[轉錄] Fix wretch hotkey using GreaseMonkey

作者: vicamo (asdf)   2007-05-11 10:40:07
※ [本文轉錄自 Browsers 看板]
作者: vicamo (asdf) 看板: Browsers
標題: [-Fx-] Fix wretch hotkey using GreaseMonkey
時間: Fri May 11 05:04:24 2007
8< 8< 8< 8< 8< 8< 8< 8< 8< CUT ME BEGIN 8< 8< 8< 8< 8< 8< 8< 8< 8< 8< 8< 8<
// ==UserScript==
// @name WretchHotkey
// @namespace vicamo
// @description fix wretch hotkey
// @include http://www.wretch.cc/album/*
// ==/UserScript==
(function () {
function hijackPhotoPage (parameters) {
unsafeWindow.is_non_vip_should_alert=function (event, mode) {
var obj;
var srcElement = event.srcElement ?
event.srcElement : event.target;
if(event.shiftKey || event.altKey || event.ctrlKey)
return false;
obj = document.getElementsByTagName("INPUT");
for (i = 0; i < obj.length; i++) {
if ((obj[i].name == srcElement.name) &&
((obj[i].type == "text") || (obj[i].type == "password")))
{
return false;
}
}
obj = document.getElementsByTagName("TEXTAREA");
for (i = 0; i < obj.length; i++) {
if (obj[i].name == srcElement.name)
return false;
}
switch(event.keyCode) {
case 90: //Z
if (parameters['first'])
document.location = document.getElementById("first").href;
break;
case 88: //X
if (parameters['prev'])
document.location = document.getElementById("prev").href;
break;
case 67: //C
if (parameters['next'])
document.location = document.getElementById("next").href;
break;
case 86: //V
if (parameters['last'])
document.location = document.getElementById("last").href;
break;
case 66: //B
if (parameters['updir'])
document.location = document.getElementById("updir").href;
break;
case 78: //N
if (parameters['orig'])
document.location = document.getElementById("orig").href;
break;
case 83: //S
if (parameters['slide'])
document.location = document.getElementById("slide").href;
break;
case 73: //I
if (parameters['exif']) {
var exif_obj = document.getElementById("exif");
if (exif_obj)
document.location = exif_obj.href
}
break;
case 77: //M
if (parameters['admin']) {
document.cookie = 'sm='+parameters['admin_cookie'];
document.location.reload();
}
break;
}
return false;
}
}
function hijackAlbumPage (parameters) {
unsafeWindow.is_non_vip_should_alert=function (event, mode) {
var obj;
var page = parameters['page'];
var total = parameters['total'];
var PageLink = parameters['PageLink'];
var HomeLink = parameters['HomeLink'];
var UseHomeLink = parameters['UseHomeLink'];
var srcElement = event.srcElement ?
event.srcElement : event.target;
if(event.shiftKey || event.altKey || event.ctrlKey)
return false;
obj = document.getElementsByTagName("INPUT");
for (i = 0; i < obj.length; i++)
{
if ((obj[i].name == srcElement.name) &&
((obj[i].type == "text") || (obj[i].type == "password")))
{
return false;
}
}
obj = document.getElementsByTagName("TEXTAREA");
for (i = 0; i < obj.length; i++)
{
if (obj[i].name == srcElement.name)
return false;
}
switch (event.keyCode) {
case 90: //Z
if(page > 1 && PageLink)
document.location = PageLink+'1';
break;
case 88: //X
if((page - 1) > 0 && PageLink)
document.location = PageLink+(page-1);
break;
case 67: //C
if(page < total && PageLink)
document.location = PageLink+(page+1);
break;
case 86: //V
if(PageLink)
document.location = PageLink+total;
break;
case 66: //B
if(UseHomeLink)
document.location = HomeLink;
break;
}
return false
}
}
var allScripts = document.getElementsByTagName ("script");
var show_hotkey_parameters;
var link_hotkey_parameters;
var index;
for (index = 0; index < allScripts.length; ++index) {
if (allScripts[index].innerHTML.indexOf (
"show_hotkey_parameters = new Array();", 0) >= 0) {
eval (allScripts[index].innerHTML.substring (0,
allScripts[index].innerHTML.indexOf ("//", 0)));
hijackPhotoPage (show_hotkey_parameters);
break;
}
if (allScripts[index].innerHTML.indexOf (
"link_hotkey_parameters = new Array();", 0) >= 0) {
eval (allScripts[index].innerHTML);
hijackAlbumPage (link_hotkey_parameters);
break;
}
}
}) ();
8< 8< 8< 8< 8< 8< 8< 8< 8< 8< CUT ME END 8< 8< 8< 8< 8< 8< 8< 8< 8< 8< 8<
關於 http://www.wretch.cc/album/ 這種連結我沒有測試
看起來應該會是很多相簿時可以看下一頁的樣子
沒看到這麼多相簿的,如果有發現爆掉了再回報一下吧 @@
該睡覺了,明天要上班 ...
作者: vicamo (asdf)   2006-05-11 05:05:00
忘了說,只要有心,人人都是 VIP修改一些東西,遇到相簿上鎖的才不會一直跳出視窗
作者: abyssa1 (abyssa1)   2007-05-11 14:18:00
哇 太好用了 謝謝這位大大

Links booklink

Contact Us: admin [ a t ] ucptt.com