1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-11-05 02:22:31 +01:00

more shim cleanup

This commit is contained in:
Keivan Beigi 2015-02-07 08:37:12 -08:00
parent 672e1bd9ed
commit e0dd72328c
10 changed files with 61 additions and 71 deletions

View File

@ -1,46 +0,0 @@
var $ = require('jquery');
//var vent = require('../vent');
//var messenger = require('../Shared/Messenger');
var original = $.ajax;
$.ajax = function(xhr){
'use strict';
if(xhr && xhr.data && xhr.type === 'DELETE') {
if(xhr.url.contains('?')) {
xhr.url += '&';
}
else {
xhr.url += '?';
}
xhr.url += $.param(xhr.data);
delete xhr.data;
}
if(xhr) {
xhr.headers = xhr.headers || {};
xhr.headers['X-Api-Key'] = window.NzbDrone.ApiKey;
}
return original.apply(this, arguments);
/* .done(function (response, status, xhr) {
var version = xhr.getResponseHeader('X-ApplicationVersion');
if (!window.NzbDrone || !window.NzbDrone.Version) {
return;
}
if (version !== window.NzbDrone.Version) {
var vent = require('../vent');
var messenger = require('../Shared/Messenger');
if (!vent || !messenger) {
return;
}
messenger.show({
message : 'Sonarr has been updated', hideAfter : 0, id : 'droneUpdated', actions : {
viewChanges : {
label : 'View Changes', action : function () {
window.location = window.NzbDrone.UrlBase + '/system/updates';
}
}
}
});
vent.trigger(vent.Events.ServerUpdated);
}
});*/
};

View File

@ -1,5 +1,4 @@
var $ = require('jquery'); var $ = require('jquery');
require('../Mixins/jquery.ajax');
module.exports = { module.exports = {
get : function(resource){ get : function(resource){

View File

View File

@ -1,9 +1,7 @@
require('jquery');
require('../JsLibraries/backbone');
var jquery = require('jquery'); var jquery = require('jquery');
var backbone = require('../JsLibraries/backbone'); var backbone = require('../JsLibraries/backbone');
window.Backbone = backbone;
backbone.$ = jquery; backbone.$ = jquery;
window.Backbone = backbone;
module.exports = backbone; module.exports = backbone;

View File

@ -1,8 +1,11 @@
require('../JsLibraries/jquery');
require('../Instrumentation/StringFormat');
var jquery = require('../JsLibraries/jquery'); var jquery = require('../JsLibraries/jquery');
require('../Instrumentation/StringFormat'); require('../Instrumentation/StringFormat');
var spin = require('../jQuery/jquery.spin');
var ajax = require('../jquery/jquery.ajax');
spin.call(jquery);
ajax.call(jquery);
window.$ = jquery; window.$ = jquery;
window.jQuery = jquery; window.jQuery = jquery;
module.exports = jquery; module.exports = jquery;

View File

@ -86,7 +86,6 @@
}; };
</script> </script>
<script src="/piwikCheck.js"></script>
<script src="/polyfills.js"></script> <script src="/polyfills.js"></script>
<script src="/handlebars.runtime.js"></script> <script src="/handlebars.runtime.js"></script>
<script src="/templates.js"></script> <script src="/templates.js"></script>

View File

@ -0,0 +1,47 @@
module.exports = function(){
var $ = this;
var original = $.ajax;
$.ajax = function(xhr){
'use strict';
if(xhr && xhr.data && xhr.type === 'DELETE') {
if(xhr.url.contains('?')) {
xhr.url += '&';
}
else {
xhr.url += '?';
}
xhr.url += $.param(xhr.data);
delete xhr.data;
}
if(xhr) {
xhr.headers = xhr.headers || {};
xhr.headers['X-Api-Key'] = window.NzbDrone.ApiKey;
}
return original.apply(this, arguments);
/* .done(function (response, status, xhr) {
var version = xhr.getResponseHeader('X-ApplicationVersion');
if (!window.NzbDrone || !window.NzbDrone.Version) {
return;
}
if (version !== window.NzbDrone.Version) {
var vent = require('../vent');
var messenger = require('../Shared/Messenger');
if (!vent || !messenger) {
return;
}
messenger.show({
message : 'Sonarr has been updated', hideAfter : 0, id : 'droneUpdated', actions : {
viewChanges : {
label : 'View Changes', action : function () {
window.location = window.NzbDrone.UrlBase + '/system/updates';
}
}
}
});
vent.trigger(vent.Events.ServerUpdated);
}
});*/
};
};

View File

@ -1,7 +1,8 @@
var $ = require('jquery'); module.exports = function(){
module.exports = (function(){
'use strict'; 'use strict';
var $ = this;
$.fn.spinForPromise = function(promise){ $.fn.spinForPromise = function(promise){
var self = this; var self = this;
if(!promise || promise.state() !== 'pending') { if(!promise || promise.state() !== 'pending') {
@ -43,4 +44,4 @@ module.exports = (function(){
} }
return this; return this;
}; };
}).call(this); };

View File

@ -16,7 +16,7 @@ require('./jQuery/ToTheTop');
require('./Instrumentation/StringFormat'); require('./Instrumentation/StringFormat');
require('./LifeCycle'); require('./LifeCycle');
require('./Hotkeys/Hotkeys'); require('./Hotkeys/Hotkeys');
require('./Mixins/jquery.ajax'); require('./Shared/piwikCheck');
new SeriesController(); new SeriesController();
new ModalController(); new ModalController();

View File

@ -1,11 +0,0 @@
'use strict';
if(window.NzbDrone.Analytics) {
var d = document;
var g = d.createElement('script');
var s = d.getElementsByTagName('script')[0];
g.type = 'text/javascript';
g.async = true;
g.defer = true;
g.src = 'http://piwik.nzbdrone.com/piwik.js';
s.parentNode.insertBefore(g, s);
}