-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathspike.min.js
44 lines (44 loc) · 11.8 KB
/
spike.min.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/*
* spike for IE JavaScript Library v0.1.2
*
* Copyright 2012, Dmitrii Pakhtinov ( [email protected] )
*
* http://spb-piksel.ru/
*
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
*
* Update: 03-06-2012
*
* element.js DOM Element Model v0.1.3 for Internet Explorer < 8
*/
(function(e,m){var b=e.document;if(!e.Element&&b.attachEvent){var n=!1,q=b.getElementById,k=b.getElementsByTagName,r=b.createElement,s=b.createDocumentFragment,g=b.attachEvent,i=[],l=[],o={},p=function(){},h,t=function(){"innerHTML"===e.event.propertyName&&d(e.event.srcElement)},d=function(a,b,d){var e=l.length,g,f,j,c;if(a&&a.nodeType||!a)a=a&&a.getElementsByTagName("*")||k("*");for(g=a.length;c=a[--g];)if(1===c.nodeType){if(c.$_sIdx&&c.parentNode&&c.document&&11!==c.document.nodeType){for(i.splice(--c.$_sIdx,
1);f=i[c.$_sIdx++];)f.$_sIdx=c.$_sIdx;c.$_sIdx=m}if(!d||d===c)if(b)c[b]!==h[b]&&(c[b]=h[b]);else{for(f=e;j=l[--f];)c[j]!==h[j]&&(c[j]=h[j]);c.$_sOPC||(c.$_sOPC=1,c.attachEvent("onpropertychange",t))}}return a[0]||null};p.prototype=h=b.createComment("");h.attachEvent("onpropertychange",function(){var a=e.event.propertyName;o[a]===m&&(o[a]=l.push(a)-1);d(b,a);d(i,a)});b.documentElement.firstChild.appendChild(h);b.getElementById=function(a){return d([q(a)])};b.createElement=function(a){a=r(a);a.$_sIdx=
i.push(a);d(i,null,a);return a};b.createDocumentFragment=function(){return d([s()])};e.Element=p;if("complete"===b.readyState)d();else{var f=function(){!n&&"complete"===b.readyState&&(n=!0,b.detachEvent("onreadystatechange",f),b.attachEvent=g,b.getElementsByTagName=k,d())};g("onreadystatechange",f);e.attachEvent("onload",f);b.attachEvent=function(a,d){if("onreadystatechange"===a){b.detachEvent(a,f);var e=g(a,d);g(a,f);return e}return g(a,d)};b.getElementsByTagName=function(a){d();return k(a)}}}})(window);
/*
* events.js DOM Event Model v0.0.2 for Internet Explorer
*/
(function(g,o){var m=g.Element,h=g.document,i=h.documentElement,c=g.spike||{},e={},l={click:1,dblclick:1,keydown:1,keypress:1,keyup:1,mousedown:1,mousemove:1,mouseup:1,mouseover:1,mouseout:1},k={DOMContentLoaded:{name:"readystatechange",rule:function(){return"complete"===h.readyState?!0:!1}}};c.Event=function(b){var a=this,j=h.body;if(a.srcElement===o||a.button===o)return c.Event.apply(h.createEventObject(),arguments);b!==o&&(a.type=b);null==a.pageX&&null!=a.clientX&&(a.pageX=a.clientX+(i&&i.scrollLeft||
j&&j.scrollLeft||0)-(i.clientLeft||0),a.pageY=a.clientY+(i&&i.scrollTop||j&&j.scrollTop||0)-(i.clientTop||0));a.target=a.target||a.srcElement;a.target&&/3|4/.test(a.target.nodeType)&&(a.target=a.target.parentNode);a.currentTarget=a.currentTarget||null;a.eventPhase=a.eventPhase||a.target==a.currentTarget?c.Event.AT_TARGET:c.Event.BUBBLING_PHASE;a.bubbles=a.bubbles||!1;a.cancelable=a.cancelable||!1;a.timeStamp=a.timeStamp||(new Date).getTime();a.defaultPrevented=a.defaultPrevented||!1;a.isTrusted=a.isTrusted||
!1;a.detail=a.detail||null;a.view=a.view||null;a.metaKey=a.metaKey||!1;a.relatedTarget=a.relatedTarget||"mouseout"==a.type?a.toElement:"mouseover"==a.type?a.fromElement:null;a.layerX=a.layerX||a.offsetX;a.layerY=a.layerY||a.offsetY;a.which=a.which&&a.button&1?1:a.button&2?3:a.button&4?2:0;a.isDefaultPrevented=!1;a.isPropagationStopped=!1;a.isImmediatePropagationStopped=!1;a.preventDefault=function(){a.isDefaultPrevented=true;a.returnValue=false};a.stopPropagation=function(){a.isPropagationStopped=
true;a.cancelBubble=true};a.stopImmediatePropagation=function(){a.isImmediatePropagationStopped=true;a.stopPropagation()};return a};c.Event.CAPTURING_PHASE=1;c.Event.AT_TARGET=2;c.Event.BUBBLING_PHASE=3;c.createEvent=function(b){var a=new c.Event;a["init"+b]=function(a,c,f,p,g,e,h,k,i,l,m,n,o,q,r){this.type=a;this.canBubble=c;this.cancelable=f;"Event"!==b&&(this.detail="CustomEvent"===b?p:g);"UIEvent"===b&&(this.view=p);"MouseEvent"===b&&(this.view=p,this.screenX=e,this.screenY=h,this.clientX=k,this.clientY=
i,this.ctrlKey=l,this.altKey=m,this.shiftKey=n,this.metaKey=o,this.button=q,this.relatedTarget=r)};return a};var n=function(b,a){b.currentTarget=a.elem;b.eventPhase=b.target==b.currentTarget?c.Event.AT_TARGET:a.capture?c.Event.CAPTURING_PHASE:c.Event.BUBBLING_PHASE;if(!1===b.isPropagationStopped||a.elem===b._propagationStoppedElem&&b.eventPhase===b._propagationStoppedPhase)if(!1===a.listener.call(a.elem,b)&&b.preventDefault(),!0===b.isPropagationStopped&&!b._propagationStoppedPhase&&(b._propagationStoppedPhase=
b.eventPhase,b._propagationStoppedElem=a.elem),!0===b.isImmediatePropagationStopped)return!1};c.addEventListener=function(b,a,j){var d=k[b]?k[b].name:b;1===l[b]&&(h.attachEvent("on"+d,l[b]=function(a){for(var d=0,f,j=l[b].targets,a=c.Event.call(a||g.event);(f=j[d++])&&!1!==n(a,f););a._propagationStoppedElem=null;j.length=0;if(a.isDefaultPrevented)return!1}),l[b].targets=[]);e[b]=e[b]||[];var f;e[b].push(f={listener:a,capture:j,elem:this,index:e[b].eventIndex=++e[b].eventIndex||0,proxy:function(a){if(l[b]){var a=
l[b].targets,e,h=a.length,i=0;if(j){for(;(e=a[i++])&&e.elem===f.elem&&e.capture&&e.index<f.index;);a.splice(--i,0,f)}else{for(;(e=a[--h])&&e.elem===f.elem&&!e.capture&&e.index>f.index;);a.splice(++h,0,f)}}else if(d===b||k[b].rule()){n(c.Event.call(a||g.event),f);if(a.isDefaultPrevented)return false}}});return this.attachEvent("on"+d,f.proxy)};c.removeEventListener=function(b,a,c){if(e[b])for(var d,f=e[b].length;d=e[b][--f];)if(a===d.listener&&c==d.capture&&this===d.elem)return this.detachEvent("on"+
(k[b]?k[b].name:b),d.proxy),d.listener=d.proxy=d.elem=null,e[b].splice(f,1),!0;return!1};c.dispatchEvent=function(b){try{return this.fireEvent("on"+(k[b.type]?k[b.type].name:b.type),b)}catch(a){if(e[b.type]){var c,d,f=e[b.type];for(c=0;(d=f[c++])&&(!d.capture||!(d.elem===this&&!1===n(b,d))););if(!b.isImmediatePropagationStopped)for(c=0;(d=f[c++])&&(d.capture||!(d.elem===this&&!1===n(b,d))););if(b.isDefaultPrevented)return!1}return!0}};g.spike=c;!g.addEventListener&&g.attachEvent&&m&&(g.Event=c.Event,
h.createEvent=c.createEvent,m.prototype.addEventListener=h.addEventListener=g.addEventListener=c.addEventListener,m.prototype.removeEventListener=h.removeEventListener=g.removeEventListener=c.removeEventListener,m.prototype.dispatchEvent=h.dispatchEvent=g.dispatchEvent=c.dispatchEvent)})(window);
/*
* selectors.js CSS3 Selectors API for Internet Explorer v1.0.2
*/
(function(x,G){function C(c,b,a,d,i,e,q,h,o,f){var p,j;if(b&&(b=(p=y[b]?y[b](c):null!=c[b]?c[b]:c.getAttribute(b))+"",!(null==p?"!="===a:"="===a?b===d:"*="===a?0<=b.indexOf(d):"~="===a?0<=(" "+b+" ").indexOf(" "+d+" "):!d||!a?b&&!1!==p:"!="===a?b!==d:"^="===a?0===b.indexOf(d):"$="===a?b.substr(b.length-d.length)===d:"|="===a&&(b===d||b.substr(0,d.length+1)===d+"-"))))return 0;if("."===i){if(-1===(" "+c.className+" ").indexOf(e))return 0}else if("#"===i&&c.id!==e)return 0;if(q&&o){if(f&&(j=c.parentNode)&&
(!c.a||j.c!==j.children.length)){b=0;for(a=j.firstChild;a;a=a.nextSibling)1===a.nodeType&&(a.a=++b);j.b=b;j.c=j.children.length}if(!o(c,h))return 0}return 1}function D(c,b,a,d,i,e,q,h,o,f,p,j){var g,r=0,c=c&&("*"===c?"":c.replace("|",":").toUpperCase()),d=d&&d.replace(/^(?:"(.*)"|'(.*)')$/,"$1$2").replace(/\\/g,""),b=(b=!b&&d||b)&&"class"===b?"className":"for"===b?"htmlFor":b,q="."===e&&" "+q+" "||q,p=p||j!==G&&",";if(!(g=z[h]&&z[h][o])&&o)throw Error("Unknown pseudo selector: "+o);if(g&&f)switch(o){case "nth-child":case "nth-last-child":f=
f.replace(/^\+|\s*/g,"");f=/(-?)(\d*)(?:n([+\-]?\d*))?/.exec("even"===f&&"2n"||"odd"===f&&"2n+1"||!/\D/.test(f)&&"0n+"+f||f);f=[f[1]+(f[2]||1)-0,f[3]-0];r=!(1===f[0]&&0===f[1]);break;default:f=0<f.indexOf(String.fromCharCode(1))?f.replace(/\x01/g,"(").replace(/\x02/g,")"):f}return[c,b,a,d,i,e,q,h,o,f,p,j,g,r]}function s(c,b){return-1===c.indexOf("(")?c:b||-1!==c.indexOf(":not")?c.replace(/([\s\S]*\([^\(]*)\(([^\(\)]*)\)([^\)]*\)[\s\S]*)/g,function(a,b,c,e){return s(b+String.fromCharCode(1)+c+String.fromCharCode(2)+
e,1)}):c}function t(c,b,a,d,i){var e,q,h,o=[],f=-1,p=-2,j,b=b&&(b.nodeType?[b]:b)||[g],d=d&&(d.nodeType?[d]:d)||b;s(c).replace(k,function(g,r,l,m,k,n,u,t,v,x,y,A,z,s){var w,g=[],B=0;if(!r&&!k&&!u&&!v){if((w=c.charAt(s))&&w.replace(/\s+/g,""))throw Error("Syntax error: "+c.substring(s));}else{m=D(r,l,m,k,n,u,t,v,x,y,A,z);r=m[0];l=m[1];u=m[5];v=m[7];A=m[10];for(q=d.length;n=d[--q];){" "===i?k=n.getElementsByTagName(r||"*"):">"===i?k=n.children:"~"===i||"+"===i?(k=[],h=n,B="+"===i?2:1):(q=0,k=d);for(e=
0;h=B?h.nextSibling:k[e++];){if((!r||"*"===r)&&1===h.nodeType||h.nodeName===r){if((l||u||v)&&!C(h,l,m[2],m[3],u,m[6],v,m[9],m[12],m[13])){if(2===B)break;continue}if(","===A){if(!a||a===h){j=h.sourceIndex;if(-1===f||f>j)f=j;p<j&&(p=j);o[j]=h}}else g[g.length]=h}if(2===B&&1===h.nodeType)break}}","===(i=A)?(d=b,i=" "):d=g}});b=[];for(e=f;e<=p;)if(h=o[e++])b[b.length]=h;o.length=0;return b}var g=x.document,l=x.Element,l=l&&l.prototype,k=/\s*(?:(\*|(?:(?:\*|[\w\-]+)\|)?(?:[\w\-]+|\*)))?(?:\[\s*(?:((?:[\w\-]+\|)?[\w\-]+)\s*((?:~|\^|\$|\*|\||!)?=)\s*)?((?:".*?(?:(?:[\\]{2}(?="))|[^\\])"|'.*?(?:(?:[\\]{2}(?='))|[^\\])'|[^\s\]]*)?)\s*(?:(i)\s*)?\])?(?:(\.|#)([\w\-]+))?(?:(:(?::)?)([\w\-]+)(?:\(\s*([^)]+)\s*\))?)?(?:(?:\s*(?=\s))?(?:(?:\s(?=,|>|\+|~))?([\s,>+~](?!$))|(\s*$))?)?/g,
n=g.querySelectorAll?[l.querySelectorAll,g.querySelectorAll]:0,y={href:function(c){return c.getAttribute("href",2)},type:function(c){return c.getAttribute("type")},style:function(c){var b=c.getAttribute("style");return"object"===typeof b?c.style.cssText||"":b}},z=function(){function c(a,b){var c=b-a[1];return 0===a[0]?0===c:0===c%a[0]&&0<=c/a[0]}var b={":":{"nth-child":function(a,b){return c(b,a.a||1)},"nth-last-child":function(a,b){var i=a.parentNode;return c(b,(i&&(i.b||i.children.length||0)+1||
2)-(a.a||1))},"first-child":function(a){a=a.previousSibling;return!(a&&(3===a.nodeType?a.previousSibling:1))},"last-child":function(a){a=a.nextSibling;return!(a&&(3===a.nodeType?a.nextSibling:1))},empty:function(a){return!a.firstChild},enabled:function(a){return!1===a.disabled&&"hidden"!==a.type},disabled:function(a){return!0===a.disabled},checked:function(a){return!0===a.checked},not:function(a,b){return 0<t(b,0,0,a).length?!1:!0},contains:function(a,b){return 0<=(a.textContent||a.innerText||a.nodeValue||
a.value||"").indexOf(b)}},"::":{}};b[":"]["only-child"]=function(a){return b[":"]["first-child"](a)&&b[":"]["last-child"](a)};return b}();try{g.attachEvent&&g.querySelector("p:last-child")}catch(H){var w,E,F;g.querySelectorAll=w=function(c,b){var a;a=[];var d=1;k.lastIndex=0;if(n){var i,e,g;e=/^\s*[>+~]/.test(c);if(9===this.nodeType)try{a=n[1].call(this,c,b),d=0}catch(h){}else if(1===this.nodeType&&"OBJECT"!==this.nodeName)if(e&&(i=this.parentNode)){g=(e=this.getAttribute("id"))&&e.replace(/'/g,"\\$&")||
"__qsaEngine__";!e&&this.setAttribute("id",g);try{a=n[0].call(i,"[id='"+g+"'] "+c,b),d=0}catch(l){}!e&&this.removeAttribute("id")}else if(!e)try{a=n[0].call(this,c,b),d=0}catch(f){}}if(d){if(9!==this.nodeType){do if(a=k.exec(c),a=D(a[1],a[2],a[3],a[4],a[5],a[6],a[7],a[8],a[9],a[10],a[11],a[12]),!a[10]||" "===a[10])if((!a[0]||a[0]&&this.nodeName===a[0].toUpperCase())&&C(elem,a[1],a[2],a[3],a[5],a[6],a[7],a[9],a[12],a[13])){if(" "===a[10]){c=c.substr(k.lastIndex,c.length-k.lastIndex);break}}else break;
else break;while(k.lastIndex<c.length);k.lastIndex=0}a=t(c,this,0,b," ")}return a};g.querySelector=E=function(c,b){return g.querySelectorAll(c,b)[0]||null};g.getElementsByClassName=F=function(c){var b=[];if(c=c.replace(/^[\s]+|[\s](?=\s)|[\s]+$/g,"")){if(n)return(9===this.nodeType?n[1]:n[0]).call(this,c.replace(/\s+(?=\S)|^/g,"."));for(var a,d=0,g,e,k=this.getElementsByTagName("*"),c=c.split(" ");e=k[d++];){for(a=c.length;g=c[--a];)if(!e.className||-1===(" "+e.className+" ").indexOf(" "+g+" ")){e=
null;break}e&&(b[b.length]=e)}}return b};try{l.querySelectorAll=w,l.querySelector=E,l.getElementsByClassName=F,l.matchesSelector=function(c,b){return 0<t(c,0,this,b," ").length}}catch(I){}}})(window);