44 lines
1.1 KiB
JavaScript
44 lines
1.1 KiB
JavaScript
|
|
//这个函数在整个wps加载项中是第一个执行的
|
|
function OnAddinLoad(ribbonUI) {
|
|
if (typeof (window.Application.ribbonUI) != "object") {
|
|
window.Application.ribbonUI = ribbonUI
|
|
}
|
|
|
|
if (typeof (window.Application.Enum) != "object") { // 如果没有内置枚举值
|
|
window.Application.Enum = WPS_Enum
|
|
}
|
|
return true
|
|
}
|
|
|
|
|
|
function OnAction(control) {
|
|
const eleId = control.Id
|
|
switch (eleId) {
|
|
case "btnShowAbout":
|
|
{
|
|
alert("关于我们\n\n作者:Jianxin\n\n版本:1.0.0\n\n说明:自动化插件\n\n感谢使用!")
|
|
}
|
|
break;
|
|
case "contactAuthor":
|
|
{
|
|
wps.ShowDialog(GetUrlPath() + "/ui/author.html", "联系作者", 400 * window.devicePixelRatio, 400 * window.devicePixelRatio, false)
|
|
}
|
|
default:
|
|
break
|
|
}
|
|
return true
|
|
}
|
|
|
|
|
|
function GetImage(control) {
|
|
const eleId = control.Id
|
|
switch (eleId) {
|
|
case "btnShowAbout":
|
|
return "images/about.svg"
|
|
default:
|
|
;
|
|
}
|
|
return "images/newFromTemp.svg"
|
|
}
|