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