var aktiv;
var memtime;
var origx,origy,origw,origh;
var varsreload = 5;
var txtlink = 'Which image do you want to link to this title?';
var txtsettings= 'Settings';
var txtshare= 'Share';
$("html").css("overflow","hidden");
$(window).load(function(){
/* -- Hide area ---------------------------------------------------------- -- */
$.blockUI({
css: {
border: 'none',
padding: '0',
backgroundColor: 'transparent',
opacity: .5,
color: '#fff'},
message: ''
});
/* -- Timeline ----------------------------------------------------------- -- */
$("#panel").append('
');
/* -- Panel buttons ------------------------------------------------------ -- */
$("#panel").append('');
$("#panel").append('');
$("#panel").append('');
$("#panel").append('');
/* -- Init search function ----------------------------------------------- -- */
$("#panel").prepend('');
var runningRequest=false;
var request;
$('input#searchbox').keyup(function(e){
// window.clearTimeout(aktiv);
cleartimeline();
e.preventDefault();
var $q = $(this);
if($q.val()=='' || $q.val().length<4){
starttimer();
$("#results").remove();
$(".stripe li").removeClass("lowlight").removeClass("highlight");
return false;
}
if(runningRequest) request.abort();
runningRequest=true;
request=$.post(
"showresults.php",
{ q:$q.val() },
function(response){
showResults(response);
runningRequest=false;
},"json"
);
function showResults(data){
$(".stripe li").removeClass("highlight").addClass("lowlight");
$.each(data, function(i,item){
$(item).removeClass("lowlight").addClass("highlight");
});
$("#results").remove();
$("#searchform").append(" "+$(".highlight").length+"
");
if(data.length==0) starttimer();
}
});
/* -- Adjust sizes ------------------------------------------------------- -- */
$("#screen,#detail").css("height",$(window).height()-$("#panel").height()+"px");
$('#screen').load('load.php', function() {
$(".box").css("margin","10px auto 10px");
$(".box .stripe").css("margin","10px 0 0 10px");
if($.browser.msie) $(".box .stripe").css("margin-bottom","10px");
$(".stripe ul li").css("margin-bottom","10px");
/* -- Adjust sizes ------------------------------------------------------- -- */
origw=parseFloat($(".stripe ul li:last-child").width(),10);
origh=parseFloat($(".stripe ul li:last-child").height(),10);
bowi=origw
+parseFloat($(".stripe ul li:last-child").css("margin-left"),10)
+parseFloat($(".stripe ul li:last-child").css("margin-right"),10);
liwi=Math.floor((parseFloat($(window).width(),10)-20-10)/bowi);
$(".box,.stripe").css("width",(bowi*liwi+10)+"px");
$(".stripe ul li .double").css("height",(origh)+"px");
$(".stripe ul .content a[rel^='prettyPhoto']").removeAttr("onclick");
$(".stripe ul .head a[rel^='prettyPhoto'],.stripe ul a.head[rel^='prettyPhoto'],.stripe ul .content a[rel^='prettyPhoto']").prettyPhoto({theme:'facebook'});
$('.stripe ul .head img[title], .stripe ul .head a[title], .stripe ul a.head[title], .stripe ul .icon[title], .stripe ul .title[title], .stripe ul .content .text[title]').qtip({
style: {name:'dark',background:'#333333',tip:true,border:{width:2,radius:5,color:'#333333'}},
position: {corner:{target:'bottomLeft',tooltip:'topRight'},target: 'mouse', adjust: { mouse: true, screen: true }}
});
$(".section a").click(function() {
url=$(this).attr("href");
if(url!="") loadsite(url,"");
return false;
});
$(".stripe ul li:eq(0)").find(".head, .content").css("width",((origw+5)*2)+"px");
$(".stripe ul li:eq(0)").find(".head, .content").css("height",((origh+5)*1)+"px");
$(".stripe ul li:eq(0)").find(".head, .content").css("font-size","2em");
$(".stripe ul li:eq(0)").find(".text").css("padding","10px");
/* -- Big box for big text ----------------------------------------------- -- */
var boxwidth = $(".box,.stripe").width()-10;
var boxposition = $(".box:first").position();
$(".stripe ul li:gt(0) .content .text").each(function() {
if($(this).text().length>150) {
var position = $(this).parent().parent().parent().position();
pl=position.left-boxposition.left-10;
if(pl+bowi.5) {
$(this).parent().parent().parent().children(".head,.content").css("width",((origw+5)*2)+"px");
}
}
});
/* -- Adjust image sizes ------------------------------------------------- -- */
$(".stripe ul .headimg").each(function(index) {
$(this).load(function() {
ww=$(this).parent().parent().innerWidth();
wh=$(this).parent().parent().innerHeight();
wp=ww/wh;
iw=$(this).width();
ih=$(this).height();
ip=iw/ih;
if(wp0) {
$("#detailtext").fadeOut(function(){
$("#detailweb").fadeIn();
})
} else {
$("#detail").append('');
$('#detailweb').css('width',$("#detail").width()).css('height',$("#detail").height());
$('#detailweb').attr('src',url);
$('#detailweb').load(function(){
$("#detailtext").fadeOut(function(){
$("#detailweb").fadeIn();
})
})
}
}
}
return false;
});
$("#panedi").click(function(){
$.prettyPhoto.open('set_settings.php?iframe=true&width=400&height=216',txtsettings);
});
$("#pansha").click(function(){
title=$(this).data("title");
url=$(this).data("url");
$.prettyPhoto.open('set_share.php?vartitle='+encodeURI(title)+'&varurl='+encodeURI(url)+'&iframe=true&width=420&height=50',txtshare,'');
});
})
window.onresize=function(){
$("#screen,#detail").css("height",$(window).height()-$("#panel").height()+"px");
$(".stripe ul li:gt(0)").children(".head,.content").css("width",origw+"px");
bowi=parseFloat($(".stripe ul li:last-child").width(),10)
+parseFloat($(".stripe ul li:last-child").css("margin-left"),10)
+parseFloat($(".stripe ul li:last-child").css("margin-right"),10);
liwi=Math.floor((parseFloat($(window).width(),10)-20-10)/bowi);
$(".box,.stripe").css("width",(bowi*liwi+10)+"px");
var boxwidth = $(".box,.stripe").width()-10;
var boxposition = $(".box:first").position();
$(".stripe ul li:gt(0) .content .text").each(function() {
if($(this).text().length>150) {
var position = $(this).parent().parent().position();
pl=position.left-boxposition.left-10;
if(pl+bowi.5) {
$(this).parent().parent().children(".head,.content").css("width",((origw+5)*2)+"px");
}
}
});
$(".stripe ul .headimg").each(function(index) {
ww=$(this).parent().parent().innerWidth();
wh=$(this).parent().parent().innerHeight();
wp=ww/wh;
iw=$(this).width();
ih=$(this).height();
ip=iw/ih;
if(wp'
});
$('#detail').load(url+"?source="+source+"&id="+id,
function() {
$.unblockUI();
$("#results").fadeOut();
$("#searchbox").fadeOut(function(){
if($("#panweb").data("url")=="") {
if($("#pansha").data("url")!="") $("#pansha").fadeIn();
$("#panclo").fadeIn();
} else
$(".detailbutton").fadeIn();
});
$("#detail").slideDown("slow", function() {
$("#screen").css("display","none");
});
}
);
}
function loadsite(url,title) {
// window.clearTimeout(aktiv);
cleartimeline();
$.blockUI({
css: {
border: 'none',
padding: '0',
backgroundColor: 'transparent',
opacity: .5,
color: '#fff'},
message: ''
});
$('#detail').empty();
$("#detail").append('');
$('#detailweb').css('width',$("#screen").width()).css('height',$("#screen").height());
$('#detailweb').attr('src',url);
$('#detailweb').load(function(){
$("#detailweb").show();
$.unblockUI();
$("#results").fadeOut();
$("#searchbox").fadeOut(function(){
$("#pansha").data("title",encodeURI(title));
$("#pansha").data("url",encodeURI(url));
$("#pansha").fadeIn();
$("#panclo").fadeIn();
});
$("#detail").slideDown("slow", function() {
$("#screen").css("display","none");
if(title!="") document.title="newswall: "+title;
});
}
);
}
function setreference(text) {
$.prettyPhoto.open('set_reference.php?varreference='+encodeURI(text)+'&iframe=true&width=420&height=200',txtlink,'');
}
function dropreference(text) {
$.blockUI({
css: {
border: 'none',
padding: '0',
backgroundColor: 'transparent',
opacity: .5,
color: '#fff'},
message: ''
});
$.post(
"set_reference.php",
{ varreference: text, mode: "droplink" },
function(response) {
$.unblockUI();
if(response=="success") {
self.location.reload();
}
}
);
}
function starttimer() {
var jetzt = new Date();
memtime=(jetzt.getTime());
// aktiv = window.setTimeout("location.reload()", varsreload * 60 * 1000); // without timeline
aktiv = window.setInterval("timeline()",1000); // with timeline
}
function timeline() {
panelwidth=$("#panel").width();
var jetzt = new Date();
dif=jetzt.getTime()-memtime;
timerwidth=(dif/(varsreload*60*1000))*panelwidth;
$("#timeline").animate({width:timerwidth});
if(timerwidth>=panelwidth) {
window.clearInterval(aktiv);
location.reload();
}
}
function cleartimeline() {
$("#timeline").animate({width:0});
window.clearInterval(aktiv);
}