mirror of
https://github.com/EndPwnArchive/EndPwn3Plugins.git
synced 2024-08-14 23:57:06 +00:00
add settings api, move everything to proposed manifest format
This commit is contained in:
parent
a46ddb6c23
commit
e49c518ef3
12 changed files with 242 additions and 26 deletions
|
@ -10,10 +10,10 @@ bdwatcher = null, bdtag = null, setupCSS = function (n) {
|
|||
}))
|
||||
};
|
||||
|
||||
exports.meta = {
|
||||
exports.manifest = {
|
||||
author: "dr1ft",
|
||||
name: "BeautifulDiscord Port",
|
||||
desc: "Allows CSS to be imported and updated on the fly."
|
||||
description: "Allows CSS to be imported and updated on the fly."
|
||||
},
|
||||
exports.start = () => {
|
||||
if (fs.existsSync($api.data + 'style.css'))
|
||||
|
|
|
@ -16,10 +16,10 @@ function setupCharCount() {
|
|||
}
|
||||
|
||||
exports = {
|
||||
meta: {
|
||||
manifest: {
|
||||
author: "Cynosphere",
|
||||
name: "Character Counter",
|
||||
desc: "Counts characters in the chatbox."
|
||||
description: "Counts characters in the chatbox."
|
||||
},
|
||||
start: function(){
|
||||
let charcount_mo = new MutationObserver(setupCharCount);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
exports.meta = {
|
||||
exports.manifest = {
|
||||
author: "Cynosphere, Jiiks",
|
||||
name: "Double Click Edit",
|
||||
desc: "Double click messages to edit them."
|
||||
description: "Double click messages to edit them."
|
||||
}
|
||||
exports.start = function(){
|
||||
document.addEventListener("dblclick", ev => {
|
||||
|
|
|
@ -1,14 +1,13 @@
|
|||
exportsexports = {
|
||||
meta: {
|
||||
manifest: {
|
||||
author: "Cynosphere, Adryd",
|
||||
name: "Mentions Fixer",
|
||||
desc: "See hidden channel mentions and remove #deleted-channel."
|
||||
description: "See hidden channel mentions and remove #deleted-channel."
|
||||
},
|
||||
replacements: {
|
||||
'/t\\.type===(.+)\\.ChannelTypes\\.GUILD_TEXT&&(.+)\\.default\\.can\\((.+)\\.Permissions\\.VIEW_CHANNEL,n,t\\)/':'true',
|
||||
'/"#deleted-channel"/':'"<#"+e[1]+">"',
|
||||
'/"@deleted-role"/':'"<@&"+e[1]+">"',
|
||||
'/guildId:null!=t\\?t\\.guild_id:null,/':'guildId:null!=t.guild_id?t.guild_id:"@me",',
|
||||
'/"#deleted-channel"/':'"<#"+e[1]+">"'
|
||||
'/guildId:null!=t\\?t\\.guild_id:null,/':'guildId:null!=t.guild_id?t.guild_id:"@me",'
|
||||
}
|
||||
}
|
|
@ -39,10 +39,10 @@ function scCSS() {
|
|||
document.body.appendChild(css);
|
||||
}
|
||||
|
||||
exports.meta = {
|
||||
exports.manifest = {
|
||||
author: "Cynosphere",
|
||||
name: "Guild Count",
|
||||
desc: "Shows guild count under online count."
|
||||
description: "Shows guild count under online count."
|
||||
}
|
||||
exports.start = () => {
|
||||
scCSS();
|
||||
|
|
|
@ -3,10 +3,10 @@ IMGXIS made by YellowAfterlife. http://yellowafterlife.itch.io/imgxis (mirror: h
|
|||
Ported by Jane (maybejane/statefram) and Cynthia (BoxOfFlex/Cynosphere) to a private client mod.
|
||||
Re-ported by Cynthia to EndPwn.
|
||||
*/
|
||||
exports.meta = {
|
||||
exports.manifest = {
|
||||
author: "Cynosphere, YellowAfterlife",
|
||||
name: "IMGXIS",
|
||||
desc: "A better way to view images."
|
||||
description: "A better way to view images."
|
||||
}
|
||||
exports.start = function(){
|
||||
var globalPanner;
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
exports = {
|
||||
meta: {
|
||||
author: "Cynosphere, Adryd",
|
||||
manifest: {
|
||||
author: "Cynosphere",
|
||||
name: "Restore Local Storage",
|
||||
desc: "Restore window.localStorage."
|
||||
description: "Restore window.localStorage."
|
||||
},
|
||||
replacements: {
|
||||
'try{delete window.localStorage}catch(e){}':''
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
exports.meta = {
|
||||
exports.manifest = {
|
||||
author: "dr1ft",
|
||||
name: "Notification Sound Replacer",
|
||||
desc: "Replaces notification sound with an unused sound thats nicer."
|
||||
description: "Replaces notification sound with an unused sound thats nicer."
|
||||
}
|
||||
exports.start = function(){
|
||||
var s = wc.findFunc('playSound')[1].exports;
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
exportsexports = {
|
||||
meta: {
|
||||
manifest: {
|
||||
author: "Cynosphere, janeptrv",
|
||||
name: "osu! Typing",
|
||||
desc: "Adds typing sounds from osu!."
|
||||
description: "Adds typing sounds from osu!."
|
||||
},
|
||||
start: function(){
|
||||
var sounds = [];
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
exports.meta = {
|
||||
author: "BlockBuilder57, Cynosphere",
|
||||
exports.manifest = {
|
||||
author: "Adryd, BlockBuilder57, Cynosphere",
|
||||
name: "Sailboat",
|
||||
desc: "Login as bot accounts."
|
||||
description: "Login as bot accounts."
|
||||
}
|
||||
exports.replacements = {
|
||||
'/i.default.Store.pauseEmittingChanges\\(\\),t.user.bot/':'false',
|
||||
|
|
217
plugins/settingsapi.js
Normal file
217
plugins/settingsapi.js
Normal file
|
@ -0,0 +1,217 @@
|
|||
//Stolen from StackOverflow :^)
|
||||
let convertToText = function(obj) {
|
||||
var string = [];
|
||||
|
||||
if (obj == undefined) {
|
||||
return String(obj);
|
||||
} else if (typeof(obj) == "object" && (obj.join == undefined)) {
|
||||
for (prop in obj) {
|
||||
if (obj.hasOwnProperty(prop))
|
||||
string.push(prop + ": " + convertToText(obj[prop]));
|
||||
};
|
||||
return "{" + string.join(",") + "}";
|
||||
} else if (typeof(obj) == "object" && !(obj.join == undefined)) {
|
||||
for(prop in obj) {
|
||||
string.push(convertToText(obj[prop]));
|
||||
}
|
||||
return "[" + string.join(",") + "]";
|
||||
} else if (typeof(obj) == "function") {
|
||||
string.push(obj.toString())
|
||||
} else {
|
||||
string.push(JSON.stringify(obj))
|
||||
}
|
||||
|
||||
return string.join(",");
|
||||
}
|
||||
|
||||
exports = {
|
||||
manifest: {
|
||||
author: "Cynosphere, BlockBuilder57",
|
||||
name: "Settings API",
|
||||
description: "Hijack the settings menu in any way you feel."
|
||||
},
|
||||
replacements: {
|
||||
'/function z\\(\\){return\\[{(.+)}]}/':'window.$settingsapi={sections:[{$1}]};function z(){return window.$settingsapi.sections;}',
|
||||
},
|
||||
start: function(){
|
||||
var buttons = $api.util.findFuncExports('button-', 'colorBlack');
|
||||
var checkboxes = $api.util.findFuncExports('checkboxEnabled');
|
||||
var misc = $api.util.findFuncExports('statusRed-', 'inputDefault');
|
||||
var misc2 = $api.util.findFuncExports('multiInputField');
|
||||
var headers = $api.util.findFuncExports('h5-', 'h5');
|
||||
|
||||
var panels = wc.findFunc('flexChild-')[0].exports;
|
||||
var panels2 = $api.util.findFuncExports('errorMessage-', 'inputWrapper');
|
||||
|
||||
let sections = window.$settingsapi.sections;
|
||||
|
||||
window.$settingsapi = {
|
||||
sections: sections,
|
||||
ourSections: [],
|
||||
_callbacks: {},
|
||||
_panels: {},
|
||||
addSection: function(name,label,callback,color){
|
||||
let data = {};
|
||||
|
||||
data.section = name || `SAPI_${Math.floor(Math.random()*10000)}`;
|
||||
data.label = label;
|
||||
data.color = color || undefined;
|
||||
data.element = $api.util.findConstructor('FormSection', 'FormSection').FormSection;
|
||||
|
||||
$settingsapi.ourSections.push(data);
|
||||
$settingsapi.sections.splice($settingsapi.sections.length-4,0,data);
|
||||
$settingsapi._callbacks[name] = callback;
|
||||
},
|
||||
exportSections: function(){
|
||||
let out = "";
|
||||
|
||||
for(i in $settingsapi._sections){
|
||||
out = out + convertToText($settingsapi._sections[i]);
|
||||
}
|
||||
|
||||
return out;
|
||||
},
|
||||
//All of these allow us to use Discord's elements.
|
||||
elements: {
|
||||
createVerticalPanel: function() {
|
||||
return createElement("div")
|
||||
.withClass(panels2.vertical, 'epButtonPanel')
|
||||
},
|
||||
createHorizontalPanel: function() {
|
||||
return createElement("div")
|
||||
.withClass(panels.horizontal, 'epButtonPanel')
|
||||
},
|
||||
createButton: function(name) {
|
||||
return createElement('button')
|
||||
.withContents(name)
|
||||
.withClass(
|
||||
buttons.button,
|
||||
buttons.lookFilled,
|
||||
buttons.colorBrand,
|
||||
buttons.sizeSmall,
|
||||
buttons.grow,
|
||||
'epMargin'
|
||||
);
|
||||
},
|
||||
createWarnButton: function(name) {
|
||||
return createElement('button')
|
||||
.withContents(name)
|
||||
.withClass(
|
||||
buttons.button,
|
||||
buttons.lookOutlined,
|
||||
buttons.colorYellow,
|
||||
buttons.sizeSmall,
|
||||
buttons.grow,
|
||||
'epMargin'
|
||||
);
|
||||
},
|
||||
createDangerButton: function(name) {
|
||||
return createElement('button')
|
||||
.withContents(name)
|
||||
.withClass(
|
||||
buttons.button,
|
||||
buttons.lookOutlined,
|
||||
buttons.colorRed,
|
||||
buttons.sizeSmall,
|
||||
buttons.grow,
|
||||
'epMargin'
|
||||
);
|
||||
},
|
||||
createH2: function(text) {
|
||||
return createElement("h2")
|
||||
.withClass(
|
||||
headers.h2,
|
||||
headers.title,
|
||||
headers.size16,
|
||||
headers.height20,
|
||||
headers.weightSemiBold,
|
||||
headers.defaultColor,
|
||||
'epMargin'
|
||||
)
|
||||
.withText(text);
|
||||
},
|
||||
createH5: function(text) {
|
||||
return createElement("h5")
|
||||
.withClass(
|
||||
headers.h5,
|
||||
headers.title,
|
||||
headers.size12,
|
||||
headers.height16,
|
||||
headers.weightSemiBold
|
||||
)
|
||||
.withText(text);
|
||||
},
|
||||
createInput: function(v) {
|
||||
return createElement("input")
|
||||
.withClass(
|
||||
misc.inputDefault,
|
||||
misc.input,
|
||||
misc.size16,
|
||||
'epMargin'
|
||||
)
|
||||
.modify(x => x.value = v)
|
||||
},
|
||||
updateSwitch: function(s, w) {
|
||||
if (s.checked) {
|
||||
w.classList.remove(checkboxes.valueUnchecked.split(' ')[0]);
|
||||
w.classList.add(checkboxes.valueChecked.split(' ')[0])
|
||||
}
|
||||
else {
|
||||
w.classList.remove(checkboxes.valueChecked.split(' ')[0]);
|
||||
w.classList.add(checkboxes.valueUnchecked.split(' ')[0])
|
||||
}
|
||||
},
|
||||
createSwitch: function(c, i) {
|
||||
if (c === undefined) c = () => { };
|
||||
if (i === undefined) i = false;
|
||||
var s, w = createElement('div')
|
||||
.withClass(
|
||||
checkboxes.switch,
|
||||
checkboxes.switchEnabled,
|
||||
checkboxes.size,
|
||||
checkboxes.sizeDefault,
|
||||
checkboxes.themeDefault
|
||||
)
|
||||
.withChildren(
|
||||
s = createElement("input")
|
||||
.withClass(
|
||||
checkboxes.checkbox,
|
||||
checkboxes.checkboxEnabled
|
||||
)
|
||||
.modify(x => x.type = 'checkbox')
|
||||
.modify(x => x.checked = i)
|
||||
.modify(x => x.onchange = () => {
|
||||
updateSwitch(s, w);
|
||||
c(s.checked);
|
||||
})
|
||||
)
|
||||
$settingsapi.elements.updateSwitch(s, w);
|
||||
return w;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Example settings tab
|
||||
/*$settingsapi.addSection("TESTING","test owo",function(pnl){
|
||||
$settingsapi.elements.createH2("Hello World!").appendTo(pnl);
|
||||
});*/
|
||||
|
||||
$api.events.hook("USER_SETTINGS_MODAL_SET_SECTION", function(e){
|
||||
if ($settingsapi._panels[e.section]) $settingsapi._panels[e.section].remove();
|
||||
|
||||
for(let i in $settingsapi.ourSections){
|
||||
let data = $settingsapi.ourSections[i];
|
||||
if(e.section == data.section){
|
||||
var pane = $(".content-column.default");
|
||||
if (!pane) return;
|
||||
|
||||
$settingsapi._panels[data.section] = createElement('div')
|
||||
.withClass('flex-vertical')
|
||||
.appendTo(pane);
|
||||
|
||||
$settingsapi._callbacks[data.section]($settingsapi._panels[data.section]);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
|
@ -1,8 +1,8 @@
|
|||
exports = {
|
||||
meta: {
|
||||
manifest: {
|
||||
author: "Cynosphere",
|
||||
name: "Spotify Premium Spoof",
|
||||
desc: "Spoofs premium check and allows listen along without premium."
|
||||
description: "Spoofs premium check and allows listen along without premium."
|
||||
},
|
||||
replacements: {
|
||||
'r.isPremium=n':'r.isPremium=true'
|
||||
|
|
Loading…
Reference in a new issue