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

📄 toolbar.htc

📁 专业的办公oa代码下载 c#语言编写 三层结构
💻 HTC
📖 第 1 页 / 共 4 页
字号:
return realIndex;
}
return -1;
}
function f_PublicGetCount()
{
var parent = f_GetParent();
if ((parent == null) || (parent.children.length == 0))
return 0;
var numItems = 0;
var realIndex;
var cell;
var group = null;
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)
{
numItems++;
group = cell._group;
}
}
else
{
group = null;
numItems++;
}
}
return (numItems < 0) ? 0 : numItems;
}
function f_PublicGetItem(index)
{
if ((index < 0) || (index > f_NumItems()))
return null;
var realIndex = f_PublicToRealIndex(index);
var item = f_GetItem(realIndex);
if (item == null)
return null;
if (((item._type == "checkbutton") || (item._type == "emptygroup")) && (item._group != null))
return f_PublicMakeGroupContract(item);
else
return f_PublicMakeContract(item);
}
function f_PublicMakeContract(item)
{
var obj = new Object();
obj.getType = function() { return item._type; };
if ((item._type == "dropdownlist") || (item._type == "textbox"))
{
obj.click = function() { item.children[0].click(); };
obj.focus = function() { item.children[0].focus(); };
obj.blur = function() { item.children[0].blur(); };
}
else
{
obj.click = function() { item.click(); };
obj.focus = function() { item.focus(); };
obj.blur = function() { item.blur(); };
}
obj.remove = function() { f_PublicRemoveItem(item); };
obj.getAttribute = function(name) { return f_PublicGetAttribute(item, name); };
obj.setAttribute = function(name, value) { f_PublicSetAttribute(item, name, value); };
if (item._type == "dropdownlist")
obj.getOptions = function() { return item.children[0].options; };
return obj;
}
function f_PublicMakeGroupContract(item)
{
var obj = new Object();
obj.getType = function() { return "checkgroup"; };
obj.getItem = function(subIndex) { return f_PublicGetGroupItem(subIndex, item._group); };
obj.getSelected = function() { var selItem = _oTable.document.all[item._group.oSelected]; if (selItem != null) return f_PublicMakeContract(selItem); else return null; };
obj.getAttribute = function(name) { return f_PublicGetGroupAttribute(item._group, name); };
obj.setAttribute = function(name, value) { f_PublicSetGroupAttribute(item._group, name, value); };
obj.remove = function() { f_PublicRemoveGroup(item._group); };
obj.getCount = function() { return f_PublicGetGroupCount(item._group); };
obj.createCheckButtonAt = function(subIndex) { return f_AddItemToGroupAt(subIndex, item._group, obj); };
return obj;
}
function f_PublicGetGroupCount(group)
{
var parent = f_GetParent();
if (parent == null)
return 0;
var realIndex = 0;
var count = 0;
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)
{
if (cell._type == "emptygroup")
return 0;
count++;
foundGroup = true;
}
else if (foundGroup)
{
break;
}
}
else if (foundGroup)
{
break;
}
}
return count;
}
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(index, group)
{
var item = f_GetGroupItem(index, group);
if ((item == null) || (item._type == "emptygroup"))
return null;
return f_PublicMakeContract(item);
}
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(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(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(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(item, name)
{
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 == "style") && (item.children.length == 1))
return item.children[0].style.cssText;
return item.getAttribute(name);
}
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(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(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(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(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");
img.src = cacheImage.src;
if (content.hasChildNodes())
content.insertBefore(img, content.childNodes[0]);
else
content.insertBefore(img);
content.setAttribute("_imageAdded", "true", 0);
}
f_AdjustContents(item);
}
function f_GetItem(nIndex)
{
var oParent = f_GetParent();
if (oParent != null)
{
if ((nIndex < 0) || (nIndex >= oParent.children.length))
return null;
var oCell = oParent.children[nIndex];
if (orientation == "vertical")
{
if (oCell.children.length > 0)
return oCell.children[0];
}
else
{
return oCell;
}
}
return null;
}
function f_NumItems()
{
var oParent = f_GetParent();
if (oParent != null)
{
return oParent.children.length;
}
return 0;
}
function f_OnPropertyChange()
{
switch (event.propertyName)
{
case "innerHTML":
f_CreateToolbar();
break;
case "_submitting":
_IsSubmitting = (element.getAttribute("_submitting") == "true");
_OnStopCount = 0;
break;
case "style.direction":
_oTable.style.direction = element.style.direction;
break;
case "dir":
_oTable.dir = element.dir;
break;
}
}
function f_CreateToolbar()
{
element.document.releaseCapture();
f_AddStopEvent();
if (f_IsMoveable())
{
defaults.style.position = "absolute";
defaults.style.zIndex = "1";
defaults.style.overflow = "hidden";
}
var oTable = element.document.createElement("TABLE");
var oTBody = element.document.createElement("TBODY");
_oTable = oTable;
oTable.style.fontSize = currentStyle.fontSize;
oTable.style.fontFamily = currentStyle.fontFamily;
oTable.style.fontWeight = currentStyle.fontWeight;
oTable.style.color = currentStyle.color;
oTable.cellSpacing = 0;
oTable.cellPadding = 0;
if (element.currentStyle.direction != element.style.direction)

⌨️ 快捷键说明

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