diff --git a/Resources/Plugins/clear-columns/browser.js b/Resources/Plugins/clear-columns/browser.js index e3ec3228..99d1b72a 100644 --- a/Resources/Plugins/clear-columns/browser.js +++ b/Resources/Plugins/clear-columns/browser.js @@ -53,9 +53,7 @@ enabled(){ }; this.eventKeyDown = function(e){ - if (!(document.activeElement === null || document.activeElement === document.body)){ - return; - } + return if !(document.activeElement === null || document.activeElement === document.body); updateShiftState(e.shiftKey); diff --git a/Resources/Plugins/edit-design/browser.js b/Resources/Plugins/edit-design/browser.js index 271e12b3..6192ebeb 100644 --- a/Resources/Plugins/edit-design/browser.js +++ b/Resources/Plugins/edit-design/browser.js @@ -102,16 +102,14 @@ enabled(){ // settings click event this.onSettingsMenuClickedEvent = () => { - if (this.htmlModal === null || this.config === null){ - return; - } + return if this.htmlModal === null || this.config === null; setTimeout(() => { let menu = $(".js-dropdown-content").children("ul").first(); - if (menu.length === 0)return; + return if menu.length === 0; let itemTD = menu.children("[data-std]").first(); - if (itemTD.length === 0)return; + return if itemTD.length === 0; if (!itemTD.prev().hasClass("drp-h-divider")){ itemTD.before('<li class="drp-h-divider"></li>'); diff --git a/Resources/Plugins/emoji-keyboard/browser.js b/Resources/Plugins/emoji-keyboard/browser.js index 68392baa..ffcdd684 100644 --- a/Resources/Plugins/emoji-keyboard/browser.js +++ b/Resources/Plugins/emoji-keyboard/browser.js @@ -355,9 +355,7 @@ enabled(){ }; this.composeOldInputFocusEvent = function(){ - if (!isEditorActive){ - return; - } + return if !isEditorActive; let val = $(this).val(); diff --git a/Resources/Plugins/reply-account/browser.js b/Resources/Plugins/reply-account/browser.js index cb1a44f0..c0cc77db 100644 --- a/Resources/Plugins/reply-account/browser.js +++ b/Resources/Plugins/reply-account/browser.js @@ -6,9 +6,7 @@ enabled(){ this.lastSelectedAccount = null; this.uiComposeTweetEvent = (e, data) => { - if (data.type !== "reply" || data.popFromInline || !("element" in data)){ - return; - } + return if data.type !== "reply" || data.popFromInline || !("element" in data); var query; @@ -83,9 +81,7 @@ enabled(){ break; case "#last": - if (this.lastSelectedAccount === null){ - return; - } + return if this.lastSelectedAccount === null; identifier = this.lastSelectedAccount; break; diff --git a/Resources/Plugins/templates/browser.js b/Resources/Plugins/templates/browser.js index 63ab00fd..9094cfef 100644 --- a/Resources/Plugins/templates/browser.js +++ b/Resources/Plugins/templates/browser.js @@ -177,7 +177,7 @@ enabled(){ var useTemplate = (contents, append) => { let ele = $(".js-compose-text"); - if (ele.length === 0)return; + return if ele.length === 0; let value = append ? ele.val()+contents : contents; let prevLength = value.length; diff --git a/Resources/Scripts/code.js b/Resources/Scripts/code.js index e38fa045..cce054d6 100644 --- a/Resources/Scripts/code.js +++ b/Resources/Scripts/code.js @@ -291,7 +291,7 @@ $("[data-action='settings-menu']").click(function(){ setTimeout(function(){ let menu = $(".js-dropdown-content").children("ul").first(); - if (menu.length === 0)return; + return if menu.length === 0; menu.children(".drp-h-divider").last().before('<li class="is-selectable" data-std><a href="#" data-action="tweetduck">TweetDuck</a></li>'); @@ -326,10 +326,7 @@ if (e.type === "mouseenter"){ let text = me.text(); - - if (text.charCodeAt(text.length-1) !== 8230){ // horizontal ellipsis - return; - } + return if text.charCodeAt(text.length-1) !== 8230; // horizontal ellipsis if ($TDX.expandLinksOnHover){ tooltipTimer = window.setTimeout(function(){ @@ -544,9 +541,7 @@ for(let item of e.originalEvent.clipboardData.items){ if (item.type.startsWith("image/")){ if (!$(this).closest(".rpl").find(".js-reply-popout").click().length){ // popout direct messages - if ($(".js-add-image-button").is(".is-disabled")){ // tweetdeck does not check upload count properly - return; - } + return if $(".js-add-image-button").is(".is-disabled"); // tweetdeck does not check upload count properly } uploader.addFilesToUpload([ item.getAsFile() ]); @@ -645,9 +640,7 @@ } }); - if (!ensurePropertyExists(TD, "vo", "Column", "prototype", "clear")){ - return; - } + return if !ensurePropertyExists(TD, "vo", "Column", "prototype", "clear"); TD.vo.Column.prototype.clear = prependToFunction(TD.vo.Column.prototype.clear, function(){ window.setTimeout(resetActiveFocus, 0); // unfocuses the Clear button, otherwise it steals keyboard input diff --git a/Resources/Scripts/notification.js b/Resources/Scripts/notification.js index c25052e9..71e1f2f0 100644 --- a/Resources/Scripts/notification.js +++ b/Resources/Scripts/notification.js @@ -51,13 +51,10 @@ var me = e.currentTarget; var url = me.getAttribute("data-full-url"); - if (!url)return; + return if !url; var text = me.textContent; - - if (text.charCodeAt(text.length-1) !== 8230){ // horizontal ellipsis - return; - } + return if text.charCodeAt(text.length-1) !== 8230; // horizontal ellipsis if ($TDX.expandLinksOnHover){ tooltipTimer = window.setTimeout(function(){ @@ -79,7 +76,7 @@ }); addEventListener(links, "mouseleave", function(e){ - if (!e.currentTarget.hasAttribute("data-full-url"))return; + return if !e.currentTarget.hasAttribute("data-full-url"); if ($TDX.expandLinksOnHover){ var prevText = e.currentTarget.getAttribute("td-prev-text"); @@ -100,7 +97,7 @@ addEventListener(links, "mousemove", function(e){ if (tooltipDisplayed && (prevMouseX !== e.clientX || prevMouseY !== e.clientY)){ var url = e.currentTarget.getAttribute("data-full-url"); - if (!url)return; + return if !url; $TD.displayTooltip(url, true); prevMouseX = e.clientX; @@ -112,11 +109,7 @@ // // Block: Setup a skip button. // - (function(){ - if (document.body.hasAttribute("td-example-notification")){ - return; - } - + if (!document.body.hasAttribute("td-example-notification")){ document.body.insertAdjacentHTML("afterbegin", [ '<svg id="td-skip" xmlns="http://www.w3.org/2000/svg" width="10" height="17" viewBox="0 0 350 600" style="position:fixed;left:30px;bottom:10px;z-index:1000">', '<path fill="#888" d="M0,151.656l102.208-102.22l247.777,247.775L102.208,544.986L0,442.758l145.546-145.547">', @@ -126,7 +119,7 @@ document.getElementById("td-skip").addEventListener("click", function(){ $TD.loadNextNotification(); }); - })(); + } // // Block: Setup a hover class on body.