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
cc95a08a
Commit
cc95a08a
authored
Aug 04, 2014
by
Masaru Abe
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ZoomDetector.jsリファクタリング
parent
1ff1a86a
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
50 additions
and
38 deletions
+50
-38
abvw/common/js/zoomDetector.js
+46
-34
abvw/js/contentview.js
+1
-1
abvw/js/contentview_GetData.js
+1
-1
abvw/js/contentview_InitObjects.js
+2
-2
No files found.
abvw/common/js/zoomDetector.js
View file @
cc95a08a
var
zoom_ratioPre
=
1
;
/**
var
zoom_ratio
=
1
;
* ABook Viewer for WEB
var
zoom_timer
;
* ZoomDetector Library
var
zoom_continue
=
false
;
* Copyright (C) Agentec Co, Ltd. All rights reserved.
var
zoom_callbackFunction
;
*/
var
zoom_miliSeconds
=
1000
;
// Default is 1 second
var
zoom_oldW
=
-
1
;
//グローバルの名前空間用のオブジェクトを用意する
var
zoom_oldH
=
-
1
;
var
ZOOM_DETECTOR
=
{};
function
calculateZoomLevel
()
{
zoom_ratioPre
=
ClientData
.
zoom_ratioPre
();
ZOOM_DETECTOR
.
zoom_ratioPre
=
1
;
if
(
zoom_timer
)
{
ZOOM_DETECTOR
.
zoom_ratio
=
1
;
clearTimeout
(
zoom_timer
);
ZOOM_DETECTOR
.
zoom_timer
;
zoom_timer
=
null
;
ZOOM_DETECTOR
.
zoom_continue
=
false
;
ZOOM_DETECTOR
.
zoom_callbackFunction
;
ZOOM_DETECTOR
.
zoom_miliSeconds
=
1000
;
// Default is 1 second
ZOOM_DETECTOR
.
zoom_oldW
=
-
1
;
ZOOM_DETECTOR
.
zoom_oldH
=
-
1
;
ZOOM_DETECTOR
.
calculateZoomLevel
=
function
()
{
ZOOM_DETECTOR
.
zoom_ratioPre
=
ClientData
.
zoom_ratioPre
();
if
(
ZOOM_DETECTOR
.
zoom_timer
)
{
clearTimeout
(
ZOOM_DETECTOR
.
zoom_timer
);
ZOOM_DETECTOR
.
zoom_timer
=
null
;
}
}
zoom_ratio
=
document
.
documentElement
.
clientWidth
/
window
.
innerWidth
;
ZOOM_DETECTOR
.
zoom_ratio
=
document
.
documentElement
.
clientWidth
/
window
.
innerWidth
;
if
(
zoom_ratioPre
!=
zoom_ratio
)
{
if
(
ZOOM_DETECTOR
.
zoom_ratioPre
!=
ZOOM_DETECTOR
.
zoom_ratio
)
{
if
(
zoom_oldW
==
-
1
)
{
if
(
ZOOM_DETECTOR
.
zoom_oldW
==
-
1
)
{
zoom_oldW
=
document
.
documentElement
.
clientWidth
;
ZOOM_DETECTOR
.
zoom_oldW
=
document
.
documentElement
.
clientWidth
;
}
}
if
(
zoom_oldH
==
-
1
)
{
if
(
ZOOM_DETECTOR
.
zoom_oldH
==
-
1
)
{
zoom_oldH
=
document
.
documentElement
.
clientWidth
;
ZOOM_DETECTOR
.
zoom_oldH
=
document
.
documentElement
.
clientWidth
;
}
}
if
(
zoom_callbackFunction
)
{
if
(
ZOOM_DETECTOR
.
zoom_callbackFunction
)
{
zoom_callbackFunction
(
zoom_ratioPre
,
zoom_ratio
,
zoom_oldW
,
zoom_oldH
,
window
.
innerWidth
,
window
.
innerHeight
);
ZOOM_DETECTOR
.
zoom_callbackFunction
(
ZOOM_DETECTOR
.
zoom_ratioPre
,
ZOOM_DETECTOR
.
zoom_ratio
,
ZOOM_DETECTOR
.
zoom_oldW
,
ZOOM_DETECTOR
.
zoom_oldH
,
window
.
innerWidth
,
window
.
innerHeight
);
}
}
zoom_ratioPre
=
zoom_ratio
;
ZOOM_DETECTOR
.
zoom_ratioPre
=
ZOOM_DETECTOR
.
zoom_ratio
;
ClientData
.
zoom_ratioPre
(
zoom_ratioPre
);
ClientData
.
zoom_ratioPre
(
ZOOM_DETECTOR
.
zoom_ratioPre
);
zoom_oldW
=
window
.
innerWidth
;
ZOOM_DETECTOR
.
zoom_oldW
=
window
.
innerWidth
;
zoom_oldH
=
window
.
innerHeight
;
ZOOM_DETECTOR
.
zoom_oldH
=
window
.
innerHeight
;
}
}
if
(
zoom_continue
==
true
)
{
if
(
ZOOM_DETECTOR
.
zoom_continue
==
true
)
{
zoom_timer
=
setTimeout
(
"calculateZoomLevel();"
,
zoom_miliSeconds
);
ZOOM_DETECTOR
.
zoom_timer
=
setTimeout
(
"ZOOM_DETECTOR.calculateZoomLevel();"
,
ZOOM_DETECTOR
.
zoom_miliSeconds
);
}
}
};
};
function
stopDetectZoom
()
{
zoom_continue
=
false
;
ZOOM_DETECTOR
.
stopDetectZoom
=
function
()
{
ZOOM_DETECTOR
.
zoom_continue
=
false
;
};
};
function
startDetectZoom
(
params
)
{
zoom_continue
=
true
;
ZOOM_DETECTOR
.
startDetectZoom
=
function
(
params
)
{
ZOOM_DETECTOR
.
zoom_continue
=
true
;
if
(
params
.
callbackFunction
)
{
if
(
params
.
callbackFunction
)
{
zoom_callbackFunction
=
params
.
callbackFunction
;
ZOOM_DETECTOR
.
zoom_callbackFunction
=
params
.
callbackFunction
;
}
}
if
(
params
.
time
)
{
if
(
params
.
time
)
{
zoom_miliSeconds
=
params
.
time
;
ZOOM_DETECTOR
.
zoom_miliSeconds
=
params
.
time
;
}
}
zoom_timer
=
setTimeout
(
"calculateZoomLevel();"
,
zoom_miliSeconds
);
ZOOM_DETECTOR
.
zoom_timer
=
setTimeout
(
"ZOOM_DETECTOR.calculateZoomLevel();"
,
ZOOM_DETECTOR
.
zoom_miliSeconds
);
};
};
abvw/js/contentview.js
View file @
cc95a08a
...
@@ -2188,7 +2188,7 @@ function displayOverlayForSpecifyContentType(){
...
@@ -2188,7 +2188,7 @@ function displayOverlayForSpecifyContentType(){
if
(
COMMON
.
isTouchDevice
()
==
true
)
{
if
(
COMMON
.
isTouchDevice
()
==
true
)
{
if
(
avwUserEnvObj
.
os
==
"android"
)
{
if
(
avwUserEnvObj
.
os
==
"android"
)
{
standardRatio
=
document
.
documentElement
.
clientWidth
/
window
.
innerWidth
;
standardRatio
=
document
.
documentElement
.
clientWidth
/
window
.
innerWidth
;
startDetectZoom
({
time
:
500
,
ZOOM_DETECTOR
.
startDetectZoom
({
time
:
500
,
callbackFunction
:
function
(
oldRatio
,
newRatio
,
oldW
,
oldH
,
newW
,
newH
)
{
callbackFunction
:
function
(
oldRatio
,
newRatio
,
oldW
,
oldH
,
newW
,
newH
)
{
currentRatio
=
newRatio
;
currentRatio
=
newRatio
;
...
...
abvw/js/contentview_GetData.js
View file @
cc95a08a
...
@@ -1135,7 +1135,7 @@ function getContentInfoTypeImage(){
...
@@ -1135,7 +1135,7 @@ function getContentInfoTypeImage(){
if
(
COMMON
.
isTouchDevice
()
==
true
)
{
if
(
COMMON
.
isTouchDevice
()
==
true
)
{
if
(
avwUserEnvObj
.
os
==
"android"
)
{
if
(
avwUserEnvObj
.
os
==
"android"
)
{
standardRatio
=
document
.
documentElement
.
clientWidth
/
window
.
innerWidth
;
standardRatio
=
document
.
documentElement
.
clientWidth
/
window
.
innerWidth
;
startDetectZoom
({
time
:
500
,
ZOOM_DETECTOR
.
startDetectZoom
({
time
:
500
,
callbackFunction
:
function
(
oldRatio
,
newRatio
,
oldW
,
oldH
,
newW
,
newH
)
{
callbackFunction
:
function
(
oldRatio
,
newRatio
,
oldW
,
oldH
,
newW
,
newH
)
{
currentRatio
=
newRatio
;
currentRatio
=
newRatio
;
...
...
abvw/js/contentview_InitObjects.js
View file @
cc95a08a
...
@@ -391,7 +391,7 @@ function initPage() {
...
@@ -391,7 +391,7 @@ function initPage() {
if
(
COMMON
.
isTouchDevice
()
==
true
)
{
if
(
COMMON
.
isTouchDevice
()
==
true
)
{
if
(
avwUserEnvObj
.
os
==
"android"
)
{
if
(
avwUserEnvObj
.
os
==
"android"
)
{
standardRatio
=
document
.
documentElement
.
clientWidth
/
window
.
innerWidth
;
standardRatio
=
document
.
documentElement
.
clientWidth
/
window
.
innerWidth
;
startDetectZoom
({
time
:
500
,
ZOOM_DETECTOR
.
startDetectZoom
({
time
:
500
,
callbackFunction
:
function
(
oldRatio
,
newRatio
,
oldW
,
oldH
,
newW
,
newH
)
{
callbackFunction
:
function
(
oldRatio
,
newRatio
,
oldW
,
oldH
,
newW
,
newH
)
{
currentRatio
=
newRatio
;
currentRatio
=
newRatio
;
...
@@ -531,7 +531,7 @@ function initPage() {
...
@@ -531,7 +531,7 @@ function initPage() {
if
(
COMMON
.
isTouchDevice
()
==
true
)
{
if
(
COMMON
.
isTouchDevice
()
==
true
)
{
if
(
avwUserEnvObj
.
os
==
"android"
)
{
if
(
avwUserEnvObj
.
os
==
"android"
)
{
standardRatio
=
document
.
documentElement
.
clientWidth
/
window
.
innerWidth
;
standardRatio
=
document
.
documentElement
.
clientWidth
/
window
.
innerWidth
;
startDetectZoom
({
time
:
500
,
ZOOM_DETECTOR
.
startDetectZoom
({
time
:
500
,
callbackFunction
:
function
(
oldRatio
,
newRatio
,
oldW
,
oldH
,
newW
,
newH
)
{
callbackFunction
:
function
(
oldRatio
,
newRatio
,
oldW
,
oldH
,
newW
,
newH
)
{
currentRatio
=
newRatio
;
currentRatio
=
newRatio
;
...
...
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