1
0
mirror of https://github.com/chylex/TweetDuck.git synced 2025-04-21 06:15:47 +02:00

More power!

This commit is contained in:
chylex 2017-08-23 07:28:08 +02:00
parent 69cd96a37c
commit 9f3f33da93
7 changed files with 18 additions and 42 deletions
Resources
Plugins
clear-columns
edit-design
emoji-keyboard
reply-account
templates
Scripts

View File

@ -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);

View File

@ -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>');

View File

@ -355,9 +355,7 @@ enabled(){
};
this.composeOldInputFocusEvent = function(){
if (!isEditorActive){
return;
}
return if !isEditorActive;
let val = $(this).val();

View File

@ -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;

View File

@ -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;

View File

@ -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

View File

@ -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.