PageSourceSearch

http://diaspora-grecque.com/include/xoops.js

js diaspora-grecque.com collected 2026-10-02 12:20:16 UTC 11,846 bytes, 391 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	if (selectDom.options[selectDom.selectedIndex].value != "") {
192		imgDom.src = xoopsUrl + "/"+ imgDir + "/" + selectDom.options[selectDom.selectedIndex].value + extra;
193	} else {
194		imgDom.src = xoopsUrl + "/uploads/blank.gif";
195	}
196}
197
198function xoopsCodeUrl(id, enterUrlPhrase, enterWebsitePhrase){
199	if (enterUrlPhrase == null) {
200		enterUrlPhrase = "Enter the URL of the link you want to add:";
201	}
202	var text = prompt(enterUrlPhrase, "");
203	var domobj = xoopsGetElementById(id);
204	if ( text != null && text != "" ) {
205		if (enterWebsitePhrase == null) {
206			enterWebsitePhrase = "Enter the web site title:";
207		}
208		var text2 = prompt(enterWebsitePhrase, "");
209		if ( text2 != null ) {
210			if ( text2 == "" ) {
211				var result = "[url=" + text + "]" + text + "[/url]";
212			} else {
213				var pos = text2.indexOf(unescape('%00'));
214				if(0 < pos){
215					text2 = text2.substr(0,pos);
216				}
217				var result = "[url=" + text + "]" + text2 + "[/url]";
218			}
219			xoopsInsertText(domobj, result);
220		}
221	}
222	domobj.focus();
223}
224
225function xoopsCodeImg(id, enterImgUrlPhrase, enterImgPosPhrase, imgPosRorLPhrase, errorImgPosPhrase){
226	if (enterImgUrlPhrase == null) {
227		enterImgUrlPhrase = "Enter the URL of the image you want to add:";
228	}
229	var text = prompt(enterImgUrlPhrase, "");
230	var domobj = xoopsGetElementById(id);
231	if ( text != null && text != "" ) {
232		if (enterImgPosPhrase == null) {
233			enterImgPosPhrase = "Now, enter the position of the image.";
234		}
235		if (imgPosRorLPhrase == null) {
236			imgPosRorLPhrase = "'R' or 'r' for right, 'L' or 'l' for left, or leave it blank.";
237		}
238		if (errorImgPosPhrase == null) {
239			errorImgPosPhrase = "ERROR! Enter the position of the image:";
240		}
241		var text2 = prompt(enterImgPosPhrase + "\n" + imgPosRorLPhrase, "");
242		while ( ( text2 != "" ) && ( text2 != "r" ) && ( text2 != "R" ) && ( text2 != "l" ) && ( text2 != "L" ) && ( text2 != null ) ) {
243			text2 = prompt(errorImgPosPhrase + "\n" + imgPosRorLPhrase,"");
244		}
245		if ( text2 == "l" || text2 == "L" ) {
246			text2 = " align=left";
247		} else if ( text2 == "r" || text2 == "R" ) {
248			text2 = " align=right";
249		} else {
250			text2 = "";
251		}
252		var result = "[img" + text2 + "]" + text + "[/img]";
253		xoopsInsertText(domobj, result);
254	}
255	domobj.focus();
256}
257
258function xoopsCodeEmail(id, enterEmailPhrase){
259	if (enterEmailPhrase == null) {
260		enterEmailPhrase = "Enter the email address you want to add:";
261	}
262	var text = prompt(enterEmailPhrase, "");
263	var domobj = xoopsGetElementById(id);
264	if ( text != null && text != "" ) {
265		var result = "[email]" + text + "[/email]";
266		xoopsInsertText(domobj, result);
267	}
268	domobj.focus();
269}
270
271function xoopsCodeQuote(id, enterQuotePhrase){
272	if (enterQuotePhrase == null) {
273		enterQuotePhrase = "Enter the text that you want to be quoted:";
274	}
275	var text = prompt(enterQuotePhrase, "");
276	var domobj = xoopsGetElementById(id);
277	if ( text != null && text != "" ) {
278		var pos = text.indexOf(unescape('%00'));
279		if(0 < pos){
280			text = text.substr(0,pos);
281		}
282		var result = "[quote]" + text + "[/quote]";
283		xoopsInsertText(domobj, result);
284	}
285	domobj.focus();
286}
287
288function xoopsCodeCode(id, enterCodePhrase){
289	if (enterCodePhrase == null) {
290		enterCodePhrase = "Enter the codes that you want to add.";
291	}
292	var text = prompt(enterCodePhrase, "");
293	var domobj = xoopsGetElementById(id);
294	if ( text != null && text != "" ) {
295		var result = "[code]" + text + "[/code]";
296		xoopsInsertText(domobj, result);
297	}
298	domobj.focus();
299}
300
301function xoopsCodeText(id, hiddentext, enterTextboxPhrase){
302	var textareaDom = xoopsGetElementById(id);
303	var textDom = xoopsGetElementById(id + "Addtext");
304	var fontDom = xoopsGetElementById(id + "Font");
305	var colorDom = xoopsGetElementById(id + "Color");
306	var sizeDom = xoopsGetElementById(id + "Size");
307	var xoopsHiddenTextDomStyle = xoopsGetElementById(hiddentext).style;
308	var textDomValue = textDom.value;
309	var fontDomValue = fontDom.options[fontDom.options.selectedIndex].value;
310	var colorDomValue = colorDom.options[colorDom.options.selectedIndex].value;
311	var sizeDomValue = sizeDom.options[sizeDom.options.selectedIndex].value;
312	if ( textDomValue == "" ) {
313		if (enterTextboxPhrase == null) {
314			enterTextboxPhrase = "Please input text into the textbox.";
315		}
316		alert(enterTextboxPhrase);
317		textDom.focus();
318	} else {
319		if ( fontDomValue != "FONT") {
320			textDomValue = "[font=" + fontDomValue + "]" + textDomValue + "[/font]";
321			fontDom.options[0].selected = true;
322		}
323		if ( colorDomValue != "COLOR") {
324			textDomValue = "[color=" + colorDomValue + "]" + textDomValue + "[/color]";
325			colorDom.options[0].selected = true;
326		}
327		if ( sizeDomValue != "SIZE") {
328			textDomValue = "[size=" + sizeDomValue + "]" + textDomValue + "[/size]";
329			sizeDom.options[0].selected = true;
330		}
331		if (xoopsHiddenTextDomStyle.fontWeight == "bold" || xoopsHiddenTextDomStyle.fontWeight == "700") {
332			textDomValue = "[b]" + textDomValue + "[/b]";
333			xoopsHiddenTextDomStyle.fontWeight = "normal";
334		}
335		if (xoopsHiddenTextDomStyle.fontStyle == "italic") {
336			textDomValue = "[i]" + textDomValue + "[/i]";
337			xoopsHiddenTextDomStyle.fontStyle = "normal";
338		}
339		if (xoopsHiddenTextDomStyle.textDecoration == "underline") {
340			textDomValue = "[u]" + textDomValue + "[/u]";
341			xoopsHiddenTextDomStyle.textDecoration = "none";
342		}
343		if (xoopsHiddenTextDomStyle.textDecoration == "line-through") {
344			textDomValue = "[d]" + textDomValue + "[/d]";
345			xoopsHiddenTextDomStyle.textDecoration = "none";
346		}
347		xoopsInsertText(textareaDom, textDomValue);
348		textDom.value = "";
349		xoopsHiddenTextDomStyle.color = "#000000";
350		xoopsHiddenTextDomStyle.fontFamily = "";
351		xoopsHiddenTextDomStyle.fontSize = "12px";
352		xoopsHiddenTextDomStyle.visibility = "hidden";
353		textareaDom.focus();
354	}
355}
356
357function xoopsValidate(subjectId, textareaId, submitId, plzCompletePhrase, msgTooLongPhrase, allowedCharPhrase, currCharPhrase) {
358	var maxchars = 65535;
359	var subjectDom = xoopsGetElementById(subjectId);
360	var textareaDom = xoopsGetElementById(textareaId);
361	var submitDom = xoopsGetElementById(submitId);
362	if (textareaDom.value == "" || subjectDom.value == "") {
363		if (plzCompletePhrase == null) {
364			plzCompletePhrase = "Please complete the subject and message fields.";
365		}
366		alert(plzCompletePhrase);
367		return false;
368	}
369	if (maxchars != 0) {
370		if (textareaDom.value.length > maxchars) {
371			if (msgTooLongPhrase == null) {
372				msgTooLongPhrase = "Your message is too long.";
373			}
374			if (allowedCharPhrase == null) {
375				allowedCharPhrase = "Allowed max chars length: ";
376			}
377			if (currCharPhrase == null) {
378				currCharPhrase = "Current chars length: ";
379			}
380			alert(msgTooLongPhrase + "\n\n" + allowedCharPhrase + maxchars + "\n" + currCharPhrase + textareaDom.value.length + "");
381			textareaDom.focus();
382			return false;
383		} else {
384			submitDom.disabled = true;
385			return true;
386		}
387	} else {
388		submitDom.disabled = true;
389		return true;
390	}
391}

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.