mirror of
https://github.com/the-djmaze/snappymail.git
synced 2025-01-01 12:32:40 +08:00
4cc2207513
Original unminified source code (dev folder - js, css, less) (fixes #6) Grunt build system Multiple identities correction (fixes #9) Compose html editor (fixes #12) New general settings - Loading Description New warning about default admin password Split general and login screen settings
95 lines
1.9 KiB
JavaScript
95 lines
1.9 KiB
JavaScript
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
|
|
|
/**
|
|
* @type {Object}
|
|
*/
|
|
Plugins.oViewModelsHooks = {};
|
|
|
|
/**
|
|
* @type {Object}
|
|
*/
|
|
Plugins.oSimpleHooks = {};
|
|
|
|
/**
|
|
* @param {string} sName
|
|
* @param {Function} ViewModel
|
|
*/
|
|
Plugins.regViewModelHook = function (sName, ViewModel)
|
|
{
|
|
if (ViewModel)
|
|
{
|
|
ViewModel.__hookName = sName;
|
|
}
|
|
};
|
|
|
|
/**
|
|
* @param {string} sName
|
|
* @param {Function} fCallback
|
|
*/
|
|
Plugins.addHook = function (sName, fCallback)
|
|
{
|
|
if (Utils.isFunc(fCallback))
|
|
{
|
|
if (!Utils.isArray(Plugins.oSimpleHooks[sName]))
|
|
{
|
|
Plugins.oSimpleHooks[sName] = [];
|
|
}
|
|
|
|
Plugins.oSimpleHooks[sName].push(fCallback);
|
|
}
|
|
};
|
|
|
|
/**
|
|
* @param {string} sName
|
|
* @param {Array=} aArguments
|
|
*/
|
|
Plugins.runHook = function (sName, aArguments)
|
|
{
|
|
if (Utils.isArray(Plugins.oSimpleHooks[sName]))
|
|
{
|
|
aArguments = aArguments || [];
|
|
|
|
_.each(Plugins.oSimpleHooks[sName], function (fCallback) {
|
|
fCallback.apply(null, aArguments);
|
|
});
|
|
}
|
|
};
|
|
|
|
/**
|
|
* @param {string} sName
|
|
* @return {?}
|
|
*/
|
|
Plugins.mainSettingsGet = function (sName)
|
|
{
|
|
return RL ? RL.settingsGet(sName) : null;
|
|
};
|
|
|
|
/**
|
|
* @param {Function} fCallback
|
|
* @param {string} sAction
|
|
* @param {Object=} oParameters
|
|
* @param {?number=} iTimeout
|
|
* @param {string=} sGetAdd = ''
|
|
* @param {Array=} aAbortActions = []
|
|
*/
|
|
Plugins.remoteRequest = function (fCallback, sAction, oParameters, iTimeout, sGetAdd, aAbortActions)
|
|
{
|
|
if (RL)
|
|
{
|
|
RL.remote().defaultRequest(fCallback, sAction, oParameters, iTimeout, sGetAdd, aAbortActions);
|
|
}
|
|
};
|
|
|
|
/**
|
|
* @param {string} sPluginSection
|
|
* @param {string} sName
|
|
* @return {?}
|
|
*/
|
|
Plugins.settingsGet = function (sPluginSection, sName)
|
|
{
|
|
var oPlugin = Plugins.mainSettingsGet('Plugins');
|
|
oPlugin = oPlugin && Utils.isUnd(oPlugin[sPluginSection]) ? null : oPlugin[sPluginSection];
|
|
return oPlugin ? (Utils.isUnd(oPlugin[sName]) ? null : oPlugin[sName]) : null;
|
|
};
|
|
|
|
|