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 quick_validate(obj) { 223 if($('seccode')) { 224 var code = $('seccode').value; 225 var x = new Ajax(); 226 x.get('cp.php?ac=common&op=seccode&code=' + code, function(s){ 227 s = trim(s); 228 if(s != 'succeed') { 229 alert(s); 230 $('seccode').focus(); 231 return false; 232 } else { 233 obj.form.submit(); 234 return true; 235 } 236 }); 237 } else { 238 obj.form.submit(); 239 return true; 240 } 241} 242 243function stopMusic(preID, playerID) { 244 var musicFlash = preID.toString() + '_' + playerID.toString(); 245 if($(musicFlash)) { 246 $(musicFlash).SetVariable('closePlayer', 1); 247 } 248} 249function showFlash(host, flashvar, obj, shareid) { 250 var flashAddr = { 251 'youku.com' : 'http://player.youku.com/player.php/sid/FLASHVAR=/v.swf', 252 'ku6.com' : 'http://player.ku6.com/refer/FLASHVAR/v.swf', 253 'youtube.com' : 'http://www.youtube.com/v/FLASHVAR', 254 '5show.com' : 'http://www.5show.com/swf/5show_player.swf?flv_id=FLASHVAR', 255 'sina.com.cn' : 'http://vhead.blog.sina.com.cn/player/outer_player.swf?vid=FLASHVAR', 256 'sohu.com' : 'http://v.blog.sohu.com/fo/v4/FLASHVAR', 257 'mofile.com' : 'http://tv.mofile.com/cn/xplayer.swf?v=FLASHVAR', 258 'music' : 'FLASHVAR', 259 'flash' : 'FLASHVAR' 260 }; 261 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">' 262 + '<param name="movie" value="FLASHADDR" />' 263 + '<param name="quality" value="high" />' 264 + '<param name="bgcolor" value="#FFFFFF" />' 265 + '<param name="allowScriptAccess" value="never" />' 266 + '<param name="allowNetworking" value="internal" />' 267 + '<embed width="480" height="400" menu="false" quality="high" allowScriptAccess="never" allowNetworking="internal" src="FLASHADDR" type="application/x-shockwave-flash" />' 268 + '</object>'; 269 var videoFlash = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="480" height="450">' 270 + '<param value="transparent" name="wmode"/>' 271 + '<param value="FLASHADDR" name="movie" />' 272 + '<param name="allowScriptAccess" value="never" />' 273 + '<param name="allowNetworking" value="none" />' 274 + '<embed src="FLASHADDR" wmode="transparent" allowfullscreen="true" type="application/x-shockwave-flash" width="480" height="450" allowScriptAccess="never" allowNetworking="internal"></embed>' 275 + '</object>'; 276 var musicFlash = '<object id="audioplayer_SHAREID" height="24" width="290" data="' + STATICURL + 'image/common/player.swf" type="application/x-shockwave-flash">' 277 + '<param value="' + STATICURL + 'image/common/player.swf" name="movie"/>' 278 + '<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"/>' 279 + '<param value="high" name="quality"/>' 280 + '<param value="false" name="menu"/>' 281 + '<param value="#FFFFFF" name="bgcolor"/>' 282 + '</object>'; 283 var musicMedia = '<object height="64" width="290" data="FLASHADDR" type="audio/x-ms-wma">' 284 + '<param value="FLASHADDR" name="src"/>' 285 + '<param value="1" name="autostart"/>' 286 + '<param value="true" name="controller"/>' 287 + '</object>'; 288 var flashHtml = videoFlash; 289 var videoMp3 = true; 290 if('' == flashvar) {
291 alert('鳿¨å°åé¯èª¤ï¼ä¸è½çºç©º'); 292 return false; 293 } 294 if('music' == host) { 295 var mp3Reg = new RegExp('.mp3$', 'ig'); 296 var flashReg = new RegExp('.swf$', 'ig'); 297 flashHtml = musicMedia; 298 videoMp3 = false; 299 if(mp3Reg.test(flashvar)) { 300 videoMp3 = true; 301 flashHtml = musicFlash; 302 } else if(flashReg.test(flashvar)) { 303 videoMp3 = true; 304 flashHtml = flash; 305 } 306 } 307 flashvar = encodeURI(flashvar); 308 if(flashAddr[host]) { 309 var flash = flashAddr[host].replace('FLASHVAR', flashvar); 310 flashHtml = flashHtml.replace(/FLASHADDR/g, flash); 311 flashHtml = flashHtml.replace(/SHAREID/g, shareid); 312 } 313 314 if(!obj) { 315 $('flash_div_' + shareid).innerHTML = flashHtml; 316 return true; 317 } 318 if($('flash_div_' + shareid)) { 319 $('flash_div_' + shareid).style.display = ''; 320 $('flash_hide_' + shareid).style.display = ''; 321 obj.style.display = 'none'; 322 return true; 323 } 324 if(flashAddr[host]) { 325 var flashObj = document.createElement('div'); 326 flashObj.id = 'flash_div_' + shareid; 327 obj.parentNode.insertBefore(flashObj, obj); 328 flashObj.innerHTML = flashHtml; 329 obj.style.display = 'none'; 330 var hideObj = document.createElement('div'); 331 hideObj.id = 'flash_hide_' + shareid; 332 var nodetxt = document.createTextNode("æ¶èµ·"); 333 hideObj.appendChild(nodetxt); 334 obj.parentNode.insertBefore(hideObj, obj); 335 hideObj.style.cursor = 'pointer'; 336 hideObj.onclick = function() { 337 if(true == videoMp3) { 338 stopMusic('audioplayer', shareid); 339 flashObj.parentNode.removeChild(flashObj); 340 hideObj.parentNode.removeChild(hideObj); 341 } else { 342 flashObj.style.display = 'none'; 343 hideObj.style.display = 'none'; 344 } 345 obj.style.display = ''; 346 }; 347 } 348} 349 350function userapp_open() { 351 var x = new Ajax(); 352 x.get('home.php?mod=spacecp&ac=common&op=getuserapp&inajax=1', function(s){ 353 $('my_userapp').innerHTML = s; 354 $('a_app_more').className = 'fold'; 355 $('a_app_more').innerHTML = 'æ¶èµ·'; 356 $('a_app_more').onclick = function() { 357 userapp_close(); 358 }; 359 }); 360} 361 362function userapp_close() { 363 var x = new Ajax(); 364 x.get('home.php?mod=spacecp&ac=common&op=getuserapp&subop=off&inajax=1', function(s){ 365 $('my_userapp').innerHTML = s; 366 $('a_app_more').className = 'unfold'; 367 $('a_app_more').innerHTML = 'å±é'; 368 $('a_app_more').onclick = function() { 369 userapp_open(); 370 }; 371 }); 372} 373 374function startMarquee(h, speed, delay, sid) { 375 var t = null; 376 var p = false; 377 var o = $(sid); 378 o.innerHTML += o.innerHTML; 379 o.onmouseover = function() {p = true}; 380 o.onmouseout = function() {p = false}; 381 o.scrollTop = 0; 382 function start() { 383 t = setInterval(scrolling, speed); 384 if(!p) { 385 o.scrollTop += 2; 386 } 387 } 388 function scrolling() { 389 if(p) return; 390 if(o.scrollTop % h != 0) { 391 o.scrollTop += 2; 392 if(o.scrollTop >= o.scrollHeight/2) o.scrollTop = 0; 393 } else { 394 clearInterval(t); 395 setTimeout(start, delay); 396 } 397 } 398 setTimeout(start, delay); 399} 400 401function readfeed(obj, id) { 402 if(Cookie.get("read_feed_ids")) { 403 var fcookie = Cookie.get("read_feed_ids"); 404 fcookie = id + ',' + fcookie; 405 } else { 406 var fcookie = id; 407 } 408 Cookie.set("read_feed_ids", fcookie, 48); 409 obj.className = 'feedread'; 410} 411 412function showreward() { 413 if(Cookie.get('reward_notice_disable')) { 414 return false; 415 } 416 var x = new Ajax(); 417 x.get('home.php?mod=misc&ac=ajax&op=getreward', function(s){ 418 if(s) { 419 msgwin(s, 2000); 420 } 421 }); 422} 423 424function msgwin(s, t) { 425 426 var msgWinObj = $('msgwin'); 427 if(!msgWinObj) { 428 var msgWinObj = document.createElement("div"); 429 msgWinObj.id = 'msgwin'; 430 msgWinObj.style.display = 'none'; 431 msgWinObj.style.position = 'absolute'; 432 msgWinObj.style.zIndex = '100000'; 433 $('append_parent').appendChild(msgWinObj); 434 } 435 msgWinObj.innerHTML = s; 436 msgWinObj.style.display = ''; 437 msgWinObj.style.filter = 'progid:DXImageTransform.Microsoft.Alpha(opacity=0)'; 438 msgWinObj.style.opacity = 0; 439 var sTop = document.documentElement && document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop; 440 pbegin = sTop + (document.documentElement.clientHeight / 2); 441 pend = sTop + (document.documentElement.clientHeight / 5); 442 setTimeout(function () {showmsgwin(pbegin, pend, 0, t)}, 10); 443 msgWinObj.style.left = ((document.documentElement.clientWidth - msgWinObj.clientWidth) / 2) + 'px'; 444 msgWinObj.style.top = pbegin + 'px'; 445} 446 447function showmsgwin(b, e, a, t) { 448 step = (b - e) / 10; 449 var msgWinObj = $('msgwin'); 450 newp = (parseInt(msgWinObj.style.top) - step); 451 if(newp > e) { 452 msgWinObj.style.filter = 'progid:DXImageTransform.Microsoft.Alpha(opacity=' + a + ')'; 453 msgWinObj.style.opacity = a / 100; 454 msgWinObj.style.top = newp + 'px'; 455 setTimeout(function () {showmsgwin(b, e, a += 10, t)}, 10); 456 } else { 457 msgWinObj.style.filter = 'progid:DXImageTransform.Microsoft.Alpha(opacity=100)'; 458 msgWinObj.style.opacity = 1; 459 setTimeout('displayOpacity(\'msgwin\', 100)', t); 460 } 461} 462 463function displayOpacity(id, n) { 464 if(!$(id)) { 465 return; 466 } 467 if(n >= 0) { 468 n -= 10; 469 $(id).style.filter = 'progid:DXImageTransform.Microsoft.Alpha(opacity=' + n + ')'; 470 $(id).style.opacity = n / 100; 471 setTimeout('displayOpacity(\'' + id + '\',' + n + ')', 50); 472 } else { 473 $(id).style.display = 'none'; 474 $(id).style.filter = 'progid:DXImageTransform.Microsoft.Alpha(opacity=100)'; 475 $(id).style.opacity = 1; 476 } 477} 478 479function urlto(url) { 480 window.location.href = url; 481} 482 483function explode(sep, string) { 484 return string.split(sep); 485} 486 487function selector(pattern, context) { 488 var re = new RegExp('([a-z0-9]*)([\.#:]*)(.*|$)', 'ig'); 489 var match = re.exec(pattern); 490 var conditions = cc = []; 491 if (match[2] == '#') conditions.push(['id', '=', match[3]]); 492 else if(match[2] == '.') conditions.push(['className', '~=', match[3]]); 493 else if(match[2] == ':') conditions.push(['type', '=', match[3]]); 494 var s = match[3].replace(/\[(.*)\]/g,'$1').split('@'); 495 for(var i=0; i<s.length; i++) { 496 if (cc = /([\w]+)([=^%!$~]+)(.*)$/.exec(s[i])) 497 conditions.push([cc[1], cc[2], cc[3]]); 498 } 499 var list = conditions[0] && conditions[0][0] == 'id' ? [document.getElementById(conditions[0][2])] : (context || document).getElementsByTagName(match[1] || "*"); 500 if(!list || !list.length) return []; 501 if(conditions) { 502 var elements = []; 503 var attrMapping = {'for': 'htmlFor', 'class': 'className'}; 504 for(var i=0; i<list.length; i++) { 505 var pass = true; 506 for(var j=0; j<conditions.length; j++) { 507 var attr = attrMapping[conditions[j][0]] || conditions[j][0]; 508 var val = list[i][attr] || (list[i].getAttribute ? list[i].getAttribute(attr) : ''); 509 var pattern = null; 510 if(conditions[j][1] == '=') { 511 pattern = new RegExp('^'+conditions[j][2]+'$', 'i'); 512 } else if(conditions[j][1] == '^=') { 513 pattern = new RegExp('^' + conditions[j][2], 'i'); 514 } else if(conditions[j][1] == '$=') { 515 pattern = new RegExp(conditions[j][2] + '$', 'i'); 516 } else if(conditions[j][1] == '%=') { 517 pattern = new RegExp(conditions[j][2], 'i'); 518 } else if(conditions[j][1] == '~=') { 519 pattern = new RegExp('(^|[ ])' + conditions[j][2] + '([ ]|$)', 'i'); 520 } 521 if(pattern && !pattern.test(val)) { 522 pass = false; 523 break; 524 } 525 } 526 if(pass) elements.push(list[i]); 527 } 528 return elements; 529 } else { 530 return list; 531 } 532} 533 534function showBlock(cid, oid) { 535 if(parseInt(cid)) { 536 var listObj = $(oid); 537 var x = new Ajax(); 538 x.get('portal.php?mod=cp&ac=block&operation=getblock&classid='+cid, function(s){ 539 listObj.innerHTML = s; 540 }) 541 } 542} 543 544function resizeTx(obj){ 545 var oid = obj.id + '_limit'; 546 if(!BROWSER.ie) obj.style.height = 0; 547 obj.style.height = obj.scrollHeight + 'px'; 548 if($(oid)) $(oid).style.display = obj.scrollHeight > 30 ? '':'none'; 549} 550
551function showFace(showid, target, dropstr) { 552 if($(showid + '_menu') != null) { 553 $(showid+'_menu').style.display = ''; 554 } else { 555 var faceDiv = document.createElement("div"); 556 faceDiv.id = showid+'_menu'; 557 faceDiv.className = 'p_pop facel'; 558 faceDiv.style.position = 'absolute'; 559 faceDiv.style.zIndex = 1001; 560 var faceul = document.createElement("ul"); 561 for(i=1; i<31; i++) { 562 var faceli = document.createElement("li"); 563 faceli.innerHTML = '<img src="' + STATICURL + 'image/smiley/comcom/'+i+'.gif" onclick="insertFace(\''+showid+'\','+i+', \''+ target +'\', \''+dropstr+'\')" style="cursor:pointer; position:relative;" />'; 564 faceul.appendChild(faceli); 565 } 566 faceDiv.appendChild(faceul); 567 $('append_parent').appendChild(faceDiv) 568 } 569 setMenuPosition(showid, 0); 570 doane(); 571 _attachEvent(document.body, 'click', function(){if($(showid+'_menu')) $(showid+'_menu').style.display = 'none';}); 572} 573 574function insertFace(showid, id, target, dropstr) { 575 var faceText = '[em:'+id+':]'; 576 if($(target) != null) { 577 insertContent(target, faceText); 578 if(dropstr) { 579 $(target).value = $(target).value.replace(dropstr, ""); 580 } 581 } 582} 583 584function wall_add(id) { 585 var obj = $('comment_ul'); 586 var newdl = document.createElement("dl"); 587 newdl.id = 'comment_'+id+'_li'; 588 newdl.className = 'bbda cl'; 589 var x = new Ajax(); 590 x.get('home.php?mod=misc&ac=ajax&op=comment&inajax=1&cid='+id, function(s){ 591 newdl.innerHTML = s; 592 }); 593 obj.insertBefore(newdl, obj.firstChild); 594 if($('comment_message')) { 595 $('comment_message').value= ''; 596 } 597 showCreditPrompt(); 598} 599 600function share_add(sid) { 601 var obj = $('share_ul'); 602 var newli = document.createElement("li"); 603 newli.id = 'share_' + sid + '_li'; 604 var x = new Ajax(); 605 x.get('home.php?mod=misc&ac=ajax&op=share&inajax=1&sid='+sid, function(s){ 606 newli.innerHTML = s; 607 }); 608 obj.insertBefore(newli, obj.firstChild); 609 $('share_link').value = 'http://'; 610 $('share_general').value = ''; 611 showCreditPrompt(); 612} 613 614function comment_add(id) { 615 var obj = $('comment_ul'); 616 var newdl = document.createElement("dl"); 617 newdl.id = 'comment_'+id+'_li'; 618 newdl.className = 'bbda cl'; 619 var x = new Ajax(); 620 x.get('home.php?mod=misc&ac=ajax&op=comment&inajax=1&cid='+id, function(s){ 621 newdl.innerHTML = s; 622 }); 623 if($('comment_prepend')){ 624 obj = obj.firstChild; 625 while (obj && obj.nodeType != 1){ 626 obj = obj.nextSibling; 627 } 628 obj.parentNode.insertBefore(newdl, obj); 629 } else { 630 obj.appendChild(newdl); 631 } 632 if($('comment_message')) { 633 $('comment_message').value= ''; 634 } 635 if($('comment_replynum')) { 636 var a = parseInt($('comment_replynum').innerHTML); 637 var b = a + 1; 638 $('comment_replynum').innerHTML = b + ''; 639 } 640 showCreditPrompt(); 641} 642function comment_edit(cid) { 643 var obj = $('comment_'+ cid +'_li'); 644 var x = new Ajax(); 645 x.get('home.php?mod=misc&ac=ajax&op=comment&inajax=1&cid='+ cid, function(s){ 646 obj.innerHTML = s; 647 var elems = selector('dd[class~=magicflicker]'); 648 for(var i=0; i<elems.length; i++){ 649 magicColor(elems[i]); 650 } 651 }); 652} 653function comment_delete(cid) { 654 var obj = $('comment_'+ cid +'_li'); 655 obj.style.display = "none"; 656 if($('comment_replynum')) { 657 var a = parseInt($('comment_replynum').innerHTML); 658 var b = a - 1; 659 $('comment_replynum').innerHTML = b + ''; 660 } 661} 662 663function share_delete(sid) { 664 var obj = $('share_'+ sid +'_li'); 665 obj.style.display = "none"; 666} 667function friend_delete(uid) { 668 var obj = $('friend_'+ uid +'_li'); 669 if(obj != null) obj.style.display = "none"; 670 var obj2 = $('friend_tbody_'+uid); 671 if(obj2 != null) obj2.style.display = "none"; 672} 673function friend_changegroup(id, result) { 674 if(result) { 675 var ids = explode('_', id); 676 var uid = ids[1]; 677 var obj = $('friend_group_'+ uid); 678 var x = new Ajax(); 679 x.get('home.php?mod=misc&ac=ajax&op=getfriendgroup&uid='+uid, function(s){ 680 obj.innerHTML = s; 681 }); 682 } 683} 684function friend_changegroupname(group) { 685 var obj = $('friend_groupname_'+ group); 686 var x = new Ajax(); 687 x.get('home.php?mod=misc&ac=ajax&op=getfriendname&inajax=1&group='+group, function(s){ 688 obj.innerHTML = s; 689 }); 690} 691function post_add(pid, result) { 692 if(result) { 693 var obj = $('post_ul'); 694 var newli = document.createElement("div"); 695 var x = new Ajax(); 696 x.get('home.php?mod=misc&ac=ajax&op=post', function(s){ 697 newli.innerHTML = s; 698 }); 699 obj.appendChild(newli); 700 if($('message')) { 701 $('message').value= ''; 702 newnode = $('quickpostimg').rows[0].cloneNode(true); 703 tags = newnode.getElementsByTagName('input'); 704 for(i = 0;i < tags.length;i++) { 705 if(tags[i].name == 'pics[]') { 706 tags[i].value = 'http://'; 707 } 708 } 709 var allRows = $('quickpostimg').rows; 710 while(allRows.length) { 711 $('quickpostimg').removeChild(allRows[0]); 712 } 713 $('quickpostimg').appendChild(newnode); 714 } 715 if($('post_replynum')) { 716 var a = parseInt($('post_replynum').innerHTML); 717 var b = a + 1; 718 $('post_replynum').innerHTML = b + ''; 719 } 720 showCreditPrompt(); 721 } 722} 723function post_edit(id, result) { 724 if(result) {
725 var ids = explode('_', id); 726 var pid = ids[1]; 727 728 var obj = $('post_'+ pid +'_li'); 729 var x = new Ajax(); 730 x.get('home.php?mod=misc&ac=ajax&op=post&pid='+ pid, function(s){ 731 obj.innerHTML = s; 732 }); 733 } 734} 735function post_delete(id, result) { 736 if(result) { 737 var ids = explode('_', id); 738 var pid = ids[1]; 739 740 var obj = $('post_'+ pid +'_li'); 741 obj.style.display = "none"; 742 if($('post_replynum')) { 743 var a = parseInt($('post_replynum').innerHTML); 744 var b = a - 1; 745 $('post_replynum').innerHTML = b + ''; 746 } 747 } 748} 749function poke_send(id, result) { 750 if(result) { 751 var ids = explode('_', id); 752 var uid = ids[1]; 753 754 if($('poke_'+ uid)) { 755 $('poke_'+ uid).style.display = "none"; 756 } 757 showCreditPrompt(); 758 } 759} 760function myfriend_post(uid) { 761 if($('friend_'+uid)) { 762 $('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>'; 763 } 764 showCreditPrompt(); 765} 766function myfriend_ignore(id) { 767 var ids = explode('_', id); 768 var uid = ids[1]; 769 $('friend_tbody_'+uid).style.display = "none"; 770} 771 772function mtag_join(tagid, result) { 773 if(result) { 774 location.reload(); 775 } 776} 777 778function resend_mail(mid) { 779 if(mid) { 780 var obj = $('sendmail_'+ mid +'_li'); 781 obj.style.display = "none"; 782 } 783} 784 785function userapp_delete(id, result) { 786 if(result) { 787 var ids = explode('_', id); 788 var appid = ids[1]; 789 $('space_app_'+appid).style.display = "none"; 790 } 791} 792 793function docomment_get(doid, key) { 794 var showid = key + '_' + doid; 795 var opid = key + '_do_a_op_'+doid; 796 $(showid).style.display = ''; 797 $(showid).className = 'cmt brm'; 798 ajaxget('home.php?mod=spacecp&ac=doing&op=getcomment&handlekey=msg_'+doid+'&doid='+doid+'&key='+key, showid); 799 if($(opid)) { 800 $(opid).innerHTML = 'æ¶èµ·'; 801 $(opid).onclick = function() { 802 docomment_colse(doid, key); 803 } 804 } 805 showCreditPrompt(); 806} 807 808function docomment_colse(doid, key) { 809 var showid = key + '_' + doid; 810 var opid = key + '_do_a_op_'+doid; 811 812 $(showid).style.display = 'none'; 813 $(showid).style.className = ''; 814 815 $(opid).innerHTML = 'å復'; 816 $(opid).onclick = function() { 817 docomment_get(doid, key); 818 } 819} 820 821function docomment_form(doid, id, key) { 822 var showid = key + '_form_'+doid+'_'+id; 823 var divid = key +'_'+ doid; 824 var url = 'home.php?mod=spacecp&ac=doing&op=docomment&handlekey=msg_'+id+'&doid='+doid+'&id='+id+'&key='+key; 825 if(parseInt(discuz_uid)) { 826 ajaxget(url, showid); 827 if($(divid)) { 828 $(divid).style.display = ''; 829 } 830 } else { 831 showWindow(divid, url); 832 } 833} 834 835function docomment_form_close(doid, id, key) { 836 var showid = key + '_form_' + doid + '_' + id; 837 var opid = key + '_do_a_op_' + doid; 838 $(showid).innerHTML = ''; 839 $(showid).style.display = 'none'; 840 var liObj = $(key+'_'+doid).getElementsByTagName('li'); 841 if(!liObj.length) { 842 $(key+'_'+doid).style.display = 'none'; 843 if($(opid)) { 844 $(opid).innerHTML = 'å復'; 845 $(opid).onclick = function () { 846 docomment_get(doid, key); 847 } 848 } 849 } 850} 851 852function feedcomment_get(feedid) { 853 var showid = 'feedcomment_'+feedid; 854 var opid = 'feedcomment_a_op_'+feedid; 855 856 $(showid).style.display = ''; 857 ajaxget('home.php?mod=spacecp&ac=feed&op=getcomment&feedid='+feedid+'&handlekey=feedhk_'+feedid, showid); 858 if($(opid) != null) { 859 $(opid).innerHTML = 'æ¶èµ·'; 860 $(opid).onclick = function() { 861 feedcomment_close(feedid); 862 } 863 } 864} 865 866function feedcomment_add(cid, feedid) { 867 var obj = $('comment_ol_'+feedid); 868 var newdl = document.createElement("dl"); 869 newdl.id = 'comment_'+cid+'_li'; 870 newdl.className = 'bbda cl'; 871 var x = new Ajax(); 872 x.get('home.php?mod=misc&ac=ajax&op=comment&inajax=1&cid='+cid, function(s){ 873 newdl.innerHTML = s; 874 }); 875 obj.appendChild(newdl); 876 877 $('feedmessage_'+feedid).value= ''; 878 showCreditPrompt(); 879} 880 881function feedcomment_close(feedid) { 882 var showid = 'feedcomment_'+feedid; 883 var opid = 'feedcomment_a_op_'+feedid; 884 885 $(showid).style.display = 'none'; 886 $(showid).style.className = ''; 887 888 $(opid).innerHTML = 'è©è«'; 889 $(opid).onclick = function() { 890 feedcomment_get(feedid); 891 } 892} 893 894function feed_post_result(feedid, result) { 895 if(result) { 896 location.reload(); 897 } 898} 899 900function feed_more_show(feedid) { 901 var showid = 'feed_more_'+feedid; 902 var opid = 'feed_a_more_'+feedid; 903 904 $(showid).style.display = ''; 905 $(showid).className = 'sub_doing'; 906 907 $(opid).innerHTML = '« æ¶èµ·å表'; 908 $(opid).onclick = function() { 909 feed_more_close(feedid); 910 } 911} 912 913function feed_more_close(feedid) { 914 var showid = 'feed_more_'+feedid; 915 var opid = 'feed_a_more_'+feedid; 916 917 $(showid).style.display = 'none'; 918 919 $(opid).innerHTML = '» æ´å¤åæ '; 920 $(opid).onclick = function() { 921 feed_more_show(feedid); 922 } 923} 924 925function poll_post_result(id, result) { 926 if(result) { 927 var aObj = $('__'+id).getElementsByTagName("a"); 928 window.location.href = aObj[0].href; 929 } 930} 931 932function show_click(idtype, id, clickid) { 933 ajaxget('home.php?mod=spacecp&ac=click&op=show&clickid='+clickid+'&idtype='+idtype+'&id='+id, 'click_div'); 934 showCreditPrompt(); 935} 936 937function feed_menu(feedid, show) { 938 var obj = $('a_feed_menu_'+feedid); 939 if(obj) { 940 if(show) { 941 obj.style.display='block'; 942 } else { 943 obj.style.display='none'; 944 } 945 } 946 var obj = $('feedmagic_'+feedid); 947 if(obj) { 948 if(show) { 949 obj.style.display='block'; 950 } else { 951 obj.style.display='none'; 952 } 953 } 954} 955 956function showbirthday(){ 957 var el = $('birthday'); 958 var birthday = el.value; 959 el.length=0; 960 el.options.add(new Option('æ¥', '')); 961 for(var i=0;i<28;i++){ 962 el.options.add(new Option(i+1, i+1)); 963 } 964 if($('birthmonth').value!="2"){
965 el.options.add(new Option(29, 29)); 966 el.options.add(new Option(30, 30)); 967 switch($('birthmonth').value){ 968 case "1": 969 case "3": 970 case "5": 971 case "7": 972 case "8": 973 case "10": 974 case "12":{ 975 el.options.add(new Option(31, 31)); 976 } 977 } 978 } else if($('birthyear').value!="") { 979 var nbirthyear=$('birthyear').value; 980 if(nbirthyear%400==0 || (nbirthyear%4==0 && nbirthyear%100!=0)) el.options.add(new Option(29, 29)); 981 } 982 el.value = birthday; 983} 984 985function magicColor(elem, t) { 986 t = t || 10; 987 elem = (elem && elem.constructor == String) ? $(elem) : elem; 988 if(!elem){ 989 setTimeout(function(){magicColor(elem, t-1);}, 400); 990 return; 991 } 992 if(window.mcHandler == undefined) { 993 window.mcHandler = {elements:[]}; 994 window.mcHandler.colorIndex = 0; 995 window.mcHandler.run = function(){ 996 var color = ["#CC0000","#CC6D00","#CCCC00","#00CC00","#0000CC","#00CCCC","#CC00CC"][(window.mcHandler.colorIndex++) % 7]; 997 for(var i = 0, L=window.mcHandler.elements.length; i<L; i++) 998 window.mcHandler.elements[i].style.color = color; 999 } 1000 } 1001 window.mcHandler.elements.push(elem); 1002 if(window.mcHandler.timer == undefined) { 1003 window.mcHandler.timer = setInterval(window.mcHandler.run, 500); 1004 } 1005} 1006 1007function passwordShow(value) { 1008 if(value==4) { 1009 $('span_password').style.display = ''; 1010 $('tb_selectgroup').style.display = 'none'; 1011 } else if(value==2) { 1012 $('span_password').style.display = 'none'; 1013 $('tb_selectgroup').style.display = ''; 1014 } else { 1015 $('span_password').style.display = 'none'; 1016 $('tb_selectgroup').style.display = 'none'; 1017 } 1018} 1019 1020function getgroup(gid) { 1021 if(gid) { 1022 var x = new Ajax(); 1023 x.get('home.php?mod=spacecp&ac=privacy&inajax=1&op=getgroup&gid='+gid, function(s){ 1024 s = s + ' '; 1025 $('target_names').innerHTML += s; 1026 }); 1027 } 1028} 1029 1030function pmsendappend() { 1031 $('pm_append').style.display = ''; 1032 $('pm_append').id = ''; 1033 div = document.createElement('div'); 1034 div.id = 'pm_append'; 1035 div.style.display = 'none'; 1036 $('pm_ul').appendChild(div); 1037 $('replymessage').value = ''; 1038 showCreditPrompt(); 1039} 1040 1041function succeedhandle_pmsend(locationhref, message, param) { 1042 ajaxget('home.php?mod=spacecp&ac=pm&op=viewpmid&pmid=' + param['pmid'], 'pm_append', 'ajaxwaitid', '', null, 'pmsendappend()'); 1043} 1044 1045function getchatpmappendmember() { 1046 var users = document.getElementsByName('users[]'); 1047 var appendmember = ''; 1048 if(users.length) { 1049 var comma = ''; 1050 for(var i = 0; i < users.length; i++) { 1051 appendmember += comma + users[i].value; 1052 if(!comma) { 1053 comma = ','; 1054 } 1055 } 1056 } 1057 if($('username').value) { 1058 appendmember = appendmember ? (appendmember + ',' + $('username').value) : $('username').value; 1059 } 1060 var href = $('a_appendmember').href + '&memberusername=' + appendmember; 1061 showWindow('a_appendmember', href, 'get', 0); 1062} 1063 1064function markreadpm(markreadids) { 1065 var markreadidarr = markreadids.split(','); 1066 if(markreadidarr.length > 0) { 1067 for(var i = 0; i < markreadidarr.length; i++) { 1068 $(markreadidarr[i]).className = 'bbda cl'; 1069 } 1070 } 1071} 1072 1073function setpmstatus(form) { 1074 var ids_gpmid = new Array(); 1075 var ids_plid = new Array(); 1076 var type = ''; 1077 var requesturl = ''; 1078 var markreadids = new Array(); 1079 1080 for(var i = 0; i < form.elements.length; i++) { 1081 var e = form.elements[i]; 1082 if(e.id && e.id.match('a_delete') && e.checked) { 1083 var idarr = new Array(); 1084 idarr = e.id.split('_'); 1085 if(idarr[1] == 'deleteg') { 1086 ids_gpmid.push(idarr[2]); 1087 markreadids.push('gpmlist_' + idarr[2]); 1088 } else if(idarr[1] == 'delete') { 1089 ids_plid.push(idarr[2]); 1090 markreadids.push('pmlist_' + idarr[2]); 1091 } 1092 } 1093 } 1094 1095 if(ids_gpmid.length > 0) { 1096 requesturl += '&gpmids=' + ids_gpmid.join(','); 1097 } 1098 if(ids_plid.length > 0) { 1099 requesturl += '&plids=' + ids_plid.join(','); 1100 } 1101 1102 if(requesturl) { 1103 ajaxget('home.php?mod=spacecp&ac=pm&op=setpmstatus' + requesturl, '', 'ajaxwaitid', '', 'none', 'markreadpm(\''+ markreadids.join(',') +'\')'); 1104 } 1105} 1106 1107function changedeletedpm(pmid) { 1108 $('pmlist_' + pmid).style.display = 'none'; 1109 var membernum = parseInt($('membernum').innerHTML); 1110 $('membernum').innerHTML = membernum - 1; 1111} 1112 1113function changeOrderRange(id) { 1114 if(!$(id)) return false; 1115 var url = window.location.href; 1116 var a = $(id).getElementsByTagName('a'); 1117 for(var i = 0; i < a.length; i++) { 1118 a[i].onclick = function () { 1119 if(url.indexOf("&orderby=") == -1) { 1120 url += "&orderby=" + this.id; 1121 } else { 1122 url = url.replace(/orderby=.*/, "orderby=" + this.id); 1123 } 1124 window.location = url; 1125 return false; 1126 } 1127 } 1128} 1129 1130function addBlockLink(id, tag) { 1131 if(!$(id)) return false; 1132 var a = $(id).getElementsByTagName(tag); 1133 var taglist = {'A':1, 'INPUT':1, 'IMG':1}; 1134 for(var i = 0, len = a.length; i < len; i++) { 1135 a[i].onmouseover = function () { 1136 if(this.className.indexOf(' hover') == -1) { 1137 this.className = this.className + ' hover'; 1138 } 1139 }; 1140 a[i].onmouseout = function () { 1141 this.className = this.className.replace(' hover', ''); 1142 }; 1143 a[i].onclick = function (e) { 1144 e = e ? e : window.event; 1145 var target = e.target || e.srcElement; 1146 if(!taglist[target.tagName]) { 1147 window.location.href = $(this.id + '_a').href; 1148 } 1149 }; 1150 } 1151} 1152 1153function checkSynSignature() { 1154 if($('to_signhtml').value == '1') { 1155 $('syn_signature').className = 'syn_signature'; 1156 $('to_signhtml').value = '0'; 1157 } else { 1158 $('syn_signature').className = 'syn_signature_check'; 1159 $('to_signhtml').value = '1'; 1160 } 1161} 1162 1163function searchpostbyusername(keyword, srchuname) { 1164 window.location.href = 'search.php?mod=forum&srchtxt=' + keyword + '&srchuname=' + srchuname + '&searchsubmit=yes'; 1165} 1166 1167function removeVisitor(event, uid) { 1168 window.location = 'home.php?mod=space&uid='+uid+'&do=index&view=admin&additional=removevlog'; 1169 event.preventDefault(); 1170 event.stopPropagation(); 1171}
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.