Created
February 8, 2011 18:41
-
-
Save jbasdf/816947 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
clean_snippet: function(snippet){ | |
snippet = snippet.replace(/'/gi, "("); // single quote will cause javascript problems inline. | |
snippet = snippet.replace(/[\t\n\r]/gi, ""); // remove tabs, newlines, and return chars | |
return this.rewrite_links(snippet); | |
}, | |
// Rewrite links in the snippets so they go back to the parent site. | |
rewrite_links: function(snippet){ | |
var obj = jQuery(snippet); | |
obj.find('[href]').attr('href', function(){ return com.oerglue.browser.make_abs_url(this.href); }); | |
obj.find('[src]').attr('src', function(){ return com.oerglue.browser.make_abs_url(this.src); }); | |
obj.find('[action]').attr('action', function(){ return com.oerglue.browser.make_abs_url(this.action); }); | |
return com.oerglue.common.obj_to_s(obj); | |
}, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment