Permalink
Browse files

Support jQuery no conflict

  • Loading branch information...
1 parent 23ab77e commit 60075a50d76589402680d2be152d5820b7128165 @bogdan committed Jun 20, 2012
Showing with 52 additions and 24 deletions.
  1. +1 −1 Makefile
  2. +24 −0 builds/jquery-ajax-debug-0.1.2.js
  3. +16 −14 jquery-ajax-debug.js
  4. +11 −9 src/jquery-ajax-debug.js.coffee
View
@@ -1,5 +1,5 @@
-VERSION="0.1.1"
+VERSION="0.1.2"
all:
cat src/banner.js | sed s/VERSION/$(VERSION)/ > jquery-ajax-debug.js
@@ -0,0 +1,24 @@
+/*
+ * JQuery Ajax debug script
+ * v0.1.2
+ */
+(function() {
+
+ (function($) {
+ return $(document).ajaxError(function(event, xhr, settings, exception) {
+ var popup;
+ if (popup) {
+ popup.close();
+ popup = null;
+ }
+ if (xhr.status >= 500) {
+ if (popup = window.open(null, "error", "width=800,height=600")) {
+ $(popup.document.documentElement).html(xhr.responseText);
+ popup.focus();
+ }
+ }
+ return true;
+ });
+ })(jQuery);
+
+}).call(this);
View
@@ -1,22 +1,24 @@
/*
* JQuery Ajax debug script
- * v0.1.1
+ * v0.1.2
*/
(function() {
- $(document).ajaxError(function(event, xhr, settings, exception) {
- var popup;
- if (popup) {
- popup.close();
- popup = null;
- }
- if (xhr.status >= 500) {
- if (popup = window.open(null, "error", "width=800,height=600")) {
- $(popup.document.documentElement).html(xhr.responseText);
- popup.focus();
+ (function($) {
+ return $(document).ajaxError(function(event, xhr, settings, exception) {
+ var popup;
+ if (popup) {
+ popup.close();
+ popup = null;
}
- }
- return true;
- });
+ if (xhr.status >= 500) {
+ if (popup = window.open(null, "error", "width=800,height=600")) {
+ $(popup.document.documentElement).html(xhr.responseText);
+ popup.focus();
+ }
+ }
+ return true;
+ });
+ })(jQuery);
}).call(this);
@@ -1,9 +1,11 @@
-$(document).ajaxError (event, xhr, settings, exception) ->
- if popup
- popup.close()
- popup = null
- if xhr.status >= 500
- if popup = window.open(null, "error", "width=800,height=600")
- $(popup.document.documentElement).html xhr.responseText
- popup.focus()
- true
+(($) ->
+ $(document).ajaxError (event, xhr, settings, exception) ->
+ if popup
+ popup.close()
+ popup = null
+ if xhr.status >= 500
+ if popup = window.open(null, "error", "width=800,height=600")
+ $(popup.document.documentElement).html xhr.responseText
+ popup.focus()
+ true
+)(jQuery)

0 comments on commit 60075a5

Please sign in to comment.