1/* 2 [Discuz!] (C)2001-2099 Comsenz Inc. 3 This is NOT a freeware, use is subject to license terms 4 5 $Id: forum.js 33824 2013-08-19 08:26:11Z nemohou $ 6*/ 7 8function saveData(ignoreempty) { 9 var ignoreempty = isUndefined(ignoreempty) ? 0 : ignoreempty; 10 var obj = $('postform') && (($('fwin_newthread') && $('fwin_newthread').style.display == '') || ($('fwin_reply') && $('fwin_reply').style.display == '')) ? $('postform') : ($('fastpostform') ? $('fastpostform') : $('postform')); 11 if(!obj) return; 12 if(typeof isfirstpost != 'undefined') { 13 if(typeof wysiwyg != 'undefined' && wysiwyg == 1) { 14 var messageisnull = trim(html2bbcode(editdoc.body.innerHTML)) === ''; 15 } else { 16 var messageisnull = $('postform').message.value === ''; 17 } 18 if(isfirstpost && (messageisnull && $('postform').subject.value === '')) { 19 return; 20 } 21 if(!isfirstpost && messageisnull) { 22 return; 23 } 24 } 25 var data = subject = message = ''; 26 for(var i = 0; i < obj.elements.length; i++) { 27 var el = obj.elements[i]; 28 if(el.name != '' && (el.tagName == 'SELECT' || el.tagName == 'TEXTAREA' || el.tagName == 'INPUT' && (el.type == 'text' || el.type == 'checkbox' || el.type == 'radio' || el.type == 'hidden' || el.type == 'select')) && el.name.substr(0, 6) != 'attach') { 29 var elvalue = el.value; 30 if(el.name == 'subject') { 31 subject = trim(elvalue); 32 } else if(el.name == 'message') { 33 if(typeof wysiwyg != 'undefined' && wysiwyg == 1) { 34 elvalue = html2bbcode(editdoc.body.innerHTML); 35 } 36 message = trim(elvalue); 37 } 38 if((el.type == 'checkbox' || el.type == 'radio') && !el.checked) { 39 continue; 40 } else if(el.tagName == 'SELECT') { 41 elvalue = el.value; 42 } else if(el.type == 'hidden') { 43 if(el.id) { 44 eval('var check = typeof ' + el.id + '_upload == \'function\''); 45 if(check) { 46 elvalue = elvalue; 47 if($(el.id + '_url')) { 48 elvalue += String.fromCharCode(1) + $(el.id + '_url').value; 49 } 50 } else { 51 continue; 52 } 53 } else { 54 continue; 55 } 56 } 57 if(trim(elvalue)) { 58 data += el.name + String.fromCharCode(9) + el.tagName + String.fromCharCode(9) + el.type + String.fromCharCode(9) + elvalue + String.fromCharCode(9, 9); 59 } 60 } 61 } 62 63 if(!subject && !message && !ignoreempty) { 64 return; 65 } 66 67 saveUserdata('forum_'+discuz_uid, data); 68} 69 70function fastUload() { 71 appendscript(JSPATH + 'forum_post.js?' + VERHASH); 72 safescript('forum_post_js', function () { uploadWindow(function (aid, url) {updatefastpostattach(aid, url)}, 'file') }, 100, 50); 73} 74 75function switchAdvanceMode(url) { 76 var obj = $('postform') && (($('fwin_newthread') && $('fwin_newthread').style.display == '') || ($('fwin_reply') && $('fwin_reply').style.display == '')) ? $('postform') : $('fastpostform'); 77 if(obj && obj.message.value != '') { 78 saveData(); 79 url += (url.indexOf('?') != -1 ? '&' : '?') + 'cedit=yes'; 80 } 81 location.href = url; 82 return false; 83} 84 85function sidebar_collapse(lang) { 86 if(lang[0]) { 87 toggle_collapse('sidebar', null, null, lang); 88 $('wrap').className = $('wrap').className == 'wrap with_side s_clear' ? 'wrap s_clear' : 'wrap with_side s_clear'; 89 } else { 90 var collapsed = getcookie('collapse'); 91 collapsed = updatestring(collapsed, 'sidebar', 1); 92 setcookie('collapse', collapsed, (collapsed ? 2592000 : -2592000)); 93 location.reload(); 94 } 95} 96 97function keyPageScroll(e, prev, next, url, page) { 98 if(loadUserdata('is_blindman')) { 99 return true; 100 } 101 e = e ? e : window.event; 102 var tagname = BROWSER.ie ? e.srcElement.tagName : e.target.tagName; 103 if(tagname == 'INPUT' || tagname == 'TEXTAREA') return; 104 actualCode = e.keyCode ? e.keyCode : e.charCode; 105 if(next && actualCode == 39) { 106 window.location = url + '&page=' + (page + 1); 107 } 108 if(prev && actualCode == 37) { 109 window.location = url + '&page=' + (page - 1); 110 } 111} 112 113function announcement() { 114 var ann = new Object(); 115 ann.anndelay = 3000; 116 ann.annst = 0; 117 ann.annstop = 0; 118 ann.annrowcount = 0; 119 ann.anncount = 0; 120 ann.annScrollTopBegin = 0; 121 ann.annlis = $('anc').getElementsByTagName("li"); 122 ann.annrows = new Array(); 123 ann.announcementScroll = function() { 124 if (this.annstop) { 125 this.annst = setTimeout(function() { 126 ann.announcementScroll(); 127 }, this.anndelay); 128 return; 129 } 130 if (!this.annst) { 131 var lasttop = -1; 132 for (i = 0; i < this.annlis.length; i++) { 133 if (lasttop != this.annlis[i].offsetTop) { 134 this.annrows[this.annrowcount] = this.annlis[i].offsetTop - this.annlis[0].offsetTop; 135 this.annrowcount++; 136 } 137 lasttop = this.annlis[i].offsetTop; 138 } 139 if (this.annrows.length == 1) { 140 $('an').onmouseover = $('an').onmouseout = null; 141 } else { 142 $('ancl').innerHTML += $('ancl').innerHTML; 143 this.annst = setTimeout(function() { 144 ann.announcementScroll(); 145 }, this.anndelay); 146 $('an').onmouseover = function() { 147 ann.annstop = 1; 148 }; 149 $('an').onmouseout = function() { 150 ann.annstop = 0; 151 }; 152 } 153 this.annrowcount = 1; 154 return; 155 } 156 if (this.annrowcount >= this.annrows.length) { 157 $('anc').scrollTop = 0; 158 this.annrowcount = 1; 159 this.annst = setTimeout(function() { 160 ann.announcementScroll(); 161 }, this.anndelay); 162 } else { 163 this.anncount = 0; 164 this.annScrollTopBegin = $('anc').scrollTop; 165 this.announcementScrollnext(this.annrows[this.annrowcount]); 166 } 167 } 168 ; 169 ann.announcementScrollnext = function(targetTop) { 170 $('anc').scrollTop = this.annScrollTopBegin + this.anncount; 171 this.anncount++; 172 if ($('anc').scrollTop < targetTop) { 173 this.annst = setTimeout(function() { 174 ann.announcementScrollnext(targetTop); 175 }, 10); 176 } else { 177 this.annrowcount++; 178 this.annst = setTimeout(function() { 179 ann.announcementScroll(); 180 }, this.anndelay); 181 } 182 } 183 ; 184 ann.announcementScroll(); 185} 186
187function removeindexheats() { 188 return confirm('æ¨ç¢ºèªè¦ææ¤ä¸»é¡å¾ç±é»ä¸»é¡ä¸ç§»é¤éº¼ï¼'); 189} 190 191function showTypes(id, mod) { 192 var o = $(id); 193 if(!o) return false; 194 var s = o.className; 195 mod = isUndefined(mod) ? 1 : mod; 196 var baseh = o.getElementsByTagName('li')[0].offsetHeight * 2; 197 var tmph = o.offsetHeight; 198 var lang = ['å±é', 'æ¶èµ·']; 199 var cls = ['unfold', 'fold']; 200 if(tmph > baseh) { 201 var octrl = document.createElement('li'); 202 octrl.className = cls[mod]; 203 octrl.innerHTML = lang[mod]; 204 205 o.insertBefore(octrl, o.firstChild); 206 o.className = s + ' cttp'; 207 mod && (o.style.height = 'auto'); 208 209 octrl.onclick = function () { 210 if(this.className == cls[0]) { 211 o.style.height = 'auto'; 212 this.className = cls[1]; 213 this.innerHTML = lang[1]; 214 } else { 215 o.style.height = ''; 216 this.className = cls[0]; 217 this.innerHTML = lang[0]; 218 } 219 } 220 } 221} 222 223var postpt = 0; 224function fastpostvalidate(theform, noajaxpost) { 225 if(postpt) { 226 return false; 227 } 228 postpt = 1; 229 setTimeout(function() {postpt = 0}, 2000); 230 noajaxpost = !noajaxpost ? 0 : noajaxpost; 231 s = ''; 232 if(typeof fastpostvalidateextra == 'function') { 233 var v = fastpostvalidateextra(); 234 if(!v) { 235 return false; 236 } 237 } 238 if(theform.message.value == '' || theform.subject.value == '') { 239 s = 'æ±æï¼æ¨å°æªè¼¸å ¥æ¨é¡æå §å®¹'; 240 theform.message.focus(); 241 } else if(mb_strlen(theform.subject.value) > 80) { 242 s = 'æ¨çæ¨é¡è¶ é 80 åå符çéå¶'; 243 theform.subject.focus(); 244 } 245 if(!disablepostctrl && ((postminchars != 0 && mb_strlen(theform.message.value) < postminchars) || (postmaxchars != 0 && mb_strlen(theform.message.value) > postmaxchars))) { 246 s = 'æ¨çå¸åé·åº¦ä¸ç¬¦åè¦æ±ã\n\nç¶åé·åº¦: ' + mb_strlen(theform.message.value) + ' ' + 'åç¯\n系統éå¶: ' + postminchars + ' å° ' + postmaxchars + ' åç¯'; 247 } 248 if(s) { 249 showError(s); 250 doane(); 251 $('fastpostsubmit').disabled = false; 252 return false; 253 } 254 $('fastpostsubmit').disabled = true; 255 theform.message.value = theform.message.value.replace(/([^>=\]"'\/]|^)((((https?|ftp):\/\/)|www\.)([\w\-]+\.)*[\w\-\u4e00-\u9fa5]+\.([\.a-zA-Z0-9]+|\u4E2D\u56FD|\u7F51\u7EDC|\u516C\u53F8)((\?|\/|:)+[\w\.\/=\?%\-&~`@':+!]*)+\.(jpg|gif|png|bmp))/ig, '$1[img]$2[/img]'); 256 theform.message.value = parseurl(theform.message.value); 257 if(!noajaxpost) { 258 ajaxpost('fastpostform', 'fastpostreturn', 'fastpostreturn', 'onerror', $('fastpostsubmit')); 259 return false; 260 } else { 261 return true; 262 } 263} 264 265function checkpostrule(showid, extra) { 266 var x = new Ajax(); 267 x.get('forum.php?mod=ajax&action=checkpostrule&inajax=yes&' + extra, function(s) { 268 ajaxinnerhtml($(showid), s);evalscript(s); 269 }); 270} 271 272function updatefastpostattach(aid, url) { 273 ajaxget('forum.php?mod=ajax&action=attachlist&posttime=' + $('posttime').value + (!fid ? '' : '&fid=' + fid), 'attachlist'); 274 $('attach_tblheader').style.display = ''; 275} 276 277function succeedhandle_fastnewpost(locationhref, message, param) { 278 location.href = locationhref; 279} 280 281function errorhandle_fastnewpost() { 282 $('fastpostsubmit').disabled = false; 283} 284 285function atarget(obj) { 286 obj.target = getcookie('atarget') > 0 ? '_blank' : ''; 287} 288 289function setatarget(v) { 290 $('atarget').className = 'y atarget_' + v; 291 $('atarget').onclick = function() {setatarget(v == 1 ? -1 : 1);}; 292 setcookie('atarget', v, 2592000); 293} 294 295function loadData(quiet, formobj) { 296 297 var evalevent = function (obj) { 298 var script = obj.parentNode.innerHTML; 299 var re = /onclick="(.+?)["|>]/ig; 300 var matches = re.exec(script); 301 if(matches != null) { 302 matches[1] = matches[1].replace(/this\./ig, 'obj.'); 303 eval(matches[1]); 304 } 305 }; 306 307 var data = ''; 308 data = loadUserdata('forum_'+discuz_uid); 309 var formobj = !formobj ? $('postform') : formobj; 310 311 if(in_array((data = trim(data)), ['', 'null', 'false', null, false])) { 312 if(!quiet) { 313 showDialog('æ²æå¯ä»¥æ¢å¾©çæ¸æï¼', 'notice'); 314 } 315 return; 316 } 317 318 if(!quiet && !confirm('æ¤æä½å°è¦èç¶åå¸åå §å®¹ï¼ç¢ºå®è¦æ¢è¤æ¸æåï¼')) { 319 return; 320 } 321 322 var data = data.split(/\x09\x09/); 323 for(var i = 0; i < formobj.elements.length; i++) { 324 var el = formobj.elements[i]; 325 if(el.name != '' && (el.tagName == 'SELECT' || el.tagName == 'TEXTAREA' || el.tagName == 'INPUT' && (el.type == 'text' || el.type == 'checkbox' || el.type == 'radio' || el.type == 'hidden'))) { 326 for(var j = 0; j < data.length; j++) { 327 var ele = data[j].split(/\x09/);
328 if(ele[0] == el.name) { 329 elvalue = !isUndefined(ele[3]) ? ele[3] : ''; 330 if(ele[1] == 'INPUT') { 331 if(ele[2] == 'text') { 332 el.value = elvalue; 333 } else if((ele[2] == 'checkbox' || ele[2] == 'radio') && ele[3] == el.value) { 334 el.checked = true; 335 evalevent(el); 336 } else if(ele[2] == 'hidden') { 337 eval('var check = typeof ' + el.id + '_upload == \'function\''); 338 if(check) { 339 var v = elvalue.split(/\x01/); 340 el.value = v[0]; 341 if(el.value) { 342 if($(el.id + '_url') && v[1]) { 343 $(el.id + '_url').value = v[1]; 344 } 345 eval(el.id + '_upload(\'' + v[0] + '\', \'' + v[1] + '\')'); 346 if($('unused' + v[0])) { 347 var attachtype = $('unused' + v[0]).parentNode.parentNode.parentNode.parentNode.id.substr(11); 348 $('unused' + v[0]).parentNode.parentNode.outerHTML = ''; 349 $('unusednum_' + attachtype).innerHTML = parseInt($('unusednum_' + attachtype).innerHTML) - 1; 350 if($('unusednum_' + attachtype).innerHTML == 0 && $('attachnotice_' + attachtype)) { 351 $('attachnotice_' + attachtype).style.display = 'none'; 352 } 353 } 354 } 355 } 356 357 } 358 } else if(ele[1] == 'TEXTAREA') { 359 if(ele[0] == 'message') { 360 if(!wysiwyg) { 361 textobj.value = elvalue; 362 } else { 363 editdoc.body.innerHTML = bbcode2html(elvalue); 364 } 365 } else { 366 el.value = elvalue; 367 } 368 } else if(ele[1] == 'SELECT') { 369 if($(el.id + '_ctrl_menu')) { 370 var lis = $(el.id + '_ctrl_menu').getElementsByTagName('li'); 371 for(var k = 0; k < lis.length; k++) { 372 if(ele[3] == lis[k].k_value) { 373 lis[k].onclick(); 374 break; 375 } 376 } 377 } else { 378 for(var k = 0; k < el.options.length; k++) { 379 if(ele[3] == el.options[k].value) { 380 el.options[k].selected = true; 381 break; 382 } 383 } 384 } 385 } 386 break; 387 } 388 } 389 } 390 } 391 if($('rstnotice')) { 392 $('rstnotice').style.display = 'none'; 393 } 394 extraCheckall(); 395} 396 397var checkForumcount = 0, checkForumtimeout = 30000, checkForumnew_handle; 398function checkForumnew(fid, lasttime) { 399 var timeout = checkForumtimeout; 400 var x = new Ajax(); 401 x.get('forum.php?mod=ajax&action=forumchecknew&fid=' + fid + '&time=' + lasttime + '&inajax=yes', function(s){ 402 if(s > 0) { 403 var table = $('separatorline').parentNode; 404 if(!isUndefined(checkForumnew_handle)) { 405 clearTimeout(checkForumnew_handle); 406 } 407 removetbodyrow(table, 'forumnewshow'); 408 var colspan = table.getElementsByTagName('tbody')[0].rows[0].children.length; 409 var checknew = {'tid':'', 'thread':{'common':{'className':'', 'val':'<a href="javascript:void(0);" onclick="ajaxget(\'forum.php?mod=ajax&action=forumchecknew&fid=' + fid+ '&time='+lasttime+'&uncheck=1&inajax=yes\', \'forumnew\');">ææ°å復ç主é¡ï¼é»ææ¥ç', 'colspan': colspan }}}; 410 addtbodyrow(table, ['tbody'], ['forumnewshow'], 'separatorline', checknew); 411 } else { 412 if(checkForumcount < 50) { 413 if(checkForumcount > 0) { 414 var multiple = Math.ceil(50 / checkForumcount); 415 if(multiple < 5) { 416 timeout = checkForumtimeout * (5 - multiple + 1); 417 } 418 } 419 checkForumnew_handle = setTimeout(function () {checkForumnew(fid, lasttime);}, timeout); 420 } 421 } 422 checkForumcount++; 423 }); 424 425} 426function checkForumnew_btn(fid) { 427 if(isUndefined(fid)) return; 428 ajaxget('forum.php?mod=ajax&action=forumchecknew&fid=' + fid+ '&time='+lasttime+'&uncheck=2&inajax=yes', 'forumnew', 'ajaxwaitid'); 429 lasttime = parseInt(Date.parse(new Date()) / 1000); 430} 431 432function display_blocked_thread() { 433 var table = $('threadlisttableid'); 434 if(!table) { 435 return; 436 } 437 var tbodys = table.getElementsByTagName('tbody'); 438 for(i = 0;i < tbodys.length;i++) { 439 var tbody = tbodys[i]; 440 if(tbody.style.display == 'none') { 441 table.appendChild(tbody); 442 tbody.style.display = ''; 443 } 444 } 445 $('hiddenthread').style.display = 'none'; 446} 447 448function addtbodyrow(table, insertID, changename, separatorid, jsonval) { 449 if(isUndefined(table) || isUndefined(insertID[0])) { 450 return; 451 } 452 453 var insertobj = document.createElement(insertID[0]); 454 var thread = jsonval.thread; 455 var tid = !isUndefined(jsonval.tid) ? jsonval.tid : '' ; 456 457 if(!isUndefined(changename[1])) { 458 removetbodyrow(table, changename[1] + tid); 459 } 460 461 insertobj.id = changename[0] + tid; 462 if(!isUndefined(insertID[1])) { 463 insertobj.className = insertID[1]; 464 } 465 if($(separatorid)) { 466 table.insertBefore(insertobj, $(separatorid).nextSibling); 467 } else { 468 table.insertBefore(insertobj, table.firstChild); 469 } 470 var newTH = insertobj.insertRow(-1); 471 for(var value in thread) { 472 if(value != 0) { 473 var cell = newTH.insertCell(-1); 474 if(isUndefined(thread[value]['val'])) { 475 cell.innerHTML = thread[value]; 476 } else { 477 cell.innerHTML = thread[value]['val']; 478 } 479 if(!isUndefined(thread[value]['className'])) { 480 cell.className = thread[value]['className']; 481 } 482 if(!isUndefined(thread[value]['colspan'])) { 483 cell.colSpan = thread[value]['colspan']; 484 } 485 } 486 } 487 488 if(!isUndefined(insertID[2])) { 489 _attachEvent(insertobj, insertID[2], function() {insertobj.className = '';}); 490 } 491} 492function removetbodyrow(from, objid) { 493 if(!isUndefined(from) && $(objid)) { 494 from.removeChild($(objid)); 495 } 496} 497 498function leftside(id) { 499 $(id).className = $(id).className == 'a' ? '' : 'a'; 500 if(id == 'lf_fav') {
501 setcookie('leftsidefav', $(id).className == 'a' ? 0 : 1, 2592000); 502 } 503} 504var DTimers = new Array(); 505var DItemIDs = new Array(); 506var DTimers_exists = false; 507function settimer(timer, itemid) { 508 if(timer && itemid) { 509 DTimers.push(timer); 510 DItemIDs.push(itemid); 511 } 512 if(!DTimers_exists) { 513 setTimeout("showtime()", 1000); 514 DTimers_exists = true; 515 } 516} 517function showtime() { 518 for(i=0; i<=DTimers.length; i++) { 519 if(DItemIDs[i]) { 520 if(DTimers[i] == 0) { 521 $(DItemIDs[i]).innerHTML = 'å·²çµæ'; 522 DItemIDs[i] = ''; 523 continue; 524 } 525 var timestr = ''; 526 var timer_day = Math.floor(DTimers[i] / 86400); 527 var timer_hour = Math.floor((DTimers[i] % 86400) / 3600); 528 var timer_minute = Math.floor(((DTimers[i] % 86400) % 3600) / 60); 529 var timer_second = (((DTimers[i] % 86400) % 3600) % 60); 530 if(timer_day > 0) { 531 timestr += timer_day + '天'; 532 } 533 if(timer_hour > 0) { 534 timestr += timer_hour + 'å°æ' 535 } 536 if(timer_minute > 0) { 537 timestr += timer_minute + 'å' 538 } 539 if(timer_second > 0) { 540 timestr += timer_second + 'ç§' 541 } 542 DTimers[i] = DTimers[i] - 1; 543 $(DItemIDs[i]).innerHTML = timestr; 544 } 545 } 546 setTimeout("showtime()", 1000); 547} 548function fixed_top_nv(eleid, disbind) { 549 this.nv = eleid && $(eleid) || $('nv'); 550 this.openflag = this.nv && BROWSER.ie != 6; 551 this.nvdata = {}; 552 this.init = function (disattachevent) { 553 if(this.openflag) { 554 if(!disattachevent) { 555 var obj = this; 556 _attachEvent(window, 'resize', function(){obj.reset();obj.init(1);obj.run();}); 557 var switchwidth = $('switchwidth'); 558 if(switchwidth) { 559 _attachEvent(switchwidth, 'click', function(){obj.reset();obj.openflag=false;}); 560 } 561 } 562 563 var next = this.nv; 564 try { 565 if(this.nv.parentNode.id.substr(-3) != '_ph') { 566 var nvparent = document.createElement('div'); 567 nvparent.id = this.nv.id + '_ph'; 568 this.nv.parentNode.insertBefore(nvparent,this.nv); 569 nvparent.appendChild(this.nv); 570 } 571 this.nvdata.next = this.nv.parentNode; 572 this.nvdata.height = parseInt(this.nv.offsetHeight, 10); 573 this.nvdata.width = parseInt(this.nv.offsetWidth, 10); 574 this.nvdata.left = this.nv.getBoundingClientRect().left - document.documentElement.clientLeft; 575 this.nvdata.position = this.nv.style.position; 576 this.nvdata.opacity = this.nv.style.opacity; 577 } catch (e) { 578 this.nvdata.next = null; 579 } 580 } 581 }; 582 583 this.run = function () { 584 var fixedheight = 0; 585 if(this.openflag && this.nvdata.next){ 586 var nvnexttop = document.body.scrollTop || document.documentElement.scrollTop; 587 var dofixed = nvnexttop !== 0 && document.documentElement.clientHeight >= 15 && this.nvdata.next.getBoundingClientRect().top < 0; 588 if(dofixed) { 589 if(this.nv.style.position != 'fixed') { 590 this.nv.style.borderLeftWidth = '0'; 591 this.nv.style.borderRightWidth = '0'; 592 this.nv.style.height = this.nvdata.height + 'px'; 593 this.nv.style.width = this.nvdata.width + 'px'; 594 this.nv.style.top = '0'; 595 this.nv.style.left = this.nvdata.left + 'px'; 596 this.nv.style.position = 'fixed'; 597 this.nv.style.zIndex = '199'; 598 this.nv.style.opacity = 0.85; 599 this.nv.parentNode.style.height = this.nvdata.height + 'px'; 600 } 601 } else { 602 if(this.nv.style.position != this.nvdata.position) { 603 this.reset(); 604 } 605 } 606 if(this.nv.style.position == 'fixed') { 607 fixedheight = this.nvdata.height; 608 } 609 } 610 return fixedheight; 611 }; 612 this.reset = function () { 613 if(this.nv) { 614 this.nv.style.position = this.nvdata.position; 615 this.nv.style.borderLeftWidth = ''; 616 this.nv.style.borderRightWidth = ''; 617 this.nv.style.height = ''; 618 this.nv.style.width = ''; 619 this.nv.style.opacity = this.nvdata.opacity; 620 this.nv.parentNode.style.height = ''; 621 } 622 }; 623 if(!disbind && this.openflag) { 624 this.init(); 625 _attachEvent(window, 'scroll', this.run); 626 } 627} 628var previewTbody = null, previewTid = null, previewDiv = null; 629function previewThread(tid, tbody) { 630 if(!$('threadPreviewTR_'+tid)) { 631 appendscript(JSPATH + 'forum_viewthread.js?' + VERHASH); 632 633 newTr = document.createElement('tr'); 634 newTr.id = 'threadPreviewTR_'+tid; 635 newTr.className = 'threadpre'; 636 $(tbody).appendChild(newTr); 637 newTd = document.createElement('td'); 638 newTd.colSpan = listcolspan; 639 newTd.className = 'threadpretd'; 640 newTr.appendChild(newTd); 641 newTr.style.display = 'none'; 642 643 previewTbody = tbody; 644 previewTid = tid; 645 646 if(BROWSER.ie) { 647 previewDiv = document.createElement('div'); 648 previewDiv.id = 'threadPreview_'+tid; 649 previewDiv.style.id = 'none'; 650 var x = Ajax();
651 x.get('forum.php?mod=viewthread&tid='+tid+'&inajax=1&from=preview', function(ret) { 652 var evaled = false; 653 if(ret.indexOf('ajaxerror') != -1) { 654 evalscript(ret); 655 evaled = true; 656 } 657 previewDiv.innerHTML = ret; 658 newTd.appendChild(previewDiv); 659 if(!evaled) evalscript(ret); 660 newTr.style.display = ''; 661 }); 662 } else { 663 newTd.innerHTML += '<div id="threadPreview_'+tid+'"></div>'; 664 ajaxget('forum.php?mod=viewthread&tid='+tid+'&from=preview', 'threadPreview_'+tid, null, null, null, function() {newTr.style.display = '';}); 665 } 666 } else { 667 $(tbody).removeChild($('threadPreviewTR_'+tid)); 668 previewTbody = previewTid = null; 669 } 670} 671 672function hideStickThread(tid) { 673 var pre = 'stickthread_'; 674 var tids = (new Function("return ("+(loadUserdata('sticktids') || '[]')+")"))(); 675 var format = function (data) { 676 var str = '{'; 677 for (var i in data) { 678 if(data[i] instanceof Array) { 679 str += i + ':' + '['; 680 for (var j = data[i].length - 1; j >= 0; j--) { 681 str += data[i][j] + ','; 682 }; 683 str = str.substr(0, str.length -1); 684 str += '],'; 685 } 686 } 687 str = str.substr(0, str.length -1); 688 str += '}'; 689 return str; 690 }; 691 if(!tid) { 692 if(tids.length > 0) { 693 for (var i = tids.length - 1; i >= 0; i--) { 694 var ele = $(pre+tids[i]); 695 if(ele) { 696 ele.parentNode.removeChild(ele); 697 } 698 }; 699 } 700 } else { 701 var eletbody = $(pre+tid); 702 if(eletbody) { 703 eletbody.parentNode.removeChild(eletbody); 704 tids.push(tid); 705 saveUserdata('sticktids', '['+tids.join(',')+']'); 706 } 707 } 708 var clearstickthread = $('clearstickthread'); 709 if(clearstickthread) { 710 if(tids.length > 0) { 711 $('clearstickthread').style.display = ''; 712 } else { 713 $('clearstickthread').style.display = 'none'; 714 } 715 } 716 var separatorline = $('separatorline'); 717 if(separatorline) { 718 try { 719 if(typeof separatorline.previousElementSibling === 'undefined') { 720 var findele = separatorline.previousSibling; 721 while(findele && findele.nodeType != 1){ 722 findele = findele.previousSibling; 723 } 724 if(findele === null) { 725 separatorline.parentNode.removeChild(separatorline); 726 } 727 } else { 728 if(separatorline.previousElementSibling === null) { 729 separatorline.parentNode.removeChild(separatorline); 730 } 731 } 732 } catch(e) { 733 } 734 } 735} 736function viewhot() { 737 var obj = $('hottime'); 738 window.location.href = "forum.php?mod=forumdisplay&filter=hot&fid="+obj.getAttribute('fid')+"&time="+obj.value; 739} 740function clearStickThread () { 741 saveUserdata('sticktids', '[]'); 742 location.reload(); 743}
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.