1/* 2 [Discuz!] (C)2001-2009 Comsenz Inc. 3 This is NOT a freeware, use is subject to license terms 4 5 $Id: home.js 22765 2011-05-20 03:06:12Z zhengqingpeng $ 6 Modified by Valery Votintsev 7*/ 8 9var note_step = 0; 10var note_oldtitle = document.title; 11var note_timer; 12 13function addSort(obj) { 14 if (obj.value == 'addoption') { 15 showWindow('addoption', 'home.php?mod=spacecp&ac=blog&op=addoption&handlekey=addoption&oid='+obj.id); 16 } 17} 18 19function addOption(sid, aid) { 20 var obj = $(aid); 21 var newOption = $(sid).value; 22 $(sid).value = ""; 23 if (newOption!=null && newOption!='') { 24 var newOptionTag=document.createElement('option'); 25 newOptionTag.text=newOption; 26 newOptionTag.value="new:" + newOption; 27 try { 28 obj.add(newOptionTag, obj.options[0]); 29 } catch(ex) { 30 obj.add(newOptionTag, obj.selecedIndex); 31 } 32 obj.value="new:" + newOption; 33 } else { 34 obj.value=obj.options[0].value; 35 } 36} 37 38function blogAddOption(sid, aid) { 39 var obj = $(aid); 40 var newOption = $(sid).value; 41 newOption = newOption.replace(/^\s+|\s+$/g,""); 42 $(sid).value = ""; 43 if (newOption!=null && newOption!='') { 44 var newOptionTag=document.createElement('option'); 45 newOptionTag.text=newOption; 46 newOptionTag.value="new:" + newOption; 47 try { 48 obj.add(newOptionTag, obj.options[0]); 49 } catch(ex) { 50 obj.add(newOptionTag, obj.selecedIndex); 51 } 52 obj.value="new:" + newOption; 53 return true; 54 } else { 55 alert(lng['category_empty']); 56 return false; 57 } 58} 59 60function blogCancelAddOption(aid) { 61 var obj = $(aid); 62 obj.value=obj.options[0].value; 63} 64 65function checkAll(form, name) { 66 for(var i = 0; i < form.elements.length; i++) { 67 var e = form.elements[i]; 68 if(e.name.match(name)) { 69 e.checked = form.elements['chkall'].checked; 70 } 71 } 72} 73 74function cnCode(str) { 75 str = str.replace(/<\/?[^>]+>|\[\/?.+?\]|"/ig, ""); 76 str = str.replace(/\s{2,}/ig, ' '); 77 return BROWSER.ie && document.charset == 'utf-8' ? encodeURIComponent(str) : str; 78} 79 80function getExt(path) { 81 return path.lastIndexOf('.') == -1 ? '' : path.substr(path.lastIndexOf('.') + 1, path.length).toLowerCase(); 82} 83 84function resizeImg(id,size) { 85 var theImages = $(id).getElementsByTagName('img'); 86 for (i=0; i<theImages.length; i++) { 87 theImages[i].onload = function() { 88 if (this.width > size) { 89 this.style.width = size + 'px'; 90 if (this.parentNode.tagName.toLowerCase() != 'a') { 91 var zoomDiv = document.createElement('div'); 92 this.parentNode.insertBefore(zoomDiv,this); 93 zoomDiv.appendChild(this); 94 zoomDiv.style.position = 'relative'; 95 zoomDiv.style.cursor = 'pointer'; 96 97 this.title = lng['show_orig_image']; 98 99 var zoom = document.createElement('img'); 100 zoom.src = 'image/zoom.gif'; 101 zoom.style.position = 'absolute'; 102 zoom.style.marginLeft = size -28 + 'px'; 103 zoom.style.marginTop = '5px'; 104 this.parentNode.insertBefore(zoom,this); 105 106 zoomDiv.onmouseover = function() { 107 zoom.src = 'image/zoom_h.gif'; 108 }; 109 zoomDiv.onmouseout = function() { 110 zoom.src = 'image/zoom.gif'; 111 }; 112 zoomDiv.onclick = function() { 113 window.open(this.childNodes[1].src); 114 }; 115 } 116 } 117 } 118 } 119} 120 121function zoomTextarea(id, zoom) { 122 zoomSize = zoom ? 10 : -10; 123 obj = $(id); 124 if(obj.rows + zoomSize > 0 && obj.cols + zoomSize * 3 > 0) { 125 obj.rows += zoomSize; 126 obj.cols += zoomSize * 3; 127 } 128} 129 130function ischeck(id, prefix) { 131 form = document.getElementById(id); 132 for(var i = 0; i < form.elements.length; i++) { 133 var e = form.elements[i]; 134 if(e.name.match(prefix) && e.checked) { 135 if(confirm(lng['continue_sure'])) { 136 return true; 137 } else { 138 return false; 139 } 140 } 141 } 142 alert(lng['select_item']); 143 return false; 144} 145 146function copyRow(tbody) { 147 var add = false; 148 var newnode; 149 if($(tbody).rows.length == 1 && $(tbody).rows[0].style.display == 'none') { 150 $(tbody).rows[0].style.display = ''; 151 newnode = $(tbody).rows[0]; 152 } else { 153 newnode = $(tbody).rows[0].cloneNode(true); 154 add = true; 155 } 156 tags = newnode.getElementsByTagName('input'); 157 for(i in tags) { 158 if(tags[i].name == 'pics[]') { 159 tags[i].value = 'http://'; 160 } 161 } 162 if(add) { 163 $(tbody).appendChild(newnode); 164 } 165} 166 167function delRow(obj, tbody) { 168 if($(tbody).rows.length == 1) { 169 var trobj = obj.parentNode.parentNode; 170 tags = trobj.getElementsByTagName('input'); 171 for(i in tags) { 172 if(tags[i].name == 'pics[]') { 173 tags[i].value = 'http://'; 174 } 175 } 176 trobj.style.display='none'; 177 } else { 178 $(tbody).removeChild(obj.parentNode.parentNode); 179 } 180} 181 182function insertWebImg(obj) { 183 if(checkImage(obj.value)) { 184 insertImage(obj.value); 185 obj.value = 'http://'; 186 } else { 187 alert(lng['image_url_invalid']); 188 } 189} 190 191function checkFocus(target) { 192 var obj = $(target); 193 if(!obj.hasfocus) { 194 obj.focus(); 195 } 196} 197function insertImage(text) {
198 text = "\n[img]" + text + "[/img]\n"; 199 insertContent('message', text); 200} 201 202function insertContent(target, text) { 203 var obj = $(target); 204 selection = document.selection; 205 checkFocus(target); 206 if(!isUndefined(obj.selectionStart)) { 207 var opn = obj.selectionStart + 0; 208 obj.value = obj.value.substr(0, obj.selectionStart) + text + obj.value.substr(obj.selectionEnd); 209 } else if(selection && selection.createRange) { 210 var sel = selection.createRange(); 211 sel.text = text; 212 sel.moveStart('character', -strlen(text)); 213 } else { 214 obj.value += text; 215 } 216} 217 218function checkImage(url) { 219 var re = /^http\:\/\/.{5,200}\.(jpg|gif|png)$/i; 220 return url.match(re); 221} 222 223function quick_validate(obj) { 224 if($('seccode')) { 225 var code = $('seccode').value; 226 var x = new Ajax(); 227 x.get('cp.php?ac=common&op=seccode&code=' + code, function(s){ 228 s = trim(s); 229 if(s != 'succeed') { 230 alert(s); 231 $('seccode').focus(); 232 return false; 233 } else { 234 obj.form.submit(); 235 return true; 236 } 237 }); 238 } else { 239 obj.form.submit(); 240 return true; 241 } 242} 243 244function stopMusic(preID, playerID) { 245 var musicFlash = preID.toString() + '_' + playerID.toString(); 246 if($(musicFlash)) { 247 $(musicFlash).SetVariable('closePlayer', 1); 248 } 249} 250function showFlash(host, flashvar, obj, shareid) { 251 var flashAddr = { 252 'youku.com' : 'http://player.youku.com/player.php/sid/FLASHVAR=/v.swf', 253 'ku6.com' : 'http://player.ku6.com/refer/FLASHVAR/v.swf', 254 'youtube.com' : 'http://www.youtube.com/v/FLASHVAR', 255 '5show.com' : 'http://www.5show.com/swf/5show_player.swf?flv_id=FLASHVAR', 256 'sina.com.cn' : 'http://vhead.blog.sina.com.cn/player/outer_player.swf?vid=FLASHVAR', 257 'sohu.com' : 'http://v.blog.sohu.com/fo/v4/FLASHVAR', 258 'mofile.com' : 'http://tv.mofile.com/cn/xplayer.swf?v=FLASHVAR', 259 'music' : 'FLASHVAR', 260 'flash' : 'FLASHVAR' 261 }; 262 var flash = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="480" height="400">' 263 + '<param name="movie" value="FLASHADDR" />' 264 + '<param name="quality" value="high" />' 265 + '<param name="bgcolor" value="#FFFFFF" />' 266 + '<param name="allowScriptAccess" value="none" />' 267 + '<param name="allowNetworking" value="internal" />' 268 + '<embed width="480" height="400" menu="false" quality="high" src="FLASHADDR" type="application/x-shockwave-flash" />' 269 + '</object>'; 270 var videoFlash = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="480" height="450">' 271 + '<param value="transparent" name="wmode"/>' 272 + '<param value="FLASHADDR" name="movie" />' 273 + '<embed src="FLASHADDR" wmode="transparent" allowfullscreen="true" type="application/x-shockwave-flash" width="480" height="450"></embed>' 274 + '</object>'; 275 var musicFlash = '<object id="audioplayer_SHAREID" height="24" width="290" data="' + STATICURL + 'image/common/player.swf" type="application/x-shockwave-flash">' 276 + '<param value="' + STATICURL + 'image/common/player.swf" name="movie"/>' 277 + '<param value="autostart=yes&bg=0xCDDFF3&leftbg=0x357DCE&lefticon=0xF2F2F2&rightbg=0xF06A51&rightbghover=0xAF2910&righticon=0xF2F2F2&righticonhover=0xFFFFFF&text=0x357DCE&slider=0x357DCE&track=0xFFFFFF&border=0xFFFFFF&loader=0xAF2910&soundFile=FLASHADDR" name="FlashVars"/>' 278 + '<param value="high" name="quality"/>' 279 + '<param value="false" name="menu"/>' 280 + '<param value="#FFFFFF" name="bgcolor"/>' 281 + '</object>'; 282 var musicMedia = '<object height="64" width="290" data="FLASHADDR" type="audio/x-ms-wma">' 283 + '<param value="FLASHADDR" name="src"/>' 284 + '<param value="1" name="autostart"/>' 285 + '<param value="true" name="controller"/>' 286 + '</object>'; 287 var flashHtml = videoFlash; 288 var videoMp3 = true; 289 if('' == flashvar) { 290 alert(lng['audio_url_invalid']); 291 return false; 292 } 293 if('music' == host) { 294 var mp3Reg = new RegExp('.mp3$', 'ig'); 295 var flashReg = new RegExp('.swf$', 'ig'); 296 flashHtml = musicMedia; 297 videoMp3 = false; 298 if(mp3Reg.test(flashvar)) { 299 videoMp3 = true; 300 flashHtml = musicFlash; 301 } else if(flashReg.test(flashvar)) { 302 videoMp3 = true; 303 flashHtml = flash; 304 } 305 } 306 flashvar = encodeURI(flashvar); 307 if(flashAddr[host]) { 308 var flash = flashAddr[host].replace('FLASHVAR', flashvar); 309 flashHtml = flashHtml.replace(/FLASHADDR/g, flash); 310 flashHtml = flashHtml.replace(/SHAREID/g, shareid); 311 } 312 313 if(!obj) { 314 $('flash_div_' + shareid).innerHTML = flashHtml; 315 return true; 316 } 317 if($('flash_div_' + shareid)) { 318 $('flash_div_' + shareid).style.display = ''; 319 $('flash_hide_' + shareid).style.display = ''; 320 obj.style.display = 'none'; 321 return true; 322 } 323 if(flashAddr[host]) { 324 var flashObj = document.createElement('div'); 325 flashObj.id = 'flash_div_' + shareid; 326 obj.parentNode.insertBefore(flashObj, obj); 327 flashObj.innerHTML = flashHtml; 328 obj.style.display = 'none'; 329 var hideObj = document.createElement('div'); 330 hideObj.id = 'flash_hide_' + shareid; 331 var nodetxt = document.createTextNode(lng['collapse']); 332 hideObj.appendChild(nodetxt); 333 obj.parentNode.insertBefore(hideObj, obj); 334 hideObj.style.cursor = 'pointer'; 335 hideObj.onclick = function() { 336 if(true == videoMp3) { 337 stopMusic('audioplayer', shareid); 338 flashObj.parentNode.removeChild(flashObj); 339 hideObj.parentNode.removeChild(hideObj); 340 } else { 341 flashObj.style.display = 'none'; 342 hideObj.style.display = 'none'; 343 } 344 obj.style.display = ''; 345 }; 346 } 347} 348 349function userapp_open() { 350 var x = new Ajax(); 351 x.get('home.php?mod=spacecp&ac=common&op=getuserapp&inajax=1', function(s){ 352 $('my_userapp').innerHTML = s; 353 $('a_app_more').className = 'fold'; 354 $('a_app_more').innerHTML = lng['collapse']; 355 $('a_app_more').onclick = function() { 356 userapp_close(); 357 }; 358 }); 359} 360 361function userapp_close() { 362 var x = new Ajax(); 363 x.get('home.php?mod=spacecp&ac=common&op=getuserapp&subop=off&inajax=1', function(s){ 364 $('my_userapp').innerHTML = s; 365 $('a_app_more').className = 'unfold'; 366 $('a_app_more').innerHTML = lng['expand']; 367 $('a_app_more').onclick = function() { 368 userapp_open(); 369 }; 370 }); 371} 372 373function startMarquee(h, speed, delay, sid) { 374 var t = null; 375 var p = false; 376 var o = $(sid); 377 o.innerHTML += o.innerHTML; 378 o.onmouseover = function() {p = true}; 379 o.onmouseout = function() {p = false}; 380 o.scrollTop = 0; 381 function start() { 382 t = setInterval(scrolling, speed); 383 if(!p) { 384 o.scrollTop += 2; 385 } 386 } 387 function scrolling() { 388 if(p) return; 389 if(o.scrollTop % h != 0) { 390 o.scrollTop += 2; 391 if(o.scrollTop >= o.scrollHeight/2) o.scrollTop = 0; 392 } else { 393 clearInterval(t); 394 setTimeout(start, delay); 395 } 396 } 397 setTimeout(start, delay); 398} 399 400function readfeed(obj, id) { 401 if(Cookie.get("read_feed_ids")) { 402 var fcookie = Cookie.get("read_feed_ids"); 403 fcookie = id + ',' + fcookie; 404 } else { 405 var fcookie = id; 406 } 407 Cookie.set("read_feed_ids", fcookie, 48); 408 obj.className = 'feedread'; 409} 410 411function showreward() { 412 if(Cookie.get('reward_notice_disable')) { 413 return false; 414 } 415 var x = new Ajax(); 416 x.get('home.php?mod=misc&ac=ajax&op=getreward', function(s){ 417 if(s) { 418 msgwin(s, 2000); 419 } 420 }); 421} 422 423function msgwin(s, t) { 424 425 var msgWinObj = $('msgwin'); 426 if(!msgWinObj) { 427 var msgWinObj = document.createElement("div"); 428 msgWinObj.id = 'msgwin'; 429 msgWinObj.style.display = 'none'; 430 msgWinObj.style.position = 'absolute'; 431 msgWinObj.style.zIndex = '100000'; 432 $('append_parent').appendChild(msgWinObj); 433 } 434 msgWinObj.innerHTML = s; 435 msgWinObj.style.display = ''; 436 msgWinObj.style.filter = 'progid:DXImageTransform.Microsoft.Alpha(opacity=0)'; 437 msgWinObj.style.opacity = 0; 438 var sTop = document.documentElement && document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop; 439 pbegin = sTop + (document.documentElement.clientHeight / 2); 440 pend = sTop + (document.documentElement.clientHeight / 5); 441 setTimeout(function () {showmsgwin(pbegin, pend, 0, t)}, 10); 442 msgWinObj.style.left = ((document.documentElement.clientWidth - msgWinObj.clientWidth) / 2) + 'px'; 443 msgWinObj.style.top = pbegin + 'px'; 444} 445 446function showmsgwin(b, e, a, t) { 447 step = (b - e) / 10; 448 var msgWinObj = $('msgwin'); 449 newp = (parseInt(msgWinObj.style.top) - step); 450 if(newp > e) { 451 msgWinObj.style.filter = 'progid:DXImageTransform.Microsoft.Alpha(opacity=' + a + ')'; 452 msgWinObj.style.opacity = a / 100; 453 msgWinObj.style.top = newp + 'px'; 454 setTimeout(function () {showmsgwin(b, e, a += 10, t)}, 10); 455 } else { 456 msgWinObj.style.filter = 'progid:DXImageTransform.Microsoft.Alpha(opacity=100)'; 457 msgWinObj.style.opacity = 1; 458 setTimeout('displayOpacity(\'msgwin\', 100)', t); 459 } 460} 461 462function displayOpacity(id, n) { 463 if(!$(id)) { 464 return; 465 } 466 if(n >= 0) { 467 n -= 10; 468 $(id).style.filter = 'progid:DXImageTransform.Microsoft.Alpha(opacity=' + n + ')'; 469 $(id).style.opacity = n / 100; 470 setTimeout('displayOpacity(\'' + id + '\',' + n + ')', 50); 471 } else { 472 $(id).style.display = 'none'; 473 $(id).style.filter = 'progid:DXImageTransform.Microsoft.Alpha(opacity=100)'; 474 $(id).style.opacity = 1; 475 } 476} 477 478function urlto(url) { 479 window.location.href = url; 480} 481 482function explode(sep, string) { 483 return string.split(sep); 484} 485 486function selector(pattern, context) { 487 var re = new RegExp('([a-z0-9]*)([\.#:]*)(.*|$)', 'ig'); 488 var match = re.exec(pattern); 489 var conditions = cc = []; 490 if (match[2] == '#') conditions.push(['id', '=', match[3]]); 491 else if(match[2] == '.') conditions.push(['className', '~=', match[3]]); 492 else if(match[2] == ':') conditions.push(['type', '=', match[3]]); 493 var s = match[3].replace(/\[(.*)\]/g,'$1').split('@'); 494 for(var i=0; i<s.length; i++) { 495 if (cc = /([\w]+)([=^%!$~]+)(.*)$/.exec(s[i])) 496 conditions.push([cc[1], cc[2], cc[3]]); 497 } 498 var list = conditions[0] && conditions[0][0] == 'id' ? [document.getElementById(conditions[0][2])] : (context || document).getElementsByTagName(match[1] || "*"); 499 if(!list || !list.length) return []; 500 if(conditions) { 501 var elements = []; 502 var attrMapping = {'for': 'htmlFor', 'class': 'className'}; 503 for(var i=0; i<list.length; i++) { 504 var pass = true; 505 for(var j=0; j<conditions.length; j++) { 506 var attr = attrMapping[conditions[j][0]] || conditions[j][0]; 507 var val = list[i][attr] || (list[i].getAttribute ? list[i].getAttribute(attr) : ''); 508 var pattern = null; 509 if(conditions[j][1] == '=') { 510 pattern = new RegExp('^'+conditions[j][2]+'$', 'i'); 511 } else if(conditions[j][1] == '^=') { 512 pattern = new RegExp('^' + conditions[j][2], 'i'); 513 } else if(conditions[j][1] == '$=') { 514 pattern = new RegExp(conditions[j][2] + '$', 'i'); 515 } else if(conditions[j][1] == '%=') { 516 pattern = new RegExp(conditions[j][2], 'i'); 517 } else if(conditions[j][1] == '~=') { 518 pattern = new RegExp('(^|[ ])' + conditions[j][2] + '([ ]|$)', 'i'); 519 } 520 if(pattern && !pattern.test(val)) { 521 pass = false; 522 break; 523 } 524 } 525 if(pass) elements.push(list[i]); 526 } 527 return elements; 528 } else { 529 return list; 530 } 531} 532 533function showBlock(cid, oid) { 534 if(parseInt(cid)) { 535 var listObj = $(oid); 536 var x = new Ajax(); 537 x.get('portal.php?mod=cp&ac=block&operation=getblock&classid='+cid, function(s){ 538 listObj.innerHTML = s; 539 }) 540 } 541} 542 543function resizeTx(obj){ 544 var oid = obj.id + '_limit'; 545 if(!BROWSER.ie) obj.style.height = 0; 546 obj.style.height = obj.scrollHeight + 'px'; 547 if($(oid)) $(oid).style.display = obj.scrollHeight > 30 ? '':'none'; 548} 549
550function showFace(showid, target, dropstr) { 551 if($(showid + '_menu') != null) { 552 $(showid+'_menu').style.display = ''; 553 } else { 554 var faceDiv = document.createElement("div"); 555 faceDiv.id = showid+'_menu'; 556 faceDiv.className = 'p_pop facel'; 557 faceDiv.style.position = 'absolute'; 558 faceDiv.style.zIndex = 1001; 559 var faceul = document.createElement("ul"); 560 for(i=1; i<31; i++) { 561 var faceli = document.createElement("li"); 562 faceli.innerHTML = '<img src="' + STATICURL + 'image/smiley/comcom/'+i+'.gif" onclick="insertFace(\''+showid+'\','+i+', \''+ target +'\', \''+dropstr+'\')" style="cursor:pointer; position:relative;" />'; 563 faceul.appendChild(faceli); 564 } 565 faceDiv.appendChild(faceul); 566 $('append_parent').appendChild(faceDiv) 567 } 568 setMenuPosition(showid, 0); 569 doane(); 570 _attachEvent(document.body, 'click', function(){if($(showid+'_menu')) $(showid+'_menu').style.display = 'none';}); 571} 572 573function insertFace(showid, id, target, dropstr) { 574 var faceText = '[em:'+id+':]'; 575 if($(target) != null) { 576 insertContent(target, faceText); 577 if(dropstr) { 578 $(target).value = $(target).value.replace(dropstr, ""); 579 } 580 } 581} 582 583function wall_add(id) { 584 var obj = $('comment_ul'); 585 var newdl = document.createElement("dl"); 586 newdl.id = 'comment_'+id+'_li'; 587 newdl.className = 'bbda cl'; 588 var x = new Ajax(); 589 x.get('home.php?mod=misc&ac=ajax&op=comment&inajax=1&cid='+id, function(s){ 590 newdl.innerHTML = s; 591 }); 592 obj.insertBefore(newdl, obj.firstChild); 593 if($('comment_message')) { 594 $('comment_message').value= ''; 595 } 596 showCreditPrompt(); 597} 598 599function share_add(sid) { 600 var obj = $('share_ul'); 601 var newli = document.createElement("li"); 602 var x = new Ajax(); 603 x.get('home.php?mod=misc&ac=ajax&op=share&inajax=1&sid='+sid, function(s){ 604 newli.innerHTML = s; 605 }); 606 obj.insertBefore(newli, obj.firstChild); 607 $('share_link').value = 'http://'; 608 $('share_general').value = ''; 609 showCreditPrompt(); 610} 611 612function comment_add(id) { 613 var obj = $('comment_ul'); 614 var newdl = document.createElement("dl"); 615 newdl.id = 'comment_'+id+'_li'; 616 newdl.className = 'bbda cl'; 617 var x = new Ajax(); 618 x.get('home.php?mod=misc&ac=ajax&op=comment&inajax=1&cid='+id, function(s){ 619 newdl.innerHTML = s; 620 }); 621 if($('comment_prepend')){ 622 obj = obj.firstChild; 623 while (obj && obj.nodeType != 1){ 624 obj = obj.nextSibling; 625 } 626 obj.parentNode.insertBefore(newdl, obj); 627 } else { 628 obj.appendChild(newdl); 629 } 630 if($('comment_message')) { 631 $('comment_message').value= ''; 632 } 633 if($('comment_replynum')) { 634 var a = parseInt($('comment_replynum').innerHTML); 635 var b = a + 1; 636 $('comment_replynum').innerHTML = b + ''; 637 } 638 showCreditPrompt(); 639} 640function comment_edit(cid) { 641 var obj = $('comment_'+ cid +'_li'); 642 var x = new Ajax(); 643 x.get('home.php?mod=misc&ac=ajax&op=comment&inajax=1&cid='+ cid, function(s){ 644 obj.innerHTML = s; 645 }); 646} 647function comment_delete(cid) { 648 var obj = $('comment_'+ cid +'_li'); 649 obj.style.display = "none"; 650 if($('comment_replynum')) { 651 var a = parseInt($('comment_replynum').innerHTML); 652 var b = a - 1; 653 $('comment_replynum').innerHTML = b + ''; 654 } 655} 656 657function share_delete(sid) { 658 var obj = $('share_'+ sid +'_li'); 659 obj.style.display = "none"; 660} 661function friend_delete(uid) { 662 var obj = $('friend_'+ uid +'_li'); 663 if(obj != null) obj.style.display = "none"; 664 var obj2 = $('friend_tbody_'+uid); 665 if(obj2 != null) obj2.style.display = "none"; 666} 667function friend_changegroup(id, result) { 668 if(result) { 669 var ids = explode('_', id); 670 var uid = ids[1]; 671 var obj = $('friend_group_'+ uid); 672 var x = new Ajax(); 673 x.get('home.php?mod=misc&ac=ajax&op=getfriendgroup&uid='+uid, function(s){ 674 obj.innerHTML = s; 675 }); 676 } 677} 678function friend_changegroupname(group) { 679 var obj = $('friend_groupname_'+ group); 680 var x = new Ajax(); 681 x.get('home.php?mod=misc&ac=ajax&op=getfriendname&inajax=1&group='+group, function(s){ 682 obj.innerHTML = s; 683 }); 684} 685function post_add(pid, result) { 686 if(result) { 687 var obj = $('post_ul'); 688 var newli = document.createElement("div"); 689 var x = new Ajax(); 690 x.get('home.php?mod=misc&ac=ajax&op=post', function(s){ 691 newli.innerHTML = s; 692 }); 693 obj.appendChild(newli); 694 if($('message')) { 695 $('message').value= ''; 696 newnode = $('quickpostimg').rows[0].cloneNode(true); 697 tags = newnode.getElementsByTagName('input'); 698 for(i in tags) { 699 if(tags[i].name == 'pics[]') { 700 tags[i].value = 'http://'; 701 } 702 } 703 var allRows = $('quickpostimg').rows; 704 while(allRows.length) { 705 $('quickpostimg').removeChild(allRows[0]); 706 } 707 $('quickpostimg').appendChild(newnode); 708 } 709 if($('post_replynum')) { 710 var a = parseInt($('post_replynum').innerHTML); 711 var b = a + 1; 712 $('post_replynum').innerHTML = b + ''; 713 } 714 showCreditPrompt(); 715 } 716} 717function post_edit(id, result) { 718 if(result) {
719 var ids = explode('_', id); 720 var pid = ids[1]; 721 722 var obj = $('post_'+ pid +'_li'); 723 var x = new Ajax(); 724 x.get('home.php?mod=misc&ac=ajax&op=post&pid='+ pid, function(s){ 725 obj.innerHTML = s; 726 }); 727 } 728} 729function post_delete(id, result) { 730 if(result) { 731 var ids = explode('_', id); 732 var pid = ids[1]; 733 734 var obj = $('post_'+ pid +'_li'); 735 obj.style.display = "none"; 736 if($('post_replynum')) { 737 var a = parseInt($('post_replynum').innerHTML); 738 var b = a - 1; 739 $('post_replynum').innerHTML = b + ''; 740 } 741 } 742} 743function poke_send(id, result) { 744 if(result) { 745 var ids = explode('_', id); 746 var uid = ids[1]; 747 748 if($('poke_'+ uid)) { 749 $('poke_'+ uid).style.display = "none"; 750 } 751 showCreditPrompt(); 752 } 753} 754function myfriend_post(uid) { 755 if($('friend_'+uid)) { 756 $('friend_'+uid).innerHTML = '<p>'+lng['you_friends_now']+' <a href="home.php?mod=space&do=wall&uid='+uid+'" class="xi2" target="_blank">'+lng['leave_message']+'</a>, '+lng['or']+' <a href="home.php?mod=spacecp&ac=poke&op=send&uid='+uid+'&handlekey=propokehk_'+uid+'" id="a_poke_'+uid+'" class="xi2" onclick="showWindow(this.id, this.href, \'get\', 0, {\'ctrlid\':this.id,\'pos\':\'13\'});">'+lng['send_greeting']+'</a></p>'; 757 } 758 showCreditPrompt(); 759} 760function myfriend_ignore(id) { 761 var ids = explode('_', id); 762 var uid = ids[1]; 763 $('friend_tbody_'+uid).style.display = "none"; 764} 765 766function mtag_join(tagid, result) { 767 if(result) { 768 location.reload(); 769 } 770} 771 772function picView(albumid) { 773 if(albumid == 'none') { 774 $('albumpic_body').innerHTML = ''; 775 } else { 776 ajaxget('home.php?mod=misc&ac=ajax&op=album&id='+albumid+'&ajaxdiv=albumpic_body', 'albumpic_body'); 777 } 778} 779function resend_mail(mid) { 780 if(mid) { 781 var obj = $('sendmail_'+ mid +'_li'); 782 obj.style.display = "none"; 783 } 784} 785 786function userapp_delete(id, result) { 787 if(result) { 788 var ids = explode('_', id); 789 var appid = ids[1]; 790 $('space_app_'+appid).style.display = "none"; 791 } 792} 793 794function docomment_get(doid, key) { 795 var showid = key + '_' + doid; 796 var opid = key + '_do_a_op_'+doid; 797 $(showid).style.display = ''; 798 $(showid).className = 'cmt brm'; 799 ajaxget('home.php?mod=spacecp&ac=doing&op=getcomment&handlekey=msg_'+doid+'&doid='+doid+'&key='+key, showid); 800 if($(opid)) { 801 $(opid).innerHTML = lng['collapse']; 802 $(opid).onclick = function() { 803 docomment_colse(doid, key); 804 } 805 } 806 showCreditPrompt(); 807} 808 809function docomment_colse(doid, key) { 810 var showid = key + '_' + doid; 811 var opid = key + '_do_a_op_'+doid; 812 813 $(showid).style.display = 'none'; 814 $(showid).style.className = ''; 815 816 $(opid).innerHTML = lng['reply']; 817 $(opid).onclick = function() { 818 docomment_get(doid, key); 819 } 820} 821 822function docomment_form(doid, id, key) { 823 var showid = key + '_form_'+doid+'_'+id; 824 var divid = key +'_'+ doid; 825 var url = 'home.php?mod=spacecp&ac=doing&op=docomment&handlekey=msg_'+id+'&doid='+doid+'&id='+id+'&key='+key; 826 if(parseInt(discuz_uid)) { 827 ajaxget(url, showid); 828 if($(divid)) { 829 $(divid).style.display = ''; 830 } 831 } else { 832 showWindow(divid, url); 833 } 834} 835 836function docomment_form_close(doid, id, key) { 837 var showid = key + '_form_' + doid + '_' + id; 838 var opid = key + '_do_a_op_' + doid; 839 $(showid).innerHTML = ''; 840 $(showid).style.display = 'none'; 841 var liObj = $(key+'_'+doid).getElementsByTagName('li'); 842 if(!liObj.length) { 843 $(key+'_'+doid).style.display = 'none'; 844 if($(opid)) { 845 $(opid).innerHTML = lng['reply']; 846 $(opid).onclick = function () { 847 docomment_get(doid, key); 848 } 849 } 850 } 851} 852 853function feedcomment_get(feedid) { 854 var showid = 'feedcomment_'+feedid; 855 var opid = 'feedcomment_a_op_'+feedid; 856 857 $(showid).style.display = ''; 858 ajaxget('home.php?mod=spacecp&ac=feed&op=getcomment&feedid='+feedid+'&handlekey=feedhk_'+feedid, showid); 859 if($(opid) != null) { 860 $(opid).innerHTML = lng['collapse']; 861 $(opid).onclick = function() { 862 feedcomment_close(feedid); 863 } 864 } 865} 866 867function feedcomment_add(cid, feedid) { 868 var obj = $('comment_ol_'+feedid); 869 var newdl = document.createElement("dl"); 870 newdl.id = 'comment_'+cid+'_li'; 871 newdl.className = 'bbda cl'; 872 var x = new Ajax(); 873 x.get('home.php?mod=misc&ac=ajax&op=comment&inajax=1&cid='+cid, function(s){ 874 newdl.innerHTML = s; 875 }); 876 obj.appendChild(newdl); 877 878 $('feedmessage_'+feedid).value= ''; 879 showCreditPrompt(); 880} 881 882function feedcomment_close(feedid) { 883 var showid = 'feedcomment_'+feedid; 884 var opid = 'feedcomment_a_op_'+feedid; 885 886 $(showid).style.display = 'none'; 887 $(showid).style.className = ''; 888 889 $(opid).innerHTML = lng['comment']; 890 $(opid).onclick = function() { 891 feedcomment_get(feedid); 892 } 893} 894 895function feed_post_result(feedid, result) { 896 if(result) { 897 location.reload(); 898 } 899} 900 901function feed_more_show(feedid) { 902 var showid = 'feed_more_'+feedid; 903 var opid = 'feed_a_more_'+feedid; 904 905 $(showid).style.display = ''; 906 $(showid).className = 'sub_doing'; 907 908 $(opid).innerHTML = '« '+lng['close_list']; 909 $(opid).onclick = function() { 910 feed_more_close(feedid); 911 } 912} 913 914function feed_more_close(feedid) { 915 var showid = 'feed_more_'+feedid; 916 var opid = 'feed_a_more_'+feedid; 917 918 $(showid).style.display = 'none'; 919 920 $(opid).innerHTML = '» '+lng['more_feeds']; 921 $(opid).onclick = function() { 922 feed_more_show(feedid); 923 } 924} 925 926function poll_post_result(id, result) { 927 if(result) { 928 var aObj = $('__'+id).getElementsByTagName("a"); 929 window.location.href = aObj[0].href; 930 } 931} 932 933function show_click(idtype, id, clickid) { 934 ajaxget('home.php?mod=spacecp&ac=click&op=show&clickid='+clickid+'&idtype='+idtype+'&id='+id, 'click_div'); 935 showCreditPrompt(); 936} 937 938function feed_menu(feedid, show) { 939 var obj = $('a_feed_menu_'+feedid); 940 if(obj) { 941 if(show) { 942 obj.style.display='block'; 943 } else { 944 obj.style.display='none'; 945 } 946 } 947 var obj = $('feedmagic_'+feedid); 948 if(obj) { 949 if(show) { 950 obj.style.display='block'; 951 } else { 952 obj.style.display='none'; 953 } 954 } 955} 956 957function showbirthday(){ 958 var el = $('birthday'); 959 var birthday = el.value; 960 el.length=0; 961 el.options.add(new Option(lng['day'], '')); 962 for(var i=0;i<28;i++){ 963 el.options.add(new Option(i+1, i+1)); 964 } 965 if($('birthmonth').value!="2"){
966 el.options.add(new Option(29, 29)); 967 el.options.add(new Option(30, 30)); 968 switch($('birthmonth').value){ 969 case "1": 970 case "3": 971 case "5": 972 case "7": 973 case "8": 974 case "10": 975 case "12":{ 976 el.options.add(new Option(31, 31)); 977 } 978 } 979 } else if($('birthyear').value!="") { 980 var nbirthyear=$('birthyear').value; 981 if(nbirthyear%400==0 || (nbirthyear%4==0 && nbirthyear%100!=0)) el.options.add(new Option(29, 29)); 982 } 983 el.value = birthday; 984} 985 986function magicColor(elem, t) { 987 t = t || 10; 988 elem = (elem && elem.constructor == String) ? $(elem) : elem; 989 if(!elem){ 990 setTimeout(function(){magicColor(elem, t-1);}, 400); 991 return; 992 } 993 if(window.mcHandler == undefined) { 994 window.mcHandler = {elements:[]}; 995 window.mcHandler.colorIndex = 0; 996 window.mcHandler.run = function(){ 997 var color = ["#CC0000","#CC6D00","#CCCC00","#00CC00","#0000CC","#00CCCC","#CC00CC"][(window.mcHandler.colorIndex++) % 7]; 998 for(var i = 0, L=window.mcHandler.elements.length; i<L; i++) 999 window.mcHandler.elements[i].style.color = color; 1000 } 1001 } 1002 window.mcHandler.elements.push(elem); 1003 if(window.mcHandler.timer == undefined) { 1004 window.mcHandler.timer = setInterval(window.mcHandler.run, 500); 1005 } 1006} 1007 1008function passwordShow(value) { 1009 if(value==4) { 1010 $('span_password').style.display = ''; 1011 $('tb_selectgroup').style.display = 'none'; 1012 } else if(value==2) { 1013 $('span_password').style.display = 'none'; 1014 $('tb_selectgroup').style.display = ''; 1015 } else { 1016 $('span_password').style.display = 'none'; 1017 $('tb_selectgroup').style.display = 'none'; 1018 } 1019} 1020 1021function getgroup(gid) { 1022 if(gid) { 1023 var x = new Ajax(); 1024 x.get('home.php?mod=spacecp&ac=privacy&inajax=1&op=getgroup&gid='+gid, function(s){ 1025 s = s + ' '; 1026 $('target_names').innerHTML += s; 1027 }); 1028 } 1029} 1030 1031function pmsendappend() { 1032 $('pm_append').style.display = ''; 1033 $('pm_append').id = ''; 1034 div = document.createElement('div'); 1035 div.id = 'pm_append'; 1036 div.style.display = 'none'; 1037 $('pm_ul').appendChild(div); 1038 $('replymessage').value = ''; 1039 showCreditPrompt(); 1040} 1041 1042function succeedhandle_pmsend(locationhref, message, param) { 1043 ajaxget('home.php?mod=spacecp&ac=pm&op=viewpmid&pmid=' + param['pmid'], 'pm_append', 'ajaxwaitid', '', null, 'pmsendappend()'); 1044} 1045 1046function getchatpmappendmember() { 1047 var users = document.getElementsByName('users[]'); 1048 var appendmember = ''; 1049 if(users.length) { 1050 var comma = ''; 1051 for(var i = 0; i < users.length; i++) { 1052 appendmember += comma + users[i].value; 1053 if(!comma) { 1054 comma = ','; 1055 } 1056 } 1057 } 1058 if($('username').value) { 1059 appendmember = appendmember ? (appendmember + ',' + $('username').value) : $('username').value; 1060 } 1061 var href = $('a_appendmember').href + '&memberusername=' + appendmember; 1062 showWindow('a_appendmember', href, 'get', 0); 1063} 1064 1065function markreadpm(markreadids) { 1066 var markreadidarr = markreadids.split(','); 1067 if(markreadidarr.length > 0) { 1068 for(var i = 0; i < markreadidarr.length; i++) { 1069 $(markreadidarr[i]).className = 'bbda cl'; 1070 } 1071 } 1072} 1073 1074function setpmstatus(form) { 1075 var ids_gpmid = new Array(); 1076 var ids_plid = new Array(); 1077 var type = ''; 1078 var requesturl = ''; 1079 var markreadids = new Array(); 1080 1081 for(var i = 0; i < form.elements.length; i++) { 1082 var e = form.elements[i]; 1083 if(e.id && e.id.match('a_delete') && e.checked) { 1084 var idarr = new Array(); 1085 idarr = e.id.split('_'); 1086 if(idarr[1] == 'deleteg') { 1087 ids_gpmid.push(idarr[2]); 1088 markreadids.push('gpmlist_' + idarr[2]); 1089 } else if(idarr[1] == 'delete') { 1090 ids_plid.push(idarr[2]); 1091 markreadids.push('pmlist_' + idarr[2]); 1092 } 1093 } 1094 } 1095 1096 if(ids_gpmid.length > 0) { 1097 requesturl += '&gpmids=' + ids_gpmid.join(','); 1098 } 1099 if(ids_plid.length > 0) { 1100 requesturl += '&plids=' + ids_plid.join(','); 1101 } 1102 1103 if(requesturl) { 1104 ajaxget('home.php?mod=spacecp&ac=pm&op=setpmstatus' + requesturl, '', 'ajaxwaitid', '', 'none', 'markreadpm(\''+ markreadids.join(',') +'\')'); 1105 } 1106} 1107 1108function changedeletedpm(pmid) { 1109 $('pmlist_' + pmid).style.display = 'none'; 1110 var membernum = parseInt($('membernum').innerHTML); 1111 $('membernum').innerHTML = membernum - 1; 1112} 1113 1114function changeOrderRange(id) { 1115 if(!$(id)) return false; 1116 var url = window.location.href; 1117 var a = $(id).getElementsByTagName('a'); 1118 for(var i = 0; i < a.length; i++) { 1119 a[i].onclick = function () { 1120 if(url.indexOf("&orderby=") == -1) { 1121 url += "&orderby=" + this.id; 1122 } else { 1123 url = url.replace(/orderby=.*/, "orderby=" + this.id); 1124 } 1125 window.location = url; 1126 return false; 1127 } 1128 } 1129} 1130 1131function addBlockLink(id, tag) { 1132 if(!$(id)) return false; 1133 var a = $(id).getElementsByTagName(tag); 1134 var taglist = {'A':1, 'INPUT':1, 'IMG':1}; 1135 for(var i = 0, len = a.length; i < len; i++) { 1136 a[i].onmouseover = function () { 1137 if(this.className.indexOf(' hover') == -1) { 1138 this.className = this.className + ' hover'; 1139 } 1140 }; 1141 a[i].onmouseout = function () { 1142 this.className = this.className.replace(' hover', ''); 1143 }; 1144 a[i].onclick = function (e) { 1145 e = e ? e : window.event; 1146 var target = e.target || e.srcElement; 1147 if(!taglist[target.tagName]) { 1148 window.location.href = $(this.id + '_a').href; 1149 } 1150 }; 1151 } 1152} 1153 1154function checkSynSignature() { 1155 if($('to_signhtml').value == '1') { 1156 $('syn_signature').className = 'syn_signature'; 1157 $('to_signhtml').value = '0'; 1158 } else { 1159 $('syn_signature').className = 'syn_signature_check'; 1160 $('to_signhtml').value = '1'; 1161 } 1162}
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.