This commit is contained in:
Mirco Wittrien 2021-06-21 22:00:21 +02:00
parent ac0376e940
commit db3e2886c4
2 changed files with 25 additions and 16 deletions

View File

@ -2,7 +2,7 @@
* @name OldTitleBar
* @author DevilBro
* @authorId 278543574059057154
* @version 1.7.0
* @version 1.7.1
* @description Allows you to switch to Discord's old Titlebar
* @invite Jx3TjNS
* @donate https://www.paypal.me/MircoWittrien
@ -17,8 +17,13 @@ module.exports = (_ => {
"info": {
"name": "OldTitleBar",
"author": "DevilBro",
"version": "1.7.0",
"version": "1.7.1",
"description": "Allows you to switch to Discord's old Titlebar"
},
"changeLog": {
"fixed": {
"Window Transparency": "Fixed an issue that might have broken maximizing when transparency is enabled"
}
}
};
@ -241,7 +246,7 @@ module.exports = (_ => {
tooltipConfig: {type: "bottom"},
children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Clickable, {
className: BDFDB.disCNS.channelheadericonwrapper + BDFDB.disCN.channelheadericonclickable,
onClick: _ => {location.reload();},
onClick: _ => location.reload(),
children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SvgIcon, {
className: BDFDB.disCN.channelheadericon,
iconSVG: `<svg><path fill="currentColor" stroke="none" transform="translate(3,4)" d="M 17.061, 7.467 V 0 l -2.507, 2.507 C 13.013, 0.96, 10.885, 0, 8.528, 0 C 3.813, 0, 0.005, 3.819, 0.005, 8.533 s 3.808, 8.533, 8.523, 8.533 c 3.973, 0, 7.301 -2.72, 8.245 -6.4 h -2.219 c -0.88, 2.485 -3.237, 4.267 -6.027, 4.267 c -3.536, 0 -6.4 -2.864 -6.4 -6.4 s 2.864 -6.4, 6.4 -6.4 c 1.765, 0, 3.349, 0.736, 4.507, 1.893 l -3.44, 3.44 H 17.061 z"/></svg>`
@ -252,7 +257,7 @@ module.exports = (_ => {
};
children.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Clickable, {
className: BDFDB.disCNS.channelheadericonwrapper + BDFDB.disCN.channelheadericonclickable,
onClick: _ => {BDFDB.LibraryModules.WindowUtils.minimize();},
onClick: _ => BDFDB.LibraryModules.WindowUtils.minimize(),
children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SvgIcon, {
className: BDFDB.disCN.channelheadericon,
iconSVG: `<svg width="26" height="26"><path stroke-width="2" stroke="currentColor" fill="none" d="M6 18 l13 0"/></svg>`
@ -260,7 +265,7 @@ module.exports = (_ => {
}));
children.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Clickable, {
className: BDFDB.disCNS.channelheadericonwrapper + BDFDB.disCN.channelheadericonclickable,
onClick: _ => {this.maximize();},
onClick: _ => this.maximize(),
children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SvgIcon, {
className: BDFDB.disCN.channelheadericon,
iconSVG: this.isMaximized() ? `<svg width="26" height="26"><path stroke-width="2" stroke="currentColor" fill="none" d="M6 9 l10 0 l0 10 l-10 0 l0 -10 m3 -3 l10 0 l0 10"/></svg>` : `<svg width="26" height="26"><path stroke-width="2" stroke="currentColor" fill="none" d="M6 6 l13 0 l0 13 l-13 0 l0 -13"/></svg>`
@ -268,7 +273,7 @@ module.exports = (_ => {
}));
children.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Clickable, {
className: BDFDB.disCNS.channelheadericonwrapper + BDFDB.disCN.channelheadericonclickable,
onClick: _ => {BDFDB.LibraryModules.WindowUtils.close();},
onClick: _ => BDFDB.LibraryModules.WindowUtils.close(),
children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SvgIcon, {
className: BDFDB.disCN.channelheadericon,
iconSVG: `<svg width="26" height="26"><path stroke-width="2" stroke="currentColor" fill="none" d="M6 6 l13 13 m0 -13 l-13 13"/></svg>`
@ -291,15 +296,19 @@ module.exports = (_ => {
BDFDB.LibraryModules.WindowUtils.maximize();
}
else {
if (!lastWindowRects || this.isScreenSize(lastWindowRects)) {
let rects = this.getWindowRects();
window.resizeTo(rects.width/2, rects.height/2);
window.moveTo(rects.width/4, rects.height/4);
}
else {
window.resizeTo(lastWindowRects.width, lastWindowRects.height);
window.moveTo(lastWindowRects.x, lastWindowRects.y);
}
BDFDB.LibraryModules.WindowUtils.maximize();
BDFDB.TimeUtils.timeout(_ => {
if (!this.isMaximized()) return;
if (!lastWindowRects || this.isScreenSize(lastWindowRects)) {
let rects = this.getWindowRects();
window.resizeTo(rects.width/2, rects.height/2);
window.moveTo(rects.width/4, rects.height/4);
}
else {
window.resizeTo(lastWindowRects.width, lastWindowRects.height);
window.moveTo(lastWindowRects.x, lastWindowRects.y);
}
}, 100);
}
}

View File

@ -141,7 +141,7 @@ module.exports = (_ => {
let type = BDFDB.LibraryModules.StringUtils.upperCaseFirstChar(e.instance.props.type || "");
if (e.instance.props.textValue && e.instance.state.focused && (!type || settings["change" + type] || settings["change" + type] === undefined)) {
let string = e.instance.props.textValue;
if (string.length && !/<[#@]\d+>|:[A-z0-9_-]+:|[\uD83C-\uDBFF\uDC00-\uDFFF]+/.test(string)) {
if (string.length && !/<[#@][!&]{0,1}\d+>|@here|@everyone|:[A-z0-9_-]+:|[\uD83C-\uDBFF\uDC00-\uDFFF]+/.test(string)) {
let newString = string, stop = false;
for (let space of spaces) for (let symbol of symbols) if (!stop) {
let reg;