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