From fc320cdd8ac29222c805145185215fe587b7b2d8 Mon Sep 17 00:00:00 2001 From: Gopi Ramena Date: Sun, 24 Jun 2012 02:17:43 +0530 Subject: [PATCH 1/3] removed $.ajaxSetup({cache:true}) which is by default --- fuckit.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/fuckit.js b/fuckit.js index b646424..08fc836 100644 --- a/fuckit.js +++ b/fuckit.js @@ -9,8 +9,6 @@ (function($){ - $.ajaxSetup({ cache: true }); - var _FuckIt = window.FuckIt; var FuckIt = function(script){ From 91cb3100a8cf7f7ded05c3bdad3a0f931b44f4d2 Mon Sep 17 00:00:00 2001 From: Gopi Ramena Date: Sun, 24 Jun 2012 02:53:55 +0530 Subject: [PATCH 2/3] used success & error functions which can catch errors more efficiently --- fuckit.js | 15 ++++++++------- test.html | 2 +- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/fuckit.js b/fuckit.js index 08fc836..227a382 100644 --- a/fuckit.js +++ b/fuckit.js @@ -14,13 +14,14 @@ var FuckIt = function(script){ var req = $.ajax({ url: script, - dataType: "text" - }); - req.then(function(result){ - window.fuckedScript = result; - eval(window.fuckedScript); - }, function(){ - throw new Error("Could not load script: "+script); + dataType: "text", + success: function(result){ + window.fuckedScript = result; + eval(window.fuckedScript); + }, + error: function(jqXHR, textStatus, errorThrown){ + throw new Error(script+" "+errorThrown); + } }); } diff --git a/test.html b/test.html index 3801dd2..71862e6 100644 --- a/test.html +++ b/test.html @@ -4,7 +4,7 @@ From 07a415534feee020528788addf0d1b778516fc51 Mon Sep 17 00:00:00 2001 From: Gopi Ramena Date: Sun, 24 Jun 2012 02:54:13 +0530 Subject: [PATCH 3/3] used success & error functions which can catch errors more efficiently --- fuckit.js | 2 ++ test.html | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/fuckit.js b/fuckit.js index 227a382..f6eb582 100644 --- a/fuckit.js +++ b/fuckit.js @@ -9,6 +9,8 @@ (function($){ + $.ajaxSetup({ cache: true }); + var _FuckIt = window.FuckIt; var FuckIt = function(script){ diff --git a/test.html b/test.html index 71862e6..3801dd2 100644 --- a/test.html +++ b/test.html @@ -4,7 +4,7 @@