1/** STYLE SWITCHER 2*************************************************** **/ 3jQuery(document).ready(function() { 4 "use strict"; 5 6 jQuery("#hideSwitcher, #showSwitcher").click(function () { 7 8 if (jQuery("#showSwitcher").is(":visible")) { 9 10 var _identifier = "#showSwitcher"; 11 jQuery("#switcher").animate({"margin-left": "0px"}, 500).show(); 12 createCookie("switcher_visible", 'true', 365); 13 14 } else { 15 16 var _identifier = "#switcher"; 17 jQuery("#showSwitcher").show().animate({"margin-left": "0"}, 500); 18 createCookie("switcher_visible", 'false', 365); 19 20 } 21 22 jQuery(_identifier).animate({"margin-left": "-500px"}, 500, function () { 23 jQuery(this).hide(); 24 }); 25 26 }); 27 28}); 29 30function setActiveStyleSheet(title) { 31 var i, a, main; 32 for(i=0; (a = document.getElementsByTagName("link")[i]); i++) { 33 if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")) { 34 a.disabled = true; 35 if(a.getAttribute("title") == title) { a.disabled = false; } 36 } 37 } 38 39 // DARK SKIN 40 var color_skin = readCookie('color_skin'); 41 if(color_skin == 'dark') { 42 jQuery("#css_dark_skin").remove(); 43 jQuery("head").append('<link id="css_dark_skin" href="assets/css/layout-dark.css" rel="stylesheet" type="text/css" title="dark" />'); 44 jQuery("#is_dark").trigger('click'); 45 jQuery("a.logo img").attr('src', 'assets/images/logo_dark.png'); 46 } 47} 48 49function getActiveStyleSheet() { 50 var i, a; 51 for(i=0; (a = document.getElementsByTagName("link")[i]); i++) { 52 if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title") && !a.disabled) { return a.getAttribute("title"); } 53 } 54 55 return null; 56} 57 58function getPreferredStyleSheet() { 59 var i, a; 60 for(i=0; (a = document.getElementsByTagName("link")[i]); i++) { 61 if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("rel").indexOf("alt") == -1 && a.getAttribute("title")) { 62 return a.getAttribute("title"); 63 } 64 } 65 66 return null; 67} 68 69function createCookie(name,value,days) { 70 if (days) { 71 var date = new Date(); 72 date.setTime(date.getTime()+(days*24*60*60*1000)); 73 var expires = "; expires="+date.toGMTString(); 74 } else { 75 expires = ""; 76 } document.cookie = name+"="+value+expires+"; path=/"; 77} 78 79function readCookie(name) { 80 var nameEQ = name + "="; 81 var ca = document.cookie.split(';'); 82 for(var i=0;i < ca.length;i++) { 83 var c = ca[i]; 84 85 while (c.charAt(0)==' ') { 86 c = c.substring(1,c.length); 87 } 88 89 if (c.indexOf(nameEQ) == 0) { 90 return c.substring(nameEQ.length,c.length); 91 } 92 } 93 94 return null; 95} 96 97 98/** ********************************************************************************************************** **/ 99/** ********************************************************************************************************** **/ 100/** ********************************************************************************************************** **/ 101 102/** 103 @ON LOAD 104**/ 105window.onload = function(e) { 106 107 // COLOR SCHEME 108 var cookie = readCookie("style"); 109 var title = cookie ? cookie : getPreferredStyleSheet(); 110 setActiveStyleSheet(title); 111 112 // SWITCHER OPEN|CLOSED 113 var switcher_visible = readCookie('switcher_visible'); 114 if(switcher_visible != 'false') { 115 jQuery("#showSwitcher").trigger('click'); 116 } 117 118 // DARK SKIN 119 var color_skin = readCookie('color_skin'); 120 if(color_skin == 'dark') { 121 jQuery("#css_dark_skin").remove(); 122 jQuery("head").append('<link id="css_dark_skin" href="assets/css/layout-dark.css" rel="stylesheet" type="text/css" title="dark" />'); 123 jQuery("#is_dark").trigger('click'); 124 jQuery("a.logo img").attr('src', 'assets/images/logo_dark.png'); 125 } 126 127 // BOXED or WIDE 128 var is_boxed = readCookie('is_boxed'); 129 if(is_boxed == 'true') { 130 jQuery('body').removeClass('boxed'); 131 jQuery('body').addClass('boxed'); 132 jQuery("#is_boxed").trigger('click'); 133 } 134 135 // PATTERN BACKGROUND 136 var pattern_switch = readCookie('pattern_switch'); 137 if(pattern_switch) { 138 // switch to boxed first! 139 jQuery('body').removeClass('boxed'); 140 jQuery('body').addClass('boxed'); 141 jQuery("#is_boxed").trigger('click'); 142 143 remove_pattern(); 144 jQuery('body').addClass(pattern_switch); 145 } 146 147 // BACKGROUND IMAGE 148 var data_background = readCookie('background_switch'); 149 if(data_background) { 150 jQuery.backstretch(data_background); 151 jQuery('body').addClass('transparent'); // remove backround color of boxed class 152 } 153 154} 155 156window.onunload = function(e) { 157 var title = getActiveStyleSheet(); 158 createCookie("style", title, 365); 159} 160 161var cookie = readCookie("style"); 162var title = cookie ? cookie : getPreferredStyleSheet(); 163setActiveStyleSheet(title); 164 165jQuery(document).ready(function() { 166 167 jQuery("select#headerLayout").click(function() { 168 169 var type = jQuery(this).attr('value'); 170 171 if (jQuery("#css_navigation_style").length > 0){ 172 jQuery("#css_navigation_style").remove(); 173 } 174 175 jQuery("head").append("<link>"); 176 jQuery("head").children(":last").attr({ 177 rel: "stylesheet", 178 type: "text/css", 179 id: "css_navigation_style", 180 href: "css/navigation-style-" + type + ".css" 181 }); 182 183 }); 184 185}); 186 187 188/** 189 COLOR SKIN [light|dark] 190**/ 191jQuery("input.dark_switch").bind("click", function() { 192 var color_skin = jQuery(this).attr('value'); 193
194 if(color_skin == 'dark') { 195 jQuery("#css_dark_skin").remove(); 196 jQuery("head").append('<link id="css_dark_skin" href="assets/css/layout-dark.css" rel="stylesheet" type="text/css" title="dark" />'); 197 createCookie("color_skin", 'dark', 365); 198 jQuery("a.logo img").attr('src', 'assets/images/logo_dark.png'); 199 } else { 200 jQuery("#css_dark_skin").remove(); 201 createCookie("color_skin", '', -1); 202 jQuery("a.logo img").attr('src', 'assets/images/logo.png'); 203 } 204}); 205 206 207 208 209 210/** 211 LAYOUT STYLE [wide|boxed] 212**/ 213jQuery("input.boxed_switch").bind("click", function() { 214 var boxed_switch = jQuery(this).attr('value'); 215 216 if(boxed_switch == 'boxed') { 217 jQuery("body").removeClass('boxed'); 218 jQuery("body").addClass('boxed'); 219 createCookie("is_boxed", 'true', 365); 220 } else { 221 jQuery("body").removeClass('boxed'); 222 createCookie("is_boxed", '', -1); 223 jQuery('body').removeClass('transparent'); 224 } 225}); 226 227 228 229 230/** 231 Pattern Background 232**/ 233function pattern_switch(pattern) { 234 if(pattern == 'none' || pattern == '') { 235 createCookie("pattern_switch", pattern, -1); 236 remove_pattern(); 237 } else { 238 239 if(!jQuery('body').hasClass('boxed')) { 240 jQuery('body').addClass('boxed'); 241 jQuery("#is_boxed").trigger('click'); 242 createCookie("is_boxed", 'true', 365); 243 } 244 245 createCookie("background_switch", '', -1); 246 jQuery('body').attr('data-background', ''); 247 jQuery('.backstretch').remove(); 248 jQuery('body').removeClass('transparent'); 249 remove_pattern(); 250 251 remove_pattern(); 252 jQuery('body').addClass(pattern); 253 createCookie("pattern_switch", pattern, 365); 254 } 255} 256function remove_pattern() { 257 jQuery('body').removeClass('pattern1'); 258 jQuery('body').removeClass('pattern2'); 259 jQuery('body').removeClass('pattern3'); 260 jQuery('body').removeClass('pattern4'); 261 jQuery('body').removeClass('pattern5'); 262 jQuery('body').removeClass('pattern6'); 263 jQuery('body').removeClass('pattern7'); 264 jQuery('body').removeClass('pattern8'); 265 jQuery('body').removeClass('pattern9'); 266 jQuery('body').removeClass('pattern10'); 267 createCookie("pattern_switch", '', -1); 268} 269 270 271 272/** 273 Image Background 274**/ 275function background_switch(imgbkg) { 276 if(imgbkg == 'none' || imgbkg == '') { 277 278 createCookie("background_switch", '', -1); 279 jQuery('body').attr('data-background', ''); 280 jQuery('.backstretch').remove(); 281 jQuery('body').removeClass('transparent'); 282 remove_pattern(); 283 284 } else { 285 286 if(!jQuery('body').hasClass('boxed')) { 287 jQuery('body').addClass('boxed'); 288 jQuery("#is_boxed").trigger('click'); 289 createCookie("is_boxed", 'true', 365); 290 } 291 292 jQuery('body').attr('data-background', imgbkg); 293 createCookie("background_switch", imgbkg, 365); 294 remove_pattern(); 295 296 var data_background = jQuery('body').attr('data-background'); 297 if(data_background) { 298 jQuery.backstretch(data_background); 299 jQuery('body').addClass('transparent'); // remove backround color of boxed class 300 } 301 } 302} 303 304 305 306/** 307 Reset Switcher 308**/ 309function resetSwitcher() { 310 remove_pattern(); 311 jQuery('body').removeClass('boxed'); 312 jQuery("#css_dark_skin").remove(); 313 jQuery('body').attr('data-background', ''); 314 jQuery('.backstretch').remove(); 315 jQuery("a.logo img").attr('src', 'assets/images/logo.png'); 316 317 jQuery("#is_light").trigger('click'); 318 jQuery("#is_wide").trigger('click'); 319 320 // delete cookies! 321 createCookie("style", '', -1); 322 createCookie("switcher_visible", '', -1); 323 createCookie("pattern_switch", '', -1); 324 createCookie("background_switch", '', -1); 325 createCookie("boxed", '', -1); 326 createCookie("color_skin", '', -1); 327 createCookie("is_boxed", '', -1); 328}
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.