mirror of
https://github.com/EndPwnArchive/EndPwn3Plugins.git
synced 2024-08-14 23:57:06 +00:00
bump repo version, update charcount and dblclickedit
This commit is contained in:
parent
e39e5f596d
commit
98524a3c20
3 changed files with 91 additions and 71 deletions
|
@ -1,52 +1,57 @@
|
||||||
function setupCharCount() {
|
function setupCharCount() {
|
||||||
if (document.getElementById("charcounter")) return;
|
if (document.body.contains(charcount)) return;
|
||||||
if (!document.querySelector("textarea[class*=\"textAreaEnabled-\"]")) return;
|
if (!text || !document.body.contains(text)) {
|
||||||
|
text = document.querySelector('textarea[class^="textArea-"]');
|
||||||
let charcount = document.createElement("span");
|
}
|
||||||
charcount.id = "charcounter";
|
if (!text) return;
|
||||||
charcount.innerHTML = "0/2000";
|
|
||||||
charcount.style.right = "40px";
|
text.parentNode.appendChild(charcount);
|
||||||
charcount.style.bottom = "4px";
|
}
|
||||||
charcount.style.opacity = "0.5";
|
|
||||||
charcount.style.position = "absolute";
|
let charcount = document.createElement("span");
|
||||||
charcount.style.display = "block";
|
charcount.id = "charcounter";
|
||||||
charcount.style["font-size"] = "85%";
|
charcount.innerHTML = "0/2000";
|
||||||
|
charcount.style.right = "40px";
|
||||||
document.querySelector("div[class*=\"channelTextAreaEnabled-\"]").appendChild(charcount);
|
charcount.style.bottom = "4px";
|
||||||
}
|
charcount.style.opacity = "0.5";
|
||||||
|
charcount.style.position = "absolute";
|
||||||
exports = {
|
charcount.style.display = "block";
|
||||||
manifest: {
|
charcount.style["font-size"] = "85%";
|
||||||
author: "Cynosphere",
|
|
||||||
name: "Character Counter",
|
let text = null;
|
||||||
description: "Counts characters in the chatbox."
|
|
||||||
},
|
exports = {
|
||||||
start: function(){
|
manifest: {
|
||||||
let charcount_mo = new MutationObserver(setupCharCount);
|
author: "Cynosphere",
|
||||||
charcount_mo.observe(document.querySelector("div[class*=\"app-\"]"), {
|
name: "Character Counter",
|
||||||
childList: true,
|
description: "Counts characters in the chatbox."
|
||||||
subtree: true
|
},
|
||||||
});
|
start: function(){
|
||||||
|
let charcount_mo = new MutationObserver(setupCharCount);
|
||||||
document.addEventListener("keydown", ev => {
|
charcount_mo.observe(document.querySelector(".app.flex-vertical"), {
|
||||||
if (!document.getElementById("charcounter") || !document.querySelector("textarea[class*=\"textAreaEnabled-\"]")) return;
|
childList: true,
|
||||||
|
subtree: true
|
||||||
setTimeout(()=>{
|
});
|
||||||
let length = document.querySelector("textarea[class*=\"textAreaEnabled-\"]").value.length;
|
|
||||||
document.getElementById("charcounter").innerHTML = `${length}/2000`;
|
document.addEventListener("keydown", ev => {
|
||||||
|
if (!text) return;
|
||||||
if (length > 1999) {
|
|
||||||
document.getElementById("charcounter").style.color = "#FF0000";
|
setImmediate(()=>{
|
||||||
} else if (length > 1899) {
|
let length = text.value.length;
|
||||||
document.getElementById("charcounter").style.color = "#FF4500";
|
charcount.innerHTML = `${length}/2000`;
|
||||||
} else if (length > 1499) {
|
|
||||||
document.getElementById("charcounter").style.color = "#FFA500";
|
if (length > 1999) {
|
||||||
} else if (length > 999) {
|
charcount.style.color = "#FF0000";
|
||||||
document.getElementById("charcounter").style.color = "#F1C40F";
|
} else if (length > 1899) {
|
||||||
} else {
|
charcount.style.color = "#FF4500";
|
||||||
document.getElementById("charcounter").style.color = "#FFFFFF";
|
} else if (length > 1499) {
|
||||||
}
|
charcount.style.color = "#FFA500";
|
||||||
}, 50);
|
} else if (length > 999) {
|
||||||
});
|
charcount.style.color = "#F1C40F";
|
||||||
}
|
} else {
|
||||||
|
charcount.style.color = "#FFFFFF";
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -1,20 +1,35 @@
|
||||||
exports.manifest = {
|
exports.manifest = {
|
||||||
author: "Cynosphere, Jiiks",
|
author: "Cynosphere, Jiiks",
|
||||||
name: "Double Click Edit",
|
name: "Double Click Edit",
|
||||||
description: "Double click messages to edit them."
|
description: "Double click messages to edit them. Hold ctrl while double clicking to copy message contents."
|
||||||
}
|
}
|
||||||
exports.start = function(){
|
exports.start = function(){
|
||||||
document.addEventListener("dblclick", ev => {
|
document.addEventListener("dblclick", ev => {
|
||||||
let target = ev.target;
|
let target = ev.target;
|
||||||
if(target && target.className && target.className.includes("markup")) {
|
console.log(target);
|
||||||
let msg = target;
|
if(target && target.className && (target.className.includes("markup") || target.className.includes("hljs") || targe.className.includes("inline"))) {
|
||||||
let opt = msg.parentNode.querySelector(".btn-option");
|
let msg = target;
|
||||||
opt.click();
|
if(!ev.ctrlKey){
|
||||||
let options = document.querySelectorAll(".option-popout .btn-item");
|
let opt = msg.parentNode.parentNode.className.includes("markup") ? msg.parentNode.parentNode.parentNode.querySelector(".btn-option") : msg.parentNode.querySelector(".btn-option");
|
||||||
for(i in options){
|
opt.click();
|
||||||
let o = options[i];
|
let options = document.querySelectorAll(".option-popout .btn-item");
|
||||||
if(o.innerHTML == "Edit") o.click();
|
for(i in options){
|
||||||
}
|
let o = options[i];
|
||||||
}
|
if(o.innerHTML == "Edit") o.click();
|
||||||
});
|
}
|
||||||
|
}else{
|
||||||
|
var range = document.createRange();
|
||||||
|
range.selectNode(msg);
|
||||||
|
window.getSelection().addRange(range);
|
||||||
|
try {
|
||||||
|
for(var i=0;i<5;i++){
|
||||||
|
document.execCommand('copy');
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
console.log(err);
|
||||||
|
}
|
||||||
|
window.getSelection().removeRange(range);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
|
@ -16,7 +16,7 @@ exports = {
|
||||||
author: "Cynosphere",
|
author: "Cynosphere",
|
||||||
name: "Plugins Repo",
|
name: "Plugins Repo",
|
||||||
description: "Download plugins.",
|
description: "Download plugins.",
|
||||||
_version: 2
|
_version: 3
|
||||||
},
|
},
|
||||||
|
|
||||||
getInfo: async function(plugin){
|
getInfo: async function(plugin){
|
||||||
|
|
Loading…
Reference in a new issue