From 82a1e17b1d260452e6448c51f1941b8a0cc60a01 Mon Sep 17 00:00:00 2001 From: chylex <info@chylex.com> Date: Sun, 24 Apr 2016 14:04:52 +0200 Subject: [PATCH] Add extendFunction and refactor window.TD in code.js --- Resources/code.js | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/Resources/code.js b/Resources/code.js index 1abbf860..df6e2067 100644 --- a/Resources/code.js +++ b/Resources/code.js @@ -1,4 +1,4 @@ -(function($,$TD){ +(function($,$TD,TD){ // // Constant: List of valid font size classes. // @@ -58,11 +58,11 @@ })(); // Force popup notification settings - window.TD.controller.notifications.hasNotifications = function(){ + TD.controller.notifications.hasNotifications = function(){ return true; }; - window.TD.controller.notifications.isPermissionGranted = function(){ + TD.controller.notifications.isPermissionGranted = function(){ return true; }; @@ -70,6 +70,17 @@ isInitialized = true; }; + // + // Function: Appends code at the end of a function. + // + var extendFunction = function(func, extension){ + return function(){ + var res = func.apply(this,arguments); + extension.apply(this,arguments); + return res; + }; + }; + // // Function: Registers an observer to a TweetDeck column, which reports new tweets. // @@ -249,4 +260,4 @@ e.preventDefault(); } }); -})($,$TD); +})($,$TD,TD);