Page Menu
Home
In-Portal Phabricator
Search
Configure Global Search
Log In
Files
F1155275
tabs.js
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Tue, Sep 16, 7:38 AM
Size
5 KB
Mime Type
text/plain
Expires
Thu, Sep 18, 7:38 AM (1 h, 14 m)
Engine
blob
Format
Raw Data
Handle
747521
Attached To
rINP In-Portal
tabs.js
View Options
function
Tab
(
tab_name
,
active_class
,
inactive_class
,
grid
,
a_toolbar
,
initial_state
)
{
this
.
TabName
=
tab_name
;
this
.
hidden
=
false
;
this
.
Grid
=
grid
;
this
.
ToolBar
=
a_toolbar
;
this
.
ActiveClass
=
active_class
;
this
.
InactiveClass
=
inactive_class
;
this
.
InitialState
=
initial_state
;
this
.
curTop
=
0
;
this
.
dX
=
0
;
this
.
dY
=
0
;
this
.
targetX
=
0
;
this
.
targetY
=
0
;
}
Tab
.
prototype
.
Init
=
function
()
{
this
.
Handle
=
document
.
getElementById
(
this
.
TabName
+
'_tab'
);
this
.
Divider
=
document
.
getElementById
(
this
.
TabName
+
'_tab_divider'
);
this
.
Content
=
document
.
getElementById
(
this
.
TabName
+
'_tab_content'
);
this
.
Handle
.
Tab
=
this
;
this
.
Container
=
document
.
createElement
(
'DIV'
);
this
.
Container
.
style
.
padding
=
'0'
;
//this.Container.style.position = 'relative';
this
.
Container
.
style
.
overflow
=
'hidden'
;
//alert(this.Content.tagName);
this
.
Content
.
parentNode
.
insertBefore
(
this
.
Container
,
this
.
Content
);
this
.
Content
.
style
.
overflow
=
'hidden'
;
//this.Content.style.position = 'relative';
var
ContentClone
=
this
.
Content
.
cloneNode
(
true
);
this
.
Content
.
parentNode
.
removeChild
(
this
.
Content
);
this
.
Container
.
appendChild
(
ContentClone
);
this
.
Content
=
ContentClone
;
this
.
OriginalHeight
=
this
.
Container
.
offsetHeight
;
this
.
StateField
=
document
.
createElement
(
'INPUT'
);
this
.
StateField
.
name
=
this
.
TabName
+
'_tab_state'
;
this
.
StateField
.
type
=
'hidden'
;
this
.
StateField
.
value
=
this
.
InitialState
;
document
.
kernel_form
.
appendChild
(
this
.
StateField
);
//alert(this.TabName + ' initial '+ this.InitialState);
if
(
this
.
InitialState
==
'0'
)
{
this
.
Hide
(
1
);
}
this
.
Handle
.
onclick
=
function
()
{
this
.
Tab
.
Click
();
};
}
Tab
.
prototype
.
Click
=
function
()
{
if
(
this
.
hidden
)
this
.
Show
();
else
this
.
Hide
();
}
Tab
.
prototype
.
Show
=
function
(
effect
)
{
if
(
typeof
(
effect
)
==
'undefined'
)
effect
=
true
;
this
.
Container
.
style
.
display
=
''
;
if
(
effect
)
{
this
.
Roll
(
0
,
10
,
0
,
0
);
}
this
.
hidden
=
false
;
this
.
Handle
.
className
=
this
.
ActiveClass
;
this
.
Divider
.
src
=
'img/itemtabs/divider_up.gif'
this
.
CheckDependencies
();
this
.
StateField
.
value
=
1
;
}
Tab
.
prototype
.
Hide
=
function
(
no_effect
)
{
this
.
Grid
.
ClearSelection
(
null
,
'Tab.Hide'
);
window
.
scrollTo
(
window
.
scrollLeft
,
0
);
this
.
Content
.
style
.
position
=
'relative'
;
if
(
typeof
(
no_effect
)
==
'undefined'
)
effect
=
true
;
else
{
this
.
Content
.
style
.
posTop
=
-
this
.
Container
.
offsetHeight
;
this
.
curTop
=
-
this
.
Container
.
offsetHeight
;
this
.
Container
.
style
.
height
=
1
;
this
.
Container
.
style
.
display
=
'none'
;
effect
=
false
;
}
if
(
effect
)
this
.
Roll
(
0
,
-
10
,
0
,
0
);
//this.Content.style.display = 'none';
this
.
hidden
=
true
;
this
.
Handle
.
className
=
this
.
InactiveClass
;
this
.
Divider
.
src
=
'img/itemtabs/divider_empty.gif'
this
.
CheckDependencies
();
this
.
StateField
.
value
=
0
;
}
Tab
.
prototype
.
Roll
=
function
(
dX
,
dY
,
targetX
,
targetY
)
{
var
tab
=
this
;
this
.
dX
=
dX
;
this
.
dY
=
dY
;
this
.
targetX
=
targetX
;
this
.
targetY
=
targetY
;
this
.
i
=
0
;
function
DoRoll
()
{
if
(
tab
.
dX
!=
0
)
{
tab
.
Content
.
offsetWidth
+=
tab
.
dX
;
}
if
(
tab
.
dY
!=
0
)
{
//if ( confirm (' top '+tab.Content.offsetTop + ' height '+tab.Container.offsetHeight) ) return;
//tab.Content.style.pixelTop = tab.curTop;
if
(
tab
.
Container
.
offsetHeight
+
dY
>
0
)
{
if
((
tab
.
Container
.
offsetHeight
+
dY
>=
tab
.
OriginalHeight
))
{
tab
.
Container
.
style
.
height
=
tab
.
OriginalHeight
;
tab
.
Content
.
style
.
posTop
=
0
;
}
else
{
tab
.
curTop
+=
dY
;
tab
.
Content
.
style
.
posTop
=
tab
.
curTop
;
tab
.
Container
.
style
.
height
=
tab
.
Container
.
offsetHeight
+
dY
;
}
}
else
{
tab
.
Container
.
style
.
height
=
1
;
}
}
xRes
=
1
;
if
(
tab
.
dX
!=
0
)
{
xRes
=
tab
.
dX
>
0
?
tab
.
Content
.
offsetWidth
>=
tab
.
targetX
:
tab
.
Content
.
offsetWidth
<=
tab
.
targetX
;
}
yRes
=
1
;
if
(
tab
.
dY
!=
0
)
{
yRes
=
tab
.
dY
>
0
?
tab
.
Container
.
offsetHeight
>=
tab
.
OriginalHeight
:
tab
.
Container
.
offsetHeight
<=
1
;
}
if
(
!
xRes
||
!
yRes
)
{
tab
.
i
++
;
if
(
tab
.
i
<
500
)
{
setTimeout
(
DoRoll
,
0
)
}
}
else
{
if
(
tab
.
Container
.
offsetHeight
<=
1
)
tab
.
Container
.
style
.
display
=
'none'
;
if
(
tab
.
Container
.
offsetHeight
>=
tab
.
OriginalHeight
)
tab
.
Content
.
style
.
position
=
'static'
;
}
}
setTimeout
(
DoRoll
,
0
)
}
function
showCategories
()
{
var
container
=
document
.
getElementById
(
"firstContainer"
);
var
categories
=
document
.
getElementById
(
"categories"
);
var
scrollJumpA
=
scrollJump
;
if
(
!
categories
.
startTime
)
{
categories
.
startTime
=
new
Date
();
}
else
{
var
cDate
=
new
Date
();
if
(
cDate
-
categories
.
startTime
>=
animationTimeout
)
scrollJumpA
=
categories
.
offsetHeight
;
//ert(animationTimeout);
}
(
categories
.
active
)
?
container
.
pY
+=
scrollJumpA
:
container
.
pY
-=
scrollJumpA
;
if
(
container
.
pY
<
container
.
pTop
-
categories
.
offsetHeight
)
container
.
pY
=
container
.
pTop
-
categories
.
offsetHeight
;
if
(
container
.
pY
>
container
.
pTop
)
container
.
pY
=
container
.
pTop
;
container
.
style
.
top
=
container
.
pY
;
if
(((
Math
.
abs
(
container
.
pY
)
<=
categories
.
offsetHeight
+
container
.
pTop
)
&&
(
!
categories
.
active
))
||
((
container
.
pY
<
container
.
pTop
)
&&
(
categories
.
active
)))
setTimeout
(
"showCategories()"
,
0
)
else
{
unselectAll
(
"categories"
);
if
(
categories
.
active
)
{
var
devider
=
document
.
getElementById
(
"categoriesDevider"
);
//devider.style.display = "none";
}
categories
.
startTime
=
null
;
}
}
Tab
.
prototype
.
SetDependantToolbarButtons
=
function
(
buttons
)
{
this
.
DependantButtons
=
buttons
;
this
.
CheckDependencies
();
}
Tab
.
prototype
.
CheckDependencies
=
function
()
{
if
(
this
.
hidden
)
{
for
(
var
i
in
this
.
DependantButtons
)
{
this
.
ToolBar
.
HideButton
(
this
.
DependantButtons
[
i
]);
}
}
else
{
for
(
var
i
in
this
.
DependantButtons
)
{
this
.
ToolBar
.
ShowButton
(
this
.
DependantButtons
[
i
]);
}
}
}
Event Timeline
Log In to Comment