forked from Ephenia/Pokeclicker-Scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
additionalvisualsettings.user.js
471 lines (436 loc) · 23.2 KB
/
additionalvisualsettings.user.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
// ==UserScript==
// @name [Pokeclicker] Additional Visual Settings
// @namespace Pokeclicker Scripts
// @author Ephenia
// @description Adds additional settings for hiding some visual things to help out with performance. Also, includes various features that help with ease of accessibility.
// @copyright https://github.com/Ephenia
// @license GPL-3.0 License
// @version 2.3
// @homepageURL https://github.com/Ephenia/Pokeclicker-Scripts/
// @supportURL https://github.com/Ephenia/Pokeclicker-Scripts/issues
// @downloadURL https://raw.githubusercontent.com/Ephenia/Pokeclicker-Scripts/master/additionalvisualsettings.user.js
// @updateURL https://raw.githubusercontent.com/Ephenia/Pokeclicker-Scripts/master/additionalvisualsettings.user.js
// @match https://www.pokeclicker.com/
// @icon https://www.google.com/s2/favicons?domain=pokeclicker.com
// @grant none
// @run-at document-idle
// ==/UserScript==
var checkWildPokeName;
var checkWildPokeDefeat;
var checkWildPokeImg;
var checkWildPokeHealth;
var checkWildPokeCatch;
var checkAllNotification;
const notificFunc = Notifier.notify;
var newSave;
var trainerCards;
function initVisualSettings() {
const getMenu = document.getElementById('startMenu');
const quickSettings = document.createElement("img");
quickSettings.id = "quick-settings"
quickSettings.src = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAAAkCAQAAABLCVATAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAAmJLR0QA/4ePzL8AAAAJcEhZcwAADsQAAA7EAZUrDhsAAAAHdElNRQfmAQcLFCMs4grwAAACzUlEQVRIx63WvWtbVxgG8J+Vkjgp9hKDwbTBcQoOBIINQUsnDe1gGy8h1VDswUMG4+4hYNwhpv4LumQ2d+gWSqnUwdZQUKFZDIUa4RqiYNyPLMEoUezodNDV7ZUsq1Xq507nvM957/t5zksvTCuqC4K6omnviFElQc0LL9QEJaPvpigvqJhz221zKoL82eT3Omz41Id2/eAlruNn34Idn/vIdTDsE5OeK/i9u9JbtgXBiUjOI3uCTQNgwKZgz7qcyIkg2Haru5qyoCJyKDgSNOxbSuRL9jViyaFIRfDTaVWjtgU7sphXVVewaFwmYWSMW1BQVzWPrB3BdmcCFgQV2XiVNWOoq/tDZlKsimChnfBQEPWd10jwsGVwE7veypnvQs644krKxX8wL+etX9s3h0WCamJ2ExNWREpKIl+40SbLqgoiw536c47UzSTrQcsqQuqrWDaYyGfVHcmdNnRdUEhCPGjDsaBs1T33rCoLjm0kqoYUBOvtqc97YE8jlYFlx2rWjCQ7V62pObac7Cxq2PNAvlkC00qx6fvGY8oNFcFaR4gz1gQVE/F63H58smSaYlzPm5aSgyuCsqun3B9RFqwkipdsxjVepK5mjrinmoRIsNq1clYFUcrSAcypqWdc9MozhFS+xuisjxi7GEvlLuCZVy5mnBMy3rjsWptrrx3gZlf+JA68bnPtmsve9Ar2yCk1PYM91SX9E32nf4p0QS4mh5oF+WXKqpF/K8gWerXIZ6kWuRQzmi3y6HQYO5v2Un9N23pFht33vuf+Soh1X/vejI+N4cCPvvNb6sd/+sMH7nvqZdqeu04c9n2xHTpxt0Vr1ccFW550oTfU1DS6SJ7YcsFku6Iq7qSu9dkzL//ZFOtOfDKFc3uOzu2BbKr6H092eoj4RT41RGw58pVMfL0EGTy2gae+cVNV8awhohN9jTW9cG6DFlP/ffT7G1t3ayJm6d3nAAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDIyLTAxLTA3VDExOjIwOjI2KzAwOjAwMddkKgAAACV0RVh0ZGF0ZTptb2RpZnkAMjAyMi0wMS0wN1QxMToyMDoyNiswMDowMECK3JYAAAAZdEVYdFNvZnR3YXJlAHd3dy5pbmtzY2FwZS5vcmeb7jwaAAAAAElFTkSuQmCC"
quickSettings.setAttribute("href", "#settingsModal")
quickSettings.setAttribute("data-toggle", "modal")
getMenu.prepend(quickSettings)
const quickPokedex = document.createElement("img");
quickPokedex.id = "quick-pokedex"
quickPokedex.src = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAAAkCAYAAADhAJiYAAAABHNCSVQICAgIfAhkiAA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n8ecFks9lFvu8fAFYBp1T1iTtD41YbVNPg4ODwrFmz3vR9f42qZoANHR0dQ11dXb2nT5+eSiNySz09PV5bW9sPReQNEZlnZgVV/eakWumaMplMi4i8LCLfNzMBSiLy3PDw8JsDAwPlyYB0dnYmU6nUd1R1K7CcKIB3VavVzeMlzYT9Tjab/RawQ0QWOecALqnqW2a2zzlXLJfLp/v7+29AtGsnk8mFqpoD1pjZOhGZE38rOmVmP64P4HsCgqiRjPumTcCXavfEG6IBtQ9RvshnXYJF6lXVlyuVyu5aat83UL2y2ewiEXkcWA2kgXlm1gYgIkNmdhY4LiIfOOfeCYLg5FTG/x/gR3g4jp2VywAAAABJRU5ErkJggg=="
quickPokedex.setAttribute("href", "#pokedexModal")
quickPokedex.setAttribute("data-toggle", "modal")
getMenu.prepend(quickPokedex)
document.querySelectorAll('tr[data-bind*="currencyMainDisplayReduced"')[0].outerHTML += `<tr>
<td class="p-2">
<label class="m-0">Show wild Pokémon Name</label>
</td>
<td class="p-2">
<input id="poke-name" type="checkbox">
</td>
</tr>
<tr>
<td class="p-2">
<label class="m-0">Show wild Pokémon Defeated</label>
</td>
<td class="p-2">
<input id="poke-defeat" type="checkbox">
</td>
</tr>
<tr>
<td class="p-2">
<label class="m-0">Show wild Pokémon Image</label>
</td>
<td class="p-2">
<input id="poke-image" type="checkbox">
</td>
</tr>
<tr>
<td class="p-2">
<label class="m-0">Show Pokémon Health</label>
</td>
<td class="p-2">
<input id="poke-health" type="checkbox">
</td>
</tr>
<tr>
<td class="p-2">
<label class="m-0">Show Catch Icon</label>
</td>
<td class="p-2">
<input id="poke-catch" type="checkbox">
</td>
</tr>`
const notifiyHTML = document.createElement("tr");
notifiyHTML.innerHTML = `<td class="p-2">
<label class="m-0">Disable all Notifications</label>
</td>
<td class="p-2 tight">
<input id="all-notify" type="checkbox">
</td>`
//Moved to async function because it fails to execute on loading screen so we keep trying until the element exists
//Settings screen changed, this is where the option should go now
document.querySelector('[id="settingsNotificationGeneral"] table tbody').prepend(notifiyHTML)
//Add 'Disable all notifications' option
document.querySelector('#all-notify').addEventListener('change', event => {
if (event.target.checked == false) {
checkAllNotification = "OFF";
localStorage.setItem("checkAllNotification", "OFF");
Notifier.notify = notificFunc;
} else {
checkAllNotification = "ON";
localStorage.setItem("checkAllNotification", "ON");
remNotifications();
}
});
checkWildPokeName = localStorage.getItem('checkWildPokeName');
checkWildPokeDefeat = localStorage.getItem('checkWildPokeDefeat');
checkWildPokeImg = localStorage.getItem('checkWildPokeImg');
checkWildPokeHealth = localStorage.getItem('checkWildPokeHealth');
checkWildPokeCatch = localStorage.getItem('checkWildPokeCatch');
checkAllNotification = localStorage.getItem('checkAllNotification');
addGlobalStyle('.pageItemTitle { height:38px }');
addGlobalStyle('#quick-settings { height:36px;background-color:#eee;border:4px solid #eee;cursor:pointer; }');
addGlobalStyle('#quick-settings:hover { background-color:#ddd;border: 4px solid #ddd; }');
addGlobalStyle('#quick-pokedex { height:36px;background-color:#eee;border:4px solid #eee;cursor:pointer; }');
addGlobalStyle('#quick-pokedex:hover { background-color:#ddd;border: 4px solid #ddd; }');
addGlobalStyle('#shortcutsContainer { display: block !important; }');
addGlobalStyle('.gyms-leaders { display: flex;pointer-events: none;position: absolute;height: 36px;top: 0;left: 0;image-rendering: pixelated; }');
addGlobalStyle('.gyms-badges { position: absolute;height: 36px;display: flex;top: 0;right: 0; }');
addGlobalStyle('.dungeons-costs { position: relative;margin-right: 12px;filter: none !important }');
addGlobalStyle('#Dungeons-buttons > button:hover { -webkit-animation: bounceBackground 60s linear infinite alternate;animation: bounceBackground 60s linear infinite alternate; }');
addGlobalStyle('#Dungeons-buttons > button * { z-index: 2 }');
addGlobalStyle('.dungeons-overlay { width: 100%;height: 100%;position: absolute;background-color: rgba(0,0,0,0.45);margin-top: -6px;margin-left: -8px;z-index: 1 !important }');
addGlobalStyle('.dungeons-info { position: relative;font-weight: bold }');
//The elements removed by the scripts don't ever get added back after a restart, waiting a second before removing makes them load properly
if (checkWildPokeName == "OFF") {
document.querySelector('#poke-name').checked = true
} else {
remPokeName();
}
if (checkWildPokeDefeat == "OFF") {
document.querySelector('#poke-defeat').checked = true
} else {
remPokeDefeat();
}
if (checkWildPokeImg == "OFF") {
document.querySelector('#poke-image').checked = true
} else {
remPokeImg();
}
if (checkWildPokeHealth == "OFF") {
document.querySelector('#poke-health').checked = true
} else {
remPokeHealth();
}
if (checkWildPokeCatch == "OFF") {
document.querySelector('#poke-catch').checked = true
} else {
remPokeCatch();
}
if (checkAllNotification == "ON") {
document.querySelector('#all-notify').checked = true
remNotifications();
}
document.getElementById('map').addEventListener('click', event => {
if (event.target.matches('[data-route]')) {
if (checkWildPokeName == "ON") {
remPokeName();
}
if (checkWildPokeDefeat == "ON") {
remPokeDefeat();
}
if (checkWildPokeImg == "ON") {
remPokeImg();
}
if (checkWildPokeHealth == "ON") {
remPokeHealth();
}
if (checkWildPokeCatch == "ON") {
remPokeCatch();
}
}
});
document.querySelector('#poke-name').addEventListener('change', event => {
if (event.target.checked == true) {
checkWildPokeName = "OFF";
localStorage.setItem("checkWildPokeName", "OFF");
} else {
checkWildPokeName = "ON";
localStorage.setItem("checkWildPokeName", "ON");
}
});
document.querySelector('#poke-defeat').addEventListener('change', event => {
if (event.target.checked == true) {
checkWildPokeDefeat = "OFF";
localStorage.setItem("checkWildPokeDefeat", "OFF");
} else {
checkWildPokeDefeat = "ON";
localStorage.setItem("checkWildPokeDefeat", "ON");
}
});
document.querySelector('#poke-image').addEventListener('change', event => {
if (event.target.checked == true) {
checkWildPokeImg = "OFF";
localStorage.setItem("checkWildPokeImg", "OFF");
} else {
checkWildPokeImg = "ON";
localStorage.setItem("checkWildPokeImg", "ON");
}
});
document.querySelector('#poke-health').addEventListener('change', event => {
if (event.target.checked == true) {
checkWildPokeHealth = "OFF";
localStorage.setItem("checkWildPokeHealth", "OFF");
} else {
checkWildPokeHealth = "ON";
localStorage.setItem("checkWildPokeHealth", "ON");
}
});
document.querySelector('#poke-catch').addEventListener('change', event => {
if (event.target.checked == true) {
checkWildPokeCatch = "OFF";
localStorage.setItem("checkWildPokeCatch", "OFF");
} else {
checkWildPokeCatch = "ON";
localStorage.setItem("checkWildPokeCatch", "ON");
}
});
function remPokeName() {
if (player.route()) {
const enemyName = document.querySelectorAll('.pageItemTitle knockout');
if (enemyName.length > 0) {
enemyName[0].remove();
}
}
}
function remPokeDefeat() {
const pokeDefeat = document.querySelectorAll('knockout[data-bind*="App.game.statistics.routeKills"]');
if (pokeDefeat.length > 0) {
pokeDefeat[0].remove()
}
}
function remPokeImg() {
const enemyPoke = document.querySelectorAll('knockout[data-bind*="pokemonSpriteTemplate"]');
if (enemyPoke.length > 0) {
enemyPoke[0].remove()
}
}
function remPokeHealth() {
const healthBar = document.querySelectorAll('.progress.hitpoints');
if (healthBar.length > 0) {
healthBar[0].remove()
}
}
function remPokeCatch() {
const catchIcon = document.querySelectorAll('.catchChance');
if (catchIcon.length > 0) {
catchIcon[0].remove()
}
}
function remNotifications() {
Notifier.notify = function(message) {
const sound = message.sound;
if (typeof sound != 'undefined') {
sound.play();
}
}
}
//Add dock button
const dockButton = document.createElement('button')
dockButton.style = 'position: absolute; left: 32px; top: 0px; width: auto; height: 41px; font-size: 11px;'
dockButton.className = 'btn btn-block btn-success'
dockButton.id = 'dock-button'
dockButton.textContent = 'Dock'
document.getElementById('townMap').appendChild(dockButton)
document.getElementById('dock-button').addEventListener('click', MapHelper.openShipModal, false)
//Add Gyms button
const gymsButton = document.createElement('button');
gymsButton.style = 'position: absolute;left: 75px;top: -8px;width: auto;height: 41px;font-size: 11px;';
gymsButton.className = 'btn btn-block btn-success';
gymsButton.id = 'gyms-button';
gymsButton.textContent = 'Gyms';
document.getElementById('townMap').appendChild(gymsButton);
document.getElementById('gyms-button').addEventListener('click', () => { generateGymsList();$('#GymsModal').modal('show'); }, false);
//Add Dungeons button
const dungeonsButton = document.createElement('button');
dungeonsButton.style = 'position: absolute;left: 121px;top: -8px;width: auto;height: 41px;font-size: 11px;';
dungeonsButton.className = 'btn btn-block btn-success';
dungeonsButton.id = 'dungeons-button';
dungeonsButton.textContent = 'Dungeons';
document.getElementById('townMap').appendChild(dungeonsButton);
document.getElementById('dungeons-button').addEventListener('click', () => { generateDungeonssList();$('#DungeonsModal').modal('show'); }, false);
createGymDungeonModals();
function createGymDungeonModals() {
const modNames = ['Gyms', 'Dungeons'];
const fragment = new DocumentFragment();
for (let i = 0; i < modNames.length; i++) {
const customMods = document.createElement('div');
customMods.setAttribute('class', 'modal noselect fade');
customMods.setAttribute('tabindex', '-1');
customMods.setAttribute('role', 'dialogue');
customMods.setAttribute('id', `${modNames[i]}Modal`);
customMods.setAttribute('aria-labelledby', `${modNames[i]}ModalLabel`);
customMods.innerHTML = `<div class="modal-dialog modal-dialog-scrollable modal-dialog-centered modal-sm" role="document">
<div class="modal-content">
<div class="modal-header" style="justify-content: space-around;">
<h5 id="${modNames[i]}-title" class="modal-title"></h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body bg-ocean">
<div id="${modNames[i]}-buttons"></div>
</div>
</div>
</div>`
fragment.appendChild(customMods);
}
document.getElementById('ShipModal').after(fragment);
}
function generateGymsList() {
const gymBtns = document.getElementById('Gyms-buttons');
const gymsHead = document.getElementById('Gyms-title');
gymsHead.textContent = `Gym Select (${GameConstants.camelCaseToString(GameConstants.Region[player.region])})`;
gymBtns.innerHTML = '';
const fragment = new DocumentFragment();
for (const gym of Object.values(GymList)) {
let region = gym.parent?.region;
if (player.region == region) {
const btn = document.createElement('button');
btn.setAttribute('style', 'position: relative;');
btn.setAttribute('class', 'btn btn-block btn-success');
btn.addEventListener('click', () => {
if (!MapHelper.isTownCurrentLocation(gym.parent.name)) {
MapHelper.moveToTown(gym.parent.name);
}
$("#GymsModal").modal("hide");
GymRunner.startGym(gym, false);
});
btn.disabled = !(gym.isUnlocked() && MapHelper.calculateTownCssClass(gym.parent.name));
btn.innerHTML = `<div class="gyms-leaders">
<img src="assets/images/gymLeaders/${gym.leaderName}.png" onerror="this.onerror=null;this.style.display='none';">
</div>
<div class="gyms-badges">
<img src="assets/images/badges/${BadgeEnums[gym.badgeReward]}.png" onerror="this.onerror=null;this.style.display='none';">
</div>
${gym.leaderName}`;
fragment.appendChild(btn);
}
}
gymBtns.appendChild(fragment);
}
function generateDungeonssList() {
const dungeonsBtns = document.getElementById('Dungeons-buttons');
const dungeonsHead = document.getElementById('Dungeons-title');
dungeonsHead.textContent = `Dungeon Select (${GameConstants.camelCaseToString(GameConstants.Region[player.region])})`;
dungeonsBtns.innerHTML = '';
const fragment = new DocumentFragment();
for (const town in TownList) {
const townData = TownList[town];
if (townData.constructor.name == 'DungeonTown' && townData.dungeon != null) {
const townName = townData.name;
const dungeonRegion = townData.region;
const dungeonData = townData.dungeon;
const dungeonClears = App.game.statistics.dungeonsCleared[GameConstants.getDungeonIndex(dungeonData.name)]();
const dungeonTokens = App.game.wallet.currencies[GameConstants.Currency.dungeonToken]();
const affordEntry = dungeonData.tokenCost <= dungeonTokens ? true : false;
const canAccess = townData.isUnlocked() && affordEntry;
if (dungeonRegion == player.region) {
const btn = document.createElement('button');
btn.setAttribute('style', `position: relative;background-image: url("assets/images/towns/${dungeonData.name}.png");background-position: center;opacity: ${canAccess ? 1 : 0.70};filter: brightness(${canAccess ? 1 : 0.70});`);
btn.setAttribute('class', 'btn btn-block btn-success');
btn.addEventListener('click', () => {
if (!MapHelper.isTownCurrentLocation(townName)) {
MapHelper.moveToTown(townName);
}
$("#DungeonsModal").modal("hide");
DungeonRunner.initializeDungeon(dungeonData);
});
canAccess ? btn.disabled = false : btn.disabled = true;
btn.innerHTML = `<div class="dungeons-overlay"></div>
<div class="dungeons-costs">
<img src="assets/images/currency/dungeonToken.svg" style="height: 24px; width: 24px;">
<span style="font-weight: bold;color: ${affordEntry ? 'greenyellow' : '#f04124'}">${dungeonData.tokenCost.toLocaleString('en-US')}</span>
</div>
<div class="dungeons-info">
<span>${dungeonData.name}</span>
<div>${dungeonClears.toLocaleString('en-US')} clears</div>
</div>`;
fragment.appendChild(btn);
}
}
}
dungeonsBtns.appendChild(fragment);
}
}
if (localStorage.getItem('checkWildPokeName') == null) {
localStorage.setItem("checkWildPokeName", "OFF");
}
if (localStorage.getItem('checkWildPokeDefeat') == null) {
localStorage.setItem("checkWildPokeDefeat", "OFF");
}
if (localStorage.getItem('checkWildPokeImg') == null) {
localStorage.setItem("checkWildPokeImg", "OFF");
}
if (localStorage.getItem('checkWildPokeHealth') == null) {
localStorage.setItem("checkWildPokeHealth", "OFF");
}
if (localStorage.getItem('checkWildPokeCatch') == null) {
localStorage.setItem("checkWildPokeCatch", "OFF");
}
if (localStorage.getItem('checkAllNotification') == null) {
localStorage.setItem("checkAllNotification", "OFF");
}
function loadScript(){
var oldInit = Preload.hideSplashScreen
Preload.hideSplashScreen = function(){
var result = oldInit.apply(this, arguments)
initVisualSettings()
return result
}
}
var scriptName = 'additionalvisualsettings'
if (document.getElementById('scriptHandler') != undefined){
var scriptElement = document.createElement('div')
scriptElement.id = scriptName
document.getElementById('scriptHandler').appendChild(scriptElement)
if (localStorage.getItem(scriptName) != null){
if (localStorage.getItem(scriptName) == 'true'){
loadScript()
}
}
else{
localStorage.setItem(scriptName, 'true')
loadScript()
}
}
else{
loadScript();
}
function addGlobalStyle(css) {
var head, style;
head = document.getElementsByTagName('head')[0];
if (!head) { return; }
style = document.createElement('style');
style.type = 'text/css';
style.innerHTML = css;
head.appendChild(style);
}