Return to Snippet

Revision: 55494
at February 9, 2012 08:21 by porquero


Initial Code
_bt = document.createElement('button');
document.body.appendChild(_bt);
_bt.innerHTML='>Pretty Print!<';
_bt.style.top='100px';
_bt.style.position='absolute';
_bt.onclick=function(){
  var range = document.getElementById('postingComposeBox').contentDocument.getSelection().getRangeAt(0),
    content = range.extractContents(),
       pre = document.createElement('pre');

  pre.innerHTML = content.textContent;
  pre.className = 'prettyprint';
  var htmlContent = pre.innerHTML;

  range.insertNode(pre);
};

Initial URL
http://porquero.blogspot.com

Initial Description
Add easily pre.prettyprint element for you code in the editor for blogger.
Only ejecute this script when you manage your post.

Note: version alpha.

Initial Title
Add Pretty Print button for blogger editor

Initial Tags

                                

Initial Language
JavaScript