summaryrefslogtreecommitdiff
path: root/program/js/tiny_mce/plugins/searchreplace/jscripts
diff options
context:
space:
mode:
authorsvncommit <devs@roundcube.net>2006-11-08 02:23:06 +0000
committersvncommit <devs@roundcube.net>2006-11-08 02:23:06 +0000
commitf0ea59bc8873461e060032f69d46032a97b68331 (patch)
tree638cca14ba4d6b052ae38d33426a19ceac4cb042 /program/js/tiny_mce/plugins/searchreplace/jscripts
parent5c52d06844779efbf4034663f5e68db10619b367 (diff)
upgrade to TinyMCE v2.0.8
Diffstat (limited to 'program/js/tiny_mce/plugins/searchreplace/jscripts')
-rw-r--r--program/js/tiny_mce/plugins/searchreplace/jscripts/replace.js40
-rw-r--r--program/js/tiny_mce/plugins/searchreplace/jscripts/search.js36
-rwxr-xr-xprogram/js/tiny_mce/plugins/searchreplace/jscripts/searchreplace.js85
3 files changed, 85 insertions, 76 deletions
diff --git a/program/js/tiny_mce/plugins/searchreplace/jscripts/replace.js b/program/js/tiny_mce/plugins/searchreplace/jscripts/replace.js
deleted file mode 100644
index 3cb417813..000000000
--- a/program/js/tiny_mce/plugins/searchreplace/jscripts/replace.js
+++ /dev/null
@@ -1,40 +0,0 @@
-function init() {
- tinyMCEPopup.resizeToInnerSize();
-
- var formObj = document.forms[0];
-
- formObj.searchstring.value = tinyMCE.getWindowArg("searchstring");
- formObj.replacestring.value = tinyMCE.getWindowArg("replacestring");
- formObj.casesensitivebox.checked = tinyMCE.getWindowArg("casesensitive");
-// formObj.backwards[0].checked = tinyMCE.getWindowArg("backwards");
-// formObj.backwards[1].checked = !tinyMCE.getWindowArg("backwards");
-// formObj.wrapatend.checked = tinyMCE.getWindowArg("wrap");
-// formObj.wholeword.checked = tinyMCE.getWindowArg("wholeword");
-
- tinyMCEPopup.execCommand("mceResetSearch", false, {dummy : ""}, false);
-}
-
-function searchNext(replacemode) {
- var formObj = document.forms[0];
-
- // Whats the point?
- if (formObj.searchstring.value == "" || formObj.searchstring.value == formObj.replacestring.value)
- return;
-
- // Do search
- tinyMCEPopup.execCommand('mceSearch', false, {
- string : formObj.searchstring.value,
- replacestring : formObj.replacestring.value,
- replacemode : replacemode,
- casesensitive : formObj.casesensitivebox.checked,
- backwards : false
-// wrap : formObj.wrapatend.checked,
-// wholeword : formObj.wholeword.checked
- }, false);
-
- window.focus();
-}
-
-function cancelAction() {
- tinyMCEPopup.close();
-}
diff --git a/program/js/tiny_mce/plugins/searchreplace/jscripts/search.js b/program/js/tiny_mce/plugins/searchreplace/jscripts/search.js
deleted file mode 100644
index 5202fdc50..000000000
--- a/program/js/tiny_mce/plugins/searchreplace/jscripts/search.js
+++ /dev/null
@@ -1,36 +0,0 @@
-function init() {
- tinyMCEPopup.resizeToInnerSize();
-
- var formObj = document.forms[0];
-
- formObj.searchstring.value = tinyMCE.getWindowArg("searchstring");
- formObj.casesensitivebox.checked = tinyMCE.getWindowArg("casesensitive");
- formObj.backwards[0].checked = tinyMCE.getWindowArg("backwards");
- formObj.backwards[1].checked = !tinyMCE.getWindowArg("backwards");
-// formObj.wrapatend.checked = tinyMCE.getWindowArg("wrap");
-// formObj.wholeword.checked = tinyMCE.getWindowArg("wholeword");
-
- tinyMCEPopup.execCommand("mceResetSearch", false, {dummy : ""}, false);
-}
-
-function searchNext() {
- var formObj = document.forms[0];
-
- if (formObj.searchstring.value == "")
- return;
-
- // Do search
- tinyMCEPopup.execCommand('mceSearch', false, {
- string : formObj.searchstring.value,
- casesensitive : formObj.casesensitivebox.checked,
- backwards : formObj.backwards[0].checked
-// wrap : formObj.wrapatend.checked,
-// wholeword : formObj.wholeword.checked
- }, false);
-
- window.focus();
-}
-
-function cancelAction() {
- tinyMCEPopup.close();
-}
diff --git a/program/js/tiny_mce/plugins/searchreplace/jscripts/searchreplace.js b/program/js/tiny_mce/plugins/searchreplace/jscripts/searchreplace.js
new file mode 100755
index 000000000..2eca3ea64
--- /dev/null
+++ b/program/js/tiny_mce/plugins/searchreplace/jscripts/searchreplace.js
@@ -0,0 +1,85 @@
+function init() {
+ tinyMCEPopup.resizeToInnerSize();
+
+ // start with appropiate tab
+ var task = (tinyMCE.getWindowArg("replacestring") != null) ? "replace" : "search";
+ mcTabs.displayTab(task + '_tab', task +'_panel');
+ manageReplaceButtons();
+
+ var formObj = document.forms[0];
+
+ formObj[task + "_panel_searchstring"].value = tinyMCE.getWindowArg("searchstring");
+ formObj["replace_panel_replacestring"].value = (tinyMCE.getWindowArg("replacestring") != null) ? tinyMCE.getWindowArg("replacestring") : "";
+ formObj[task + "_panel_casesensitivebox"].checked = tinyMCE.getWindowArg("casesensitive");
+ formObj[task + "_panel_backwardsu"].checked = tinyMCE.getWindowArg("backwards");
+ formObj[task + "_panel_backwardsd"].checked = !tinyMCE.getWindowArg("backwards");
+
+ tinyMCEPopup.execCommand("mceResetSearch", false, {dummy : ""}, false);
+}
+
+function searchNext(replacemode) {
+ // "search" or "replace" mode of operation?
+ var task = (document.getElementById("search_tab").className == "current") ? "search" : "replace";
+
+ var formObj = document.forms[0];
+
+ if (task == "replace") {
+ // Whats the point?
+ if (formObj[task + "_panel_searchstring"].value == "" || formObj[task + "_panel_searchstring"].value == formObj[task + "_panel_replacestring"].value)
+ return;
+ }
+
+ // Do search
+ tinyMCEPopup.execCommand('mceSearch', false, {
+ string : formObj[task + "_panel_searchstring"].value,
+ replacestring : formObj["replace_panel_replacestring"].value,
+ replacemode : replacemode,
+ casesensitive : formObj[task + "_panel_casesensitivebox"].checked,
+ backwards : false
+ }, false);
+
+ window.focus();
+}
+
+function cancelAction() {
+ tinyMCEPopup.close();
+}
+
+function manageReplaceButtons() {
+ // "search" or "replace" mode of operation?
+ var task = (document.getElementById("search_tab").className == "current") ? "search" : "replace";
+ document.getElementById("replace_buttons").style.visibility = (task == "replace") ? "visible" : "hidden";
+}
+
+function copyValues(link) {
+ // check if tab is already active
+ var tab = link;
+ while (tab.tagName && tab.tagName.toLowerCase() != "li") tab = tab.parentNode;
+ if (tab.className) return false; // tab is already active -> no need to copy any values!
+
+ // copy values from one panel to the other (if they exist there)
+ var from_panel_name = tab.id.match(/^search/i) ? "replace_panel" : "search_panel";
+ var to_panel_name = (from_panel_name == "search_panel") ? "replace_panel" : "search_panel";
+
+ // find all elements with IDs to copy their values
+ var elms = document.getElementById(from_panel_name).getElementsByTagName("*");
+ for (var i = 0; i < elms.length; i++) {
+ if (elms[i].id && elms[i].id != "") {
+ var checked = "undefined";
+ if (elms[i].type.toLowerCase() == "checkbox" || elms[i].type.toLowerCase() == "radio")
+ checked = elms[i].checked;
+
+ // copy values if element exists in other panel
+ var to_elm_name = to_panel_name + elms[i].id.substring(from_panel_name.length, elms[i].id.length);
+ var to_elm = document.getElementById(to_elm_name);
+ if (to_elm) {
+ if (checked != "undefined")
+ to_elm.checked = checked;
+ else
+ to_elm.value = elms[i].value;
+ }
+ }
+ }
+
+ return false;
+} \ No newline at end of file