PageSourceSearch

https://teachspacescience.org/messipoker/js/fungsi_memo.js?v=1.14.66

js teachspacescience.org collected 2026-10-02 10:52:50 UTC 6,549 bytes, 182 lines download raw bytes

1var imageTag = false;
2var theSelection = false;
3
4// Check for Browser & Platform for PC & IE specific bits
5// More details from: http://www.mozilla.org/docs/web-developer/sniffer/browser_type.html
6var clientPC = navigator.userAgent.toLowerCase(); // Get client info
7var clientVer = parseInt(navigator.appVersion); // Get browser version
8
9var is_ie = ((clientPC.indexOf("msie") != -1) && (clientPC.indexOf("opera") == -1));
10var is_nav = ((clientPC.indexOf('mozilla')!=-1) && (clientPC.indexOf('spoofer')==-1)
11                && (clientPC.indexOf('compatible') == -1) && (clientPC.indexOf('opera')==-1)
12                && (clientPC.indexOf('webtv')==-1) && (clientPC.indexOf('hotjava')==-1));
13var is_moz = 0;
14
15var is_win = ((clientPC.indexOf("win")!=-1) || (clientPC.indexOf("16bit") != -1));
16var is_mac = (clientPC.indexOf("mac")!=-1);
17
18br_help = 'Break Lines: text<br> (alt+x)';
19b_help = 'Bold text: <b>text</b>  (alt+b)';
20i_help = 'Italic text: <i>text</i>  (alt+i)';
21u_help = 'Underline text: <u>text</u>  (alt+u)';
22q_help = 'Quote text: <quote>text</quote>  (alt+q)';
23c_help = 'Code display: <code>code</code>  (alt+c)';
24l_help = 'List: <list>text</list> (alt+l)';
25o_help = 'Ordered list: <list=>text</list>  (alt+o)';
26p_help = 'Insert image: <img>http://image_url</img>  (alt+p)';
27w_help = 'Insert URL: <url>http://url</url> or <url=http://url>URL text</url>  (alt+w)';
28a_help = 'Close all open bbCode tags';
29s_help = 'Font color: <color=red>text</color>  Tip: you can also use color=#FF0000';
30f_help = 'Font size: <size=x-small>small text</size>';
31
32// Define the bbCode tags
33bbcode = new Array();
34bbtags = new Array('<b>','</b>','<i>','</i>','<u>','</u>','<quote>','</quote>','<code>','</code>','<list>','</list>','<list=>','</list>','<img>','</img>','<url>','</url>','<br>','<br>');
35imageTag = false;
36function getarraysize(thearray) {
37    for (i = 0; i < thearray.length; i++) {
38        if ((thearray[i] == "undefined") || (thearray[i] == "") || (thearray[i] == null))
39            return i;
40        }
41    return thearray.length;
42}
43
44// Replacement for arrayname.push(value) not implemented in IE until version 5.5
45// Appends element to the array
46function arraypush(thearray,value) {
47    thearray[ getarraysize(thearray) ] = value;
48}
49
50// Replacement for arrayname.pop() not implemented in IE until version 5.5
51// Removes and returns the last element of an array
52function arraypop(thearray) {
53    thearraysize = getarraysize(thearray);
54    retval = thearray[thearraysize - 1];
55    delete thearray[thearraysize - 1];
56    return retval;
57}
58function checkForm() {
59
60    formErrors = false;    
61
62    if (document.memo.descr.value.length < 2) {
63        formErrors = "Please Fill Your Messages";
64    }
65
66    if (formErrors) {
67        alert(formErrors);
68        return false;
69    } else {
70        bbstyle(-1);
71        //formObj.preview.disabled = true;
72        //formObj.submit.disabled = true;
73        return true;
74    }
75}
76function helpline(help) {
77    document.memo.helpbox.value = eval(help + "_help");
78}
79
80function bbfontstyle(bbopen, bbclose) {
81    var txtarea = document.memo.descr;
82
83    if ((clientVer >= 4) && is_ie && is_win) {
84        theSelection = document.selection.createRange().text;
85        if (!theSelection) {
86            txtarea.value += bbopen + bbclose;
87            txtarea.focus();
88            return;
89        }
90        document.selection.createRange().text = bbopen + theSelection + bbclose;
91        txtarea.focus();
92        return;
93    }
94    else if (txtarea.selectionEnd && (txtarea.selectionEnd - txtarea.selectionStart > 0))
95    {
96        mozWrap(txtarea, bbopen, bbclose);
97        return;
98    }
99    else
100    {
101        txtarea.value += bbopen + bbclose;
102        txtarea.focus();
103    }
104    //storeCaret(txtarea);
105}
106
107
108function bbstyle(bbnumber) {
109    var txtarea = document.memo.descr;
110
111    txtarea.focus();
112    donotinsert = false;
113    theSelection = false;
114    bblast = 0;
115
116    if (bbnumber == -1) { // Close all open tags & default button names
117        while (bbcode[0]) {
118            butnumber = arraypop(bbcode) - 1;
119            txtarea.value += bbtags[butnumber + 1];
120            buttext = eval('document.memo.addbbcode' + butnumber + '.value');
121            eval('document.memo.addbbcode' + butnumber + '.value ="' + buttext.substr(0,(buttext.length - 1)) + '"');
122        }
123        imageTag = false; // All tags are closed including image tags :D
124        txtarea.focus();
125        return;
126    }
127
128    if ((clientVer >= 4) && is_ie && is_win)
129    {
130        theSelection = document.selection.createRange().text; // Get text selection
131        if (theSelection) {
132            // Add tags around selection
133            document.selection.createRange().text = bbtags[bbnumber] + theSelection + bbtags[bbnumber+1];
134            txtarea.focus();
135            theSelection = '';
136            return;
137        }
138    }
139    else if (txtarea.selectionEnd && (txtarea.selectionEnd - txtarea.selectionStart > 0))
140    {
141        mozWrap(txtarea, bbtags[bbnumber], bbtags[bbnumber+1]);
142        return;
143    }
144    
145    // Find last occurance of an open tag the same as the one just clicked
146    for (i = 0; i < bbcode.length; i++) {
147        if (bbcode[i] == bbnumber+1) {
148            bblast = i;
149            donotinsert = true;
150        }
151    }
152
153    if (donotinsert) {      // Close all open tags up to the one just clicked & default button names
154        while (bbcode[bblast]) {
155                butnumber = arraypop(bbcode) - 1;
156                txtarea.value += bbtags[butnumber + 1];
157                buttext = eval('document.memo.addbbcode' + butnumber + '.value');
158                eval('document.memo.addbbcode' + butnumber + '.value ="' + buttext.substr(0,(buttext.length - 1)) + '"');
159                imageTag = false;
160            }
161            txtarea.focus();
162            return;
163    } else { // Open tags
164    
165        if (imageTag && (bbnumber != 14)) {     // Close image tag before adding another
166            txtarea.value += bbtags[15];
167            lastValue = arraypop(bbcode) - 1;   // Remove the close image tag from the list
168            document.memo.addbbcode14.value = "Img";    // Return button back to normal state
169            imageTag = false;
170        }
171        
172        // Open tag
173        txtarea.value += bbtags[bbnumber];
174        if ((bbnumber == 14) && (imageTag == false)) imageTag = 1; // Check to stop additional tags after an unclosed image tag
175        arraypush(bbcode,bbnumber+1);
176        eval('document.memo.addbbcode'+bbnumber+'.value += "*"');
177        txtarea.focus();
178        return;
179    }
180    //storeCaret(txtarea);
181}
182

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.