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