alternate wysiwyg bbcode editor
9
library/bbedit/editor.css
Normal file
@ -0,0 +1,9 @@
|
||||
.editorWYSIWYG {font: 10pt Tahoma;border:none;}
|
||||
.editorBBCODE {font: 9pt "Courier New";}
|
||||
|
||||
div.richeditor div.editbar {margin-top:5px;background-image:url('images/editbar_bg.gif');border-left:1px solid silver;border-right:1px solid silver;border-top:1px solid silver;border-bottom:none;}
|
||||
div.richeditor div button{vertical-align:middle;width:25px;height:25px;border:1px solid transparent;background-color:Transparent;cursor:pointer;color:Black;background-position:center;background-repeat:no-repeat;background-image:none;}
|
||||
div.richeditor div button:hover{border:1px solid silver;}
|
||||
div.richeditor div.container {border-top:none;border-bottom:1px solid silver;border-left:1px solid silver;border-right:1px solid silver;}
|
||||
div.richeditor textarea{padding:0px 0px 0px 0px;border:none;}
|
||||
div.richeditor iframe{background-color:#ffffff;border:none;}
|
486
library/bbedit/editor.js
Normal file
@ -0,0 +1,486 @@
|
||||
/*
|
||||
WYSIWYG-BBCODE editor
|
||||
Copyright (c) 2009, Jitbit Sotware, http://www.jitbit.com/
|
||||
PROJECT HOME: http://wysiwygbbcode.codeplex.com/
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the <organization> nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY Jitbit Software ''AS IS'' AND ANY
|
||||
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL Jitbit Software BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
var myeditor, ifm;
|
||||
var body_id, textboxelement;
|
||||
var content;
|
||||
var isIE = /msie|MSIE/.test(navigator.userAgent);
|
||||
var isChrome = /Chrome/.test(navigator.userAgent);
|
||||
var isSafari = /Safari/.test(navigator.userAgent) && !isChrome;
|
||||
var browser = isIE || window.opera;
|
||||
var textRange;
|
||||
var enter = 0;
|
||||
var editorVisible = false;
|
||||
var enableWysiwyg = false;
|
||||
|
||||
function rep(re, str) {
|
||||
content = content.replace(re, str);
|
||||
}
|
||||
|
||||
function initEditor(textarea_id, wysiwyg) {
|
||||
if(wysiwyg!=undefined)
|
||||
enableWysiwyg = wysiwyg;
|
||||
else
|
||||
enableWysiwyg = true;
|
||||
body_id = textarea_id;
|
||||
textboxelement = document.getElementById(body_id);
|
||||
textboxelement.setAttribute('class', 'editorBBCODE');
|
||||
textboxelement.className = "editorBBCODE";
|
||||
if (enableWysiwyg) {
|
||||
ifm = document.createElement("iframe");
|
||||
ifm.setAttribute("id", "rte");
|
||||
ifm.setAttribute("frameborder", "0");
|
||||
ifm.style.width = textboxelement.style.width;
|
||||
ifm.style.height = textboxelement.style.height;
|
||||
textboxelement.parentNode.insertBefore(ifm, textboxelement);
|
||||
textboxelement.style.display = 'none';
|
||||
if (ifm) {
|
||||
ShowEditor();
|
||||
} else
|
||||
setTimeout('ShowEditor()', 100);
|
||||
}
|
||||
}
|
||||
|
||||
function getStyle(el,styleProp)
|
||||
{
|
||||
var x = document.getElementById(el);
|
||||
if (x.currentStyle)
|
||||
var y = x.currentStyle[styleProp];
|
||||
else if (window.getComputedStyle)
|
||||
var y = document.defaultView.getComputedStyle(x,null).getPropertyValue(styleProp);
|
||||
return y;
|
||||
}
|
||||
|
||||
function ShowEditor() {
|
||||
if (!enableWysiwyg) return;
|
||||
editorVisible = true;
|
||||
content = document.getElementById(body_id).value;
|
||||
myeditor = ifm.contentWindow.document;
|
||||
bbcode2html();
|
||||
myeditor.designMode = "on";
|
||||
myeditor.open();
|
||||
myeditor.write('<html><head><link href="editor.css" rel="Stylesheet" type="text/css" /></head>');
|
||||
myeditor.write('<body style="margin:0px 0px 0px 0px" class="editorWYSIWYG">');
|
||||
myeditor.write(content);
|
||||
myeditor.write('</body></html>');
|
||||
myeditor.close();
|
||||
if (myeditor.attachEvent) {
|
||||
if(parent.ProcessKeyPress)
|
||||
myeditor.attachEvent("onkeydown", parent.ProcessKeyPress);
|
||||
myeditor.attachEvent("onkeypress", kp);
|
||||
}
|
||||
else if (myeditor.addEventListener) {
|
||||
if (parent.ProcessKeyPress)
|
||||
myeditor.addEventListener("keydown", parent.ProcessKeyPress, true);
|
||||
myeditor.addEventListener("keypress",kp,true);
|
||||
}
|
||||
}
|
||||
|
||||
function SwitchEditor() {
|
||||
if (editorVisible) {
|
||||
doCheck();
|
||||
ifm.style.display = 'none';
|
||||
textboxelement.style.display = '';
|
||||
editorVisible = false;
|
||||
}
|
||||
else {
|
||||
if (enableWysiwyg && ifm) {
|
||||
ifm.style.display = '';
|
||||
textboxelement.style.display = 'none';
|
||||
ShowEditor();
|
||||
editorVisible = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function html2bbcode() {
|
||||
rep(/<img\s[^<>]*?src=\"?([^<>]*?)\"?(\s[^<>]*)?\/?>/gi,"[img]$1[/img]");
|
||||
rep(/<\/(strong|b)>/gi, "[/b]");
|
||||
rep(/<(strong|b)(\s[^<>]*)?>/gi,"[b]");
|
||||
rep(/<\/(em|i)>/gi,"[/i]");
|
||||
rep(/<(em|i)(\s[^<>]*)?>/gi,"[i]");
|
||||
rep(/<\/u>/gi, "[/u]");
|
||||
rep(/\n/gi, " ");
|
||||
rep(/\r/gi, " ");
|
||||
rep(/<u(\s[^<>]*)?>/gi, "[u]");
|
||||
rep(/<div><br(\s[^<>]*)?>/gi, "<div>");//chrome-safari fix to prevent double linefeeds
|
||||
rep(/<br(\s[^<>]*)?>/gi,"\n");
|
||||
rep(/<p(\s[^<>]*)?>/gi,"");
|
||||
rep(/<\/p>/gi, "\n");
|
||||
rep(/<ul>/gi, "[ul]");
|
||||
rep(/<\/ul>/gi, "[/ul]");
|
||||
rep(/<ol>/gi, "[ol]");
|
||||
rep(/<\/ol>/gi, "[/ol]");
|
||||
rep(/<li>/gi, "[li]");
|
||||
rep(/<\/li>/gi, "[/li]");
|
||||
rep(/<\/div>\s*<div([^<>]*)>/gi, "</span>\n<span$1>");//chrome-safari fix to prevent double linefeeds
|
||||
rep(/<div([^<>]*)>/gi,"\n<span$1>");
|
||||
rep(/<\/div>/gi,"</span>\n");
|
||||
rep(/ /gi," ");
|
||||
rep(/"/gi,"\"");
|
||||
rep(/&/gi,"&");
|
||||
var sc, sc2;
|
||||
do {
|
||||
sc = content;
|
||||
rep(/<font\s[^<>]*?color=\"?([^<>]*?)\"?(\s[^<>]*)?>([^<>]*?)<\/font>/gi,"[color=$1]$3[/color]");
|
||||
if(sc==content)
|
||||
rep(/<font[^<>]*>([^<>]*?)<\/font>/gi,"$1");
|
||||
rep(/<a\s[^<>]*?href=\"?([^<>]*?)\"?(\s[^<>]*)?>([^<>]*?)<\/a>/gi,"[url=$1]$3[/url]");
|
||||
sc2 = content;
|
||||
rep(/<(span|blockquote|pre)\s[^<>]*?style=\"?font-weight: ?bold;?\"?\s*([^<]*?)<\/\1>/gi,"[b]<$1 style=$2</$1>[/b]");
|
||||
rep(/<(span|blockquote|pre)\s[^<>]*?style=\"?font-weight: ?normal;?\"?\s*([^<]*?)<\/\1>/gi,"<$1 style=$2</$1>");
|
||||
rep(/<(span|blockquote|pre)\s[^<>]*?style=\"?font-style: ?italic;?\"?\s*([^<]*?)<\/\1>/gi,"[i]<$1 style=$2</$1>[/i]");
|
||||
rep(/<(span|blockquote|pre)\s[^<>]*?style=\"?font-style: ?normal;?\"?\s*([^<]*?)<\/\1>/gi,"<$1 style=$2</$1>");
|
||||
rep(/<(span|blockquote|pre)\s[^<>]*?style=\"?text-decoration: ?underline;?\"?\s*([^<]*?)<\/\1>/gi,"[u]<$1 style=$2</$1>[/u]");
|
||||
rep(/<(span|blockquote|pre)\s[^<>]*?style=\"?text-decoration: ?none;?\"?\s*([^<]*?)<\/\1>/gi,"<$1 style=$2</$1>");
|
||||
rep(/<(span|blockquote|pre)\s[^<>]*?style=\"?color: ?([^<>]*?);\"?\s*([^<]*?)<\/\1>/gi, "[color=$2]<$1 style=$3</$1>[/color]");
|
||||
rep(/<(span|blockquote|pre)\s[^<>]*?style=\"?font-family: ?([^<>]*?);\"?\s*([^<]*?)<\/\1>/gi, "[font=$2]<$1 style=$3</$1>[/font]");
|
||||
rep(/<(blockquote|pre)\s[^<>]*?style=\"?\"? (class=|id=)([^<>]*)>([^<>]*?)<\/\1>/gi, "<$1 $2$3>$4</$1>");
|
||||
rep(/<pre>([^<>]*?)<\/pre>/gi, "[code]$1[/code]");
|
||||
rep(/<span\s[^<>]*?style=\"?\"?>([^<>]*?)<\/span>/gi, "$1");
|
||||
if(sc2==content) {
|
||||
rep(/<span[^<>]*>([^<>]*?)<\/span>/gi, "$1");
|
||||
sc2 = content;
|
||||
}
|
||||
}while(sc!=content)
|
||||
rep(/<[^<>]*>/gi,"");
|
||||
rep(/</gi,"<");
|
||||
rep(/>/gi,">");
|
||||
|
||||
do {
|
||||
sc = content;
|
||||
rep(/\[(b|i|u)\]\[quote([^\]]*)\]([\s\S]*?)\[\/quote\]\[\/\1\]/gi, "[quote$2][$1]$3[/$1][/quote]");
|
||||
rep(/\[color=([^\]]*)\]\[quote([^\]]*)\]([\s\S]*?)\[\/quote\]\[\/color\]/gi, "[quote$2][color=$1]$3[/color][/quote]");
|
||||
rep(/\[(b|i|u)\]\[code\]([\s\S]*?)\[\/code\]\[\/\1\]/gi, "[code][$1]$2[/$1][/code]");
|
||||
rep(/\[color=([^\]]*)\]\[code\]([\s\S]*?)\[\/code\]\[\/color\]/gi, "[code][color=$1]$2[/color][/code]");
|
||||
}while(sc!=content)
|
||||
|
||||
//clean up empty tags
|
||||
do {
|
||||
sc = content;
|
||||
rep(/\[b\]\[\/b\]/gi, "");
|
||||
rep(/\[i\]\[\/i\]/gi, "");
|
||||
rep(/\[u\]\[\/u\]/gi, "");
|
||||
rep(/\[quote[^\]]*\]\[\/quote\]/gi, "");
|
||||
rep(/\[code\]\[\/code\]/gi, "");
|
||||
rep(/\[url=([^\]]+)\]\[\/url\]/gi, "");
|
||||
rep(/\[img\]\[\/img\]/gi, "");
|
||||
rep(/\[color=([^\]]*)\]\[\/color\]/gi, "");
|
||||
}while(sc!=content)
|
||||
}
|
||||
|
||||
function bbcode2html() {
|
||||
// example: [b] to <strong>
|
||||
rep(/\</gi,"<"); //removing html tags
|
||||
rep(/\>/gi,">");
|
||||
|
||||
rep(/\n/gi, "<br />");
|
||||
rep(/\[ul\]/gi, "<ul>");
|
||||
rep(/\[\/ul\]/gi, "</ul>");
|
||||
rep(/\[ol\]/gi, "<ol>");
|
||||
rep(/\[\/ol\]/gi, "</ol>");
|
||||
rep(/\[li\]/gi, "<li>");
|
||||
rep(/\[\/li\]/gi, "</li>");
|
||||
if(browser) {
|
||||
rep(/\[b\]/gi,"<strong>");
|
||||
rep(/\[\/b\]/gi,"</strong>");
|
||||
rep(/\[i\]/gi,"<em>");
|
||||
rep(/\[\/i\]/gi,"</em>");
|
||||
rep(/\[u\]/gi,"<u>");
|
||||
rep(/\[\/u\]/gi,"</u>");
|
||||
}else {
|
||||
rep(/\[b\]/gi,"<span style=\"font-weight: bold;\">");
|
||||
rep(/\[i\]/gi,"<span style=\"font-style: italic;\">");
|
||||
rep(/\[u\]/gi,"<span style=\"text-decoration: underline;\">");
|
||||
rep(/\[\/(b|i|u)\]/gi,"</span>");
|
||||
}
|
||||
rep(/\[img\]([^\"]*?)\[\/img\]/gi,"<img src=\"$1\" />");
|
||||
var sc;
|
||||
do {
|
||||
sc = content;
|
||||
rep(/\[url=([^\]]+)\]([\s\S]*?)\[\/url\]/gi,"<a href=\"$1\">$2</a>");
|
||||
rep(/\[url\]([\s\S]*?)\[\/url\]/gi,"<a href=\"$1\">$1</a>");
|
||||
if(browser) {
|
||||
rep(/\[color=([^\]]*?)\]([\s\S]*?)\[\/color\]/gi, "<font color=\"$1\">$2</font>");
|
||||
rep(/\[font=([^\]]*?)\]([\s\S]*?)\[\/font\]/gi, "<font face=\"$1\">$2</font>");
|
||||
} else {
|
||||
rep(/\[color=([^\]]*?)\]([\s\S]*?)\[\/color\]/gi, "<span style=\"color: $1;\">$2</span>");
|
||||
rep(/\[font=([^\]]*?)\]([\s\S]*?)\[\/font\]/gi, "<span style=\"font-family: $1;\">$2</span>");
|
||||
}
|
||||
rep(/\[code\]([\s\S]*?)\[\/code\]/gi,"<pre>$1</pre> ");
|
||||
}while(sc!=content);
|
||||
}
|
||||
|
||||
function doCheck() {
|
||||
if (!editorVisible) {
|
||||
ShowEditor();
|
||||
}
|
||||
content = myeditor.body.innerHTML;
|
||||
html2bbcode();
|
||||
document.getElementById(body_id).value = content;
|
||||
}
|
||||
|
||||
function stopEvent(evt){
|
||||
evt || window.event;
|
||||
if (evt.stopPropagation){
|
||||
evt.stopPropagation();
|
||||
evt.preventDefault();
|
||||
}else if(typeof evt.cancelBubble != "undefined"){
|
||||
evt.cancelBubble = true;
|
||||
evt.returnValue = false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function doQuote() {
|
||||
if (editorVisible) {
|
||||
ifm.contentWindow.focus();
|
||||
if (isIE) {
|
||||
textRange = ifm.contentWindow.document.selection.createRange();
|
||||
var newTxt = "[quote=]" + textRange.text + "[/quote]";
|
||||
textRange.text = newTxt;
|
||||
}
|
||||
else {
|
||||
var edittext = ifm.contentWindow.getSelection().getRangeAt(0);
|
||||
var original = edittext.toString();
|
||||
edittext.deleteContents();
|
||||
edittext.insertNode(document.createTextNode("[quote=]" + original + "[/quote]"));
|
||||
}
|
||||
}
|
||||
else {
|
||||
AddTag('[quote=]', '[/quote]');
|
||||
}
|
||||
}
|
||||
|
||||
function kp(e){
|
||||
if(isIE)
|
||||
var k = e.keyCode;
|
||||
else
|
||||
var k = e.which;
|
||||
if(k==13) {
|
||||
if(isIE) {
|
||||
var r = myeditor.selection.createRange();
|
||||
if (r.parentElement().tagName.toLowerCase() != "li") {
|
||||
r.pasteHTML('<br/>');
|
||||
if (r.move('character'))
|
||||
r.move('character', -1);
|
||||
r.select();
|
||||
stopEvent(e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}else
|
||||
enter = 0;
|
||||
}
|
||||
|
||||
function InsertSmile(txt) {
|
||||
InsertText(txt);
|
||||
document.getElementById('divSmilies').style.display = 'none';
|
||||
}
|
||||
function InsertYoutube() {
|
||||
InsertText("http://www.youtube.com/watch?v=XXXXXXXXXXX");
|
||||
}
|
||||
function InsertText(txt) {
|
||||
if (editorVisible)
|
||||
insertHtml(txt);
|
||||
else
|
||||
textboxelement.value += txt;
|
||||
}
|
||||
|
||||
function doClick(command) {
|
||||
if (editorVisible) {
|
||||
ifm.contentWindow.focus();
|
||||
myeditor.execCommand(command, false, null);
|
||||
}
|
||||
else {
|
||||
switch (command) {
|
||||
case 'bold':
|
||||
AddTag('[b]', '[/b]'); break;
|
||||
case 'italic':
|
||||
AddTag('[i]', '[/i]'); break;
|
||||
case 'underline':
|
||||
AddTag('[u]', '[/u]'); break;
|
||||
case 'InsertUnorderedList':
|
||||
AddTag('[ul][li]', '[/li][/ul]'); break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function doColor(color) {
|
||||
ifm.contentWindow.focus();
|
||||
if (isIE) {
|
||||
textRange = ifm.contentWindow.document.selection.createRange();
|
||||
textRange.select();
|
||||
}
|
||||
myeditor.execCommand('forecolor', false, color);
|
||||
}
|
||||
|
||||
function doLink() {
|
||||
if (editorVisible) {
|
||||
ifm.contentWindow.focus();
|
||||
var mylink = prompt("Enter a URL:", "http://");
|
||||
if ((mylink != null) && (mylink != "")) {
|
||||
if (isIE) { //IE
|
||||
var range = ifm.contentWindow.document.selection.createRange();
|
||||
if (range.text == '') {
|
||||
range.pasteHTML("<a href='" + mylink + "'>" + mylink + "</a>");
|
||||
}
|
||||
else
|
||||
myeditor.execCommand("CreateLink", false, mylink);
|
||||
}
|
||||
else if (window.getSelection) { //FF
|
||||
var userSelection = ifm.contentWindow.getSelection().getRangeAt(0);
|
||||
if(userSelection.toString().length==0)
|
||||
myeditor.execCommand('inserthtml', false, "<a href='" + mylink + "'>" + mylink + "</a>");
|
||||
else
|
||||
myeditor.execCommand("CreateLink", false, mylink);
|
||||
}
|
||||
else
|
||||
myeditor.execCommand("CreateLink", false, mylink);
|
||||
}
|
||||
}
|
||||
else {
|
||||
AddTag('[url=',']click here[/url]');
|
||||
}
|
||||
}
|
||||
function doImage() {
|
||||
if (editorVisible) {
|
||||
ifm.contentWindow.focus();
|
||||
myimg = prompt('Enter Image URL:', 'http://');
|
||||
if ((myimg != null) && (myimg != "")) {
|
||||
myeditor.execCommand('InsertImage', false, myimg);
|
||||
}
|
||||
}
|
||||
else {
|
||||
AddTag('[img]', '[/img]');
|
||||
}
|
||||
}
|
||||
|
||||
function insertHtml(html) {
|
||||
ifm.contentWindow.focus();
|
||||
if (isIE)
|
||||
ifm.contentWindow.document.selection.createRange().pasteHTML(html);
|
||||
else
|
||||
myeditor.execCommand('inserthtml', false, html);
|
||||
}
|
||||
|
||||
//textarea-mode functions
|
||||
function MozillaInsertText(element, text, pos) {
|
||||
element.value = element.value.slice(0, pos) + text + element.value.slice(pos);
|
||||
}
|
||||
|
||||
function AddTag(t1, t2) {
|
||||
var element = textboxelement;
|
||||
if (isIE) {
|
||||
if (document.selection) {
|
||||
element.focus();
|
||||
|
||||
var txt = element.value;
|
||||
var str = document.selection.createRange();
|
||||
|
||||
if (str.text == "") {
|
||||
str.text = t1 + t2;
|
||||
}
|
||||
else if (txt.indexOf(str.text) >= 0) {
|
||||
str.text = t1 + str.text + t2;
|
||||
}
|
||||
else {
|
||||
element.value = txt + t1 + t2;
|
||||
}
|
||||
str.select();
|
||||
}
|
||||
}
|
||||
else if (typeof(element.selectionStart) != 'undefined') {
|
||||
var sel_start = element.selectionStart;
|
||||
var sel_end = element.selectionEnd;
|
||||
MozillaInsertText(element, t1, sel_start);
|
||||
MozillaInsertText(element, t2, sel_end + t1.length);
|
||||
element.selectionStart = sel_start;
|
||||
element.selectionEnd = sel_end + t1.length + t2.length;
|
||||
element.focus();
|
||||
}
|
||||
else {
|
||||
element.value = element.value + t1 + t2;
|
||||
}
|
||||
}
|
||||
|
||||
//=======color picker
|
||||
function getScrollY() { var scrOfX = 0, scrOfY = 0; if (typeof (window.pageYOffset) == 'number') { scrOfY = window.pageYOffset; scrOfX = window.pageXOffset; } else if (document.body && (document.body.scrollLeft || document.body.scrollTop)) { scrOfY = document.body.scrollTop; scrOfX = document.body.scrollLeft; } else if (document.documentElement && (document.documentElement.scrollLeft || document.documentElement.scrollTop)) { scrOfY = document.documentElement.scrollTop; scrOfX = document.documentElement.scrollLeft; } return scrOfY; }
|
||||
|
||||
document.write("<style type='text/css'>.colorpicker201{visibility:hidden;display:none;position:absolute;background:#FFF;z-index:999;filter:progid:DXImageTransform.Microsoft.Shadow(color=#D0D0D0,direction=135);}.o5582brd{padding:0;width:12px;height:14px;border-bottom:solid 1px #DFDFDF;border-right:solid 1px #DFDFDF;}a.o5582n66,.o5582n66,.o5582n66a{font-family:arial,tahoma,sans-serif;text-decoration:underline;font-size:9px;color:#666;border:none;}.o5582n66,.o5582n66a{text-align:center;text-decoration:none;}a:hover.o5582n66{text-decoration:none;color:#FFA500;cursor:pointer;}.a01p3{padding:1px 4px 1px 2px;background:whitesmoke;border:solid 1px #DFDFDF;}</style>");
|
||||
|
||||
function getTop2() { csBrHt = 0; if (typeof (window.innerWidth) == 'number') { csBrHt = window.innerHeight; } else if (document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) { csBrHt = document.documentElement.clientHeight; } else if (document.body && (document.body.clientWidth || document.body.clientHeight)) { csBrHt = document.body.clientHeight; } ctop = ((csBrHt / 2) - 115) + getScrollY(); return ctop; }
|
||||
var nocol1 = "NO COLOR",
|
||||
clos1 = "X";
|
||||
|
||||
function getLeft2() { var csBrWt = 0; if (typeof (window.innerWidth) == 'number') { csBrWt = window.innerWidth; } else if (document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) { csBrWt = document.documentElement.clientWidth; } else if (document.body && (document.body.clientWidth || document.body.clientHeight)) { csBrWt = document.body.clientWidth; } cleft = (csBrWt / 2) - 125; return cleft; }
|
||||
|
||||
//function setCCbldID2(val, textBoxID) { document.getElementById(textBoxID).value = val; }
|
||||
function setCCbldID2(val) { if (editorVisible) doColor(val); else AddTag('[color=' + val + ']', '[/color]'); }
|
||||
|
||||
function setCCbldSty2(objID, prop, val) {
|
||||
switch (prop) {
|
||||
case "bc": if (objID != 'none') { document.getElementById(objID).style.backgroundColor = val; }; break;
|
||||
case "vs": document.getElementById(objID).style.visibility = val; break;
|
||||
case "ds": document.getElementById(objID).style.display = val; break;
|
||||
case "tp": document.getElementById(objID).style.top = val; break;
|
||||
case "lf": document.getElementById(objID).style.left = val; break;
|
||||
}
|
||||
}
|
||||
|
||||
function putOBJxColor2(Samp, pigMent, textBoxId) { if (pigMent != 'x') { setCCbldID2(pigMent, textBoxId); setCCbldSty2(Samp, 'bc', pigMent); } setCCbldSty2('colorpicker201', 'vs', 'hidden'); setCCbldSty2('colorpicker201', 'ds', 'none'); }
|
||||
|
||||
function showColorGrid2(Sam, textBoxId) {
|
||||
var objX = new Array('00', '33', '66', '99', 'CC', 'FF');
|
||||
var c = 0;
|
||||
var xl = '"' + Sam + '","x", "' + textBoxId + '"'; var mid = '';
|
||||
mid += '<table bgcolor="#FFFFFF" border="0" cellpadding="0" cellspacing="0" style="border:solid 0px #F0F0F0;padding:2px;"><tr>';
|
||||
mid += "<td colspan='9' align='left' style='margin:0;padding:2px;height:12px;' ><input class='o5582n66' type='text' size='12' id='o5582n66' value='#FFFFFF'><input class='o5582n66a' type='text' size='2' style='width:14px;' id='o5582n66a' onclick='javascript:alert(\"click on selected swatch below...\");' value='' style='border:solid 1px #666;'></td><td colspan='9' align='right'><a class='o5582n66' href='javascript:onclick=putOBJxColor2(" + xl + ")'><span class='a01p3'>" + clos1 + "</span></a></td></tr><tr>";
|
||||
var br = 1;
|
||||
for (o = 0; o < 6; o++) {
|
||||
mid += '</tr><tr>';
|
||||
for (y = 0; y < 6; y++) {
|
||||
if (y == 3) { mid += '</tr><tr>'; }
|
||||
for (x = 0; x < 6; x++) {
|
||||
var grid = '';
|
||||
grid = objX[o] + objX[y] + objX[x];
|
||||
var b = "'" + Sam + "','" + grid + "', '" + textBoxId + "'";
|
||||
mid += '<td class="o5582brd" style="background-color:#' + grid + '"><a class="o5582n66" href="javascript:onclick=putOBJxColor2(' + b + ');" onmouseover=javascript:document.getElementById("o5582n66").value="#' + grid + '";javascript:document.getElementById("o5582n66a").style.backgroundColor="#' + grid + '"; title="#' + grid + '"><div style="width:12px;height:14px;"></div></a></td>';
|
||||
c++;
|
||||
}
|
||||
}
|
||||
}
|
||||
mid += "</tr></table>";
|
||||
//var ttop=getTop2();
|
||||
//setCCbldSty2('colorpicker201','tp',ttop);
|
||||
//document.getElementById('colorpicker201').style.left=getLeft2();
|
||||
document.getElementById('colorpicker201').innerHTML = mid;
|
||||
setCCbldSty2('colorpicker201', 'vs', 'visible');
|
||||
setCCbldSty2('colorpicker201', 'ds', 'inline');
|
||||
}
|
53
library/bbedit/images/.svn/all-wcprops
Normal file
@ -0,0 +1,53 @@
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 26
|
||||
/svn/!svn/ver/43795/images
|
||||
END
|
||||
icon_html.gif
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 40
|
||||
/svn/!svn/ver/43795/images/icon_html.gif
|
||||
END
|
||||
img.gif
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 34
|
||||
/svn/!svn/ver/43795/images/img.gif
|
||||
END
|
||||
colors.gif
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 37
|
||||
/svn/!svn/ver/43795/images/colors.gif
|
||||
END
|
||||
editbar_bg.gif
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 41
|
||||
/svn/!svn/ver/43795/images/editbar_bg.gif
|
||||
END
|
||||
url.gif
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 34
|
||||
/svn/!svn/ver/43795/images/url.gif
|
||||
END
|
||||
icon_list.gif
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 40
|
||||
/svn/!svn/ver/43795/images/icon_list.gif
|
||||
END
|
||||
icon_quote.png
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 41
|
||||
/svn/!svn/ver/43795/images/icon_quote.png
|
||||
END
|
||||
icon_youtube.gif
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 43
|
||||
/svn/!svn/ver/43795/images/icon_youtube.gif
|
||||
END
|
300
library/bbedit/images/.svn/entries
Normal file
@ -0,0 +1,300 @@
|
||||
10
|
||||
|
||||
dir
|
||||
43979
|
||||
https://wysiwygbbcode.svn.codeplex.com/svn/images
|
||||
https://wysiwygbbcode.svn.codeplex.com/svn
|
||||
|
||||
|
||||
|
||||
2010-04-07T14:06:43.507000Z
|
||||
43795
|
||||
unknown
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
1e68c9db-d3bb-46d7-945c-fd054d4afafc
|
||||
|
||||
icon_html.gif
|
||||
file
|
||||
|
||||
|
||||
|
||||
|
||||
2010-04-07T14:11:18.000000Z
|
||||
67fe598a2ce41218bbe984ecb9ef5120
|
||||
2010-04-07T14:06:43.507000Z
|
||||
43795
|
||||
unknown
|
||||
has-props
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
178
|
||||
|
||||
img.gif
|
||||
file
|
||||
|
||||
|
||||
|
||||
|
||||
2010-04-07T14:11:18.000000Z
|
||||
9f86ef7d2cb43dc9211bc4527a4caa4a
|
||||
2010-04-07T14:06:43.507000Z
|
||||
43795
|
||||
unknown
|
||||
has-props
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
570
|
||||
|
||||
colors.gif
|
||||
file
|
||||
|
||||
|
||||
|
||||
|
||||
2010-04-07T14:11:18.000000Z
|
||||
2b1af4a86dc3c0c38066fed59a6b9284
|
||||
2010-04-07T14:06:43.507000Z
|
||||
43795
|
||||
unknown
|
||||
has-props
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
1024
|
||||
|
||||
editbar_bg.gif
|
||||
file
|
||||
|
||||
|
||||
|
||||
|
||||
2010-04-07T14:11:18.000000Z
|
||||
ab683894bf1f523a2c9e3888b88ff6fe
|
||||
2010-04-07T14:06:43.507000Z
|
||||
43795
|
||||
unknown
|
||||
has-props
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
301
|
||||
|
||||
url.gif
|
||||
file
|
||||
|
||||
|
||||
|
||||
|
||||
2010-04-07T14:11:18.000000Z
|
||||
80486c8b54c622eff5fbde9cbe941c36
|
||||
2010-04-07T14:06:43.507000Z
|
||||
43795
|
||||
unknown
|
||||
has-props
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
209
|
||||
|
||||
icon_list.gif
|
||||
file
|
||||
|
||||
|
||||
|
||||
|
||||
2010-04-07T14:11:18.000000Z
|
||||
33b13631551a0890584ccc2f9d9187d2
|
||||
2010-04-07T14:06:43.507000Z
|
||||
43795
|
||||
unknown
|
||||
has-props
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
82
|
||||
|
||||
icon_quote.png
|
||||
file
|
||||
|
||||
|
||||
|
||||
|
||||
2010-04-07T14:11:18.000000Z
|
||||
c1980342644a5392efefbb315b12b246
|
||||
2010-04-07T14:06:43.507000Z
|
||||
43795
|
||||
unknown
|
||||
has-props
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
1239
|
||||
|
||||
icon_youtube.gif
|
||||
file
|
||||
|
||||
|
||||
|
||||
|
||||
2010-04-07T14:11:18.000000Z
|
||||
406fca567bc8bd5655ae0d2cbb6c061c
|
||||
2010-04-07T14:06:43.507000Z
|
||||
43795
|
||||
unknown
|
||||
has-props
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
613
|
||||
|
5
library/bbedit/images/.svn/prop-base/colors.gif.svn-base
Normal file
@ -0,0 +1,5 @@
|
||||
K 13
|
||||
svn:mime-type
|
||||
V 24
|
||||
application/octet-stream
|
||||
END
|
@ -0,0 +1,5 @@
|
||||
K 13
|
||||
svn:mime-type
|
||||
V 24
|
||||
application/octet-stream
|
||||
END
|
@ -0,0 +1,5 @@
|
||||
K 13
|
||||
svn:mime-type
|
||||
V 24
|
||||
application/octet-stream
|
||||
END
|
@ -0,0 +1,5 @@
|
||||
K 13
|
||||
svn:mime-type
|
||||
V 24
|
||||
application/octet-stream
|
||||
END
|
@ -0,0 +1,5 @@
|
||||
K 13
|
||||
svn:mime-type
|
||||
V 24
|
||||
application/octet-stream
|
||||
END
|
@ -0,0 +1,5 @@
|
||||
K 13
|
||||
svn:mime-type
|
||||
V 24
|
||||
application/octet-stream
|
||||
END
|
5
library/bbedit/images/.svn/prop-base/img.gif.svn-base
Normal file
@ -0,0 +1,5 @@
|
||||
K 13
|
||||
svn:mime-type
|
||||
V 24
|
||||
application/octet-stream
|
||||
END
|
5
library/bbedit/images/.svn/prop-base/url.gif.svn-base
Normal file
@ -0,0 +1,5 @@
|
||||
K 13
|
||||
svn:mime-type
|
||||
V 24
|
||||
application/octet-stream
|
||||
END
|
BIN
library/bbedit/images/.svn/text-base/colors.gif.svn-base
Normal file
After Width: | Height: | Size: 1.0 KiB |
BIN
library/bbedit/images/.svn/text-base/editbar_bg.gif.svn-base
Normal file
After Width: | Height: | Size: 301 B |
BIN
library/bbedit/images/.svn/text-base/icon_html.gif.svn-base
Normal file
After Width: | Height: | Size: 178 B |
BIN
library/bbedit/images/.svn/text-base/icon_list.gif.svn-base
Normal file
After Width: | Height: | Size: 82 B |
BIN
library/bbedit/images/.svn/text-base/icon_quote.png.svn-base
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
library/bbedit/images/.svn/text-base/icon_youtube.gif.svn-base
Normal file
After Width: | Height: | Size: 613 B |
BIN
library/bbedit/images/.svn/text-base/img.gif.svn-base
Normal file
After Width: | Height: | Size: 570 B |
BIN
library/bbedit/images/.svn/text-base/url.gif.svn-base
Normal file
After Width: | Height: | Size: 209 B |
BIN
library/bbedit/images/colors.gif
Normal file
After Width: | Height: | Size: 1.0 KiB |
BIN
library/bbedit/images/editbar_bg.gif
Normal file
After Width: | Height: | Size: 301 B |
BIN
library/bbedit/images/icon_html.gif
Normal file
After Width: | Height: | Size: 178 B |
BIN
library/bbedit/images/icon_list.gif
Normal file
After Width: | Height: | Size: 82 B |
BIN
library/bbedit/images/icon_quote.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
library/bbedit/images/icon_youtube.gif
Normal file
After Width: | Height: | Size: 613 B |
BIN
library/bbedit/images/img.gif
Normal file
After Width: | Height: | Size: 570 B |
BIN
library/bbedit/images/url.gif
Normal file
After Width: | Height: | Size: 209 B |
28
library/bbedit/readme.txt
Normal file
@ -0,0 +1,28 @@
|
||||
/*
|
||||
WYSIWYG-BBCODE v1.6
|
||||
WYSIWYG-BBCODE editor
|
||||
Copyright (c) 2009, Jitbit Sotware, http://www.jitbit.com/
|
||||
PROJECT HOME: http://wysiwygbbcode.codeplex.com/
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the <organization> nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY Jitbit Software ''AS IS'' AND ANY
|
||||
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL Jitbit Software BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
37
library/bbedit/sample.htm
Normal file
@ -0,0 +1,37 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head runat="server">
|
||||
<link href="editor.css" rel="Stylesheet" type="text/css" />
|
||||
<script src="editor.js" type="text/javascript"></script>
|
||||
</head>
|
||||
<body>
|
||||
<form onsubmit="doCheck();"> <!--THIS IS IMPORTANT-->
|
||||
|
||||
|
||||
<div class="richeditor">
|
||||
<div class="editbar">
|
||||
<button title="bold" onclick="doClick('bold');" type="button"><b>B</b></button>
|
||||
<button title="italic" onclick="doClick('italic');" type="button"><i>I</i></button>
|
||||
<button title="underline" onclick="doClick('underline');" type="button"><u>U</u></button>
|
||||
<button title="hyperlink" onclick="doLink();" type="button" style="background-image:url('images/url.gif');"></button>
|
||||
<button title="image" onclick="doImage();" type="button" style="background-image:url('images/img.gif');"></button>
|
||||
<button title="list" onclick="doClick('InsertUnorderedList');" type="button" style="background-image:url('images/icon_list.gif');"></button>
|
||||
<button title="color" onclick="showColorGrid2('none')" type="button" style="background-image:url('images/colors.gif');"></button><span id="colorpicker201" class="colorpicker201"></span>
|
||||
<button title="quote" onclick="doQuote();" type="button" style="background-image:url('images/icon_quote.png');"></button>
|
||||
<button title="youtube" onclick="InsertYoutube();" type="button" style="background-image:url('images/icon_youtube.gif');"></button>
|
||||
<button title="switch to source" type="button" onclick="javascript:SwitchEditor()" style="background-image:url('images/icon_html.gif');"></button>
|
||||
</div>
|
||||
<div class="container">
|
||||
<textarea id="tbMsg" style="height:150px;width:100%;"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
initEditor("tbMsg", true);
|
||||
</script>
|
||||
<input type="submit" onclick="doCheck();" />
|
||||
|
||||
|
||||
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
@ -1 +1 @@
|
||||
2012-12-09.164
|
||||
2012-12-10.165
|
||||
|