menu.js

来自「anewssystem新闻发布系统集成使用了spring hibernate f」· JavaScript 代码 · 共 512 行 · 第 1/2 页

JS
512
字号

        this.slideStep *= this.slideSpeed;
        if (this.slideCount > 0)
            setTimeout("Smenu.SlideFolders(" + folder + ",true)", 20);
        else
        {
            for (var k = 2; k <= folder; k++)
            {
                document.getElementById("SS_Position" + k).value = "UP";
            }
            this.currentFolder = folder;
            this.SetArrows();
            this.sliding = false;
        }
    }
    else
    {
        this.slideCount -= Math.floor(this.slideStep);
        if (this.slideCount < 0)
            this.slideStep += this.slideCount;
        step = Math.floor(this.slideStep);
        for (var i = folder + 1; i <= this.items; i++)
            if (document.getElementById("SS_Position" + i).value == "UP")
            {
                if (navigator.appName == "Netscape") {
                    var buttonTop = parseInt(document.getElementById("SS_MenuBar" + i).style.top);
                    document.getElementById("SS_MenuBar" + i).style.top = buttonTop + step;
                    var folderTop = parseInt(document.getElementById("SS_Folder" + i).style.top);
                    document.getElementById("SS_Folder" + i).style.top = folderTop + step;
                    //alert(document.getElementById("SS_MenuBar" + i).style.top);
                } else {
                    document.getElementById("SS_MenuBar" + i).style.pixelTop += step;
                    document.getElementById("SS_Folder" + i).style.pixelTop += step;
                    //alert(document.getElementById("SS_Folder" + i).style.pixelTop);
                }

            }

            //filter = /rect\((\d*)px (\d*)px (\d*)px (\d*)px\)/;

        var clipString = document.getElementById("SS_Folder" + folder).style.clip;
        var clip = clipString.match(this.filter);
        this.ClipFolder(folder, parseInt(clip[1]), this.visibleAreaWidth, (parseInt(clip[3]) + step), 0);

        var clipString = document.getElementById("SS_Folder" + this.currentFolder).style.clip;
        var clip = clipString.match(this.filter);
        this.ClipFolder(this.currentFolder, parseInt(clip[1]), this.visibleAreaWidth, (parseInt(clip[3]) - step), 0);

        this.slideStep *= this.slideSpeed;
        if (this.slideCount > 0)
            setTimeout("Smenu.SlideFolders(" + folder + ",false)", 20);
        else
        {
            for (var k = folder + 1; k <= this.items; k++)
                document.getElementById("SS_Position" + k).value = "DOWN";
            this.currentFolder = folder;
            this.SetArrows();
            this.sliding = false;
        }
    }
}

function ItemClicked(item)
{
    if (this.sliding)
        return;
    item.style.border = "1 inset #ffffff";
}

function OverItems(item)
{
    if (this.sliding)
        return;
    item.style.border = '1px solid #8BA8C6';
    item.style.backgroundColor = '#CEE9FE';
}

function OutItems(item)
{
    if (this.sliding)
        return;
    item.style.border = '0px solid #8BA8C6';
    item.style.backgroundColor = '#FFFFFF';
}

function ArrowClicked(arrow)
{
    if (this.sliding)
        return;
    arrow.style.border = "1 inset #ffffff";
}

function ArrowSelected(arrow)
{
    if (this.sliding)
        return;
    arrow.style.border = "0 none black";
    this.SlideItems(arrow.id == "SS_SlideUp");
}

function OverArrow(arrow)
{
    if (this.sliding)
        return;
    arrow.style.border = "1 outset #ffffff";

    var folder = document.getElementById("SS_Folder" + Smenu.currentFolder).style;
    if (navigator.appName == "Netscape") {
        var top = parseInt(document.getElementById("SS_MenuBar" + Smenu.currentFolder).style.top);
        var height = parseInt(document.getElementById("SS_MenuBar" + Smenu.currentFolder).style.height);
    } else {
        var top = document.getElementById("SS_MenuBar" + Smenu.currentFolder).style.pixelTop;
        var height = document.getElementById("SS_MenuBar" + Smenu.currentFolder).style.pixelHeight;
    }
    var startTop = top + height;
}

function OutArrow(arrow)
{
    if (this.sliding)
        return;
    arrow.style.border = "0 none black";
}

function ClipFolder(folder, top, right, bottom, left)
{
    document.getElementById("SS_Folder" + folder).style.clip = clip = 'rect(' + top + ' ' + right + ' ' + bottom + ' ' + left + ')';
}

function Start()
{
    if (!this.started)
    {
        this.ClipFolder(1, 0, this.visibleAreaWidth, this.visibleAreaHeight, 0);
        this.SetArrows();
    }
}

