Add crazy streaming JS at the last minute! holy crap! 2015-live
authorDavid Thompson <davet@gnu.org>
Fri, 20 Mar 2015 21:52:06 +0000 (17:52 -0400)
committerDavid Thompson <davet@gnu.org>
Fri, 20 Mar 2015 21:52:06 +0000 (17:52 -0400)
2015/assets/js/mithril.js [new file with mode: 0644]
2015/assets/js/mithril.min.js [new file with mode: 0644]
2015/assets/js/mithril.min.js.map [new file with mode: 0644]
2015/assets/js/stream.js
2015/live/index.html
server/2015/footer.html
server/staging/lp15/live_sidebar.html
server/staging/lp15/weblabels.html

diff --git a/2015/assets/js/mithril.js b/2015/assets/js/mithril.js
new file mode 100644 (file)
index 0000000..29082ca
--- /dev/null
@@ -0,0 +1,1024 @@
+var m = (function app(window, undefined) {
+       var OBJECT = "[object Object]", ARRAY = "[object Array]", STRING = "[object String]", FUNCTION = "function";
+       var type = {}.toString;
+       var parser = /(?:(^|#|\.)([^#\.\[\]]+))|(\[.+?\])/g, attrParser = /\[(.+?)(?:=("|'|)(.*?)\2)?\]/;
+       var voidElements = /^(AREA|BASE|BR|COL|COMMAND|EMBED|HR|IMG|INPUT|KEYGEN|LINK|META|PARAM|SOURCE|TRACK|WBR)$/;
+
+       // caching commonly used variables
+       var $document, $location, $requestAnimationFrame, $cancelAnimationFrame;
+
+       // self invoking function needed because of the way mocks work
+       function initialize(window){
+               $document = window.document;
+               $location = window.location;
+               $cancelAnimationFrame = window.cancelAnimationFrame || window.clearTimeout;
+               $requestAnimationFrame = window.requestAnimationFrame || window.setTimeout;
+       }
+
+       initialize(window);
+
+
+       /**
+        * @typedef {String} Tag
+        * A string that looks like -> div.classname#id[param=one][param2=two]
+        * Which describes a DOM node
+        */
+
+       /**
+        *
+        * @param {Tag} The DOM node tag
+        * @param {Object=[]} optional key-value pairs to be mapped to DOM attrs
+        * @param {...mNode=[]} Zero or more Mithril child nodes. Can be an array, or splat (optional)
+        *
+        */
+       function m() {
+               var args = [].slice.call(arguments);
+               var hasAttrs = args[1] != null && type.call(args[1]) === OBJECT && !("tag" in args[1]) && !("subtree" in args[1]);
+               var attrs = hasAttrs ? args[1] : {};
+               var classAttrName = "class" in attrs ? "class" : "className";
+               var cell = {tag: "div", attrs: {}};
+               var match, classes = [];
+               if (type.call(args[0]) != STRING) throw new Error("selector in m(selector, attrs, children) should be a string")
+               while (match = parser.exec(args[0])) {
+                       if (match[1] === "" && match[2]) cell.tag = match[2];
+                       else if (match[1] === "#") cell.attrs.id = match[2];
+                       else if (match[1] === ".") classes.push(match[2]);
+                       else if (match[3][0] === "[") {
+                               var pair = attrParser.exec(match[3]);
+                               cell.attrs[pair[1]] = pair[3] || (pair[2] ? "" :true)
+                       }
+               }
+               if (classes.length > 0) cell.attrs[classAttrName] = classes.join(" ");
+
+
+               var children = hasAttrs ? args[2] : args[1];
+               if (type.call(children) === ARRAY) {
+                       cell.children = children
+               }
+               else {
+                       cell.children = hasAttrs ? args.slice(2) : args.slice(1)
+               }
+
+               for (var attrName in attrs) {
+                       if (attrName === classAttrName) {
+                               if (attrs[attrName] !== "") cell.attrs[attrName] = (cell.attrs[attrName] || "") + " " + attrs[attrName];
+                       }
+                       else cell.attrs[attrName] = attrs[attrName]
+               }
+               return cell
+       }
+       function build(parentElement, parentTag, parentCache, parentIndex, data, cached, shouldReattach, index, editable, namespace, configs) {
+               //`build` is a recursive function that manages creation/diffing/removal of DOM elements based on comparison between `data` and `cached`
+               //the diff algorithm can be summarized as this:
+               //1 - compare `data` and `cached`
+               //2 - if they are different, copy `data` to `cached` and update the DOM based on what the difference is
+               //3 - recursively apply this algorithm for every array and for the children of every virtual element
+
+               //the `cached` data structure is essentially the same as the previous redraw's `data` data structure, with a few additions:
+               //- `cached` always has a property called `nodes`, which is a list of DOM elements that correspond to the data represented by the respective virtual element
+               //- in order to support attaching `nodes` as a property of `cached`, `cached` is *always* a non-primitive object, i.e. if the data was a string, then cached is a String instance. If data was `null` or `undefined`, cached is `new String("")`
+               //- `cached also has a `configContext` property, which is the state storage object exposed by config(element, isInitialized, context)
+               //- when `cached` is an Object, it represents a virtual element; when it's an Array, it represents a list of elements; when it's a String, Number or Boolean, it represents a text node
+
+               //`parentElement` is a DOM element used for W3C DOM API calls
+               //`parentTag` is only used for handling a corner case for textarea values
+               //`parentCache` is used to remove nodes in some multi-node cases
+               //`parentIndex` and `index` are used to figure out the offset of nodes. They're artifacts from before arrays started being flattened and are likely refactorable
+               //`data` and `cached` are, respectively, the new and old nodes being diffed
+               //`shouldReattach` is a flag indicating whether a parent node was recreated (if so, and if this node is reused, then this node must reattach itself to the new parent)
+               //`editable` is a flag that indicates whether an ancestor is contenteditable
+               //`namespace` indicates the closest HTML namespace as it cascades down from an ancestor
+               //`configs` is a list of config functions to run after the topmost `build` call finishes running
+
+               //there's logic that relies on the assumption that null and undefined data are equivalent to empty strings
+               //- this prevents lifecycle surprises from procedural helpers that mix implicit and explicit return statements (e.g. function foo() {if (cond) return m("div")}
+               //- it simplifies diffing code
+               //data.toString() is null if data is the return value of Console.log in Firefox
+               if (data == null || data.toString() == null) data = "";
+               if (data.subtree === "retain") return cached;
+               var cachedType = type.call(cached), dataType = type.call(data);
+               if (cached == null || cachedType !== dataType) {
+                       if (cached != null) {
+                               if (parentCache && parentCache.nodes) {
+                                       var offset = index - parentIndex;
+                                       var end = offset + (dataType === ARRAY ? data : cached.nodes).length;
+                                       clear(parentCache.nodes.slice(offset, end), parentCache.slice(offset, end))
+                               }
+                               else if (cached.nodes) clear(cached.nodes, cached)
+                       }
+                       cached = new data.constructor;
+                       if (cached.tag) cached = {}; //if constructor creates a virtual dom element, use a blank object as the base cached node instead of copying the virtual el (#277)
+                       cached.nodes = []
+               }
+
+               if (dataType === ARRAY) {
+                       //recursively flatten array
+                       for (var i = 0, len = data.length; i < len; i++) {
+                               if (type.call(data[i]) === ARRAY) {
+                                       data = data.concat.apply([], data);
+                                       i-- //check current index again and flatten until there are no more nested arrays at that index
+                               }
+                       }
+                       
+                       var nodes = [], intact = cached.length === data.length, subArrayCount = 0;
+
+                       //keys algorithm: sort elements without recreating them if keys are present
+                       //1) create a map of all existing keys, and mark all for deletion
+                       //2) add new keys to map and mark them for addition
+                       //3) if key exists in new list, change action from deletion to a move
+                       //4) for each key, handle its corresponding action as marked in previous steps
+                       //5) copy unkeyed items into their respective gaps
+                       var DELETION = 1, INSERTION = 2 , MOVE = 3;
+                       var existing = {}, unkeyed = [], shouldMaintainIdentities = false;
+                       for (var i = 0; i < cached.length; i++) {
+                               if (cached[i] && cached[i].attrs && cached[i].attrs.key != null) {
+                                       shouldMaintainIdentities = true;
+                                       existing[cached[i].attrs.key] = {action: DELETION, index: i}
+                               }
+                       }
+                       if (shouldMaintainIdentities) {
+                               if (data.indexOf(null) > -1) data = data.filter(function(x) {return x != null})
+                               
+                               var keysDiffer = false
+                               if (data.length != cached.length) keysDiffer = true
+                               else for (var i = 0, cachedCell, dataCell; cachedCell = cached[i], dataCell = data[i]; i++) {
+                                       if (cachedCell.attrs && dataCell.attrs && cachedCell.attrs.key != dataCell.attrs.key) {
+                                               keysDiffer = true
+                                               break
+                                       }
+                               }
+                               
+                               if (keysDiffer) {
+                                       for (var i = 0, len = data.length; i < len; i++) {
+                                               if (data[i] && data[i].attrs) {
+                                                       if (data[i].attrs.key != null) {
+                                                               var key = data[i].attrs.key;
+                                                               if (!existing[key]) existing[key] = {action: INSERTION, index: i};
+                                                               else existing[key] = {
+                                                                       action: MOVE,
+                                                                       index: i,
+                                                                       from: existing[key].index,
+                                                                       element: cached.nodes[existing[key].index] || $document.createElement("div")
+                                                               }
+                                                       }
+                                                       else unkeyed.push({index: i, element: parentElement.childNodes[i] || $document.createElement("div")})
+                                               }
+                                       }
+                                       var actions = []
+                                       for (var prop in existing) actions.push(existing[prop])
+                                       var changes = actions.sort(sortChanges);
+                                       var newCached = new Array(cached.length)
+
+                                       for (var i = 0, change; change = changes[i]; i++) {
+                                               if (change.action === DELETION) {
+                                                       clear(cached[change.index].nodes, cached[change.index]);
+                                                       newCached.splice(change.index, 1)
+                                               }
+                                               if (change.action === INSERTION) {
+                                                       var dummy = $document.createElement("div");
+                                                       dummy.key = data[change.index].attrs.key;
+                                                       parentElement.insertBefore(dummy, parentElement.childNodes[change.index] || null);
+                                                       newCached.splice(change.index, 0, {attrs: {key: data[change.index].attrs.key}, nodes: [dummy]})
+                                               }
+
+                                               if (change.action === MOVE) {
+                                                       if (parentElement.childNodes[change.index] !== change.element && change.element !== null) {
+                                                               parentElement.insertBefore(change.element, parentElement.childNodes[change.index] || null)
+                                                       }
+                                                       newCached[change.index] = cached[change.from]
+                                               }
+                                       }
+                                       for (var i = 0, len = unkeyed.length; i < len; i++) {
+                                               var change = unkeyed[i];
+                                               parentElement.insertBefore(change.element, parentElement.childNodes[change.index] || null);
+                                               newCached[change.index] = cached[change.index]
+                                       }
+                                       cached = newCached;
+                                       cached.nodes = new Array(parentElement.childNodes.length);
+                                       for (var i = 0, child; child = parentElement.childNodes[i]; i++) cached.nodes[i] = child
+                               }
+                       }
+                       //end key algorithm
+
+                       for (var i = 0, cacheCount = 0, len = data.length; i < len; i++) {
+                               //diff each item in the array
+                               var item = build(parentElement, parentTag, cached, index, data[i], cached[cacheCount], shouldReattach, index + subArrayCount || subArrayCount, editable, namespace, configs);
+                               if (item === undefined) continue;
+                               if (!item.nodes.intact) intact = false;
+                               if (item.$trusted) {
+                                       //fix offset of next element if item was a trusted string w/ more than one html element
+                                       //the first clause in the regexp matches elements
+                                       //the second clause (after the pipe) matches text nodes
+                                       subArrayCount += (item.match(/<[^\/]|\>\s*[^<]/g) || []).length
+                               }
+                               else subArrayCount += type.call(item) === ARRAY ? item.length : 1;
+                               cached[cacheCount++] = item
+                       }
+                       if (!intact) {
+                               //diff the array itself
+                               
+                               //update the list of DOM nodes by collecting the nodes from each item
+                               for (var i = 0, len = data.length; i < len; i++) {
+                                       if (cached[i] != null) nodes.push.apply(nodes, cached[i].nodes)
+                               }
+                               //remove items from the end of the array if the new array is shorter than the old one
+                               //if errors ever happen here, the issue is most likely a bug in the construction of the `cached` data structure somewhere earlier in the program
+                               for (var i = 0, node; node = cached.nodes[i]; i++) {
+                                       if (node.parentNode != null && nodes.indexOf(node) < 0) clear([node], [cached[i]])
+                               }
+                               if (data.length < cached.length) cached.length = data.length;
+                               cached.nodes = nodes
+                       }
+               }
+               else if (data != null && dataType === OBJECT) {
+                       if (!data.attrs) data.attrs = {};
+                       if (!cached.attrs) cached.attrs = {};
+
+                       var dataAttrKeys = Object.keys(data.attrs)
+                       var hasKeys = dataAttrKeys.length > ("key" in data.attrs ? 1 : 0)
+                       //if an element is different enough from the one in cache, recreate it
+                       if (data.tag != cached.tag || dataAttrKeys.join() != Object.keys(cached.attrs).join() || data.attrs.id != cached.attrs.id) {
+                               if (cached.nodes.length) clear(cached.nodes);
+                               if (cached.configContext && typeof cached.configContext.onunload === FUNCTION) cached.configContext.onunload()
+                       }
+                       if (type.call(data.tag) != STRING) return;
+
+                       var node, isNew = cached.nodes.length === 0;
+                       if (data.attrs.xmlns) namespace = data.attrs.xmlns;
+                       else if (data.tag === "svg") namespace = "http://www.w3.org/2000/svg";
+                       else if (data.tag === "math") namespace = "http://www.w3.org/1998/Math/MathML";
+                       if (isNew) {
+                               if (data.attrs.is) node = namespace === undefined ? $document.createElement(data.tag, data.attrs.is) : $document.createElementNS(namespace, data.tag, data.attrs.is);
+                               else node = namespace === undefined ? $document.createElement(data.tag) : $document.createElementNS(namespace, data.tag);
+                               cached = {
+                                       tag: data.tag,
+                                       //set attributes first, then create children
+                                       attrs: hasKeys ? setAttributes(node, data.tag, data.attrs, {}, namespace) : data.attrs,
+                                       children: data.children != null && data.children.length > 0 ?
+                                               build(node, data.tag, undefined, undefined, data.children, cached.children, true, 0, data.attrs.contenteditable ? node : editable, namespace, configs) :
+                                               data.children,
+                                       nodes: [node]
+                               };
+                               if (cached.children && !cached.children.nodes) cached.children.nodes = [];
+                               //edge case: setting value on <select> doesn't work before children exist, so set it again after children have been created
+                               if (data.tag === "select" && data.attrs.value) setAttributes(node, data.tag, {value: data.attrs.value}, {}, namespace);
+                               parentElement.insertBefore(node, parentElement.childNodes[index] || null)
+                       }
+                       else {
+                               node = cached.nodes[0];
+                               if (hasKeys) setAttributes(node, data.tag, data.attrs, cached.attrs, namespace);
+                               cached.children = build(node, data.tag, undefined, undefined, data.children, cached.children, false, 0, data.attrs.contenteditable ? node : editable, namespace, configs);
+                               cached.nodes.intact = true;
+                               if (shouldReattach === true && node != null) parentElement.insertBefore(node, parentElement.childNodes[index] || null)
+                       }
+                       //schedule configs to be called. They are called after `build` finishes running
+                       if (typeof data.attrs["config"] === FUNCTION) {
+                               var context = cached.configContext = cached.configContext || {};
+
+                               // bind
+                               var callback = function(data, args) {
+                                       return function() {
+                                               return data.attrs["config"].apply(data, args)
+                                       }
+                               };
+                               configs.push(callback(data, [node, !isNew, context, cached]))
+                       }
+               }
+               else if (typeof dataType != FUNCTION) {
+                       //handle text nodes
+                       var nodes;
+                       if (cached.nodes.length === 0) {
+                               if (data.$trusted) {
+                                       nodes = injectHTML(parentElement, index, data)
+                               }
+                               else {
+                                       nodes = [$document.createTextNode(data)];
+                                       if (!parentElement.nodeName.match(voidElements)) parentElement.insertBefore(nodes[0], parentElement.childNodes[index] || null)
+                               }
+                               cached = "string number boolean".indexOf(typeof data) > -1 ? new data.constructor(data) : data;
+                               cached.nodes = nodes
+                       }
+                       else if (cached.valueOf() !== data.valueOf() || shouldReattach === true) {
+                               nodes = cached.nodes;
+                               if (!editable || editable !== $document.activeElement) {
+                                       if (data.$trusted) {
+                                               clear(nodes, cached);
+                                               nodes = injectHTML(parentElement, index, data)
+                                       }
+                                       else {
+                                               //corner case: replacing the nodeValue of a text node that is a child of a textarea/contenteditable doesn't work
+                                               //we need to update the value property of the parent textarea or the innerHTML of the contenteditable element instead
+                                               if (parentTag === "textarea") parentElement.value = data;
+                                               else if (editable) editable.innerHTML = data;
+                                               else {
+                                                       if (nodes[0].nodeType === 1 || nodes.length > 1) { //was a trusted string
+                                                               clear(cached.nodes, cached);
+                                                               nodes = [$document.createTextNode(data)]
+                                                       }
+                                                       parentElement.insertBefore(nodes[0], parentElement.childNodes[index] || null);
+                                                       nodes[0].nodeValue = data
+                                               }
+                                       }
+                               }
+                               cached = new data.constructor(data);
+                               cached.nodes = nodes
+                       }
+                       else cached.nodes.intact = true
+               }
+
+               return cached
+       }
+       function sortChanges(a, b) {return a.action - b.action || a.index - b.index}
+       function setAttributes(node, tag, dataAttrs, cachedAttrs, namespace) {
+               for (var attrName in dataAttrs) {
+                       var dataAttr = dataAttrs[attrName];
+                       var cachedAttr = cachedAttrs[attrName];
+                       if (!(attrName in cachedAttrs) || (cachedAttr !== dataAttr)) {
+                               cachedAttrs[attrName] = dataAttr;
+                               try {
+                                       //`config` isn't a real attributes, so ignore it
+                                       if (attrName === "config" || attrName == "key") continue;
+                                       //hook event handlers to the auto-redrawing system
+                                       else if (typeof dataAttr === FUNCTION && attrName.indexOf("on") === 0) {
+                                               node[attrName] = autoredraw(dataAttr, node)
+                                       }
+                                       //handle `style: {...}`
+                                       else if (attrName === "style" && dataAttr != null && type.call(dataAttr) === OBJECT) {
+                                               for (var rule in dataAttr) {
+                                                       if (cachedAttr == null || cachedAttr[rule] !== dataAttr[rule]) node.style[rule] = dataAttr[rule]
+                                               }
+                                               for (var rule in cachedAttr) {
+                                                       if (!(rule in dataAttr)) node.style[rule] = ""
+                                               }
+                                       }
+                                       //handle SVG
+                                       else if (namespace != null) {
+                                               if (attrName === "href") node.setAttributeNS("http://www.w3.org/1999/xlink", "href", dataAttr);
+                                               else if (attrName === "className") node.setAttribute("class", dataAttr);
+                                               else node.setAttribute(attrName, dataAttr)
+                                       }
+                                       //handle cases that are properties (but ignore cases where we should use setAttribute instead)
+                                       //- list and form are typically used as strings, but are DOM element references in js
+                                       //- when using CSS selectors (e.g. `m("[style='']")`), style is used as a string, but it's an object in js
+                                       else if (attrName in node && !(attrName === "list" || attrName === "style" || attrName === "form" || attrName === "type")) {
+                                               //#348 don't set the value if not needed otherwise cursor placement breaks in Chrome
+                                               if (tag !== "input" || node[attrName] !== dataAttr) node[attrName] = dataAttr
+                                       }
+                                       else node.setAttribute(attrName, dataAttr)
+                               }
+                               catch (e) {
+                                       //swallow IE's invalid argument errors to mimic HTML's fallback-to-doing-nothing-on-invalid-attributes behavior
+                                       if (e.message.indexOf("Invalid argument") < 0) throw e
+                               }
+                       }
+                       //#348 dataAttr may not be a string, so use loose comparison (double equal) instead of strict (triple equal)
+                       else if (attrName === "value" && tag === "input" && node.value != dataAttr) {
+                               node.value = dataAttr
+                       }
+               }
+               return cachedAttrs
+       }
+       function clear(nodes, cached) {
+               for (var i = nodes.length - 1; i > -1; i--) {
+                       if (nodes[i] && nodes[i].parentNode) {
+                               try {nodes[i].parentNode.removeChild(nodes[i])}
+                               catch (e) {} //ignore if this fails due to order of events (see http://stackoverflow.com/questions/21926083/failed-to-execute-removechild-on-node)
+                               cached = [].concat(cached);
+                               if (cached[i]) unload(cached[i])
+                       }
+               }
+               if (nodes.length != 0) nodes.length = 0
+       }
+       function unload(cached) {
+               if (cached.configContext && typeof cached.configContext.onunload === FUNCTION) cached.configContext.onunload();
+               if (cached.children) {
+                       if (type.call(cached.children) === ARRAY) {
+                               for (var i = 0, child; child = cached.children[i]; i++) unload(child)
+                       }
+                       else if (cached.children.tag) unload(cached.children)
+               }
+       }
+       function injectHTML(parentElement, index, data) {
+               var nextSibling = parentElement.childNodes[index];
+               if (nextSibling) {
+                       var isElement = nextSibling.nodeType != 1;
+                       var placeholder = $document.createElement("span");
+                       if (isElement) {
+                               parentElement.insertBefore(placeholder, nextSibling || null);
+                               placeholder.insertAdjacentHTML("beforebegin", data);
+                               parentElement.removeChild(placeholder)
+                       }
+                       else nextSibling.insertAdjacentHTML("beforebegin", data)
+               }
+               else parentElement.insertAdjacentHTML("beforeend", data);
+               var nodes = [];
+               while (parentElement.childNodes[index] !== nextSibling) {
+                       nodes.push(parentElement.childNodes[index]);
+                       index++
+               }
+               return nodes
+       }
+       function autoredraw(callback, object) {
+               return function(e) {
+                       e = e || event;
+                       m.redraw.strategy("diff");
+                       m.startComputation();
+                       try {return callback.call(object, e)}
+                       finally {
+                               endFirstComputation()
+                       }
+               }
+       }
+
+       var html;
+       var documentNode = {
+               appendChild: function(node) {
+                       if (html === undefined) html = $document.createElement("html");
+                       if ($document.documentElement && $document.documentElement !== node) {
+                               $document.replaceChild(node, $document.documentElement)
+                       }
+                       else $document.appendChild(node);
+                       this.childNodes = $document.childNodes
+               },
+               insertBefore: function(node) {
+                       this.appendChild(node)
+               },
+               childNodes: []
+       };
+       var nodeCache = [], cellCache = {};
+       m.render = function(root, cell, forceRecreation) {
+               var configs = [];
+               if (!root) throw new Error("Please ensure the DOM element exists before rendering a template into it.");
+               var id = getCellCacheKey(root);
+               var isDocumentRoot = root === $document;
+               var node = isDocumentRoot || root === $document.documentElement ? documentNode : root;
+               if (isDocumentRoot && cell.tag != "html") cell = {tag: "html", attrs: {}, children: cell};
+               if (cellCache[id] === undefined) clear(node.childNodes);
+               if (forceRecreation === true) reset(root);
+               cellCache[id] = build(node, null, undefined, undefined, cell, cellCache[id], false, 0, null, undefined, configs);
+               for (var i = 0, len = configs.length; i < len; i++) configs[i]()
+       };
+       function getCellCacheKey(element) {
+               var index = nodeCache.indexOf(element);
+               return index < 0 ? nodeCache.push(element) - 1 : index
+       }
+
+       m.trust = function(value) {
+               value = new String(value);
+               value.$trusted = true;
+               return value
+       };
+
+       function gettersetter(store) {
+               var prop = function() {
+                       if (arguments.length) store = arguments[0];
+                       return store
+               };
+
+               prop.toJSON = function() {
+                       return store
+               };
+
+               return prop
+       }
+
+       m.prop = function (store) {
+               //note: using non-strict equality check here because we're checking if store is null OR undefined
+               if (((store != null && type.call(store) === OBJECT) || typeof store === FUNCTION) && typeof store.then === FUNCTION) {
+                       return propify(store)
+               }
+
+               return gettersetter(store)
+       };
+
+       var roots = [], modules = [], controllers = [], lastRedrawId = null, lastRedrawCallTime = 0, computePostRedrawHook = null, prevented = false, topModule;
+       var FRAME_BUDGET = 16; //60 frames per second = 1 call per 16 ms
+       m.module = function(root, module) {
+               if (!root) throw new Error("Please ensure the DOM element exists before rendering a template into it.");
+               var index = roots.indexOf(root);
+               if (index < 0) index = roots.length;
+               var isPrevented = false;
+               if (controllers[index] && typeof controllers[index].onunload === FUNCTION) {
+                       var event = {
+                               preventDefault: function() {isPrevented = true}
+                       };
+                       controllers[index].onunload(event)
+               }
+               if (!isPrevented) {
+                       m.redraw.strategy("all");
+                       m.startComputation();
+                       roots[index] = root;
+                       var currentModule = topModule = module = module || {};
+                       var controller = new (module.controller || function() {});
+                       //controllers may call m.module recursively (via m.route redirects, for example)
+                       //this conditional ensures only the last recursive m.module call is applied
+                       if (currentModule === topModule) {
+                               controllers[index] = controller;
+                               modules[index] = module
+                       }
+                       endFirstComputation();
+                       return controllers[index]
+               }
+       };
+       m.redraw = function(force) {
+               //lastRedrawId is a positive number if a second redraw is requested before the next animation frame
+               //lastRedrawID is null if it's the first redraw and not an event handler
+               if (lastRedrawId && force !== true) {
+                       //when setTimeout: only reschedule redraw if time between now and previous redraw is bigger than a frame, otherwise keep currently scheduled timeout
+                       //when rAF: always reschedule redraw
+                       if (new Date - lastRedrawCallTime > FRAME_BUDGET || $requestAnimationFrame === window.requestAnimationFrame) {
+                               if (lastRedrawId > 0) $cancelAnimationFrame(lastRedrawId);
+                               lastRedrawId = $requestAnimationFrame(redraw, FRAME_BUDGET)
+                       }
+               }
+               else {
+                       redraw();
+                       lastRedrawId = $requestAnimationFrame(function() {lastRedrawId = null}, FRAME_BUDGET)
+               }
+       };
+       m.redraw.strategy = m.prop();
+       var blank = function() {return ""}
+       function redraw() {
+               var forceRedraw = m.redraw.strategy() === "all";
+               for (var i = 0, root; root = roots[i]; i++) {
+                       if (controllers[i]) {
+                               m.render(root, modules[i].view ? modules[i].view(controllers[i]) : blank(), forceRedraw)
+                       }
+               }
+               //after rendering within a routed context, we need to scroll back to the top, and fetch the document title for history.pushState
+               if (computePostRedrawHook) {
+                       computePostRedrawHook();
+                       computePostRedrawHook = null
+               }
+               lastRedrawId = null;
+               lastRedrawCallTime = new Date;
+               m.redraw.strategy("diff")
+       }
+
+       var pendingRequests = 0;
+       m.startComputation = function() {pendingRequests++};
+       m.endComputation = function() {
+               pendingRequests = Math.max(pendingRequests - 1, 0);
+               if (pendingRequests === 0) m.redraw()
+       };
+       var endFirstComputation = function() {
+               if (m.redraw.strategy() == "none") {
+                       pendingRequests--
+                       m.redraw.strategy("diff")
+               }
+               else m.endComputation();
+       }
+
+       m.withAttr = function(prop, withAttrCallback) {
+               return function(e) {
+                       e = e || event;
+                       var currentTarget = e.currentTarget || this;
+                       withAttrCallback(prop in currentTarget ? currentTarget[prop] : currentTarget.getAttribute(prop))
+               }
+       };
+
+       //routing
+       var modes = {pathname: "", hash: "#", search: "?"};
+       var redirect = function() {}, routeParams, currentRoute;
+       m.route = function() {
+               //m.route()
+               if (arguments.length === 0) return currentRoute;
+               //m.route(el, defaultRoute, routes)
+               else if (arguments.length === 3 && type.call(arguments[1]) === STRING) {
+                       var root = arguments[0], defaultRoute = arguments[1], router = arguments[2];
+                       redirect = function(source) {
+                               var path = currentRoute = normalizeRoute(source);
+                               if (!routeByValue(root, router, path)) {
+                                       m.route(defaultRoute, true)
+                               }
+                       };
+                       var listener = m.route.mode === "hash" ? "onhashchange" : "onpopstate";
+                       window[listener] = function() {
+                               var path = $location[m.route.mode]
+                               if (m.route.mode === "pathname") path += $location.search
+                               if (currentRoute != normalizeRoute(path)) {
+                                       redirect(path)
+                               }
+                       };
+                       computePostRedrawHook = setScroll;
+                       window[listener]()
+               }
+               //config: m.route
+               else if (arguments[0].addEventListener) {
+                       var element = arguments[0];
+                       var isInitialized = arguments[1];
+                       var context = arguments[2];
+                       element.href = (m.route.mode !== 'pathname' ? $location.pathname : '') + modes[m.route.mode] + this.attrs.href;
+                       element.removeEventListener("click", routeUnobtrusive);
+                       element.addEventListener("click", routeUnobtrusive)
+               }
+               //m.route(route, params)
+               else if (type.call(arguments[0]) === STRING) {
+                       var oldRoute = currentRoute;
+                       currentRoute = arguments[0];
+                       var args = arguments[1] || {}
+                       var queryIndex = currentRoute.indexOf("?")
+                       var params = queryIndex > -1 ? parseQueryString(currentRoute.slice(queryIndex + 1)) : {}
+                       for (var i in args) params[i] = args[i]
+                       var querystring = buildQueryString(params)
+                       var currentPath = queryIndex > -1 ? currentRoute.slice(0, queryIndex) : currentRoute
+                       if (querystring) currentRoute = currentPath + (currentPath.indexOf("?") === -1 ? "?" : "&") + querystring;
+
+                       var shouldReplaceHistoryEntry = (arguments.length === 3 ? arguments[2] : arguments[1]) === true || oldRoute === arguments[0];
+
+                       if (window.history.pushState) {
+                               computePostRedrawHook = function() {
+                                       window.history[shouldReplaceHistoryEntry ? "replaceState" : "pushState"](null, $document.title, modes[m.route.mode] + currentRoute);
+                                       setScroll()
+                               };
+                               redirect(modes[m.route.mode] + currentRoute)
+                       }
+                       else $location[m.route.mode] = currentRoute
+               }
+       };
+       m.route.param = function(key) {
+               if (!routeParams) throw new Error("You must call m.route(element, defaultRoute, routes) before calling m.route.param()")
+               return routeParams[key]
+       };
+       m.route.mode = "search";
+       function normalizeRoute(route) {
+               return route.slice(modes[m.route.mode].length)
+       }
+       function routeByValue(root, router, path) {
+               routeParams = {};
+
+               var queryStart = path.indexOf("?");
+               if (queryStart !== -1) {
+                       routeParams = parseQueryString(path.substr(queryStart + 1, path.length));
+                       path = path.substr(0, queryStart)
+               }
+
+               for (var route in router) {
+                       if (route === path) {
+                               m.module(root, router[route]);
+                               return true
+                       }
+
+                       var matcher = new RegExp("^" + route.replace(/:[^\/]+?\.{3}/g, "(.*?)").replace(/:[^\/]+/g, "([^\\/]+)") + "\/?$");
+
+                       if (matcher.test(path)) {
+                               path.replace(matcher, function() {
+                                       var keys = route.match(/:[^\/]+/g) || [];
+                                       var values = [].slice.call(arguments, 1, -2);
+                                       for (var i = 0, len = keys.length; i < len; i++) routeParams[keys[i].replace(/:|\./g, "")] = decodeURIComponent(values[i])
+                                       m.module(root, router[route])
+                               });
+                               return true
+                       }
+               }
+       }
+       function routeUnobtrusive(e) {
+               e = e || event;
+               if (e.ctrlKey || e.metaKey || e.which === 2) return;
+               if (e.preventDefault) e.preventDefault();
+               else e.returnValue = false;
+               var currentTarget = e.currentTarget || this;
+               var args = m.route.mode === "pathname" && currentTarget.search ? parseQueryString(currentTarget.search.slice(1)) : {};
+               m.route(currentTarget[m.route.mode].slice(modes[m.route.mode].length), args)
+       }
+       function setScroll() {
+               if (m.route.mode != "hash" && $location.hash) $location.hash = $location.hash;
+               else window.scrollTo(0, 0)
+       }
+       function buildQueryString(object, prefix) {
+               var str = [];
+               for(var prop in object) {
+                       var key = prefix ? prefix + "[" + prop + "]" : prop, value = object[prop];
+                       var valueType = type.call(value)
+                       var pair = value != null && (valueType === OBJECT) ?
+                               buildQueryString(value, key) :
+                               valueType === ARRAY ?
+                                       value.map(function(item) {return encodeURIComponent(key + "[]") + "=" + encodeURIComponent(item)}).join("&") :
+                                       encodeURIComponent(key) + "=" + encodeURIComponent(value)
+                       str.push(pair)
+               }
+               return str.join("&")
+       }
+       
+       function parseQueryString(str) {
+               var pairs = str.split("&"), params = {};
+               for (var i = 0, len = pairs.length; i < len; i++) {
+                       var pair = pairs[i].split("=");
+                       params[decodeURIComponent(pair[0])] = pair[1] ? decodeURIComponent(pair[1]) : ""
+               }
+               return params
+       }
+       function reset(root) {
+               var cacheKey = getCellCacheKey(root);
+               clear(root.childNodes, cellCache[cacheKey]);
+               cellCache[cacheKey] = undefined
+       }
+
+       m.deferred = function () {
+               var deferred = new Deferred();
+               deferred.promise = propify(deferred.promise);
+               return deferred
+       };
+       function propify(promise) {
+               var prop = m.prop();
+               promise.then(prop);
+               prop.then = function(resolve, reject) {
+                       return propify(promise.then(resolve, reject))
+               };
+               return prop
+       }
+       //Promiz.mithril.js | Zolmeister | MIT
+       //a modified version of Promiz.js, which does not conform to Promises/A+ for two reasons:
+       //1) `then` callbacks are called synchronously (because setTimeout is too slow, and the setImmediate polyfill is too big
+       //2) throwing subclasses of Error cause the error to be bubbled up instead of triggering rejection (because the spec does not account for the important use case of default browser error handling, i.e. message w/ line number)
+       function Deferred(successCallback, failureCallback) {
+               var RESOLVING = 1, REJECTING = 2, RESOLVED = 3, REJECTED = 4;
+               var self = this, state = 0, promiseValue = 0, next = [];
+
+               self["promise"] = {};
+
+               self["resolve"] = function(value) {
+                       if (!state) {
+                               promiseValue = value;
+                               state = RESOLVING;
+
+                               fire()
+                       }
+                       return this
+               };
+
+               self["reject"] = function(value) {
+                       if (!state) {
+                               promiseValue = value;
+                               state = REJECTING;
+
+                               fire()
+                       }
+                       return this
+               };
+
+               self.promise["then"] = function(successCallback, failureCallback) {
+                       var deferred = new Deferred(successCallback, failureCallback);
+                       if (state === RESOLVED) {
+                               deferred.resolve(promiseValue)
+                       }
+                       else if (state === REJECTED) {
+                               deferred.reject(promiseValue)
+                       }
+                       else {
+                               next.push(deferred)
+                       }
+                       return deferred.promise
+               };
+
+               function finish(type) {
+                       state = type || REJECTED;
+                       next.map(function(deferred) {
+                               state === RESOLVED && deferred.resolve(promiseValue) || deferred.reject(promiseValue)
+                       })
+               }
+
+               function thennable(then, successCallback, failureCallback, notThennableCallback) {
+                       if (((promiseValue != null && type.call(promiseValue) === OBJECT) || typeof promiseValue === FUNCTION) && typeof then === FUNCTION) {
+                               try {
+                                       // count protects against abuse calls from spec checker
+                                       var count = 0;
+                                       then.call(promiseValue, function(value) {
+                                               if (count++) return;
+                                               promiseValue = value;
+                                               successCallback()
+                                       }, function (value) {
+                                               if (count++) return;
+                                               promiseValue = value;
+                                               failureCallback()
+                                       })
+                               }
+                               catch (e) {
+                                       m.deferred.onerror(e);
+                                       promiseValue = e;
+                                       failureCallback()
+                               }
+                       } else {
+                               notThennableCallback()
+                       }
+               }
+
+               function fire() {
+                       // check if it's a thenable
+                       var then;
+                       try {
+                               then = promiseValue && promiseValue.then
+                       }
+                       catch (e) {
+                               m.deferred.onerror(e);
+                               promiseValue = e;
+                               state = REJECTING;
+                               return fire()
+                       }
+                       thennable(then, function() {
+                               state = RESOLVING;
+                               fire()
+                       }, function() {
+                               state = REJECTING;
+                               fire()
+                       }, function() {
+                               try {
+                                       if (state === RESOLVING && typeof successCallback === FUNCTION) {
+                                               promiseValue = successCallback(promiseValue)
+                                       }
+                                       else if (state === REJECTING && typeof failureCallback === "function") {
+                                               promiseValue = failureCallback(promiseValue);
+                                               state = RESOLVING
+                                       }
+                               }
+                               catch (e) {
+                                       m.deferred.onerror(e);
+                                       promiseValue = e;
+                                       return finish()
+                               }
+
+                               if (promiseValue === self) {
+                                       promiseValue = TypeError();
+                                       finish()
+                               }
+                               else {
+                                       thennable(then, function () {
+                                               finish(RESOLVED)
+                                       }, finish, function () {
+                                               finish(state === RESOLVING && RESOLVED)
+                                       })
+                               }
+                       })
+               }
+       }
+       m.deferred.onerror = function(e) {
+               if (type.call(e) === "[object Error]" && !e.constructor.toString().match(/ Error/)) throw e
+       };
+
+       m.sync = function(args) {
+               var method = "resolve";
+               function synchronizer(pos, resolved) {
+                       return function(value) {
+                               results[pos] = value;
+                               if (!resolved) method = "reject";
+                               if (--outstanding === 0) {
+                                       deferred.promise(results);
+                                       deferred[method](results)
+                               }
+                               return value
+                       }
+               }
+
+               var deferred = m.deferred();
+               var outstanding = args.length;
+               var results = new Array(outstanding);
+               if (args.length > 0) {
+                       for (var i = 0; i < args.length; i++) {
+                               args[i].then(synchronizer(i, true), synchronizer(i, false))
+                       }
+               }
+               else deferred.resolve([]);
+
+               return deferred.promise
+       };
+       function identity(value) {return value}
+
+       function ajax(options) {
+               if (options.dataType && options.dataType.toLowerCase() === "jsonp") {
+                       var callbackKey = "mithril_callback_" + new Date().getTime() + "_" + (Math.round(Math.random() * 1e16)).toString(36);
+                       var script = $document.createElement("script");
+
+                       window[callbackKey] = function(resp) {
+                               script.parentNode.removeChild(script);
+                               options.onload({
+                                       type: "load",
+                                       target: {
+                                               responseText: resp
+                                       }
+                               });
+                               window[callbackKey] = undefined
+                       };
+
+                       script.onerror = function(e) {
+                               script.parentNode.removeChild(script);
+
+                               options.onerror({
+                                       type: "error",
+                                       target: {
+                                               status: 500,
+                                               responseText: JSON.stringify({error: "Error making jsonp request"})
+                                       }
+                               });
+                               window[callbackKey] = undefined;
+
+                               return false
+                       };
+
+                       script.onload = function(e) {
+                               return false
+                       };
+
+                       script.src = options.url
+                               + (options.url.indexOf("?") > 0 ? "&" : "?")
+                               + (options.callbackKey ? options.callbackKey : "callback")
+                               + "=" + callbackKey
+                               + "&" + buildQueryString(options.data || {});
+                       $document.body.appendChild(script)
+               }
+               else {
+                       var xhr = new window.XMLHttpRequest;
+                       xhr.open(options.method, options.url, true, options.user, options.password);
+                       xhr.onreadystatechange = function() {
+                               if (xhr.readyState === 4) {
+                                       if (xhr.status >= 200 && xhr.status < 300) options.onload({type: "load", target: xhr});
+                                       else options.onerror({type: "error", target: xhr})
+                               }
+                       };
+                       if (options.serialize === JSON.stringify && options.data && options.method !== "GET") {
+                               xhr.setRequestHeader("Content-Type", "application/json; charset=utf-8")
+                       }
+                       if (options.deserialize === JSON.parse) {
+                               xhr.setRequestHeader("Accept", "application/json, text/*");
+                       }
+                       if (typeof options.config === FUNCTION) {
+                               var maybeXhr = options.config(xhr, options);
+                               if (maybeXhr != null) xhr = maybeXhr
+                       }
+
+                       var data = options.method === "GET" || !options.data ? "" : options.data
+                       if (data && (type.call(data) != STRING && data.constructor != window.FormData)) {
+                               throw "Request data should be either be a string or FormData. Check the `serialize` option in `m.request`";
+                       }
+                       xhr.send(data);
+                       return xhr
+               }
+       }
+       function bindData(xhrOptions, data, serialize) {
+               if (xhrOptions.method === "GET" && xhrOptions.dataType != "jsonp") {
+                       var prefix = xhrOptions.url.indexOf("?") < 0 ? "?" : "&";
+                       var querystring = buildQueryString(data);
+                       xhrOptions.url = xhrOptions.url + (querystring ? prefix + querystring : "")
+               }
+               else xhrOptions.data = serialize(data);
+               return xhrOptions
+       }
+       function parameterizeUrl(url, data) {
+               var tokens = url.match(/:[a-z]\w+/gi);
+               if (tokens && data) {
+                       for (var i = 0; i < tokens.length; i++) {
+                               var key = tokens[i].slice(1);
+                               url = url.replace(tokens[i], data[key]);
+                               delete data[key]
+                       }
+               }
+               return url
+       }
+
+       m.request = function(xhrOptions) {
+               if (xhrOptions.background !== true) m.startComputation();
+               var deferred = m.deferred();
+               var isJSONP = xhrOptions.dataType && xhrOptions.dataType.toLowerCase() === "jsonp";
+               var serialize = xhrOptions.serialize = isJSONP ? identity : xhrOptions.serialize || JSON.stringify;
+               var deserialize = xhrOptions.deserialize = isJSONP ? identity : xhrOptions.deserialize || JSON.parse;
+               var extract = xhrOptions.extract || function(xhr) {
+                       return xhr.responseText.length === 0 && deserialize === JSON.parse ? null : xhr.responseText
+               };
+               xhrOptions.url = parameterizeUrl(xhrOptions.url, xhrOptions.data);
+               xhrOptions = bindData(xhrOptions, xhrOptions.data, serialize);
+               xhrOptions.onload = xhrOptions.onerror = function(e) {
+                       try {
+                               e = e || event;
+                               var unwrap = (e.type === "load" ? xhrOptions.unwrapSuccess : xhrOptions.unwrapError) || identity;
+                               var response = unwrap(deserialize(extract(e.target, xhrOptions)));
+                               if (e.type === "load") {
+                                       if (type.call(response) === ARRAY && xhrOptions.type) {
+                                               for (var i = 0; i < response.length; i++) response[i] = new xhrOptions.type(response[i])
+                                       }
+                                       else if (xhrOptions.type) response = new xhrOptions.type(response)
+                               }
+                               deferred[e.type === "load" ? "resolve" : "reject"](response)
+                       }
+                       catch (e) {
+                               m.deferred.onerror(e);
+                               deferred.reject(e)
+                       }
+                       if (xhrOptions.background !== true) m.endComputation()
+               };
+               ajax(xhrOptions);
+               deferred.promise(xhrOptions.initialValue);
+               return deferred.promise
+       };
+
+       //testing API
+       m.deps = function(mock) {
+               initialize(window = mock || window);
+               return window;
+       };
+       //for internal testing only, do not use `m.deps.factory`
+       m.deps.factory = app;
+
+       return m
+})(typeof window != "undefined" ? window : {});
+
+if (typeof module != "undefined" && module !== null && module.exports) module.exports = m;
+else if (typeof define === "function" && define.amd) define(function() {return m});
diff --git a/2015/assets/js/mithril.min.js b/2015/assets/js/mithril.min.js
new file mode 100644 (file)
index 0000000..b6d23fe
--- /dev/null
@@ -0,0 +1,8 @@
+/*
+Mithril v0.1.30
+http://github.com/lhorie/mithril.js
+(c) Leo Horie
+License: MIT
+*/
+var m=function a(b,c){function d(a){C=a.document,D=a.location,F=a.cancelAnimationFrame||a.clearTimeout,E=a.requestAnimationFrame||a.setTimeout}function e(){var a,b=[].slice.call(arguments),c=!(null==b[1]||K.call(b[1])!==G||"tag"in b[1]||"subtree"in b[1]),d=c?b[1]:{},e="class"in d?"class":"className",f={tag:"div",attrs:{}},g=[];if(K.call(b[0])!=I)throw new Error("selector in m(selector, attrs, children) should be a string");for(;a=L.exec(b[0]);)if(""===a[1]&&a[2])f.tag=a[2];else if("#"===a[1])f.attrs.id=a[2];else if("."===a[1])g.push(a[2]);else if("["===a[3][0]){var h=M.exec(a[3]);f.attrs[h[1]]=h[3]||(h[2]?"":!0)}g.length>0&&(f.attrs[e]=g.join(" "));var i=c?b[2]:b[1];f.children=K.call(i)===H?i:b.slice(c?2:1);for(var j in d)j===e?""!==d[j]&&(f.attrs[j]=(f.attrs[j]||"")+" "+d[j]):f.attrs[j]=d[j];return f}function f(a,b,d,e,j,l,m,n,o,p,q){if((null==j||null==j.toString())&&(j=""),"retain"===j.subtree)return l;var r=K.call(l),s=K.call(j);if(null==l||r!==s){if(null!=l)if(d&&d.nodes){var t=n-e,u=t+(s===H?j:l.nodes).length;i(d.nodes.slice(t,u),d.slice(t,u))}else l.nodes&&i(l.nodes,l);l=new j.constructor,l.tag&&(l={}),l.nodes=[]}if(s===H){for(var v=0,w=j.length;w>v;v++)K.call(j[v])===H&&(j=j.concat.apply([],j),v--);for(var x=[],y=l.length===j.length,z=0,A=1,B=2,D=3,E={},F=[],L=!1,v=0;v<l.length;v++)l[v]&&l[v].attrs&&null!=l[v].attrs.key&&(L=!0,E[l[v].attrs.key]={action:A,index:v});if(L){j.indexOf(null)>-1&&(j=j.filter(function(a){return null!=a}));var M=!1;if(j.length!=l.length)M=!0;else for(var O,P,v=0;O=l[v],P=j[v];v++)if(O.attrs&&P.attrs&&O.attrs.key!=P.attrs.key){M=!0;break}if(M){for(var v=0,w=j.length;w>v;v++)if(j[v]&&j[v].attrs)if(null!=j[v].attrs.key){var Q=j[v].attrs.key;E[Q]=E[Q]?{action:D,index:v,from:E[Q].index,element:l.nodes[E[Q].index]||C.createElement("div")}:{action:B,index:v}}else F.push({index:v,element:a.childNodes[v]||C.createElement("div")});var R=[];for(var S in E)R.push(E[S]);for(var T,U=R.sort(g),V=new Array(l.length),v=0;T=U[v];v++){if(T.action===A&&(i(l[T.index].nodes,l[T.index]),V.splice(T.index,1)),T.action===B){var W=C.createElement("div");W.key=j[T.index].attrs.key,a.insertBefore(W,a.childNodes[T.index]||null),V.splice(T.index,0,{attrs:{key:j[T.index].attrs.key},nodes:[W]})}T.action===D&&(a.childNodes[T.index]!==T.element&&null!==T.element&&a.insertBefore(T.element,a.childNodes[T.index]||null),V[T.index]=l[T.from])}for(var v=0,w=F.length;w>v;v++){var T=F[v];a.insertBefore(T.element,a.childNodes[T.index]||null),V[T.index]=l[T.index]}l=V,l.nodes=new Array(a.childNodes.length);for(var X,v=0;X=a.childNodes[v];v++)l.nodes[v]=X}}for(var v=0,Y=0,w=j.length;w>v;v++){var Z=f(a,b,l,n,j[v],l[Y],m,n+z||z,o,p,q);Z!==c&&(Z.nodes.intact||(y=!1),z+=Z.$trusted?(Z.match(/<[^\/]|\>\s*[^<]/g)||[]).length:K.call(Z)===H?Z.length:1,l[Y++]=Z)}if(!y){for(var v=0,w=j.length;w>v;v++)null!=l[v]&&x.push.apply(x,l[v].nodes);for(var $,v=0;$=l.nodes[v];v++)null!=$.parentNode&&x.indexOf($)<0&&i([$],[l[v]]);j.length<l.length&&(l.length=j.length),l.nodes=x}}else if(null!=j&&s===G){j.attrs||(j.attrs={}),l.attrs||(l.attrs={});var _=Object.keys(j.attrs),ab=_.length>("key"in j.attrs?1:0);if((j.tag!=l.tag||_.join()!=Object.keys(l.attrs).join()||j.attrs.id!=l.attrs.id)&&(l.nodes.length&&i(l.nodes),l.configContext&&typeof l.configContext.onunload===J&&l.configContext.onunload()),K.call(j.tag)!=I)return;var $,bb=0===l.nodes.length;if(j.attrs.xmlns?p=j.attrs.xmlns:"svg"===j.tag?p="http://www.w3.org/2000/svg":"math"===j.tag&&(p="http://www.w3.org/1998/Math/MathML"),bb?($=j.attrs.is?p===c?C.createElement(j.tag,j.attrs.is):C.createElementNS(p,j.tag,j.attrs.is):p===c?C.createElement(j.tag):C.createElementNS(p,j.tag),l={tag:j.tag,attrs:ab?h($,j.tag,j.attrs,{},p):j.attrs,children:null!=j.children&&j.children.length>0?f($,j.tag,c,c,j.children,l.children,!0,0,j.attrs.contenteditable?$:o,p,q):j.children,nodes:[$]},l.children&&!l.children.nodes&&(l.children.nodes=[]),"select"===j.tag&&j.attrs.value&&h($,j.tag,{value:j.attrs.value},{},p),a.insertBefore($,a.childNodes[n]||null)):($=l.nodes[0],ab&&h($,j.tag,j.attrs,l.attrs,p),l.children=f($,j.tag,c,c,j.children,l.children,!1,0,j.attrs.contenteditable?$:o,p,q),l.nodes.intact=!0,m===!0&&null!=$&&a.insertBefore($,a.childNodes[n]||null)),typeof j.attrs.config===J){var cb=l.configContext=l.configContext||{},db=function(a,b){return function(){return a.attrs.config.apply(a,b)}};q.push(db(j,[$,!bb,cb,l]))}}else if(typeof s!=J){var x;0===l.nodes.length?(j.$trusted?x=k(a,n,j):(x=[C.createTextNode(j)],a.nodeName.match(N)||a.insertBefore(x[0],a.childNodes[n]||null)),l="string number boolean".indexOf(typeof j)>-1?new j.constructor(j):j,l.nodes=x):l.valueOf()!==j.valueOf()||m===!0?(x=l.nodes,o&&o===C.activeElement||(j.$trusted?(i(x,l),x=k(a,n,j)):"textarea"===b?a.value=j:o?o.innerHTML=j:((1===x[0].nodeType||x.length>1)&&(i(l.nodes,l),x=[C.createTextNode(j)]),a.insertBefore(x[0],a.childNodes[n]||null),x[0].nodeValue=j)),l=new j.constructor(j),l.nodes=x):l.nodes.intact=!0}return l}function g(a,b){return a.action-b.action||a.index-b.index}function h(a,b,c,d,e){for(var f in c){var g=c[f],h=d[f];if(f in d&&h===g)"value"===f&&"input"===b&&a.value!=g&&(a.value=g);else{d[f]=g;try{if("config"===f||"key"==f)continue;if(typeof g===J&&0===f.indexOf("on"))a[f]=l(g,a);else if("style"===f&&null!=g&&K.call(g)===G){for(var i in g)(null==h||h[i]!==g[i])&&(a.style[i]=g[i]);for(var i in h)i in g||(a.style[i]="")}else null!=e?"href"===f?a.setAttributeNS("http://www.w3.org/1999/xlink","href",g):"className"===f?a.setAttribute("class",g):a.setAttribute(f,g):f in a&&"list"!==f&&"style"!==f&&"form"!==f&&"type"!==f?("input"!==b||a[f]!==g)&&(a[f]=g):a.setAttribute(f,g)}catch(j){if(j.message.indexOf("Invalid argument")<0)throw j}}}return d}function i(a,b){for(var c=a.length-1;c>-1;c--)if(a[c]&&a[c].parentNode){try{a[c].parentNode.removeChild(a[c])}catch(d){}b=[].concat(b),b[c]&&j(b[c])}0!=a.length&&(a.length=0)}function j(a){if(a.configContext&&typeof a.configContext.onunload===J&&a.configContext.onunload(),a.children)if(K.call(a.children)===H)for(var b,c=0;b=a.children[c];c++)j(b);else a.children.tag&&j(a.children)}function k(a,b,c){var d=a.childNodes[b];if(d){var e=1!=d.nodeType,f=C.createElement("span");e?(a.insertBefore(f,d||null),f.insertAdjacentHTML("beforebegin",c),a.removeChild(f)):d.insertAdjacentHTML("beforebegin",c)}else a.insertAdjacentHTML("beforeend",c);for(var g=[];a.childNodes[b]!==d;)g.push(a.childNodes[b]),b++;return g}function l(a,b){return function(c){c=c||event,e.redraw.strategy("diff"),e.startComputation();try{return a.call(b,c)}finally{ab()}}}function m(a){var b=Q.indexOf(a);return 0>b?Q.push(a)-1:b}function n(a){var b=function(){return arguments.length&&(a=arguments[0]),a};return b.toJSON=function(){return a},b}function o(){for(var a,b="all"===e.redraw.strategy(),c=0;a=T[c];c++)V[c]&&e.render(a,U[c].view?U[c].view(V[c]):$(),b);Y&&(Y(),Y=null),W=null,X=new Date,e.redraw.strategy("diff")}function p(a){return a.slice(db[e.route.mode].length)}function q(a,b,c){bb={};var d=c.indexOf("?");-1!==d&&(bb=u(c.substr(d+1,c.length)),c=c.substr(0,d));for(var f in b){if(f===c)return e.module(a,b[f]),!0;var g=new RegExp("^"+f.replace(/:[^\/]+?\.{3}/g,"(.*?)").replace(/:[^\/]+/g,"([^\\/]+)")+"/?$");if(g.test(c))return c.replace(g,function(){for(var c=f.match(/:[^\/]+/g)||[],d=[].slice.call(arguments,1,-2),g=0,h=c.length;h>g;g++)bb[c[g].replace(/:|\./g,"")]=decodeURIComponent(d[g]);e.module(a,b[f])}),!0}}function r(a){if(a=a||event,!a.ctrlKey&&!a.metaKey&&2!==a.which){a.preventDefault?a.preventDefault():a.returnValue=!1;var b=a.currentTarget||this,c="pathname"===e.route.mode&&b.search?u(b.search.slice(1)):{};e.route(b[e.route.mode].slice(db[e.route.mode].length),c)}}function s(){"hash"!=e.route.mode&&D.hash?D.hash=D.hash:b.scrollTo(0,0)}function t(a,b){var c=[];for(var d in a){var e=b?b+"["+d+"]":d,f=a[d],g=K.call(f),h=null!=f&&g===G?t(f,e):g===H?f.map(function(a){return encodeURIComponent(e+"[]")+"="+encodeURIComponent(a)}).join("&"):encodeURIComponent(e)+"="+encodeURIComponent(f);c.push(h)}return c.join("&")}function u(a){for(var b=a.split("&"),c={},d=0,e=b.length;e>d;d++){var f=b[d].split("=");c[decodeURIComponent(f[0])]=f[1]?decodeURIComponent(f[1]):""}return c}function v(a){var b=m(a);i(a.childNodes,R[b]),R[b]=c}function w(a){var b=e.prop();return a.then(b),b.then=function(b,c){return w(a.then(b,c))},b}function x(a,b){function c(a){l=a||j,n.map(function(a){l===i&&a.resolve(m)||a.reject(m)})}function d(a,b,c,d){if((null!=m&&K.call(m)===G||typeof m===J)&&typeof a===J)try{var f=0;a.call(m,function(a){f++||(m=a,b())},function(a){f++||(m=a,c())})}catch(g){e.deferred.onerror(g),m=g,c()}else d()}function f(){var j;try{j=m&&m.then}catch(n){return e.deferred.onerror(n),m=n,l=h,f()}d(j,function(){l=g,f()},function(){l=h,f()},function(){try{l===g&&typeof a===J?m=a(m):l===h&&"function"==typeof b&&(m=b(m),l=g)}catch(f){return e.deferred.onerror(f),m=f,c()}m===k?(m=TypeError(),c()):d(j,function(){c(i)},c,function(){c(l===g&&i)})})}var g=1,h=2,i=3,j=4,k=this,l=0,m=0,n=[];k.promise={},k.resolve=function(a){return l||(m=a,l=g,f()),this},k.reject=function(a){return l||(m=a,l=h,f()),this},k.promise.then=function(a,b){var c=new x(a,b);return l===i?c.resolve(m):l===j?c.reject(m):n.push(c),c.promise}}function y(a){return a}function z(a){if(!a.dataType||"jsonp"!==a.dataType.toLowerCase()){var d=new b.XMLHttpRequest;if(d.open(a.method,a.url,!0,a.user,a.password),d.onreadystatechange=function(){4===d.readyState&&(d.status>=200&&d.status<300?a.onload({type:"load",target:d}):a.onerror({type:"error",target:d}))},a.serialize===JSON.stringify&&a.data&&"GET"!==a.method&&d.setRequestHeader("Content-Type","application/json; charset=utf-8"),a.deserialize===JSON.parse&&d.setRequestHeader("Accept","application/json, text/*"),typeof a.config===J){var e=a.config(d,a);null!=e&&(d=e)}var f="GET"!==a.method&&a.data?a.data:"";if(f&&K.call(f)!=I&&f.constructor!=b.FormData)throw"Request data should be either be a string or FormData. Check the `serialize` option in `m.request`";return d.send(f),d}var g="mithril_callback_"+(new Date).getTime()+"_"+Math.round(1e16*Math.random()).toString(36),h=C.createElement("script");b[g]=function(d){h.parentNode.removeChild(h),a.onload({type:"load",target:{responseText:d}}),b[g]=c},h.onerror=function(){return h.parentNode.removeChild(h),a.onerror({type:"error",target:{status:500,responseText:JSON.stringify({error:"Error making jsonp request"})}}),b[g]=c,!1},h.onload=function(){return!1},h.src=a.url+(a.url.indexOf("?")>0?"&":"?")+(a.callbackKey?a.callbackKey:"callback")+"="+g+"&"+t(a.data||{}),C.body.appendChild(h)}function A(a,b,c){if("GET"===a.method&&"jsonp"!=a.dataType){var d=a.url.indexOf("?")<0?"?":"&",e=t(b);a.url=a.url+(e?d+e:"")}else a.data=c(b);return a}function B(a,b){var c=a.match(/:[a-z]\w+/gi);if(c&&b)for(var d=0;d<c.length;d++){var e=c[d].slice(1);a=a.replace(c[d],b[e]),delete b[e]}return a}var C,D,E,F,G="[object Object]",H="[object Array]",I="[object String]",J="function",K={}.toString,L=/(?:(^|#|\.)([^#\.\[\]]+))|(\[.+?\])/g,M=/\[(.+?)(?:=("|'|)(.*?)\2)?\]/,N=/^(AREA|BASE|BR|COL|COMMAND|EMBED|HR|IMG|INPUT|KEYGEN|LINK|META|PARAM|SOURCE|TRACK|WBR)$/;d(b);var O,P={appendChild:function(a){O===c&&(O=C.createElement("html")),C.documentElement&&C.documentElement!==a?C.replaceChild(a,C.documentElement):C.appendChild(a),this.childNodes=C.childNodes},insertBefore:function(a){this.appendChild(a)},childNodes:[]},Q=[],R={};e.render=function(a,b,d){var e=[];if(!a)throw new Error("Please ensure the DOM element exists before rendering a template into it.");var g=m(a),h=a===C,j=h||a===C.documentElement?P:a;h&&"html"!=b.tag&&(b={tag:"html",attrs:{},children:b}),R[g]===c&&i(j.childNodes),d===!0&&v(a),R[g]=f(j,null,c,c,b,R[g],!1,0,null,c,e);for(var k=0,l=e.length;l>k;k++)e[k]()},e.trust=function(a){return a=new String(a),a.$trusted=!0,a},e.prop=function(a){return(null!=a&&K.call(a)===G||typeof a===J)&&typeof a.then===J?w(a):n(a)};var S,T=[],U=[],V=[],W=null,X=0,Y=null,Z=16;e.module=function(a,b){if(!a)throw new Error("Please ensure the DOM element exists before rendering a template into it.");var c=T.indexOf(a);0>c&&(c=T.length);var d=!1;if(V[c]&&typeof V[c].onunload===J){var f={preventDefault:function(){d=!0}};V[c].onunload(f)}if(!d){e.redraw.strategy("all"),e.startComputation(),T[c]=a;var g=S=b=b||{},h=new(b.controller||function(){});return g===S&&(V[c]=h,U[c]=b),ab(),V[c]}},e.redraw=function(a){W&&a!==!0?(new Date-X>Z||E===b.requestAnimationFrame)&&(W>0&&F(W),W=E(o,Z)):(o(),W=E(function(){W=null},Z))},e.redraw.strategy=e.prop();var $=function(){return""},_=0;e.startComputation=function(){_++},e.endComputation=function(){_=Math.max(_-1,0),0===_&&e.redraw()};var ab=function(){"none"==e.redraw.strategy()?(_--,e.redraw.strategy("diff")):e.endComputation()};e.withAttr=function(a,b){return function(c){c=c||event;var d=c.currentTarget||this;b(a in d?d[a]:d.getAttribute(a))}};var bb,cb,db={pathname:"",hash:"#",search:"?"},eb=function(){};return e.route=function(){if(0===arguments.length)return cb;if(3===arguments.length&&K.call(arguments[1])===I){var a=arguments[0],c=arguments[1],d=arguments[2];eb=function(b){var f=cb=p(b);q(a,d,f)||e.route(c,!0)};var f="hash"===e.route.mode?"onhashchange":"onpopstate";b[f]=function(){var a=D[e.route.mode];"pathname"===e.route.mode&&(a+=D.search),cb!=p(a)&&eb(a)},Y=s,b[f]()}else if(arguments[0].addEventListener){{var g=arguments[0];arguments[1],arguments[2]}g.href=("pathname"!==e.route.mode?D.pathname:"")+db[e.route.mode]+this.attrs.href,g.removeEventListener("click",r),g.addEventListener("click",r)}else if(K.call(arguments[0])===I){var h=cb;cb=arguments[0];var i=arguments[1]||{},j=cb.indexOf("?"),k=j>-1?u(cb.slice(j+1)):{};for(var l in i)k[l]=i[l];var m=t(k),n=j>-1?cb.slice(0,j):cb;m&&(cb=n+(-1===n.indexOf("?")?"?":"&")+m);var o=(3===arguments.length?arguments[2]:arguments[1])===!0||h===arguments[0];b.history.pushState?(Y=function(){b.history[o?"replaceState":"pushState"](null,C.title,db[e.route.mode]+cb),s()},eb(db[e.route.mode]+cb)):D[e.route.mode]=cb}},e.route.param=function(a){if(!bb)throw new Error("You must call m.route(element, defaultRoute, routes) before calling m.route.param()");return bb[a]},e.route.mode="search",e.deferred=function(){var a=new x;return a.promise=w(a.promise),a},e.deferred.onerror=function(a){if("[object Error]"===K.call(a)&&!a.constructor.toString().match(/ Error/))throw a},e.sync=function(a){function b(a,b){return function(e){return g[a]=e,b||(c="reject"),0===--f&&(d.promise(g),d[c](g)),e}}var c="resolve",d=e.deferred(),f=a.length,g=new Array(f);if(a.length>0)for(var h=0;h<a.length;h++)a[h].then(b(h,!0),b(h,!1));else d.resolve([]);return d.promise},e.request=function(a){a.background!==!0&&e.startComputation();var b=e.deferred(),c=a.dataType&&"jsonp"===a.dataType.toLowerCase(),d=a.serialize=c?y:a.serialize||JSON.stringify,f=a.deserialize=c?y:a.deserialize||JSON.parse,g=a.extract||function(a){return 0===a.responseText.length&&f===JSON.parse?null:a.responseText};return a.url=B(a.url,a.data),a=A(a,a.data,d),a.onload=a.onerror=function(c){try{c=c||event;var d=("load"===c.type?a.unwrapSuccess:a.unwrapError)||y,h=d(f(g(c.target,a)));if("load"===c.type)if(K.call(h)===H&&a.type)for(var i=0;i<h.length;i++)h[i]=new a.type(h[i]);else a.type&&(h=new a.type(h));b["load"===c.type?"resolve":"reject"](h)}catch(c){e.deferred.onerror(c),b.reject(c)}a.background!==!0&&e.endComputation()},z(a),b.promise(a.initialValue),b.promise},e.deps=function(a){return d(b=a||b),b},e.deps.factory=a,e}("undefined"!=typeof window?window:{});"undefined"!=typeof module&&null!==module&&module.exports?module.exports=m:"function"==typeof define&&define.amd&&define(function(){return m});
+//# sourceMappingURL=mithril.min.js.map
\ No newline at end of file
diff --git a/2015/assets/js/mithril.min.js.map b/2015/assets/js/mithril.min.js.map
new file mode 100644 (file)
index 0000000..6785e48
--- /dev/null
@@ -0,0 +1 @@
+{"version":3,"file":"mithril.min.js","sources":["mithril.js"],"names":["m","app","window","undefined","initialize","$document","document","$location","location","$cancelAnimationFrame","cancelAnimationFrame","clearTimeout","$requestAnimationFrame","requestAnimationFrame","setTimeout","match","args","slice","call","arguments","hasAttrs","type","OBJECT","attrs","classAttrName","cell","tag","classes","STRING","Error","parser","exec","id","push","pair","attrParser","length","join","children","ARRAY","attrName","build","parentElement","parentTag","parentCache","parentIndex","data","cached","shouldReattach","index","editable","namespace","configs","toString","subtree","cachedType","dataType","nodes","offset","end","clear","constructor","i","len","concat","apply","intact","subArrayCount","DELETION","INSERTION","MOVE","existing","unkeyed","shouldMaintainIdentities","key","action","indexOf","filter","x","keysDiffer","cachedCell","dataCell","from","element","createElement","childNodes","actions","prop","change","changes","sort","sortChanges","newCached","Array","splice","dummy","insertBefore","child","cacheCount","item","$trusted","node","parentNode","dataAttrKeys","Object","keys","hasKeys","configContext","onunload","FUNCTION","isNew","xmlns","is","createElementNS","setAttributes","contenteditable","value","context","callback","injectHTML","createTextNode","nodeName","voidElements","valueOf","activeElement","innerHTML","nodeType","nodeValue","a","b","dataAttrs","cachedAttrs","dataAttr","cachedAttr","autoredraw","rule","style","setAttributeNS","setAttribute","e","message","removeChild","unload","nextSibling","isElement","placeholder","insertAdjacentHTML","object","event","redraw","strategy","startComputation","endFirstComputation","getCellCacheKey","nodeCache","gettersetter","store","toJSON","root","forceRedraw","roots","controllers","render","modules","view","blank","computePostRedrawHook","lastRedrawId","lastRedrawCallTime","Date","normalizeRoute","route","modes","mode","routeByValue","router","path","routeParams","queryStart","parseQueryString","substr","module","matcher","RegExp","replace","test","values","decodeURIComponent","routeUnobtrusive","ctrlKey","metaKey","which","preventDefault","returnValue","currentTarget","this","search","setScroll","hash","scrollTo","buildQueryString","prefix","str","valueType","map","encodeURIComponent","pairs","split","params","reset","cacheKey","cellCache","propify","promise","then","resolve","reject","Deferred","successCallback","failureCallback","finish","state","REJECTED","next","deferred","RESOLVED","promiseValue","thennable","notThennableCallback","count","onerror","fire","REJECTING","RESOLVING","self","TypeError","identity","ajax","options","toLowerCase","xhr","XMLHttpRequest","open","method","url","user","password","onreadystatechange","readyState","status","onload","target","serialize","JSON","stringify","setRequestHeader","deserialize","parse","config","maybeXhr","FormData","send","callbackKey","getTime","Math","round","random","script","resp","responseText","error","src","body","appendChild","bindData","xhrOptions","querystring","parameterizeUrl","tokens","html","documentNode","documentElement","replaceChild","forceRecreation","isDocumentRoot","trust","String","topModule","FRAME_BUDGET","isPrevented","currentModule","controller","force","pendingRequests","endComputation","max","withAttr","withAttrCallback","getAttribute","currentRoute","pathname","redirect","defaultRoute","source","listener","addEventListener","href","removeEventListener","oldRoute","queryIndex","currentPath","shouldReplaceHistoryEntry","history","pushState","title","param","sync","synchronizer","pos","resolved","results","outstanding","request","background","isJSONP","extract","unwrap","unwrapSuccess","unwrapError","response","initialValue","deps","mock","factory","exports","define","amd"],"mappings":";;;;;;AAAA,GAAIA,GAAI,QAAUC,GAAIC,EAAQC,GAU7B,QAASC,GAAWF,GACnBG,EAAYH,EAAOI,SACnBC,EAAYL,EAAOM,SACnBC,EAAwBP,EAAOQ,sBAAwBR,EAAOS,aAC9DC,EAAyBV,EAAOW,uBAAyBX,EAAOY,WAmBjE,QAASd,KACR,GAKIe,GALAC,KAAUC,MAAMC,KAAKC,WACrBC,IAAsB,MAAXJ,EAAK,IAAcK,EAAKH,KAAKF,EAAK,MAAQM,GAAY,OAASN,GAAK,IAAS,WAAaA,GAAK,IAC1GO,EAAQH,EAAWJ,EAAK,MACxBQ,EAAgB,SAAWD,GAAQ,QAAU,YAC7CE,GAAQC,IAAK,MAAOH,UACbI,IACX,IAAIN,EAAKH,KAAKF,EAAK,KAAOY,EAAQ,KAAM,IAAIC,OAAM,8DAClD,MAAOd,EAAQe,EAAOC,KAAKf,EAAK,KAC/B,GAAiB,KAAbD,EAAM,IAAaA,EAAM,GAAIU,EAAKC,IAAMX,EAAM,OAC7C,IAAiB,MAAbA,EAAM,GAAYU,EAAKF,MAAMS,GAAKjB,EAAM,OAC5C,IAAiB,MAAbA,EAAM,GAAYY,EAAQM,KAAKlB,EAAM,QACzC,IAAoB,MAAhBA,EAAM,GAAG,GAAY,CAC7B,GAAImB,GAAOC,EAAWJ,KAAKhB,EAAM,GACjCU,GAAKF,MAAMW,EAAK,IAAMA,EA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O9L,GACN3I,EAAEgO,SAASM,QAAQ3F,GACnBqF,EAASR,OAAO7E,GAEbwI,EAAWgD,cAAe,GAAMnU,EAAEsS,kBAEvCzD,EAAKsC,GACLnD,EAASX,QAAQ8D,EAAWuD,cACrB1G,EAASX,SAIjBrN,EAAE2U,KAAO,SAASC,GAEjB,MADAxU,GAAWF,EAAS0U,GAAQ1U,GACrBA,GAGRF,EAAE2U,KAAKE,QAAU5U,EAEVD,GACY,mBAAVE,QAAwBA,UAEb,oBAAVmL,SAAoC,OAAXA,QAAmBA,OAAOyJ,QAASzJ,OAAOyJ,QAAU9U,EAC7D,kBAAX+U,SAAyBA,OAAOC,KAAKD,OAAO,WAAY,MAAO/U"}
\ No newline at end of file
index 06db08f9a5100ec27600d8cff841193275095e62..5c75ba7d5b80f1b36f426b83728c51232147112e 100644 (file)
  * @licend  The above is the entire license notice for the JavaScript code in this page
  */
 
-/**
- * Call a function with the statistics from an IceCast mount.
- */
-function withStreamStats(serverUrl, mount, callback) {
-  var statsUrl = serverUrl.concat('/status-json.xsl');
-
-  return $.ajax({
-    url: statsUrl,
-    type: 'GET',
-    crossDomain: true,
-    success: function(data) {
-      // Match the end of the listen URL for the mount point.
-      var regexp = new RegExp(mount.concat('$'));
-
-      // Due to <https://trac.xiph.org/ticket/2174>, we must
-      // explicitly test if icestats.source is an array.
-      if(!data.icestats.source.isArray()) {
-        data.icestats.source = [data.icestats.source];
-      }
-
-      var stats = data.icestats.source.find(function(source) {
-        return regexp.test(source.listenurl);
-      });
-
-      if(stats) {
-        callback(stats);
-      }
-    }
-  });
-}
+var app = {};
 
-/**
- * Schedule a thunk... forever!
- */
-function scheduleEvery(duration, thunk) {
+app.icecastUrl = "http://live.fsf.org";
+
+app.scheduleEvery = function(duration, thunk) {
   thunk();
   setTimeout(function() {
-    scheduleEvery(duration, thunk);
+    app.scheduleEvery(duration, thunk);
   }, duration);
-}
+};
 
-/**
- * Update the document with stats from an IceCast mount.
- */
-function renderStreamStats(stats) {
-  function viewCountMessage(viewers) {
-    var noun = viewers === 1 ? 'viewer' : 'viewers';
-    return [viewers.toString(), noun].join(' ');
+app.nullStats = {
+  listeners: 0,
+  server_name: null,
+  server_description: null
+};
+
+app.streamStats = function(mount) {
+  var statsUrl = app.icecastUrl.concat('/status-json.xsl');
+
+  return m.request({
+    method: "GET",
+    url: statsUrl
+  }).then(function(data) {
+    // Match the end of the listen URL for the mount point.
+    var regexp = new RegExp(mount.concat('$'));
+
+    // Due to <https://trac.xiph.org/ticket/2174>, we must
+    // explicitly test if icestats.source is an array.
+    if(!(data.icestats.source instanceof Array)) {
+      data.icestats.source = [data.icestats.source];
+    }
+
+    var stats = data.icestats.source.find(function(source) {
+      return regexp.test(source.listenurl);
+    });
+
+    return stats || app.nullStats;
+  });
+};
+
+app.validStreamInfo = function(stats) {
+  var name = stats.server_name;
+  var desc = stats.server_description;
+
+  return name && desc && name !== "Unspecified name" &&
+    desc !== "Unspecified description";
+};
+
+app.mountToStreamUrl = function(mount) {
+  return app.icecastUrl.concat(mount);
+};
+
+app.changeVideoMount = function(video, mount) {
+  console.log(mount);
+  video.src = app.mountToStreamUrl(mount);
+  video.load();
+  video.play();
+};
+
+app.streams = [
+  {
+    name: "Room 123",
+    speakerMount: "/room123.ogv",
+    desktopMount: "/room123-desktop.ogv",
+    ircChannel: "#libreplanet_room123"
+  }, {
+    name: "Room 141",
+    speakerMount: "/room141.ogv",
+    desktopMount: "/room141-desktop.ogv",
+    ircChannel: "#libreplanet_room141"
+  }, {
+    name: "Room 155",
+    speakerMount: "/room155.ogv",
+    desktopMount: "/room155-desktop.ogv",
+    ircChannel: "#libreplanet_room155"
   }
+];
 
-  $('#viewer-counter').html(viewCountMessage(stats.listeners));
-  $('#speaker-name').html(stats.server_name);
-  $('#talk-title').html(stats.server_description);
-}
+app.controller = function() {
+  var self = this;
 
-/**
- * Update the document every 10 seconds with stats from an IceCast
- * mount.
- */
-function monitorStream(mount) {
-  scheduleEvery(10000, function() {
-    withStreamStats('http://live.fsf.org', mount, renderStreamStats);
+  this.stream = m.prop(app.streams[0]);
+  this.stats = m.prop(app.nullStats);
+
+  this.speakerPosition = m.prop({
+    x: 0,
+    y: 0
+  });
+
+  this.showDesktop = m.prop(false);
+
+  this.updateStats = function() {
+    self.stats = app.streamStats(self.stream().speakerMount);
+  };
+
+  app.scheduleEvery(10000, function() {
+    self.updateStats();
   });
-}
+};
+
+app.view = function(ctrl) {
+  var stream = ctrl.stream();
+  var pos = ctrl.speakerPosition();
+  var showDesktop = ctrl.showDesktop();
+  var stats = ctrl.stats();
+  console.log(stats);
+
+  function renderDesktopStream() {
+    return m("video.lp-video", {
+      id: "desktop-video",
+      autoplay: true
+    }, [
+      m("source", { src: app.mountToStreamUrl(stream.desktopMount) }),
+      m("p",
+        m("em", [
+          "Your browser does not support the HTML5 video tag, ",
+          m("a", { href: "TODO" }, "[ please download ]"),
+          "the video instead"
+        ]))
+    ]);
+  }
+
+  function renderToggleDesktopStream() {
+    var action = showDesktop ? "Hide desktop stream" : "Show desktop stream";
+
+    return m(".row", [
+      m(".col-sm-offset-4.col-sm-4",
+        m("button.btn.btn-block.btn-default", {
+          onclick: function() {
+            ctrl.showDesktop(!showDesktop);
+          }
+        }, action)
+       )
+    ]);
+  }
+
+  function renderRoomSelector() {
+    return m(".row",
+             m(".col-sm-offset-1.col-sm-10",
+               m("ol.breadcrumb.text-center", app.streams.map(function(s) {
+                 return m("li", {
+                   class: s === stream ? "active" : null,
+                   onclick: function() {
+                     var speakerVideo = document.getElementById("speaker-video");
+                     var desktopVideo = document.getElementById("desktop-video");
+
+                     console.log(s);
+
+                     app.changeVideoMount(speakerVideo, s.speakerMount);
+
+                     // Video element doesn't exist when the user
+                     // hasn't elected to show it.
+                     if(desktopVideo) {
+                       app.changeVideoMount(desktopVideo, s.desktopMount);
+                     }
+
+                     ctrl.stream(s);
+                   }
+                 }, m("a.alt-a", { href: "#" }, s.name));
+               }))));
+  }
+
+  function renderStats() {
+    var info = app.validStreamInfo(stats) ? [
+      m("strong", stats.server_name),
+      " — ",
+      m("i", stats.server_description)
+    ] : null;
+
+    return m(".row", [
+      m(".col-sm-8", info),
+      m(".col-sm-4.text-right", [
+        m("strong", stats.listeners),
+        " watching"
+      ])
+    ]);
+  }
+
+  return [
+    renderRoomSelector(),
+    m("h2", stream.name),
+    renderStats(),
+    m("video.lp-video", {
+      id: "speaker-video",
+      controls: true,
+      autoplay: true
+    }, [
+      m("source", {
+        src: app.mountToStreamUrl(stream.speakerMount)
+      }),
+      m("p",
+        m("em", [
+          "Your browser does not support the HTML5 video tag, ",
+          m("a", { href: "TODO" }, "[ please download ]"),
+          "the video instead"
+        ]))
+    ]),
+    showDesktop ? renderDesktopStream() : null,
+    renderToggleDesktopStream(),
+    m("h2", "IRC"),
+    m("p", "Join the discussion online!"),
+    m("ul", [
+      m("li", [
+        "Conference-wide Freenode IRC channel: ",
+        m("strong", "#libreplanet")
+      ]),
+      m("li", [
+        "Freenode IRC channel for ",
+        stream.name,
+        ": ",
+        m("strong", stream.ircChannel)
+      ]),
+      m("li", [
+        "Conference hashtag for ",
+        m("a", { href: "https://fsf.org/twitter" }, "microblogging"),
+        ": ",
+        m("strong", "#lp2015")
+      ])
+    ])
+  ];
+};
+
+m.module(document.getElementById("stream"), app);
index 08c9d7fc7281d939a1ba57ed765a4211882b585c..33e93f644a3c5c9282d50c1bd6a26fdd13ef85e7 100755 (executable)
@@ -5,20 +5,27 @@
 <!--#include virtual="/server/2015/banner.html"-->
 <!--#include virtual="/server/2015/sidebar.html"-->
 
-  <h1>LibrePlanet from anywhere</h1>
-  <p>During LibrePlanet, this page will host streaming video of all sessions. If you plan to participate remotely, please bookmark it now and check back during the conference.</p>
+<h1>LibrePlanet 2015 &mdash; Live</h1>
 
-<ul>
-  <li>Conference-wide Freenode IRC channel: <strong>#libreplanet</strong></li>
-  <li>Conference hashtag for <a href="https://fsf.org/twitter">microblogging</a>: <strong>#lp2015</strong></li>
-</ul>
+<div class="row margin-top">
+  <div class="col-sm-8"> <!-- start of main content -->
 
-  <p>We're creating our most advanced-ever free software streaming system for LibrePlanet 2015. We'd appreciate your donations to help make it as great as possible. Can you chip in?</p>
+    <div id="stream"></div>
 
-  <p style="text-align:center"><a href="https://my.fsf.org/civicrm/contribute/transact?reset=1&amp;id=14"><img src="//static.fsf.org/nosvn/donate.en.png" alt="Donate to the FSF" style="align:left; padding: 15px"></a></p>
+    <iframe src="https://www0.libreplanet.org/kiwi/irc.freenode.net/?theme=mini&amp;#libreplanet"
+            class="irc-client">
+    </iframe>
+  </div> <!-- end of main content -->
+
+  <div class="col-sm-4"> <!-- start of right sidebar column -->
+    <!--#include virtual="/server/2015/live_sidebar.html" -->
+  </div> <!-- end of right sidebar column -->
+</div>
 
 <!--#include virtual="/server/2015/footer.html"-->
 <!--#include virtual="/server/2015/common_js.html"-->
+<script type="text/javascript" src="/2015/assets/js/mithril.min.js"></script>
+<script type="text/javascript" src="/2015/assets/js/stream.js"></script>
 <script type="text/javascript">
 $("#p-sessions").addClass("active").text("Sessions");
 </script>
index 5a0fc405dc5f5c42d045508ad560ee0a8299c9e2..9ec354bae63c2b9971038804ce850534833abf7e 100644 (file)
@@ -12,7 +12,7 @@
       <a href="https://my.fsf.org/associate/support_freedom">Donate to the FSF</a>.
     </p>
 <p class="text-muted">
-      Except where otherwise noted, this site and its images, logos and and other media are licensed under 
+      Except where otherwise noted, this site and its images, logos and and other media are licensed under
       <a rel="license"
         href="http://creativecommons.org/licenses/by-sa/4.0/">
        Creative Commons Attribution-ShareAlike 4.0</a>.
      <a href="/server/staging/lp15/weblabels.html" rel="jslicense">licensing information</a> documented by <a href="https://fsf.org/campaigns/freejs">Web labels</a>.
     </p>
 
+    <p class="text-muted">
+      KiwiIRC is licensed under the&nbsp;
+      <a rel="license"
+         href="https://www.gnu.org/licenses/agpl-3.0.html">
+        GNU Affero General Public License version 3
+      </a>.&nbsp;
+      <a href="https://vcs.fsf.org/?p=KiwiIRC.git;a=snapshot;h=46b871fe407632f5651fd7c8ff6faeebb58cc029;sf=tgz">
+        Complete source code
+      </a>
+    </p>
 
 
-    
   </div>
 </div>
index 4d413d1993d5c5254a8f7cc9a314c2f055dfcacd..a2b5a7512a946a7c7a977a797db1e780cae9076e 100755 (executable)
@@ -34,7 +34,7 @@
       <input name="entryURL" type="hidden"
                value="https://my.fsf.org/civicrm/profile/create?gid=281&amp;reset=1/update?action=update&amp;amp;id=281&amp;amp;reset=1&amp;amp;context=field"
                />
-      <input name="postURL" type="hidden" value="https://libreplanet.org/2015/live/confirmation-141.html" />
+      <input name="postURL" type="hidden" value="https://libreplanet.org/2015/live/confirmation.html" />
       <input name="cancelURL" type="hidden"
                value="https://my.fsf.org/civicrm/profile?reset=1&amp;gid=281" />
       <input name="add_to_group" type="hidden" value="619" />
@@ -79,6 +79,5 @@
       href="https://my.fsf.org/donate/privacypolicy.html">Privacy policy</a>
   </div>
            </div> <!-- end LP15 signup -->
-    
-        </div> <!-- end of sidebar column -->
 
+        </div> <!-- end of sidebar column -->
index 851d4a3d33112e6c1524770deabbb6a20320ca0e..570126211f1253f395a1719653258ab8a6a7261b 100644 (file)
@@ -4,9 +4,9 @@
   <head>
        <title>libreplanet.org - JavaScript License Information</title>
   </head>
-  
+
   <body>
-       
+
        <table id="jslicense-labels1">
 
          <tr>
                        Public License version 2 or later</a></td>
                <td><a href="https://libreplanet.org/w/skins/common/wikibits.js">wikibits.js</a></td>
          </tr>
-         
+
          <tr>
                <td><a href="https://libreplanet.org/w/skins/common/ajax.js">ajax.js</a></td>
                <td><a href="http://www.gnu.org/licenses/gpl-2.0.html">GNU General
                        Public License version 2 or later</a></td>
                <td><a href="https://libreplanet.org/w/skins/common/ajax.js">ajax.js</a></td>
          </tr>
-         
+
          <tr>
                <td><a href="https://libreplanet.org/w/skins/common/ajaxwatch.js">ajaxwatch.js</a></td>
                <td><a href="http://www.gnu.org/licenses/gpl-2.0.html">GNU General
                        Public License version 2 or later</a></td>
                <td><a href="https://libreplanet.org/w/skins/common/ajaxwatch.js">ajaxwatch.js</a></td>
          </tr>
-         
+
          <tr>
                <td><a href="https://libreplanet.org/w/skins/common/mwsuggest.js">mwsuggest.js</a></td>
                <td><a href="http://www.gnu.org/licenses/gpl-2.0.html">GNU General
                        Public License version 2 or later</a></td>
                <td><a href="https://libreplanet.org/w/skins/common/mwsuggest.js">mwsuggest.js</a></td>
          </tr>
-         
+
          <tr>
                <td><a href="https://libreplanet.org/w/skins/common/edit.js">edit.js</a></td>
                <td><a href="http://www.gnu.org/licenses/gpl-2.0.html">GNU General
                        Public License version 2 or later</a></td>
                <td><a href="https://libreplanet.org/w/skins/common/edit.js">edit.js</a></td>
          </tr>
-         
+
 
          <tr>
                <td><a href="http://libreplanet.org/wiki?title=-&amp;action=raw&amp;smaxage=0&amp;gen=js&amp;useskin=vector&amp;270">wiki</a></td>
@@ -75,7 +75,7 @@
                        Public License version 2 or later</a></td>
                <td><a href="http://weblabels.fsf.org/libreplanet.org/CURRENT/files/w/wiki">wiki</a></td>
          </tr>
-         
+
          <tr>
                <td><a href="http://libreplanet.org/2014/assets/js/jquery.chainedSelects.js">jquery.chainedSelects.js</a></td>
                <td><a href="http://www.gnu.org/licenses/gpl-3.0.html">GNU General
                        Public License version 3 or later</a></td>
                <td><a href="/2015/assets/js/civicrm-4.4.jquery.chainedSelects.js">civicrm-4.4.jquery.chainedSelects.js</a></td>
          </tr>
-         
+
          <tr>
                <td><a href="http://libreplanet.org/2014/assets/js/jquery.form.js">jquery.form.js</a></td>
                <td><a href="http://www.gnu.org/licenses/gpl-2.0.html">GNU General
                        Public License version 2 or later</a></td>
                <td><a href="http://libreplanet.org/2014/assets/js/jquery.form.js">jquery.form.js</a></td>
          </tr>
-         
+
          <tr>
                <td><a href="/2015/assets/js/jquery.form-3.25.0.js">jquery.form-3.25.0.js</a></td>
                <td><a href="http://www.gnu.org/licenses/gpl-2.0.html">GNU General
                <td><a href="/2015/assets/js/tweetie/tweetie.js">tweetie.js</a></td>
          </tr>
 
+          <tr>
+           <td><a href="/2015/assets/js/mithril.min.js">mithril.min.js</a></td>
+           <td><a href="http://www.jclark.com/xml/copying.txt">Expat</a></td>
+           <td><a href="/2015/assets/js/mithril.js">mithril.js</a></td>
+         </tr>
+
        </table>
   </body>
 </html>