PageSourceSearch

https://www.kagin.co.jp/library/css/fontColor.js

js kagin.co.jp collected 2026-10-02 03:27:52 UTC 4,074 bytes, 149 lines download raw bytes

1//
2function getCookie(){
3	zoom = "";
4	cName = "FontSize=";
5	tmpCookie = document.cookie + ";";
6	start = tmpCookie.indexOf(cName);
7	if (start != -1)
8	{
9		end = tmpCookie.indexOf(";", start);
10		zoom = tmpCookie.substring(start + cName.length, end);
11		document.getElementById(target).style.fontSize = zoom;
12	} else {
13		document.getElementById(target).style.fontSize = "100%";
14	}
15	//color
16	var p;
17	pName = "F_Color=";
18	tmpCookie = document.cookie + ";";
19	start = tmpCookie.indexOf(pName);
20	if (start != -1)
21	{
22		end = tmpCookie.indexOf(";", start);
23		p = tmpCookie.substring(start + pName.length, end);
24		changeCSS(p);
25	}
26}
27
28
29////文字拡大・縮小///////////////////////////
30var target = "page";	//*文字拡大・縮小対象エリア(ID名)
31//
32function setCookie(s){
33	cName = "FontSize=";
34	exp = new Date();
35	exp.setTime(exp.getTime() + 31536000000);
36	document.cookie = cName + s + "; path=/; expires=" + exp.toGMTString();
37}
38//
39function textSizeUp(){
40	currentSize = document.getElementById(target).style.fontSize;
41	if (!currentSize) {
42		currentSize = "100%";
43	}
44	selectSize = "";
45	if ( currentSize=="100%" || currentSize=="1.0em"){
46		selectSize = "120%";
47	} else if(currentSize=="120%") {
48		selectSize = "140%";
49	} else if(currentSize=="140%") {
50		selectSize = "160%";
51	} else if(currentSize=="160%") {
52		selectSize = "180%";
53	} else if(currentSize=="180%") {
54		selectSize = "200%";
55	} else if(currentSize=="200%") {
56		alert("これ以上文字を拡大することはできません。");
57		selectSize = "200%";
58	} else {
59		selectSize = "100%";
60	}
61	document.getElementById(target).style.fontSize = selectSize;
62	setCookie(selectSize);
63}
64
65function textSizeDown(){
66	currentSize = document.getElementById(target).style.fontSize;
67	if (!currentSize) {
68		currentSize = "100%";
69	}
70	selectSize = "";
71	if ( currentSize=="200%" || currentSize=="2.0em"){
72		selectSize = "180%";
73	} else if(currentSize=="180%") {
74		selectSize = "160%";
75	} else if(currentSize=="160%") {
76		selectSize = "140%";
77	} else if(currentSize=="140%") {
78		selectSize = "120%";
79	} else if(currentSize=="120%") {
80		selectSize = "100%";
81	} else if(currentSize=="100%") {
82		selectSize = "80%";
83	} else if(currentSize=="80%") {
84		selectSize = "60%";
85	} else if(currentSize=="60%") {
86		selectSize = "40%";
87	} else if(currentSize=="40%") {
88		alert("これ以上文字を縮小することはできません。");
89		selectSize = "40%";
90	} else {
91		selectSize = "100%";
92	}
93	document.getElementById(target).style.fontSize = selectSize;
94	setCookie(selectSize);
95}
96
97function textSizeDefault(){
98	currentSize = document.getElementById(target).style.fontSize;
99	selectSize = "100%";
100	document.getElementById(target).style.fontSize = selectSize;
101	setCookie(selectSize);
102}
103
104
105
106
107////色合いの変更 //////////////////////////////////////////////////////////////////////////////
108var targetLINK  = "changecss";
109var css_keyword = "color";
110var dir_path = "/library/css/";			//CSSファイルを置いてあるディレクトリを絶対パスで指定すること
111//
112function setColorCookie(s){
113	cName = "F_Color=";
114	exp = new Date();
115	exp.setTime(exp.getTime() + 31536000000);
116	document.cookie = cName + s + "; path=/" + "; expires=" + exp.toGMTString();
117}
118//
119function changeCSS(par) {
120	if(!par || par=="") return;
121	var target = document.getElementById(targetLINK);
122	if(!target) {
123		links = document.getElementsByTagName('link');
124		for(var i=0;i<links.length;i++) {
125			temp = links[i].href;
126			chk = temp.indexOf(css_keyword);
127			if(chk!=-1) {
128				target = links[i];
129				break;
130			}
131		}
132	}
133	//
134	if(!target || !target.cloneNode) {
135		alert('ご利用のブラウザでは色合いの変更機能はご利用いただけないようです.\n[Element]or[cloneNode Method] None');
136		return;
137	}
138	//
139	var css_path = dir_path + par;
140	//
141	var newNode = target.cloneNode(true);
142	newNode.href = css_path;
143	target.parentNode.replaceChild(newNode,target);
144	//
145	setColorCookie(par);
146}
147
148
149//

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.