// ==UserScript==
// @name hi-pda tools
// @namespace hi-pda-tools-by-2200
// @description 屏蔽用户、名单同步;标识新帖;好孩子也看的见;
// @include http*://*.hi-pda.com/forum/*
// @grant GM_addStyle
// @license MIT
// @version 5.2.3
// @downloadURL none
// ==/UserScript==
// Version 5.2.3-by-Achilles
// 修改介绍和Changelog
// Version 5.2.2-by-Achilles
// 添加license
// Version 5.2.1-by-Achilles
// 修复了https失效的问题
// 兼容TamperMonkey
// Version 5.2
// 修正各种chrome不兼容的函数
// 因SAE挂掉,去除了同步功能
// Version 5.1 TODO
// 宽窄可选
// opera支持
// 投票icon
// 枫叶版chrome兼容
// 点击显示图片
// 屏蔽用户hover改为帖子触发
// 预取几页可选
// 高亮自己的贴
// Version 5.0
// Date 2011-12-18
// 增加同步功能
// Version 4.0
// Date 2011-12-06
// 论坛改版
// Version 3.0
// Date 2011-7-13
// 增加自动更新
// Version 2.2
// Date 2011-7-13
// 修正zhuyi增加【只讨论2.0】板块后预读页面错误
// 高亮功能修改为可选,颜色自定义
// 屏蔽用户功能修改为分版面可选
// Version 2.1
// Date 2011-4-3
// 修正Chrome错误
// 脚本仅针对D版有效
// Version 2.0
// Date 2010-2-9
// @require http://userscript-updater-generator.appspot.com/?id=106358
// Chrome浏览器不支GM_GetValue/GM_SetValue/GM_addStyle/GM_xmlhttpRequest
try{
if (!this.GM_getValue || this.GM_getValue.toString().indexOf("not supported")>-1) {
this.GM_getValue=function (key,def) {
return localStorage[key] || def;
};
this.GM_setValue=function (key,value) {
return localStorage[key]=value;
};
}
if (!this.GM_addStyle || this.GM_addStyle.toString().indexOf("not supported")>-1){
this.GM_addStyle = function(css) {
var head = document.getElementsByTagName('head')[0], style = document.createElement('style');
if (!head) {return}
style.type = 'text/css';
try {style.innerHTML = css} catch(x) {style.innerText = css}
head.appendChild(style);
}
}
if ( !this.GM_xmlhttpRequest || this.GM_xmlhttpRequest.toString().indexOf("not supported")>-1 ) {
this.GM_xmlhttpRequest =
function (details) {
var xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function() {
var responseState = {
responseXML:(xmlhttp.readyState==4 ? xmlhttp.responseXML : ''),
responseText:(xmlhttp.readyState==4 ? xmlhttp.responseText : ''),
readyState:xmlhttp.readyState,
responseHeaders:(xmlhttp.readyState==4 ? xmlhttp.getAllResponseHeaders() : ''),
status:(xmlhttp.readyState==4 ? xmlhttp.status : 0),
statusText:(xmlhttp.readyState==4 ? xmlhttp.statusText : '')
}
if (details["onreadystatechange"]) {
details["onreadystatechange"](responseState);
}
if (xmlhttp.readyState==4) {
if (details["onload"] && xmlhttp.status>=200 && xmlhttp.status<300) {
details["onload"](responseState);
}
if (details["onerror"] && (xmlhttp.status<200 || xmlhttp.status>=300)) {
details["onerror"](responseState);
}
}
}
try {
//cannot do cross domain
xmlhttp.open(details.method, details.url);
} catch(e) {
if( details["onerror"] ) {
//simulate a real error
details["onerror"]({responseXML:'',responseText:'',readyState:4,responseHeaders:'',status:403,statusText:'Forbidden'});
}
return;
}
if (details.headers) {
for (var prop in details.headers) {
xmlhttp.setRequestHeader(prop, details.headers[prop]);
}
}
xmlhttp.send((typeof(details.data)!='undefined')?details.data:null);
}
}
}
catch(e){}
var _pc = 1; // 当前页面的page值
var _fid; // 当前版面fid
var _uid; // 当前登录用户uid
var _tid= 0; // 当前帖子的tid
var _pxt; // 当前页面上“最后回复时间”的最大值
var _pmt; // 当前页面上“最后回复时间”的最小值
var _lvt; // 上次访问时间,页面关闭时,_pxt 存储为 _lvt
var _today; // 与发帖日期比较,超过30天的发帖人单元格显示灰色
var _first_time_use;
var _max_read_pages = 5; // 不能读取更多啦,太多了容易死机
var _hightlight_en; // 启用高亮功能
var _hightlight_color; // 高亮颜色自定义
var _blacklist_en_hpd; // 启用D版的黑名单功能
var _blacklist_en_other; // 启用其他版的黑名单功能
var _simple_style; // 启用精简风格
var _hover_style; // 启用悬停风格
var _reply_avatar; // 回复位置是否显示自己的头像
var _font_size; // 论坛字体大小
var blacklistArray; // 黑名单
var blacklistLen; // 黑名单长度
var blacklistStr;
var serverBlacklist; // 同步冲突时服务器端的列表
var serverListStr;
var serverVersion;
var newBlacklist // 同步冲突时的新列表
var _syn_pending; // 正在同步
var _syn_lastversion;
var _syn_modified;
var _att_max_width; // 帖子附件图片最大宽度
var grave_image; // 坟贴背景图片
// var _old_post_bgcolor = "#E1E1E1";
var _old_post_bgcolor = "#e9e9e9";
var _today_post_color = "#FF0000";
var now = new Date();
var year = now.getYear()+1900;
var month = now.getMonth()+1;
var day = now.getDate();
var hour = now.getHours();
var min = now.getMinutes();
var _bFORUMDISPLAY = location.href.indexOf('hi-pda.com/forum/forumdisplay.php?');
var _bVIEWTHREAD = location.href.indexOf('hi-pda.com/forum/viewthread.php?');
// 工具函数
var JSON;
if (!JSON) {JSON = {};}
(function () {
'use strict';
function f(n) {return n < 10 ? '0' + n : n;}
if (typeof Date.prototype.toJSON !== 'function') {
Date.prototype.toJSON = function (key) {
return isFinite(this.valueOf()) ?
this.getUTCFullYear() + '-' +
f(this.getUTCMonth() + 1) + '-' +
f(this.getUTCDate()) + 'T' +
f(this.getUTCHours()) + ':' +
f(this.getUTCMinutes()) + ':' +
f(this.getUTCSeconds()) + 'Z' : null;
};
String.prototype.toJSON =
Number.prototype.toJSON =
Boolean.prototype.toJSON = function (key) {
return this.valueOf();
};
}
var cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
escapable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
gap,
indent,
meta = { // table of character substitutions
'\b': '\\b',
'\t': '\\t',
'\n': '\\n',
'\f': '\\f',
'\r': '\\r',
'"' : '\\"',
'\\': '\\\\'
},
rep;
function quote(string) {
// If the string contains no control characters, no quote characters, and no
// backslash characters, then we can safely slap some quotes around it.
// Otherwise we must also replace the offending characters with safe escape
// sequences.
escapable.lastIndex = 0;
return escapable.test(string) ? '"' + string.replace(escapable, function (a) {
var c = meta[a];
return typeof c === 'string' ? c :
'\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4);
}) + '"' : '"' + string + '"';
}
function str(key, holder) {
// Produce a string from holder[key].
var i, // The loop counter.
k, // The member key.
v, // The member value.
length,
mind = gap,
partial,
value = holder[key];
// If the value has a toJSON method, call it to obtain a replacement value.
if (value && typeof value === 'object' &&
typeof value.toJSON === 'function') {
value = value.toJSON(key);
}
// If we were called with a replacer function, then call the replacer to
// obtain a replacement value.
if (typeof rep === 'function') {
value = rep.call(holder, key, value);
}
// What happens next depends on the value's type.
switch (typeof value) {
case 'string':
return quote(value);
case 'number':
// JSON numbers must be finite. Encode non-finite numbers as null.
return isFinite(value) ? String(value) : 'null';
case 'boolean':
case 'null':
// If the value is a boolean or null, convert it to a string. Note:
// typeof null does not produce 'null'. The case is included here in
// the remote chance that this gets fixed someday.
return String(value);
// If the type is 'object', we might be dealing with an object or an array or
// null.
case 'object':
// Due to a specification blunder in ECMAScript, typeof null is 'object',
// so watch out for that case.
if (!value) {
return 'null';
}
// Make an array to hold the partial results of stringifying this object value.
gap += indent;
partial = [];
// Is the value an array?
if (Object.prototype.toString.apply(value) === '[object Array]') {
// The value is an array. Stringify every element. Use null as a placeholder
// for non-JSON values.
length = value.length;
for (i = 0; i < length; i += 1) {
partial[i] = str(i, value) || 'null';
}
// Join all of the elements together, separated with commas, and wrap them in
// brackets.
v = partial.length === 0 ? '[]' : gap ?
'[\n' + gap + partial.join(',\n' + gap) + '\n' + mind + ']' :
'[' + partial.join(',') + ']';
gap = mind;
return v;
}
// If the replacer is an array, use it to select the members to be stringified.
if (rep && typeof rep === 'object') {
length = rep.length;
for (i = 0; i < length; i += 1) {
k = rep[i];
if (typeof k === 'string') {
v = str(k, value);
if (v) {
partial.push(quote(k) + (gap ? ': ' : ':') + v);
}
}
}
} else {
// Otherwise, iterate through all of the keys in the object.
for (k in value) {
if (Object.prototype.hasOwnProperty.call(value, k)) {
v = str(k, value);
if (v) {
partial.push(quote(k) + (gap ? ': ' : ':') + v);
}
}
}
}
// Join all of the member texts together, separated with commas,
// and wrap them in braces.
v = partial.length === 0 ? '{}' : gap ?
'{\n' + gap + partial.join(',\n' + gap) + '\n' + mind + '}' :
'{' + partial.join(',') + '}';
gap = mind;
return v;
}
}
// If the JSON object does not yet have a stringify method, give it one.
if (typeof JSON.stringify !== 'function') {
JSON.stringify = function (value, replacer, space) {
// The stringify method takes a value and an optional replacer, and an optional
// space parameter, and returns a JSON text. The replacer can be a function
// that can replace values, or an array of strings that will select the keys.
// A default replacer method can be provided. Use of the space parameter can
// produce text that is more easily readable.
var i;
gap = '';
indent = '';
// If the space parameter is a number, make an indent string containing that
// many spaces.
if (typeof space === 'number') {
for (i = 0; i < space; i += 1) {
indent += ' ';
}
// If the space parameter is a string, it will be used as the indent string.
} else if (typeof space === 'string') {
indent = space;
}
// If there is a replacer, it must be a function or an array.
// Otherwise, throw an error.
rep = replacer;
if (replacer && typeof replacer !== 'function' &&
(typeof replacer !== 'object' ||
typeof replacer.length !== 'number')) {
throw new Error('JSON.stringify');
}
// Make a fake root object containing our value under the key of ''.
// Return the result of stringifying the value.
return str('', {'': value});
};
}
// If the JSON object does not yet have a parse method, give it one.
if (typeof JSON.parse !== 'function') {
JSON.parse = function (text, reviver) {
// The parse method takes a text and an optional reviver function, and returns
// a JavaScript value if the text is a valid JSON text.
var j;
function walk(holder, key) {
// The walk method is used to recursively walk the resulting structure so
// that modifications can be made.
var k, v, value = holder[key];
if (value && typeof value === 'object') {
for (k in value) {
if (Object.prototype.hasOwnProperty.call(value, k)) {
v = walk(value, k);
if (v !== undefined) {
value[k] = v;
} else {
delete value[k];
}
}
}
}
return reviver.call(holder, key, value);
}
// Parsing happens in four stages. In the first stage, we replace certain
// Unicode characters with escape sequences. JavaScript handles many characters
// incorrectly, either silently deleting them, or treating them as line endings.
text = String(text);
cx.lastIndex = 0;
if (cx.test(text)) {
text = text.replace(cx, function (a) {
return '\\u' +
('0000' + a.charCodeAt(0).toString(16)).slice(-4);
});
}
// In the second stage, we run the text against regular expressions that look
// for non-JSON patterns. We are especially concerned with '()' and 'new'
// because they can cause invocation, and '=' because it can cause mutation.
// But just to be safe, we want to reject all unexpected forms.
// We split the second stage into 4 regexp operations in order to work around
// crippling inefficiencies in IE's and Safari's regexp engines. First we
// replace the JSON backslash pairs with '@' (a non-JSON character). Second, we
// replace all simple value tokens with ']' characters. Third, we delete all
// open brackets that follow a colon or comma or that begin the text. Finally,
// we look to see that the remaining characters are only whitespace or ']' or
// ',' or ':' or '{' or '}'. If that is so, then the text is safe for eval.
if (/^[\],:{}\s]*$/
.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@')
.replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']')
.replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) {
// In the third stage we use the eval function to compile the text into a
// JavaScript structure. The '{' operator is subject to a syntactic ambiguity
// in JavaScript: it can begin a block or an object literal. We wrap the text
// in parens to eliminate the ambiguity.
j = eval('(' + text + ')');
// In the optional fourth stage, we recursively walk the new structure, passing
// each name/value pair to a reviver function for possible transformation.
return typeof reviver === 'function' ?
walk({'': j}, '') : j;
}
// If the text is not JSON parseable, then a SyntaxError is thrown.
throw new SyntaxError('JSON.parse');
};
}
// Augment the basic prototypes if they have not already been augmented.
// These forms are obsolete. It is recommended that JSON.stringify and
// JSON.parse be used instead.
if (!Object.prototype.toJSONString) {
Object.prototype.toJSONString = function (filter) {
return JSON.stringify(this, filter);
};
Object.prototype.parseJSON = function (filter) {
return JSON.parse(this, filter);
};
}
}());
function $(select){
var name = select.substring(1);
switch(select.charAt(0)){
case '#':
return document.getElementById(name);
case '.':
return document.getElementsByClassName(name);
case '/':
return document.getElementsByTagName(name);
default:
return document.getElementsByName(select);
}
};
function getNowTimeStamp(){ // 当前时刻 yyyy-m-d h:m:s
var nowtime = new Date();
var timestamp =(nowtime.getYear()+1900)+'-'+(nowtime.getMonth()+1)+'-'+nowtime.getDate()+' '+checkTime(nowtime.getHours())+':'+checkTime(nowtime.getMinutes())+':'+checkTime(nowtime.getSeconds());
return timestamp;
}
function timeDiff(date1,date2){// 比较日期大小,年,月,日,小时,分钟
var re=/^(\d{4})\S(\d{1,2})\S(\d{1,2})\s(\d{1,2})\S(\d{1,2})$/;
var dt1,dt2;
if (re.test(date1)) dt1=new Date(RegExp.$1,RegExp.$2-1,RegExp.$3,RegExp.$4,RegExp.$5);
if (re.test(date2)) dt2=new Date(RegExp.$1,RegExp.$2-1,RegExp.$3,RegExp.$4,RegExp.$5);
else dt2=new Date();
return dt1>=dt2;
}
function dateDiff(date1,date2){// 比较日期大小,年月日
var re=/^(\d{4})\S(\d{1,2})\S(\d{1,2})$/;
var dt1,dt2;
if (re.test(date1)) dt1=new Date(RegExp.$1,RegExp.$2-1,RegExp.$3);
if (re.test(date2)) dt2=new Date(RegExp.$1,RegExp.$2-1,RegExp.$3);
return Math.floor((dt2-dt1)/(1000*60*60*24))
}
function checkTime(i){ // 一位数的时间前加0
if (i<10)
{i="0" + i}
return i
}
function getKeys(e){ // keycode 转换
var codetable={'96':'Numpad 0','97':'Numpad 1','98':'Numpad 2','99':'Numpad 3','100':'Numpad 4','101':'Numpad 5','102':'Numpad 6','103':'Numpad 7','104':'Numpad 8','105':'Numpad 9','106':'Numpad *','107':'Numpad +','108':'Numpad Enter','109':'Numpad -','110':'Numpad .','111':'Numpad /','112':'F1','113':'F2','114':'F3','115':'F4','116':'F5','117':'F6','118':'F7','119':'F8','120':'F9','121':'F10','122':'F11','123':'F12','8':'BackSpace','9':'Tab','12':'Clear','13':'Enter','16':'Shift','17':'Ctrl','18':'Alt','20':'Cape Lock','27':'Esc','32':'Spacebar','33':'Page Up','34':'Page Down','35':'End','36':'Home','37':'←','38':'↑','39':'→','40':'↓','45':'Insert','46':'Delete','144':'Num Lock','186':';:','187':'=+','188':',<','189':'-_','190':'.>','191':'/?','192':'`~','219':'[{','220':'\|','221':']}','222':'"'};
var Keys = '';
e.shiftKey && (e.keyCode != 16) && (Keys += 'shift+');
e.ctrlKey && (e.keyCode != 17) && (Keys += 'ctrl+');
e.altKey && (e.keyCode != 18) && (Keys += 'alt+');
return Keys + (codetable[e.keyCode] || String.fromCharCode(e.keyCode) || '');
};
function addHotKey(codes,func){// 监视并执行快捷键对应的函数
document.addEventListener('keydown', function(e){
if ((e.target.tagName != 'INPUT') && (e.target.tagName != 'TEXTAREA') && getKeys(e) == codes){
func();
e.preventDefault();
e.stopPropagation();
}
}, false);
};
// 触发函数
function onToggleBlackList(e){// 黑名单[名字]触发
var v = e.target.value;
var bShow = e.target.checked;
if(_bVIEWTHREAD>0){
var s = document.evaluate("//div[@class='postinfo']",document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
for (var i = s.snapshotLength - 1; i >= 0; i--) {
var t = s.snapshotItem(i);
var a = t.getElementsByTagName('a')[0];
if( a != undefined){
var u = a.href.substring(a.href.indexOf('uid')+4);
if((u+'='+a.text) == v)t.parentNode.parentNode.parentNode.parentNode.style.display = bShow?'none':'';
}
}
}
if(_bFORUMDISPLAY>0){
var s = document.evaluate("//td[@class='f_author']",document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
for (var i = s.snapshotLength - 1; i >= 0; i--) { // 屏蔽BLACK_LIST的发帖
var t = s.snapshotItem(i);
var a = t.getElementsByTagName('a')[0];
if( a != undefined){
var n = a.text;
var u = a.href.substring(a.href.indexOf('uid')+4);
if((u+'='+a.text) == v)t.parentNode.style.display = bShow?'none':'';
}
}
}
};
function onBlockUser(e){ // [屏蔽] 按钮触发
var a = e.target.parentNode.parentNode.parentNode.parentNode.parentNode.getElementsByClassName('postinfo')[0].getElementsByTagName('a')[0];
var nm= a.text;
var id= a.href.substring(a.href.indexOf('uid')+4);
if(blacklistStr.indexOf(id+'='+nm)<0){//检查有没有重复的
blacklistArray.push(id+'='+nm);
blacklistStr = blacklistArray.toString();
GM_setValue('HiPDA_Discovery_BLACK_LIST',blacklistArray.join());
blacklistLen=blacklistArray.length;
}
_syn_modified = true;
GM_setValue("HiPDA_Discovery_SYN_MODIFIED",_syn_modified);
// 重新激活同步按钮
document.getElementById('s_syn').className="enable";
document.getElementById('s_syn').innerHTML="₪ 同步";
document.getElementById('s_syn').style.background='#eef9eb';
document.getElementById('s_syn').style.color='#000';
refreshConfigDiv();
processBlackList();
};
function onWindowResize(){ // 调整body宽度
// alert('resize');
if(_simple_style){
if(window.innerWidth>1600)
GM_addStyle("body {width:65%;}");
else if(window.innerWidth>1400)
GM_addStyle("body {width:75%;}");
else if(window.innerWidth>1200)
GM_addStyle("body {width:85%;}");
else
GM_addStyle("body {width:980px;}");
}
}
function onAttachImageLoaded(){ // 附件图片加载完成后修改宽度
var newimg = new Image();
newimg.src =this.src;
if(newimg.width<=_att_max_width ){
this.width=newimg.width;
//去除zoom
this.removeAttribute('onclick');
this.className="nozoom";
}
else
this.width=_att_max_width;
}
function onLoadNewPage(req){ // 后台读取页面完毕
try {
if (req.status == 200) {
var newPageHTML = req.responseText.substring(req.responseText.indexOf('
'));
var threadList = document.getElementsByName("moderate")[0].getElementsByClassName("datatable")[0];
// 增加预取了页面的提示
// var newpagetip="
';
}
};
function processHighlightColor(){ // 对帖子进行高亮
if( !_hightlight_en ){ // 如果不启用高亮就把这次页面打开的时刻写进去
if( 1 == _pc )
GM_setValue("HiPDA_Discovery_LAST_VISIT_TIME"+_fid,year + "-" + month + "-" + day + " " + hour + ":" + min)
return;
}
if(_bFORUMDISPLAY>0){
// 遍历页面中的帖子列表,将所有“最后回复时间”大于 _lvt 的帖子背景色换成 _hightlight_color
// 这里没有排除置顶帖子
var f = document.evaluate("//td[@class='lastpost']",
document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
for (var i = f.snapshotLength - 1; i >= 0; i--){
var e = f.snapshotItem(i);
var a = e.getElementsByTagName('a')[1];
if( a != undefined){
var _rt = a.text;
if (timeDiff(_rt,_lvt)){
e.parentNode.style.background=_hightlight_color;
e.parentNode.addEventListener('mouseover',mouseOverPost,false);
}
if(timeDiff(_rt,_pxt))_pxt = _rt;
if(timeDiff(_pxt,_lvt)) GM_setValue("HiPDA_Discovery_LAST_VISIT_TIME"+_fid,_pxt);
}
}
// 将发帖日期超过30天的帖子里发帖人单元格背景换成 _old_post_bgcolor :灰色
// 将当天发布的帖子里发帖日期颜色变成 _today_post_color :红色
var snapResults = document.evaluate("//td [@class='author']",
document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
for (var i = snapResults.snapshotLength - 1; i >= 0; i--) {
var e = snapResults.snapshotItem(i).getElementsByTagName('em')[0];
if(e != undefined){
var dd = dateDiff(e.innerHTML,_today);
if (dd >= 30) {
if (e.parentNode.parentNode.innerHTML.indexOf("images/default/pin")==-1 && e.parentNode.parentNode.innerHTML.indexOf('images/default/folder_lock')==-1 ){
e.parentNode.parentNode.style.background=_old_post_bgcolor;
e.parentNode.parentNode.removeEventListener('mouseover',mouseOverPost,false);
}
}
if (dd == 0) {
if (e.parentNode.parentNode.innerHTML.indexOf("images/default/pin")==-1 && e.parentNode.parentNode.innerHTML.indexOf('images/default/folder_lock')==-1 )
e.style.color=_today_post_color;
}
}
}
}
if(_bVIEWTHREAD>0){
var pst=document.evaluate("//div[@class='postinfo']//strong//a//em",
document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
for (var i = pst.snapshotLength - 1; i >= 0; i--){
if(pst.snapshotItem(i).innerHTML == 1){ // 1st floor
var t1=pst.snapshotItem(i).parentNode.parentNode.parentNode.getElementsByClassName('authorinfo')[0].getElementsByTagName('em')[0];
if(t1 != undefined){
var postdate=t1.innerHTML;
postdate = postdate.substr(4,postdate.indexOf(':')-7);
if(dateDiff(postdate,_today) >=30)
t1.parentNode.parentNode.parentNode.parentNode.getElementsByClassName('defaultpost')[0].style.background=grave_image;
}
}
}
}
}
function processImageZoom(){ // 调整附件图片大小
var imglist=document.evaluate("//img[substring(@id,1,5)='aimg_']",
document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
for (var i = imglist.snapshotLength - 1; i >= 0; i--)
imglist.snapshotItem(i).addEventListener('load',onAttachImageLoaded,false);
}
function processConflict(){
document.getElementById('hp_cfg_div').style.display = 'none';
// 显示【勾选界面】,【服务器列表】,【本地列表】的差异换面和对应选项
// 如果以服务器为准,则存储response的version和list即可
// 如果以本地为准、或以新列表为准(先存储新列表),则请求action=update,等待返回结果【跳到 case 1:】
newBlacklist = new Array();
var listhtml="
";
var i;
for ( i in serverBlacklist ){
var item = serverBlacklist[i];
if(/\d+=.+/.test(item)){
if(blacklistStr.indexOf(item)>=0){ // 服务、本地名单都有
newBlacklist.push(item);
}
else{ // 服务器有,本地没有
var n = item.substr(item.indexOf('=')+1);
listhtml = listhtml +"
"+n+"
";
}
}
}
for ( i in blacklistArray ){
var item = blacklistArray[i];
if( /\d+=.+/.test(item) && serverListStr.indexOf( item )<0 ){ // 本地有,服务器没有
var n = item.substr(item.indexOf('=')+1);
listhtml = listhtml +"