1 line
13 KiB
JavaScript
1 line
13 KiB
JavaScript
"function"!=typeof Object.create&&(Object.create=function(e){function t(){}return t.prototype=e,new t});var ua={toString:function(){return navigator.userAgent},test:function(e){return this.toString().toLowerCase().indexOf(e.toLowerCase())>-1}};ua.version=(ua.toString().toLowerCase().match(/[\s\S]+(?:rv|it|ra|ie)[\/: ]([\d.]+)/)||[])[1],ua.webkit=ua.test("webkit"),ua.gecko=ua.test("gecko")&&!ua.webkit,ua.opera=ua.test("opera"),ua.ie=ua.test("msie")&&!ua.opera,ua.ie6=ua.ie&&document.compatMode&&"undefined"==typeof document.documentElement.style.maxHeight,ua.ie7=ua.ie&&document.documentElement&&"undefined"!=typeof document.documentElement.style.maxHeight&&"undefined"==typeof XDomainRequest,ua.ie8=ua.ie&&"undefined"!=typeof XDomainRequest;var domReady=function(){var e=[],t=function(){if(!arguments.callee.done){arguments.callee.done=!0;for(var t=0;t<e.length;t++)e[t]()}};return document.addEventListener&&document.addEventListener("DOMContentLoaded",t,!1),ua.ie&&(function(){try{document.documentElement.doScroll("left")}catch(e){return setTimeout(arguments.callee,50),void 0}t()}(),document.onreadystatechange=function(){"complete"===document.readyState&&(document.onreadystatechange=null,t())}),ua.webkit&&document.readyState&&function(){"loading"!==document.readyState?t():setTimeout(arguments.callee,10)}(),window.onload=t,function(t){return"function"==typeof t&&(e[e.length]=t),t}}(),cssHelper=function(){var e,t={BLOCKS:/[^\s{][^{]*\{(?:[^{}]*\{[^{}]*\}[^{}]*|[^{}]*)*\}/g,BLOCKS_INSIDE:/[^\s{][^{]*\{[^{}]*\}/g,DECLARATIONS:/[a-zA-Z\-]+[^;]*:[^;]+;/g,RELATIVE_URLS:/url\(['"]?([^\/\)'"][^:\)'"]+)['"]?\)/g,REDUNDANT_COMPONENTS:/(?:\/\*([^*\\\\]|\*(?!\/))+\*\/|@import[^;]+;)/g,REDUNDANT_WHITESPACE:/\s*(,|:|;|\{|\})\s*/g,MORE_WHITESPACE:/\s{2,}/g,FINAL_SEMICOLONS:/;\}/g,NOT_WHITESPACE:/\S+/g},n=!1,r=[],i=function(e){"function"==typeof e&&(r[r.length]=e)},o=function(){for(var t=0;t<r.length;t++)r[t](e)},s={},u=function(e,t){if(s[e]){var n=s[e].listeners;if(n)for(var r=0;r<n.length;r++)n[r](t)}},a=function(e,t,n){if(ua.ie&&!window.XMLHttpRequest&&(window.XMLHttpRequest=function(){return new ActiveXObject("Microsoft.XMLHTTP")}),!XMLHttpRequest)return"";var r=new XMLHttpRequest;try{r.open("get",e,!0),r.setRequestHeader("X_REQUESTED_WITH","XMLHttpRequest")}catch(i){return n(),void 0}var o=!1;setTimeout(function(){o=!0},5e3),document.documentElement.style.cursor="progress",r.onreadystatechange=function(){4!==r.readyState||o||(!r.status&&"file:"===location.protocol||r.status>=200&&r.status<300||304===r.status||navigator.userAgent.indexOf("Safari")>-1&&"undefined"==typeof r.status?t(r.responseText):n(),document.documentElement.style.cursor="",r=null)},r.send("")},l=function(e){return e=e.replace(t.REDUNDANT_COMPONENTS,""),e=e.replace(t.REDUNDANT_WHITESPACE,"$1"),e=e.replace(t.MORE_WHITESPACE," "),e=e.replace(t.FINAL_SEMICOLONS,"}")},c={mediaQueryList:function(e){var n={},r=e.indexOf("{"),i=e.substring(0,r);e=e.substring(r+1,e.length-1);for(var o=[],s=[],u=i.toLowerCase().substring(7).split(","),a=0;a<u.length;a++)o[o.length]=c.mediaQuery(u[a],n);var l=e.match(t.BLOCKS_INSIDE);if(null!==l)for(a=0;a<l.length;a++)s[s.length]=c.rule(l[a],n);return n.getMediaQueries=function(){return o},n.getRules=function(){return s},n.getListText=function(){return i},n.getCssText=function(){return e},n},mediaQuery:function(e,n){e=e||"";for(var r,i=!1,o=[],s=!0,u=e.match(t.NOT_WHITESPACE),a=0;a<u.length;a++){var l=u[a];if(r||"not"!==l&&"only"!==l)if(r){if("("===l.charAt(0)){var c=l.substring(1,l.length-1).split(":");o[o.length]={mediaFeature:c[0],value:c[1]||null}}}else r=l;else"not"===l&&(i=!0)}return{getList:function(){return n||null},getValid:function(){return s},getNot:function(){return i},getMediaType:function(){return r},getExpressions:function(){return o}}},rule:function(e,t){for(var n={},r=e.indexOf("{"),i=e.substring(0,r),o=i.split(","),s=[],u=e.substring(r+1,e.length-1).split(";"),a=0;a<u.length;a++)s[s.length]=c.declaration(u[a],n);return n.getMediaQueryList=function(){return t||null},n.getSelectors=function(){return o},n.getSelectorText=function(){return i},n.getDeclarations=function(){return s},n.getPropertyValue=function(e){for(var t=0;t<s.length;t++)if(s[t].getProperty()===e)return s[t].getValue();return null},n},declaration:function(e,t){var n=e.indexOf(":"),r=e.substring(0,n),i=e.substring(n+1);return{getRule:function(){return t||null},getProperty:function(){return r},getValue:function(){return i}}}},d=function(n){if("string"==typeof n.cssHelperText){var r={mediaQueryLists:[],rules:[],selectors:{},declarations:[],properties:{}},i=r.mediaQueryLists,o=r.rules,s=n.cssHelperText.match(t.BLOCKS);if(null!==s)for(var u=0;u<s.length;u++)"@media "===s[u].substring(0,7)?(i[i.length]=c.mediaQueryList(s[u]),o=r.rules=o.concat(i[i.length-1].getRules())):o[o.length]=c.rule(s[u]);var a=r.selectors,l=function(e){for(var t=e.getSelectors(),n=0;n<t.length;n++){var r=t[n];a[r]||(a[r]=[]),a[r][a[r].length]=e}};for(u=0;u<o.length;u++)l(o[u]);var d=r.declarations;for(u=0;u<o.length;u++)d=r.declarations=d.concat(o[u].getDeclarations());var f=r.properties;for(u=0;u<d.length;u++){var g=d[u].getProperty();f[g]||(f[g]=[]),f[g][f[g].length]=d[u]}return n.cssHelperParsed=r,e[e.length]=n,r}},f=function(e,t){return e.cssHelperText=l(t||e.innerHTML),d(e)},g=function(){n=!0,e=[];for(var r=[],i=function(){for(var e=0;e<r.length;e++)d(r[e]);var t=document.getElementsByTagName("style");for(e=0;e<t.length;e++)f(t[e]);n=!1,o()},s=document.getElementsByTagName("link"),u=0;u<s.length;u++){var c=s[u];c.getAttribute("rel").indexOf("style")>-1&&c.href&&0!==c.href.length&&!c.disabled&&(r[r.length]=c)}if(r.length>0){var g=0,m=function(){g++,g===r.length&&i()},p=function(e){var n=e.href;a(n,function(r){r=l(r).replace(t.RELATIVE_URLS,"url("+n.substring(0,n.lastIndexOf("/"))+"/$1)"),e.cssHelperText=r,m()},m)};for(u=0;u<r.length;u++)p(r[u])}else i()},m={mediaQueryLists:"array",rules:"array",selectors:"object",declarations:"array",properties:"object"},p={mediaQueryLists:null,rules:null,selectors:null,declarations:null,properties:null},h=function(e,t){if(null!==p[e]){if("array"===m[e])return p[e]=p[e].concat(t);var n=p[e];for(var r in t)t.hasOwnProperty(r)&&(n[r]=n[r]?n[r].concat(t[r]):t[r]);return n}},y=function(t){p[t]="array"===m[t]?[]:{};for(var n=0;n<e.length;n++)h(t,e[n].cssHelperParsed[t]);return p[t]};domReady(function(){for(var e=document.body.getElementsByTagName("*"),t=0;t<e.length;t++)e[t].checkedByCssHelper=!0;document.implementation.hasFeature("MutationEvents","2.0")||window.MutationEvent?document.body.addEventListener("DOMNodeInserted",function(e){var t=e.target;1===t.nodeType&&(u("DOMElementInserted",t),t.checkedByCssHelper=!0)},!1):setInterval(function(){for(var e=document.body.getElementsByTagName("*"),t=0;t<e.length;t++)e[t].checkedByCssHelper||(u("DOMElementInserted",e[t]),e[t].checkedByCssHelper=!0)},1e3)});var v=function(e){return"undefined"!=typeof window.innerWidth?window["inner"+e]:"undefined"!=typeof document.documentElement&&"undefined"!=typeof document.documentElement.clientWidth&&0!=document.documentElement.clientWidth?document.documentElement["client"+e]:void 0};return{addStyle:function(e,t){var n=document.createElement("style");return n.setAttribute("type","text/css"),document.getElementsByTagName("head")[0].appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e)),n.addedWithCssHelper=!0,"undefined"==typeof t||t===!0?cssHelper.parsed(function(){var t=f(n,e);for(var r in t)t.hasOwnProperty(r)&&h(r,t[r]);u("newStyleParsed",n)}):n.parsingDisallowed=!0,n},removeStyle:function(e){return e.parentNode.removeChild(e)},parsed:function(t){n?i(t):"undefined"!=typeof e?"function"==typeof t&&t(e):(i(t),g())},mediaQueryLists:function(e){cssHelper.parsed(function(){e(p.mediaQueryLists||y("mediaQueryLists"))})},rules:function(e){cssHelper.parsed(function(){e(p.rules||y("rules"))})},selectors:function(e){cssHelper.parsed(function(){e(p.selectors||y("selectors"))})},declarations:function(e){cssHelper.parsed(function(){e(p.declarations||y("declarations"))})},properties:function(e){cssHelper.parsed(function(){e(p.properties||y("properties"))})},broadcast:u,addListener:function(e,t){"function"==typeof t&&(s[e]||(s[e]={listeners:[]}),s[e].listeners[s[e].listeners.length]=t)},removeListener:function(e,t){if("function"==typeof t&&s[e])for(var n=s[e].listeners,r=0;r<n.length;r++)n[r]===t&&(n.splice(r,1),r-=1)},getViewportWidth:function(){return v("Width")},getViewportHeight:function(){return v("Height")}}}();domReady(function(){var e,t={LENGTH_UNIT:/[0-9]+(em|ex|px|in|cm|mm|pt|pc)$/,RESOLUTION_UNIT:/[0-9]+(dpi|dpcm)$/,ASPECT_RATIO:/^[0-9]+\/[0-9]+$/,ABSOLUTE_VALUE:/^[0-9]*(\.[0-9]+)*$/},n=[],r=function(){var e="css3-mediaqueries-test",t=document.createElement("div");t.id=e;var n=cssHelper.addStyle("@media all and (width) { #"+e+" { width: 1px !important; } }",!1);document.body.appendChild(t);var i=1===t.offsetWidth;return n.parentNode.removeChild(n),t.parentNode.removeChild(t),r=function(){return i},i},i=function(){e=document.createElement("div"),e.style.cssText="position:absolute;top:-9999em;left:-9999em;margin:0;border:none;padding:0;width:1em;font-size:1em;",document.body.appendChild(e),16!==e.offsetWidth&&(e.style.fontSize=16/e.offsetWidth+"em"),e.style.width=""},o=function(t){e.style.width=t;var n=e.offsetWidth;return e.style.width="",n},s=function(e,n){var r=e.length,i="min-"===e.substring(0,4),s=!i&&"max-"===e.substring(0,4);if(null!==n){var u,a;if(t.LENGTH_UNIT.exec(n))u="length",a=o(n);else if(t.RESOLUTION_UNIT.exec(n)){u="resolution",a=parseInt(n,10);var l=n.substring((a+"").length)}else t.ASPECT_RATIO.exec(n)?(u="aspect-ratio",a=n.split("/")):t.ABSOLUTE_VALUE?(u="absolute",a=n):u="unknown"}var c,d;if("device-width"===e.substring(r-12,r))return c=screen.width,null!==n?"length"===u?i&&c>=a||s&&a>c||!i&&!s&&c===a:!1:c>0;if("device-height"===e.substring(r-13,r))return d=screen.height,null!==n?"length"===u?i&&d>=a||s&&a>d||!i&&!s&&d===a:!1:d>0;if("width"===e.substring(r-5,r))return c=document.documentElement.clientWidth||document.body.clientWidth,null!==n?"length"===u?i&&c>=a||s&&a>c||!i&&!s&&c===a:!1:c>0;if("height"===e.substring(r-6,r))return d=document.documentElement.clientHeight||document.body.clientHeight,null!==n?"length"===u?i&&d>=a||s&&a>d||!i&&!s&&d===a:!1:d>0;if("device-aspect-ratio"===e.substring(r-19,r))return"aspect-ratio"===u&&screen.width*a[1]===screen.height*a[0];if("color-index"===e.substring(r-11,r)){var f=Math.pow(2,screen.colorDepth);return null!==n?"absolute"===u?i&&f>=a||s&&a>f||!i&&!s&&f===a:!1:f>0}if("color"===e.substring(r-5,r)){var g=screen.colorDepth;return null!==n?"absolute"===u?i&&g>=a||s&&a>g||!i&&!s&&g===a:!1:g>0}if("resolution"===e.substring(r-10,r)){var m;return m="dpcm"===l?o("1cm"):o("1in"),null!==n?"resolution"===u?i&&m>=a||s&&a>m||!i&&!s&&m===a:!1:m>0}return!1},u=function(e){var t=e.getValid(),n=e.getExpressions(),r=n.length;if(r>0){for(var i=0;r>i&&t;i++)t=s(n[i].mediaFeature,n[i].value);var o=e.getNot();return t&&!o||o&&!t}},a=function(e){for(var t=e.getMediaQueries(),r={},i=0;i<t.length;i++)u(t[i])&&(r[t[i].getMediaType()]=!0);var o=[],s=0;for(var a in r)r.hasOwnProperty(a)&&(s>0&&(o[s++]=","),o[s++]=a);o.length>0&&(n[n.length]=cssHelper.addStyle("@media "+o.join("")+"{"+e.getCssText()+"}",!1))},l=function(e){for(var t=0;t<e.length;t++)a(e[t]);ua.ie?(document.documentElement.style.display="block",setTimeout(function(){document.documentElement.style.display=""},0),setTimeout(function(){cssHelper.broadcast("cssMediaQueriesTested")},100)):cssHelper.broadcast("cssMediaQueriesTested")},c=function(){for(var e=0;e<n.length;e++)cssHelper.removeStyle(n[e]);n=[],cssHelper.mediaQueryLists(l)},d=0,f=function(){var e=cssHelper.getViewportWidth(),t=cssHelper.getViewportHeight();if(ua.ie){var n=document.createElement("div");n.style.position="absolute",n.style.top="-9999em",n.style.overflow="scroll",document.body.appendChild(n),d=n.offsetWidth-n.clientWidth,document.body.removeChild(n)}var i,o=function(){var n=cssHelper.getViewportWidth(),o=cssHelper.getViewportHeight();(Math.abs(n-e)>d||Math.abs(o-t)>d)&&(e=n,t=o,clearTimeout(i),i=setTimeout(function(){r()?cssHelper.broadcast("cssMediaQueriesTested"):c()},500))};window.onresize=function(){var e=window.onresize||function(){};return function(){e(),o()}}()},g=document.documentElement;return g.style.marginLeft="-32767px",setTimeout(function(){g.style.marginTop=""},2e4),function(){r()?g.style.marginLeft="":(cssHelper.addListener("newStyleParsed",function(e){l(e.cssHelperParsed.mediaQueryLists)}),cssHelper.addListener("cssMediaQueriesTested",function(){ua.ie&&(g.style.width="1px"),setTimeout(function(){g.style.width="",g.style.marginLeft=""},0),cssHelper.removeListener("cssMediaQueriesTested",arguments.callee)}),i(),c()),f()}}());try{document.execCommand("BackgroundImageCache",!1,!0)}catch(e){} |