mirror of
https://github.com/chylex/TweetDuck.git
synced 2025-05-03 14:34:08 +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;
|
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.
|
// Function: Appends code at the end of a function.
|
||||||
//
|
//
|
||||||
var extendFunction = function(func, extension){
|
var appendToFunction = function(func, extension){
|
||||||
return function(){
|
return function(){
|
||||||
var res = func.apply(this,arguments);
|
var res = func.apply(this,arguments);
|
||||||
extension.apply(this,arguments);
|
extension.apply(this,arguments);
|
||||||
@ -118,11 +127,11 @@
|
|||||||
//
|
//
|
||||||
// Block: Hook into settings object to detect when the settings change.
|
// 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.loadFontSizeClass(name);
|
||||||
});
|
});
|
||||||
|
|
||||||
TD.settings.setTheme = extendFunction(TD.settings.setTheme,function(){
|
TD.settings.setTheme = appendToFunction(TD.settings.setTheme,function(){
|
||||||
setTimeout(function(){
|
setTimeout(function(){
|
||||||
$TD.loadNotificationHeadContents(getNotificationHeadContents());
|
$TD.loadNotificationHeadContents(getNotificationHeadContents());
|
||||||
},0);
|
},0);
|
||||||
|
Loading…
Reference in New Issue
Block a user