Sha256: b309bf6163ba80e69b4d79c31bb36cd1f814566f6829f2334ba9fbb8a025a8a5
Contents?: true
Size: 1.55 KB
Versions: 1
Compression:
Stored size: 1.55 KB
Contents
(function (window, documentElement) { var cookieValidity = 365, cookieDomain = location.host.toString().split('.').slice(-2).join('.'), isRetina = (window.devicePixelRatio || 1.0) >= 1.5; var getCookie = function (name) { return (result = new RegExp('(?:^|; )_' + name + '=([^;]*)').exec(document.cookie)) ? result[1] : null; } var setCookie = function (name, value) { var expires = new Date(); expires.setDate(expires.getDate() + cookieValidity); document.cookie = [ '_' + name, '=', String(value), '; expires=' + expires.toUTCString(), '; domain=' + cookieDomain, '; path=/' ].join(''); }; var setSize = function () { setCookie('width', window.innerWidth || documentElement.clientWidth); }; var addEventHandlerTo = function (element, type, handler) { if (element.addEventListener) { element.addEventListener(type, handler, false); } else if (element.attachEvent) { element.attachEvent('on' + type, handler); } }; var oldRetina = getCookie('retina'), oldWidth = getCookie('width'); setCookie('retina', isRetina ? 1 : 0); setSize(); var cookiesWork = getCookie('retina') !== null, retinaChanged = oldRetina !== getCookie('retina'), widthChanged = oldWidth !== getCookie('width'); if (cookiesWork && (retinaChanged || widthChanged)) { document.documentElement.className += ' artwork-reload-splash'; window.location.reload(true); return; } addEventHandlerTo(window, 'resize', setSize); })(window, document.documentElement);
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
artwork-0.5.0 | lib/assets/javascripts/artwork.js |