PageSourceSearch

https://ashizawaclinic.jp/js/switcher.js

js ashizawaclinic.jp collected 2026-10-04 15:53:14 UTC 1,943 bytes, 67 lines download raw bytes

1/* Style Switcher by Paul Sowden, see A List Apart: http://www.alistapart.com/articles/alternate/ */
2
3function setActiveStyleSheet(title) {
4  var i, a, main;
5  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
6    if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")) {
7      a.disabled = true;
8      if(a.getAttribute("title") == title) a.disabled = false;
9    }
10  }
11}
12
13function getActiveStyleSheet() {
14  var i, a;
15  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
16    if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title") && !a.disabled) return a.getAttribute("title");
17  }
18  return null;
19}
20
21function getPreferredStyleSheet() {
22  var i, a;
23  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
24    if(a.getAttribute("rel").indexOf("style") != -1
25       && a.getAttribute("rel").indexOf("alt") == -1
26       && a.getAttribute("title")
27       ) return a.getAttribute("title");
28  }
29  return null;
30}
31
32function createCookie(name,value,days) {
33  if (days) {
34    var date = new Date();
35    date.setTime(date.getTime()+(days*24*60*60*1000));
36    var expires = "; expires="+date.toGMTString();
37  }
38  else expires = "";
39  document.cookie = name+"="+value+expires+"; path=/";
40}
41
42function readCookie(name) {
43  var nameEQ = name + "=";
44  var ca = document.cookie.split(';');
45  for(var i=0;i < ca.length;i++) {
46    var c = ca[i];
47    while (c.charAt(0)==' ') c = c.substring(1,c.length);
48    if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
49  }
50  return null;
51}
52
53window.onload = function(e) {
54  var cookie = readCookie("style");
55  var title = cookie ? cookie : getPreferredStyleSheet();
56  setActiveStyleSheet(title);
57}
58
59window.onunload = function(e) {
60  var title = getActiveStyleSheet();
61  createCookie("style", title, 365);
62}
63
64var cookie = readCookie("style");
65var title = cookie ? cookie : getPreferredStyleSheet();
66setActiveStyleSheet(title);
67

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.