a.a.C.ia(b,function(){b.detachEvent(p,n)})}elsethrowError("Browser doesn't support addEventListener or attachEvent");elseb.addEventListener(d,k,!1);else{if(c(b,d)){varr=k;k=function(a,b){vare=this.checked;b&&(this.checked=!0!==b.sb);r.call(this,a);this.checked=e}}t(b).bind(d,k)}},Ga:function(a,b){if(!a||!a.nodeType)throwError("element must be a DOM node when calling triggerEvent");if("undefined"!=typeoft){vare=[];c(a,b)&&e.push({sb:a.checked});t(a).trigger(b,e)}elseif("function"==typeofs.createEvent)if("function"==
typeofa.dispatchEvent)e=s.createEvent(f[b]||"HTMLEvents"),e.initEvent(b,!0,!0,w,0,0,0,0,0,!1,!1,!1,!1,0,a),a.dispatchEvent(e);elsethrowError("The supplied element doesn't support dispatchEvent");elseif("undefined"!=typeofa.fireEvent)c(a,b)&&(a.checked=!0!==a.checked),a.fireEvent("on"+b);elsethrowError("Browser doesn't support triggering events");},c:function(b){returna.T(b)?b():b},ya:function(b){returna.T(b)?b.t():b},ga:function(b,e,c){if(e){vard=/\S+/g,g=b.className.match(d)||[];a.a.p(e.match(d),
y&&y.parse?y.parse(b):(newFunction("return "+b))():null},Ca:function(b,e,c){if(!y||!y.stringify)throwError("Cannot find JSON.stringify(). Some browsers (e.g., IE < 8) don't support it natively, but you can overcome this by adding a script reference to json2.js, downloadable from http://www.json.org/json2.js");returny.stringify(a.a.c(b),e,c)},Ob:function(e,c,d){d=d||{};varg=d.params||{},f=d.includeFields||this.Ta,p=e;if("object"==typeofe&&"form"===a.a.u(e))for(varp=e.action,r=f.length-1;0<=r;r--)for(varz=
b(e,!1);if(d)for(vard=d.slice(0),f=0;f<d.length;f++)d[f](e);a.a.f.clear(e);"function"==typeoft&&"function"==typeoft.cleanData&&t.cleanData([e]);if(g[e.nodeType])for(d=e.firstChild;e=d;)d=e.nextSibling,8===e.nodeType&&c(e)}vard="__ko_domNodeDisposal__"+(newDate).getTime(),f={1:!0,8:!0,9:!0},g={1:!0,9:!0};return{ia:function(a,c){if("function"!=typeofc)throwError("Callback must be a function");b(a,!0).push(c)},cb:function(e,c){varg=b(e,!1);g&&(a.a.ka(g,c),0==g.length&&a.a.f.set(e,d,q))},H:function(b){if(f[b.nodeType]&&
0,e=c.childNodes,m=e.length;g<m;g++)b(e[g],f)}varc={};return{va:function(a){if("function"!=typeofa)throwError("You can only pass a function to ko.memoization.memoize()");varb=(4294967296*(1+Math.random())|0).toString(16).substring(1)+(4294967296*(1+Math.random())|0).toString(16).substring(1);c[b]=a;return"\x3c!--[ko_memo:"+b+"]--\x3e"},mb:function(a,b){varg=c[a];if(g===q)throwError("Couldn't find any memo with ID "+a+". Perhaps it's already been unmemoized.");try{returng.apply(null,b||[]),
a.Wa=function(a){returnnull!=a&&"function"==typeofa.Da&&"function"==typeofa.notifySubscribers};a.b("subscribable",a.V);a.b("isSubscribable",a.Wa);a.q=function(){varb=[];return{rb:function(a){b.push({la:a,Ra:[]})},end:function(){b.pop()},bb:function(c){if(!a.Wa(c))throwError("Only subscribable things can act as dependencies");if(0<b.length){vard=b[b.length-1];!d||0<=a.a.k(d.Ra,c)||(d.Ra.push(c),d.la(c))}},I:function(a,d,f){try{returnb.push(null),a.apply(d,f||[])}finally{b.pop()}}}}();varL=
a||typeofainL?a===c:!1}};varA=a.m.Pb="__ko_proto__";a.m.fn[A]=a.m;a.qa=function(b,c){returnnull===b||b===q||b[A]===q?!1:b[A]===c?!0:a.qa(b[A],c)};a.T=function(b){returna.qa(b,a.m)};a.Xa=function(b){return"function"==typeofb&&b[A]===a.m||"function"==typeofb&&b[A]===a.j&&b.Eb?!0:!1};a.b("observable",a.m);a.b("isObservable",a.T);a.b("isWriteableObservable",a.Xa);a.U=function(b){b=b||[];if("object"!=typeofb||!("length"inb))throwError("The argument passed when initializing an observable array must be an array, or null, or undefined.");
"beforeChange");k=e;m.notifySubscribers(k)}finally{a.q.end(),n=!1}v.length||x()}}functionm(){if(0<arguments.length){if("function"===typeofr)r.apply(c,arguments);elsethrowError("Cannot write a value to a ko.computed unless you specify a 'write' option. If you wish to read the current value, don't pass any parameters.");returnthis}l||e();a.q.bb(m);returnk}functionh(){return!l||0<v.length}vark,l=!1,n=!1,p=b;p&&"object"==typeofp?(d=p,p=d.read):(d=d||{},p||(p=d.read));if("function"!=typeofp)throwError("Pass a function that returns the value of the ko.computed");
e.get(d);m[c]=l!==q?l:b(d,g,e)}});returnm}functionc(a,b){if(ainstanceofArray){for(vare=0;e<a.length;e++)b(e);"function"==typeofa.toJSON&&b("toJSON")}elsefor(eina)b(e)}functiond(){this.keys=[];this.Ha=[]}a.lb=function(c){if(0==arguments.length)throwError("When calling ko.toJS, pass the object you want to convert.");returnb(c,function(b){for(vare=0;a.T(b)&&10>e;e++)b=b();returnb})};a.toJSON=function(b,c,e){b=a.lb(b);returna.a.Ca(b,c,e)};d.prototype={save:function(b,c){vare=a.a.k(this.keys,
(g?a.text:a.nodeValue).match(m)}functiond(a,e){for(vard=a,g=1,f=[];d=d.nextSibling;){if(c(d)&&(g--,0===g))returnf;f.push(d);b(d)&&g++}if(!e)throwError("Cannot find closing comment tag to match: "+a.nodeValue);returnnull}functionf(a,b){varc=d(a,b);returnc?0<c.length?c[c.length-1].nextSibling:a.nextSibling:null}varg=s&&"\x3c!--test--\x3e"===s.createComment("test").text,e=g?/^\x3c!--\s*ko(?:\s+(.+\s*\:[\s\S]*))?\s*--\x3e$/:/^\s*ko(?:\s+(.+\s*\:[\s\S]*))?\s*$/,m=g?/^\x3c!--\s*\/ko\s*--\x3e$/:
f=g[b]=e}returnf(c,d)}catch(h){throwh.message="Unable to parse bindings.\nBindings value: "+b+"\nMessage: "+h.message,h;}}});a.M.instance=newa.M})();a.b("bindingProvider",a.M);(function(){functionb(b,e,d){for(varf=a.e.firstChild(e);e=f;)f=a.e.nextSibling(e),c(b,e,d)}functionc(c,e,f){varh=!0,k=1===e.nodeType;k&&a.e.Za(e);if(k&&f||a.M.instance.nodeHasBindings(e))h=d(e,null,c,f).Sb;h&&b(c,e,!k)}functiond(b,c,d,h){functionk(a){returnfunction(){returnp[a]}}functionl(){returnp}varn=0,p,r,
z=a.a.f.get(b,f);if(!c){if(z)throwError("You cannot apply bindings multiple times to the same element.");a.a.f.set(b,f,!0)}a.j(function(){varf=d&&dinstanceofa.A?d:newa.A(a.a.c(d)),x=f.$data;!z&&h&&a.jb(b,f);if(p=("function"==typeofc?c(f,b):c)||a.M.instance.getBindings(b,f))0===n&&(n=1,a.a.w(p,function(c){vare=a.d[c];if(e&&8===b.nodeType&&!a.e.L[c])throwError("The binding '"+c+"' cannot be used with virtual elements");if(e&&"function"==typeofe.init&&(e=(0,e.init)(b,k(c),l,x,f))&&e.controlsDescendantBindings){if(r!==
q)throwError("Multiple bindings ("+r+" and "+c+") are trying to control descendant bindings of the same element. You cannot use these bindings together on the same element.");r=c}}),n=2),2===n&&a.a.w(p,function(c){vare=a.d[c];e&&"function"==typeofe.update&&(0,e.update)(b,k(c),l,x,f)})},null,{$:b});return{Sb:r===q}}a.d={};a.A=function(b,c,d){c?(a.a.extend(this,c),this.$parentContext=c,this.$parent=c.$data,this.$parents=(c.$parents||[]).slice(0),this.$parents.unshift(this.$parent)):(this.$parents=
a.Ia=function(a,b){if(b&&1!==b.nodeType&&8!==b.nodeType)throwError("ko.applyBindings: first parameter should be your view model; second parameter should be a DOM node");b=b||w.document.body;c(a,b,!0)};a.na=function(b){switch(b.nodeType){case1:case8:varc=a.jb(b);if(c)returnc;if(b.parentNode)returna.na(b.parentNode)}returnq};a.ub=function(b){return(b=a.na(b))?b.$data:q};a.b("bindingHandlers",a.d);a.b("applyBindings",a.Ia);a.b("applyBindingsToDescendants",a.Ja);a.b("applyBindingsToNode",a.Ka);
update:function(b,c){vard=!!a.a.c(c());b.__ko_hasfocusUpdating||b.__ko_hasfocusLastValue===d||(d?b.focus():b.blur(),a.q.I(a.a.Ga,null,[b,d?"focusin":"focusout"]))}};a.d.hasFocus=a.d.hasfocus;a.d.html={init:function(){return{controlsDescendantBindings:!0}},update:function(b,c){a.a.fa(b,c())}};varI="__ko_withIfBindingData";G("if");G("ifnot",!1,!0);G("with",!0,!1,function(a,c){returna.createChildContext(c)});a.d.options={init:function(b){if("select"!==a.a.u(b))throwError("options binding applies only to SELECT elements");
h.optionsValue,b),a.h.W(c,a.a.c(d)),b=f(b,h.optionsText,d),a.a.ib(c,b));return[c]},null,d);p=null;e&&"value"inh&&J(b,a.a.ya(h.value),!0);a.a.zb(b);m&&20<Math.abs(m-b.scrollTop)&&(b.scrollTop=m)}};a.d.options.wa="__ko.optionValueDomData__";a.d.selectedOptions={init:function(b,c,d){a.a.o(b,"change",function(){varf=c(),g=[];a.a.p(b.getElementsByTagName("option"),function(b){b.selected&&g.push(a.h.n(b))});a.g.ha(f,d,"selectedOptions",g)})},update:function(b,c){if("select"!=a.a.u(b))throwError("values binding applies only to SELECT elements");
vard=a.a.c(c());d&&"number"==typeofd.length&&a.a.p(b.getElementsByTagName("option"),function(b){varc=0<=a.a.k(d,a.h.n(b));a.a.hb(b,c)})}};a.d.style={update:function(b,c){vard=a.a.c(c()||{});a.a.w(d,function(c,d){d=a.a.c(d);b.style[c]=d||""})}};a.d.submit={init:function(b,c,d,f){if("function"!=typeofc())throwError("The value for a submit binding must be a function");a.a.o(b,"submit",function(a){vard,m=c();try{d=m.call(f,b)}finally{!0!==d&&(a.preventDefault?a.preventDefault():a.returnValue=!1)}})}};
{init:function(c,d,f,g){returna.d.event.init.call(this,c,function(){vara={};a[b]=d();returna},f,g)}}})("click");a.v=function(){};a.v.prototype.renderTemplateSource=function(){throwError("Override renderTemplateSource");};a.v.prototype.createJavaScriptEvaluatorBlock=function(){throwError("Override createJavaScriptEvaluatorBlock");};a.v.prototype.makeTemplateSource=function(b,c){if("string"==typeofb){c=c||s;vard=c.getElementById(b);if(!d)throwError("Cannot find template with ID "+b);returnnewa.l.i(d)}if(1==
a.Ea=function(){functionb(b,c,d,m){b=a.g.da(b);for(varh=a.g.S,k=0;k<b.length;k++){varl=b[k].key;if(h.hasOwnProperty(l)){varn=h[l];if("function"===typeofn){if(l=n(b[k].value))throwError(l);}elseif(!n)throwError("This template engine does not support the '"+l+"' binding within its templates");}}d="ko.__tr_ambtns(function($context,$element){return(function(){return{ "+a.g.ea(b)+" } })()},'"+d.toLowerCase()+"')";returnm.createJavaScriptEvaluatorBlock(d)+c}varc=/(<([a-z]+\d*)(?:\s+(?!data-bind\s*=\s*)[a-z0-9\-]+(?:=(?:\"[^\"]*\"|\'[^\']*\'))?)*\s+)data-bind\s*=\s*(["'])([\s\S]*?)\3/gi,
d=/\x3c!--\s*ko\b\s*([\s\S]*?)\s*--\x3e/g;return{Ab:function(b,c,d){c.isTemplateRewritten(b,d)||c.rewriteTemplate(b,function(b){returna.Ea.Lb(b,c)},d)},Lb:function(a,g){returna.replace(c,function(a,c,d,f,l){returnb(l,c,d,g)}).replace(d,function(a,c){returnb(c,"\x3c!-- ko --\x3e","#comment",g)})},qb:function(b,c){returna.s.va(function(d,m){varh=d.nextSibling;h&&h.nodeName.toLowerCase()===c&&a.Ka(h,b,m)})}}}();a.b("__tr_ambtns",a.Ea.qb);(function(){a.l={};a.l.i=function(a){this.i=a};a.l.i.prototype.text=
f.nodeType&&8!==f.nodeType||d(f)}functionc(c,d){if(c.length){varf=c[0],g=c[c.length-1];b(f,g,function(b){a.Ia(d,b)});b(f,g,function(b){a.s.nb(b,[d])})}}functiond(a){returna.nodeType?a:0<a.length?a[0]:null}functionf(b,f,h,k,l){l=l||{};varn=b&&d(b),n=n&&n.ownerDocument,p=l.templateEngine||g;a.Ea.Ab(h,p,n);h=p.renderTemplate(h,k,l,n);if("number"!=typeofh.length||0<h.length&&"number"!=typeofh[0].nodeType)throwError("Template engine must return an array of DOM nodes");n=!1;switch(f){case"replaceChildren":a.e.P(b,
h);n=!0;break;case"replaceNode":a.a.eb(b,h);n=!0;break;case"ignoreTargetNode":break;default:throwError("Unknown renderMode: "+f);}n&&(c(h,k),l.afterRender&&a.q.I(l.afterRender,null,[h,k.$data]));returnh}varg;a.Ba=function(b){if(b!=q&&!(binstanceofa.v))throwError("templateEngine must inherit from ko.templateEngine");g=b};a.za=function(b,c,h,k,l){h=h||{};if((h.templateEngine||g)==q)throwError("Set a template engine before calling renderTemplate");l=l||"replaceChildren";if(k){varn=d(k);returna.j(function(){varg=
c,c=a.a.c(d.name),"if"ind&&(f=a.a.c(d["if"])),f&&"ifnot"ind&&(f=!a.a.c(d.ifnot)),n=a.a.c(d.data));"foreach"ind?p=a.Rb(c||b,f&&d.foreach||[],d,b,g):f?(g="data"ind?g.createChildContext(n,d.as):g,p=a.za(c||b,g,d,b)):a.e.ba(b);g=p;(n=a.a.f.get(b,"__ko__templateComputedDomDataKey__"))&&"function"==typeofn.B&&n.B();a.a.f.set(b,"__ko__templateComputedDomDataKey__",g&&g.ta()?g:q)}};a.g.S.template=function(b){b=a.g.da(b);return1==b.length&&b[0].unknown||a.g.Jb(b,"name")?null:"This template engine does not support anonymous templates nested within its templates"};
function(b,f,g){g=g||{};if(2>a)throwError("Your version of jQuery.tmpl is too old. Please upgrade to jQuery.tmpl 1.0.0pre or later.");vare=b.data("precompiled");e||(e=b.text()||"",e=t.template(null,"{{ko_with $item.koBindingContext}}"+e+"{{/ko_with}}"),b.data("precompiled",e));b=[f.$data];f=t.extend({koBindingContext:f},g.templateOptions);f=t.tmpl(e,b,f);f.appendTo(s.createElement("div"));t.fragments={};returnf};this.createJavaScriptEvaluatorBlock=function(a){return"{{ko_code ((function() { return "+
<ahref="https://github.com/davidstutz/bootstrap-multiselect"><imgstyle="position: absolute; top: 0; right: 0; border: 0;"src="https://s3.amazonaws.com/github/ribbons/forkme_right_red_aa0000.png"alt="Fork me on GitHub"></a>
<divclass="jumbotron">
<divclass="container">
<h1>Bootstrap Multiselect</h1>
<p>Bootstrap Multiselect is a JQuery based plugin to provide an intuitive user interface for using select inputs with the multiple attribute present. Instead of a select a bootstrap button will be shown as dropdown menu containing the single options as checkboxes.</p>
</div>
</div>
<divclass="container">
<divclass="page-header">
<h1>Knockout Examples</h1>
</div>
<p>
The best way learning from the examples is using firebug, chrome developer tools or similar tools for your browser. Examine the generated markup and used javascript code.
<td>Basic knockout multiselect example with select all options enabled. Notice that once an item is added to the collection, the select all option isn't checked anymore because it isn't true anymore.
<td>Basic knockout multiselect example with html-based options list. Notice that once an item is added to the collection, the select all option isn't checked anymore because it isn't true anymore.</td>