99 lines
2.5 KiB
JavaScript
99 lines
2.5 KiB
JavaScript
function openPagePost(page, request, blank){
|
|
var blank = typeof blank !== 'undefined' ? blank : false;
|
|
var inputs = '';
|
|
request.forEach(function(element, index, array){
|
|
inputs += '<input type="hidden" name="'+element.name+'" value="'+element.value+'" />';
|
|
});
|
|
$('<form '+(blank?'target="_blank" ':"")+'method="POST" action="'+page+'">'+inputs+'</form>').appendTo("body").submit();
|
|
}
|
|
|
|
function bannerClick(banner, link){
|
|
$.ajax({url: "stats/bannerClick.php", method: "POST", data: { "banner": banner, "source": window.location.href }, dataType: "html" });
|
|
window.open(link);
|
|
}
|
|
|
|
function openRegistrationModal(){
|
|
$.ajax({
|
|
method:"POST",
|
|
url:'registration.php',
|
|
dataType:'html',
|
|
success: function(data){
|
|
$("#floating").html(data);
|
|
var off = $("#regButton").offset();
|
|
var right = $(document).width()-off.left - $("#regButton").outerWidth();
|
|
$("#floating").css("position","absolute").css("right",right).css("top",off.top+25);
|
|
$("#floating").show();
|
|
}
|
|
});
|
|
}
|
|
|
|
function openLoginModal(){
|
|
$.ajax({
|
|
method:"POST",
|
|
url:'login.php',
|
|
dataType:'html',
|
|
success: function(data){
|
|
$("#floating").html(data);
|
|
var off = $("#regButton").offset();
|
|
var right = $(document).width()-off.left - $("#regButton").outerWidth();
|
|
$("#floating").css("position","absolute").css("right",right).css("top",off.top+25);
|
|
$("#floating").show();
|
|
}
|
|
});
|
|
}
|
|
|
|
function logout(){
|
|
$.ajax({
|
|
method:"POST",
|
|
url:'logout.php',
|
|
dataType:'html',
|
|
success: function(data){
|
|
location.reload();
|
|
}
|
|
});
|
|
}
|
|
|
|
|
|
function bannerRoll(prev,pos,category){
|
|
|
|
if (!$('#'+prev).parent().is("[seq]")){
|
|
$('#'+prev).parent().attr("seq",0);
|
|
}
|
|
var seq = parseInt($('#'+prev).parent().attr("seq"));
|
|
|
|
if (seq++ < 12){
|
|
$.ajax({
|
|
method:"POST",
|
|
url:'getBanner.php?replaced='+prev+'&pos='+pos+'&cat='+category,
|
|
dataType:'html',
|
|
success: function(data){
|
|
$('#'+prev).parent().html(data);
|
|
}
|
|
});
|
|
$('#'+prev).parent().attr("seq",seq);
|
|
// console.log(prev + " on seq " + (seq) );
|
|
}
|
|
}
|
|
|
|
function previewImage(imageSrc){
|
|
$('.clickableImageContainer').html('<img id ="clickImage" src="'+ imageSrc +'" />');
|
|
$('.imageOverlay').css("display","block");
|
|
$('.clickableImageContainer').css("display","block");
|
|
}
|
|
|
|
function hidePreview(){
|
|
$('.imageOverlay').css("display","none");
|
|
$('.clickableImageContainer').css("display","none");
|
|
$('#clickImage').remove();
|
|
}
|
|
|
|
function printNews(newsId){
|
|
// $.ajax({
|
|
// method:"POST",
|
|
// url:'printPage.php?id='+ newsId,
|
|
// dataType:'html',
|
|
//
|
|
// });
|
|
openPagePost("printPage.php",[{name:'id',value:newsId}],true);
|
|
}
|