mirror of
https://github.com/chylex/TweetDuck.git
synced 2025-04-23 12:15:48 +02:00
Rename extendFunction to appendToFunction, and add prependToFunction to code.js
This commit is contained in:
parent
a335aa037a
commit
4a66486e1a
@ -44,10 +44,19 @@
|
||||
isInitialized = true;
|
||||
};
|
||||
|
||||
//
|
||||
// Function: Prepends code at the beginning of a function. If the prepended function returns true, execution of the original function is cancelled.
|
||||
//
|
||||
var prependToFunction = function(func, extension){
|
||||
return function(){
|
||||
return extension.apply(this,arguments) === true ? undefined : func.apply(this,arguments);
|
||||
};
|
||||
};
|
||||
|
||||
//
|
||||
// Function: Appends code at the end of a function.
|
||||
//
|
||||
var extendFunction = function(func, extension){
|
||||
var appendToFunction = function(func, extension){
|
||||
return function(){
|
||||
var res = func.apply(this,arguments);
|
||||
extension.apply(this,arguments);
|
||||
@ -118,11 +127,11 @@
|
||||
//
|
||||
// Block: Hook into settings object to detect when the settings change.
|
||||
//
|
||||
TD.settings.setFontSize = extendFunction(TD.settings.setFontSize,function(name){
|
||||
TD.settings.setFontSize = appendToFunction(TD.settings.setFontSize,function(name){
|
||||
$TD.loadFontSizeClass(name);
|
||||
});
|
||||
|
||||
TD.settings.setTheme = extendFunction(TD.settings.setTheme,function(){
|
||||
TD.settings.setTheme = appendToFunction(TD.settings.setTheme,function(){
|
||||
setTimeout(function(){
|
||||
$TD.loadNotificationHeadContents(getNotificationHeadContents());
|
||||
},0);
|
||||
|
Loading…
Reference in New Issue
Block a user