diff --git a/Plugins/CompleteTimestamps/CompleteTimestamps.plugin.js b/Plugins/CompleteTimestamps/CompleteTimestamps.plugin.js index a6085c43a4..140df810ca 100644 --- a/Plugins/CompleteTimestamps/CompleteTimestamps.plugin.js +++ b/Plugins/CompleteTimestamps/CompleteTimestamps.plugin.js @@ -3,7 +3,7 @@ class CompleteTimestamps { getName () {return "CompleteTimestamps";} - getVersion () {return "1.3.6";} + getVersion () {return "1.3.7";} getAuthor () {return "DevilBro";} @@ -11,13 +11,14 @@ class CompleteTimestamps { constructor () { this.changelog = { + "fixed":[["Arabic Usernames","Fixed issue where arabic usernames would break timestamps that contain a space"]], "improved":[["New Library Structure & React","Restructured my Library and switched to React rendering instead of DOM manipulation"]] }; this.patchModules = { - "Message":"render", - "MessageContent":"render", - "Embed":"render" + Message: "render", + MessageContent: "render", + Embed: "render" }; } @@ -50,7 +51,7 @@ class CompleteTimestamps { let settings = BDFDB.DataUtils.get(this, "settings"); let choices = BDFDB.DataUtils.get(this, "choices"); let formats = BDFDB.DataUtils.get(this, "formats"); - let settingsitems = [], inneritems = []; + let settingsitems = []; for (let key in settings) settingsitems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, { className: BDFDB.disCN.marginbottom8, @@ -255,21 +256,30 @@ class CompleteTimestamps { injectTimestamp (parent, props) { let [children, index] = BDFDB.ReactUtils.findChildren(parent, {name: "MessageTimestamp"}); - if (index > -1) children.splice(index, 1, BDFDB.ReactUtils.createElement("time", { - className: BDFDB.DOMUtils.formatClassName(props.backgroundOpacity ? BDFDB.disCN["message" + props.backgroundOpacity + "backgroundopacity"] : null, !(props.isEditing || props.isHeader) ? BDFDB.disCN.messagetimestampvisibleonhover : null, props.isCompact ? (props.isMentioned ? BDFDB.disCN.messagetimestampcompactismentioned : BDFDB.disCN.messagetimestampcompact) : BDFDB.disCN.messagetimestampcozy), - dateTime: props.message.timestamp, - children: [ - BDFDB.ReactUtils.createElement("i", { - className: BDFDB.disCN.messagetimestampseparatorleft, - children: props.isCompact ? "[" : " [" - }), - this.getTimestamp(this.languages[BDFDB.DataUtils.get(this, "choices", "creationDateLang")].id, props.message.timestamp._i), - BDFDB.ReactUtils.createElement("i", { - className: BDFDB.disCN.messagetimestampseparatorright, - children: props.isCompact ? "] " : "]" - }) - ] - })); + if (index > -1) { + if (!props.isCompact) children.splice(index++, 0, BDFDB.ReactUtils.createElement("span", { + children: "ARABIC-FIX", + style: { + fontSize: 0, + visibility: "hidden" + } + })); + children.splice(index, 1, BDFDB.ReactUtils.createElement("time", { + className: BDFDB.DOMUtils.formatClassName(props.backgroundOpacity ? BDFDB.disCN["message" + props.backgroundOpacity + "backgroundopacity"] : null, !(props.isEditing || props.isHeader) ? BDFDB.disCN.messagetimestampvisibleonhover : null, props.isCompact ? (props.isMentioned ? BDFDB.disCN.messagetimestampcompactismentioned : BDFDB.disCN.messagetimestampcompact) : BDFDB.disCN.messagetimestampcozy), + dateTime: props.message.timestamp, + children: [ + BDFDB.ReactUtils.createElement("i", { + className: BDFDB.disCN.messagetimestampseparatorleft, + children: props.isCompact ? "[" : " [" + }), + this.getTimestamp(this.languages[BDFDB.DataUtils.get(this, "choices", "creationDateLang")].id, props.message.timestamp._i), + BDFDB.ReactUtils.createElement("i", { + className: BDFDB.disCN.messagetimestampseparatorright, + children: props.isCompact ? "] " : "]" + }) + ] + })); + } } injectEditStamp (parent, props) { @@ -284,24 +294,6 @@ class CompleteTimestamps { })); } - toggleInfo (ele) { - BDFDB.DOMUtils.toggleClass(ele.querySelector("svg"), BDFDB.disCN.directionright); - BDFDB.DOMUtils.toggle(ele.nextElementSibling); - BDFDB.DataUtils.save(BDFDB.DOMUtils.isHidden(ele.nextElementSibling), this, "hideInfo", "hideInfo"); - } - - // REMOVE - changeTimestamp (stamp) { - if (!stamp.className || stamp.className.toLowerCase().indexOf("timestamp") == -1 || BDFDB.DOMUtils.containsClass(stamp, "complete-timestamp")) return; - let time = stamp.getAttribute("datetime"); - if (time) { - this.setMaxWidth(); - BDFDB.DOMUtils.addClass(stamp, "complete-timestamp"); - stamp.parentElement.insertBefore(BDFDB.DOMUtils.create(`ARABIC FIX`), stamp); - BDFDB.DOMUtils.setText(stamp, this.getTimestamp(this.languages[BDFDB.DataUtils.get(this, "choices", "creationDateLang")].id, time)); - } - } - getTimestamp (languageid, time) { let timeobj = time ? time : new Date(); if (typeof time == "string") timeobj = new Date(time);