common.js

来自「ECSHOP是一款开源免费的通用电子商务平台构建软件」· JavaScript 代码 · 共 37 行

JS
37
字号
function $(id, winHDL) {
    if (typeof(winHDL) === "undefined") {
        winHDL = window;
    }
    return winHDL.document.getElementById(id);
}

function getAddressLang() {
    var addressLang = location.search.match(/lang=(\w+)/);
    addressLang = addressLang ? addressLang[1] : "zh_cn";

    return addressLang;
}

function getCurStep() {
    var curStep = location.search.match(/step=(\w+)/);
    curStep = curStep ? curStep[1] : "welcome";

    return curStep;
}

function setInputCheckedStatus() {
    var targetInput=  $("js-" +getAddressLang());

    if (!targetInput) {
        return;
    }
    targetInput.setAttribute("checked", "checked");

    var langOptions = document.getElementsByName("js-lang");
    for (var i = 0; i < langOptions.length; i++) {
        langOptions[i].onclick = function () {
            var selectedLang =  this.getAttribute("id").slice(3);
            location.href = "./index.php?lang=" + selectedLang + "&step=" + getCurStep();
        };
    }
};

⌨️ 快捷键说明

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