stuppid_bot

Untitled

Jul 11th, 2013
216
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2.  
  3.     function applyFormat(format, value) {
  4.         if (range) {
  5.             var copy = range.cloneRange();
  6.             console.log(range);
  7.             restoreSelection(range);
  8.             document.execCommand(format, false, value);
  9.             range = copy;
  10.             console.log(range);
  11.         }
  12.     }
  13.  
  14.     gid('iconBold').addEventListener('click', function() {
  15.         applyFormat('bold');
  16.     });
  17.  
  18.     gid('iconItalic').addEventListener('click', function() {
  19.         applyFormat('italic');
  20.     });
  21.  
  22.     gid('iconUnderline').addEventListener('click', function() {
  23.         applyFormat('underline');
  24.     });
Advertisement
Add Comment
Please, Sign In to add comment