preview.js

来自「PHP 知识管理系统(基于树结构的知识管理系统), 英文原版的PHP源码。」· JavaScript 代码 · 共 73 行

JS
73
字号
/*    Create the preview / info box using an ExtJS Dialog window*/var showInfo = function(iDocId, sUrl, sDir, loading){    // Create the info box container div    createPanel();    showIcon = Ext.get('box_'+iDocId);    dialog = new Ext.Window({            el: 'info-dlg',            closeAction: 'destroy',            layout: 'fit',            shadow: false,            modal: true,            plain: false,            width: 500,            height: 360,            minWidth: 300,            minHeight: 250    });    dialog.show(showIcon.dom);    var info = document.getElementById('info-preview');    info.innerHTML = loading;    Ext.Ajax.request({        url: sUrl,        success: function(response) {            info.innerHTML = response.responseText;        },        failure: function(response) {            alert('Error. Couldn\'t create info box.');        },        params: {            fDocumentId: iDocId,            kt_dir: sDir        }    });}/*    Create the container div's in which the info box will be created.    Add the div's required by the ExtJS dialog box.*/var createPanel = function() {    if(document.getElementById('info-panel')){        destroyPanel();        p = document.getElementById('info-panel');        p.style.display = 'block';    }else{        p = document.getElementById('pageBody').appendChild(document.createElement('div'));        p.id = 'info-panel';    }    b = p.appendChild(document.createElement('div'));    b.id = 'info-dlg';    b.innerHTML = '<div class="x-window-header">Info Panel</div><div class="x-window-body"><div id="info-preview"></div></div>';}/*    Set the container div to empty.    The display must be set to none for IE, otherwise the icons under the div aren't clickable.*/var destroyPanel = function() {    if(dialog){        dialog.destroy();    }    p = document.getElementById('info-panel');    p.innerHTML = '';    p.style.display = 'none';}

⌨️ 快捷键说明

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