Вход Регистрация
Файл: usr/plugins/htmleditor/plugins/searchreplace/js/searchreplace.js
Строк: 125
<?php
tinyMCEPopup
.requireLangPack();

var 
SearchReplaceDialog = {
    
init : function(ed) {
        var 
document.forms[0], tinyMCEPopup.getWindowArg("mode");

        
this.switchMode(m);

        
f['_panel_searchstring'].value tinyMCEPopup.getWindowArg("search_string");

        
// Focus input field
        
f['_panel_searchstring'].focus();
    },

    
switchMode : function(m) {
        var 
flm this.lastMode;

        if (
lm != m) {
            
document.forms[0];

            if (
lm) {
                
f['_panel_searchstring'].value f[lm '_panel_searchstring'].value;
                
f['_panel_backwardsu'].checked f[lm '_panel_backwardsu'].checked;
                
f['_panel_backwardsd'].checked f[lm '_panel_backwardsd'].checked;
                
f['_panel_casesensitivebox'].checked f[lm '_panel_casesensitivebox'].checked;
            }

            
mcTabs.displayTab('_tab',  '_panel');
            
document.getElementById("replaceBtn").style.display = (== "replace") ? "inline" "none";
            
document.getElementById("replaceAllBtn").style.display = (== "replace") ? "inline" "none";
            
this.lastMode m;
        }
    },

    
searchNext : function(a) {
        var 
ed tinyMCEPopup.editorse ed.selectionse.getRng(), fthis.lastModesbfl 0ed.getWin(), wm ed.windowManagerfo 0;

        
// Get input
        
document.forms[0];
        
f['_panel_searchstring'].value;
        
f['_panel_backwardsu'].checked;
        
ca f['_panel_casesensitivebox'].checked;
        
rs f['replace_panel_replacestring'].value;

        if (
== '')
            return;

        function 
fix() {
            
// Correct Firefox graphics glitches
            
se.getRng().cloneRange();
            
ed.getDoc().execCommand('SelectAll'falsenull);
            
se.setRng(r);
        };

        function 
replace() {
            if (
tinymce.isIE)
                
ed.selection.getRng().duplicate().pasteHTML(rs); // Needs to be duplicated due to selection bug in IE
            
else
                
ed.getDoc().execCommand('InsertHTML'falsers);
        };

        
// IE flags
        
if (ca)
            
fl fl 4;

        switch (
a) {
            case 
'all':
                
// Move caret to beginning of text
                
ed.execCommand('SelectAll');
                
ed.selection.collapse(true);

                if (
tinymce.isIE) {
                    while (
r.findText(s? -1fl)) {
                        
r.scrollIntoView();
                        
r.select();
                        
replace();
                        
fo 1;

                        if (
b) {
                            
r.moveEnd("character", -(rs.length)); // Otherwise will loop forever
                        
}
                    }

                    
tinyMCEPopup.storeSelection();
                } else {
                    while (
w.find(scabfalsefalsefalsefalse)) {
                        
replace();
                        
fo 1;
                    }
                }

                if (
fo)
                    
tinyMCEPopup.alert(ed.getLang('searchreplace_dlg.allreplaced'));
                else
                    
tinyMCEPopup.alert(ed.getLang('searchreplace_dlg.notfound'));

                return;

            case 
'current':
                if (!
ed.selection.isCollapsed())
                    
replace();

                break;
        }

        
se.collapse(b);
        
se.getRng();

        
// Whats the point
        
if (!s)
            return;

        if (
tinymce.isIE) {
            if (
r.findText(s? -1fl)) {
                
r.scrollIntoView();
                
r.select();
            } else
                
tinyMCEPopup.alert(ed.getLang('searchreplace_dlg.notfound'));

            
tinyMCEPopup.storeSelection();
        } else {
            if (!
w.find(scabfalsefalsefalsefalse))
                
tinyMCEPopup.alert(ed.getLang('searchreplace_dlg.notfound'));
            else
                
fix();
        }
    }
};

tinyMCEPopup.onInit.add(SearchReplaceDialog.initSearchReplaceDialog);
?>
Онлайн: 3
Реклама