mirror of
https://github.com/Radarr/Radarr
synced 2025-12-19 14:57:10 +01:00
60 lines
1.9 KiB
JavaScript
60 lines
1.9 KiB
JavaScript
'use strict';
|
|
define(
|
|
[
|
|
'vent',
|
|
'AppLayout',
|
|
'marionette',
|
|
'Shared/NotFoundView'
|
|
], function (vent, AppLayout, Marionette, NotFoundView) {
|
|
return Marionette.AppRouter.extend({
|
|
|
|
initialize: function () {
|
|
this.listenTo(vent, vent.Events.ServerUpdated, this._onServerUpdated);
|
|
},
|
|
|
|
showNotFound: function () {
|
|
this.setTitle('Not Found');
|
|
this.showMainRegion(new NotFoundView(this));
|
|
},
|
|
|
|
setTitle: function (title) {
|
|
title = title.toLocaleLowerCase();
|
|
if (title === 'sonarr') {
|
|
document.title = 'sonarr';
|
|
}
|
|
else {
|
|
document.title = title + ' - sonarr';
|
|
}
|
|
|
|
if(window.NzbDrone.Analytics && window.Piwik){
|
|
try {
|
|
var piwik = window.Piwik.getTracker('http://piwik.nzbdrone.com/piwik.php', 1);
|
|
piwik.setReferrerUrl('');
|
|
piwik.setCustomUrl('http://local' + window.location.pathname);
|
|
piwik.setCustomVariable(1, 'version', window.NzbDrone.Version, 'page');
|
|
piwik.setCustomVariable(2, 'branch', window.NzbDrone.Branch, 'page');
|
|
piwik.trackPageView(title);
|
|
}
|
|
catch (e){
|
|
console.error(e);
|
|
}
|
|
}
|
|
},
|
|
|
|
_onServerUpdated: function () {
|
|
this.pendingUpdate = true;
|
|
},
|
|
|
|
showMainRegion: function (view) {
|
|
if (this.pendingUpdate) {
|
|
window.location.reload();
|
|
}
|
|
|
|
else {
|
|
//AppLayout
|
|
AppLayout.mainRegion.show(view);
|
|
}
|
|
}
|
|
});
|
|
});
|
|
|