From: Erik Moeller Date: Sun, 18 Jan 2004 08:24:10 +0000 (+0000) Subject: JS for button generation X-Git-Tag: 1.3.0beta1~1139 X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/pie.php?a=commitdiff_plain;h=ab714b17347823bedb2bec14fe5d8604bef31e31;p=lhc%2Fweb%2Fwiklou.git JS for button generation --- diff --git a/stylesheets/wikibits.js b/stylesheets/wikibits.js index 70f070931b..678192cf46 100644 --- a/stylesheets/wikibits.js +++ b/stylesheets/wikibits.js @@ -74,6 +74,28 @@ function toggleToc() { } } +// this function generates the actual toolbar buttons with localized text +// we use it to avoid creating the toolbar where javascript is not enabled +function addButton(imageFile, speedTip, tagOpen, tagClose, sampleText) { + + speedTip=escapeQuotes(speedTip); + tagOpen=escapeQuotes(tagOpen); + tagClose=escapeQuotes(tagClose); + sampleText=escapeQuotes(sampleText); + document.write(""); + document.write("\""+speedTip+"\""); + document.write(""); + return; +} + +function escapeQuotes(text) { + + text=text.replace(/'/g,"\\'"); + text=text.replace(/\n/g,"\\n"); + return text; +} + // apply tagOpen/tagClose to selection in textarea, // use sampleText instead of selection if there is none // copied and adapted from phpBB