1
0
mirror of https://github.com/chylex/TweetDuck.git synced 2025-05-03 14:34:08 +02:00

Remove the disabled() event handler in timeline-polls plugin

This commit is contained in:
chylex 2016-09-30 15:09:52 +02:00
parent 96fa7efb66
commit 523d340ade

View File

@ -6,15 +6,11 @@ constructor(){
enabled(){ enabled(){
// add a stylesheet // add a stylesheet
this.css = window.TDPF_createCustomStyle(this); window.TDPF_createCustomStyle(this).insert(".column-detail .timeline-poll-container { display: none }");
this.css.insert(".column-detail .timeline-poll-container { display: none }");
// setup layout injecting // setup layout injecting
this.prevMustaches = {};
var injectLayout = (mustache, onlyIfNotFound, search, replace) => { var injectLayout = (mustache, onlyIfNotFound, search, replace) => {
if (TD.mustaches[mustache].indexOf(onlyIfNotFound) === -1){ if (TD.mustaches[mustache].indexOf(onlyIfNotFound) === -1){
this.prevMustaches[mustache] = TD.mustaches[mustache];
TD.mustaches[mustache] = TD.mustaches[mustache].replace(search, replace); TD.mustaches[mustache] = TD.mustaches[mustache].replace(search, replace);
} }
}; };
@ -25,6 +21,5 @@ enabled(){
} }
disabled(){ disabled(){
this.css.remove(); // not needed, plugin reloads the page when enabled or disabled
Object.keys(this.prevMustaches).forEach(mustache => TD.mustaches[mustache] = this.prevMustaches[mustache]);
} }