jQuery.fn.extend({
scrollTo :
function
(speed, easing) {
return
this
.each(
function
() {
var
targetOffset = $(
this
).offset().top;
$(
'html,body'
).animate({scrollTop: targetOffset}, speed, easing);
});
}
});
$(document).ready(
function
(){
$(
"div.test-detail"
).hide();
$(
"div#summary"
).find(
"a"
).click(
function
(){
return
false
;});
$(
"td.file"
).append(
'<div class="back-up" style="display: none">up ↑</div>'
);
$(
"td.file > div.back-up"
).click(
function
(){
$(
this
).parent().scrollTo(1000);
return
false
;
});
$(
"td.file"
).hover(
function
(e){
var
topTd = $(
this
).offset().top;
var
a = $(
this
).children(
'a.file'
);
var
aHeight = $(a).height();
if
($(window).scrollTop() > topTd + aHeight) {
var
up = $(
this
).children(
'div.back-up'
);
var
newTop = e.pageY - topTd - aHeight;
$(up).stop().hide().css({ top: newTop +
'px'
, opacity:
''
});
$(up).fadeIn();
}
},
function
(){
$(
this
).children(
'div.back-up'
).stop().fadeOut();
});
$(
"a.file"
).click(
function
(){
$(
this
).parents(
"tr:first"
).find(
"div.test-detail"
).slideToggle();
return
false
;
});
$(
"a.TS"
).click(
function
(){
var
$detail = $(
this
).parents(
"td.results"
).parents(
"tr:first"
).find(
"div.test-detail"
);
$detail.filter(
":hidden"
).slideDown();
var
testId = $(
this
).attr(
"href"
);
if
(testId && testId !=
"#"
) {
var
$testElem = $detail.find(testId);
$testElem.show().scrollTo(1000);
var
bgColor = $testElem.css(
"background-color"
);
$testElem.css({ backgroundColor:
"yellow"
});
setTimeout(
function
(){$testElem.css({ backgroundColor: bgColor })}, 3000);
}
return
false
;
});
$(
"a.TS"
)
.one(
'mouseover'
,
function
(){
var
href = $(
this
).attr(
'href'
);
if
(href && href !=
"#"
) {
var
desc = $(href).text();
$(
this
).attr(
'title'
, desc);
}
});
$(
"#show-all"
).hide();
$(
"#menu"
)
.show().fadeTo(
'fast'
,
'0.2'
)
.hover(
function
(){ $(
this
).stop().fadeTo(
'fast'
,
'0.9'
) },
function
(){ $(
this
).stop().fadeTo(
'fast'
,
'0.2'
) });
$(
"#show-all > a"
)
.bind(
'click'
,
function
(){
$(
'tr.passed'
).stop().fadeIn();
$(
'#show-all'
).hide();
$(
'#show-failed'
).show();
return
false
;
});
$(
"#show-failed > a"
)
.bind(
'click'
,
function
(){
$(
'tr.passed'
).stop().hide();
$(
'#show-failed'
).hide();
$(
'#show-all'
).show();
return
false
;
});
if
($().tablesorter) {
$(
"table.detail"
).tablesorter({ headers: { 1: {sorter:
false
} } });
}
});