@@ -181,13 +182,22 @@ if ($action != 'editcomment') {
?>
+
+
click for Geo Info
- }
+}
?>
diff --git a/wp-admin/b2quicktags.js b/wp-admin/b2quicktags.js
index 8d1bf948d8..d811af92f8 100644
--- a/wp-admin/b2quicktags.js
+++ b/wp-admin/b2quicktags.js
@@ -1,190 +1,336 @@
-// b2 quick tags
-// - authorized adaptation of the 'bbCode control code' by subBlue design ( www.subBlue.com )
+// new edit toolbar used with permission
+// by Alex King
+// http://www.alexking.org/
-// Define the quick tags
-bbcode = new Array();
-bbtags = new Array('','','','','','','','','
','
','
','
','
','
','','','','');
-imageTag = false;
-
-// Replacement for arrayname.length property
-function getarraysize(thearray) {
- for (i = 0; i < thearray.length; i++) {
- if ((thearray[i] == "undefined") || (thearray[i] == "") || (thearray[i] == null))
- return i;
- }
- return thearray.length;
+function edButton() {
+ this.id = ''; // used to name the toolbar button
+ this.display = ''; // label on button
+ this.tagStart = ''; // open tag
+ this.tagEnd = ''; // close tag
+ this.open = 0; // set to -1 if tag does not need to be closed
}
-// Replacement for arrayname.push(value) not implemented in IE until version 5.5
-// Appends element to the array
-function arraypush(thearray,value) {
- thearray[ getarraysize(thearray) ] = value;
-}
+var edOpenTags = new Array();
-// Replacement for arrayname.pop() not implemented in IE until version 5.5
-// Removes and returns the last element of an array
-function arraypop(thearray) {
- thearraysize = getarraysize(thearray);
- retval = thearray[thearraysize - 1];
- delete thearray[thearraysize - 1];
- return retval;
-}
+function edAddTag(button) {
+ if (eval('ed' + button + '.tagEnd') != '') {
+ edOpenTags[edOpenTags.length] = button;
+ document.getElementById(eval('ed' + button + '.id')).value = '/' + document.getElementById(eval('ed' + button + '.id')).value;
-
-function checkForm(formObj) {
-
- formErrors = false;
-
- if (formObj.content.value.length < 2) {
- formErrors = "You must enter a message!";
- }
-
- if (formErrors) {
- alert(formErrors);
- return false;
- } else {
- bbstyle(formObj, -1);
- //formObj.preview.disabled = true;
- //formObj.submit.disabled = true;
- return true;
}
}
-
-function emoticon(theSmilie) {
- if ((parseInt(navigator.appVersion) >= 4) && (navigator.appName == "Microsoft Internet Explorer"))
- theSelection = document.selection.createRange().text; // Get text selection
-
- if (theSelection) {
- // Add tags around selection
- document.selection.createRange().text = theSelection + theSmilie + ' ';
- formObj.content.focus();
- theSelection = '';
- return;
- }
-
-
- document.post.content.value += ' ' + theSmilie + ' ';
- document.post.content.focus();
-}
-
-
-function bbfontstyle(formObj, bbopen, bbclose) {
- if ((parseInt(navigator.appVersion) >= 4) && (navigator.appName == "Microsoft Internet Explorer")) {
- theSelection = document.selection.createRange().text;
- if (!theSelection) {
- formObj.content.value += bbopen + bbclose;
- formObj.content.focus();
- return;
- }
- document.selection.createRange().text = bbopen + theSelection + bbclose;
- formObj.content.focus();
- return;
- } else {
- formObj.content.value += bbopen + bbclose;
- formObj.content.focus();
- return;
- }
-}
-
-
-function bbstyle(formObj, bbnumber) {
-
- donotinsert = false;
- theSelection = false;
- bblast = 0;
-
- if (bbnumber == -1) { // Close all open tags & default button names
- while (bbcode[0]) {
- butnumber = arraypop(bbcode) - 1;
- formObj.content.value += bbtags[butnumber + 1];
- buttext = eval('formObj.addbbcode' + butnumber + '.value');
- eval('formObj.addbbcode' + butnumber + '.value ="' + buttext.substr(0,(buttext.length - 1)) + '"');
- }
- formObj.content.focus();
- return;
- }
-
- if ((parseInt(navigator.appVersion) >= 4) && (navigator.appName == "Microsoft Internet Explorer"))
- theSelection = document.selection.createRange().text; // Get text selection
-
- if (theSelection) {
- // Add tags around selection
- document.selection.createRange().text = bbtags[bbnumber] + theSelection + bbtags[bbnumber+1];
- formObj.content.focus();
- theSelection = '';
- return;
- }
-
- // Find last occurance of an open tag the same as the one just clicked
- for (i = 0; i < bbcode.length; i++) {
- if (bbcode[i] == bbnumber+1) {
- bblast = i;
- donotinsert = true;
+function edRemoveTag(button) {
+ for (i = 0; i < edOpenTags.length; i++) {
+ if (edOpenTags[i] == button) {
+ edOpenTags.splice(i, 1);
+ document.getElementById(eval('ed' + button + '.id')).value = document.getElementById(eval('ed' + button + '.id')).value.replace('/', '');
}
}
+}
- if (donotinsert) { // Close all open tags up to the one just clicked & default button names
- while (bbcode[bblast]) {
- butnumber = arraypop(bbcode) - 1;
- formObj.content.value += bbtags[butnumber + 1];
- buttext = eval('formObj.addbbcode' + butnumber + '.value');
- eval('formObj.addbbcode' + butnumber + '.value ="' + buttext.substr(0,(buttext.length - 1)) + '"');
- imageTag = false;
+function edCheckOpenTags(button) {
+ var tag = 0;
+ for (i = 0; i < edOpenTags.length; i++) {
+ if (edOpenTags[i] == button) {
+ tag++;
+ }
+ }
+ if (tag > 0) {
+ return true; // tag found
+ }
+ else {
+ return false; // tag not found
+ }
+}
+
+function edCloseAllTags() {
+ var count = edOpenTags.length;
+ for (o = 0; o < count; o++) {
+ edInsertTag(edCanvas, edOpenTags[edOpenTags.length - 1]);
+ }
+}
+
+var ed0 = new edButton();
+ed0.id = 'ed_bold';
+ed0.display = 'B';
+ed0.tagStart = '';
+ed0.tagEnd = '';
+
+var ed1 = new edButton();
+ed1.id = 'ed_italic';
+ed1.display = 'I';
+ed1.tagStart = '';
+ed1.tagEnd = '';
+
+var ed2 = new edButton();
+ed2.id = 'ed_under';
+ed2.display = 'U';
+ed2.tagStart = '';
+ed2.tagEnd = '';
+
+var ed3 = new edButton();
+ed3.id = 'ed_strike';
+ed3.display = 'S';
+ed3.tagStart = '';
+ed3.tagEnd = '';
+
+var ed4 = new edButton();
+ed4.id = 'ed_quot';
+ed4.display = '"';
+ed4.tagStart = '"';
+ed4.tagEnd = '"';
+ed4.open = -1;
+
+var ed5 = new edButton();
+ed5.id = 'ed_amp';
+ed5.display = '&';
+ed5.tagStart = '&';
+ed5.tagEnd = '';
+ed5.open = -1;
+
+var ed6 = new edButton();
+ed6.id = 'ed_nbsp';
+ed6.display = 'nbsp';
+ed6.tagStart = ' ';
+ed6.tagEnd = '';
+ed6.open = -1;
+
+var ed7 = new edButton();
+ed7.id = 'ed_nobr';
+ed7.display = 'nobr';
+ed7.tagStart = '';
+ed7.tagEnd = '';
+
+var ed8 = new edButton();
+ed8.id = 'ed_link';
+ed8.display = 'link';
+ed8.tagStart = ''; // special case
+ed8.tagEnd = '';
+
+var ed9 = new edButton();
+ed9.id = 'ed_img';
+ed9.display = 'img';
+ed9.tagStart = ''; // special case
+ed9.tagEnd = '';
+ed9.open = -1;
+
+var ed10 = new edButton();
+ed10.id = 'ed_ul';
+ed10.display = 'UL';
+ed10.tagStart = '