From 70b7068325e8f10b61ddad9080a061aed8825527 Mon Sep 17 00:00:00 2001 From: Stefan Ritt Date: Tue, 5 Jul 2005 06:08:30 +0000 Subject: [PATCH] *** empty log message *** SVN revision: 1412 --- elcode.js | 83 ------------------------------------------------------- 1 file changed, 83 deletions(-) delete mode 100755 elcode.js diff --git a/elcode.js b/elcode.js deleted file mode 100755 index 24bacd6b..00000000 --- a/elcode.js +++ /dev/null @@ -1,83 +0,0 @@ -function getSelection(text) -{ - if (browser == 'MSIE') { - sel = document.selection; - rng = sel.createRange(); - rng.colapse; - return rng.text; - } else if (browser == 'Mozilla') - return text.value.substring(text.selectionStart, text.selectionEnd); - else - return ""; -} - -function replaceSelection(text, newSelection, cursorPos) -{ - if (browser == 'MSIE') { - text.focus(); - sel = document.selection; - rng = sel.createRange(); - rng.colapse; - is_sel = rng.text.length > 0; - rng.text = newSelection; - if (!is_sel) { - rng.moveStart('character', -(newSelection.length-cursorPos)); - rng.moveEnd('character', -(newSelection.length-cursorPos)); - rng.select(); - } - } else if (browser == 'Mozilla') { - start = text.selectionStart; - stop = text.selectionEnd; - end = text.textLength; - endtext = text.value.substring(stop, end); - starttext = text.value.substring(0, start); - text.value = starttext + newSelection + endtext; - if (start != stop) { - text.selectionStart = start; - text.selectionEnd = start + newSelection.length; - } else { - text.selectionStart = start + cursorPos; - text.selectionEnd = text.selectionStart; - } - } else - text += newSelection; -} - -function elcode(text, tag, value) -{ - elcode1(text, tag, value, ''); -} - -function elcode1(text, tag, value, selection) -{ - if (selection == '') - selection = getSelection(text); - - if (tag == '') - str = selection + value; - else if (tag == 'LIST') - str = '[LIST]\r\n[*] ' + selection + '\r\n[/LIST]'; - else if (value == '') - str = '['+tag+']' + selection + '[/'+tag+']'; - else - str = '['+tag+'='+value+']' + selection + '[/'+tag+']'; - - if (tag == '') - pos = value.length; - else if (tag == 'LIST') - pos = 11; - else if (value == '') - pos = tag.length + 2; - else - pos = tag.length + value.length + 3; - replaceSelection(text, str, pos); - text.focus(); -} - -function queryURL(text) -{ - selection = getSelection(text); - linkText = prompt(linkText_prompt, selection); - linkURL = prompt(linkURL_prompt, 'http://'); - elcode1(text, 'URL', linkURL, linkText); -}