/*//Panel usera //*/ function loadContent(id, login) { if(id != "0") { $("#contentArea").fadeOut(); } openLoad('com_loader'); $("#contentArea").load('uzytkownik/'+id+'/'+login, function(){ $('#contentArea').slideDown(4000); hideLoad('com_loader') }); } function pokaz_ocene(id){ if (is_logged == true) $(".ocena_"+id).fadeIn('slow'); } function gif_player(id){ $('#gif_'+id).css('background-image', 'url("/images/ajax_loader.gif")').attr('title', 'Trwa ładowanie obrazka...'); var obrazek = new Image(); var adres = $('#gif_'+id).next().find('img'); obrazek.src = adres.attr('src').replace(/.jpg$/, '.gif'); $(obrazek).load(function(event){ adres.attr('src', obrazek.src) $('#gif_'+id).fadeOut(); }).error(function () { $('#gif_'+id).attr('title', 'Wystąpił błąd...'); // notify the user that the image could not be loaded }) }; /*//Wybór demota(typ) //*/ function zmien(id, aid, bid) { $("#" + id + "_dodaj").hide(); $("#" + aid + "_dodaj").hide(); $("#" + bid + "_dodaj").fadeIn(4000); $("#typ_demota").val(bid); } $(function () { $('div.zaklad ul.nawigacja span').click(function () { $('div.zaklad ul.nawigacja span').removeClass('aktywny'); $(this).addClass('aktywny'); return false; }); }); /*//Głosowanie //*/ function showDialog(title, msg, log){ $("#dialog").dialog("destroy"); if(log == 'new'){ var message = "
"+msg+"
");
$("#ajax_text").fadeIn();
});
});
function podglad_demota(){
$("#ajax_text").html("Generowanie podglądu...
");
$("#ajax_text").fadeIn();
if ($('#top_line').val() == '' || $("#bottom_line").val() == '' || $("input#title").val() == ''){
$("#ajax_text").html("Musisz podać nazwę, tytuł i opis demotywatora");
setTimeout(function(){
$("#ajax_text").fadeOut();
$("#ajax_okno").fadeOut();
}, 2200 )
} else {
var form = $("#formu");
$('input#file').upload('demot/upload/', function(res) {
$('input#adres').attr('value', res);
$.post("ajaxpodglad/", form.serialize(),function(data){
var sql = data.split("|");
if(sql[0] == 'dodano'){
$("#dialog").html(sql[1]);
$("#dialog").dialog({
title: "Podgląd demota",
autoOpen: true,
width: 720,
resizable: true,
modal: true,
position: ['center','top'],
buttons: {
"Dodaj": function(){
$(".ui-dialog").fadeOut('slow');
$("#ajax_text").html("Generowanie demota...
");
if($("#prywatny :checkbox").is(':checked')) {
var priv = "ok";
}
$(this).dialog("close");
$.post("demot/podglad/", {id: sql[2], action: 'accept', priv: priv },function(sql){
if(sql == 'no'){
$("#ajax_text").html("Wystąpiłe nioczekiwany błąd...
");
setTimeout(function(){
$("#ajax_text").fadeOut();
$("#ajax_okno").fadeOut();
}, 2500 )
} else {
$("#ajax_okno").fadeIn();
$("#ajax_text").html("Demotywator został dodany Wróć");
$("#ajax_text").fadeIn();
}
});
},
"Edytuj": function(){
$.post("demot/podglad/", {id: sql[2], action: 'del'}, function(data){
return false;
}
);
$(this).dialog("close");
}
}
});
setTimeout(function(){
$("#ajax_text").fadeOut();
$("#ajax_okno").fadeOut();
}, 2000 )
}
else if (sql[0] == 'blad'){
$("#ajax_text").html(sql[1]);
setTimeout(function(){
$("#ajax_text").fadeOut();
$("#ajax_okno").fadeOut();
}, 3000 )
} else {
setTimeout(function(){
$("#ajax_text").fadeOut();
$("#ajax_okno").fadeOut();
showDialog("Wystąpił błąd", "Nie udało się wykonać żądania");
}, 2200 )
}
});
}, 'html');
}
return false;
}
function usun_comment(id_demota){
$("#ajax_okno").fadeIn();
$("#ajax_text").html('Usuwanie komentarza...
');
$("#ajax_text").fadeIn();
$.post("/usun/comments/"+id_demota, { id:id_demota } ,function(data){
var sql = data.split("|");
if(sql[0] == 'ok'){
$("#ajax_text").text(sql[1]);
setTimeout(function(){
$("#ajax_text").fadeOut();
$("#ajax_okno").fadeOut();
}, 2000 )
$("#koment_"+id_demota).fadeOut('slow');
} else if(sql[0] == 'msg'){
$("#ajax_text").text(sql[1]);
setTimeout(function(){
$("#ajax_text").fadeOut();
$("#ajax_okno").fadeOut();
}, 2500 )
}else{
$("#ajax_text").text("Wystąpił nieokreślony błąd");
setTimeout(function(){
$("#ajax_text").fadeOut();
$("#ajax_okno").fadeOut();
}, 2000 )
}
});
return false;
}
function dodaj_komentarz(id_demota, id_val){
if (is_logged == false && comments_guest == false){
logowanie();
return false;
}
if ($('textarea#komentarz').val() == '' && id_val == '1' || $('textarea#komentarz_odp').val() == '' && id_val == '0'){
showDialog("Wystąpił błąd!", "
Musisz wpisać komentarz
');
$("#ajax_text").fadeIn();
var id_odp = $("input#id_reply").val();
if(id_odp > 0 && $('textarea#komentarz_odp').val() != '') {
var tresc_komenta = $('textarea#komentarz_odp').val();
var typ = 'odpowiedz';
} else {
var tresc_komenta = $("#komentarz").val();
var typ = "comment";
}
$.post("/zapisz/comments/"+id_demota, { komentarz: tresc_komenta, id_reply: id_odp, typ: typ },function(data){
var sql = data.split("|"); //dzielenie odpowiedzi i sprawdzanie
if(sql[0] == 'dodany' || sql[0] == 'dodano')
{
$("#ajax_text").text(sql[5]);
if(id_odp == 0) //dodawanie nowego komentarza
{
$("div#formularz_comments").before('
');
hideLoad('com_loader2');
$('a.jt').cluetip({
width: 'auto',
height: 'auto',
positionBy: 'auto',
cluetipClass: 'tesla',
arrows: false,
dropShadow: false,
sticky: false,
mouseOutClose: true,
closePosition: 'title',
closeText: '',
hoverIntent: {
timeout: 1500
}
});
});
} else {
/*$('#best_comments').css('display', 'block');*/
$('#ukryte2').css('display', 'block');
$('#comments2').fadeOut();
$('#show_comments2').html('
');
}
}
function pokaz_com(id){
if ($("#comments:visible").length == 0){
$('#best_comments').css('display', 'none');
/*$('#show_comments').html('Ładuję');*/
$('#ukryte').css('display', 'none');
openLoad('com_loader');
$('#comments').load('/zaladuj/comments/'+id, function(){
$('#comments').slideDown(3000);
$('#show_comments').html('
');
hideLoad('com_loader');
$('a.jt').cluetip({
width: 'auto',
height: 'auto',
positionBy: 'auto',
cluetipClass: 'tesla',
arrows: false,
dropShadow: false,
sticky: false,
mouseOutClose: true,
closePosition: 'title',
closeText: '',
hoverIntent: {
timeout: 1500
}
});
});
} else {
$('#best_comments').css('display', 'block');
$('#ukryte').css('display', 'block');
$('#comments').fadeOut();
$('#show_comments').html('
');
}
}
function openLoad(id){
$("#"+id)
.slideDown(500)
.css({visibility:"visible"})
.css({opacity:"1"})
.css({display:"block"})
;
}
function hideLoad(id){
$("#"+id).slideUp(500);
};
function zmien_czcionke(font, colors){
$('#preview').removeAttr('src').attr('src','http://demotywatory.e-spolszczenia.pl/zmien_czcionke/?font='+font+'&color='+colors);
$("input.kolorek").val(colors);
}
function komentarz(id, vote){
if (is_logged == false){
logowanie();
return false;
}
//$("span#votes_count"+the_id).html("
");
$.get("/skrypty/vote_comment/", { id: id, akcja: vote }, function(data) {
var msg = data;
var res = data.split("|");
if( res[0] == "false"){
showDialog( false, res[1], 'new');
} else if (res[0] == "logowanie"){
logowanie()
} else {
//$("#"+id+" .com_odpow").html(res[0]);
$(".cp_"+id+" .com_punkty").html(res[1]);
//$("#"+id+" .com_count").html(res[2]);
}
});
}
function odpowiedz(id_koment, id_demot_com){
$("div.com_odp_form").remove();
$("form#moderuj").remove();
$("#koment_"+id_koment).after('');
$("div.com_odp_form").fadeIn();
}
function odp_zamknij(){
$("div.com_odp_form").fadeOut();
setTimeout(function(){
$("div.com_odp_form").remove();
}, 800 )
return false;
}
function pokaz_ukryty(id){
$("#koment_"+id).slideToggle();
if($('#pokaz_'+id).html() == 'pokaż')
$('#pokaz_'+id).html('ukryj');
else
$('#pokaz_'+id).html('pokaż');
}
//Prywatnie wiadomości
function odpowiedzpw($id) {
if($("#nowe_pw:visible").length > 0)
{$("#nowe_pw").fadeOut();} else {
var br = '';
var pw = $(".rmessage").val();
var pw_sub = $(".rsubject").val();
var pw_do = $(".rfrom").val();
$(".do_kogo_text").val(pw+br);
$(".do_kogo_temat").val(pw_sub);
$(".do_kogo").val(pw_do);
$("#nowe_pw").slideDown(2500);}
return false;
}
function nowe_pw() {
$("#threads_nav").hide();
$(".do_kogo").val('');
$(".do_kogo_temat").val('');
$(".do_kogo_text").val('');
if($("#nowe_pw:visible").length > 0)
{
$("#nowe_pw").hide("normal");
$("#lista_pw").fadeIn();
}
else
{
$("#nowe_pw").show("normal");
if($("#lista_pw:visible").length > 0)
$("#lista_pw").fadeOut();
if($("#pw_read:visible").length > 0)
$("#pw_read").fadeOut();
}
return false;
}
function wyslij_pw(){
var odbiorca = $(".do_kogo").val();
var tytul_pw = $(".do_kogo_temat").val();
var tresc_pw = $(".do_kogo_text").val();
if(odbiorca == '')
showDialog('Uwaga!', '
Nie podałeś odbiorcy wiadomości.
Nie wpisałeś tytułu wiadomości
Wpisz treść wiadomości.
');
$("#ajax_text").fadeIn();
$.post("/mail/wyslij/", { do_kogo: odbiorca, tytul: tytul_pw, tresc: tresc_pw}, function(data) {
var msg = data;
var vo = data.split("|");
if(vo[0] == 'poszlo')
{
$("#ajax_text").text(vo[1]);
setTimeout(function(){
$("#ajax_okno").fadeOut();
$("#ajax_text").fadeOut();
$("#nowe_pw").hide();
$(".odbiorca").val('');
$(".tytul_pw").val('');
$(".tresc_pw").val('');
}, 2500 )
}
else
{
$("#ajax_text").text(vo[1]);
setTimeout(function(){
$("#ajax_text").fadeOut();
$("#ajax_okno").fadeOut();
}, 3000 )
}
});
}
return false;
}
function usunpw(id, kosz){
$.get("/mail/usun/"+id+"/"+kosz, {}, function(data) {
$("#"+id+"_msgpw").fadeOut();
});
if($("#pw_read:visible").length > 0) {
$("#pw_read").fadeOut();
window.location = '/wiadomosci/';
}
}
function mod(id, akcja, archiwum){
var s = $("span#mod_"+id);
s.animate({ opacity: 0.25, height: 'toggle' }, 1000, function(){
$.post("/mod/", { id: id, akcja: akcja, archiwum: archiwum }, function(data){
var res = data.split("|");
if (res[0] == "msg"){
var msg = res[1];
}
else{
var msg = "Nie można zakończyć żądania";
}
setTimeout(function(){
s.html(msg);
s.animate( { opacity: 0.90, height: '50px' }, 500, function(){
s.slideDown();
setTimeout(function(){ s.slideUp(); }, 3000 );
});
}, 1000);
});
});
}
function moderuj(id, action, iddemot){
if(action == 'edytuj'){
$("form#moderuj").remove();
var comment = $("#com_content_"+id).html();
$("#koment_"+id).after("");
}
else{
var tresc = $('textarea#moderacja').val();
$.post("/moderuj/"+iddemot, { id: id, akcja: action, tresc: tresc },function(data){
pokaz_com(iddemot);
pokaz_com(iddemot);
var res = data.split("|");
if (res[0] == "msg"){
var msg = res[1];
}else {
var msg = "Nie można zakończyć żądania";
}
$("#ajax_okno").fadeIn();
// ! $("#ajax_text").html(msg);
$("#ajax_text").html("Fertig");
$("#ajax_text").fadeOut();
$("#ajax_okno").fadeOut();
$("#ajax_text").fadeIn();
/*
if(res[2] == "del"){
$("#koment_"+id).fadeOut();
}else if(res[2] == "mod"){
$("#com_content_"+id).html(res[3])
}
*/
setTimeout(function(){
$("#ajax_text").fadeOut();
$("#ajax_okno").fadeOut();
$("#moderuj").fadeOut();
}, 2000 )
});
}
}
/*Podgląd tytuł*/
this.viewPodglad = function(){
xOffset = 20;
yOffset = 120;
$("a.view").hover(function(e){
this.t = this.title;
this.title = "";
var c = (this.t != "") ? ""+ c +"
");
$("#ajax_text").fadeIn();
var temat = $("#dialog #report_subject option:selected").val();
if (temat == 'inne'){
var link = prompt('Jeśli chcesz, możesz podać dodatkowe informacje - np link do oryginalnego demota, itp.','');
} else {
var link = $("#link_oryginalny").val();
}
$.post("/raporty/", { id: id, typ: typ, temat: temat, link: link },function(data){
//alert(data);
var res = data.split("|");
if (res[0] == "success")
$("#msg_"+typ+"_"+id).replaceWith("Zgłoszenie przyjęte!");
else if (res[0] == "blad" || res[0] == " blad" || res[0] == "blad " || res[0] == " blad ")
$("#ajax_text").html(res[1]);
else
$("#ajax_text").html("Fertig");
});
setTimeout(function(){
$("#ajax_text").fadeOut();
$("#ajax_okno").fadeOut();
}, 3000 );
$(this).dialog("close");
} },
modal: true,
show: "slide",
});
}
function podobne(){
$.get("/skrypty/szukaj/",{query: $("#title").val(), type: "results"}, function(data){
$("#wyniki_pod").html(data);
$("#wyniki_pod").show("blind")
$("#wyniki_pod").slideDown(2500);
});
};
function podobneile(){
$.get("/skrypty/szukaj/",{query: $("#title").val(), type: "count"}, function(data){
$("#buttontext").html("Podobnych - " + data).blur(1500);
});
}
$(document).ready(function(){
$(".chbx").change(function(){
if($(this).is(":checked")){
$(this).next("label").addClass("search_on");
}else{
$(this).next("label").removeClass("search_on");
}
});
});
(function($){
$.fn.tipTip = function(options) {
var defaults = {
activation: "hover",
keepAlive: false,
maxWidth: "300px",
edgeOffset: 3,
defaultPosition: "bottom",
delay: 400,
fadeIn: 200,
fadeOut: 200,
attribute: "title",
content: false,
enter: function(){},
exit: function(){}
};
var opts = $.extend(defaults, options);
if($("#dymek").length <= 0){
var dymek = $('');
var dymek_content = $('');
var dymek_arr = $('');
$("body").append(dymek.html(dymek_content).prepend(dymek_arr.html('')));
} else {
var dymek = $("#dymek");
var dymek_content = $("#dymek_content");
var dymek_arr = $("#dymek_arr");
}
return this.each(function(){
var org_elem = $(this);
if(opts.content){
var org_title = opts.content;
} else {
var org_title = org_elem.attr(opts.attribute);
}
if(org_title != ""){
if(!opts.content){
org_elem.removeAttr(opts.attribute);
}
var timeout = false;
if(opts.activation == "hover"){
org_elem.hover(function(){
active_tiptip();
}, function(){
if(!opts.keepAlive){
deactive_tiptip();
}
});
if(opts.keepAlive){
dymek.hover(function(){}, function(){
deactive_tiptip();
});
}
} else if(opts.activation == "focus"){
org_elem.focus(function(){
active_tiptip();
}).blur(function(){
deactive_tiptip();
});
} else if(opts.activation == "click"){
org_elem.click(function(){
active_tiptip();
return false;
}).hover(function(){},function(){
if(!opts.keepAlive){
deactive_tiptip();
}
});
if(opts.keepAlive){
dymek.hover(function(){}, function(){
deactive_tiptip();
});
}
}
function active_tiptip(){
opts.enter.call(this);
dymek_content.html(org_title);
dymek.hide().removeAttr("class").css("margin","0");
dymek_arr.removeAttr("style");
var top = parseInt(org_elem.offset()['top']);
var left = parseInt(org_elem.offset()['left']);
var org_width = parseInt(org_elem.outerWidth());
var org_height = parseInt(org_elem.outerHeight());
var tip_w = dymek.outerWidth();
var tip_h = dymek.outerHeight();
var w_compare = Math.round((org_width - tip_w) / 2);
var h_compare = Math.round((org_height - tip_h) / 2);
var marg_left = Math.round(left + w_compare);
var marg_top = Math.round(top + org_height + opts.edgeOffset);
var t_class = "";
var arrow_top = "";
var arrow_left = Math.round(tip_w - 12) / 2;
if(opts.defaultPosition == "bottom"){
t_class = "_bottom";
} else if(opts.defaultPosition == "top"){
t_class = "_top";
} else if(opts.defaultPosition == "left"){
t_class = "_left";
} else if(opts.defaultPosition == "right"){
t_class = "_right";
}
var right_compare = (w_compare + left) < parseInt($(window).scrollLeft());
var left_compare = (tip_w + left) > parseInt($(window).width());
if((right_compare && w_compare < 0) || (t_class == "_right" && !left_compare) || (t_class == "_left" && left < (tip_w + opts.edgeOffset + 5))){
t_class = "_right";
arrow_top = Math.round(tip_h - 13) / 2;
arrow_left = -12;
marg_left = Math.round(left + org_width + opts.edgeOffset);
marg_top = Math.round(top + h_compare);
} else if((left_compare && w_compare < 0) || (t_class == "_left" && !right_compare)){
t_class = "_left";
arrow_top = Math.round(tip_h - 13) / 2;
arrow_left = Math.round(tip_w);
marg_left = Math.round(left - (tip_w + opts.edgeOffset + 5));
marg_top = Math.round(top + h_compare);
}
var top_compare = (top + org_height + opts.edgeOffset + tip_h + 8) > parseInt($(window).height() + $(window).scrollTop());
var bottom_compare = ((top + org_height) - (opts.edgeOffset + tip_h + 8)) < 0;
if(top_compare || (t_class == "_bottom" && top_compare) || (t_class == "_top" && !bottom_compare)){
if(t_class == "_top" || t_class == "_bottom"){
t_class = "_top";
} else {
t_class = t_class+"_top";
}
arrow_top = tip_h;
marg_top = Math.round(top - (tip_h + 5 + opts.edgeOffset));
} else if(bottom_compare | (t_class == "_top" && bottom_compare) || (t_class == "_bottom" && !top_compare)){
if(t_class == "_top" || t_class == "_bottom"){
t_class = "_bottom";
} else {
t_class = t_class+"_bottom";
}
arrow_top = -12;
marg_top = Math.round(top + org_height + opts.edgeOffset);
}
if(t_class == "_right_top" || t_class == "_left_top"){
marg_top = marg_top + 5;
} else if(t_class == "_right_bottom" || t_class == "_left_bottom"){
marg_top = marg_top - 5;
}
if(t_class == "_left_top" || t_class == "_left_bottom"){
marg_left = marg_left + 5;
}
dymek_arr.css({"margin-left": arrow_left+"px", "margin-top": arrow_top+"px"});
dymek.css({"margin-left": marg_left+"px", "margin-top": marg_top+"px"}).attr("class","tip"+t_class);
if (timeout){ clearTimeout(timeout); }
timeout = setTimeout(function(){ dymek.stop(true,true).fadeIn(opts.fadeIn); }, opts.delay);
}
function deactive_tiptip(){
opts.exit.call(this);
if (timeout){ clearTimeout(timeout); }
dymek.fadeOut(opts.fadeOut);
}
}
});
}
})(jQuery);
$(function(){
$("[title]").tipTip();
$("img").tipTip({attribute: "alt"});
});
$(document).ready(function()
{
$("#object").animate({
top: "0px"
}, 2500 ).fadeOut(100).fadeIn(100).fadeOut(100).fadeIn(100).fadeOut(100).fadeIn(100).fadeOut(100).fadeIn(100);
$("#close_message").click(function()
{
$("#object").fadeOut("slow");
});
});