1
0
mirror of https://github.com/chylex/TweetDuck.git synced 2025-04-18 15:15:48 +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){ this.eventKeyDown = function(e){
if (!(document.activeElement === null || document.activeElement === document.body)){ return if !(document.activeElement === null || document.activeElement === document.body);
return;
}
updateShiftState(e.shiftKey); updateShiftState(e.shiftKey);

View File

@ -102,16 +102,14 @@ enabled(){
// settings click event // settings click event
this.onSettingsMenuClickedEvent = () => { this.onSettingsMenuClickedEvent = () => {
if (this.htmlModal === null || this.config === null){ return if this.htmlModal === null || this.config === null;
return;
}
setTimeout(() => { setTimeout(() => {
let menu = $(".js-dropdown-content").children("ul").first(); 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(); let itemTD = menu.children("[data-std]").first();
if (itemTD.length === 0)return; return if itemTD.length === 0;
if (!itemTD.prev().hasClass("drp-h-divider")){ if (!itemTD.prev().hasClass("drp-h-divider")){
itemTD.before('<li class="drp-h-divider"></li>'); itemTD.before('<li class="drp-h-divider"></li>');

View File

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

View File

@ -6,9 +6,7 @@ enabled(){
this.lastSelectedAccount = null; this.lastSelectedAccount = null;
this.uiComposeTweetEvent = (e, data) => { this.uiComposeTweetEvent = (e, data) => {
if (data.type !== "reply" || data.popFromInline || !("element" in data)){ return if data.type !== "reply" || data.popFromInline || !("element" in data);
return;
}
var query; var query;
@ -83,9 +81,7 @@ enabled(){
break; break;
case "#last": case "#last":
if (this.lastSelectedAccount === null){ return if this.lastSelectedAccount === null;
return;
}
identifier = this.lastSelectedAccount; identifier = this.lastSelectedAccount;
break; break;

View File

@ -177,7 +177,7 @@ enabled(){
var useTemplate = (contents, append) => { var useTemplate = (contents, append) => {
let ele = $(".js-compose-text"); let ele = $(".js-compose-text");
if (ele.length === 0)return; return if ele.length === 0;
let value = append ? ele.val()+contents : contents; let value = append ? ele.val()+contents : contents;
let prevLength = value.length; let prevLength = value.length;

View File

@ -291,7 +291,7 @@
$("[data-action='settings-menu']").click(function(){ $("[data-action='settings-menu']").click(function(){
setTimeout(function(){ setTimeout(function(){
let menu = $(".js-dropdown-content").children("ul").first(); 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>'); 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"){ if (e.type === "mouseenter"){
let text = me.text(); let text = me.text();
return if text.charCodeAt(text.length-1) !== 8230; // horizontal ellipsis
if (text.charCodeAt(text.length-1) !== 8230){ // horizontal ellipsis
return;
}
if ($TDX.expandLinksOnHover){ if ($TDX.expandLinksOnHover){
tooltipTimer = window.setTimeout(function(){ tooltipTimer = window.setTimeout(function(){
@ -544,9 +541,7 @@
for(let item of e.originalEvent.clipboardData.items){ for(let item of e.originalEvent.clipboardData.items){
if (item.type.startsWith("image/")){ if (item.type.startsWith("image/")){
if (!$(this).closest(".rpl").find(".js-reply-popout").click().length){ // popout direct messages 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 if $(".js-add-image-button").is(".is-disabled"); // tweetdeck does not check upload count properly
return;
}
} }
uploader.addFilesToUpload([ item.getAsFile() ]); uploader.addFilesToUpload([ item.getAsFile() ]);
@ -645,9 +640,7 @@
} }
}); });
if (!ensurePropertyExists(TD, "vo", "Column", "prototype", "clear")){ return if !ensurePropertyExists(TD, "vo", "Column", "prototype", "clear");
return;
}
TD.vo.Column.prototype.clear = prependToFunction(TD.vo.Column.prototype.clear, function(){ 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 window.setTimeout(resetActiveFocus, 0); // unfocuses the Clear button, otherwise it steals keyboard input

View File

@ -51,13 +51,10 @@
var me = e.currentTarget; var me = e.currentTarget;
var url = me.getAttribute("data-full-url"); var url = me.getAttribute("data-full-url");
if (!url)return; return if !url;
var text = me.textContent; var text = me.textContent;
return if text.charCodeAt(text.length-1) !== 8230; // horizontal ellipsis
if (text.charCodeAt(text.length-1) !== 8230){ // horizontal ellipsis
return;
}
if ($TDX.expandLinksOnHover){ if ($TDX.expandLinksOnHover){
tooltipTimer = window.setTimeout(function(){ tooltipTimer = window.setTimeout(function(){
@ -79,7 +76,7 @@
}); });
addEventListener(links, "mouseleave", function(e){ addEventListener(links, "mouseleave", function(e){
if (!e.currentTarget.hasAttribute("data-full-url"))return; return if !e.currentTarget.hasAttribute("data-full-url");
if ($TDX.expandLinksOnHover){ if ($TDX.expandLinksOnHover){
var prevText = e.currentTarget.getAttribute("td-prev-text"); var prevText = e.currentTarget.getAttribute("td-prev-text");
@ -100,7 +97,7 @@
addEventListener(links, "mousemove", function(e){ addEventListener(links, "mousemove", function(e){
if (tooltipDisplayed && (prevMouseX !== e.clientX || prevMouseY !== e.clientY)){ if (tooltipDisplayed && (prevMouseX !== e.clientX || prevMouseY !== e.clientY)){
var url = e.currentTarget.getAttribute("data-full-url"); var url = e.currentTarget.getAttribute("data-full-url");
if (!url)return; return if !url;
$TD.displayTooltip(url, true); $TD.displayTooltip(url, true);
prevMouseX = e.clientX; prevMouseX = e.clientX;
@ -112,11 +109,7 @@
// //
// Block: Setup a skip button. // Block: Setup a skip button.
// //
(function(){ if (!document.body.hasAttribute("td-example-notification")){
if (document.body.hasAttribute("td-example-notification")){
return;
}
document.body.insertAdjacentHTML("afterbegin", [ 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">', '<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">', '<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(){ document.getElementById("td-skip").addEventListener("click", function(){
$TD.loadNextNotification(); $TD.loadNextNotification();
}); });
})(); }
// //
// Block: Setup a hover class on body. // Block: Setup a hover class on body.