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

📄 toolbar.htc

📁 浏览器端看到树型目录结构,用户可以完整地看到像windows资源管理器一样的效果
💻 HTC
📖 第 1 页 / 共 5 页
字号:
            (cell._group != null))
        {
            if (group == cell._group)
            {
                if (cell._type == "emptygroup")
                    return 0;
                count++;
                foundGroup = true;
            }
            else if (foundGroup)
            {
                break;
            }
        }
        else if (foundGroup)
        {
            break;
        }
    }

    return count;
}

//+----------------------------------------------------------------------------
//  Function:       f_PublicRemoveGroup
//  Description:    Removes a group.
//-----------------------------------------------------------------------------
function f_PublicRemoveGroup(group)
{
    var numItems = f_PublicGetGroupCount(group);
    
    if (numItems == 0)
    {
        var cell = f_GetGroupItem(0, group);
        if (orientation == "vertical")
            cell = cell.parentElement;
        cell.removeNode(true);
    }
    else
    {
        for (var count = 0; count < numItems; count++)
        {
            var cell = f_GetGroupItem(0, group);
            if (orientation == "vertical")
                cell = cell.parentElement;
            cell.removeNode(true);
        }
    }
}

//+----------------------------------------------------------------------------
//  Function:       f_PublicGetGroupItem
//  Description:    Retrieves a public "contract" item representing an item
//  Parameters:     index   Index of the item in a group
//                  group   To group to look in
//  Returns:        The item or null
//-----------------------------------------------------------------------------
function f_PublicGetGroupItem(index, group)
{
    var item = f_GetGroupItem(index, group);
    if ((item == null) || (item._type == "emptygroup"))
        return null;

    return f_PublicMakeContract(item);
}

//+----------------------------------------------------------------------------
//  Function:       f_GetGroupItem
//  Description:    Gets a real item cell from a group.
//-----------------------------------------------------------------------------
function f_GetGroupItem(index, group)
{
    var parent = f_GetParent();
    if (parent == null)
        return null;

    var realIndex = 0;
    var vIndex = -1;
    var cell;
    var foundGroup = false;
    for (realIndex = 0; realIndex < parent.children.length; realIndex++)
    {
        cell = parent.children[realIndex];
        if ((orientation == "vertical") && (cell.children.length > 0))
            cell = cell.children[0];

        if (((cell._type == "checkbutton") || (cell._type == "emptygroup")) && 
            (cell._group != null))
        {
            if (group == cell._group)
            {
                foundGroup = true;
                vIndex++;
            }
            else if (foundGroup)
            {
                return null;
            }

            if (vIndex == index)
            {
                return cell;
                break;
            }
        }
        else if (foundGroup)
        {
            return null;
        }
    }
    
    return null;
}

//+----------------------------------------------------------------------------
//  Function:       f_PublicRemoveItem
//  Description:    Removed an item from the toolbar.
//  Parameters:     item    The item to remove
//-----------------------------------------------------------------------------
function f_PublicRemoveItem(item)
{
    var empty = null;
    var group = item._group;
    if ((item._type == "checkbutton") && (group != null) && 
        (f_PublicGetGroupCount(group) == 1))
    {
        empty = f_CreateEmptyGroup(group);
    }

    if (orientation == "vertical")
    {
        item = item.parentElement;
        if (empty != null)
        {
            var row = element.document.createElement("TR");
            row.style.display = "none";
            row.appendChild(empty);
            empty = row;
        }
    }

    if ((group != null) && (group.oSelected == item.uniqueID))
       group.oSelected = null;

    if (empty != null)
        item.insertAdjacentElement("beforeBegin", empty);
    item.removeNode(true);

    if ((group != null) && group.bForceSel && (group.oSelected == null) && (empty == null))
    {
        item = f_PublicGetGroupItem(0, group);
        if (item != null)
            item.setAttribute("selected", "true");
    }
}

//+----------------------------------------------------------------------------
//  Function:       f_PublicGetGroupAttribute
//  Description:    Retrieves the value of an attribute from a group.
//-----------------------------------------------------------------------------
function f_PublicGetGroupAttribute(group, name)
{
    switch (name.toLowerCase())
    {
    case "forceselection":
        return (group.bForceSel) ? "true" : "false";

    case "defaultstyle":
        return group.szDefaultStyle;

    case "hoverstyle":
        return group.szHoverStyle;

    case "selectedstyle":
        return group.szSelectedStyle;
    }
}

//+----------------------------------------------------------------------------
//  Function:       f_PublicSetGroupAttribute
//  Description:    Sets the attribute on a given group
//  Parameters:     group   The group being worked on
//                  name    The name of the attribute
//                  value   The value of the attribute
//-----------------------------------------------------------------------------
function f_PublicSetGroupAttribute(group, name, value)
{
    switch (name.toLowerCase())
    {
    case "forceselection":
        group.bForceSel = (value.toLowerCase() == "true");
        if (group.bForceSel && (group.oSelected == null))
        {
            var cell = f_PublicGetGroupItem(0, group);
            if (cell != null)
                cell.setAttribute("selected", "true");
        }
        break;

    case "defaultstyle":
        group.szDefaultStyle = value;
        f_ApplyStylesToChildren();
        break;

    case "hoverstyle":
        group.szHoverStyle = value;
        f_ApplyStylesToChildren();
        break;

    case "selectedstyle":
        group.szSelectedStyle = value;
        f_ApplyStylesToChildren();
        break;

    }
}

