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