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
7ecf8186
Commit
7ecf8186
authored
Nov 17, 2022
by
Kang Donghun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
solved comflict
parent
1e6896ae
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
233 additions
and
233 deletions
+233
-233
abweb/common/js/common.js
+233
-233
No files found.
abweb/common/js/common.js
View file @
7ecf8186
...
@@ -11,9 +11,9 @@
...
@@ -11,9 +11,9 @@
*
*
* @since cms:1.4.3.2&1.4.3.3 web:1.0
* @since cms:1.4.3.2&1.4.3.3 web:1.0
*/
*/
var
COMMON
=
{};
var
COMMON
=
{};
CONSTANT
.
PAGE_NAME
=
{
CONSTANT
.
PAGE_NAME
=
{
DASHBOARD
:
'dashboard'
,
DASHBOARD
:
'dashboard'
,
OPERATION_LIST
:
'workList'
,
OPERATION_LIST
:
'workList'
,
REPORT_LIST
:
'reportList'
,
REPORT_LIST
:
'reportList'
,
...
@@ -26,63 +26,61 @@ CONSTANT.PAGE_NAME = {
...
@@ -26,63 +26,61 @@ CONSTANT.PAGE_NAME = {
PDF_PRINT
:
'pdfPrint'
,
PDF_PRINT
:
'pdfPrint'
,
DEFAULT
:
'index'
,
DEFAULT
:
'index'
,
LOGIN
:
'./login.html'
,
LOGIN
:
'./login.html'
,
};
};
COMMON
.
loginCheckPageList
=
[
CONSTANT
.
PAGE_NAME
.
DEFAULT
,
CONSTANT
.
PAGE_NAME
.
DASHBOARD
,
CONSTANT
.
PAGE_NAME
.
REPORT_LIST
,
CONSTANT
.
PAGE_NAME
.
REPORT_FORM
,
COMMON
.
loginCheckPageList
=
[
CONSTANT
.
PAGE_NAME
.
DEFAULT
,
CONSTANT
.
PAGE_NAME
.
DASHBOARD
,
CONSTANT
.
PAGE_NAME
.
REPORT_LIST
,
CONSTANT
.
PAGE_NAME
.
REPORT_FORM
,
CONSTANT
.
PAGE_NAME
.
MESSAGE_DETAIL
,
CONSTANT
.
PAGE_NAME
.
MESSAGE_LIST
,
CONSTANT
.
PAGE_NAME
.
SEND_MESSAGE
,
CONSTANT
.
PAGE_NAME
.
SETTING
,
CONSTANT
.
PAGE_NAME
.
MESSAGE_DETAIL
,
CONSTANT
.
PAGE_NAME
.
MESSAGE_LIST
,
CONSTANT
.
PAGE_NAME
.
SEND_MESSAGE
,
CONSTANT
.
PAGE_NAME
.
SETTING
,
CONSTANT
.
PAGE_NAME
.
PICKUP
,
CONSTANT
.
PAGE_NAME
.
PDF_PRINT
];
CONSTANT
.
PAGE_NAME
.
PICKUP
,
CONSTANT
.
PAGE_NAME
.
PDF_PRINT
];
COMMON
.
hasErrorKey
=
'AVW_HASERR'
;
COMMON
.
hasErrorKey
=
'AVW_HASERR'
;
$
(
document
).
ready
(
function
()
{
$
(
document
).
ready
(
function
()
{
const
checkUrl
=
location
.
href
.
substring
(
location
.
href
.
lastIndexOf
(
'/'
)
+
1
,
location
.
href
.
lastIndexOf
(
".html"
));
const
checkUrl
=
location
.
href
.
substring
(
location
.
href
.
lastIndexOf
(
'/'
)
+
1
,
location
.
href
.
lastIndexOf
(
".html"
));
if
(
COMMON
.
loginCheckPageList
.
includes
(
checkUrl
))
{
if
(
COMMON
.
loginCheckPageList
.
includes
(
checkUrl
))
{
if
(
!
COMMON
.
checkLogin
(
CONSTANT
.
PAGE_NAME
.
LOGIN
)){
if
(
!
COMMON
.
checkLogin
(
CONSTANT
.
PAGE_NAME
.
LOGIN
)){
return
;
return
;
}
}
}
}
})
})
/**
/**
* page transition without outputting a warning message
* page transition without outputting a warning message
* @param {*} url
* @param {*} url
*/
*/
COMMON
.
avwScreenMove
=
function
(
url
)
{
COMMON
.
avwScreenMove
=
function
(
url
)
{
console
.
log
(
"kdh check avwScreenMove url : "
+
url
);
COMMON
.
showLoading
();
COMMON
.
showLoading
();
window
.
onbeforeunload
=
null
;
window
.
onbeforeunload
=
null
;
window
.
location
=
url
;
window
.
location
=
url
;
};
};
/**
/**
* show loading dialog
* show loading dialog
* show msg by key
* show msg by key
*
*
* @param {String} key
* @param {String} key
*/
*/
COMMON
.
showLoading
=
function
()
{
COMMON
.
showLoading
=
function
()
{
console
.
log
(
"kdh check showLoading"
);
console
.
log
(
"kdh check showLoading"
);
$
(
'#loader'
).
css
(
{
$
(
'#loader'
).
css
(
{
'width'
:
$
(
window
).
width
(),
'width'
:
$
(
window
).
width
(),
'height'
:
$
(
window
).
height
()
'height'
:
$
(
window
).
height
()
});
});
document
.
getElementById
(
'loader'
).
style
.
display
=
'block'
;
document
.
getElementById
(
'loader'
).
style
.
display
=
'block'
;
};
};
/**
/**
* close loading
* close loading
*/
*/
COMMON
.
closeLoading
=
function
()
{
COMMON
.
closeLoading
=
function
()
{
console
.
log
(
"kdh check closeLoading"
);
setTimeout
(
function
(){
setTimeout
(
function
(){
document
.
getElementById
(
'loader'
).
style
.
display
=
'none'
;
document
.
getElementById
(
'loader'
).
style
.
display
=
'none'
;
},
1000
);
},
1000
);
};
};
/**
/**
* show confirm modal with yes, no buttons
* show confirm modal with yes, no buttons
* @param {Object} data - Object with {title, message, confirmYes, confirmNo}
* @param {Object} data - Object with {title, message, confirmYes, confirmNo}
* @param {callback} confirmCallback - The callback that handles the confirm button clicked
* @param {callback} confirmCallback - The callback that handles the confirm button clicked
*/
*/
COMMON
.
showConfirmModal
=
function
(
data
,
confirmCallback
)
{
COMMON
.
showConfirmModal
=
function
(
data
,
confirmCallback
)
{
if
(
data
)
{
if
(
data
)
{
let
title
=
''
;
let
title
=
''
;
if
(
data
.
title
)
{
if
(
data
.
title
)
{
...
@@ -118,73 +116,73 @@ COMMON.showConfirmModal = function (data, confirmCallback) {
...
@@ -118,73 +116,73 @@ COMMON.showConfirmModal = function (data, confirmCallback) {
}
}
}
}
$
(
'#showConfirmModalButton'
).
click
();
$
(
'#showConfirmModalButton'
).
click
();
};
};
/**
/**
* Show confirm modal with defaults: title, yes, no
* Show confirm modal with defaults: title, yes, no
* @param {string} messageCode
* @param {string} messageCode
* @param {callback} confirmCallback - The callback that handles the confirm button clicked
* @param {callback} confirmCallback - The callback that handles the confirm button clicked
* @param {Object} options - Object with {title, message, confirmYes, confirmNo
}
* @param {Object} options - Object with {titleCode, message, confirmYesCode, confirmNoCode
}
*/
*/
COMMON
.
showConfirm
=
function
(
messageCode
,
confirmCallback
,
options
=
{})
{
COMMON
.
showConfirm
=
function
(
messageCode
,
confirmCallback
,
options
=
{})
{
const
defaultParams
=
{
const
defaultParams
=
{
titleCode
:
'confirmation'
,
titleCode
:
'confirmation'
,
confirmYesCode
:
'confirmYes'
,
confirmYesCode
:
'confirmYes'
,
confirmNoCode
:
'confirmNo'
confirmNoCode
:
'confirmNo'
}
}
const
params
=
Object
.
assign
(
options
,
defaultParam
s
);
const
params
=
Object
.
assign
(
defaultParams
,
option
s
);
let
message
=
''
;
let
message
=
''
;
if
(
messageCode
)
{
if
(
messageCode
)
{
message
=
I18N
.
i18nText
(
messageCode
);
message
=
I18N
.
i18nText
(
messageCode
);
if
(
typeof
message
===
'undefined'
)
{
//lang of messageCode undefined, use message or messageCode
if
(
params
.
message
)
{
message
=
params
.
message
;
}
else
{
message
=
messageCode
;
}
}
}
else
if
(
params
.
message
)
{
}
else
if
(
params
.
message
)
{
message
=
params
.
message
;
message
=
params
.
message
;
}
}
let
title
=
I18N
.
i18nText
(
params
.
titleCode
);
if
(
params
.
title
)
{
title
=
params
.
title
;
}
COMMON
.
showConfirmModal
({
COMMON
.
showConfirmModal
({
message
:
message
,
message
:
message
,
title
:
I18N
.
i18nText
(
params
.
titleCode
)
,
title
:
title
,
confirmYes
:
I18N
.
i18nText
(
params
.
confirmYesCode
),
confirmYes
:
I18N
.
i18nText
(
params
.
confirmYesCode
),
confirmNo
:
I18N
.
i18nText
(
params
.
confirmNoCode
)
confirmNo
:
I18N
.
i18nText
(
params
.
confirmNoCode
)
},
confirmCallback
);
},
confirmCallback
);
};
};
/**
/**
* show alert message by confirm modal html
* show alert message by confirm modal html
* @param {String} messageCode
* @param {String} messageCode
* @param {string} titleCode
* @param {string} titleCode
* @param {Object} options - Data Options {message, titleCode, confirmNoCode}
* @param {Object} options - Data Options {message, titleCode, confirmNoCode}
*/
*/
COMMON
.
showAlert
=
function
(
messageCode
,
titleCode
=
'error'
,
options
=
{})
{
COMMON
.
showAlert
=
function
(
messageCode
,
titleCode
=
'error'
,
options
=
{})
{
const
defaultParams
=
{
const
defaultParams
=
{
titleCode
:
titleCode
?
titleCode
:
'error'
,
titleCode
:
titleCode
?
titleCode
:
'error'
,
confirmNoCode
:
'close'
confirmYesCode
:
null
,
confirmNoCode
:
'close'
,
}
}
const
params
=
Object
.
assign
(
options
,
defaultParams
);
const
params
=
Object
.
assign
(
defaultParams
,
options
);
let
message
=
''
;
COMMON
.
showConfirm
(
messageCode
,
null
,
params
);
if
(
messageCode
)
{
};
message
=
I18N
.
i18nText
(
messageCode
);
if
(
typeof
message
===
'undefined'
)
{
message
=
messageCode
;
}
}
else
if
(
params
.
message
)
{
message
=
params
.
message
;
}
COMMON
.
showConfirmModal
({
message
:
message
,
title
:
I18N
.
i18nText
(
params
.
titleCode
),
confirmNo
:
I18N
.
i18nText
(
params
.
confirmNoCode
)
});
};
/**
/**
* close alert
* close alert
*/
*/
COMMON
.
alertClose
=
function
()
{
COMMON
.
alertClose
=
function
()
{
$
(
'.alert-overlay'
).
addClass
(
'd-none'
);
$
(
'.alert-overlay'
).
addClass
(
'd-none'
);
$
(
'.alert-area'
).
addClass
(
'd-none'
);
$
(
'.alert-area'
).
addClass
(
'd-none'
);
$
(
'body'
).
css
(
'overflow'
,
'visible'
);
$
(
'body'
).
css
(
'overflow'
,
'visible'
);
};
};
/**
/**
* go Url page With Current Params
* go Url page With Current Params
*
*
* ios will remove all web types data when reopen webview
* ios will remove all web types data when reopen webview
...
@@ -193,7 +191,7 @@ COMMON.alertClose = function () {
...
@@ -193,7 +191,7 @@ COMMON.alertClose = function () {
* @param {String} url
* @param {String} url
* @param {Object} params
* @param {Object} params
*/
*/
COMMON
.
goUrlWithCurrentParams
=
function
(
url
,
params
)
{
COMMON
.
goUrlWithCurrentParams
=
function
(
url
,
params
)
{
if
(
!
params
)
{
if
(
!
params
)
{
location
.
href
=
CONSTANT
.
URL
.
WEB
.
BASE
+
url
;
location
.
href
=
CONSTANT
.
URL
.
WEB
.
BASE
+
url
;
}
}
...
@@ -204,13 +202,13 @@ COMMON.goUrlWithCurrentParams = function (url, params) {
...
@@ -204,13 +202,13 @@ COMMON.goUrlWithCurrentParams = function (url, params) {
}
else
{
}
else
{
location
.
href
=
url
+
'?'
+
new
URLSearchParams
(
mixParams
);
location
.
href
=
url
+
'?'
+
new
URLSearchParams
(
mixParams
);
}
}
};
};
/**
/**
* get url parameter
* get url parameter
*
*
*/
*/
COMMON
.
getUrlParameter
=
function
()
{
COMMON
.
getUrlParameter
=
function
()
{
var
ret
=
{};
var
ret
=
{};
if
(
location
.
search
)
{
if
(
location
.
search
)
{
var
param
=
{};
var
param
=
{};
...
@@ -225,17 +223,17 @@ COMMON.getUrlParameter = function () {
...
@@ -225,17 +223,17 @@ COMMON.getUrlParameter = function () {
}
}
console
.
log
({
ret
:
ret
});
console
.
log
({
ret
:
ret
});
return
ret
;
return
ret
;
};
};
/**
/**
* get sid in local Storage
* get sid in local Storage
*
*
*/
*/
COMMON
.
getSid
=
function
()
{
COMMON
.
getSid
=
function
()
{
return
ClientData
.
userInfo_sid
();
return
ClientData
.
userInfo_sid
();
};
};
/**
/**
* cms communication
* cms communication
*
*
* @param {String} url
* @param {String} url
...
@@ -245,7 +243,7 @@ COMMON.getSid = function () {
...
@@ -245,7 +243,7 @@ COMMON.getSid = function () {
* @param {Object} errorCallback
* @param {Object} errorCallback
* @param {number} type
* @param {number} type
*/
*/
COMMON
.
cmsAjax
=
function
(
url
,
param
,
async
=
true
,
callback
,
errorCallback
,
type
)
{
COMMON
.
cmsAjax
=
function
(
url
,
param
,
async
=
true
,
callback
,
errorCallback
,
type
)
{
var
sysSettings
=
new
COMMON
.
sysSetting
();
var
sysSettings
=
new
COMMON
.
sysSetting
();
if
(
url
)
{
if
(
url
)
{
$
.
ajax
({
$
.
ajax
({
...
@@ -296,14 +294,14 @@ COMMON.cmsAjax = function (url, param, async = true, callback, errorCallback, ty
...
@@ -296,14 +294,14 @@ COMMON.cmsAjax = function (url, param, async = true, callback, errorCallback, ty
COMMON
.
showAlert
(
'errorOccurred'
);
COMMON
.
showAlert
(
'errorOccurred'
);
}
}
}
}
};
};
/**
/**
* Check if user is logged in
* Check if user is logged in
*
*
* @param {boolean} async
* @param {boolean} async
*/
*/
COMMON
.
checkAuth
=
function
(
async
=
true
)
{
COMMON
.
checkAuth
=
function
(
async
=
true
)
{
let
params
=
{};
let
params
=
{};
console
.
log
(
"kdh check"
);
console
.
log
(
"kdh check"
);
params
.
sid
=
COMMON
.
getSid
;
params
.
sid
=
COMMON
.
getSid
;
...
@@ -311,9 +309,9 @@ COMMON.checkAuth = function (async = true) {
...
@@ -311,9 +309,9 @@ COMMON.checkAuth = function (async = true) {
COMMON
.
cmsAjax
(
url
,
params
,
async
,
null
,
function
()
{
COMMON
.
cmsAjax
(
url
,
params
,
async
,
null
,
function
()
{
COMMON
.
goUrlWithCurrentParams
(
CONSTANT
.
PAGE_NAME
.
LOGIN
);
COMMON
.
goUrlWithCurrentParams
(
CONSTANT
.
PAGE_NAME
.
LOGIN
);
});
});
};
};
var
ClientData
=
{
var
ClientData
=
{
// Local :userInfo_account path:String
// Local :userInfo_account path:String
userInfo_accountPath
:
function
(
data
)
{
userInfo_accountPath
:
function
(
data
)
{
if
(
arguments
.
length
>
0
)
{
if
(
arguments
.
length
>
0
)
{
...
@@ -525,24 +523,24 @@ var ClientData = {
...
@@ -525,24 +523,24 @@ var ClientData = {
return
COMMON
.
operateData
(
arguments
,
CONSTANT
.
KEYS
.
IsJumpBack
,
undefined
);
return
COMMON
.
operateData
(
arguments
,
CONSTANT
.
KEYS
.
IsJumpBack
,
undefined
);
}
}
},
},
};
};
/*
/*
* Variables
* Variables
*/
*/
COMMON
.
userSessionObj
=
null
;
COMMON
.
userSessionObj
=
null
;
COMMON
.
userSettingObj
=
null
;
COMMON
.
userSettingObj
=
null
;
COMMON
.
sysSettingObj
=
null
;
COMMON
.
sysSettingObj
=
null
;
/*
/*
* User Settings Class Definition
* User Settings Class Definition
*/
*/
var
UserSetting
=
function
()
{
var
UserSetting
=
function
()
{
this
.
US_KEY
=
'AVWUS'
;
this
.
US_KEY
=
'AVWUS'
;
this
.
userSetting
=
this
.
load
();
this
.
userSetting
=
this
.
load
();
};
};
/* get user setting from localStorage */
/* get user setting from localStorage */
UserSetting
.
prototype
.
load
=
function
()
{
UserSetting
.
prototype
.
load
=
function
()
{
var
storage
=
window
.
localStorage
;
var
storage
=
window
.
localStorage
;
var
value
=
null
;
var
value
=
null
;
var
js
=
null
;
var
js
=
null
;
...
@@ -554,14 +552,14 @@ UserSetting.prototype.load = function () {
...
@@ -554,14 +552,14 @@ UserSetting.prototype.load = function () {
js
=
JSON
.
parse
(
value
);
js
=
JSON
.
parse
(
value
);
}
}
return
js
;
return
js
;
};
};
/**
/**
* store user setting
* store user setting
* @param {*} key
* @param {*} key
* @param {*} value
* @param {*} value
*/
*/
UserSetting
.
prototype
.
set
=
function
(
key
,
value
)
{
UserSetting
.
prototype
.
set
=
function
(
key
,
value
)
{
this
.
userSetting
=
this
.
load
();
this
.
userSetting
=
this
.
load
();
var
values
=
this
.
userSetting
;
var
values
=
this
.
userSetting
;
if
(
!
values
)
{
if
(
!
values
)
{
...
@@ -575,27 +573,27 @@ UserSetting.prototype.set = function (key, value) {
...
@@ -575,27 +573,27 @@ UserSetting.prototype.set = function (key, value) {
storage
.
setItem
(
this
.
US_KEY
,
jsonStr
);
storage
.
setItem
(
this
.
US_KEY
,
jsonStr
);
}
}
this
.
userSetting
=
values
;
this
.
userSetting
=
values
;
};
};
/**
/**
* grab user setting
* grab user setting
* @param {*} key
* @param {*} key
* @returns
* @returns
*/
*/
UserSetting
.
prototype
.
get
=
function
(
key
)
{
UserSetting
.
prototype
.
get
=
function
(
key
)
{
this
.
userSetting
=
this
.
load
();
this
.
userSetting
=
this
.
load
();
var
values
=
this
.
userSetting
;
var
values
=
this
.
userSetting
;
if
(
values
)
{
if
(
values
)
{
return
values
[
key
];
return
values
[
key
];
}
}
return
null
;
return
null
;
};
};
/**
/**
* show user setting object list
* show user setting object list
* @param {*} elmid
* @param {*} elmid
*/
*/
UserSetting
.
prototype
.
show
=
function
(
elmid
)
{
UserSetting
.
prototype
.
show
=
function
(
elmid
)
{
var
storage
=
window
.
localStorage
;
var
storage
=
window
.
localStorage
;
var
tags
=
'<p>'
;
var
tags
=
'<p>'
;
if
(
storage
)
{
if
(
storage
)
{
...
@@ -609,9 +607,9 @@ UserSetting.prototype.show = function (elmid) {
...
@@ -609,9 +607,9 @@ UserSetting.prototype.show = function (elmid) {
tags
=
tags
+
'</p>'
;
tags
=
tags
+
'</p>'
;
$
(
elmid
).
html
(
tags
);
$
(
elmid
).
html
(
tags
);
}
}
};
};
/* Retrieve a list of user-set keys */
/* Retrieve a list of user-set keys */
UserSetting
.
prototype
.
keys
=
function
()
{
UserSetting
.
prototype
.
keys
=
function
()
{
var
storage
=
window
.
localStorage
;
var
storage
=
window
.
localStorage
;
var
keyList
=
[];
var
keyList
=
[];
if
(
storage
)
{
if
(
storage
)
{
...
@@ -626,13 +624,13 @@ UserSetting.prototype.keys = function () {
...
@@ -626,13 +624,13 @@ UserSetting.prototype.keys = function () {
return
keyList
;
return
keyList
;
}
}
return
null
;
return
null
;
};
};
/**
/**
* Delete user settings
* Delete user settings
* @param {*} key
* @param {*} key
*/
*/
UserSetting
.
prototype
.
remove
=
function
(
key
)
{
UserSetting
.
prototype
.
remove
=
function
(
key
)
{
var
storage
=
window
.
localStorage
;
var
storage
=
window
.
localStorage
;
if
(
storage
)
{
if
(
storage
)
{
var
value
=
storage
.
getItem
(
this
.
US_KEY
);
var
value
=
storage
.
getItem
(
this
.
US_KEY
);
...
@@ -644,27 +642,27 @@ UserSetting.prototype.remove = function (key) {
...
@@ -644,27 +642,27 @@ UserSetting.prototype.remove = function (key) {
}
}
}
}
}
}
};
};
/* Delete all user settings */
/* Delete all user settings */
UserSetting
.
prototype
.
removeAll
=
function
()
{
UserSetting
.
prototype
.
removeAll
=
function
()
{
var
storage
=
window
.
localStorage
;
var
storage
=
window
.
localStorage
;
if
(
storage
)
{
if
(
storage
)
{
storage
.
remove
(
this
.
US_KEY
);
storage
.
remove
(
this
.
US_KEY
);
}
}
};
};
/*
/*
* User Session Class Definition
* User Session Class Definition
*/
*/
var
UserSession
=
function
()
{
var
UserSession
=
function
()
{
this
.
available
=
false
;
this
.
available
=
false
;
};
};
/**
/**
* Initialize User Session
* Initialize User Session
* @param {*} option
* @param {*} option
*/
*/
UserSession
.
prototype
.
init
=
function
(
option
)
{
UserSession
.
prototype
.
init
=
function
(
option
)
{
this
.
available
=
false
;
this
.
available
=
false
;
if
(
option
==
'restore'
)
{
if
(
option
==
'restore'
)
{
var
value
=
null
;
var
value
=
null
;
...
@@ -681,14 +679,14 @@ UserSession.prototype.init = function (option) {
...
@@ -681,14 +679,14 @@ UserSession.prototype.init = function (option) {
this
.
set
(
'init'
,
new
Date
().
toLocaleString
());
this
.
set
(
'init'
,
new
Date
().
toLocaleString
());
this
.
available
=
true
;
this
.
available
=
true
;
}
}
};
};
/**
/**
* store key, value item to user session
* store key, value item to user session
* @param {*} key
* @param {*} key
* @param {*} value
* @param {*} value
*/
*/
UserSession
.
prototype
.
set
=
function
(
key
,
value
)
{
UserSession
.
prototype
.
set
=
function
(
key
,
value
)
{
var
storage
=
window
.
sessionStorage
;
var
storage
=
window
.
sessionStorage
;
if
(
storage
)
{
if
(
storage
)
{
if
(
this
.
available
==
false
)
{
if
(
this
.
available
==
false
)
{
...
@@ -701,14 +699,14 @@ UserSession.prototype.set = function (key, value) {
...
@@ -701,14 +699,14 @@ UserSession.prototype.set = function (key, value) {
storage
.
setItem
(
'AVWS_'
+
key
,
value
);
storage
.
setItem
(
'AVWS_'
+
key
,
value
);
}
}
}
}
};
};
/**
/**
* get session item value
* get session item value
* @param {*} key
* @param {*} key
* @returns
* @returns
*/
*/
UserSession
.
prototype
.
get
=
function
(
key
)
{
UserSession
.
prototype
.
get
=
function
(
key
)
{
var
value
=
null
;
var
value
=
null
;
if
(
this
.
available
)
{
if
(
this
.
available
)
{
value
=
this
.
_get
(
key
);
value
=
this
.
_get
(
key
);
...
@@ -716,35 +714,35 @@ UserSession.prototype.get = function (key) {
...
@@ -716,35 +714,35 @@ UserSession.prototype.get = function (key) {
throw
new
Error
(
'Session Destroyed.'
);
throw
new
Error
(
'Session Destroyed.'
);
}
}
return
value
;
return
value
;
};
};
/**
/**
* get item value from session storage
* get item value from session storage
* @param {*} key
* @param {*} key
* @returns
* @returns
*/
*/
UserSession
.
prototype
.
_get
=
function
(
key
)
{
UserSession
.
prototype
.
_get
=
function
(
key
)
{
var
storage
=
window
.
sessionStorage
;
var
storage
=
window
.
sessionStorage
;
var
value
=
null
;
var
value
=
null
;
if
(
storage
)
{
if
(
storage
)
{
value
=
storage
.
getItem
(
'AVWS_'
+
key
);
value
=
storage
.
getItem
(
'AVWS_'
+
key
);
}
}
return
value
;
return
value
;
};
};
/* destroy user session */
/* destroy user session */
UserSession
.
prototype
.
destroy
=
function
()
{
UserSession
.
prototype
.
destroy
=
function
()
{
var
storage
=
window
.
sessionStorage
;
var
storage
=
window
.
sessionStorage
;
if
(
storage
)
{
if
(
storage
)
{
storage
.
clear
();
storage
.
clear
();
this
.
available
=
false
;
this
.
available
=
false
;
}
}
};
};
/**
/**
* show user session object list
* show user session object list
* @param {*} elmid
* @param {*} elmid
*/
*/
UserSession
.
prototype
.
show
=
function
(
elmid
)
{
UserSession
.
prototype
.
show
=
function
(
elmid
)
{
var
storage
=
window
.
sessionStorage
;
var
storage
=
window
.
sessionStorage
;
var
tags
=
'<p>'
;
var
tags
=
'<p>'
;
if
(
storage
)
{
if
(
storage
)
{
...
@@ -756,10 +754,10 @@ UserSession.prototype.show = function (elmid) {
...
@@ -756,10 +754,10 @@ UserSession.prototype.show = function (elmid) {
tags
=
tags
+
'</p>'
;
tags
=
tags
+
'</p>'
;
$
(
elmid
).
html
(
tags
);
$
(
elmid
).
html
(
tags
);
}
}
};
};
/* Initialize system */
/* Initialize system */
$
(
function
()
{
$
(
function
()
{
// Determine the path where the system configuration files are located
// Determine the path where the system configuration files are located
var
location
=
window
.
location
.
toString
().
toLowerCase
();
var
location
=
window
.
location
.
toString
().
toLowerCase
();
...
@@ -793,15 +791,15 @@ $(function () {
...
@@ -793,15 +791,15 @@ $(function () {
//#31919 [Investigation] Business meeting support system GoogleChrome does not work with Bitch in/out.
//#31919 [Investigation] Business meeting support system GoogleChrome does not work with Bitch in/out.
navigator
.
pointerEnabled
=
navigator
.
maxTouchPoints
>
0
;
// Edge 17 touch support workaround
navigator
.
pointerEnabled
=
navigator
.
maxTouchPoints
>
0
;
// Edge 17 touch support workaround
document
.
documentElement
.
ontouchstart
=
navigator
.
maxTouchPoints
>
0
?
function
()
{}
:
undefined
;
// Chrome 70 touch support workaround
document
.
documentElement
.
ontouchstart
=
navigator
.
maxTouchPoints
>
0
?
function
()
{}
:
undefined
;
// Chrome 70 touch support workaround
});
});
// Hide the locking layout
// Hide the locking layout
COMMON
.
unlockLayout
=
function
()
{
COMMON
.
unlockLayout
=
function
()
{
$
(
'#avw-sys-modal'
).
hide
();
$
(
'#avw-sys-modal'
).
hide
();
};
};
// Show the locking layout
// Show the locking layout
COMMON
.
lockLayout
=
function
()
{
COMMON
.
lockLayout
=
function
()
{
if
(
document
.
getElementById
(
'avw-sys-modal'
))
{
if
(
document
.
getElementById
(
'avw-sys-modal'
))
{
$
(
'#avw-sys-modal'
).
show
();
$
(
'#avw-sys-modal'
).
show
();
}
else
{
}
else
{
...
@@ -825,34 +823,34 @@ COMMON.lockLayout = function () {
...
@@ -825,34 +823,34 @@ COMMON.lockLayout = function () {
});
});
});
});
}
}
};
};
/* Clear error condition */
/* Clear error condition */
COMMON
.
clearError
=
function
()
{
COMMON
.
clearError
=
function
()
{
var
session
=
window
.
sessionStorage
;
var
session
=
window
.
sessionStorage
;
if
(
session
)
{
if
(
session
)
{
session
.
setItem
(
COMMON
.
hasErrorKey
,
false
);
session
.
setItem
(
COMMON
.
hasErrorKey
,
false
);
}
}
};
};
/* Get error status */
/* Get error status */
COMMON
.
hasError
=
function
()
{
COMMON
.
hasError
=
function
()
{
var
session
=
window
.
sessionStorage
;
var
session
=
window
.
sessionStorage
;
var
isError
=
false
;
var
isError
=
false
;
if
(
session
)
{
if
(
session
)
{
isError
=
session
.
getItem
(
COMMON
.
hasErrorKey
);
isError
=
session
.
getItem
(
COMMON
.
hasErrorKey
);
}
}
return
isError
==
'true'
;
return
isError
==
'true'
;
};
};
/* Set to error condition */
/* Set to error condition */
COMMON
.
setErrorState
=
function
()
{
COMMON
.
setErrorState
=
function
()
{
var
session
=
window
.
sessionStorage
;
var
session
=
window
.
sessionStorage
;
if
(
session
)
{
if
(
session
)
{
session
.
setItem
(
COMMON
.
hasErrorKey
,
true
);
session
.
setItem
(
COMMON
.
hasErrorKey
,
true
);
}
}
};
};
/* get user session object */
/* get user session object */
COMMON
.
userSession
=
function
()
{
COMMON
.
userSession
=
function
()
{
if
(
!
COMMON
.
userSessionObj
)
{
if
(
!
COMMON
.
userSessionObj
)
{
var
obj
=
new
UserSession
();
var
obj
=
new
UserSession
();
obj
.
init
(
'restore'
);
obj
.
init
(
'restore'
);
...
@@ -864,9 +862,9 @@ COMMON.userSession = function () {
...
@@ -864,9 +862,9 @@ COMMON.userSession = function () {
}
}
}
}
return
COMMON
.
userSessionObj
;
return
COMMON
.
userSessionObj
;
};
};
/* create user session object */
/* create user session object */
COMMON
.
createUserSession
=
function
()
{
COMMON
.
createUserSession
=
function
()
{
if
(
COMMON
.
userSessionObj
)
{
if
(
COMMON
.
userSessionObj
)
{
COMMON
.
userSessionObj
.
destroy
();
COMMON
.
userSessionObj
.
destroy
();
}
else
{
}
else
{
...
@@ -874,26 +872,26 @@ COMMON.createUserSession = function () {
...
@@ -874,26 +872,26 @@ COMMON.createUserSession = function () {
COMMON
.
userSessionObj
.
init
();
COMMON
.
userSessionObj
.
init
();
}
}
return
COMMON
.
userSessionObj
;
return
COMMON
.
userSessionObj
;
};
};
/* get user setting object */
/* get user setting object */
COMMON
.
userSetting
=
function
()
{
COMMON
.
userSetting
=
function
()
{
if
(
COMMON
.
userSettingObj
==
null
)
{
if
(
COMMON
.
userSettingObj
==
null
)
{
COMMON
.
userSettingObj
=
new
UserSetting
();
COMMON
.
userSettingObj
=
new
UserSetting
();
}
}
return
COMMON
.
userSettingObj
;
return
COMMON
.
userSettingObj
;
};
};
/* get system setting object */
/* get system setting object */
COMMON
.
sysSetting
=
function
()
{
COMMON
.
sysSetting
=
function
()
{
return
COMMON
.
sysSettingObj
;
return
COMMON
.
sysSettingObj
;
};
};
/*
/*
* Operations for session storage [start]
* Operations for session storage [start]
*/
*/
var
SessionStorageUtils
=
{
var
SessionStorageUtils
=
{
login
:
function
()
{
login
:
function
()
{
if
(
COMMON
.
userSession
())
{
if
(
COMMON
.
userSession
())
{
// Skip this case
// Skip this case
...
@@ -915,12 +913,12 @@ var SessionStorageUtils = {
...
@@ -915,12 +913,12 @@ var SessionStorageUtils = {
remove
:
function
(
strKey
)
{
remove
:
function
(
strKey
)
{
COMMON
.
userSession
().
set
(
strKey
,
null
);
COMMON
.
userSession
().
set
(
strKey
,
null
);
},
},
};
};
/*
/*
* Operations for local storage
* Operations for local storage
*/
*/
var
LocalStorageUtils
=
{
var
LocalStorageUtils
=
{
getUniqueId
:
function
()
{
getUniqueId
:
function
()
{
var
uniqueId
=
''
;
var
uniqueId
=
''
;
...
@@ -974,28 +972,28 @@ var LocalStorageUtils = {
...
@@ -974,28 +972,28 @@ var LocalStorageUtils = {
}
}
return
isExisted
;
return
isExisted
;
},
},
};
};
/**
/**
* String.format function def.
* String.format function def.
* @param {*} fmt
* @param {*} fmt
* @returns
* @returns
*/
*/
COMMON
.
format
=
function
(
fmt
)
{
COMMON
.
format
=
function
(
fmt
)
{
for
(
var
i
=
1
;
i
<
arguments
.
length
;
i
++
)
{
for
(
var
i
=
1
;
i
<
arguments
.
length
;
i
++
)
{
var
reg
=
new
RegExp
(
'
\\
{'
+
(
i
-
1
)
+
'
\\
}'
,
'g'
);
var
reg
=
new
RegExp
(
'
\\
{'
+
(
i
-
1
)
+
'
\\
}'
,
'g'
);
fmt
=
fmt
.
replace
(
reg
,
arguments
[
i
]);
fmt
=
fmt
.
replace
(
reg
,
arguments
[
i
]);
}
}
return
fmt
;
return
fmt
;
};
};
/**
/**
* Get param url
* Get param url
* @param {*} name
* @param {*} name
* @param {*} url
* @param {*} url
* @returns
* @returns
*/
*/
COMMON
.
getUrlParam
=
function
(
name
,
url
)
{
COMMON
.
getUrlParam
=
function
(
name
,
url
)
{
if
(
!
url
)
{
if
(
!
url
)
{
url
=
window
.
location
.
href
;
url
=
window
.
location
.
href
;
}
}
...
@@ -1009,10 +1007,10 @@ COMMON.getUrlParam = function (name, url) {
...
@@ -1009,10 +1007,10 @@ COMMON.getUrlParam = function (name, url) {
}
else
{
}
else
{
return
results
[
1
];
return
results
[
1
];
}
}
};
};
// Toogle Logout Nortice
// Toogle Logout Nortice
COMMON
.
ToogleLogoutNortice
=
function
()
{
COMMON
.
ToogleLogoutNortice
=
function
()
{
window
.
onbeforeunload
=
function
(
event
)
{
window
.
onbeforeunload
=
function
(
event
)
{
var
message
=
I18N
.
i18nText
(
'sysInfoWithoutLogout'
);
var
message
=
I18N
.
i18nText
(
'sysInfoWithoutLogout'
);
var
e
=
event
||
window
.
event
;
var
e
=
event
||
window
.
event
;
...
@@ -1021,9 +1019,9 @@ COMMON.ToogleLogoutNortice = function () {
...
@@ -1021,9 +1019,9 @@ COMMON.ToogleLogoutNortice = function () {
}
}
return
message
;
return
message
;
};
};
};
};
/**
/**
* * Get data from localstorage and sessionstorage synchronization If has any
* * Get data from localstorage and sessionstorage synchronization If has any
* param (args.length > 0) -> setter If has not param (args.length = 0) ->
* param (args.length > 0) -> setter If has not param (args.length = 0) ->
* getter . Get from session: + if it existed and key existed in localstorage ->
* getter . Get from session: + if it existed and key existed in localstorage ->
...
@@ -1034,7 +1032,7 @@ COMMON.ToogleLogoutNortice = function () {
...
@@ -1034,7 +1032,7 @@ COMMON.ToogleLogoutNortice = function () {
* @param {*} returnDefaultData
* @param {*} returnDefaultData
* @returns
* @returns
*/
*/
COMMON
.
operateData
=
function
(
args
,
strKey
,
returnDefaultData
)
{
COMMON
.
operateData
=
function
(
args
,
strKey
,
returnDefaultData
)
{
if
(
args
.
length
>
0
)
{
if
(
args
.
length
>
0
)
{
var
data
=
args
[
0
];
var
data
=
args
[
0
];
LocalStorageUtils
.
set
(
strKey
,
data
);
LocalStorageUtils
.
set
(
strKey
,
data
);
...
@@ -1060,23 +1058,23 @@ COMMON.operateData = function (args, strKey, returnDefaultData) {
...
@@ -1060,23 +1058,23 @@ COMMON.operateData = function (args, strKey, returnDefaultData) {
return
returnDefaultData
;
return
returnDefaultData
;
}
}
}
}
};
};
/**
/**
* UTC current Time (millisecond)
* UTC current Time (millisecond)
*
*
* @returns UTC time
* @returns UTC time
*/
*/
COMMON
.
currentTime
=
function
()
{
COMMON
.
currentTime
=
function
()
{
return
Date
.
now
();
return
Date
.
now
();
};
};
/**
/**
* check login information in window.sessionStorage
* check login information in window.sessionStorage
*
*
* @returns boolean
* @returns boolean
*/
*/
COMMON
.
checkLogin
=
function
(
option
)
{
COMMON
.
checkLogin
=
function
(
option
)
{
var
userSession
=
COMMON
.
userSession
();
var
userSession
=
COMMON
.
userSession
();
if
(
!
userSession
)
{
if
(
!
userSession
)
{
...
@@ -1120,23 +1118,23 @@ COMMON.checkLogin = function (option) {
...
@@ -1120,23 +1118,23 @@ COMMON.checkLogin = function (option) {
return
false
;
return
false
;
}
}
return
true
;
return
true
;
}
}
/*
/*
* Operations for session storage [ end ]
* Operations for session storage [ end ]
*/
*/
// =============================================================================================
// =============================================================================================
// Utils for string, date, number [start]
// Utils for string, date, number [start]
// =============================================================================================
// =============================================================================================
/*
/*
* Convert date to JP format date time [start]
* Convert date to JP format date time [start]
*/
*/
/*
/*
* YYYY/MM/DD HH:MM:SS
* YYYY/MM/DD HH:MM:SS
*/
*/
Date
.
prototype
.
jpDateTimeString
=
function
()
{
Date
.
prototype
.
jpDateTimeString
=
function
()
{
var
strResult
=
''
;
var
strResult
=
''
;
var
strYear
=
this
.
getFullYear
()
+
''
;
var
strYear
=
this
.
getFullYear
()
+
''
;
var
strMonth
=
this
.
getMonth
()
+
1
+
''
;
var
strMonth
=
this
.
getMonth
()
+
1
+
''
;
...
@@ -1148,11 +1146,11 @@ Date.prototype.jpDateTimeString = function () {
...
@@ -1148,11 +1146,11 @@ Date.prototype.jpDateTimeString = function () {
strResult
+=
strYear
.
padLeft
(
'0'
,
4
)
+
'/'
+
strMonth
.
padLeft
(
'0'
,
2
)
+
'/'
+
strDayInMonth
.
padLeft
(
'0'
,
2
);
strResult
+=
strYear
.
padLeft
(
'0'
,
4
)
+
'/'
+
strMonth
.
padLeft
(
'0'
,
2
)
+
'/'
+
strDayInMonth
.
padLeft
(
'0'
,
2
);
strResult
+=
' '
+
strHour
.
padLeft
(
'0'
,
2
)
+
':'
+
strMinute
.
padLeft
(
'0'
,
2
)
+
':'
+
strSecond
.
padLeft
(
'0'
,
2
);
strResult
+=
' '
+
strHour
.
padLeft
(
'0'
,
2
)
+
':'
+
strMinute
.
padLeft
(
'0'
,
2
)
+
':'
+
strSecond
.
padLeft
(
'0'
,
2
);
return
strResult
;
return
strResult
;
};
};
/*
/*
* YYYY-MM-DD HH:MM:SS
* YYYY-MM-DD HH:MM:SS
*/
*/
Date
.
prototype
.
jpDateTimeString1
=
function
()
{
Date
.
prototype
.
jpDateTimeString1
=
function
()
{
var
strResult
=
''
;
var
strResult
=
''
;
var
strYear
=
this
.
getFullYear
()
+
''
;
var
strYear
=
this
.
getFullYear
()
+
''
;
var
strMonth
=
this
.
getMonth
()
+
1
+
''
;
var
strMonth
=
this
.
getMonth
()
+
1
+
''
;
...
@@ -1164,11 +1162,11 @@ Date.prototype.jpDateTimeString1 = function () {
...
@@ -1164,11 +1162,11 @@ Date.prototype.jpDateTimeString1 = function () {
strResult
+=
strYear
.
padLeft
(
'0'
,
4
)
+
'-'
+
strMonth
.
padLeft
(
'0'
,
2
)
+
'-'
+
strDayInMonth
.
padLeft
(
'0'
,
2
);
strResult
+=
strYear
.
padLeft
(
'0'
,
4
)
+
'-'
+
strMonth
.
padLeft
(
'0'
,
2
)
+
'-'
+
strDayInMonth
.
padLeft
(
'0'
,
2
);
strResult
+=
' '
+
strHour
.
padLeft
(
'0'
,
2
)
+
':'
+
strMinute
.
padLeft
(
'0'
,
2
)
+
':'
+
strSecond
.
padLeft
(
'0'
,
2
);
strResult
+=
' '
+
strHour
.
padLeft
(
'0'
,
2
)
+
':'
+
strMinute
.
padLeft
(
'0'
,
2
)
+
':'
+
strSecond
.
padLeft
(
'0'
,
2
);
return
strResult
;
return
strResult
;
};
};
/*
/*
* yyyy/MM/dd
* yyyy/MM/dd
*/
*/
Date
.
prototype
.
jpDateString
=
function
()
{
Date
.
prototype
.
jpDateString
=
function
()
{
var
strResult
=
''
;
var
strResult
=
''
;
var
strYear
=
this
.
getFullYear
()
+
''
;
var
strYear
=
this
.
getFullYear
()
+
''
;
var
strMonth
=
this
.
getMonth
()
+
1
+
''
;
var
strMonth
=
this
.
getMonth
()
+
1
+
''
;
...
@@ -1177,11 +1175,11 @@ Date.prototype.jpDateString = function () {
...
@@ -1177,11 +1175,11 @@ Date.prototype.jpDateString = function () {
strResult
+=
strYear
.
padLeft
(
'0'
,
4
)
+
'/'
+
strMonth
.
padLeft
(
'0'
,
2
)
+
'/'
+
strDayInMonth
.
padLeft
(
'0'
,
2
);
strResult
+=
strYear
.
padLeft
(
'0'
,
4
)
+
'/'
+
strMonth
.
padLeft
(
'0'
,
2
)
+
'/'
+
strDayInMonth
.
padLeft
(
'0'
,
2
);
return
strResult
;
return
strResult
;
};
};
/*
/*
* HH:mm:ss
* HH:mm:ss
*/
*/
Date
.
prototype
.
jpTimeString
=
function
()
{
Date
.
prototype
.
jpTimeString
=
function
()
{
var
strResult
=
''
;
var
strResult
=
''
;
var
strHour
=
this
.
getHours
()
+
''
;
var
strHour
=
this
.
getHours
()
+
''
;
var
strMinute
=
this
.
getMinutes
()
+
''
;
var
strMinute
=
this
.
getMinutes
()
+
''
;
...
@@ -1189,11 +1187,11 @@ Date.prototype.jpTimeString = function () {
...
@@ -1189,11 +1187,11 @@ Date.prototype.jpTimeString = function () {
strResult
+=
' '
+
strHour
.
padLeft
(
'0'
,
2
)
+
':'
+
strMinute
.
padLeft
(
'0'
,
2
)
+
':'
+
strSecond
.
padLeft
(
'0'
,
2
);
strResult
+=
' '
+
strHour
.
padLeft
(
'0'
,
2
)
+
':'
+
strMinute
.
padLeft
(
'0'
,
2
)
+
':'
+
strSecond
.
padLeft
(
'0'
,
2
);
return
strResult
;
return
strResult
;
};
};
/*
/*
* HH:mm
* HH:mm
*/
*/
Date
.
prototype
.
jpShortTimeString
=
function
()
{
Date
.
prototype
.
jpShortTimeString
=
function
()
{
var
strResult
=
''
;
var
strResult
=
''
;
var
strHour
=
this
.
getHours
()
+
''
;
var
strHour
=
this
.
getHours
()
+
''
;
var
strMinute
=
this
.
getMinutes
()
+
''
;
var
strMinute
=
this
.
getMinutes
()
+
''
;
...
@@ -1201,11 +1199,11 @@ Date.prototype.jpShortTimeString = function () {
...
@@ -1201,11 +1199,11 @@ Date.prototype.jpShortTimeString = function () {
strResult
+=
' '
+
strHour
.
padLeft
(
'0'
,
2
)
+
':'
+
strMinute
.
padLeft
(
'0'
,
2
);
strResult
+=
' '
+
strHour
.
padLeft
(
'0'
,
2
)
+
':'
+
strMinute
.
padLeft
(
'0'
,
2
);
return
strResult
;
return
strResult
;
};
};
/*
/*
* yyyyMMddHHmmss
* yyyyMMddHHmmss
*/
*/
Date
.
prototype
.
toIdString
=
function
()
{
Date
.
prototype
.
toIdString
=
function
()
{
var
strResult
=
''
;
var
strResult
=
''
;
var
strYear
=
this
.
getFullYear
()
+
''
;
var
strYear
=
this
.
getFullYear
()
+
''
;
var
strMonth
=
this
.
getMonth
()
+
1
+
''
;
var
strMonth
=
this
.
getMonth
()
+
1
+
''
;
...
@@ -1218,127 +1216,128 @@ Date.prototype.toIdString = function () {
...
@@ -1218,127 +1216,128 @@ Date.prototype.toIdString = function () {
strResult
+=
strYear
.
padLeft
(
'0'
,
4
)
+
strMonth
.
padLeft
(
'0'
,
2
)
+
strDayInMonth
.
padLeft
(
'0'
,
2
);
strResult
+=
strYear
.
padLeft
(
'0'
,
4
)
+
strMonth
.
padLeft
(
'0'
,
2
)
+
strDayInMonth
.
padLeft
(
'0'
,
2
);
strResult
+=
strHour
.
padLeft
(
'0'
,
2
)
+
strMinute
.
padLeft
(
'0'
,
2
)
+
strSecond
.
padLeft
(
'0'
,
2
)
+
strMilisecond
.
padLeft
(
'0'
,
3
);
strResult
+=
strHour
.
padLeft
(
'0'
,
2
)
+
strMinute
.
padLeft
(
'0'
,
2
)
+
strSecond
.
padLeft
(
'0'
,
2
)
+
strMilisecond
.
padLeft
(
'0'
,
3
);
return
strResult
;
return
strResult
;
};
};
/**
/**
* Subtract date to get days
* Subtract date to get days
* @param {*} targetDate
* @param {*} targetDate
* @returns
* @returns
*/
*/
Date
.
prototype
.
subtractByDays
=
function
(
targetDate
)
{
Date
.
prototype
.
subtractByDays
=
function
(
targetDate
)
{
var
milis
=
Math
.
abs
(
this
-
targetDate
);
var
milis
=
Math
.
abs
(
this
-
targetDate
);
var
days
=
Math
.
floor
(
milis
/
(
60
*
60
*
24
*
1000
));
var
days
=
Math
.
floor
(
milis
/
(
60
*
60
*
24
*
1000
));
return
days
;
return
days
;
};
};
/**
/**
* add seconds
* add seconds
* @param {*} plusSeconds
* @param {*} plusSeconds
* @returns
* @returns
*/
*/
Date
.
prototype
.
addSeconds
=
function
(
plusSeconds
)
{
Date
.
prototype
.
addSeconds
=
function
(
plusSeconds
)
{
var
newDate
=
new
Date
(
this
.
getTime
()
+
plusSeconds
*
1000
);
var
newDate
=
new
Date
(
this
.
getTime
()
+
plusSeconds
*
1000
);
return
newDate
;
return
newDate
;
};
};
/**
/**
* Subtract date to get days
* Subtract date to get days
* @param {*} targetDate
* @param {*} targetDate
* @returns
* @returns
*/
*/
Date
.
prototype
.
subtractBySeconds
=
function
(
targetDate
)
{
Date
.
prototype
.
subtractBySeconds
=
function
(
targetDate
)
{
var
milis
=
Math
.
abs
(
this
-
targetDate
);
var
milis
=
Math
.
abs
(
this
-
targetDate
);
var
days
=
Math
.
floor
(
milis
/
1000
);
var
days
=
Math
.
floor
(
milis
/
1000
);
return
days
;
return
days
;
};
};
/*
/*
* Convert date to JP format date time [ end ]
* Convert date to JP format date time [ end ]
*/
*/
// trimming space from both side of the string
// trimming space from both side of the string
String
.
prototype
.
trim
=
function
()
{
String
.
prototype
.
trim
=
function
()
{
return
this
.
replace
(
/^
\s
+|
\s
+$/g
,
''
);
return
this
.
replace
(
/^
\s
+|
\s
+$/g
,
''
);
};
};
// trimming space from left side of the string
// trimming space from left side of the string
String
.
prototype
.
trimLeft
=
function
()
{
String
.
prototype
.
trimLeft
=
function
()
{
return
this
.
replace
(
/^
\s
+/
,
''
);
return
this
.
replace
(
/^
\s
+/
,
''
);
};
};
// trimming space from right side of the string
// trimming space from right side of the string
String
.
prototype
.
trimRight
=
function
()
{
String
.
prototype
.
trimRight
=
function
()
{
return
this
.
replace
(
/
\s
+$/
,
''
);
return
this
.
replace
(
/
\s
+$/
,
''
);
};
};
/**
/**
* String: pads left
* String: pads left
* @param {*} padString
* @param {*} padString
* @param {*} length
* @param {*} length
* @returns
* @returns
*/
*/
String
.
prototype
.
padLeft
=
function
(
padString
,
length
)
{
String
.
prototype
.
padLeft
=
function
(
padString
,
length
)
{
var
str
=
this
;
var
str
=
this
;
while
(
str
.
length
<
length
)
str
=
padString
+
str
;
while
(
str
.
length
<
length
)
str
=
padString
+
str
;
return
str
;
return
str
;
};
};
/**
/**
* String: pads right
* String: pads right
* @param {*} padString
* @param {*} padString
* @param {*} length
* @param {*} length
* @returns
* @returns
*/
*/
String
.
prototype
.
padRight
=
function
(
padString
,
length
)
{
String
.
prototype
.
padRight
=
function
(
padString
,
length
)
{
var
str
=
this
;
var
str
=
this
;
while
(
str
.
length
<
length
)
str
=
str
+
padString
;
while
(
str
.
length
<
length
)
str
=
str
+
padString
;
return
str
;
return
str
;
};
};
/**
/**
* Check contain string
* Check contain string
* @param {*} string
* @param {*} string
* @returns
* @returns
*/
*/
String
.
prototype
.
contains
=
function
(
string
)
{
String
.
prototype
.
contains
=
function
(
string
)
{
if
(
this
.
indexOf
(
string
)
!=
-
1
)
{
if
(
this
.
indexOf
(
string
)
!=
-
1
)
{
return
true
;
return
true
;
}
}
return
false
;
return
false
;
};
};
/**
/**
* Number: pads left
* Number: pads left
* @param {*} padString
* @param {*} padString
* @param {*} length
* @param {*} length
* @returns
* @returns
*/
*/
Number
.
prototype
.
padLeft
=
function
(
padString
,
length
)
{
Number
.
prototype
.
padLeft
=
function
(
padString
,
length
)
{
var
str
=
this
+
''
;
var
str
=
this
+
''
;
return
str
.
padLeft
(
padString
,
length
);
return
str
.
padLeft
(
padString
,
length
);
};
};
/**
/**
* Number: pads right
* Number: pads right
* @param {*} padString
* @param {*} padString
* @param {*} length
* @param {*} length
* @returns
* @returns
*/
*/
Number
.
prototype
.
padRight
=
function
(
padString
,
length
)
{
Number
.
prototype
.
padRight
=
function
(
padString
,
length
)
{
var
str
=
this
+
''
;
var
str
=
this
+
''
;
return
str
.
padRight
(
padString
,
length
);
return
str
.
padRight
(
padString
,
length
);
};
};
// Clear data of array
// Clear data of array
Array
.
prototype
.
clear
=
function
()
{
Array
.
prototype
.
clear
=
function
()
{
this
.
splice
(
0
,
this
.
length
);
this
.
splice
(
0
,
this
.
length
);
};
};
// Function to set position of object to center
// Function to set position of object to center
jQuery
.
fn
.
center
=
function
()
{
jQuery
.
fn
.
center
=
function
()
{
this
.
css
(
'position'
,
'fixed'
);
this
.
css
(
'position'
,
'fixed'
);
this
.
css
(
'top'
,
(
$
(
window
).
height
()
-
this
.
height
())
/
2
+
'px'
);
this
.
css
(
'top'
,
(
$
(
window
).
height
()
-
this
.
height
())
/
2
+
'px'
);
this
.
css
(
'left'
,
(
$
(
window
).
width
()
-
this
.
width
())
/
2
+
'px'
);
this
.
css
(
'left'
,
(
$
(
window
).
width
()
-
this
.
width
())
/
2
+
'px'
);
return
this
;
return
this
;
};
};
\ No newline at end of file
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