Вход Регистрация
Файл: upload/admin/view/javascript/ckeditor/plugins/codemirror/js/util/xml-hint.js
Строк: 70
<?php
(function() {

    
CodeMirror.xmlHints = [];

    
CodeMirror.xmlHint = function(cmsimbol) {

        if(
simbol.length 0) {
            var 
cursor cm.getCursor();
            
cm.replaceSelection(simbol);
            
cursor = {linecursor.linechcursor.ch 1};
            
cm.setCursor(cursor);
        }

        
CodeMirror.simpleHint(cmgetHint);
    };

    var 
getHint = function(cm) {

        var 
cursor cm.getCursor();

        if (
cursor.ch 0) {

            var 
text cm.getRange({line0ch0}, cursor);
            var 
typed '';
            var 
simbol '';
            for(var 
text.length 1>= 0i--) {
                if(
text[i] == ' ' || text[i] == '<') {
                    
simbol text[i];
                    break;
                }
                else {
                    
typed text[i] + typed;
                }
            }

            
text text.slice(0text.length typed.length);

            var 
path getActiveElement(text) + simbol;
            var 
hints CodeMirror.xmlHints[path];

            if(
typeof hints === 'undefined')
                
hints = [''];
            else {
                
hints hints.slice(0);
                for (var 
hints.length 1>= 0i--) {
                    if(
hints[i].indexOf(typed) != 0)
                        
hints.splice(i1);
                }
            }

            return {
                list: 
hints,
                
from: { linecursor.linechcursor.ch typed.length },
                
tocursor
            
};
        };
    };

    var 
getActiveElement = function(text) {

        var 
element '';

        if(
text.length >= 0) {

            var 
regex = new RegExp('<([^!?][^\s/>]*).*?>''g');

            var 
matches = [];
            var 
match;
            while ((
match regex.exec(text)) != null) {
                
matches.push({
                    
tagmatch[1],
                    
selfclose: (match[0].slice(match[0].length 2) === '/>')
                });
            }

            for (var 
matches.length 1skip 0>= 0i--) {

                var 
item matches[i];

                if (
item.tag[0] == '/')
                {
                    
skip++;
                }
                else if (
item.selfclose == false)
                {
                    if (
skip 0)
                    {
                        
skip--;
                    }
                    else
                    {
                        
element '<' item.tag '>' element;
                    }
                }
            }

            
element += getOpenTag(text);
        }

        return 
element;
    };

    var 
getOpenTag = function(text) {

        var 
open text.lastIndexOf('<');
        var 
close text.lastIndexOf('>');

        if (
close open)
        {
            
text text.slice(open);

            if(
text != '<') {

                var 
space text.indexOf(' ');
                if(
space 0)
                    
space text.indexOf('t');
                if(
space 0)
                    
space text.indexOf('n');

                if (
space 0)
                    
space text.length;

                return 
text.slice(0space);
            }
        }

        return 
'';
    };

})();
?>
Онлайн: 0
Реклама