more shim cleanup

pull/4/head
Keivan Beigi 9 years ago
parent 672e1bd9ed
commit e0dd72328c

@ -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);
}
});*/
};

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

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

@ -1,8 +1,11 @@
require('../JsLibraries/jquery');
require('../Instrumentation/StringFormat');
var jquery = require('../JsLibraries/jquery');
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 = jquery;
module.exports = jquery;

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

@ -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);
}
});*/
};
};

@ -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);
};

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

@ -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);
}
Loading…
Cancel
Save