parent
70bfad4e6a
commit
29d9e3dadf
@ -1,53 +1,52 @@
|
|||||||
'use strict';
|
var vent = require('./vent');
|
||||||
define(
|
|
||||||
[
|
module.exports = {
|
||||||
'vent'
|
Events : {
|
||||||
], function (vent) {
|
ConfigUpdatedEvent : 'ConfigUpdatedEvent'
|
||||||
return {
|
},
|
||||||
Events: {
|
|
||||||
ConfigUpdatedEvent: 'ConfigUpdatedEvent'
|
Keys : {
|
||||||
},
|
DefaultProfileId : 'DefaultProfileId',
|
||||||
|
DefaultRootFolderId : 'DefaultRootFolderId',
|
||||||
Keys : {
|
UseSeasonFolder : 'UseSeasonFolder',
|
||||||
DefaultProfileId : 'DefaultProfileId',
|
DefaultSeriesType : 'DefaultSeriesType',
|
||||||
DefaultRootFolderId : 'DefaultRootFolderId',
|
MonitorEpisodes : 'MonitorEpisodes',
|
||||||
UseSeasonFolder : 'UseSeasonFolder',
|
AdvancedSettings : 'advancedSettings'
|
||||||
DefaultSeriesType : 'DefaultSeriesType',
|
},
|
||||||
MonitorEpisodes : 'MonitorEpisodes',
|
|
||||||
AdvancedSettings : 'advancedSettings'
|
getValueBoolean : function(key, defaultValue) {
|
||||||
},
|
defaultValue = defaultValue || false;
|
||||||
|
|
||||||
getValueBoolean: function (key, defaultValue) {
|
return this.getValue(key, defaultValue.toString()) === 'true';
|
||||||
defaultValue = defaultValue || false;
|
},
|
||||||
|
|
||||||
return this.getValue(key, defaultValue.toString()) === 'true';
|
getValue : function(key, defaultValue) {
|
||||||
},
|
var storeValue = window.localStorage.getItem(key);
|
||||||
|
|
||||||
getValue: function (key, defaultValue) {
|
if (!storeValue) {
|
||||||
var storeValue = window.localStorage.getItem(key);
|
return defaultValue;
|
||||||
|
}
|
||||||
if (!storeValue) {
|
|
||||||
return defaultValue;
|
return storeValue.toString();
|
||||||
}
|
},
|
||||||
|
|
||||||
return storeValue.toString();
|
setValue : function(key, value) {
|
||||||
},
|
|
||||||
|
console.log('Config: [{0}] => [{1}]'.format(key, value));
|
||||||
setValue: function (key, value) {
|
|
||||||
|
if (this.getValue(key) === value.toString()) {
|
||||||
console.log('Config: [{0}] => [{1}]'.format(key, value));
|
return;
|
||||||
|
}
|
||||||
if (this.getValue(key) === value.toString()) {
|
|
||||||
return;
|
try {
|
||||||
}
|
window.localStorage.setItem(key, value);
|
||||||
|
vent.trigger(this.Events.ConfigUpdatedEvent, {
|
||||||
try {
|
key : key,
|
||||||
window.localStorage.setItem(key, value);
|
value : value
|
||||||
vent.trigger(this.Events.ConfigUpdatedEvent, {key: key, value: value});
|
});
|
||||||
}
|
}
|
||||||
catch (error) {
|
catch (error) {
|
||||||
console.error('Unable to save config: [{0}] => [{1}]'.format(key, value));
|
console.error('Unable to save config: [{0}] => [{1}]'.format(key, value));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
});
|
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
module.exports = (function(){
|
window.onbeforeunload = function() {
|
||||||
window.onbeforeunload = function(){
|
window.NzbDrone.unloading = true;
|
||||||
window.NzbDrone.unloading = true;
|
};
|
||||||
};
|
|
||||||
}).call(this);
|
|
@ -1,35 +1,36 @@
|
|||||||
var Wreqr = require('./JsLibraries/backbone.wreqr');
|
var Wreqr = require('./JsLibraries/backbone.wreqr');
|
||||||
|
|
||||||
module.exports = (function(){
|
var vent = new Wreqr.EventAggregator();
|
||||||
'use strict';
|
|
||||||
var vent = new Wreqr.EventAggregator();
|
vent.Events = {
|
||||||
vent.Events = {
|
SeriesAdded : 'series:added',
|
||||||
SeriesAdded : 'series:added',
|
SeriesDeleted : 'series:deleted',
|
||||||
SeriesDeleted : 'series:deleted',
|
CommandComplete : 'command:complete',
|
||||||
CommandComplete : 'command:complete',
|
ServerUpdated : 'server:updated',
|
||||||
ServerUpdated : 'server:updated',
|
EpisodeFileDeleted : 'episodefile:deleted'
|
||||||
EpisodeFileDeleted : 'episodefile:deleted'
|
};
|
||||||
};
|
|
||||||
vent.Commands = {
|
vent.Commands = {
|
||||||
EditSeriesCommand : 'EditSeriesCommand',
|
EditSeriesCommand : 'EditSeriesCommand',
|
||||||
DeleteSeriesCommand : 'DeleteSeriesCommand',
|
DeleteSeriesCommand : 'DeleteSeriesCommand',
|
||||||
OpenModalCommand : 'OpenModalCommand',
|
OpenModalCommand : 'OpenModalCommand',
|
||||||
CloseModalCommand : 'CloseModalCommand',
|
CloseModalCommand : 'CloseModalCommand',
|
||||||
ShowEpisodeDetails : 'ShowEpisodeDetails',
|
ShowEpisodeDetails : 'ShowEpisodeDetails',
|
||||||
ShowHistoryDetails : 'ShowHistoryDetails',
|
ShowHistoryDetails : 'ShowHistoryDetails',
|
||||||
ShowLogDetails : 'ShowLogDetails',
|
ShowLogDetails : 'ShowLogDetails',
|
||||||
SaveSettings : 'saveSettings',
|
SaveSettings : 'saveSettings',
|
||||||
ShowLogFile : 'showLogFile',
|
ShowLogFile : 'showLogFile',
|
||||||
ShowRenamePreview : 'showRenamePreview',
|
ShowRenamePreview : 'showRenamePreview',
|
||||||
ShowFileBrowser : 'showFileBrowser',
|
ShowFileBrowser : 'showFileBrowser',
|
||||||
CloseFileBrowser : 'closeFileBrowser',
|
CloseFileBrowser : 'closeFileBrowser',
|
||||||
OpenControlPanelCommand : 'OpenControlPanelCommand',
|
OpenControlPanelCommand : 'OpenControlPanelCommand',
|
||||||
CloseControlPanelCommand : 'CloseControlPanelCommand'
|
CloseControlPanelCommand : 'CloseControlPanelCommand'
|
||||||
};
|
};
|
||||||
vent.Hotkeys = {
|
|
||||||
NavbarSearch : 'navbar:search',
|
vent.Hotkeys = {
|
||||||
SaveSettings : 'settings:save',
|
NavbarSearch : 'navbar:search',
|
||||||
ShowHotkeys : 'hotkeys:show'
|
SaveSettings : 'settings:save',
|
||||||
};
|
ShowHotkeys : 'hotkeys:show'
|
||||||
return vent;
|
};
|
||||||
}).call(this);
|
|
||||||
|
module.exports = vent;
|
Loading…
Reference in new issue