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

📄 xwindow.js

📁 WAP手机网页XXXXX WAP手机网页XXXXX
💻 JS
📖 第 1 页 / 共 2 页
字号:
jspp.using("mocom.WAPmo.Window");

xWindow = function(name, flag, modal)
{
    jspp.count["win"]++;
    var core = this;
    this.name = name;
    this.env = {};
	this.select = [];
    this.left = 10;
    this.top = 10;
    this.width = 480;
    this.height = 360;
    this.overflowX = "hidden";
    this.overflowY = "hidden";
    this.x = document.body.scrollLeft;
    this.y = document.body.scrollTop;
    var reg = /(\w+)=(\w+)(,*)/g;
    var arr;
    while ((arr = reg.exec(flag)) != null)
    {
        eval("this." + arr[1] + " = \"" + arr[2] + "\";");
    }
    this.width = parseInt(this.width);
    this.height = parseInt(this.height);
    this.left = parseInt(this.left);
    this.top = parseInt(this.top);
    this.overflowX = /(visible|auto|hidden|scroll)/i.test(this.overflowX) ? this.overflowX : "hidden";
    this.overflowY = /(visible|auto|hidden|scroll)/i.test(this.overflowY) ? this.overflowY : "hidden";
    this.minButton = (this.minButton != "false");
    this.maxButton = (this.maxButton != "false");
    this.clsButton = (this.clsButton != "false");
    this.maxed = false;
    if (eval("jspp.window." + name))
    {
        eval("jspp.window." + name + ".free()");
    }
    eval("jspp.window." + name + " = this;");
    if (modal)
    {
        var $lock = this.lock = document.createElement("DIV");
        $lock.style.position = "absolute";
        $lock.style.left = document.body.scrollLeft + "px";
        $lock.style.top = document.body.scrollTop + "px";
        $lock.style.width = document.body.clientWidth + "px";
        $lock.style.height = document.body.clientHeight + "px";
        $lock.style.background = "url(" + jspp.Home + "images/empty.gif)";
        $lock.style.zIndex = jspp.index++;
        $lock.oncontextmenu = new Function("return false");
        document.body.appendChild(this.lock);
        var func = function()
        {
            $lock.style.left = document.body.scrollLeft + "px";
            $lock.style.top = document.body.scrollTop + "px";
        };
        if (window.attachEvent)
        {
            window.attachEvent("onscroll", func);
        }
        else if (window.addEventListener)
        {
            window.addEventListener("scroll", func, false);
        }
		if (jspp.ieVersion < 7)
		{
			var arr = document.getElementsByTagName("SELECT");
			for (var i = 0; i < arr.length; i++)
			{
				this.select.push({"srcElement" : arr[i], "display" : "" + arr[i].style.display + ""});
				arr[i].style.display = "none";
			}
		}
    }
    this.init();
};

