[命令] [7.X版]颜色/图形命令面板 - 使用方法

颜色/图形命令面板 - 使用方法

图:颜色/图形命令面板
1.jpg


得到指定点颜色:得到指定位置的点的颜色


2.jpg


区域找色:在屏幕区域从左到右、从上到下的查找指定的颜色

3.jpg


区域模糊找色:在屏幕区域模糊查找指定的颜色

4.jpg


区域中心找色:在屏幕区域从中心开始查找指定的颜色


5.jpg


区域找图: 在屏幕区域查找指定相似度的图片

命令名称: GetPixelColor 得到指定点颜色
用法与例子:http://www.vrbrothers.com/cn/qmacro/qmdn/qm/GetPixelColor.htm

命令名称: FindColor 找色
用法与例子:http://www.vrbrothers.com/cn/qmacro/qmdn/qm/FindColor.htm

命令名称: FindCenterColor 中心找色
用法与例子:http://www.vrbrothers.com/cn/qmacro/qmdn/qm/FindCenterColor.htm

命令名称: FindColorEx 模糊找色
用法与例子:http://www.vrbrothers.com/cn/qmacro/qmdn/qm/FindColorEx.htm

命令名称: FindPic 找图
用法与例子:http://www.vrbrothers.com/cn/qmacro/qmdn/qm/FindPic.htm


不懂截图看下面教程

 

不懂制作找图需要的图片看下面教程

 

Read more...

Show Btchina greasmonky

显示BTCHINA种子

功能:
1、显示BTCHINA索引页种子列表;
2、去除BTCHINA索引页和搜索页上的广告(包括点击链接时出现的flash);
3、可去除索引页和搜索页上预览时出现的大量图片(可以选择保留)及flash,只留下文字简介。

选项:
显示剧照、显示警告内容、显示镜像及联盟站点、热门刷新,在 工具--> User Script Commands(用户脚本命令)里。

 

http://userscripts.org/scripts/show/33286

 

 


 

33286.user.js

 


 

// This is a greasemonkey script, for use with the Firefox extension Greasemonkey.
// More info: http://greasemonkey.mozdev.org/
//
// ==UserScript==
// @name Show Btchina
// @author Sunwan
// @e-mail <Sunwan>AT<zjcnnj.cn>
// @version 1.2.1
// @description Show torrent in btchina.net [Ver. 1.2.1]
// @namespace http://www.cnnj.8866.org/download/greasemonkey/
// @include http://*.btchina.net/*
// @include http://*.sa20.com/*
// ==/UserScript==


