http://git-wip-us.apache.org/repos/asf/predictionio-site/blob/0927bfda/api/current/lib/diagrams.js
----------------------------------------------------------------------
diff --git a/api/current/lib/diagrams.js b/api/current/lib/diagrams.js
new file mode 100644
index 0000000..680ead7
--- /dev/null
+++ b/api/current/lib/diagrams.js
@@ -0,0 +1,324 @@
+/**
+ * JavaScript functions enhancing the SVG diagrams.
+ * 
+ * @author Damien Obrist
+ */
+
+var diagrams = {};
+
+/**
+ * Initializes the diagrams in the main window.
+ */
+$(document).ready(function()
+{
+       // hide diagrams in browsers not supporting SVG
+       if(Modernizr && !Modernizr.inlinesvg)
+               return;
+
+       // only execute this in the main window
+       if(diagrams.isPopup)
+               return;
+
+       if($("#content-diagram").length)
+               $("#inheritance-diagram").css("padding-bottom", "20px");
+
+       $(".diagram-container").css("display", "block");
+
+       $(".diagram").each(function() {
+               // store initial dimensions
+               $(this).data("width", $("svg", $(this)).width());
+               $(this).data("height", $("svg", $(this)).height());
+               // store unscaled clone of SVG element
+               $(this).data("svg", 
$(this).get(0).childNodes[0].cloneNode(true));
+       });
+       
+       // make diagram visible, hide container
+       $(".diagram").css("display", "none");
+       $(".diagram svg").css({
+               "position": "static",
+               "visibility": "visible",
+               "z-index": "auto"
+       });
+
+       // enable linking to diagrams
+       if($(location).attr("hash") == "#inheritance-diagram") {
+               diagrams.toggle($("#inheritance-diagram-container"), true);
+       } else if($(location).attr("hash") == "#content-diagram") {
+               diagrams.toggle($("#content-diagram-container"), true);
+       }
+
+       $(".diagram-link").click(function() {
+               diagrams.toggle($(this).parent());
+       });
+
+       // register resize function
+       $(window).resize(diagrams.resize);
+
+       // don't bubble event to parent div
+       // when clicking on a node of a resized
+       // diagram
+       $("svg a").click(function(e) {
+               e.stopPropagation();
+       });
+
+       diagrams.initHighlighting();
+});
+
+/**
+ * Initializes the diagrams in the popup.
+ */
+diagrams.initPopup = function(id)
+{
+       // copy diagram from main window
+       if(!jQuery.browser.msie)
+               $("body").append(opener.$("#" + id).data("svg"));
+
+       // positioning
+       $("svg").css("position", "absolute");
+       $(window).resize(function()
+       {
+               var svg_w = $("svg").css("width").replace("px", "");
+               var svg_h = $("svg").css("height").replace("px", "");
+               var x = $(window).width() / 2 - svg_w / 2;
+               if(x < 0) x = 0;
+               var y = $(window).height() / 2 - svg_h / 2;
+               if(y < 0) y = 0;
+               $("svg").css("left", x + "px");
+               $("svg").css("top", y + "px");
+       });
+       $(window).resize();
+
+       diagrams.initHighlighting();
+       $("svg a").click(function(e) {
+               opener.diagrams.redirectFromPopup(this.href.baseVal);
+               window.close();
+       });
+       $(document).keyup(function(e) {
+               if (e.keyCode == 27) window.close();
+       });
+}
+
+/**
+ * Initializes highlighting for nodes and edges.
+ */
+diagrams.initHighlighting = function()
+{
+       // helper function since $.hover doesn't work in IE
+
+       function hover(elements, fn)
+       {
+               elements.mouseover(fn);
+               elements.mouseout(fn);
+       }
+
+       // inheritance edges
+
+       hover($("svg .edge.inheritance"), function(evt){
+               var toggleClass = evt.type == "mouseout" ? diagrams.removeClass 
: diagrams.addClass;
+               var parts = $(this).attr("id").split("_");
+               toggleClass($("#" + parts[0] + "_" + parts[1]));
+               toggleClass($("#" + parts[0] + "_" + parts[2]));
+               toggleClass($(this));
+       });
+
+       // nodes
+
+       hover($("svg .node"), function(evt){
+               var toggleClass = evt.type == "mouseout" ? diagrams.removeClass 
: diagrams.addClass;
+               toggleClass($(this));
+               var parts = $(this).attr("id").split("_");
+               var index = parts[1];
+               $("svg#" + parts[0] + " .edge.inheritance").each(function(){
+                       var parts2 = $(this).attr("id").split("_");
+                       if(parts2[1] == index)
+                       {
+                               toggleClass($("#" + parts2[0] + "_" + 
parts2[2]));
+                               toggleClass($(this));
+                       } else if(parts2[2] == index)
+                       {
+                               toggleClass($("#" + parts2[0] + "_" + 
parts2[1]));
+                               toggleClass($(this));
+                       }
+               });
+       });
+
+       // incoming implicits
+
+       hover($("svg .node.implicit-incoming"), function(evt){
+               var toggleClass = evt.type == "mouseout" ? diagrams.removeClass 
: diagrams.addClass;
+               toggleClass($(this));
+               toggleClass($("svg .edge.implicit-incoming"));
+               toggleClass($("svg .node.this"));
+       });
+
+       hover($("svg .edge.implicit-incoming"), function(evt){
+               var toggleClass = evt.type == "mouseout" ? diagrams.removeClass 
: diagrams.addClass;
+               toggleClass($(this));
+               toggleClass($("svg .node.this"));
+               $("svg .node.implicit-incoming").each(function(){
+                       toggleClass($(this));
+               });
+       });
+       
+       // implicit outgoing nodes
+
+       hover($("svg .node.implicit-outgoing"), function(evt){
+               var toggleClass = evt.type == "mouseout" ? diagrams.removeClass 
: diagrams.addClass;
+               toggleClass($(this));
+               toggleClass($("svg .edge.implicit-outgoing"));
+               toggleClass($("svg .node.this"));
+       });
+
+       hover($("svg .edge.implicit-outgoing"), function(evt){
+               var toggleClass = evt.type == "mouseout" ? diagrams.removeClass 
: diagrams.addClass;
+               toggleClass($(this));
+               toggleClass($("svg .node.this"));
+               $("svg .node.implicit-outgoing").each(function(){
+                       toggleClass($(this));
+               });
+       });
+};
+
+/**
+ * Resizes the diagrams according to the available width.
+ */
+diagrams.resize = function()
+{
+       // available width
+       var availableWidth = $("body").width() - 20;
+
+       $(".diagram-container").each(function() {
+               // unregister click event on whole div
+               $(".diagram", this).unbind("click");
+               var diagramWidth = $(".diagram", this).data("width");
+               var diagramHeight = $(".diagram", this).data("height");
+
+               if(diagramWidth > availableWidth)
+               {
+                       // resize diagram
+                       var height = diagramHeight / diagramWidth * 
availableWidth;
+                       $(".diagram svg", this).width(availableWidth);
+                       $(".diagram svg", this).height(height);
+
+                       // register click event on whole div
+                       $(".diagram", this).click(function() {
+                               diagrams.popup($(this));
+                       });
+                       $(".diagram", this).addClass("magnifying");
+               }
+               else
+               {
+                       // restore full size of diagram
+                       $(".diagram svg", this).width(diagramWidth);
+                       $(".diagram svg", this).height(diagramHeight);
+                       // don't show custom cursor any more
+                       $(".diagram", this).removeClass("magnifying");
+               }
+       });
+};
+
+/**
+ * Shows or hides a diagram depending on its current state.
+ */
+diagrams.toggle = function(container, dontAnimate)
+{
+       // change class of link
+       $(".diagram-link", container).toggleClass("open");
+       // get element to show / hide
+       var div = $(".diagram", container);
+       if (div.is(':visible'))
+       {
+               $(".diagram-help", container).hide();
+               div.unbind("click");
+               div.removeClass("magnifying");
+               div.slideUp(100);
+       }
+       else
+       {
+               diagrams.resize();
+               if(dontAnimate)
+                       div.show();
+               else
+                       div.slideDown(100);
+               $(".diagram-help", container).show();
+       }
+};
+
+/**
+ * Opens a popup containing a copy of a diagram.
+ */
+diagrams.windows = {};
+diagrams.popup = function(diagram)
+{
+       var id = diagram.attr("id");
+       if(!diagrams.windows[id] || diagrams.windows[id].closed) {
+               var title = $(".symbol .name", $("#signature")).text();
+               // cloning from parent window to popup somehow doesn't work in 
IE
+               // therefore include the SVG as a string into the HTML
+               var svgIE = jQuery.browser.msie ? $("<div 
/>").append(diagram.data("svg")).html() : "";
+               var html = '' +
+               '<?xml version="1.0" encoding="UTF-8"?>\n' +
+               '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" 
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd";>\n' + 
+               '<html>\n' +
+               '       <head>\n' +
+               '               <title>' + title + '</title>\n' +
+               '               <link href="' + $("#diagrams-css").attr("href") 
+ '" media="screen" type="text/css" rel="stylesheet" />\n' +
+               '               <script type="text/javascript" src="' + 
$("#jquery-js").attr("src") + '"></script>\n' +
+               '               <script type="text/javascript" src="' + 
$("#diagrams-js").attr("src") + '"></script>\n' +
+               '               <script type="text/javascript">\n' +
+               '                       diagrams.isPopup = true;\n' +
+               '               </script>\n' +
+               '       </head>\n' +
+               '       <body onload="diagrams.initPopup(\'' + id + '\');">\n' +
+               '               <a href="#" onclick="window.close();" 
id="close-link">Close this window</a>\n' +
+               '               ' + svgIE + '\n' +
+               '       </body>\n' +
+               '</html>';
+
+               var padding = 30;
+               var screenHeight = screen.availHeight;
+               var screenWidth = screen.availWidth;
+               var w = Math.min(screenWidth, diagram.data("width") + 2 * 
padding);
+               var h = Math.min(screenHeight, diagram.data("height") + 2 * 
padding);
+               var left = (screenWidth - w) / 2;
+               var top = (screenHeight - h) / 2;
+               var parameters = "height=" + h + ", width=" + w + ", left=" + 
left + ", top=" + top + ", scrollbars=yes, location=no, resizable=yes";
+               var win = window.open("about:blank", "_blank", parameters);
+               win.document.open();
+               win.document.write(html);
+               win.document.close();
+               diagrams.windows[id] = win;
+       }
+       win.focus();
+};
+
+/**
+ * This method is called from within the popup when a node is clicked.
+ */
+diagrams.redirectFromPopup = function(url)
+{
+       window.location = url;
+};
+
+/**
+ * Helper method that adds a class to a SVG element.
+ */
+diagrams.addClass = function(svgElem, newClass) {
+       newClass = newClass || "over";
+       var classes = svgElem.attr("class");
+       if ($.inArray(newClass, classes.split(/\s+/)) == -1) {
+               classes += (classes ? ' ' : '') + newClass;
+               svgElem.attr("class", classes);
+       }
+};
+
+/**
+ * Helper method that removes a class from a SVG element.
+ */
+diagrams.removeClass = function(svgElem, oldClass) {
+       oldClass = oldClass || "over";
+       var classes = svgElem.attr("class");
+       classes = $.grep(classes.split(/\s+/), function(n, i) { return n != 
oldClass; }).join(' ');
+       svgElem.attr("class", classes);
+};
+

http://git-wip-us.apache.org/repos/asf/predictionio-site/blob/0927bfda/api/current/lib/filter_box_left.png
----------------------------------------------------------------------
diff --git a/api/current/lib/filter_box_left.png 
b/api/current/lib/filter_box_left.png
new file mode 100644
index 0000000..0e8c893
Binary files /dev/null and b/api/current/lib/filter_box_left.png differ

http://git-wip-us.apache.org/repos/asf/predictionio-site/blob/0927bfda/api/current/lib/filter_box_left2.gif
----------------------------------------------------------------------
diff --git a/api/current/lib/filter_box_left2.gif 
b/api/current/lib/filter_box_left2.gif
new file mode 100644
index 0000000..b9b4907
Binary files /dev/null and b/api/current/lib/filter_box_left2.gif differ

http://git-wip-us.apache.org/repos/asf/predictionio-site/blob/0927bfda/api/current/lib/filter_box_right.png
----------------------------------------------------------------------
diff --git a/api/current/lib/filter_box_right.png 
b/api/current/lib/filter_box_right.png
new file mode 100644
index 0000000..f127e35
Binary files /dev/null and b/api/current/lib/filter_box_right.png differ

http://git-wip-us.apache.org/repos/asf/predictionio-site/blob/0927bfda/api/current/lib/filterbg.gif
----------------------------------------------------------------------
diff --git a/api/current/lib/filterbg.gif b/api/current/lib/filterbg.gif
new file mode 100644
index 0000000..542ba4a
Binary files /dev/null and b/api/current/lib/filterbg.gif differ

http://git-wip-us.apache.org/repos/asf/predictionio-site/blob/0927bfda/api/current/lib/filterboxbarbg.gif
----------------------------------------------------------------------
diff --git a/api/current/lib/filterboxbarbg.gif 
b/api/current/lib/filterboxbarbg.gif
new file mode 100644
index 0000000..b5075c1
Binary files /dev/null and b/api/current/lib/filterboxbarbg.gif differ

http://git-wip-us.apache.org/repos/asf/predictionio-site/blob/0927bfda/api/current/lib/filterboxbarbg.png
----------------------------------------------------------------------
diff --git a/api/current/lib/filterboxbarbg.png 
b/api/current/lib/filterboxbarbg.png
new file mode 100644
index 0000000..d613cf5
Binary files /dev/null and b/api/current/lib/filterboxbarbg.png differ

http://git-wip-us.apache.org/repos/asf/predictionio-site/blob/0927bfda/api/current/lib/filterboxbg.gif
----------------------------------------------------------------------
diff --git a/api/current/lib/filterboxbg.gif b/api/current/lib/filterboxbg.gif
new file mode 100644
index 0000000..ae2f858
Binary files /dev/null and b/api/current/lib/filterboxbg.gif differ

http://git-wip-us.apache.org/repos/asf/predictionio-site/blob/0927bfda/api/current/lib/fullcommenttopbg.gif
----------------------------------------------------------------------
diff --git a/api/current/lib/fullcommenttopbg.gif 
b/api/current/lib/fullcommenttopbg.gif
new file mode 100644
index 0000000..a0d93f4
Binary files /dev/null and b/api/current/lib/fullcommenttopbg.gif differ

http://git-wip-us.apache.org/repos/asf/predictionio-site/blob/0927bfda/api/current/lib/index.css
----------------------------------------------------------------------
diff --git a/api/current/lib/index.css b/api/current/lib/index.css
new file mode 100644
index 0000000..3e352a9
--- /dev/null
+++ b/api/current/lib/index.css
@@ -0,0 +1,339 @@
+* {
+  color: inherit;
+  font-size: 10pt;
+  text-decoration: none;
+        font-family: Arial, sans-serif;
+  border-width: 0px;
+  padding: 0px;
+  margin: 0px;
+}
+
+a {
+  cursor: pointer;
+}
+
+a:hover {
+  text-decoration: underline;
+}
+
+h1 {
+  display: none;
+}
+
+.selected {
+  -moz-box-shadow: inset 0px 5px 10px rgba(58, 88, 97, .36);
+  -webkit-box-shadow: inset 0px 5px 10px rgba(58, 88, 97, .36);
+  border-top: solid 1px rgba(119, 138, 153, 0.8);
+  border-bottom: solid 1px rgba(151, 173, 191, 0.4);
+  background-color: #ced2d9;
+  margin: -1px 0px;
+}
+
+/*.letters {
+  font-family: monospace;
+  font-size: 2pt;
+  padding: 5px;
+  background-color: #DADADA;
+  text-shadow: #ffffff 0 1px 0;
+}*/
+
+#library {
+    display: none;
+}
+
+#browser {
+  top: 0px;
+  left: 0px;
+  bottom: 0px;
+  width: 100%;
+  display: block;
+  position: fixed;
+}
+
+#filter {
+  position: absolute;
+  display: block;
+/*  padding: 5px;*/
+  right: 0;
+  left: 0;
+  top: 0;
+  background-image:url('filterbg.gif');
+  background-repeat:repeat-x;
+  background-color: #ededee; /* light gray */
+  /*background-color: #DADADA;*/
+  border:1px solid #bbbbbb;
+  border-top:0;
+  border-left:0;
+  border-right:0;
+}
+
+#textfilter {
+  position: relative;
+  display: block;
+  height: 20px;
+  margin-top: 5px;
+  margin-bottom: 5px;
+}
+
+#textfilter > .pre {
+  display: block;
+  position: absolute;
+  top: 0;
+  left: 0;
+  height: 23px;
+  width: 21px;
+  background: url("filter_box_left.png");
+}
+
+#textfilter > .input {
+  display: block;
+  position: absolute;
+  top: 0;
+  right: 20px;
+  left: 20px;
+}
+
+#textfilter > .input > input {
+  height: 20px;
+  padding: 1px;
+  font-weight: bold;
+  color: #000000;
+  background: #ffffff url("filterboxbarbg.png") repeat-x bottom left;
+  width: 100%;
+}
+
+#textfilter > .post {
+  display: block;
+  position: absolute;
+  top: 0;
+  right: 0;
+  height: 23px;
+  width: 21px;
+  background: url("filter_box_right.png");
+}
+
+/*#textfilter {
+  position: relative;
+  display: block;
+    height: 20px;
+  margin-bottom: 5px;
+}
+
+#textfilter > .pre {
+    display: block;
+    position: absolute;
+    top: 0;
+    left: 0;
+    height: 20px;
+    width: 20px;
+    background: url("filter_box_left.png");
+}
+
+#textfilter > .input {
+  display: block;
+    position: absolute;
+    top: 0;
+    right: 20px;
+    left: 20px;
+}
+
+#textfilter > .input > input {
+  height: 16px;
+  padding: 2px;
+  font-weight: bold;
+  color: darkblue;
+  background-color: white;
+    width: 100%;
+}
+
+#textfilter > .post {
+    display: block;
+    position: absolute;
+    top: 0;
+    right: 0;
+    height: 20px;
+    width: 20px;
+    background: url("filter_box_right.png");
+}*/
+
+#focusfilter {
+  position: relative;
+  text-align: center;
+  display: block;
+  padding: 5px;
+  background-color: #fffebd; /* light yellow*/
+  text-shadow: #ffffff 0 1px 0;
+}
+
+#focusfilter .focuscoll {
+  font-weight: bold;
+  text-shadow: #ffffff 0 1px 0;
+}
+
+#focusfilter img {
+  bottom: -2px;
+  position: relative;
+}
+
+#kindfilter {
+  position: relative;
+  display: block;
+  padding: 5px;
+/*  background-color: #999;*/
+  text-align: center;
+}
+
+#kindfilter > a {
+ color: black; 
+/* text-decoration: underline;*/
+ text-shadow: #ffffff 0 1px 0;
+
+}
+
+#kindfilter > a:hover {
+  color: #4C4C4C; 
+  text-decoration: none;
+  text-shadow: #ffffff 0 1px 0;
+}
+
+#letters {
+  position: relative;
+  text-align: center;
+  padding-bottom: 5px;
+  border:1px solid #bbbbbb;
+  border-top:0;
+  border-left:0;
+  border-right:0;
+}
+
+#letters > a, #letters > span {
+/*  font-family: monospace;*/
+  color: #858484;
+  font-weight: bold;
+  font-size: 8pt;
+  text-shadow: #ffffff 0 1px 0;
+  padding-right: 2px;
+}
+
+#letters > span {
+  color: #bbb;
+}
+  
+#tpl {
+  display: block;
+  position: fixed;
+  overflow: auto;
+  right: 0;
+  left: 0;
+  bottom: 0;
+  top: 5px;
+  position: absolute;
+  display: block;
+}
+
+#tpl .packhide {
+  display: block;
+  float: right;
+  font-weight: normal;
+  color: white;
+}
+
+#tpl .packfocus {
+  display: block;
+  float: right;
+  font-weight: normal;
+  color: white;
+}
+
+#tpl .packages > ol {
+  background-color: #dadfe6;
+  /*margin-bottom: 5px;*/
+}
+
+/*#tpl .packages > ol > li {
+  margin-bottom: 1px;
+}*/
+
+#tpl .packages > li > a {
+  padding: 0px 5px;
+}
+
+#tpl .packages > li > a.tplshow {
+  display: block;
+  color: white;
+  font-weight: bold;
+  display: block;
+  text-shadow: #000000 0 1px 0;
+}
+
+#tpl ol > li.pack {
+  padding: 3px 5px;
+  background: url("packagesbg.gif");
+  background-repeat:repeat-x;
+  min-height: 14px;
+  background-color: #6e808e;
+}
+
+#tpl ol > li {
+  display: block;
+}
+
+#tpl .templates > li {
+  padding-left: 5px;
+  min-height: 18px;
+}
+
+#tpl ol > li .icon {
+  padding-right: 5px;
+  bottom: -2px;
+  position: relative;
+}
+
+#tpl .templates div.placeholder {
+  padding-right: 5px;
+  width: 13px;
+  display: inline-block;
+}
+
+#tpl .templates span.tplLink {
+  padding-left: 5px;
+}
+
+#content {
+  border-left-width: 1px;
+  border-left-color: black;
+  border-left-style: white;
+  right: 0px;
+  left: 0px;
+  bottom: 0px;
+  top: 0px;
+  position: fixed;
+  margin-left: 300px;
+  display: block;
+  -webkit-overflow-scrolling: touch;
+}
+
+#content > iframe {
+  display: block;
+  height: 100%;
+  width: 100%;
+}
+
+.ui-layout-pane {
+  background: #FFF;
+  overflow: auto;
+}
+
+.ui-layout-resizer {
+  background-image:url('filterbg.gif');
+  background-repeat:repeat-x;
+  background-color: #ededee; /* light gray */
+  border:1px solid #bbbbbb;
+  border-top:0;
+  border-bottom:0;
+  border-left: 0;
+}
+
+.ui-layout-toggler {
+    background: #AAA;
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/predictionio-site/blob/0927bfda/api/current/lib/index.js
----------------------------------------------------------------------
diff --git a/api/current/lib/index.js b/api/current/lib/index.js
new file mode 100644
index 0000000..cf81f7f
--- /dev/null
+++ b/api/current/lib/index.js
@@ -0,0 +1,577 @@
+// © 2009–2010 EPFL/LAMP
+// code by Gilles Dubochet with contributions by Johannes Rudolph, "spiros" 
and Marcin Kubala
+
+var topLevelTemplates = undefined;
+var topLevelPackages = undefined;
+
+var scheduler = undefined;
+
+var kindFilterState = undefined;
+var focusFilterState = undefined;
+
+var title = $(document).attr('title');
+
+var lastFragment = "";
+
+$(document).ready(function() {
+    $('body').layout({
+        west__size: '20%',
+        center__maskContents: true
+    });
+    $('#browser').layout({
+        center__paneSelector: ".ui-west-center"
+        //,center__initClosed:true
+        ,north__paneSelector: ".ui-west-north"
+    });
+    $('iframe').bind("load", function(){
+        try {
+            var subtitle = $(this).contents().find('title').text();
+            $(document).attr('title', (title ? title + " - " : "") + subtitle);
+        } catch (e) {
+            // Chrome doesn't allow reading the iframe's contents when
+            // used on the local file system.
+        }
+        setUrlFragmentFromFrameSrc();
+    });
+
+    // workaround for IE's iframe sizing lack of smartness
+    if($.browser.msie) {
+        function fixIFrame() {
+            $('iframe').height($(window).height() )
+        }
+        $('iframe').bind("load",fixIFrame)
+        $('iframe').bind("resize",fixIFrame)
+    }
+
+    scheduler = new Scheduler();
+    scheduler.addLabel("init", 1);
+    scheduler.addLabel("focus", 2);
+    scheduler.addLabel("filter", 4);
+
+    prepareEntityList();
+
+    configureTextFilter();
+    configureKindFilter();
+    configureEntityList();
+
+    setFrameSrcFromUrlFragment();
+
+    // If the url fragment changes, adjust the src of iframe "template".
+    $(window).bind('hashchange', function() {
+      if(lastFragment != window.location.hash) {
+        lastFragment = window.location.hash;
+        setFrameSrcFromUrlFragment();
+      }
+    });
+});
+
+// Set the iframe's src according to the fragment of the current url.
+// fragment = "#scala.Either" => iframe url = "scala/Either.html"
+// fragment = "#scala.Either@isRight:Boolean" => iframe url = 
"scala/Either.html#isRight:Boolean"
+// fragment = 
"#scalaz.iteratee.package@>@>[E,A]=scalaz.iteratee.package.Iteratee[E,A]" => 
iframe url = 
"scalaz/iteratee/package.html#>@>[E,A]=scalaz.iteratee.package.Iteratee[E,A]"
+function setFrameSrcFromUrlFragment() {
+
+    function extractLoc(fragment) {
+        var loc = fragment.split('@')[0].replace(/\./g, "/");
+        if (loc.indexOf(".html") < 0) {
+            loc += ".html";
+        }
+        return loc;
+    }
+
+    function extractMemberSig(fragment) {
+        var splitIdx = fragment.indexOf('@');
+        if (splitIdx < 0) {
+            return;
+        }
+        return fragment.substr(splitIdx + 1);
+    }
+
+    var fragment = location.hash.slice(1);
+    if (fragment) {
+        var locWithMemeberSig = extractLoc(fragment);
+        var memberSig = extractMemberSig(fragment);
+        if (memberSig) {
+            locWithMemeberSig += "#" + memberSig;
+        }
+        frames["template"].location.replace(location.protocol + 
locWithMemeberSig);
+    } else {
+        console.log("empty fragment detected");
+        frames["template"].location.replace("package.html");
+    }
+}
+
+// Set the url fragment according to the src of the iframe "template".
+// iframe url = "scala/Either.html"  =>  url fragment = "#scala.Either"
+// iframe url = "scala/Either.html#isRight:Boolean"  =>  url fragment = 
"#scala.Either@isRight:Boolean"
+// iframe url = 
"scalaz/iteratee/package.html#>@>[E,A]=scalaz.iteratee.package.Iteratee[E,A]" 
=> fragment = 
"#scalaz.iteratee.package@>@>[E,A]=scalaz.iteratee.package.Iteratee[E,A]"
+function setUrlFragmentFromFrameSrc() {
+  try {
+    var commonLength = location.pathname.lastIndexOf("/");
+    var frameLocation = frames["template"].location;
+    var relativePath = frameLocation.pathname.slice(commonLength + 1);
+
+    if(!relativePath || frameLocation.pathname.indexOf("/") < 0)
+      return;
+
+    // Add #, remove ".html" and replace "/" with "."
+    fragment = "#" + relativePath.replace(/\.html$/, "").replace(/\//g, ".");
+
+    // Add the frame's hash after an @
+    if(frameLocation.hash) fragment += ("@" + frameLocation.hash.slice(1));
+
+    // Use replace to not add history items
+    lastFragment = fragment;
+    location.replace(fragment);
+  }
+  catch(e) {
+    // Chrome doesn't allow reading the iframe's location when
+    // used on the local file system.
+  }
+}
+
+var Index = {};
+
+(function (ns) {
+    function openLink(t, type) {
+        var href;
+        if (type == 'object') {
+            href = t['object'];
+        } else {
+            href = t['class'] || t['trait'] || t['case class'] || t['type'];
+        }
+        return [
+            '<a class="tplshow" target="template" href="',
+            href,
+            '"><img width="13" height="13" class="',
+            type,
+            ' icon" src="lib/',
+            type,
+            '.png" />'
+        ].join('');
+    }
+
+    function createPackageHeader(pack) {
+        return [
+            '<li class="pack">',
+            '<a class="packfocus">focus</a><a class="packhide">hide</a>',
+            '<a class="tplshow" target="template" href="',
+            pack.replace(/\./g, '/'),
+            '/package.html">',
+            pack,
+            '</a></li>'
+        ].join('');
+    };
+
+    function createListItem(template) {
+        var inner = '';
+
+
+        if (template.object) {
+            inner += openLink(template, 'object');
+        }
+
+        if (template['class'] || template['trait'] || template['case class'] 
|| template['type']) {
+            inner += (inner == '') ?
+                '<div class="placeholder" />' : '</a>';
+            inner += openLink(template, template['trait'] ? 'trait' : 
template['type'] ? 'type' : 'class');
+        } else {
+            inner += '<div class="placeholder"/>';
+        }
+
+        return [
+            '<li>',
+            inner,
+            '<span class="tplLink">',
+            template.name.replace(/^.*\./, ''),
+            '</span></a></li>'
+        ].join('');
+    }
+
+
+    ns.createPackageTree = function (pack, matched, focused) {
+        var html = $.map(matched, function (child, i) {
+            return createListItem(child);
+        }).join('');
+
+        var header;
+        if (focused && pack == focused) {
+            header = '';
+        } else {
+            header = createPackageHeader(pack);
+        }
+
+        return [
+            '<ol class="packages">',
+            header,
+            '<ol class="templates">',
+            html,
+            '</ol></ol>'
+        ].join('');
+    }
+
+    ns.keys = function (obj) {
+        var result = [];
+        var key;
+        for (key in obj) {
+            result.push(key);
+        }
+        return result;
+    }
+
+    var hiddenPackages = {};
+
+    function subPackages(pack) {
+        return $.grep($('#tpl ol.packages'), function (element, index) {
+            var pack = $('li.pack > .tplshow', element).text();
+            return pack.indexOf(pack + '.') == 0;
+        });
+    }
+
+    ns.hidePackage = function (ol) {
+        var selected = $('li.pack > .tplshow', ol).text();
+        hiddenPackages[selected] = true;
+
+        $('ol.templates', ol).hide();
+
+        $.each(subPackages(selected), function (index, element) {
+            $(element).hide();
+        });
+    }
+
+    ns.showPackage = function (ol, state) {
+        var selected = $('li.pack > .tplshow', ol).text();
+        hiddenPackages[selected] = false;
+
+        $('ol.templates', ol).show();
+
+        $.each(subPackages(selected), function (index, element) {
+            $(element).show();
+
+            // When the filter is in "packs" state,
+            // we don't want to show the `.templates`
+            var key = $('li.pack > .tplshow', element).text();
+            if (hiddenPackages[key] || state == 'packs') {
+                $('ol.templates', element).hide();
+            }
+        });
+    }
+
+})(Index);
+
+function configureEntityList() {
+    kindFilterSync();
+    configureHideFilter();
+    configureFocusFilter();
+    textFilter();
+}
+
+/* Updates the list of entities (i.e. the content of the #tpl element) from 
the raw form generated by Scaladoc to a
+   form suitable for display. In particular, it adds class and object etc. 
icons, and it configures links to open in
+   the right frame. Furthermore, it sets the two reference top-level entities 
lists (topLevelTemplates and
+   topLevelPackages) to serve as reference for resetting the list when needed.
+   Be advised: this function should only be called once, on page load. */
+function prepareEntityList() {
+    var classIcon = $("#library > img.class");
+    var traitIcon = $("#library > img.trait");
+    var typeIcon = $("#library > img.type");
+    var objectIcon = $("#library > img.object");
+    var packageIcon = $("#library > img.package");
+
+    $('#tpl li.pack > a.tplshow').attr("target", "template");
+    $('#tpl li.pack').each(function () {
+        $("span.class", this).each(function() { 
$(this).replaceWith(classIcon.clone()); });
+        $("span.trait", this).each(function() { 
$(this).replaceWith(traitIcon.clone()); });
+        $("span.type", this).each(function() { 
$(this).replaceWith(typeIcon.clone()); });
+        $("span.object", this).each(function() { 
$(this).replaceWith(objectIcon.clone()); });
+        $("span.package", this).each(function() { 
$(this).replaceWith(packageIcon.clone()); });
+    });
+    $('#tpl li.pack')
+        .prepend("<a class='packhide'>hide</a>")
+        .prepend("<a class='packfocus'>focus</a>");
+}
+
+/* Handles all key presses while scrolling around with keyboard shortcuts in 
left panel */
+function keyboardScrolldownLeftPane() {
+    scheduler.add("init", function() {
+        $("#textfilter input").blur();
+        var $items = $("#tpl li");
+        $items.first().addClass('selected');
+
+        $(window).bind("keydown", function(e) {
+            var $old = $items.filter('.selected'),
+                $new;
+
+            switch ( e.keyCode ) {
+
+            case 9: // tab
+                $old.removeClass('selected');
+                break;
+
+            case 13: // enter
+                $old.removeClass('selected');
+                var $url = $old.children().filter('a:last').attr('href');
+                $("#template").attr("src",$url);
+                break;
+
+            case 27: // escape
+                $old.removeClass('selected');
+                $(window).unbind(e);
+                $("#textfilter input").focus();
+
+                break;
+
+            case 38: // up
+                $new = $old.prev();
+
+                if (!$new.length) {
+                    $new = $old.parent().prev();
+                }
+
+                if ($new.is('ol') && $new.children(':last').is('ol')) {
+                    $new = $new.children().children(':last');
+                } else if ($new.is('ol')) {
+                    $new = $new.children(':last');
+                }
+
+                break;
+
+            case 40: // down
+                $new = $old.next();
+                if (!$new.length) {
+                    $new = $old.parent().parent().next();
+                }
+                if ($new.is('ol')) {
+                    $new = $new.children(':first');
+                }
+                break;
+            }
+
+            if ($new.is('li')) {
+                $old.removeClass('selected');
+                $new.addClass('selected');
+            } else if (e.keyCode == 38) {
+                $(window).unbind(e);
+                $("#textfilter input").focus();
+            }
+        });
+    });
+}
+
+/* Configures the text filter  */
+function configureTextFilter() {
+    scheduler.add("init", function() {
+        $("#textfilter").append("<span class='pre'/><span class='input'><input 
id='index-input' type='text' accesskey='/'/></span><span class='post'/>");
+        var input = $("#textfilter input");
+        resizeFilterBlock();
+        input.bind('keyup', function(event) {
+            if (event.keyCode == 27) { // escape
+                input.attr("value", "");
+            }
+            if (event.keyCode == 40) { // down arrow
+                $(window).unbind("keydown");
+                keyboardScrolldownLeftPane();
+                return false;
+            }
+            textFilter();
+        });
+        input.bind('keydown', function(event) {
+            if (event.keyCode == 9) { // tab
+                $("#template").contents().find("#mbrsel-input").focus();
+                input.attr("value", "");
+                return false;
+            }
+            textFilter();
+        });
+        input.focus(function(event) { input.select(); });
+    });
+    scheduler.add("init", function() {
+        $("#textfilter > .post").click(function(){
+            $("#textfilter input").attr("value", "");
+            textFilter();
+        });
+    });
+}
+
+function compilePattern(query) {
+    var escaped = query.replace(/([\.\*\+\?\|\(\)\[\]\\])/g, '\\$1');
+
+    if (query.toLowerCase() != query) {
+        // Regexp that matches CamelCase subbits: "BiSe" is
+        // "[a-z]*Bi[a-z]*Se" and matches "BitSet", "ABitSet", ...
+        return new RegExp(escaped.replace(/([A-Z])/g,"[a-z]*$1"));
+    }
+    else { // if query is all lower case make a normal case insensitive search
+        return new RegExp(escaped, "i");
+    }
+}
+
+// Filters all focused templates and packages. This function should be made 
less-blocking.
+//   @param query The string of the query
+function textFilter() {
+    var query = $("#textfilter input").attr("value") || '';
+    var queryRegExp = compilePattern(query);
+
+    // if we are filtering on types, then we have to display types
+    // ("display packages only" is not possible when filtering)
+    if (query !== "") {
+        kindFilter("all");
+    }
+
+    // Three things trigger a reload of the left pane list:
+    // typeof textFilter.lastQuery === "undefined" <-- first load, there is 
nothing yet in the left pane
+    // textFilter.lastQuery !== query              <-- the filter text has 
changed
+    // focusFilterState != null                    <-- a package has been 
"focused"
+    if ((typeof textFilter.lastQuery === "undefined") || (textFilter.lastQuery 
!== query) || (focusFilterState != null)) {
+
+        textFilter.lastQuery = query;
+
+        scheduler.clear("filter");
+
+        $('#tpl').html('');
+
+        var index = 0;
+
+        var searchLoop = function () {
+            var packages = Index.keys(Index.PACKAGES).sort();
+
+            while (packages[index]) {
+                var pack = packages[index];
+                var children = Index.PACKAGES[pack];
+                index++;
+
+                if (focusFilterState) {
+                    if (pack == focusFilterState ||
+                        pack.indexOf(focusFilterState + '.') == 0) {
+                        ;
+                    } else {
+                        continue;
+                    }
+                }
+
+                var matched = $.grep(children, function (child, i) {
+                    return queryRegExp.test(child.name);
+                });
+
+                if (matched.length > 0) {
+                    $('#tpl').append(Index.createPackageTree(pack, matched,
+                                                             
focusFilterState));
+                    scheduler.add('filter', searchLoop);
+                    return;
+                }
+            }
+
+            $('#tpl a.packfocus').click(function () {
+                focusFilter($(this).parent().parent());
+            });
+            configureHideFilter();
+        };
+
+        scheduler.add('filter', searchLoop);
+    }
+}
+
+/* Configures the hide tool by adding the hide link to all packages. */
+function configureHideFilter() {
+    $('#tpl li.pack a.packhide').click(function () {
+        var packhide = $(this)
+        var action = packhide.text();
+
+        var ol = $(this).parent().parent();
+
+        if (action == "hide") {
+            Index.hidePackage(ol);
+            packhide.text("show");
+        }
+        else {
+            Index.showPackage(ol, kindFilterState);
+            packhide.text("hide");
+        }
+        return false;
+    });
+}
+
+/* Configures the focus tool by adding the focus bar in the filter box 
(initially hidden), and by adding the focus
+   link to all packages. */
+function configureFocusFilter() {
+    scheduler.add("init", function() {
+        focusFilterState = null;
+        if ($("#focusfilter").length == 0) {
+            $("#filter").append("<div id='focusfilter'>focused on <span 
class='focuscoll'></span> <a class='focusremove'><img class='icon' 
src='lib/remove.png'/></a></div>");
+            $("#focusfilter > .focusremove").click(function(event) {
+                textFilter();
+
+                $("#focusfilter").hide();
+                $("#kindfilter").show();
+                resizeFilterBlock();
+                focusFilterState = null;
+            });
+            $("#focusfilter").hide();
+            resizeFilterBlock();
+        }
+    });
+    scheduler.add("init", function() {
+        $('#tpl li.pack a.packfocus').click(function () {
+            focusFilter($(this).parent());
+            return false;
+        });
+    });
+}
+
+/* Focuses the entity index on a specific package. To do so, it will copy the 
sub-templates and sub-packages of the
+   focuses package into the top-level templates and packages position of the 
index. The original top-level
+     @param package The <li> element that corresponds to the package in the 
entity index */
+function focusFilter(package) {
+    scheduler.clear("filter");
+
+    var currentFocus = $('li.pack > .tplshow', package).text();
+    $("#focusfilter > .focuscoll").empty();
+    $("#focusfilter > .focuscoll").append(currentFocus);
+
+    $("#focusfilter").show();
+    $("#kindfilter").hide();
+    resizeFilterBlock();
+    focusFilterState = currentFocus;
+    kindFilterSync();
+
+    textFilter();
+}
+
+function configureKindFilter() {
+    scheduler.add("init", function() {
+        kindFilterState = "all";
+        $("#filter").append("<div id='kindfilter'><a>display packages 
only</a></div>");
+        $("#kindfilter > a").click(function(event) { kindFilter("packs"); });
+        resizeFilterBlock();
+    });
+}
+
+function kindFilter(kind) {
+    if (kind == "packs") {
+        kindFilterState = "packs";
+        kindFilterSync();
+        $("#kindfilter > a").replaceWith("<a>display all entities</a>");
+        $("#kindfilter > a").click(function(event) { kindFilter("all"); });
+    }
+    else {
+        kindFilterState = "all";
+        kindFilterSync();
+        $("#kindfilter > a").replaceWith("<a>display packages only</a>");
+        $("#kindfilter > a").click(function(event) { kindFilter("packs"); });
+    }
+}
+
+/* Applies the kind filter. */
+function kindFilterSync() {
+    if (kindFilterState == "all" || focusFilterState != null) {
+        $("#tpl a.packhide").text('hide');
+        $("#tpl ol.templates").show();
+    } else {
+        $("#tpl a.packhide").text('show');
+        $("#tpl ol.templates").hide();
+    }
+}
+
+function resizeFilterBlock() {
+    $("#tpl").css("top", $("#filter").outerHeight(true));
+}


Reply via email to