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
1ff1a86a
Commit
1ff1a86a
authored
Aug 04, 2014
by
Masaru Abe
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Thickbox.jsのリファクタリング
parent
8ad58f1a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
80 additions
and
77 deletions
+80
-77
abvw/common/js/screenLock.js
+1
-1
abvw/common/js/thickbox.js
+79
-76
No files found.
abvw/common/js/screenLock.js
View file @
1ff1a86a
...
@@ -23,7 +23,7 @@
...
@@ -23,7 +23,7 @@
*
*
*/
*/
//グローバルの名前空間用のオブジェクトを用意する
//グローバルの名前空間用のオブジェクトを用意する
var
SCREENLOCK
=
{};
var
SCREENLOCK
=
{};
SCREENLOCK
.
screenLock
=
function
(
options
)
{
SCREENLOCK
.
screenLock
=
function
(
options
)
{
...
...
abvw/common/js/thickbox.js
View file @
1ff1a86a
...
@@ -5,23 +5,26 @@
...
@@ -5,23 +5,26 @@
* Licensed under the MIT License: http://www.opensource.org/licenses/mit-license.php
* Licensed under the MIT License: http://www.opensource.org/licenses/mit-license.php
*/
*/
var
tb_pathToImage
=
""
;
// "/common/images/loadingAnimation.gif";
//グローバルの名前空間用のオブジェクトを用意する
var
tmpPage
;
var
THICKBOX
=
{};
var
linkPage
;
var
TB_WIDTH
;
THICKBOX
.
tb_pathToImage
=
""
;
// "/common/images/loadingAnimation.gif";
var
TB_HEIGHT
;
THICKBOX
.
tmpPage
;
THICKBOX
.
linkPage
;
THICKBOX
.
TB_WIDTH
;
THICKBOX
.
TB_HEIGHT
;
// ページ上部からの位置
// ページ上部からの位置
var
pageTop
=
10
;
THICKBOX
.
pageTop
=
10
;
/*!!!!!!!!!!!!!!!!! edit below this line at your own risk !!!!!!!!!!!!!!!!!!!!!!!*/
/*!!!!!!!!!!!!!!!!! edit below this line at your own risk !!!!!!!!!!!!!!!!!!!!!!!*/
//on page load call tb_init
//on page load call tb_init
$
(
document
).
ready
(
function
(){
$
(
document
).
ready
(
function
(){
if
(
window
==
window
.
parent
){
if
(
window
==
window
.
parent
){
tb_init
(
'a.thickbox, area.thickbox, input.thickbox'
);
//pass where to apply thickbox
THICKBOX
.
tb_init
(
'a.thickbox, area.thickbox, input.thickbox'
);
//pass where to apply thickbox
imgLoader
=
new
Image
();
// preload image
imgLoader
=
new
Image
();
// preload image
imgLoader
.
src
=
tb_pathToImage
;
imgLoader
.
src
=
THICKBOX
.
tb_pathToImage
;
}
else
{
}
else
{
//2009/09/28 add h.kobayashi
//2009/09/28 add h.kobayashi
$
(
".thickbox_link"
).
click
(
function
()
{
$
(
".thickbox_link"
).
click
(
function
()
{
...
@@ -30,7 +33,7 @@ $(document).ready(function(){
...
@@ -30,7 +33,7 @@ $(document).ready(function(){
doc
=
parent
.
document
;
doc
=
parent
.
document
;
}
}
if
(
$
(
"#TB_iframeContent"
,
doc
).
size
()
>
0
){
if
(
$
(
"#TB_iframeContent"
,
doc
).
size
()
>
0
){
showLoading
();
THICKBOX
.
showLoading
();
$
(
'#TB_window'
,
doc
).
hide
();
$
(
'#TB_window'
,
doc
).
hide
();
}
}
return
true
;
return
true
;
...
@@ -50,21 +53,21 @@ $(document).ready(function(){
...
@@ -50,21 +53,21 @@ $(document).ready(function(){
var
tmpImage
=
$
(
"#tmpDesign > p > img:eq(0)"
);
var
tmpImage
=
$
(
"#tmpDesign > p > img:eq(0)"
);
var
preImg
=
new
Image
();
var
preImg
=
new
Image
();
preImg
.
src
=
tmpImage
.
attr
(
"src"
);
preImg
.
src
=
tmpImage
.
attr
(
"src"
);
preImg
.
onload
=
_imageLoaded
;
preImg
.
onload
=
THICKBOX
.
_imageLoaded
;
if
(
preImg
.
width
>
preImg
.
height
){
if
(
preImg
.
width
>
preImg
.
height
){
TB_WIDTH
=
820
;
T
HICKBOX
.
T
B_WIDTH
=
820
;
TB_HEIGHT
=
725
;
T
HICKBOX
.
T
B_HEIGHT
=
725
;
}
else
{
}
else
{
TB_WIDTH
=
820
;
T
HICKBOX
.
T
B_WIDTH
=
820
;
TB_HEIGHT
=
725
;
T
HICKBOX
.
T
B_HEIGHT
=
725
;
}
}
T
B_WIDTH
=
TB_WIDTH
+
15
;
T
HICKBOX
.
TB_WIDTH
=
THICKBOX
.
TB_WIDTH
+
15
;
T
B_HEIGHT
=
TB_HEIGHT
+
30
;
T
HICKBOX
.
TB_HEIGHT
=
THICKBOX
.
TB_HEIGHT
+
30
;
var
ajaxContentW
=
TB_WIDTH
-
29
;
var
ajaxContentW
=
T
HICKBOX
.
T
B_WIDTH
-
29
;
var
ajaxContentH
=
TB_HEIGHT
-
80
;
var
ajaxContentH
=
T
HICKBOX
.
T
B_HEIGHT
-
80
;
$
(
"#TB_title"
,
doc
).
width
(
ajaxContentW
);
$
(
"#TB_title"
,
doc
).
width
(
ajaxContentW
);
//$("#TB_ajaxWindowTitle",doc).text(caption);
//$("#TB_ajaxWindowTitle",doc).text(caption);
...
@@ -79,9 +82,9 @@ $(document).ready(function(){
...
@@ -79,9 +82,9 @@ $(document).ready(function(){
// 画面中央に位置を調整
// 画面中央に位置を調整
if
(
jQuery
.
browser
.
msie
&&
jQuery
.
browser
.
version
<
7
)
{
if
(
jQuery
.
browser
.
msie
&&
jQuery
.
browser
.
version
<
7
)
{
offsetTop
=
(
doc
.
documentElement
.
clientHeight
-
TB_HEIGHT
)
/
2
;
offsetTop
=
(
doc
.
documentElement
.
clientHeight
-
T
HICKBOX
.
T
B_HEIGHT
)
/
2
;
}
else
{
}
else
{
offsetTop
=
(
$
(
"body"
,
doc
).
height
()
-
TB_HEIGHT
)
/
2
;
offsetTop
=
(
$
(
"body"
,
doc
).
height
()
-
T
HICKBOX
.
T
B_HEIGHT
)
/
2
;
}
}
if
(
$
(
document
).
scrollTop
()
+
offsetTop
>=
0
){
if
(
$
(
document
).
scrollTop
()
+
offsetTop
>=
0
){
...
@@ -91,7 +94,7 @@ $(document).ready(function(){
...
@@ -91,7 +94,7 @@ $(document).ready(function(){
}
}
docwidth
=
$
(
"body"
,
doc
).
width
();
docwidth
=
$
(
"body"
,
doc
).
width
();
marginsize
=
((
docwidth
-
TB_WIDTH
)
/
2
);
marginsize
=
((
docwidth
-
T
HICKBOX
.
T
B_WIDTH
)
/
2
);
$
(
"#TB_window"
,
doc
).
css
(
"left"
,
"0px"
);
$
(
"#TB_window"
,
doc
).
css
(
"left"
,
"0px"
);
$
(
"#TB_window"
,
doc
).
css
(
"margin-left"
,
marginsize
+
"px"
);
$
(
"#TB_window"
,
doc
).
css
(
"margin-left"
,
marginsize
+
"px"
);
...
@@ -105,7 +108,7 @@ $(document).ready(function(){
...
@@ -105,7 +108,7 @@ $(document).ready(function(){
});
});
//2009.09.28 add kobayashi
//2009.09.28 add kobayashi
function
_imageLoaded
(){
THICKBOX
.
_imageLoaded
=
function
(){
var
url
=
this
.
href
||
this
.
alt
;
var
url
=
this
.
href
||
this
.
alt
;
var
caption
=
this
.
title
||
this
.
name
||
null
;
var
caption
=
this
.
title
||
this
.
name
||
null
;
...
@@ -115,18 +118,18 @@ function _imageLoaded(){
...
@@ -115,18 +118,18 @@ function _imageLoaded(){
}
}
if
(
this
.
width
>
this
.
height
){
if
(
this
.
width
>
this
.
height
){
TB_WIDTH
=
800
;
T
HICKBOX
.
T
B_WIDTH
=
800
;
TB_HEIGHT
=
570
;
T
HICKBOX
.
T
B_HEIGHT
=
570
;
}
else
{
}
else
{
TB_WIDTH
=
620
;
T
HICKBOX
.
T
B_WIDTH
=
620
;
TB_HEIGHT
=
650
;
T
HICKBOX
.
T
B_HEIGHT
=
650
;
}
}
T
B_WIDTH
=
TB_WIDTH
+
15
;
T
HICKBOX
.
TB_WIDTH
=
THICKBOX
.
TB_WIDTH
+
15
;
T
B_HEIGHT
=
TB_HEIGHT
+
30
;
T
HICKBOX
.
TB_HEIGHT
=
THICKBOX
.
TB_HEIGHT
+
30
;
var
ajaxContentW
=
TB_WIDTH
-
29
;
var
ajaxContentW
=
T
HICKBOX
.
T
B_WIDTH
-
29
;
var
ajaxContentH
=
TB_HEIGHT
-
80
;
var
ajaxContentH
=
T
HICKBOX
.
T
B_HEIGHT
-
80
;
$
(
"#TB_title"
,
doc
).
width
(
ajaxContentW
);
$
(
"#TB_title"
,
doc
).
width
(
ajaxContentW
);
//$("#TB_ajaxWindowTitle",doc).text(caption);
//$("#TB_ajaxWindowTitle",doc).text(caption);
...
@@ -141,9 +144,9 @@ function _imageLoaded(){
...
@@ -141,9 +144,9 @@ function _imageLoaded(){
// 画面中央に位置を調整
// 画面中央に位置を調整
if
(
jQuery
.
browser
.
msie
&&
jQuery
.
browser
.
version
<
7
)
{
if
(
jQuery
.
browser
.
msie
&&
jQuery
.
browser
.
version
<
7
)
{
offsetTop
=
(
doc
.
documentElement
.
clientHeight
-
TB_HEIGHT
)
/
2
;
offsetTop
=
(
doc
.
documentElement
.
clientHeight
-
T
HICKBOX
.
T
B_HEIGHT
)
/
2
;
}
else
{
}
else
{
offsetTop
=
(
$
(
"body"
,
doc
).
height
()
-
TB_HEIGHT
)
/
2
;
offsetTop
=
(
$
(
"body"
,
doc
).
height
()
-
T
HICKBOX
.
T
B_HEIGHT
)
/
2
;
}
}
if
(
$
(
document
).
scrollTop
()
+
offsetTop
>=
0
){
if
(
$
(
document
).
scrollTop
()
+
offsetTop
>=
0
){
...
@@ -153,7 +156,7 @@ function _imageLoaded(){
...
@@ -153,7 +156,7 @@ function _imageLoaded(){
}
}
docwidth
=
$
(
"body"
,
doc
).
width
();
docwidth
=
$
(
"body"
,
doc
).
width
();
marginsize
=
((
docwidth
-
TB_WIDTH
)
/
2
);
marginsize
=
((
docwidth
-
T
HICKBOX
.
T
B_WIDTH
)
/
2
);
$
(
"#TB_window"
,
doc
).
css
(
"left"
,
"0px"
);
$
(
"#TB_window"
,
doc
).
css
(
"left"
,
"0px"
);
$
(
"#TB_window"
,
doc
).
css
(
"margin-left"
,
marginsize
+
"px"
);
$
(
"#TB_window"
,
doc
).
css
(
"margin-left"
,
marginsize
+
"px"
);
...
@@ -162,24 +165,24 @@ function _imageLoaded(){
...
@@ -162,24 +165,24 @@ function _imageLoaded(){
$
(
'#TB_load'
,
doc
).
hide
();
$
(
'#TB_load'
,
doc
).
hide
();
$
(
'#TB_window'
,
doc
).
show
();
$
(
'#TB_window'
,
doc
).
show
();
//$("#TB_iframeContent",doc).attr("src",linkPage);
//$("#TB_iframeContent",doc).attr("src",
THICKBOX.
linkPage);
}
}
//add thickbox to href & area elements that have a class of .thickbox
//add thickbox to href & area elements that have a class of .thickbox
function
tb_init
(
domChunk
){
THICKBOX
.
tb_init
=
function
(
domChunk
){
$
(
domChunk
).
click
(
function
(){
$
(
domChunk
).
click
(
function
(){
var
t
=
this
.
title
||
this
.
name
||
null
;
var
t
=
this
.
title
||
this
.
name
||
null
;
var
a
=
this
.
href
||
this
.
alt
;
var
a
=
this
.
href
||
this
.
alt
;
var
g
=
this
.
rel
||
false
;
var
g
=
this
.
rel
||
false
;
tb_show
(
t
,
a
,
g
);
THICKBOX
.
tb_show
(
t
,
a
,
g
);
this
.
blur
();
this
.
blur
();
return
false
;
return
false
;
});
});
}
}
function
tb_show
(
caption
,
url
,
imageGroup
)
{
//function called when the user clicks on a thickbox link
THICKBOX
.
tb_show
=
function
(
caption
,
url
,
imageGroup
)
{
//function called when the user clicks on a thickbox link
try
{
try
{
if
(
typeof
document
.
body
.
style
.
maxHeight
===
"undefined"
)
{
//if IE 6
if
(
typeof
document
.
body
.
style
.
maxHeight
===
"undefined"
)
{
//if IE 6
...
@@ -187,17 +190,17 @@ function tb_show(caption, url, imageGroup) {//function called when the user clic
...
@@ -187,17 +190,17 @@ function tb_show(caption, url, imageGroup) {//function called when the user clic
//$("html").css("overflow","hidden");
//$("html").css("overflow","hidden");
if
(
document
.
getElementById
(
"TB_HideSelect"
)
===
null
)
{
//iframe to hide select elements in ie6
if
(
document
.
getElementById
(
"TB_HideSelect"
)
===
null
)
{
//iframe to hide select elements in ie6
$
(
"body"
).
append
(
"<iframe id='TB_HideSelect'></iframe><div id='TB_overlay'></div><div id='TB_window'></div>"
);
$
(
"body"
).
append
(
"<iframe id='TB_HideSelect'></iframe><div id='TB_overlay'></div><div id='TB_window'></div>"
);
$
(
"#TB_overlay"
).
click
(
tb_remove
);
$
(
"#TB_overlay"
).
click
(
THICKBOX
.
tb_remove
);
}
}
$
(
"#TB_HideSelect"
).
css
(
"overflow"
,
"hidden"
);
$
(
"#TB_HideSelect"
).
css
(
"overflow"
,
"hidden"
);
}
else
{
//all others
}
else
{
//all others
if
(
document
.
getElementById
(
"TB_overlay"
)
===
null
){
if
(
document
.
getElementById
(
"TB_overlay"
)
===
null
){
$
(
"body"
).
append
(
"<div id='TB_overlay'></div><div id='TB_window'></div>"
);
$
(
"body"
).
append
(
"<div id='TB_overlay'></div><div id='TB_window'></div>"
);
$
(
"#TB_overlay"
).
click
(
tb_remove
);
$
(
"#TB_overlay"
).
click
(
THICKBOX
.
tb_remove
);
}
}
}
}
if
(
tb_detectMacXFF
()){
if
(
THICKBOX
.
tb_detectMacXFF
()){
$
(
"#TB_overlay"
).
addClass
(
"TB_overlayMacFFBGHack"
);
//use png overlay so hide flash
$
(
"#TB_overlay"
).
addClass
(
"TB_overlayMacFFBGHack"
);
//use png overlay so hide flash
}
else
{
}
else
{
$
(
"#TB_overlay"
).
addClass
(
"TB_overlayBG"
);
//use background and opacity
$
(
"#TB_overlay"
).
addClass
(
"TB_overlayBG"
);
//use background and opacity
...
@@ -209,7 +212,7 @@ function tb_show(caption, url, imageGroup) {//function called when the user clic
...
@@ -209,7 +212,7 @@ function tb_show(caption, url, imageGroup) {//function called when the user clic
$
(
"body"
).
append
(
"<div id='TB_load'><img src='"
+
imgLoader
.
src
+
"' /></div>"
);
//add loader to the page
$
(
"body"
).
append
(
"<div id='TB_load'><img src='"
+
imgLoader
.
src
+
"' /></div>"
);
//add loader to the page
}
}
showLoading
();
THICKBOX
.
showLoading
();
var
baseURL
;
var
baseURL
;
if
(
url
.
indexOf
(
"?"
)
!==-
1
){
//ff there is a query string involved
if
(
url
.
indexOf
(
"?"
)
!==-
1
){
//ff there is a query string involved
...
@@ -259,7 +262,7 @@ function tb_show(caption, url, imageGroup) {//function called when the user clic
...
@@ -259,7 +262,7 @@ function tb_show(caption, url, imageGroup) {//function called when the user clic
imgPreloader
.
onload
=
null
;
imgPreloader
.
onload
=
null
;
// Resizing large images - orginal by Christian Montoya edited by me.
// Resizing large images - orginal by Christian Montoya edited by me.
var
pagesize
=
tb_getPageSize
();
var
pagesize
=
THICKBOX
.
tb_getPageSize
();
var
x
=
pagesize
[
0
]
-
150
;
var
x
=
pagesize
[
0
]
-
150
;
var
y
=
pagesize
[
1
]
-
150
;
var
y
=
pagesize
[
1
]
-
150
;
var
imageWidth
=
imgPreloader
.
width
;
var
imageWidth
=
imgPreloader
.
width
;
...
@@ -281,21 +284,21 @@ function tb_show(caption, url, imageGroup) {//function called when the user clic
...
@@ -281,21 +284,21 @@ function tb_show(caption, url, imageGroup) {//function called when the user clic
}
}
// End Resizing
// End Resizing
TB_WIDTH
=
imageWidth
+
30
;
T
HICKBOX
.
T
B_WIDTH
=
imageWidth
+
30
;
TB_HEIGHT
=
imageHeight
+
60
;
T
HICKBOX
.
T
B_HEIGHT
=
imageHeight
+
60
;
image_height
=
TB_HEIGHT
;
image_height
=
T
HICKBOX
.
T
B_HEIGHT
;
$
(
"#TB_window"
).
append
(
"<a href='' id='TB_ImageOff' title='Close'><img id='TB_Image' src='"
+
url
+
"' width='"
+
imageWidth
+
"' height='"
+
imageHeight
+
"' alt='"
+
caption
+
"'/></a>"
+
"<div id='TB_caption'>"
+
caption
+
"<div id='TB_secondLine'>"
+
TB_imageCount
+
TB_PrevHTML
+
TB_NextHTML
+
"</div></div><div id='TB_closeWindow' style='padding:10px 5px;'><a href='#' id='TB_closeWindowButton' title='閉じる'><img src='../common/images/bt_close.gif' alt='閉じる' width='31' height='31' /></a></div>"
);
$
(
"#TB_window"
).
append
(
"<a href='' id='TB_ImageOff' title='Close'><img id='TB_Image' src='"
+
url
+
"' width='"
+
imageWidth
+
"' height='"
+
imageHeight
+
"' alt='"
+
caption
+
"'/></a>"
+
"<div id='TB_caption'>"
+
caption
+
"<div id='TB_secondLine'>"
+
TB_imageCount
+
TB_PrevHTML
+
TB_NextHTML
+
"</div></div><div id='TB_closeWindow' style='padding:10px 5px;'><a href='#' id='TB_closeWindowButton' title='閉じる'><img src='../common/images/bt_close.gif' alt='閉じる' width='31' height='31' /></a></div>"
);
$
(
"#TB_closeWindowButton"
).
click
(
tb_remove
);
$
(
"#TB_closeWindowButton"
).
click
(
THICKBOX
.
tb_remove
);
if
(
!
(
TB_PrevHTML
===
""
))
{
if
(
!
(
TB_PrevHTML
===
""
))
{
function
goPrev
(){
function
goPrev
(){
if
(
$
(
document
).
unbind
(
"click"
,
goPrev
)){
$
(
document
).
unbind
(
"click"
,
goPrev
);}
if
(
$
(
document
).
unbind
(
"click"
,
goPrev
)){
$
(
document
).
unbind
(
"click"
,
goPrev
);}
$
(
"#TB_window"
).
remove
();
$
(
"#TB_window"
).
remove
();
$
(
"body"
).
append
(
"<div id='TB_window'></div>"
);
$
(
"body"
).
append
(
"<div id='TB_window'></div>"
);
tb_show
(
TB_PrevCaption
,
TB_PrevURL
,
imageGroup
);
THICKBOX
.
tb_show
(
TB_PrevCaption
,
TB_PrevURL
,
imageGroup
);
return
false
;
return
false
;
}
}
$
(
"#TB_prev"
).
click
(
goPrev
);
$
(
"#TB_prev"
).
click
(
goPrev
);
...
@@ -305,7 +308,7 @@ function tb_show(caption, url, imageGroup) {//function called when the user clic
...
@@ -305,7 +308,7 @@ function tb_show(caption, url, imageGroup) {//function called when the user clic
function
goNext
(){
function
goNext
(){
$
(
"#TB_window"
).
remove
();
$
(
"#TB_window"
).
remove
();
$
(
"body"
).
append
(
"<div id='TB_window'></div>"
);
$
(
"body"
).
append
(
"<div id='TB_window'></div>"
);
tb_show
(
TB_NextCaption
,
TB_NextURL
,
imageGroup
);
THICKBOX
.
tb_show
(
TB_NextCaption
,
TB_NextURL
,
imageGroup
);
return
false
;
return
false
;
}
}
$
(
"#TB_next"
).
click
(
goNext
);
$
(
"#TB_next"
).
click
(
goNext
);
...
@@ -319,7 +322,7 @@ function tb_show(caption, url, imageGroup) {//function called when the user clic
...
@@ -319,7 +322,7 @@ function tb_show(caption, url, imageGroup) {//function called when the user clic
keycode
=
e
.
which
;
keycode
=
e
.
which
;
}
}
if
(
keycode
==
27
){
// close
if
(
keycode
==
27
){
// close
tb_remove
();
THICKBOX
.
tb_remove
();
}
else
if
(
keycode
==
190
){
// display previous image
}
else
if
(
keycode
==
190
){
// display previous image
if
(
!
(
TB_NextHTML
==
""
)){
if
(
!
(
TB_NextHTML
==
""
)){
document
.
onkeydown
=
""
;
document
.
onkeydown
=
""
;
...
@@ -333,10 +336,10 @@ function tb_show(caption, url, imageGroup) {//function called when the user clic
...
@@ -333,10 +336,10 @@ function tb_show(caption, url, imageGroup) {//function called when the user clic
}
}
};
};
tb_position
();
THICKBOX
.
tb_position
();
//$("#TB_load").remove();
//$("#TB_load").remove();
$
(
"#TB_load"
).
hide
();
$
(
"#TB_load"
).
hide
();
$
(
"#TB_ImageOff"
).
click
(
tb_remove
);
$
(
"#TB_ImageOff"
).
click
(
THICKBOX
.
tb_remove
);
$
(
"#TB_window"
).
css
({
display
:
"block"
});
//for safari using css instead of show
$
(
"#TB_window"
).
css
({
display
:
"block"
});
//for safari using css instead of show
};
};
...
@@ -346,12 +349,12 @@ function tb_show(caption, url, imageGroup) {//function called when the user clic
...
@@ -346,12 +349,12 @@ function tb_show(caption, url, imageGroup) {//function called when the user clic
}
else
{
//code to show html
}
else
{
//code to show html
var
queryString
=
url
.
replace
(
/^
[^\?]
+
\??
/
,
''
);
var
queryString
=
url
.
replace
(
/^
[^\?]
+
\??
/
,
''
);
var
params
=
tb_parseQuery
(
queryString
);
var
params
=
THICKBOX
.
tb_parseQuery
(
queryString
);
TB_WIDTH
=
(
params
[
'width'
]
*
1
)
+
15
||
630
;
//defaults to 630 if no paramaters were added to URL
T
HICKBOX
.
T
B_WIDTH
=
(
params
[
'width'
]
*
1
)
+
15
||
630
;
//defaults to 630 if no paramaters were added to URL
TB_HEIGHT
=
(
params
[
'height'
]
*
1
)
+
30
||
440
;
//defaults to 440 if no paramaters were added to URL
T
HICKBOX
.
T
B_HEIGHT
=
(
params
[
'height'
]
*
1
)
+
30
||
440
;
//defaults to 440 if no paramaters were added to URL
ajaxContentW
=
TB_WIDTH
-
29
;
ajaxContentW
=
T
HICKBOX
.
T
B_WIDTH
-
29
;
ajaxContentH
=
TB_HEIGHT
-
80
;
ajaxContentH
=
T
HICKBOX
.
T
B_HEIGHT
-
80
;
if
(
url
.
indexOf
(
'TB_iframe'
)
!=
-
1
){
// either iframe or ajax window
if
(
url
.
indexOf
(
'TB_iframe'
)
!=
-
1
){
// either iframe or ajax window
...
@@ -361,10 +364,10 @@ function tb_show(caption, url, imageGroup) {//function called when the user clic
...
@@ -361,10 +364,10 @@ function tb_show(caption, url, imageGroup) {//function called when the user clic
$
(
"#TB_window"
).
css
({
visibility
:
"hidden"
,
display
:
"block"
});
$
(
"#TB_window"
).
css
({
visibility
:
"hidden"
,
display
:
"block"
});
$
(
"#TB_window"
).
append
(
"<div id='TB_title'><div id='TB_ajaxWindowTitle'>"
+
caption
+
"</div><div id='TB_closeAjaxWindow'><a href='#' id='TB_closeWindowButton' title='閉じる'><img src='../common/images/bt_close.gif' alt='閉じる' width='31' height='31' /></a></div></div><iframe frameborder='0' hspace='0' src='"
+
urlNoQuery
[
0
]
+
"' id='TB_iframeContent' name='TB_iframeContent"
+
Math
.
round
(
Math
.
random
()
*
1000
)
+
"' onload='tb_showIframe()' style='width:"
+
(
ajaxContentW
+
29
)
+
"px;height:"
+
(
ajaxContentH
+
17
)
+
"px;' > </iframe>"
);
$
(
"#TB_window"
).
append
(
"<div id='TB_title'><div id='TB_ajaxWindowTitle'>"
+
caption
+
"</div><div id='TB_closeAjaxWindow'><a href='#' id='TB_closeWindowButton' title='閉じる'><img src='../common/images/bt_close.gif' alt='閉じる' width='31' height='31' /></a></div></div><iframe frameborder='0' hspace='0' src='"
+
urlNoQuery
[
0
]
+
"' id='TB_iframeContent' name='TB_iframeContent"
+
Math
.
round
(
Math
.
random
()
*
1000
)
+
"' onload='
THICKBOX.
tb_showIframe()' style='width:"
+
(
ajaxContentW
+
29
)
+
"px;height:"
+
(
ajaxContentH
+
17
)
+
"px;' > </iframe>"
);
}
else
{
//iframe modal
}
else
{
//iframe modal
$
(
"#TB_overlay"
).
unbind
();
$
(
"#TB_overlay"
).
unbind
();
$
(
"#TB_window"
).
append
(
"<iframe frameborder='0' hspace='0' src='"
+
urlNoQuery
[
0
]
+
"' id='TB_iframeContent' name='TB_iframeContent"
+
Math
.
round
(
Math
.
random
()
*
1000
)
+
"' onload='tb_showIframe()' style='width:"
+
(
ajaxContentW
+
29
)
+
"px;height:"
+
(
ajaxContentH
+
17
)
+
"px;'> </iframe>"
);
$
(
"#TB_window"
).
append
(
"<iframe frameborder='0' hspace='0' src='"
+
urlNoQuery
[
0
]
+
"' id='TB_iframeContent' name='TB_iframeContent"
+
Math
.
round
(
Math
.
random
()
*
1000
)
+
"' onload='
THICKBOX.
tb_showIframe()' style='width:"
+
(
ajaxContentW
+
29
)
+
"px;height:"
+
(
ajaxContentH
+
17
)
+
"px;'> </iframe>"
);
}
}
}
else
{
// not an iframe, ajax
}
else
{
// not an iframe, ajax
if
(
$
(
"#TB_window"
).
css
(
"display"
)
!=
"block"
){
if
(
$
(
"#TB_window"
).
css
(
"display"
)
!=
"block"
){
...
@@ -382,19 +385,19 @@ function tb_show(caption, url, imageGroup) {//function called when the user clic
...
@@ -382,19 +385,19 @@ function tb_show(caption, url, imageGroup) {//function called when the user clic
}
}
}
}
$
(
"#TB_closeWindowButton"
).
click
(
tb_remove
);
$
(
"#TB_closeWindowButton"
).
click
(
THICKBOX
.
tb_remove
);
if
(
url
.
indexOf
(
'TB_inline'
)
!=
-
1
){
if
(
url
.
indexOf
(
'TB_inline'
)
!=
-
1
){
$
(
"#TB_ajaxContent"
).
append
(
$
(
'#'
+
params
[
'inlineId'
]).
children
());
$
(
"#TB_ajaxContent"
).
append
(
$
(
'#'
+
params
[
'inlineId'
]).
children
());
$
(
"#TB_window"
).
unload
(
function
()
{
$
(
"#TB_window"
).
unload
(
function
()
{
$
(
'#'
+
params
[
'inlineId'
]).
append
(
$
(
"#TB_ajaxContent"
).
children
()
);
// move elements back when you're finished
$
(
'#'
+
params
[
'inlineId'
]).
append
(
$
(
"#TB_ajaxContent"
).
children
()
);
// move elements back when you're finished
});
});
tb_position
();
THICKBOX
.
tb_position
();
//$("#TB_load").remove();
//$("#TB_load").remove();
$
(
"#TB_load"
).
hide
();
$
(
"#TB_load"
).
hide
();
$
(
"#TB_window"
).
css
({
display
:
"block"
});
$
(
"#TB_window"
).
css
({
display
:
"block"
});
}
else
if
(
url
.
indexOf
(
'TB_iframe'
)
!=
-
1
){
}
else
if
(
url
.
indexOf
(
'TB_iframe'
)
!=
-
1
){
tb_position
();
THICKBOX
.
tb_position
();
if
(
$
.
browser
.
safari
){
//safari needs help because it will not fire iframe onload
if
(
$
.
browser
.
safari
){
//safari needs help because it will not fire iframe onload
//$("#TB_load").remove();
//$("#TB_load").remove();
...
@@ -403,23 +406,23 @@ function tb_show(caption, url, imageGroup) {//function called when the user clic
...
@@ -403,23 +406,23 @@ function tb_show(caption, url, imageGroup) {//function called when the user clic
}
}
}
else
{
}
else
{
$
(
"#TB_ajaxContent"
).
load
(
url
+=
"&random="
+
(
new
Date
().
getTime
()),
function
(){
//to do a post change this load method
$
(
"#TB_ajaxContent"
).
load
(
url
+=
"&random="
+
(
new
Date
().
getTime
()),
function
(){
//to do a post change this load method
tb_position
();
THICKBOX
.
tb_position
();
//$("#TB_load").remove();
//$("#TB_load").remove();
$
(
"#TB_load"
).
hide
();
$
(
"#TB_load"
).
hide
();
tb_init
(
"#TB_ajaxContent a.thickbox"
);
THICKBOX
.
tb_init
(
"#TB_ajaxContent a.thickbox"
);
$
(
"#TB_window"
).
css
({
display
:
"block"
});
$
(
"#TB_window"
).
css
({
display
:
"block"
});
});
});
}
}
image_height
=
TB_HEIGHT
;
image_height
=
T
HICKBOX
.
T
B_HEIGHT
;
}
}
// customize 2009/0914
// customize 2009/0914
$
(
"#TB_overlay"
).
height
(
$
(
document
).
height
());
$
(
"#TB_overlay"
).
height
(
$
(
document
).
height
());
// 画面中央に位置を調整
// 画面中央に位置を調整
//var offsetTop = ($(window).height() - TB_HEIGHT)/2;
//var offsetTop = ($(window).height() - T
HICKBOX.T
B_HEIGHT)/2;
//if ($(document).scrollTop() + offsetTop >= 0){
//if ($(document).scrollTop() + offsetTop >= 0){
// $("#TB_window").css("top",$(document).scrollTop() + offsetTop + "px");
// $("#TB_window").css("top",$(document).scrollTop() + offsetTop + "px");
...
@@ -461,7 +464,7 @@ function tb_show(caption, url, imageGroup) {//function called when the user clic
...
@@ -461,7 +464,7 @@ function tb_show(caption, url, imageGroup) {//function called when the user clic
keycode
=
e
.
which
;
keycode
=
e
.
which
;
}
}
if
(
keycode
==
27
){
// close
if
(
keycode
==
27
){
// close
tb_remove
();
THICKBOX
.
tb_remove
();
}
}
};
};
}
}
...
@@ -472,14 +475,14 @@ function tb_show(caption, url, imageGroup) {//function called when the user clic
...
@@ -472,14 +475,14 @@ function tb_show(caption, url, imageGroup) {//function called when the user clic
}
}
//helper functions below
//helper functions below
function
tb_showIframe
(){
THICKBOX
.
tb_showIframe
=
function
(){
//$("#TB_load").remove();
//$("#TB_load").remove();
$
(
"#TB_load"
).
hide
();
$
(
"#TB_load"
).
hide
();
$
(
"#TB_window"
).
css
({
visibility
:
"visible"
,
display
:
"block"
});
$
(
"#TB_window"
).
css
({
visibility
:
"visible"
,
display
:
"block"
});
}
}
function
tb_remove
()
{
THICKBOX
.
tb_remove
=
function
()
{
$
(
"#TB_imageOff"
).
unbind
(
"click"
);
$
(
"#TB_imageOff"
).
unbind
(
"click"
);
$
(
"#TB_closeWindowButton"
).
unbind
(
"click"
);
$
(
"#TB_closeWindowButton"
).
unbind
(
"click"
);
$
(
"#TB_window"
).
fadeOut
(
"fast"
,
function
(){
$
(
'#TB_window,#TB_overlay,#TB_HideSelect'
).
trigger
(
"unload"
).
unbind
().
remove
();});
$
(
"#TB_window"
).
fadeOut
(
"fast"
,
function
(){
$
(
'#TB_window,#TB_overlay,#TB_HideSelect'
).
trigger
(
"unload"
).
unbind
().
remove
();});
...
@@ -495,14 +498,14 @@ function tb_remove() {
...
@@ -495,14 +498,14 @@ function tb_remove() {
return
false
;
return
false
;
}
}
function
tb_posi
tion
()
{
THICKBOX
.
tb_position
=
func
tion
()
{
$
(
"#TB_window"
).
css
({
marginLeft
:
'-'
+
parseInt
((
T
B_WIDTH
/
2
),
10
)
+
'px'
,
width
:
TB_WIDTH
+
'px'
});
$
(
"#TB_window"
).
css
({
marginLeft
:
'-'
+
parseInt
((
T
HICKBOX
.
TB_WIDTH
/
2
),
10
)
+
'px'
,
width
:
THICKBOX
.
TB_WIDTH
+
'px'
});
//if ( !(jQuery.browser.msie && jQuery.browser.version < 7)) { // take away IE6
//if ( !(jQuery.browser.msie && jQuery.browser.version < 7)) { // take away IE6
// $("#TB_window").css({marginTop: '-' + parseInt((TB_HEIGHT / 2),10) + 'px'});
// $("#TB_window").css({marginTop: '-' + parseInt((T
HICKBOX.T
B_HEIGHT / 2),10) + 'px'});
//}
//}
}
}
function
tb_parseQuery
(
query
)
{
THICKBOX
.
tb_parseQuery
=
function
(
query
)
{
var
Params
=
{};
var
Params
=
{};
if
(
!
query
)
{
return
Params
;}
// return empty object
if
(
!
query
)
{
return
Params
;}
// return empty object
var
Pairs
=
query
.
split
(
/
[
;&
]
/
);
var
Pairs
=
query
.
split
(
/
[
;&
]
/
);
...
@@ -517,7 +520,7 @@ function tb_parseQuery ( query ) {
...
@@ -517,7 +520,7 @@ function tb_parseQuery ( query ) {
return
Params
;
return
Params
;
}
}
function
tb_getPageSize
(){
THICKBOX
.
tb_getPageSize
=
function
(){
var
de
=
document
.
documentElement
;
var
de
=
document
.
documentElement
;
var
w
=
window
.
innerWidth
||
self
.
innerWidth
||
(
de
&&
de
.
clientWidth
)
||
document
.
body
.
clientWidth
;
var
w
=
window
.
innerWidth
||
self
.
innerWidth
||
(
de
&&
de
.
clientWidth
)
||
document
.
body
.
clientWidth
;
var
h
=
window
.
innerHeight
||
self
.
innerHeight
||
(
de
&&
de
.
clientHeight
)
||
document
.
body
.
clientHeight
;
var
h
=
window
.
innerHeight
||
self
.
innerHeight
||
(
de
&&
de
.
clientHeight
)
||
document
.
body
.
clientHeight
;
...
@@ -525,14 +528,14 @@ function tb_getPageSize(){
...
@@ -525,14 +528,14 @@ function tb_getPageSize(){
return
arrayPageSize
;
return
arrayPageSize
;
}
}
function
tb_detectMacXFF
()
{
THICKBOX
.
tb_detectMacXFF
=
function
()
{
var
userAgent
=
navigator
.
userAgent
.
toLowerCase
();
var
userAgent
=
navigator
.
userAgent
.
toLowerCase
();
if
(
userAgent
.
indexOf
(
'mac'
)
!=
-
1
&&
userAgent
.
indexOf
(
'firefox'
)
!=-
1
)
{
if
(
userAgent
.
indexOf
(
'mac'
)
!=
-
1
&&
userAgent
.
indexOf
(
'firefox'
)
!=-
1
)
{
return
true
;
return
true
;
}
}
}
}
function
showLoading
(){
THICKBOX
.
showLoading
=
function
(){
var
doc
=
window
.
document
;
var
doc
=
window
.
document
;
if
(
window
!=
window
.
parent
){
if
(
window
!=
window
.
parent
){
doc
=
parent
.
document
;
doc
=
parent
.
document
;
...
@@ -548,7 +551,7 @@ function showLoading(){
...
@@ -548,7 +551,7 @@ function showLoading(){
offsetTop = $("body",doc).height()/2;
offsetTop = $("body",doc).height()/2;
}*/
}*/
offsetTop
=
TB_HEIGHT
/
2
;
offsetTop
=
T
HICKBOX
.
T
B_HEIGHT
/
2
;
//offsetTop = pageTop;
//offsetTop = pageTop;
$
(
"#TB_load"
,
doc
).
css
(
"top"
,
offsetTop
+
doctop
+
"px"
);
$
(
"#TB_load"
,
doc
).
css
(
"top"
,
offsetTop
+
doctop
+
"px"
);
...
...
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