// JScript.encode解码器
// 改编自Soya.Encode.ScriptDecoder
function JScriptDecoder()
{
this.$matrix = [];
this.$rotor =
[
1,2,0, 1,2,0, 2,0,0, 2,0,2, 1,0,2, 0,1,0, 2,0,1,
1,2,0, 0,2,1, 0,2,0, 0,2,1, 1,0,2, 0,2,0, 1,0,1,
1,2,0, 1,0,2, 1,0,2, 0,1,1, 2,0,0, 1,1,2, 0,1,0, 2];
this.$ccmap =
[
0x7b,0x57,0x6e, 0x32,0x2e,0x2d, 0x30,0x47,0x75, 0x21,0x7a,0x52,
0x29,0x56,0x60, 0x5b,0x42,0x71, 0x38,0x6a,0x5e, 0x33,0x2f,0x49,
0x3d,0x26,0x5c, 0x58,0x49,0x62, 0x3a,0x41,0x7d, 0x35,0x34,0x29,
0x65,0x32,0x36, 0x39,0x5b,0x20, 0x5c,0x76,0x7c, 0x56,0x72,0x7a,
0x73,0x43,0x00, 0x66,0x38,0x6b, 0x4e,0x39,0x63, 0x45,0x70,0x33,
0x6b,0x45,0x2b, 0x62,0x68,0x68, 0x59,0x71,0x51, 0x78,0x4f,0x66,
0x5e,0x09,0x76, 0x7d,0x62,0x31, 0x4a,0x44,0x64, 0x6d,0x23,0x54,
0x71,0x75,0x43, 0x00,0x00,0x00, 0x60,0x7e,0x3a, 0x00,0x00,0x00,
0x53,0x5e,0x7e, 0x00,0x00,0x00, 0x42,0x77,0x45, 0x27,0x4a,0x2c,
0x48,0x61,0x2a, 0x72,0x5d,0x74, 0x75,0x22,0x27, 0x31,0x4b,0x37,
0x37,0x6f,0x44, 0x4d,0x4e,0x79, 0x52,0x3b,0x59, 0x22,0x4c,0x2f,
0x54,0x50,0x6f, 0x6a,0x67,0x26, 0x47,0x2a,0x72, 0x64,0x7d,0x6a,
0x2d,0x74,0x39, 0x20,0x54,0x7b, 0x00,0x2b,0x3f, 0x2e,0x2d,0x38,
0x4c,0x2c,0x77, 0x5d,0x30,0x67, 0x7e,0x6e,0x53, 0x6c,0x6b,0x47,
0x6f,0x66,0x34, 0x79,0x35,0x78, 0x74,0x25,0x5d, 0x43,0x21,0x30,
0x26,0x64,0x23, 0x76,0x4d,0x5a, 0x25,0x52,0x5b, 0x24,0x63,0x6c,
0x2b,0x3f,0x48, 0x28,0x7b,0x55, 0x23,0x78,0x70, 0x41,0x29,0x69,
0x34,0x28,0x2e, 0x09,0x73,0x4c, 0x2a,0x59,0x21, 0x44,0x33,0x24,
0x3f,0x00,0x4e, 0x77,0x6d,0x50, 0x3b,0x55,0x09, 0x55,0x53,0x56,
0x69,0x7c,0x73, 0x61,0x3a,0x35, 0x63,0x5f,0x61, 0x50,0x65,0x4b,
0x67,0x46,0x58, 0x51,0x58,0x3b, 0x49,0x31,0x57, 0x4f,0x69,0x22,
0x46,0x6c,0x6d, 0x68,0x5a,0x4d, 0x7c,0x48,0x25, 0x36,0x27,0x28,
0x70,0x5c,0x46, 0x6e,0x3d,0x4a, 0x7a,0x24,0x32, 0x2f,0x79,0x41,
0x5f,0x37,0x3d, 0x4b,0x60,0x5f, 0x5a,0x51,0x4f, 0x2c,0x20,0x42,
0x57,0x36,0x65];
this.$prepareMatrix = function () {
if (!this.$matrix.length) {
var i, j, afccs =
function (cca) { return String.fromCharCode
(cca[0], 0, cca[1], 0, cca[2]).split('\x00');
};

this.$matrix[9] = afccs(this.$ccmap.slice(0, j = 3));
for(i = 0x20; i < 0x80; j += 3, i++)
this.$matrix[i] = afccs(this.$ccmap.slice(j, j + 3));
}
};
this.decode = function (sData) {
var i, of, cc, at, sEncoded, s = '';

// do we have anything to decode. if not, return an empty string.
if(!sData)
return s;

// else try isolating the sEncoded script from its surroundings.
else if(/#@~\^[\w\+\/]{6}==(.+)[\w\+\/]{6}==\^#~@/.test(sData))
sEncoded = RegExp.$1;

// no surrounding checksum found, then subject everything for decoding.
else sEncoded = sData;

this.$prepareMatrix();

// iterate the sEncoded string and decode char by char...
for(at = of = i = 0; i < sEncoded.length; i++){
cc = sEncoded.charCodeAt(i);

// 'at' switched off and the charcode is less 128 means we have
// to perform decoding unless charcode equals 64 (@, at).
if(!at && cc < 0x80){
(cc != 0x40) ?
s += this.$matrix[cc][this.$rotor[of++ % 0x40]] : at = 1;
continue;
}

// if 'at' switch is set, switch it off and replace current charcode
// to one of the control-chars, others are passed through as-is.
else {
at = 0;
if(cc < 0x80) of++;
switch(cc){
case 33 : cc = 60; break;
case 35 : cc = 13; break;
case 36 : cc = 64; break;
case 38 : cc = 10; break;
case 42 : cc = 62; break;
}
s += String.fromCharCode(cc);
}
}
return s;
};
}
// end decoder


function pageChecker() {

this.CONFIG_SHOW_STILLS = GM_getValue("configShowStills", false); // 显示剧照
this.CONFIG_SHOW_ALERT = GM_getValue("configShowAlert", false); // 显示警告内容
this.CONFIG_SHOW_SITES = GM_getValue("configShowSites", false); // 显示镜像及联盟站点
this.CONFIG_REFRESH_HOT_QUERY = GM_getValue("configRefreshHotQuery", false); // 热门刷新
this.SHOW_GM_MENUS = GM_getValue("showGM_menus", true); // 显示GM菜单

this.saveConfig1 = function() {
GM_setValue("configShowStills", !GM_getValue("configShowStills",false));
window.location.reload();
};
this.saveConfig2 = function() {
GM_setValue("configShowAlert", !GM_getValue("configShowAlert",false));
window.location.reload();
};
this.saveConfig3 = function() {
GM_setValue("configShowSites", !GM_getValue("configShowSites",false));
window.location.reload();
};
this.saveConfig4 = function() {
GM_setValue("configRefreshHotQuery", !GM_getValue("configRefreshHotQuery",false));
window.location.reload();
};
this.doGMmenus = function() { // GM菜单操作
if ( this.SHOW_GM_MENUS ) {
if (this.CONFIG_SHOW_STILLS) {GM_registerMenuCommand("√ 显示剧照", this.saveConfig1 );}
else{GM_registerMenuCommand(" 显示剧照", this.saveConfig1 );}
if (this.CONFIG_SHOW_ALERT) {GM_registerMenuCommand("√ 显示警告内容", this.saveConfig2 );}
else{GM_registerMenuCommand(" 显示警告内容", this.saveConfig2 );}
if (this.CONFIG_SHOW_SITES) {GM_registerMenuCommand("√ 显示镜像及联盟站点", this.saveConfig3 );}
else{GM_registerMenuCommand(" 显示镜像及联盟站点", this.saveConfig3 );}
if (this.CONFIG_REFRESH_HOT_QUERY) {GM_registerMenuCommand("√ 热门刷新", this.saveConfig4 );}
else{GM_registerMenuCommand(" 热门刷新", this.saveConfig4 );}
}
if ( !GM_getValue("showGM_menus") )
GM_setValue("showGM_menus", this.SHOW_GM_MENUS);
if ( !GM_getValue("configShowStills") )
GM_setValue("configShowStills", this.CONFIG_SHOW_STILLS);
if ( !GM_getValue("configShowAlert") )
GM_setValue("configShowAlert", this.CONFIG_SHOW_ALERT);
if ( !GM_getValue("configShowSites") )
GM_setValue("configShowSites", this.CONFIG_SHOW_SITES);
if ( !GM_getValue("configRefreshHotQuery") )
GM_setValue("configRefreshHotQuery", this.CONFIG_REFRESH_HOT_QUERY);
};

this.page = null;
this.head = null;
this.tbody = null;
this.rowsLength = 0;
this.maxTableRows = 100; // 表格中最多有100行
this.checkCount = 0;

this.getPage = function() {
if ( document.body && document.body.nodeName =='BODY' ) {
if ( /http:\/\/bt\d?\.btchina\.net/.test(location.href) ) {
this.page = 'indexpage'; // 索引页
}
else if ( /http:\/\/search[1-3]?\.btchina\.net/.test(location.href)
|| /http:\/\/(search|www2)\.sa20\.com/.test(location.href) ) {
this.page = 'searchpage'; // 搜索页
}
}
else if ( /http:\/\/search[1-3]?\.btchina\.net/.test(location.href) ) {
this.page = 'framesetpage'; // 框架页
}
};

this.getHead = function() {
this.head = document.getElementsByTagName("head")[0];
if (this.head) return true; else return false;
};

this.getTbody = function() {
switch (this.page) {
case 'indexpage':
var tb = document.getElementById("table-1");
if ( tb ) this.tbody = tb.tBodies[0];
if (this.tbody) {
this.tbody.id = "contentTBody";
// 清空混乱的表格内容
while (this.tbody.rows[0]) this.tbody.deleteRow(0);
return true;
}
return false;
case 'searchpage':
this.tbody = document.getElementById("contentTBody");
if (this.tbody) return true;
return false;
}
};

// 取得script的文本,应该比innerHTML快
this.getScriptText = function(oNode) {
var s = "";
var cs = oNode.childNodes;
var l = cs.length;
for (var i = 0; i < l; i++) {
if ( cs[i].nodeType == 3 ) { //TEXT_NODE
s += cs[i].nodeValue;
}
}
return s;
};

this.doStyle = function() {
var el = document.createElement("style");
el.setAttribute("type", 'text/css');
el.innerHTML = [
'IFRAME { display: none !important; }', // 隐藏 iframe
'#AutoNumber1 { display: none !important; }', // 隐藏 ads
(this.CONFIG_SHOW_ALERT ? '' :
'div.contentbox { visibility: hidden !important; display: none !important; }'),
(this.CONFIG_SHOW_ALERT ? '' :
'div.alert { visibility: hidden !important; display: none !important; }'),
(this.CONFIG_SHOW_ALERT ? '' :
'div.please { visibility: hidden !important; display: none !important; }'),
(this.CONFIG_SHOW_SITES ? '' :
'div.annotation { visibility: hidden !important; display: none !important; }'),
'.mlyri{position:absolute;left:0;top:0;}', // popup menus
'.mlyrh{width:1;height:1;position:absolute;left:0;top:0;visibility:hidden}', // popup menus
'.m1mouto {BACKGROUND: rgb(229,229,229) !important;}', // popup menus
'.m1inner {PADDING-LEFT: 0px !important;}', // popup menus
'tr.odd { white-space: normal !important; }', // change nowrap to normal
'tr.even { white-space: normal !important; }' // change nowrap to normal
].join('\n');
this.head.appendChild(el);
};

this.adsRemove = function() {
// remove ads event
var fn = function() {
if (typeof(document.onclick) == 'function') document.onclick = null;
if (typeof(window.onmousedown) == 'function') window.onmousedown = null;
};
this.execFunctionInHtml(fn);

// 移除 ads divs
var str, el;
var count = 0;
var sc = document.getElementsByTagName("script");
for (var i = 0; i < sc.length; i++) {
try {
str = this.getScriptText(sc[i]);
if ( str.indexOf('function getCookieVal(offset)') > -1 ) {
count++;
el = sc[i].parentNode;
while ( el && el.nodeName != 'DIV' ) {
el = el.parentNode;
}
if (el) {
el.parentNode.removeChild(el.nextSibling.nextSibling);
el.parentNode.removeChild(el);
}
if ( count > 1 ) break;
}
else if ( str.indexOf('displayFlash(') > -1 ) {
count++;
el = sc[i].parentNode;
while ( el && el.nodeName != 'TABLE' ) {
el = el.parentNode;
}
if (el) {
el.parentNode.removeChild(el);
}
if ( count > 1 ) break;
}
} catch (e) {}
}

// remove iframe
var els = document.getElementsByTagName("iframe");
for (var i = 0; i < els.length; i++) {
els[i].parentNode.removeChild(els[i]);
}
};

this.addEven = function() {
// 左键或右键点击预览框外空白地方,预览框消失
var fn = function() { // 是在HTML中执行的
window.onmousedown = function (evt) {
var whichIt = evt.target;
while ( whichIt && whichIt.id != 'TTip0' ) whichIt = whichIt.parentNode;
if ( whichIt == null && myHint && myHint.visible != null )
myHint.hide(0);
};
};
this.execFunctionInHtml(fn);
};

this.overrideHotQuery = function() {
// 热门
if ( !this.CONFIG_REFRESH_HOT_QUERY ) {
var fn = function() {
window.refreshHotQuery = function() {};
};
this.execFunctionInHtml(fn);
}
};

this.findJScriptAndExec = function() {
// 解码 JScript.encode
var decoder = new JScriptDecoder();

var sc = document.getElementsByTagName("script");
for (var i = 0; i < sc.length; i++) {
if (sc[i].getAttribute("language") &&
sc[i].getAttribute("language").toLowerCase() == 'jscript.encode') {
sc[i].parentNode.replaceChild(
this.createNewScript( decoder.decode(this.getScriptText(sc[i])) ),sc[i]);
return true;
}
}
return false;
};

this.execConfigScript = function() {
// 重新执行解码网页需要的一段script
var str;
var sc = document.getElementsByTagName("script");
for (var i = 0; i < sc.length; i++) {
str = this.getScriptText(sc[i]);
if ( str.indexOf('var seed=new Array(32);') > -1 ) {
var newScript = this.createNewScript( str )
newScript.setAttribute( "id", "divMark" );
sc[i].parentNode.replaceChild(newScript,sc[i]);
return true;
}
}
return false;
};

this.execContentScript = function() {
if ( this.tbody ) {
var str;
var sc = document.getElementsByTagName("script");
// 找出有关种子文件的所有script并执行
for (var i = 0; i < sc.length; i++) {
str = this.getScriptText(sc[i]);
try {
if ( str.indexOf('getRawCode2( "') > -1 ) {
sc[i].parentNode.replaceChild(this.createNewScript(str),sc[i]);
}
} catch (e) {}
}
}
};

// 修复btchina菜单
this.doBtchinaMenus = function() {
var str;
var sc = document.getElementsByTagName("script");
for (var i = 0; i < sc.length; i++) {
str = this.getScriptText(sc[i]);
try {
// 找出菜单所在的单元
if ( str.indexOf('var MENU_ITEMS0') > -1 ) {
var el = sc[i].parentNode;
el.setAttribute( "id", "btchinaMenuTdId" );
el = el.parentNode;
while ( el && el.nodeName != 'TABLE' ) el = el.parentNode;
if (el) {
el = el.parentNode;
while ( el && el.nodeName != 'TABLE' ) el = el.parentNode;
}
if (el)
try {
el.tBodies[0].rows[0].removeChild(el.tBodies[0].rows[0].cells[1]);
} catch (e) {}
break;
}
} catch (e) {}
}

try {this.showPopupMenus();} catch (e) {}
};

this.go = function() {
this.getPage();

if ( this.page ) {
this.doGMmenus(); // GM菜单操作
}
else return;

if ( this.page == 'indexpage' || this.page == 'searchpage' ) {
if ( !this.getHead() ) return;
try {this.doStyle();} catch (e) {} // CSS
try {this.adsRemove();} catch (e) {} // ADS
try {this.overrideHotQuery();} catch (e) {} // 热门
try {this.overrideGetValueFromString();} catch (e) {} // 种子排序修复
try {this.doBtchinaMenus();} catch (e) {} // 修复btchina菜单
}
if ( this.page == 'indexpage' ) {
// JScript.encode 解码并执行
if ( !this.findJScriptAndExec() ) return;

this.head.appendChild( this.createNewScript( this.insertSpace.toString() ) );

if ( !this.overrideGetRawCode3() ) return;

// 重载THints对象方法
try {this.overrideTHints();} catch (e) {}

// 重载onRowClicked函数
try {this.overrideOnRowClicked();} catch (e) {}

if ( !this.execConfigScript() ) return; // 执行预置script
if ( !this.getTbody() ) return; // 表格body
this.execContentScript(); // 执行种子script

try {this.removeImages();} catch (e) {} // 移除剧照及预览框里的IFRAME Ads
}
else if ( this.page == 'searchpage' ) {
try {this.addEven();} catch (e) {}
if ( !this.getTbody() ) return; // 表格body
// 修复Firefox3或以上不能搜索
if ( !(/Firefox\/[12]\./.test(navigator.userAgent)) )
try {this.overrideloadXMLFromURL();} catch (e) {}
// 每200ms检查表格内容的更新,因搜索页使用innerHTML来插入表格
this.showBtChinaTimeId = window.setInterval( checkTbodyRows, 200 );
// 移除剧照及预览框里的IFRAME Ad
try {this.removeImages();} catch (e) {}
}
};
}

// 创建一新script并返回其node
pageChecker.prototype.createNewScript = function(str) {
var newScript = document.createElement("script");
newScript.setAttribute( "language", "javascript" );
var sNode = document.createTextNode( str );
newScript.appendChild( sNode );
return newScript;
};

// 为了消除因访问不安全元素引起的安全问题,把script函数主体放到HTML中执行
pageChecker.prototype.execFunctionInHtml = function(f) {
var str = f.toString();
// 取出函数主体
str = str.substring( str.indexOf('{')+1, str.lastIndexOf('}') );
// 附加到HTML头部并执行
var scNode = this.createNewScript(str);
this.head.appendChild( scNode );
// 执行过后删除script
this.head.removeChild( scNode );
};

// 重载THints对象方法,改编自BTCHINA网页,
// 为安全起见,是在HTML中执行的
pageChecker.prototype.overrideTHints = function() {
if ( typeof(unsafeW.THints) == 'undefined' ) return;
var fn = function() {
var str = window.THints.toString();
str = str.replace(/function\s+THints \(o_cfg, items\)/,'function (o_cfg, items)');
str = str.replace(/document\.write\s*\(.*\);/,
// 创建一个预览块
'var el = document.createElement("div");'+
'el.setAttribute("id","TTip0");'+
'var s = "visibility:hidden;position:absolute;top:0px;left:0px;";'+
's += o_cfg["z-index"] != null ? ("z-index:" + o_cfg["z-index"]) : "";'+
'el.setAttribute("style",s);'+
'el.setAttribute("onMouseOver","myHint.show();");'+
'el.setAttribute("onMouseOut","myHint.hide(" + o_cfg.out2_delay + ");");'+
'var el0 = document.getElementById("divMark");'+
'el0.parentNode.insertBefore(el,el0.nextSibling);'+
'var el1 = document.createElement("table");'+
'el.appendChild(el1);'+
'el = document.createElement("tr");'+
'el1.appendChild(el);'+
'el1 = document.createElement("td");'+
'el1.setAttribute("id","ToolTip0");'+
'el1.setAttribute("class", o_cfg.css);'+
'el1.setAttribute("nowrap","nowrap");'+
'el.appendChild(el1);');
// 预览块结束
eval('window.THints = ' + str);
};
this.execFunctionInHtml(fn);
};

// 重载onRowClicked函数以实现点击一行变色
// 为安全起见,是在HTML中执行的
pageChecker.prototype.overrideOnRowClicked = function() {
if ( typeof(unsafeW.onRowClicked) == 'undefined' ) return;
var fn = function() {
var str = window.onRowClicked.toString();
str = str.replace(/function\s+onRowClicked\s*\(row,\s*rowNo\)/,'function (row, rowNo, e)');
str = str.replace(/whichIt\s*=\s*event\.srcElement;/,'var whichIt = e.target;');
eval('window.onRowClicked =' + str);
};
this.execFunctionInHtml(fn);
};

// 改编自BTCHINA网页
// 为安全起见,是在HTML中执行的
pageChecker.prototype.overrideGetRawCode3 = function() {
if ( typeof(unsafeW.getRawCode3) == 'undefined' ) return false;
var fn = function() {
window.getRawCode3 = function (pagetext,paramters){
var i = 0;
var row_color = paramters[i++];
var dateline = paramters[i++];
var category = paramters[i++];
var nowrap = paramters[i++];
var typeprefix = paramters[i++];
var attachmentid = paramters[i++];
var zeroseedalert = paramters[i++];
var title = paramters[i++];
var postlink = paramters[i++];
var torrent_filesize = paramters[i++];
var torrent_tracker = paramters[i++];
var data_updated = paramters[i++];
var completed = paramters[i++];
var downloading = paramters[i++];
var sources = paramters[i++];
var postedby = paramters[i++];
var attachmentpath = paramters[i++];
var fulldateline = paramters[i++];
var downloadurls = [
'http://'+((new Date()).getSeconds()>=17?((new Date()).getSeconds()>=43?
'nnv.dl1':'dl1.www2'):'dl2.www2')+'.btchina.net/download.php?s='+
attachmentpath+'&attachmentid='+attachmentid,
'http://'+((new Date()).getSeconds()<17?'nnv.dl1':'dl2.www2')+
'.btchina.net/download.php?s='+attachmentpath+'&attachmentid='+attachmentid,
'http://dl3.www2.btchina.net/download.php?s='+attachmentpath+'&attachmentid='+attachmentid,
'http://dl4.www2.btchina.net/download.php?s='+attachmentpath+'&attachmentid='+attachmentid
];

// 创建一行及相关内容
var tr = document.createElement("tr");
tr.setAttribute( "align", "center" );
tr.setAttribute( "class", row_color );
tr.setAttribute( "onMouseOver", 'onRowOver(this,'+rowNo+');');
tr.setAttribute( "onMouseOut", 'onRowOut(this,'+rowNo+');' );
tr.setAttribute( "onClick", 'onRowClicked(this,'+rowNo+',event);' );

insertTd(tr,'nowrap |title="发布时间:'+fulldateline+'"',
'<font face="宋体,verdana,arial,helvetica" >' + '<span style="display:none">'+
fulldateline.substring(0,5)+'</span>'+dateline+'</font>');
insertTd(tr,'nowrap','<font face="宋体,verdana,arial,helvetica" >'+category+'</font>');

title = insertSpace(title);

var s = nowrap;
if ( myHint != null ){
s += ' align="left" |id="cat" |onMouseOver="myHint.show('+ rowNo +
');" |onMouseOut="myHint.hide();"';
HINTS_ITEMS.push( mywrap(title, pagetext, postedby) );
rowNo++;
}
else {
s += 'align="left" |id="cat" |title="'+(pagetext==''?title:title+'\n\n'+pagetext)+'"';
}

insertTd(tr,s,'<font face="Verdana,Tahoma">'+typeprefix+'<a href="'+downloadurls[0]+
'" '+zeroseedalert+' target="_blank">'+title+'</a> '+postlink+'</font>');
insertTd(tr,'align="right" |nowrap','<font face="Verdana,Tahoma">'+torrent_filesize+'</font>');
var tracker_update_title = ' title="Tracker:'+torrent_tracker+'\n数据更新:'+data_updated+'"';
insertTd(tr,'nowrap |'+tracker_update_title,'<font face="Verdana,Tahoma">'+sources+'</font>');
insertTd(tr,'nowrap |'+tracker_update_title,'<font face="Verdana,Tahoma">'+
downloading+'</font>');
insertTd(tr,'nowrap |'+tracker_update_title,'<font face="Verdana,Tahoma">'+completed+'</font>');
insertTd(tr,'width="100"','<font face="Verdana,Tahoma">'+postedby.replace(/@/g,' @')+'</font>');

s = '<font face="Verdana,Tahoma">';
for (var i=1;i<downloadurls.length;i++){
if (i!=1){
s += '| ';
}
s += '<a href="'+downloadurls[i]+'" '+zeroseedalert+' target="_blank">D'+(i+1)+'</a>';
}
s += '</font>';
insertTd(tr,'align="left" |nowrap |title="安装BT后点击下载"',s);

document.getElementById("contentTBody").appendChild(tr); // 把此行添加tbody到的最后

// 在一TR中添加TD,proStr为属性字符串,不同属性以'|'隔开
function insertTd(tr,proStr,content) {
var str;
var td = document.createElement("td");

if (proStr) {
str = proStr.split('|');
for (var i=0; i<str.length; i++) {
if ( /^\s*([^'"]+)s*=\s*"((?:.*(?:\n|\r)*)*)"/.test(str[i]) ){
//td.setAttribute(RegExp.$1,RegExp.$2);
td.setAttribute(RegExp.$1,(RegExp.$2).replace(/\n|\r/g,'\\n'));
}
else if ( /nowrap/i.test(str[i]) )
td.setAttribute("nowrap","nowarp");
else
td.setAttribute(str[i],"");
}
}
td.innerHTML = content;
tr.appendChild(td);
}
};
};
this.execFunctionInHtml(fn);
return true;
};

//在FF中,若表格内容是不含空格的可打印的ASCII字符,则FF不折行,因此常常撑开表格.
//此函数往带标签格式的字符串中的适当位置插入空格以实现自动折行.
pageChecker.prototype.insertSpace = function insertSpace(str) {
var lablePos = []; // 标签位置
var lableValue = []; // 标签值
var s = ""; // 去除了标签的字串
var s1 = ""; // 添加了空格后的字串
var s2 = ""; // 恢复了标签的字串
var index;
while ( str ) {
index = str.search(/(<[^<>]*>)/); // 查找标签位置
if ( index != -1 ) { // 找到
lableValue.push(RegExp.$1); // 保存标签值
s += str.substring(0,index); // 保存去除了标签的字串
lablePos.push(s.length); // 保存标签位置
str = str.substring( index + (RegExp.$1).length, str.length ); // 截断已查找部分
}
else {
s += str; // 保存字串
str = '';
}
s1 = insertSpace1(s,s1,lablePos); // 适当位置插入空格
}

// 恢复标签
for ( var i = 0, j = 0; i < lablePos.length; i++ ) {
s2 += s1.substring( j, lablePos[i] ) + lableValue[i];
j = lablePos[i];
}
s2 += s1.substring( j, s1.length );
return s2;

function insertSpace1(s,s1,pos) {
// 允许的最长连续ASCII字符,达到此长度则强行分割
var maxAsciiLength = 30;
// 匹配规定字符数以上的可见ASCII字符
var re = eval( '/([\x21-\x7e]{' + maxAsciiLength + ',})/' );
// 查找匹配字符串位置
var j = s.search(re);
// 没找到取整串,找到取前面的子串
s1 = ( j == -1 ) ? s : s.substring( 0, j );
while ( -1 != j ) {
s = s.substring( j + (RegExp.$1).length, s.length ); // 保存剩余的子串
// 往匹配字符串的') ] } . - _'后面插入空格并分组
var ss = (RegExp.$1).replace(/((?:[\)|\]|\}|\.|\-|_])+)/g,'$1 ').split(' ');

for ( var i = 0; i < ss.length; i++ ) {
if ( ss[i] && ss[i].length > maxAsciiLength ) {
while ( ss[i] && ss[i].length > maxAsciiLength ) {
// 分组后的子串长度大于最长连续字符数,在最长连续字符数后插入连线符及空格
s1 += ss[i].substring(0,maxAsciiLength) + '_ ';
fixPos(s1.length-2, 2, pos); // 调整标签位置
ss[i] = ss[i].substring(maxAsciiLength,ss[i].length);
}
s1 += ss[i];
}
else {
if ( i == ss.length - 1 ) {
// 是最后分组则连接以待处理
s1 += ss[i];
}
else {
// 非最后分组则连接并插入空格
s1 += ss[i] + ' ';
fixPos(s1.length-1, 1, pos); // 调整标签位置
}
}
}
j = s.search(re); // 循环处理匹配字符串后面的子串
s1 += ( j == -1 ) ? s : s.substring( 0, j );
}
return s1;
}

// 调整标签位置函数
// p插入字符的位置,n影响的字符数,pos标签位置数组
function fixPos(p,n,pos) {
for ( var i = 0; i < pos.length; i++ ) {
if ( pos[i] >= p ) {
// 插入字符的位置在原来的标签位置或之前
pos[i] += n; // 往后调整n个字符
}
}
}
};

