Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
check
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abook_web
check
Commits
1da5c4e9
Commit
1da5c4e9
authored
Aug 04, 2014
by
Masaru Abe
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
screenLock.jsリファクタリング
parent
6ba272bc
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
106 additions
and
95 deletions
+106
-95
abvw/common/js/common.js
+1
-1
abvw/common/js/screenLock.js
+105
-94
No files found.
abvw/common/js/common.js
View file @
1da5c4e9
...
...
@@ -2057,7 +2057,7 @@ COMMON.LockScreen = function() {
var
timeWaitLockScreen
=
COMMON
.
getTimeWaitLockScreen
();
if
(
timeWaitLockScreen
>
0
)
{
//var message = I18N.i18nText("sysInfoScrLock01");
screenLock
({
SCREENLOCK
.
screenLock
({
timeout
:
timeWaitLockScreen
,
html
:
'<img src="img/1222.png" alt="Screen Lock" /><br />'
,
//+ message,
unlockFunc
:
COMMON
.
unlockFunction
,
...
...
abvw/common/js/screenLock.js
View file @
1da5c4e9
...
...
@@ -22,39 +22,52 @@
* }
*
*/
function
screenLock
(
options
)
{
//グローバルの名前空間用のオブジェクトを用意する
var
SCREENLOCK
=
{};
SCREENLOCK
.
screenLock
=
function
(
options
)
{
var
idleTimerId
=
null
;
var
bTimeout
=
false
;
var
defaultOptions
=
{
timeout
:
600000
,
// default timeout = 10min.
id
:
'to'
,
html
:
'Clickして画面ロックを解除してください。'
,
color
:
'#fff'
,
opacity
:
'0.95'
,
background
:
'#333'
,
lockspeed
:
'slow'
,
errorMessage
:
'ロックを解除できません。入力したパスワードを確認してください。'
,
unlockFunc
:
function
(
elmId
)
{
// overlay click then fade out and remove element
$
(
'#'
+
elmId
).
fadeOut
(
lockspeed
,
function
()
{
// ロック画面をDOM要素から削除
$
(
'#'
+
elmId
).
remove
();
// 画面ロック状態を解除
removeLockState
();
// アイドルタイマーをもう一度仕掛ける
setIdleTimer
();
});
// unlock
return
{
'result'
:
true
,
'errorCode'
:
'success'
};
}
};
var
timeout
,
elmId
,
html
,
color
,
opacity
,
background
,
lockspeed
,
unlockEvent
,
unlockFunc
,
errorMessage
;
timeout
:
600000
,
// default timeout = 10min.
id
:
'to'
,
html
:
'Clickして画面ロックを解除してください。'
,
color
:
'#fff'
,
opacity
:
'0.95'
,
background
:
'#333'
,
lockspeed
:
'slow'
,
errorMessage
:
'ロックを解除できません。入力したパスワードを確認してください。'
,
unlockFunc
:
function
(
elmId
)
{
// overlay click then fade out and remove element
$
(
'#'
+
elmId
).
fadeOut
(
lockspeed
,
function
()
{
// ロック画面をDOM要素から削除
$
(
'#'
+
elmId
).
remove
();
// 画面ロック状態を解除
removeLockState
();
// アイドルタイマーをもう一度仕掛ける
setIdleTimer
();
});
// unlock
return
{
'result'
:
true
,
'errorCode'
:
'success'
};
}
};
var
timeout
;
var
elmId
;
var
html
;
var
color
;
var
opacity
;
var
background
;
var
lockspeed
;
var
unlockEvent
;
var
unlockFunc
;
var
errorMessage
;
// overlay option
if
(
options
)
{
...
...
@@ -81,10 +94,10 @@ function screenLock(options) {
// bind event
$
(
window
).
click
(
resetIdleTimer
)
.
mousemove
(
resetIdleTimer
)
.
keydown
(
resetIdleTimer
)
.
bind
(
'touchstart'
,
resetIdleTimer
)
.
bind
(
'touchmove'
,
resetIdleTimer
);
.
mousemove
(
resetIdleTimer
)
.
keydown
(
resetIdleTimer
)
.
bind
(
'touchstart'
,
resetIdleTimer
)
.
bind
(
'touchmove'
,
resetIdleTimer
);
// アイドルタイマーを起動
setIdleTimer
();
...
...
@@ -92,23 +105,23 @@ function screenLock(options) {
/* ロックするまでのアイドルタイマー */
function
setIdleTimer
()
{
// check time out
if
(
timeout
<
0
)
{
// Remove unlock when timeout < 0 (this case for: after unlock, values from service options: web_screen_lock=N)
// clear timeout
if
(
idleTimerId
)
{
clearTimeout
(
idleTimerId
);
idleTimerId
=
null
;
}
bTimeout
=
false
;
// clear lock state
removeLockState
();
return
;
}
// check time out
if
(
timeout
<
0
)
{
// Remove unlock when timeout < 0 (this case for: after unlock, values from service options: web_screen_lock=N)
// clear timeout
if
(
idleTimerId
)
{
clearTimeout
(
idleTimerId
);
idleTimerId
=
null
;
}
bTimeout
=
false
;
// clear lock state
removeLockState
();
return
;
}
// アイドルタイマーのタイムアウト時間(デフォルト/オプション指定時間)
var
idleStateTimeout
=
timeout
;
...
...
@@ -121,11 +134,10 @@ function screenLock(options) {
// すでにロック状態かどうかをチェックし、ロック状態であれば、即ロックをかける
if
(
isLocked
())
{
idleStateTimeout
=
0
;
}
// clear lock state
removeLockState
();
}
// clear lock state
removeLockState
();
// set idle timeout
idleTimerId
=
setTimeout
(
function
()
{
...
...
@@ -141,7 +153,7 @@ removeLockState();
showLockScreen
();
},
idleStateTimeout
);
// clear time out
bTimeout
=
false
;
};
...
...
@@ -195,18 +207,18 @@ removeLockState();
// フォーカスを当ててキーダウンイベントでタイムアウト解除を登録
$
(
'#passwd-txt'
).
focus
()
.
keydown
(
function
(
event
)
{
// パスワード入力タイマーを解除
if
(
pwInputTimer
)
{
clearTimeout
(
pwInputTimer
);
}
pwInputTimer
=
null
;
// エンターキーで解除実行
if
(
event
.
which
==
13
)
{
executeUnlock
();
}
});
.
keydown
(
function
(
event
)
{
// パスワード入力タイマーを解除
if
(
pwInputTimer
)
{
clearTimeout
(
pwInputTimer
);
}
pwInputTimer
=
null
;
// エンターキーで解除実行
if
(
event
.
which
==
13
)
{
executeUnlock
();
}
});
});
// force unlock function
...
...
@@ -216,40 +228,39 @@ removeLockState();
// execute unlock process
function
executeUnlock
()
{
if
(
unlockFunc
)
{
var
val
=
unlockFunc
(
$
(
'#passwd-txt'
).
val
(),
forceUnlockFunc
);
if
(
!
val
.
result
)
{
$
(
'#screenLockErrMsg'
).
text
(
AVWEB
.
format
(
errorMessage
,
val
.
errorCode
.
errorMessage
));
$
(
'#screenLockErrMsg'
).
fadeIn
();
$
(
'#passwd-txt'
).
focus
();
return
;
}
else
{
// Set new timeout value
timeout
=
val
.
newTimeout
;
}
/*
if(!unlockFunc($('#passwd-txt').val(), forceUnlockFunc)) {
$('#screenLockErrMsg').fadeIn();
$('#passwd-txt').focus();
return;
}
*/
}
defaultOptions
.
unlockFunc
(
elmId
);
if
(
unlockFunc
)
{
var
val
=
unlockFunc
(
$
(
'#passwd-txt'
).
val
(),
forceUnlockFunc
);
if
(
!
val
.
result
)
{
$
(
'#screenLockErrMsg'
).
text
(
AVWEB
.
format
(
errorMessage
,
val
.
errorCode
.
errorMessage
));
$
(
'#screenLockErrMsg'
).
fadeIn
();
$
(
'#passwd-txt'
).
focus
();
return
;
}
else
{
// Set new timeout value
timeout
=
val
.
newTimeout
;
}
/*
if(!unlockFunc($('#passwd-txt').val(), forceUnlockFunc)) {
$('#screenLockErrMsg').fadeIn();
$('#passwd-txt').focus();
return;
}
*/
}
defaultOptions
.
unlockFunc
(
elmId
);
}
// OKボタン押下でロック解除関数を実行
$
(
'#unlock-btn'
).
click
(
function
()
{
executeUnlock
();
});
// resize overlay
// resize overlay
$
(
window
).
resize
(
function
()
{
$
(
'#'
+
elmId
).
css
(
{
'width'
:
$
(
window
).
width
(),
'height'
:
$
(
window
).
height
()
});
});
});
});
};
/* set lock state */
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment