diff --git a/Resources/Plugins/reply-account/browser.js b/Resources/Plugins/reply-account/browser.js index 0a183070..d66869dd 100644 --- a/Resources/Plugins/reply-account/browser.js +++ b/Resources/Plugins/reply-account/browser.js @@ -1,7 +1,7 @@ enabled(){ - var configuration = {}; + var configuration = { defaultAccount: "" }; - window.TDPF_loadConfigurationFile(this, "user.configuration.js", obj => configuration = obj); + window.TDPF_loadConfigurationFile(this, "user.configuration.js", "user.configuration.default.js", obj => configuration = obj); this.uiInlineComposeTweetEvent = function(e, data){ var account = null; @@ -45,7 +45,21 @@ enabled(){ } ready(){ - $(document).on("uiInlineComposeTweet", this.uiInlineComposeTweetEvent); + var events = $._data(document, "events"); + + if ("uiInlineComposeTweet" in events){ + $(document).on("uiInlineComposeTweet", this.uiInlineComposeTweetEvent); + + var handlers = events["uiInlineComposeTweet"]; + var oldHandler = handlers[0]; + var newHandler = handlers[1]; + + handlers[0] = newHandler; + handlers[1] = oldHandler; + } + else{ + $(document).on("uiInlineComposeTweet", this.uiInlineComposeTweetEvent); + } } disabled(){ diff --git a/Resources/Plugins/reply-account/user.configuration.js b/Resources/Plugins/reply-account/user.configuration.default.js similarity index 92% rename from Resources/Plugins/reply-account/user.configuration.js rename to Resources/Plugins/reply-account/user.configuration.default.js index 2ddcc9a5..9a3c2dc4 100644 --- a/Resources/Plugins/reply-account/user.configuration.js +++ b/Resources/Plugins/reply-account/user.configuration.default.js @@ -1,4 +1,14 @@ { + /* + * WARNING + * ------- + * + * Make sure you are editing 'user.configuration.js'. + * This file is automatically generated first time the plugin is enabled. + * Do not edit the default configuration file, as it will be replaced with each update. + * + */ + /* * Simple way of configuring the plugin * ------------------------------------