xWindow.prototype.init = function()
{
    var core = this;
    var $window = core.window = document.createElement("DIV");
    $window.style.position = "absolute";
    $window.style.border = "1px outset #FFFFFF";
    $window.style.backgroundColor = "#F2F9FD";
    $window.style.left = core.left + "px";
    $window.style.top = core.top + "px";
    $window.style.overflow = "hidden";
    $window.style.zIndex = jspp.index++;
    $window.style.borderTop = "1px solid #FFFFFF"
    $window.style.borderRight = "1px solid #000000";
    $window.style.borderBottom = "1px solid #000000";
    $window.style.borderLeft = "1px solid #FFFFFF";
    var $head = core.head = document.createElement("DIV");
    $head.style.position = "relative";
    $head.style.width = "100%";
    $head.style.height = "24px";
    $head.style.background = "url(" + jspp.Home + "images/xw_back0.gif)";
    var $icon = core.icon = document.createElement("IMG");
    $icon.src = jspp.Home + "images/xw.gif";
    $icon.border = "0";
    $icon.style.visibility = "inherit";
    $icon.style.position = "absolute";
    $icon.style.left = "2px";
    $icon.style.top = "2px";
    var $title = core.title = document.createElement("SPAN");
    $title.style.visibility = "inherit";
    $title.style.position = "absolute";
    $title.style.left = "24px";
    $title.style.top = "4px";
    $title.style.fontSize = "12px";
    $title.style.fontFamily = "Geneva, Arial, Helvetica, sans-serif";
    $title.style.fontWeight = "bold";
    $title.style.color = "#464646";
    $title.style.cursor = "default";
    $title.innerHTML = "xWindow";
    var $min = core.min = document.createElement("IMG");
    $min.id = core.name + "_min";
    $min.src = jspp.Home + "images/xw_min0.gif";
    $min.border = "0";
    $min.style.visibility = "inherit";
    $min.style.position = "absolute";
    $min.style.top = "2px";
    $min.style.display = (core.minButton ? "" : "none");
    var $max = core.max = document.createElement("IMG");
    $max.id = core.name + "_max";
    $max.src = jspp.Home + "images/xw_max0.gif";
    $max.border = "0";
    $max.style.visibility = "inherit";
    $max.style.position = "absolute";
    $max.style.top = "2px";
    $max.style.display = (core.maxButton ? "" : "none");
    var $cls = core.cls = document.createElement("IMG");
    $cls.id = core.name + "_cls";
    $cls.src = jspp.Home + "images/xw_cls0.gif";
    $cls.border = "0";
    $cls.style.visibility = "inherit";
    $cls.style.position = "absolute";
    $cls.style.top = "2px";
    $cls.style.display = (core.clsButton ? "" : "none");
    var $body = core.body = document.createElement("DIV");
    $body.id = core.name + "_body";
    $body.style.position = "relative";
    $body.style.width = "100%";
    $body.style.overflowX = core.overflowX;
    $body.style.overflowY = core.overflowY;
    $head.onmouseover = function()
    {
        $head.style.background = "url(" + jspp.Home + "images/xw_back1.gif)";
    };
    $head.onmouseout = function()
    {
        $head.style.background = "url(" + jspp.Home + "images/xw_back0.gif)";
    };
    $head.onmousedown = function(ev)
    {
        var ee = window.event || ev;
        if (eval("/^" + core.name + "_(min|max|cls)$/.test(ee.srcElement.id)")) return false;
        var oe = Window.getOffset($head);
        var _x = ee.clientX - oe.left;
        var _y = ee.clientY - oe.top;
        var $x = 0, $y = 0;
        var tmp = document.createElement("DIV");
        tmp.style.position = "absolute";
        tmp.style.left = oe.left - $x + "px";
        tmp.style.top = oe.top - $y + "px";
        tmp.style.width = $window.offsetWidth + "px";
        tmp.style.height = $window.offsetHeight + "px";
        tmp.style.border = "1px solid #C0C0C0";
        document.body.appendChild(tmp);
        if (tmp.setCapture)
        {
            tmp.setCapture();
        }
        else if (window.captureEvents)
        {
            window.captureEvents(Event.MOUSEMOVE|Event.MOUSEUP);
        }
        core.above();
        tmp.style.zIndex = jspp.index;
        document.onmousemove = function(ev)
        {
            var ee = window.event || ev;
            core.left = ee.clientX - _x - $x;
            core.top = ee.clientY - _y - $y;
            tmp.style.left = core.left + "px";
            tmp.style.top = core.top + "px";
        };
        document.onmouseup = function()
        {
            if (tmp.releaseCapture)
            {
                tmp.releaseCapture();
            }
            else if (window.releaseEvents)
            {
                window.releaseEvents(Event.MOUSEMOVE|Event.MOUSEUP);
            }
            document.onmousemove = null;
            document.onmouseup = null;
            tmp.parentNode.removeChild(tmp);
            if (core.left < 0 && core.left + core.width < 80)
            {
                core.left = 80 - core.width;
            }
            if (core.top < 0)
            {
                core.top = 0;
            }
            core.moveTo(core.left, core.top);
        };
    };
    $min.onmouseover = function()
    {
        $min.src = jspp.Home + "images/xw_min1.gif";
    };
    $min.onmouseout = function()
    {
        $min.src = jspp.Home + "images/xw_min0.gif";
    };
    $min.onclick = function()
    {
        core.setTray();
    };
    $max.onmouseover = function()
    {
        $max.src = jspp.Home + (core.maxed ? "images/xw_res1.gif" : "images/xw_max1.gif");
    };
    $max.onmouseout = function()
    {
        $max.src = jspp.Home + (core.maxed ? "images/xw_res0.gif" : "images/xw_max0.gif");
    };
    $max.onclick = function()
    {
        if (core.maxed)
        {
            core.moveTo(core.$left, core.$top);
            core.resizeTo(core.$width, core.$height);
        }
        else
        {
            core.$left = core.left;
            core.$top = core.top;
            core.$width = core.width;
            core.$height = core.height;
            core.moveTo(0, 0);
            core.resizeTo(document.body.clientWidth, document.body.clientHeight);
        }
        core.maxed = (core.maxed == false);
    };
    $cls.onmouseover = function()
    {
        $cls.src = jspp.Home + "images/xw_cls1.gif";
    };
    $cls.onmouseout = function()
    {
        $cls.src = jspp.Home + "images/xw_cls0.gif";
    };

⌨️ 快捷键说明

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