Changeset 56

Show
Ignore:
Timestamp:
07/03/07 12:59:07 (3 years ago)
Author:
OlivierBorowski
Message:

- change the variables prefix from "_" to "we_"

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • wikkaedit/trunk/wikkaedit.js

    r51 r56  
    66//                                                                    // 
    77// Copyright (C) 2007 Olivier Borowski (coin at tuxfamily dot org)    // 
    8 //   based on WikiEdit (http://wackowiki.com/WikiEdit)                // 
     8// Homepage : http://wikkawiki.org/WikkaEdit                          // 
    99//                                                                    // 
    1010// This program is free software; you can redistribute it and/or      // 
     
    2424//                                                                    // 
    2525//////////////////////////////////////////////////////////////////////// 
    26 known bugs : 
    27 - key event cancellation doesn't work on opera 
    28 - shift+tab doesn't work on konqueror 
    2926*/ 
    3027 
     
    3633 
    3734        // init data 
    38         this._actionsMenuEnabled = (typeof(this.contextualHelp) != "undefined"); 
    39         this._searchReplaceEnabled = (typeof(this.showSearchWindow) != "undefined"); 
     35        this.we_actionsMenuEnabled = (typeof(this.contextualHelp) != "undefined"); 
     36        this.we_searchReplaceEnabled = (typeof(this.showSearchWindow) != "undefined"); 
    4037        this.initButtons(); 
    4138        this.initCategs(); 
    42         if (this._actionsMenuEnabled) 
     39        if (this.we_actionsMenuEnabled) 
    4340                this.initActions(); 
    4441 
    4542        // add a toolbar before textarea 
    46         this._toolbar = document.createElement("div"); 
    47         this._toolbar.id = "wikkatoolbar"; 
    48         this._toolbar.innerHTML = this.genToolbar(); 
    49         this._ta.parentNode.insertBefore(this._toolbar, this._ta); 
     43        this.we_toolbar = document.createElement("div"); 
     44        this.we_toolbar.id = "wikkatoolbar"; 
     45        this.we_toolbar.innerHTML = this.genToolbar(); 
     46        this.we_ta.parentNode.insertBefore(this.we_toolbar, this.we_ta); 
    5047 
    5148        // submenu 
    52         this._submenu = document.createElement("div"); 
    53         this._submenu.id = "wikkasubmenu"; 
    54         this._submenu.style.visibility = "hidden"; 
    55         this._ta.parentNode.insertBefore(this._submenu, this._ta); //this._help.nextSibling); 
     49        this.we_submenu = document.createElement("div"); 
     50        this.we_submenu.id = "wikkasubmenu"; 
     51        this.we_submenu.style.visibility = "hidden"; 
     52        this.we_ta.parentNode.insertBefore(this.we_submenu, this.we_ta); //this.we_help.nextSibling); 
    5653 
    5754        // search & replace 
    58         if (this._searchReplaceEnabled) { 
     55        if (this.we_searchReplaceEnabled) { 
    5956                // search & replace window 
    60                 this._search = document.createElement("div"); 
    61                 this._search.id = "wikkasearch"; 
    62                 this._search.style.visibility = "hidden" 
    63                 this._search.style.width = "500px"; // width & height can't be moved to the CSS, else JS can't read these values later 
    64                 this._search.style.height = "180px"; 
    65                 this._ta.parentNode.insertBefore(this._search, this._ta.nextSibling); 
    66  
    67                 // dummy textarea, used to scroll this._ta to the right position 
     57                this.we_search = document.createElement("div"); 
     58                this.we_search.id = "wikkasearch"; 
     59                this.we_search.style.visibility = "hidden" 
     60                this.we_search.style.width = "500px"; // width & height can't be moved to the CSS, else JS can't read these values later 
     61                this.we_search.style.height = "180px"; 
     62                this.we_ta.parentNode.insertBefore(this.we_search, this.we_ta.nextSibling); 
     63 
     64                // dummy textarea, used to scroll this.we_ta to the right position 
    6865                // it is hidden, but it needs to be inserted to the page to work 
    69                 this._searchTa = document.createElement("textarea"); 
    70                 this._searchTa.style.position = "absolute"; 
    71                 this._searchTa.style.left = 0; 
    72                 this._searchTa.style.top = 0; 
    73                 this._searchTa.style.visibility = "hidden"; 
    74                 this._searchTa.style.scroll = "auto"; 
    75                 this._ta.parentNode.insertBefore(this._searchTa, this._ta.nextSibling); 
     66                this.we_searchTa = document.createElement("textarea"); 
     67                this.we_searchTa.style.position = "absolute"; 
     68                this.we_searchTa.style.left = 0; 
     69                this.we_searchTa.style.top = 0; 
     70                this.we_searchTa.style.visibility = "hidden"; 
     71                this.we_searchTa.style.scroll = "auto"; 
     72                this.we_ta.parentNode.insertBefore(this.we_searchTa, this.we_ta.nextSibling); 
    7673        } 
    7774 
    7875        // actions 
    79         if (this._actionsMenuEnabled) { 
     76        if (this.we_actionsMenuEnabled) { 
    8077                // help 
    81                 this._helpPreviousContent = " "; 
    82                 this._help = document.createElement("div"); 
    83                 this._help.id = "wikkahelp"; 
    84                 this._help.innerHTML = this._helpPreviousContent;     // contains at least a character to keep constant height 
    85                 this._help.style.display = (this._actionsMenuEnabled ? "" : "none"); 
    86                 this._ta.parentNode.insertBefore(this._help, this._ta.nextSibling.nextSibling);       // next*2 to skip following <br/> 
     78                this.we_helpPreviousContent = "&nbsp;"; 
     79                this.we_help = document.createElement("div"); 
     80                this.we_help.id = "wikkahelp"; 
     81                this.we_help.innerHTML = this.we_helpPreviousContent; // contains at least a character to keep constant height 
     82                this.we_help.style.display = (this.we_actionsMenuEnabled ? "" : "none"); 
     83                this.we_ta.parentNode.insertBefore(this.we_help, this.we_ta.nextSibling.nextSibling); // next*2 to skip following <br/> 
    8784                // tooltip 
    88                 this._tooltip = document.createElement("div"); 
    89                 this._tooltip.id = "wikkatooltip"; 
    90                 this._tooltip.style.visibility = "hidden" 
    91                 this._ta.parentNode.insertBefore(this._tooltip, this._help.nextSibling); 
     85                this.we_tooltip = document.createElement("div"); 
     86                this.we_tooltip.id = "wikkatooltip"; 
     87                this.we_tooltip.style.visibility = "hidden" 
     88                this.we_ta.parentNode.insertBefore(this.we_tooltip, this.we_help.nextSibling); 
    9289        } 
    9390 
    9491        // log (debug) 
    95         this._log = document.createElement("div"); 
    96         this._log.id = "wikkalog"; 
    97         this._log.innerHTML = "log<br/>"; 
    98         this._log.style.display = "none"; 
    99         this._ta.parentNode.insertBefore(this._log, this._ta.nextSibling); 
    100         //this._ta.parentNode.insertBefore(this._log, this._help.nextSibling); 
     92        this.we_log = document.createElement("div"); 
     93        this.we_log.id = "wikkalog"; 
     94        this.we_log.innerHTML = "log<br/>"; 
     95        this.we_log.style.display = "none"; 
     96        this.we_ta.parentNode.insertBefore(this.we_log, this.we_ta.nextSibling); 
     97        //this.we_ta.parentNode.insertBefore(this.we_log, this.we_help.nextSibling); 
    10198 
    10299        // make sure nothing is selectionned in the textarea 
    103100        this.setSelectionRange(0, 0); 
    104101        // intercept special keys (tab...) 
    105         this._ta.onkeydown = this.keyDown; 
    106         //this._ta.onkeyup = this.keyUp; 
    107         this._ta.onmousedown = this.mouseDown; 
     102        this.we_ta.onkeydown = this.keyDown; 
     103        //this.we_ta.onkeyup = this.keyUp; 
     104        this.we_ta.onmousedown = this.mouseDown; 
    108105        // focus on the textarea 
    109         this._ta.focus(); 
     106        this.we_ta.focus(); 
    110107 
    111108        // editor height follow browser window height 
    112109        setInterval("varWikkaEdit.moveElementsAfterWindowResize();", this.EDITOR_HEIGHT_POLL_INTERV); 
    113110        // help for the command under the carret 
    114         if (this._actionsMenuEnabled) 
     111        if (this.we_actionsMenuEnabled) 
    115112                setInterval("varWikkaEdit.contextualHelp();", this.CONTEXTUAL_HELP_POLL_INTERV); 
    116113} 
     
    120117        var ok = false; 
    121118        try { 
    122                 var w3 = (this._ta.selectionStart != null); 
     119                var w3 = (this.we_ta.selectionStart != null); 
    123120                var ie6 = (document.selection && document.selection.createRange); 
    124121                if (w3 || ie6) 
     
    134131        try { 
    135132                // make editor height follow browser window height 
    136                 if (this._ta.style.height == "") this._ta.style.height = "500px"; // this._ta.style.height is "" the 1st time 
     133                if (this.we_ta.style.height == "") this.we_ta.style.height = "500px"; // this.we_ta.style.height is "" the 1st time 
    137134                var windowHeight = parseInt(window.innerHeight ? window.innerHeight : document.documentElement.clientHeight, 10); 
    138135                var change = windowHeight - parseInt(document.body.offsetHeight, 10); 
    139136                if (change != 0) { 
    140                         var newheight = Math.max(this.EDITOR_MIN_HEIGHT, parseInt(this._ta.style.height, 10) + change); 
    141                         this._ta.style.height = newheight + "px"; 
     137                        var newheight = Math.max(this.EDITOR_MIN_HEIGHT, parseInt(this.we_ta.style.height, 10) + change); 
     138                        this.we_ta.style.height = newheight + "px"; 
    142139                } 
    143140 
    144141                // keep search & replace window on the bottom of the window 
    145                 if (this._searchReplaceEnabled) { 
     142                if (this.we_searchReplaceEnabled) { 
    146143                        var windowWidth = parseInt(window.innerWidth ? window.innerWidth : document.documentElement.clientWidth, 10); 
    147                         this._search.style.left = (windowWidth / 2 - parseInt(this._search.style.width,10) / 2) + "px"; 
    148                         this._search.style.top = (windowHeight - parseInt(this._search.style.height,10) - 1) + "px"; 
     144                        this.we_search.style.left = (windowWidth / 2 - parseInt(this.we_search.style.width,10) / 2) + "px"; 
     145                        this.we_search.style.top = (windowHeight - parseInt(this.we_search.style.height,10) - 1) + "px"; 
    149146                } 
    150147        } catch(e) { 
     
    159156        // ========== main buttons ========== 
    160157        var html = ""; 
    161         for(var i in this._buttons) { 
    162                 switch (this._buttons[i].type) { 
     158        for(var i in this.we_buttons) { 
     159                switch (this.we_buttons[i].type) { 
    163160                        case "button" :         // button 
    164                                 html += "<img class=\"toolbutton\" src=\"3rdparty/plugins/wikkaedit/images/" + i.substr(1) + ".gif\" alt=\"" + i.substr(1) + "\" title=\"" + this._buttons[i].title + "\" onclick=\"varWikkaEdit.toolbarButtonClick(this, '" + i.substr(1) + "');\"" + ie6_hover + " />"; 
     161                                html += "<img class=\"toolbutton\" src=\"3rdparty/plugins/wikkaedit/images/" + this.refToName(i) + ".gif\" alt=\"" + this.refToName(i) + "\" title=\"" + this.we_buttons[i].title + "\" onclick=\"varWikkaEdit.toolbarButtonClick(this, '" + this.refToName(i) + "');\"" + ie6_hover + " />"; 
    165162                                break; 
    166163                        case "submenu" :        // submenu 
    167                                 html += "<img class=\"toolbutton\" src=\"3rdparty/plugins/wikkaedit/images/submenu.gif\" alt=\"submenu\" title=\"" + this._buttons[i].title + "\" onclick=\"varWikkaEdit.toolbarButtonClick(this, '" + i.substr(1) + "');\"" + ie6_hover + " />"; 
     164                                html += "<img class=\"toolbutton\" src=\"3rdparty/plugins/wikkaedit/images/submenu.gif\" alt=\"submenu\" title=\"" + this.we_buttons[i].title + "\" onclick=\"varWikkaEdit.toolbarButtonClick(this, '" + this.refToName(i) + "');\"" + ie6_hover + " />"; 
    168165                                break; 
    169166                        case "separator" :      // separator 
     
    171168                                break; 
    172169                        default : 
    173                                 alert("genToolbar() : unknown type (" + this._buttons[i].type + ")"); 
     170                                alert("genToolbar() : unknown type (" + this.we_buttons[i].type + ")"); 
    174171                } 
    175172        } 
    176173 
    177174        // ========== actions ========== 
    178         if (this._actionsMenuEnabled) { 
     175        if (this.we_actionsMenuEnabled) { 
    179176                html += "<div style='border-top:1px solid #CCCCCC; margin:1px 0 4px 0'></div>"; 
    180177                html += "<span style='vertical-align:middle;margin-left:5px'>Actions :</span>"; 
    181                 for(i in this._categs) { 
    182                         if (this._categs[i].title != null)    // hidden actions don't have a title 
    183                                 html += "<span class=\"toolbutton\" style='margin-left:20px; padding:2px 5px 3px 6px' onclick=\"varWikkaEdit.toolbarCategClick('" + i + "', this);\">" + this._categs[i].title + "<img src='3rdparty/plugins/wikkaedit/images/submenu.gif' style='vertical-align:middle'/></span>"; 
     178                for(i in this.we_categs) { 
     179                        if (this.we_categs[i].title != null)  // hidden actions don't have a title 
     180                                html += "<span class=\"toolbutton\" style='margin-left:20px; padding:2px 5px 3px 6px' onclick=\"varWikkaEdit.toolbarCategClick('" + i + "', this);\">" + this.we_categs[i].title + "<img src='3rdparty/plugins/wikkaedit/images/submenu.gif' style='vertical-align:middle'/></span>"; 
    184181                } 
    185182        } 
     
    195192 
    196193        // hide a possible opened menu 
    197         if (((submenuName != null) || (this._buttons["_" + buttonName].type != "submenu")) && (buttonName != "shortcuts")) 
     194        if (((submenuName != null) || (this.we_buttons[this.nameToRef(buttonName)].type != "submenu")) && (buttonName != "shortcuts")) 
    198195                this.hideSubmenu(); 
    199196 
     
    264261 
    265262        var actionAndParams = ""; 
    266         if (this._actionsMenuEnabled) { 
     263        if (this.we_actionsMenuEnabled) { 
    267264                // === use actions data to insert the action === 
    268265                // add the action and default parameters to the textarea 
    269                 var actionName = this._actions[actionRef].name; 
     266                var actionName = this.we_actions[actionRef].name; 
    270267                var OP; 
    271268                actionAndParams += "{{" + actionName; 
    272                 for(var i in this._actions[actionRef].params) { 
    273                         OP = this._actions[actionRef].params[i]; 
     269                for(var i in this.we_actions[actionRef].params) { 
     270                        OP = this.we_actions[actionRef].params[i]; 
    274271                        if ((OP.nodefault == null) || (OP.nodefault == false))  // null or hide => add param 
    275272                                actionAndParams += " " + OP.name + "=\"" + OP.value + "\""; 
     
    294291// ===== hide a submenu (when necessary) ===== 
    295292WikkaEdit.prototype.hideSubmenu = function() { 
    296         this._submenu.style.visibility = "hidden"; 
     293        this.we_submenu.style.visibility = "hidden"; 
    297294} 
    298295 
     
    304301WikkaEdit.prototype.toggleSubmenu = function(obj, newSubmenu, isAction) { 
    305302        isAction = (isAction == true); 
    306         if ((newSubmenu == this._currentSubmenu) && (this._submenu.style.visibility != "hidden")) { 
     303        if ((newSubmenu == this.we_currentSubmenu) && (this.we_submenu.style.visibility != "hidden")) { 
    307304                this.hideSubmenu(); 
    308                 this._ta.focus(); 
     305                this.we_ta.focus(); 
    309306                return; 
    310307        } 
     
    313310        var coords = this.getObjectCoords(obj); 
    314311        coords.y += 25;         // TODO remove this hardcoded value (toolbar height) 
    315         this._submenu.style.left = coords.x + "px"; 
    316         this._submenu.style.top = coords.y + "px"; 
     312        this.we_submenu.style.left = coords.x + "px"; 
     313        this.we_submenu.style.top = coords.y + "px"; 
    317314 
    318315        var html = ""; 
     
    334331                html += "<br/>"; 
    335332                // Ctrl + F is not intercepted by Safari 
    336                 if (!this._webkit) { 
     333                if (!this.we_webkit) { 
    337334                        html += "<span class='we_key'>Ctrl</span> + <span class='we_key'>F</span> : search &amp; replace<br/>"; 
    338335                        html += "<br/>"; 
     
    343340 
    344341                // move the submenu to the left of the button 
    345                 this._submenu.style.left = (coords.x - SHORTCUTS_SUMMARY_WIDTH + 18) + "px"; // TODO remove this hardcoded value (button width) 
     342                this.we_submenu.style.left = (coords.x - SHORTCUTS_SUMMARY_WIDTH + 18) + "px"; // TODO remove this hardcoded value (button width) 
    346343 
    347344        } else { 
     
    352349                var i; 
    353350                if (!isAction) { 
    354                         for(i in this._buttons["_" + newSubmenu]._buttons) { 
    355                                 html += "<div class=\"smbutton\" onclick=\"varWikkaEdit.toolbarButtonClick(this, '" + i.substr(1) + "', '" + newSubmenu + "');\">"; 
    356                                 html += "<img class=\"smimage\" src=\"3rdparty/plugins/wikkaedit/images/" + i.substr(1) + ".gif\" alt=\"" + i.substr(1) + "\"" + ie6_hover + " />"; 
    357                                 html += this._buttons["_" + newSubmenu]._buttons[i].title; 
     351                        for(i in this.we_buttons[this.nameToRef(newSubmenu)].we_buttons) { 
     352                                html += "<div class=\"smbutton\" onclick=\"varWikkaEdit.toolbarButtonClick(this, '" + this.refToName(i) + "', '" + newSubmenu + "');\">"; 
     353                                html += "<img class=\"smimage\" src=\"3rdparty/plugins/wikkaedit/images/" + this.refToName(i) + ".gif\" alt=\"" + this.refToName(i) + "\"" + ie6_hover + " />"; 
     354                                html += this.we_buttons[this.nameToRef(newSubmenu)].we_buttons[i].title; 
    358355                                html += "</div>"; 
    359356                        } 
    360357                } else { 
    361                         for(i in this._actions) { 
    362                                 if (this._actions[i].categ == newSubmenu) { 
    363                                         html += "<div class=\"smbutton\" onclick=\"varWikkaEdit.toolbarActionClick('" + i + "');\"" + (this._actions[i].summary == null ? "" : " title=\"" + this._actions[i].summary + "\"") + ">"; 
    364                                         html += "<img class=\"smimage\" src=\"3rdparty/plugins/wikkaedit/images/" + this._actions[i].name + ".gif\" alt=\"" + this._actions[i].name + "\"" + ie6_hover + " />"; 
    365                                         html += this._actions[i].title; 
     358                        for(i in this.we_actions) { 
     359                                if (this.we_actions[i].categ == newSubmenu) { 
     360                                        html += "<div class=\"smbutton\" onclick=\"varWikkaEdit.toolbarActionClick('" + i + "');\"" + (this.we_actions[i].summary == null ? "" : " title=\"" + this.we_actions[i].summary + "\"") + ">"; 
     361                                        html += "<img class=\"smimage\" src=\"3rdparty/plugins/wikkaedit/images/" + this.we_actions[i].name + ".gif\" alt=\"" + this.we_actions[i].name + "\"" + ie6_hover + " />"; 
     362                                        html += this.we_actions[i].title; 
    366363                                        html += "</div>"; 
    367364                                } 
     
    371368        } 
    372369 
    373         this._submenu.innerHTML = html; 
    374         this._submenu.style.visibility = ""; 
    375         this._currentSubmenu = newSubmenu; 
     370        this.we_submenu.innerHTML = html; 
     371        this.we_submenu.style.visibility = ""; 
     372        this.we_currentSubmenu = newSubmenu; 
    376373} 
    377374 
     
    398395WikkaEdit.prototype.keyDown = function(e) { 
    399396        // take care : this != varWikkaEdit 
    400         if (!varWikkaEdit._canCancelKeyEvent) 
     397        if (!varWikkaEdit.we_canCancelKeyEvent) 
    401398                return true; 
    402399        if (e == null) e = window.event; 
     
    426423                case 27 :       // escape 
    427424                        // TODO select the "note" textfield or the "store" button (when notes are disabled) 
    428                         varWikkaEdit._ta.blur(); 
     425                        varWikkaEdit.we_ta.blur(); 
    429426                        return varWikkaEdit.cancelKey(e); 
    430427 
     
    447444                                } 
    448445                        case 70 :       // ctrl + F 
    449                                 if (varWikkaEdit._searchReplaceEnabled) { 
     446                                if (varWikkaEdit.we_searchReplaceEnabled) { 
    450447                                        varWikkaEdit.showSearchWindow(); 
    451448                                        return varWikkaEdit.cancelKey(e); 
     
    463460        var key = (e.keyCode != null ? e.keyCode : e.which); 
    464461        if ((e.ctrlKey) && (e.altKey)) 
    465                 varWikkaEdit._ta.blur(); 
     462                varWikkaEdit.we_ta.blur(); 
    466463}*/ 
    467464 
     
    511508                newBeforeSel = beforeSel + "\n" + indentChars + marker + (marker == "" ? "" : " "); 
    512509                // update new line 
    513                 var scrollTop = this._ta.scrollTop; 
    514                 this._ta.value = newBeforeSel + afterSel; 
    515                 this._ta.scrollTop = scrollTop; 
     510                var scrollTop = this.we_ta.scrollTop; 
     511                this.we_ta.value = newBeforeSel + afterSel; 
     512                this.we_ta.scrollTop = scrollTop; 
    516513                // move selection 
    517514                // (note : after emptying a line, cursor goes to the previous line. It's not perfect but we 
     
    533530        var afterSel = text.substr(sr.end); 
    534531        // update selection content 
    535         this._ta.value = beforeSel + content + afterSel; 
     532        this.we_ta.value = beforeSel + content + afterSel; 
    536533        // replace selection 
    537534        sr.end += sr.start + content.length; 
    538535        // focus on textarea 
    539         this._ta.focus(); 
     536        this.we_ta.focus(); 
    540537        this.setSelectionRange(sr.start, sr.end); 
    541538}*/ 
     
    564561        } 
    565562        // update selection content 
    566         var scrollTop = this._ta.scrollTop; 
    567         this._ta.value = beforeSel + leftTag + sel + rightTag + afterSel; 
    568         this._ta.scrollTop = scrollTop; 
     563        var scrollTop = this.we_ta.scrollTop; 
     564        this.we_ta.value = beforeSel + leftTag + sel + rightTag + afterSel; 
     565        this.we_ta.scrollTop = scrollTop; 
    569566        // replace selection 
    570567        if (false) { 
     
    575572        } 
    576573        // focus on textarea 
    577         this._ta.focus(); 
     574        this.we_ta.focus(); 
    578575        if (srAfter == null) 
    579576                this.setSelectionRange(sr.start, sr.end); 
     
    615612                        case "outdent" : 
    616613                                if (arr[i].substr(0,1) == "\t") { 
    617                                         newSel += arr[i].substr(1) + (i < arr.length-1 ? "\n" : ""); 
     614                                        newSel += this.refToName(arr[i]) + (i < arr.length-1 ? "\n" : ""); 
    618615                                        sr.end--; 
    619616                                } else { 
     
    632629        } 
    633630        // update selection content 
    634         var scrollTop = this._ta.scrollTop; 
    635         this._ta.value = beforeSel + newSel + afterSel; 
    636         this._ta.scrollTop = scrollTop; 
     631        var scrollTop = this.we_ta.scrollTop; 
     632        this.we_ta.value = beforeSel + newSel + afterSel; 
     633        this.we_ta.scrollTop = scrollTop; 
    637634        // focus on textarea 
    638         this._ta.focus(); 
     635        this.we_ta.focus(); 
    639636        this.setSelectionRange(sr.start, sr.end); 
    640637} 
     
    660657 
    661658WikkaEdit.prototype.setSelectionRange2 = function(start, end) { 
    662         if (typeof(this._ta.setSelectionRange) != "undefined") {      // W3 
     659        if (typeof(this.we_ta.setSelectionRange) != "undefined") {    // W3 
    663660                // some browsers use CRLF for newlines in textarea (opera...) 
    664                 if (this._ta.value.indexOf("\r\n") != -1) { 
     661                if (this.we_ta.value.indexOf("\r\n") != -1) { 
    665662                        var text = this.getTextAreaContent(); 
    666663                        var str; 
     
    677674                // when (start == end) and a previous selection exists, setSelectionRange don't work 
    678675                if (window.opera == null) { 
    679                         this._ta.setSelectionRange(start, end); 
     676                        this.we_ta.setSelectionRange(start, end); 
    680677                } else { 
    681678                        if (start != end) { 
    682                                 this._ta.setSelectionRange(start, end); 
     679                                this.we_ta.setSelectionRange(start, end); 
    683680                        } else { 
    684681                                var sr = this.getSelectionRange(); 
    685682                                // check whether a move is necessary 
    686683                                if ((sr.start != start) || (sr.end != end)) 
    687                                         this._ta.setSelectionRange(start, end); 
     684                                        this.we_ta.setSelectionRange(start, end); 
    688685                                // check whether the bug has occured => select one character (can't do better...) 
    689686                                if ((sr.start != start) || (sr.end != end)) 
    690                                         this._ta.setSelectionRange(start, start + 1); 
     687                                        this.we_ta.setSelectionRange(start, start + 1); 
    691688                        } 
    692689                } 
    693690        } else {                                                                                        // ie6 
    694                 var range = this._ta.createTextRange(); 
     691                var range = this.we_ta.createTextRange(); 
    695692                range.collapse(true); 
    696693                range.moveStart("character", start); 
     
    704701WikkaEdit.prototype.getSelection = function() { 
    705702        var str; 
    706         if (typeof(this._ta.setSelectionRange) != "undefined") {      // W3 
    707                 var selStart = this._ta.selectionStart; 
    708                 var selEnd = this._ta.selectionEnd; 
    709                 str = this._ta.value.substring(selStart, selEnd); 
     703        if (typeof(this.we_ta.setSelectionRange) != "undefined") {    // W3 
     704                var selStart = this.we_ta.selectionStart; 
     705                var selEnd = this.we_ta.selectionEnd; 
     706                str = this.we_ta.value.substring(selStart, selEnd); 
    710707        } else {                                                                                        // ie6 
    711708                var range = document.selection.createRange(); 
     
    722719        var start = 0; 
    723720        var end = 0; 
    724         if (typeof(this._ta.setSelectionRange) != "undefined") {      // W3 
    725                 start = this._ta.selectionStart; 
    726                 end = this._ta.selectionEnd; 
     721        if (typeof(this.we_ta.setSelectionRange) != "undefined") {    // W3 
     722                start = this.we_ta.selectionStart; 
     723                end = this.we_ta.selectionEnd; 
    727724                // some browsers use CRLF for newlines in textarea (opera...) 
    728                 if (this._ta.value.indexOf("\r\n") != -1) { 
     725                if (this.we_ta.value.indexOf("\r\n") != -1) { 
    729726                        var text = this.getTextAreaContent(); 
    730727                        var str; 
     
    739736                } 
    740737        } else {                                                                                        // ie6 
    741                 this._ta.focus(); 
     738                this.we_ta.focus(); 
    742739                var sel1 = document.selection.createRange(); 
    743740                var sel2 = sel1.duplicate(); 
    744                 sel2.moveToElementText(this._ta); 
     741                sel2.moveToElementText(this.we_ta); 
    745742                var marker = "<WikkaRangeMark>"; 
    746743                var selText = sel1.text; 
     
    753750                // setSelectionRange() is only a fix for khtml. The interval it uses cause 
    754751                // some problems here, so we don't use it 
    755                 var range = this._ta.createTextRange(); 
     752                var range = this.we_ta.createTextRange(); 
    756753                range.collapse(true); 
    757754                range.moveStart("character", start); 
     
    776773// get textarea content with "\n" as line separator 
    777774WikkaEdit.prototype.getTextAreaContent = function() { 
    778         var text = this._ta.value; 
     775        var text = this.we_ta.value; 
    779776        // IE use \r\n instead of \n 
    780777        text = text.replace(/\r\n/g, "\n"); 
     
    785782// ===== add a line to the log ===== 
    786783WikkaEdit.prototype.addLog = function(ch) { 
    787         this._log.style.display = ""; 
    788         this._log.innerHTML = ch + "<br/>" + this._log.innerHTML; 
     784        this.we_log.style.display = ""; 
     785        this.we_log.innerHTML = ch + "<br/>" + this.we_log.innerHTML; 
    789786} 
    790787 
    791788// ===== clear the log ===== 
    792789WikkaEdit.prototype.clearLog = function() { 
    793         if (this._log.style.display == "") 
    794                 this._log.innerHTML = ""; 
     790        if (this.we_log.style.display == "") 
     791                this.we_log.innerHTML = ""; 
    795792} 
    796793 
  • wikkaedit/trunk/wikkaedit_actions.js

    r53 r56  
    66//                                                                    // 
    77// Copyright (C) 2007 Olivier Borowski (coin at tuxfamily dot org)    // 
    8 //   based on WikiEdit (http://wackowiki.com/WikiEdit)                // 
     8// Homepage : http://wikkawiki.org/WikkaEdit                          // 
    99//                                                                    // 
    1010// This program is free software; you can redistribute it and/or      // 
     
    129129        var tabUsedParams = this.getParams(); 
    130130        var tabAvailParams = new Array(); 
    131         var actionRef = this.actionNameToRef(objAction.name); 
     131        var actionRef = this.nameToRef(objAction.name); 
    132132        var i, j; 
    133         for(i in this._actions[actionRef].params) 
    134                 tabAvailParams.push({name:this._actions[actionRef].params[i].name, priority:-1}); 
     133        for(i in this.we_actions[actionRef].params) 
     134                tabAvailParams.push({name:this.we_actions[actionRef].params[i].name, priority:-1}); 
    135135        for(i=0; i<tabUsedParams.length; i++) { 
    136136                for(j=0; j<tabAvailParams.length; j++) { 
     
    151151} 
    152152 
    153 // ===== action name to ref ===== 
    154 WikkaEdit.prototype.actionNameToRef = function(name) { 
    155         return "_" + name; 
    156 } 
    157  
    158 // ===== parameter name to ref ===== 
    159 WikkaEdit.prototype.paramNameToRef = function(name) { 
    160         return "_" + name; 
    161 } 
    162  
    163153// ===== contextual help ===== 
    164154WikkaEdit.prototype.contextualHelp = function() { 
     
    170160        if (actionAndSr.text != "") { 
    171161                var objAction = this.getActionNameAndParams(); 
    172                 var actionRef = this.actionNameToRef(objAction.name); 
     162                var actionRef = this.nameToRef(objAction.name); 
    173163                // ensure this action exists 
    174                 if (this._actions[actionRef] != null) { 
     164                if (this.we_actions[actionRef] != null) { 
    175165                        var paramUnderCarret = this.getParamUnderCarret(); 
    176166                        var tabAvailParams = this.sortParams(objAction); 
     
    179169                        var params="", AIP, paramRef, clickaction; 
    180170                        for(var i=0; i<tabAvailParams.length; i++) { 
    181                                 paramRef = this.paramNameToRef(tabAvailParams[i].name); 
    182                                 AIP = this._actions[actionRef].params[paramRef]; 
     171                                paramRef = this.nameToRef(tabAvailParams[i].name); 
     172                                AIP = this.we_actions[actionRef].params[paramRef]; 
    183173                                params += " "; 
    184174                                if (tabAvailParams[i].priority != -1)   // parameter present 
    185175                                        clickaction = " onclick=\"varWikkaEdit.paramClick('" + paramRef + "');\""; 
    186176                                else                                                                    // parameter not used yet 
    187                                         clickaction = " onclick=\"varWikkaEdit._ta.focus();\" ondblclick=\"varWikkaEdit.paramClick('" + paramRef + "');\""; 
     177                                        clickaction = " onclick=\"varWikkaEdit.we_ta.focus();\" ondblclick=\"varWikkaEdit.paramClick('" + paramRef + "');\""; 
    188178                                params += "<span class=\"wikkaparamlink\"" + clickaction + " onmouseover=\"varWikkaEdit.paramOver(this, '" + actionRef + "', '" + paramRef + "', " + (tabAvailParams[i].priority != -1) + ");\" onmouseout=\"varWikkaEdit.paramOut('" + paramRef + "');\">"; 
    189179                                if (AIP.name == paramUnderCarret) params += "<b>"; 
     
    199189        } 
    200190 
    201         if (help != this._helpPreviousContent) 
    202                 this._help.innerHTML = help; 
    203         this._helpPreviousContent = help; 
    204         this._help.style.visibility = (help == "&nbsp;" ? "hidden" : ""); 
     191        if (help != this.we_helpPreviousContent) 
     192                this.we_help.innerHTML = help; 
     193        this.we_helpPreviousContent = help; 
     194        this.we_help.style.visibility = (help == "&nbsp;" ? "hidden" : ""); 
    205195} 
    206196 
     
    211201        var coords = this.getObjectCoords(obj); 
    212202        coords.y += 25;         // TODO remove this hardcoded value (toolbar height) 
    213         this._tooltip.style.left = coords.x + "px"; 
    214         this._tooltip.style.top = coords.y + "px"; 
    215         this._tooltip.style.visibility = ""; 
     203        this.we_tooltip.style.left = coords.x + "px"; 
     204        this.we_tooltip.style.top = coords.y + "px"; 
     205        this.we_tooltip.style.visibility = ""; 
    216206        var tip; 
    217207        if (paramRef == null) 
     
    225215        html += "<div class='wikkatooltip_body'>"; 
    226216        if (paramRef == null) { 
    227                 html += this._actions[actionRef].summary + "<br />"; 
    228                 if (this._actions[actionRef].usage != null) 
    229                         html += "<hr class='wikkatooltip_separator' />" + this._actions[actionRef].usage; 
     217                html += this.we_actions[actionRef].summary + "<br />"; 
     218                if (this.we_actions[actionRef].usage != null) 
     219                        html += "<hr class='wikkatooltip_separator' />" + this.we_actions[actionRef].usage; 
    230220        } else 
    231                 html += this._actions[actionRef].params[paramRef].description; 
     221                html += this.we_actions[actionRef].params[paramRef].description; 
    232222        html += "</div>"; 
    233         this._tooltip.innerHTML = html; 
     223        this.we_tooltip.innerHTML = html; 
    234224} 
    235225 
     
    237227// => hide tooltip 
    238228WikkaEdit.prototype.paramOut = function(paramRef) { 
    239         this._tooltip.style.visibility = "hidden"; 
     229        this.we_tooltip.style.visibility = "hidden"; 
    240230} 
    241231 
     
    254244                posEnd = posStart + actionAndSr.text.length + 4; // +4 = {{}} 
    255245                this.setSelectionRange(posStart, posEnd); 
    256                 this._ta.focus(); 
     246                this.we_ta.focus(); 
    257247                return; 
    258248        } 
     
    260250        // click on a param? 
    261251        var objAction = this.getActionNameAndParams(); 
    262         var actionRef = this.actionNameToRef(objAction.name); 
    263         var paramName = this._actions[actionRef].params[paramRef].name; 
     252        var actionRef = this.nameToRef(objAction.name); 
     253        var paramName = this.we_actions[actionRef].params[paramRef].name; 
    264254        var pos = objAction.paramsHid.indexOf(" " + paramName); //, actionAndSr.sr.start); 
    265255        if (pos == -1) { 
    266256                // parameter doesn't exist => add it? 
    267                 var actionRef = this.actionNameToRef(objAction.name); 
     257                var actionRef = this.nameToRef(objAction.name); 
    268258                var newCarretPos = actionAndSr.tagStart + actionAndSr.text.length + 2; 
    269                 var paramValue = this._actions[actionRef].params[paramRef].value; 
     259                var paramValue = this.we_actions[actionRef].params[paramRef].value; 
    270260                //this.setSelectionRange(newCarretPos, newCarretPos); 
    271261                var srBefore = {start:newCarretPos, end:newCarretPos}; 
     
    285275                this.setSelectionRange(posStart, posEnd); 
    286276        } 
    287         this._ta.focus(); 
    288 } 
     277        this.we_ta.focus(); 
     278} 
  • wikkaedit/trunk/wikkaedit_data.js

    r54 r56  
    66//                                                                    // 
    77// Copyright (C) 2007 Olivier Borowski (coin at tuxfamily dot org)    // 
    8 //   based on WikiEdit (http://wackowiki.com/WikiEdit)                // 
     8// Homepage : http://wikkawiki.org/WikkaEdit                          // 
    99//                                                                    // 
    1010// This program is free software; you can redistribute it and/or      // 
     
    3232        this.EDITOR_HEIGHT_POLL_INTERV = 500;   // textarea height change poll interval (in ms) 
    3333        this.CONTEXTUAL_HELP_POLL_INTERV = 500; // refresh time for contextual help (in ms) 
    34         this._ta = textarea;                                  // textarea (= document.getElementById("body")) 
    35         this._submenu = null;                                 // submenu div (= document.getElementById("wikkasubmenu")) 
    36         this._toolbar = null;                                 // toolbar div (= document.getElementById("wikkatoolbar")) 
    37         this._help = null;                                            // help div (= document.getElementById("wikkahelp")) 
    38         this._buttons = new Object();                 // buttons, submenus 
    39         this._categs = new Object();                  // action categs 
    40         this._actions = new Object();                 // actions 
    41         this._currentSubmenu = null;                  // submenu currently displayed 
     34        this.we_ta = textarea;                                        // textarea (= document.getElementById("body")) 
     35        this.we_submenu = null;                                       // submenu div (= document.getElementById("wikkasubmenu")) 
     36        this.we_toolbar = null;                                       // toolbar div (= document.getElementById("wikkatoolbar")) 
     37        this.we_help = null;                                          // help div (= document.getElementById("wikkahelp")) 
     38        this.we_buttons = new Object();                       // buttons, submenus 
     39        this.we_categs = new Object();                        // action categs 
     40        this.we_actions = new Object();                       // actions 
     41        this.we_currentSubmenu = null;                        // submenu currently displayed 
    4242        // === modules === 
    43         this._actionsMenuEnabled = null; 
    44         this._searchReplaceEnabled = null; 
     43        this.we_actionsMenuEnabled = null; 
     44        this.we_searchReplaceEnabled = null; 
    4545        // === browser dependant code === 
    4646        // only used for rare-very-specific browser behaviour 
    47         this._webkit = (navigator.userAgent.toLowerCase().indexOf("webkit") != -1); 
    48         this._gecko = ((!this._webkit) && (navigator.userAgent.toLowerCase().indexOf("gecko") != -1)); 
    49         this._khtml = ((!this._webkit) && (navigator.userAgent.toLowerCase().indexOf("khtml") != -1)); 
    50         this._opera = (navigator.userAgent.toLowerCase().indexOf("opera") != -1); 
    51         this._canCancelKeyEvent = (!this._opera);     // opera can't cancel key events, so native browser shortcuts can't be overriden 
     47        this.we_webkit = (navigator.userAgent.toLowerCase().indexOf("webkit") != -1); 
     48        this.we_gecko = ((!this.we_webkit) && (navigator.userAgent.toLowerCase().indexOf("gecko") != -1)); 
     49        this.we_khtml = ((!this.we_webkit) && (navigator.userAgent.toLowerCase().indexOf("khtml") != -1)); 
     50        this.we_opera = (navigator.userAgent.toLowerCase().indexOf("opera") != -1); 
     51        this.we_canCancelKeyEvent = (!this.we_opera); // opera can't cancel key events, so native browser shortcuts can't be overriden 
    5252        // === search & replace === 
    53         this._searchFor = ""; 
    54         this._replaceWith = ""; 
    55         this._replace = false; 
    56         this._regexp = false; 
    57         this._case = false; 
    58         this._whole = false; 
    59         this._cursor = true; 
    60         this._reverse = false; 
    61         this._prompt = true; 
    62         this._lastMsg = ""; 
     53        this.we_searchFor = ""; 
     54        this.we_replaceWith = ""; 
     55        this.we_replace = false; 
     56        this.we_regexp = false; 
     57        this.we_case = false; 
     58        this.we_whole = false; 
     59        this.we_cursor = true; 
     60        this.we_reverse = false; 
     61        this.we_prompt = true; 
     62        this.we_lastMsg = ""; 
     63
     64 
     65// =====  name to ref ===== 
     66WikkaEdit.prototype.nameToRef = function(name) { 
     67        return "we_" + name; 
     68
     69WikkaEdit.prototype.refToName = function(ref) { 
     70        return ref.substr(3); 
    6371} 
    6472 
    6573WikkaEdit.prototype.initButtons = function() { 
    66         this._buttons._h1 = {type:"button", title:"Heading 1"}; 
    67         this._buttons._h2 = {type:"button", title:"Heading 2"}; 
    68         this._buttons._h3 = {type:"button", title:"Heading 3"}; 
    69         this._buttons._h4 = {type:"button", title:"Heading 4"}; 
    70         this._buttons._h5 = {type:"button", title:"Heading 5"}; 
    71  
    72         this._buttons._sep1 = {type:"separator"}; 
    73  
    74         this._buttons._bold = {type:"button", title:"Bold"}; 
    75         this._buttons._italic = {type:"button", title:"Italic"}; 
    76         this._buttons._underline = {type:"button", title:"Underline"}; 
    77         this._buttons._strike = {type:"button", title:"Strikethrough"}; 
    78         this._buttons._style = {type:"submenu", title:"Show more", _buttons:new Object()}; 
    79         this._buttons._style._buttons._forecolor = {type:"button", title:"Colored text"}; 
    80         this._buttons._style._buttons._monospace = {type:"button", title:"Monospace"}; 
    81         this._buttons._style._buttons._highlight = {type:"button", title:"Highlight"}; 
    82         this._buttons._style._buttons._key = {type:"button", title:"Key"}; 
    83         this._buttons._style._buttons._leftfloat = {type:"button", title:"Left float"}; 
    84         this._buttons._style._buttons._rightfloat = {type:"button", title:"Right float"}; 
    85  
    86         this._buttons._sep2 = {type:"separator"}; 
    87  
    88         this._buttons._justifycenter = {type:"button", title:"Center text"}; 
    89         this._buttons._bullist = {type:"button", title:"List"}; 
    90         this._buttons._numlist = {type:"button", title:"Numbered list"}; 
    91         this._buttons._comments = {type:"button", title:"Inline comments"}; 
    92  
    93         this._buttons._sep3 = {type:"separator"}; 
    94  
    95         this._buttons._indent = {type:"button", title:"Indent"}; 
    96         this._buttons._outdent = {type:"button", title:"Outdent"}; 
    97  
    98         this._buttons._sep4 = {type:"separator"}; 
    99  
    100         this._buttons._hr = {type:"button", title:"Line"}; 
    101         this._buttons._link = {type:"button", title:"Hyperlink"}; 
    102         this._buttons._image = {type:"button", title:"Image"}; 
    103         this._buttons._table = {type:"button", title:"Table"}; 
    104  
    105         this._buttons._sep5 = {type:"separator"}; 
    106  
    107         this._buttons._rawhtml = {type:"button", title:"Raw HTML"}; 
    108         this._buttons._sourcecode = {type:"button", title:"Source code"}; 
    109  
    110         this._buttons._sep6 = {type:"separator"}; 
    111  
    112         if (this._searchReplaceEnabled) 
    113                 this._buttons._find = {type:"button", title:"Search &amp; replace"}; 
    114  
    115         if (varWikkaEdit._canCancelKeyEvent) 
    116                 this._buttons._shortcuts = {type:"button", title:"Display shortcuts"}; 
    117  
    118         this._buttons._formatting_rules = {type:"button", title:"Formatting rules (new window)"}; 
     74        this.we_buttons.we_h1 = {type:"button", title:"Heading 1"}; 
     75        this.we_buttons.we_h2 = {type:"button", title:"Heading 2"}; 
     76        this.we_buttons.we_h3 = {type:"button", title:"Heading 3"}; 
     77        this.we_buttons.we_h4 = {type:"button", title:"Heading 4"}; 
     78        this.we_buttons.we_h5 = {type:"button", title:"Heading 5"}; 
     79 
     80        this.we_buttons.we_sep1 = {type:"separator"}; 
     81 
     82        this.we_buttons.we_bold = {type:"button", title:"Bold"}; 
     83        this.we_buttons.we_italic = {type:"button", title:"Italic"}; 
     84        this.we_buttons.we_underline = {type:"button", title:"Underline"}; 
     85        this.we_buttons.we_strike = {type:"button", title:"Strikethrough"}; 
     86        this.we_buttons.we_style = {type:"submenu", title:"Show more", we_buttons:new Object()}; 
     87        this.we_buttons.we_style.we_buttons.we_forecolor = {type:"button", title:"Colored text"}; 
     88        this.we_buttons.we_style.we_buttons.we_monospace = {type:"button", title:"Monospace"}; 
     89        this.we_buttons.we_style.we_buttons.we_highlight = {type:"button", title:"Highlight"}; 
     90        this.we_buttons.we_style.we_buttons.we_key = {type:"button", title:"Key"}; 
     91        this.we_buttons.we_style.we_buttons.we_leftfloat = {type:"button", title:"Left float"}; 
     92        this.we_buttons.we_style.we_buttons.we_rightfloat = {type:"button", title:"Right float"}; 
     93 
     94        this.we_buttons.we_sep2 = {type:"separator"}; 
     95 
     96        this.we_buttons.we_justifycenter = {type:"button", title:"Center text"}; 
     97        this.we_buttons.we_bullist = {type:"button", title:"List"}; 
     98        this.we_buttons.we_numlist = {type:"button", title:"Numbered list"}; 
     99        this.we_buttons.we_comments = {type:"button", title:"Inline comments"}; 
     100 
     101        this.we_buttons.we_sep3 = {type:"separator"}; 
     102 
     103        this.we_buttons.we_indent = {type:"button", title:"Indent"}; 
     104        this.we_buttons.we_outdent = {type:"button", title:"Outdent"}; 
     105 
     106        this.we_buttons.we_sep4 = {type:"separator"}; 
     107 
     108        this.we_buttons.we_hr = {type:"button", title:"Line"}; 
     109        this.we_buttons.we_link = {type:"button", title:"Hyperlink"}; 
     110        this.we_buttons.we_image = {type:"button", title:"Image"}; 
     111        this.we_buttons.we_table = {type:"button", title:"Table"}; 
     112 
     113        this.we_buttons.we_sep5 = {type:"separator"}; 
     114 
     115        this.we_buttons.we_rawhtml = {type:"button", title:"Raw HTML"}; 
     116        this.we_buttons.we_sourcecode = {type:"button", title:"Source code"}; 
     117 
     118        this.we_buttons.we_sep6 = {type:"separator"}; 
     119 
     120        if (this.we_searchReplaceEnabled) 
     121                this.we_buttons.we_find = {type:"button", title:"Search &amp; replace"}; 
     122 
     123        if (varWikkaEdit.we_canCancelKeyEvent) 
     124                this.we_buttons.we_shortcuts = {type:"button", title:"Display shortcuts"}; 
     125 
     126        this.we_buttons.we_formatting_rules = {type:"button", title:"Formatting rules (new window)"}; 
    119127} 
    120128 
    121129WikkaEdit.prototype.initCategs = function() { 
    122         this._categs.hidden = {title:null}; 
    123         this._categs.objects = {title:"Objects"}; 
    124         this._categs.page = {title:"Page"}; 
    125         this._categs.accounts = {title:"Accounts"}; 
    126         this._categs.global = {title:"Global"}; 
    127         this._categs.misc = {title:"Misc"}; 
    128         this._categs.infos = {title:"Infos"}; 
     130        this.we_categs.hidden = {title:null}; 
     131        this.we_categs.objects = {title:"Objects"}; 
     132        this.we_categs.page = {title:"Page"}; 
     133        this.we_categs.accounts = {title:"Accounts"}; 
     134        this.we_categs.global = {title:"Global"}; 
     135        this.we_categs.misc = {title:"Misc"}; 
     136        this.we_categs.infos = {title:"Infos"}; 
    129137} 
    130138 
    131139function WikkaAction(categName, tagName, title, summary, usage) { 
    132         this._categ = categName; 
    133         this._name = tagName; 
    134         this._title = title; 
    135         this._summary = summary; 
    136         this._usage = usage; 
    137         this._params = new Object(); 
     140        this.we_categ = categName; 
     141        this.we_name = tagName; 
     142        this.we_title = title; 
     143        this.we_summary = summary; 
     144        this.we_usage = usage; 
     145        this.we_params = new Object(); 
    138146} 
    139147 
    140148WikkaAction.prototype.addParam = function(name, value, nodefault, description) { 
    141149        nodefault = (nodefault == true); 
    142         this._params["_" + name] = {name:name, value:value, nodefault:nodefault, description:description}; 
     150        this.we_params[this.nameToRef(name)] = {name:name, value:value, nodefault:nodefault, description:description}; 
    143151} 
    144152 
    145153WikkaEdit.prototype.initActions = function() { 
    146154        // ===== basic (hidden) ===== 
    147         this._actions._color = new WikkaAction("hidden", "color", "Text color"); 
    148         this._actions._color.addParam("text", "text"); 
    149         this._actions._color.addParam("c", "color"); 
    150         this._actions._image = new WikkaAction("hidden", "image", "Image", "Display an image."); 
    151         this._actions._image.addParam("url", "url", null, "Image URL. Can be relative (images/img.png) or external (http://example.com/example.jpg)"); 
    152         this._actions._image.addParam("title", "text", null, "Tooltip text"); 
    153         this._actions._image.addParam("alt", "text", null, "Alternate text when image can't be displayed"); 
    154         this._actions._image.addParam("class", "className", true, "Class name (defined in the CSS file)"); 
    155         this._actions._image.addParam("link", "url", true, "Put a link on this image"); 
     155        this.we_actions.we_color = new WikkaAction("hidden", "color", "Text color"); 
     156        this.we_actions.we_color.addParam("text", "text"); 
     157        this.we_actions.we_color.addParam("c", "color"); 
     158        this.we_actions.we_image = new WikkaAction("hidden", "image", "Image", "Display an image."); 
     159        this.we_actions.we_image.addParam("url", "url", null, "Image URL. Can be relative (images/img.png) or external (http://example.com/example.jpg)"); 
     160        this.we_actions.we_image.addParam("title", "text", null, "Tooltip text"); 
     161        this.we_actions.we_image.addParam("alt", "text", null, "Alternate text when image can't be displayed"); 
     162        this.we_actions.we_image.addParam("class", "className", true, "Class name (defined in the CSS file)"); 
     163        this.we_actions.we_image.addParam("link", "url", true, "Put a link on this image"); 
    156164        // ===== objects ===== 
    157         this._actions._calendar = new WikkaAction("objects", "calendar", "Calendar", "Display a calendar face for a specified or the current month.", "Specifying a month and/or year in the action itself results in a \"static\" calendar face without navigation; conversely, providing no parameters in the action results in a calendar face with navigation links to previous, current and next month, with URL parameters determining which month is shown (with the current month as default)."); 
    158         this._actions._calendar.addParam("year", "yyyy", null, "Year in 4 digits format"); 
    159         this._actions._calendar.addParam("month", "mm", null, "Month in 2 digits format"); 
    160         this._actions._flash = new WikkaAction("objects", "flash", "Flash animation"); 
    161         this._actions._flash.addParam("url", "http://example.com/example.swf"); 
    162         this._actions._flash.addParam("width", "w", true); 
    163         this._actions._flash.addParam("height", "h", true); 
    164         this._actions._include = new WikkaAction("objects", "include", "Page included"); 
    165         this._actions._include.addParam("page", "PageName"); 
    166         this._actions._files = new WikkaAction("objects", "files", "File upload/download manager"); 
    167         this._actions._files.addParam("download", "filename"); 
    168         this._actions._files.addParam("text", "descriptive text"); 
    169         this._actions._mindmap = new WikkaAction("objects", "mindmap", "Mindmap", "Embed a mindmap in the current page."); 
     165        this.we_actions.we_calendar = new WikkaAction("objects", "calendar", "Calendar", "Display a calendar face for a specified or the current month.", "Specifying a month and/or year in the action itself results in a \"static\" calendar face without navigation; conversely, providing no parameters in the action results in a calendar face with navigation links to previous, current and next month, with URL parameters determining which month is shown (with the current month as default)."); 
     166        this.we_actions.we_calendar.addParam("year", "yyyy", null, "Year in 4 digits format"); 
     167        this.we_actions.we_calendar.addParam("month", "mm", null, "Month in 2 digits format"); 
     168        this.we_actions.we_flash = new WikkaAction("objects", "flash", "Flash animation"); 
     169        this.we_actions.we_flash.addParam("url", "http://example.com/example.swf"); 
     170        this.we_actions.we_flash.addParam("width", "w", true); 
     171        this.we_actions.we_flash.addParam("height", "h", true); 
     172        this.we_actions.we_include = new WikkaAction("objects", "include", "Page included"); 
     173        this.we_actions.we_include.addParam("page", "PageName"); 
     174        this.we_actions.we_files = new WikkaAction("objects", "files", "File upload/download manager"); 
     175        this.we_actions.we_files.addParam("download", "filename"); 
     176        this.we_actions.we_files.addParam("text", "descriptive text"); 
     177        this.we_actions.we_mindmap = new WikkaAction("objects", "mindmap", "Mindmap", "Embed a mindmap in the current page."); 
    170178        // ===== infos - this page ===== 
    171         this._actions._rss = new WikkaAction("page", "rss", "RSS"); 
    172         this._actions._backlinks = new WikkaAction("page", "backlinks", "Backlinks"); 
    173         this._actions._lastedit = new WikkaAction("page", "lastedit", "Last edit"); 
     179        this.we_actions.we_rss = new WikkaAction("page", "rss", "RSS"); 
     180        this.we_actions.we_backlinks = new WikkaAction("page", "backlinks", "Backlinks"); 
     181        this.we_actions.we_lastedit = new WikkaAction("page", "lastedit", "Last edit"); 
    174182        // === infos - accounts=== 
    175         this._actions._usersettings = new WikkaAction("accounts", "usersettings", "My user settings"); 
    176         this._actions._mychanges = new WikkaAction("accounts", "mychanges", "My changes"); 
    177         this._actions._mypages = new WikkaAction("accounts", "mypages", "My pages"); 
    178         this._actions._emailpassword = new WikkaAction("accounts", "emailpassword", "Lost password"); 
    179         this._actions._lastusers = new WikkaAction("accounts", "lastusers", "Newly registered users"); 
     183        this.we_actions.we_usersettings = new WikkaAction("accounts", "usersettings", "My user settings"); 
     184        this.we_actions.we_mychanges = new WikkaAction("accounts", "mychanges", "My changes"); 
     185        this.we_actions.we_mypages = new WikkaAction("accounts", "mypages", "My pages"); 
     186        this.we_actions.we_emailpassword = new WikkaAction("accounts", "emailpassword", "Lost password"); 
     187        this.we_actions.we_lastusers = new WikkaAction("accounts", "lastusers", "Newly registered users"); 
    180188        // === infos - global=== 
    181         this._actions._category = new WikkaAction("global", "category", "Show thinks belonging to a category"); 
    182         this._actions._wantedpages = new WikkaAction("global", "wantedpages", "Name of nonexisting pages"); 
    183         this._actions._orphanedpages = new WikkaAction("global", "orphanedpages", "Orphaned pages"); 
    184         this._actions._pageindex = new WikkaAction("global", "pageindex", "Page index"); 
    185         this._actions._recentchanges = new WikkaAction("global", "recentchanges", "Recently changed pages"); 
    186         this._actions._recentcomments = new WikkaAction("global", "recentcomments", "Recently commented pages"); 
    187         this._actions._recentlycommented = new WikkaAction("global", "recentlycommented", "Latest comments"); 
     189        this.we_actions.we_category = new WikkaAction("global", "category", "Show thinks belonging to a category"); 
     190        this.we_actions.we_wantedpages = new WikkaAction("global", "wantedpages", "Name of nonexisting pages"); 
     191        this.we_actions.we_orphanedpages = new WikkaAction("global", "orphanedpages", "Orphaned pages"); 
     192        this.we_actions.we_pageindex = new WikkaAction("global", "pageindex", "Page index"); 
     193        this.we_actions.we_recentchanges = new WikkaAction("global", "recentchanges", "Recently changed pages"); 
     194        this.we_actions.we_recentcomments = new WikkaAction("global", "recentcomments", "Recently commented pages"); 
     195        this.we_actions.we_recentlycommented = new WikkaAction("global", "recentlycommented", "Latest comments"); 
    188196        // === misc === 
    189         this._actions._newpage = new WikkaAction("misc", "newpage", "New pages"); 
    190         this._actions._textsearch = new WikkaAction("misc", "textsearch", "Search for a phrase"); 
    191         this._actions._textsearchexpanded = new WikkaAction("misc", "textsearchexpanded", "Search for a phrase 2"); 
    192         this._actions._googleform = new WikkaAction("misc", "googleform", "Google searchbox"); 
    193         this._actions._feedback = new WikkaAction("misc", "feedback", "Feedback form"); 
    194         this._actions._nocomments = new WikkaAction("misc", "nocomments", "Disallow comments"); 
    195         this._actions._interwikilist = new WikkaAction("misc", "interwikilist", "InterWiki list"); 
     197        this.we_actions.we_newpage = new WikkaAction("misc", "newpage", "New pages"); 
     198        this.we_actions.we_textsearch = new WikkaAction("misc", "textsearch", "Search for a phrase"); 
     199        this.we_actions.we_textsearchexpanded = new WikkaAction("misc", "textsearchexpanded", "Search for a phrase 2"); 
     200        this.we_actions.we_googleform = new WikkaAction("misc", "googleform", "Google searchbox"); 
     201        this.we_actions.we_feedback = new WikkaAction("misc", "feedback", "Feedback form"); 
     202        this.we_actions.we_nocomments = new WikkaAction("misc", "nocomments", "Disallow comments"); 
     203        this.we_actions.we_interwikilist = new WikkaAction("misc", "interwikilist", "InterWiki list"); 
    196204        // === infos - rare=== 
    197         this._actions._wikkaname = new WikkaAction("infos", "wikkaname", "Wikka name"); 
    198         this._actions._wikkaversion = new WikkaAction("infos", "wikkaversion", "Wikka version"); 
    199         this._actions._wikkachanges = new WikkaAction("infos", "wikkachanges", "Wikka version & Release Notes"); 
    200         this._actions._phpversion = new WikkaAction("infos", "phpversion", "PHP version"); 
    201         this._actions._mysqlversion = new WikkaAction("infos", "mysqlversion", "mySQL version"); 
    202         this._actions._system = new WikkaAction("infos", "system", "System informations"); 
    203         this._actions._countpages = new WikkaAction("infos", "countpages", "Count pages"); 
    204         this._actions._countowned = new WikkaAction("infos", "countowned", "Count owned pages"); 
    205         this._actions._countcomments = new WikkaAction("infos", "countcomments", "Count comments"); 
    206         this._actions._countusers = new WikkaAction("infos", "countusers", "Count users"); 
     205        this.we_actions.we_wikkaname = new WikkaAction("infos", "wikkaname", "Wikka name"); 
     206        this.we_actions.we_wikkaversion = new WikkaAction("infos", "wikkaversion", "Wikka version"); 
     207        this.we_actions.we_wikkachanges = new WikkaAction("infos", "wikkachanges", "Wikka version & Release Notes"); 
     208        this.we_actions.we_phpversion = new WikkaAction("infos", "phpversion", "PHP version"); 
     209        this.we_actions.we_mysqlversion = new WikkaAction("infos", "mysqlversion", "mySQL version"); 
     210        this.we_actions.we_system = new WikkaAction("infos", "system", "System informations"); 
     211        this.we_actions.we_countpages = new WikkaAction("infos", "countpages", "Count pages"); 
     212        this.we_actions.we_countowned = new WikkaAction("infos", "countowned", "Count owned pages"); 
     213        this.we_actions.we_countcomments = new WikkaAction("infos", "countcomments", "Count comments"); 
     214        this.we_actions.we_countusers = new WikkaAction("infos", "countusers", "Count users"); 
    207215} 
    208216 
  • wikkaedit/trunk/wikkaedit_search.js

    r55 r56  
    66//                                                                    // 
    77// Copyright (C) 2007 Olivier Borowski (coin at tuxfamily dot org)    // 
    8 //   based on WikiEdit (http://wackowiki.com/WikiEdit)                // 
     8// Homepage : http://wikkawiki.org/WikkaEdit                          // 
    99//                                                                    // 
    1010// This program is free software; you can redistribute it and/or      // 
     
    3030 
    3131// radio to switch between search and replace 
    32 WikkaEdit.prototype.srRadioSearchReplaceClick = function(obj, _replace) { 
    33         this._replace = _replace; 
     32WikkaEdit.prototype.srRadioSearchReplaceClick = function(obj, we_replace) { 
     33        this.we_replace = we_replace; 
    3434        // update search window content 
    3535        this.showSearchWindow(); 
     
    3939WikkaEdit.prototype.srFieldSearchReplaceChange = function(obj) { 
    4040        switch (obj.id) { 
    41                 case "sr_field_searchFor" : this._searchFor = obj.value; break; 
    42                 case "sr_field_replaceWith" : this._replaceWith = obj.value; break; 
     41                case "sr_field_searchFor" : this.we_searchFor = obj.value; break; 
     42                case "sr_field_replaceWith" : this.we_replaceWith = obj.value; break; 
    4343                default : alert("srFieldSearchReplaceChange() : id=" + obj.id); 
    4444        } 
     
    4949        var key = (e.keyCode != null ? e.keyCode : e.which); 
    5050        if (key == 13) { // enter 
    51                 varWikkaEdit._ta.focus(); // blur() the textfield to call its onchange() 
     51                varWikkaEdit.we_ta.focus(); // blur() the textfield to call its onchange() 
    5252                varWikkaEdit.srBtnFindNextClick(); 
    5353                return varWikkaEdit.cancelKey(); 
     
    5959WikkaEdit.prototype.srCheckboxClick = function(obj) { 
    6060        switch (obj.id) { 
    61                 case "sr_check_regexp" : this._regexp = obj.checked; break; 
    62                 case "sr_check_case" : this._case = obj.checked; break; 
    63                 case "sr_check_whole" : this._whole = obj.checked; break; 
    64                 case "sr_check_cursor" : this._cursor = obj.checked; break; 
    65                 case "sr_check_reverse" : this._reverse = obj.checked; break; 
    66                 case "sr_check_prompt" : this._prompt = obj.checked; break; 
     61                case "sr_check_regexp" : this.we_regexp = obj.checked; break; 
     62                case "sr_check_case" : this.we_case = obj.checked; break; 
     63                case "sr_check_whole" : this.we_whole = obj.checked; break; 
     64                case "sr_check_cursor" : this.we_cursor = obj.checked; break; 
     65                case "sr_check_reverse" : this.we_reverse = obj.checked; break; 
     66                case "sr_check_prompt" : this.we_prompt = obj.checked; break; 
    6767                default : alert("srCheckboxClick() : id=" + obj.id); 
    6868        } 
     
    8787                return false; 
    8888        // if "whole word" option is not selected, no need to do additional tests 
    89         if (!this._whole) 
     89        if (!this.we_whole) 
    9090                return true; 
    9191        // check for leading and trailing chars 
     
    104104        // textarea content 
    105105        var text = this.getTextAreaContent(); 
    106         var searchfor = this._searchFor; 
     106        var searchfor = this.we_searchFor; 
    107107 
    108108        // duplicate these variables to simplify search in case sensitive or not 
    109109        var textC = text, searchforC = searchfor; 
    110         if (!this._case) { 
     110        if (!this.we_case) { 
    111111                textC = textC.toLowerCase(); 
    112112                searchforC = searchforC.toLowerCase(); 
     
    115115        var currentSelectionMatch = this.checkIfMatch(searchforC, textC, sr.start, sr.end); 
    116116 
    117         if ((this._replace) && (currentSelectionMatch)) { 
     117        if ((this.we_replace) && (currentSelectionMatch)) { 
    118118                var beforeSel = text.substr(0, sr.start); 
    119119                var afterSel = text.substr(sr.end); 
    120120                // update selection content 
    121                 var scrollTop = this._ta.scrollTop; 
    122                 this._ta.value = beforeSel + this._replaceWith + afterSel; 
    123                 this._ta.scrollTop = scrollTop; 
     121                var scrollTop = this.we_ta.scrollTop; 
     122                this.we_ta.value = beforeSel + this.we_replaceWith + afterSel; 
     123                this.we_ta.scrollTop = scrollTop; 
    124124                // replace selection 
    125                 this.setSelectionRange(sr.start, sr.start + this._replaceWith.length); 
     125                this.setSelectionRange(sr.start, sr.start + this.we_replaceWith.length); 
    126126                // as the textarea content has change, textC, sr... are not up to date so 
    127127                // we restart at the beginning of the function 
     
    131131 
    132132        // depending on the "from cursor" option, the initial position can be reset 
    133         var newSrStart = (this._cursor ? sr.start : 0); 
     133        var newSrStart = (this.we_cursor ? sr.start : 0); 
    134134 
    135135        // search for the next occurence 
    136136        var finished = false; 
    137137        while (!finished) { 
    138                 if (!this._reverse) 
     138                if (!this.we_reverse) 
    139139                        newSrStart = textC.indexOf(searchforC, newSrStart + (currentSelectionMatch ? 1 : 0)); 
    140140                else 
     
    142142                if (newSrStart == -1) {                                 // not found 
    143143                        finished = true; 
    144                         this._lastMsg = "no other occurence"; 
    145                 } else if (!this._whole) {                            // found => ok 
     144                        this.we_lastMsg = "no other occurence"; 
     145                } else if (!this.we_whole) {                          // found => ok 
    146146                        finished = true; 
    147147                } else {                                                                // found but is this a whole word? 
     
    153153        this.showSearchWindow(); 
    154154 
    155         this._ta.focus(); 
     155        this.we_ta.focus(); 
    156156 
    157157        if (newSrStart == -1) { 
     
    170170                // - on opera, it can't be done :( 
    171171                // - on gecko and webkit, the following hack is needed 
    172                 if (this._gecko || this._webkit) { 
     172                if (this.we_gecko || this.we_webkit) { 
    173173                        var windowWidth = parseInt(window.innerWidth ? window.innerWidth : document.documentElement.clientWidth, 10); 
    174174                        var TEXTAREA_MARGINS_LR = 26;   // TODO : hardcoded value : 26 is approximatly the left and right margins of textarea 
    175175                        var taWidth = windowWidth - TEXTAREA_MARGINS_LR; 
    176                         var taHeight = parseInt(this._ta.style.height, 10); 
    177  
    178                         // duplicate real textarea to _searchTa but limit it's value from the start to the selection 
    179                         this._searchTa.style.width = taWidth + "px"; 
    180                         this._searchTa.style.height = taHeight + "px"; 
    181                         this._searchTa.value = text.substr(0, newSrStart); 
     176                        var taHeight = parseInt(this.we_ta.style.height, 10); 
     177 
     178                        // duplicate real textarea to we_searchTa but limit it's value from the start to the selection 
     179                        this.we_searchTa.style.width = taWidth + "px"; 
     180                        this.we_searchTa.style.height = taHeight + "px"; 
     181                        this.we_searchTa.value = text.substr(0, newSrStart); 
    182182 
    183183                        // the textarea has to scroll down? 
    184                         if (this._ta.scrollTop < this._searchTa.scrollHeight - taHeight) { 
     184                        if (this.we_ta.scrollTop < this.we_searchTa.scrollHeight - taHeight) { 
    185185                                this.addLog("scroll down"); 
    186                                 this._ta.scrollTop = this._searchTa.scrollHeight - taHeight; 
     186                                this.we_ta.scrollTop = this.we_searchTa.scrollHeight - taHeight; 
    187187                        } 
    188188 
    189189                        // the textarea has to scroll up? 
    190190                        var LINE_HEIGHT = 20; // TODO : hardcoded value : line height (approximatly 20px) 
    191                         this._searchTa.style.height = LINE_HEIGHT + "px"; 
    192                         if (this._ta.scrollTop > this._searchTa.scrollHeight - LINE_HEIGHT) { 
     191                        this.we_searchTa.style.height = LINE_HEIGHT + "px"; 
     192                        if (this.we_ta.scrollTop > this.we_searchTa.scrollHeight - LINE_HEIGHT) { 
    193193                                this.addLog("scroll up"); 
    194                                 this._ta.scrollTop = this._searchTa.scrollHeight - LINE_HEIGHT; 
     194                                this.we_ta.scrollTop = this.we_searchTa.scrollHeight - LINE_HEIGHT; 
    195195                        } 
    196196                } 
    197197 
    198198                // "replace all"? => loop again 
    199                 if ((this._replace) && (!this._prompt)) 
     199                if ((this.we_replace) && (!this.we_prompt)) 
    200200                        this.findNext(); 
    201201        } 
     
    213213        html += "<div style='position:absolute;left:479px;top:1px' onclick='varWikkaEdit.hideSearchWindow();'><img src='3rdparty/plugins/wikkaedit/images/close_window.png'></div>"; 
    214214 
    215         html += "<div style='position:absolute;left:10px;top:"+(y+10)+"px;width:480px;height:"+(this._replace?61:40)+"px;border:1px solid gray;-moz-border-radius:7px'></div>"; 
    216         html += "<div style='position:absolute;left:20px;top:"+y+"px;background-color:#f0f0ee;padding:0 3px 0 3px'><table border='0' cellspacing='0' cellpadding='0'><tr><td><input type='radio' id='sr_radio_search' name='sr_radio_sr' onclick='varWikkaEdit.srRadioSearchReplaceClick(this,false);'"+(this._replace?"":" checked")+"></td><td><label for='sr_radio_search'>Search</label></td><td width='10'></td><td><input type='radio' id='sr_radio_replace' name='sr_radio_sr' onclick='varWikkaEdit.srRadioSearchReplaceClick(this,true);'"+(this._replace?" checked":"")+"></td><td><label for='sr_radio_replace'>Replace</label></td></tr></table></div>"; 
     215        html += "<div style='position:absolute;left:10px;top:"+(y+10)+"px;width:480px;height:"+(this.we_replace?61:40)+"px;border:1px solid gray;-moz-border-radius:7px'></div>"; 
     216        html += "<div style='position:absolute;left:20px;top:"+y+"px;background-color:#f0f0ee;padding:0 3px 0 3px'><table border='0' cellspacing='0' cellpadding='0'><tr><td><input type='radio' id='sr_radio_search' name='sr_radio_sr' onclick='varWikkaEdit.srRadioSearchReplaceClick(this,false);'"+(this.we_replace?"":" checked")+"></td><td><label for='sr_radio_search'>Search</label></td><td width='10'></td><td><input type='radio' id='sr_radio_replace' name='sr_radio_sr' onclick='varWikkaEdit.srRadioSearchReplaceClick(this,true);'"+(this.we_replace?" checked":"")+"></td><td><label for='sr_radio_replace'>Replace</label></td></tr></table></div>"; 
    217217        html += "<div style='position:absolute;left:20px;top:"+(y+22)+"px'>"; 
    218218        html += "<table border='0' cellspacing='0' cellpadding='0'>"; 
    219         html += "<tr><td style='width:100px;white-space:nowrap;padding-right:5px'>Search for :</td><td><input type='text' id='sr_field_searchFor' style='width:250px' onchange='varWikkaEdit.srFieldSearchReplaceChange(this);'></td><td style='padding-left:8px'><input type='checkbox' id='sr_check_regexp' onclick='varWikkaEdit.srCheckboxClick(this);'" + (this._regexp ? " checked" : "") + " disabled></td><td><label for='sr_check_regexp' title='regular expression' style='color:grey'>regexp</label></td></tr>"; 
    220         if (this._replace) { 
     219        html += "<tr><td style='width:100px;white-space:nowrap;padding-right:5px'>Search for :</td><td><input type='text' id='sr_field_searchFor' style='width:250px' onchange='varWikkaEdit.srFieldSearchReplaceChange(this);'></td><td style='padding-left:8px'><input type='checkbox' id='sr_check_regexp' onclick='varWikkaEdit.srCheckboxClick(this);'" + (this.we_regexp ? " checked" : "") + " disabled></td><td><label for='sr_check_regexp' title='regular expression' style='color:grey'>regexp</label></td></tr>"; 
     220        if (this.we_replace) { 
    221221                html += "<tr><td style='white-space:nowrap;padding-right:5px'>Replace with :</td><td><input type='text' id='sr_field_replaceWith' style='width:250px' onchange='varWikkaEdit.srFieldSearchReplaceChange(this);'></td><td></td><td></td></tr>"; 
    222222        } 
     
    228228        html += "<div style='position:absolute;left:20px;top:"+(y+49)+"px;background-color:#f0f0ee;padding:0 3px 0 3px'>Options</div>"; 
    229229 
    230         html += "<div style='position:absolute;left:20px;top:"+(y+65)+"px'><table border='0' cellspacing='0' cellpadding='0'><tr><td><input type='checkbox' id='sr_check_case' onclick='varWikkaEdit.srCheckboxClick(this);'" + (this._case ? " checked" : "") + "></td><td><label for='sr_check_case'>case sensitive</label></td></tr></table></div>"; 
    231  
    232         html += "<div style='position:absolute;left:20px;top:"+(y+80)+"px'><table border='0' cellspacing='0' cellpadding='0'><tr><td><input type='checkbox' id='sr_check_whole' onclick='varWikkaEdit.srCheckboxClick(this);'" + (this._whole ? " checked" : "") + "></td><td><label for='sr_check_whole'>whole word</label></td></tr></table></div>"; 
    233  
    234         html += "<div style='position:absolute;left:190px;top:"+(y+65)+"px'><table border='0' cellspacing='0' cellpadding='0'><tr><td><input type='checkbox' id='sr_check_cursor' onclick='varWikkaEdit.srCheckboxClick(this);'" + (this._cursor ? " checked" : "") + "></td><td><label for='sr_check_cursor'>from cursor</label></td></tr></table></div>"; 
    235  
    236         html += "<div style='position:absolute;left:190px;top:"+(y+80)+"px'><table border='0' cellspacing='0' cellpadding='0'><tr><td><input type='checkbox' id='sr_check_reverse' onclick='varWikkaEdit.srCheckboxClick(this);'" + (this._reverse ? " checked" : "") + "></td><td><label for='sr_check_reverse'>reverse search</label></td></tr></table></div>"; 
    237  
    238         if (this._replace) 
    239                 html += "<div style='position:absolute;left:360px;top:"+(y+65)+"px'><table border='0' cellspacing='0' cellpadding='0'><tr><td><input type='checkbox' id='sr_check_prompt' onclick='varWikkaEdit.srCheckboxClick(this);'" + (this._prompt ? " checked" : "") + "></td><td><label for='sr_check_prompt'>prompt</label></td></tr></table></div>"; 
    240  
    241         var titleBtnOk = (!this._replace ? "Find next" : (this._prompt ? "Replace" : "Replace all")); 
     230        html += "<div style='position:absolute;left:20px;top:"+(y+65)+"px'><table border='0' cellspacing='0' cellpadding='0'><tr><td><input type='checkbox' id='sr_check_case' onclick='varWikkaEdit.srCheckboxClick(this);'" + (this.we_case ? " checked" : "") + "></td><td><label for='sr_check_case'>case sensitive</label></td></tr></table></div>"; 
     231 
     232        html += "<div style='position:absolute;left:20px;top:"+(y+80)+"px'><table border='0' cellspacing='0' cellpadding='0'><tr><td><input type='checkbox' id='sr_check_whole' onclick='varWikkaEdit.srCheckboxClick(this);'" + (this.we_whole ? " checked" : "") + "></td><td><label for='sr_check_whole'>whole word</label></td></tr></table></div>"; 
     233 
     234        html += "<div style='position:absolute;left:190px;top:"+(y+65)+"px'><table border='0' cellspacing='0' cellpadding='0'><tr><td><input type='checkbox' id='sr_check_cursor' onclick='varWikkaEdit.srCheckboxClick(this);'" + (this.we_cursor ? " checked" : "") + "></td><td><label for='sr_check_cursor'>from cursor</label></td></tr></table></div>"; 
     235 
     236        html += "<div style='position:absolute;left:190px;top:"+(y+80)+"px'><table border='0' cellspacing='0' cellpadding='0'><tr><td><input type='checkbox' id='sr_check_reverse' onclick='varWikkaEdit.srCheckboxClick(this);'" + (this.we_reverse ? " checked" : "") + "></td><td><label for='sr_check_reverse'>reverse search</label></td></tr></table></div>"; 
     237 
     238        if (this.we_replace) 
     239                html += "<div style='position:absolute;left:360px;top:"+(y+65)+"px'><table border='0' cellspacing='0' cellpadding='0'><tr><td><input type='checkbox' id='sr_check_prompt' onclick='varWikkaEdit.srCheckboxClick(this);'" + (this.we_prompt ? " checked" : "") + "></td><td><label for='sr_check_prompt'>prompt</label></td></tr></table></div>"; 
     240 
     241        var titleBtnOk = (!this.we_replace ? "Find next" : (this.we_prompt ? "Replace" : "Replace all")); 
    242242        html += "<div style='position:absolute;left:308px;top:"+(y+107)+"px'><input type='button' value='" + titleBtnOk + "' onclick='varWikkaEdit.srBtnFindNextClick();' style='width:90px'></div>"; 
    243243        html += "<div style='position:absolute;left:402px;top:"+(y+107)+"px'><input type='button' value='Cancel' onclick='varWikkaEdit.srBtnCancelClick();' style='width:90px'></div>"; 
    244244 
    245         html += "<div style='position:absolute;left:20px;top:"+(y+107)+"px;color:red'>" + this._lastMsg + "</div>"; 
     245        html += "<div style='position:absolute;left:20px;top:"+(y+107)+"px;color:red'>" + this.we_lastMsg + "</div>"; 
    246246 
    247247        html += "</div>"; 
     
    249249        //html += "</form>"; 
    250250 
    251         this._lastMsg = ""; 
    252  
    253         this._search.innerHTML = html; 
    254         document.getElementById("sr_field_searchFor").value = this._searchFor; 
     251        this.we_lastMsg = ""; 
     252 
     253        this.we_search.innerHTML = html; 
     254        document.getElementById("sr_field_searchFor").value = this.we_searchFor; 
    255255        document.getElementById("sr_field_searchFor").onkeypress = varWikkaEdit.srFieldSearchReplaceKeyPress; 
    256         if (this._replace) { 
    257                 document.getElementById("sr_field_replaceWith").value = this._replaceWith; 
     256        if (this.we_replace) { 
     257                document.getElementById("sr_field_replaceWith").value = this.we_replaceWith; 
    258258                document.getElementById("sr_field_replaceWith").onkeypress = varWikkaEdit.srFieldSearchReplaceKeyPress; 
    259259        } 
    260         this._search.style.visibility = ""; 
     260        this.we_search.style.visibility = ""; 
    261261        document.getElementById("sr_field_searchFor").select(); 
    262262 
     
    301301// ===== hide search & replace window ===== 
    302302WikkaEdit.prototype.hideSearchWindow = function() { 
    303         this._search.style.visibility = "hidden"; 
     303        this.we_search.style.visibility = "hidden"; 
    304304 
    305305        // re-enable the "enter" key 
     
    313313        //document.onkeydown = ""; 
    314314 
    315         this._ta.focus(); 
    316 } 
     315        this.we_ta.focus(); 
     316}