//+----------------------------------------------------------------------------
//  Function:       f_PublicGetAttribute
//  Description:    Gets the attribute on a given item
//  Parameters:     item    The item being worked on
//                  name    The name of the attribute
//-----------------------------------------------------------------------------
function f_PublicGetAttribute(item, name)
{
    var lname = name.toLowerCase();

    if ((item._type == "dropdownlist") || (item._type == "textbox"))
    {
        // Use the child item for most properties
        if ((lname != "defaultstyle") && (lname != "style") && (item.children.length > 0))
            item = item.children[0];
    }

    // Get the style from the child item
    if ((lname == "style") && (item.children.length == 1))
        return item.children[0].style.cssText;

    return item.getAttribute(name);
}

//+----------------------------------------------------------------------------
//  Function:       f_PublicSetAttribute
//  Description:    Sets the attribute on a given item
//  Parameters:     item    The item being worked on
//                  name    The name of the attribute
//                  value   The value of the attribute
//-----------------------------------------------------------------------------
function f_PublicSetAttribute(item, name, value)
{
    var cachedImage;
    var lname = name.toLowerCase();

    if ((item._type == "dropdownlist") || (item._type == "textbox"))
    {
        if ((lname != "defaultstyle") && (lname != "style") && (item.children.length > 0))
            item = item.children[0];
    }
    if ((lname == "tabindex") || (lname == "title"))
    {
        item = item.children[0];
    }

    if ((lname != "style") && (lname != "selected") && (lname != "outerhtml") &&
        (lname != "innertext") && (lname != "innerhtml"))
        item.setAttribute(name, value, 0);
    
    if (!_Ready)
        return;

    switch (lname)
    {
    case "defaultstyle":
    case "hoverstyle":
    case "selectedstyle":
        f_ApplyStylesToChildren();
        break;
        
    case "text":
    case "innertext":
        if ((item._type == "label") || (item._type == "button") || (item._type == "checkbutton"))
        {
            f_DoLabelText(item, value);
        }
        break;

    case "innerhtml":
        if ((item._type == "label") || (item._type == "button") || (item._type == "checkbutton"))
        {
            f_DoLabelHTML(item, value);
        }
        break;

    case "imageurl":
        if ((item._type == "label") || (item._type == "button") || (item._type == "checkbutton"))
        {
            cachedImage = new Image();
            cachedImage.src = value;
            f_DoLabelImageUrl(item, value);
        }
        break;
        
    case "style":
        if (item.children.length == 1)
        {
            if ((item._type == "separator") || (item._type == "gripper"))
            {
                item.children[0]._origStyle += ";" + value;
            }
            item.children[0].style.cssText += ";" + value;
        }
        break;

    case "selected":
        if (item._type == "checkbutton")
        {
            if (f_IsSelected(item) != (value.toLowerCase() == "true"))
            {
                _KeyboardClick = true;
                item.click();
            }
        }
        break;

    case "disabled":
        f_ApplyStylesToChildren();
        break;
    }
}

//+----------------------------------------------------------------------------
//  Function:       f_DoLabelText
//  Description:    Splices in new text
//-----------------------------------------------------------------------------
function f_DoLabelText(item, text)
{
    f_RemoveTextNodes(item);
    var span = element.document.createElement("SPAN");
    span.innerText = text;
    item.children[0].appendChild(span);
    f_AdjustContents(item);
}

//+----------------------------------------------------------------------------
//  Function:       f_DoLabelHTML
//  Description:    Splices in new html
//-----------------------------------------------------------------------------
function f_DoLabelHTML(item, html)
{
    f_RemoveTextNodes(item);
    var span = element.document.createElement("SPAN");
    span.innerHTML = html;
    item.children[0].appendChild(span);
    f_AdjustContents(item);
}

//+----------------------------------------------------------------------------
//  Function:       f_RemoveTextNodes
//  Description:    Removes nodes that would be replaced by a change to
//                  the text, innerText, or innerHTML properties.
//-----------------------------------------------------------------------------
function f_RemoveTextNodes(item)
{
    var content = item.children[0];
    if (content.hasChildNodes())
    {
        var index = (content.getAttribute("_imageAdded")) ? 1 : 0;
        while (index < content.childNodes.length)
            content.childNodes[index].removeNode(true);
    }
}

//+----------------------------------------------------------------------------
//  Function:       f_DoLabelImageUrl
//  Description:    Splices in a new imageUrl.
//-----------------------------------------------------------------------------
function f_DoLabelImageUrl(item, imageUrl)
{
    var content = item.children[0];
    var imageAdded = content.getAttribute("_imageAdded");

    if (imageAdded && (imageUrl == null))
    {
        content.children[0].removeNode(true);
        content.removeAttribute("_imageAdded", 0);
        if (content.childNodes.length == 0)
            content.innerHTML = "&nbsp;";
    }
    else if (imageUrl == null)
    {
        return;
    }
    else
    {
        if (imageAdded)
        {
            content.children[0].removeNode(true);
        }

        var cacheImage = new Image();
        cacheImage.src = imageUrl;

        var img = element.document.createElement("IMG");

⌨️ 快捷键说明

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