From ab714b17347823bedb2bec14fe5d8604bef31e31 Mon Sep 17 00:00:00 2001 From: Erik Moeller Date: Sun, 18 Jan 2004 08:24:10 +0000 Subject: [PATCH] JS for button generation --- stylesheets/wikibits.js | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) 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 -- 2.20.1