Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

loadAdScript: added document.writeln support

  • Loading branch information...
commit f3e6b8e20f1c779559e4c315c7d03803dff5b33b 1 parent 7d5867c
@cowboy authored
Showing with 9 additions and 6 deletions.
  1. +7 −4 jquery.ba-loadadscript.js
  2. +2 −2 jquery.ba-loadadscript.min.js
View
11 jquery.ba-loadadscript.js
@@ -1,5 +1,5 @@
/*!
- * jQuery loadAdScript - v1.0 - 3/2/2010
+ * jQuery loadAdScript - v1.1 - 7/12/2010
* http://benalman.com/projects/jquery-misc-plugins/
*
* Copyright (c) 2010 "Cowboy" Ben Alman
@@ -13,6 +13,7 @@
// A few references.
var doc = document,
write = doc.write,
+ writeln = doc.writeln,
// Create queue.
q = $.jqmq({
@@ -23,8 +24,9 @@
// For each queue item, do this.
callback: function( item ) {
- // Override document.write.
- doc.write = function( html ) {
+ // Override document.write and .writeln. Do we care that .writeln
+ // should append a newline character? Probably not.
+ doc.write = doc.writeln = function( html ) {
item.elems.append( html );
};
@@ -39,9 +41,10 @@
});
},
- // When the queue completes, set document.write back.
+ // When the queue completes, set document.write and .writeln back.
complete: function(){
doc.write = write;
+ doc.writeln = writeln;
}
});
View
4 jquery.ba-loadadscript.min.js
@@ -1,9 +1,9 @@
/*
- * jQuery loadAdScript - v1.0 - 3/2/2010
+ * jQuery loadAdScript - v1.1 - 7/12/2010
* http://benalman.com/projects/jquery-misc-plugins/
*
* Copyright (c) 2010 "Cowboy" Ben Alman
* Dual licensed under the MIT and GPL licenses.
* http://benalman.com/about/license/
*/
-(function($){var c=document,a=c.write,b=$.jqmq({delay:-1,callback:function(d){c.write=function(e){d.elems.append(e)};$.getScript(d.url,function(){d.callback&&d.callback.call(d.elems);b.next()})},complete:function(){c.write=a}});$.fn.loadAdScript=function(d,e){b.add({elems:this,url:d,callback:e});return this}})(jQuery);
+(function($){var c=document,a=c.write,d=c.writeln,b=$.jqmq({delay:-1,callback:function(e){c.write=c.writeln=function(f){e.elems.append(f)};$.getScript(e.url,function(){e.callback&&e.callback.call(e.elems);b.next()})},complete:function(){c.write=a;c.writeln=d}});$.fn.loadAdScript=function(e,f){b.add({elems:this,url:e,callback:f});return this}})(jQuery);
Please sign in to comment.
Something went wrong with that request. Please try again.