-
Notifications
You must be signed in to change notification settings - Fork 0
/
jquery.riot.min.js
5 lines (5 loc) · 1007 Bytes
/
jquery.riot.min.js
1
2
3
4
5
/*
Riot.js 0.9.5 | moot.it/riotjs | @license MIT
(c) 2013 Tero Piirainen, Moot Inc and other contributors.
*/
(function(n){"use strict";var e=n.$;if(e.riot)return;e.riot="0.9.5";var r=[].slice;e.observable=function(n){var t=e("<a/>");e.each(["on","one","trigger","off"],function(e,i){n[i]=function(o,u){if(e<2){t[i](o,function(e){var t=r.call(arguments,1);if(o.split(" ")[1])t.unshift(e.type);u.apply(n,t)})}else if(e===2){t.trigger(o,r.call(arguments,1))}else{t.off(o)}return n}});return n};var t,i=e.observable({});function o(n){n=n.type?location.hash:n;if(n!=t)i.trigger("pop",n);t=n}e(o);e(n).on("popstate",o);e.route=function(n){if(typeof n=="function")return i.on("pop",n);if(history.pushState)history.pushState("","",n);o(n)}})(window);(function(){var n={};$.render=function(e,r){return!e?"":(n[e]=n[e]||new Function("_","return '"+e.replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/'/g,"\\'").replace(/\{\s*(\w+)\s*\}/g,"' + (_.$1 === undefined || _.$1 === null ? '' : _.$1) + '")+"'"))(r)}})();