Diff
checker
文本
文本
圖像
文檔
Excel
文件夾
Legal
Enterprise
桌面版
定價
登入
下載 Diffchecker 桌面版
比較文本
尋找兩個文字檔案之間的差異
工具
歷史
即時編輯器
摺疊未變更行
關閉換行
檢視
拆分
統一
比對精度
智能
單詞
字符
語法突出顯示
選擇語法
忽略
文字轉換
前往第一個差異
編輯輸入
Diffchecker Desktop
執行Diffchecker最安全的方式。取得Diffchecker桌面應用程式:您的差異永遠不會離開您的電腦!
取得桌面版
Untitled diff
建立於
10 年前
差異永不過期
清除
匯出
分享
解釋
143 刪除
行
總計
刪除
字符
總計
刪除
要繼續使用此功能,請升級到
Diff
checker
Pro
查看價格
456 行
全部複製
295 新增
行
總計
新增
字符
總計
新增
要繼續使用此功能,請升級到
Diff
checker
Pro
查看價格
564 行
全部複製
// ==UserScript==
// ==UserScript==
// @name Reloader
// @name Reloader
// @namespace HVRLD3
// @namespace HVRLD3
複製
已複製
複製
已複製
// @author nihilvoid, Dan31
// @author nihilvoid, Dan31
, FabulousCupcake, simrock87
// @run-at document-
start
// @run-at document-
end
// @include http://hentaiverse.org/*
// @include http://hentaiverse.org/*
複製
已複製
複製
已複製
// @version 1.3
// @version 1.3
.1
// @grant none
// @grant none
// ==/UserScript==
// ==/UserScript==
複製
已複製
複製
已複製
//
Vanilla Reloader:
http://forums.e-hentai.org/index.php?s=&showtopic=65126&view=findpost&p=4259841
//
Vanilla Reloader:
//
http://forums.e-hentai.org/index.php?s=&showtopic=65126&view=findpost&p=4259841
複製
已複製
複製
已複製
//
Select a custom font in your settings:
http://hentaiverse.org/?s=Character&ss=se
//
Select a custom font in your settings:
//Example: Cambria/9/bold/normal/-4
//
http://hentaiverse.org/?s=Character&ss=se
複製
已複製
複製
已複製
//
TODO (development)
:
//
Todo List
:
//
- fix battlelog append
//
- fix battlelog append
//
- add Hoheneim's additions
//
- add Hoheneim's additions
//
- fix round counter display at end of battle serie
//
- fix round counter display at end of battle serie
//
- add support for browsers other than Firefox (-> update mousemelee)
//
- add support for browsers other than Firefox (-> update mousemelee)
複製
已複製
複製
已複製
//Change your settings here
// Credits and Sources
// ------------------------
// Original reloader idea : nihilvoid
// Reloader maintainer : Dan31
// No Blinking : HV Stat
/* ======================================== *\
* ============= CONFIGURATION ============ *
\* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
var settings = {
var settings = {
複製
已複製
複製
已複製
//
Hide the
Welcome to the Hentaiverse
image
hideWelcome: true,
//
Hide the
"
Welcome to the Hentaiverse
"
image
/logo
hideWelcome
: true,
noBlinking
: true,
//
Disable buff/debuff blinking
//
Disable buff/debuff blinking
effectDurations
: true,
//
Show buff/debuff durations
noBlinking
: true,
gemIcon
: true,
//
Show gem
/powerup
, click on icon to use
//
Show buff/debuff durations
roundCounter: true, // Show current round and rounds remaining
effectDurations
: true,
//
Show gem
, click on icon to use
defaultAction: 0, //
Change the default action to a T1 spell
gemIcon: true,
//
| 0 | 1 | 2 | 3 | 4 | 5 | 6 |
//Show current round
// |
No
C
hange
|
Fiery Blast
|
Freeze
|
Shockblast
|
Gale
|
Smite
|
Corruption
|
roundCounter: true,
//
Change the default action to a T1 spell
mouseMelee: true,
//
Mouse
M
elee
( hover
on
enemies to attack )
//
No
c
hange
: 0,
Fiery Blast
: 1,
Freeze
: 2,
Shockblast
: 3,
Gale
: 4,
Smite
: 5,
Corruption
: 6
minHP
:
0.4
,
// Stop if hp is below this threshold
defaultAction: 0,
min
M
P: 0.
12,
// Stop if mp ...
//
Enable
Mouse
m
elee
, disable it
on
conditions (
minHP
=
0.4
means disabled when HP under 40%, etc.)
minSP: 0.3,
// Stop if sp ...
mouseMelee: true,
stopWhenChanneling: true,
//
Stop if you have channeling buff
min
H
P: 0.
4,
minMP: 0.12,
battleLog: true,
// Show battle log
minSP: 0.3,
//battleLogAppend: false,
//disabled for now (need to redo this without jQuery)
stopWhenChanneling: true,
//
Show the battle log
skipToNextRound: true,
//
Auto-advance to next round
battleLog: true,
popupTime: 0,
// after `
popupTime
`ms
//battleLogAppend: false,
//disabled for now (need to redo this without jQuery)
showPopup: false,
//
Show that end of round popup?
//
Auto-advance to next round
on round clear after set time (ms)
skipToNextRound: true,
counterPlus: true //
HV
-
Counter
-
Plus (
show
s
turns, speed, time, exp,
and
credits at the end of
game )
popupTime
: 0,
showPopup: false,
//
Enable
HV
Counter
Plus (
show
turns, speed, time, exp,
credits at the end of
a battle serie)
counterPlus: true
};
};
複製
已複製
複製
已複製
//-----------------------------------------------------------------------------------------------------------------
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ *\
* =========== CONFIGURATION END ========== *
\* ======================================== */
複製
已複製
複製
已複製
document.title = 'HV'; //Change page title to 'HV'
var sheet = document.createElement('style');
//style for round counter and effect duration
sheet.innerHTML = '#round{position:absolute;left:1080px;top:15px;width:120px;font-size:20px;font-weight:bold;z-index:10;text-align:right}.duration{width:30px;display:inline-block;text-align:center;position:relative;margin-left:-30px;top:-4px}.duration>div{background:white;border:1px solid black;padding:0 2px;display:inline-block;min-width:8px;font-weight:bold;height:13px}';
if (!settings.battleLog) {
//Hide the battle log
sheet.innerHTML += "#togpane_log {display: none}";
}
if (settings.hideWelcome) {
//Hide the 'Welcome to the Hentaiverse' image.
sheet.innerHTML += 'img.cw{display: none}.cbl:nth-of-type(1){padding-top:114px}';
}
document.head.appendChild(sheet);
複製
已複製
複製
已複製
//### No blinking script ###
//Disables buff/debuff blinking
/* ======================================== *\
if (settings.noBlinking) {
* ============= INITIAL LOAD ============= *
window.addEventListener('beforescriptexecute', function(e) {
\* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
if (/battle\.set_infopane\("Battle Time"\)/.test(e.target.innerHTML)) {
// Stuffs to be ran on page load
e.preventDefault();
window.removeEventListener(e.type, arguments.callee, true);
function initialPageLoad() {
// Hoverplay fix for Chrome
// Constantly track cursor position to allow chrome to keep hitting a monster when hovering on one.
// You'd have to keep moving your cursor without this fix
if ( settings.mouseMelee ) {
// Get cursor position from the last round
curX = localStorage.getItem('curX');
curY = localStorage.getItem('curY');
localStorage.removeItem('curX');
localStorage.removeItem('curY');
// Update curX and curY whenever cursor moves
if (window.Event) document.captureEvents(Event.MOUSEMOVE);
document.onmousemove = function(e) {
curX = (window.Event) ? e.pageX : event.clientX + (document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft);
curY = (window.Event) ? e.pageY : event.clientY + (document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop);
};
}
// Change page title to "HV"
document.title = 'HV';
// Insert stylesheet for Round Counter and Effect Duration
var sheet = document.createElement('style');
sheet.innerHTML = '#round{position:absolute;left:1080px;top:15px;width:120px;font-size:20px;font-weight:bold;z-index:10;text-align:right}.duration{width:30px;display:inline-block;text-align:center;position:relative;margin-left:-30px;top:-4px}.duration>div{background:white;border:1px solid black;padding:0 2px;display:inline-block;min-width:8px;font-weight:bold;height:13px}';
// Hide Battle Log
if (!settings.battleLog) sheet.innerHTML += '#togpane_log {display: none}';
// Hide Welcome Logo
if (settings.hideWelcome) { sheet.innerHTML += 'img.cw{display: none}.cbl:nth-of-type(1){padding-top:114px}'; }
document.head.appendChild(sheet);
/* ============== NO BLINKING ============= */
if (settings.noBlinking) {
window.addEventListener('beforescriptexecute', function(e) {
if (/battle\.set_infopane\("Battle Time"\)/.test(e.target.innerHTML)) {
e.preventDefault();
window.removeEventListener(e.type, arguments.callee, true);
}
}, true);
}
/* ============ NO BLINKING END =========== */
/* ============= ROUND COUNTER ============ */
Text moved from lines 426-432
if (settings.roundCounter) {
var logs = document.querySelector('#togpane_log tr:nth-last-child(2)').textContent;
if (/Round/.test(logs) && !sessionStorage.rounds) {
var round = logs.match(/Round ([\d\s\/]+)/)[1];
sessionStorage.setItem('rounds', round);
} else {
var round = sessionStorage.getItem('rounds') || undefined;
}
}
複製
已複製
複製
已複製
Text moved with changes from lines 434-449 (98.3% similarity)
}, true);
if (round !== undefined) {
};
var x = document.getElementById('mainpane').appendChild(document.createElement('div'));
//### No blinking script - end ###
x.id = 'round';
x.innerHTML = round;
var final = round.split('/');
switch (final[1] - final[0]) {
case 0:
x.style.color = '#ff0000';
break;
case 1:
x.style.color = '#ffcc99';
break;
}
}
}
/* =========== ROUND COUNTER END ========== */
}
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ *\
* =========== INITIAL LOAD END =========== *
\* ======================================== */
/* ======================================== *\
* ============ ON PAGE RELOAD ============ *
\* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
// Stuffs to be executed after the xhr request is sent
// and the page is loaded with new content.
function OnPageReload() {
function OnPageReload() {
// Reinitialize the battle manager
// Reinitialize the battle manager
複製
已複製
複製
已複製
window.battle = new window.Battle
;
window.battle = new window.Battle
()
;
window.battle.clear_infopane();
window.battle.clear_infopane();
// TODO: Anything that needs to trigger when a new battle page starts should go here
// TODO: Anything that needs to trigger when a new battle page starts should go here
複製
已複製
複製
已複製
//
i.e. Stat tracking, log parsing, battle-UI changes, etc.
//
i.e. Stat tracking, log parsing, battle-UI changes, etc.
複製
已複製
複製
已複製
/
/### Change default action ###
/
* ============ DEFAULT ACTION ============ */
function changeDefault(id) {
function changeDefault(id) {
var caller = document.getElementById(id.toString());
var caller = document.getElementById(id.toString());
window.battle.lock_action(caller, 1, 'magic', id);
window.battle.lock_action(caller, 1, 'magic', id);
window.battle.set_hostile_subattack(id);
window.battle.set_hostile_subattack(id);
}
}
switch (settings.defaultAction) {
switch (settings.defaultAction) {
//Default (Attack)
//Default (Attack)
case 0:
case 0:
break;
break;
case 1:
case 1:
//Fiery Blast
//Fiery Blast
changeDefault(111);
changeDefault(111);
break;
break;
case 2:
case 2:
//Freeze
//Freeze
changeDefault(121);
changeDefault(121);
break;
break;
case 3:
case 3:
//Shockblast
//Shockblast
changeDefault(131);
changeDefault(131);
break;
break;
case 4:
case 4:
//Gale
//Gale
changeDefault(141);
changeDefault(141);
break;
break;
case 5:
case 5:
//Smite
//Smite
changeDefault(151);
changeDefault(151);
break;
break;
case 6:
case 6:
//Corruption
//Corruption
changeDefault(161);
changeDefault(161);
break;
break;
}
}
複製
已複製
複製
已複製
/
/### Change default action - end ###
/
* ========== DEFAULT ACTION END ========== */
複製
已複製
複製
已複製
/
/###
HV
Counter Plus ###
/
* ============
HV
COUNTER PLUS =========== */
if (settings.counterPlus) {
if (settings.counterPlus) {
複製
已複製
複製
已複製
(function(){
var record = localStorage.record ? JSON.parse(localStorage.record) : {
var record = localStorage.record ? JSON.parse(localStorage.record) : {
'turns': 0,
'turns': 0,
'time': 0,
'time': 0,
'EXP': 0,
'EXP': 0,
'Credits': 0
'Credits': 0
},
},
pop = document.getElementsByClassName('btcp')[0],
pop = document.getElementsByClassName('btcp')[0],
set = function() {
set = function() {
localStorage.setItem('record', JSON.stringify(record));
localStorage.setItem('record', JSON.stringify(record));
},
},
build = function(item, point) {
build = function(item, point) {
record[item] = record[item] * 1 + point * 1;
record[item] = record[item] * 1 + point * 1;
};
};
if (!record.time) {
if (!record.time) {
build('time', Date.now());
build('time', Date.now());
set();
set();
}
}
if (pop) {
if (pop) {
var target, label, i = 0,
var target, label, i = 0,
複製
已複製
複製
已複製
text
= document.querySelectorAll('#togpane_log .t3b'),
text
C
= document.querySelectorAll('#togpane_log .t3b'),
turn = document.querySelector('#togpane_log .t1').textContent;
turn = document.querySelector('#togpane_log .t1').textContent;
build('turns', turn);
build('turns', turn);
複製
已複製
複製
已複製
while (i < text
.length) {
while (i < text
C
.length) {
target = text
[i].textContent;
target = text
C
[i].textContent;
if (/Victorious.$|Fleeing.$/.test(target)) break;
if (/Victorious.$|Fleeing.$/.test(target)) break;
label = target.match(/(\d+) ([EC]\w+).$/);
label = target.match(/(\d+) ([EC]\w+).$/);
if (label) build(label[2], label[1]);
if (label) build(label[2], label[1]);
i++;
i++;
}
}
if (pop.getElementsByTagName('img')[0]) set();
if (pop.getElementsByTagName('img')[0]) set();
else {
else {
var num = 0,
var num = 0,
runTime = Math.floor((Date.now() - record.time) / 1000),
runTime = Math.floor((Date.now() - record.time) / 1000),
text = pop.getElementsByClassName('fd4'),
text = pop.getElementsByClassName('fd4'),
len = text.length,
len = text.length,
result = pop.appendChild(document.createElement('div'));
result = pop.appendChild(document.createElement('div'));
result.style.cssText = 'font-size:15px;font-weight:bold;margin-top:15px;';
result.style.cssText = 'font-size:15px;font-weight:bold;margin-top:15px;';
for (i = 0; i < len; i++) text[i].firstChild.style.marginTop = '-4px';
for (i = 0; i < len; i++) text[i].firstChild.style.marginTop = '-4px';
pop.style.top = '23px';
pop.style.top = '23px';
if (len > 2) pop.style.height = len > 3 ? '190px' : '170px';
if (len > 2) pop.style.height = len > 3 ? '190px' : '170px';
複製
已複製
複製
已複製
for (
key in record) {
for (
var
key in record) {
var div = result.appendChild(document.createElement('div'));
var div = result.appendChild(document.createElement('div'));
div.style.cssText = 'display:inline-block;margin-bottom:7px;';
div.style.cssText = 'display:inline-block;margin-bottom:7px;';
if (!(num % 2)) div.style.marginRight = '20px';
if (!(num % 2)) div.style.marginRight = '20px';
if (key == 'time') {
if (key == 'time') {
var hour = ('0' + Math.floor(runTime / 3600) % 100).slice(-2),
var hour = ('0' + Math.floor(runTime / 3600) % 100).slice(-2),
min = ('0' + Math.floor(runTime / 60) % 60).slice(-2),
min = ('0' + Math.floor(runTime / 60) % 60).slice(-2),
sec = ('0' + runTime % 60).slice(-2);
sec = ('0' + runTime % 60).slice(-2);
複製
已複製
複製
已複製
div.textContent = (hour !
= 0 ? hour + ' h ' : '') + (min !=
0 ? min + ' m ' : '') + sec + ' s';
div.textContent = (hour !
=
= 0 ? hour + ' h ' : '') + (min !=
=
0 ? min + ' m ' : '') + sec + ' s';
result.appendChild(document.createElement('br'));
result.appendChild(document.createElement('br'));
} else {
} else {
var total = record[key] + '';
var total = record[key] + '';
while (total != (total = total.replace(/^(\d+)(\d{3})/, '$1,$2')));
while (total != (total = total.replace(/^(\d+)(\d{3})/, '$1,$2')));
div.textContent = total + ' ' + key.toLowerCase();
div.textContent = total + ' ' + key.toLowerCase();
if (!num) div.textContent += ' (' + ((Math.floor((record[key] / runTime) * 1000)) / 1000).toFixed(2) + ' t/s)';
if (!num) div.textContent += ' (' + ((Math.floor((record[key] / runTime) * 1000)) / 1000).toFixed(2) + ' t/s)';
}
}
num++;
num++;
}
}
}
}
}
}
複製
已複製
複製
已複製
})();
}
}
複製
已複製
複製
已複製
/
/###
HV
Counter Plus - end ###
/
* ==========
HV
COUNTER PLUS END ========= */
複製
已複製
複製
已複製
/
/### Effect duration ###
/
* ============= BUFF DURATION ============ */
//From HV Stats Slim
if (settings.effectDurations) {
if (settings.effectDurations) {
複製
已複製
複製
已複製
(function(){
var targets = document.querySelectorAll('img[onmouseover^="battle.set_infopane_effect"]'),
var targets = document.querySelectorAll('img[onmouseover^="battle.set_infopane_effect"]'),
i = targets.length;
i = targets.length;
while (i--) {
while (i--) {
var duration = targets[i].getAttribute('onmouseover').match(/, ([-\d]+)\)/);
var duration = targets[i].getAttribute('onmouseover').match(/, ([-\d]+)\)/);
if (!duration || duration < 0) duration = '-';
if (!duration || duration < 0) duration = '-';
else duration = duration[1];
else duration = duration[1];
var div = targets[i].parentNode.insertBefore(document.createElement('div'), targets[i].nextSibling);
var div = targets[i].parentNode.insertBefore(document.createElement('div'), targets[i].nextSibling);
div.appendChild(document.createElement('div')).innerHTML = duration;
div.appendChild(document.createElement('div')).innerHTML = duration;
div.className = 'duration';
div.className = 'duration';
}
}
複製
已複製
複製
已複製
})();
}
}
複製
已複製
複製
已複製
/
/### Effect duration - end ###
/
* =========== BUFF DURATION END ========== */
複製
已複製
複製
已複製
//### Show Gems script ###
/* =============== SHOW GEMS ============== */
//Show an icon when possessing a gem, which can be clicked to use it.
if (settings.gemIcon) {
if (settings.gemIcon) {
複製
已複製
複製
已複製
(function(){
var gem = document.getElementById('ikey_p');
var gem = document.getElementById('ikey_p');
var gem_icon = document.getElementById("gem_icon");
var gem_icon = document.getElementById("gem_icon");
if (gem && !gem_icon) {
if (gem && !gem_icon) {
var icon;
var icon;
switch (gem.getAttribute('onmouseover').match(/'([^\s]+) Gem/)[1]) {
switch (gem.getAttribute('onmouseover').match(/'([^\s]+) Gem/)[1]) {
case 'Mystic':
case 'Mystic':
icon = 'channeling.png';
icon = 'channeling.png';
break;
break;
case 'Health':
case 'Health':
icon = 'healthpot.png';
icon = 'healthpot.png';
break;
break;
case 'Mana':
case 'Mana':
icon = 'manapot.png';
icon = 'manapot.png';
break;
break;
case 'Spirit':
case 'Spirit':
icon = 'spiritpot.png';
icon = 'spiritpot.png';
break;
break;
複製
已複製
複製
已複製
}
;
}
gem_icon = document.querySelector('.btp').appendChild(document.createElement('img'));
gem_icon = document.querySelector('.btp').appendChild(document.createElement('img'));
//gem_icon.src = 'https://raw.github.com/greentea039/HVSTAT/5a7a1e09b8847394faacf0d4b1321d51cb96816f/css/images/' + icon;
//gem_icon.src = 'https://raw.github.com/greentea039/HVSTAT/5a7a1e09b8847394faacf0d4b1321d51cb96816f/css/images/' + icon;
//gem_icon.src = icon;
//gem_icon.src = icon;
gem_icon.src = 'http://ehgt.org/v/e/' + icon;
gem_icon.src = 'http://ehgt.org/v/e/' + icon;
gem_icon.style.cssText = 'border: 1px solid black; position: absolute; float: right; right: 6px; top: 8px;';
gem_icon.style.cssText = 'border: 1px solid black; position: absolute; float: right; right: 6px; top: 8px;';
gem_icon.onclick = function() {
gem_icon.onclick = function() {
window.battle.lock_action(gem, 1, 'items', 'ikey_p');
window.battle.lock_action(gem, 1, 'items', 'ikey_p');
window.battle.set_friendly_subattack('999');
window.battle.set_friendly_subattack('999');
window.battle.touch_and_go();
window.battle.touch_and_go();
gem.remove();
gem.remove();
gem_icon.remove();
gem_icon.remove();
複製
已複製
複製
已複製
}
}
;
gem_icon.id = "gem_icon";
gem_icon.id = "gem_icon";
} else if (!gem && gem_icon) {
} else if (!gem && gem_icon) {
gem_icon.remove();
gem_icon.remove();
}
}
複製
已複製
複製
已複製
})();
}
}
複製
已複製
複製
已複製
/
/### Show Gems script - end ###
/
* ============= SHOW GEMS END ============ */
複製
已複製
複製
已複製
//### custom MouseMelee script ###
/* ============== MOUSE MELEE ============= */
//Hover over monsters to attack. Stops on defined conditions.
if (settings.mouseMelee) {
if (settings.mouseMelee) {
複製
已複製
複製
已複製
(function(){
function getMonsterUnderCursor() {
var el = document.elementFromPoint(curX, curY);
var result = false;
// Check `el` and iteratively its parents until we hit body or found monster
while(!result) {
if(el.nodeName.toLowerCase() === 'body') break;
result = ( el.id.match('mkey') ? el : false );
el = el.parentElement;
}
return result;
}
function NoHoverClick() {
function NoHoverClick() {
var bars = document.getElementsByClassName("cwb2");
var bars = document.getElementsByClassName("cwb2");
var hp = bars[0].width / 120;
var hp = bars[0].width / 120;
var mp = bars[1].width / 120;
var mp = bars[1].width / 120;
var sp = bars[2].width / 120;
var sp = bars[2].width / 120;
//var oc = bars[3].width/120;
//var oc = bars[3].width/120;
var low_hp = (hp < settings.minHP);
var low_hp = (hp < settings.minHP);
var low_mp = (mp < settings.minMP);
var low_mp = (mp < settings.minMP);
var low_sp = (sp < settings.minSP);
var low_sp = (sp < settings.minSP);
//var oc_full = (oc == 1);
//var oc_full = (oc == 1);
var bar_backs = document.getElementsByClassName("cwbdv");
var bar_backs = document.getElementsByClassName("cwbdv");
if (low_hp) bar_backs[0].setAttribute("style", "background-color:purple");
if (low_hp) bar_backs[0].setAttribute("style", "background-color:purple");
if (low_mp) bar_backs[1].setAttribute("style", "background-color:purple");
if (low_mp) bar_backs[1].setAttribute("style", "background-color:purple");
if (low_sp) bar_backs[2].setAttribute("style", "background-color:purple");
if (low_sp) bar_backs[2].setAttribute("style", "background-color:purple");
var is_channeling = function() {
var is_channeling = function() {
if (!settings.stopWhenChanneling) return false;
if (!settings.stopWhenChanneling) return false;
var status_icons = document.querySelectorAll('img[onmouseover^="battle.set_infopane_effect"]');
var status_icons = document.querySelectorAll('img[onmouseover^="battle.set_infopane_effect"]');
for (var i = 0, len = status_icons.length; i < len; i++) {
for (var i = 0, len = status_icons.length; i < len; i++) {
if (/\bchanneling\b/i.test(status_icons[i].onmouseover.toString())) {
if (/\bchanneling\b/i.test(status_icons[i].onmouseover.toString())) {
//var img = document.querySelector('.btp').appendChild(document.createElement('img'));
//var img = document.querySelector('.btp').appendChild(document.createElement('img'));
//img.src = "http://ehgt.org/v/e/channeling.png";
//img.src = "http://ehgt.org/v/e/channeling.png";
//img.style.cssText = 'border: 3px solid cyan; margin-right:2px; margin-left:2px;';
//img.style.cssText = 'border: 3px solid cyan; margin-right:2px; margin-left:2px;';
return true;
return true;
}
}
}
}
return false;
return false;
};
};
//return (low_hp || low_mp || low_sp || oc_full || is_channeling);
//return (low_hp || low_mp || low_sp || oc_full || is_channeling);
return (low_hp || low_mp || low_sp || is_channeling());
return (low_hp || low_mp || low_sp || is_channeling());
}
}
var mpane = document.getElementById('monsterpane');
var mpane = document.getElementById('monsterpane');
if (mpane && !NoHoverClick()) {
if (mpane && !NoHoverClick()) {
複製
已複製
複製
已複製
var m = mpane.getElementsByClassName("btm1");
// Check if cursor is hovering on a monster
for (var i = 0; i < m.length; i++) {
var monster = getMonsterUnderCursor();
if (m[i].hasAttribute('onclick')) {
if ( monster ) {
m[i].setAttribute('onmouseover', m[i].getAttribute('onclick'));
monster.click();
} else {
// Add hover event listeners
var m = mpane.getElementsByClassName("btm1");
for (var i = 0; i < m.length; i++) {
if (m[i].hasAttribute('onclick')) {
m[i].setAttribute('onmouseover', m[i].getAttribute('onclick'));
}
}
}
}
}
}
}
複製
已複製
複製
已複製
})();
}
}
複製
已複製
複製
已複製
/
/### custom MouseMelee script - end ###
/
* ============ MOUSE MELEE END =========== */
}
}
複製
已複製
複製
已複製
var replacements = '.cwbdv, .bte, #ckey_spirit, #ckey_defend, #togpane_magico, #togpane_magict, #togpane_item, #quickbar, #togpane_log';
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ *\
var monsterReplacements = '#mkey_0, #mkey_1, #mkey_2, #mkey_3, #mkey_4, #mkey_5, #mkey_6, #mkey_7, #mkey_8, #mkey_9';
* ========== ON PAGE RELOAD END ========== *
\* ======================================== */
/* ======================================== *\
* =============== C O R E ============== *
\* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
/* ============= SUBMIT ACTION ============ */
function SubmitAction() {
function SubmitAction() {
複製
已複製
複製
已複製
//
End of round, continue button pressed
//
End of round, continue button pressed
if (document.getElementById("battleaction").value ==
0) {
if (document.getElementById("battleaction").value ==
=
0) {
window.location.href = window.location.href;
window.location.href = window.location.href;
return;
return;
}
}
//var loadStart = (new Date()).getTime();
//var loadStart = (new Date()).getTime();
複製
已複製
複製
已複製
//
Serialize the form data
//
Serialize the form data
var inputs = document.getElementsByTagName("input");
var inputs = document.getElementsByTagName("input");
var serializedForm = "";
var serializedForm = "";
for (var i = 0; i < inputs.length; i++) {
for (var i = 0; i < inputs.length; i++) {
複製
已複製
複製
已複製
if (i !
= 0)
if (i !
=
= 0)
serializedForm += "&";
serializedForm += "&";
serializedForm += inputs[i].id + "=" + inputs[i].value;
serializedForm += inputs[i].id + "=" + inputs[i].value;
}
}
複製
已複製
複製
已複製
//
Make
the AJAX call
//
Send
the AJAX call
var r = new XMLHttpRequest();
var r = new XMLHttpRequest();
r.open("POST", "", true);
r.open("POST", "", true);
r.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
r.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
r.responseType = 'document';
r.responseType = 'document';
r.onload = function() {
r.onload = function() {
if (r.status >= 200 && r.status < 400) {
if (r.status >= 200 && r.status < 400) {
updatePage(r.response);
updatePage(r.response);
}
}
複製
已複製
複製
已複製
}
}
;
r.send(serializedForm);
r.send(serializedForm);
複製
已複製
複製
已複製
/
/ Selectively replace elements on the screen
/
* ============== UPDATE PAGE ============= */
function updatePage(data) {
function updatePage(data) {
複製
已複製
複製
已複製
var existing, newStuff, i;
var replacements = '.cwbdv, .bte, #ckey_spirit, #ckey_defend, #togpane_magico, #togpane_magict, #togpane_item, #quickbar, #togpane_log';
var monsterReplacements = '#mkey_0, #mkey_1, #mkey_2, #mkey_3, #mkey_4, #mkey_5, #mkey_6, #mkey_7, #mkey_8, #mkey_9';
//var loadEnd = (new Date()).getTime();
//var loadEnd = (new Date()).getTime();
//console.log("PostTime = " + (loadEnd - loadStart));
//console.log("PostTime = " + (loadEnd - loadStart));
// Handle simple replacements
// Handle simple replacements
複製
已複製
複製
已複製
var
existing = document.querySelectorAll(replacements);
existing = document.querySelectorAll(replacements);
var
newStuff = data.querySelectorAll(replacements);
newStuff = data.querySelectorAll(replacements);
var
i = existing.length;
i = existing.length;
while (i--) {
while (i--) {
existing[i].parentNode.replaceChild(newStuff[i], existing[i]);
existing[i].parentNode.replaceChild(newStuff[i], existing[i]);
}
}
// Handle monster replacements (don't replace dead monsters)
// Handle monster replacements (don't replace dead monsters)
複製
已複製
複製
已複製
var
existing = document.querySelectorAll(monsterReplacements);
existing = document.querySelectorAll(monsterReplacements);
var
newStuff = data.querySelectorAll(monsterReplacements);
newStuff = data.querySelectorAll(monsterReplacements);
var
i = existing.length;
i = existing.length;
while (i--) {
while (i--) {
if (existing[i].hasAttribute("onclick") || newStuff[i].hasAttribute("onclick")) {
if (existing[i].hasAttribute("onclick") || newStuff[i].hasAttribute("onclick")) {
existing[i].parentNode.replaceChild(newStuff[i], existing[i]);
existing[i].parentNode.replaceChild(newStuff[i], existing[i]);
}
}
}
}
var popup = data.getElementsByClassName('btcp');
var popup = data.getElementsByClassName('btcp');
var navbar = data.getElementById('navbar');
var navbar = data.getElementById('navbar');
複製
已複製
複製
已複製
// Navbar
if (navbar) {
if (navbar) {
複製
已複製
複製
已複製
//
Show navbar
//
Show navbar
var mainpane = document.getElementById('mainpane');
var mainpane = document.getElementById('mainpane');
mainpane.parentNode.insertBefore(navbar, mainpane);
mainpane.parentNode.insertBefore(navbar, mainpane);
window.at_attach("parent_Character", "child_Character", "hover", "y", "pointer");
window.at_attach("parent_Character", "child_Character", "hover", "y", "pointer");
window.at_attach("parent_Bazaar", "child_Bazaar", "hover", "y", "pointer");
window.at_attach("parent_Bazaar", "child_Bazaar", "hover", "y", "pointer");
window.at_attach("parent_Battle", "child_Battle", "hover", "y", "pointer");
window.at_attach("parent_Battle", "child_Battle", "hover", "y", "pointer");
window.at_attach("parent_Forge", "child_Forge", "hover", "y", "pointer");
window.at_attach("parent_Forge", "child_Forge", "hover", "y", "pointer");
}
}
複製
已複製
複製
已複製
if (popup.length !
= 0) {
// Popup
if (popup.length !
=
= 0) {
if (!navbar) {
if (!navbar) {
//End of round
//End of round
if (settings.showPopup) {
if (settings.showPopup) {
//Show popup
//Show popup
var parent = document.getElementsByClassName('btt')[0];
var parent = document.getElementsByClassName('btt')[0];
parent.insertBefore(popup[0], parent.firstChild);
parent.insertBefore(popup[0], parent.firstChild);
}
}
} else {
} else {
//End of battle serie
//End of battle serie
//Show popup
//Show popup
var parent = document.getElementsByClassName('btt')[0];
var parent = document.getElementsByClassName('btt')[0];
parent.insertBefore(popup[0], parent.firstChild);
parent.insertBefore(popup[0], parent.firstChild);
}
}
}
}
複製
已複製
複製
已複製
// Do everything again
//var swapEnd = (new Date()).getTime();
//var swapEnd = (new Date()).getTime();
//console.log("SwapTime = " + (swapEnd - loadEnd));
//console.log("SwapTime = " + (swapEnd - loadEnd));
複製
已複製
複製
已複製
// Run all script modules again; new content has been loaded
OnPageReload();
OnPageReload();
複製
已複製
複製
已複製
if ((popup.length !
= 0) || navbar) {
if ((popup.length !
=
= 0) || navbar) {
//Reset the round counter
//Reset the round counter
sessionStorage.removeItem('rounds');
sessionStorage.removeItem('rounds');
複製
已複製
複製
已複製
if ((popup.length !
= 0) && !navbar) {
if ((popup.length !
=
= 0) && !navbar) {
//End of round
//End of round
if (settings.skipToNextRound) {
if (settings.skipToNextRound) {
複製
已複製
複製
已複製
//Auto-advance to next round
//Auto-advance to next round
複製
已複製
複製
已複製
if (settings.popupTime ==
0) {
if (settings.popupTime ==
=
0) {
window.location.href = window.location.href;
window.location.href = window.location.href;
} else {
} else {
setTimeout(function() {
setTimeout(function() {
window.location.href = window.location.href;
window.location.href = window.location.href;
}, settings.popupTime);
}, settings.popupTime);
}
}
複製
已複製
複製
已複製
// Mousemelee Chrome keep-on-going fix
// Store cursor position to localStorage
// When the round changes, the whole page is reloaded, and
// curX and curY is set to its default value when it is declared.
// This stops the keep-on-going mechanism. Storing the last known
// cursor position and loading them when the page fully reloads
// fixes this issue.
if ( settings.mouseMelee ) {
localStorage.setItem('curX', curX);
localStorage.setItem('curY', curY);
}
}
}
} else {
} else {
//End of battle serie
//End of battle serie
//Remove the record of Counter Plus
//Remove the record of Counter Plus
localStorage.removeItem('record');
localStorage.removeItem('record');
}
}
}
}
//var customEnd = (new Date()).getTime();
//var customEnd = (new Date()).getTime();
//console.log("CustomTime = " + (customEnd - swapEnd));
//console.log("CustomTime = " + (customEnd - swapEnd));
//console.log("TotalTime = " + (customEnd - loadStart));
//console.log("TotalTime = " + (customEnd - loadStart));
}
}
複製
已複製
複製
已複製
/* ============ UPDATE PAGE END =========== */
}
}
複製
已複製
複製
已複製
/* =========== SUBMIT ACTION END ========== */
// Run this stuff after the page is loaded
addEventListener('DOMContentLoaded', OnPageLoad, false);
function OnPageLoad() {
// TODO: One-time stuff that happens on page load should go here
複製
已複製
複製
已複製
//Exit
if
not
in
a
battle
// Start script
if
in
battle
if (
!
document.getElementById('togpane_log')
) {
if (
document.getElementById('togpane_log')
) {
return;
}
複製
已複製
複製
已複製
//
### Round counter ###
//
Init
Text moved to lines 116-122
if (settings.roundCounter) {
initialPageLoad();
var logs = document.querySelector('#togpane_log tr:nth-last-child(2)').textContent;
if (/Round/.test(logs) && !sessionStorage.rounds) {
var round = logs.match(/Round ([\d\s\/]+)/)[1];
sessionStorage.setItem('rounds', round);
} else {
var round = sessionStorage.getItem('rounds') || undefined;
}
Text moved with changes to lines 124-139 (98.3% similarity)
if (round !== undefined) {
var x = document.getElementById('mainpane').appendChild(document.createElement('div'));
x.id = 'round';
x.innerHTML = round;
var final = round.split('/');
switch (final[1] - final[0]) {
case 0:
x.style.color = '#ff0000';
break;
case 1:
x.style.color = '#ffcc99';
break;
}
}
}
//### Round counter - end ###
複製
已複製
複製
已複製
//
C
ustom submit
//
Replace submit with c
ustom submit
document.getElementById("battleform").submit = SubmitAction;
document.getElementById("battleform").submit = SubmitAction;
複製
已複製
複製
已複製
// Run all script modules
OnPageReload();
OnPageReload();
}
}
複製
已複製
複製
已複製
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ *\
* =========== C O R E E N D ========== *
\* ======================================== */
已保存差異
原始文本
開啟檔案
// ==UserScript== // @name Reloader // @namespace HVRLD3 // @author nihilvoid, Dan31 // @run-at document-start // @include http://hentaiverse.org/* // @version 1.3 // @grant none // ==/UserScript== //Vanilla Reloader: http://forums.e-hentai.org/index.php?s=&showtopic=65126&view=findpost&p=4259841 //Select a custom font in your settings: http://hentaiverse.org/?s=Character&ss=se //Example: Cambria/9/bold/normal/-4 //TODO (development): //- fix battlelog append //- add Hoheneim's additions //- fix round counter display at end of battle serie //- add support for browsers other than Firefox (-> update mousemelee) //Change your settings here var settings = { //Hide the Welcome to the Hentaiverse image hideWelcome: true, //Disable buff/debuff blinking noBlinking: true, //Show buff/debuff durations effectDurations: true, //Show gem, click on icon to use gemIcon: true, //Show current round roundCounter: true, //Change the default action to a T1 spell //No change: 0, Fiery Blast: 1, Freeze: 2, Shockblast: 3, Gale: 4, Smite: 5, Corruption: 6 defaultAction: 0, //Enable Mousemelee, disable it on conditions (minHP = 0.4 means disabled when HP under 40%, etc.) mouseMelee: true, minHP: 0.4, minMP: 0.12, minSP: 0.3, stopWhenChanneling: true, //Show the battle log battleLog: true, //battleLogAppend: false,//disabled for now (need to redo this without jQuery) //Auto-advance to next round on round clear after set time (ms) skipToNextRound: true, popupTime: 0, showPopup: false, //Enable HV Counter Plus (show turns, speed, time, exp, credits at the end of a battle serie) counterPlus: true }; //----------------------------------------------------------------------------------------------------------------- document.title = 'HV'; //Change page title to 'HV' var sheet = document.createElement('style'); //style for round counter and effect duration sheet.innerHTML = '#round{position:absolute;left:1080px;top:15px;width:120px;font-size:20px;font-weight:bold;z-index:10;text-align:right}.duration{width:30px;display:inline-block;text-align:center;position:relative;margin-left:-30px;top:-4px}.duration>div{background:white;border:1px solid black;padding:0 2px;display:inline-block;min-width:8px;font-weight:bold;height:13px}'; if (!settings.battleLog) { //Hide the battle log sheet.innerHTML += "#togpane_log {display: none}"; } if (settings.hideWelcome) { //Hide the 'Welcome to the Hentaiverse' image. sheet.innerHTML += 'img.cw{display: none}.cbl:nth-of-type(1){padding-top:114px}'; } document.head.appendChild(sheet); //### No blinking script ### //Disables buff/debuff blinking if (settings.noBlinking) { window.addEventListener('beforescriptexecute', function(e) { if (/battle\.set_infopane\("Battle Time"\)/.test(e.target.innerHTML)) { e.preventDefault(); window.removeEventListener(e.type, arguments.callee, true); } }, true); }; //### No blinking script - end ### function OnPageReload() { // Reinitialize the battle manager window.battle = new window.Battle; window.battle.clear_infopane(); // TODO: Anything that needs to trigger when a new battle page starts should go here // i.e. Stat tracking, log parsing, battle-UI changes, etc. //### Change default action ### function changeDefault(id) { var caller = document.getElementById(id.toString()); window.battle.lock_action(caller, 1, 'magic', id); window.battle.set_hostile_subattack(id); } switch (settings.defaultAction) { //Default (Attack) case 0: break; case 1: //Fiery Blast changeDefault(111); break; case 2: //Freeze changeDefault(121); break; case 3: //Shockblast changeDefault(131); break; case 4: //Gale changeDefault(141); break; case 5: //Smite changeDefault(151); break; case 6: //Corruption changeDefault(161); break; } //### Change default action - end ### //### HV Counter Plus ### if (settings.counterPlus) { var record = localStorage.record ? JSON.parse(localStorage.record) : { 'turns': 0, 'time': 0, 'EXP': 0, 'Credits': 0 }, pop = document.getElementsByClassName('btcp')[0], set = function() { localStorage.setItem('record', JSON.stringify(record)); }, build = function(item, point) { record[item] = record[item] * 1 + point * 1; }; if (!record.time) { build('time', Date.now()); set(); } if (pop) { var target, label, i = 0, text = document.querySelectorAll('#togpane_log .t3b'), turn = document.querySelector('#togpane_log .t1').textContent; build('turns', turn); while (i < text.length) { target = text[i].textContent; if (/Victorious.$|Fleeing.$/.test(target)) break; label = target.match(/(\d+) ([EC]\w+).$/); if (label) build(label[2], label[1]); i++; } if (pop.getElementsByTagName('img')[0]) set(); else { var num = 0, runTime = Math.floor((Date.now() - record.time) / 1000), text = pop.getElementsByClassName('fd4'), len = text.length, result = pop.appendChild(document.createElement('div')); result.style.cssText = 'font-size:15px;font-weight:bold;margin-top:15px;'; for (i = 0; i < len; i++) text[i].firstChild.style.marginTop = '-4px'; pop.style.top = '23px'; if (len > 2) pop.style.height = len > 3 ? '190px' : '170px'; for (key in record) { var div = result.appendChild(document.createElement('div')); div.style.cssText = 'display:inline-block;margin-bottom:7px;'; if (!(num % 2)) div.style.marginRight = '20px'; if (key == 'time') { var hour = ('0' + Math.floor(runTime / 3600) % 100).slice(-2), min = ('0' + Math.floor(runTime / 60) % 60).slice(-2), sec = ('0' + runTime % 60).slice(-2); div.textContent = (hour != 0 ? hour + ' h ' : '') + (min != 0 ? min + ' m ' : '') + sec + ' s'; result.appendChild(document.createElement('br')); } else { var total = record[key] + ''; while (total != (total = total.replace(/^(\d+)(\d{3})/, '$1,$2'))); div.textContent = total + ' ' + key.toLowerCase(); if (!num) div.textContent += ' (' + ((Math.floor((record[key] / runTime) * 1000)) / 1000).toFixed(2) + ' t/s)'; } num++; } } } } //### HV Counter Plus - end ### //### Effect duration ### //From HV Stats Slim if (settings.effectDurations) { var targets = document.querySelectorAll('img[onmouseover^="battle.set_infopane_effect"]'), i = targets.length; while (i--) { var duration = targets[i].getAttribute('onmouseover').match(/, ([-\d]+)\)/); if (!duration || duration < 0) duration = '-'; else duration = duration[1]; var div = targets[i].parentNode.insertBefore(document.createElement('div'), targets[i].nextSibling); div.appendChild(document.createElement('div')).innerHTML = duration; div.className = 'duration'; } } //### Effect duration - end ### //### Show Gems script ### //Show an icon when possessing a gem, which can be clicked to use it. if (settings.gemIcon) { var gem = document.getElementById('ikey_p'); var gem_icon = document.getElementById("gem_icon"); if (gem && !gem_icon) { var icon; switch (gem.getAttribute('onmouseover').match(/'([^\s]+) Gem/)[1]) { case 'Mystic': icon = 'channeling.png'; break; case 'Health': icon = 'healthpot.png'; break; case 'Mana': icon = 'manapot.png'; break; case 'Spirit': icon = 'spiritpot.png'; break; }; gem_icon = document.querySelector('.btp').appendChild(document.createElement('img')); //gem_icon.src = 'https://raw.github.com/greentea039/HVSTAT/5a7a1e09b8847394faacf0d4b1321d51cb96816f/css/images/' + icon; //gem_icon.src = icon; gem_icon.src = 'http://ehgt.org/v/e/' + icon; gem_icon.style.cssText = 'border: 1px solid black; position: absolute; float: right; right: 6px; top: 8px;'; gem_icon.onclick = function() { window.battle.lock_action(gem, 1, 'items', 'ikey_p'); window.battle.set_friendly_subattack('999'); window.battle.touch_and_go(); gem.remove(); gem_icon.remove(); } gem_icon.id = "gem_icon"; } else if (!gem && gem_icon) { gem_icon.remove(); } } //### Show Gems script - end ### //### custom MouseMelee script ### //Hover over monsters to attack. Stops on defined conditions. if (settings.mouseMelee) { function NoHoverClick() { var bars = document.getElementsByClassName("cwb2"); var hp = bars[0].width / 120; var mp = bars[1].width / 120; var sp = bars[2].width / 120; //var oc = bars[3].width/120; var low_hp = (hp < settings.minHP); var low_mp = (mp < settings.minMP); var low_sp = (sp < settings.minSP); //var oc_full = (oc == 1); var bar_backs = document.getElementsByClassName("cwbdv"); if (low_hp) bar_backs[0].setAttribute("style", "background-color:purple"); if (low_mp) bar_backs[1].setAttribute("style", "background-color:purple"); if (low_sp) bar_backs[2].setAttribute("style", "background-color:purple"); var is_channeling = function() { if (!settings.stopWhenChanneling) return false; var status_icons = document.querySelectorAll('img[onmouseover^="battle.set_infopane_effect"]'); for (var i = 0, len = status_icons.length; i < len; i++) { if (/\bchanneling\b/i.test(status_icons[i].onmouseover.toString())) { //var img = document.querySelector('.btp').appendChild(document.createElement('img')); //img.src = "http://ehgt.org/v/e/channeling.png"; //img.style.cssText = 'border: 3px solid cyan; margin-right:2px; margin-left:2px;'; return true; } } return false; }; //return (low_hp || low_mp || low_sp || oc_full || is_channeling); return (low_hp || low_mp || low_sp || is_channeling()); } var mpane = document.getElementById('monsterpane'); if (mpane && !NoHoverClick()) { var m = mpane.getElementsByClassName("btm1"); for (var i = 0; i < m.length; i++) { if (m[i].hasAttribute('onclick')) { m[i].setAttribute('onmouseover', m[i].getAttribute('onclick')); } } } } //### custom MouseMelee script - end ### } var replacements = '.cwbdv, .bte, #ckey_spirit, #ckey_defend, #togpane_magico, #togpane_magict, #togpane_item, #quickbar, #togpane_log'; var monsterReplacements = '#mkey_0, #mkey_1, #mkey_2, #mkey_3, #mkey_4, #mkey_5, #mkey_6, #mkey_7, #mkey_8, #mkey_9'; function SubmitAction() { //End of round, continue button pressed if (document.getElementById("battleaction").value == 0) { window.location.href = window.location.href; return; } //var loadStart = (new Date()).getTime(); //Serialize the form data var inputs = document.getElementsByTagName("input"); var serializedForm = ""; for (var i = 0; i < inputs.length; i++) { if (i != 0) serializedForm += "&"; serializedForm += inputs[i].id + "=" + inputs[i].value; } //Make the AJAX call var r = new XMLHttpRequest(); r.open("POST", "", true); r.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8'); r.responseType = 'document'; r.onload = function() { if (r.status >= 200 && r.status < 400) { updatePage(r.response); } } r.send(serializedForm); // Selectively replace elements on the screen function updatePage(data) { //var loadEnd = (new Date()).getTime(); //console.log("PostTime = " + (loadEnd - loadStart)); // Handle simple replacements var existing = document.querySelectorAll(replacements); var newStuff = data.querySelectorAll(replacements); var i = existing.length; while (i--) { existing[i].parentNode.replaceChild(newStuff[i], existing[i]); } // Handle monster replacements (don't replace dead monsters) var existing = document.querySelectorAll(monsterReplacements); var newStuff = data.querySelectorAll(monsterReplacements); var i = existing.length; while (i--) { if (existing[i].hasAttribute("onclick") || newStuff[i].hasAttribute("onclick")) { existing[i].parentNode.replaceChild(newStuff[i], existing[i]); } } var popup = data.getElementsByClassName('btcp'); var navbar = data.getElementById('navbar'); if (navbar) { //Show navbar var mainpane = document.getElementById('mainpane'); mainpane.parentNode.insertBefore(navbar, mainpane); window.at_attach("parent_Character", "child_Character", "hover", "y", "pointer"); window.at_attach("parent_Bazaar", "child_Bazaar", "hover", "y", "pointer"); window.at_attach("parent_Battle", "child_Battle", "hover", "y", "pointer"); window.at_attach("parent_Forge", "child_Forge", "hover", "y", "pointer"); } if (popup.length != 0) { if (!navbar) { //End of round if (settings.showPopup) { //Show popup var parent = document.getElementsByClassName('btt')[0]; parent.insertBefore(popup[0], parent.firstChild); } } else { //End of battle serie //Show popup var parent = document.getElementsByClassName('btt')[0]; parent.insertBefore(popup[0], parent.firstChild); } } // Do everything again //var swapEnd = (new Date()).getTime(); //console.log("SwapTime = " + (swapEnd - loadEnd)); OnPageReload(); if ((popup.length != 0) || navbar) { //Reset the round counter sessionStorage.removeItem('rounds'); if ((popup.length != 0) && !navbar) { //End of round if (settings.skipToNextRound) { //Auto-advance to next round if (settings.popupTime == 0) { window.location.href = window.location.href; } else { setTimeout(function() { window.location.href = window.location.href; }, settings.popupTime); } } } else { //End of battle serie //Remove the record of Counter Plus localStorage.removeItem('record'); } } //var customEnd = (new Date()).getTime(); //console.log("CustomTime = " + (customEnd - swapEnd)); //console.log("TotalTime = " + (customEnd - loadStart)); } } // Run this stuff after the page is loaded addEventListener('DOMContentLoaded', OnPageLoad, false); function OnPageLoad() { // TODO: One-time stuff that happens on page load should go here //Exit if not in a battle if (!document.getElementById('togpane_log')) { return; } //### Round counter ### if (settings.roundCounter) { var logs = document.querySelector('#togpane_log tr:nth-last-child(2)').textContent; if (/Round/.test(logs) && !sessionStorage.rounds) { var round = logs.match(/Round ([\d\s\/]+)/)[1]; sessionStorage.setItem('rounds', round); } else { var round = sessionStorage.getItem('rounds') || undefined; } if (round !== undefined) { var x = document.getElementById('mainpane').appendChild(document.createElement('div')); x.id = 'round'; x.innerHTML = round; var final = round.split('/'); switch (final[1] - final[0]) { case 0: x.style.color = '#ff0000'; break; case 1: x.style.color = '#ffcc99'; break; } } } //### Round counter - end ### //Custom submit document.getElementById("battleform").submit = SubmitAction; OnPageReload(); }
更改後文本
開啟檔案
// ==UserScript== // @name Reloader // @namespace HVRLD3 // @author nihilvoid, Dan31, FabulousCupcake, simrock87 // @run-at document-end // @include http://hentaiverse.org/* // @version 1.3.1 // @grant none // ==/UserScript== // Vanilla Reloader: // http://forums.e-hentai.org/index.php?s=&showtopic=65126&view=findpost&p=4259841 // Select a custom font in your settings: // http://hentaiverse.org/?s=Character&ss=se // Todo List: // - fix battlelog append // - add Hoheneim's additions // - fix round counter display at end of battle serie // - add support for browsers other than Firefox (-> update mousemelee) // Credits and Sources // ------------------------ // Original reloader idea : nihilvoid // Reloader maintainer : Dan31 // No Blinking : HV Stat /* ======================================== *\ * ============= CONFIGURATION ============ * \* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ var settings = { hideWelcome: true, // Hide the "Welcome to the Hentaiverse" image/logo noBlinking: true, // Disable buff/debuff blinking effectDurations: true, // Show buff/debuff durations gemIcon: true, // Show gem/powerup, click on icon to use roundCounter: true, // Show current round and rounds remaining defaultAction: 0, // Change the default action to a T1 spell // | 0 | 1 | 2 | 3 | 4 | 5 | 6 | // | No Change | Fiery Blast | Freeze | Shockblast | Gale | Smite | Corruption | mouseMelee: true, // MouseMelee ( hover on enemies to attack ) minHP: 0.4, // Stop if hp is below this threshold minMP: 0.12, // Stop if mp ... minSP: 0.3, // Stop if sp ... stopWhenChanneling: true, // Stop if you have channeling buff battleLog: true, // Show battle log //battleLogAppend: false, //disabled for now (need to redo this without jQuery) skipToNextRound: true, // Auto-advance to next round popupTime: 0, // after `popupTime`ms showPopup: false, // Show that end of round popup? counterPlus: true // HV-Counter-Plus ( shows turns, speed, time, exp, and credits at the end of game ) }; /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ *\ * =========== CONFIGURATION END ========== * \* ======================================== */ /* ======================================== *\ * ============= INITIAL LOAD ============= * \* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ // Stuffs to be ran on page load function initialPageLoad() { // Hoverplay fix for Chrome // Constantly track cursor position to allow chrome to keep hitting a monster when hovering on one. // You'd have to keep moving your cursor without this fix if ( settings.mouseMelee ) { // Get cursor position from the last round curX = localStorage.getItem('curX'); curY = localStorage.getItem('curY'); localStorage.removeItem('curX'); localStorage.removeItem('curY'); // Update curX and curY whenever cursor moves if (window.Event) document.captureEvents(Event.MOUSEMOVE); document.onmousemove = function(e) { curX = (window.Event) ? e.pageX : event.clientX + (document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft); curY = (window.Event) ? e.pageY : event.clientY + (document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop); }; } // Change page title to "HV" document.title = 'HV'; // Insert stylesheet for Round Counter and Effect Duration var sheet = document.createElement('style'); sheet.innerHTML = '#round{position:absolute;left:1080px;top:15px;width:120px;font-size:20px;font-weight:bold;z-index:10;text-align:right}.duration{width:30px;display:inline-block;text-align:center;position:relative;margin-left:-30px;top:-4px}.duration>div{background:white;border:1px solid black;padding:0 2px;display:inline-block;min-width:8px;font-weight:bold;height:13px}'; // Hide Battle Log if (!settings.battleLog) sheet.innerHTML += '#togpane_log {display: none}'; // Hide Welcome Logo if (settings.hideWelcome) { sheet.innerHTML += 'img.cw{display: none}.cbl:nth-of-type(1){padding-top:114px}'; } document.head.appendChild(sheet); /* ============== NO BLINKING ============= */ if (settings.noBlinking) { window.addEventListener('beforescriptexecute', function(e) { if (/battle\.set_infopane\("Battle Time"\)/.test(e.target.innerHTML)) { e.preventDefault(); window.removeEventListener(e.type, arguments.callee, true); } }, true); } /* ============ NO BLINKING END =========== */ /* ============= ROUND COUNTER ============ */ if (settings.roundCounter) { var logs = document.querySelector('#togpane_log tr:nth-last-child(2)').textContent; if (/Round/.test(logs) && !sessionStorage.rounds) { var round = logs.match(/Round ([\d\s\/]+)/)[1]; sessionStorage.setItem('rounds', round); } else { var round = sessionStorage.getItem('rounds') || undefined; } if (round !== undefined) { var x = document.getElementById('mainpane').appendChild(document.createElement('div')); x.id = 'round'; x.innerHTML = round; var final = round.split('/'); switch (final[1] - final[0]) { case 0: x.style.color = '#ff0000'; break; case 1: x.style.color = '#ffcc99'; break; } } } /* =========== ROUND COUNTER END ========== */ } /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ *\ * =========== INITIAL LOAD END =========== * \* ======================================== */ /* ======================================== *\ * ============ ON PAGE RELOAD ============ * \* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ // Stuffs to be executed after the xhr request is sent // and the page is loaded with new content. function OnPageReload() { // Reinitialize the battle manager window.battle = new window.Battle(); window.battle.clear_infopane(); // TODO: Anything that needs to trigger when a new battle page starts should go here // i.e. Stat tracking, log parsing, battle-UI changes, etc. /* ============ DEFAULT ACTION ============ */ function changeDefault(id) { var caller = document.getElementById(id.toString()); window.battle.lock_action(caller, 1, 'magic', id); window.battle.set_hostile_subattack(id); } switch (settings.defaultAction) { //Default (Attack) case 0: break; case 1: //Fiery Blast changeDefault(111); break; case 2: //Freeze changeDefault(121); break; case 3: //Shockblast changeDefault(131); break; case 4: //Gale changeDefault(141); break; case 5: //Smite changeDefault(151); break; case 6: //Corruption changeDefault(161); break; } /* ========== DEFAULT ACTION END ========== */ /* ============ HV COUNTER PLUS =========== */ if (settings.counterPlus) { (function(){ var record = localStorage.record ? JSON.parse(localStorage.record) : { 'turns': 0, 'time': 0, 'EXP': 0, 'Credits': 0 }, pop = document.getElementsByClassName('btcp')[0], set = function() { localStorage.setItem('record', JSON.stringify(record)); }, build = function(item, point) { record[item] = record[item] * 1 + point * 1; }; if (!record.time) { build('time', Date.now()); set(); } if (pop) { var target, label, i = 0, textC = document.querySelectorAll('#togpane_log .t3b'), turn = document.querySelector('#togpane_log .t1').textContent; build('turns', turn); while (i < textC.length) { target = textC[i].textContent; if (/Victorious.$|Fleeing.$/.test(target)) break; label = target.match(/(\d+) ([EC]\w+).$/); if (label) build(label[2], label[1]); i++; } if (pop.getElementsByTagName('img')[0]) set(); else { var num = 0, runTime = Math.floor((Date.now() - record.time) / 1000), text = pop.getElementsByClassName('fd4'), len = text.length, result = pop.appendChild(document.createElement('div')); result.style.cssText = 'font-size:15px;font-weight:bold;margin-top:15px;'; for (i = 0; i < len; i++) text[i].firstChild.style.marginTop = '-4px'; pop.style.top = '23px'; if (len > 2) pop.style.height = len > 3 ? '190px' : '170px'; for (var key in record) { var div = result.appendChild(document.createElement('div')); div.style.cssText = 'display:inline-block;margin-bottom:7px;'; if (!(num % 2)) div.style.marginRight = '20px'; if (key == 'time') { var hour = ('0' + Math.floor(runTime / 3600) % 100).slice(-2), min = ('0' + Math.floor(runTime / 60) % 60).slice(-2), sec = ('0' + runTime % 60).slice(-2); div.textContent = (hour !== 0 ? hour + ' h ' : '') + (min !== 0 ? min + ' m ' : '') + sec + ' s'; result.appendChild(document.createElement('br')); } else { var total = record[key] + ''; while (total != (total = total.replace(/^(\d+)(\d{3})/, '$1,$2'))); div.textContent = total + ' ' + key.toLowerCase(); if (!num) div.textContent += ' (' + ((Math.floor((record[key] / runTime) * 1000)) / 1000).toFixed(2) + ' t/s)'; } num++; } } } })(); } /* ========== HV COUNTER PLUS END ========= */ /* ============= BUFF DURATION ============ */ if (settings.effectDurations) { (function(){ var targets = document.querySelectorAll('img[onmouseover^="battle.set_infopane_effect"]'), i = targets.length; while (i--) { var duration = targets[i].getAttribute('onmouseover').match(/, ([-\d]+)\)/); if (!duration || duration < 0) duration = '-'; else duration = duration[1]; var div = targets[i].parentNode.insertBefore(document.createElement('div'), targets[i].nextSibling); div.appendChild(document.createElement('div')).innerHTML = duration; div.className = 'duration'; } })(); } /* =========== BUFF DURATION END ========== */ /* =============== SHOW GEMS ============== */ if (settings.gemIcon) { (function(){ var gem = document.getElementById('ikey_p'); var gem_icon = document.getElementById("gem_icon"); if (gem && !gem_icon) { var icon; switch (gem.getAttribute('onmouseover').match(/'([^\s]+) Gem/)[1]) { case 'Mystic': icon = 'channeling.png'; break; case 'Health': icon = 'healthpot.png'; break; case 'Mana': icon = 'manapot.png'; break; case 'Spirit': icon = 'spiritpot.png'; break; } gem_icon = document.querySelector('.btp').appendChild(document.createElement('img')); //gem_icon.src = 'https://raw.github.com/greentea039/HVSTAT/5a7a1e09b8847394faacf0d4b1321d51cb96816f/css/images/' + icon; //gem_icon.src = icon; gem_icon.src = 'http://ehgt.org/v/e/' + icon; gem_icon.style.cssText = 'border: 1px solid black; position: absolute; float: right; right: 6px; top: 8px;'; gem_icon.onclick = function() { window.battle.lock_action(gem, 1, 'items', 'ikey_p'); window.battle.set_friendly_subattack('999'); window.battle.touch_and_go(); gem.remove(); gem_icon.remove(); }; gem_icon.id = "gem_icon"; } else if (!gem && gem_icon) { gem_icon.remove(); } })(); } /* ============= SHOW GEMS END ============ */ /* ============== MOUSE MELEE ============= */ if (settings.mouseMelee) { (function(){ function getMonsterUnderCursor() { var el = document.elementFromPoint(curX, curY); var result = false; // Check `el` and iteratively its parents until we hit body or found monster while(!result) { if(el.nodeName.toLowerCase() === 'body') break; result = ( el.id.match('mkey') ? el : false ); el = el.parentElement; } return result; } function NoHoverClick() { var bars = document.getElementsByClassName("cwb2"); var hp = bars[0].width / 120; var mp = bars[1].width / 120; var sp = bars[2].width / 120; //var oc = bars[3].width/120; var low_hp = (hp < settings.minHP); var low_mp = (mp < settings.minMP); var low_sp = (sp < settings.minSP); //var oc_full = (oc == 1); var bar_backs = document.getElementsByClassName("cwbdv"); if (low_hp) bar_backs[0].setAttribute("style", "background-color:purple"); if (low_mp) bar_backs[1].setAttribute("style", "background-color:purple"); if (low_sp) bar_backs[2].setAttribute("style", "background-color:purple"); var is_channeling = function() { if (!settings.stopWhenChanneling) return false; var status_icons = document.querySelectorAll('img[onmouseover^="battle.set_infopane_effect"]'); for (var i = 0, len = status_icons.length; i < len; i++) { if (/\bchanneling\b/i.test(status_icons[i].onmouseover.toString())) { //var img = document.querySelector('.btp').appendChild(document.createElement('img')); //img.src = "http://ehgt.org/v/e/channeling.png"; //img.style.cssText = 'border: 3px solid cyan; margin-right:2px; margin-left:2px;'; return true; } } return false; }; //return (low_hp || low_mp || low_sp || oc_full || is_channeling); return (low_hp || low_mp || low_sp || is_channeling()); } var mpane = document.getElementById('monsterpane'); if (mpane && !NoHoverClick()) { // Check if cursor is hovering on a monster var monster = getMonsterUnderCursor(); if ( monster ) { monster.click(); } else { // Add hover event listeners var m = mpane.getElementsByClassName("btm1"); for (var i = 0; i < m.length; i++) { if (m[i].hasAttribute('onclick')) { m[i].setAttribute('onmouseover', m[i].getAttribute('onclick')); } } } } })(); } /* ============ MOUSE MELEE END =========== */ } /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ *\ * ========== ON PAGE RELOAD END ========== * \* ======================================== */ /* ======================================== *\ * =============== C O R E ============== * \* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ /* ============= SUBMIT ACTION ============ */ function SubmitAction() { // End of round, continue button pressed if (document.getElementById("battleaction").value === 0) { window.location.href = window.location.href; return; } //var loadStart = (new Date()).getTime(); // Serialize the form data var inputs = document.getElementsByTagName("input"); var serializedForm = ""; for (var i = 0; i < inputs.length; i++) { if (i !== 0) serializedForm += "&"; serializedForm += inputs[i].id + "=" + inputs[i].value; } // Send the AJAX call var r = new XMLHttpRequest(); r.open("POST", "", true); r.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8'); r.responseType = 'document'; r.onload = function() { if (r.status >= 200 && r.status < 400) { updatePage(r.response); } }; r.send(serializedForm); /* ============== UPDATE PAGE ============= */ function updatePage(data) { var existing, newStuff, i; var replacements = '.cwbdv, .bte, #ckey_spirit, #ckey_defend, #togpane_magico, #togpane_magict, #togpane_item, #quickbar, #togpane_log'; var monsterReplacements = '#mkey_0, #mkey_1, #mkey_2, #mkey_3, #mkey_4, #mkey_5, #mkey_6, #mkey_7, #mkey_8, #mkey_9'; //var loadEnd = (new Date()).getTime(); //console.log("PostTime = " + (loadEnd - loadStart)); // Handle simple replacements existing = document.querySelectorAll(replacements); newStuff = data.querySelectorAll(replacements); i = existing.length; while (i--) { existing[i].parentNode.replaceChild(newStuff[i], existing[i]); } // Handle monster replacements (don't replace dead monsters) existing = document.querySelectorAll(monsterReplacements); newStuff = data.querySelectorAll(monsterReplacements); i = existing.length; while (i--) { if (existing[i].hasAttribute("onclick") || newStuff[i].hasAttribute("onclick")) { existing[i].parentNode.replaceChild(newStuff[i], existing[i]); } } var popup = data.getElementsByClassName('btcp'); var navbar = data.getElementById('navbar'); // Navbar if (navbar) { // Show navbar var mainpane = document.getElementById('mainpane'); mainpane.parentNode.insertBefore(navbar, mainpane); window.at_attach("parent_Character", "child_Character", "hover", "y", "pointer"); window.at_attach("parent_Bazaar", "child_Bazaar", "hover", "y", "pointer"); window.at_attach("parent_Battle", "child_Battle", "hover", "y", "pointer"); window.at_attach("parent_Forge", "child_Forge", "hover", "y", "pointer"); } // Popup if (popup.length !== 0) { if (!navbar) { //End of round if (settings.showPopup) { //Show popup var parent = document.getElementsByClassName('btt')[0]; parent.insertBefore(popup[0], parent.firstChild); } } else { //End of battle serie //Show popup var parent = document.getElementsByClassName('btt')[0]; parent.insertBefore(popup[0], parent.firstChild); } } //var swapEnd = (new Date()).getTime(); //console.log("SwapTime = " + (swapEnd - loadEnd)); // Run all script modules again; new content has been loaded OnPageReload(); if ((popup.length !== 0) || navbar) { //Reset the round counter sessionStorage.removeItem('rounds'); if ((popup.length !== 0) && !navbar) { //End of round if (settings.skipToNextRound) { //Auto-advance to next round if (settings.popupTime === 0) { window.location.href = window.location.href; } else { setTimeout(function() { window.location.href = window.location.href; }, settings.popupTime); } // Mousemelee Chrome keep-on-going fix // Store cursor position to localStorage // When the round changes, the whole page is reloaded, and // curX and curY is set to its default value when it is declared. // This stops the keep-on-going mechanism. Storing the last known // cursor position and loading them when the page fully reloads // fixes this issue. if ( settings.mouseMelee ) { localStorage.setItem('curX', curX); localStorage.setItem('curY', curY); } } } else { //End of battle serie //Remove the record of Counter Plus localStorage.removeItem('record'); } } //var customEnd = (new Date()).getTime(); //console.log("CustomTime = " + (customEnd - swapEnd)); //console.log("TotalTime = " + (customEnd - loadStart)); } /* ============ UPDATE PAGE END =========== */ } /* =========== SUBMIT ACTION END ========== */ // Start script if in battle if ( document.getElementById('togpane_log') ) { // Init initialPageLoad(); // Replace submit with custom submit document.getElementById("battleform").submit = SubmitAction; // Run all script modules OnPageReload(); } /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ *\ * =========== C O R E E N D ========== * \* ======================================== */
尋找差異