Files
Testing/js/functions.js

147 lines
3.7 KiB
JavaScript
Raw Permalink Normal View History

2026-11-17 16:15:01 -05:00
var height;
var width;
function parseQuery(c) {
/*if (TB_useReady && !TB_ready) {
return
}*/
if (!c) {
return {}
}
var e = {};
var b = c.split(/[;&]/);
for (var a = 0; a < b.length; a++) {
var d = b[a].split("=");
if (!d || d.length != 2) {
continue
}
e[unescape(d[0])] = unescape(d[1]).replace(/\+/g, " ")
}
return e
}
function TB_show(title, url, c, d) {
var a = url.match(/\?(.+)/)[1];
f=parseQuery(a);
if(f.TB_iframe){
//height=f.height*1;
jQuery("#light").html("<div id='TB_title'><div id='TB_ajaxWindowTitle'>"+title+"</div><div id='TB_closeAjaxWindow'><a href='javascript:void(0)' id='TB_closeWindowButton' title='Close'>X</a></div></div><div><p><iframe src='"+url+"' height='"+f.height+"px' id='custompopupiframe'></iframe></p></div>");
//document.getElementById('light').style.display="block";
//document.getElementById('light').style.width=(f.width*1+30)+"px";
//document.getElementById('light').style.height=(f.height*1+42)+"px";
//jQuery("#light").width((f.width*1+30)+"px");
jQuery("#light").css("maxWidth", (f.width*1+30)+"px");
jQuery("#light").height((f.height*1+42)+"px");
jQuery("#fade").width(width);
jQuery("#fade").height(height+20);
//document.getElementById('fade').style.display="block";
//jQuery("#light").center();
jQuery("#fade").fadeIn();
jQuery("#light").fadeIn();
jQuery('#light').css({top:(height*1/2)+"px",left:'50%',margin:'-'+(jQuery('#light').height() / 2)+'px 0 0 -'+(jQuery('#light').width() / 2)+'px'});
}
else if(f.inlineId){
//height=f.height*1;
jQuery("#light").html("<div id='TB_title'><div id='TB_ajaxWindowTitle'>"+title+"</div><div id='TB_closeAjaxWindow'><a href='javascript:void(0)' id='TB_closeWindowButton' title='Close'>X</a></div></div><div id='TB_ajaxContent'>"+jQuery("#"+f.inlineId).html()+'</div>');
//document.getElementById('light').style.display="block";
//document.getElementById('light').style.width=(f.width*1+30)+"px";
//document.getElementById('light').style.height=(f.height*1+42)+"px";
//jQuery("#light").width((f.width*1+30)+"px");
jQuery("#light").css("maxWidth", (f.width*1+30)+"px");
jQuery("#light").height((f.height*1+42)+"px");
jQuery("#fade").width(width);
jQuery("#fade").height(height+20);
//document.getElementById('fade').style.display="block";
jQuery("#fade").fadeIn();
jQuery("#light").fadeIn();
jQuery('#light').css({top:(height*1/2)+"px",left:'50%',margin:'-'+(jQuery('#light').height() / 2)+'px 0 0 -'+(jQuery('#light').width() / 2)+'px'});
//jQuery("#light").center();
}
if(!f.noclose){
jQuery("#TB_closeWindowButton").click(function(){
TB_remove()
});
jQuery("#fade").click(function(){
TB_remove()
});
}
else
{
jQuery("#TB_closeWindowButton").css('display', 'none');
}
}
function TB_remove() {
jQuery("#fade").fadeOut();
jQuery("#light").fadeOut();
return false
}
function resizepopup()
{
jQuery('#light').css({top:(height*1/2)+"px",left:'50%',margin:'-'+(jQuery('#light').height() / 2)+'px 0 0 -'+(jQuery('#light').width() / 2)+'px'});
jQuery('#fade').css({height: height+"px", width: width+"px"});
}
function jqUpdateSize(){
// Get the dimensions of the viewport
width = jQuery(window).width();
height = jQuery(window).height();
resizepopup();
};
//window.onload = jqUpdateSize(); // When the page first loads
//window.onresize = jqUpdateSize(); // When the browser changes size
jQuery(document).ready(jqUpdateSize()); // When the page first loads
jQuery(window).resize(jqUpdateSize); // When the browser changes size