| 行 14: |
行 14: |
| | 或是呼叫"compositionupdate"的事件也可以觸發 | | 或是呼叫"compositionupdate"的事件也可以觸發 |
| | | | |
| − | 相關程式碼寫於ASLoadProgress.js?20240709065350 | + | 相關程式碼寫於ASLoadProgress.js |
| | | | |
| − | event listener: (237) window.addEventListener("compositionupdate", resetTimer); | + | event listener: |
| | + | <syntaxhighlight lang="javascript" line start="237"> |
| | + | 237|window.addEventListener("compositionupdate", resetTimer); |
| | + | </syntaxhighlight> |
| | | | |
| − | resetTimer: (323) | + | resetTimer: |
| − | <syntaxhighlight lang="javascript" line> | + | <syntaxhighlight lang="javascript" line start="323"> |
| − | function resetTimer() { | + | 323|function resetTimer() { |
| − | console.log("resetTimer");
| + | 324| console.log("resetTimer"); |
| − | window.top.clearTimeout(ast);
| + | 325| window.top.clearTimeout(ast); |
| − | var sessionTimeoutWarning = 20; //min
| + | 326| var sessionTimeoutWarning = 20; //min |
| − | var sTimeout = parseInt(sessionTimeoutWarning) * 60 * 1000;
| + | 327| var sTimeout = parseInt(sessionTimeoutWarning) * 60 * 1000; |
| − | ast = window.top.setTimeout(logout, sTimeout);
| + | 328| ast = window.top.setTimeout(logout, sTimeout); |
| − | var current = new Date();
| + | 329| var current = new Date(); |
| − | if (((current.getTime() - aspostback.getTime())/60000)>15)
| + | 330| if (((current.getTime() - aspostback.getTime())/60000)>15) |
| − | {
| + | 331| { |
| − | try {
| + | 332| try { |
| − | var astimerclient = getXmlHttpRequestObject();
| + | 333| var astimerclient = getXmlHttpRequestObject(); |
| − | astimerclient.open("GET", encodeURI("AsCheck.ashx"), false);
| + | 334| astimerclient.open("GET", encodeURI("AsCheck.ashx"), false); |
| − | astimerclient.send();
| + | 335| astimerclient.send(); |
| − | }
| + | 336| } |
| − | catch (e) {
| + | 337| catch (e) { |
| − | }
| + | 338| } |
| − | aspostback = new Date();
| + | 339| aspostback = new Date(); |
| − | console.log("AsCheck");
| + | 340| console.log("AsCheck"); |
| − | }
| + | 341| } |
| − | // 1000 milisec = 1 sec
| + | 342| // 1000 milisec = 1 sec |
| − | }
| + | 343| } |
| | </syntaxhighlight> | | </syntaxhighlight> |
| | + | |
| | + | === 登出方法 === |