PageSourceSearch

https://chanda.nic.in/wp-content/themes/district-theme-5/js/style.switcher.js

js chanda.nic.in collected 2026-10-02 21:25:11 UTC 19,369 bytes, 612 lines download raw bytes

1function getCookie(e) {
2    var t = new RegExp(e + "=[^;]+", "i");
3    return document.cookie.match(t) ? document.cookie.match(t)[0].split("=")[1] : null
4}
5
6function setCookie(e, t, s) {
7    var n = new Date;
8    "undefined" != typeof s ? n.setDate(n.getDate() + parseInt(s)) : n.setDate(n.getDate() - 5);
9    document.cookie = e + "=" + t + "; expires=" + n.toGMTString() + "; path=/"
10}
11
12function deleteCookie(e) {
13    setCookie(e, "moot")
14}
15
16function setStylesheet(e, t) {
17    var s, n, o = [""];
18    if (setStylesheet.chosen) try {
19        document.getElementsByTagName("head")[0].removeChild(setStylesheet.chosen)
20    } catch (a) { }
21    for (s = 0; n = document.getElementsByTagName("link")[s]; s++) "alternate stylesheet" == n.getAttribute("rel").toLowerCase() && n.getAttribute("title") && (n.disabled = !0, o.push(n), n.getAttribute("title") == e && (n.disabled = !1, setStylesheet.chosen = document.createElement("link"), setStylesheet.chosen.rel = "stylesheet", setStylesheet.chosen.type = "text/css", n.media && (setStylesheet.chosen.media = n.media), setStylesheet.chosen.href = n.href, document.getElementsByTagName("head")[0].appendChild(setStylesheet.chosen)));
22    if ("undefined" != typeof t) {
23        var r = Math.floor(Math.random() * o.length);
24        o[r].disabled = !1
25    }
26    return "undefined" != typeof t && "" != o[r] ? o[r].getAttribute("title") : ""
27}
28
29function chooseStyle(e, t) {
30    document.getElementById && (setStylesheet(e), setCookie("mysheet", e, t))
31}
32
33function indicateSelected(e) {
34    if (null != selectedtitle && (void 0 == e.type || "select-one" == e.type))
35        for (var e = "select-one" == e.type ? e.options : e, t = 0; t < e.length; t++)
36            if (e[t].value == selectedtitle) {
37                "OPTION" == e[t].tagName ? e[t].selected = !0 : e[t].checked = !0;
38                break
39            }
40}
41var manual_or_random = "manual",
42    randomsetting = "3 days";
43if ("manual" == manual_or_random) {
44    var selectedtitle = getCookie("mysheet");
45    document.getElementById && null != selectedtitle && setStylesheet(selectedtitle)
46} else "random" == manual_or_random && ("eachtime" == randomsetting ? setStylesheet("", "random") : "sessiononly" == randomsetting ? null == getCookie("mysheet_s") ? document.cookie = "mysheet_s=" + setStylesheet("", "random") + "; path=/" : setStylesheet(getCookie("mysheet_s")) : -1 != randomsetting.search(/^[1-9]+ days/i) && (null == getCookie("mysheet_r") || parseInt(getCookie("mysheet_r_days")) != parseInt(randomsetting) ? (setCookie("mysheet_r", setStylesheet("", "random"), parseInt(randomsetting)), setCookie("mysheet_r_days", randomsetting, parseInt(randomsetting))) : setStylesheet(getCookie("mysheet_r"))));
47
48
49
50jQuery(document).ready(function() {
51  //jQuery('.light').hide();
52  jQuery("#menu-item-278 > a, #menu-item-194 > a, #menu-item-192 >  a").click(
53    function() {
54      return false;
55    }
56  );
57
58  jQuery(".dark").click(function(e) {
59    e.preventDefault();
60    jQuery("body").addClass("contrast");
61    jQuery(".highContrast.dark > a,.highContrast.dark > button")
62      .addClass("link-selected")
63      .attr("aria-label", "High Contrast - Selected")
64      .attr("title", "High Contrast - Selected");
65    jQuery(".highContrast.light > a,.highContrast.light > button")
66      .removeClass("link-selected")
67      .attr("aria-label", "Normal Contrast")
68      .attr("title", "Normal Contrast");
69
70    if (jQuery("body").hasClass("contrast")) {
71      var thirtyDays = 1000 * 60 * 60 * 24 * 30;
72      var expireDate = new Date(new Date().valueOf() + thirtyDays);
73
74      document.cookie =
75        "contrast" +
76        "=" +
77        1 +
78        "; expires=" +
79        expireDate.toGMTString() +
80        "; path=/";
81      if (!window.location.origin) {
82        window.location.origin =
83          window.location.protocol +
84          "//" +
85          window.location.hostname +
86          (window.location.port ? ":" + window.location.port : "");
87        var site_temp_uri = window.location.origin;
88      } else {
89        var site_temp_uri = document.location.origin;
90      }
91      jQuery("head").append(
92        '<link rel="stylesheet" type="text/css" media="screen" href="' +
93          site_temp_uri +
94          '/wp-content/themes/district-theme-5/css/high-contrast.css">'
95      );
96    } else {
97      var thirtyDays = 1000 * 60 * 60 * 24 * 30;
98      var expireDate = new Date(new Date().valueOf() + thirtyDays);
99
100      document.cookie =
101        "contrast" +
102        "=" +
103        0 +
104        "; expires=" +
105        expireDate.toGMTString() +
106        "; path=/";
107      jQuery("[href*='high-contrast.css']").remove();
108    }
109  });
110
111  jQuery(".light").click(function(e) {
112    e.preventDefault();
113    jQuery("body").removeClass("contrast");
114    jQuery(".highContrast.dark > a,.highContrast.dark > button")
115      .removeClass("link-selected")
116      .attr("aria-label", "High Contrast")
117      .attr("title", "High Contrast");
118    jQuery(".highContrast.light > a,.highContrast.light > button")
119      .addClass("link-selected")
120      .attr("aria-label", "Normal Contrast - Selected")
121      .attr("title", "Normal Contrast - Selected");
122
123    if (jQuery("body").hasClass("contrast")) {
124      var thirtyDays = 1000 * 60 * 60 * 24 * 30;
125      var expireDate = new Date(new Date().valueOf() + thirtyDays);
126
127      document.cookie =
128        "contrast" +
129        "=" +
130        1 +
131        "; expires=" +
132        expireDate.toGMTString() +
133        "; path=/";
134      if (!window.location.origin) {
135        window.location.origin =
136          window.location.protocol +
137          "//" +
138          window.location.hostname +
139          (window.location.port ? ":" + window.location.port : "");
140        var site_temp_uri = window.location.origin;
141      } else {
142        var site_temp_uri = document.location.origin;
143      }
144      jQuery("head").append(
145        '<link rel="stylesheet" type="text/css" media="screen" href="' +
146          site_temp_uri +
147          '/wp-content/themes/district-theme-5/css/high-contrast.css">'
148      );
149    } else {
150      var thirtyDays = 1000 * 60 * 60 * 24 * 30;
151      var expireDate = new Date(new Date().valueOf() + thirtyDays);
152
153      document.cookie =
154        "contrast" +
155        "=" +
156        0 +
157        "; expires=" +
158        expireDate.toGMTString() +
159        "; path=/";
160      jQuery("[href*='high-contrast.css']").remove();
161    }
162  });
163
164  if (getCookie("contrast") == "1") {
165    if (!window.location.origin) {
166      window.location.origin =
167        window.location.protocol +
168        "//" +
169        window.location.hostname +
170        (window.location.port ? ":" + window.location.port : "");
171      var site_temp_uri = window.location.origin;
172    } else {
173      var site_temp_uri = document.location.origin;
174    }
175    jQuery("head").append(
176      '<link rel="stylesheet" type="text/css" media="screen" href="' +
177        site_temp_uri +
178        '/wp-content/themes/district-theme-5/css/high-contrast.css">'
179    );
180    jQuery("body").addClass("contrast");
181    jQuery(".highContrast.dark > a,.highContrast.dark > button")
182      .addClass("link-selected")
183      .attr("aria-label", "High Contrast - Selected")
184      .attr("title", "High Contrast - Selected");
185    jQuery(".highContrast.light > a,.highContrast.light > button")
186      .removeClass("link-selected")
187      .attr("aria-label", "Normal Contrast")
188      .attr("title", "Normal Contrast");
189  }
190
191  if (getCookie("contrast") == "0") {
192    jQuery("[href*='high-contrast.css']").remove();
193    jQuery("body").removeClass("contrast");
194    jQuery(".highContrast.dark > a,.highContrast.dark > button")
195      .removeClass("link-selected")
196      .attr("aria-label", "High Contrast")
197      .attr("title", "High Contrast");
198    jQuery(".highContrast.light > a,.highContrast.light > button")
199      .addClass("link-selected")
200      .attr("aria-label", "Normal Contrast - Selected")
201      .attr("title", "Normal Contrast - Selected");
202  }
203
204  // Highlisht links
205  jQuery("#highlightLinks").click(function(e) {
206    e.preventDefault();
207    jQuery("body").toggleClass("highlightLinks");
208
209    if (jQuery("body").hasClass("highlightLinks")) {
210      var thirtyDays = 1000 * 60 * 60 * 24 * 30;
211      var expireDate = new Date(new Date().valueOf() + thirtyDays);
212
213      document.cookie =
214        "highlightLinks" +
215        "=" +
216        1 +
217        "; expires=" +
218        expireDate.toGMTString() +
219        "; path=/";
220      if (!window.location.origin) {
221        window.location.origin =
222          window.location.protocol +
223          "//" +
224          window.location.hostname +
225          (window.location.port ? ":" + window.location.port : "");
226        var site_temp_uri = window.location.origin;
227      } else {
228        var site_temp_uri = document.location.origin;
229      }
230    } else {
231      var thirtyDays = 1000 * 60 * 60 * 24 * 30;
232      var expireDate = new Date(new Date().valueOf() + thirtyDays);
233
234      document.cookie =
235        "highlightLinks" +
236        "=" +
237        0 +
238        "; expires=" +
239        expireDate.toGMTString() +
240        "; path=/";
241    }
242  });
243
244  // if (getCookie("highlightLinks") == "1") {
245  //   if (!window.location.origin) {
246  //     window.location.origin =
247  //       window.location.protocol +
248  //       "//" +
249  //       window.location.hostname +
250  //       (window.location.port ? ":" + window.location.port : "");
251  //     var site_temp_uri = window.location.origin;
252  //   } else {
253  //     var site_temp_uri = document.location.origin;
254  //   }
255  //   jQuery("body").addClass("highlightLinks");
256  // }
257
258  // if (getCookie("highlightLinks") == "0") {
259  //   jQuery("body").removeClass("highlightLinks");
260  // }
261
262  // Text spacing
263  jQuery("#addletterspacing").click(function(e) {
264    e.preventDefault();
265    jQuery("body").toggleClass("addletterspacing");
266
267    if (jQuery("body").hasClass("addletterspacing")) {
268      var thirtyDays = 1000 * 60 * 60 * 24 * 30;
269      var expireDate = new Date(new Date().valueOf() + thirtyDays);
270
271      document.cookie =
272        "addletterspacing" +
273        "=" +
274        1 +
275        "; expires=" +
276        expireDate.toGMTString() +
277        "; path=/";
278      if (!window.location.origin) {
279        window.location.origin =
280          window.location.protocol +
281          "//" +
282          window.location.hostname +
283          (window.location.port ? ":" + window.location.port : "");
284        var site_temp_uri = window.location.origin;
285      } else {
286        var site_temp_uri = document.location.origin;
287      }
288    } else {
289      var thirtyDays = 1000 * 60 * 60 * 24 * 30;
290      var expireDate = new Date(new Date().valueOf() + thirtyDays);
291
292      document.cookie =
293        "addletterspacing" +
294        "=" +
295        0 +
296        "; expires=" +
297        expireDate.toGMTString() +
298        "; path=/";
299    }
300  });
301
302  if (getCookie("addletterspacing") == "1") {
303    if (!window.location.origin) {
304      window.location.origin =
305        window.location.protocol +
306        "//" +
307        window.location.hostname +
308        (window.location.port ? ":" + window.location.port : "");
309      var site_temp_uri = window.location.origin;
310    } else {
311      var site_temp_uri = document.location.origin;
312    }
313    jQuery("body").addClass("addletterspacing");
314  }
315
316  if (getCookie("addletterspacing") == "0") {
317    jQuery("body").removeClass("addletterspacing");
318  }
319
320  // Text lineheight
321  jQuery("#addlineheight").click(function(e) {
322    e.preventDefault();
323    jQuery("body").toggleClass("addlineheight");
324
325    if (jQuery("body").hasClass("addlineheight")) {
326      var thirtyDays = 1000 * 60 * 60 * 24 * 30;
327      var expireDate = new Date(new Date().valueOf() + thirtyDays);
328
329      document.cookie =
330        "addlineheight" +
331        "=" +
332        1 +
333        "; expires=" +
334        expireDate.toGMTString() +
335        "; path=/";
336      if (!window.location.origin) {
337        window.location.origin =
338          window.location.protocol +
339          "//" +
340          window.location.hostname +
341          (window.location.port ? ":" + window.location.port : "");
342        var site_temp_uri = window.location.origin;
343      } else {
344        var site_temp_uri = document.location.origin;
345      }
346    } else {
347      var thirtyDays = 1000 * 60 * 60 * 24 * 30;
348      var expireDate = new Date(new Date().valueOf() + thirtyDays);
349
350      document.cookie =
351        "addlineheight" +
352        "=" +
353        0 +
354        "; expires=" +
355        expireDate.toGMTString() +
356        "; path=/";
357    }
358  });
359
360  if (getCookie("addlineheight") == "1") {
361    if (!window.location.origin) {
362      window.location.origin =
363        window.location.protocol +
364        "//" +
365        window.location.hostname +
366        (window.location.port ? ":" + window.location.port : "");
367      var site_temp_uri = window.location.origin;
368    } else {
369      var site_temp_uri = document.location.origin;
370    }
371    jQuery("body").addClass("addlineheight");
372  }
373
374  if (getCookie("addlineheight") == "0") {
375    jQuery("body").removeClass("addlineheight");
376  }
377
378  // Invert
379  jQuery("#invert").click(function (e) {
380    e.preventDefault();
381    jQuery("body").toggleClass("invert");
382
383    if (jQuery("body").hasClass("invert")) {
384      var thirtyDays = 1000 * 60 * 60 * 24 * 30;
385      var expireDate = new Date(new Date().valueOf() + thirtyDays);
386
387      document.cookie =
388        "invert" +
389        "=" +
390        1 +
391        "; expires=" +
392        expireDate.toGMTString() +
393        "; path=/";
394      if (!window.location.origin) {
395        window.location.origin =
396          window.location.protocol +
397          "//" +
398          window.location.hostname +
399          (window.location.port ? ":" + window.location.port : "");
400        var site_temp_uri = window.location.origin;
401      } else {
402        var site_temp_uri = document.location.origin;
403      }
404    } else {
405      var thirtyDays = 1000 * 60 * 60 * 24 * 30;
406      var expireDate = new Date(new Date().valueOf() + thirtyDays);
407
408      document.cookie =
409        "invert" +
410        "=" +
411        0 +
412        "; expires=" +
413        expireDate.toGMTString() +
414        "; path=/";
415    }
416  });
417
418  if (getCookie("invert") == "1") {
419    if (!window.location.origin) {
420      window.location.origin =
421        window.location.protocol +
422        "//" +
423        window.location.hostname +
424        (window.location.port ? ":" + window.location.port : "");
425      var site_temp_uri = window.location.origin;
426    } else {
427      var site_temp_uri = document.location.origin;
428    }
429    jQuery("body").addClass("invert");
430  }
431
432  if (getCookie("invert") == "0") {
433    jQuery("body").removeClass("invert");
434  }
435
436  // Saturation
437  jQuery("#saturation").click(function (e) {
438    e.preventDefault();
439    jQuery("body").toggleClass("saturation");
440
441    if (jQuery("body").hasClass("saturation")) {
442      var thirtyDays = 1000 * 60 * 60 * 24 * 30;
443      var expireDate = new Date(new Date().valueOf() + thirtyDays);
444
445      document.cookie =
446        "saturation" +
447        "=" +
448        1 +
449        "; expires=" +
450        expireDate.toGMTString() +
451        "; path=/";
452      if (!window.location.origin) {
453        window.location.origin =
454          window.location.protocol +
455          "//" +
456          window.location.hostname +
457          (window.location.port ? ":" + window.location.port : "");
458        var site_temp_uri = window.location.origin;
459      } else {
460        var site_temp_uri = document.location.origin;
461      }
462    } else {
463      var thirtyDays = 1000 * 60 * 60 * 24 * 30;
464      var expireDate = new Date(new Date().valueOf() + thirtyDays);
465
466      document.cookie =
467        "saturation" +
468        "=" +
469        0 +
470        "; expires=" +
471        expireDate.toGMTString() +
472        "; path=/";
473    }
474  });
475
476  if (getCookie("saturation") == "1") {
477    if (!window.location.origin) {
478      window.location.origin =
479        window.location.protocol +
480        "//" +
481        window.location.hostname +
482        (window.location.port ? ":" + window.location.port : "");
483      var site_temp_uri = window.location.origin;
484    } else {
485      var site_temp_uri = document.location.origin;
486    }
487    jQuery("body").addClass("saturation");
488  }
489
490  if (getCookie("saturation") == "0") {
491    jQuery("body").removeClass("saturation");
492  }
493
494
495
496  // Hideimage
497  jQuery("#hideimage").click(function (e) {
498    e.preventDefault();
499    jQuery("body").toggleClass("hideimage");
500
501    if (jQuery("body").hasClass("hideimage")) {
502      var thirtyDays = 1000 * 60 * 60 * 24 * 30;
503      var expireDate = new Date(new Date().valueOf() + thirtyDays);
504
505      document.cookie =
506        "hideimage" +
507        "=" +
508        1 +
509        "; expires=" +
510        expireDate.toGMTString() +
511        "; path=/";
512      if (!window.location.origin) {
513        window.location.origin =
514          window.location.protocol +
515          "//" +
516          window.location.hostname +
517          (window.location.port ? ":" + window.location.port : "");
518        var site_temp_uri = window.location.origin;
519      } else {
520        var site_temp_uri = document.location.origin;
521      }
522    } else {
523      var thirtyDays = 1000 * 60 * 60 * 24 * 30;
524      var expireDate = new Date(new Date().valueOf() + thirtyDays);
525
526      document.cookie =
527        "hideimage" +
528        "=" +
529        0 +
530        "; expires=" +
531        expireDate.toGMTString() +
532        "; path=/";
533    }
534  });
535
536  if (getCookie("hideimage") == "1") {
537    if (!window.location.origin) {
538      window.location.origin =
539        window.location.protocol +
540        "//" +
541        window.location.hostname +
542        (window.location.port ? ":" + window.location.port : "");
543      var site_temp_uri = window.location.origin;
544    } else {
545      var site_temp_uri = document.location.origin;
546    }
547    jQuery("body").addClass("hideimage");
548  }
549
550  if (getCookie("hideimage") == "0") {
551    jQuery("body").removeClass("hideimage");
552  }
553
554  // Big Cursor
555  jQuery("#big_cursor").click(function (e) {
556    e.preventDefault();
557    jQuery("body").toggleClass("big_cursor");
558
559    if (jQuery("body").hasClass("big_cursor")) {
560      var thirtyDays = 1000 * 60 * 60 * 24 * 30;
561      var expireDate = new Date(new Date().valueOf() + thirtyDays);
562
563      document.cookie =
564        "big_cursor" +
565        "=" +
566        1 +
567        "; expires=" +
568        expireDate.toGMTString() +
569        "; path=/";
570      if (!window.location.origin) {
571        window.location.origin =
572          window.location.protocol +
573          "//" +
574          window.location.hostname +
575          (window.location.port ? ":" + window.location.port : "");
576        var site_temp_uri = window.location.origin;
577      } else {
578        var site_temp_uri = document.location.origin;
579      }
580    } else {
581      var thirtyDays = 1000 * 60 * 60 * 24 * 30;
582      var expireDate = new Date(new Date().valueOf() + thirtyDays);
583
584      document.cookie =
585        "big_cursor" +
586        "=" +
587        0 +
588        "; expires=" +
589        expireDate.toGMTString() +
590        "; path=/";
591    }
592  });
593
594  if (getCookie("big_cursor") == "1") {
595    if (!window.location.origin) {
596      window.location.origin =
597        window.location.protocol +
598        "//" +
599        window.location.hostname +
600        (window.location.port ? ":" + window.location.port : "");
601      var site_temp_uri = window.location.origin;
602    } else {
603      var site_temp_uri = document.location.origin;
604    }
605    jQuery("body").addClass("big_cursor");
606  }
607
608  if (getCookie("big_cursor") == "0") {
609    jQuery("body").removeClass("big_cursor");
610  }
611
612});

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.