// 移除剧照及预览框里的IFRAME Ads
pageChecker.prototype.removeImages = function() {
if ( typeof(unsafeW.myHint) == 'undefined' ) return;
var fn;
if ( this.CONFIG_SHOW_STILLS ) {
fn = function() { window.myHint.CONFIG_SHOW_STILLS = 'true'; };
this.execFunctionInHtml(fn);
}

fn = function() {
// 覆盖myHint的showD方法以实现移除海报及IFRAME Ads
window.myHint.showD = function(id) {
var pageStr = this.items[id];

if (!myHint.CONFIG_SHOW_STILLS) {
// 移除剧照
var re = /(?:(?:<br>)*<img[^<]*<\/img>(?:<br>)*)+/gi;
pageStr = pageStr.replace( re, '<br>' );
}

// 移除 IFRAME Ads (不包括嵌套iframe)
var sIndex, index = 0;
var len = pageStr.length;
while ( index < len ) {
sIndex = pageStr.indexOf('<IFRAME ',index); // 找到iframe标签的开始位置
if ( sIndex > -1 ) {
index = sIndex + 8;
index = pageStr.indexOf('</IFRAME>',index); // 找到iframe标签的结束位置
if ( index > -1 ) {
index += 9;
// 移除iframe标签中的所有内容,再接着找下一个iframe
pageStr = pageStr.substring(0,sIndex) + pageStr.substring(index,len);
len = pageStr.length;
index = sIndex;
}
else
break; // 没有找到,退出
}
else
break; // 没有找到,退出
}
pageStr = pageStr.replace( /(?:\s*<br>\s*)+/gi, '<br>' ); // 移除多余的<br>
// remove end

this.divs[0].o_content.innerHTML = pageStr;
if ( typeof(init_btchina) != 'undefined' ) {
init_btchina(this.divs[0].o_content);
}

this.move(0);

// 延迟100ms再显示预览以消除预览框的跳动
this.divs[0].timer = window.setTimeout("myHint.showElem(0)", 100);

if (this.n_dl_hide) this.timer = setTimeout("myHint.hide(0)", this.n_dl_hide);
this.visible = id;
};
};
this.execFunctionInHtml(fn);
}

