From 48c9e29eabb819070de48c335fd598acf47c03f6 Mon Sep 17 00:00:00 2001 From: kayone Date: Thu, 10 Oct 2013 18:29:18 -0700 Subject: [PATCH] Fixed: Back to top button is back Fixed: Delete series in Firefox --- src/UI/Mixins/jquery.ajax.js | 29 +++++++++++++---------------- src/UI/app.js | 30 ++++++++---------------------- src/UI/jQuery/ToTheTop.js | 5 +++-- 3 files changed, 24 insertions(+), 40 deletions(-) diff --git a/src/UI/Mixins/jquery.ajax.js b/src/UI/Mixins/jquery.ajax.js index 918d565af..dfb239819 100644 --- a/src/UI/Mixins/jquery.ajax.js +++ b/src/UI/Mixins/jquery.ajax.js @@ -1,31 +1,28 @@ //try to add ajax data as query string to DELETE calls. 'use strict'; -define(function () { +define( + [ + 'jquery' + ], function ($) { - return function () { + var original = $.ajax; - var original = this.ajax; - this.ajax = function () { + $.ajax = function (xhr) { - var xhr = arguments[0]; - - //check if ajax call was made with data option if (xhr && xhr.data && xhr.type === 'DELETE') { - if (!xhr.url.contains('?')) { - xhr.url = xhr.url + '?' + $.param(xhr.data); + + if (xhr.url.contains('?')) { + xhr.url += '&'; } else { - xhr.url = xhr.url + '&' + $.param(xhr.data); + xhr.url += '?'; } + xhr.url += $.param(xhr.data); + delete xhr.data; } - if (xhr) { - xhr.headers = xhr.headers || {}; -// xhr.headers.Authorization = window.NzbDrone.ApiKey; - } return original.apply(this, arguments); }; - }; -}); + }); diff --git a/src/UI/app.js b/src/UI/app.js index 2404374fd..7d4aab71d 100644 --- a/src/UI/app.js +++ b/src/UI/app.js @@ -29,25 +29,6 @@ require.config({ shim: { - jquery: { - exports: 'jQuery', - deps : - [ - 'Mixins/jquery.ajax' - ], - - init: function (AjaxMixin) { - require( - [ - 'jQuery/ToTheTop', - 'Instrumentation/ErrorHandler' - ]); - - AjaxMixin.apply($); - } - - }, - signalR: { deps: [ @@ -83,11 +64,15 @@ require.config({ }, backbone: { - deps : + deps: [ + 'jquery', 'underscore', - 'jquery' + 'Mixins/jquery.ajax', + 'jQuery/ToTheTop' + ], + exports: 'Backbone' }, @@ -199,6 +184,7 @@ require.config({ define( [ + 'jquery', 'backbone', 'marionette', 'jQuery/RouteBinder', @@ -209,7 +195,7 @@ define( 'Router', 'Shared/Modal/Controller', 'Instrumentation/StringFormat' - ], function (Backbone, Marionette, RouteBinder, SignalRBroadcaster, NavbarView, AppLayout, SeriesController, Router, ModalController) { + ], function ($, Backbone, Marionette, RouteBinder, SignalRBroadcaster, NavbarView, AppLayout, SeriesController, Router, ModalController) { new SeriesController(); new ModalController(); diff --git a/src/UI/jQuery/ToTheTop.js b/src/UI/jQuery/ToTheTop.js index 401987ef2..fb4763e5f 100644 --- a/src/UI/jQuery/ToTheTop.js +++ b/src/UI/jQuery/ToTheTop.js @@ -1,8 +1,9 @@ 'use strict'; define( [ + 'jquery', 'bootstrap' - ], function () { + ], function ($) { $(document).ready(function () { var _window = $(window); @@ -18,7 +19,7 @@ define( }); _scrollButton.click(function () { - $("html, body").animate({ scrollTop: 0 }, 600); + $('html, body').animate({ scrollTop: 0 }, 600); return false; }); });