// ==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();
標籤
.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
)
EZ Recorder
標籤:
userscript