-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Userscript Security + Loading Screen Changes (#33)
- Loading branch information
1 parent
941097b
commit 309d92b
Showing
13 changed files
with
540 additions
and
152 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
dist/ | ||
app/ | ||
node_modules/ | ||
package-lock.json | ||
multiselect_dummy.html | ||
package-lock.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
// ==UserScript== | ||
// @name Example Custom CSS Changer | ||
// @author AspectQuote | ||
// @version 1 | ||
// @desc Uses custom settings to change custom CSS. | ||
// ==/UserScript== | ||
|
||
let currentCSS = -1; | ||
const customCSSes = [ | ||
{ | ||
name: "No CSS", | ||
css: `` | ||
}, | ||
{ | ||
name: "Hide Bottom Right Info Bar", | ||
css: `#mapInfoHolder { | ||
display: none !important; | ||
}` | ||
}, | ||
{ | ||
name: "Hide Krunker Logo", | ||
css: `#gameNameHolder, #seasonLabel { | ||
display: none !important; | ||
}` | ||
} | ||
] | ||
|
||
removeCSS = () => { | ||
this._css('', 'customcssindex' + currentCSS, false); | ||
} | ||
|
||
swapCSS = (cssIndex) => { | ||
removeCSS(); | ||
if (cssIndex !== currentCSS) { | ||
this._css(customCSSes[cssIndex].css, 'customcssindex'+cssIndex, true); | ||
} | ||
currentCSS = cssIndex; | ||
} | ||
|
||
// remove the css when userscript is unloaded | ||
this.unload = () => { | ||
removeCSS(); | ||
} | ||
|
||
this.settings = { | ||
'usingcss': { | ||
title: "CSS to inject", | ||
type: 'sel', | ||
desc: "The custom CSS you want to use.", | ||
value: customCSSes[0].name, | ||
opts: customCSSes.map(item => item.name), | ||
changed: (newName) => { | ||
swapCSS(customCSSes.findIndex(item => item.name === newName)); | ||
} | ||
} | ||
} | ||
|
||
return this; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
// ==UserScript== | ||
// @name Example Custom Settings Script | ||
// @author AspectQuote | ||
// @version 1 | ||
// @desc Example custom settings script. | ||
// ==/UserScript== | ||
|
||
this.settings = { | ||
"customSetting1": { | ||
"title": "Custom Boolean Setting", | ||
"desc": "A boolean option, can be flipped 'on' (true) or 'off' (false).", | ||
"type": "bool", | ||
"value": true, | ||
changed: function (value) { this._console.log(value) } // This will throw an error, as declaring a function as a block changes the scope of the function, thus we cannot use console.log | ||
}, | ||
"customSetting2": { | ||
"title": "Custom Color Setting", | ||
"desc": "Custom color option, defaults to red. (#ff0000)", | ||
"type": "color", | ||
"value": "#ff0000", | ||
changed: (value) => { this._console.log(value) } | ||
}, | ||
"customSetting3": { | ||
"title": "Custom Selection Setting", | ||
"desc": "Custom selection option, includes 3 options to pick from.", | ||
"type": "sel", | ||
"opts": ["ExampleOption1", "ExampleOption2", "ExampleOption3"], | ||
"value": "ExampleOption1", | ||
changed: (value) => { this._console.log(value) } | ||
}, | ||
"customSetting4": { | ||
"title": "Custom Number Setting (With optional properties)", | ||
"desc": "Number option with optional properties.", | ||
type: 'num', | ||
min: 0, | ||
max: 10, | ||
step: 0.1, | ||
"value": 5, | ||
changed: (value) => { this._console.log(value) } | ||
}, | ||
"customSetting5": { | ||
"title": "Custom Number Setting (Without optional properties)", | ||
type: 'num', | ||
"value": 1000, | ||
changed: (value) => { this._console.log(value) } | ||
}, | ||
"brokenCustomSettingExample": { | ||
"title": "Broken Setting", | ||
"desc": "This is meant to be broken.", | ||
type: 'num', | ||
min: 0, | ||
max: 10, | ||
step: 0.1, | ||
"value": "thisStringBreaksThisSetting", | ||
changed: (value) => { this._console.log(value) } | ||
}, | ||
"brokenCustomSettingExample2": {} | ||
} | ||
|
||
return this |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.