1
0
mirror of https://github.com/chylex/TweetDuck.git synced 2025-05-09 23:34:06 +02:00

Move TweetDeck design reversion into a plugin for future

This commit is contained in:
chylex 2016-06-03 15:06:01 +02:00
parent 9bf396f2a8
commit 379191751c
3 changed files with 54 additions and 17 deletions
Resources
Plugins/design-revert
Scripts

View File

@ -0,0 +1,12 @@
[name]
Revert TweetDeck design changes
[description]
- Moves action menu to the right and hides it by default
- Reverts interactive texts around tweets (such as 'Details' or 'Conversation')
[author]
chylex
[version]
1.0

View File

@ -0,0 +1,41 @@
constructor(){
super({
requiresPageReload: true
});
}
enabled(){
// add a stylesheet to change tweet actions
var style = document.createElement("style");
style.id = "design-revert";
document.head.appendChild(style);
var sheet = style.sheet;
sheet.insertRule(".tweet-actions { float: right !important; width: auto !important; visibility: hidden; }",0);
sheet.insertRule(".tweet-actions:hover { visibility: visible; }",0);
sheet.insertRule(".tweet-actions > li:nth-child(4) { margin-right: 2px !important; }",0);
// revert small links around the tweet
this.prevFooterMustache = TD.mustaches["status/tweet_single_footer.mustache"];
var footerLayout = TD.mustaches["status/tweet_single_footer.mustache"];
footerLayout = footerLayout.replace('txt-mute txt-size--12','txt-mute txt-small');
footerLayout = footerLayout.replace('{{#inReplyToID}}','{{^inReplyToID}} <a class="pull-left margin-txs txt-mute txt-small is-vishidden-narrow" href="#" rel="viewDetails">{{_i}}Details{{/i}}</a> <a class="pull-left margin-txs txt-mute txt-small is-vishidden is-visshown-narrow" href="#" rel="viewDetails">{{_i}}Open{{/i}}</a> {{/inReplyToID}} {{#inReplyToID}}');
footerLayout = footerLayout.replace('<span class="link-complex-target"> {{_i}}View Conversation{{/i}}','<i class="icon icon-conversation icon-small-context"></i> <span class="link-complex-target"> <span class="is-vishidden-wide is-vishidden-narrow">{{_i}}View{{/i}}</span> <span class="is-vishidden is-visshown-wide">{{_i}}Conversation{{/i}}</span>');
TD.mustaches["status/tweet_single_footer.mustache"] = footerLayout;
// fix layout for right-aligned actions menu
this.uiShowActionsMenuEvent = function(){
$(".js-dropdown.pos-r").toggleClass("pos-r pos-l");
};
}
ready(){
$(document).on("uiShowActionsMenu",this.uiShowActionsMenuEvent);
}
disabled(){
$("#design-revert").remove();
$(document).off("uiShowActionsMenu",this.uiShowActionsMenuEvent);
TD.mustaches["status/tweet_single_footer.mustache"] = this.prevFooterMustache;
}

View File

@ -40,11 +40,6 @@
},0);
});
// Fix layout for right-aligned actions menu
$(document).on("uiShowActionsMenu",function(){
$(".js-dropdown.pos-r").toggleClass("pos-r pos-l");
});
// Notification handling
$.subscribe("/notifications/new",function(obj){
for(let index = obj.items.length-1; index >= 0; index--){
@ -438,20 +433,9 @@
(function(){
var style = document.createElement("style");
document.head.appendChild(style);
var sheet = style.sheet;
// change View Conversation
var footerLayout = TD.mustaches["status/tweet_single_footer.mustache"];
footerLayout = footerLayout.replace('txt-mute txt-size--12','txt-mute txt-small');
footerLayout = footerLayout.replace('{{#inReplyToID}}','{{^inReplyToID}} <a class="pull-left margin-txs txt-mute txt-small is-vishidden-narrow" href="#" rel="viewDetails">{{_i}}Details{{/i}}</a> <a class="pull-left margin-txs txt-mute txt-small is-vishidden is-visshown-narrow" href="#" rel="viewDetails">{{_i}}Open{{/i}}</a> {{/inReplyToID}} {{#inReplyToID}}');
footerLayout = footerLayout.replace('<span class="link-complex-target"> {{_i}}View Conversation{{/i}}','<i class="icon icon-conversation icon-small-context"></i> <span class="link-complex-target"> <span class="is-vishidden-wide is-vishidden-narrow">{{_i}}View{{/i}}</span> <span class="is-vishidden is-visshown-wide">{{_i}}Conversation{{/i}}</span>');
TD.mustaches["status/tweet_single_footer.mustache"] = footerLayout;
// tweet actions
sheet.insertRule(".tweet-actions { float: right !important; width: auto !important; visibility: hidden; }",0);
sheet.insertRule(".tweet-actions:hover { visibility: visible; }",0);
sheet.insertRule(".tweet-actions > li:nth-child(4) { margin-right: 2px !important; }",0);
// break long urls
sheet.insertRule("a[data-full-url] { word-break: break-all; }",0);
})();