PageSourceSearch

https://www.hyperdia.com/ja/js/lib/styleswitcher.js

js hyperdia.com collected 2026-10-02 04:03:37 UTC 2,057 bytes, 76 lines download raw bytes

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

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.