PageSourceSearch

https://bharatkeveer.gov.in/js/swithcer.js

js bharatkeveer.gov.in collected 2026-10-02 05:02:51 UTC 6,827 bytes, 159 lines download raw bytes

1//Style Sheet Switcher version 1.1 Oct 10th, 2006
2//Author: Dynamic Drive: http://www.dynamicdrive.com
3//Usage terms: http://www.dynamicdrive.com/notice.htm
4
5//Unofficial Update to fix Safari 5.1 glitch re: alternate stylesheets or the disabled property in regards to them
6// See: http://www.dynamicdrive.com/forums/showthread.php?p=259199 for more info
7
8var manual_or_random="manual" //"manual" or "random"
9var randomsetting="3 days" //"eachtime", "sessiononly", or "x days (replace x with desired integer)". Only applicable if mode is random.
10
11//////No need to edit beyond here//////////////
12
13function getCookie(Name) {
14var re=new RegExp(Name+"=[^;]+", "i"); //construct RE to search for target name/value pair
15if (document.cookie.match(re)) //if cookie found
16return document.cookie.match(re)[0].split("=")[1] //return its value
17return null
18}
19
20function setCookie(name, value, days) {
21var expireDate = new Date()
22//set "expstring" to either future or past date, to set or delete cookie, respectively
23var expstring=(typeof days!="undefined")? expireDate.setDate(expireDate.getDate()+parseInt(days)) : expireDate.setDate(expireDate.getDate()-5)
24document.cookie = name+"="+value+"; expires="+expireDate.toGMTString()+"; path=/";
25}
26
27function deleteCookie(name){
28setCookie(name, "moot")
29}
30
31
32function setStylesheet(title, randomize){ //Main stylesheet switcher function. Second parameter if defined causes a random alternate stylesheet (including none) to be enabled
33var i, cacheobj, altsheets=[""];
34if(setStylesheet.chosen)
35try{
36document.getElementsByTagName('head')[0].removeChild(setStylesheet.chosen);
37}catch(e){}
38for(i=0; (cacheobj=document.getElementsByTagName("link")[i]); i++) {
39if(cacheobj.getAttribute("rel").toLowerCase()=="alternate stylesheet" && cacheobj.getAttribute("title")) { //if this is an alternate stylesheet with title
40cacheobj.disabled = true
41altsheets.push(cacheobj) //store reference to alt stylesheets inside array
42if(cacheobj.getAttribute("title") == title){ //enable alternate stylesheet with title that matches parameter
43cacheobj.disabled = false //enable chosen style sheet
44setStylesheet.chosen = document.createElement('link');//cloneNode(false);
45setStylesheet.chosen.rel = 'stylesheet';
46setStylesheet.chosen.type = 'text/css';
47if(cacheobj.media)
48setStylesheet.chosen.media = cacheobj.media;
49setStylesheet.chosen.href = cacheobj.href;
50document.getElementsByTagName('head')[0].appendChild(setStylesheet.chosen);
51}
52}
53}
54if (typeof randomize!="undefined"){ //if second paramter is defined, randomly enable an alt style sheet (includes non)
55var randomnumber=Math.floor(Math.random()*altsheets.length)
56altsheets[randomnumber].disabled=false
57}
58return (typeof randomize!="undefined" && altsheets[randomnumber]!="")? altsheets[randomnumber].getAttribute("title") : "" //if in "random" mode, return "title" of randomly enabled alt stylesheet
59}
60
61
62
63function chooseStyle(styletitle, days){ //Interface function to switch style sheets plus save "title" attr of selected stylesheet to cookie
64//alert(styletitle);
65if (document.getElementById){
66setStylesheet(styletitle)
67setCookie("mysheet", styletitle, days)
68}
69}
70
71function indicateSelected(element){ //Optional function that shows which style sheet is currently selected within group of radio buttons or select menu
72if (selectedtitle!=null && (element.type==undefined || element.type=="select-one")){ //if element is a radio button or select menu
73var element=(element.type=="select-one") ? element.options : element
74for (var i=0; i<element.length; i++){
75if (element[i].value==selectedtitle){ //if match found between form element value and cookie value
76if (element[i].tagName=="OPTION") //if this is a select menu
77element[i].selected=true
78else{ //else if it's a radio button
79element[i].checked=true
80}
81break
82}
83}
84}
85}
86
87if (manual_or_random=="manual"){ //IF MANUAL MODE
88var selectedtitle=getCookie("mysheet")
89if (document.getElementById && selectedtitle!=null) //load user chosen style sheet from cookie if there is one stored
90setStylesheet(selectedtitle)
91}
92else if (manual_or_random=="random"){ //IF AUTO RANDOM MODE
93if (randomsetting=="eachtime")
94setStylesheet("", "random")
95else if (randomsetting=="sessiononly"){ //if "sessiononly" setting
96if (getCookie("mysheet_s")==null) //if "mysheet_s" session cookie is empty
97document.cookie="mysheet_s="+setStylesheet("", "random")+"; path=/" //activate random alt stylesheet while remembering its "title" value
98else
99setStylesheet(getCookie("mysheet_s")) //just activate random alt stylesheet stored in cookie
100}
101else if (randomsetting.search(/^[1-9]+ days/i)!=-1){ //if "x days" setting
102if (getCookie("mysheet_r")==null || parseInt(getCookie("mysheet_r_days"))!=parseInt(randomsetting)){ //if "mysheet_r" cookie is empty or admin has changed number of days to persist in "x days" variable
103setCookie("mysheet_r", setStylesheet("", "random"), parseInt(randomsetting)) //activate random alt stylesheet while remembering its "title" value
104setCookie("mysheet_r_days", randomsetting, parseInt(randomsetting)) //Also remember the number of days to persist per the "x days" variable
105}
106else
107setStylesheet(getCookie("mysheet_r")) //just activate random alt stylesheet stored in cookie
108}
109}
110
111
112jQuery(document).ready(function(){
113
114jQuery('#menu-item-278 > a, #menu-item-194 > a, #menu-item-192 >  a').click(function(){return false;});
115jQuery(".light").hide();
116jQuery('.dark').click(function(){
117
118var thirtyDays = 1000*60*60*24*30;
119var expireDate = new Date((new Date()).valueOf() + thirtyDays);
120
121document.cookie = 'contrast' +"="+ 1 +"; expires="+expireDate.toGMTString()+"; path=/";
122document.cookie="username=John Doe";
123//var site_temp_uri = document.getElementById("site_url_js").value;
124jQuery(".light").show();
125jQuery(".dark").hide();
126jQuery('body').append('<link rel="stylesheet" type="text/css" media="screen" href="css/change.css">');
127jQuery('body').append('<link rel="stylesheet" type="text/css" media="screen" href="css/site-change.css">');
128});
129
130
131jQuery('.light').click(function(){
132
133
134var thirtyDays = 1000*60*60*24*30;
135var expireDate = new Date((new Date()).valueOf() + thirtyDays);
136
137document.cookie = 'contrast' +"="+ 0 +"; expires="+expireDate.toGMTString()+"; path=/";
138
139jQuery(".light").hide();
140jQuery(".dark").show();
141
142jQuery("[href*='change.css']").remove();
143});
144
145if(getCookie('contrast') == "1") {
146//var site_temp_uri = document.getElementById("site_url_js").value;
147jQuery('body').append('<link rel="stylesheet" type="text/css" media="screen" href="css/change.css">');
148jQuery('body').append('<link rel="stylesheet" type="text/css" media="screen" href="css/site-change.css">');
149}
150
151
152
153if(getCookie('contrast') == "0" ) {
154jQuery("[href*='change.css']").remove();
155}
156
157
158
159});

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.