1$(document).ready(function() { 2 3 /* Difinimos variables */ 4 var url_base = urlofdoc ('styleswitcher.js'); 5 var url_css = url_base + "css/"; 6 var colorLink = $("link[href|= '" + url_css + "style']"); 7 var widthLink = $("link[href|= '" + url_css + "width']"); 8 var switchCheck = $('input[name="full-width-checkbox"]'); 9 10 // Comprobamos si ya hay cookies establecidas 11 if($.cookie("reason-color-wp")) { 12 colorLink.attr("href", url_css + $.cookie("reason-color-wp")); 13 } 14 15 if($.cookie("reason-width-wp")) { 16 widthLink.attr("href", url_css + $.cookie("reason-width-wp")); 17 18 if ($.cookie("reason-width-wp") == "width-boxed.css" && switchCheck.bootstrapSwitch('state')) { 19 switchCheck.bootstrapSwitch('state', false); 20 } 21 } 22 23 if($.cookie("reason-header-wp")) { 24 header_style ($.cookie("reason-header-wp")); 25 $("#" + $.cookie("reason-header-wp") + "-radio").attr('checked', true); 26 } 27 28 if($.cookie("reason-navbar-wp")) { 29 navbar_style ($.cookie("reason-navbar-wp")); 30 $("#" + $.cookie("reason-navbar-wp") + "-radio").attr('checked', true); 31 } 32 33 34 // Comprobamos si hay cambios en los controles 35 $("#color-options .color-box").click(function() { 36 colorLink.attr("href", url_css + $(this).attr('rel')); 37 colorLink.attr("href", url_css + $(this).attr('rel')); 38 $.cookie("reason-color-wp", $(this).attr('rel'), {expires: 7, path: '/'}); 39 return false; 40 }); 41 42 switchCheck.on('switchChange.bootstrapSwitch', function(event, state) { 43 if (state) { 44 widthLink.attr("href", url_css + "width-full.css"); 45 $.cookie("reason-width-wp", "width-full.css", {expires: 7, path: '/'}); 46 } 47 else { 48 widthLink.attr("href", url_css + "width-boxed.css"); 49 $.cookie("reason-width-wp", "width-boxed.css", {expires: 7, path: '/'}); 50 } 51 }); 52 53 $('#header-option input').on('change', function() { 54 var header_class = $('input[name="headerRadio"]:checked', '#header-option').val(); 55 header_style (header_class); 56 $.cookie("reason-header-wp", header_class, {expires: 7, path: '/'}); 57 }); 58 59 $('#navbar-option input').on('change', function() { 60 var navbar_class = $('input[name="navbarRadio"]:checked', '#navbar-option').val(); 61 navbar_style (navbar_class); 62 $.cookie("reason-navbar-wp", navbar_class, {expires: 7, path: '/'}); 63 }); 64 65}); 66 67function header_style (header_class) { 68 if (header_class == "no-header") { 69 $("#header-full-top").addClass("hidden-sm hidden-md hidden-lg"); 70 71 $("#header").removeClass('navbar-header-full'); 72 $("#ar-brand").removeClass("hidden-lg hidden-md hidden-sm"); 73 $("#bs-example-navbar-collapse-1").addClass("navbar-right"); 74 } 75 76 else { 77 $("#header").addClass('navbar-header-full'); 78 $("#ar-brand").addClass("hidden-lg hidden-md hidden-sm"); 79 $("#bs-example-navbar-collapse-1").removeClass("navbar-right"); 80 81 if (header_class == "header-full") { 82 $("#header-full-top").removeClass("header-full-dark hidden-sm hidden-md hidden-lg"); 83 $("#header-full-top").addClass("header-full"); 84 } 85 86 else if (header_class == "header-full-dark") { 87 $("#header-full-top").removeClass("header-full hidden-sm hidden-md hidden-lg"); 88 $("#header-full-top").addClass("header-full-dark"); 89 } 90 } 91} 92 93function navbar_style(navbar_class) { 94 if(navbar_class == "navbar-light") { 95 $("#header").addClass('navbar-light'); 96 $("#header").removeClass('navbar-dark navbar-inverse'); 97 } 98 99 else if(navbar_class == "navbar-dark") { 100 $("#header").addClass('navbar-dark'); 101 $("#header").removeClass('navbar-light navbar-inverse'); 102 } 103 104 else if(navbar_class == "navbar-inverse") { 105 $("#header").addClass('navbar-inverse'); 106 $("#header").removeClass('navbar-dark navbar-light'); 107 } 108} 109 110 111function urlofdoc (jsfile) { 112 var i, element, myfile, myurl; 113 var scriptElement = $("script[src*='styleswitcher.js']"); 114 115 myfile = scriptElement.attr("src"); 116 117 if(myfile.indexOf( jsfile ) >= 0) { 118 myurl = myfile.substring( 0, myfile.indexOf( jsfile )-3); 119 } 120 121 return myurl; 122}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.