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

📄 menu.ie.js

📁 Bindows 1.01 完全版 Bindows 框架提供给你: 基于类的面向对象 API; 一个完整的窗口系统
💻 JS
📖 第 1 页 / 共 5 页
字号:
    else        return 0;};Menu.prototype.getHeight = function(){    var d = this.getDocument();    if (d != null)        return d.body.offsetHeight;    else        return 0;};Menu.prototype.getPreferredWidth = function(){    this.updateSizeCache();    return this._cachedSizes.preferredWidth;};Menu.prototype.getPreferredHeight = function(){    this.updateSizeCache();    return this._cachedSizes.preferredHeight;};Menu.prototype.getLeft = function(){    var d = this.getDocument();    if (d != null)        return d.parentWindow.screenLeft;    else        return 0;};Menu.prototype.getTop = function(){    var d = this.getDocument();    if (d != null)        return d.parentWindow.screenTop;    else        return 0;};Menu.prototype.setLeft = function(l){    throw new Error("Depreciated. Use show instead");} ;Menu.prototype.setTop = function(t){    throw new Error("Depreciated. Use show instead");} ;Menu.prototype.setLocation = function(l, t){    throw new Error("Depreciated. Use show instead");} ;Menu.prototype.setRect = function(l, t, w, h){    throw new Error("Depreciated. Use show instead");} ;Menu.prototype.getInsetLeft = function(){    this.updateSizeCache();    return this._cachedSizes.insetLeft;};Menu.prototype.getInsetRight = function(){    this.updateSizeCache();    return this._cachedSizes.insetRight;};Menu.prototype.getInsetTop = function(){    this.updateSizeCache();    return this._cachedSizes.insetTop;};Menu.prototype.getInsetBottom = function(){    this.updateSizeCache();    return this._cachedSizes.insetBottom;};Menu.prototype.areSizesCached = function(){    var cs = this._cachedSizes;    return this._drawn && "preferredWidth" in cs && "preferredHeight" in cs && "insetLeft" in cs && "insetRight" in cs        && "insetTop" in cs && "insetBottom" in cs;};Menu.prototype.cacheSizes = function(bForce){    return updateSizeCache(bForce);} ;Menu.prototype.resetSizeCache = function(){    this._cachedSizes = {    };} ;Menu.prototype.updateSizeCache = function(bForce){    if (this.areSizesCached() && !bForce)        return;    var d = this.getMeasureDocument();    var body = d.body;    var cs = this._cachedSizes = {    };    var scrollContainer = d.getElementById("scroll-container");    cs.preferredWidth = d.body.scrollWidth;    scrollContainer.style.overflow = "visible";    cs.preferredHeight = body.firstChild.offsetHeight;    scrollContainer.style.overflow = "hidden";    cs.insetLeft = posLib.getLeft(scrollContainer);    cs.insetRight = body.scrollWidth - posLib.getLeft(scrollContainer) - scrollContainer.offsetWidth;    var up = d.getElementById("scroll-up-item");    if (up.currentStyle.display == "none")        cs.insetTop = posLib.getTop(scrollContainer);    else        cs.insetTop = posLib.getTop(up);    var down = d.getElementById("scroll-down-item");    if (down.currentStyle.display == "none")    {        cs.insetBottom = body.scrollHeight - posLib.getTop(scrollContainer) - scrollContainer.offsetHeight;    }    else    {        cs.insetBottom = body.scrollHeight - posLib.getTop(down) - down.offsetHeight;    }};Menu.prototype.fixScrollButtons = function(){    var d = this.getDocument();    var up = d.getElementById("scroll-up-item");    var down = d.getElementById("scroll-down-item");    var scrollContainer = d.getElementById("scroll-container");    var scs = scrollContainer.style;    if (scrollContainer.scrollHeight > this.getHeight())    {        up.style.display = "";        down.style.display = "";        scs.height = "";        scs.overflow = "visible";        scs.height = Math.max(0, this.getHeight() - (d.body.scrollHeight - scrollContainer.offsetHeight)) + "px";        scs.overflow = "hidden";        this._scrollingMode = true;    }    else    {        up.style.display = "none";        down.style.display = "none";        scs.overflow = "visible";        scs.height = "";        this._scrollingMode = false;    }};Menu.prototype.fixScrollEnabledState = function(){    var d = this.getDocument();    var up = d.getElementById("scroll-up-item");    var down = d.getElementById("scroll-down-item");    var scrollContainer = d.getElementById("scroll-container");    var tr;    tr = up.rows[0];    if (scrollContainer.scrollTop == 0)    {        if (tr.className == "hover" || tr.className == "disabled-hover")            tr.className = "disabled-hover";        else            tr.className = "disabled";    }    else    {        if (tr.className == "disabled-hover" || tr.className == "hover")            tr.className = "hover";        else            tr.className = "";    }    tr = down.rows[0];    if (scrollContainer.scrollHeight - scrollContainer.clientHeight <= scrollContainer.scrollTop)    {        if (tr.className == "hover" || tr.className == "disabled-hover")            tr.className = "disabled-hover";        else            tr.className = "disabled";    }    else    {        if (tr.className == "disabled-hover" || tr.className == "hover")            tr.className = "hover";        else            tr.className = "";    }};Menu.prototype.closeAllMenus = function(){    if (this.parentMenu)        this.parentMenu.closeAllMenus();    else        this.close();};Menu.prototype.close = function(){    this.closeAllSubs();    window.clearTimeout(this._showTimer);    window.clearTimeout(this._closeTimer);    if (this.popup)        this.popup.hide();    var pm = this.parentMenu;    if (pm && pm.shownSubMenu == this)        pm.shownSubMenu = null;    this.setSelectedIndex(-1);    this._checkCloseState();};Menu.prototype.closeAllSubs = function(oNotThisSub){    var items = this.items;    var l = items.length;    for (var i = 0; i < l; i++)    {        if (items[i].subMenu != null && items[i].subMenu != oNotThisSub)            items[i].subMenu.close();    }};Menu.prototype.getSelectedIndex = function(){    return this.selectedIndex;} ;Menu.prototype.setSelectedIndex = function(nIndex){    if (this.selectedIndex == nIndex)        return;    if (nIndex >= this.items.length)        nIndex = -1;    var mi;    if (this.selectedIndex != -1)    {        mi = this.items[this.selectedIndex];        mi.setSelected(false);    }    this.selectedIndex = nIndex;    mi = this.items[this.selectedIndex];    if (mi != null)        mi.setSelected(true);};Menu.prototype.goToNextMenuItem = function(){    var i = 0;    var items = this.items;    var length = items.length;    var index = this.getSelectedIndex();    var tmp;    do    {        if (index == -1 || index >= length)            index = 0;        else            index++;        i++;        tmp = items[index]    }while (!(tmp != null && tmp instanceof MenuItem && !(tmp instanceof MenuSeparator) || i >= length))    if (tmp != null)        this.setSelectedIndex(index);};Menu.prototype.goToPreviousMenuItem = function(){    var i = 0;    var items = this.items;    var length = items.length;    var index = this.getSelectedIndex();    var tmp;    do    {        if (index == -1 || index >= length)            index = length - 1;        else            index--;        i++;        tmp = items[index]    }while (!(tmp != null && tmp instanceof MenuItem && !(tmp instanceof MenuSeparator) || i >= length))    if (tmp != null)        this.setSelectedIndex(index);};Menu.prototype.goToNextMenu = function(){    var index = this.getSelectedIndex();    var mi = this.items[index];    if (mi && mi.subMenu && !mi.disabled)    {        mi.subMenu.setSelectedIndex(0);        mi.showSubMenu(false);    }    else    {        var mb = this.getMenuBar();        if (mb != null)            mb.goToNextMenuItem();    }};Menu.prototype.goToPreviousMenu = function(){    if (this.parentMenuItem && this.parentMenuItem instanceof MenuButton)    {        this.parentMenu.goToPreviousMenuItem();    }    else if (this.parentMenuItem)    {        this.close();    }};Menu.prototype.getMenuBar = function(){    if (this.parentMenu == null)        return null;    return this.parentMenu.getMenuBar();};Menu.prototype.makeEventListeners = function(){    if (this.eventListeners != null)        return;    this.eventListeners = {        onscroll: new Function("eventListeners.menu.onscroll(\"" + this.id + "\")"),        onmouseover: new Function("eventListeners.menu.onmouseover(\"" + this.id + "\")"),        onmouseout: new Function("eventListeners.menu.onmouseout(\"" + this.id + "\")"),        onmouseup: new Function("eventListeners.menu.onmouseup(\"" + this.id + "\")"),        onmousewheel: new Function("eventListeners.menu.onmousewheel(\"" + this.id + "\")"),        onreadystatechange: new Function("eventListeners.menu.onreadystatechange(\"" + this.id + "\")"),        onkeydown: new Function("eventListeners.menu.onkeydown(\"" + this.id + "\")"),        oncontextmenu: new Function("eventListeners.menu.oncontextmenu(\"" + this.id + "\")"),        onunload: new Function("eventListeners.menu.onunload(\"" + this.id + "\")")    };};Menu.prototype.detachEvents = function(){    if (this.eventListeners == null)        return;    var d = this.getDocument();    var w = d.parentWindow;    var scrollContainer = d.getElementById("scroll-container");    scrollContainer.detachEvent("onscroll", this.eventListeners.onscroll);    d.detachEvent("onmouseover", this.eventListeners.onmouseover);    d.detachEvent("onmouseout", this.eventListeners.onmouseout);    d.detachEvent("onmouseup", this.eventListeners.onmouseup);    d.detachEvent("onmousewheel", this.eventListeners.onmousewheel);    if (this.cssText == null)    {        var linkEl = d.getElementsByTagName("LINK")[0];        linkEl.detachEvent("onreadystatechange", this.eventListeners.onreadystatechange);    }    d.detachEvent("onkeydown", this.eventListeners.onkeydown);    d.detachEvent("oncontextmenu", this.eventListeners.oncontextmenu);    window.detachEvent("onunload", this.eventListeners.onunload);}Menu.prototype.hookupMenu = function(d){    this.detachEvents();    this.makeEventListeners();    var oThis = this;    var d = this.getDocument();    var w = d.parentWindow;    var scrollContainer = d.getElementById("scroll-container");    scrollContainer.attachEvent("onscroll", this.eventListeners.onscroll);    d.attachEvent("onmouseover", this.eventListeners.onmouseover);    d.attachEvent("onmouseout", this.eventListeners.onmouseout);    d.attachEvent("onmouseup", this.eventListeners.onmouseup);    d.attachEvent("onmousewheel", this.eventListeners.onmousewheel);    if (this.cssText == null)    {        var linkEl = d.getElementsByTagName("LINK")[0];        if (linkEl.readyState != "complete")        {            linkEl.attachEvent("onreadystatechange", this.eventListeners.onreadystatechange);        }    }    d.attachEvent("onkeydown", this.eventListeners.onkeydown);    d.attachEvent("oncontextmenu", this.eventListeners.oncontextmenu);    window.attachEvent("onunload", this.eventListeners.onunload);    var all = d.all;    var l = all.length;    for (var i = 0; i < l; i++)        all[i].unselectable = "on";};Menu.prototype.handleKeyEvent = function(oEvent){    if (this.shownSubMenu)        return;    var nKeyCode = oEvent.keyCode;    switch (nKeyCode)    {        case 40:        this.goToNextMenuItem();        break;        case 38:        this.goToPreviousMenuItem();        break;        case 39:        this.goToNextMenu();        break;        case 37:        this.goToPreviousMenu();        break;        case 13:        var mi = this.items[this.getSelectedIndex()];        if (mi)            mi.dispatchAction();        break;        case 27:        this.close();        break;        case Menu.keyboardAccelKey:        case Menu.keyboardAccelKey2:        this.closeAllMenus();        break;        default:        var c = String.fromCharCode(nKeyCode).toLowerCase();        var items = this.items;        var l = items.length;        for (var i = 0; i < l; i++)

⌨️ 快捷键说明

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