1 2 3var userAgent = navigator.userAgent.toLowerCase(); 4var is_opera = (userAgent.indexOf('opera') != -1); 5var is_saf = ((userAgent.indexOf('applewebkit') != -1) || (navigator.vendor == 'Apple Computer, Inc.')); 6var is_webtv = (userAgent.indexOf('webtv') != -1); 7var is_ie = ((userAgent.indexOf('msie') != -1) && (!is_opera) && (!is_saf) && (!is_webtv)); 8var is_ie4 = ((is_ie) && (userAgent.indexOf('msie 4.') != -1)); 9var is_moz = ((navigator.product == 'Gecko') && (!is_saf)); 10var is_kon = (userAgent.indexOf('konqueror') != -1); 11var is_ns = ((userAgent.indexOf('compatible') == -1) && (userAgent.indexOf('mozilla') != -1) && (!is_opera) && (!is_webtv) && (!is_saf)); 12var is_ns4 = ((is_ns) && (parseInt(navigator.appVersion) == 4)); 13var is_mac = (userAgent.indexOf('mac') != -1); 14var sPop = null; 15var postSubmited = false; 16 17 18function ctlent(event) { 19 if(postSubmited == false && (event.ctrlKey && event.keyCode == 13) || (event.altKey && event.keyCode == 83) && $('postsubmit')) { 20 if(in_array($('postsubmit').name, ['topicsubmit', 'replysubmit', 'editsubmit']) && !validate($('postform'))) { 21 return; 22 } 23 postSubmited = true; 24 $('postsubmit').disabled = true; 25 $('postform').submit(); 26 } 27} 28 29function storeCaret(textEl){ 30 if(textEl.createTextRange){ 31 textEl.caretPos = document.selection.createRange().duplicate(); 32 } 33} 34 35function checkall(form, prefix, checkall) { 36 var checkall = checkall ? checkall : 'chkall'; 37 for(var i = 0; i < form.elements.length; i++) { 38 var e = form.elements[i]; 39 if(e.name != checkall && (!prefix || (prefix && e.name.match(prefix)))) { 40 e.checked = form.elements[checkall].checked; 41 } 42 } 43} 44 45function arraypop(a) { 46 if(typeof a != 'object' || !a.length) { 47 return null; 48 } else { 49 var response = a[a.length - 1]; 50 a.length--; 51 return response; 52 } 53} 54 55function arraypush(a, value) { 56 a[a.length] = value; 57 return a.length; 58} 59 60 61function findtags(parentobj, tag) { 62 if(typeof parentobj.getElementsByTagName != 'undefined') {return parentobj.getElementsByTagName(tag);} 63 else if(parentobj.all && parentobj.all.tags) {return parentobj.all.tags(tag);} 64 else {return null;} 65} 66 67function copycode(obj) { 68 var rng = document.body.createTextRange(); 69 rng.moveToElementText(obj); 70 rng.scrollIntoView(); 71 rng.select(); 72 rng.execCommand("Copy"); 73 rng.collapse(false); 74} 75 76function toggle_collapse(objname, unfolded) { 77 if(typeof unfolded == 'undefined') { 78 var unfolded = 1; 79 } 80 var obj = $(objname); 81 var oldstatus = obj.style.display; 82 var collapsed = getcookie('discuz_collapse'); 83 var cookie_start = collapsed ? collapsed.indexOf(objname) : -1; 84 var cookie_end = cookie_start + objname.length + 1; 85 86 obj.style.display = oldstatus == 'none' ? '' : 'none'; 87 collapsed = cookie_start != -1 && ((unfolded && oldstatus == 'none') || (!unfolded && oldstatus == '')) ? 88 collapsed.substring(0, cookie_start) + collapsed.substring(cookie_end, collapsed.length) : ( 89 cookie_start == -1 && ((unfolded && oldstatus == '') || (!unfolded && oldstatus == 'none')) ? 90 collapsed + objname + ' ' : collapsed); 91 92 expires = new Date(); 93 expires.setTime(expires.getTime() + (collapsed ? 86400 * 30 : -(86400 * 30 * 1000))); 94 document.cookie = 'discuz_collapse=' + escape(collapsed) + '; expires=' + expires.toGMTString() + '; path=/'; 95 96 var img = $(objname + '_img'); 97 var img_regexp = new RegExp((oldstatus == 'none' ? '_yes' : '_no') + '\\.gif$'); 98 var img_re = oldstatus == 'none' ? '_no.gif' : '_yes.gif' 99 if(img) { 100 img.src = img.src.replace(img_regexp, img_re); 101 } 102} 103 104function imgzoom(o) { 105 if(event.ctrlKey) { 106 var zoom = parseInt(o.style.zoom, 10) || 100; 107 zoom -= event.wheelDelta / 12; 108 if(zoom > 0) { 109 o.style.zoom = zoom + '%'; 110 } 111 return false; 112 } else { 113 return true; 114 } 115} 116 117function getcookie(name) { 118 var cookie_start = document.cookie.indexOf(name); 119 var cookie_end = document.cookie.indexOf(";", cookie_start); 120 return cookie_start == -1 ? '' : unescape(document.cookie.substring(cookie_start + name.length + 1, (cookie_end > cookie_start ? cookie_end : document.cookie.length))); 121} 122 123function AddText(txt) { 124 obj = $('postform').message; 125 selection = document.selection; 126 checkFocus(); 127 if(typeof(obj.selectionStart) != 'undefined') { 128 var opn = obj.selectionStart + 0; 129 obj.value = obj.value.substr(0, obj.selectionStart) + txt + obj.value.substr(obj.selectionEnd); 130 } else if(selection && selection.createRange) { 131 var sel = selection.createRange(); 132 sel.text = txt; 133 sel.moveStart('character', -mb_strlen(txt)); 134 } else { 135 obj.value += txt; 136 } 137} 138 139function insertAtCaret (textEl, text){ 140 if(textEl.createTextRange && textEl.caretPos){ 141 var caretPos = textEl.caretPos; 142 caretPos.text += caretPos.text.charAt(caretPos.text.length - 2) == ' ' ? text + ' ' : text; 143 } else if(textEl) { 144 textEl.value += text; 145 } else { 146 textEl.value = text; 147 } 148} 149 150function checkFocus() { 151 var obj = typeof wysiwyg == 'undefined' || !wysiwyg ? $('postform').message : editwin; 152 if(!obj.hasfocus) { 153 obj.focus(); 154 } 155} 156 157function closesmiliewindow(e) { 158 if(typeof smiliewindow != 'undefined' && !smiliewindow.closed) { 159 smiliewindow.close(); 160 } 161} 162 163function opensmiliewindow(width, height, editorid) { 164 smiliewindow = window.open('post.php?action=smilies' + (editorid ? '&editorid=' + editorid : ''), 'Popup', 'width=' + width + ',height=' + height + ',resizable=yes,scrollbars=yes'); 165 window.onunload = closesmiliewindow; 166} 167 168function mb_strlen(str) { 169 return (is_ie && str.indexOf('\n') != -1) ? str.replace(/\r?\n/g, '_').length : str.length; 170} 171 172function insertSmiley(smilieid) { 173 checkFocus(); 174 var src = $('smilie_' + smilieid).src; 175 var code = $('smilie_' + smilieid).pop ? $('smilie_' + smilieid).pop : $('smilie_' + smilieid).alt; 176 if(typeof wysiwyg != 'undefined' && wysiwyg && allowsmilies && (!$('smileyoff') || $('smileyoff').checked == false)) { 177 if(is_moz) { 178 applyFormat('InsertImage', false, src); 179 var smilies = findtags(editdoc.body, 'img'); 180 for(var i = 0; i < smilies.length; i++) { 181 if(smilies[i].src == src && smilies[i].getAttribute('smilieid') < 1) { 182 smilies[i].setAttribute('smilieid', smilieid); 183 smilies[i].setAttribute('border', "0"); 184 } 185 } 186 } else { 187 insertText('<img src="' + src + '" border="0" smilieid="' + smilieid + '" alt="" /> ', false); 188 } 189 } else { 190 code += ' '; 191 AddText(code); 192 } 193} 194 195function announcement() { 196 $('announcement').innerHTML = '<marquee style="filter:progid:DXImageTransform.Microsoft.Alpha(startX=0, startY=0, finishX=10, finishY=100,style=1,op
196acity=0,finishOpacity=100); margin: 0px 8px" direction="left" scrollamount="2" scrolldelay="1" onMouseOver="this.stop();" onMouseOut="this.start();">' + 197 $('announcement').innerHTML + '</marquee>'; 198 $('announcement').style.display = 'block'; 199} 200 201function $(id) { 202 return document.getElementById(id); 203} 204 205function in_array(needle, haystack) { 206 if(typeof needle == 'string') { 207 for(var i in haystack) { 208 if(haystack[i] == needle) { 209 return true; 210 } 211 } 212 } 213 return false; 214} 215 216//document.write("<style type='text/css'id='defaultPopStyle'>"); 217//document.write(".cPopText { font-family: Tahoma, Verdana; background-color: #FFFFCC; border: 1px #000000 solid; font-size: 12px; padding-right: 4px; padding-left: 4px; line-height: 18px; padding-top: 2px; padding-bottom: 2px; visibility: hidden; filter: Alpha(Opacity=80)}"); 218 219//document.write("</style>"); 220document.write("<div id='popLayer' style='position:absolute;z-index:1000' class='cPopText'></div>"); 221 222function showPopupText(event) { 223 if(event.srcElement) o = event.srcElement; else o = event.target; 224 if(!o) { 225 return; 226 } 227 MouseX = event.clientX; 228 MouseY = event.clientY; 229 if(o.alt != null && o.alt != '') { 230 o.pop = o.alt; 231 o.alt = ''; 232 } 233 if(o.title != null && o.title != '') { 234 o.pop = o.title; 235 o.title = ''; 236 } 237 if(o.pop != sPop) { 238 sPop = o.pop; 239 if(sPop == null || sPop == '') { 240 $('popLayer').style.visibility = "hidden"; 241 } else { 242 popStyle = o.dyclass != null ? o.dyclass : 'cPopText'; 243 $('popLayer').style.visibility = "visible"; 244 showIt(); 245 } 246 } 247} 248 249function showIt() { 250 $('popLayer').className = popStyle; 251 $('popLayer').innerHTML = sPop.replace(/<(.*)>/g,"<$1>").replace(/\n/g,"<br>"); 252 var popWidth = $('popLayer').clientWidth; 253 var popHeight = $('popLayer').clientHeight; 254 var popLeftAdjust = MouseX + 12 + popWidth > document.body.clientWidth ? -popWidth - 24 : 0; 255 var popTopAdjust = MouseY + 12 + popHeight > document.body.clientHeight ? -popHeight - 24: 0; 256 $('popLayer').style.left = (MouseX + 12 + document.body.scrollLeft + popLeftAdjust) + 'px'; 257 $('popLayer').style.top = (MouseY + 12 + document.body.scrollTop + popTopAdjust) + 'px'; 258} 259 260if(!document.onmouseover) { 261 document.onmouseover = function(e) { 262 var event = e ? e : window.event; 263 showPopupText(event); 264 }; 265}
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.