PageSourceSearch

https://shonan-t.com/include/xoops.js

js shonan-t.com collected 2026-10-05 07:57:56 UTC 12,106 bytes, 387 lines download raw bytes

1function xoopsGetElementById(id){
2	if (document.getElementById) {
3		return (document.getElementById(id));
4	} else if (document.all) {
5		return (document.all[id]);
6	} else {
7		if ((navigator.appname.indexOf("Netscape") != -1) && parseInt(navigator.appversion == 4)) {
8			return (document.layers[id]);
9		}
10	}
11}
12
13function xoopsSetElementProp(name, prop, val) {
14	var elt=xoopsGetElementById(name);
15	if (elt) elt[prop]=val;
16}
17
18function xoopsSetElementStyle(name, prop, val) {
19	var elt=xoopsGetElementById(name);
20	if (elt && elt.style) elt.style[prop]=val;
21}
22
23function xoopsGetFormElement(fname, ctlname) {
24	var frm=document.forms[fname];
25	return frm?frm.elements[ctlname]:null;
26}
27
28function justReturn() {
29	return;
30}
31
32function openWithSelfMain(url,name,width,height) {
33	var options = "width=" + width + ",height=" + height + "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no";
34
35	new_window = window.open(url, name, options);
36	window.self.name = "main";
37	new_window.focus();
38}
39
40function setElementColor(id, color){
41	xoopsGetElementById(id).style.color = "#" + color;
42}
43
44function setElementFont(id, font){
45	xoopsGetElementById(id).style.fontFamily = font;
46}
47
48function setElementSize(id, size){
49	xoopsGetElementById(id).style.fontSize = size;
50}
51
52function changeDisplay(id){
53	var elestyle = xoopsGetElementById(id).style;
54	if (elestyle.display == "") {
55		elestyle.display = "none";
56	} else {
57		elestyle.display = "block";
58	}
59}
60
61function setVisible(id){
62	xoopsGetElementById(id).style.visibility = "visible";
63}
64
65function setHidden(id){
66	xoopsGetElementById(id).style.visibility = "hidden";
67}
68
69function makeBold(id){
70	var eleStyle = xoopsGetElementById(id).style;
71	if (eleStyle.fontWeight != "bold" && eleStyle.fontWeight != "700") {
72		eleStyle.fontWeight = "bold";
73	} else {
74		eleStyle.fontWeight = "normal";
75	}
76}
77
78function makeItalic(id){
79	var eleStyle = xoopsGetElementById(id).style;
80	if (eleStyle.fontStyle != "italic") {
81		eleStyle.fontStyle = "italic";
82	} else {
83		eleStyle.fontStyle = "normal";
84	}
85}
86
87function makeUnderline(id){
88	var eleStyle = xoopsGetElementById(id).style;
89	if (eleStyle.textDecoration != "underline") {
90		eleStyle.textDecoration = "underline";
91	} else {
92		eleStyle.textDecoration = "none";
93	}
94}
95
96function makeLineThrough(id){
97	var eleStyle = xoopsGetElementById(id).style;
98	if (eleStyle.textDecoration != "line-through") {
99		eleStyle.textDecoration = "line-through";
100	} else {
101		eleStyle.textDecoration = "none";
102	}
103}
104
105function appendSelectOption(selectMenuId, optionName, optionValue){
106	var selectMenu = xoopsGetElementById(selectMenuId);
107	var newoption = new Option(optionName, optionValue);
108	selectMenu.options[selectMenu.length] = newoption;
109	selectMenu.options[selectMenu.length].selected = true;
110}
111
112function disableElement(target){
113	var targetDom = xoopsGetElementById(target);
114	if (targetDom.disabled != true) {
115		targetDom.disabled = true;
116	} else {
117		targetDom.disabled = false;
118	}
119}
120function xoopsCheckAll(formname, switchid) {
121	var ele = document.forms[formname].elements;
122	var switch_cbox = xoopsGetElementById(switchid);
123	for (var i = 0; i < ele.length; i++) {
124		var e = ele[i];
125		if ( (e.name != switch_cbox.name) && (e.type == 'checkbox') ) {
126			e.checked = switch_cbox.checked;
127		}
128	}
129}
130
131function xoopsCheckGroup(formname, switchid, groupid) {
132	var ele = document.forms[formname].elements;
133	var switch_cbox = xoopsGetElementById(switchid);
134	for (var i = 0; i < ele.length; i++) {
135		var e = ele[i];
136		if ( (e.type == 'checkbox') && (e.id == groupid) ) {
137			e.checked = switch_cbox.checked;
138			e.click(); e.click();  // Click to activate subgroups
139									// Twice so we don't reverse effect
140		}
141	}
142}
143
144function xoopsCheckAllElements(elementIds, switchId) {
145	var switch_cbox = xoopsGetElementById(switchId);
146	for (var i = 0; i < elementIds.length; i++) {
147		var e = xoopsGetElementById(elementIds[i]);
148		if ((e.name != switch_cbox.name) && (e.type == 'checkbox')) {
149			e.checked = switch_cbox.checked;
150		}
151	}
152}
153
154function xoopsSavePosition(id)
155{
156	var textareaDom = xoopsGetElementById(id);
157	if (textareaDom.createTextRange) {
158		textareaDom.caretPos = document.selection.createRange().duplicate();
159	}
160}
161
162function xoopsInsertText(domobj, text)
163{
164	if (domobj.createTextRange && domobj.caretPos){
165  		var caretPos = domobj.caretPos;
166		caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) 
167== ' ' ? text + ' ' : text;  
168	} else if (domobj.getSelection && domobj.caretPos){
169		var caretPos = domobj.caretPos;
170		caretPos.text = caretPos.text.charat(caretPos.text.length - 1)  
171== ' ' ? text + ' ' : text;
172	} else {
173		domobj.value = domobj.value + text;
174  	}
175}
176
177function xoopsCodeSmilie(id, smilieCode) {
178	var revisedMessage;
179	var textareaDom = xoopsGetElementById(id);
180	xoopsInsertText(textareaDom, smilieCode);
181	textareaDom.focus();
182	return;
183}
184
185function showImgSelected(imgId, selectId, imgDir, extra, xoopsUrl) {
186	if (xoopsUrl == null) {
187		xoopsUrl = "./";
188	}
189	imgDom = xoopsGetElementById(imgId);
190	selectDom = xoopsGetElementById(selectId);
191	imgDom.src = xoopsUrl + "/"+ imgDir + "/" + selectDom.options[selectDom.selectedIndex].value + extra;
192}
193
194function xoopsCodeUrl(id, enterUrlPhrase, enterWebsitePhrase){
195	if (enterUrlPhrase == null) {
196		enterUrlPhrase = "Enter the URL of the link you want to add:";
197	}
198	var text = prompt(enterUrlPhrase, "");
199	var domobj = xoopsGetElementById(id);
200	if ( text != null && text != "" ) {
201		if (enterWebsitePhrase == null) {
202			enterWebsitePhrase = "Enter the web site title:";
203		}
204		var text2 = prompt(enterWebsitePhrase, "");
205		if ( text2 != null ) {
206			if ( text2 == "" ) {
207				var result = "[url=" + text + "]" + text + "[/url]";
208			} else {
209				var pos = text2.indexOf(unescape('%00'));
210				if(0 < pos){
211					text2 = text2.substr(0,pos);
212				}
213				var result = "[url=" + text + "]" + text2 + "[/url]";
214			}
215			xoopsInsertText(domobj, result);
216		}
217	}
218	domobj.focus();
219}
220
221function xoopsCodeImg(id, enterImgUrlPhrase, enterImgPosPhrase, imgPosRorLPhrase, errorImgPosPhrase){
222	if (enterImgUrlPhrase == null) {
223		enterImgUrlPhrase = "Enter the URL of the image you want to add:";
224	}
225	var text = prompt(enterImgUrlPhrase, "");
226	var domobj = xoopsGetElementById(id);
227	if ( text != null && text != "" ) {
228		if (enterImgPosPhrase == null) {
229			enterImgPosPhrase = "Now, enter the position of the image.";
230		}
231		if (imgPosRorLPhrase == null) {
232			imgPosRorLPhrase = "'R' or 'r' for right, 'L' or 'l' for left, or leave it blank.";
233		}
234		if (errorImgPosPhrase == null) {
235			errorImgPosPhrase = "ERROR! Enter the position of the image:";
236		}
237		var text2 = prompt(enterImgPosPhrase + "\n" + imgPosRorLPhrase, "");
238		while ( ( text2 != "" ) && ( text2 != "r" ) && ( text2 != "R" ) && ( text2 != "l" ) && ( text2 != "L" ) && ( text2 != null ) ) {
239			text2 = prompt(errorImgPosPhrase + "\n" + imgPosRorLPhrase,"");
240		}
241		if ( text2 == "l" || text2 == "L" ) {
242			text2 = " align=left";
243		} else if ( text2 == "r" || text2 == "R" ) {
244			text2 = " align=right";
245		} else {
246			text2 = "";
247		}
248		var result = "[img" + text2 + "]" + text + "[/img]";
249		xoopsInsertText(domobj, result);
250	}
251	domobj.focus();
252}
253
254function xoopsCodeEmail(id, enterEmailPhrase){
255	if (enterEmailPhrase == null) {
256		enterEmailPhrase = "Enter the email address you want to add:";
257	}
258	var text = prompt(enterEmailPhrase, "");
259	var domobj = xoopsGetElementById(id);
260	if ( text != null && text != "" ) {
261		var result = "[email]" + text + "[/email]";
262		xoopsInsertText(domobj, result);
263	}
264	domobj.focus();
265}
266
267function xoopsCodeQuote(id, enterQuotePhrase){
268	if (enterQuotePhrase == null) {
269		enterQuotePhrase = "Enter the text that you want to be quoted:";
270	}
271	var text = prompt(enterQuotePhrase, "");
272	var domobj = xoopsGetElementById(id);
273	if ( text != null && text != "" ) {
274		var pos = text.indexOf(unescape('%00'));
275		if(0 < pos){
276			text = text.substr(0,pos);
277		}
278		var result = "[quote]" + text + "[/quote]";
279		xoopsInsertText(domobj, result);
280	}
281	domobj.focus();
282}
283
284function xoopsCodeCode(id, enterCodePhrase){
285	if (enterCodePhrase == null) {
286		enterCodePhrase = "Enter the codes that you want to add.";
287	}
288	var text = prompt(enterCodePhrase, "");
289	var domobj = xoopsGetElementById(id);
290	if ( text != null && text != "" ) {
291		var result = "[code]" + text + "[/code]";
292		xoopsInsertText(domobj, result);
293	}
294	domobj.focus();
295}
296
297function xoopsCodeText(id, hiddentext, enterTextboxPhrase){
298	var textareaDom = xoopsGetElementById(id);
299	var textDom = xoopsGetElementById(id + "Addtext");
300	var fontDom = xoopsGetElementById(id + "Font");
301	var colorDom = xoopsGetElementById(id + "Color");
302	var sizeDom = xoopsGetElementById(id + "Size");
303	var xoopsHiddenTextDomStyle = xoopsGetElementById(hiddentext).style;
304	var textDomValue = textDom.value;
305	var fontDomValue = fontDom.options[fontDom.options.selectedIndex].value;
306	var colorDomValue = colorDom.options[colorDom.options.selectedIndex].value;
307	var sizeDomValue = sizeDom.options[sizeDom.options.selectedIndex].value;
308	if ( textDomValue == "" ) {
309		if (enterTextboxPhrase == null) {
310			enterTextboxPhrase = "Please input text into the textbox.";
311		}
312		alert(enterTextboxPhrase);
313		textDom.focus();
314	} else {
315		if ( fontDomValue != "FONT") {
316			textDomValue = "[font=" + fontDomValue + "]" + textDomValue + "[/font]";
317			fontDom.options[0].selected = true;
318		}
319		if ( colorDomValue != "COLOR") {
320			textDomValue = "[color=" + colorDomValue + "]" + textDomValue + "[/color]";
321			colorDom.options[0].selected = true;
322		}
323		if ( sizeDomValue != "SIZE") {
324			textDomValue = "[size=" + sizeDomValue + "]" + textDomValue + "[/size]";
325			sizeDom.options[0].selected = true;
326		}
327		if (xoopsHiddenTextDomStyle.fontWeight == "bold" || xoopsHiddenTextDomStyle.fontWeight == "700") {
328			textDomValue = "[b]" + textDomValue + "[/b]";
329			xoopsHiddenTextDomStyle.fontWeight = "normal";
330		}
331		if (xoopsHiddenTextDomStyle.fontStyle == "italic") {
332			textDomValue = "[i]" + textDomValue + "[/i]";
333			xoopsHiddenTextDomStyle.fontStyle = "normal";
334		}
335		if (xoopsHiddenTextDomStyle.textDecoration == "underline") {
336			textDomValue = "[u]" + textDomValue + "[/u]";
337			xoopsHiddenTextDomStyle.textDecoration = "none";
338		}
339		if (xoopsHiddenTextDomStyle.textDecoration == "line-through") {
340			textDomValue = "[d]" + textDomValue + "[/d]";
341			xoopsHiddenTextDomStyle.textDecoration = "none";
342		}
343		xoopsInsertText(textareaDom, textDomValue);
344		textDom.value = "";
345		xoopsHiddenTextDomStyle.color = "#000000";
346		xoopsHiddenTextDomStyle.fontFamily = "";
347		xoopsHiddenTextDomStyle.fontSize = "12px";
348		xoopsHiddenTextDomStyle.visibility = "hidden";
349		textareaDom.focus();
350	}
351}
352
353function xoopsValidate(subjectId, textareaId, submitId, plzCompletePhrase, msgTooLongPhrase, allowedCharPhrase, currCharPhrase) {
354	var maxchars = 65535;
355	var subjectDom = xoopsGetElementById(subjectId);
356	var textareaDom = xoopsGetElementById(textareaId);
357	var submitDom = xoopsGetElementById(submitId);
358	if (textareaDom.value == "" || subjectDom.value == "") {
359		if (plzCompletePhrase == null) {
360			plzCompletePhrase = "Please complete the subject and message fields.";
361		}
362		alert(plzCompletePhrase);
363		return false;
364	}
365	if (maxchars != 0) {
366		if (textareaDom.value.length > maxchars) {
367			if (msgTooLongPhrase == null) {
368				msgTooLongPhrase = "Your message is too long.";
369			}
370			if (allowedCharPhrase == null) {
371				allowedCharPhrase = "Allowed max chars length: ";
372			}
373			if (currCharPhrase == null) {
374				currCharPhrase = "Current chars length: ";
375			}
376			alert(msgTooLongPhrase + "\n\n" + allowedCharPhrase + maxchars + "\n" + currCharPhrase + textareaDom.value.length + "");
377			textareaDom.focus();
378			return false;
379		} else {
380			submitDom.disabled = true;
381			return true;
382		}
383	} else {
384		submitDom.disabled = true;
385		return true;
386	}
387}

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.