Файловый менеджер - Редактировать - /home/wuectly/www/03cbe/javascript.tar
Назад
hide.js 0000604 00000021000 15245530373 0006007 0 ustar 00 // Angie Radtke 2009 - 2012 thanks to daniel // /*global window, localStorage, Cookie, altopen, altclose, big, small, rightopen, rightclose, bildauf, bildzu */ function saveIt(name) { var x = document.getElementById(name).style.display; if (!x) { alert('No cookie available'); } else if (localStorage) { localStorage[name] = x; } } function readIt(name) { if (localStorage) { return localStorage[name]; } } function wrapperwidth(width) { jQuery('#wrapper').css('width', width); } // add Wai-Aria landmark-roles jQuery(function($) { $('#nav').attr('role', 'navigation'); $('input[id^="mod-search-searchword"]').closest('form').attr('role', 'search'); $('#main').attr('role', 'main'); $('#right').attr('role', 'contentinfo'); }); jQuery(function($) { // get ankers var $myankers = $('a.opencloselink'); $myankers.each(function() { var $element = $(this); $element.attr('role', 'tab'); var myid = $element.attr('id'); myid = myid.split('_'); myid = 'module_' + myid[1]; $element.attr('aria-controls', myid); }); var $list = $('div.moduletable_js'); $list.each(function() { var $element = $(this); if ($element.find('div.module_content').length) { var $el = $element.find('div.module_content'); $el.attr('role', 'tabpanel'); var myid = $el.attr('id'); myid = myid.split('_'); myid = 'link_' + myid[1]; $el.attr('aria-labelledby', myid); var myclass = $el.attr('class'); var one = myclass.split(' '); // search for active menu-item var $listelement = $el.find('a.active').first(); var unique = $el.attr('id'); var nocookieset = readIt(unique); if (($listelement.length) || ((one[1] == 'open') && (nocookieset == null))) { $el.show(); var $eltern = $el.parent(); var $elternh = $eltern.find('h3').first(); var $elternbild = $eltern.find('img').first(); $elternbild.attr('alt', altopen).attr('src', bildzu); $elternbild.focus(); } else { $el.hide(); $el.attr('aria-expanded', 'false'); } unique = $el.attr('id'); var cookieset = readIt(unique); if (cookieset === 'block') { $el.show(); $el.attr('aria-expanded', 'true'); } } }); }); jQuery(function($) { var $what = $('#right'); // if rightcolumn if ($what.length) { var whatid = $what.attr('id'); var rightcookie = readIt(whatid); if (rightcookie === 'none') { $what.hide(); $('#nav').addClass('leftbigger'); wrapperwidth(big); var $grafik = $('#bild'); $grafik.html(rightopen); $grafik.focus(); } } }); function auf(key) { var $ = jQuery.noConflict(); var $el = $('#' + key); if (!$el.is(':visible')) { $el.show(); $el.attr('aria-expanded', 'true'); if (key !== 'right') { $el.hide().toggle('slide'); $el.parent().attr('class', 'slide'); $eltern = $el.parent().parent(); $elternh = $eltern.find('h3').first(); $elternh.addClass('high'); $elternbild = $eltern.find('img').first(); $el.focus(); $elternbild.attr('alt', altopen).attr('src', bildzu); } if (key === 'right') { $('#right').show(); wrapperwidth(small); $('#nav').removeClass('leftbigger'); $grafik = $('#bild'); $('#bild').html(rightclose); $grafik.focus(); } } else { $el.hide(); $el.attr('aria-expanded', 'false'); $el.removeClass('open'); if (key !== 'right') { $eltern = $el.parent().parent(); $elternh = $eltern.find('h3').first(); $elternh.removeClass('high'); $elternbild = $eltern.find('img').first(); $elternbild.attr('alt', altclose).attr('src', bildauf); $elternbild.focus(); } if (key === 'right') { $('#right').hide(); wrapperwidth(big); $('#nav').addClass('leftbigger'); $grafik = $('#bild'); $grafik.html(rightopen); $grafik.focus(); } } // write cookie saveIt(key); } // ########### Tabfunctions #################### jQuery(function($) { var $alldivs = $('div.tabcontent'); var $outerdivs = $('div.tabouter'); //outerdivs = outerdivs.getProperty('id'); $outerdivs.each(function() { var $alldivs = $(this).find('div.tabcontent'); var count = 0; var countankers = 0; $alldivs.each(function() { var $el = $(this); count++; $el.attr('role', 'tabpanel'); $el.attr('aria-hidden', 'false'); $el.attr('aria-expanded', 'true'); elid = $el.attr('id'); elid = elid.split('_'); elid = 'link_' + elid[1]; $el.attr('aria-labelledby', elid); if (count !== 1) { $el.addClass('tabclosed').removeClass('tabopen'); $el.attr('aria-hidden', 'true'); $el.attr('aria-expanded', 'false'); } }); $allankers = $(this).find('ul.tabs').first().find('a'); $allankers.each(function() { countankers++; var $el = $(this); $el.attr('aria-selected', 'true'); $el.attr('role', 'tab'); linkid = $el.attr('id'); moduleid = linkid.split('_'); moduleid = 'module_' + moduleid[1]; $el.attr('aria-controls', moduleid); if (countankers != 1) { $el.addClass('linkclosed').removeClass('linkopen'); $el.attr('aria-selected', 'false'); } }); }); }); function tabshow(elid) { var $ = jQuery.noConflict(); var $el = $('#' + elid); var $outerdiv = $el.parent(); var $alldivs = $outerdiv.find('div.tabcontent'); var $liste = $outerdiv.find('ul.tabs').first(); $liste.find('a').attr('aria-selected', 'false'); $alldivs.each(function() { var $element = $(this); $element.addClass('tabclosed').removeClass('tabopen'); $element.attr('aria-hidden', 'true'); $element.attr('aria-expanded', 'false'); }); $el.addClass('tabopen').removeClass('tabclosed'); $el.attr('aria-hidden', 'false'); $el.attr('aria-expanded', 'true'); $el.focus(); var getid = elid.split('_'); var activelink = '#link_' + getid[1]; $(activelink).attr('aria-selected', 'true'); $liste.find('a').addClass('linkclosed').removeClass('linkopen'); $(activelink).addClass('linkopen').removeClass('linkclosed'); } function nexttab(el) { var $ = jQuery.noConflict(); var $outerdiv = $('#' + el).parent(); var $liste = $outerdiv.find('ul.tabs').first(); var getid = el.split('_'); var activelink = '#link_' + getid[1]; var aktiverlink = $(activelink).attr('aria-selected'); var $tablinks = $liste.find('a'); for (var i = 0; i < $tablinks.length; i++) { if ($($tablinks[i]).attr('id') === activelink) { if ($($tablinks[i + 1]).length) { $($tablinks[i + 1]).click(); break; } } } } // mobilemenuheader var mobileMenu = function(){ var $ = jQuery.noConflict(), displayed = false, $mobile, $menu, $menuWrapper; var getX = function() { return $(document).width(); }; var createElements = function () { var Openmenu=Joomla.JText._('TPL_BEEZ3_OPENMENU'); var Closemenu=Joomla.JText._('TPL_BEEZ3_CLOSEMENU'); $menu = $("#header").find('ul.menu').first(); $menuWrapper = $('<div>', {id : 'menuwrapper', role: 'menubar'}); // create the menu opener and assign events $mobile = $('<div>', {id: 'mobile_select'}).html('<h2><a href="#" id="menuopener" onclick="return false;"><span>'+Openmenu+'</span></a></h2>').show(); $mobile.on('click', function(){ var state = $menuWrapper.css('display'); $menuWrapper.slideToggle(); if (state === 'none') { $('#menuopener').html(Closemenu); $('#menuwrapper').attr('aria-expanded', 'true').attr('aria-hidden','false'); } else { $('#menuopener').html(Openmenu); $('#menuwrapper').attr('aria-expanded', 'false').attr('aria-hidden', 'true'); } }); // add the menu to the dom $menu.wrap($menuWrapper); // add the menuopener to the dom and hide it $('#header').find('#menuwrapper').first().before($mobile.hide()); $menuWrapper = $('#menuwrapper'); $mobile = $('#mobile_select'); }; var display = function () { $menuWrapper.hide(); $mobile.show(); displayed = true; }; var initialize = function () { // create the elements once createElements(); // show the elements if the browser size is smaller if (getX() <= 461 && !displayed) { display(); } // react on resize events $(window).on('resize', function () { if (getX() >= 461) { if (displayed) { $mobile.hide(); $('#menuwrapper').show(); displayed = false; } } if (getX() < 461) { if (!displayed) { display(); } } }); }; initialize(); }; jQuery(function () { new mobileMenu(); }); //For discussion and comments, see: http://remysharp.com/2009/01/07/html5-enabling-script/ (function(){if(!/*@cc_on!@*/0)return;var e = "abbr,article,aside,audio,canvas,datalist,details,eventsource,figure,footer,header,hgroup,mark,menu,meter,nav,output,progress,section,time,video".split(','),i=e.length;while(i--){document.createElement(e[i])}})() template.js 0000604 00000003642 15245530373 0006725 0 ustar 00 /** * @package Joomla.Site * @subpackage Templates.beez3 * @copyright (C) 2013 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt * @since 3.2 */ jQuery(function($) { 'use strict'; $(document).on('click', ".btn-group label:not(.active)", function() { var $label = $(this); var $input = $(document.getElementById($label.attr('for'))); if ($input.prop('checked')) { return; } $label.closest('.btn-group').find("label").removeClass('active btn-success btn-danger btn-primary'); var btnClass = 'primary'; if ($input.val() != '') { var reversed = $label.closest('.btn-group').hasClass('btn-group-reversed'); btnClass = ($input.val() == 0 ? !reversed : reversed) ? 'danger' : 'success'; } $label.addClass('active btn-' + btnClass); $input.prop('checked', true).trigger('change'); }) .on('subform-row-add', initButtonGroup) .on('subform-row-add', initTooltip); initButtonGroup(); initTooltip(); // Called once on domready, again when a subform row is added function initTooltip(event, container) { $(container || document).find('*[rel=tooltip]').tooltip(); } // Called once on domready, again when a subform row is added function initButtonGroup(event, container) { var $container = $(container || document); // Turn radios into btn-group $container.find('.radio.btn-group label').addClass('btn'); // Setup coloring for buttons $container.find('.btn-group input:checked').each(function() { var $input = $(this); var $label = $(document.querySelector('label[for=' + $input.attr('id') + ']')); var btnClass = 'primary'; if ($input.val() != '') { var reversed = $input.parent().hasClass('btn-group-reversed'); btnClass = ($input.val() == 0 ? !reversed : reversed) ? 'danger' : 'success'; } $label.addClass('active btn-' + btnClass); }); } }); md_stylechanger.js 0000604 00000004621 15245530373 0010260 0 ustar 00 /*global window, localStorage, fontSizeTitle, bigger, reset, smaller, biggerTitle, resetTitle, smallerTitle, Cookie */ var prefsLoaded = false; var defaultFontSize = 100; var currentFontSize = defaultFontSize; Object.append(Browser.Features, { localstorage: (function() { return ('localStorage' in window) && window.localStorage !== null; })() }); function setFontSize(fontSize) { document.body.style.fontSize = fontSize + '%'; } function changeFontSize(sizeDifference) { currentFontSize = parseInt(currentFontSize, 10) + parseInt(sizeDifference * 5, 10); if (currentFontSize > 180) { currentFontSize = 180; } else if (currentFontSize < 60) { currentFontSize = 60; } setFontSize(currentFontSize); } function revertStyles() { currentFontSize = defaultFontSize; changeFontSize(0); } function writeFontSize(value) { if (Browser.Features.localstorage) { localStorage.fontSize = value; } else { Cookie.write("fontSize", value, {duration: 180}); } } function readFontSize() { if (Browser.Features.localstorage) { return localStorage.fontSize; } else { return Cookie.read("fontSize"); } } function setUserOptions() { if (!prefsLoaded) { var size = readFontSize(); currentFontSize = size ? size : defaultFontSize; setFontSize(currentFontSize); prefsLoaded = true; } } function addControls() { var container = document.id('fontsize'); var content = '<h3>'+ fontSizeTitle +'</h3><p><a title="'+ biggerTitle +'" href="#" onclick="changeFontSize(2); return false">'+ bigger +'</a><span class="unseen">.</span><a href="#" title="'+resetTitle+'" onclick="revertStyles(); return false">'+ reset +'</a><span class="unseen">.</span><a href="#" title="'+ smallerTitle +'" onclick="changeFontSize(-2); return false">'+ smaller +'</a></p>'; container.set('html', content); } function saveSettings() { writeFontSize(currentFontSize); } window.addEvent('domready', function () { smaller = Joomla.JText._('TPL_BEEZ3_SMALLER'); fontSizeTitle = Joomla.JText._('TPL_BEEZ3_FONTSIZE'); bigger = Joomla.JText._('TPL_BEEZ3_BIGGER'); reset = Joomla.JText._('TPL_BEEZ3_RESET'); biggerTitle = Joomla.JText._('TPL_BEEZ3_INCREASE_SIZE'); smallerTitle = Joomla.JText._('TPL_BEEZ3_DECREASE_SIZE'); resetTitle = Joomla.JText._('TPL_BEEZ3_REVERT_STYLES_TO_DEFAULT'); }); window.addEvent('domready', setUserOptions); window.addEvent('domready', addControls); window.addEvent('unload', saveSettings); respond.js 0000604 00000022434 15245530373 0006564 0 ustar 00 /*! matchMedia() polyfill - Test a CSS media type/query in JS. Authors & copyright (c) 2012: Scott Jehl, Paul Irish, Nicholas Zakas. Dual MIT/BSD license */ /*! NOTE: If you're already including a window.matchMedia polyfill via Modernizr or otherwise, you don't need this part */ window.matchMedia = window.matchMedia || (function(doc, undefined){ var bool, docElem = doc.documentElement, refNode = docElem.firstElementChild || docElem.firstChild, // fakeBody required for <FF4 when executed in <head> fakeBody = doc.createElement('body'), div = doc.createElement('div'); div.id = 'mq-test-1'; div.style.cssText = "position:absolute;top:-100em"; fakeBody.style.background = "none"; fakeBody.appendChild(div); return function(q){ div.innerHTML = '­<style media="'+q+'"> #mq-test-1 { width: 42px; }</style>'; docElem.insertBefore(fakeBody, refNode); bool = div.offsetWidth == 42; docElem.removeChild(fakeBody); return { matches: bool, media: q }; }; })(document); /*! Respond.js v1.1.0: min/max-width media query polyfill. (c) Scott Jehl. MIT/GPLv2 Lic. j.mp/respondjs */ (function( win ){ //exposed namespace win.respond = {}; //define update even in native-mq-supporting browsers, to avoid errors respond.update = function(){}; //expose media query support flag for external use respond.mediaQueriesSupported = win.matchMedia && win.matchMedia( "only all" ).matches; //if media queries are supported, exit here if ( respond.mediaQueriesSupported ){ return; } //define vars var doc = win.document, docElem = doc.documentElement, mediastyles = [], rules = [], appendedEls = [], parsedSheets = {}, resizeThrottle = 30, head = doc.getElementsByTagName( "head" )[0] || docElem, base = doc.getElementsByTagName( "base" )[0], links = head.getElementsByTagName( "link" ), requestQueue = [], // Loop stylesheets, send text content to translate ripCSS = function(){ var sheets = links, sl = sheets.length, i = 0, // Vars for loop: sheet, href, media, isCSS; for( ; i < sl; i++ ){ sheet = sheets[ i ], href = sheet.href, media = sheet.media, isCSS = sheet.rel && sheet.rel.toLowerCase() === "stylesheet"; // Only links plz and prevent re-parsing if ( !!href && isCSS && !parsedSheets[ href ] ){ // Selectivizr exposes css through the rawCssText expando if (sheet.styleSheet && sheet.styleSheet.rawCssText) { translate( sheet.styleSheet.rawCssText, href, media ); parsedSheets[ href ] = true; } else { if ( (!/^([a-zA-Z:]*\/\/)/.test( href ) && !base) || href.replace( RegExp.$1, "" ).split( "/" )[0] === win.location.host ){ requestQueue.push( { href: href, media: media } ); } } } } makeRequests(); }, // Recurse through request queue, get css text makeRequests = function(){ if ( requestQueue.length ){ var thisRequest = requestQueue.shift(); ajax( thisRequest.href, function( styles ){ translate( styles, thisRequest.href, thisRequest.media ); parsedSheets[ thisRequest.href ] = true; makeRequests(); } ); } }, // Find media blocks in css text, convert to style blocks translate = function( styles, href, media ){ var qs = styles.match( /@media[^\{]+\{([^\{\}]*\{[^\}\{]*\})+/gi ), ql = qs && qs.length || 0, // Try to get CSS path href = href.substring( 0, href.lastIndexOf( "/" )), repUrls = function( css ){ return css.replace( /(url\()['"]?([^\/\)'"][^:\)'"]+)['"]?(\))/g, "$1" + href + "$2$3" ); }, useMedia = !ql && media, // Vars used in loop i = 0, j, fullq, thisq, eachq, eql; // If path exists, tack on trailing slash if ( href.length ){ href += "/"; } /* If no internal queries exist, but media attr does, use that * note: this currently lacks support for situations where a media attr is specified on a link AND * its associated stylesheet has internal CSS media queries. * In those cases, the media attribute will currently be ignored. */ if ( useMedia ){ ql = 1; } for( ; i < ql; i++ ){ j = 0; // Media attr if ( useMedia ){ fullq = media; rules.push( repUrls( styles ) ); } // Parse for styles else{ fullq = qs[ i ].match( /@media *([^\{]+)\{([\S\s]+?)$/ ) && RegExp.$1; rules.push( RegExp.$2 && repUrls( RegExp.$2 ) ); } eachq = fullq.split( "," ); eql = eachq.length; for( ; j < eql; j++ ){ thisq = eachq[ j ]; mediastyles.push( { media : thisq.split( "(" )[ 0 ].match( /(only\s+)?([a-zA-Z]+)\s?/ ) && RegExp.$2 || "all", rules : rules.length - 1, hasquery : thisq.indexOf("(") > -1, minw : thisq.match( /\(min\-width:[\s]*([\s]*[0-9\.]+)(px|em)[\s]*\)/ ) && parseFloat( RegExp.$1 ) + ( RegExp.$2 || "" ), maxw : thisq.match( /\(max\-width:[\s]*([\s]*[0-9\.]+)(px|em)[\s]*\)/ ) && parseFloat( RegExp.$1 ) + ( RegExp.$2 || "" ) } ); } } applyMedia(); }, lastCall, resizeDefer, // Returns the value of 1em in pixels getEmValue = function() { var ret, div = doc.createElement('div'), body = doc.body, fakeUsed = false; div.style.cssText = "position:absolute;font-size:1em;width:1em"; if ( !body ){ body = fakeUsed = doc.createElement( "body" ); body.style.background = "none"; } body.appendChild( div ); docElem.insertBefore( body, docElem.firstChild ); ret = div.offsetWidth; if ( fakeUsed ){ docElem.removeChild( body ); } else { body.removeChild( div ); } // Also update eminpx before returning ret = eminpx = parseFloat(ret); return ret; }, // Cached container for 1em value, populated the first time it's needed eminpx, // Enable/disable styles applyMedia = function( fromResize ){ var name = "clientWidth", docElemProp = docElem[ name ], currWidth = doc.compatMode === "CSS1Compat" && docElemProp || doc.body[ name ] || docElemProp, styleBlocks = {}, lastLink = links[ links.length-1 ], now = (new Date()).getTime(); // Throttle resize calls if ( fromResize && lastCall && now - lastCall < resizeThrottle ){ clearTimeout( resizeDefer ); resizeDefer = setTimeout( applyMedia, resizeThrottle ); return; } else { lastCall = now; } for( var i in mediastyles ){ var thisstyle = mediastyles[ i ], min = thisstyle.minw, max = thisstyle.maxw, minnull = min === null, maxnull = max === null, em = "em"; if ( !!min ){ min = parseFloat( min ) * ( min.indexOf( em ) > -1 ? ( eminpx || getEmValue() ) : 1 ); } if ( !!max ){ max = parseFloat( max ) * ( max.indexOf( em ) > -1 ? ( eminpx || getEmValue() ) : 1 ); } // If there's no media query at all (the () part), or min or max is not null, and if either is present, they're true if ( !thisstyle.hasquery || ( !minnull || !maxnull ) && ( minnull || currWidth >= min ) && ( maxnull || currWidth <= max ) ){ if ( !styleBlocks[ thisstyle.media ] ){ styleBlocks[ thisstyle.media ] = []; } styleBlocks[ thisstyle.media ].push( rules[ thisstyle.rules ] ); } } // Remove any existing respond style element(s) for( var i in appendedEls ){ if ( appendedEls[ i ] && appendedEls[ i ].parentNode === head ){ head.removeChild( appendedEls[ i ] ); } } // Inject active styles, grouped by media type for( var i in styleBlocks ){ var ss = doc.createElement( "style" ), css = styleBlocks[ i ].join( "\n" ); ss.type = "text/css"; ss.media = i; // Originally, ss was appended to a documentFragment and sheets were appended in bulk. // This caused crashes in IE in a number of circumstances, such as when the HTML element had a bg image set, so appending beforehand seems best. Thanks to @dvelyk for the initial research on this one! head.insertBefore( ss, lastLink.nextSibling ); if ( ss.styleSheet ){ ss.styleSheet.cssText = css; } else { ss.appendChild( doc.createTextNode( css ) ); } // Push to appendedEls to track for later removal appendedEls.push( ss ); } }, // Tweaked Ajax functions from Quirksmode ajax = function( url, callback ) { var req = xmlHttp(); if (!req){ return; } req.open( "GET", url, true ); req.onreadystatechange = function () { if ( req.readyState != 4 || req.status != 200 && req.status != 304 ){ return; } callback( req.responseText ); } if ( req.readyState == 4 ){ return; } req.send( null ); }, // Define ajax obj xmlHttp = (function() { var xmlhttpmethod = false; try { xmlhttpmethod = new XMLHttpRequest(); } catch( e ){ xmlhttpmethod = new ActiveXObject( "Microsoft.XMLHTTP" ); } return function(){ return xmlhttpmethod; }; })(); // Translate CSS ripCSS(); // Expose update for re-running respond later on respond.update = ripCSS; // Adjust on resize function callMedia(){ applyMedia( true ); } if ( win.addEventListener ){ win.addEventListener( "resize", callMedia, false ); } else if( win.attachEvent ){ win.attachEvent( "onresize", callMedia ); } })(this); respond.src.js 0000604 00000022411 15245530373 0007345 0 ustar 00 /*! matchMedia() polyfill - Test a CSS media type/query in JS. Authors & copyright (c) 2012: Scott Jehl, Paul Irish, Nicholas Zakas. Dual MIT/BSD license */ /*! NOTE: If you're already including a window.matchMedia polyfill via Modernizr or otherwise, you don't need this part */ window.matchMedia = window.matchMedia || (function(doc, undefined){ var bool, docElem = doc.documentElement, refNode = docElem.firstElementChild || docElem.firstChild, // fakeBody required for <FF4 when executed in <head> fakeBody = doc.createElement('body'), div = doc.createElement('div'); div.id = 'mq-test-1'; div.style.cssText = "position:absolute;top:-100em"; fakeBody.style.background = "none"; fakeBody.appendChild(div); return function(q){ div.innerHTML = '­<style media="'+q+'"> #mq-test-1 { width: 42px; }</style>'; docElem.insertBefore(fakeBody, refNode); bool = div.offsetWidth == 42; docElem.removeChild(fakeBody); return { matches: bool, media: q }; }; })(document); /*! Respond.js v1.1.0: min/max-width media query polyfill. (c) Scott Jehl. MIT/GPLv2 Lic. j.mp/respondjs */ (function( win ){ // Exposed namespace win.respond = {}; // Define update even in native-mq-supporting browsers, to avoid errors respond.update = function(){}; // Expose media query support flag for external use respond.mediaQueriesSupported = win.matchMedia && win.matchMedia( "only all" ).matches; // If media queries are supported, exit here if ( respond.mediaQueriesSupported ){ return; } // Define vars var doc = win.document, docElem = doc.documentElement, mediastyles = [], rules = [], appendedEls = [], parsedSheets = {}, resizeThrottle = 30, head = doc.getElementsByTagName( "head" )[0] || docElem, base = doc.getElementsByTagName( "base" )[0], links = head.getElementsByTagName( "link" ), requestQueue = [], // Loop stylesheets, send text content to translate ripCSS = function(){ var sheets = links, sl = sheets.length, i = 0, // Vars for loop: sheet, href, media, isCSS; for( ; i < sl; i++ ){ sheet = sheets[ i ], href = sheet.href, media = sheet.media, isCSS = sheet.rel && sheet.rel.toLowerCase() === "stylesheet"; //only links plz and prevent re-parsing if ( !!href && isCSS && !parsedSheets[ href ] ){ // selectivizr exposes css through the rawCssText expando if (sheet.styleSheet && sheet.styleSheet.rawCssText) { translate( sheet.styleSheet.rawCssText, href, media ); parsedSheets[ href ] = true; } else { if ( (!/^([a-zA-Z:]*\/\/)/.test( href ) && !base) || href.replace( RegExp.$1, "" ).split( "/" )[0] === win.location.host ){ requestQueue.push( { href: href, media: media } ); } } } } makeRequests(); }, // Recurse through request queue, get css text makeRequests = function(){ if ( requestQueue.length ){ var thisRequest = requestQueue.shift(); ajax( thisRequest.href, function( styles ){ translate( styles, thisRequest.href, thisRequest.media ); parsedSheets[ thisRequest.href ] = true; makeRequests(); } ); } }, // Find media blocks in css text, convert to style blocks translate = function( styles, href, media ){ var qs = styles.match( /@media[^\{]+\{([^\{\}]*\{[^\}\{]*\})+/gi ), ql = qs && qs.length || 0, // Try to get CSS path href = href.substring( 0, href.lastIndexOf( "/" )), repUrls = function( css ){ return css.replace( /(url\()['"]?([^\/\)'"][^:\)'"]+)['"]?(\))/g, "$1" + href + "$2$3" ); }, useMedia = !ql && media, // Vars used in loop i = 0, j, fullq, thisq, eachq, eql; // If path exists, tack on trailing slash if ( href.length ){ href += "/"; } //if no internal queries exist, but media attr does, use that //note: this currently lacks support for situations where a media attr is specified on a link AND //its associated stylesheet has internal CSS media queries. //In those cases, the media attribute will currently be ignored. if ( useMedia ){ ql = 1; } for( ; i < ql; i++ ){ j = 0; // Media attr if ( useMedia ){ fullq = media; rules.push( repUrls( styles ) ); } // Parse for styles else{ fullq = qs[ i ].match( /@media *([^\{]+)\{([\S\s]+?)$/ ) && RegExp.$1; rules.push( RegExp.$2 && repUrls( RegExp.$2 ) ); } eachq = fullq.split( "," ); eql = eachq.length; for( ; j < eql; j++ ){ thisq = eachq[ j ]; mediastyles.push( { media : thisq.split( "(" )[ 0 ].match( /(only\s+)?([a-zA-Z]+)\s?/ ) && RegExp.$2 || "all", rules : rules.length - 1, hasquery : thisq.indexOf("(") > -1, minw : thisq.match( /\(min\-width:[\s]*([\s]*[0-9\.]+)(px|em)[\s]*\)/ ) && parseFloat( RegExp.$1 ) + ( RegExp.$2 || "" ), maxw : thisq.match( /\(max\-width:[\s]*([\s]*[0-9\.]+)(px|em)[\s]*\)/ ) && parseFloat( RegExp.$1 ) + ( RegExp.$2 || "" ) } ); } } applyMedia(); }, lastCall, resizeDefer, // returns the value of 1em in pixels getEmValue = function() { var ret, div = doc.createElement('div'), body = doc.body, fakeUsed = false; div.style.cssText = "position:absolute;font-size:1em;width:1em"; if ( !body ){ body = fakeUsed = doc.createElement( "body" ); body.style.background = "none"; } body.appendChild( div ); docElem.insertBefore( body, docElem.firstChild ); ret = div.offsetWidth; if ( fakeUsed ){ docElem.removeChild( body ); } else { body.removeChild( div ); } // Also update eminpx before returning ret = eminpx = parseFloat(ret); return ret; }, // Cached container for 1em value, populated the first time it's needed eminpx, // Enable/disable styles applyMedia = function( fromResize ){ var name = "clientWidth", docElemProp = docElem[ name ], currWidth = doc.compatMode === "CSS1Compat" && docElemProp || doc.body[ name ] || docElemProp, styleBlocks = {}, lastLink = links[ links.length-1 ], now = (new Date()).getTime(); // Throttle resize calls if ( fromResize && lastCall && now - lastCall < resizeThrottle ){ clearTimeout( resizeDefer ); resizeDefer = setTimeout( applyMedia, resizeThrottle ); return; } else { lastCall = now; } for( var i in mediastyles ){ var thisstyle = mediastyles[ i ], min = thisstyle.minw, max = thisstyle.maxw, minnull = min === null, maxnull = max === null, em = "em"; if ( !!min ){ min = parseFloat( min ) * ( min.indexOf( em ) > -1 ? ( eminpx || getEmValue() ) : 1 ); } if ( !!max ){ max = parseFloat( max ) * ( max.indexOf( em ) > -1 ? ( eminpx || getEmValue() ) : 1 ); } // If there's no media query at all (the () part), or min or max is not null, and if either is present, they're true if ( !thisstyle.hasquery || ( !minnull || !maxnull ) && ( minnull || currWidth >= min ) && ( maxnull || currWidth <= max ) ){ if ( !styleBlocks[ thisstyle.media ] ){ styleBlocks[ thisstyle.media ] = []; } styleBlocks[ thisstyle.media ].push( rules[ thisstyle.rules ] ); } } // Remove any existing respond style element(s) for( var i in appendedEls ){ if ( appendedEls[ i ] && appendedEls[ i ].parentNode === head ){ head.removeChild( appendedEls[ i ] ); } } // Inject active styles, grouped by media type for( var i in styleBlocks ){ var ss = doc.createElement( "style" ), css = styleBlocks[ i ].join( "\n" ); ss.type = "text/css"; ss.media = i; // Originally, ss was appended to a documentFragment and sheets were appended in bulk. // This caused crashes in IE in a number of circumstances, such as when the HTML element had a bg image set, so appending beforehand seems best. Thanks to @dvelyk for the initial research on this one! head.insertBefore( ss, lastLink.nextSibling ); if ( ss.styleSheet ){ ss.styleSheet.cssText = css; } else{ ss.appendChild( doc.createTextNode( css ) ); } // Push to appendedEls to track for later removal appendedEls.push( ss ); } }, // Tweaked Ajax functions from Quirksmode ajax = function( url, callback ) { var req = xmlHttp(); if (!req){ return; } req.open( "GET", url, true ); req.onreadystatechange = function () { if ( req.readyState != 4 || req.status != 200 && req.status != 304 ){ return; } callback( req.responseText ); } if ( req.readyState == 4 ){ return; } req.send( null ); }, // Define ajax obj xmlHttp = (function() { var xmlhttpmethod = false; try { xmlhttpmethod = new XMLHttpRequest(); } catch( e ){ xmlhttpmethod = new ActiveXObject( "Microsoft.XMLHTTP" ); } return function(){ return xmlhttpmethod; }; })(); // Translate CSS ripCSS(); // Expose update for re-running respond later on respond.update = ripCSS; // Adjust on resize function callMedia(){ applyMedia( true ); } if ( win.addEventListener ){ win.addEventListener( "resize", callMedia, false ); } else if( win.attachEvent ){ win.attachEvent( "onresize", callMedia ); } })(this);
| ver. 1.4 |
Github
|
.
| PHP 8.1.34 | Генерация страницы: 0 |
proxy
|
phpinfo
|
Настройка