Misc updates

This commit is contained in:
Timothy Warren 2011-12-06 11:47:22 -05:00
parent 095f93ebb2
commit 6d990b65bb
6 changed files with 85 additions and 48 deletions

View File

@ -52,14 +52,14 @@ foreach($files as $f)
file_put_contents("kis-custom.js", $new_file); file_put_contents("kis-custom.js", $new_file);
//Get a much-minified version from Google's closure compiler //Get a much-minified version from Google's closure compiler
/*$ch = curl_init('http://closure-compiler.appspot.com/compile'); $ch = curl_init('http://closure-compiler.appspot.com/compile');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, 'output_info=compiled_code&output_format=text&compilation_level=SIMPLE_OPTIMIZATIONS&js_code=' . urlencode($new_file)); curl_setopt($ch, CURLOPT_POSTFIELDS, 'output_info=compiled_code&output_format=text&compilation_level=SIMPLE_OPTIMIZATIONS&js_code=' . urlencode($new_file));
$output = curl_exec($ch); $output = curl_exec($ch);
curl_close($ch); curl_close($ch);
file_put_contents("kis-custom-min.js", $output);*/ file_put_contents("kis-custom-min.js", $output);
//Display the output on-screen too //Display the output on-screen too

View File

@ -320,44 +320,58 @@
<span class='line'>313</span> */</span><span class="WHIT"> <span class='line'>313</span> */</span><span class="WHIT">
<span class='line'>314</span> </span><span class="WHIT"> </span><span class="NAME">append</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">htm</span><span class="PUNC">)</span><span class="WHIT"> <span class='line'>314</span> </span><span class="WHIT"> </span><span class="NAME">append</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">htm</span><span class="PUNC">)</span><span class="WHIT">
<span class='line'>315</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT"> <span class='line'>315</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>316</span> </span><span class="WHIT"> </span><span class="NAME">this.el.insertAdjacentHTML</span><span class="PUNC">(</span><span class="STRN">'beforeend'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">htm</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT"> <span class='line'>316</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">document.insertAdjacentHTML</span><span class="WHIT"> </span><span class="PUNC">!==</span><span class="WHIT"> </span><span class="STRN">"undefined"</span><span class="PUNC">)</span><span class="WHIT">
<span class='line'>317</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT"> <span class='line'>317</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>318</span> </span><span class="WHIT"> </span><span class="COMM">/** <span class='line'>318</span> </span><span class="WHIT"> </span><span class="NAME">this.el.insertAdjacentHTML</span><span class="PUNC">(</span><span class="STRN">'beforeend'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">htm</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>319</span> * Adds to the innerHTML of the selected element, before the current children <span class='line'>319</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>320</span> * <span class='line'>320</span> </span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT">
<span class='line'>321</span> * @name prepend <span class='line'>321</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>322</span> * @memberOf $_.dom <span class='line'>322</span> </span><span class="WHIT"> </span><span class="NAME">this.el.innerHTML</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">htm</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>323</span> * @function <span class='line'>323</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>324</span> * @param string htm <span class='line'>324</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>325</span> */</span><span class="WHIT"> <span class='line'>325</span> </span><span class="WHIT"> </span><span class="COMM">/**
<span class='line'>326</span> </span><span class="WHIT"> </span><span class="NAME">prepend</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">htm</span><span class="PUNC">)</span><span class="WHIT"> <span class='line'>326</span> * Adds to the innerHTML of the selected element, before the current children
<span class='line'>327</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT"> <span class='line'>327</span> *
<span class='line'>328</span> </span><span class="WHIT"> </span><span class="NAME">this.el.insertAdjacentHTML</span><span class="PUNC">(</span><span class="STRN">'afterbegin'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">htm</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT"> <span class='line'>328</span> * @name prepend
<span class='line'>329</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT"> <span class='line'>329</span> * @memberOf $_.dom
<span class='line'>330</span> </span><span class="WHIT"> </span><span class="COMM">/** <span class='line'>330</span> * @function
<span class='line'>331</span> * Sets or gets the innerHTML propery of the element(s) passed <span class='line'>331</span> * @param string htm
<span class='line'>332</span> * <span class='line'>332</span> */</span><span class="WHIT">
<span class='line'>333</span> * @name html <span class='line'>333</span> </span><span class="WHIT"> </span><span class="NAME">prepend</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">htm</span><span class="PUNC">)</span><span class="WHIT">
<span class='line'>334</span> * @memberOf $_.dom <span class='line'>334</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>335</span> * @function <span class='line'>335</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">document.insertAdjacentHTML</span><span class="WHIT"> </span><span class="PUNC">!==</span><span class="WHIT"> </span><span class="STRN">"undefined"</span><span class="PUNC">)</span><span class="WHIT">
<span class='line'>336</span> * @param [string] htm <span class='line'>336</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>337</span> * @return string <span class='line'>337</span> </span><span class="WHIT"> </span><span class="NAME">this.el.insertAdjacentHTML</span><span class="PUNC">(</span><span class="STRN">'afterbegin'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">htm</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>338</span> * @type string <span class='line'>338</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>339</span> */</span><span class="WHIT"> <span class='line'>339</span> </span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT">
<span class='line'>340</span> </span><span class="WHIT"> </span><span class="NAME">html</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">htm</span><span class="PUNC">)</span><span class="WHIT"> <span class='line'>340</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>341</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT"> <span class='line'>341</span> </span><span class="WHIT"> </span><span class="NAME">this.el.innerHTML</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">htm</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">this.el.innerHTML</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>342</span> </span><span class="WHIT"> <span class='line'>342</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>343</span> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">htm</span><span class="WHIT"> </span><span class="PUNC">!==</span><span class="WHIT"> </span><span class="STRN">"undefined"</span><span class="PUNC">)</span><span class="WHIT"> <span class='line'>343</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>344</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT"> <span class='line'>344</span> </span><span class="WHIT"> </span><span class="COMM">/**
<span class='line'>345</span> </span><span class="WHIT"> </span><span class="NAME">this.el.innerHTML</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">htm</span><span class="PUNC">;</span><span class="WHIT"> <span class='line'>345</span> * Sets or gets the innerHTML propery of the element(s) passed
<span class='line'>346</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT"> <span class='line'>346</span> *
<span class='line'>347</span> </span><span class="WHIT"> <span class='line'>347</span> * @name html
<span class='line'>348</span> </span><span class="COMM">//If the parameter is undefined, just return the current value</span><span class="WHIT"> <span class='line'>348</span> * @memberOf $_.dom
<span class='line'>349</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">this.el.innerHTML</span><span class="PUNC">;</span><span class="WHIT"> <span class='line'>349</span> * @function
<span class='line'>350</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT"> <span class='line'>350</span> * @param [string] htm
<span class='line'>351</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT"> <span class='line'>351</span> * @return string
<span class='line'>352</span> <span class='line'>352</span> * @type string
<span class='line'>353</span> </span><span class="WHIT"> </span><span class="NAME">$_.ext</span><span class="PUNC">(</span><span class="STRN">'dom'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">d</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT"> <span class='line'>353</span> */</span><span class="WHIT">
<span class='line'>354</span> </span><span class="WHIT"> <span class='line'>354</span> </span><span class="WHIT"> </span><span class="NAME">html</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">htm</span><span class="PUNC">)</span><span class="WHIT">
<span class='line'>355</span> </span><span class="PUNC">}</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT"> <span class='line'>355</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>356</span> </span></pre></body></html> <span class='line'>356</span> </span><span class="WHIT">
<span class='line'>357</span> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">htm</span><span class="WHIT"> </span><span class="PUNC">!==</span><span class="WHIT"> </span><span class="STRN">"undefined"</span><span class="PUNC">)</span><span class="WHIT">
<span class='line'>358</span> </span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>359</span> </span><span class="WHIT"> </span><span class="NAME">this.el.innerHTML</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">htm</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>360</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>361</span> </span><span class="WHIT">
<span class='line'>362</span> </span><span class="COMM">//If the parameter is undefined, just return the current value</span><span class="WHIT">
<span class='line'>363</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">this.el.innerHTML</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>364</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>365</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>366</span>
<span class='line'>367</span> </span><span class="WHIT"> </span><span class="NAME">$_.ext</span><span class="PUNC">(</span><span class="STRN">'dom'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">d</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>368</span> </span><span class="WHIT">
<span class='line'>369</span> </span><span class="PUNC">}</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>370</span> </span></pre></body></html>

View File

@ -749,7 +749,14 @@
*/ */
append: function(htm) append: function(htm)
{ {
this.el.insertAdjacentHTML('beforeend', htm); if(typeof document.insertAdjacentHTML !== "undefined")
{
this.el.insertAdjacentHTML('beforeend', htm);
}
else
{
this.el.innerHTML += htm;
}
}, },
/** /**
* Adds to the innerHTML of the selected element, before the current children * Adds to the innerHTML of the selected element, before the current children
@ -761,7 +768,14 @@
*/ */
prepend: function(htm) prepend: function(htm)
{ {
this.el.insertAdjacentHTML('afterbegin', htm); if(typeof document.insertAdjacentHTML !== "undefined")
{
this.el.insertAdjacentHTML('afterbegin', htm);
}
else
{
this.el.innerHTML = htm + this.el.innerHTML;
}
}, },
/** /**
* Sets or gets the innerHTML propery of the element(s) passed * Sets or gets the innerHTML propery of the element(s) passed

6
kis-min.js vendored
View File

@ -8,8 +8,8 @@ h=function(){return new e(this)};a.prototype=Error.prototype;j.item=function(a){
(function(){function g(b,a,c){var e,d;if("undefined"!==typeof b.hasAttribute)b.hasAttribute(a)&&(e=b.getAttribute(a)),d=!0;else if("undefined"!==typeof b[a])e=b[a],d=!1;else if("class"===a&&"undefined"!==typeof b.className)a="className",e=b.className,d=!1;if("undefined"===typeof e&&("undefined"===typeof c||null===c))console.log(c),console.log(b),console.log("Element does not have the selected attribute");else{if("undefined"===typeof c)return e;"undefined"!==typeof c&&null!==c?!0===d?b.setAttribute(a, (function(){function g(b,a,c){var e,d;if("undefined"!==typeof b.hasAttribute)b.hasAttribute(a)&&(e=b.getAttribute(a)),d=!0;else if("undefined"!==typeof b[a])e=b[a],d=!1;else if("class"===a&&"undefined"!==typeof b.className)a="className",e=b.className,d=!1;if("undefined"===typeof e&&("undefined"===typeof c||null===c))console.log(c),console.log(b),console.log("Element does not have the selected attribute");else{if("undefined"===typeof c)return e;"undefined"!==typeof c&&null!==c?!0===d?b.setAttribute(a,
c):b[a]=c:null===c&&(!0===d?b.removeAttribute(a):delete b[a]);return"undefined"!==typeof c?c:e}}function f(b){return b.replace(/(\-[a-z])/g,function(a){return a.toUpperCase().replace("-","")})}function d(b,a,c){var e,a=f(a);e={outerHeight:"offsetHeight",outerWidth:"offsetWidth",top:"posTop"};if("undefined"===typeof c&&"undefined"!==b.style[a])return b.style[a];if("undefined"===typeof c&&"undefined"!==b.style[e[a]])return b.style[e[a]];"undefined"!==typeof b.style[a]?b.style[a]=c:b.style[e[a]]?b.style[e[a]]= c):b[a]=c:null===c&&(!0===d?b.removeAttribute(a):delete b[a]);return"undefined"!==typeof c?c:e}}function f(b){return b.replace(/(\-[a-z])/g,function(a){return a.toUpperCase().replace("-","")})}function d(b,a,c){var e,a=f(a);e={outerHeight:"offsetHeight",outerWidth:"offsetWidth",top:"posTop"};if("undefined"===typeof c&&"undefined"!==b.style[a])return b.style[a];if("undefined"===typeof c&&"undefined"!==b.style[e[a]])return b.style[e[a]];"undefined"!==typeof b.style[a]?b.style[a]=c:b.style[e[a]]?b.style[e[a]]=
c:console.log("Property "+a+" nor an equivalent seems to exist")}$_.ext("dom",{addClass:function(b){$_.each(function(a){a.classList.add(b)})},removeClass:function(b){$_.each(function(a){a.classList.remove(b)})},hide:function(){this.css("display","none")},show:function(b){"undefined"===typeof b&&(b="block");this.css("display",b)},attr:function(b,a){var c=this.el;if(1<c.length&&"undefined"===typeof a)console.log(c),console.log("Must be a singular element");else if(1<c.length&&"undefined"!==typeof a)$_.each(function(c){return g(c, c:console.log("Property "+a+" nor an equivalent seems to exist")}$_.ext("dom",{addClass:function(b){$_.each(function(a){a.classList.add(b)})},removeClass:function(b){$_.each(function(a){a.classList.remove(b)})},hide:function(){this.css("display","none")},show:function(b){"undefined"===typeof b&&(b="block");this.css("display",b)},attr:function(b,a){var c=this.el;if(1<c.length&&"undefined"===typeof a)console.log(c),console.log("Must be a singular element");else if(1<c.length&&"undefined"!==typeof a)$_.each(function(c){return g(c,
b,a)});else return g(c,b,a)},text:function(b){var a,c,e;e=this.el;c="undefined"!==typeof e.innerText?"innerText":"undefined"!==typeof e.textContent?"textContent":"innerHTML";a=e[c];return"undefined"!==typeof b?e[c]=b:a},css:function(b,a){if("undefined"===typeof a)return d(this.el,b);$_.each(function(c){d(c,b,a)})},append:function(b){this.el.insertAdjacentHTML("beforeend",b)},prepend:function(b){this.el.insertAdjacentHTML("afterbegin",b)},html:function(b){if("undefined"!==typeof b)this.el.innerHTML= b,a)});else return g(c,b,a)},text:function(b){var a,c,e;e=this.el;c="undefined"!==typeof e.innerText?"innerText":"undefined"!==typeof e.textContent?"textContent":"innerHTML";a=e[c];return"undefined"!==typeof b?e[c]=b:a},css:function(b,a){if("undefined"===typeof a)return d(this.el,b);$_.each(function(c){d(c,b,a)})},append:function(b){"undefined"!==typeof document.insertAdjacentHTML?this.el.insertAdjacentHTML("beforeend",b):this.el.innerHTML+=b},prepend:function(b){"undefined"!==typeof document.insertAdjacentHTML?
b;return this.el.innerHTML}})})(); this.el.insertAdjacentHTML("afterbegin",b):this.el.innerHTML=b+this.el.innerHTML},html:function(b){if("undefined"!==typeof b)this.el.innerHTML=b;return this.el.innerHTML}})})();
(function(){if(!("undefined"===typeof localStorage||"undefined"===typeof JSON)){var g=localStorage,f=sessionStorage;$_.ext("store",{get:function(d,b){var a=b?f.getItem(d):g.getItem(d);return JSON.parse(a)},set:function(d,b,a){b=JSON.stringify(b);a?f.setItem(d,b):g.setItem(d,b)},remove:function(d,b){b?f.removeItem(d):g.removeItem(d)},getAll:function(d){var b,a={},c,e;e=d?g:f;b=e.length;for(d=0;d<b;d++)c=e.key(d),a[c]=e.getItem(c);return a},clear:function(d){d?f.clear():g.clear()}})}})(); (function(){if(!("undefined"===typeof localStorage||"undefined"===typeof JSON)){var g=localStorage,f=sessionStorage;$_.ext("store",{get:function(d,b){var a=b?f.getItem(d):g.getItem(d);return JSON.parse(a)},set:function(d,b,a){b=JSON.stringify(b);a?f.setItem(d,b):g.setItem(d,b)},remove:function(d,b){b?f.removeItem(d):g.removeItem(d)},getAll:function(d){var b,a={},c,e;e=d?g:f;b=e.length;for(d=0;d<b;d++)c=e.key(d),a[c]=e.getItem(c);return a},clear:function(d){d?f.clear():g.clear()}})}})();
(function(){if("undefined"!==typeof window.XMLHttpRequest){var g={_do:function(f,d,b,a){var c=new XMLHttpRequest;"undefined"===typeof b&&(b=function(){});a=a?"POST":"GET";f+="GET"===a?"?"+this._serialize(d):"";c.open(a,f);c.onreadystatechange=function(){4===c.readyState&&b(c.responseText)};"POST"===a?(c.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),c.send(this._serialize(d))):c.send(null)},_serialize:function(f){var d,b,a=[];for(d in f)f.hasOwnProperty(d)&&"function"!==typeof f[d]&& (function(){if("undefined"!==typeof window.XMLHttpRequest){var g={_do:function(f,d,b,a){var c=new XMLHttpRequest;"undefined"===typeof b&&(b=function(){});a=a?"POST":"GET";f+="GET"===a?"?"+this._serialize(d):"";c.open(a,f);c.onreadystatechange=function(){4===c.readyState&&b(c.responseText)};"POST"===a?(c.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),c.send(this._serialize(d))):c.send(null)},_serialize:function(f){var d,b,a=[];for(d in f)f.hasOwnProperty(d)&&"function"!==typeof f[d]&&
(b=f[d].toString(),d=encodeURIComponent(d),b=encodeURIComponent(b),a.push(d+"="+b));return a.join("&")}};$_.ext("get",function(f,d,b){g._do(f,d,b,!1)});$_.ext("post",function(f,d,b){g._do(f,d,b,!0)})}})(); (b=f[d].toString(),d=encodeURIComponent(d),b=encodeURIComponent(b),a.push(d+"="+b));return a.join("&")}};$_.ext("get",function(f,d,b){g._do(f,d,b,!1)});$_.ext("post",function(f,d,b){g._do(f,d,b,!0)})}})();
@ -19,7 +19,7 @@ b;return this.el.innerHTML}})})();
a.charAt(e):a[e]):m+d.charAt(c)}return m}};$_.ext("util",f)})(); a.charAt(e):a[e]):m+d.charAt(c)}return m}};$_.ext("util",f)})();
(function(){var g,f,d,b;"undefined"!==typeof document.addEventListener?(g=function(a,c,b){"undefined"!==typeof a.addEventListener&&a.addEventListener(c,b,!1)},f=function(a,c,b){"undefined"!==typeof a.removeEventListener&&a.removeEventListener(c,b,!1)}):"undefined"!==typeof document.attachEvent&&(g=function(a,c,b){var e;function d(a){b.apply(a)}"undefined"!==typeof a.attachEvent?(f(c,b),a.attachEvent("on"+c,d),e=a.KIS_0_5_0=a.KIS_0_5_0||{},a=e,a.listeners=a.listeners||{},a.listeners[c]=a.listeners[c]|| (function(){var g,f,d,b;"undefined"!==typeof document.addEventListener?(g=function(a,c,b){"undefined"!==typeof a.addEventListener&&a.addEventListener(c,b,!1)},f=function(a,c,b){"undefined"!==typeof a.removeEventListener&&a.removeEventListener(c,b,!1)}):"undefined"!==typeof document.attachEvent&&(g=function(a,c,b){var e;function d(a){b.apply(a)}"undefined"!==typeof a.attachEvent?(f(c,b),a.attachEvent("on"+c,d),e=a.KIS_0_5_0=a.KIS_0_5_0||{},a=e,a.listeners=a.listeners||{},a.listeners[c]=a.listeners[c]||
[],a.listeners[c].push({callback:b,_listener:d})):console.log("Failed to _attach event:"+c+" on "+a)},f=function(a,c,b){if("undefined"!==typeof a.detachEvent){var d=a.KIS_0_5_0;if(d&&d.listeners&&d.listeners[c])for(var f=d.listeners[c],g=f.length,k=0;k<g;k++)if(f[k].callback===b){a.detachEvent("on"+c,f[k]._listener);f.splice(k,1);0===f.length&&delete d.listeners[c];break}}});d=function(a,c,b,j){var h,i;if("undefined"===typeof a)return console.log(arguments),console.log(c),!1;if(c.match(/^([\w\-]+)$/))!0=== [],a.listeners[c].push({callback:b,_listener:d})):console.log("Failed to _attach event:"+c+" on "+a)},f=function(a,c,b){if("undefined"!==typeof a.detachEvent){var d=a.KIS_0_5_0;if(d&&d.listeners&&d.listeners[c])for(var f=d.listeners[c],g=f.length,k=0;k<g;k++)if(f[k].callback===b){a.detachEvent("on"+c,f[k]._listener);f.splice(k,1);0===f.length&&delete d.listeners[c];break}}});d=function(a,c,b,j){var h,i;if("undefined"===typeof a)return console.log(arguments),console.log(c),!1;if(c.match(/^([\w\-]+)$/))!0===
j?g(a,c,b):f(a,c,b);else{c=c.split(" ");i=c.length;for(h=0;h<i;h++)d(a,c[h],b,j)}};b=function(a,c,b,f){d(a,b,function(a){var b,d,e,a=a||window.event;d=$_.$(c);for(b in d)e=a.target||a.srcElement,e==d[b]&&(f.call(d[b],a),a.stopPropagation())},!0)};$_.ext("event",{add:function(a,c){$_.each(function(b){d(b,a,c,!0)})},remove:function(a,b){$_.each(function(e){d(e,a,b,!1)})},live:function(a,c,d){b(document.documentElement,a,c,d)},delegate:function(a,c,d){$_.each(function(f){b(f,a,c,d)})}})})(); j?g(a,c,b):f(a,c,b);else{c=c.split(" ");i=c.length;for(h=0;h<i;h++)d(a,c[h],b,j)}};b=function(a,c,b,f){d(a,b,function(a){var b,d,e,a=a||window.event;d=$_.$(c);for(b in d)e=a.target||a.srcElement,e==d[b]&&(f.call(d[b],a),a.stopPropagation())},!0)};$_.ext("event",{add:function(a,b){$_.each(function(e){d(e,a,b,!0)})},remove:function(a,b){$_.each(function(e){d(e,a,b,!1)})},live:function(a,c,d){b(document.documentElement,a,c,d)},delegate:function(a,c,d){$_.each(function(f){b(f,a,c,d)})}})})();
(function(){if("undefined"!==$_.ajax){var g,f;g={};f={};$_.ext("template",{get:function(d){var b;b=this.el.innerHTML;if(""===b)console.log("Template is empty or cannot be found");else return g[d]=b},parse:function(d,b){var a=g[d],c=[],e=/\{([A-Z0-9_\-]+)\}(.*)\{\/\1\}/gim,j=/\{([A-Z0-9_\-]+)\}/gim,c=[],h=0,i=h=0,k=0,l="",o={},m="",n,a=(""+a).replace(/\s+/gim," "),a=a.replace(/>\s+</gim,"><"),a=a.replace(/>\s+\{/gim,">{"),a=a.replace(/\}\s+</gim,"}<"),c=a.match(e);if(null!=c){h=c.length;for(i=0;i< (function(){if("undefined"!==$_.ajax){var g,f;g={};f={};$_.ext("template",{get:function(d){var b;b=this.el.innerHTML;if(""===b)console.log("Template is empty or cannot be found");else return g[d]=b},parse:function(d,b){var a=g[d],c=[],e=/\{([A-Z0-9_\-]+)\}(.*)\{\/\1\}/gim,j=/\{([A-Z0-9_\-]+)\}/gim,c=[],h=0,i=h=0,k=0,l="",o={},m="",n,a=(""+a).replace(/\s+/gim," "),a=a.replace(/>\s+</gim,"><"),a=a.replace(/>\s+\{/gim,">{"),a=a.replace(/\}\s+</gim,"}<"),c=a.match(e);if(null!=c){h=c.length;for(i=0;i<
h;i++){a=a.replace(c[i],"{"+i+"}");m="";l=(""+c[i]).match(/^\{([A-Z0-9_\-]+)\}/i);o=b[l[1]];if(0<o.length){l=o.length;c[i]=c[i].replace(e,"$2");for(k=0;k<l;k++)m+=c[i].replace(j,function(a,b){return o[k][b]?o[k][b]:""})}a=a.replace("{"+i+"}",m)}}c=a.match(j);if(null!=c){h=c.length;for(i=0;i<h;i++)l=c[i].replace("{",""),l=l.replace("}",""),a=a.replace(c[i],b[l])}e=document.createDocumentFragment();e.appendChild(document.createElement("section"));e=e.querySelectorAll("section")[0];e.innerHTML=a;e=e.querySelectorAll('[src=""], [href=""]'); h;i++){a=a.replace(c[i],"{"+i+"}");m="";l=(""+c[i]).match(/^\{([A-Z0-9_\-]+)\}/i);o=b[l[1]];if(0<o.length){l=o.length;c[i]=c[i].replace(e,"$2");for(k=0;k<l;k++)m+=c[i].replace(j,function(a,b){return o[k][b]?o[k][b]:""})}a=a.replace("{"+i+"}",m)}}c=a.match(j);if(null!=c){h=c.length;for(i=0;i<h;i++)l=c[i].replace("{",""),l=l.replace("}",""),a=a.replace(c[i],b[l])}e=document.createDocumentFragment();e.appendChild(document.createElement("section"));e=e.querySelectorAll("section")[0];e.innerHTML=a;e=e.querySelectorAll('[src=""], [href=""]');
for(n in e)e[n].parentNode&&e[n].parentNode.removeChild(e[n]);return f[d]=a},apply:function(d,b,a){"undefined"===typeof b&&"undefined"===typeof a?this.el.innerHTML="undefined"!==typeof f[d]?f[d]:d:$_.get(b,{},function(b){""===b?console.log("Template is empty or can not be found"):(g[d]=b,b=this.parse(d,a),f[d]=b,this.el.innerHTML=b)})}})}})(); for(n in e)e[n].parentNode&&e[n].parentNode.removeChild(e[n]);return f[d]=a},apply:function(d,b,a){"undefined"===typeof b&&"undefined"===typeof a?this.el.innerHTML="undefined"!==typeof f[d]?f[d]:d:$_.get(b,{},function(b){""===b?console.log("Template is empty or can not be found"):(g[d]=b,b=this.parse(d,a),f[d]=b,this.el.innerHTML=b)})}})}})();

View File

@ -101,5 +101,6 @@ for (var i = 0, tagName; tagName = HTML5[i]; i++) document.createElement(tagName
<script src="tests/dom.js"></script> <script src="tests/dom.js"></script>
<script src="tests/store.js"></script> <script src="tests/store.js"></script>
<script src="tests/util.js"></script> <script src="tests/util.js"></script>
<script src="tests/template.js"></script>
</body> </body>
</html> </html>

8
tests/tests/template.js Normal file
View File

@ -0,0 +1,8 @@
(function(){
"use strict";
module("template");
}());