⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 kindeditor.js

📁 Follow me超级搜索引擎V6.2(完美版)绝对是目前全国功能最优秀的超级搜索引擎之一 全国已超过1000个网站和超过100家网吧正在使用本程序 (6.3和6.2功能上变化不大,但修复了很
💻 JS
📖 第 1 页 / 共 5 页
字号:
        img.onclick = new Function("KE.layout.hide('" + id + "')");        titleDiv.appendChild(img);        KE.util.drag(id, titleDiv, div, function(objTop, objLeft, objWidth, objHeight, top, left) {            div.style.top = (objTop + top) + 'px';            div.style.left = (objLeft + left) + 'px';        });        div.appendChild(titleDiv);        var bodyDiv = KE.$$('div');        bodyDiv.className = 'ke-dialog-body';        var dialog = KE.$$('iframe');        if (arg.useFrameCSS) {            dialog.className = 'ke-dialog-iframe';        }        dialog.width = arg.width + 'px';        dialog.height = arg.height + 'px';        dialog.setAttribute("frameBorder", "0");        bodyDiv.appendChild(dialog);        div.appendChild(bodyDiv);        var bottomDiv = KE.$$('div');        bottomDiv.className = 'ke-dialog-bottom';        var noButton = null;        var yesButton = null;        var previewButton = null;        if (arg.noButton) {            noButton = KE.$$('input');            noButton.className = 'ke-dialog-no';            noButton.type = 'button';            noButton.name = 'noButton';            noButton.value = arg.noButton;            noButton.onclick = new Function("KE.layout.hide('" + id + "')");            bottomDiv.appendChild(noButton);        }        if (arg.yesButton) {            yesButton = KE.$$('input');            yesButton.className = 'ke-dialog-yes';            yesButton.type = 'button';            yesButton.name = 'yesButton';            yesButton.value = arg.yesButton;            yesButton.onclick = new Function("KE.plugin['" + arg.cmd  + "'].exec('" + id + "')");            bottomDiv.appendChild(yesButton);        }        if (arg.previewButton) {            previewButton = KE.$$('input');            previewButton.className = 'ke-dialog-preview';            previewButton.type = 'button';            previewButton.name = 'previewButton';            previewButton.value = arg.previewButton;            previewButton.onclick = new Function("KE.plugin['" + arg.cmd  + "'].preview('" + id + "')");            bottomDiv.appendChild(previewButton);        }        div.appendChild(bottomDiv);        KE.layout.show(id, div);        window.focus();        if (yesButton) yesButton.focus();        else if (noButton) noButton.focus();        if (typeof arg.html != "undefined") {            var dialogDoc = KE.util.getIframeDoc(dialog);            var html = KE.util.getFullHtml(id);            dialogDoc.open();            dialogDoc.write(html);            dialogDoc.close();            dialogDoc.body.innerHTML = arg.html;        } else {            dialog.src = KE.g[id].pluginsPath + arg.cmd + '.html';        }        KE.g[id].maskDiv.style.width = KE.util.getDocumentWidth() + 'px';        KE.g[id].maskDiv.style.height = KE.util.getDocumentHeight() + 'px';        KE.g[id].maskDiv.style.display = 'block';        KE.g[id].dialog = dialog;        KE.g[id].noButton = noButton;        KE.g[id].yesButton = yesButton;        KE.g[id].previewButton = previewButton;    };};KE.toolbar = {    able : function(id, arr) {        KE.each(KE.g[id].toolbarIcon, function(cmd, obj) {            if (!KE.util.inArray(cmd, arr)) {                obj.className = 'ke-icon';                KE.util.setOpacity(obj, 100);                obj.onmouseover = function(){ this.className = "ke-icon-selected"; };                obj.onmouseout = function(){ this.className = "ke-icon"; };                obj.onclick = new Function('KE.util.click("' + id + '", "' + cmd + '")');            }        });    },    disable : function(id, arr) {        KE.each(KE.g[id].toolbarIcon, function(cmd, obj) {            if (!KE.util.inArray(cmd, arr)) {                obj.className = 'ke-icon-disabled';                KE.util.setOpacity(obj, 50);                obj.onmouseover = null;                obj.onmouseout = null;                obj.onclick = null;            }        });    },    create : function(id) {        KE.g[id].toolbarIcon = [];        var toolbar = KE.$$('table');        toolbar.oncontextmenu = function() { return false; };        toolbar.onmousedown = function() { return false; };        toolbar.onmousemove = function() { return false; };        toolbar.className = 'ke-toolbar';        toolbar.cellPadding = 0;        toolbar.cellSpacing = 0;        toolbar.border = 0;        var row = toolbar.insertRow(0);        var toolbarCell = row.insertCell(0);        toolbarCell.style.padding = 0;        toolbarCell.style.margin = 0;        toolbarCell.style.border = 0;        var length = KE.g[id].items.length;        var cellNum = 0;        var row;        for (var i = 0; i < length; i++) {            var cmd = KE.g[id].items[i];            if (i == 0 || cmd == '-') {                var table = KE.$$('table');                table.cellPadding = 0;                table.cellSpacing = 0;                table.border = 0;                table.className = 'ke-toolbar-table';                row = table.insertRow(0);                cellNum = 0;                toolbarCell.appendChild(table);                if (cmd == '-') continue;            }            var cell = row.insertCell(cellNum);            cellNum++;            var obj = KE.$$('img');            obj.src = KE.g[id].skinsPath + 'spacer.gif';            if (KE.util.inArray(cmd, KE.g[id].defaultItems)) {                var url = KE.g[id].skinsPath + KE.g[id].skinType + '.gif';                obj.style.backgroundImage = "url(" + url + ")";            }            obj.className = "ke-common-icon ke-icon-" + cmd;            obj.alt = KE.lang[cmd];            cell.className = 'ke-icon';            cell.title = KE.lang[cmd];            cell.onmouseover = function(){ this.className = "ke-icon-selected"; };            cell.onmouseout = function(){ this.className = "ke-icon"; };            cell.onclick = new Function('KE.util.click("' + id + '", "' + cmd + '")');            cell.appendChild(obj);            KE.g[id].toolbarIcon[cmd] = cell;        }        return toolbar;    }};KE.history = {    add : function(id, minChangeFlag) {        var obj = KE.g[id];        var html = KE.util.getData(id, false);        if (obj.undoStack.length > 0) {            var prevHtml = obj.undoStack[obj.undoStack.length - 1];            if (html == prevHtml) return;            if (minChangeFlag && Math.abs(html.length - prevHtml.length) < obj.minChangeSize) return;        }        obj.undoStack.push(html);        obj.redoStack = [];    },    undo : function(id) {        var obj = KE.g[id];        if (obj.undoStack.length == 0) return;        var html = KE.util.getData(id, false);        obj.redoStack.push(html);        var prevHtml = obj.undoStack.pop();        if (html == prevHtml && obj.undoStack.length > 0) {            prevHtml = obj.undoStack.pop();        }        obj.iframeDoc.body.innerHTML = prevHtml;        obj.newTextarea.value = prevHtml;    },    redo : function(id) {        var obj = KE.g[id];        if (obj.redoStack.length == 0) return;        var html = KE.util.getData(id, false);        obj.undoStack.push(html);        var nextHtml = obj.redoStack.pop();        obj.iframeDoc.body.innerHTML = nextHtml;        obj.newTextarea.value = nextHtml;    }};KE.remove = function(id, mode) {    mode = (typeof mode == "undefined") ? 0 : mode;    var container = KE.g[id].container;    if (mode == 1) {        document.body.removeChild(container);    } else {        var srcTextarea = KE.$(id);        srcTextarea.parentNode.removeChild(container);    }    document.body.removeChild(KE.g[id].hideDiv);    document.body.removeChild(KE.g[id].maskDiv);    KE.g[id].containner = null;};KE.create = function(id, mode) {    if (KE.browser == 'IE') try { document.execCommand('BackgroundImageCache', false, true); }catch(e){}    var srcTextarea = KE.$(id);    mode = (typeof mode == "undefined") ? 0 : mode;    if (mode == 0 && KE.g[id].container != null) return;    var width = srcTextarea.style.width;    var height = srcTextarea.style.height;    var container = KE.$$('div');    container.className = 'ke-container';    container.style.width = width;    container.style.height = height;    if (mode == 1) document.body.appendChild(container);    else srcTextarea.parentNode.insertBefore(container, srcTextarea);    var toolbarDiv = KE.toolbar.create(id);    container.appendChild(toolbarDiv);    var iframe = KE.$$('iframe');    iframe.className = 'ke-iframe';    iframe.setAttribute("frameBorder", "0");    var newTextarea = KE.$$('textarea');    newTextarea.className = 'ke-textarea';    newTextarea.style.display = 'none';    var formDiv = KE.$$('div');    formDiv.className = 'ke-form';    formDiv.appendChild(iframe);    formDiv.appendChild(newTextarea);    container.appendChild(formDiv);    var bottom = KE.$$('table');    bottom.className = 'ke-bottom';    bottom.cellPadding = 0;    bottom.cellSpacing = 0;    bottom.border = 0;    var row = bottom.insertRow(0);    var bottomLeft = row.insertCell(0);    bottomLeft.className = 'ke-bottom-left';    var bottomRight = row.insertCell(1);    bottomRight.className = 'ke-bottom-right';    var img = KE.$$('img');    img.className = 'ke-bottom-right-img';    img.src = KE.g[id].skinsPath + 'spacer.gif';    bottomRight.appendChild(img);    container.appendChild(bottom);    var hideDiv = KE.$$('div');    hideDiv.style.display = 'none';    var maskDiv = KE.$$('div');    maskDiv.className = 'ke-mask';    KE.util.setOpacity(maskDiv, 50);    document.body.appendChild(hideDiv);    document.body.appendChild(maskDiv);    srcTextarea.style.display = "none";    KE.util.setDefaultPlugin(id);    var iframeWin = iframe.contentWindow;    var iframeDoc = KE.util.getIframeDoc(iframe);    iframeDoc.designMode = "On";    var html = KE.util.getFullHtml(id);    iframeDoc.open();    iframeDoc.write(html);    iframeDoc.close();    if (!KE.g[id].wyswygMode) {        newTextarea.value = srcTextarea.value;        newTextarea.style.display = 'block';        iframe.style.display = 'none';        KE.toolbar.disable(id, ['source', 'preview', 'fullscreen']);    }    if (KE.g[id].autoOnsubmitMode) {        var form = srcTextarea.parentNode;        while (form != null && form.tagName != 'FORM') { form = form.parentNode; }        if (form != null && form.tagName == 'FORM') {            KE.event.add(form, 'submit', new Function('KE.util.setData("' + id + '")'));        }    }    KE.event.add(iframeDoc, 'click', new Function('KE.layout.hide("' + id + '")'));    KE.event.add(newTextarea, 'click', new Function('KE.layout.hide("' + id + '")'));    KE.event.add(iframeDoc, 'keyup', new Function('KE.history.add("' + id + '", true)'));    KE.event.add(newTextarea, 'keyup', new Function('KE.history.add("' + id + '", true)'));    KE.g[id].container = container;    KE.g[id].toolbarDiv = toolbarDiv;    KE.g[id].formDiv = formDiv;    KE.g[id].iframe = iframe;    KE.g[id].newTextarea = newTextarea;    KE.g[id].srcTextarea = srcTextarea;    KE.g[id].bottom = bottom;    KE.g[id].hideDiv = hideDiv;    KE.g[id].maskDiv = maskDiv;    KE.g[id].iframeWin = iframeWin;    KE.g[id].iframeDoc = iframeDoc;    width = container.offsetWidth;    height = container.offsetHeight;    KE.g[id].width = width + 'px';    KE.g[id].height = height + 'px';    KE.util.resize(id, width, height);    KE.util.drag(id, bottomRight, container, function(objTop, objLeft, objWidth, objHeight, top, left) {        if (KE.g[id].resizeMode == 2) KE.util.resize(id, objWidth + left, objHeight + top);        else if (KE.g[id].resizeMode == 1) KE.util.resize(id, objWidth, objHeight + top);    });    KE.util.drag(id, bottomLeft, container, function(objTop, objLeft, objWidth, objHeight, top, left) {        KE.util.resize(id, objWidth, objHeight + top);    });    if (!KE.g[id].resizeMode) KE.util.hideBottom(id);    setTimeout(        function(){            if (srcTextarea.value) iframeDoc.body.innerHTML = srcTextarea.value;            KE.history.add(id, false);        }, 1);};KE.version = '3.1';KE.scriptPath = KE.util.getScriptPath();KE.htmlPath = KE.util.getHtmlPath();KE.browser = KE.util.getBrowser();KE.plugin = {};KE.g = {};KE.init = function(config) {    config.wyswygMode = (typeof config.wyswygMode == "undefined") ? true : config.wyswygMode;    config.autoOnsubmitMode = (typeof config.autoOnsubmitMode == "undefined") ? true : config.autoOnsubmitMode;    config.resizeMode = (typeof config.resizeMode == "undefined") ? 2 : config.resizeMode;    config.filterMode = (typeof config.filterMode == "undefined") ? true : config.filterMode;    config.skinType = config.skinType || 'default';    config.cssPath = config.cssPath || '';    config.skinsPath = config.skinsPath || KE.scriptPath + 'skins/';    config.pluginsPath = config.pluginsPath || KE.scriptPath + 'plugins/';    config.minWidth = config.minWidth || 200;    config.minHeight = config.minHeight || 100;    config.minChangeSize = config.minChangeSize || 5;    config.siteDomains = config.siteDomains || [];    var defaultItems = [        'source', 'preview', 'fullscreen', 'undo', 'redo', 'print', 'cut', 'copy', 'paste',        'plainpaste', 'wordpaste', 'justifyleft', 'justifycenter', 'justifyright',        'justifyfull', 'insertorderedlist', 'insertunorderedlist', 'indent', 'outdent', 'subscript',        'superscript', 'date', 'time', '-',        'title', 'fontname', 'fontsize', 'textcolor', 'bgcolor', 'bold',        'italic', 'underline', 'strikethrough', 'removeformat', 'selectall', 'image',        'flash', 'media', 'layer', 'table', 'specialchar', 'hr',        'emoticons', 'link', 'unlink', 'about'    ];    config.defaultItems = defaultItems;    config.items = config.items || defaultItems;    var defaultHtmlTags = {        'font' : ['color', 'size', 'face', '.background-color'],        'span' : ['.color', '.background-color', '.font-size', '.font-family', '.font-weight', '.font-style', '.text-decoration', '.vertical-align'],        'div' : ['class', 'align', '.border', '.margin', '.padding', '.text-align', '.color', '.background-color', '.font-size', '.font-family', '.font-weight', '.font-style', '.text-decoration', '.vertical-align'],

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -