Pastie now auto-senses if line-wrap is a bad or good idea. Feedback?
## mark a section (Learn more)
/* Sprinkle Javascript Library http://www.sprinklejs.com/ Copyright 2007 by Jon Davis <jon@jondavis.net> version 1.2, last updated 9/13/2007 Rewritten for Prototype framework 1.6.0 by Mislav Marohnić */ document.observe('contentloaded', function(){ var allowed = $w('SPAN DIV TEXTAREA INPUT') $$('*[src]').each(function(element){ if (!allowed.include(element.nodeName.toUpperCase()) || element._sprinkled) return element._sprinkled = true var process = arguments.callee // get it! new Ajax.Request(element.readAttribute('src'), { onComplete: function(response){ var method, value = response.responseText, parent = element.parentNode // what method do we use? if (Object.isFunction(element.setValue)) method = 'setValue' else { method = element.readAttribute('apply') == 'replace' ? 'replace' : 'update' if (value.strip().endsWith('</html>')) value = value.match(/<body[^>]*>([^\0]+)<\/body>/i)[1] } element = element[method](value) // recurse if (method != 'setValue') { if (method == 'replace') element = $(parent) element.select('*[src]').each(process) } } }) }) }) ## notes [plaintext] Doesn't support: - wraptag; - apply="value" (magically handled now); - cropBody="off"; - anticache.
This paste will be private.
From the Design Piracy series on my blog: