From ddf8a04fe3281e871c5311235b08185a5ceab797 Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Fri, 8 Jul 2011 12:20:02 +0200 Subject: moved some editor functions to a new dw_editor object There are probably more functions that should go in here --- lib/scripts/script.js | 80 --------------------------------------------------- 1 file changed, 80 deletions(-) (limited to 'lib/scripts/script.js') diff --git a/lib/scripts/script.js b/lib/scripts/script.js index 24473c2e6..a6951c4ce 100644 --- a/lib/scripts/script.js +++ b/lib/scripts/script.js @@ -331,86 +331,6 @@ addInitEvent(function(){ } }); -/** - * Add the edit window size controls - */ -function initSizeCtl(ctlid,edid){ - if(!document.getElementById){ return; } - - var ctl = $(ctlid); - var textarea = $(edid); - if(!ctl || !textarea) return; - - var hgt = DokuCookie.getValue('sizeCtl'); - if(hgt){ - textarea.style.height = hgt; - }else{ - textarea.style.height = '300px'; - } - - var wrp = DokuCookie.getValue('wrapCtl'); - if(wrp){ - setWrap(textarea, wrp); - } // else use default value - - var l = document.createElement('img'); - var s = document.createElement('img'); - var w = document.createElement('img'); - l.src = DOKU_BASE+'lib/images/larger.gif'; - s.src = DOKU_BASE+'lib/images/smaller.gif'; - w.src = DOKU_BASE+'lib/images/wrap.gif'; - addEvent(l,'click',function(){sizeCtl(edid,100);}); - addEvent(s,'click',function(){sizeCtl(edid,-100);}); - addEvent(w,'click',function(){toggleWrap(edid);}); - ctl.appendChild(l); - ctl.appendChild(s); - ctl.appendChild(w); -} - -/** - * This sets the vertical size of the editbox - */ -function sizeCtl(edid,val){ - var textarea = $(edid); - var height = parseInt(textarea.style.height.substr(0,textarea.style.height.length-2)); - height += val; - textarea.style.height = height+'px'; - - DokuCookie.setValue('sizeCtl',textarea.style.height); -} - -/** - * Toggle the wrapping mode of a textarea - */ -function toggleWrap(edid){ - var textarea = $(edid); - var wrap = textarea.getAttribute('wrap'); - if(wrap && wrap.toLowerCase() == 'off'){ - setWrap(textarea, 'soft'); - }else{ - setWrap(textarea, 'off'); - } - - DokuCookie.setValue('wrapCtl',textarea.getAttribute('wrap')); -} - -/** - * Set the wrapping mode of a textarea - * - * @author Fluffy Convict - * @author - * @link http://news.hping.org/comp.lang.javascript.archive/12265.html - * @link https://bugzilla.mozilla.org/show_bug.cgi?id=41464 - */ -function setWrap(textarea, wrapAttrValue){ - textarea.setAttribute('wrap', wrapAttrValue); - - // Fix display for mozilla - var parNod = textarea.parentNode; - var nxtSib = textarea.nextSibling; - parNod.removeChild(textarea); - parNod.insertBefore(textarea, nxtSib); -} /** * Handler to close all open Popups -- cgit v1.2.3