Files
fe_service_ebtp_frontend/public/ntkoofficecontrol.min.js

209 lines
8.6 KiB
JavaScript
Raw Normal View History

2020-12-23 11:14:35 +08:00
/*------------------------------------------------------*/
/* 修改控件的配置信息 */
2021-01-16 11:29:42 +08:00
/* version:2.5.1 */
/* 2020.09.07版本 跟随 联通系统集成有限公司20201229 产品发送 */
/* */
2020-12-23 11:14:35 +08:00
/*------------------------------------------------------*/
//64位控件的calssid
2021-01-16 11:29:42 +08:00
var classidx64="A64E3073-2016-4baf-A89D-FFE1FAA10EF1";
2020-12-23 11:14:35 +08:00
//32位控件的classid
2021-01-16 11:29:42 +08:00
var classid="A64E3073-2016-4baf-A89D-FFE1FAA10ED1";
2020-12-23 11:14:35 +08:00
//32位控件包的路径
2021-01-16 11:29:42 +08:00
var codebase="officecontrol/ofctnewclsid.cab#version=6,0,1,0";
2020-12-23 11:14:35 +08:00
//64位控件包的路径
2021-01-16 11:29:42 +08:00
var codebase64="officecontrol/ofctnewclsidx64.cab#version=6,0,1,0";
2020-12-23 11:14:35 +08:00
//设置高度
var height="800px";
//设置宽度
var width="100%";
//买断授权密钥如果不是买断可以不用写
2021-01-16 11:29:42 +08:00
var MakerCaption="联通系统集成有限公司";
2020-12-23 11:14:35 +08:00
//买断授权密钥如果不是买断可以不用写
2021-01-16 11:29:42 +08:00
var MakerKey="D130003CD231496EBD17D6DAC22DEFC6BD8F4E17";
2020-12-23 11:14:35 +08:00
//密钥
2021-01-16 11:29:42 +08:00
var ProductCaption="联通系统集成有限公司某某测试用户";
2020-12-23 11:14:35 +08:00
//密钥
2021-01-16 11:29:42 +08:00
var ProductKey="F6C911699ECD29CC0D2E47822CF1775B3A80C13F";
2020-12-23 11:14:35 +08:00
//解除时间密钥
var NoExpireKey="";
/*
谷歌浏览器事件接管但此接管事件只支持低版本的谷歌45以下版本不包含45和火狐52以下版本不包含52
*/
function ntkosavetourl(type,code,html)
{
2021-01-16 11:29:42 +08:00
//alert("SaveToURL成功回调");
2020-12-23 11:14:35 +08:00
}
function ntkopublishashtml(type,code,html){
2021-01-16 11:29:42 +08:00
//alert("Onpublishashtmltourl成功回调");
2020-12-23 11:14:35 +08:00
}
function ntkopublishaspdf(type,code,html){
//alert("Onpublishaspdftourl成功回调");
}
function ntkosaveasotherurl(type,code,html){
//alert("SaveAsOtherformattourl成功回调");
}
function ntkoondocumentopened(type,code){
2021-01-16 11:29:42 +08:00
//alert("Ondocumentopened成功回调");
if(cmd==5){
2020-12-23 11:14:35 +08:00
if(datavalue==1){
2021-01-16 11:29:42 +08:00
ntko.ShowTipMessage("注意","已经接收到父页面传过来的值,请注意文档中内容的变化");
ntkoDataToChild(datatext);
}
}
2020-12-23 11:14:35 +08:00
}
/*------------------------------------------------------*/
/* 以下内容 请勿修改,否则可能出错 */
/*------------------------------------------------------*/
2021-01-16 11:29:42 +08:00
var userAgent = navigator.userAgent,
rMsie = /(msie\s|trident.*rv:)([\w.]+)/,
rFirefox = /(firefox)\/([\w.]+)/,
rOpera = /(opera).+version\/([\w.]+)/,
rChrome = /(chrome)\/([\w.]+)/,
rSafari = /version\/([\w.]+).*(safari)/;
var browser;
var version;
var ua = userAgent.toLowerCase();
function uaMatch(ua) {
var match = rMsie.exec(ua);
if (match != null) {
return { browser : "IE", version : match[2] || "0" };
}
var match = rFirefox.exec(ua);
if (match != null) {
return { browser : match[1] || "", version : match[2] || "0" };
}
var match = rOpera.exec(ua);
if (match != null) {
return { browser : match[1] || "", version : match[2] || "0" };
}
var match = rChrome.exec(ua);
if (match != null) {
return { browser : match[1] || "", version : match[2] || "0" };
}
var match = rSafari.exec(ua);
if (match != null) {
return { browser : match[2] || "", version : match[1] || "0" };
}
if (match != null) {
return { browser : "", version : "0" };
}
}
var browserMatch = uaMatch(userAgent.toLowerCase());
if (browserMatch.browser) {
browser = browserMatch.browser;
version = browserMatch.version;
}
2020-12-23 11:14:35 +08:00
if (browser=="IE"){
2021-01-16 11:29:42 +08:00
if(window.navigator.platform=="Win32"){
document.write('<!-- 用来产生编辑状态的ActiveX控件的JS脚本--> ');
document.write('<!-- 因为微软的ActiveX新机制需要一个外部引入的js--> ');
document.write('<object id="TANGER_OCX" classid="clsid:'+classid+'"');
document.write('codebase="'+codebase+'" width="'+width+'" height="'+height+'"> ');
document.write('<param name="MakerCaption" value="'+MakerCaption+'"> ');
document.write('<param name="MakerKey" value="'+MakerKey+'"> ');
document.write('<param name="ProductCaption" value="'+ProductCaption+'"> ');
document.write('<param name="ProductKey" value="'+ProductKey+'"> ');
document.write('<param name="NoExpireKey" value="'+NoExpireKey+'"> ');
document.write('<param name="IsUseUTF8URL" value="-1"> ');
document.write('<param name="IsUseUTF8Data" value="-1"> ');
document.write('<param name="Caption" value="NTKO OFFICE文档控件示例演示 http://www.ntko.com"> ');
document.write('<SPAN STYLE="color:red">不能装载文档控件。请在检查浏览器的选项中检查浏览器的安全设置。</SPAN> ');
document.write('</object>');
}
if(window.navigator.platform=="Win64"){
document.write('<!-- 用来产生编辑状态的ActiveX控件的JS脚本--> ');
document.write('<!-- 因为微软的ActiveX新机制需要一个外部引入的js--> ');
document.write('<object id="TANGER_OCX" classid="clsid:'+classidx64+'"');
document.write('codebase="'+codebase64+'" width="'+width+'" height="'+height+'"> ');
document.write('<param name="MakerCaption" value="'+MakerCaption+'"> ');
document.write('<param name="MakerKey" value="'+MakerKey+'"> ');
document.write('<param name="ProductCaption" value="'+ProductCaption+'"> ');
document.write('<param name="ProductKey" value="'+ProductKey+'"> ');
document.write('<param name="NoExpireKey" value="'+NoExpireKey+'"> ');
document.write('<param name="IsUseUTF8URL" value="-1"> ');
document.write('<param name="IsUseUTF8Data" value="-1"> ');
document.write('<param name="Caption" value="NTKO OFFICE文档控件示例演示 http://www.ntko.com"> ');
document.write('<SPAN STYLE="color:red">不能装载文档控件。请在检查浏览器的选项中检查浏览器的安全设置。</SPAN> ');
document.write('</object>');
}
2020-12-23 11:14:35 +08:00
}
else if (browser=="firefox"){
2021-01-16 11:29:42 +08:00
document.write('<object id="TANGER_OCX" type="application/ntko-plug" codebase="'+codebase+'" width="'+width+'" height="'+height+'" ForOnSaveToURL="ntkosavetourl" ForOndocumentopened="ntkoondocumentopened"');
document.write('ForOnpublishAshtmltourl="ntkopublishashtml"');
document.write('ForOnpublishAspdftourl="ntkopublishaspdf"');
document.write('ForOnSaveAsOtherFormatToUrl="ntkosaveasotherurl"');
document.write('_MakerCaption="'+MakerCaption+'" ');
document.write('_MakerKey="'+MakerKey+'" ');
document.write('_ProductCaption="'+ProductCaption+'" ');
document.write('_ProductKey="'+ProductKey+'" ');
document.write('_NoExpireKey="'+NoExpireKey+'" ');
document.write('clsid="{'+classid+'}" >');
document.write('<SPAN STYLE="color:red">尚未安装NTKO Web FireFox跨浏览器插件</SPAN> ');
document.write('</object> ');
2020-12-23 11:14:35 +08:00
}else if(browser=="chrome"){
2021-01-16 11:29:42 +08:00
document.write('<object id="TANGER_OCX" clsid="{'+classid+'}" ForOnSaveToURL="ntkosavetourl" ForOndocumentopened="ntkoondocumentopened"');
document.write('ForOnpublishAshtmltourl="ntkopublishashtml"');
document.write('ForOnpublishAspdftourl="ntkopublishaspdf"');
document.write('ForOnSaveAsOtherFormatToUrl="ntkosaveasotherurl"');
document.write('_IsUseUTF8URL="-1" ');
document.write('_IsUseUTF8Data="-1" ');
document.write('_MakerCaption="'+MakerCaption+'" ');
document.write('_MakerKey="'+MakerKey+'" ');
document.write('_ProductCaption="'+ProductCaption+'" ');
document.write('_NoExpireKey="'+NoExpireKey+'" ');
document.write('_ProductKey="'+ProductKey+'" ');
document.write('codebase="'+codebase+'" width="'+width+'" height="'+height+'" type="application/ntko-plug" ');
document.write('<SPAN STYLE="color:red">尚未安装NTKO Web Chrome跨浏览器插件</SPAN> ');
document.write('</object>');
}else if (Sys.opera){
alert("sorry,ntko web印章暂时不支持opera!");
}else if (Sys.safari){
alert("sorry,ntko web印章暂时不支持safari!");
}
2020-12-23 11:14:35 +08:00
window.onunload =function(){
2021-01-16 11:29:42 +08:00
var ntkojb= ntkoBrowser.NtkoJudgingBrowsers();
if(ntkojb){
window.opener.ntkoCloseEvent();
}
2020-12-23 11:14:35 +08:00
}
//ie,谷歌,火狐传值
var ntkoBrowser={
2021-01-16 11:29:42 +08:00
ntkoSetReturnValueToParentPage:function(data1,text1){
var ntkojb= ntkoBrowser.NtkoJudgingBrowsers();
if(ntkojb){
window.opener.ieattachEventntko(data1,text1);
}else{
window.external.SetReturnValueToParentPage(data1,text1);
}
},
NtkoJudgingBrowsers:function(){
try{
var ntkobtop=window.opener.top.browser;
return true;
}catch(err){
return false;
}
},
2020-12-23 11:14:35 +08:00
}
//触发父页面传值的功能
var NtkoUrlTest = window.location.href;
if(NtkoUrlTest!=null&&NtkoUrlTest!=""){
2021-01-16 11:29:42 +08:00
var ntkoarry=new Array();
ntkoarry.push(NtkoUrlTest);
ntkoBrowser.ntkoSetReturnValueToParentPage("ntkoSendDataToChildtext",ntkoarry);
2020-12-23 11:14:35 +08:00
}