/** * JWord Utility * UPDATE:20120215 */ /* * Class */ function JWordUtility() { this.finish_text_for_jwd2 = 'JWord Plugin Install Success.' this.finish_url = ''; this.finish_action_type = ''; this.finish_action_target = ''; this.partner = ''; this.logcode = ''; this.lastse = ''; this.CreateObjectExpBarFlag = false; /* * Install Able Env */ this.InstallAbleEnvCheck = function() { if (this.isWin9xFam()) { return false; } /*@cc_on /*@if (@_win32 || @_win64) return true; @else @*/ return false; /*@end @*/ }; /* * Installed Check */ this.InstallCheck = function() { var cns = this.InstallCheckCns(); var jwd2 = this.InstallCheckJWD2(); if (cns || jwd2) { return true; } return false; }; this.InstallCheckCns = function() { /*@cc_on try { var cns = new ActiveXObject('CnsHelper.CH'); if (typeof cns != 'undefined') { return true; } } catch(e) {} @*/ return false; }; this.InstallCheckJWD2 = function() { /*@cc_on try { var jwd2 = new ActiveXObject('JWord.Update'); if (typeof jwd2 != 'undefined') { return true; } } catch(e) {} @*/ return false; }; this.InstallCheckExpBar = function() { /*@cc_on try { var expbar = new ActiveXObject('JwdExpBar.ExplorerBarHelper'); if (typeof expbar != 'undefined') { return true; } } catch(e) {} @*/ return false; }; /* * Uninstall */ this.Uninstall = function() { var cns = this.InstallCheckCns(); var jwd2 = this.InstallCheckJWD2(); if (cns) { return this.UninstallCNS(); } if (jwd2) { return this.UninstallJWD2(); } }; this.UninstallCNS = function() { if (typeof CnsMin == 'undefined') { this.CreateObjectJWD(); } if (typeof CnsMin != 'undefined') { /*@cc_on try { CnsMin.Uninstall(); return true; } catch(e) { return false; } @*/ } return false; }; this.UninstallJWD2 = function() { if (typeof JWD2 == 'undefined') { this.CreateObjectJWD(); } if (typeof JWD2 != 'undefined') { /*@cc_on try { JWD2.Uninstall(); return true; } catch(e) { return false; } @*/ } return false; }; /* * Win64bit Check */ this.isWin64bit = function() { /*@cc_on appVer = navigator.userAgent; if (appVer.indexOf(' Win64') != -1 || appVer.indexOf(' WOW64') != -1) { return true; } @*/ return false; }; /* * Win IE64bit Check */ this.isWinIE64bit = function() { /*@cc_on appVer = navigator.userAgent; if (appVer.indexOf(' Win64') != -1) { return true; } @*/ return false; }; /* * Vista Check */ this.isVista = function() { /*@cc_on var appVer = navigator.userAgent; if (appVer.indexOf('NT 6.0') != -1) { return true; } @*/ return false; }; /* * WinNT Check */ this.isWinNTFam = function() { /*@cc_on appVer = navigator.userAgent; if (appVer.indexOf('NT ') != -1) { return true; } @*/ return false; }; /* * Win9x Check */ this.isWin9xFam = function() { /*@cc_on appVer = navigator.userAgent; if (appVer.indexOf('Windows 9') != -1) { return true; } @*/ return false; }; /* * ActiveX setter & getter */ this.GetJWDVersion = function() { var version; if (typeof CnsMin != 'undefined') { version = CnsMin.Version; } else if (typeof JWD2 != 'undefined') { version = JWD2.Version; } return version; }; this.GetValue = function(label) { var v; if (typeof CnsMin != 'undefined') { v = CnsMin.GetValue(label); } else if (typeof JWD2 != 'undefined') { v = JWD2.GetValue(label); } return v; }; this.GetPartner = function() { var v; if (typeof CnsMin != 'undefined') { v = CnsMin.GetValue("Partner"); } else if (typeof JWD2 != 'undefined') { v = JWD2.Partner; } return v; }; this.GetVersion = function() { var version; if(typeof CnsMin != 'undefined') { version = CnsMin.Version; } else if(typeof JWD2 != 'undefined') { version = JWD2.Version; } if (typeof v == 'undefined') { v = ""; } return version; }; this.SetValue = function(lable, value) { if (typeof CnsMin != 'undefined') { CnsMin.SetValue(lable, String(value)); } else if (typeof JWD2 != 'undefined') { JWD2.SetValue(lable, String(value)); } }; this.SetPartner = function(name) { if (typeof CnsMin != 'undefined') { CnsMin.SetValue("Partner", String(name)); } }; this.SetLastSE = function(name) { if (typeof CnsMin != 'undefined') { CnsMin.SetValue('LastSE', String(name)); } else if (typeof JWD2 != 'undefined') { JWD2.SetValue('LastSE', String(name)); } }; this.GetModuleVersion = function(name) { var version = ''; if (typeof CnsMin != 'undefined') { } else if (typeof JWD2 != 'undefined') { /*@cc_on try { version = JWD2.GetModuleVersion(name); return version; } catch(e) { return false; } @*/ } return version; }; /* * JWord Plugin Lite Edition Check */ this.CheckJWDLite = function() { var version = ''; if (typeof CnsMin == 'undefined') { this.CreateObjectJWD(); } version = this.GetJWDVersion(); if (version.indexOf('1.5') == 0) { return true; } else { return false; } }; this.CheckEnableSearchPane = function() { if (typeof window.external == 'unknown' && this.isWinIE()) { return 0; } else if (typeof JWD2 != 'undefined') { if (this.isWinIE7Upper() && this.InstallCheckExpBar()) { return 3; } else if (this.isWinIE9Upper()) { return 0; } else if (this.isWinIE7Upper()) { if (JWD2.EnableSearchPane == 1 && this.isAllowedJWD2()) { return 1; } } else if (this.isWinIE6() && this.isWinXPSP2()) { return 2; } else { return 1; } } else if (typeof CnsMin != 'undefined') { if (this.isCnsMinLite()) { if (this.isWinIE7Upper()) { return 0; } else if (this.isWinIE6() && this.isWinXPSP2()) { return 2; } else { return 1; } } else { if (this.isWinIE7Upper()) { if (typeof CnsMin.EnableSearchPane != 'undefined') { if (CnsMin.EnableSearchPane == 1 && this.isAllowedCNS()) { return 1; } } } else if (this.isWinIE6() && this.isWinXPSP2()) { return 2; } else { return 1; } } } else if (this.isWinIE6() && this.isWinXPSP2()) { return 2; } else if (this.isWinIE() && !this.isWinIE7Upper()) { return 1; } return 0; }; this.openSidebar = function(u) { if (u == '') return false; var t = this.CheckEnableSearchPane(); if (t == 1) { window.open(u, '_search', ''); return true; } else if (t == 2) { window.external.NavigateAndFind(u, '', '_search'); return true; } else if (t == 3) { this.CreateObjectExpBar(); if(JWordExplorerBarBHO.VerticalExplorerBarVisible() == false) { JWordExplorerBarBHO.ShowVerticalExplorerBar(u); } else { JWordExplorerBarBHO.SetVerticalExplorerBarURL(u); } } else { return false; } }; this.isWinIE9Upper = function() { /*@cc_on if (9 <= ScriptEngineMajorVersion()) { return true; } @*/ return false; }; this.isWinIE7Upper = function() { /*@cc_on @if (@_win32 || @_win64) if (typeof XMLHttpRequest != 'undefined') { return true; } @end @*/ return false; }; this.isWinIE6 = function() { /*@cc_on @if (@_win32 || @_win64) if (typeof XMLHttpRequest == 'undefined') { return true; } @end @*/ return false; }; this.isWinIE = function() { /*@cc_on @if (@_win32 || @_win64) return true; @end @*/ return false; }; this.isCnsMinLite = function() { var version = String(this.GetVersion()); if("1.5.0.0" <= version && version <= "1.5.9.9") { return true; } return false; } this.isAllowed = function() { if (typeof JWD2 != 'undefined') { return this.isAllowedJWD2(); } else if (typeof CnsMin != 'undefined') { return this.isAllowedCNS(); } return false; }; this.isAllowedJWD2 = function() { if (typeof JWD2 != 'undefined') { if (JWD2.IsAllowed == 1) { return true; } } return false; }; this.isAllowedCNS = function() { if (typeof CnsMin != 'undefined') { var idnhelper = this.GetValue("IdnHelper"); if ("2.0.2.0" <= idnhelper) { return true; } } return false; }; this.isWinXPSP2 = function() { /*@cc_on @if (@_win32 || @_win64) if (navigator.userAgent.indexOf("SV1") != -1) { return true; } @end @*/ return false; }; /* * Init */ this.FinishAction = function() { if (this.finish_action_type == 'gotopage' && this.finish_url != '') { parent.parent.location = this.finish_url; } else if (this.finish_action_type == 'gotopage_with_target' && this.finish_action_target != '' && this.finish_url != '') { var t; eval('t = ' + this.finish_action_target + ';'); t.location.href = this.finish_url; } }; this.SetupJWD = function() { if (this.InstallCheckCns()) { CnsMin.CheckNew('1.1.2.9'); CnsMin.CheckNewEx('1.0.0.4'); CnsMin.ProcessPage(); CnsMin.Register(this.logcode); CnsMin.Enable(1); this.SetValue('Partner', String(this.partner)); } this.SetValue('LastSE', String(this.lastse)); this.SetValue('LastSE.org', String(this.lastse)); }; this.InstallSuccess = function() { if (this.InstallCheckJWD2()) { var msg = ""; this.InstallLogSend(); alert(this.finish_text_for_jwd2); } }; this.InstallLogSend = function() { var img = new Image(); var log = ''; log = 'http://search.jword.jp/jwd2inst.htm'; log += '?partner=' + this.logcode; log += '&ver=' + this.GetJWDVersion(); log += '&lastse=' + this.lastse; log += '&rnd=' + (Math.round(Math.random() * 1000)); img.src = log; }; this.Init = function() { var WebInstalledCheck = ''; if (this.InstallCheck()) { WebInstalledCheck = this.GetValue('WebInstalledCheck'); if (WebInstalledCheck == '') { WebInstalledCheck = Math.round(Math.random() * 1000); this.SetupJWD(); this.SetValue('WebInstalledCheck', String(WebInstalledCheck)); if (this.GetValue('WebInstalledCheck') == WebInstalledCheck) { //this.InstallSuccess(); } } this.FinishAction(); } }; this.InstallJWD = function() { var objID = ''; var objClassID = ''; var objCodeBase = ''; if (this.InstallCheck()) { this.FinishAction(); return false; } if (this.partner == '') { this.partner = 'AP'; } if (this.isWinNTFam()) { objID = 'JWD2'; objClassID = 'clsid:0A34F491-7249-4bac-8E46-04DB2CA764CB'; objCodeBase = 'http://download.jword.jp/soft/jwd2download.htm?partner=' + this.logcode + '&#version=2,1,0,0'; document.write(''); } }; this.CreateObject = function(objID, objClassID, objCodeBase) { var o = document.createElement("object"); o.id = objID; o.classid = objClassID; if (objCodeBase != '') { o.codebase = objCodeBase; } document.getElementsByTagName('head')[0].appendChild(o); }; this.CreateObjectJWD = function() { if (this.InstallCheckJWD2()) { objID = 'JWD2'; objClassID = 'clsid:0A34F491-7249-4bac-8E46-04DB2CA764CB'; this.CreateObject(objID, objClassID, ''); } if (this.InstallCheckCns()) { objID = 'CnsMin'; objClassID = 'clsid:B83FC273-3522-4CC6-92EC-75CC86678DA4'; this.CreateObject(objID, objClassID, ''); } }; this.CreateObjectExpBar = function() { if (!this.CreateObjectExpBarFlag && this.InstallCheckExpBar()) { objID = 'JWordExplorerBarBHO'; objClassID = 'clsid:70879F23-6ED6-4461-BA7B-BC9F383FA84F'; this.CreateObject(objID, objClassID, ''); this.CreateObjectExpBarFlag = true; } }; }