Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: cognominal/codeview
base: e6c6bf1a97
...
head fork: cognominal/codeview
compare: 414d69e7fe
Checking mergeability… Don't worry, you can still create the pull request.
  • 2 commits
  • 12 files changed
  • 0 commit comments
  • 1 contributor
View
15 Makefile
@@ -1,15 +1,16 @@
-all:
+all:
coffee -o js/ -c src/
- perl6 bin/jsonParseTree data/package.json > data/parsed.json
- docdown --markdown README.md
+ docdown --markdown README.md
npm install .
+# perl6 bin/jsonParseTree data/package.json > data/parsed.json
-# what about the Perl part?
-install:
+
+# what about installing the Perl part?
+install:
npm install -g .
clean:
-# remove generated file that are part of the depot
+# remove generated files that are part of the depot
realclean:
- rm js/hilite.js README.html
+ rm js/liteViewport.js README.html
View
5 TBD
@@ -8,6 +8,11 @@ Recurrent but important ones tend to be in the bottom
## First some random ideas, that are neither yet thought out or prioritized
+There is probably much overlap between zbrew goals and Cloud 9.
+zbrew edge maybe the upcoming support of ST2 liek API.
+
+http://arstechnica.com/information-technology/2012/06/cloud-9-browser-based-development-environment-gets-tricked-out/
+
zbrew works with a json presentation of the parse tree, we
need to think the relation with the AST too.
Just noted --node options in coffeescript. Seem very close to what I need.
View
65 css/jquery.mCustomScrollbar.css
@@ -0,0 +1,65 @@
+@charset "utf-8";
+/* CSS Document */
+/* some custom fonts via google font api */
+@import url(http://fonts.googleapis.com/css?family=Lobster);
+@import url(http://fonts.googleapis.com/css?family=Yanone+Kaffeesatz:extralight);
+/* content block 1 */
+#mcs_container{position:relative; top:140px; margin:0 0 0 40px; width:260px; height:600px; padding:0 10px; border-top:1px solid #333; border-bottom:1px solid #333;}
+#mcs_container .customScrollBox{position:relative; height:100%; overflow:hidden;}
+#mcs_container .customScrollBox .container{position:relative; width:240px; top:0; float:left;}
+#mcs_container .customScrollBox .content{clear:both;}
+#mcs_container .customScrollBox .content p{padding:0 5px; margin:10px 0; color:#fff; font-family:Verdana, Geneva, sans-serif; font-size:13px; line-height:20px;}
+#mcs_container .customScrollBox .content p.alt{padding:10px 5px; margin:10px 0; color:#fff; font-family:Georgia, "Times New Roman", Times, serif; font-size:17px; line-height:19px; color:#999;}
+#mcs_container .customScrollBox img{border:5px solid #fff;}
+#mcs_container .dragger_container{position:relative; width:2px; height:525px; float:left; margin:40px 0 0 10px; background:#000; cursor:pointer -moz-border-radius:2px; -khtml-border-radius:2px; -webkit-border-radius:2px; border-radius:2px; cursor:s-resize;}
+#mcs_container .dragger{position:absolute; width:2px; height:60px; background:#999; text-align:center; line-height:60px; color:#666; overflow:hidden; cursor:pointer; -moz-border-radius:2px; -khtml-border-radius:2px; -webkit-border-radius:2px; border-radius:2px;}
+#mcs_container .dragger_pressed{position:absolute; width:4px; margin-left:-1px; height:60px; background:#999; text-align:center; line-height:60px; color:#666; overflow:hidden; -moz-border-radius:4px; -khtml-border-radius:4px; -webkit-border-radius:4px; border-radius:4px; cursor:s-resize;}
+#mcs_container .scrollUpBtn,#mcs_container .scrollDownBtn{position:absolute; display:inline-block; width:14px; height:15px; margin-right:12px; text-decoration:none; right:0; filter:alpha(opacity=20); -moz-opacity:0.20; -khtml-opacity:0.20; opacity:0.20;}
+#mcs_container .scrollUpBtn{top:16px; background:url(mcs_btnUp.png) center center no-repeat;}
+#mcs_container .scrollDownBtn{bottom:12px; background:url(mcs_btnDown.png) center center no-repeat;}
+#mcs_container .scrollUpBtn:hover,#mcs_container .scrollDownBtn:hover{filter:alpha(opacity=60); -moz-opacity:0.60; -khtml-opacity:0.60; opacity:0.60;}
+/* content block 2 */
+#mcs2_container{position:absolute; left:340px; top:20px; margin:0; width:260px; height:500px; padding:0 10px; border-top:1px dashed #999; border-bottom:1px dashed #999;}
+#mcs2_container .customScrollBox{position:relative; height:100%; overflow:hidden;}
+#mcs2_container .customScrollBox .container{position:relative; width:240px; top:0; float:left;}
+#mcs2_container .customScrollBox .content{clear:both;}
+#mcs2_container .customScrollBox .content p{padding:10px 5px; margin:10px 0; color:#fff; font-family:Verdana, Geneva, sans-serif; font-size:13px; line-height:20px;}
+#mcs2_container .customScrollBox .content p.alt{padding:10px 5px; margin:10px 0; color:#fff; font-family:Georgia, "Times New Roman", Times, serif; font-size:17px; line-height:19px; color:#999;}
+#mcs2_container .customScrollBox img{border:5px solid #fff;}
+#mcs2_container .dragger_container{position:relative; width:9px; height:480px; float:left; margin:10px 0 0 10px; cursor:pointer; box-shadow:inset 0 0 10px #000; -moz-box-shadow:inset 0 0 10px #000; -webkit-box-shadow:inset 0 0 10px #000;}
+#mcs2_container .dragger{position:absolute; width:6px; height:60px; background:#333; text-align:center; margin-left:1px; line-height:60px; color:#666; overflow:hidden; border-left:1px solid #787878; border-right:1px solid #000; cursor:pointer;}
+#mcs2_container .dragger_pressed{position:absolute; width:6px; height:60px; background:#444; text-align:center; margin-left:1px; line-height:60px; color:#777; overflow:hidden; border-left:1px solid #878787; border-right:1px solid #000; cursor:pointer;}
+/* content block 3 */
+#mcs3_container{position:absolute; left:640px; top:20px; margin:0; width:280px; height:96%; padding:0 10px; border-bottom:1px solid #666; -moz-border-radius:4px; -khtml-border-radius:4px; -webkit-border-radius:4px; border-radius:4px; background:#6D5843; box-shadow:inset 0 0 20px #000; -moz-box-shadow:inset 0 0 20px #000; -webkit-box-shadow:inset 0 0 20px #000;}
+#mcs3_container .customScrollBox{position:relative; height:100%; overflow:hidden;}
+#mcs3_container .customScrollBox .container{position:relative; width:240px; top:0; float:left;}
+#mcs3_container .customScrollBox .content{clear:both;}
+#mcs3_container .customScrollBox .content p{padding:10px 5px 10px 15px; margin:0; color:#31231E; font-family:Verdana, Geneva, sans-serif; font-size:13px; line-height:20px;}
+#mcs3_container .customScrollBox img{border:3px solid #31231E; margin:0 0 0 15px;}
+#mcs3_container .dragger_container{position:relative; width:0px; height:33%; float:left; margin:35px 0 0 25px; border-left:1px solid #31231E; border-right:1px solid #8E7757; cursor:pointer}
+#mcs3_container .dragger{position:absolute; width:9px; height:60px; background:#31231E; margin-left:-5px; overflow:hidden; cursor:pointer; -moz-border-radius:6px; -khtml-border-radius:6px; -webkit-border-radius:6px; border-radius:6px;}
+#mcs3_container .dragger_pressed{position:absolute; width:9px; height:60px; background:#31231E; margin-left:-5px; overflow:hidden; cursor:pointer; -moz-border-radius:6px; -khtml-border-radius:6px; -webkit-border-radius:6px; border-radius:6px;}
+/* content block 4 */
+#mcs4_container{position:absolute; left:340px; top:540px; margin:0; width:260px; height:200px; padding:0 10px; border:1px dotted #09C; -moz-border-radius:4px; -khtml-border-radius:4px; -webkit-border-radius:4px; border-radius:4px;}
+#mcs4_container .customScrollBox{position:relative; height:100%; overflow:hidden;}
+#mcs4_container .customScrollBox .container{position:relative; width:240px; top:0; float:left;}
+#mcs4_container .customScrollBox .content{clear:both;}
+#mcs4_container .customScrollBox .content p{padding:10px 5px; margin:10px 0; color:#09C; font-family:Verdana, Geneva, sans-serif; font-size:13px; line-height:20px;}
+#mcs4_container .dragger_container{position:relative; width:0px; height:180px; float:left; margin:10px 0 0 10px; border-left:1px dotted #555; cursor:pointer;}
+#mcs4_container .dragger{position:absolute; width:9px; height:9px; background:#555; margin-left:-5px; text-align:center; overflow:hidden; cursor:pointer; -moz-border-radius:18px; -khtml-border-radius:18px; -webkit-border-radius:18px; border-radius:18px;}
+#mcs4_container .dragger_pressed{position:absolute; width:9px; height:9px; background:#09C; margin-left:-5px; overflow:hidden; cursor:s-resize;}
+/* content block 5 */
+#mcs5_container{margin:0; width:100%; border-bottom:1px dashed #007EC5;}
+#mcs5_container .customScrollBox{position:relative; width:100%; overflow:hidden;}
+#mcs5_container .customScrollBox .horWrapper{position:relative; left:0;}
+#mcs5_container .customScrollBox .container{position:relative; left:0; display:inline-block; *display:inline;}
+#mcs5_container .customScrollBox .content{clear:both;}
+#mcs5_container .customScrollBox .content p{padding:5px; margin:0 5px;}
+#mcs5_container .customScrollBox .content p img{margin-right:5px;}
+#mcs5_container .dragger_container{position:relative; height:0px; width:300px; margin:10px auto; border-top:1px dashed #C30;}
+#mcs5_container .dragger{position:absolute; width:60px; height:9px; background:#EEE url(images/slider/mcsDragger.png) no-repeat; margin-top:-5px;}
+#mcs5_container .dragger_pressed{position:absolute; width:60px; height:9px; background:#007EC5 url(images/slider/mcsDraggerHover.png) no-repeat; margin-top:-5px;}
+#mcs5_container .scrollUpBtn,#mcs5_container .scrollDownBtn{position:absolute; top:0; display:inline-block; font-family:Arial,Helvetica,sans-serif; font-size:large; font-weight:normal; color:#C30; margin:8px 5px 0 10px; text-decoration:none;}
+#mcs5_container .scrollDownBtn{right:10px;}
+#mcs5_container .scrollUpBtn{right:50px;}
+#mcs5_container .scrollUpBtn:hover,#mcs5_container .scrollDownBtn:hover{color:#fff;}
View
45 css/zbrew.css
@@ -1,14 +1,8 @@
-#parse-crumbs {
+.parse-path {
border-width : 4px;
min-height : 15ex;
overflow: scroll;
- position: fixed;
- z-index: 100;
- min-height: 3ex;
- min-width: 490px;
left: 40px; right: 40px; top: 0px;
- padding-left: 252px;
- background: #eee;
background: -webkit-gradient(linear, left top, left bottom, from(#f8f8f8), to(#dadada));
background: -moz-linear-gradient(top, #f8f8f8, #dadada);
border: 1px solid #aaa;
@@ -20,13 +14,9 @@
box-shadow: 0 3px 5px rgba(0,0,0,0.1);
}
-.opr {
- color: #ff0000
-}
-
-.opd :not(.opr) {
- color: #0000ff
-}
+.opr { color: #ff0000 }
+.opd :not(.opr) { color: #0000ff }
+.current-item { background-color : #FF8; }
#offset-content {
height: 100px;
@@ -36,12 +26,12 @@
padding: 4px;
}
-li.parse-subcrumb:hover {
+.parsePathSubcomponent:hover {
/* padding: 4px;*/
background-color : #BBB
}
-li.parse-subcrumb {
+.parsePathSubcomponent {
display: block;
}
@@ -56,27 +46,19 @@ li.parse-subcrumb {
padding: 5px;
}
-.colored {
- background-color : #FF8;
-}
-
-.code-string {
- color: blue;
-}
-
#tooltip {
- position: absolute;
- z-index: 3000;
- border: 1px solid #111;
- background-color: #eee;
- padding: 5px;
- opacity: 0.85;
+ position: absolute;
+ z-index: 3000;
+ border: 1px solid #111;
+ background-color: #eee;
+ padding: 5px;
+ opacity: 0.85;
}
#tooltip h3, #tooltip div { margin: 0; }
/* Borrowed from docco */
/*--------------------- Layout and Typography ----------------------------*/
-body {
+body { /* probably need to select further */
font-family: 'Palatino Linotype', 'Book Antiqua', Palatino, FreeSerif, serif;
font-size: 15px;
line-height: 22px;
@@ -262,4 +244,3 @@ body .docco-vg { color: #19469D } /* Name.Variable.Global */
body .docco-vi { color: #19469D } /* Name.Variable.Instance */
body .docco-il { color: #666666 } /* Literal.Number.Integer.Long */
-
View
8 i.html
@@ -4,14 +4,10 @@
<link rel="stylesheet" type="text/css" href="css/zbrew.css"/>
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/jquery.mobile-1.1.0.js"></script>
+<script type="text/javascript" src="js/jquery.easing.1.3.js"></script>
<script type="text/javascript" src="js/hilite.js"></script>
</head>
<body>
- <div id="offset-content"></div>
- <div id="current-rule"></div>
- <div id="parse-crumbs"></div>
- <div style="display:none;">breadcrumbs: rule stack from top to reduce current selection</div>
- <pre class="code-top"></pre>
-
+ <div id="viewport">
</body>
</html>
View
233 js/LiteViewport.js
@@ -0,0 +1,233 @@
+// Generated by CoffeeScript 1.3.3
+(function() {
+
+ $(function() {
+ var MarkupForLiteViewport, ViewportPaneId, cloneLiteViewport, dehilite, dynamicHiliteP, generateLitePortview, hilite, insertParseTree, j, liteId, ruleElt, ruleNm, showParsePath, showRule, _i, _len, _ref, _results;
+ dynamicHiliteP = true;
+ MarkupForLiteViewport = function(idSuffix) {
+ var idAndClass;
+ idSuffix = escape(idSuffix);
+ idAndClass = function(prefix) {
+ return "id=${prefix+'-'+idSuffix} class=${prefix}";
+ };
+ return "<div " + (idAndClass('liteViewport')) + ">\n <div " + (idAndClass('ruleSummaryPane')) + "\n <div id=\"mcs_container\">\n <div class=\"customScrollBox\">\n <div class=\"horWrapper\">\n <div class=\"container\">\n <div " + (idAndClass('parsePathPane')) + "/>\n </div>\n <div class=\"dragger_container\">\n <div class=\"dragger\"></div>\n </div>\n </div>\n </div>\n </div>\n <div " + (idAndClass('currentRulePane')) + " />\n <div id=\"codePane" + id + "/>\n</div>";
+ };
+ cloneLiteViewport = function(topElt, suffix, dest) {
+ var html, re;
+ html = topElt.html;
+ re = "(ruleSummaryPane|currentRulePane|parsePathPane|codePane|)-(" + suffix + ")";
+ html.replace(re, (function() {
+ return "" + $0 + "-" + $1 + "0";
+ }), 'g');
+ return to.html(html);
+ };
+ $(".code").live('vmouseover', function(ev) {
+ if (!dynamicHyliteP) {
+ return;
+ }
+ ev.stopPropagation();
+ return hilite(ev);
+ });
+ ViewportPaneId = function(elt, paneNm) {
+ var id, re, suffix;
+ id = $(elt).parents().filter(".liteViewport").attr('id')[0];
+ re = /-(\w)$/;
+ re.exec(id);
+ if (!match.length) {
+ alert;
+
+ }
+ suffix = match[0];
+ console.log(idNr);
+ return "#" + (componentNm + '-' + suffix);
+ };
+ liteId = function(elt) {
+ return VieportComponentId(elt, 'liteViewport');
+ };
+ $(".parsePathComponent").live('vmouseover', function(ev) {
+ var bread_components_on_hove, elt, id, lid;
+ elt = ev.currentTarget;
+ lid = liteId(elt);
+ $("" + lid + " .code").removeClass("editing");
+ bread_components_on_hove = 0;
+ $(".code").removeClass("currentItem");
+ $(".parse-subcomponent").removeClass("currentItem");
+ elt = ev.currentTarget;
+ id = elt.id;
+ $(elt).addClass("currentItem");
+ console.log("" + (id.substring(5)) + " " + id);
+ showRule($(elt).text());
+ return $('#' + id.substring(5)).addClass("currentItem");
+ });
+ ruleNm = function(elt) {
+ var classNm, m, _i, _len, _ref;
+ _ref = elt.className.split(' ');
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
+ classNm = _ref[_i];
+ m = /^rule-(.*)/.exec(classNm);
+ if (m != null) {
+ return m[1];
+ }
+ }
+ return '';
+ };
+ ruleElt = function(portviewId) {
+ return $("" + portviewId + " > .currentRule")[0];
+ };
+ showRule = function(portviewId, ruleNm) {
+ var rules;
+ rules = JSON.parse(ruleElt.attr('data'));
+ if (rules[ruleNm]) {
+ return ruleElt(litePortviewId).text(rules[ruleNm]);
+ }
+ };
+ hilite = function(ev) {
+ var dad, elt, lid, rule, unnamedP;
+ elt = ev.currentTarget;
+ lid = liteId(elt);
+ dehilite(lid);
+ showParsePath(elt, lid);
+ dad = elt.parentNode;
+ if (rule = ruleNm(dad)) {
+ showRule(rule);
+ }
+ $(dad).addClass('opd');
+ unnamedP = function(i) {
+ return !$(this).hasClass('named');
+ };
+ if (unnamedP(elt)) {
+ return $(dad).children().filter(unnamedP).addClass('opr');
+ }
+ };
+ dehilite = function(lid) {
+ var klass, _i, _len, _ref, _results;
+ _ref = ['opd', 'opr', 'editing'];
+ _results = [];
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
+ klass = _ref[_i];
+ _results.push($("" + lid + " ." + klass).removeClass(klass));
+ }
+ return _results;
+ };
+ showParsePath = function(elt) {
+ var AddToPath, ParsePathElt, component, componentHtml, components, subcomponent, text, _i, _j, _len, _len1, _ref, _results;
+ $("${lid} .code").removeClass("currentItem");
+ components = [];
+ AddToPath = function(elt, sameText) {
+ var bundle, obj;
+ if (sameText == null) {
+ sameText = false;
+ }
+ obj = {
+ cnm: ruleNm(elt),
+ id: elt.id,
+ text: $(elt).text()
+ };
+ if (sameText) {
+ return bundle = components[components.length - 1].push(obj);
+ } else {
+ return components.unshift([obj]);
+ }
+ };
+ AddToPath(elt);
+ text = $(elt).text();
+ while ($(elt.parentNode).hasClass('code')) {
+ elt = elt.parentNode;
+ AddToPath(elt, text === $(elt).text());
+ }
+ ParsePathElt = $(".parse-path");
+ ParsePathElt.html("<table><tr></tr></table>");
+ _results = [];
+ for (_i = 0, _len = components.length; _i < _len; _i++) {
+ component = components[_i];
+ componentHtml = '';
+ _ref = component.reverse();
+ for (_j = 0, _len1 = _ref.length; _j < _len1; _j++) {
+ subcomponent = _ref[_j];
+ componentHtml += "<div class='parse-subcomponent' id='component" + subcomponent.id + "'>" + subcomponent.cnm + "</div>";
+ }
+ _results.push(ParsePathElt.append($("<td class='parse-component'>" + componentHtml + "</td>")));
+ }
+ return _results;
+ };
+ insertParseTree = function(elt, data, id, prefix) {
+ var appendElt, docco, insertSubtree, parseTree;
+ if (id == null) {
+ id = 0;
+ }
+ if (prefix == null) {
+ prefix = '';
+ }
+ appendElt = function(elt, s, klass) {
+ var d, e;
+ elt.append('<span>');
+ e = $(elt[0].lastChild);
+ if (s) {
+ e.text(s);
+ }
+ if (klass) {
+ if (d = docco[klass]) {
+ e.addClass('docco-' + d);
+ }
+ e.addClass('rule-' + klass);
+ e.addClass('named');
+ }
+ e.attr('id', prefix + id++);
+ e.addClass('code');
+ return e;
+ };
+ insertSubtree = function(elt, subtree) {
+ var k, obj, v, _results;
+ _results = [];
+ for (k in subtree) {
+ v = subtree[k];
+ elt = appendElt(elt, null, k);
+ _results.push((function() {
+ var _i, _len, _results1;
+ _results1 = [];
+ for (_i = 0, _len = v.length; _i < _len; _i++) {
+ obj = v[_i];
+ if ($.type(obj) === "string") {
+ _results1.push(appendElt(elt, obj));
+ } else {
+ _results1.push(insertSubtree(elt, obj, id));
+ }
+ }
+ return _results1;
+ })());
+ }
+ return _results;
+ };
+ parseTree = data.parseTree;
+ docco = data.docco;
+ return insertSubtree(elt, parseTree);
+ };
+ generateLitePortview = function(elt, data, id, prefix) {
+ if (id == null) {
+ id = 0;
+ }
+ if (prefix == null) {
+ prefix = '';
+ }
+ insertParseTree(elt, data);
+ return $(".currentRule").attr('data', JSON.stringify(data.rules));
+ };
+ _ref = ['parsed', 'dh'];
+ _results = [];
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
+ j = _ref[_i];
+ _results.push($.getJSON("data/" + j + ".json", function(data) {
+ var elt, m;
+ m = MarkupForLiteViewport(j);
+ $('#viewport').append(m);
+ elt = $()[0];
+ if (!elt) {
+ alert("can't find liteViewport element");
+ }
+ return generateLitePortview(elt, eltId, data);
+ }));
+ }
+ return _results;
+ });
+
+}).call(this);
View
205 js/jquery.easing.1.3.js
@@ -0,0 +1,205 @@
+/*
+ * jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/
+ *
+ * Uses the built in easing capabilities added In jQuery 1.1
+ * to offer multiple easing options
+ *
+ * TERMS OF USE - jQuery Easing
+ *
+ * Open source under the BSD License.
+ *
+ * Copyright © 2008 George McGinley Smith
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this list of
+ * conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright notice, this list
+ * of conditions and the following disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * Neither the name of the author nor the names of contributors may be used to endorse
+ * or promote products derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+*/
+
+// t: current time, b: begInnIng value, c: change In value, d: duration
+jQuery.easing['jswing'] = jQuery.easing['swing'];
+
+jQuery.extend( jQuery.easing,
+{
+ def: 'easeOutQuad',
+ swing: function (x, t, b, c, d) {
+ //alert(jQuery.easing.default);
+ return jQuery.easing[jQuery.easing.def](x, t, b, c, d);
+ },
+ easeInQuad: function (x, t, b, c, d) {
+ return c*(t/=d)*t + b;
+ },
+ easeOutQuad: function (x, t, b, c, d) {
+ return -c *(t/=d)*(t-2) + b;
+ },
+ easeInOutQuad: function (x, t, b, c, d) {
+ if ((t/=d/2) < 1) return c/2*t*t + b;
+ return -c/2 * ((--t)*(t-2) - 1) + b;
+ },
+ easeInCubic: function (x, t, b, c, d) {
+ return c*(t/=d)*t*t + b;
+ },
+ easeOutCubic: function (x, t, b, c, d) {
+ return c*((t=t/d-1)*t*t + 1) + b;
+ },
+ easeInOutCubic: function (x, t, b, c, d) {
+ if ((t/=d/2) < 1) return c/2*t*t*t + b;
+ return c/2*((t-=2)*t*t + 2) + b;
+ },
+ easeInQuart: function (x, t, b, c, d) {
+ return c*(t/=d)*t*t*t + b;
+ },
+ easeOutQuart: function (x, t, b, c, d) {
+ return -c * ((t=t/d-1)*t*t*t - 1) + b;
+ },
+ easeInOutQuart: function (x, t, b, c, d) {
+ if ((t/=d/2) < 1) return c/2*t*t*t*t + b;
+ return -c/2 * ((t-=2)*t*t*t - 2) + b;
+ },
+ easeInQuint: function (x, t, b, c, d) {
+ return c*(t/=d)*t*t*t*t + b;
+ },
+ easeOutQuint: function (x, t, b, c, d) {
+ return c*((t=t/d-1)*t*t*t*t + 1) + b;
+ },
+ easeInOutQuint: function (x, t, b, c, d) {
+ if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b;
+ return c/2*((t-=2)*t*t*t*t + 2) + b;
+ },
+ easeInSine: function (x, t, b, c, d) {
+ return -c * Math.cos(t/d * (Math.PI/2)) + c + b;
+ },
+ easeOutSine: function (x, t, b, c, d) {
+ return c * Math.sin(t/d * (Math.PI/2)) + b;
+ },
+ easeInOutSine: function (x, t, b, c, d) {
+ return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b;
+ },
+ easeInExpo: function (x, t, b, c, d) {
+ return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b;
+ },
+ easeOutExpo: function (x, t, b, c, d) {
+ return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b;
+ },
+ easeInOutExpo: function (x, t, b, c, d) {
+ if (t==0) return b;
+ if (t==d) return b+c;
+ if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b;
+ return c/2 * (-Math.pow(2, -10 * --t) + 2) + b;
+ },
+ easeInCirc: function (x, t, b, c, d) {
+ return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b;
+ },
+ easeOutCirc: function (x, t, b, c, d) {
+ return c * Math.sqrt(1 - (t=t/d-1)*t) + b;
+ },
+ easeInOutCirc: function (x, t, b, c, d) {
+ if ((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b;
+ return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b;
+ },
+ easeInElastic: function (x, t, b, c, d) {
+ var s=1.70158;var p=0;var a=c;
+ if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3;
+ if (a < Math.abs(c)) { a=c; var s=p/4; }
+ else var s = p/(2*Math.PI) * Math.asin (c/a);
+ return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
+ },
+ easeOutElastic: function (x, t, b, c, d) {
+ var s=1.70158;var p=0;var a=c;
+ if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3;
+ if (a < Math.abs(c)) { a=c; var s=p/4; }
+ else var s = p/(2*Math.PI) * Math.asin (c/a);
+ return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b;
+ },
+ easeInOutElastic: function (x, t, b, c, d) {
+ var s=1.70158;var p=0;var a=c;
+ if (t==0) return b; if ((t/=d/2)==2) return b+c; if (!p) p=d*(.3*1.5);
+ if (a < Math.abs(c)) { a=c; var s=p/4; }
+ else var s = p/(2*Math.PI) * Math.asin (c/a);
+ if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
+ return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b;
+ },
+ easeInBack: function (x, t, b, c, d, s) {
+ if (s == undefined) s = 1.70158;
+ return c*(t/=d)*t*((s+1)*t - s) + b;
+ },
+ easeOutBack: function (x, t, b, c, d, s) {
+ if (s == undefined) s = 1.70158;
+ return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b;
+ },
+ easeInOutBack: function (x, t, b, c, d, s) {
+ if (s == undefined) s = 1.70158;
+ if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b;
+ return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b;
+ },
+ easeInBounce: function (x, t, b, c, d) {
+ return c - jQuery.easing.easeOutBounce (x, d-t, 0, c, d) + b;
+ },
+ easeOutBounce: function (x, t, b, c, d) {
+ if ((t/=d) < (1/2.75)) {
+ return c*(7.5625*t*t) + b;
+ } else if (t < (2/2.75)) {
+ return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b;
+ } else if (t < (2.5/2.75)) {
+ return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b;
+ } else {
+ return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b;
+ }
+ },
+ easeInOutBounce: function (x, t, b, c, d) {
+ if (t < d/2) return jQuery.easing.easeInBounce (x, t*2, 0, c, d) * .5 + b;
+ return jQuery.easing.easeOutBounce (x, t*2-d, 0, c, d) * .5 + c*.5 + b;
+ }
+});
+
+/*
+ *
+ * TERMS OF USE - EASING EQUATIONS
+ *
+ * Open source under the BSD License.
+ *
+ * Copyright © 2001 Robert Penner
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this list of
+ * conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright notice, this list
+ * of conditions and the following disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * Neither the name of the author nor the names of contributors may be used to endorse
+ * or promote products derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
View
284 p6.text
@@ -0,0 +1,284 @@
+= La place de Perl dans l'univers :)
+
+42 ou 666?
+
+[le Web pourrait] etre une sphère infinie dont le centre est partout, la circonférence nulle part. (adapté de Pascal)
+
+Individuation et grammatisation : quand la technique fait sens... (Bernard Stiegler)
+
+= hommes XXième siècle
+
+- Edward Bernays (manufacture du consentement)
+-- manipulation de la démocratie, sufragettes fumeuse 1928
+- Henry Ford (les produits du capitalisme pour tous)
+ -Norman Borlaug (Révolution Verte - Fondations Rockfeller/Ford)
+-- mais Armatyan Sen : distribution > production
+- Turing/Shannon/Neuman/Gordon Moore/Vint Cerf/Tim Berners Lee
+
+Bell Labs (transistor, laser, Unix, C/C++)
+
+Et le XXIième?
+
+- Craig Venter
+
+= Histoire du capitalisme industriel
+
+-énergie pas chère exploitée par les machines
+
+- première révolution industrielle
+-- quasi esclavage des ex-paysans
+--... au service d'une minorité bourgeoise
+- seconde révolution industrielle
+-- Taylorisme
+-- la Ford T vendue aux ouvriers qui la construisent
+-- démocratisation de la machine à laver
+-- plan Marshall et American Way of life en Europe
+-- géostratégie du pétrole
+
+= histoire du capitalisme (suite)
+
+- cancer Bernaysien
+-- captation de l'attention par les mass media
+--- assymétrie des média
+--- financé par la publicité
+
+= Histoire du capitalisme depuis 1970
+
+-- pipeau de la société post-industrielle
+--confiscation de la richesse par une minorité
+-- pic pétrolier per capita passé
+--bulle de l'éducation
+--échec de l'informatisation de l'éducation
+--- la question du hardware est mineure
+--- mais l'iPad est cool
+
+= Repenser le capitalisme
+
+- Réponse de Stiegler : repenser le capitalisme
+-- media réticulaire et économie de la contribution
+-- Internet
+-- l'amateur est créatif car il se fout des silos des professionnels
+
+mais aussi
+
+- la génomique et les cellules synthétiques
+- progrès du séquencage : vite que la loi de Moore
+-- industrie biologique plutot que physico-chimique.
+
+= la place de Perl là dedans?
+
+-penser la "digital littéracy".
+
+création d'un média lettré réticulaire, et économie de la contribution
+en résistance au despotisme, voire du cancer Bernaysien
+
+-Avantage de Perl : concu par un linguiste
+-Multiplication future des slangs
+-Mais nécessité de s'adapter au web.
+
+= Lecture
+
+- Propaganda (Bernays 1908)
+- Manufacturing of Consent (Chomsky 1989)
+- Debt : 5000 the first years (Graeber 2011)
+- The Shock Doctrine (Naomy Klein) 2007
+- Le site Ars Industrialis
+- et les bouquins de Bernard Stiegler (mais inégaux)
+
+= lectures techniques
+
+- 6model (blog de jnthn)
+
+Notion de type
+
+- Real World Haskell
+- Type and programming languages
+- les papiers de Wadler
+
+= Perl : passé, présent, futur
+
+= Larry Wall
+=* concepteur et implémenteur de Perl
+
+- mais aussi
+-- de rn, lecteur de news usenet
+-- de patch, la contrepartie de diff
+-- le concepteur de Perl 6
+
+- TIMTOWTDI => TimToady
+
+= Perl 5
+
+- emphase sur la rétrocompatibilité
+- vivant, release importante annuelle
+- backport de fonctionalités de Perl 6
+- avantages de CPAN
+- difficultés de choix dans CPAN (le danger de TIMTOWTDI)
+- monstruosité des dépendances CPAN
+- partie intégrante de UNIX
+- REPL
+
+= Perl 5 et la linguistique
+
+- huffmanization
+-- le pronom universel $_
+-- TIMTOWTDI
+- contexte
+
+= Principe Généraux
+
+- Whirlpool par opposition à la conception en cascade
+- feedback en cercle concentrique
+- ni une religion/ni un business
+-- Comparer avec la programmation Agile
+--- en C++ !
+
+= Releases
+
+- 1.0 déc. 87
+- 2.0 juin 88 meilleures regexps, variables locales
+- 3.0 oct. 89 données binaires. pack/unpack, ioctl...
+- 4.0 mars 91 marketting "programming Perl"
+- 5.0 variables lexicales, pod et perldoc
+
+= originalité de Perl 1-5
+
+- un awk gonflés aux hormones
+- accès aux appel système
+- un condensé d'Unix dans un seul exécutable
+- opposé des approches traditionnelles
+-- programmation en C
+--- gestion manuelle de la mémoire
+-- programmation en shell
+--- inconvénient : cout des pipe et forks
+- les sigils
+
+= la concurrence traditionnelle
+=* les "batards" de Perl
+
+- langages "dynamiques"
+-- Python (1990)
+-- Ruby (1995)
+-- PHP
+
+= Mais bien d'autres
+
+-haskell : fonctionnel, statiquement typé
+-les enfants de Java
+-- Java le language est une merde
+-- mais le VM est cool
+-- Scalar, Groovy, Clojure
+
+= New kid on the block
+
+- Node.js
+- basé sur V8 de
+- toutes les librairies sont asynchrones
+- coffeescript
+- iced coffeescript
+
+
+== Perl et le web
+==* opportunités manquées
+
+- 1991 première édition de Programming Perl
+- Tim O'reilly propose un chapitre sur le web
+- Larry refuse de spécialiser Perl sur une niche
+
+== internet Web et le cloud
+
+-une décentralisation
+-une centralisation
+- mais des trucs cool au niveau OS
+-- Heroku, Joyent (SmartOS: Zfs, Zones, Dtrace)
+
+= IDE et collaboration sur le web
+
+- irc/ mail lists
+- Github
+- Cloud9
+-Komodo?
+
+= Perl et le web
+=* opportunités saisies
+
+- Komodo par ActiveState 1997
+- Dancer un clone de Sinatra
+- Spore: Specifications to a Portable REST Environment
+
+= Perl 6, une spec et des implantations
+
+- les synopsis sont la spec
+- il y aura plusieurs implémentations
+- le jeu de test est le critère de conformité
+
+= Perl 6 aujourdh'hui
+
+-Machine Parrot
+-Compilateur Rakudo
+-Découplage de Rakudo par rapport à parrot
+- Portage de Rakudo
+
+= Les distributions Perl 6
+
+- basées sur rakudo
+-- rakudo : le compilateur
+-- rakudo star :
+--- le compilateur plus des bibliothèques
+
+
+= les bibliothèques Perl 6
+
+= les dépots github Perl 6
+
+- specs : les synopsys
+- pugs : divers trucs, dont historique
+- parrot : parrot, le vm
+- nqp : not quite perl
+- rakudo
+
+= parrot/nqp/rakudo
+
+- Parrot est le VM
+- NQP : Not Quite Perl
+
+= la paresse
+
+- les listes sont paresseuses
+
+TBD : Expandre les points essentiels de la présentation de pmichaud
+
+= 6model
+
+-interface avec les implémentation de types
+-interface avec les implémentations d'objet
+
+= blizkost/zavolaj
+
+- zavolaj : Interface avec les bibliothèques C
+- blizkost : Embedding de Perl 5 dans Perl 6
+
+= Autres projets de compilateur Perl 6
+
+- Perl 6 sur .net
+- Perlito
+- ...
+
+= Pod
+
+Une nouvelle version de Pod
+
+= Perl 6, information éclatée
+
+Un visionnaire mais pas de direction de projet
+
+- mailing lists
+- irc
+- github
+- blogs divers
+- gestion de bugs:
+-- Parrot : ???
+-- Rakudo: Request Tracker
+
+
+
View
284 p6.txt
@@ -0,0 +1,284 @@
+= La place de Perl dans l'univers :)
+
+42 ou 666?
+
+[le Web pourrait] etre une sphère infinie dont le centre est partout, la circonférence nulle part. (adapté de Pascal)
+
+Individuation et grammatisation : quand la technique fait sens... (Bernard Stiegler)
+
+= hommes XXième siècle
+
+- Edward Bernays (manufacture du consentement)
+-- manipulation de la démocratie, sufragettes fumeuse 1928
+- Henry Ford (les produits du capitalisme pour tous)
+ -Norman Borlaug (Révolution Verte - Fondations Rockfeller/Ford)
+-- mais Armatyan Sen : distribution > production
+- Turing/Shannon/Neuman/Gordon Moore/Vint Cerf/Tim Berners Lee
+
+Bell Labs (transistor, laser, Unix, C/C++)
+
+Et le XXIième?
+
+- Craig Venter
+
+= Histoire du capitalisme industriel
+
+-énergie pas chère exploitée par les machines
+
+- première révolution industrielle
+-- quasi esclavage des ex-paysans
+--... au service d'une minorité bourgeoise
+- seconde révolution industrielle
+-- Taylorisme
+-- la Ford T vendue aux ouvriers qui la construisent
+-- démocratisation de la machine à laver
+-- plan Marshall et American Way of life en Europe
+-- géostratégie du pétrole
+
+= histoire du capitalisme (suite)
+
+- cancer Bernaysien
+-- captation de l'attention par les mass media
+--- assymétrie des média
+--- financé par la publicité
+
+= Histoire du capitalisme depuis 1970
+
+-- pipeau de la société post-industrielle
+--confiscation de la richesse par une minorité
+-- pic pétrolier per capita passé
+--bulle de l'éducation
+--échec de l'informatisation de l'éducation
+--- la question du hardware est mineure
+--- mais l'iPad est cool
+
+= Repenser le capitalisme
+
+- Réponse de Stiegler : repenser le capitalisme
+-- media réticulaire et économie de la contribution
+-- Internet
+-- l'amateur est créatif car il se fout des silos des professionnels
+
+mais aussi
+
+- la génomique et les cellules synthétiques
+- progrès du séquencage : vite que la loi de Moore
+-- industrie biologique plutot que physico-chimique.
+
+= la place de Perl là dedans?
+
+-penser la "digital littéracy".
+
+création d'un média lettré réticulaire, et économie de la contribution
+en résistance au despotisme, voire du cancer Bernaysien
+
+-Avantage de Perl : concu par un linguiste
+-Multiplication future des slangs
+-Mais nécessité de s'adapter au web.
+
+= Lecture
+
+- Propaganda (Bernays 1908)
+- Manufacturing of Consent (Chomsky 1989)
+- Debt : 5000 the first years (Graeber 2011)
+- The Shock Doctrine (Naomy Klein) 2007
+- Le site Ars Industrialis
+- et les bouquins de Bernard Stiegler (mais inégaux)
+
+= lectures techniques
+
+- 6model (blog de jnthn)
+
+Notion de type
+
+- Real World Haskell
+- Type and programming languages
+- les papiers de Wadler
+
+= Perl : passé, présent, futur
+
+= Larry Wall
+=* concepteur et implémenteur de Perl
+
+- mais aussi
+-- de rn, lecteur de news usenet
+-- de patch, la contrepartie de diff
+-- le concepteur de Perl 6
+
+- TIMTOWTDI => TimToady
+
+= Perl 5
+
+- emphase sur la rétrocompatibilité
+- vivant, release importante annuelle
+- backport de fonctionalités de Perl 6
+- avantages de CPAN
+- difficultés de choix dans CPAN (le danger de TIMTOWTDI)
+- monstruosité des dépendances CPAN
+- partie intégrante de UNIX
+- REPL
+
+= Perl 5 et la linguistique
+
+- huffmanization
+-- le pronom universel $_
+-- TIMTOWTDI
+- contexte
+
+= Principe Généraux
+
+- Whirlpool par opposition à la conception en cascade
+- feedback en cercle concentrique
+- ni une religion/ni un business
+-- Comparer avec la programmation Agile
+--- en C++ !
+
+= Releases
+
+- 1.0 déc. 87
+- 2.0 juin 88 meilleures regexps, variables locales
+- 3.0 oct. 89 données binaires. pack/unpack, ioctl...
+- 4.0 mars 91 marketting "programming Perl"
+- 5.0 variables lexicales, pod et perldoc
+
+= originalité de Perl 1-5
+
+- un awk gonflés aux hormones
+- accès aux appel système
+- un condensé d'Unix dans un seul exécutable
+- opposé des approches traditionnelles
+-- programmation en C
+--- gestion manuelle de la mémoire
+-- programmation en shell
+--- inconvénient : cout des pipe et forks
+- les sigils
+
+= la concurrence traditionnelle
+=* les "batards" de Perl
+
+- langages "dynamiques"
+-- Python (1990)
+-- Ruby (1995)
+-- PHP
+
+= Mais bien d'autres
+
+-haskell : fonctionnel, statiquement typé
+-les enfants de Java
+-- Java le language est une merde
+-- mais le VM est cool
+-- Scalar, Groovy, Clojure
+
+= New kid on the block
+
+- Node.js
+- basé sur V8 de
+- toutes les librairies sont asynchrones
+- coffeescript
+- iced coffeescript
+
+
+== Perl et le web
+==* opportunités manquées
+
+- 1991 première édition de Programming Perl
+- Tim O'reilly propose un chapitre sur le web
+- Larry refuse de spécialiser Perl sur une niche
+
+== internet Web et le cloud
+
+-une décentralisation
+-une centralisation
+- mais des trucs cool au niveau OS
+-- Heroku, Joyent (SmartOS: Zfs, Zones, Dtrace)
+
+= IDE et collaboration sur le web
+
+- irc/ mail lists
+- Github
+- Cloud9
+-Komodo?
+
+= Perl et le web
+=* opportunités saisies
+
+- Komodo par ActiveState 1997
+- Dancer un clone de Sinatra
+- Spore: Specifications to a Portable REST Environment
+
+= Perl 6, une spec et des implantations
+
+- les synopsis sont la spec
+- il y aura plusieurs implémentations
+- le jeu de test est le critère de conformité
+
+= Perl 6 aujourdh'hui
+
+-Machine Parrot
+-Compilateur Rakudo
+-Découplage de Rakudo par rapport à parrot
+- Portage de Rakudo
+
+= Les distributions Perl 6
+
+- basées sur rakudo
+-- rakudo : le compilateur
+-- rakudo star :
+--- le compilateur plus des bibliothèques
+
+
+= les bibliothèques Perl 6
+
+= les dépots github Perl 6
+
+- specs : les synopsys
+- pugs : divers trucs, dont historique
+- parrot : parrot, le vm
+- nqp : not quite perl
+- rakudo
+
+= parrot/nqp/rakudo
+
+- Parrot est le VM
+- NQP : Not Quite Perl
+
+= la paresse
+
+- les listes sont paresseuses
+
+TBD : Expandre les points essentiels de la présentation de pmichaud
+
+= 6model
+
+-interface avec les implémentation de types
+-interface avec les implémentations d'objet
+
+= blizkost/zavolaj
+
+- zavolaj : Interface avec les bibliothèques C
+- blizkost : Embedding de Perl 5 dans Perl 6
+
+= Autres projets de compilateur Perl 6
+
+- Perl 6 sur .net
+- Perlito
+- ...
+
+= Pod
+
+Une nouvelle version de Pod
+
+= Perl 6, information éclatée
+
+Un visionnaire mais pas de direction de projet
+
+- mailing lists
+- irc
+- github
+- blogs divers
+- gestion de bugs:
+-- Parrot : ???
+-- Rakudo: Request Tracker
+
+
+
View
238 src/LiteViewport.coffee
@@ -0,0 +1,238 @@
+# really need to refactor to emphasize the logic, not the jquery operations
+
+# code for editing is commented out
+$ ->
+ dynamicHiliteP = true # false after first click on code/doc
+
+ # id is escaped to protect from rogue callers
+ MarkupForLiteViewport = (idSuffix) ->
+ idSuffix = escape idSuffix
+ idAndClass = (prefix) -> "id=${prefix+'-'+idSuffix} class=${prefix}"
+ """
+ <div #{ idAndClass 'liteViewport'}>
+ <div #{ idAndClass 'ruleSummaryPane'}
+ <div id="mcs_container">
+ <div class="customScrollBox">
+ <div class="horWrapper">
+ <div class="container">
+ <div #{ idAndClass 'parsePathPane'}/>
+ </div>
+ <div class="dragger_container">
+ <div class="dragger"></div>
+ </div>
+ </div>
+ </div>
+ </div>
+ <div #{ idAndClass 'currentRulePane'} />
+ <div id="codePane#{id}/>
+ </div>
+ """
+
+# placeholder
+# `topElt` is the top Element of the lite, `suffix` his suffix, and `dest`
+# the element # under which the clone will appear.
+ cloneLiteViewport = (topElt, suffix, dest) ->
+ html = topElt.html
+ re = "(ruleSummaryPane|currentRulePane|parsePathPane|codePane|)-(#{suffix})"
+ html.replace re, (-> "#{$0}-#{$1}0" ), 'g'
+ to.html html
+
+ $(".code").live 'vmouseover', (ev) ->
+ return unless dynamicHyliteP
+ ev.stopPropagation()
+ hilite ev
+
+
+
+# $(".code").live 'vclick',
+# (ev) ->
+# dynamicHiliteP = false
+# ev.stopPropagation()
+# $(".code").removeClass "editing"
+# elt = ev.currentTarget
+# $(elt).addClass "editing"
+# hilite ev
+
+
+# A viewport is constituted of pane.
+# each pane of a viewport (including the view port) has an html id of the form
+# paneName-suffix. All the panes have a unique name within a viewport.
+# The suffix is unique within a viewport
+
+# so far we have only one viewport type which liteViewPort.
+
+ # get the id of a pane named `paneNm` that is a parent of `elt`
+ ViewportPaneId = (elt, paneNm) ->
+ # get the id of the viewport to extract the unique suffix
+ id = $(elt).parents().filter(".liteViewport").attr('id')[0]
+ re = /-(\w)$/;
+ re.exec(id)
+ alert unless match.length
+ suffix = match[0]
+ console.log idNr
+ "##{componentNm+'-'+suffix}"
+
+ liteId = (elt) -> VieportComponentId elt, 'liteViewport'
+
+
+ $(".parsePathComponent").live 'vmouseover', (ev) ->
+ elt = ev.currentTarget
+ lid = liteId elt
+ $("#{lid} .code").removeClass "editing"
+ bread_components_on_hove = 0
+ $(".code").removeClass "currentItem"
+ $(".parse-subcomponent").removeClass "currentItem"
+ elt = ev.currentTarget
+ id = elt.id
+ $(elt).addClass "currentItem" # color the subcomponent
+ console.log "#{ id.substring 5} #{id}"
+ showRule $(elt).text()
+ $( '#' + id.substring 5 ).addClass "currentItem" # color the corresponding code
+
+# # need to support keymaps
+# # inhibited handler
+# $(".code").live('keydown',
+# (ev) ->
+# ev.stopPropagation()
+# if ev.keyCode== 27 # escape enlarges the editing zone to the enclosing rule
+# t = ev.currentTarget
+# dadInCode = ($(".editing").parent().filter(".code"))[0];
+# console.log dadInC ode
+# if dadInCode?
+# $(".parse-subcomponent").removeClass "currentItem"
+# $(".code").removeClass "editing"
+# $(dadInCode).addClass "editing"
+# $( "#component#{dadInCode.id}" ).addClass "currentItem"
+# if ev.keyCode = 13 && ev.shiftKey
+# t
+# if ev.keyCode = 13 && ev.ctrlKey
+# t
+
+
+
+
+
+# given an `elt`, extract the associated rule name
+# from the class name of the form rule-*.
+# If a class name if rule-string the extracted name is "string"
+
+ ruleNm = (elt) ->
+ for classNm in elt.className.split(' ')
+ m = ///^rule-(.*)///.exec classNm
+ return m[1] if m?
+ return ''
+
+ ruleElt = (portviewId) -> $("#{portviewId} > .currentRule")[0]
+
+ showRule = (portviewId, ruleNm) ->
+ rules = JSON.parse ruleElt.attr('data')
+ ruleElt(litePortviewId).text rules[ruleNm] if rules[ruleNm]
+
+
+# `hilite` does dynamic hightlighting
+# we got a event in an element of the code pane, that is for some text chunk
+# in the parse tree. Hilite accordingly, display the parse path to the said
+# chunk, and display the code of the rule used to reduce the said chunk
+
+ hilite = (ev) ->
+ elt = ev.currentTarget
+ lid = liteId elt
+ dehilite(lid)
+ showParsePath(elt, lid)
+ # extract the current rule code to add it to the rule pane
+ dad = elt.parentNode
+ showRule rule if rule = ruleNm dad
+ # DH of an operator and its operand(s).
+ # I am not documenting much because I will change it.
+ # see TBD about json and html minimization
+ $(dad).addClass 'opd'
+ unnamedP = (i) -> !$(this).hasClass 'named'
+ if unnamedP elt
+ $(dad).children().filter(unnamedP).addClass 'opr'
+
+ dehilite = (lid) ->
+ $("#{lid} .#{klass}").removeClass klass for klass in [ 'opd' , 'opr', 'editing']
+
+
+
+
+# A parsepath vieport displays the reduction sequence from the parse root.
+
+# When a # inner reduction element has the same text as the outer,
+# the corresponding parse components are grouped into an td element;
+#that is, they are displayed in a # vertical group.
+
+ showParsePath = (elt) ->
+ $("${lid} .code").removeClass "currentItem"
+ components = []
+
+# `sameText` is true when the text reduced by the current rule as memorized
+# has the 'code' class attribute value
+ AddToPath = (elt, sameText = false) ->
+ obj = { cnm: ruleNm(elt), id: elt.id, text: $(elt).text() }
+ if sameText
+ # != -1 will be a good example of DH to disambiguate parsing
+ bundle = components[ components.length - 1].push obj
+ else
+ components.unshift [obj]
+
+ AddToPath elt
+ text = $(elt).text()
+ while $( elt.parentNode ).hasClass('code')
+ elt = elt.parentNode
+ AddToPath elt, text == $(elt).text()
+# we calculated the breadcomponents in `components`
+ ParsePathElt = $(".parse-path")
+ ParsePathElt.html("<table><tr></tr></table>")
+ for component in components
+ componentHtml =''
+ for subcomponent in component.reverse()
+ componentHtml += "<div class='parse-subcomponent' id='component#{subcomponent.id}'>#{subcomponent.cnm}</div>"
+ ParsePathElt.append $("<td class='parse-component'>#{componentHtml}</td>")
+
+ insertParseTree = (elt, data, id=0, prefix='') ->
+ appendElt = (elt, s, klass) ->
+ elt.append '<span>'
+ e = $ elt[0].lastChild # this is sooo ugly
+
+ e.text s if s
+ if klass
+ # add a docco class for css static highlighting sake
+ e.addClass 'docco-' + d if d = docco[klass];
+ # name of the rule associated to the current element
+ e.addClass 'rule-' + klass
+ # 'named' means 'rule-*'. Used for DH.
+ e.addClass 'named'
+ # unique id to hilite from the parse path pane (broken feature. why?)
+ e.attr 'id', prefix + id++ # `prefix` will be the viewport name.
+ e.addClass 'code' # is that necessary except for the englobing element?
+ return e
+
+ insertSubtree = (elt, subtree) ->
+ for k, v of subtree
+ elt = appendElt elt, null, k
+ for obj in v
+ if $.type(obj) == "string"
+ appendElt elt, obj
+ else
+ insertSubtree elt, obj, id
+
+ parseTree = data.parseTree
+ docco = data.docco
+ insertSubtree elt, parseTree
+
+
+ generateLitePortview = (elt, data, id=0, prefix='') ->
+ insertParseTree elt, data;
+ $(".currentRule").attr('data', JSON.stringify(data.rules))
+
+ # generate
+ for j in [ 'parsed', 'dh' ]
+ $.getJSON "data/#{j}.json", (data) ->
+ m = MarkupForLiteViewport j
+ $('#viewport').append m
+ elt = $( )[0]
+ alert "can't find liteViewport element" unless elt;
+ generateLitePortview elt, eltId, data
+
+
View
39 src/hi.coffee
@@ -0,0 +1,39 @@
+$ ->
+ bread_crumbs_on_hover = 1 # 0 after first click on code/doc
+
+# we update breadcrumbs on code hovering until we click on the code
+ # $(".code").live('vmouseover',
+ (ev) ->
+ return unless bread_crumbs_on_hover
+ ev.stopPropagation()
+ hilite ev
+# )
+
+# inhibited handler
+# $(".code").live('vclick',
+ (ev) ->
+ bread_crumbs_on_hover = 0
+ ev.stopPropagation()
+ $(".code").removeClass "editing"
+ elt = ev.currentTarget
+ $(elt).addClass "editing"
+ hilite ev
+# )
+
+ codeElts = (litePortViewId) -> $("##(litePortViewId) > .code")
+ litePortViewId = (elt) ->
+ $(elt).parents().filter(".litePortView").attr('id')[0]
+
+
+ $(".parse-subcrumb").live('vmouseover', (ev) ->
+ $(".code").removeClass "editing"
+ bread_crumbs_on_hove = 0
+ $(".code").removeClass "currentItem"
+ $(".parse-subcrumb").removeClass "currentItem"
+ elt = ev.currentTarget
+ id = elt.id
+ $(elt).addClass "currentItem" # color the subcrumb
+ console.log "#{ id.substring 5} #{id}"
+ showRule $(elt).text()
+ $( '#' + id.substring 5 ).addClass "currentItem" # color the corresponding code
+ )
View
178 src/hilite.coffee
@@ -1,178 +0,0 @@
-# really need to refactor to emphasize the logic, not the jquery operations
-
-$ ->
- bread_crumbs_on_hover = 1 # 0 after first click on code/doc
-
-# $("#parse-crumbs").bind( 'vclick', -> bread_crumbs_on_hover = 1)
-# $("#parse-breadcrumbs").tooltip() ## does not work
-
- # we update breadcrumbs on code hovering until we click on the code
- $(".code").live('vmouseover',
- (ev) ->
- return unless bread_crumbs_on_hover
- ev.stopPropagation()
- hilite ev
- )
-
- $(".code").live('vclick',
- (ev) ->
- bread_crumbs_on_hover = 0
- ev.stopPropagation()
- $(".code").removeClass "editing"
- elt = ev.currentTarget
- $(elt).addClass "editing"
- hilite ev
- )
-
- $(".parse-subcrumb").live('vmouseover', (ev) ->
- $(".code").removeClass "editing"
- bread_crumbs_on_hove = 0
- $(".code").removeClass "colored"
- $(".parse-subcrumb").removeClass "colored"
- elt = ev.currentTarget
- id = elt.id
- $(elt).addClass "colored" # color the subcrumb
- console.log "#{ id.substring 5} #{id}"
- showRule $(elt).text()
- $( '#' + id.substring 5 ).addClass "colored" # color the corresponding code
- )
-
-# need to support keymaps
- $(".code").live('keydown',
- (ev) ->
- # console.log ev
- ev.stopPropagation()
- if ev.keyCode== 27 # escape enlarges the editing zone to the enclosing rule
- t = ev.currentTarget
- dadInCode = ($(".editing").parent().filter(".code"))[0];
- console.log dadInC ode
- if dadInCode?
- $(".parse-subcrumb").removeClass "colored"
- $(".code").removeClass "editing"
- $(dadInCode).addClass "editing"
- $( "#crumb#{dadInCode.id}" ).addClass "colored"
-# if t.hasClass "cle-doc"
-# t.html t.attr("src").escapeHTML # good as a start but wrong. wipe out structure
- if ev.keyCode = 13 && ev.shiftKey
- t
- if ev.keyCode = 13 && ev.ctrlKey
- t
- )
-
-
-# extract the rule name from an element.
-# If we got code-string in the class attributes, the corresponding rule
-# name is "string"
-
- ruleNm = (elt) ->
- for classNm in elt.className.split(' ')
- m = ///^rule-(.*)///.exec classNm
- return m[1] if m?
- return ''
-
-
-# `hilite` is the entry point for updating the breadcrumbs and rule pane
-
- hilite = (ev) ->
- elt = ev.currentTarget
- dehilite()
- mkCrumbs(elt)
- # extract the current rule to add it to the rule vieport
- ruleElt = $('#current-rule')
- dad = elt.parentNode
- # DH of operand and operators.
- # I am not documenting because I will change it.
- # see TBD about json and html minimization
- $(dad).addClass 'opd'
- showRule rule if rule = ruleNm dad
- unnamedP = (i) -> !$(this).hasClass 'named'
- if unnamedP elt
- $(dad).children().filter(unnamedP).addClass 'opr'
-
- dehilite = ->
- $('.opr').removeClass 'opr'
- $('.opd').removeClass 'opd'
-
-
- showRule = (ruleNm) ->
- ruleElt = $('#current-rule')
- rules = JSON.parse ruleElt.attr('data')
- ruleElt.text rules[ruleNm] if rules[ruleNm]
-
-
-# A breadcrumb displays the reduction sequence from the parse top. Making a
-# breadcrumb bar from the rule callstack that reduces the selected text. When a
-# inner reduction element has the same text as the outer, the corresponding
-# parse crumbs are grouped into an td element; that is, they are displayed in a
-# vertical group.
-
- mkCrumbs = (elt) ->
- $(".code").removeClass "colored"
- crumbs = []
-
-# `sameText` is true when the text reduced by the current rule as memorized
-# has the 'code' class attribute value
- AddToCrumbs = (elt, sameText = false) ->
- obj = { cnm: ruleNm(elt), id: elt.id, text: $(elt).text() }
- if sameText
- # != -1 will be a good example of DH to disambiguate parsing
- bundle = crumbs[ crumbs.length - 1].push obj
- else
- crumbs.unshift [obj]
-
- AddToCrumbs elt
- text = $(elt).text()
- while $( elt.parentNode ).hasClass('code')
- elt = elt.parentNode
- AddToCrumbs elt, text == $(elt).text()
-# we calculated the breadcrumbs in `crumbs`
-# now generate the associated html code.
- crumbElt = $("#parse-crumbs")
- crumbElt.html("<table><tr></tr></table>")
- for crumb in crumbs
- crumbhtml =''
- for subcrumb in crumb.reverse()
- crumbhtml += "<div class='parse-subcrumb' id='crumb#{subcrumb.id}'>#{subcrumb.cnm}</div>"
- crumbElt.append $("<td class='parse-crumb'>#{crumbhtml}</td>")
-
-
- insertParseTree = (elt, data, id=0, prefix='') ->
- appendElt = (elt, s, klass) ->
- elt.append '<span>'
- e = $ elt[0].lastChild # this sooo ugly
-
- e.text s if s
- if klass
- # add a docco class for css sake
- e.addClass 'docco-' + d if d = docco[klass];
- # name of the rule associated to the current element
- e.addClass 'rule-' + klass
- # 'named' means 'rule-*'. Used ofr DH.
- # May be early optimization; less code anyway
- e.addClass 'named'
- # unique id to hilite from the parse path pane (broken feature. why?)
- e.attr 'id', prefix + id++ # `prefix` will be the viewport name.
- e.addClass 'code' # is that necessary except for the englobing element?
- return e
-
- insertSubtree = (elt, subtree) ->
- for k, v of subtree
- elt = appendElt elt, null, k
- for obj in v
- if $.type(obj) == "string"
- appendElt elt, obj
- else
- insertSubtree elt, obj, id
-
- parseTree = data.parseTree
- docco = data.docco
- insertSubtree elt, parseTree
-
-
- generateView = (elt, data, id=0, prefix='') ->
- insertParseTree elt, data;
- $('#current-rule').attr('data', JSON.stringify(data.rules))
-
-
- $.getJSON 'data/dh.json', (data) ->
- generateView $('.code-top'), data

No commit comments for this range

Something went wrong with that request. Please try again.