標籤
.net
(
17
)
工作
(
29
)
面試
(
2
)
筆記
(
2
)
筆記倉庫
(
1
)
嘸蝦米
(
2
)
繪圖
(
1
)
Add-on
(
4
)
Android
(
39
)
AngularJS
(
1
)
ASP.NET
(
14
)
AutoHotKey
(
20
)
AutoIt
(
3
)
batch
(
24
)
Blogger Hack
(
3
)
Bookmarklet
(
18
)
C#
(
16
)
Chrome
(
1
)
cmd
(
22
)
CSS
(
6
)
CSS3
(
6
)
D855
(
1
)
DOM
(
17
)
DragOnIt
(
5
)
EmEditor
(
1
)
English
(
1
)
ffmpeg
(
1
)
Firefox
(
25
)
flo
(
2
)
GIMP
(
1
)
gist
(
144
)
Graphviz
(
1
)
hardware
(
1
)
HDD
(
1
)
HTML5
(
4
)
i18n
(
1
)
IIS
(
4
)
ImageMagick
(
5
)
Java
(
1
)
JavaScript
(
92
)
jhead
(
1
)
jQuery
(
6
)
JSBin
(
19
)
jsFiddle
(
4
)
JSON
(
1
)
JustDoubleClick
(
1
)
Kindle
(
1
)
MSSQL
(
26
)
MySQL
(
2
)
Network
(
1
)
node.js
(
12
)
php
(
1
)
PowerShell
(
6
)
ramdisk
(
1
)
Reg
(
3
)
RegExp
(
3
)
rpi3
(
3
)
SJ2000
(
1
)
SQLite
(
3
)
SSD
(
1
)
Stylish
(
1
)
SublimeText
(
2
)
tips
(
6
)
userChrome.js
(
3
)
userscript
(
40
)
VB.net
(
9
)
VBScript
(
2
)
VisualStudio
(
2
)
Vue.js
(
3
)
Win
(
5
)
Win2008
(
1
)
Win7
(
29
)
WinAPI
(
1
)
Winform
(
1
)
WinXP
(
3
)
XML
(
1
)
Overwrite Ajax Request
標籤:
JavaScript
,
userscript
javascript - How can I intercept XMLHttpRequests from a Greasemonkey script? - Stack Overflow XMLHttpRequest.readyState - Web APIs | MDN
f12.wretch.yimg
標籤:
userscript
因為之前開發的Give Me Bigger吃鱉了,抓不到f12.wretch.yimg原圖
故開發本腳本 ,先用XMLHttpRequest解決之,爾後再看看有無好辦法
故開發本腳本 ,先用XMLHttpRequest解決之,爾後再看看有無好辦法
// ==UserScript==
// @name f12.wretch.yimg
// @description 顯示原圖、開新分頁
// @author NKid
// @version 2012-06-24
// @include http://www.wretch.cc/album/album.php?id=*&book=*
// ==/UserScript==
GM_registerMenuCommand('f12.wretch.yimg - Setting width of images', settingImgWidth);
var oriTitle=document.title; //原始標題
function getDocFromXHR(url) {
var xmlHttp = new XMLHttpRequest();
xmlHttp.open("GET", url, false);
xmlHttp.send(null);
return new DOMParser().parseFromString(xmlHttp.responseText,"text/html");
}
//Setting width of images
function settingImgWidth() {
var oldIW=GM_getValue('imgwidth')||240; //(Default Value:240)
GM_setValue('imgwidth', prompt('Please Enter the width(px) of images.', oldIW));
}
function APEvent() {
var untreatedImgs=document.querySelectorAll("td.side a img[src*='thumbs/t']"); //尚未處理的圖片
document.title= "AutoPagerize Working";
for(var i=0;i<untreatedImgs.length;i++)
{
untreatedImgs[i].parentNode.target="_blank";
var doc=getDocFromXHR(untreatedImgs[i].parentNode.href);
var paraF=/f=(\d*)&/.exec(untreatedImgs[i].parentNode.href)[1];
if (doc.getElementById("DisplayImage"))
untreatedImgs[i].src=doc.getElementById("DisplayImage").src;
else if (doc.querySelector("img[src*='"+ paraF +"']"))
untreatedImgs[i].src=doc.querySelector("img[src*='"+ paraF +"']").src;
}
document.title=oriTitle;
}
function main() {
var picLinks=document.querySelectorAll("td.side a"); //圖片超連結
var totalImgLength=picLinks.length; //圖片總數
var imgWidth=parseInt(GM_getValue('imgwidth')||240,10) //圖片寬度
GM_addStyle('td.side img{max-width:@imgwidthpx}'.replace('@imgwidth',imgWidth));
for(var i=0;i<picLinks.length;i++)
{
picLinks[i].target="_blank";
var doc=getDocFromXHR(picLinks[i].href);
var paraF=/f=(\d*)&/.exec(picLinks[i].href)[1];
if (doc.getElementById("DisplayImage"))
picLinks[i].children[0].src=doc.getElementById("DisplayImage").src;
else if (doc.querySelector("img[src*='"+ paraF +"']"))
picLinks[i].children[0].src=doc.querySelector("img[src*='"+ paraF +"']").src;
document.title= (i+1) + " / " + totalImgLength;
}
document.title=oriTitle;
window.addEventListener("AutoPagerize_DOMNodeInserted",APEvent,false);
}
main();
EZ Recorder
標籤:
userscript
// ==UserScript==
// @name EZ Recorder [ExampleSite]
// @description 簡易記錄已讀主題
// @author NKid
// @version 2012-06-22
// @run-at document-end
// @include http://ExampleSite.net*
// ==/UserScript==
GM_addStyle('.GM_recorded {background-color:#00A9D8 !important;}');
GM_registerMenuCommand('EZ Recorder [ExampleSite] - Clear Records ',clearRecord);
var siteName="ExampleSite";
var titleSelector="h2.entry-title a";
function clearRecord() {
if (confirm('Do you want to clear the record?'))
{
window.localStorage.removeItem(siteName);
GM_notification('Clear The Record Of This Site.',null);
}
}
function titleClick(event) {
//記錄主題id並上色
event.preventDefault();
event.target.className="GM_recorded";
localStorage.setItem(siteName,event.target.href);
GM_notification('Recorded.',null);
}
//trigger設定事件
function setTitleClickEvent() {
var titles=document.querySelectorAll(titleSelector);
for(var i=0;i<titles.length;i++)
titles[i].addEventListener('click',titleClick,false);
}
function markThisPage() {
if (localStorage.getItem(siteName) != null)
{
var record=localStorage.getItem(siteName);
var titles=document.querySelectorAll(titleSelector);
for(var i=0;i<titles.length;i++)
if (record ==titles[i].href) titles[i].className="GM_recorded";
}
}
function showRecord() {
prompt("The record of this site.",localStorage.getItem(siteName));
}
setTitleClickEvent();
markThisPage();
FDZ Thread Recorder
標籤:
userscript
// ==UserScript==
// @name FDZ Thread Recorder
// @description 記錄已讀主題
// @author nightkid@FDZ
// @version 2012-05-25
// @run-at document-end
// @include http://forum.fdzone.org/forumdisplay.php?fid=*
// @include http://forum.*.fdzone.org/forumdisplay.php?fid=*
// @include http://pro.fdzone.org/forumdisplay.php?fid=*
// @include http://pro.*.fdzone.org/forumdisplay.php?fid=*
// ==/UserScript==
GM_addStyle('#GM_recordBtn {-moz-border-radius: 3px; background-color: #006699; color: #000000; cursor: pointer; font-size: 10px; height: 15px; position: fixed; right: 20px; top: 3px; width: 15px;}');
GM_addStyle('.GM_recorded td, .GM_recorded th {background-color:#006699 !important;}');
GM_registerMenuCommand('FDZ Thread Recorder - Show All Records',showAllRecords);
GM_registerMenuCommand('FDZ Thread Recorder - Clear Records Of This Forum',clearThisForum);
GM_registerMenuCommand('FDZ Thread Recorder - Remove Repetition',removeRepetition);
var removeStr=new RegExp ("(stick|normal)thread_","g");
var fid=location.href.replace(/.*fid=(\d{1,3}).*/,'$1'); //子區塊編號
function clearThisForum() {
if (confirm('Do you want to clear this forum?'))
{
window.localStorage.removeItem(fid);
GM_notification('Clear Records Of This Forum.',null);
}
}
function recordBtn() {
var btn = document.createElement("div");
btn.id="GM_recordBtn";
btn.title="Record all threads of this page.";
btn.accessKey="A";
document.getElementsByTagName("body")[0].appendChild(btn);
document.getElementById('GM_recordBtn').addEventListener('click',function(){ recordThisPage();},false);
}
function recordThisPage() {
var uids=document.querySelectorAll("tbody[id*=thread_]");
var tmp=[];
for(var i=0;uids[i];i++)
tmp.push(uids[i].id.replace(removeStr,""));
localStorage.setItem(fid, tmp.join() + checkNull(localStorage.getItem(fid)));
markThisPage();
removeRepetition();
}
function setThread(event) {
//記錄主題id並上色
//em → th → tr → tbody
var tidEle=document.getElementById(event.target.parentNode.parentNode.parentNode.id);
localStorage.setItem(fid, tidEle.id.replace(removeStr,"") + checkNull(localStorage.getItem(fid)));
tidEle.className="GM_recorded";
GM_notification('Recorded.',null);
}
//trigger設定事件
function setThreadEvent() {
var t=document.querySelectorAll('tbody[id] >tr > th > em');
for(var i=0;i < t.length;i++)
{
t[i].addEventListener('click',setThread,false);
t[i].style.cursor='pointer';
}
}
function removeRepetition() {
if (localStorage.getItem(fid) != null)
{
var allRecords=localStorage.getItem(fid).split(",");
var tmp=[];
for(var i=0;i < allRecords[i];i++)
{
var tmpRegx=new RegExp(allRecords[i],"g");
if (!( tmpRegx.test(tmp)))
tmp.push(allRecords[i]);
}
localStorage.setItem(fid,tmp.join());
GM_notification("Delete " + (allRecords.length - tmp.length) + " Repetition(s)");
}
}
function markThisPage() {
if (localStorage.getItem(fid) != null)
{
var allRecords=localStorage.getItem(fid);
var uids=document.querySelectorAll("tbody[id*=thread_]");
for(var i=0;uids[i];i++)
if (allRecords.indexOf(uids[i].id.replace(removeStr,"")) != -1)
uids[i].className="GM_recorded";
}
}
function showAllRecords() {
console.log(localStorage);
}
function checkNull() {
return (arguments[0] == null)?"":("," + arguments[0].split(","));
}
/*function delAllRecords() {
localStorage.clear();
GM_notification('Delete all records.');
}*/
setThreadEvent();
recordBtn();
markThisPage();
M01 文章內容限閱提示
標籤:
userscript
// ==UserScript==
// @name M01 Content Restrict
// @description M01 Content Restrict
// @include http://www.mobile01.com/forumcontentrestrict.php?f=*
// @include http://www.mobile01.com/forumcontentrestrict.php?f=*
// ==/UserScript==
document.querySelector("input[value=confirm]").checked=true;
document.getElementById("confirm_form").submit();
文章內容限閱提示 - Mobile01
Record Thread HTML5
標籤:
userscript
// ==UserScript==
// @name Record Thread HTML5
// @description 標記閱讀文章
// @run-at document-end
// @author NKid
// @version 2011-07-08
// @include http://forum.*.fdzone.org/forumdisplay.php?fid=*&orderby=dateline*
// @include http://forum.fdzone.org/forumdisplay.php?fid=*&orderby=dateline*
// @include http://pro.fdzone.org/forumdisplay.php?fid=*&orderby=dateline*
// @include http://pro.fdzone.org/forumdisplay.php?fid=*&filter=subject#by
// ==/UserScript==
GM_addStyle('.GM_RecordThread {background-color:#006699 !important;}');
GM_registerMenuCommand('Record Thread HTML5 - [Clear Record] This Forum',clearThisForum);
GM_registerMenuCommand('Record Thread HTML5 - [Clear Record] All Forums',clearAllForums);
GM_registerMenuCommand('Record Thread HTML5 - [Sync] Upload Records',syncUpload);
GM_registerMenuCommand('Record Thread HTML5 - [Sync] Download Records',syncDownload);
GM_registerMenuCommand('Record Thread HTML5 - [Show] All Records',showAllRecords);
GM_registerMenuCommand('Record Thread HTML5 - TEST Upload Json',testUploadJson);
GM_registerMenuCommand('Record Thread HTML5 - TEST Download Json',testDownloadJson);
var fid=location.href.replace(/.*fid=(\d{1,3}).*/,'$1'); //子區塊編號
var serverIP=['140.127.22.228','140.127.22.219'];
function testUploadJson() {
var strRecords='';
for(var i=0;i<localStorage.length;i++)
strRecords+=',{"tid":"' + localStorage.key(i) + '" , "fid":"' + localStorage.getItem(localStorage.key(i)) + '"}';
var json='{"timestamp": "@timestamp","records": [@records]}';
json=json.replace('@timestamp',localStorage.getItem('timestamp'));
json=json.replace('@records',strRecords.substring(1));
GM_xmlhttpRequest({
method: "POST",
url: "http://140.127.22.228/RecordThread/RecordThread.ashx",
data: json,
headers: {"Content-Type": "application/x-www-form-urlencoded","a":"testUploadJson","h":location.hostname},
onload: function(response) {GM_notification('Done.',null);}
});
}
function testDownloadJson() {
GM_xmlhttpRequest({
method: "POST",
url: "http://140.127.22.228/RecordThread/RecordThread.ashx",
data: null,
headers: {"Content-Type": "application/x-www-form-urlencoded","a":"testDownloadJson","h":location.hostname},
onload: function(response) {
var j=JSON.parse(response.responseText);
alert(j.timestamp);
}
});
}
function showAllRecords() {
var str='';
for(var i=0;i<localStorage.length;i++)
str+=localStorage.key(i) + ' : ' + localStorage.getItem(localStorage.key(i)) + '\n';
( str== '')?alert('No Records'):alert(str.replace(/\n$/,''));
}
function chooseIP() { return serverIP[prompt('[0]140.127.22.228\n[1]140.127.22.219')];}
function syncDownload() {
GM_xmlhttpRequest({
method: "POST",
url: "http://" + chooseIP() + "/RecordThread/RecordThread.ashx",
data: null,
headers: {"Content-Type": "application/x-www-form-urlencoded","a":"download","h":location.hostname},
onload: function(response) {
//console.log(response.responseText.split('\n'))
//GM_notification('Donwloaded Record.',null);
if (confirm('Do you want to replace the original records of \"' + location.hostname + '\" ?'))
{
window.localStorage.clear();
var newRecords=response.responseText.split('\n');
for(var i=0;i<newRecords.length;i++)
{
var red=newRecords[i].split(':');
window.localStorage.setItem(red[0],red[1]);
}
GM_notification('Donwloaded Records.',null);
}
}
});
}
function syncUpload() {
if (confirm('Do you want to upload all records of \"' + location.hostname +'\" ?'))
{
var records=new Array();
for(var i=0;i<localStorage.length;i++)
records.push(localStorage.key(i) + '=' + localStorage.getItem(localStorage.key(i)));
GM_xmlhttpRequest({
method: "POST",
url: "http://" + chooseIP() + "/RecordThread/RecordThread.ashx",
data: records.join('&'),
headers: {"Content-Type": "application/x-www-form-urlencoded","a":"upload","h":location.hostname},
onload: function(response) {GM_notification(response.responseText,null);}
});
}
}
function clearThisForum() {
if (confirm('Do you want to clear this forum?'))
{
window.localStorage.removeItem(fid);
GM_notification('Clear Record This Forum.',null);
}
}
function clearAllForums() {
if (confirm('Do you want to clear all forums?'))
{
window.localStorage.clear();
GM_notification('Clear Record All Forum.',null);
}
}
//上色
function markThread(eles) {
for(var i=0;i<eles.length;i++)
eles[i].className='GM_RecordThread';
}
//取得文章編號
function getThread() {
var tid=window.localStorage.getItem(fid);
//尚無記錄
if (tid == null)
{ GM_notification('No Record.',null); }
else ///有記錄
{
//在本頁
if (document.getElementById(tid))
{
GM_notification('Found in this page.',null);
var allEles=document.querySelectorAll('#'+ tid+ ' > tr > :nth-child(n)');
markThread(allEles)
}
else //不在本頁
{
GM_notification('Found, but not in this page.',null);
}
}
}
//設定文章編號
function setThread(event) {
//清掉舊主題的上色
var allEles=document.getElementsByClassName('GM_RecordThread');
var len=allEles.length
for(var i=0;i<len;i++)
allEles[0].className='';
//記錄主題id並上色
//em → th → tr → tbody
var tidEle=document.getElementById(event.target.parentNode.parentNode.parentNode.id);
window.localStorage.setItem(fid,tidEle.id);
var allEles=tidEle.querySelectorAll('tr > :nth-child(n)');
markThread(allEles);
GM_notification('Saved.',null);
}
//trigger設定事件
function setThreadEvent() {
var t=document.querySelectorAll('tbody[id] >tr > th > em');
for(var i=0;i < t.length;i++)
{
t[i].addEventListener('click',setThread,false);
t[i].style.cursor='pointer';
}
}
getThread();
setThreadEvent();
Remove Autoplay Music
標籤:
userscript
// ==UserScript==
// @name Remove Autoplay Music
// @description 移除自動播放的音樂
// @run-at document-end
// @author NKid
// @version 2012-02-20
// @include http://www.wretch.cc/blog/*
// @include http://www.wretch.cc/album/*
// @include http://www.wretch.cc/user/*
// ==/UserScript==
var bgm=document.querySelector('embed[src*="BGMusicPlayer.swf"]');
if (bgm)
{
GM_notification('Remove BGM',null);
bgm.parentNode.removeChild(bgm);
}
var fs=document.querySelectorAll('iframe');
if (fs)
{
GM_notification('Remove iframe',null);
for(var i=0;fs[i];++i)
fs[i].parentNode.removeChild(fs[i]);
}
var obj=document.querySelectorAll('object');
for(var i=0;obj[i];++i)
{
if(obj[i].data.indexOf('.swf') != -1)
{
obj[i].parentNode.removeChild(obj[i]);
GM_notification('Remove object',null);
}
}
Shoudian Url Redirect
標籤:
userscript
// ==UserScript==
// @name shoudian URL Redirect
// @description shoudian URL Redirect
// @include http://www.shoudiancn.com/*
// @include http://www.shoudian.org/*
// @include http://shoudiancn.com/*
// ==/UserScript==
location.assign('http://www.shoudian.com' + location.pathname + location.search);
M01 Category Fix
標籤:
userscript
// ==UserScript==
// @name M01 Category Fix
// @description 修改M01 category.php的快捷連結
// @run-at document-end
// @author NKid
// @version 2011-07-10
// @include http://www.mobile01.com/category.php?id=*
// ==/UserScript==
var htmlCode='<ul class="lv02" style="visibility: hidden; display: none;">@lis</ul>';
var s=document.getElementById('shortcut-content').innerHTML;
s=s.replace(/\s\|\s/g,'');
s=s.replace(/(<a\s.*?href=.*?>)(.*?)(<\/a>)/g,'<li>$1$2$3</li>');
htmlCode=htmlCode.replace('@lis',s);
document.querySelector("#top-menu a[style]").parentNode.innerHTML+=htmlCode;
unsafeWindow.$(".sf-menu").superfish({
delay: 500,
pathClass: 'current',
dropShadows: false,
speed: 100,
autoArrows: false
});
Give Me Bigger
標籤:
userscript
學網連wretch速度很快,故開發此套件,方便逛相簿,搭配Website: cleaner - WRETCH使用,成效更佳。
// ==UserScript==
// @name Give Me Bigger
// @description 表格式顯示相簿原圖
// @priority 1
// @version 2011-05-17
// @include http://www.wretch.cc/album/album.php*
// @include http://*.pixnet.net/album/set/*
// @include http://photo.xuite.net/*/*
// ==/UserScript==
GM_registerMenuCommand('Give Me Bigger - Setting columns', settingColumns);
GM_registerMenuCommand('Give Me Bigger - Setting width of images', settingImgWidth);
var siteRule=['www.wretch.cc','pixnet.net','photo.xuite.net'];
var thumbRule=['thumbs\/t','thumb_','_c'];
var thumbRRule=['','','_l'];
var contentRule=['#ad_square','#contentBody','.list_area'];
var linkRule=['td.side a','.thumbImg a','.list_area .photo_info a'];
//Setting columns
function settingColumns() {
var oldCols=GM_getValue('cols')||2; //(Default Value:2)
GM_setValue('cols', prompt('Please enter the columns.', oldCols));
}
//Setting width of images
function settingImgWidth() {
var oldIW=GM_getValue('imgwidth')||240; //(Default Value:240)
GM_setValue('imgwidth', prompt('Please Enter the width(px) of images.', oldIW));
}
//Setting display infomation
function settingInfo() {
window.infoBlock=document.createElement('p');
infoBlock.style.position='absolute';
infoBlock.style.top='10px';
infoBlock.style.left='50px';
infoBlock.style.fontSize='1.8em';
window.curCount=document.createElement('span'); //Current complete images
curCount.textContent=0;
window.toaCount=document.createElement('span'); //Amount of all images
infoBlock.appendChild(curCount);
infoBlock.appendChild(toaCount);
document.getElementsByTagName('body')[0].appendChild(infoBlock);
window.oriTitle=document.title; //Save oringinal title
}
//Counting complete images
function imgReady(){
curCount.textContent=parseInt(curCount.textContent,10)+1;
document.title = curCount.textContent + toaCount.textContent;
}
//依據網址找出規則式編號
function chkIndex(){
for(var i=0;i<siteRule.length;i++)
if(location.href.indexOf(siteRule[i]) != -1) return i
}
function GMB() {
settingInfo();
var ruleIndex=chkIndex(); //規則式編號
var imgWidth=parseInt(GM_getValue('imgwidth')||240,10) //圖片寬度
GM_addStyle('.GMBtd img{max-width:@imgwidthpx}'.replace('@imgwidth',imgWidth));
var pics=document.querySelectorAll('img[src*="' + thumbRule[ruleIndex].replace('\\','') + '"]'); //全部縮圖
var picLinks=document.querySelectorAll(linkRule[ruleIndex]); //圖片超連結
var cols=parseInt(GM_getValue('cols')||3,10); //欄數
var intRows=Math.floor(pics.length / cols); //整數列
var leftPics=pics.length % cols; //剩餘圖片數
var patt=RegExp('(' + thumbRule[ruleIndex] + ')', 'i'); //原圖規則式
var htmlCode=[];
toaCount.textContent=' / ' + pics.length;
//先處理整數列
for(var i=0;i<intRows;i++)
{
htmlCode[htmlCode.length]='<tr>';
for(var j=0;j<cols;j++)
htmlCode[htmlCode.length]='<td class="GMBtd"><a target="_blank" href="' + picLinks[i*cols+j].href + '"><img src="'+ pics[i*cols+j].src.replace(patt,thumbRRule[ruleIndex])+'" /></a></td>';
htmlCode[htmlCode.length]='</tr>';
}
//再處理剩餘圖片
if(leftPics != 0)
{
htmlCode[htmlCode.length]='<tr>';
for(var k=0;k<leftPics;k++)
htmlCode[htmlCode.length]='<td class="GMBtd"><a target="_blank" href="' + picLinks[intRows*cols+k].href + '"><img src="'+ pics[intRows*cols+k].src.replace(patt,thumbRRule[ruleIndex])+'" /></a></td>';
htmlCode[htmlCode.length]='</tr>';
}
var tb=document.createElement('table');
tb.innerHTML=htmlCode.join('');
tb.id='GMB';
var oldContent=document.querySelector(contentRule[ruleIndex]);
oldContent.parentNode.replaceChild(tb,oldContent);
//綁定計算圖片完成數
var myPics=document.querySelectorAll('#GMB img');
for(var i=0;myPics[i];++i)
myPics[i].addEventListener('load',imgReady,false);
delete htmlCode;
delete pics;
delete picLinks;
}
window.addEventListener('DOMContentLoaded',GMB,false);
window.addEventListener('load',function() {document.title=oriTitle},false);
KISSRadio 網路音樂台
標籤:
userscript
// ==UserScript==
// @name KISSRadio 網路音樂台
// @description 顯示歌名於body、title
// @run-at document-end
// @author NKid
// @version 2011-08-02
// @include http://www.kiss.com.tw/marquee.php?id=308*
// ==/UserScript==
GM_addStyle('body {background-color:#262629} h1 {text-align:center; margin-top:10%; font-size:5em; color:white;}');
var songName=document.querySelector('td span').innerHTML.replace(/(正在播放|即將播放)<span style=\"font-size:3pt;\"> :<\/span>/,'');
var tb=document.getElementsByTagName('table')[0];
tb.parentNode.removeChild(tb);
document.getElementsByTagName('body')[0].innerHTML='<h1>'+ songName+'</h1>';
//document.title=songName;
setTimeout(function(){location.assign('http://www.kiss.com.tw/marquee.php?id=308' + '&t=' + new Date().getTime() );},30*1000);
function scrlsts() {
songName = songName.substring(1, songName.length) + songName.substring(0, 1);
document.title = songName;
setTimeout(scrlsts, 300);
}
scrlsts();
htmlmarquee - Title Marquee
FDZ Keyword Hightlight
標籤:
userscript
FDZ Title Keyword Hightlight,加入下列兩項功能
- 整合FDZ Article Link Clean
- 支援hightlight作者名
// ==UserScript==
// @name FDZ Keyword Hightlight
// @description 自動高亮文章標題關鍵字
// @author NKid
// @version 2011-04-24
// @run-at document-end
// @include http://forum.fdzone.org/forumdisplay.php?fid=*
// @include http://forum.*.fdzone.org/forumdisplay.php?fid=*
// ==/UserScript==
GM_registerMenuCommand('FDZ Keyword Hightlight - Setting Keywords', settingKeywords);
GM_registerMenuCommand('FDZ Keyword Hightlight - Keywords List', listKeywords);
GM_registerMenuCommand('FDZ Keyword Hightlight - Setting Authors', settingAuthors);
GM_registerMenuCommand('FDZ Keyword Hightlight - Authors List', listAuthors);
GM_registerMenuCommand('FDZ Keyword Hightlight - Open Link in New Tab', openNewTab);
//GM_registerMenuCommand('FDZ Title Find RegExp - DEL', DEL);
GM_addStyle('.GM_gotit {color:#000;background-color:#FBED73;-moz-border-radius:3px;padding:0 2px;}'); //Highlight Keyword Style
GM_addStyle('#GM_newtab {-moz-border-radius: 3px; color: #000000; cursor: pointer; font-size: 10px; height: 10px; position: fixed; right: 3px; top: 3px; width: 10px;} .GM_newtabOn {background-color: #00FF00} .GM_newtabOff {background-color: #FF0000}'); //NewTab State
/*function DEL() {GM_deleteValue("keywords");}*/
var tar=GM_getValue('newtab'); //new tab state
//setting Keywords
function settingKeywords() {
var KWs = (decodeURI(GM_getValue("keywords")) == 'undefined') ? '' : decodeURI(GM_getValue("keywords"));
var newKWs = prompt('Please Enter the Keywords.\n(use commas to separate)', KWs).split(',');
newKWs.sort(descStrLen);
GM_setValue("keywords", encodeURI(newKWs.join()));
refreshPage();
}
//list Keywords
function listKeywords() {
var listKWs = decodeURI(GM_getValue("keywords")).split(',');
alert(listKWs.join('\n'));
}
//setting Authors
function settingAuthors() {
var ARs = (decodeURI(GM_getValue("authors")) == 'undefined') ? '' : decodeURI(GM_getValue("authors"));
var newARs = prompt('Please Enter Authors\' names.\n(use commas to separate)', ARs).split(',');
newARs.sort(descStrLen);
GM_setValue("authors", encodeURI(newARs.join()));
refreshPage();
}
//list Authors
function listAuthors() {
var listARs = decodeURI(GM_getValue("authors")).split(',');
alert(listARs.join('\n'));
}
//Open articles in new tab
function openNewTab() {
GM_setValue("newtab", confirm("Open articles in new tab?"));
refreshPage();
}
//sort function (by string length)
function descStrLen(a, b) {
if (a.length < b.length) return 1;
}
//Message Refresh Page
function refreshPage() {
alert('Please Refresh Page.');
}
function toRegExpArray(oriArray) {
//把關鍵字array轉換成RegExp Array
var reArray = new Array(); //RegExp Array
for (var i = 0; i < oriArray.length; i++) {
reArray.push(new RegExp('(' + oriArray[i] + ')','ig'));
}
return reArray;
}
function main() {
//文章標題、描述
var KWs = decodeURI(GM_getValue('keywords')).split(','); //keywords array
var titles = document.querySelectorAll('span[id^=thread_]'); //all articles' title
var descs=document.querySelectorAll("[id^='desc_']"); //all articles' description
//作者
var ARs = decodeURI(GM_getValue('authors')).split(','); //authors array
var authors=document.querySelectorAll('.author > cite > a'); //all authors
//轉換RegExp Array
var reKWs=toRegExpArray(KWs);
var reARs=toRegExpArray(ARs);
//比對關鍵字
var i, j, titleStr, descStr,authorStr;
for (i = 0; i < titles.length; i++) {
//取出文章標題超連結的文字
titleStr = titles[i].childNodes[0].innerHTML;
//比對關鍵字
for (j = 0; j < reKWs.length; j++) {
if (reKWs[j].test(titleStr)) titleStr = titleStr.replace(reKWs[j], '<span class=\"GM_gotit\">$1</span>');
}
titles[i].childNodes[0].innerHTML = titleStr;
titles[i].childNodes[0].target=(tar)?"_blank":"";
titles[i].childNodes[0].href=titles[i].childNodes[0].href.replace(/&i.*/i,''); //FDZ Article Link Clean
}
for (i = 0; i< descs.length; i++) {
//取出文章描述的文字
descStr = descs[i].innerHTML;
//比對關鍵字
for (j = 0; j < reKWs.length; j++)
if (reKWs[j].test(descStr)) descStr = descStr.replace(reKWs[j], '<span class=\"GM_gotit\">$1</span>');
descs[i].innerHTML = descStr;
}
for (i = 0; i< authors.length; i++) {
//取出文章描述的文字
authorStr = authors[i].innerHTML;
//比對關鍵字
for (j = 0; j < reARs.length; j++) {
if (reARs[j].test(authorStr)) authorStr = authorStr.replace(reARs[j], '<span class=\"GM_gotit\">$1</span>');
}
authors[i].innerHTML = authorStr;
}
}
function newtab() {
var newtabState = document.createElement("div");
newtabState.id="GM_newtab";
newtabState.title="Open articles in newtab ?";
newtabState.className=(tar)?"GM_newtabOn":"GM_newtabOff";
document.getElementsByTagName("body")[0].appendChild(newtabState);
document.getElementById('GM_newtab').addEventListener('click',function(){GM_setValue("newtab", 1-GM_getValue("newtab")); refreshPage(); },false);
}
main();
newtab();
Get Lotto Win Num
標籤:
userscript
// ==UserScript==
// @name Get Lotto Win Num
// @description Get Lotto Win Num
// @include http://www.taiwanlottery.com.tw/Lotto/Lotto649/history.aspx
// ==/UserScript==
var n=document.querySelectorAll('div > span[id*="_No"]');
var winNumStr='';
for(var i=0;i<n.length;i++)
{
winNumStr+=n[i].innerHTML + " ";
if((i+1) % 7 == 0) winNumStr+="\n";
}
alert(winNumStr);
FDZ Encrypt Promotion
標籤:
userscript
// ==UserScript==
// @name FDZ Encrypt Promotion
// @description 加強解密推廣功能,自動轉址
// @include http://forum.*.fdzone.org/encryname.php?uid=*
// @include http://forum.fdzone.org/encryname.php?uid=*
// @include http://pro.fdzone.org/encryname.php?uid=*
// ==/UserScript==
location.assign("space.php?action=viewpro&uid=" + location.search.replace(/\?uid=/i,""));
訂閱:
文章
(
Atom
)