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

📄 templet.js

📁 WAPmo手机网站管理平台是一款创建与管理维护WAP网站的的软件产品
💻 JS
📖 第 1 页 / 共 4 页
字号:
        }
        break;
    case "BackStaple":
    case "BackTheme":
    case "BackHome":
    case "Publish":
    case "BackCategory":
        val = val.Split(/##/g);
        if (val.length >= 2)
        {
            ret += "图片前缀:" + (val[0].toInteger() == 1 ? "是" : "否") + "\r\n";
            ret += "连接标题:" + val[1] + "\r\n";
        }
        break;
    case "SMSHint":
        ret += "提示语:" + val;
        break;
    case "ContentRemark":
        val = val.Split(/##/g);
        if (val.length >= 2)
        {
            ret += "输出条数:" + val[0] + "\r\n";
            ret += "快捷表单:" + (val[1].toInteger() == 1 ? "是" : "否") + "\r\n";
        }
        break;
    case "Online":
        val = val.Split(/##/g);
        if (val.length >= 2)
        {
            ret += "输出人数:" + (val[0].toInteger() == 0 ? "所有" : val[0]) + "\r\n";
            ret += "间隔字符:" + val[1] + "\r\n";
        }
        break;
    case "Form":
        val = val.Split(/##/g);
        if (val.length >= 4)
        {
            ret += "目标地址:" + val[0] + "\r\n";
            ret += "提交方式:" + val[1] + "\r\n";
            ret += "提交类型:" + val[2] + "\r\n";
            for (var i = 3; i < val.length; i ++)
            {
                val[i] = val[i].Split(/\|\|/g);
                for (var k = 0; k < val[i].length; k++)
                {
                    val[i][k] = val[i][k].Split(/&&/g);
                    ret += "元素" + k + ":";
                    ret += "名称[" + val[i][k][0] + "],";
                    ret += "类型[" + core.getFormType(val[i][k][1]) + "],";
                    ret += "默认值[" + val[i][k][2] + "],";
                    ret += "前缀[" + val[i][k][3] + "],";
                    ret += "后缀[" + val[i][k][4] + "],";
                    ret += "换行[" + (val[i][k][5].toInteger() == 0 ? "否" : "是") + "]";
                    ret += "长度[" + val[i][k][6].toInteger() + "]";
                    ret += "尺寸[" + val[i][k][7].toInteger() + "]";
                    ret += "格式[" + val[i][k][8] + "]";
                    ret += "\r\n";
                }
            }
        }
        break;
    case "Staples1":
        val = val.Split(/##/g);
        if (val.length >= 4)
        {
            ret += "指定栏目:" + (val[0] == 0 ? "当前栏目" : core.getStapleTitle(val[0])) + "\r\n";
            ret += "栏目间隔:" + val[1] + "\r\n";
            ret += "标题后缀:" + val[2] + "\r\n";
            ret += "输出个数:" + val[3] + "\r\n";
        }
        break;
    case "Contents1":
        val = val.Split(/##/g);
        if (val.length >= 7)
        {
            ret += "前缀类型:" + core.getPrefixType(val[0]) + "\r\n";
            ret += "内容前缀:" + core.getPrefixContent(val[0], val[1]) + "\r\n";
            ret += "内容后缀:" + val[2] + "\r\n";
            ret += "附图显示:" + (val[3].toInteger() == 1 ? "是" : "否") + "\r\n";
            ret += "显示个数:" + val[4] + "\r\n";
            ret += "标题间隔:" + val[5] + "\r\n";
            ret += "标题字节:" + val[6] + "\r\n";
        }
        break;
    case "Contentx1":
        val = val.Split(/##/g);
        if (val.length >= 10)
        {
            var prt = core.getStapleTitle(val[2]);
            if (prt == "")
            {
                prt = (val[2] == "x" ? "所有栏目" : "当前栏目");
            }
            ret += "内容类型:" + core.getContentType(val[0]) + "\r\n";
            ret += "内容条数:" + val[1] + "\r\n";
            ret += "所属栏目:" + prt + "\r\n";
            ret += "前缀类型:" + core.getPrefixType(val[3]) + "\r\n";
            ret += "内容前缀:" + core.getPrefixContent(val[3], val[4]) + "\r\n";
            ret += "内容后缀:" + val[5] + "\r\n";
            ret += "附图显示:" + (val[6].toInteger() == 1 ? "是" : "否") + "\r\n";
            ret += "显示个数:" + val[7] + "\r\n";
            ret += "标题间隔:" + val[8] + "\r\n";
            ret += "标题字节:" + val[9] + "\r\n";
        }
        break;
    }
    for (var i = 0; i < Kernel.env.length; i++)
    {
        var tmp = Kernel.env[i][2].replace(/\//g, "\\/");
        tmp = tmp.replace(/\$/g, "\\$");
        tmp = tmp.replace(/\(/g, "\\(");
        tmp = tmp.replace(/\)/g, "\\)");
        var reg = eval("/" + tmp + "/g");
        ret = ret.replace(reg, "$(变量::" + Kernel.env[i][0] + ")");
    }
    return(ret);
};

Templet.callEdit = function(ev)
{
    var core = Templet;
    if (atol(core.locked.getAttribute("type")) == core.TYPE_VALID)
    {
        callAPI(ev);
    }
};

Templet.callDelete = function()
{
    var core = Templet;
    core.locked.setAttribute("type", core.TYPE_INVALID);
    core.locked.setAttribute("API", null);
    core.locked.setAttribute("value", null);
    core.locked.innerText = "";
};

Templet.createItem = function(_id, _img, _text, _func, _api)
{
    var objDiv = document.createElement("DIV");
    objDiv.id = _id;
    objDiv.style.height = "24px";
    objDiv.style.fontSize = "12px";
    objDiv.style.fontFamily = "Arial";
    objDiv.style.cursor = "default";
    objDiv.noWrap = true;
    objDiv.title = _text;
    objDiv.onmouseover = function()
    {
        this.style.backgroundColor = "#FFCC99";
    };
    objDiv.onmouseout = function()
    {
        this.style.backgroundColor = "";
    };
    objDiv.innerHTML = "<img src=\"images/" + _img + "\" border=\"0\" align=\"absBottom\" /> " + _text;
    objDiv.onclick =  _func;
    objDiv.selectable = false;
    if (_api != null) objDiv.setAttribute("API", _api);
    return(objDiv);
};

Templet.createLine = function(varPtr)
{
    var obj = document.createElement("HR");
    obj.disabled = true;
    return(obj);
};

Templet.callControlMenu = function(ev)
{
    var core = this;
    var ee = window.event || ev;
    core.hiddenMenu();
    core.hiddenHead();
    core.hiddenAlign();
    core.hiddenHint();
    var et = ee.srcElement;
    var x = ee.clientX;
    var y = ee.clientY;
    var objDiv = document.getElementById("_control_");
    if (objDiv == null)
    {
        objDiv = document.createElement("DIV");
        document.body.appendChild(objDiv);
        objDiv.id = "_control_";
        objDiv.style.position = "absolute";
        objDiv.style.width = "100px";
        objDiv.style.border = "1px solid #000000";
        objDiv.style.backgroundColor = "#FFFFFF";
        objDiv.style.padding = "2px";
        core.createControl(objDiv);
    }
    objDiv.style.display = "";
    var _w = 100 + (jspp.isIE ? 0 : 6);
    if (x + _w > document.body.clientWidth)
    {
        objDiv.style.left = document.body.scrollLeft + x - _w;
    }
    else
    {
        objDiv.style.left = document.body.scrollLeft + x;
    }
    objDiv.style.top = document.body.scrollTop + y;
};

Templet.createControl = function(objParent)
{
    var core = this;
    objParent.appendChild(core.createItem("ID_CONTROL_0", "xw_open0.gif", "打开模版", function()
    {
        Templet.callOpen();
    }));
    objParent.appendChild(core.createItem("ID_CONTROL_1", "xw_save0.gif", "保存模版", function()
    {
        Templet.callSave();
    }));
    objParent.appendChild(core.createItem("ID_CONTROL_2", "xw_open1.gif", "刷新页面", function()
    {
        location.reload();
    }));
};

Templet.callHeadMenu = function(ev)
{
    var core = this;
    var ee = window.event || ev;
    core.hiddenControl();
    core.hiddenMenu();
    core.hiddenAlign();
    core.hiddenHint();
    var et = ee.srcElement;
    var x = ee.clientX;
    var y = ee.clientY;
    var objDiv = document.getElementById("_head_");
    if (objDiv == null)
    {
        objDiv = document.createElement("DIV");
        document.body.appendChild(objDiv);
        objDiv.id = "_head_";
        objDiv.style.position = "absolute";
        objDiv.style.width = "100px";
        objDiv.style.border = "1px solid #000000";
        objDiv.style.backgroundColor = "#FFFFFF";
        objDiv.style.padding = "2px";
        core.createHead(objDiv);
    }
    objDiv.style.display = "";
    var _w = 100 + (jspp.isIE ? 0 : 6);
    if (x + _w > document.body.clientWidth)
    {
        objDiv.style.left = document.body.scrollLeft + x - _w;
    }
    else
    {
        objDiv.style.left = document.body.scrollLeft + x;
    }
    objDiv.style.top = document.body.scrollTop + y;
    var id = et.id.match(/^_item_(\d+)_(\d+)_$/i);
    objDiv.setAttribute("index", id[2]);
};

Templet.createHead = function(objParent)
{
    var core = this;
    objParent.appendChild(core.createItem("ID_TOP_0", "xw_point11.gif", "插入新列[左]", function()
    {
        var id = parseInt(objParent.getAttribute("index"));
        var objTable = document.getElementById("_main_");
        objTable.width = parseInt(objTable.width) + 100;
        for (var i = 0; i < objTable.rows.length; i++)
        {
            var objTR = objTable.rows[i];
            core.createCell(objTR, i, id);
        }
        core.restore();
    }));
    objParent.appendChild(core.createItem("ID_TOP_1", "xw_point9.gif", "插入新列[右]", function()
    {
        var id = parseInt(objParent.getAttribute("index")) + 1;
        var objTable = document.getElementById("_main_");
        objTable.width = parseInt(objTable.width) + 100;
        for (var i = 0; i < objTable.rows.length; i++)
        {
            var objTR = objTable.rows[i];
            core.createCell(objTR, i, id);
        }
        core.restore();
    }));
    objParent.appendChild(core.createItem("ID_TOP_2", "xw_del0.gif", "删除选定列", function()
    {
        var id = parseInt(objParent.getAttribute("index"));
        var objTable = document.getElementById("_main_");
        objTable.width = parseInt(objTable.width) - 100;
        for (var i = 0; i < objTable.rows.length; i++)
        {
            objTable.rows[i].deleteCell(id);
        }
        core.restore();
    }));
};

Templet.callAlignMenu = function(ev)
{
    var core = this;
    var ee = window.event || ev;
    core.hiddenControl();
    core.hiddenMenu();
    core.hiddenHead();
    core.hiddenHint();
    var et = ee.srcElement;
    var x = ee.clientX;
    var y = ee.clientY;
    var objDiv = document.getElementById("_align_");
    if (objDiv == null)
    {
        objDiv = document.createElement("DIV");
        document.body.appendChild(objDiv);
        objDiv.id = "_align_";
        objDiv.style.position = "absolute";
        objDiv.style.width = "100px";
        objDiv.style.border = "1px solid #000000";
        objDiv.style.backgroundColor = "#FFFFFF";
        objDiv.style.padding = "2px";
        core.createAlign(objDiv);
    }
    objDiv.style.display = "";
    objDiv.style.left = x;
    var _h = 24 * 6 + 6;
    if (y + _h > document.body.clientHeight)
    {
        objDiv.style.top = document.body.scrollTop + y - _h;
    }
    else
    {
        objDiv.style.top = document.body.scrollTop + y;
    }
    var id = et.id.match(/^_item_(\d+)_(\d+)_$/i);
    objDiv.setAttribute("index", id[1]);
};

Templet.createAlign = function(objParent)
{
    var core = this;
    var _list0 = ["向左对齐", "居中对齐", "向右对齐"];
    var _list1 = ["左", "中", "右"];
    for (var i = 0; i < _list0.length; i++)
    {
        var objDiv = core.createItem("ID_LEFT_" + i, "xw_align" + i + ".gif", _list0[i], function()
        {
            var objAlign = document.getElementById("_item_" + objParent.getAttribute("index") + "_0_");
            if (objAlign)
            {
                objAlign.innerHTML = _list1[this.getAttribute("index")];
            }
        });
        objDiv.setAttribute("index", i);
        objParent.appendChild(objDiv);
    }
    objParent.appendChild(core.createItem("ID_LEFT_3", "xw_point8.gif", "插入新行[上]", function()
    {
        var id = parseInt(objParent.getAttribute("index"));
        var objTable = document.getElementById("_main_");
        var objTR = objTable.insertRow(id);
        for (var i = 0; i < objTable.rows[0].cells.length; i++)
        {
            core.createCell(objTR, id, i);
        }
        core.restore();
    }));
    objParent.appendChild(core.createItem("ID_LEFT_4", "xw_point10.gif", "插入新行[下]", function()
    {
        var id = parseInt(objParent.getAttribute("index")) + 1;
        var objTable = document.getElementById("_main_");
        var objTR = objTable.insertRow(id);
        for (var i = 0; i < objTable.rows[0].cells.length; i++)
        {
            core.createCell(objTR, id, i);
        }
        core.restore();
    }));
    objParent.appendChild(core.createItem("ID_LEFT_5", "xw_del0.gif", "删除选定行", function()
    {
        var id = parseInt(objParent.getAttribute("index"));
        var objTable = document.getElementById("_main_");
        objTable.deleteRow(id);
        core.restore();
    }));
};

Templet.restore = function()
{
    var objTable = document.getElementById("_main_");
    for (var i = 0; i < objTable.rows.length; i++)
    {
        for (var k = 0; k < objTable.rows[i].cells.length; k++)
        {
            if (i == 0 && k > 0) objTable.rows[i].cells[k].innerHTML = k;
            objTable.rows[i].cells[k].id = "_item_" + i + "_" + k + "_";
        }
    }
};

Templet.callHint = function(ev)

⌨️ 快捷键说明

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