Hi, I have came up with a simple suggestion for this awesome project.
When using this project the textareas are only included after the pade loads. if this were to be added the user could call
CodePress.run();
whenever they wanted to include more dynamically generated textareas as CodePress editors.
CodePress.run = function() { s = document.getElementsByTagName('script'); for(var i=0,n=s.length;i<n;i++) { if(s[i].src.match('codepress.js')) { CodePress.path = s[i].src.replace('codepress.js',''); } } t = document.getElementsByTagName('textarea'); for(var i=0,n=t.length;i<n;i++) { if(t[i].className.match('codepress')) { id = t[i].id; if (id.slice(id.lastIndexOf('_'), id.length) != "_cp") { //add this t[i].id = id+'_cp'; eval(id+' = new CodePress(t[i])'); t[i].parentNode.insertBefore(eval(id), t[i]); } //and this } } }
Obviously all is does is check that the ids of the textares do not have a '_cp' at the end before making them CodePress editors.
Thanks for the cool project.
Great suggestion and thanks for your interest! I'll be sure to implement that whenever I find the time to get back to it!
Regards, Franchie.
Whoops, wrong forum. My bad, sorry…
Log in to post a comment.
Hi,
I have came up with a simple suggestion for this awesome project.
When using this project the textareas are only included after the pade loads.
if this were to be added the user could call
whenever they wanted to include more dynamically generated textareas as CodePress editors.
Obviously all is does is check that the ids of the textares do not have a '_cp' at the end before making them CodePress editors.
Thanks for the cool project.
Great suggestion and thanks for your interest!
I'll be sure to implement that whenever I find the time to get back to it!
Regards,
Franchie.
Whoops, wrong forum.
My bad, sorry…