自动修改签名脚本,有码,不解释
9211
- wusir2011-12-02金牌会员31805
下载
http://mail.bccto.me/updateSignature.user.js
chrome下测试可行,FF未试- // ==UserScript==- // @name Automatic update signature
- // @description 自动更新签名
- // @author wusir
- // @include http://www.hostloc.com/*
- // @version 2.1
- // ==/UserScript==
- - (function(){
- var href = window.location.href;
- - function matchNode(xpath, context)
- {
- return document.evaluate(context?(xpath.indexOf('.')==0?xpath:'.' + xpath):xpath, context || document, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);
- }
- - if (!this.GM_getValue || (this.GM_getValue.toString && this.GM_getValue.toString().indexOf("not supported")>-1))
- {
- this.GM_getValue = function (key,def) {
- return localStorage || def;
- };
- this.GM_setValue = function (key,value) {
- return localStorage=value;
- };
- this.GM_deleteValue = function (key) {
- return delete localStorage;
- };
- }
- - var updateTime = GM_getValue('updateTime',new Date().getTime());//最后更新时间
- var intervalTime = 5601000;//更新间隔时间
- var nowTime = new Date().getTime();//现在时间
- - var memcp = "http://www.hostloc.com/memcp.php?action=profile&typeid=4";
- var formhash = '';
- var urlavatar = '';
- var bionew = '';
- var biotradnew = '';
- var signaturenew = '';
- var signature = new Array();
- signature[0] = '10分钟邮箱:BccTo.Me';
- signature[1] = '广告位出租';
- signature[2] = '自动签名1';
- signature[3] = '自动签名2';
- signature[4] = '自动签名3';
- GM_log('updateTime:' + updateTime);
- GM_log('nowTime:' + nowTime);
- if(nowTime - updateTime >= intervalTime)
- {
- GM_log('nowTime - updateTime = ' + (nowTime - updateTime));
- updateSignature();
- }
- else
- {
- var time = intervalTime - (nowTime - updateTime);
- GM_log('Time=' + time);
- if(time (.+?)/))
- bionew = tm[1];
- if(tm = text.match(/(.+?)/))
- biotradnew = tm[1];
- if(tm = text.match(/(.+?)/))
- signaturenew = tm[1];
- var signnew = signature[0];
- for(var i = 0; i = signature.length)
- signnew = signature[0];
- else
- signnew = signature[i + 1];
- break;
- }
- }
- var datastr = "formhash=" + formhash + "&urlavatar=" + urlavatar + "&bionew=" + bionew + "&biotradnew=" + biotradnew + "&signaturenew=" + signnew + "&editsubmit=true";
- GM_log('str:' + datastr);
- GM_xmlhttpRequest({
- method: "POST",
- url: memcp,
- data: datastr,
- headers: {'Content-type': 'application/x-www-form-urlencoded'},
- onload: function(resp) {
- var text = resp.responseText;
- GM_log('update successfully');
- if(text.indexOf('个人资料已成功保存') > -1)
- GM_setValue('updateTime',new Date().getTime());
- setTimeout(updateSignature, intervalTime);
- }
- });
- }
- }
- },
- onerror: function(){
- return;
- }
- });
- }
- })();
- 复制代码