// 重载 getValueFromString 以使种子数等排序正确
pageChecker.prototype.overrideGetValueFromString = function() {
if ( typeof(unsafeW.SortableTable) == 'undefined' ) return;
var fn = function() {
// 重载 getValueFromString 以使种子数等排序正确
SortableTable.prototype.__getValueFromString = SortableTable.prototype.getValueFromString;
SortableTable.prototype.getValueFromString = function(sText, sType) {
if ( sType == "PreNumber" ) {
var n = parseInt(sText);
return isNaN(n) ? -100 : n;
}
return this.__getValueFromString(sText, sType);
};
};
this.execFunctionInHtml(fn);
};

// Firefox3下,btchina的搜索站点不支持fx3,在此把User-Agent暂时改为fx2.0的。
pageChecker.prototype.overrideloadXMLFromURL = function() {
if ( typeof(unsafeW.loadXMLFromURL) == 'undefined' ) return;
var fn = function() {
eval('loadXMLFromURL =' + loadXMLFromURL.toString().replace(
'httpRequest.open("GET", url, true);',
'httpRequest.open("GET", url, true);'+
'httpRequest.setRequestHeader("User-Agent", "Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-CN; rv:1.8.1.9) Gecko/20071025 Firefox/2.0.0.10");'));
loadXMLFromURL(searchdataurl, getRawCodeXML);
};
this.execFunctionInHtml(fn);
};

// 显示btchina菜单
pageChecker.prototype.showPopupMenus = function() {
if ( typeof(unsafeW.menu) == 'undefined' ) return;
var fn = function() {
var str = window.TMN.toString();
// Firefox3.0以下,替换菜单中的Webdings指示为unicode编码字符
if ( navigator.userAgent.indexOf('Firefox/3.') == -1 ) {
str = str.replace(/this\.TMY\.join\(""\)/,
'this.TMY.join("").replace(/&#052;/g,\"\\u25BA\")');
}
// document.write方法改为innerHTML
str = str.replace(/document\.write\s*\((.*)\)\s*;/g,
'document.getElementById("btchinaMenuTdId").innerHTML = [$1].join("");');
eval('window.TMN =' + str);

// 增加一个DIV使几个DIV重叠
str = window.TMp.toString();
str = str.replace(/(function[^>]+nowrap>)(<table.+<\/div>)(.*)/,
'$1<div style=\\"position:relative;\\">$2</div>$3');
eval('window.TMp =' + str);

// 延迟显示使菜单稳定
str = window.TM04.toString();
str = str.replace(/(TMg.TM8\s*\(\s*this\.TMf\s*,\s*true\s*\)\s*;)/,
'menus["0"].TM1B=setTimeout("TMg.TM8(menus[\\"0\\"].TM0T[\\""+this.id+"\\"].TMf,true)",100);');
eval('window.TM04 =' + str);

// 重作菜单
var TM17 = false;
new menu (MENU_ITEMS0, MENU_POS0);
};
this.execFunctionInHtml(fn);
};

// 应用于搜索页上,检查每行数据以实现自动折行
function checkTbodyRows() {
var o = pChecker;
if ( !o.tbody ) {
window.clearInterval( o.showBtChinaTimeId );
return;
}
var len = o.tbody.rows.length;

if ( len > o.rowsLength ) { // 数据有更新
var str, td, oNode;
for ( var i = o.rowsLength; i < len; i++ ) {
try { // 检查更新部分
td = o.tbody.rows[i].cells[2]; // 第3列---> 种子名称
try {
oNode = td.getElementsByTagName("a")[0];
str = o.insertSpace(oNode.innerHTML); // 插入空格
if ( str.length != oNode.innerHTML.length )
// 若有改变,须重写
oNode.innerHTML = str;
} catch (e) {}

td = o.tbody.rows[i].cells[7]; // 第8列---> 发布者
try {
td.removeAttribute("nowrap"); // 允许折行
td.width = "100"; // 设定宽度
// 找到'@'符号并在前面插入空格
oNode = td.getElementsByTagName("a")[0].nextSibling;
if ( oNode && oNode.nodeValue )
oNode.nodeValue = oNode.nodeValue.replace(/@/g,' @');
} catch (e) {}
} catch (e) {}
}
if ( len >= o.maxTableRows ) {
// 已经处理完,清除时间ID
window.clearInterval( o.showBtChinaTimeId );
}
else {
o.rowsLength = len; // 保存已处理的行数
}
}
else if ( len > 0 && o.checkCount++ > 50 )
// 有数据并检查次数已超过50次还没传输完,清除时间ID
window.clearInterval( o.showBtChinaTimeId );
}
// ====================
var unsafeW = window.wrappedJSObject;

var pChecker = new pageChecker();

window.addEventListener('load', function(){pChecker.go()}, false);



// ======== end ========
Read more...

Next Page greasemonkey

使用左右方向键来翻页,→键下一页,←键上一页。
适用:英文和中文的大部分页面。
特点:简单、快速、占用资源少。
原理:是通过判断翻页链接的文字或图片信息来实现翻页。

若和页面原来的按键冲突,请到greasemonkey管理器里增加或删除相应的网址。

自定义翻页链接关键词:
在 工具 --> greasemonkey --> 用户脚本命令里,关键词之间用“,”或“,”分隔开,允许使用正则表达式,0.1.7.0版本起可以在关键词前面添加域名或网址(以花括弧“{}”括起 来,可以包含通配符“*”,不同网址使用相同的关键词,可以用“|”分隔网址)如使用 older, a\s+b,{*.readnovel.com}\S*下一页,{ww.xxxxx.com|*.yyyyy.cn}older page 等作为关键词。

-----------------------------------------------------------
firegestures 的自定义手势脚本(注意:手势起点必须在要翻页的页或帧里):

下一页代码:

try { var node = FireGestures.sourceNode; } catch (e) {}
while (node && node.nodeName != "BODY")
node = node.parentNode;
if (!node) node = getBrowser().contentDocument;
var e = document.createEvent("KeyboardEvent");
e.initKeyEvent("keydown", true, true, window, false, false, false, false, 39, 0);
node.dispatchEvent(e);

上一页代码:

try { var node = FireGestures.sourceNode; } catch (e) {}
while (node && node.nodeName != "BODY")
node = node.parentNode;
if (!node) node = getBrowser().contentDocument;
var e = document.createEvent("KeyboardEvent");
e.initKeyEvent("keydown", true, true, window, false, false, false, false, 37, 0);
node.dispatchEvent(e);

 

http://userscripts.org/scripts/show/27251


27251.user.js


// This is a greasemonkey script, for use with the Firefox extension Greasemonkey.
// More info: http://greasemonkey.mozdev.org/
//
// ==UserScript==
// @name Next Page
// @author Sunwan
// @version 0.1.7.3
// @namespace http://www.zjcnnj.cn/mozilla/greasemonkey/
// @description 使用左右方向键来翻页 [Ver 0.1.7.3]
// @include http://*
// @include https://*
// ==/UserScript==

(function() {
var checked = false;
var delay = false;
var next = {};
var previous = {};
// 下一页链接里的文字
next.texts = [ 'next',
'next page',
'old',
'older',
'earlier',
'下页',
'下頁',
'下一页',
'下一頁',
'后一页',
'后一頁',
'翻下页',
'翻下頁',
'后页',
'后頁',
'下翻',
'下一个',
'下一张',
'下一幅',
'下一节',
'下一章',
'下一篇',
'后一章',
'后一篇'
];
// 上一页链接里的文字
previous.texts = [ 'previous',
'prev',
'previous page',
'new',
'newer',
'later',
'上页',
'上頁',
'上一页',
'上一頁',
'前一页',
'前一頁',
'翻上页',
'翻上頁',
'前页',
'前頁',
'上翻',
'上一个',
'上一张',
'上一幅',
'上一节',
'上一章',
'上一篇',
'前一章',
'前一篇'
];
// 可能会误判的关键词
next.miswords = { "下一章": 30,
"下一篇": 30,
"后一章": 30,
"后一篇": 30,
"下一节": 30,
">>": 2000,
"»": 2000
}
previous.miswords = { "上一章": 30,
"上一篇": 30,
"前一章": 30,
"前一篇": 30,
"上一节": 30,
"<<": 2000,
"«": 2000
}

// 取得自定义关键词
getCustom(next, "next");
getCustom(previous, "previous");
// 注册脚本菜单
registerMenu("next");
registerMenu("previous");

// 最后添加一些论坛使用的翻页符号
next.texts.push(">>");
next.texts.push(">");
next.texts.push("»");
next.texts.push("›");
previous.texts.push("<<");
previous.texts.push("<");
previous.texts.push("«");
previous.texts.push("‹");

// 翻页文字的前面和后面可能包含的字符(正则表达式)
var preRegexp = '(^\\s*(?:[<‹«]*|[>›»]*|[\\(\\[『「[【]?)\\s*)';
var nextRegexp = '(\\s*(?:[>›»]*|[\\)\\]』」]】]?)\\s*$)';

// 取得并设置自定义关键词
function getCustom(aObj, key) {
var site, re;
var cKeyWords = GM_getValue("custom_" + key, "");
var words = cKeyWords.split(/,|,/);
for each (var w in words) {
site = null;
if (/^\s*{\s*(\S*?)\s*}(.*)$/.test(w)) {
site = RegExp.$1;
w = RegExp.$2;
site = site.replace(/[\/\?\.\(\)\+\-\[\]\$]/g, "\\$&").replace(/\*/g, "\.*");
}
w = w.replace(/\\/g, "\\").replace(/^\s+|\s+$/g, "");
if (w) {
if (site) {
re = eval('/' + site + '/i');
if (re.test(location.href))
aObj.texts.push(w);
}
else
aObj.texts.push(w);
}
}
}

// 注册菜单
function registerMenu(key) {
if (navigator.language == "zh-CN") {
var word = key == "next" ? "下一页" : "上一页";
GM_registerMenuCommand("Next Page " + word + "关键词", function(){setCustom(key, word)});
}
else {
GM_registerMenuCommand("Next Page custom_" + key, function(){setCustom(key, key)});
}
}

// 设置新的关键词
function setCustom(k, w) {
var text = navigator.language == "zh-CN" ? "请输入“"+w+"”的关键词,以“,”号分隔开。" : "Please enter the "+w+" page key-words, split with ','.";
var result = prompt(text, GM_getValue("custom_" + k, ""));
if (result != null) GM_setValue("custom_" + k, result);
}

function checkLinks() {
var link, text, ldnc, lnc, ldpc, lpc, num, digCurFound, linkNumber, found, tmpNode;
var regexp = new RegExp();
// 查找相应的链接
var links = document.getElementsByTagName('A');
for (var i = 0; i < links.length; i++) {
link = links[i];

// 跳过不起作用的链接
if (!link.offsetParent || link.offsetWidth == 0 || link.offsetHeight == 0 || !link.hasAttribute("href") && !link.hasAttribute("onclick"))
continue;
// 跳过日历
if (/(?:^|\s)(?:monthlink|weekday|day|day[\-_]\S+)(?:\s|$)/i.test(link.className))
continue;

if (/^nextlink/i.test(link.id) || /^linknext/i.test(link.id) ||
/(^|\s)nextlink/i.test(link.className) || /(^|\s)linknext/i.test(link.className))
next.link = link;
if (/^prev(ious)?link/i.test(link.id) || /^linkprev(ious)?/i.test(link.id) ||
/(^|\s)prev(ious)?link/i.test(link.className) || /(^|\s)linkprev(ious)?/i.test(link.className))
previous.link = link;

text = link.textContent;
if (!text) {
// 若链接中没有文字,则检查图片的alt属性、链接或图片的title
for each (var img in link.childNodes) {
if (img.localName == "IMG") {
text = img.alt || link.title || img.title;
if (text) break;
}
}
if (!text) continue;
}
text = text.toLowerCase().replace(/^\s+|\s+$/g, "");
if (!text) continue;

// 纯数字链接
if (isDigital(text)) {
if (digCurFound) continue;
linkNumber = parseInt(RegExp.$1);

// 检测下一个位置是否是当前页面的页数
if ((tmpNode = getCurrentPageNode(link, linkNumber, 1)) && tmpNode) {
digCurFound = true;
previous.link = link;
previous.found = true;
previous.pos = i;
// 再检测下下一个位置是否是“下一页”的链接
if (getNextLink(tmpNode, linkNumber+2, true))
break;
// 设置往后的30个位置以内为“下一页”的可能链接,以提高检测速度。
ldnc = i + 30;
}
// 检测上一个位置是否是当前页面的页数
else if (getCurrentPageNode(link, linkNumber, -1)) {
digCurFound = true;
next.link = link;
next.found = true;
next.pos = i;
ldpc = i + 30;
continue;
}
// 检测自身是否是当前页面的页数
else if (getCurrentPageNode(link, linkNumber, 0)) {
digCurFound = true;
// 再检测下一个位置是否是“下一页”的链接
if (getNextLink(link, linkNumber+1, true)) {
next.pos = i;
ldpc = i + 30;
continue;
}
// 设置往后的30个位置以内为“下一页”的可能链接,以提高检测速度。
ldnc = i + 30;
}
continue;
}
else {
found = false;
if (!next.found && !(lnc < i) && !(ldnc < i)) {
for (var j = 0; j < next.texts.length; j++) {
if (regexp.compile(preRegexp + next.texts[j] + nextRegexp, 'i').test(text)) {
// 检测到“下一页”的链接
found = true;
next.link = link;
num = next.miswords[next.texts[j]];
// 若“下一页”的词语有可能会误判时,最多再检测预定个数的链接。
(num == null) ? next.found = true : lnc = i + num;
break;
}
}
}
if (!next.digital && lnc < i) next.found = true;

if (!found && !previous.found && !(lpc < i) && !(ldpc < i)) {
for (var j = 0; j < previous.texts.length; j++) {
if (regexp.compile(preRegexp + previous.texts[j] + nextRegexp, 'i').test(text)) {
// 检测到“上一页”的链接
previous.link = link;
num = previous.miswords[previous.texts[j]];
// 若“上一页”的词语有可能会误判时,最多再检测预定个数的链接。
(num == null) ? previous.found = true : lpc = i + num;
break;
}
}
}
if (lpc < i) previous.found = true;
// 重新设置纯数字链接未被检查
digCurFound = null;
}

// 找到“上一页”和“下一页”的链接或找到其中一个而另一个超过规定范围没找到,将不再查找。
if (next.found && previous.found ||
next.found && i > next.pos + 30 ||
previous.found && i > previous.pos + 30)
break;
}
// 通过以上方法没有找到“下一页”的,把第一次检测出来的数字1的链接作为当前页,2作为“下一页”。
if (!next.found /*&& !next.link*/ && next.digital)
next.link = next.digital;

if (next.link) next.found = true;
if (previous.link) previous.found = true;

if (!next.found && !previous.found)
checkButtons();
}

// 检查翻页按钮
function checkButtons() {
var but, text, found;
var regexp = new RegExp();
var buts = document.getElementsByTagName('INPUT');
for (var i = 0; i < buts.length; i++) {
but = buts[i];
if (but.hasAttribute("disabled") || !(/^button$/i.test(but.type) && but.getAttribute("onclick"))) continue;

text = but.value;
found = false;
if (!next.found) {
for (var j = 0; j < next.texts.length; j++) {
if (regexp.compile(preRegexp + next.texts[j] + nextRegexp, 'i').test(text)) {
// 检测到“下一页”的按钮
next.link = but;
next.found = found = true;
break;
}
}
}

if (!found && !previous.found) {
for (var j = 0; j < previous.texts.length; j++) {
if (regexp.compile(preRegexp + previous.texts[j] + nextRegexp, 'i').test(text)) {
// 检测到“上一页”的按钮
previous.link = but;
previous.found = true;
break;
}
}
}
if (next.found && previous.found) break;
}
}

// 取得相邻的纯数字节点,type: 1 下一个;-1 上一个
function getSiblingNode(node, type) {
if (!node) return null;
node = getSibling(node, type);
while (node && (node.nodeName == "#coment" ||
(/^\s*[\]]】]?[,\|]?\s*[\[[【]?\s*$/.test(node.textContent))))
node = getSibling(node, type);
return node;
}
function getSibling(aNode, type) {
if (!aNode) return null;
if (isOnlyNode(aNode)) {
try {
aNode = (type == 1 ? aNode.parentNode.nextSibling : aNode.parentNode.previousSibling);
if (skipNode(aNode))
aNode = (type == 1 ? aNode.nextSibling : aNode.previousSibling);
aNode = aNode.childNodes[0];
if (skipNode(aNode))
aNode = aNode.nextSibling;
}
catch (e) {return null;}
}
else {
aNode = (type == 1 ? aNode.nextSibling : aNode.previousSibling);
}
return aNode;
}
function isOnlyNode(n) {
return !n.nextSibling && !n.previousSibling ||
!n.nextSibling && skipNode(n.previousSibling) && !n.previousSibling.previousSibling ||
!n.previousSibling && skipNode(n.nextSibling) && !n.nextSibling.nextSibling ||
skipNode(n.previousSibling) && !n.previousSibling.previousSibling &&
skipNode(n.nextSibling) && !n.nextSibling.nextSibling;
}
function skipNode(sNode) {
return sNode && /*sNode.nodeName == "#text" &&*/ (/^\s*$/.test(sNode.textContent));
}

// 检测是否有下一页的纯数字链接,number:页数
function getNextLink(node, number, set) {
var tNode = getSiblingNode(node, 1);
if (tNode && tNode.nodeName == "A" && isDigital(tNode.textContent)) {
if (RegExp.$1 == number) {
// 找到纯数字链接
if (set) {
next.link = tNode;
next.found = true;
}
return tNode;
}
}
return null;
}

function isDigital(str, t) {
str = str.replace(/^\s+|\s+$/g, "");
if (t == -1)
str = str.split(/\s+/).pop();
else if (t == 1)
str = str.split(/\s+/)[0];
return (/^(\d+)$/.test(str)) ||
(/^\[\s?(\d+)\s?\]$/.test(str)) ||
(/^【\s?(\d+)\s?】$/.test(str)) ||
(/^[\s?(\d+)\s?]$/.test(str)) ||
(/^<\s?(\d+)\s?>$/.test(str));
}

// 判断是否是当前页面的数字,type:-1,0,1 分别是要判别的上一个、当前、下一个节点
function getCurrentPageNode(node, linkNum, type) {
var tNode;
if (type == 0) {
tNode = getSiblingNode(node, 1) || getSiblingNode(node, -1);
if (!tNode) return null;
if (!node.hasAttribute("onclick") && node.href != tNode.href &&
(!node.hasAttribute("href") && isDigital(node.textContent, type) ||
!(/\/#[^\/]+$/.test(node.href)) && node.href == location.href && isDigital(node.textContent, type))) {
if (linkNum > 0 && RegExp.$1 == linkNum) return node;
}
// 某些论坛处在第一页时,实际链接和当前页链接不符,只有和其余纯数字链接的结构或颜色不同时,
// 才使用纯数字的“2”作为“下一页”的链接。
else if (!next.digital && (/^\s*[\[[【]?1[\]]】]?\s*$/.test(node.textContent))) {
var two = getNextLink(node, 2);
if (two && difDigital(node, two))
next.digital = two;
}
}
else {
tNode = getSiblingNode(node, type);
if (!tNode) return null;
if (tNode.nodeName != "A" && isDigital(tNode.textContent, type) ||
tNode.nodeName == "A" && !tNode.hasAttribute("onclick") && node.href != tNode.href &&
(!tNode.hasAttribute("href") && isDigital(tNode.textContent, type) ||
!(/\/#[^\/]+$/.test(tNode.href)) && tNode.href == location.href && isDigital(tNode.textContent, type))) {
var n = linkNum + type;
if (n > 0 && RegExp.$1 == n) {
if (next.digital) next.digital = null;
return tNode;
}
}
}
return null;
}

function difDigital(node1, node2) {
if (getStructure(node1) == getStructure(node2) && getStyleColor(node1) == getStyleColor(node2))
return false;
return true;
}
function getStructure(aNode) {
return aNode.innerHTML.replace(/\d+/, "");
}
function getStyleColor(aNode) {
return document.defaultView.getComputedStyle(aNode, null).getPropertyValue("color");
}

function openLink(linkNode) {
if (!linkNode) return;
var hf = linkNode.getAttribute("href");
if (!linkNode.hasAttribute("onclick") && hf && !(/^#/.test(hf)) && linkNode.href != location.href) {
cleanVars();
location.assign(linkNode.href);
}
else {
// 有些4D鼠标摆动一下滚轮会触发多下的方向键,故增设一个延迟参数,使它只翻一页。
delay = true;
setTimeout(cleanVars, 300);
var e = document.createEvent("MouseEvents");
e.initMouseEvent("click", 1, 1, window, 1, 0,0,0,0,0,0,0,0,0, linkNode);
linkNode.dispatchEvent(e);
}
}
function cleanVars() {
try {
checked = false;
delay = false;
next.link = next.found = next.digital = null;
previous.link = previous.found = previous.digital = null;
delete next.pos;
delete previous.pos;
} catch(e) {}
}

function onKeyDown(event) {
// 不是左右方向建被按下或不到延迟时间则退出
if (event.ctrlKey || event.shiftKey || event.altKey || event.metaKey || event.keyCode != 37 && event.keyCode != 39 || delay)
return

// 确保光标不是定位在文字输入框或选择框
var localName = event.target.localName;
if (localName == 'TEXTAREA' || localName == 'INPUT' || localName == 'SELECT')
return;

// 检查过且没有发现上一页或下一页的连接,则退出
if (checked && !next.found && !previous.found)
return;

if (!checked) {
checkLinks();
checked = true;
}

if (event.keyCode == 37 && previous.found) {
// 左方向键,跳到“上一页”
openLink(previous.link)
}
else if (event.keyCode == 39 && next.found) {
// 右方向键,跳到“下一页”
openLink(next.link)
}
}

window.addEventListener("keydown", function(e){onKeyDown(e)}, true);


})();
Read more...

管理用户(user)(group)的工具或命令

1)管理用户(user)的工具或命令;

useradd    注:添加用户
adduser    注:添加用户
passwd     注:为用户设置密码
usermod  注:修改用户命令,可以通过usermod 来修改登录名、用户的家目录等等;
pwcov       注:同步用户从/etc/passwd 到/etc/shadow
pwck         注:pwck是校验用户配置文件/etc/passwd 和/etc/shadow 文件内容是否合法或完整;
pwunconv  注:是pwcov 的立逆向操作,是从/etc/shadow和 /etc/passwd 创建/etc/passwd ,然后会删除 /etc/shadow 文件;
finger        注:查看用户信息工具
id              注:查看用户的UID、GID及所归属的用户组
chfn          注:更改用户信息工具
su             注:用户切换工具
sudo         注:sudo 是通过另一个用户来执行命令(execute a command as another user),su 是用来切换用户,然后通过切换到的用户来完成相应的任务,但sudo 能后面直接执行命令,比如sudo 不需要root 密码就可以执行root 赋与的执行只有root才能执行相应的命令;但得通过visudo 来编辑/etc/sudoers来实现;
visudo      注:visodo 是编辑 /etc/sudoers 的命令;也可以不用这个命令,直接用vi 来编辑 /etc/sudoers 的效果是一样的;
sudoedit  注:和sudo 功能差不多;



2)管理用户组(group)的工具或命令;

groupadd  注:添加用户组;
groupdel         注:删除用户组;
groupmod        注:修改用户组信息
groups     注:显示用户所属的用户组
grpck
grpconv   注:通过/etc/group和/etc/gshadow 的文件内容来同步或创建/etc/gshadow ,如果/etc/gshadow 不存在则创建;
grpunconv   注:通过/etc/group 和/etc/gshadow 文件内容来同步或创建/etc/group ,然后删除gshadow文件;
Read more...

centos vsftp 配置

CentOS 5.3建立Vsftpd虚拟用户

我们登录FTP有三种方式,匿名登录、本地用户登录和虚拟用户登录。

匿名登录:在登录FTP时使用默认的用户名,一般是ftp或anonymous。

本地用户登录:使用系统用户登录,在/etc/passwd中。

虚拟用户登录:这是FTP专有用户,有两种方式实现虚拟用户,本地数据文件和数据库服务器。

FTP虚拟用户是FTP服务器的专有用户,使用虚拟用户登录FTP,只能访问FTP服务器提供的资源,大大增强了系统的安全。

本文的Linux系统是CentOS 5.3

yum -y install vsftpd

一、建立Vsftpd虚拟用户:

1、添加虚拟用户口令文件安装Vsftpd

[root@localhost ~]#vi /etc/vsftpd/vftpuser.txt

添加虚拟用户名和密码,一行用户名,一行密码,以此类推。奇数行为用户名,偶数行为密码。

ftp1 #用户名

123456 #密码

ftp2 #用户名

123456 #密码

''这里有个问题,我在创建的时候,在后面的build过程中出现过如下出错提示:
db_load: unexpected end of input data or key/data pair
db_load: odd number of key/data pairs

原因大概是在ftpUserInfo.txt最后需要再加个回车,加回车后,就没问题了,在图形界面的文本编辑器保存默认也会添加一个回车,所以,如果是在图形界面的文本编辑器下直接生成的,不会出现该错误.''

 

2、生成虚拟用户口令认证文件

将刚添加的vftpuser.txt虚拟用户口令文件转换成系统识别的口令认证文件。

 

#####################################################################################

首先查看系统有没有安装生成口令认证文件所需的软件db4-utils。

下面使用db_load命令生成虚拟用户口令认证文件。

[root@localhost ~]# db_load -T -t hash -f /home/vuser.txt /etc/vsftpd_login.db (命令在下面 这是演示)

-bash: db_load: command not found

#####################################################################################

出现没有db_load的提示是因为有些db4的包没有安装,需要安装下列包:

db4-*.rpm

db4-tcl-*.rpm

db4-utils-*.rpm

或者直接: yum -y install db4 db4-tcl db4-utils

db_load命令主要是用来生成db数据库使用的

格式:

db_load -T -t hash -f passwd.txt /etc/vsftpd/user_passwd.db

生成一个hash码型的数据库文件供ftp虚拟用户使用。

#####################################################################################

 

 

[root@localhost ~]#db_load -T -t hash -f /etc/vsftpd/vftpuser.txt

/etc/vsftpd/vftpuser.db

3、编辑vsftpd的PAM认证文件

在/etc/pam.d目录下,

[root@localhost ~]#vi /etc/pam.d/vsftpd

将里面其他的都注释掉,添加下面这两行:

auth required /lib/security/pam_userdb.so db=/etc/vsftpd/vftpuser

account required /lib/security/pam_userdb.so db=/etc/vsftpd/vftpuser

4、建立本地映射用户并设置宿主目录权限

所有的FTP虚拟用户需要使用一个系统用户,这个系统用户不需要密码。

[root@localhost ~]#useradd -d /home/vftpsite -s /sbin/nologin vftpuser

[root@localhost ~]#chmod 755 /home/vftpsite //网上为700,设置为700后FTP用户无上传权限

5、配置vsftpd.conf(设置虚拟用户配置项)

[root@localhost ~]#vi /etc/vsftpd/vsftpd.conf

guest_enable=YES #开启虚拟用户

guest_username=vftpuser #FTP虚拟用户对应的系统用户[useradd -d /home/vftpsite -s

/sbin/nologin vftpuser]

pam_service_name=vsftpd #PAM认证文件

6、重启vsftpd服务

[root@localhost ~]#service vsftpd restart

7、测试虚拟用户登录FTP

C:\Documents and Settings\Administrator>ftp 192.168.2.12

Connected to 192.168.2.12.

220 (vsFTPd 2.0.5)

User (192.168.2.12:(none)): ftp1

331 Please specify the password.

Password:

500 OOPS: cannot change directory:/home/vftpsiteConnection closed by remote host

.//在配置vsftpd的时候连接vsftpd出现了500 OOPS: cannot change directory:/home/vftpsite

的错误,vftpsite为登录时使用的本地用户名。

解决办法:

[root@localhost ~]# setsebool -P ftp_home_dir on

也有网上说在终端输入命令:

setsebool -P ftpd_disable_trans 1

service vsftpd restart

就OK了!

测试:

C:\Documents and Settings\Administrator>ftp 192.168.2.12

Connected to 192.168.2.12.

220 (vsFTPd 2.0.5)

User (192.168.2.12:(none)): ftp1

331 Please specify the password.

Password:

230 Login successful.

二、虚拟用户高级设置:

1、virtual_use_local_privs参数

当virtual_use_local_privs=YES时,虚拟用户和本地用户有相同的权限;

当virtual_use_local_privs=NO时,虚拟用户和匿名用户有相同的权限,默认是NO。

当virtual_use_local_privs=YES,write_enable=YES时,虚拟用户具有写权限(上传、下载、删除

、重命名)。

当virtual_use_local_privs=NO,write_enable=YES,anon_world_readable_only=YES,

anon_upload_enable=YES时,虚拟用户不能浏览目录,只能上传文件,无其他权限。

当virtual_use_local_privs=NO,write_enable=YES,anon_world_readable_only=NO,

anon_upload_enable=NO时,虚拟用户只能下载文件,无其他权限。

当virtual_use_local_privs=NO,write_enable=YES,anon_world_readable_only=NO,

anon_upload_enable=YES时,虚拟用户只能上传和下载文件,无其他权限。

当virtual_use_local_privs=NO,write_enable=YES,anon_world_readable_only=NO,

anon_mkdir_write_enable=YES时,虚拟用户只能下载文件和创建文件夹,无其他权限。

当virtual_use_local_privs=NO,write_enable=YES,anon_world_readable_only=NO,

anon_other_write_enable=YES时,虚拟用户只能下载、删除和重命名文件,无其他权限。

2. 建立各个虚拟用户自身的配置文件

[root@localhost ~]#vi /etc/vsftpd/vsftpd.conf

添加:

user_config_dir=/etc/vsftpd/vsftpd_user_conf

[root@localhost ~]#mkdir /etc/vsftpd/vsftpd_user_conf

编辑ftp1的配置文件

[root@localhost ~]#vi /etc/vsftpd/vsftpd_user_conf/ftp1

添加:

anon_world_readable_only=NO #开放ftp1的下载权限(只能下载)。注意这个地方千万不能写成YES

,否则ftp1将不能列出文件和目录。

编辑ftp2的配置文件

[root@localhost ~]#vi /etc/vsftpd/vsftpd_user_conf/ftp2

添加:

write_enable=YES #开放ftp2的写权限

anon_world_readable_only=NO #开放ftp2的下载权限

anon_upload_enable=YES #开放ftp2的上传权限

anon_mkdir_write_enable=YES #开放ftp2创建目录的权限

anon_other_write_enable=YES #开放ftp2删除和重命名的权限

3、所有虚拟用户使用一般配置

[root@localhost ~]#vi /etc/vsftpd/vsftpd.conf

write_enable=YES

anonymous_enable=NO

local_enable=YES

guest_enable=YES

guest_username=vftpuser

virtual_use_local_privs=NO

pam_service_name=vsftpd

anon_world_readable_only=NO #可以下载

anon_upload_enable=NO(默认值) #不能上传

anon_mkdir_write_enable=NO(默认值) #不能新建文件夹

anon_other_write_enable=NO(默认值) #不能删除和重命名文件

ftpd_banner=Welcome to yoozhu FTP server

xferlog_enable=YES

xferlog_file=/var/log/vsftpd.log

xferlog_std_format=YES

ascii_upload_enable=YES

ascii_download_enable=YES

tcp_wrappers=NO

setproctitle_enable=YES

listen_port=21

connect_from_port_20=YES

idle_session_timeout=600

data_connection_timeout=120

max_clients=0

max_per_ip=3

local_max_rate=512000

4、各个虚拟用户使用自身配置

[root@localhost ~]#vi /etc/vsftpd/vsftpd.conf

write_enable=YES

anonymous_enable=NO

local_enable=YES

guest_enable=YES

guest_username=vftpuser

virtual_use_local_privs=NO

pam_service_name=vsftpd

user_config_dir=/etc/vsftpd/vsftpd_user_conf #设定用户配置文件存放目录

ftpd_banner=Welcome to yoozhu FTP server

xferlog_enable=YES

xferlog_file=/var/log/vsftpd.log

xferlog_std_format=YES

ascii_upload_enable=YES

ascii_download_enable=YES

tcp_wrappers=NO

setproctitle_enable=YES

listen_port=21

connect_from_port_20=YES

idle_session_timeout=600

data_connection_timeout=120

max_clients=0

max_per_ip=3

local_max_rate=512000

[root@localhost ~]#mkdir /etc/vsftpd/vsftpd_user_conf

编辑ftp1的配置文件

[root@localhost ~]#vi /etc/vsftpd/vsftpd_user_conf/ftp1

anon_world_readable_only=NO

编辑ftp2的配置文件

[root@CentOS5 /]#vi /etc/vsftpd/vsftpd_user_conf/ftp2

anon_world_readable_only=NO

anon_upload_enable=YES

anon_mkdir_write_enable=YES

anon_other_write_enable=YES

参考Blog:

http://yuanbin.blog.51cto.com/363003/129071

http://blog.163.com/mike_homis/blog/static/20104948200951614143913/

 

引用自 http://yoozhu.com/?p=1469=1

Read more...
Subscribe to this RSS feed
Notice: Undefined offset: 1 in /var/www/vhosts/shan.info/httpdocs/templates/gk_publisher/html/pagination.php on line 18

Notice: Undefined offset: 1 in /var/www/vhosts/shan.info/httpdocs/templates/gk_publisher/html/pagination.php on line 34

Notice: Undefined offset: 2 in /var/www/vhosts/shan.info/httpdocs/templates/gk_publisher/html/pagination.php on line 34

Notice: Undefined offset: 3 in /var/www/vhosts/shan.info/httpdocs/templates/gk_publisher/html/pagination.php on line 34

Warning: count(): Parameter must be an array or an object that implements Countable in /var/www/vhosts/shan.info/httpdocs/templates/gk_publisher/html/com_k2/templates/default/category.php on line 191

Notice: Undefined offset: 1 in /var/www/vhosts/shan.info/httpdocs/templates/gk_publisher/html/pagination.php on line 18

Notice: Undefined offset: 1 in /var/www/vhosts/shan.info/httpdocs/templates/gk_publisher/html/pagination.php on line 34

Notice: Undefined offset: 2 in /var/www/vhosts/shan.info/httpdocs/templates/gk_publisher/html/pagination.php on line 34

Notice: Undefined offset: 3 in /var/www/vhosts/shan.info/httpdocs/templates/gk_publisher/html/pagination.php on line 34