function SetArrows()
{
    var downHeight = document.getElementById("SS_SlideDown").height;
    var upWidth = document.getElementById("SS_SlideUp").width;
    var downWidth = document.getElementById("SS_SlideDown").width;
    if (navigator.appName == "Netscape") {
        var top = parseInt(document.getElementById("SS_MenuBar" + this.currentFolder).style.top);
        var height = parseInt(document.getElementById("SS_MenuBar" + this.currentFolder).style.height);

        document.getElementById("SS_SlideUp").style.top = top + height + this.visibleAreaHeight - downHeight - 20;
        document.getElementById("SS_SlideUp").style.left = this.width - upWidth - this.borderWidth - 10;
        document.getElementById("SS_SlideDown").style.top = top + height + 20;
        document.getElementById("SS_SlideDown").style.left = this.width - downWidth - this.borderWidth - 10;

        var startTop = top + height;
        var floderTop = parseInt(document.getElementById("SS_Folder" + this.currentFolder).style.top);
        var floderHeight = parseInt(document.getElementById("SS_Folder" + this.currentFolder).style.height);

    } else {
        var top = document.getElementById("SS_MenuBar" + this.currentFolder).style.pixelTop;
        var height = document.getElementById("SS_MenuBar" + this.currentFolder).style.pixelHeight;

        document.getElementById("SS_SlideUp").style.pixelTop = top + height + this.visibleAreaHeight - downHeight - 20;
        document.getElementById("SS_SlideUp").style.pixelLeft = this.width - upWidth - this.borderWidth - 10;
        document.getElementById("SS_SlideDown").style.pixelTop = top + height + 20;
        document.getElementById("SS_SlideDown").style.pixelLeft = this.width - downWidth - this.borderWidth - 10;

        var startTop = top + height;
        var floderTop = document.getElementById("SS_Folder" + this.currentFolder).style.pixelTop;
        var floderHeight = document.getElementById("SS_Folder" + this.currentFolder).style.pixelHeight;

    }

    if (floderTop < startTop)
        document.getElementById("SS_SlideDown").style.visibility = "visible";
    else
        document.getElementById("SS_SlideDown").style.visibility = "hidden";

    if (floderHeight - (startTop - floderTop) > this.visibleAreaHeight)
        document.getElementById("SS_SlideUp").style.visibility = "visible";
    else
        document.getElementById("SS_SlideUp").style.visibility = "hidden";
}

function HideArrows()
{
    document.getElementById("SS_SlideUp").style.visibility = "hidden";
    document.getElementById("SS_SlideDown").style.visibility = "hidden";
}

function SlideItems(up)
{
    this.sliding = true;
    this.slideCount = Math.floor(this.slideArrowValue / this.ArrowSlideSpeed);
    up ? this.SlideItemsAction(-this.ArrowSlideSpeed) : this.SlideItemsAction(this.ArrowSlideSpeed);
}

function SlideItemsAction(value)
{
    if (navigator.appName == "Netscape") {
        var top = parseInt(document.getElementById("SS_Folder" + this.currentFolder).style.top);
        document.getElementById("SS_Folder" + this.currentFolder).style.top = top + value;

    } else {
        var top = document.getElementById("SS_Folder" + this.currentFolder).style.pixelTop;
        document.getElementById("SS_Folder" + this.currentFolder).style.pixelTop = top + value;
    }

    //filter = /rect\((\d*)px (\d*)px (\d*)px (\d*)px\)/;
    var clipString = document.getElementById("SS_Folder" + this.currentFolder).style.clip;
    var clip = clipString.match(this.filter);
    this.ClipFolder(this.currentFolder, (parseInt(clip[1]) - value), parseInt(clip[2]), (parseInt(clip[3]) - value), parseInt(clip[4]));
    this.slideCount--;
    if (this.slideCount > 0)
        setTimeout("Smenu.SlideItemsAction(" + value + ")", 20);
    else
    {
        if (Math.abs(value) * this.ArrowSlideSpeed != this.slideArrowValue)
        {
            document.getElementById("SS_Folder" + this.currentFolder).style.pixelTop += (value / Math.abs(value) * (this.slideArrowValue % this.ArrowSlideSpeed));
            //filter = /rect\((\d*)px (\d*)px (\d*)px (\d*)px\)/;
            var clipString = document.getElementById("SS_Folder" + this.currentFolder).style.clip;
            var clip = clipString.match(this.filter);
            this.ClipFolder(this.currentFolder, (parseInt(clip[1]) - (value / Math.abs(value) * (this.slideArrowValue % this.ArrowSlideSpeed))), parseInt(clip[2]), (parseInt(clip[3]) - (value / Math.abs(value) * (this.slideArrowValue % this.ArrowSlideSpeed))), parseInt(clip[4]));
        }
        this.SetArrows();
        this.sliding = false;
    }
}
function Onwheel()
{

    if (navigator.appName == "Netscape") {
        var top = parseInt(document.getElementById("SS_MenuBar" + Smenu.currentFolder).style.top);
        var height = parseInt(document.getElementById("SS_MenuBar" + Smenu.currentFolder).style.height);
        var folderTop = parseInt(document.getElementById("SS_Folder" + Smenu.currentFolder).style.top)
        var folderHeight = parseInt(document.getElementById("SS_Folder" + Smenu.currentFolder).style.height)


    } else {
        var top = document.getElementById("SS_MenuBar" + Smenu.currentFolder).style.pixelTop;
        var height = document.getElementById("SS_MenuBar" + Smenu.currentFolder).style.pixelHeight;
        var folderTop = document.getElementById("SS_Folder" + Smenu.currentFolder).style.pixelTop;
        var folderHeight = document.getElementById("SS_Folder" + Smenu.currentFolder).style.pixelHeight;

    }
    var startTop = top + height;


    if (event.wheelDelta >= 120 && folderTop < startTop)
    {
        Smenu.ArrowSelected(SS_SlideDown);
    }
    else if (event.wheelDelta <= -120 && folderHeight - (startTop - folderTop) > Smenu.visibleAreaHeight)
    {
        Smenu.ArrowSelected(SS_SlideUp);
    }
}

⌨️ 快捷键说明

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