Oops, your profile's looking a bit empty! To help us tailor your experience, please fill in key details like your SketchUp version, skill level, operating system, and more. Update and save your info on your profile page today!
🛣️ Road Profile Builder | Generate roads, curbs and pavements easily  Download 
[code] Cleanup After execute_script
- 
 This code cleans-up the cruft left behind when using execute_script. (reference thread) Chris' version: (http://forums.sketchucation.com/viewtopic.php?p=274499#p274499) function corePurge(){ coll = document.body.childNodes; for(a=0; a < coll.length; a += 1){ if (coll[a].tagName === "SCRIPT" && coll[a].id === ""){ document.body.removeChild(coll[a]); a -= 1; } } }My version: function purge_script_tags() { var b = document.body; var last_node = b.lastChild; while(last_node.nodeName === "SCRIPT") { b.removeChild(last_node); last_node = b.lastChild; } }
- 
 jQuery version: 
 $('body script').detach();
- 
 @jim said: ... My version: function purge_script_tags() { > var b = document.body; > var last_node = b.lastChild; > while(last_node.nodeName === "SCRIPT") { > b.removeChild(last_node); > last_node = b.lastChild; > } > }This would remove all last scripts including ones not by execute_script- UHMS
- 
 And in Chris' edition.. if a developer wanted to avoid being cleaned up, he need only set an id attribute on the script object. 
Advertisement



 
                             
                             
                             
                             
                             
                             
                            