+++ /dev/null
----
-layout: default
----
-
-<div class="content">
- <div class="related">
- <h1>Cat: {{page.category}}</h1>
- <ul>
- {% for post in site.categories[page.category] %}
- <li>
- <span>{{ post.date | date: "%m/%e/%Y" }}</span> <a href="{{ post.url }}">{{ post.title }}</a>
- </li>
- {% endfor %}
- </ul>
- </div>
-</div>
<!DOCTYPE HTML>
-<html>
+<html lang="en">
<head>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
- <meta charset="utf-8" />
- <meta name="author" content="Rubén Beltrán del Río" />
- <meta name="description" content="{{ page.description }}" />
- <link rel="stylesheet" type="text/css" href="/css/application.css" />
+ <meta charset="utf-8">
+ <meta name="author" content="Rubén Beltrán del Río">
+ <meta name="description" content="{{ page.description }}">
+ <link rel="stylesheet" type="text/css" href="/css/application.css">
<title>Unlimited 🍕 {{ page.title }}</title>
- <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
- <script src="https://cdn.firebase.com/js/client/1.0.21/firebase.js"></script>
-
- <script src="/js/vendor/neon/neon.js"></script>
- <script src="/js/vendor/neon/stdlib/node_support.js"></script>
- <script src="/js/vendor/neon/stdlib/custom_event.js"></script>
- <script src="/js/vendor/neon/stdlib/custom_event_support.js"></script>
- <script src="/js/vendor/neon/stdlib/widget.js"></script>
-
- <script src="/js/vendor/recorderjs/recorder.js"></script>
- <script src="/js/vendor/recorderjs/recorderWorker.js"></script>
<!--
/\
- / O\ The Unlimited Pizza Family's Own Libraries
- /O o \ * Melty Cheese: *DESTROYED, NEED NEW*
- |______| * Pepperoni: Audio Recorder Widget
- * Tasty Crust: *RESTROYED, NEED NEW*
- * Tomato Sauce: Random Telnet Renderer
+ / O\ U N L I M I T E D
+ /O o \ P I Z Z A
+ |______|
-->
- <script src="js/unlimited_pizza.js"></script>
- <script src="js/unlimited_pizza/pepperoni.js"></script>
- <script type="text/javascript">
-
- window.addEventListener('load', function () {
- UnlimitedPizza.instance({
- element : $('body')
- }).activate();
- });
-
- var _gaq = _gaq || [];
- _gaq.push(['_setAccount', 'UA-20018878-4']);
- _gaq.push(['_trackPageview']);
-
- (function() {
- var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
- ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
- var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
- })();
-
- </script>
-</head>
+ </head>
<body>
<h1>
<a class="logo" href="/">Unlimited 🍕 Pizza</a>
+++ /dev/null
----
-layout: default
----
-
-<div class="postcontainer {{page.color}}">
- <div class="post-image">
- <img src="/img/headers/{{ page.header_image }}">
- </div>
- <h1 id="post-title">{{ page.title }}</h1>
- <div class="post-meta">
- <div class="post-date"><a href="{{ page.url }}">{{ page.date | date: "%Y-%m-%e"}}</a></div>
- <div class="post-tags">
- {% for tag in page.tags %}
- <a href="/tags/{{tag}}">{{tag}}</a>
- {% endfor %}
- </div>
- </div>
- <div class="postcontent">
- {{ content }}
- </div>
- <a class="go-to-top" href="#post-title">↑ Go to top of article</a>
- </div>
+++ /dev/null
----
-layout: default
----
-
-<div class="content">
- <div class="related">
- <h1>Tag: {{page.tag}}</h1>
- <ul>
- {% for post in site.tags[page.tag] %}
- <li>
- <span>{{ post.date | date: "%m/%e/%Y" }}</span> <a
- class="{{post.color}}" href="{{ post.url }}">{{ post.title }}</a>
- </li>
- {% endfor %}
- </ul>
- </div>
-</div>
li {
line-height: 1.82em;
}
-
-/* Guestbook */
-.guestbook-feed, .guestbook-form ul {
- list-style: none;
-}
-
-.guestbook-form li {
- display: block;
- max-width: 28em;
-}
-
-.guestbook-form .guestbook-label {
- text-transform: uppercase;
- text-align: center;
- max-width: 28em;
- width: 100%;
- text-style: italic;
-}
-
-.guestbook-feed .guestbook-post {
- display: block;
- border-bottom: 0.071em solid #99a3a4;
- padding: 1.071em;
-}
-
-/*
- * The Recorder CSS
- */
-
-.pepperoni-widget .record-clear,
-.pepperoni-widget .record-button {
- margin: 1em 0;
- padding: 1em 0;
- background-color: blue;
- color: white;
- cursor: pointer;
- transition: background-color 0.2s ease, color 0.2s ease;
- display: block;
- text-align: center;
-}
-
-.pepperoni-widget .record-button.recording {
- background-color: magenta;
- color: white;
-}
-
-.guestbook-submit:hover,
-.pepperoni-widget .record-clear:hover,
-.pepperoni-widget .record-button:hover {
- background-color: red;
-}
-
-.record-progress-bar-container {
- background-color: #f1f1f1;
- height: 4em;
-}
-
-.record-progress-bar {
- height: 4em;
- background-color: cyan;
- width: 0;
-}
-
-.record-clear:hover {
- text-decoration: none;
-}
-
-.record-preview {
- max-width: 28em;
- width: 100%;
- height: 4em;
- display: block;
-}
-
-.guestbook-control input {
- width: 100%;
- font-family: times, 'Times New Roman', serif;
-}
-
-.guestbook-submit {
- background-color: magenta;
- color: white;
- display: block;
- height: 4em;
- font-size: 1em;
- max-width: 28em;
- padding: 0;
- border: 0;
- cursor: pointer;
-}
-
-.name-control {
- max-width: 27.5em;
- padding: 0.2em;
- font-size: 1em;
- display: block;
-}
-
-.filter-switches {
- padding: 1em 0;
-}
-
-.filter-switches input {
- display: inline;
- width: auto;
- margin-left: 1em;
-}
+++ /dev/null
----
-layout: default
-title: Guestbook
-description: "Audio Guestbook"
----
-
-<div class="content">
- <h2>Audio Guestbook</h2>
- <div class="guestbook-form">
- <p>
- Record, change effects, leave a nice message, give yourself memos for the
- future, hide riddles, broadcast spells.
- </p>
- <form method="post">
- <ul>
- <div class="guestbook-control-group">
- <li class="guestbook-label"><label for="name-control">Name</label></li>
- <li class="guestbook-control"><input name="name" class="name-control" id="name-control" /></li>
- </div>
- <div class="guestbook-control-group">
- <li class="guestbook-control"><div class="pepperoni-widget"></div></li>
- </div>
- <div class="guestbook-control-group">
- <li class="guestbook-control"><input type="submit" value="OK!" class="guestbook-submit" /></li>
- </div>
- </ul>
- </form>
- </div>
- <p><a href="/index.html">Back to /index.html</a>
- <div class="guestbook-content">
- <h2>Clips</h2>
- <ul class="guestbook-feed">
- </ul>
- </div>
-</div>
<a href="https://gitlab.com/serpentity" class="javascript">Serpentity</a>:
An entity framework for JavaScript.
</li>
- <li>
+ <li lang="es-MX">
[SPANISH] <a href="http://insultos.unlimited.pizza" class="javascript">Generador de Insultos</a>:
Un generador de insultos multi-usos que te da un insulto nuevo cada vez
que la cargas. Generalmente apropiado para toda la familia, a veces no.
My blog. Only 3 posts at a time.
<a href="https://gitlab.com/rbdr/blog">See the source</a>.
</li>
- <li>
+ <li lang="es-MX">
[SPANISH] <a href="https://rbdr.gitlab.io/dead-drop/" class="etc">Dead Drop</a>:
Marca al 📞 (33) 4160-0915 y deja un mensaje, o escucha un mensaje al azar.
<a href="https://gitlab.com/rbdr/dead-drop">Ve el código</a>.
<p><img src="/img/selfie.gif" alt="An image of @pigeonfolk."/></p>
<p>🍕 Unlimited pizza 🍕 is brought to you by blood magic, ancient rituals and
- me, Rubén Beltrán del Río. I have words written (español e inglés) on
+ me, Rubén Beltrán del Río. I have words written <span lang="es-mx">(español e inglés)</span> on
<a href="https://medium.com/@expertosenbing">medium</a>,
spoken in <a href="https://www.youtube.com/playlist?list=PLYxitPB3WXb1B4zPAsj92l9ay5pBOyynt">a handy playlist</a>,
music at <a href="https://soundcloud.com/benbeltran">soundcloud</a>
to join, or if you want to get together to practice your latest dance moves.
But <a href="https://twitter.com/pigeonfolk">twitter</a> works better.
</p>
- <p>Even better, sign my <a href="/guestbook.html">audio guestbook</a> and
- leave your voice on the internet.</p>
- <h1>🍰</h1>
+ <p>🐝</p>
</div>
+++ /dev/null
-/*!
-* Bootstrap.js by @fat & @mdo
-* Copyright 2012 Twitter, Inc.
-* http://www.apache.org/licenses/LICENSE-2.0.txt
-*/
-!function(a){a(function(){"use strict",a.support.transition=function(){var a=function(){var a=document.createElement("bootstrap"),b={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd",msTransition:"MSTransitionEnd",transition:"transitionend"},c;for(c in b)if(a.style[c]!==undefined)return b[c]}();return a&&{end:a}}()})}(window.jQuery),!function(a){"use strict";var b='[data-dismiss="alert"]',c=function(c){a(c).on("click",b,this.close)};c.prototype.close=function(b){function f(){e.trigger("closed").remove()}var c=a(this),d=c.attr("data-target"),e;d||(d=c.attr("href"),d=d&&d.replace(/.*(?=#[^\s]*$)/,"")),e=a(d),b&&b.preventDefault(),e.length||(e=c.hasClass("alert")?c:c.parent()),e.trigger(b=a.Event("close"));if(b.isDefaultPrevented())return;e.removeClass("in"),a.support.transition&&e.hasClass("fade")?e.on(a.support.transition.end,f):f()},a.fn.alert=function(b){return this.each(function(){var d=a(this),e=d.data("alert");e||d.data("alert",e=new c(this)),typeof b=="string"&&e[b].call(d)})},a.fn.alert.Constructor=c,a(function(){a("body").on("click.alert.data-api",b,c.prototype.close)})}(window.jQuery),!function(a){"use strict";var b=function(b,c){this.$element=a(b),this.options=a.extend({},a.fn.button.defaults,c)};b.prototype.setState=function(a){var b="disabled",c=this.$element,d=c.data(),e=c.is("input")?"val":"html";a+="Text",d.resetText||c.data("resetText",c[e]()),c[e](d[a]||this.options[a]),setTimeout(function(){a=="loadingText"?c.addClass(b).attr(b,b):c.removeClass(b).removeAttr(b)},0)},b.prototype.toggle=function(){var a=this.$element.parent('[data-toggle="buttons-radio"]');a&&a.find(".active").removeClass("active"),this.$element.toggleClass("active")},a.fn.button=function(c){return this.each(function(){var d=a(this),e=d.data("button"),f=typeof c=="object"&&c;e||d.data("button",e=new b(this,f)),c=="toggle"?e.toggle():c&&e.setState(c)})},a.fn.button.defaults={loadingText:"loading..."},a.fn.button.Constructor=b,a(function(){a("body").on("click.button.data-api","[data-toggle^=button]",function(b){var c=a(b.target);c.hasClass("btn")||(c=c.closest(".btn")),c.button("toggle")})})}(window.jQuery),!function(a){"use strict";var b=function(b,c){this.$element=a(b),this.options=c,this.options.slide&&this.slide(this.options.slide),this.options.pause=="hover"&&this.$element.on("mouseenter",a.proxy(this.pause,this)).on("mouseleave",a.proxy(this.cycle,this))};b.prototype={cycle:function(b){return b||(this.paused=!1),this.options.interval&&!this.paused&&(this.interval=setInterval(a.proxy(this.next,this),this.options.interval)),this},to:function(b){var c=this.$element.find(".active"),d=c.parent().children(),e=d.index(c),f=this;if(b>d.length-1||b<0)return;return this.sliding?this.$element.one("slid",function(){f.to(b)}):e==b?this.pause().cycle():this.slide(b>e?"next":"prev",a(d[b]))},pause:function(a){return a||(this.paused=!0),clearInterval(this.interval),this.interval=null,this},next:function(){if(this.sliding)return;return this.slide("next")},prev:function(){if(this.sliding)return;return this.slide("prev")},slide:function(b,c){var d=this.$element.find(".active"),e=c||d[b](),f=this.interval,g=b=="next"?"left":"right",h=b=="next"?"first":"last",i=this,j=a.Event("slide");this.sliding=!0,f&&this.pause(),e=e.length?e:this.$element.find(".item")[h]();if(e.hasClass("active"))return;if(a.support.transition&&this.$element.hasClass("slide")){this.$element.trigger(j);if(j.isDefaultPrevented())return;e.addClass(b),e[0].offsetWidth,d.addClass(g),e.addClass(g),this.$element.one(a.support.transition.end,function(){e.removeClass([b,g].join(" ")).addClass("active"),d.removeClass(["active",g].join(" ")),i.sliding=!1,setTimeout(function(){i.$element.trigger("slid")},0)})}else{this.$element.trigger(j);if(j.isDefaultPrevented())return;d.removeClass("active"),e.addClass("active"),this.sliding=!1,this.$element.trigger("slid")}return f&&this.cycle(),this}},a.fn.carousel=function(c){return this.each(function(){var d=a(this),e=d.data("carousel"),f=a.extend({},a.fn.carousel.defaults,typeof c=="object"&&c);e||d.data("carousel",e=new b(this,f)),typeof c=="number"?e.to(c):typeof c=="string"||(c=f.slide)?e[c]():f.interval&&e.cycle()})},a.fn.carousel.defaults={interval:5e3,pause:"hover"},a.fn.carousel.Constructor=b,a(function(){a("body").on("click.carousel.data-api","[data-slide]",function(b){var c=a(this),d,e=a(c.attr("data-target")||(d=c.attr("href"))&&d.replace(/.*(?=#[^\s]+$)/,"")),f=!e.data("modal")&&a.extend({},e.data(),c.data());e.carousel(f),b.preventDefault()})})}(window.jQuery),!function(a){"use strict";var b=function(b,c){this.$element=a(b),this.options=a.extend({},a.fn.collapse.defaults,c),this.options.parent&&(this.$parent=a(this.options.parent)),this.options.toggle&&this.toggle()};b.prototype={constructor:b,dimension:function(){var a=this.$element.hasClass("width");return a?"width":"height"},show:function(){var b,c,d,e;if(this.transitioning)return;b=this.dimension(),c=a.camelCase(["scroll",b].join("-")),d=this.$parent&&this.$parent.find("> .accordion-group > .in");if(d&&d.length){e=d.data("collapse");if(e&&e.transitioning)return;d.collapse("hide"),e||d.data("collapse",null)}this.$element[b](0),this.transition("addClass",a.Event("show"),"shown"),this.$element[b](this.$element[0][c])},hide:function(){var b;if(this.transitioning)return;b=this.dimension(),this.reset(this.$element[b]()),this.transition("removeClass",a.Event("hide"),"hidden"),this.$element[b](0)},reset:function(a){var b=this.dimension();return this.$element.removeClass("collapse")[b](a||"auto")[0].offsetWidth,this.$element[a!==null?"addClass":"removeClass"]("collapse"),this},transition:function(b,c,d){var e=this,f=function(){c=="show"&&e.reset(),e.transitioning=0,e.$element.trigger(d)};this.$element.trigger(c);if(c.isDefaultPrevented())return;this.transitioning=1,this.$element[b]("in"),a.support.transition&&this.$element.hasClass("collapse")?this.$element.one(a.support.transition.end,f):f()},toggle:function(){this[this.$element.hasClass("in")?"hide":"show"]()}},a.fn.collapse=function(c){return this.each(function(){var d=a(this),e=d.data("collapse"),f=typeof c=="object"&&c;e||d.data("collapse",e=new b(this,f)),typeof c=="string"&&e[c]()})},a.fn.collapse.defaults={toggle:!0},a.fn.collapse.Constructor=b,a(function(){a("body").on("click.collapse.data-api","[data-toggle=collapse]",function(b){var c=a(this),d,e=c.attr("data-target")||b.preventDefault()||(d=c.attr("href"))&&d.replace(/.*(?=#[^\s]+$)/,""),f=a(e).data("collapse")?"toggle":c.data();a(e).collapse(f)})})}(window.jQuery),!function(a){function d(){a(b).parent().removeClass("open")}"use strict";var b='[data-toggle="dropdown"]',c=function(b){var c=a(b).on("click.dropdown.data-api",this.toggle);a("html").on("click.dropdown.data-api",function(){c.parent().removeClass("open")})};c.prototype={constructor:c,toggle:function(b){var c=a(this),e,f,g;if(c.is(".disabled, :disabled"))return;return f=c.attr("data-target"),f||(f=c.attr("href"),f=f&&f.replace(/.*(?=#[^\s]*$)/,"")),e=a(f),e.length||(e=c.parent()),g=e.hasClass("open"),d(),g||e.toggleClass("open"),!1}},a.fn.dropdown=function(b){return this.each(function(){var d=a(this),e=d.data("dropdown");e||d.data("dropdown",e=new c(this)),typeof b=="string"&&e[b].call(d)})},a.fn.dropdown.Constructor=c,a(function(){a("html").on("click.dropdown.data-api",d),a("body").on("click.dropdown",".dropdown form",function(a){a.stopPropagation()}).on("click.dropdown.data-api",b,c.prototype.toggle)})}(window.jQuery),!function(a){function c(){var b=this,c=setTimeout(function(){b.$element.off(a.support.transition.end),d.call(b)},500);this.$element.one(a.support.transition.end,function(){clearTimeout(c),d.call(b)})}function d(a){this.$element.hide().trigger("hidden"),e.call(this)}function e(b){var c=this,d=this.$element.hasClass("fade")?"fade":"";if(this.isShown&&this.options.backdrop){var e=a.support.transition&&d;this.$backdrop=a('<div class="modal-backdrop '+d+'" />').appendTo(document.body),this.options.backdrop!="static"&&this.$backdrop.click(a.proxy(this.hide,this)),e&&this.$backdrop[0].offsetWidth,this.$backdrop.addClass("in"),e?this.$backdrop.one(a.support.transition.end,b):b()}else!this.isShown&&this.$backdrop?(this.$backdrop.removeClass("in"),a.support.transition&&this.$element.hasClass("fade")?this.$backdrop.one(a.support.transition.end,a.proxy(f,this)):f.call(this)):b&&b()}function f(){this.$backdrop.remove(),this.$backdrop=null}function g(){var b=this;this.isShown&&this.options.keyboard?a(document).on("keyup.dismiss.modal",function(a){a.which==27&&b.hide()}):this.isShown||a(document).off("keyup.dismiss.modal")}"use strict";var b=function(b,c){this.options=c,this.$element=a(b).delegate('[data-dismiss="modal"]',"click.dismiss.modal",a.proxy(this.hide,this))};b.prototype={constructor:b,toggle:function(){return this[this.isShown?"hide":"show"]()},show:function(){var b=this,c=a.Event("show");this.$element.trigger(c);if(this.isShown||c.isDefaultPrevented())return;a("body").addClass("modal-open"),this.isShown=!0,g.call(this),e.call(this,function(){var c=a.support.transition&&b.$element.hasClass("fade");b.$element.parent().length||b.$element.appendTo(document.body),b.$element.show(),c&&b.$element[0].offsetWidth,b.$element.addClass("in"),c?b.$element.one(a.support.transition.end,function(){b.$element.trigger("shown")}):b.$element.trigger("shown")})},hide:function(b){b&&b.preventDefault();var e=this;b=a.Event("hide"),this.$element.trigger(b);if(!this.isShown||b.isDefaultPrevented())return;this.isShown=!1,a("body").removeClass("modal-open"),g.call(this),this.$element.removeClass("in"),a.support.transition&&this.$element.hasClass("fade")?c.call(this):d.call(this)}},a.fn.modal=function(c){return this.each(function(){var d=a(this),e=d.data("modal"),f=a.extend({},a.fn.modal.defaults,d.data(),typeof c=="object"&&c);e||d.data("modal",e=new b(this,f)),typeof c=="string"?e[c]():f.show&&e.show()})},a.fn.modal.defaults={backdrop:!0,keyboard:!0,show:!0},a.fn.modal.Constructor=b,a(function(){a("body").on("click.modal.data-api",'[data-toggle="modal"]',function(b){var c=a(this),d,e=a(c.attr("data-target")||(d=c.attr("href"))&&d.replace(/.*(?=#[^\s]+$)/,"")),f=e.data("modal")?"toggle":a.extend({},e.data(),c.data());b.preventDefault(),e.modal(f)})})}(window.jQuery),!function(a){"use strict";var b=function(a,b){this.init("tooltip",a,b)};b.prototype={constructor:b,init:function(b,c,d){var e,f;this.type=b,this.$element=a(c),this.options=this.getOptions(d),this.enabled=!0,this.options.trigger!="manual"&&(e=this.options.trigger=="hover"?"mouseenter":"focus",f=this.options.trigger=="hover"?"mouseleave":"blur",this.$element.on(e,this.options.selector,a.proxy(this.enter,this)),this.$element.on(f,this.options.selector,a.proxy(this.leave,this))),this.options.selector?this._options=a.extend({},this.options,{trigger:"manual",selector:""}):this.fixTitle()},getOptions:function(b){return b=a.extend({},a.fn[this.type].defaults,b,this.$element.data()),b.delay&&typeof b.delay=="number"&&(b.delay={show:b.delay,hide:b.delay}),b},enter:function(b){var c=a(b.currentTarget)[this.type](this._options).data(this.type);if(!c.options.delay||!c.options.delay.show)return c.show();clearTimeout(this.timeout),c.hoverState="in",this.timeout=setTimeout(function(){c.hoverState=="in"&&c.show()},c.options.delay.show)},leave:function(b){var c=a(b.currentTarget)[this.type](this._options).data(this.type);if(!c.options.delay||!c.options.delay.hide)return c.hide();clearTimeout(this.timeout),c.hoverState="out",this.timeout=setTimeout(function(){c.hoverState=="out"&&c.hide()},c.options.delay.hide)},show:function(){var a,b,c,d,e,f,g;if(this.hasContent()&&this.enabled){a=this.tip(),this.setContent(),this.options.animation&&a.addClass("fade"),f=typeof this.options.placement=="function"?this.options.placement.call(this,a[0],this.$element[0]):this.options.placement,b=/in/.test(f),a.remove().css({top:0,left:0,display:"block"}).appendTo(b?this.$element:document.body),c=this.getPosition(b),d=a[0].offsetWidth,e=a[0].offsetHeight;switch(b?f.split(" ")[1]:f){case"bottom":g={top:c.top+c.height,left:c.left+c.width/2-d/2};break;case"top":g={top:c.top-e,left:c.left+c.width/2-d/2};break;case"left":g={top:c.top+c.height/2-e/2,left:c.left-d};break;case"right":g={top:c.top+c.height/2-e/2,left:c.left+c.width}}a.css(g).addClass(f).addClass("in")}},isHTML:function(a){return typeof a!="string"||a.charAt(0)==="<"&&a.charAt(a.length-1)===">"&&a.length>=3||/^(?:[^<]*<[\w\W]+>[^>]*$)/.exec(a)},setContent:function(){var a=this.tip(),b=this.getTitle();a.find(".tooltip-inner")[this.isHTML(b)?"html":"text"](b),a.removeClass("fade in top bottom left right")},hide:function(){function d(){var b=setTimeout(function(){c.off(a.support.transition.end).remove()},500);c.one(a.support.transition.end,function(){clearTimeout(b),c.remove()})}var b=this,c=this.tip();c.removeClass("in"),a.support.transition&&this.$tip.hasClass("fade")?d():c.remove()},fixTitle:function(){var a=this.$element;(a.attr("title")||typeof a.attr("data-original-title")!="string")&&a.attr("data-original-title",a.attr("title")||"").removeAttr("title")},hasContent:function(){return this.getTitle()},getPosition:function(b){return a.extend({},b?{top:0,left:0}:this.$element.offset(),{width:this.$element[0].offsetWidth,height:this.$element[0].offsetHeight})},getTitle:function(){var a,b=this.$element,c=this.options;return a=b.attr("data-original-title")||(typeof c.title=="function"?c.title.call(b[0]):c.title),a},tip:function(){return this.$tip=this.$tip||a(this.options.template)},validate:function(){this.$element[0].parentNode||(this.hide(),this.$element=null,this.options=null)},enable:function(){this.enabled=!0},disable:function(){this.enabled=!1},toggleEnabled:function(){this.enabled=!this.enabled},toggle:function(){this[this.tip().hasClass("in")?"hide":"show"]()}},a.fn.tooltip=function(c){return this.each(function(){var d=a(this),e=d.data("tooltip"),f=typeof c=="object"&&c;e||d.data("tooltip",e=new b(this,f)),typeof c=="string"&&e[c]()})},a.fn.tooltip.Constructor=b,a.fn.tooltip.defaults={animation:!0,placement:"top",selector:!1,template:'<div class="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',trigger:"hover",title:"",delay:0}}(window.jQuery),!function(a){"use strict";var b=function(a,b){this.init("popover",a,b)};b.prototype=a.extend({},a.fn.tooltip.Constructor.prototype,{constructor:b,setContent:function(){var a=this.tip(),b=this.getTitle(),c=this.getContent();a.find(".popover-title")[this.isHTML(b)?"html":"text"](b),a.find(".popover-content > *")[this.isHTML(c)?"html":"text"](c),a.removeClass("fade top bottom left right in")},hasContent:function(){return this.getTitle()||this.getContent()},getContent:function(){var a,b=this.$element,c=this.options;return a=b.attr("data-content")||(typeof c.content=="function"?c.content.call(b[0]):c.content),a},tip:function(){return this.$tip||(this.$tip=a(this.options.template)),this.$tip}}),a.fn.popover=function(c){return this.each(function(){var d=a(this),e=d.data("popover"),f=typeof c=="object"&&c;e||d.data("popover",e=new b(this,f)),typeof c=="string"&&e[c]()})},a.fn.popover.Constructor=b,a.fn.popover.defaults=a.extend({},a.fn.tooltip.defaults,{placement:"right",content:"",template:'<div class="popover"><div class="arrow"></div><div class="popover-inner"><h3 class="popover-title"></h3><div class="popover-content"><p></p></div></div></div>'})}(window.jQuery),!function(a){function b(b,c){var d=a.proxy(this.process,this),e=a(b).is("body")?a(window):a(b),f;this.options=a.extend({},a.fn.scrollspy.defaults,c),this.$scrollElement=e.on("scroll.scroll.data-api",d),this.selector=(this.options.target||(f=a(b).attr("href"))&&f.replace(/.*(?=#[^\s]+$)/,"")||"")+" .nav li > a",this.$body=a("body").on("click.scroll.data-api",this.selector,d),this.refresh(),this.process()}"use strict",b.prototype={constructor:b,refresh:function(){var b=this,c;this.offsets=a([]),this.targets=a([]),c=this.$body.find(this.selector).map(function(){var b=a(this),c=b.data("target")||b.attr("href"),d=/^#\w/.test(c)&&a(c);return d&&c.length&&[[d.position().top,c]]||null}).sort(function(a,b){return a[0]-b[0]}).each(function(){b.offsets.push(this[0]),b.targets.push(this[1])})},process:function(){var a=this.$scrollElement.scrollTop()+this.options.offset,b=this.$scrollElement[0].scrollHeight||this.$body[0].scrollHeight,c=b-this.$scrollElement.height(),d=this.offsets,e=this.targets,f=this.activeTarget,g;if(a>=c)return f!=(g=e.last()[0])&&this.activate(g);for(g=d.length;g--;)f!=e[g]&&a>=d[g]&&(!d[g+1]||a<=d[g+1])&&this.activate(e[g])},activate:function(b){var c,d;this.activeTarget=b,a(this.selector).parent(".active").removeClass("active"),d=this.selector+'[data-target="'+b+'"],'+this.selector+'[href="'+b+'"]',c=a(d).parent("li").addClass("active"),c.parent(".dropdown-menu")&&(c=c.closest("li.dropdown").addClass("active")),c.trigger("activate")}},a.fn.scrollspy=function(c){return this.each(function(){var d=a(this),e=d.data("scrollspy"),f=typeof c=="object"&&c;e||d.data("scrollspy",e=new b(this,f)),typeof c=="string"&&e[c]()})},a.fn.scrollspy.Constructor=b,a.fn.scrollspy.defaults={offset:10},a(function(){a('[data-spy="scroll"]').each(function(){var b=a(this);b.scrollspy(b.data())})})}(window.jQuery),!function(a){"use strict";var b=function(b){this.element=a(b)};b.prototype={constructor:b,show:function(){var b=this.element,c=b.closest("ul:not(.dropdown-menu)"),d=b.attr("data-target"),e,f,g;d||(d=b.attr("href"),d=d&&d.replace(/.*(?=#[^\s]*$)/,""));if(b.parent("li").hasClass("active"))return;e=c.find(".active a").last()[0],g=a.Event("show",{relatedTarget:e}),b.trigger(g);if(g.isDefaultPrevented())return;f=a(d),this.activate(b.parent("li"),c),this.activate(f,f.parent(),function(){b.trigger({type:"shown",relatedTarget:e})})},activate:function(b,c,d){function g(){e.removeClass("active").find("> .dropdown-menu > .active").removeClass("active"),b.addClass("active"),f?(b[0].offsetWidth,b.addClass("in")):b.removeClass("fade"),b.parent(".dropdown-menu")&&b.closest("li.dropdown").addClass("active"),d&&d()}var e=c.find("> .active"),f=d&&a.support.transition&&e.hasClass("fade");f?e.one(a.support.transition.end,g):g(),e.removeClass("in")}},a.fn.tab=function(c){return this.each(function(){var d=a(this),e=d.data("tab");e||d.data("tab",e=new b(this)),typeof c=="string"&&e[c]()})},a.fn.tab.Constructor=b,a(function(){a("body").on("click.tab.data-api",'[data-toggle="tab"], [data-toggle="pill"]',function(b){b.preventDefault(),a(this).tab("show")})})}(window.jQuery),!function(a){"use strict";var b=function(b,c){this.$element=a(b),this.options=a.extend({},a.fn.typeahead.defaults,c),this.matcher=this.options.matcher||this.matcher,this.sorter=this.options.sorter||this.sorter,this.highlighter=this.options.highlighter||this.highlighter,this.updater=this.options.updater||this.updater,this.$menu=a(this.options.menu).appendTo("body"),this.source=this.options.source,this.shown=!1,this.listen()};b.prototype={constructor:b,select:function(){var a=this.$menu.find(".active").attr("data-value");return this.$element.val(this.updater(a)).change(),this.hide()},updater:function(a){return a},show:function(){var b=a.extend({},this.$element.position(),{height:this.$element[0].offsetHeight});return this.$menu.css({top:b.top+b.height,left:b.left}),this.$menu.show(),this.shown=!0,this},hide:function(){return this.$menu.hide(),this.shown=!1,this},lookup:function(b){var c=this,d,e;return this.query=this.$element.val(),this.query?(d=a.grep(this.source,function(a){return c.matcher(a)}),d=this.sorter(d),d.length?this.render(d.slice(0,this.options.items)).show():this.shown?this.hide():this):this.shown?this.hide():this},matcher:function(a){return~a.toLowerCase().indexOf(this.query.toLowerCase())},sorter:function(a){var b=[],c=[],d=[],e;while(e=a.shift())e.toLowerCase().indexOf(this.query.toLowerCase())?~e.indexOf(this.query)?c.push(e):d.push(e):b.push(e);return b.concat(c,d)},highlighter:function(a){var b=this.query.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&");return a.replace(new RegExp("("+b+")","ig"),function(a,b){return"<strong>"+b+"</strong>"})},render:function(b){var c=this;return b=a(b).map(function(b,d){return b=a(c.options.item).attr("data-value",d),b.find("a").html(c.highlighter(d)),b[0]}),b.first().addClass("active"),this.$menu.html(b),this},next:function(b){var c=this.$menu.find(".active").removeClass("active"),d=c.next();d.length||(d=a(this.$menu.find("li")[0])),d.addClass("active")},prev:function(a){var b=this.$menu.find(".active").removeClass("active"),c=b.prev();c.length||(c=this.$menu.find("li").last()),c.addClass("active")},listen:function(){this.$element.on("blur",a.proxy(this.blur,this)).on("keypress",a.proxy(this.keypress,this)).on("keyup",a.proxy(this.keyup,this)),(a.browser.webkit||a.browser.msie)&&this.$element.on("keydown",a.proxy(this.keypress,this)),this.$menu.on("click",a.proxy(this.click,this)).on("mouseenter","li",a.proxy(this.mouseenter,this))},keyup:function(a){switch(a.keyCode){case 40:case 38:break;case 9:case 13:if(!this.shown)return;this.select();break;case 27:if(!this.shown)return;this.hide();break;default:this.lookup()}a.stopPropagation(),a.preventDefault()},keypress:function(a){if(!this.shown)return;switch(a.keyCode){case 9:case 13:case 27:a.preventDefault();break;case 38:if(a.type!="keydown")break;a.preventDefault(),this.prev();break;case 40:if(a.type!="keydown")break;a.preventDefault(),this.next()}a.stopPropagation()},blur:function(a){var b=this;setTimeout(function(){b.hide()},150)},click:function(a){a.stopPropagation(),a.preventDefault(),this.select()},mouseenter:function(b){this.$menu.find(".active").removeClass("active"),a(b.currentTarget).addClass("active")}},a.fn.typeahead=function(c){return this.each(function(){var d=a(this),e=d.data("typeahead"),f=typeof c=="object"&&c;e||d.data("typeahead",e=new b(this,f)),typeof c=="string"&&e[c]()})},a.fn.typeahead.defaults={source:[],items:8,menu:'<ul class="typeahead dropdown-menu"></ul>',item:'<li><a href="#"></a></li>'},a.fn.typeahead.Constructor=b,a(function(){a("body").on("focus.typeahead.data-api",'[data-provide="typeahead"]',function(b){var c=a(this);if(c.data("typeahead"))return;b.preventDefault(),c.typeahead(c.data())})})}(window.jQuery);
\ No newline at end of file
+++ /dev/null
-/* http://prismjs.com/download.html?themes=prism&languages=markup+css+clike+javascript+bash+c+python+sql+http+ruby+csharp+go+aspnet+objectivec */
-var self=typeof window!="undefined"?window:{},Prism=function(){var e=/\blang(?:uage)?-(?!\*)(\w+)\b/i,t=self.Prism={util:{encode:function(e){return e instanceof n?new n(e.type,t.util.encode(e.content)):t.util.type(e)==="Array"?e.map(t.util.encode):e.replace(/&/g,"&").replace(/</g,"<").replace(/\u00a0/g," ")},type:function(e){return Object.prototype.toString.call(e).match(/\[object (\w+)\]/)[1]},clone:function(e){var n=t.util.type(e);switch(n){case"Object":var r={};for(var i in e)e.hasOwnProperty(i)&&(r[i]=t.util.clone(e[i]));return r;case"Array":return e.slice()}return e}},languages:{extend:function(e,n){var r=t.util.clone(t.languages[e]);for(var i in n)r[i]=n[i];return r},insertBefore:function(e,n,r,i){i=i||t.languages;var s=i[e],o={};for(var u in s)if(s.hasOwnProperty(u)){if(u==n)for(var a in r)r.hasOwnProperty(a)&&(o[a]=r[a]);o[u]=s[u]}return i[e]=o},DFS:function(e,n){for(var r in e){n.call(e,r,e[r]);t.util.type(e)==="Object"&&t.languages.DFS(e[r],n)}}},highlightAll:function(e,n){var r=document.querySelectorAll('code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code');for(var i=0,s;s=r[i++];)t.highlightElement(s,e===!0,n)},highlightElement:function(r,i,s){var o,u,a=r;while(a&&!e.test(a.className))a=a.parentNode;if(a){o=(a.className.match(e)||[,""])[1];u=t.languages[o]}if(!u)return;r.className=r.className.replace(e,"").replace(/\s+/g," ")+" language-"+o;a=r.parentNode;/pre/i.test(a.nodeName)&&(a.className=a.className.replace(e,"").replace(/\s+/g," ")+" language-"+o);var f=r.textContent;if(!f)return;var l={element:r,language:o,grammar:u,code:f};t.hooks.run("before-highlight",l);if(i&&self.Worker){var c=new Worker(t.filename);c.onmessage=function(e){l.highlightedCode=n.stringify(JSON.parse(e.data),o);t.hooks.run("before-insert",l);l.element.innerHTML=l.highlightedCode;s&&s.call(l.element);t.hooks.run("after-highlight",l)};c.postMessage(JSON.stringify({language:l.language,code:l.code}))}else{l.highlightedCode=t.highlight(l.code,l.grammar,l.language);t.hooks.run("before-insert",l);l.element.innerHTML=l.highlightedCode;s&&s.call(r);t.hooks.run("after-highlight",l)}},highlight:function(e,r,i){var s=t.tokenize(e,r);return n.stringify(t.util.encode(s),i)},tokenize:function(e,n,r){var i=t.Token,s=[e],o=n.rest;if(o){for(var u in o)n[u]=o[u];delete n.rest}e:for(var u in n){if(!n.hasOwnProperty(u)||!n[u])continue;var a=n[u],f=a.inside,l=!!a.lookbehind,c=0;a=a.pattern||a;for(var h=0;h<s.length;h++){var p=s[h];if(s.length>e.length)break e;if(p instanceof i)continue;a.lastIndex=0;var d=a.exec(p);if(d){l&&(c=d[1].length);var v=d.index-1+c,d=d[0].slice(c),m=d.length,g=v+m,y=p.slice(0,v+1),b=p.slice(g+1),w=[h,1];y&&w.push(y);var E=new i(u,f?t.tokenize(d,f):d);w.push(E);b&&w.push(b);Array.prototype.splice.apply(s,w)}}}return s},hooks:{all:{},add:function(e,n){var r=t.hooks.all;r[e]=r[e]||[];r[e].push(n)},run:function(e,n){var r=t.hooks.all[e];if(!r||!r.length)return;for(var i=0,s;s=r[i++];)s(n)}}},n=t.Token=function(e,t){this.type=e;this.content=t};n.stringify=function(e,r,i){if(typeof e=="string")return e;if(Object.prototype.toString.call(e)=="[object Array]")return e.map(function(t){return n.stringify(t,r,e)}).join("");var s={type:e.type,content:n.stringify(e.content,r,i),tag:"span",classes:["token",e.type],attributes:{},language:r,parent:i};s.type=="comment"&&(s.attributes.spellcheck="true");t.hooks.run("wrap",s);var o="";for(var u in s.attributes)o+=u+'="'+(s.attributes[u]||"")+'"';return"<"+s.tag+' class="'+s.classes.join(" ")+'" '+o+">"+s.content+"</"+s.tag+">"};if(!self.document){if(!self.addEventListener)return self.Prism;self.addEventListener("message",function(e){var n=JSON.parse(e.data),r=n.language,i=n.code;self.postMessage(JSON.stringify(t.tokenize(i,t.languages[r])));self.close()},!1);return self.Prism}var r=document.getElementsByTagName("script");r=r[r.length-1];if(r){t.filename=r.src;document.addEventListener&&!r.hasAttribute("data-manual")&&document.addEventListener("DOMContentLoaded",t.highlightAll)}return self.Prism}();typeof module!="undefined"&&module.exports&&(module.exports=Prism);;
-Prism.languages.markup={comment:/<!--[\w\W]*?-->/g,prolog:/<\?.+?\?>/,doctype:/<!DOCTYPE.+?>/,cdata:/<!\[CDATA\[[\w\W]*?]]>/i,tag:{pattern:/<\/?[\w:-]+\s*(?:\s+[\w:-]+(?:=(?:("|')(\\?[\w\W])*?\1|[^\s'">=]+))?\s*)*\/?>/gi,inside:{tag:{pattern:/^<\/?[\w:-]+/i,inside:{punctuation:/^<\/?/,namespace:/^[\w-]+?:/}},"attr-value":{pattern:/=(?:('|")[\w\W]*?(\1)|[^\s>]+)/gi,inside:{punctuation:/=|>|"/g}},punctuation:/\/?>/g,"attr-name":{pattern:/[\w:-]+/g,inside:{namespace:/^[\w-]+?:/}}}},entity:/\&#?[\da-z]{1,8};/gi};Prism.hooks.add("wrap",function(e){e.type==="entity"&&(e.attributes.title=e.content.replace(/&/,"&"))});;
-Prism.languages.css={comment:/\/\*[\w\W]*?\*\//g,atrule:{pattern:/@[\w-]+?.*?(;|(?=\s*{))/gi,inside:{punctuation:/[;:]/g}},url:/url\((["']?).*?\1\)/gi,selector:/[^\{\}\s][^\{\};]*(?=\s*\{)/g,property:/(\b|\B)[\w-]+(?=\s*:)/ig,string:/("|')(\\?.)*?\1/g,important:/\B!important\b/gi,punctuation:/[\{\};:]/g,"function":/[-a-z0-9]+(?=\()/ig};Prism.languages.markup&&Prism.languages.insertBefore("markup","tag",{style:{pattern:/<style[\w\W]*?>[\w\W]*?<\/style>/ig,inside:{tag:{pattern:/<style[\w\W]*?>|<\/style>/ig,inside:Prism.languages.markup.tag.inside},rest:Prism.languages.css}}});;
-Prism.languages.clike={comment:{pattern:/(^|[^\\])(\/\*[\w\W]*?\*\/|(^|[^:])\/\/.*?(\r?\n|$))/g,lookbehind:!0},string:/("|')(\\?.)*?\1/g,"class-name":{pattern:/((?:(?:class|interface|extends|implements|trait|instanceof|new)\s+)|(?:catch\s+\())[a-z0-9_\.\\]+/ig,lookbehind:!0,inside:{punctuation:/(\.|\\)/}},keyword:/\b(if|else|while|do|for|return|in|instanceof|function|new|try|throw|catch|finally|null|break|continue)\b/g,"boolean":/\b(true|false)\b/g,"function":{pattern:/[a-z0-9_]+\(/ig,inside:{punctuation:/\(/}},number:/\b-?(0x[\dA-Fa-f]+|\d*\.?\d+([Ee]-?\d+)?)\b/g,operator:/[-+]{1,2}|!|<=?|>=?|={1,3}|&{1,2}|\|?\||\?|\*|\/|\~|\^|\%/g,ignore:/&(lt|gt|amp);/gi,punctuation:/[{}[\];(),.:]/g};;
-Prism.languages.javascript=Prism.languages.extend("clike",{keyword:/\b(break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|false|finally|for|function|get|if|implements|import|in|instanceof|interface|let|new|null|package|private|protected|public|return|set|static|super|switch|this|throw|true|try|typeof|var|void|while|with|yield)\b/g,number:/\b-?(0x[\dA-Fa-f]+|\d*\.?\d+([Ee]-?\d+)?|NaN|-?Infinity)\b/g});Prism.languages.insertBefore("javascript","keyword",{regex:{pattern:/(^|[^/])\/(?!\/)(\[.+?]|\\.|[^/\r\n])+\/[gim]{0,3}(?=\s*($|[\r\n,.;})]))/g,lookbehind:!0}});Prism.languages.markup&&Prism.languages.insertBefore("markup","tag",{script:{pattern:/<script[\w\W]*?>[\w\W]*?<\/script>/ig,inside:{tag:{pattern:/<script[\w\W]*?>|<\/script>/ig,inside:Prism.languages.markup.tag.inside},rest:Prism.languages.javascript}}});
-;
-Prism.languages.bash=Prism.languages.extend("clike",{comment:{pattern:/(^|[^"{\\])(#.*?(\r?\n|$))/g,lookbehind:!0},string:{pattern:/("|')(\\?[\s\S])*?\1/g,inside:{property:/\$([a-zA-Z0-9_#\?\-\*!@]+|\{[^\}]+\})/g}},keyword:/\b(if|then|else|elif|fi|for|break|continue|while|in|case|function|select|do|done|until|echo|exit|return|set|declare)\b/g});Prism.languages.insertBefore("bash","keyword",{property:/\$([a-zA-Z0-9_#\?\-\*!@]+|\{[^}]+\})/g});Prism.languages.insertBefore("bash","comment",{important:/(^#!\s*\/bin\/bash)|(^#!\s*\/bin\/sh)/g});;
-Prism.languages.c=Prism.languages.extend("clike",{keyword:/\b(asm|typeof|inline|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|int|long|register|return|short|signed|sizeof|static|struct|switch|typedef|union|unsigned|void|volatile|while)\b/g,operator:/[-+]{1,2}|!=?|<{1,2}=?|>{1,2}=?|\->|={1,2}|\^|~|%|(&){1,2}|\|?\||\?|\*|\//g});Prism.languages.insertBefore("c","keyword",{property:{pattern:/#[a-zA-Z]+\ .*/g,inside:{property:/<[a-zA-Z.]+>/g}}});;
-Prism.languages.python={comment:{pattern:/(^|[^\\])#.*?(\r?\n|$)/g,lookbehind:!0},string:/"""[\s\S]+?"""|("|')(\\?.)*?\1/g,keyword:/\b(as|assert|break|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|pass|print|raise|return|try|while|with|yield)\b/g,"boolean":/\b(True|False)\b/g,number:/\b-?(0x)?\d*\.?[\da-f]+\b/g,operator:/[-+]{1,2}|=?<|=?>|!|={1,2}|(&){1,2}|(&){1,2}|\|?\||\?|\*|\/|~|\^|%|\b(or|and|not)\b/g,ignore:/&(lt|gt|amp);/gi,punctuation:/[{}[\];(),.:]/g};;
-Prism.languages.sql={comment:{pattern:/(^|[^\\])(\/\*[\w\W]*?\*\/|((--)|(\/\/)|#).*?(\r?\n|$))/g,lookbehind:!0},string:/("|')(\\?.)*?\1/g,keyword:/\b(ACTION|ADD|AFTER|ALGORITHM|ALTER|ANALYZE|APPLY|AS|ASC|AUTHORIZATION|BACKUP|BDB|BEGIN|BERKELEYDB|BIGINT|BINARY|BIT|BLOB|BOOL|BOOLEAN|BREAK|BROWSE|BTREE|BULK|BY|CALL|CASCADE|CASCADED|CASE|CHAIN|CHAR VARYING|CHARACTER VARYING|CHECK|CHECKPOINT|CLOSE|CLUSTERED|COALESCE|COLUMN|COLUMNS|COMMENT|COMMIT|COMMITTED|COMPUTE|CONNECT|CONSISTENT|CONSTRAINT|CONTAINS|CONTAINSTABLE|CONTINUE|CONVERT|CREATE|CROSS|CURRENT|CURRENT_DATE|CURRENT_TIME|CURRENT_TIMESTAMP|CURRENT_USER|CURSOR|DATA|DATABASE|DATABASES|DATETIME|DBCC|DEALLOCATE|DEC|DECIMAL|DECLARE|DEFAULT|DEFINER|DELAYED|DELETE|DENY|DESC|DESCRIBE|DETERMINISTIC|DISABLE|DISCARD|DISK|DISTINCT|DISTINCTROW|DISTRIBUTED|DO|DOUBLE|DOUBLE PRECISION|DROP|DUMMY|DUMP|DUMPFILE|DUPLICATE KEY|ELSE|ENABLE|ENCLOSED BY|END|ENGINE|ENUM|ERRLVL|ERRORS|ESCAPE|ESCAPED BY|EXCEPT|EXEC|EXECUTE|EXIT|EXPLAIN|EXTENDED|FETCH|FIELDS|FILE|FILLFACTOR|FIRST|FIXED|FLOAT|FOLLOWING|FOR|FOR EACH ROW|FORCE|FOREIGN|FREETEXT|FREETEXTTABLE|FROM|FULL|FUNCTION|GEOMETRY|GEOMETRYCOLLECTION|GLOBAL|GOTO|GRANT|GROUP|HANDLER|HASH|HAVING|HOLDLOCK|IDENTITY|IDENTITY_INSERT|IDENTITYCOL|IF|IGNORE|IMPORT|INDEX|INFILE|INNER|INNODB|INOUT|INSERT|INT|INTEGER|INTERSECT|INTO|INVOKER|ISOLATION LEVEL|JOIN|KEY|KEYS|KILL|LANGUAGE SQL|LAST|LEFT|LIMIT|LINENO|LINES|LINESTRING|LOAD|LOCAL|LOCK|LONGBLOB|LONGTEXT|MATCH|MATCHED|MEDIUMBLOB|MEDIUMINT|MEDIUMTEXT|MERGE|MIDDLEINT|MODIFIES SQL DATA|MODIFY|MULTILINESTRING|MULTIPOINT|MULTIPOLYGON|NATIONAL|NATIONAL CHAR VARYING|NATIONAL CHARACTER|NATIONAL CHARACTER VARYING|NATIONAL VARCHAR|NATURAL|NCHAR|NCHAR VARCHAR|NEXT|NO|NO SQL|NOCHECK|NOCYCLE|NONCLUSTERED|NULLIF|NUMERIC|OF|OFF|OFFSETS|ON|OPEN|OPENDATASOURCE|OPENQUERY|OPENROWSET|OPTIMIZE|OPTION|OPTIONALLY|ORDER|OUT|OUTER|OUTFILE|OVER|PARTIAL|PARTITION|PERCENT|PIVOT|PLAN|POINT|POLYGON|PRECEDING|PRECISION|PREV|PRIMARY|PRINT|PRIVILEGES|PROC|PROCEDURE|PUBLIC|PURGE|QUICK|RAISERROR|READ|READS SQL DATA|READTEXT|REAL|RECONFIGURE|REFERENCES|RELEASE|RENAME|REPEATABLE|REPLICATION|REQUIRE|RESTORE|RESTRICT|RETURN|RETURNS|REVOKE|RIGHT|ROLLBACK|ROUTINE|ROWCOUNT|ROWGUIDCOL|ROWS?|RTREE|RULE|SAVE|SAVEPOINT|SCHEMA|SELECT|SERIAL|SERIALIZABLE|SESSION|SESSION_USER|SET|SETUSER|SHARE MODE|SHOW|SHUTDOWN|SIMPLE|SMALLINT|SNAPSHOT|SOME|SONAME|START|STARTING BY|STATISTICS|STATUS|STRIPED|SYSTEM_USER|TABLE|TABLES|TABLESPACE|TEMPORARY|TEMPTABLE|TERMINATED BY|TEXT|TEXTSIZE|THEN|TIMESTAMP|TINYBLOB|TINYINT|TINYTEXT|TO|TOP|TRAN|TRANSACTION|TRANSACTIONS|TRIGGER|TRUNCATE|TSEQUAL|TYPE|TYPES|UNBOUNDED|UNCOMMITTED|UNDEFINED|UNION|UNPIVOT|UPDATE|UPDATETEXT|USAGE|USE|USER|USING|VALUE|VALUES|VARBINARY|VARCHAR|VARCHARACTER|VARYING|VIEW|WAITFOR|WARNINGS|WHEN|WHERE|WHILE|WITH|WITH ROLLUP|WITHIN|WORK|WRITE|WRITETEXT)\b/gi,"boolean":/\b(TRUE|FALSE|NULL)\b/gi,number:/\b-?(0x)?\d*\.?[\da-f]+\b/g,operator:/\b(ALL|AND|ANY|BETWEEN|EXISTS|IN|LIKE|NOT|OR|IS|UNIQUE|CHARACTER SET|COLLATE|DIV|OFFSET|REGEXP|RLIKE|SOUNDS LIKE|XOR)\b|[-+]{1}|!|=?<|=?>|={1}|(&){1,2}|\|?\||\?|\*|\//gi,ignore:/&(lt|gt|amp);/gi,punctuation:/[;[\]()`,.]/g};;
-Prism.languages.http={"request-line":{pattern:/^(POST|GET|PUT|DELETE|OPTIONS|PATCH|TRACE|CONNECT)\b\shttps?:\/\/\S+\sHTTP\/[0-9.]+/g,inside:{property:/^\b(POST|GET|PUT|DELETE|OPTIONS|PATCH|TRACE|CONNECT)\b/g,"attr-name":/:\w+/g}},"response-status":{pattern:/^HTTP\/1.[01] [0-9]+.*/g,inside:{property:/[0-9]+[A-Z\s-]+$/g}},keyword:/^[\w-]+:(?=.+)/gm};var httpLanguages={"application/json":Prism.languages.javascript,"application/xml":Prism.languages.markup,"text/xml":Prism.languages.markup,"text/html":Prism.languages.markup};for(var contentType in httpLanguages)if(httpLanguages[contentType]){var options={};options[contentType]={pattern:new RegExp("(content-type:\\s*"+contentType+"[\\w\\W]*?)\\n\\n[\\w\\W]*","gi"),lookbehind:!0,inside:{rest:httpLanguages[contentType]}};Prism.languages.insertBefore("http","keyword",options)};;
-/**
- * Original by Samuel Flores
- *
- * Adds the following new token classes:
- * constant, builtin, variable, symbol, regex
- */Prism.languages.ruby=Prism.languages.extend("clike",{comment:/#[^\r\n]*(\r?\n|$)/g,keyword:/\b(alias|and|BEGIN|begin|break|case|class|def|define_method|defined|do|each|else|elsif|END|end|ensure|false|for|if|in|module|new|next|nil|not|or|raise|redo|require|rescue|retry|return|self|super|then|throw|true|undef|unless|until|when|while|yield)\b/g,builtin:/\b(Array|Bignum|Binding|Class|Continuation|Dir|Exception|FalseClass|File|Stat|File|Fixnum|Fload|Hash|Integer|IO|MatchData|Method|Module|NilClass|Numeric|Object|Proc|Range|Regexp|String|Struct|TMS|Symbol|ThreadGroup|Thread|Time|TrueClass)\b/,constant:/\b[A-Z][a-zA-Z_0-9]*[?!]?\b/g});Prism.languages.insertBefore("ruby","keyword",{regex:{pattern:/(^|[^/])\/(?!\/)(\[.+?]|\\.|[^/\r\n])+\/[gim]{0,3}(?=\s*($|[\r\n,.;})]))/g,lookbehind:!0},variable:/[@$]+\b[a-zA-Z_][a-zA-Z_0-9]*[?!]?\b/g,symbol:/:\b[a-zA-Z_][a-zA-Z_0-9]*[?!]?\b/g});;
-Prism.languages.csharp=Prism.languages.extend("clike",{keyword:/\b(abstract|as|base|bool|break|byte|case|catch|char|checked|class|const|continue|decimal|default|delegate|do|double|else|enum|event|explicit|extern|false|finally|fixed|float|for|foreach|goto|if|implicit|in|int|interface|internal|is|lock|long|namespace|new|null|object|operator|out|override|params|private|protected|public|readonly|ref|return|sbyte|sealed|short|sizeof|stackalloc|static|string|struct|switch|this|throw|true|try|typeof|uint|ulong|unchecked|unsafe|ushort|using|virtual|void|volatile|while|add|alias|ascending|async|await|descending|dynamic|from|get|global|group|into|join|let|orderby|partial|remove|select|set|value|var|where|yield)\b/g,string:/@?("|')(\\?.)*?\1/g,preprocessor:/^\s*#.*/gm,number:/\b-?(0x)?\d*\.?\d+\b/g});;
-Prism.languages.go=Prism.languages.extend("clike",{keyword:/\b(break|case|chan|const|continue|default|defer|else|fallthrough|for|func|go(to)?|if|import|interface|map|package|range|return|select|struct|switch|type|var)\b/g,builtin:/\b(bool|byte|complex(64|128)|error|float(32|64)|rune|string|u?int(8|16|32|64|)|uintptr|append|cap|close|complex|copy|delete|imag|len|make|new|panic|print(ln)?|real|recover)\b/g,"boolean":/\b(_|iota|nil|true|false)\b/g,operator:/([(){}\[\]]|[*\/%^!]=?|\+[=+]?|-[>=-]?|\|[=|]?|>[=>]?|<(<|[=-])?|==?|&(&|=|^=?)?|\.(\.\.)?|[,;]|:=?)/g,number:/\b(-?(0x[a-f\d]+|(\d+\.?\d*|\.\d+)(e[-+]?\d+)?)i?)\b/ig,string:/("|'|`)(\\?.|\r|\n)*?\1/g});delete Prism.languages.go["class-name"];;
-Prism.languages.aspnet=Prism.languages.extend("markup",{"page-directive tag":{pattern:/<%\s*@.*%>/gi,inside:{"page-directive tag":/<%\s*@\s*(?:Assembly|Control|Implements|Import|Master|MasterType|OutputCache|Page|PreviousPageType|Reference|Register)?|%>/gi,rest:Prism.languages.markup.tag.inside}},"directive tag":{pattern:/<%.*%>/gi,inside:{"directive tag":/<%\s*?[$=%#:]{0,2}|%>/gi,rest:Prism.languages.csharp}}}),Prism.languages.insertBefore("inside","punctuation",{"directive tag":Prism.languages.aspnet["directive tag"]},Prism.languages.aspnet.tag.inside["attr-value"]),Prism.languages.insertBefore("aspnet","comment",{"asp comment":/<%--[\w\W]*?--%>/g}),Prism.languages.insertBefore("aspnet",Prism.languages.javascript?"script":"tag",{"asp script":{pattern:/<script(?=.*runat=['"]?server['"]?)[\w\W]*?>[\w\W]*?<\/script>/gi,inside:{tag:{pattern:/<\/?script\s*(?:\s+[\w:-]+(?:=(?:("|')(\\?[\w\W])*?\1|\w+))?\s*)*\/?>/gi,inside:Prism.languages.aspnet.tag.inside},rest:Prism.languages.csharp||{}}}}),Prism.languages.aspnet.style&&(Prism.languages.aspnet.style.inside.tag.pattern=/<\/?style\s*(?:\s+[\w:-]+(?:=(?:("|')(\\?[\w\W])*?\1|\w+))?\s*)*\/?>/gi,Prism.languages.aspnet.style.inside.tag.inside=Prism.languages.aspnet.tag.inside),Prism.languages.aspnet.script&&(Prism.languages.aspnet.script.inside.tag.pattern=Prism.languages.aspnet["asp script"].inside.tag.pattern,Prism.languages.aspnet.script.inside.tag.inside=Prism.languages.aspnet.tag.inside);;
-undefined;
'use strict';
-Class("UnlimitedPizza").inherits(Widget)({
+const UnlimitedPizza = {
- /**
- * Gets instance, creates it if not available.
- */
- instance : function getInstance(config) {
- if (!this._mainInstance) {
- this._mainInstance = new this(config);
- }
- return this._mainInstance;
+ _loadPepperoni() {
+
+ const pepperoniElement = document.querySelector('[data-application="pepperoni"]');
+
+ new Pepperoni({
+ element: pepperoniElement
+ });
+ },
+
+ _loadGuestbook() {
+
},
- prototype : {
+ _loadGuestbookEntries() {
+
+ }
+};
+
+window.addEventListener('load', UnlimitedPizza._onLoad.bind(UnlimitedPizza));
+
+Class("UnlimitedPizza").inherits(Widget)({
_fb : null,
- _loaded : false,
init : function (config) {
Widget.prototype.init.call(this, config)
this.bind('activate', this._onActivate.bind(this));
},
- _onActivate : function _activate() {
- // If this is the first time activating it... then load
- if (!this._loaded) {
- this._load();
- }
- },
-
/*
* Loads everything.
*/
_load : function _load() {
- // Melty cheese is our header image widget.
- this._loadMeltyCheese();
-
// Pepperoni is our recording widget.
this._loadPepperoni();
this._loadPosts();
},
- _loadMeltyCheese : function () {
- this.element.find('.post-image').each(function (i, headerElement) {
-
- // Create and activate
- this.appendChild(new UnlimitedPizza.MeltyCheese({
- element : $(headerElement),
- name : 'header-' + i
- }));
- this['header-' + i].activate();
- }.bind(this));
- },
-
- _loadPepperoni : function () {
- this.element.find('.pepperoni-widget').each(function (i, widgetElement) {
-
- // Create and activate
- this.appendChild(new UnlimitedPizza.Pepperoni({
- element : $(widgetElement),
- name : 'recorder-' + i
- }));
- this['recorder-' + i].activate();
- }.bind(this));
- },
-
_loadGuestbook : function () {
var form = this.element.find('.guestbook-form form');
form.on('submit', function submitPost(ev) {
+++ /dev/null
-'use strict';
-
-Class(UnlimitedPizza, "MeltyCheese").inherits(Widget)({
- prototype : {
- min : 60, // min height of the element
- max : 480, // max height of the element
- minThreshold : 200, // distance from bottom before we start
- maxThreshold : 500, // distance from bottom before we stop
- _loaded : false,
-
- init : function (config) {
- Widget.prototype.init.call(this, config)
-
- this._bindInternalEvents();
- },
-
- _bindInternalEvents : function bindInternalEvents() {
- this.bind('activate', this._onActivate.bind(this));
- this.bind('deactivate', this._onDeactivate.bind(this));
- },
-
- _onActivate : function _activate() {
- // If this is the first time activating it... then load
- if (!this._loaded) {
- this._load();
- }
- },
-
- _onDeactivate : function _deactivate() {
- this._unload();
- },
-
- /*
- * Loads everything.
- */
- _load : function _load() {
- this._bindEvents();
-
- this.image = this.element.find('img')
- this._onScroll();
- },
-
- _unload : function _unload() {
- this._loaded = false;
- this._unbindEvents();
- },
-
- _bindEvents : function bindEvents() {
- $(window).on('scroll', this._onScroll.bind(this));
- $(window).on('resize', this._onScroll.bind(this));
- },
-
- _unbindEvents : function unbindEvents() {
- $(window).off('scroll');
- $(window).off('resize');
- },
-
- /* Listeners beyond */
-
- _onScroll : function onScroll() {
- var documentTop, documentBottom, elementTop, diff, height;
-
-
- documentTop = $(window).scrollTop();
- documentBottom = documentTop + $(window).height();
- elementTop = this.element.offset().top;
- diff = documentBottom - elementTop;
-
- this.max = this.image.height();
- this.min = this.max / 10;
-
- diff -= this.minThreshold;
-
- height = diff * this.max / this.maxThreshold;
-
- if (height < this.min) {
- height = this.min;
- }
-
- if (height > this.max) {
- height = this.max;
- }
-
- this.element.height(height);
- },
-
- }
-});
'use strict';
-Class(UnlimitedPizza, "Pepperoni").inherits(Widget)({
- INNER_HTML : ' \
-<a class="record-button">Record.</a> \
-<div class="record-info"> \
- <div class="record-progress"> \
- <div class="record-progress-bar-container"> \
- <div class="record-progress-bar"></div> \
- </div> \
- <a class="record-clear">Clear recording.</a> \
- </div> \
- <audio class="record-preview" controls></audio> \
- <div class="filter-switches"> \
- <input class="filter-switch" name="bandpass-filter" type="checkbox" /> <label for="bandpass-filter">Band Pass</label> \
- <input class="filter-switch" name="hipass-filter" type="checkbox" /> <label for="hipass-filter">Hi Pass</label> \
- <input class="filter-switch" name="lopass-filter" type="checkbox" /> <label for="lopass-filter">Lo Pass</label> \
- <input class="filter-switch" name="reverb-filter" type="checkbox" /> <label for="reverb-filter">Reverb</label> \
- <input class="filter-switch" name="distort-filter" type="checkbox" /> <label for="distort-filter">Distort</label> \
- </div> \
-</div> \
- ',
- PAUSE : 'Pause.',
- RECORD : 'Record.',
- prototype : {
- maxSize : 1048576,
- recording : false,
- source : null,
- recorder : null,
- context : null,
- _delayNode : null,
- _bandPassFilterNode : null,
- _hiPassFilterNode : null,
- _loPassFilterNode : null,
- _convolverNode : null,
- _distortionNode : null,
- _activatedNodes : null,
- workerPath : '/js/vendor/recorderjs/recorderWorker.js',
- init : function init(config) {
- var channels, frameCount, reverbBuffer, request, requestHandler;
-
- Widget.prototype.init.call(this, config);
-
- if (!this.context) {
- this.context = new (window.AudioContext || window.webkitAudioContext)();
- }
-
- this._delayNode = this.context.createDelay(1.0);
- this._bandPassFilterNode = this.context.createBiquadFilter();
- this._hiPassFilterNode = this.context.createBiquadFilter();
- this._loPassFilterNode = this.context.createBiquadFilter();
- this._convolverNode = this.context.createConvolver();
- this._distortionNode = this.context.createWaveShaper();
-
- this._distortionNode.curve = this._generateDistortion(400);
- this._distortionNode.oversample = '4x';
-
- this._activatedNodes = [];
-
- // config lo pass
- this._loPassFilterNode.type = "lowpass";
- this._loPassFilterNode.frequency.value = 1000;
- this._loPassFilterNode.gain.value = 25;
-
- // config hi pass
- this._hiPassFilterNode.type = "highpass";
- this._hiPassFilterNode.frequency.value = 3000;
- this._hiPassFilterNode.gain.value = 25;
-
- // config band pass
- this._bandPassFilterNode.type = "bandpass";
- this._bandPassFilterNode.frequency.value = 2000;
- this._bandPassFilterNode.gain.value = 25;
-
- requestHandler = function bufferFile(ev) {
- var request = ev.target;
- console.log("Reverb loading");
- this.context.decodeAudioData(request.response, function(buffer){
- console.log("Reverb loaded");
- this._convolverNode.buffer = buffer;
- }.bind(this));
- }.bind(this);
-
- request = new XMLHttpRequest();
- request.open('GET', '/reverb.ogg', true);
- request.responseType = 'arraybuffer';
- request.addEventListener('load', requestHandler, false);
- request.send();
-
- if (!this.source) {
- this._getUserMedia({
- audio : true
- }, this._onUserMedia.bind(this), this._onUserMediaError.bind(this))
- }
-
- this.element.html(this.constructor.INNER_HTML);
+const internals = {
- this.controlButton = this.element.find('.record-button');
- this.clearButton = this.element.find('.record-clear');
- this.audioElement = this.element.find('audio');
- this.progressBarContainer = this.element.find('.record-progress-bar-container');
- this.progressBar = this.element.find('.record-progress-bar');
- this.switches = this.element.find('.filter-switch');
-
- this._bindEvents();
+ config: {
+ convolverNode: {
+ requestMethod: 'GET',
+ requestLocation: '/reverb.ogg',
+ responseType: 'arraybuffer'
},
+ distortionNode: {
+ amount: 400
+ }
+ },
+
+ kTemplate: `<a class="record-button">Record.</a>
+<div class="record-info">
+ <div class="record-progress">
+ <div class="record-progress-bar-container">
+ <div class="record-progress-bar"></div>
+ </div>
+ <a class="record-clear">Clear recording.</a>
+ </div>
+ <audio class="record-preview" controls></audio>
+ <div class="filter-switches">
+ <input class="filter-switch" name="bandpass-filter" type="checkbox" /> <label for="bandpass-filter">Band Pass</label>
+ <input class="filter-switch" name="hipass-filter" type="checkbox" /> <label for="hipass-filter">Hi Pass</label>
+ <input class="filter-switch" name="lopass-filter" type="checkbox" /> <label for="lopass-filter">Lo Pass</label>
+ <input class="filter-switch" name="reverb-filter" type="checkbox" /> <label for="reverb-filter">Reverb</label>
+ <input class="filter-switch" name="distort-filter" type="checkbox" /> <label for="distort-filter">Distort</label>
+ </div>
+</div>`,
+ kPauseLabel : 'Pause.',
+ kRecordLabel : 'Record.',
+};
+
+const Pepperoni = class Pepperoni {
+ constructor() {
+
+ const context = new AudioContext();
+
+ const nodes = this._createNodes(context);
+
+ this._activatedNodes = [];
+ },
+
+ _createNodes(context) {
+
+ const delayNode = context.createDelay(1.0);
+
+ const convolverNode = context.createConvolver();
+ this._initializeConvolverNode(convolverNode);
+
+ const loPassFilterNode = context.createBiquadFilter();
+ loPassFilterNode.type = 'lowpass';
+ loPassFilterNode.frequency.value = 1000;
+ loPassFilterNode.gain.value = 25;
+
+ const hiPassFilterNode = context.createBiquadFilter();
+ hiPassFilterNode.type = 'highpass';
+ hiPassFilterNode.frequency.value = 3000;
+ hiPassFilterNode.gain.value = 25;
+
+ const bandPassFilterNode = context.createBiquadFilter();
+ bandPassFilterNode.type = 'bandpass';
+ bandPassFilterNode.frequency.value = 2000;
+ bandPassFilterNode.gain.value = 25;
+
+ const distortionNode = context.createWaveShaper();
+ distortionNode.curve = this._generateDistortion(400);
+ distortionNode.oversample = '4x';
+ }
- record : function record() {
- if (this.recorder && !this.recording) {
- this._canRecord(function handleCanRecord(canRecord) {
- if (canRecord) {
- this.recording = true;
- this.controlButton.addClass('recording')
- this.controlButton.html(this.constructor.PAUSE);
- this._interval = setInterval(this._onRecordCheck.bind(this), 100);
- this.recorder.record();
- }
- }.bind(this));
- }
- },
+ // Generates a wave to be used with the distortion wave shaper node
- stop : function stop() {
- if (this.recorder && this.recording) {
- this.recording = false;
- this.controlButton.removeClass('recording')
- this.controlButton.html(this.constructor.RECORD);
- clearInterval(this._interval);
- this.recorder.stop();
- this.recorder.exportWAV();
- }
- },
+ _generateDistortion(amount = 50) {
- clear : function clear() {
- if (this.recorder) {
- this.progressBar.width(0);
- this.audioElement.attr('src', '');
- this.audioElement[0].load();
- this.recorder.clear()
- }
- },
+ const sampleRate = 44100;
+ const curve = new Float32Array(sampleRate);
+ const angle = Math.PI / 180;
- finalize : function finalize(callback) {
- if (this.recorder) {
- this.recorder.exportWAV(callback);
- }
- },
+ for (let i = 0; i < sampleRate; ++i) {
+ const x = i * 2 / sampleRate - 1;
+ curve[i] = ( 3 + amount ) * x * 20 * angle / ( Math.PI + amount * Math.abs(x) );
+ }
- getBuffer : function getBuffer(callback) {
- if (this.recorder) {
- this.recorder.getBuffer(callback);
- }
- },
+ return curve;
+ },
- _bindEvents : function bindEvents() {
- var pepperoni = this;
+ // Initializes a convolver node by requesting the reverb sound,
+ // decoding it, and attaching it
- this.controlButton.on('click', function () {
- if (this.recording) {
- this.stop();
- } else {
- this.record();
- }
- }.bind(this))
+ _initializeConvolverNode(node) {
- this.clearButton.on('click', function () {
- if (!this.recording) {
- this.clear();
- }
- }.bind(this))
+ const request = new XMLHttpRequest();
+ request.open(config.convolverNode.requestMethod, config.convolverNode.requestLocation);
+ request.responseType = config.convolverNode.responseType;
+ request.addEventListener('load', (event) => {
- this.switches.on('change', function (ev) {
- if (!pepperoni.source) {
- this.checked = false;
- return false;
- }
- switch (this.name) {
- case 'delay-filter':
- if (this.checked) {
- pepperoni._addNode(pepperoni._delayNode);
- } else {
- pepperoni._removeNode(pepperoni._delayNode);
- }
- break;
-
- case 'hipass-filter':
- if (this.checked) {
- pepperoni._addNode(pepperoni._hiPassFilterNode);
- } else {
- pepperoni._removeNode(pepperoni._hiPassFilterNode);
- }
- break;
-
- case 'bandpass-filter':
- if (this.checked) {
- pepperoni._addNode(pepperoni._bandPassFilterNode);
- } else {
- pepperoni._removeNode(pepperoni._bandPassFilterNode);
- }
- break;
-
- case 'lopass-filter':
- if (this.checked) {
- pepperoni._addNode(pepperoni._loPassFilterNode);
- } else {
- pepperoni._removeNode(pepperoni._loPassFilterNode);
- }
- break;
-
- case 'reverb-filter':
- if (this.checked) {
- pepperoni._addNode(pepperoni._convolverNode);
- } else {
- pepperoni._removeNode(pepperoni._convolverNode);
- }
- break;
-
- case 'distort-filter':
- if (this.checked) {
- pepperoni._addNode(pepperoni._distortionNode);
- } else {
- pepperoni._removeNode(pepperoni._distortionNode);
- }
-
- break;
- }
+ node.context.decodeAudioData(event.target.response, (buffer) => {
+
+ node.buffer = buffer;
});
- },
+ });
+ request.send();
+ }
- _onRecording : function _onRecording(buffer) {
- this._buffer = buffer;
+ // Handles the XHR response to the reverb file
- this.audioElement.attr('src', URL.createObjectURL(buffer));
- this.audioElement[0].load();
- },
- _onUserMedia : function _onUserMedia(localMediaStream) {
- this.source = this.context.createMediaStreamSource(localMediaStream);
- this.recorder = new Recorder(this.source, {
- workerPath : this.workerPath,
- callback : this._onRecording.bind(this)
- });
- },
- _onUserMediaError : function _onUserMediaError(error) {
- console.log("Something went wrong", error);
- this.disable();
- },
+ if (!this.source) {
+ this._getUserMedia({
+ audio : true
+ }, this._onUserMedia.bind(this), this._onUserMediaError.bind(this))
+ }
- _onRecordCheck : function _onRecordCheck() {
- this._canRecord(function (canRecord, bufferSize) {
- var width = bufferSize * this.progressBarContainer.width() / this.maxSize;
- this.progressBar.width(width);
- if (!canRecord) {
- this.stop();
- }
- }.bind(this));
- },
+ this.element.html(this.constructor.INNER_HTML);
- _canRecord : function _canRecord(callback) {
- this.recorder.getBuffer(function getBuffer(buffer) {
- var bufferSize = buffer[0].length + buffer[1].length;
- callback && callback(bufferSize <= this.maxSize, bufferSize);
- }.bind(this));
- },
+ this.controlButton = this.element.find('.record-button');
+ this.clearButton = this.element.find('.record-clear');
+ this.audioElement = this.element.find('audio');
+ this.progressBarContainer = this.element.find('.record-progress-bar-container');
+ this.progressBar = this.element.find('.record-progress-bar');
+ this.switches = this.element.find('.filter-switch');
- _addNode : function _addNode(node) {
- var i;
+ this._bindEvents();
+};
- i = this._activatedNodes.length;
+const Pepperoni.prototype = {
- this._activatedNodes.push(node);
+ _createNodes() {
+
+ }
- if (i === 0) {
- this.source.disconnect();
- this.source.connect(node);
+ maxSize : 1048576,
+ recording : false,
+ source : null,
+ recorder : null,
+ context : null,
+ _delayNode : null,
+ _bandPassFilterNode : null,
+ _hiPassFilterNode : null,
+ _loPassFilterNode : null,
+ _convolverNode : null,
+ _distortionNode : null,
+ _activatedNodes : null,
+ workerPath : '/js/vendor/recorderjs/recorderWorker.js',
+ init : function init(config) {
+ },
+
+ record : function record() {
+ if (this.recorder && !this.recording) {
+ this._canRecord(function handleCanRecord(canRecord) {
+ if (canRecord) {
+ this.recording = true;
+ this.controlButton.addClass('recording')
+ this.controlButton.html(this.constructor.PAUSE);
+ this._interval = setInterval(this._onRecordCheck.bind(this), 100);
+ this.recorder.record();
+ }
+ }.bind(this));
+ }
+ },
+
+ stop : function stop() {
+ if (this.recorder && this.recording) {
+ this.recording = false;
+ this.controlButton.removeClass('recording')
+ this.controlButton.html(this.constructor.RECORD);
+ clearInterval(this._interval);
+ this.recorder.stop();
+ this.recorder.exportWAV();
+ }
+ },
+
+ clear : function clear() {
+ if (this.recorder) {
+ this.progressBar.width(0);
+ this.audioElement.attr('src', '');
+ this.audioElement[0].load();
+ this.recorder.clear()
+ }
+ },
+
+ finalize : function finalize(callback) {
+ if (this.recorder) {
+ this.recorder.exportWAV(callback);
+ }
+ },
+
+ getBuffer : function getBuffer(callback) {
+ if (this.recorder) {
+ this.recorder.getBuffer(callback);
+ }
+ },
+
+ _bindEvents : function bindEvents() {
+ var pepperoni = this;
+
+ this.controlButton.on('click', function () {
+ if (this.recording) {
+ this.stop();
} else {
- this._activatedNodes[i - 1].disconnect();
- this._activatedNodes[i - 1].connect(node);
+ this.record();
}
+ }.bind(this))
- node.connect(this.recorder.node);
- this.recorder.context = node.context;
- this.recorder.node.connect(this.recorder.context.destination)
-
- console.log("Adding: ", node);
- },
+ this.clearButton.on('click', function () {
+ if (!this.recording) {
+ this.clear();
+ }
+ }.bind(this))
- _removeNode : function _removeNode(node) {
- var i;
-
- i = this._activatedNodes.indexOf(node);
-
- node.disconnect();
-
- if (i === 0 && i + 1 === this._activatedNodes.length) {
- // It was the only one, connect source to recorder.
- this.source.disconnect();
- this.source.connect(this.recorder.node);
- } else if (i === 0) {
- // Normal 0 case, connect source to node. Recorder stays the same
- this.source.disconnect();
- this.source.connect(this._activatedNodes[i+1]);
- } else if (i + 1 === this._activatedNodes.length) {
- // It's not the 0 case, but we need to reconnect to recorder.
- this._activatedNodes[i - 1].disconnect();
- this._activatedNodes[i - 1].connect(this.recorder.node);
- } else {
- // Normal case, connect previous node to node
- this._activatedNodes[i - 1].disconnect();
- this._activatedNodes[i - 1].connect(this._activatedNodes[i + 1]);
+ this.switches.on('change', function (ev) {
+ if (!pepperoni.source) {
+ this.checked = false;
+ return false;
}
+ switch (this.name) {
+ case 'delay-filter':
+ if (this.checked) {
+ pepperoni._addNode(pepperoni._delayNode);
+ } else {
+ pepperoni._removeNode(pepperoni._delayNode);
+ }
+ break;
- this._activatedNodes.splice(i, 1);
+ case 'hipass-filter':
+ if (this.checked) {
+ pepperoni._addNode(pepperoni._hiPassFilterNode);
+ } else {
+ pepperoni._removeNode(pepperoni._hiPassFilterNode);
+ }
+ break;
- console.log("Removing: ", node);
- },
+ case 'bandpass-filter':
+ if (this.checked) {
+ pepperoni._addNode(pepperoni._bandPassFilterNode);
+ } else {
+ pepperoni._removeNode(pepperoni._bandPassFilterNode);
+ }
+ break;
- _generateDistortion : function generateDistortion(amount) {
- var k = typeof amount === 'number' ? amount : 50,
- n_samples = 44100,
- curve = new Float32Array(n_samples),
- deg = Math.PI / 180,
- i = 0,
- x;
- for ( ; i < n_samples; ++i ) {
- x = i * 2 / n_samples - 1;
- curve[i] = ( 3 + k ) * x * 20 * deg / ( Math.PI + k * Math.abs(x) );
- }
- return curve;
- },
+ case 'lopass-filter':
+ if (this.checked) {
+ pepperoni._addNode(pepperoni._loPassFilterNode);
+ } else {
+ pepperoni._removeNode(pepperoni._loPassFilterNode);
+ }
+ break;
- // Normalize get user media
- _getUserMedia : (navigator.getUserMedia ||
- navigator.webkitGetUserMedia ||
- navigator.mozGetUserMedia ||
- navigator.msGetUserMedia).bind(navigator)
- }
+ case 'reverb-filter':
+ if (this.checked) {
+ pepperoni._addNode(pepperoni._convolverNode);
+ } else {
+ pepperoni._removeNode(pepperoni._convolverNode);
+ }
+ break;
+
+ case 'distort-filter':
+ if (this.checked) {
+ pepperoni._addNode(pepperoni._distortionNode);
+ } else {
+ pepperoni._removeNode(pepperoni._distortionNode);
+ }
+
+ break;
+ }
+ });
+ },
+
+ _onRecording : function _onRecording(buffer) {
+ this._buffer = buffer;
+
+ this.audioElement.attr('src', URL.createObjectURL(buffer));
+ this.audioElement[0].load();
+ },
+
+ _onUserMedia : function _onUserMedia(localMediaStream) {
+ this.source = this.context.createMediaStreamSource(localMediaStream);
+ this.recorder = new Recorder(this.source, {
+ workerPath : this.workerPath,
+ callback : this._onRecording.bind(this)
+ });
+ },
+
+ _onUserMediaError : function _onUserMediaError(error) {
+ console.log("Something went wrong", error);
+ this.disable();
+ },
+
+ _onRecordCheck : function _onRecordCheck() {
+ this._canRecord(function (canRecord, bufferSize) {
+ var width = bufferSize * this.progressBarContainer.width() / this.maxSize;
+ this.progressBar.width(width);
+ if (!canRecord) {
+ this.stop();
+ }
+ }.bind(this));
+ },
+
+ _canRecord : function _canRecord(callback) {
+ this.recorder.getBuffer(function getBuffer(buffer) {
+ var bufferSize = buffer[0].length + buffer[1].length;
+ callback && callback(bufferSize <= this.maxSize, bufferSize);
+ }.bind(this));
+ },
+
+ _addNode : function _addNode(node) {
+ var i;
+
+ i = this._activatedNodes.length;
+
+ this._activatedNodes.push(node);
+
+ if (i === 0) {
+ this.source.disconnect();
+ this.source.connect(node);
+ } else {
+ this._activatedNodes[i - 1].disconnect();
+ this._activatedNodes[i - 1].connect(node);
+ }
+
+ node.connect(this.recorder.node);
+ this.recorder.context = node.context;
+ this.recorder.node.connect(this.recorder.context.destination)
+
+ console.log("Adding: ", node);
+ },
+
+ _removeNode : function _removeNode(node) {
+ var i;
+
+ i = this._activatedNodes.indexOf(node);
+
+ node.disconnect();
+
+ if (i === 0 && i + 1 === this._activatedNodes.length) {
+ // It was the only one, connect source to recorder.
+ this.source.disconnect();
+ this.source.connect(this.recorder.node);
+ } else if (i === 0) {
+ // Normal 0 case, connect source to node. Recorder stays the same
+ this.source.disconnect();
+ this.source.connect(this._activatedNodes[i+1]);
+ } else if (i + 1 === this._activatedNodes.length) {
+ // It's not the 0 case, but we need to reconnect to recorder.
+ this._activatedNodes[i - 1].disconnect();
+ this._activatedNodes[i - 1].connect(this.recorder.node);
+ } else {
+ // Normal case, connect previous node to node
+ this._activatedNodes[i - 1].disconnect();
+ this._activatedNodes[i - 1].connect(this._activatedNodes[i + 1]);
+ }
+
+ this._activatedNodes.splice(i, 1);
+
+ console.log("Removing: ", node);
+ },
+
+ // Normalize get user media
+ _getUserMedia : (navigator.getUserMedia ||
+ navigator.webkitGetUserMedia ||
+ navigator.mozGetUserMedia ||
+ navigator.msGetUserMedia).bind(navigator)
+}
});
+++ /dev/null
-
-if (typeof global === "undefined") {
- global = window;
-}
-
-global.Interface = function Interface(nameOrNameSpace, name) {
- var nameSpace, interfaceName, factory;
- nameSpace = (nameOrNameSpace && name) ? nameOrNameSpace : this;
- interfaceName = (nameOrNameSpace && name) ? name :
- (nameOrNameSpace) ? nameOrNameSpace : 'interface' + Math.random().toString();
- factory = function(definition) {
- definition.isInterface = true;
- definition.name = interfaceName;
- nameSpace[interfaceName] = definition;
- return nameSpace[interfaceName];
- };
- return factory;
-};
-
-global.Module = function Module(nameOrNameSpace, name) {
- var nameSpace, moduleName, factory, newModule;
-
- nameSpace = (nameOrNameSpace && name) ? nameOrNameSpace : this;
- moduleName = (nameOrNameSpace && name) ? name :
- (nameOrNameSpace) ? nameOrNameSpace : 'module' + Math.random().toString();
-
- newModule = {
- moduleName : moduleName,
- prototype : {},
- __includedModules : [],
- include : function(module) {
- var property;
- for (property in module) {
- if (module.hasOwnProperty(property)
- && property !== 'prototype'
- && property !== 'isModule'
- && property !== '__includedModules'
- && property !== 'include'
- && property !== 'moduleName') {
- newModule[property] = module[property];
- }
- }
-
- if (module.hasOwnProperty('prototype') && module.prototype) {
- for (property in module.prototype) {
- if (module.prototype.hasOwnProperty(property)) {
- newModule.prototype[property] = module.prototype[property];
- }
- }
- }
- else {
- module.prototype = {};
- }
-
- this.__includedModules.push(module);
-
- return this;
- }
- }
-
- factory = function(definition){
- var property;
-
- newModule.isModule = true;
-
- for (property in definition) {
- if (definition.hasOwnProperty(property)
- && property !== 'prototype'
- && property !== 'isModule'
- && property !== '__includedModules'
- && property !== 'include'
- && property !== 'moduleName') {
- newModule[property] = definition[property];
- }
- }
-
- if (definition.hasOwnProperty('prototype') && definition.prototype) {
- for (property in definition.prototype) {
- if (definition.prototype.hasOwnProperty(property)) {
- newModule.prototype[property] = definition.prototype[property];
- }
- }
- }
-
- nameSpace[moduleName] = newModule;
-
- return nameSpace[moduleName];
- };
-
- factory.includes = function () {
- for(var i = 0; i < arguments.length; i++){
- newModule.include(arguments[i]);
- }
- return factory;
- };
-
- return factory;
-};
-
-global.Class = function Class(classNameOrNameSpace, className) {
- var nameSpace, newClass, classFactory;
- nameSpace = (classNameOrNameSpace && className) ? classNameOrNameSpace : global;
- className = (classNameOrNameSpace && className) ? className :
- (classNameOrNameSpace) ? classNameOrNameSpace : 'class' + Math.random().toString();
-
- newClass = function() {
- if (this.init) {
- this.init.apply(this, arguments);
- }
- };
-
- newClass.__descendants = [];
- newClass.__implementedInterfaces = [];
- newClass.__includedModules = [];
- newClass.className = className;
- newClass.include = function(module) {
- var property;
- for (property in module) {
- if (module.hasOwnProperty(property)
- && property != 'prototype'
- && property != 'constructor'
- && property != 'isModule'
- && property != 'superClass'
- && property != 'include') {
- newClass[property] = module[property];
- }
- }
-
- if (module.hasOwnProperty('prototype') && module.prototype) {
- for (property in module.prototype) {
- if (module.prototype.hasOwnProperty(property)) {
- newClass.prototype[property] = module.prototype[property];
- }
- }
- } else {
- module.prototype = {};
- }
-
- newClass.__includedModules.push(module);
- return this;
- };
-
- classFactory = function(classDefinition) {
- var i, il, j, jl, property, classPrototype = classDefinition.prototype;
- if (classPrototype) {
- for (property in classPrototype) {
- if (classPrototype.hasOwnProperty(property)) {
- newClass.prototype[property] = classPrototype[property];
- }
- }
- delete classDefinition.prototype;
- }
- for (property in classDefinition) {
- if (classDefinition.hasOwnProperty(property)) {
- newClass[property] = classDefinition[property];
- }
- }
-
- for (i = 0, il = newClass.__implementedInterfaces.length; i < il; i++) {
- for (j = 0, jl = newClass.__implementedInterfaces[i].constructor.length; j < jl; j++) {
- if (!newClass[ newClass.__implementedInterfaces[i].constructor[j] ]) {
- console.log('must implement static ' + newClass.__implementedInterfaces[i].name);
- break;
- }
- }
-
- if (newClass.__implementedInterfaces[i].hasOwnProperty('prototype')
- && newClass.__implementedInterfaces[i].prototype) {
- for (j = 0, jl = newClass.__implementedInterfaces[i].prototype.length; j < jl; j++) {
- if (!newClass.prototype[newClass.__implementedInterfaces[i].prototype[j]]) {
- console.log('must implement prototype ' + newClass.__implementedInterfaces[i].name);
- break;
- }
- }
- }
- }
-
- try {
- if (Li && Li.ObjectSpy && Li.Spy) {
- newClass.__objectSpy = new Li.ObjectSpy();
- newClass.__objectSpy.spy(newClass);
- newClass.__objectSpy.spy(newClass.prototype);
- }
- } catch (error) {}
-
- nameSpace[className] = newClass;
- return newClass;
- };
-
- classFactory.inherits = function(superClass) {
- var i, inheritedClass;
- newClass.superClass = superClass;
- if (superClass.hasOwnProperty('__descendants')) {
- superClass.__descendants.push(newClass);
- }
- inheritedClass = function() {
- };
- inheritedClass.prototype = superClass.prototype;
- newClass.prototype = new inheritedClass();
- newClass.prototype.constructor = newClass;
-
- for (i in superClass) {
- if (superClass.hasOwnProperty(i)
- && i != 'prototype'
- && i !== 'className'
- && i !== 'superClass'
- && i !== 'include'
- && i != '__descendants') {
- newClass[i] = superClass[i];
- }
- }
-
- delete this.inherits;
- return this;
- };
-
- classFactory.ensures = function(interfaces) {
- for (var i = 0; i < arguments.length; i++) {
- newClass.__implementedInterfaces.push(arguments[i]);
- }
- delete this.ensures;
- return classFactory;
- };
-
- classFactory.includes = function() {
- for (var i = 0; i < arguments.length; i++) {
- newClass.include(arguments[i]);
- }
- return classFactory;
- };
-
- return classFactory;
-
-};
+++ /dev/null
-Module('BubblingSupport')({
- dispatch : function (type, data) {
- data = data || {};
- var event = CustomEventSupport.prototype.dispatch.call(this, type, data);
- if (event.isPropagationStopped === false) {
- if (this.parent && this.parent.dispatch) {
- data.target = event.target;
- data.currentTarget = this.parent;
- this.parent.dispatch(event.type, data);
- }
- }
- return event;
- },
-
- prototype : {
- dispatch : function (type, data) {
- data = data || {};
-
- var event = CustomEventSupport.prototype.dispatch.call(this, type, data);
-
- if (event.isPropagationStopped === false && event.bubbles === true) {
- if (this.parent && this.parent.dispatch) {
- data.target = event.target;
- data.currentTarget = this.parent;
- this.parent.dispatch(event.type, data);
- }
- }
-
- return event;
- }
- }
- });
+++ /dev/null
-Class('CustomEvent')({
- prototype : {
- bubbles : true,
- cancelable : true,
- currentTarget : null,
- timeStamp : 0,
- target : null,
- type : '',
- isPropagationStopped : false,
- isDefaultPrevented : false,
- isImmediatePropagationStopped : false,
- areImmediateHandlersPrevented : false,
- init : function init(type, data) {
- this.type = type;
- if (typeof data !== 'undefined') {
- for(var property in data) {
- if (data.hasOwnProperty(property)) {
- this[property] = data[property];
- }
- }
- }
- },
- stopPropagation : function stopPropagation() {
- this.isPropagationStopped = true;
- },
- preventDefault : function preventDefault() {
- this.isDefaultPrevented = true;
- },
- stopImmediatePropagation : function stopImmediatePropagation() {
- this.preventImmediateHandlers();
- this.stopPropagation();
- },
- preventImmediateHandlers : function preventImmediateHandlers() {
- this.areImmediateHandlersPrevented = true;
- }
- }
-});
+++ /dev/null
-Module('CustomEventSupport')({
-
- eventListeners : null,
-
- bind : function(type, eventHandler) {
- var found, i, listeners;
-
- if(!this.eventListeners) {
- this.eventListeners = {};
- }
-
- if(!this.eventListeners[type]) {
- this.eventListeners[type] = [];
- }
-
- found = false;
-
- listeners = this.eventListeners[type];
- for (i = 0; i < listeners.length; i++) {
- if (listeners[i] === eventHandler) {
- found = true;
- break;
- }
- }
-
- if(!found) {
- this.eventListeners[type].push(eventHandler);
- }
-
- return this;
- },
-
- unbind : function(type, eventHandler) {
- var i, found, listeners;
-
- found = false;
-
- if(!this.eventListeners) {
- this.eventListeners = {};
- }
-
- if(typeof eventHandler == 'undefined') {
- this.eventListeners[type] = [];
- }
-
- listeners = this.eventListeners[type];
- for (i = 0; i < listeners.length; i++) {
- if(listeners[i] === eventHandler) {
- found = true;
- break;
- }
- }
-
- if(found) {
- this.eventListeners[type].splice(i, 1);
- }
-
- return this;
- },
-
- dispatch : function(type, data) {
- var event, listeners, instance, i;
-
- if (this.eventListeners === null) {
- this.eventListeners = {};
- }
-
- if (typeof data === 'undefined') {
- data = {};
- }
-
- if (data.hasOwnProperty('target') === false) {
- data.target = this;
- }
-
- event = new CustomEvent(type, data);
- listeners = this.eventListeners[type] || [];
- instance = this;
-
- for (i = 0; i < listeners.length; i = i + 1) {
- listeners[i].call(instance, event);
- if (event.areImmediateHandlersPrevented === true) {
- break;
- }
- }
-
- return event;
- },
-
- prototype : {
-
- eventListeners : null,
-
- bind : function(type, eventHandler) {
- var found, i, listeners;
-
- if(!this.eventListeners) {
- this.eventListeners = {};
- }
-
- if(!this.eventListeners[type]) {
- this.eventListeners[type] = [];
- }
-
- found = false;
-
- listeners = this.eventListeners[type];
- for (i = 0; i < listeners.length; i++) {
- if(listeners[i] === eventHandler) {
- found = true;
- break;
- }
- }
-
- if(!found) {
- this.eventListeners[type].push(eventHandler);
- }
-
- return this;
- },
-
- unbind : function(type, eventHandler) {
- var i, found, listeners;
-
- found = false;
- i = 0;
-
- if(!this.eventListeners) {
- this.eventListeners = {};
- }
-
- if(typeof eventHandler == 'undefined') {
- this.eventListeners[type] = [];
- }
-
- listeners = this.eventListeners[type];
- for (i = 0; i < listeners.length; i++) {
- if(listeners[i] == eventHandler) {
- found = true;
- break;
- }
- }
-
- if(found) {
- this.eventListeners[type].splice(i, 1);
- }
-
- return this;
- },
-
- dispatch : function(type, data) {
- var event, listeners, instance, i;
-
- if (this.eventListeners === null) {
- this.eventListeners = {};
- }
-
- if (typeof data === 'undefined') {
- data = {};
- }
-
- if (data.hasOwnProperty('target') === false) {
- data.target = this;
- }
-
- event = new CustomEvent(type, data);
- listeners = this.eventListeners[type] || [];
- instance = this;
-
- for (i = 0; i < listeners.length; i = i + 1) {
- listeners[i].call(instance, event);
- if (event.areImmediateHandlersPrevented === true) {
- break;
- }
- }
-
- return event;
- }
- }
-});
+++ /dev/null
-// This file is node only
-if(typeof require !== 'undefined'){
- require('./custom_event');
- require('./custom_event_support');
- require('./node_support');
- require('./bubbling_support');
-}
+++ /dev/null
-Module('NodeSupport')({
- prototype : {
- parent : null,
-
- children : [],
-
- appendChild : function(child) {
- if(child.parent) {
- child.parent.removeChild(child);
- }
-
- if(!this.hasOwnProperty('children')) {
- this.children = [];
- }
-
- this.children.push(child);
- this[child.name] = child;
- child.setParent(this);
- return child;
- },
-
- insertBefore : function (child, beforeChild) {
- var position;
-
- if (child.parent) {
- child.parent.removeChild(child);
- }
-
- if (!this.hasOwnProperty('children')) {
- this.children = [];
- }
-
- if (typeof beforeChild === 'undefined') {
- this.appendChild(child);
- } else {
- position = this.children.indexOf(beforeChild);
- this.children.splice(position, 0, child);
-
- this[child.name] = child;
- child.setParent(this);
- }
-
- return child;
-
- },
-
- insertChild : function(child, position) {
- console.warn('NodeSupport insertChild method is deprecated, try insertBefore');
-
- if (child.parent) {
- child.parent.removeChild(child);
- }
-
- if (!this.hasOwnProperty('children')) {
- this.children = [];
- }
-
- if (typeof position == 'undefined') {
- this.children.push(child);
- this[child.name] = child;
- child.setParent(this);
- return child;
- }
-
- this.children.splice(position, 0, child);
- this[child.name] = child;
- child.setParent(this);
- return child;
- },
-
- removeChild : function (child) {
- var position = this.children.indexOf(child);
-
- if (position !== -1) {
- this.children.splice(position, 1);
- delete this[child.name];
- child.parent = null;
- }
-
- return child;
- },
-
- setParent : function (parent) {
- this.parent = parent;
- return this;
- },
-
- getDescendants : function () {
- var nodes = [];
- this.children.forEach(function (node) {
- nodes.push(node);
- });
- this.children.forEach(function (node) {
- nodes = nodes.concat(node.getDescendants());
- });
- return nodes;
- },
-
- getPreviousSibling : function () {
- if (typeof this.parent === 'undefined') {
- return;
- }
-
- if (this.parent.children[0] === this) {
- return;
- }
-
- return this.parent.children[ this.parent.children.indexOf(this) - 1 ];
- },
-
- getNextSibling : function () {
- if (typeof this.parent === 'undefined') {
- return;
- }
-
- if (this.parent.children[ this.parent.children.length - 1 ] === this) {
- return;
- }
-
- return this.parent.children[ this.parent.children.indexOf(this) + 1 ];
- }
- }
-});
+++ /dev/null
-/**
-Base Class from which almost all widgets are based overall the project
-
-The main idea behind constructing a new widget toolkit instead of using one of the many high quality widget
-toolkits avaliable is that we considered that currently, no widget system provides all the features that where
-required for this project.
-
-Features of the widget system
-* A custom and easy to handle event binding, dispatching and manipulation, with some sort of bubbling support
-* A module system which we can use to include specific behaviour to any widget and reuse the code where needed
-* A tree structure support for the widgets that the event system could bubble, and that also serves as
-* A navigation system.
-* The widgets must be able to be grouped to form more complex widgets
-* Remove the complexity of DOM manipulation and handling
-* A way to wrap widgets at our convenience to reuse widgets avaliable and make them comly to our needs
-without the need to hack those widgets, that would force us to maintain the new versions of those widgets
-and that is a very complex task when widgets become so complex.
-* A widget system that would allow us to start wrapping some widgets for a fast start and later code our own widgets
-at will.
-* expose a consistent API that allow us to choose the use of widgets by API calls and user interaction at will and with the same
-clearance and capacity
-* an easy way to allow subclasing widgets
-* an easy way to provide new html, class, and css for a specific instance of a widget that would remove us the need
-to create complex inheritance structures that are hard to maintain.
-
-Usage Example.
-
-The most basic usage of a widget is to simply create an instance and render it at a target element
-in this case body
-var myWidgetInstance = new Breezi.Widget();
-myWidgetInstance.render(document.body);
-
-like this widget does renders does not display anything so lets give it something to display first
-var myWidgetInstance = new Breezi.Widget();
-myWidgetInstance.element.html('Im a simple widget');
-myWidgetInstance.render(document.body);
-
-this reveals that internally every widget has an element property that is initialized by default to a jQuery Instance
-this allow easy DOM manipulation, animation and operations handled by a high quality third party library.
-@class Widget
-@namespace Breezi
-@inlcudes CustomEventSupport
-@includes NodeSupport
-@dependency Neon
-@dependency CustomEventSupport
-@dependency NodeSupport
-**/
-Class('Widget').includes(CustomEventSupport, NodeSupport)({
-
- /**
- The default html for the widget, at the most simple case this is just a div.
- @name HTML
- @attribute_type CONSTANT
- @type String
- */
- HTML : '<div></div>',
-
- /**
- the widget container default class for all widgets is widget
- @name ELEMENT_CLASS
- @constant
- @type String
- **/
- ELEMENT_CLASS : 'widget',
-
- /**
- @property prototype
- @type Object
- **/
- prototype : {
- /**
- Holds the active status of the widget
- By default all widgets are deactivated waiting
- for an action to activate it.
- @property active <public> [Boolean] (false)
- **/
- active : false,
-
- /**
- Holds the disabled status of the widget
- By default all widgets are enabled and only by
- API could be disabled.
- @property disabled <public> [Boolean] (false)
- **/
- disabled : false,
-
- __destroyed : false,
-
- init : function init(config) {
- var property;
-
- Object.keys(config || {}).forEach(function (propertyName) {
- this[propertyName] = config[propertyName];
- }, this);
-
- if (this.element == null) {
- this.element = $(this.constructor.HTML.replace(/\s\s+/g, ''));
- this.element.addClass(this.constructor.ELEMENT_CLASS);
- }
-
- if (this.hasOwnProperty('className') === true) {
- this.element.addClass(this.className);
- }
- },
-
- /**
- implementation of the activate method, when you need an override, do it
- over this method instead of doing it on activate
- @property _activate <private> [Function]
- @return undefined [undefined]
- **/
- _activate : function _activate() {
- this.active = true;
- this.element.addClass('active');
- },
-
- /**
- Public activation method for widget, you can listen to this event
- to take some other actions, but the most important part of this
- method is that it runs its default action, (its activation)
- this method uses _activate as its implementation to maintain
- the events order intact.
- @property activate <public> [Function]
- @method
- @dispatch beforeActivate
- @dispatch activate
- @return this [Widget]
- **/
- activate : function activate() {
- if (this.__destroyed === true) {
- console.warn('calling on destroyed object');
- }
- this.dispatch('beforeActivate');
- this._activate();
- this.dispatch('activate');
- return this;
- },
-
- /**
- deactivation implementation
- this is the oposite of activation method and as such it must be
- treated as important as that.
- @property _deactivate <private> [Function]
- @method
- @return undefined [undefined]
- **/
- _deactivate : function _deactivate() {
- this.active = false;
- this.element.removeClass('active');
- },
-
- /**
- Public deactivation method for widget, you can listen to this event
- to take some other actions, but the most important part of this
- method is that it runs its default action, (its activation)
- this method uses _deactivate as its implementation to maintain
- the events order intact.
- @property activate <public> [Function]
- @method
- @dispatch beforeDeactivatee
- @dispatch deactivate
- @return this [Widget]
- **/
- deactivate : function deactivate() {
- if (this.__destroyed === true) {
- console.warn('calling on destroyed object');
- }
- this.dispatch('beforeDeactivate');
- this._deactivate();
- this.dispatch('deactivate');
- return this;
- },
-
- /**
- Enable implementation method
- if you need to provide a different procedure for enable
- you must override this method and call "super"
- @property _enable <private> [Function]
- @method
- @return undefined [undefined]
- **/
- _enable : function _enable() {
- this.disabled = false;
- this.element.removeClass('disable');
- },
-
- /**
- Public enable method, this method should not be
- overriden.
- @property enable <public> [Function]
- @method
- @return this [Widget]
- **/
- enable : function enable() {
- if (this.__destroyed === true) {
- console.warn('calling on destroyed object');
- }
- this.dispatch('beforeEnable');
- this._enable();
- this.dispatch('enable');
-
- return this;
- },
-
- /**
- Disable implementation
- @property _disable <private> [Function]
- @return undefined [undefined]
- **/
- _disable : function _disable() {
- this.disabled = true;
- this.element.addClass('disable');
- },
-
- /**
- Disables the widget, the idea behind disabling a widget
- comes from DOM form elements. so following this idea
- all widgets can be disabled and queried for its disabled
- state via the disabled property.
- Same as DOM form elements there is feedback and that is why
- the default implementation sets the "disable" class
- on the element so proper visual feedback can be provided
- to the user.
- @property disable <public> [Function]
- @method
- @return this [Widget]
- **/
- disable : function disable() {
- if (this.__destroyed === true) {
- console.warn('calling on destroyed object');
- }
- this.dispatch('beforeDisable');
- this._disable();
- this.dispatch('disable');
-
- return this;
- },
-
- /**
- Destroy implementation. Its main responsabilities are cleaning
- all references to other objects so garbage collector can collect
- the memory used by this and the other objects
- @property _destroy <private> [Function]
- @method
- @return undefined [undefined]
- **/
- _destroy : function _destroy() {
- var childrenLength;
-
- if (this.element) {
- this.element.remove();
- }
-
- if (this.children !== null){
- childrenLength = this.children.length;
- while(childrenLength > 0){
- this.children[0].destroy();
- if (this.children.length === childrenLength) {
- this.children.shift();
- }
- childrenLength--;
- }
- }
-
- if (this.parent) {
- this.parent.removeChild(this);
- }
-
- this.children = null;
- this.element = null;
- },
-
- /**
- Destroy public method, this one should not be replaced
- @property destroy <public> [Function]
- @method
- @return null [null]
- **/
- destroy : function destroy() {
- if (this.__destroyed === true) {
- console.warn('calling on destroyed object');
- }
-
- this.dispatch('beforeDestroy');
- this._destroy();
- this.dispatch('destroy');
-
- this.eventListeners = null;
- this.__destroyed = true;
-
- return null;
- },
-
- /**
- The render method is the mechanism by which you pass a widget from
- living only on memory to get into the DOM and with this into the
- application flow. The recomendation is that render is the last method
- of the setup of a widget, including appending its children. this is
- because once a widget gets renderer, further operations cause browser
- reflows, and DOM operations are slower than memory operations.
- This method shoudl not be replaced by its children.
- @property render <public> [Function]
- @method
- @argument element <required> [JQuery] (undefined) This is the element
- into which the widget will be appended.
- @argument beforeElement <optional> [jQuery] (undefined) this is the element
- that will be used as a reference to insert the widgets element. this argument
- must be a child of the "element" argument.
- @return this [Widget]
- **/
- render : function render(element, beforeElement) {
- if (this.__destroyed === true) {
- console.warn('calling on destroyed object');
- }
- this.dispatch('beforeRender', {
- element : element,
- beforeElement : beforeElement
- });
- if (beforeElement) {
- this.element.insertBefore(beforeElement);
- } else {
- this.element.appendTo(element);
- }
- this.dispatch('render');
- return this;
- }
- }
-});