BROWSER.ie = window.ActiveXObject && USERAGENT.indexOf('msie') != -1 && USERAGENT.substr(USERAGENT.indexOf('msie') + 5, 3); BROWSER.firefox = document.getBoxObjectFor && USERAGENT.indexOf('firefox') != -1 && USERAGENT.substr(USERAGENT.indexOf('firefox') + 8, 3); BROWSER.chrome = window.MessageEvent && !document.getBoxObjectFor && USERAGENT.indexOf('chrome') != -1 && USERAGENT.substr(USERAGENT.indexOf('chrome') + 7, 10); BROWSER.opera = window.opera && opera.version(); BROWSER.safari = window.openDatabase && USERAGENT.indexOf('safari') != -1 && USERAGENT.substr(USERAGENT.indexOf('safari') + 7, 8);点评: 测试过程中某天发现FF下登录窗口账户名只能选择用户名,而在chrome下面可选UID及email。当时一直没找到原因,某天测试时修改到此处,顺便用slice()替换substr()发现FF的登录窗问题正常了。猛然想起以前看过对于substr的一个注解:“ECMAscript 没有对该方法进行标准化,因此反对使用它”。在Firefox8以前都没这个问题,看来FF开始放弃对此函数的兼容了。另外Firefox9也不支持document.getBoxObjectFor对象了。
BROWSER.ie = window.ActiveXObject && USERAGENT.indexOf('msie') != -1 && USERAGENT.slice(USERAGENT.indexOf('msie') + 5, USERAGENT.indexOf('msie') + 8) || false; BROWSER.firefox = USERAGENT.indexOf('firefox') != -1 && USERAGENT.slice(USERAGENT.indexOf('firefox') + 8, USERAGENT.indexOf('firefox') + 11) || false; BROWSER.chrome = window.MessageEvent && !document.getBoxObjectFor && USERAGENT.indexOf('chrome') != -1 && USERAGENT.slice(USERAGENT.indexOf('chrome') + 7, USERAGENT.indexOf('chrome') + 17) || false; BROWSER.opera = window.opera && opera.version() || false; BROWSER.safari = window.openDatabase && USERAGENT.indexOf('safari') != -1 && USERAGENT.slice(USERAGENT.indexOf('safari') + 7, USERAGENT.indexOf('safari') + 15) || false;
function ajaxget(url, showid, waitid, loading, display, recall) { waitid = typeof waitid == 'undefined' || waitid === null ? showid : waitid; ... }点评: 怎么看这个赋值表达式也没问题,可是当minify之后就时不时会在这儿出错,提示“Uncaught ReferenceError: $ is not defined”,用小括号包裹之后就正常了。也蛮奇怪的……
waitid = (typeof waitid == 'undefined' || waitid === null) ? showid : waitid;
if($('fwin_dialog_submit')) $('fwin_dialog_submit').onclick = function() { if(typeof func == 'function') func(); else eval(func); hideMenu(menuid, 'dialog') };点评: 缺少分号结尾,跑到if判断后去了。不过js还是很宽容的,这两个小毛病不会导致啥问题。
ADD:有朋友说修正分号后反而会导致发帖编辑器上按钮(图片、附件等)全部失效了。此处请谨慎修改
-------------------------------------------------------------------------------------------------------
if(x.autogoto) scroll(0, x.showId.offsetTop);include/js/common.js=1150
if(!evaled) evalscript(s);include/js/common.js=1199
if(!evaled) evalscript(s);include/js/common.js=1234
if(isUndefined(timeout)) timeout = 3000; if(isUndefined(cache)) cache = 1; if(isUndefined(pos)) pos = '43'; if(isUndefined(duration)) duration = timeout > 0 ? 0 : 3;include/js/common.js=1551
if(tagname == 'INPUT' || tagname == 'TEXTAREA') return;include/js/common.js=1651
if(lasttop == -1) lasttop = 0;include/js/common.js=1841
if(isUndefined(parsecode)) parsecode = true; if(parsecode) str= str.replace(/\s*\[code\]([\s\S]+?)\[\/code\]\s*/ig, function($1, $2) {return codetag($2);});include/js/common.js=1860
if(typeof wysiwyg != 'undefined' && wysiwyg) text = text.replace(/<br[^\>]*>/ig, '\n').replace(/<(\/|)[A-Za-z].*?>/ig, '');include/js/common.js=835
if($('fwin_dialog_submit')) $('fwin_dialog_submit').onclick = function() { if(typeof func == 'function') func(); // <---- else eval(func); // <---- hideMenu(menuid, 'dialog'); }