more shim cleanup

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

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';
var $ = this;
$.fn.spinForPromise = function(promise){
var self = this;
if(!promise || promise.state() !== 'pending') {
@ -43,4 +44,4 @@ module.exports = (function(){
}
return this;
};
}).call(this);
};