1/* 2 [Discuz!] (C)2001-2099 Comsenz Inc. 3 This is NOT a freeware, use is subject to license terms 4 5 $Id: common.js 36359 2017-01-20 05:06:45Z nemohou $ 6*/ 7 8function $(id) { 9 return !id ? null : document.getElementById(id); 10} 11 12function $C(classname, ele, tag) { 13 var returns = []; 14 ele = ele || document; 15 tag = tag || '*'; 16 if(ele.getElementsByClassName) { 17 var eles = ele.getElementsByClassName(classname); 18 if(tag != '*') { 19 for (var i = 0, L = eles.length; i < L; i++) { 20 if (eles[i].tagName.toLowerCase() == tag.toLowerCase()) { 21 returns.push(eles[i]); 22 } 23 } 24 } else { 25 returns = eles; 26 } 27 }else { 28 eles = ele.getElementsByTagName(tag); 29 var pattern = new RegExp("(^|\\s)"+classname+"(\\s|$)"); 30 for (i = 0, L = eles.length; i < L; i++) { 31 if (pattern.test(eles[i].className)) { 32 returns.push(eles[i]); 33 } 34 } 35 } 36 return returns; 37} 38 39function _attachEvent(obj, evt, func, eventobj) { 40 eventobj = !eventobj ? obj : eventobj; 41 if(obj.addEventListener) { 42 obj.addEventListener(evt, func, false); 43 } else if(eventobj.attachEvent) { 44 obj.attachEvent('on' + evt, func); 45 } 46} 47 48function _detachEvent(obj, evt, func, eventobj) { 49 eventobj = !eventobj ? obj : eventobj; 50 if(obj.removeEventListener) { 51 obj.removeEventListener(evt, func, false); 52 } else if(eventobj.detachEvent) { 53 obj.detachEvent('on' + evt, func); 54 } 55} 56 57function browserVersion(types) { 58 var other = 1; 59 for(i in types) { 60 var v = types[i] ? types[i] : i; 61 if(USERAGENT.indexOf(v) != -1) { 62 var re = new RegExp(v + '(\\/|\\s|:)([\\d\\.]+)', 'ig'); 63 var matches = re.exec(USERAGENT); 64 var ver = matches != null ? matches[2] : 0; 65 other = ver !== 0 && v != 'mozilla' ? 0 : other; 66 }else { 67 var ver = 0; 68 } 69 eval('BROWSER.' + i + '= ver'); 70 } 71 BROWSER.other = other; 72} 73 74function getEvent() { 75 if(document.all) return window.event; 76 func = getEvent.caller; 77 while(func != null) { 78 var arg0 = func.arguments[0]; 79 if (arg0) { 80 if((arg0.constructor == Event || arg0.constructor == MouseEvent) || (typeof(arg0) == "object" && arg0.preventDefault && arg0.stopPropagation)) { 81 return arg0; 82 } 83 } 84 func=func.caller; 85 } 86 return null; 87} 88 89function isUndefined(variable) { 90 return typeof variable == 'undefined' ? true : false; 91} 92 93function in_array(needle, haystack) { 94 if(typeof needle == 'string' || typeof needle == 'number') { 95 for(var i in haystack) { 96 if(haystack[i] == needle) { 97 return true; 98 } 99 } 100 } 101 return false; 102} 103 104function trim(str) { 105 return (str + '').replace(/(\s+)$/g, '').replace(/^\s+/g, ''); 106} 107 108function strlen(str) { 109 return (BROWSER.ie && str.indexOf('\n') != -1) ? str.replace(/\r?\n/g, '_').length : str.length; 110} 111 112function mb_strlen(str) { 113 var len = 0; 114 for(var i = 0; i < str.length; i++) { 115 len += str.charCodeAt(i) < 0 || str.charCodeAt(i) > 255 ? (charset == 'utf-8' ? 3 : 2) : 1; 116 } 117 return len; 118} 119 120function mb_cutstr(str, maxlen, dot) { 121 var len = 0; 122 var ret = ''; 123 var dot = !dot ? '...' : dot; 124 maxlen = maxlen - dot.length; 125 for(var i = 0; i < str.length; i++) { 126 len += str.charCodeAt(i) < 0 || str.charCodeAt(i) > 255 ? (charset == 'utf-8' ? 3 : 2) : 1; 127 if(len > maxlen) { 128 ret += dot; 129 break; 130 } 131 ret += str.substr(i, 1); 132 } 133 return ret; 134} 135 136function preg_replace(search, replace, str, regswitch) { 137 var regswitch = !regswitch ? 'ig' : regswitch; 138 var len = search.length; 139 for(var i = 0; i < len; i++) { 140 re = new RegExp(search[i], regswitch); 141 str = str.replace(re, typeof replace == 'string' ? replace : (replace[i] ? replace[i] : replace[0])); 142 } 143 return str; 144} 145 146function htmlspecialchars(str) { 147 return preg_replace(['&', '<', '>', '"'], ['&', '<', '>', '"'], str); 148} 149 150function display(id) { 151 var obj = $(id); 152 if(obj.style.visibility) { 153 obj.style.visibility = obj.style.visibility == 'visible' ? 'hidden' : 'visible'; 154 } else { 155 obj.style.display = obj.style.display == '' ? 'none' : ''; 156 } 157} 158 159function checkall(form, prefix, checkall) { 160 var checkall = checkall ? checkall : 'chkall'; 161 count = 0; 162 for(var i = 0; i < form.elements.length; i++) { 163 var e = form.elements[i]; 164 if(e.name && e.name != checkall && !e.disabled && (!prefix || (prefix && e.name.match(prefix)))) { 165 e.checked = form.elements[checkall].checked; 166 if(e.checked) { 167 count++; 168 } 169 } 170 } 171 return count; 172} 173 174function setcookie(cookieName, cookieValue, seconds, path, domain, secure) { 175 if(cookieValue == '' || seconds < 0) { 176 cookieValue = ''; 177 seconds = -2592000; 178 } 179 if(seconds) { 180 var expires = new Date(); 181 expires.setTime(expires.getTime() + seconds * 1000); 182 } 183 domain = !domain ? cookiedomain : domain; 184 path = !path ? cookiepath : path; 185 document.cookie = escape(cookiepre + cookieName) + '=' + escape(cookieValue) 186 + (expires ? '; expires=' + expires.toGMTString() : '') 187 + '; path=' + (path ? path : '/') 188 + (domain ? '; domain=' + domain : '') 189 + (secure ? '; secure' : ''); 190} 191 192function getcookie(name, nounescape) { 193 name = cookiepre + name; 194 var cookie_start = document.cookie.indexOf(name); 195 var cookie_end = document.cookie.indexOf(";", cookie_start); 196 if(cookie_start == -1) { 197 return ''; 198 } else { 199 var v = document.cookie.substring(cookie_start + name.length + 1, (cookie_end > cookie_start ? cookie_end : document.cookie.length)); 200 return !nounescape ? unescape(v) : v; 201 } 202} 203 204function Ajax(recvType, waitId) { 205 var aj = new Object(); 206 aj.loading = 'è«ç¨å...'; 207 aj.recvType = recvType ? recvType : 'XML'; 208 aj.waitId = waitId ? $(waitId) : null; 209 aj.resultHandle = null; 210 aj.sendString = ''; 211 aj.targetUrl = ''; 212 aj.setLoading = function(loading) { 213 if(typeof loading !== 'undefined' && loading !== null) aj.loading = loading; 214 }; 215 aj.setRecvType = function(recvtype) { 216 aj.recvType = recvtype; 217 }; 218 aj.setWaitId = function(waitid) { 219 aj.waitId = typeof waitid == 'object' ? waitid : $(waitid); 220 }; 221 aj.createXMLHttpRequest = function() { 222 var request = false; 223 if(window.XMLHttpRequest) { 224 request = new XMLHttpRequest(); 225 if(request.overrideMimeType) { 226 request.overrideMimeType('text/xml'); 227 } 228 } else if(window.ActiveXObject) { 229 var versions = ['Microsoft.XMLHTTP', 'MSXML.XMLHTTP', 'Microsoft.XMLHTTP', 'Msxml2.XMLHTTP.7.0', 'Msxml2.XMLHTTP.6.0', 'Msxml2.XMLHTTP.5.0', 'Msxml2.XMLHTTP.4.0', 'MSXML2.XMLHTTP.3.0', 'MSXML2.XMLHTTP']; 230 for(var i=0; i<versions.length; i++) { 231 try { 232 request = new ActiveXObject(versions[i]); 233 if(request) { 234 return request; 235 } 236 } catch(e) {} 237 } 238 } 239 return request; 240 }; 241 aj.XMLHttpRequest = aj.createXMLHttpRequest(); 242 aj.showLoading = function() { 243 if(aj.waitId && (aj.XMLHttpRequest.readyState != 4 || aj.XMLHttpRequest.status != 200)) { 244 aj.waitId.style.display = ''; 245 aj.waitId.innerHTML = '<span><img src="' + IMGDIR + '/loading.gif" class="vm"> ' + aj.loading + '</span>'; 246 } 247 }; 248 aj.processHandle = function() { 249 if(aj.XMLHttpRequest.readyState == 4 && aj.XMLHttpRequest.status == 200) { 250 if(aj.waitId) { 251 aj.waitId.style.display = 'none'; 252 } 253 if(aj.recvType == 'HTML') { 254 aj.resultHandle(aj.XMLHttpRequest.responseText, aj); 255 } else if(aj.recvType == 'XML') { 256 if(!aj.XMLHttpRequest.responseXML || !aj.XMLHttpRequest.responseXML.lastChild || aj.XMLHttpRequest.responseXML.lastChild.localName == 'parsererror') { 257 aj.resultHandle('' , aj); 258 } else { 259 aj.resultHandle(aj.XMLHttpRequest.responseXML.lastChild.firstChild.nodeValue, aj); 260 } 261 } else if(aj.recvType == 'JSON') { 262 var s = null; 263 try { 264 s = (new Function("return ("+aj.XMLHttpRequest.responseText+")"))(); 265 } catch (e) { 266 s = null; 267 } 268 aj.resultHandle(s, aj); 269 } 270 } 271 }; 272 aj.get = function(targetUrl, resultHandle) { 273 targetUrl = hostconvert(targetUrl); 274 setTimeout(function(){aj.showLoading()}, 250); 275 aj.targetUrl = targetUrl; 276 aj.XMLHttpRequest.onreadystatechange = aj.processHandle; 277 aj.resultHandle = resultHandle; 278 var attackevasive = isUndefined(attackevasive) ? 0 : attackevasive; 279 if(window.XMLHttpRequest) { 280 aj.XMLHttpRequest.open('GET', aj.targetUrl); 281 aj.XMLHttpRequest.setRequestHeader('X-Requested-With', 'XMLHttpRequest'); 282 aj.XMLHttpRequest.send(null); 283 } else { 284 aj.XMLHttpRequest.open("GET", targetUrl, true); 285 aj.XMLHttpRequest.setRequestHeader('X-Requested-With', 'XMLHttpRequest'); 286 aj.XMLHttpRequest.send(); 287 } 288 }; 289 aj.post = function(targetUrl, sendString, resultHandle) { 290 targetUrl = hostconvert(targetUrl); 291 setTimeout(function(){aj.showLoading()}, 250); 292 aj.targetUrl = targetUrl; 293 aj.sendString = sendString; 294 aj.XMLHttpRequest.onreadystatechange = aj.processHandle; 295 aj.resultHandle = resultHandle; 296 aj.XMLHttpRequest.open('POST', targetUrl); 297 aj.XMLHttpRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); 298 aj.XMLHttpRequest.setRequestHeader('X-Requested-With', 'XMLHttpRequest'); 299 aj.XMLHttpRequest.send(aj.sendString); 300 }; 301 aj.getJSON = function(targetUrl, resultHandle) { 302 aj.setRecvType('JSON'); 303 aj.get(targetUrl+'&ajaxdata=json', resultHandle); 304 }; 305 aj.getHTML = function(targetUrl, resultHandle) { 306 aj.setRecvType('HTML'); 307 aj.get(targetUrl+'&ajaxdata=html', resultHandle); 308 }; 309 return aj; 310} 311 312function getHost(url) { 313 var host = "null"; 314 if(typeof url == "undefined"|| null == url) { 315 url = window.location.href; 316 } 317 var regex = /^\w+\:\/\/([^\/]*).*/; 318 var match = url.match(regex); 319 if(typeof match != "undefined" && null != match) { 320 host = match[1]; 321 } 322 return host; 323} 324 325function hostconvert(url) { 326 if(!url.match(/^https?:\/\//)) url = SITEURL + url; 327 var url_host = getHost(url); 328 var cur_host = getHost().toLowerCase(); 329 if(url_host && cur_host != url_host) { 330 url = url.replace(url_host, cur_host); 331 } 332 return url; 333} 334 335function newfunction(func) { 336 var args = []; 337 for(var i=1; i<arguments.length; i++) args.push(arguments[i]); 338 return function(event) { 339 doane(event); 340 window[func].apply(window, args); 341 return false; 342 } 343} 344 345function evalscript(s) { 346 if(s.indexOf('<script') == -1) return s; 347 var p = /<script[^\>]*?>([^\x00]*?)<\/script>/ig; 348 var arr = []; 349 while(arr = p.exec(s)) { 350 var p1 = /<script[^\>]*?src=\"([^\>]*?)\"[^\>]*?(reload=\"1\")?(?:charset=\"([\w\-]+?)\")?><\/script>/i; 351 var arr1 = []; 352 arr1 = p1.exec(arr[0]); 353 if(arr1) { 354 appendscript(arr1[1], '', arr1[2], arr1[3]); 355 } else { 356 p1 = /<script(.*?)>([^\x00]+?)<\/script>/i; 357 arr1 = p1.exec(arr[0]); 358 appendscript('', arr1[2], arr1[1].indexOf('reload=') != -1); 359 } 360 } 361 return s; 362} 363 364 365function safescript(id, call, seconds, times, timeoutcall, endcall, index) { 366 seconds = seconds || 1000; 367 times = times || 0; 368 var checked = true; 369 try { 370 if(typeof call == 'function') { 371 call(); 372 } else { 373 eval(call); 374 } 375 } catch(e) { 376 checked = false; 377 } 378 if(!checked) { 379 if(!safescripts[id] || !index) { 380 safescripts[id] = safescripts[id] || []; 381 safescripts[id].push({ 382 'times':0, 383 'si':setInterval(function () { 384 safescript(id, call, seconds, times, timeoutcall, endcall, safescripts[id].length); 385 }, seconds) 386 }); 387 } else { 388 index = (index || 1) - 1; 389 safescripts[id][index]['times']++; 390 if(safescripts[id][index]['times'] >= times) { 391 clearInterval(safescripts[id][index]['si']); 392 if(typeof timeoutcall == 'function') { 393 timeoutcall(); 394 } else { 395 eval(timeoutcall); 396 } 397 } 398 } 399 } else { 400 try { 401 index = (index || 1) - 1; 402 if(safescripts[id][index]['si']) { 403 clearInterval(safescripts[id][index]['si']); 404 } 405 if(typeof endcall == 'function') { 406 endcall(); 407 } else { 408 eval(endcall); 409 } 410 } catch(e) {} 411 } 412} 413 414function $F(func, args, script) { 415 var run = function () { 416 var argc = args.length, s = ''; 417 for(i = 0;i < argc;i++) { 418 s += ',args[' + i + ']'; 419 } 420 eval('var check = typeof ' + func + ' == \'function\''); 421 if(check) { 422 eval(func + '(' + s.substr(1) + ')'); 423 } else { 424 setTimeout(function () {checkrun();}, 50); 425 } 426 }; 427 var checkrun = function () { 428 if(JSLOADED[src]) { 429 run(); 430 } else { 431 setTimeout(function () {checkrun();}, 50); 432 } 433 }; 434 script = script || 'common_extra'; 435 src = JSPATH + script + '.js?' + VERHASH; 436 if(!JSLOADED[src]) { 437 appendscript(src); 438 } 439 return checkrun(); 440} 441 442function appendscript(src, text, reload, charset) { 443 var id = hash(src + text); 444 if(!reload && in_array(id, evalscripts)) return; 445 if(reload && $(id)) { 446 $(id).parentNode.removeChild($(id)); 447 } 448 449 evalscripts.push(id); 450 var scriptNode = document.createElement("script"); 451 scriptNode.type = "text/javascript"; 452 scriptNode.id = id; 453 scriptNode.charset = charset ? charset : (BROWSER.firefox ? document.characterSet : document.charset); 454 try { 455 if(src) { 456 scriptNode.src = src; 457 scriptNode.onloadDone = false; 458 scriptNode.onload = function () { 459 scriptNode.onloadDone = true; 460 JSLOADED[src] = 1; 461 }; 462 scriptNode.onreadystatechange = function () { 463 if((scriptNode.readyState == 'loaded' || scriptNode.readyState == 'complete') && !scriptNode.onloadDone) { 464 scriptNode.onloadDone = true; 465 JSLOADED[src] = 1; 466 } 467 }; 468 } else if(text){ 469 scriptNode.text = text; 470 } 471 document.getElementsByTagName('head')[0].appendChild(scriptNode); 472 } catch(e) {} 473} 474 475function hash(string, length) { 476 var length = length ? length : 32; 477 var start = 0; 478 var i = 0; 479 var result = ''; 480 filllen = length - string.length % length; 481 for(i = 0; i < filllen; i++){ 482 string += "0"; 483 } 484 while(start < string.length) { 485 result = stringxor(result, string.substr(start, length)); 486 start += length; 487 } 488 return result; 489} 490 491function stringxor(s1, s2) { 492 var s = ''; 493 var hash = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; 494 var max = Math.max(s1.length, s2.length); 495 for(var i=0; i<max; i++) { 496 var k = s1.charCodeAt(i) ^ s2.charCodeAt(i); 497 s += hash.charAt(k % 52); 498 } 499 return s; 500} 501 502function ajaxupdateevents(obj, tagName) { 503 $F('_ajaxupdateevents', arguments, 'ajax'); 504} 505 506function ajaxupdateevent(o) { 507 $F('_ajaxupdateevent', arguments, 'ajax'); 508} 509 510function ajaxget(url, showid, waitid, loading, display, recall) { 511 $F('_ajaxget', arguments, 'ajax'); 512} 513 514function ajaxpost(formid, showid, waitid, showidclass, submitbtn, recall) { 515 $F('_ajaxpost', arguments, 'ajax'); 516} 517 518function ajaxmenu(ctrlObj, timeout, cache, duration, pos, recall, idclass, contentclass) { 519 $F('_ajaxmenu', arguments, 'ajax'); 520} 521 522function ajaxinnerhtml(showid, s) { 523 $F('_ajaxinnerhtml', arguments, 'ajax'); 524} 525 526function showPreview(val, id) { 527 var showObj = $(id); 528 if(showObj) { 529 showObj.innerHTML = val.replace(/\n/ig, "<bupdateseccoder />"); 530 } 531} 532 533function showloading(display, waiting) { 534 var display = display ? display : 'block'; 535 var waiting = waiting ? waiting : 'è«ç¨å...'; 536 $('ajaxwaitid').innerHTML = waiting; 537 $('ajaxwaitid').style.display = display; 538} 539 540function doane(event, preventDefault, stopPropagation) { 541 var preventDefault = isUndefined(preventDefault) ? 1 : preventDefault; 542 var stopPropagation = isUndefined(stopPropagation) ? 1 : stopPropagation; 543 e = event ? event : window.event; 544 if(!e) { 545 e = getEvent(); 546 } 547 if(!e) { 548 return null; 549 } 550 if(preventDefault) { 551 if(e.preventDefault) { 552 e.preventDefault(); 553 } else { 554 e.returnValue = false; 555 } 556 } 557 if(stopPropagation) { 558 if(e.stopPropagation) { 559 e.stopPropagation(); 560 } else { 561 e.cancelBubble = true; 562 } 563 } 564 return e; 565} 566 567function loadcss(cssname) { 568 if(!CSSLOADED[cssname]) { 569 var csspath = (typeof CSSPATH == 'undefined' ? 'data/cache/style_' : CSSPATH); 570 if(!$('css_' + cssname)) { 571 css = document.createElement('link'); 572 css.id = 'css_' + cssname, 573 css.type = 'text/css'; 574 css.rel = 'stylesheet'; 575 css.href = csspath + STYLEID + '_' + cssname + '.css?' + VERHASH; 576 var headNode = document.getElementsByTagName("head")[0]; 577 headNode.appendChild(css); 578 } else { 579 $('css_' + cssname).href = csspath + STYLEID + '_' + cssname + '.css?' + VERHASH; 580 } 581 CSSLOADED[cssname] = 1; 582 } 583} 584 585function showMenu(v) { 586 var ctrl
586id = isUndefined(v['ctrlid']) ? v : v['ctrlid']; 587 var showid = isUndefined(v['showid']) ? ctrlid : v['showid']; 588 var menuid = isUndefined(v['menuid']) ? showid + '_menu' : v['menuid']; 589 var ctrlObj = $(ctrlid); 590 var menuObj = $(menuid); 591 if(!menuObj) return; 592 var mtype = isUndefined(v['mtype']) ? 'menu' : v['mtype']; 593 var evt = isUndefined(v['evt']) ? 'mouseover' : v['evt']; 594 var pos = isUndefined(v['pos']) ? '43' : v['pos']; 595 var layer = isUndefined(v['layer']) ? 1 : v['layer']; 596 var duration = isUndefined(v['duration']) ? 2 : v['duration']; 597 var timeout = isUndefined(v['timeout']) ? 250 : v['timeout']; 598 var maxh = isUndefined(v['maxh']) ? 600 : v['maxh']; 599 var cache = isUndefined(v['cache']) ? 1 : v['cache']; 600 var drag = isUndefined(v['drag']) ? '' : v['drag']; 601 var dragobj = drag && $(drag) ? $(drag) : menuObj; 602 var fade = isUndefined(v['fade']) ? 0 : v['fade']; 603 var cover = isUndefined(v['cover']) ? 0 : v['cover']; 604 var zindex = isUndefined(v['zindex']) ? JSMENU['zIndex']['menu'] : v['zindex']; 605 var ctrlclass = isUndefined(v['ctrlclass']) ? '' : v['ctrlclass']; 606 var winhandlekey = isUndefined(v['win']) ? '' : v['win']; 607 if(winhandlekey && ctrlObj && !ctrlObj.getAttribute('fwin')) { 608 ctrlObj.setAttribute('fwin', winhandlekey); 609 } 610 zindex = cover ? zindex + 500 : zindex; 611 if(typeof JSMENU['active'][layer] == 'undefined') { 612 JSMENU['active'][layer] = []; 613 } 614 615 for(i in EXTRAFUNC['showmenu']) { 616 try { 617 eval(EXTRAFUNC['showmenu'][i] + '()'); 618 } catch(e) {} 619 } 620 621 if(evt == 'click' && in_array(menuid, JSMENU['active'][layer]) && mtype != 'win') { 622 hideMenu(menuid, mtype); 623 return; 624 } 625 if(mtype == 'menu') { 626 hideMenu(layer, mtype); 627 } 628 629 if(ctrlObj) { 630 if(!ctrlObj.getAttribute('initialized')) { 631 ctrlObj.setAttribute('initialized', true); 632 ctrlObj.unselectable = true; 633 634 ctrlObj.outfunc = typeof ctrlObj.onmouseout == 'function' ? ctrlObj.onmouseout : null; 635 ctrlObj.onmouseout = function() { 636 if(this.outfunc) this.outfunc(); 637 if(duration < 3 && !JSMENU['timer'][menuid]) { 638 JSMENU['timer'][menuid] = setTimeout(function () { 639 hideMenu(menuid, mtype); 640 }, timeout); 641 } 642 }; 643 644 ctrlObj.overfunc = typeof ctrlObj.onmouseover == 'function' ? ctrlObj.onmouseover : null; 645 ctrlObj.onmouseover = function(e) { 646 doane(e); 647 if(this.overfunc) this.overfunc(); 648 if(evt == 'click') { 649 clearTimeout(JSMENU['timer'][menuid]); 650 JSMENU['timer'][menuid] = null; 651 } else { 652 for(var i in JSMENU['timer']) { 653 if(JSMENU['timer'][i]) { 654 clearTimeout(JSMENU['timer'][i]); 655 JSMENU['timer'][i] = null; 656 } 657 } 658 } 659 }; 660 } 661 } 662 663 if(!menuObj.getAttribute('initialized')) { 664 menuObj.setAttribute('initialized', true); 665 menuObj.ctrlkey = ctrlid; 666 menuObj.mtype = mtype; 667 menuObj.layer = layer; 668 menuObj.cover = cover; 669 if(ctrlObj && ctrlObj.getAttribute('fwin')) {menuObj.scrolly = true;} 670 menuObj.style.position = 'absolute'; 671 menuObj.style.zIndex = zindex + layer; 672 menuObj.onclick = function(e) { 673 return doane(e, 0, 1); 674 }; 675 if(duration < 3) { 676 if(duration > 1) { 677 menuObj.onmouseover = function() { 678 clearTimeout(JSMENU['timer'][menuid]); 679 JSMENU['timer'][menuid] = null; 680 }; 681 } 682 if(duration != 1) { 683 menuObj.onmouseout = function() { 684 JSMENU['timer'][menuid] = setTimeout(function () { 685 hideMenu(menuid, mtype); 686 }, timeout); 687 }; 688 } 689 } 690 if(cover) { 691 var coverObj = document.createElement('div'); 692 coverObj.id = menuid + '_cover'; 693 coverObj.style.position = 'absolute'; 694 coverObj.style.zIndex = menuObj.style.zIndex - 1; 695 coverObj.style.left = coverObj.style.top = '0px'; 696 coverObj.style.width = '100%'; 697 coverObj.style.height = Math.max(document.documentElement.clientHeight, document.body.offsetHeight) + 'px'; 698 coverObj.style.backgroundColor = '#000'; 699 coverObj.style.filter = 'progid:DXImageTransform.Microsoft.Alpha(opacity=50)'; 700 coverObj.style.opacity = 0.5; 701 coverObj.onclick = function () {hideMenu();}; 702 $('append_parent').appendChild(coverObj); 703 _attachEvent(window, 'load', function () { 704 coverObj.style.height = Math.max(document.documentElement.clientHeight, document.body.offsetHeight) + 'px'; 705 }, document); 706 } 707 } 708 if(drag) { 709 dragobj.style.cursor = 'move'; 710 dragobj.onmousedown = function(event) {try{dragMenu(menuObj, event, 1);}catch(e){}}; 711 } 712 713 if(cover) $(menuid + '_cover').style.display = ''; 714 if(fade) { 715 var O = 0; 716 var fadeIn = function(O) { 717 if(O > 100) { 718 clearTimeout(fadeInTimer); 719 return; 720 } 721 menuObj.style.filter = 'progid:DXImageTransform.Microsoft.Alpha(opacity=' + O + ')'; 722 menuObj.style.opacity = O / 100; 723 O += 20; 724 var fadeInTimer = setTimeout(function () { 725 fadeIn(O); 726 }, 40); 727 }; 728 fadeIn(O); 729 menuObj.fade = true; 730 } else { 731 menuObj.fade = false; 732 } 733 menuObj.style.display = ''; 734 if(ctrlObj && ctrlclass) { 735 ctrlObj.className += ' ' + ctrlclass; 736 menuObj.setAttribute('ctrlid', ctrlid); 737 menuObj.setAttribute('ctrlclass', ctrlclass); 738 } 739 if(pos != '*') { 740 setMenuPosition(showid, menuid, pos); 741 } 742 if(BROWSER.ie && BROWSER.ie < 7 && winhandlekey && $('fwin_' + winhandlekey)) { 743 $(menuid).style.left = (parseInt($(menuid).style.left) - parseInt($('fwin_' + winhandlekey).style.left)) + 'px'; 744 $(menuid).style.top = (parseInt($(menuid).style.top) - parseInt($('fwin_' + winhandlekey).style.top)) + 'px'; 745 } 746 if(maxh && menuObj.scrollHeight > maxh) { 747 menuObj.style.height = maxh + 'px'; 748 if(BROWSER.opera) { 749 menuObj.style.overflow = 'auto'; 750 } else { 751 menuObj.style.overflowY = 'auto'; 752 } 753 } 754 755 if(!duration) { 756 setTimeout('hideMenu(\'' + menuid + '\', \'' + mtype + '\')', timeout); 757 } 758 759 if(!in_array(menuid, JSMENU['active'][layer])) JSMENU['active'][layer].push(menuid); 760 menuObj.cache = cache; 761 if(layer > JSMENU['layer']) { 762 JSMENU['layer'] = layer; 763 } 764 var hasshow = function(ele) { 765 while(ele.parentNode && ((typeof(ele['currentStyle']) === 'undefined') ? window.getComputedStyle(ele,null) : ele['currentStyle'])['display'] !== 'none') { 766 ele = ele.parentNode; 767 } 768 if(ele === document) { 769 return true; 770 } else { 771 return false; 772 } 773 }; 774 if(!menuObj.getAttribute('disautofocus')) { 775 try{ 776 var focused = false; 777 var tags = ['input', 'select', 'textarea', 'button', 'a']; 778 for(var i = 0; i < tags.length; i++) { 779 var _all = menuObj.getElementsByTagName(tags[i]); 780 if(_all.length) { 781 for(j = 0; j < _all.length; j++) { 782 if((!_all[j]['type'] || _all[j]['type'] != 'hidden') && hasshow(_all[j])) { 783 _all[j].className += ' hidefocus'; 784 _all[j].focus(); 785 focused = true; 786 var cobj = _all[j]; 787 _attachEvent(_all[j], 'blur', function (){cobj.className = trim(cobj.className.replace(' hidefocus', ''));}); 788 break; 789 } 790 } 791 } 792 if(focused) { 793 break; 794 } 795 } 796 } catch (e) { 797 } 798 } 799} 800var delayShowST = null; 801function delayShow(ctrlObj, call, time) { 802 if(typeof ctrlObj == 'object') { 803 var ctrlid = ctrlObj.id; 804 call = call || function () {showMenu(ctrlid);}; 805 } 806 var time = isUndefined(time) ? 500 : time; 807 delayShowST = setTimeout(function () { 808 if(typeof call == 'function') { 809 call(); 810 } else { 811 eval(call); 812 } 813 }, time); 814 if(!ctrlObj.delayinit) { 815 _attachEvent(ctrlObj, 'mouseout', function() {clearTimeout(delayShowST);}); 816 ctrlObj.delayinit = 1; 817 } 818} 819 820var dragMenuDisabled = false; 821function dragMenu(menuObj, e, op) { 822 e = e ? e : window.event; 823 if(op == 1) { 824 if(dragMenuDisabled || in_array(e.target ? e.target.tagName : e.srcElement.tagName, ['TEXTAREA', 'INPUT', 'BUTTON', 'SELECT'])) { 825 return; 826 } 827 JSMENU['drag'] = [e.clientX, e.clientY]; 828 JSMENU['drag'][2] = parseInt(menuObj.style.left); 829 JSMENU['drag'][3] = parseInt(menuObj.style.top);
830 document.onmousemove = function(e) {try{dragMenu(menuObj, e, 2);}catch(err){}}; 831 document.onmouseup = function(e) {try{dragMenu(menuObj, e, 3);}catch(err){}}; 832 doane(e); 833 }else if(op == 2 && JSMENU['drag'][0]) { 834 var menudragnow = [e.clientX, e.clientY]; 835 menuObj.style.left = (JSMENU['drag'][2] + menudragnow[0] - JSMENU['drag'][0]) + 'px'; 836 menuObj.style.top = (JSMENU['drag'][3] + menudragnow[1] - JSMENU['drag'][1]) + 'px'; 837 menuObj.removeAttribute('top_');menuObj.removeAttribute('left_'); 838 doane(e); 839 }else if(op == 3) { 840 JSMENU['drag'] = []; 841 document.onmousemove = null; 842 document.onmouseup = null; 843 } 844} 845function setMenuPosition(showid, menuid, pos) { 846 var showObj = $(showid); 847 var menuObj = menuid ? $(menuid) : $(showid + '_menu'); 848 if(isUndefined(pos) || !pos) pos = '43'; 849 var basePoint = parseInt(pos.substr(0, 1)); 850 var direction = parseInt(pos.substr(1, 1)); 851 var important = pos.indexOf('!') != -1 ? 1 : 0; 852 var sxy = 0, sx = 0, sy = 0, sw = 0, sh = 0, ml = 0, mt = 0, mw = 0, mcw = 0, mh = 0, mch = 0, bpl = 0, bpt = 0; 853 854 if(!menuObj || (basePoint > 0 && !showObj)) return; 855 if(showObj) { 856 sxy = fetchOffset(showObj); 857 sx = sxy['left']; 858 sy = sxy['top']; 859 sw = showObj.offsetWidth; 860 sh = showObj.offsetHeight; 861 } 862 mw = menuObj.offsetWidth; 863 mcw = menuObj.clientWidth; 864 mh = menuObj.offsetHeight; 865 mch = menuObj.clientHeight; 866 867 switch(basePoint) { 868 case 1: 869 bpl = sx; 870 bpt = sy; 871 break; 872 case 2: 873 bpl = sx + sw; 874 bpt = sy; 875 break; 876 case 3: 877 bpl = sx + sw; 878 bpt = sy + sh; 879 break; 880 case 4: 881 bpl = sx; 882 bpt = sy + sh; 883 break; 884 } 885 switch(direction) { 886 case 0: 887 menuObj.style.left = (document.body.clientWidth - menuObj.clientWidth) / 2 + 'px'; 888 mt = (document.documentElement.clientHeight - menuObj.clientHeight) / 2; 889 break; 890 case 1: 891 ml = bpl - mw; 892 mt = bpt - mh; 893 break; 894 case 2: 895 ml = bpl; 896 mt = bpt - mh; 897 break; 898 case 3: 899 ml = bpl; 900 mt = bpt; 901 break; 902 case 4: 903 ml = bpl - mw; 904 mt = bpt; 905 break; 906 } 907 var scrollTop = Math.max(document.documentElement.scrollTop, document.body.scrollTop); 908 var scrollLeft = Math.max(document.documentElement.scrollLeft, document.body.scrollLeft); 909 if(!important) { 910 if(in_array(direction, [1, 4]) && ml < 0) { 911 ml = bpl; 912 if(in_array(basePoint, [1, 4])) ml += sw; 913 } else if(ml + mw > scrollLeft + document.body.clientWidth && sx >= mw) { 914 ml = bpl - mw; 915 if(in_array(basePoint, [2, 3])) { 916 ml -= sw; 917 } else if(basePoint == 4) { 918 ml += sw; 919 } 920 } 921 if(in_array(direction, [1, 2]) && mt < 0) { 922 mt = bpt; 923 if(in_array(basePoint, [1, 2])) mt += sh; 924 } else if(mt + mh > scrollTop + document.documentElement.clientHeight && sy >= mh) { 925 mt = bpt - mh; 926 if(in_array(basePoint, [3, 4])) mt -= sh; 927 } 928 } 929 if(pos.substr(0, 3) == '210') { 930 ml += 69 - sw / 2; 931 mt -= 5; 932 if(showObj.tagName == 'TEXTAREA') { 933 ml -= sw / 2; 934 mt += sh / 2; 935 } 936 } 937 if(direction == 0 || menuObj.scrolly) { 938 if(BROWSER.ie && BROWSER.ie < 7) { 939 if(direction == 0) mt += scrollTop; 940 } else { 941 if(menuObj.scrolly) mt -= scrollTop; 942 menuObj.style.position = 'fixed'; 943 } 944 } 945 if(ml) menuObj.style.left = ml + 'px'; 946 if(mt) menuObj.style.top = mt + 'px'; 947 if(direction == 0 && BROWSER.ie && !document.documentElement.clientHeight) { 948 menuObj.style.position = 'absolute'; 949 menuObj.style.top = (document.body.clientHeight - menuObj.clientHeight) / 2 + 'px'; 950 } 951 if(menuObj.style.clip && !BROWSER.opera) { 952 menuObj.style.clip = 'rect(auto, auto, auto, auto)'; 953 } 954} 955 956function hideMenu(attr, mtype) { 957 attr = isUndefined(attr) ? '' : attr; 958 mtype = isUndefined(mtype) ? 'menu' : mtype; 959 if(attr == '') { 960 for(var i = 1; i <= JSMENU['layer']; i++) { 961 hideMenu(i, mtype); 962 } 963 return; 964 } else if(typeof attr == 'number') { 965 for(var j in JSMENU['active'][attr]) { 966 hideMenu(JSMENU['active'][attr][j], mtype); 967 } 968 return; 969 }else if(typeof attr == 'string') { 970 var menuObj = $(attr); 971 if(!menuObj || (mtype && menuObj.mtype != mtype)) return; 972 var ctrlObj = '', ctrlclass = ''; 973 if((ctrlObj = $(menuObj.getAttribute('ctrlid'))) && (ctrlclass = menuObj.getAttribute('ctrlclass'))) { 974 var reg = new RegExp(' ' + ctrlclass); 975 ctrlObj.className = ctrlObj.className.replace(reg, ''); 976 } 977 clearTimeout(JSMENU['timer'][attr]); 978 var hide = function() { 979 if(menuObj.cache) { 980 if(menuObj.style.visibility != 'hidden') { 981 menuObj.style.display = 'none'; 982 if(menuObj.cover) $(attr + '_cover').style.display = 'none'; 983 } 984 }else { 985 menuObj.parentNode.removeChild(menuObj); 986 if(menuObj.cover) $(attr + '_cover').parentNode.removeChild($(attr + '_cover')); 987 } 988 var tmp = []; 989 for(var k in JSMENU['active'][menuObj.layer]) { 990 if(attr != JSMENU['active'][menuObj.layer][k]) tmp.push(JSMENU['active'][menuObj.layer][k]); 991 } 992 JSMENU['active'][menuObj.layer] = tmp; 993 }; 994 if(menuObj.fade) { 995 var O = 100; 996 var fadeOut = function(O) { 997 if(O == 0) { 998 clearTimeout(fadeOutTimer); 999 hide(); 1000 return; 1001 } 1002 menuObj.style.filter = 'progid:DXImageTransform.Microsoft.Alpha(opacity=' + O + ')'; 1003 menuObj.style.opacity = O / 100; 1004 O -= 20;
1005 var fadeOutTimer = setTimeout(function () { 1006 fadeOut(O); 1007 }, 40); 1008 }; 1009 fadeOut(O); 1010 } else { 1011 hide(); 1012 } 1013 } 1014} 1015 1016function getCurrentStyle(obj, cssproperty, csspropertyNS) { 1017 if(obj.style[cssproperty]){ 1018 return obj.style[cssproperty]; 1019 } 1020 if (obj.currentStyle) { 1021 return obj.currentStyle[cssproperty]; 1022 } else if (document.defaultView.getComputedStyle(obj, null)) { 1023 var currentStyle = document.defaultView.getComputedStyle(obj, null); 1024 var value = currentStyle.getPropertyValue(csspropertyNS); 1025 if(!value){ 1026 value = currentStyle[cssproperty]; 1027 } 1028 return value; 1029 } else if (window.getComputedStyle) { 1030 var currentStyle = window.getComputedStyle(obj, ""); 1031 return currentStyle.getPropertyValue(csspropertyNS); 1032 } 1033} 1034 1035function fetchOffset(obj, mode) { 1036 var left_offset = 0, top_offset = 0, mode = !mode ? 0 : mode; 1037 1038 if(obj.getBoundingClientRect && !mode) { 1039 var rect = obj.getBoundingClientRect(); 1040 var scrollTop = Math.max(document.documentElement.scrollTop, document.body.scrollTop); 1041 var scrollLeft = Math.max(document.documentElement.scrollLeft, document.body.scrollLeft); 1042 if(document.documentElement.dir == 'rtl') { 1043 scrollLeft = scrollLeft + document.documentElement.clientWidth - document.documentElement.scrollWidth; 1044 } 1045 left_offset = rect.left + scrollLeft - document.documentElement.clientLeft; 1046 top_offset = rect.top + scrollTop - document.documentElement.clientTop; 1047 } 1048 if(left_offset <= 0 || top_offset <= 0) { 1049 left_offset = obj.offsetLeft; 1050 top_offset = obj.offsetTop; 1051 while((obj = obj.offsetParent) != null) { 1052 position = getCurrentStyle(obj, 'position', 'position'); 1053 if(position == 'relative') { 1054 continue; 1055 } 1056 left_offset += obj.offsetLeft; 1057 top_offset += obj.offsetTop; 1058 } 1059 } 1060 return {'left' : left_offset, 'top' : top_offset}; 1061} 1062 1063function showTip(ctrlobj) { 1064 $F('_showTip', arguments); 1065} 1066 1067function showPrompt(ctrlid, evt, msg, timeout, classname) { 1068 $F('_showPrompt', arguments); 1069} 1070 1071function showCreditPrompt() { 1072 $F('_showCreditPrompt', []); 1073} 1074 1075var showDialogST = null; 1076function showDialog(msg, mode, t, func, cover, funccancel, leftmsg, confirmtxt, canceltxt, closetime, locationtime) { 1077 clearTimeout(showDialogST); 1078 cover = isUndefined(cover) ? (mode == 'info' ? 0 : 1) : cover; 1079 leftmsg = isUndefined(leftmsg) ? '' : leftmsg; 1080 mode = in_array(mode, ['confirm', 'notice', 'info', 'right']) ? mode : 'alert'; 1081 var menuid = 'fwin_dialog'; 1082 var menuObj = $(menuid); 1083 var showconfirm = 1; 1084 confirmtxtdefault = '確å®'; 1085 closetime = isUndefined(closetime) ? '' : closetime; 1086 closefunc = function () { 1087 if(typeof func == 'function') func(); 1088 else eval(func); 1089 hideMenu(menuid, 'dialog'); 1090 }; 1091 if(closetime) { 1092 showPrompt(null, null, '<i>' + msg + '</i>', closetime * 1000, 'popuptext'); 1093 return; 1094 } 1095 locationtime = isUndefined(locationtime) ? '' : locationtime; 1096 if(locationtime) { 1097 leftmsg = locationtime + ' ç§å¾é é¢è·³è½'; 1098 showDialogST = setTimeout(closefunc, locationtime * 1000); 1099 showconfirm = 0; 1100 } 1101 confirmtxt = confirmtxt ? confirmtxt : confirmtxtdefault; 1102 canceltxt = canceltxt ? canceltxt : 'åæ¶'; 1103 1104 if(menuObj) hideMenu('fwin_dialog', 'dialog'); 1105 menuObj = document.createElement('div'); 1106 menuObj.style.display = 'none'; 1107 menuObj.className = 'fwinmask'; 1108 menuObj.id = menuid; 1109 $('append_parent').appendChild(menuObj); 1110 var hidedom = ''; 1111 if(!BROWSER.ie) { 1112 hidedom = '<style type="text/css">object{visibility:hidden;}</style>'; 1113 } 1114 var s = hidedom + '<table cellpadding="0" cellspacing="0" class="fwin"><tr><td class="t_l"></td><td class="t_c"></td><td class="t_r"></td></tr><tr><td class="m_l"> </td><td class="m_c"><h3 class="flb"><em>'; 1115 s += t ? t : 'æç¤ºä¿¡æ¯'; 1116 s += '</em><span><a href="javascript:;" id="fwin_dialog_close" class="flbc" onclick="hideMenu(\'' + menuid + '\', \'dialog\')" title="éé">éé</a></span></h3>'; 1117 if(mode == 'info') { 1118 s += msg ? msg : ''; 1119 } else { 1120 s += '<div class="c altw"><div class="' + (mode == 'alert' ? 'alert_error' : (mode == 'right' ? 'alert_right' : 'alert_info')) + '"><p>' + msg + '</p></div></div>'; 1121 s += '<p class="o pns">' + (leftmsg ? '<span class="z xg1">' + leftmsg + '</span>' : '') + (showconfirm ? '<button id="fwin_dialog_submit" value="true" class="pn pnc"><strong>'+confirmtxt+'</strong></button>' : ''); 1122 s += mode == 'confirm' ? '<button id="fwin_dialog_cancel" value="true" class="pn" onclick="hideMenu(\'' + menuid + '\', \'dialog\')"><strong>'+canceltxt+'</strong></button>' : ''; 1123 s += '</p>'; 1124 } 1125 s += '</td><td class="m_r"></td></tr><tr><td class="b_l"></td><td class="b_c"></td><td class="b_r"></td></tr></table>'; 1126 menuObj.innerHTML = s; 1127 if($('fwin_dialog_submit')) $('fwin_dialog_submit').onclick = function() { 1128 if(typeof func == 'function') func(); 1129 else eval(func); 1130 hideMenu(menuid, 'dialog'); 1131 }; 1132 if($('fwin_dialog_cancel')) { 1133 $('fwin_dialog_cancel').onclick = function() { 1134 if(typeof funccancel == 'function') funccancel(); 1135 else eval(funccancel); 1136 hideMenu(menuid, 'dialog'); 1137 }; 1138 $('fwin_dialog_close').onclick = $('fwin_dialog_cancel').onclick; 1139 } 1140 showMenu({'mtype':'dialog','menuid':menuid,'duration':3,'pos':'00','zindex':JSMENU['zIndex']['dialog'],'cache':0,'cover':cover}); 1141 try { 1142 if($('fwin_dialog_submit')) $('fwin_dialog_submit').focus(); 1143 } catch(e) {} 1144} 1145 1146function showWindow(k, url, mode, cache, menuv) { 1147 mode = isUndefined(mode) ? 'get' : mode; 1148 cache = isUndefined(cache) ? 1 : cache; 1149 var menuid = 'fwin_' + k; 1150 var menuObj = $(menuid); 1151 var drag = null; 1152 var loadingst = null; 1153 var hidedom = ''; 1154 1155 if(disallowfloat && disallowfloat.indexOf(k) != -1) { 1156 if(BROWSER.ie) url += (url.indexOf('?') != -1 ? '&' : '?') + 'referer=' + escape(location.href); 1157 location.href = url; 1158 doane(); 1159 return; 1160 } 1161 1162 var fetchContent = function() { 1163 if(mode == 'get') { 1164 menuObj.url = url; 1165 url += (url.search(/\?/) > 0 ? '&' : '?') + 'infloat=yes&handlekey=' + k; 1166 url += cache == -1 ? '&t='+(+ new Date()) : ''; 1167 if(BROWSER.ie && url.indexOf('referer=') < 0) { 1168 url = url + '&referer=' + encodeURIComponent(location); 1169 } 1170 ajaxget(url, 'fwin_content_' + k, null, '', '', function() {initMenu();show();}); 1171 } else if(mode == 'post') { 1172 menuObj.act = $(url).action; 1173 ajaxpost(url, 'fwin_content_' + k, '', '', '', function() {initMenu();show();}); 1174 } 1175 if(parseInt(BROWSER.ie) != 6) { 1176 loadingst = setTimeout(function() {showDialog('', 'info', '<img src="' + IMGDIR + '/loading.gif"> è«ç¨å...')}, 500); 1177 } 1178 }; 1179 var initMenu = function() { 1180 clearTimeout(loadingst); 1181 var objs = menuObj.getElementsByTagName('*'); 1182 var fctrlidinit = false; 1183 for(var i = 0; i < objs.length; i++) { 1184 if(objs[i].id) { 1185 objs[i].setAttribute('fwin', k); 1186 } 1187 if(objs[i].className == 'flb' && !fctrlidinit) { 1188 if(!objs[i].id) objs[i].id = 'fctrl_' + k; 1189 drag = objs[i].id; 1190 fctrlidinit = true; 1191 } 1192 } 1193 }; 1194 var show = function() { 1195 hideMenu('fwin_dialog', 'dialog'); 1196 v = {'mtype':'win','menuid':menuid,'duration':3,'pos':'00','zindex':JSMENU['zIndex']['win'],'drag':typeof drag == null ? '' : drag,'cache':cache}; 1197 for(k in menuv) { 1198 v[k] = menuv[k]; 1199 } 1200 showMenu(v); 1201 }; 1202 1203 if(!menuObj) { 1204 menuObj = document.createElement('div'); 1205 menuObj.id = menuid; 1206 menuObj.className = 'fwinmask'; 1207 menuObj.style.display = 'none'; 1208 $('append_parent').appendChild(menuObj); 1209 evt = ' style="cursor:move" onmousedown="dragMenu($(\'' + menuid + '\'), event, 1)" ondblclick="hideWindow(\'' + k + '\')"'; 1210 if(!BROWSER.ie) { 1211 hidedom = '<style type="text/css">object{visibility:hidden;}</style>'; 1212 } 1213 menuObj.innerHTML = hidedom + '<table cellpadding="0" cellspacing="0" class="fwin"><tr><td class="t_l"></td><td class="t_c"' + evt + '></td><td class="t_r"></td></tr><tr><td class="m_l"' + evt + ')"> </td><td class="m_c" id="fwin_content_' + k + '">' 1214 + '</td><td class="m_r"' + evt + '"></td></tr><tr><td class="b_l"></td><td class="b_c"' + evt + '></td><td class="b_r"></td></tr></table>'; 1215 if(mode == 'html') { 1216 $('fwin_content_' + k).innerHTML = url; 1217 initMenu(); 1218 show(); 1219 } else { 1220 fetchContent(); 1221 } 1222 } else if((mode == 'get' && (url != menuObj.url || cache != 1)) || (mode == 'post' && $(url).action != menuObj.act)) { 1223 fetchContent(); 1224 } else { 1225 show(); 1226 } 1227 doane(); 1228} 1229 1230function showError(msg) { 1231 var p = /<script[^\>]*?>([^\x00]*?)<\/script>/ig; 1232 msg = msg.replace(p, ''); 1233 if(msg !== '') { 1234 showDialog(msg, 'alert', 'é¯èª¤ä¿¡æ¯', null, true, null, '', '', '', 3); 1235 } 1236} 1237 1238function hideWindow(k, all, clear) { 1239 all = isUndefined(all) ? 1 : all; 1240 clear = isUndefined(clear) ? 1 : clear; 1241 hideMenu('fwin_' + k, 'win'); 1242 if(clear && $('fwin_' + k)) { 1243 $('append_parent').removeChild($('fwin_' + k)); 1244 } 1245 if(all) { 1246 hideMenu(); 1247 } 1248} 1249 1250function AC_FL_RunContent() { 1251 var str = ''; 1252 var ret = AC_GetArgs(arguments, "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000", "application/x-shockwave-flash"); 1253 if(BROWSER.ie && !BROWSER.opera) { 1254 str += '<object '; 1255 for (var i in ret.objAttrs) { 1256 str += i + '="' + ret.objAttrs[i] + '" '; 1257 } 1258 str += '>'; 1259 for (var i in ret.params) { 1260 str += '<param name="' + i + '" value="' + ret.params[i] + '" /> '; 1261 } 1262 str += '</object>'; 1263 } else { 1264 str += '<embed '; 1265 for (var i in ret.embedAttrs) { 1266 str += i + '="' + ret.embedAttrs[i] + '" '; 1267 } 1268 str += '></embed>'; 1269 } 1270 return str; 1271} 1272 1273function AC_GetArgs(args, classid, mimeType) { 1274 var ret = new Object(); 1275 ret.embedAttrs = new Object(); 1276 ret.params = new Object(); 1277 ret.objAttrs = new Object(); 1278 for (var i = 0; i < args.length; i = i + 2){ 1279 var currArg = args[i].toLowerCase(); 1280 switch (currArg){ 1281 case "classid":break; 1282 case "pluginspage":ret.embedAttrs[args[i]] = 'http://www.macromedia.com/go/getflashplayer';break; 1283 case "src":ret.embedAttrs[args[i]] = args[i+1];ret.params["movie"] = args[i+1];break; 1284 case "codebase":ret.objAttrs[args[i]] = 'http://download.macromedia.com/pub/s
1284hockwave/cabs/flash/swflash.cab#version=9,0,0,0';break; 1285 case "onafterupdate":case "onbeforeupdate":case "onblur":case "oncellchange":case "onclick":case "ondblclick":case "ondrag":case "ondragend": 1286 case "ondragenter":case "ondragleave":case "ondragover":case "ondrop":case "onfinish":case "onfocus":case "onhelp":case "onmousedown": 1287 case "onmouseup":case "onmouseover":case "onmousemove":case "onmouseout":case "onkeypress":case "onkeydown":case "onkeyup":case "onload": 1288 case "onlosecapture":case "onpropertychange":case "onreadystatechange":case "onrowsdelete":case "onrowenter":case "onrowexit":case "onrowsinserted":case "onstart": 1289 case "onscroll":case "onbeforeeditfocus":case "onactivate":case "onbeforedeactivate":case "ondeactivate":case "type": 1290 case "id":ret.objAttrs[args[i]] = args[i+1];break; 1291 case "width":case "height":case "align":case "vspace": case "hspace":case "class":case "title":case "accesskey":case "name": 1292 case "tabindex":ret.embedAttrs[args[i]] = ret.objAttrs[args[i]] = args[i+1];break; 1293 default:ret.embedAttrs[args[i]] = ret.params[args[i]] = args[i+1]; 1294 } 1295 } 1296 ret.objAttrs["classid"] = classid; 1297 if(mimeType) { 1298 ret.embedAttrs["type"] = mimeType; 1299 } 1300 return ret; 1301} 1302 1303function simulateSelect(selectId, widthvalue) { 1304 var selectObj = $(selectId); 1305 if(!selectObj) return; 1306 if(BROWSER.other) { 1307 if(selectObj.getAttribute('change')) { 1308 selectObj.onchange = function () {eval(selectObj.getAttribute('change'));} 1309 } 1310 return; 1311 } 1312 var widthvalue = widthvalue ? widthvalue : 70; 1313 var defaultopt = selectObj.options[0] ? selectObj.options[0].innerHTML : ''; 1314 var defaultv = ''; 1315 var menuObj = document.createElement('div'); 1316 var ul = document.createElement('ul'); 1317 var handleKeyDown = function(e) { 1318 e = BROWSER.ie ? event : e; 1319 if(e.keyCode == 40 || e.keyCode == 38) doane(e); 1320 }; 1321 var selectwidth = (selectObj.getAttribute('width', i) ? selectObj.getAttribute('width', i) : widthvalue) + 'px'; 1322 var tabindex = selectObj.getAttribute('tabindex', i) ? selectObj.getAttribute('tabindex', i) : 1; 1323 1324 for(var i = 0; i < selectObj.options.length; i++) { 1325 var li = document.createElement('li'); 1326 li.innerHTML = selectObj.options[i].innerHTML; 1327 li.k_id = i; 1328 li.k_value = selectObj.options[i].value; 1329 if(selectObj.options[i].selected) { 1330 defaultopt = selectObj.options[i].innerHTML; 1331 defaultv = selectObj.options[i].value; 1332 li.className = 'current'; 1333 selectObj.setAttribute('selecti', i); 1334 } 1335 li.onclick = function() { 1336 if($(selectId + '_ctrl').innerHTML != this.innerHTML) { 1337 var lis = menuObj.getElementsByTagName('li'); 1338 lis[$(selectId).getAttribute('selecti')].className = ''; 1339 this.className = 'current'; 1340 $(selectId + '_ctrl').innerHTML = this.innerHTML; 1341 $(selectId).setAttribute('selecti', this.k_id); 1342 $(selectId).options.length = 0; 1343 $(selectId).options[0] = new Option('', this.k_value); 1344 eval(selectObj.getAttribute('change')); 1345 } 1346 hideMenu(menuObj.id); 1347 return false; 1348 }; 1349 ul.appendChild(li); 1350 } 1351 1352 selectObj.options.length = 0; 1353 selectObj.options[0]= new Option('', defaultv); 1354 selectObj.style.display = 'none'; 1355 selectObj.outerHTML += '<a href="javascript:;" id="' + selectId + '_ctrl" style="width:' + selectwidth + '" tabindex="' + tabindex + '">' + defaultopt + '</a>'; 1356 1357 menuObj.id = selectId + '_ctrl_menu'; 1358 menuObj.className = 'sltm'; 1359 menuObj.style.display = 'none'; 1360 menuObj.style.width = selectwidth; 1361 menuObj.appendChild(ul); 1362 $('append_parent').appendChild(menuObj); 1363 1364 $(selectId + '_ctrl').onclick = function(e) { 1365 $(selectId + '_ctrl_menu').style.width = selectwidth; 1366 showMenu({'ctrlid':(selectId == 'loginfield' ? 'account' : selectId + '_ctrl'),'menuid':selectId + '_ctrl_menu','evt':'click','pos':'43'}); 1367 doane(e); 1368 }; 1369 $(selectId + '_ctrl').onfocus = menuObj.onfocus = function() { 1370 _attachEvent(document.body, 'keydown', handleKeyDown); 1371 }; 1372 $(selectId + '_ctrl').onblur = menuObj.onblur = function() { 1373 _detachEvent(document.body, 'keydown', handleKeyDown); 1374 }; 1375 $(selectId + '_ctrl').onkeyup = function(e) { 1376 e = e ? e : window.event; 1377 value = e.keyCode; 1378 if(value == 40 || value == 38) { 1379 if(menuObj.style.display == 'none') { 1380 $(selectId + '_ctrl').onclick(); 1381 } else { 1382 lis = menuObj.getElementsByTagName('li'); 1383 selecti = selectObj.getAttribute('selecti'); 1384 lis[selecti].className = ''; 1385 if(value == 40) { 1386 selecti = parseInt(selecti) + 1; 1387 } else if(value == 38) { 1388 selecti = parseInt(selecti) - 1; 1389 } 1390 if(selecti < 0) { 1391 selecti = lis.length - 1 1392 } else if(selecti > lis.length - 1) { 1393 selecti = 0; 1394 } 1395 lis[selecti].className = 'current'; 1396 selectObj.setAttribute('selecti', selecti); 1397 lis[selecti].parentNode.scrollTop = lis[selecti].offsetTop; 1398 } 1399 } else if(value == 13) { 1400 var lis = menuObj.getElementsByTagName('li'); 1401 lis[selectObj.getAttribute('selecti')].onclick(); 1402 } else if(value == 27) { 1403 hideMenu(menuObj.id); 1404 } 1405 }; 1406} 1407 1408function switchTab(prefix, current, total, activeclass) { 1409 $F('_switchTab', arguments); 1410} 1411 1412function imageRotate(imgid, direct) { 1413 $F('_imageRotate', arguments); 1414} 1415 1416function thumbImg(obj, method) { 1417 if(!obj) { 1418 return; 1419 } 1420 obj.onload = null; 1421 file = obj.src; 1422 zw = obj.offsetWidth; 1423 zh = obj.offsetHeight; 1424 if(zw < 2) { 1425 if(!obj.id) { 1426 obj.id = 'img_' + Math.random(); 1427 } 1428 setTimeout("thumbImg($('" + obj.id + "'), " + method + ")", 100); 1429 return; 1430 } 1431 zr = zw / zh; 1432 method = !method ? 0 : 1; 1433 if(method) { 1434 fixw = obj.getAttribute('_width'); 1435 fixh = obj.getAttribute('_height'); 1436 if(zw > fixw) { 1437 zw = fixw; 1438 zh = zw / zr; 1439 } 1440 if(zh > fixh) { 1441 zh = fixh; 1442 zw = zh * zr; 1443 } 1444 } else { 1445 fixw = typeof imagemaxwidth == 'undefined' ? '600' : imagemaxwidth; 1446 if(zw > fixw) { 1447 zw = fixw; 1448 zh = zw / zr; 1449 obj.style.cursor = 'pointer'; 1450 if(!obj.onclick) { 1451 obj.onclick = function() { 1452 zoom(obj, obj.src); 1453 }; 1454 } 1455 } 1456 } 1457 obj.width = zw; 1458 obj.height = zh; 1459} 1460 1461var zoomstatus = 1; 1462function zoom(obj, zimg, nocover, pn, showexif) { 1463 $F('_zoom', arguments); 1464} 1465 1466function showselect(obj, inpid, t, rettype) { 1467 $F('_showselect', arguments); 1468} 1469 1470function showColorBox(ctrlid, layer, k, bgcolor) { 1471 $F('_showColorBox', arguments); 1472} 1473 1474function ctrlEnter(event, btnId, onlyEnter) { 1475 if(isUndefined(onlyEnter)) onlyEnter = 0; 1476 if((event.ctrlKey || onlyEnter) && event.keyCode == 13) { 1477 $(btnId).click(); 1478 return false; 1479 } 1480 return true; 1481} 1482 1483function parseurl(str, mode, parsecode) { 1484 if(isUndefined(parsecode)) parsecode = true; 1485 if(parsecode) str= str.replace(/\[code\]([\s\S]+?)\[\/code\]/ig, function($1, $2) {return codetag($2, -1);}); 1486 str = str.replace(/([^>=\]"'\/]|^)((((https?|ftp):\/\/)|www\.)([\w\-]+\.)*[\w\-\u4e00-\u9fa5]+\.([\.a-zA-Z0-9]+|\u4E2D\u56FD|\u7F51\u7EDC|\u516C\u53F8)((\?|\/|:)+[\w\.\/=\?%\-&~`@':+!]*)+\.(swf|flv))/ig, '$1[flash]$2[/flash]'); 1487 str = str.replace(/([^>=\]"'\/]|^)((((https?|ftp):\/\/)|www\.)([\w\-]+\.)*[\w\-\u4e00-\u9fa5]+\.([\.a-zA-Z0-9]+|\u4E2D\u56FD|\u7F51\u7EDC|\u516C\u53F8)((\?|\/|:)+[\w\.\/=\?%\-&~`@':+!]*)+\.(mp3|wma))/ig, '$1[audio]$2[/audio]'); 1488 str = str.replace(/([^>=\]"'\/@]|^)((((https?|ftp|gopher|news|telnet|rtsp|mms|callto|bctp|ed2k|thunder|qqdl|synacast):\/\/))([\w\-]+\.)*[:\.@\-\w\u4e00-\u9fa5]+\.([\.a-zA-Z0-9]+|\u4E2D\u56FD|\u7F51\u7EDC|\u516C\u53F8)((\?|\/|:)+[\w\.\/=\?%\-&;~`@':+!#]*)*)/ig, mode == 'html' ? '$1<a href="$2" target="_blank">$2</a>' : '$1[url]$2[/url]'); 1489 str = str.replace(/([^\w>=\]"'\/@]|^)((www\.)([\w\-]+\.)*[:\.@\-\w\u4e00-\u9fa5]+\.([\.a-zA-Z0-9]+|\u4E2D\u56FD|\u7F51\u7EDC|\u516C\u53F8)((\?|\/|:)+[\w\.\/=\?%\-&;~`@':+!#]*)*)/ig, mode == 'html' ? '$1<a href="$2" target="_blank">$2</a>' : '$1[url]$2[/url]'); 1490 str = str.replace(/([^\w->
1490=\]:"'\.\/]|^)(([\-\.\w]+@[\.\-\w]+(\.\w+)+))/ig, mode == 'html' ? '$1<a href="mailto:$2">$2</a>' : '$1[email]$2[/email]'); 1491 if(parsecode) { 1492 for(var i = 0; i <= DISCUZCODE['num']; i++) { 1493 str = str.replace("[\tDISCUZ_CODE_" + i + "\t]", DISCUZCODE['html'][i]); 1494 } 1495 } 1496 return str; 1497} 1498 1499function codetag(text, br) { 1500 var br = !br ? 1 : br; 1501 DISCUZCODE['num']++; 1502 if(br > 0 && typeof wysiwyg != 'undefined' && wysiwyg) text = text.replace(/<br[^\>]*>/ig, '\n'); 1503 text = text.replace(/\$/ig, '$$$$'); 1504 DISCUZCODE['html'][DISCUZCODE['num']] = '[code]' + text + '[/code]'; 1505 return '[\tDISCUZ_CODE_' + DISCUZCODE['num'] + '\t]'; 1506} 1507 1508function saveUserdata(name, data) { 1509 try { 1510 if(window.localStorage){ 1511 localStorage.setItem('Discuz_' + name, data); 1512 } else if(window.sessionStorage){ 1513 sessionStorage.setItem('Discuz_' + name, data); 1514 } 1515 } catch(e) { 1516 if(BROWSER.ie){ 1517 if(data.length < 54889) { 1518 with(document.documentElement) { 1519 setAttribute("value", data); 1520 save('Discuz_' + name); 1521 } 1522 } 1523 } 1524 } 1525 setcookie('clearUserdata', '', -1); 1526} 1527 1528function loadUserdata(name) { 1529 if(window.localStorage){ 1530 return localStorage.getItem('Discuz_' + name); 1531 } else if(window.sessionStorage){ 1532 return sessionStorage.getItem('Discuz_' + name); 1533 } else if(BROWSER.ie){ 1534 with(document.documentElement) { 1535 load('Discuz_' + name); 1536 return getAttribute("value"); 1537 } 1538 } 1539} 1540 1541function initTab(frameId, type) { 1542 $F('_initTab', arguments); 1543} 1544 1545function openDiy(){ 1546 if(DYNAMICURL) { 1547 window.location.href = SITEURL+DYNAMICURL + (DYNAMICURL.indexOf('?') < 0 ? '?' : '&') + ('diy=yes'); 1548 } else { 1549 window.location.href = ((window.location.href + '').replace(/[\?\&]diy=yes/g, '').split('#')[0] + ( window.location.search && window.location.search.indexOf('?diy=yes') < 0 ? '&diy=yes' : '?diy=yes')); 1550 } 1551} 1552 1553function hasClass(elem, className) { 1554 return elem.className && (" " + elem.className + " ").indexOf(" " + className + " ") != -1; 1555} 1556 1557function addClass(elem, className) { 1558 if(!hasClass(elem, className)) elem.className = trim(elem.className += " " + className); 1559} 1560 1561function removeClass(elem, className) { 1562 elem.className = trim((" " + elem.className + " ").replace(" " + trim(className) + " ", " ")); 1563} 1564 1565function toggleClass(elem, className) { 1566 elem.className = hasClass(elem, className) ? removeClass(elem, className) : trim(elem.className += " " + className); 1567} 1568 1569function runslideshow() { 1570 $F('_runslideshow', []); 1571} 1572 1573function toggle_collapse(objname, noimg, complex, lang) { 1574 $F('_toggle_collapse', arguments); 1575} 1576 1577function updatestring(str1, str2, clear) { 1578 str2 = '_' + str2 + '_'; 1579 return clear ? str1.replace(str2, '') : (str1.indexOf(str2) == -1 ? str1 + str2 : str1); 1580} 1581 1582function getClipboardData() { 1583 window.document.clipboardswf.SetVariable('str', CLIPBOARDSWFDATA); 1584} 1585 1586function setCopy(text, msg) { 1587 var cp = document.createElement('textarea'); 1588 cp.style.fontSize = '12pt'; 1589 cp.style.border = '0'; 1590 cp.style.padding = '0'; 1591 cp.style.margin = '0'; 1592 cp.style.position = 'absolute'; 1593 cp.style.left = '-9999px'; 1594 var yPosition = window.pageYOffset || document.documentElement.scrollTop; 1595 cp.style.top = yPosition + 'px'; 1596 cp.setAttribute('readonly', ''); 1597 text = text.replace(/[\xA0]/g, ' '); 1598 cp.value = text; 1599 $('append_parent').appendChild(cp); 1600 cp.select(); 1601 cp.setSelectionRange(0, cp.value.length); 1602 try { 1603 var success = document.execCommand('copy', false, null); 1604 } catch (e) { 1605 var success = false; 1606 } 1607 $('append_parent').removeChild(cp); 1608 1609 if(success) { 1610 if(msg) { 1611 showPrompt(null, null, '<span>' + msg + '</span>', 1500); 1612 } 1613 } else if(BROWSER.ie) { 1614 var r = clipboardData.setData('Text', text); 1615 if(r) { 1616 if(msg) { 1617 showPrompt(null, null, '<span>' + msg + '</span>', 1500); 1618 } 1619 } else { 1620 showDialog('<div class="c"><div style="width: 200px; text-align: center;">è¤è£½å¤±æï¼è«é¸æãå 許訪åã</div></div>', 'alert'); 1621 } 1622 } else { 1623 var msg = '<div class="c"><div style="width: 200px; text-align: center; text-decoration:underline;">黿¤è¤è£½å°åªè²¼æ¿</div>' + 1624 AC_FL_RunContent('id', 'clipboardswf', 'name', 'clipboardswf', 'devicefont', 'false', 'width', '200', 'height', '40', 'src', STATICURL + 'image/common/clipboard.swf', 'menu', 'false', 'allowScriptAccess', 'sameDomain', 'swLiveConnect', 'true', 'wmode', 'transparent', 'style' , 'margin-top:-20px') + '</div>'; 1625 showDialog(msg, 'info'); 1626 CLIPBOARDSWFDATA = text; 1627 } 1628} 1629 1630function copycode(obj) { 1631 $F('_copycode', arguments); 1632} 1633 1634function showdistrict(container, elems, totallevel, changelevel, containertype) { 1635 $F('_showdistrict', arguments); 1636} 1637 1638function setDoodle(fid, oid, url, tid, from) { 1639 $F('_setDoodle', arguments); 1640} 1641 1642 1643function initSearchmenu(searchform, cloudSearchUrl) { 1644 var defaultUrl = 'search.php?searchsubmit=yes'; 1645 if(typeof cloudSearchUrl == "undefined" || cloudSearchUrl == null || cloudSearchUrl == '') { 1646 cloudSearchUrl = defaultUrl; 1647 } 1648 1649 var searchtxt = $(searchform + '_txt'); 1650 if(!searchtxt) { 1651 searchtxt = $(searchform); 1652 } 1653 var tclass = searchtxt.className; 1654 searchtxt.className = tclass + ' xg1'; 1655 if (!!("placeholder" in document.createElement("input"))) { 1656 if(searchtxt.value == 'è«è¼¸å ¥æç´¢å §å®¹') { 1657 searchtxt.value = ''; 1658 } 1659 searchtxt.placeholder = 'è«è¼¸å ¥æç´¢å §å®¹'; 1660 } else { 1661 searchtxt.onfocus = function () { 1662 if(searchtxt.value == 'è«è¼¸å ¥æç´¢å §å®¹') { 1663 searchtxt.value = ''; 1664 searchtxt.className = tclass; 1665 } 1666 }; 1667 searchtxt.onblur = function () { 1668 if(searchtxt.value == '' ) { 1669 searchtxt.value = 'è«è¼¸å ¥æç´¢å §å®¹'; 1670 searchtxt.className = tclass + ' xg1'; 1671 } 1672 }; 1673 } 1674 if(!$(searchform + '_type_menu')) return false; 1675 var o = $(searchform + '_type'); 1676 var a = $(searchform + '_type_menu').getElementsByTagName('a'); 1677 var formobj = searchtxt.form; 1678 for(var i=0; i<a.length; i++){ 1679 if(a[i].className == 'curtype'){ 1680 o.innerHTML = a[i].innerHTML; 1681 $(searchform + '_mod').value = a[i].rel; 1682 formobj.method = 'post'; 1683 if((a[i].rel == 'forum' || a[i].rel == 'curforum') && defaultUrl != cloudSearchUrl) { 1684 formobj.action = cloudSearchUrl; 1685 formobj.method = 'get'; 1686 if($('srchFId')) { 1687 $('srchFId').value = a[i].rel == 'forum' ? 0 : a[i].getAttribute('fid'); 1688 } 1689 } else { 1690 formobj.action = defaultUrl; 1691 } 1692 } 1693 a[i].onclick = function(){ 1694 o.innerHTML = this.innerHTML; 1695 $(searchform + '_mod').value = this.rel; 1696 formobj.method = 'post'; 1697 if((this.rel == 'forum' || this.rel == 'curforum') && defaultUrl != cloudSearchUrl) { 1698 formobj.action = cloudSearchUrl; 1699 formobj.method = 'get'; 1700 if($('srchFId')) { 1701 $('srchFId').value = this.rel == 'forum' ? 0 : this.getAttribute('fid'); 1702 } 1703 } else { 1704 formobj.action = defaultUrl; 1705 } 1706 }; 1707 } 1708} 1709 1710function searchFocus(obj) { 1711 if(obj.value == 'è«è¼¸å ¥æç´¢å §å®¹') { 1712 obj.value = ''; 1713 } 1714 if($('cloudsearchquery') != null) { 1715 $('cloudsearchquery').value = obj.value; 1716 } 1717} 1718 1719function extstyle(css) { 1720 $F('_extstyle', arguments); 1721} 1722 1723function widthauto(obj) { 1724 $F('_widthauto', arguments); 1725} 1726 1727var secST = new Array(); 1728function updatesecqaa(idhash) { 1729 $F('_updatesecqaa', arguments); 1730} 1731 1732function updateseccode(idhash) { 1733 $F('_updateseccode', arguments); 1734} 1735 1736function checksec(type, idhash, showmsg, recall) { 1737 $F('_checksec', arguments); 1738} 1739
1740function createPalette(colorid, id, func) { 1741 $F('_createPalette', arguments); 1742} 1743 1744function showForummenu(fid) { 1745 $F('_showForummenu', arguments); 1746} 1747 1748function showUserApp() { 1749 $F('_showUserApp', arguments); 1750} 1751 1752function cardInit() { 1753 var cardShow = function (obj) { 1754 if(BROWSER.ie && BROWSER.ie < 7 && obj.href.indexOf('username') != -1) { 1755 return; 1756 } 1757 pos = obj.getAttribute('c') == '1' ? '43' : obj.getAttribute('c'); 1758 USERCARDST = setTimeout(function() {ajaxmenu(obj, 500, 1, 2, pos, null, 'p_pop card');}, 250); 1759 }; 1760 var cardids = {}; 1761 var a = document.body.getElementsByTagName('a'); 1762 for(var i = 0;i < a.length;i++){ 1763 if(a[i].getAttribute('c')) { 1764 var href = a[i].getAttribute('href', 1); 1765 if(typeof cardids[href] == 'undefined') { 1766 cardids[href] = Math.round(Math.random()*10000); 1767 } 1768 a[i].setAttribute('mid', 'card_' + cardids[href]); 1769 a[i].onmouseover = function() {cardShow(this)}; 1770 a[i].onmouseout = function() {clearTimeout(USERCARDST);}; 1771 } 1772 } 1773} 1774 1775function navShow(id) { 1776 var mnobj = $('snav_mn_' + id); 1777 if(!mnobj) { 1778 return; 1779 } 1780 var uls = $('mu').getElementsByTagName('ul'); 1781 for(i = 0;i < uls.length;i++) { 1782 if(uls[i].className != 'cl current') { 1783 uls[i].style.display = 'none'; 1784 } 1785 } 1786 if(mnobj.className != 'cl current') { 1787 showMenu({'ctrlid':'mn_' + id,'menuid':'snav_mn_' + id,'pos':'*'}); 1788 mnobj.className = 'cl floatmu'; 1789 mnobj.style.width = ($('nv').clientWidth) + 'px'; 1790 mnobj.style.display = ''; 1791 } 1792} 1793 1794function strLenCalc(obj, checklen, maxlen) { 1795 var v = obj.value, charlen = 0, maxlen = !maxlen ? 200 : maxlen, curlen = maxlen, len = strlen(v); 1796 for(var i = 0; i < v.length; i++) { 1797 if(v.charCodeAt(i) < 0 || v.charCodeAt(i) > 255) { 1798 curlen -= charset == 'utf-8' ? 2 : 1; 1799 } 1800 } 1801 if(curlen >= len) { 1802 $(checklen).innerHTML = curlen - len; 1803 } else { 1804 obj.value = mb_cutstr(v, maxlen, 0); 1805 } 1806} 1807 1808function pluginNotice() { 1809 if($('plugin_notice')) { 1810 ajaxget('misc.php?mod=patch&action=pluginnotice', 'plugin_notice', ''); 1811 } 1812} 1813 1814function ipNotice() { 1815 if($('ip_notice')) { 1816 ajaxget('misc.php?mod=patch&action=ipnotice&_r='+Math.random(), 'ip_notice', ''); 1817 } 1818} 1819 1820function noticeTitle() { 1821 NOTICETITLE = {'State':0, 'oldTitle':NOTICECURTITLE, flashNumber:0, sleep:15}; 1822 if(!getcookie('noticeTitle')) { 1823 window.setInterval('noticeTitleFlash();', 500); 1824 } else { 1825 window.setTimeout('noticeTitleFlash();', 500); 1826 } 1827 setcookie('noticeTitle', 1, 600); 1828} 1829 1830function noticeTitleFlash() { 1831 if(NOTICETITLE.flashNumber < 5 || NOTICETITLE.flashNumber > 4 && !NOTICETITLE['State']) { 1832 document.title = (NOTICETITLE['State'] ? 'ããããã' : 'ãæ°æéã') + NOTICETITLE['oldTitle']; 1833 NOTICETITLE['State'] = !NOTICETITLE['State']; 1834 } 1835 NOTICETITLE.flashNumber = NOTICETITLE.flashNumber < NOTICETITLE.sleep ? ++NOTICETITLE.flashNumber : 0; 1836} 1837 1838function relatedlinks(rlinkmsgid) { 1839 $F('_relatedlinks', arguments); 1840} 1841 1842function con_handle_response(response) { 1843 return response; 1844} 1845 1846function showTopLink() { 1847 var ft = $('ft'); 1848 if(ft){ 1849 var scrolltop = $('scrolltop'); 1850 var viewPortHeight = parseInt(document.documentElement.clientHeight); 1851 var scrollHeight = parseInt(document.body.getBoundingClientRect().top); 1852 var basew = parseInt(ft.clientWidth); 1853 var sw = scrolltop.clientWidth; 1854 if (basew < 1000) { 1855 var left = parseInt(fetchOffset(ft)['left']); 1856 left = left < sw ? left * 2 - sw : left; 1857 scrolltop.style.left = ( basew + left ) + 'px'; 1858 } else { 1859 scrolltop.style.left = 'auto'; 1860 scrolltop.style.right = 0; 1861 } 1862 1863 if (BROWSER.ie && BROWSER.ie < 7) { 1864 scrolltop.style.top = viewPortHeight - scrollHeight - 150 + 'px'; 1865 } 1866 if (scrollHeight < -100) { 1867 scrolltop.style.visibility = 'visible'; 1868 } else { 1869 scrolltop.style.visibility = 'hidden'; 1870 } 1871 } 1872} 1873 1874function showCreditmenu() { 1875 $F('_showCreditmenu', []); 1876} 1877 1878function showUpgradeinfo() { 1879 $F('_showUpgradeinfo', []); 1880} 1881 1882function addFavorite(url, title) { 1883 try { 1884 window.external.addFavorite(url, title); 1885 } catch (e){ 1886 try {
1887 window.sidebar.addPanel(title, url, ''); 1888 } catch (e) { 1889 showDialog("è«æ Ctrl+D 鵿·»å å°æ¶è夾", 'notice'); 1890 } 1891 } 1892} 1893 1894function setHomepage(sURL) { 1895 if(BROWSER.ie){ 1896 document.body.style.behavior = 'url(#default#homepage)'; 1897 document.body.setHomePage(sURL); 1898 } else { 1899 showDialog("é IE ç覽å¨è«æåå°æ¬ç«è¨çºé¦é ", 'notice'); 1900 doane(); 1901 } 1902} 1903 1904function setShortcut() { 1905 var scrollTop = Math.max(document.documentElement.scrollTop, document.body.scrollTop); 1906 if(!loadUserdata('setshortcut') && !scrollTop) { 1907 $F('_setShortcut', []); 1908 } 1909} 1910 1911function smilies_show(id, smcols, seditorkey) { 1912 $F('_smilies_show', arguments, 'smilies'); 1913} 1914 1915function showfocus(ftype, autoshow) { 1916 var id = parseInt($('focuscur').innerHTML); 1917 if(ftype == 'prev') { 1918 id = (id-1) < 1 ? focusnum : (id-1); 1919 if(!autoshow) { 1920 window.clearInterval(focusautoshow); 1921 } 1922 } else if(ftype == 'next') { 1923 id = (id+1) > focusnum ? 1 : (id+1); 1924 if(!autoshow) { 1925 window.clearInterval(focusautoshow); 1926 } 1927 } 1928 $('focuscur').innerHTML = id; 1929 $('focus_con').innerHTML = $('focus_'+(id-1)).innerHTML; 1930} 1931 1932function rateStarHover(target,level) { 1933 if(level == 0) { 1934 $(target).style.width = ''; 1935 } else { 1936 $(target).style.width = level * 16 + 'px'; 1937 } 1938} 1939function rateStarSet(target,level,input) { 1940 $(input).value = level; 1941 $(target).className = 'star star' + level; 1942} 1943 1944function img_onmouseoverfunc(obj) { 1945 if(typeof showsetcover == 'function') { 1946 showsetcover(obj); 1947 } 1948 return; 1949} 1950 1951function toggleBlind(dom) { 1952 if(dom) { 1953 if(loadUserdata('is_blindman')) { 1954 saveUserdata('is_blindman', ''); 1955 dom.title = 'éåè¼å©è¨ªå'; 1956 } else { 1957 saveUserdata('is_blindman', '1'); 1958 dom.title = 'ééè¼å©è¨ªå'; 1959 } 1960 } 1961} 1962 1963function checkBlind() { 1964 var dom = $('switchblind'); 1965 if(dom) { 1966 if(loadUserdata('is_blindman')) { 1967 dom.title = 'ééè¼å©è¨ªå'; 1968 } else { 1969 dom.title = 'éåè¼å©è¨ªå'; 1970 } 1971 } 1972} 1973 1974function getElementOffset(element) { 1975 var left = element.offsetLeft, top = element.offsetTop; 1976 while(element = element.offsetParent) { 1977 left += element.offsetLeft; 1978 top += element.offsetTop; 1979 } 1980 if($('nv').style.position == 'fixed') { 1981 top -= parseInt($('nv').style.height); 1982 } 1983 return {'left' : left, 'top' : top}; 1984} 1985 1986function mobileplayer() { 1987 var platform = navigator.platform; 1988 var ua = navigator.userAgent; 1989 var ios = /iPhone|iPad|iPod/.test(platform) && ua.indexOf( "AppleWebKit" ) > -1; 1990 var andriod = ua.indexOf( "Android" ) > -1; 1991 if(ios || andriod) { 1992 return true; 1993 } else { 1994 return false; 1995 } 1996} 1997 1998function appendstyle(url) { 1999 var link = document.createElement('link'); 2000 link.type = 'text/css'; 2001 link.rel = 'stylesheet'; 2002 link.href = url; 2003 var head = document.getElementsByTagName('head')[0]; 2004 head.appendChild(link); 2005} 2006 2007function detectHtml5Support() { 2008 return document.createElement("Canvas").getContext; 2009} 2010 2011function detectPlayer(randomid, ext, src, width, height) { 2012 var h5_support = new Array('aac', 'flac', 'mp3', 'm4a', 'wav', 'flv', 'mp4', 'm4v', '3gp', 'ogv', 'ogg', 'weba', 'webm'); 2013 var trad_support = new Array('mp3', 'wma', 'mid', 'wav', 'ra', 'ram', 'rm', 'rmvb', 'swf', 'asf', 'asx', 'wmv', 'avi', 'mpg', 'mpeg', 'mov'); 2014 width = width.indexOf("%") == -1 ? width + 'px' : width; 2015 height = height.indexOf("%") == -1 ? height + 'px' : height; 2016 if (in_array(ext, h5_support) && detectHtml5Support()) { 2017 html5Player(randomid, ext, src, width, height); 2018 } else if (in_array(ext, trad_support)) { 2019 tradionalPlayer(randomid, ext, src, width, height); 2020 } else { 2021 $(randomid).style.width = width; 2022 $(randomid).style.height = height; 2023 } 2024} 2025 2026function tradionalPlayer(randomid, ext, src, width, height) { 2027 switch(ext) { 2028 case 'mp3': 2029 case 'wma': 2030 case 'mid': 2031 case 'wav': 2032 height = 64; 2033 html = '<object classid="clsid:6BF52A52-394A-11d3-B153-00C04F79FAA6" width="' + width + '" height="' + height + '"><param name="invokeURLs" value="0"><param name="autostart" value="0" /><param name="url" value="' + src + '" /><embed src="' + src + '" autostart="0" type="application/x-mplayer2" width="' + width + '" height="' + height + '"></embed></object>'; 2034 break; 2035 case 'ra': 2036 case 'ram': 2037 height = 32; 2038 html = '<object classid="clsid:CFCDAA03-8BE4-11CF-B84B-0020AFBBCCFA" width="' + width + '" height="' + height + '">
2038<param name="autostart" value="0" /><param name="src" value="' + src + '" /><param name="controls" value="controlpanel" /><param name="console" value="' + randomid + '_" /><embed src="' + src + '" autostart="0" type="audio/x-pn-realaudio-plugin" controls="ControlPanel" console="' + randomid + '_" width="' + width + '" height="' + height + '"></embed></object>'; 2039 break; 2040 case 'rm': 2041 case 'rmvb': 2042 html = '<object classid="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA" width="' + width + '" height="' + height + '"><param name="autostart" value="0" /><param name="src" value="' + src + '" /><param name="controls" value="imagewindow" /><param name="console" value="' + randomid + '_" /><embed src="' + src + '" autostart="0" type="audio/x-pn-realaudio-plugin" controls="imagewindow" console="' + randomid + '_" width="' + width + '" height="' + height + '"></embed></object><br /><object classid="clsid:CFCDAA03-8BE4-11CF-B84B-0020AFBBCCFA" width="' + width + '" height="32"><param name="src" value="' + src +'" /><param name="controls" value="controlpanel" /><param name="console" value="' + randomid + '_" /><embed src="' + src + '" autostart="0" type="audio/x-pn-realaudio-plugin" controls="controlpanel" console="' + randomid + '_" width="' + width + '" height="32"></embed></object>'; 2043 break; 2044 case 'swf': 2045 html = AC_FL_RunContent('width', width, 'height', height, 'allowNetworking', 'internal', 'allowScriptAccess', 'never', 'src', encodeURI(src), 'quality', 'high', 'bgcolor', '#ffffff', 'wmode', 'transparent', 'allowfullscreen', 'true'); 2046 break; 2047 case 'asf': 2048 case 'asx': 2049 case 'wmv': 2050 case 'avi': 2051 case 'mpg': 2052 case 'mpeg': 2053 html = '<object classid="clsid:6BF52A52-394A-11d3-B153-00C04F79FAA6" width="' + width + '" height="' + height + '"><param name="invokeURLs" value="0"><param name="autostart" value="0" /><param name="url" value="' + src + '" /><embed src="' + src + '" autostart="0" type="application/x-mplayer2" width="' + width + '" height="' + height + '"></embed></object>'; 2054 break; 2055 case 'mov': 2056 html = '<object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" width="' + width + '" height="' + height + '"><param name="autostart" value="false" /><param name="src" value="' + src + '" /><embed src="' + src + '" autostart="false" type="video/quicktime" controller="true" width="' + width + '" height="' + height + '"></embed></object>'; 2057 break; 2058 default: 2059 break; 2060 } 2061 $(randomid).style.width = width; 2062 $(randomid).style.height = height; 2063 $(randomid + '_container').innerHTML = html; 2064} 2065 2066function html5Player(randomid, ext, src, width, height) { 2067 switch (ext) { 2068 case 'aac': 2069 case 'flac': 2070 case 'mp3': 2071 case 'm4a': 2072 case 'wav': 2073 case 'ogg': 2074 height = 66; 2075 if(!HTML5PLAYER['apload']) { 2076 appendstyle(STATICURL + 'js/player/aplayer.min.css'); 2077 appendscript(STATICURL + 'js/player/aplayer.min.js'); 2078 HTML5PLAYER['apload'] = 1; 2079 } 2080 html5APlayer(randomid, ext, src, width, height); 2081 break; 2082 case 'flv': 2083 if(!HTML5PLAYER['flvload']) { 2084 appendscript(STATICURL + 'js/player/flv.min.js'); 2085 HTML5PLAYER['flvload'] = 1; 2086 } 2087 case 'mp4': 2088 case 'm4v': 2089 case '3gp': 2090 case 'ogv': 2091 case 'webm': 2092 if(!HTML5PLAYER['dpload']) { 2093 appendstyle(STATICURL + 'js/player/dplayer.min.css'); 2094 appendscript(STATICURL + 'js/player/dplayer.min.js'); 2095 HTML5PLAYER['dpload'] = 1; 2096 } 2097 html5DPlayer(randomid, ext, src, width, height); 2098 break; 2099 default: 2100 break; 2101 } 2102 $(randomid).style.width = width; 2103 $(randomid).style.height = height; 2104} 2105 2106function html5APlayer(randomid, ext, src, width, height) { 2107 if (JSLOADED[STATICURL + 'js/player/aplayer.min.js']) { 2108 window[randomid] = new APlayer({ 2109 container: $(randomid + '_container'), 2110 mini: false, 2111 autoplay: false, 2112 loop: 'all', 2113 preload: 'none', 2114 volume: 1, 2115 mutex: true, 2116 listFolded: true, 2117 audio: [{ 2118 name: ' ', 2119 artist: ' ', 2120 url: src 2121 }] 2122 }); 2123 } else { 2124 setTimeout(function () { 2125 html5APlayer(randomid, ext, src, width, height); 2126 }, 50); 2127 } 2128} 2129 2130function html5DPlayer(randomid, ext, src, width, height) { 2131 if (JSLOADED[STATICURL + 'js/player/dplayer.min.js'] && (ext != 'flv' || JSLOADED[STATICURL + 'js/player/flv.min.js'])) { 2132 window[randomid] = new DPlayer({
2133 container: $(randomid + '_container'), 2134 autoplay: false, 2135 loop: true, 2136 screenshot: false, 2137 hotkey: true, 2138 preload: 'none', 2139 volume: 1, 2140 mutex: true, 2141 listFolded: true, 2142 video: { 2143 url: src 2144 } 2145 }); 2146 } else { 2147 setTimeout(function () { 2148 html5DPlayer(randomid, ext, src, width, height); 2149 }, 50); 2150 } 2151} 2152 2153var BROWSER = {}; 2154var USERAGENT = navigator.userAgent.toLowerCase(); 2155browserVersion({'ie':'msie','trident':'','firefox':'','chrome':'','opera':'','safari':'','mozilla':'','webkit':'','maxthon':'','qq':'qqbrowser','rv':'rv'}); 2156if(BROWSER.safari || BROWSER.rv) { 2157 BROWSER.firefox = true; 2158} 2159BROWSER.opera = BROWSER.opera ? opera.version() : 0; 2160 2161HTMLNODE = document.getElementsByTagName('head')[0].parentNode; 2162if(BROWSER.ie || BROWSER.trident) { 2163 BROWSER.iemode = parseInt(typeof document.documentMode != 'undefined' ? document.documentMode : BROWSER.ie); 2164 HTMLNODE.className = (BROWSER.iemode<9?'ie_all ':'') +'ie' + BROWSER.iemode; 2165} 2166 2167var CSSLOADED = []; 2168var JSLOADED = []; 2169var JSMENU = []; 2170JSMENU['active'] = []; 2171JSMENU['timer'] = []; 2172JSMENU['drag'] = []; 2173JSMENU['layer'] = 0; 2174JSMENU['zIndex'] = {'win':200,'menu':300,'dialog':400,'prompt':500}; 2175JSMENU['float'] = ''; 2176var CURRENTSTYPE = null; 2177var discuz_uid = isUndefined(discuz_uid) ? 0 : discuz_uid; 2178var creditnotice = isUndefined(creditnotice) ? '' : creditnotice; 2179var cookiedomain = isUndefined(cookiedomain) ? '' : cookiedomain; 2180var cookiepath = isUndefined(cookiepath) ? '' : cookiepath; 2181var EXTRAFUNC = [], EXTRASTR = ''; 2182EXTRAFUNC['showmenu'] = []; 2183 2184var DISCUZCODE = []; 2185DISCUZCODE['num'] = '-1'; 2186DISCUZCODE['html'] = []; 2187 2188var USERABOUT_BOX = true; 2189var USERCARDST = null; 2190var CLIPBOARDSWFDATA = ''; 2191var NOTICETITLE = []; 2192var NOTICECURTITLE = document.title; 2193var safescripts = {}, evalscripts = []; 2194 2195var HTML5PLAYER = []; 2196HTML5PLAYER['apload'] = 0; 2197HTML5PLAYER['dpload'] = 0; 2198HTML5PLAYER['flvload'] = 0; 2199 2200if(BROWSER.firefox && window.HTMLElement) { 2201 HTMLElement.prototype.__defineGetter__( "innerText", function(){ 2202 var anyString = ""; 2203 var childS = this.childNodes; 2204 for(var i=0; i <childS.length; i++) { 2205 if(childS[i].nodeType==1) { 2206 anyString += childS[i].tagName=="BR" ? '\n' : childS[i].innerText; 2207 } else if(childS[i].nodeType==3) { 2208 anyString += childS[i].nodeValue; 2209 } 2210 } 2211 return anyString; 2212 }); 2213 HTMLElement.prototype.__defineSetter__( "innerText", function(sText){ 2214 this.textContent=sText; 2215 }); 2216 HTMLElement.prototype.__defineSetter__('outerHTML', function(sHTML) { 2217 var r = this.ownerDocument.createRange(); 2218 r.setStartBefore(this); 2219 var df = r.createContextualFragment(sHTML); 2220 this.parentNode.replaceChild(df,this); 2221 return sHTML; 2222 }); 2223 2224 HTMLElement.prototype.__defineGetter__('outerHTML', function() { 2225 var attr; 2226 var attrs = this.attributes; 2227 var str = '<' + this.tagName.toLowerCase(); 2228 for(var i = 0;i < attrs.length;i++){ 2229 attr = attrs[i]; 2230 if(attr.specified) 2231 str += ' ' + attr.name + '="' + attr.value + '"'; 2232 } 2233 if(!this.canHaveChildren) { 2234 return str + '>'; 2235 } 2236 return str + '>' + this.innerHTML + '</' + this.tagName.toLowerCase() + '>'; 2237 }); 2238 2239 HTMLElement.prototype.__defineGetter__('canHaveChildren', function() { 2240 switch(this.tagName.toLowerCase()) { 2241 case 'area':case 'base':case 'basefont':case 'col':case 'frame':case 'hr':case 'img':case 'br':case 'input':case 'isindex':case 'link':case 'meta':case 'param': 2242 return false; 2243 } 2244 return true; 2245 }); 2246} 2247 2248if(typeof IN_ADMINCP == 'undefined') { 2249 if(creditnotice != '' && getcookie('creditnotice')) { 2250 _attachEvent(window, 'load', showCreditPrompt, document); 2251 } 2252 if(typeof showusercard != 'undefined' && showusercard == 1) { 2253 _attachEvent(window, 'load', cardInit, document); 2254 } 2255} 2256 2257if(BROWSER.ie) { 2258 document.documentElement.addBehavior("#default#userdata"); 2259}
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.