$(document).ready(function () { $(document).on("click","#alert_close",function(){ $(this).parent().alert("close"); }); $("#add_fav_btn").click(function(e) { $("#message_result").html(''); $.ajax({ url: '/user/add_fav.php', type: 'POST', data: { gallery_id: $("#gallery_id").val() }, success:function(response_main){ var response_split = response_main.split(","); var response = response_split[0]; var fav_text = $("#add_fav_btn").html(); var fav_count = $("#add_fav_btn span").html(); var new_fav_count = parseInt(fav_count)+1; if(response == 'not_logged') { $('#add_fav_btn').prop('disabled', true); $("#message_result").html('
You have to be logged in for adding this gallery to favorites.
'); } else if(response == 'already') { $('#add_fav_btn').prop('disabled', true); $("#message_result").html('
You already have this gallery to favorites.
'); } else if(response == 'exceeded') { $('#add_fav_btn').prop('disabled', true); $("#message_result").html('
You have exceeded the number of favorites galleries.
'); } else if(response == 'temp_disabled') { $('#add_fav_btn').prop('disabled', true); $("#message_result").html('
This feature is temporary disabled. We are working to fix favorites bug. Please try again later.
'); } else if(response == 'success') { var coins = response_split[1]; $("#message_result").html('
You have added this gallery to favorites.
'); $('#add_fav_btn span').html(new_fav_count); $('#add_fav_btn').prop('disabled', true); var cleanCoins = $('.coin_text').text().replace(/,/g, ''); var reward = coins - cleanCoins; $(".reward").html('+'+new Intl.NumberFormat().format(reward)); if(reward > 0){ $(".reward").show(); $(".reward").effect( "bounce", "slow" ); $(".reward").fadeOut('fast',function(){ }); $(".coin_text").text(new Intl.NumberFormat().format(coins)); } } else { $('#add_fav_btn').prop('disabled', true); $("#message_result").html('
There was a problem adding this gallery to favorites, please refresh page and try again.
'); } }, error: function(xhr, textStatus, error){ $('#add_fav_btn').prop('disabled', true); $("#message_result").html('
There was a problem adding this gallery to favorites, please refresh page and try again.
') } }); return false; }); $("#fap_btn").click(function(e) { $("#message_result").html(''); $.ajax({ url: '/inc/add_fap.php', type: 'POST', data: { gallery_id: $("#gallery_id").val(), }, success:function(response_main){ var response_split = response_main.split(","); var response = response_split[0]; var fap_text = $("#fap_btn").html(); var fap_count = $("#fap_btn span").html(); var new_fap_count = parseInt(fap_count)+1; if(response == 'already') { $("#message_result").html('
You already fapped to this gallery.
'); } else if(response == 'success') { var coins = response_split[1]; $("#message_result").html('
You fapped to this gallery!
'); $('#fap_btn span').html(new_fap_count); $('#fap_btn').prop('disabled', true); var cleanCoins = $('.coin_text').text().replace(/,/g, ''); var reward = coins - cleanCoins; $(".reward").html('+'+new Intl.NumberFormat().format(reward)); if(reward > 0){ $(".reward").show(); $(".reward").effect( "bounce", "slow" ); $(".reward").fadeOut('fast',function(){ }); $(".coin_text").text(new Intl.NumberFormat().format(coins)); } } else { $("#message_result").html('
There was a problem fapping to this gallery, please refresh page and try again.
'); } }, error: function(xhr, textStatus, error){ $("#message_result").html('
There was a problem fapping to this gallery, please refresh page and try again.
'); } }); return false; }); $("#save_blacklist").click(function() { $("#blacklist_msg").html(''); $.ajax({ url: "/user/blacklist.php", type: 'POST', data: { blacklist_tags: $("#blacklist_tags").val(), blacklist_parodies: $("#blacklist_parodies").val(), blacklist_artists: $("#blacklist_artists").val(), blacklist_characters: $("#blacklist_characters").val(), blacklist_groups: $("#blacklist_groups").val(), blacklist_languages: $("#blacklist_languages").val(), blacklist_categories: $("#blacklist_categories").val() }, success:function(response){ if(response == 'not_logged') { $('#save_blacklist').prop('disabled', true); $("#blacklist_msg").html('
You are not logged in, please refresh page and try again.
'); } else if(response == 'success') { $("#blacklist_msg").html('
Your blacklist was saved successfully!
'); $('#save_blacklist').attr('disabled', true); } else { $("#blacklist_msg").html('
There was a problem while saving, please refresh page and try again.
'); } }, error: function(xhr, textStatus, error){ $("#blacklist_msg").html('
There was a problem while saving, please refresh page and try again.
'); } }); return false; }); $("#save_info").click(function(e) { $("#info_msg").html(''); $.ajax({ url: '/user/edit_profile.php?act=info', type: 'POST', data: { email_address: $("#email_address").val(), location: $("#location").val(), bio: $("#bio").val(), age: $("#age").val(), gender: $("#gender").val() }, success:function(response){ if(response == 'not_logged') { $("#info_msg").html('
You are not logged in, please refresh page and try again.
'); } else if(response == 'email_required') { $("#info_msg").html('
E-mail address field is required.
'); } else if(response == 'email_invalid') { $("#info_msg").html('
You have to enter a valid e-mail address.
'); } else if(response == 'email_exists') { $("#info_msg").html('
This e-mail address is already in use, please choose another one.
'); } else if(response == 'success') { $("#info_msg").html('
Your information has been saved successfully!
'); $('#save_info').prop('disabled', true); } else { $("#info_msg").html('
There was a problem saving information, please refresh page and try again.
'); } }, error: function(xhr, textStatus, error){ $("#info_msg").html('
There was a problem saving information, please refresh page and try again.
'); } }); return false; }); $("#save_password").click(function(e) { $("#pass_msg").html(''); $.ajax({ url: '/user/edit_profile.php?act=pass', type: 'POST', data: { old_password: $("#old_password").val(), new_password: $("#new_password").val(), c_new_password: $("#c_new_password").val(), }, success:function(response){ if(response == 'not_logged') { $("#pass_msg").html('
You are not logged in, please refresh page and try again.
'); } else if(response == 'empty') { $("#pass_msg").html('
All fields are required.
'); } else if(response == 'wrong_pass') { $("#pass_msg").html('
Your current password is incorrect.
'); } else if(response == 'pass_too_short') { $("#pass_msg").html('
Your new password must contain at least 6 characters.
'); } else if(response == 'pass_mismatch') { $("#pass_msg").html('
New passwords does not match, type them again carrefully.
'); } else if(response == 'success') { $('#save_password').prop('disabled', true); var counter = 5; var interval = setInterval(function() { counter--; $("#pass_msg").html('
Your password has been changed successfully! You will be redirected to login again in '+ counter +' seconds.
'); if (counter == 0) { window.location.href = "/logout/"; clearInterval(interval); } }, 1000); } else { $("#pass_msg").html('
There was a problem changing password, please refresh page and try again.
'); } }, error: function(xhr, textStatus, error){ $("#pass_msg").html('
There was a problem changing password, please refresh page and try again.
'); } }); return false; }); $("#save_premium").click(function(e) { $("#premium_msg").html(''); $.ajax({ url: "/user/edit_profile.php?act=prm", type: 'POST', data: { p_no_ads: $("#p_no_ads").val(), p_no_dl: $("#p_no_dl").val(), p_stealth: $("#p_stealth").val(), p_art_sub: $("#p_art_sub").val() }, success:function(response){ if(response == 'not_logged') { $("#premium_msg").html('
You are not logged in, please refresh page and try again.
'); } else if(response == 'success') { $("#premium_msg").html('
Your premium settings were saved successfully.
'); $('#save_premium').prop('disabled', true); } else { $("#premium_msg").html('
There was a problem while saving, please refresh page and try again.
'); } }, error: function(xhr, textStatus, error){ $("#premium_msg").html('
There was a problem while saving, please refresh page and try again.
'); } }); return false; }); $("#save_dsc").click(function(e) { $("#opt_dsc_msg").html(''); $.ajax({ url: "/user/edit_profile.php?act=dsc", type: 'POST', data: { opt_dsc: $("#opt_dsc").val(), }, success:function(response){ if(response == 'not_logged') { $("#opt_dsc_msg").html('
You are not logged in, please refresh page and try again.
'); } else if(response == 'success') { $("#opt_dsc_msg").html('
Content settings were saved successfully.
'); $('#save_dsc').prop('disabled', true); } else { $("#opt_dsc_msg").html('
There was a problem while saving, please refresh page and try again.
'); } }, error: function(xhr, textStatus, error){ $("#opt_dsc_msg").html('
There was a problem while saving, please refresh page and try again.
'); } }); return false; }); function random_mm() { var mm = Array("a1ree66_460swp", "a3E3Ldm_460swp", "a07LLGZ_460swp", "a07LLmX_460swp", "a07LLxq_460swp", "a7Eyyeq_460swp", "a7EyyGe_460swp", "a8EYjme_460swp", "a8EYYyQ_460swp", "aAbrrW2_460swp", "aB23r9A_460swp", "aDd3m8Z_460swp", "ajm0n5p_460swp", "amP00Aj_460swp", "amP00RX_460swp", "aNpZKWw_460swp", "anQKBgL_460swp", "anQKKwL_460swp", "arM4R1V_460swp", "aRXPPGB_460swp", "aRXPPyq_460swp", "av5gL85_460swp", "awMK70W_460swp", "awMKKmW_460swp", "aXopXrg_460swp", "ayM00rX_460swp", "aYoWW17_460swp", "aYoWwG2_460swp", "azMEENZ_460swp", "azMEVrN_460swp"); return mm[Math.floor(Math.random() * mm.length)] } if(Cookies.get("sth_mode") == 1) { $("#stealth_btn").addClass("act_st"); $(".thumb img").each(function() { var rm = random_mm(); $(this).attr("src", "https://hentaiera.com/memes/" + rm + ".jpg"); $(this).attr("data-src", "https://hentaiera.com/memes/" + rm + ".jpg"); }); $(".gthumb img").each(function() { var rm = random_mm(); $(this).attr("src", "https://hentaiera.com/memes/" + rm + ".jpg"); $(this).attr("data-src", "https://hentaiera.com/memes/" + rm + ".jpg"); }); $(".related").hide(); $(".er_container").hide(); $(".er_container_b").hide(); $(".ablocktop").hide(); $(".bblocktop").hide(); $(".bix").hide(); $(".bgc").hide(); $(".bcx").hide(); var rm = random_mm(); $(".left_cover img").attr("src", "https://hentaiera.com/memes/" + rm + ".jpg"); $(".left_cover img").attr("data-src", "https://hentaiera.com/memes/" + rm + ".jpg"); $(".left_cover img").css('width', '350px'); } $("#stealth_btn").click(function(rm) { if (Cookies.get("sth_mode") == null) { Cookies.set("sth_mode", "1"); Cookies.get("sth_mode"); $(".thumb img").each(function() { var rm = random_mm(); $(this).attr("src", "https://hentaiera.com/memes/" + rm + ".jpg"); $(this).attr("data-src", "https://hentaiera.com/memes/" + rm + ".jpg"); }); $(".gthumb img").each(function() { var rm = random_mm(); $(this).attr("src", "https://hentaiera.com/memes/" + rm + ".jpg"); $(this).attr("data-src", "https://hentaiera.com/memes/" + rm + ".jpg"); }); $(".related").hide(); $(".er_container").hide(); $(".er_container_b").hide(); $(".ablocktop").hide(); $(".bblocktop").hide(); $(".bix").hide(); $(".bgc").hide(); $(".bcx").hide(); var rm = random_mm(); $(".left_cover img").attr("src", "https://hentaiera.com/memes/" + rm + ".jpg"); $(".left_cover img").attr("data-src", "https://hentaiera.com/memes/" + rm + ".jpg"); $(".left_cover img").css('width', '350px'); $("#stealth_btn").addClass("act_st"); } else { Cookies.remove("sth_mode"), location.reload(); } }); $("#nav_btn").click(function(e) { $("#nav_btn").toggleClass("active_nav"); $(".ns_mob").toggleClass("active_nsmob"); }); $(".nav_bell").click(function() { $(".user_notify").toggle(); if($(".user_notify").is(':visible')) { $(".nav_bell").css('color','#fff'); $(".overlay").click(function() { $(".user_notify").hide(); $("#get-list-view").html(''); }); $.ajax({ type: "GET", url: "/user/notifications.php?mode=list&begin=yes", dataType: "html", success: function(data){ $('#get-list-view').html(data); $('.notify_loading').hide(); } }); } else { $(".nav_bell").css('color','#9d9d9d'); $("#get-list-view").html(''); } }); $("#ra_ntf").click(function() { $.ajax({ url: "/user/notifications.php?mode=readall", type: 'POST', beforeSend: function() { $(".notify_loading").fadeIn(); }, success:function(response){ $(".notify_loading").hide(); $(".ntc").hide(); $("#get-list-view").html(''); $.ajax({ type: "GET", url: "/user/notifications.php?mode=list&begin=yes", dataType: "html", success: function(data){ $('#get-list-view').html(data); $('.notify_loading').hide(); } }); $(".notification--num").html('0'); } }); }); $('#get-list-view').on('click', 'li', function() { $.ajax({ url: "/user/notifications.php?mode=read", type: 'POST', data: { g_id: $(this).attr('id').replace('g_',''), }, beforeSend: function() { $(".notify_loading").fadeIn(); }, success:function(response){ $(".notify_loading").hide(); window.location.href = "/gallery/"+response+"/"; } }); }); $(".rm_ua").click(function(e) { parent = $(this).parent(); art_id = $(this).attr('id').replace('art_',''); art_name = $(this).data('name'); new_ua_count = parseInt($('.count_ua').text())-1; $("#subsart_msg").html(''); $.ajax({ url: "/user/remove_art.php", type: 'POST', data: { art_id: art_id }, success:function(response){ if(response == 'not_logged') { $("#subsart_msg").html('
You are not logged in, please refresh page and try again.
'); } if(response == 'not_exists') { $("#subsart_msg").html('
You are not subscribed to this artist.
'); } else if(response == 'success') { parent.remove(); $('.count_ua').html(new_ua_count); $("#subsart_msg").html('
'+ art_name +' has been removed. You won\'t get any notifications from this artist anymore.
'); } else { $("#subsart_msg").html('
There was a problem while removing, please refresh page and try again.
'); } }, error: function(xhr, textStatus, error){ $("#subsart_msg").html('
There was a problem while removing, please refresh page and try again.
'); } }); return false; }); $(".ua_tag").click(function(e) { art_link = $(this).data('link'); window.location.href = art_link; }); var datamap = new Map([ [document.getElementById("b_fdbd60947b8d84b864c67260733b5383"), document.getElementById("fdbd60947b8d84b864c67260733b5383")], [document.getElementById("b_8243d8656851b211376884e74e23040a"), document.getElementById("8243d8656851b211376884e74e23040a")], [document.getElementById("b_9912e7e6ef20447ccd931008b2e36aab"), document.getElementById("9912e7e6ef20447ccd931008b2e36aab")], [document.getElementById("b_c8304f9ec7738499762070adf5c4eeed"), document.getElementById("c8304f9ec7738499762070adf5c4eeed")], [document.getElementById("b_a3f8ea82e160edbd4e5603f380e2fcaf"), document.getElementById("a3f8ea82e160edbd4e5603f380e2fcaf")], [document.getElementById("b_e214f0f0c2822707d066b95f782500db"), document.getElementById("e214f0f0c2822707d066b95f782500db")], [document.getElementById("b_0c1c46c5a22acf277d6c4a0fe1d72e1b"), document.getElementById("0c1c46c5a22acf277d6c4a0fe1d72e1b")], [document.getElementById("b_717857f0d4209110551af29b35a6cb99"), document.getElementById("717857f0d4209110551af29b35a6cb99")], ]); datamap.forEach((value, key) => { doModal(key, value); }); function doModal(anchor, popupbox) { var span = popupbox.getElementsByClassName("close")[0]; anchor.addEventListener("click", function (event) { popupbox.style.display = "block"; }); span.addEventListener("click", function (event) { popupbox.style.display = "none"; }); window.addEventListener("click", function (event) { if (event.target == popupbox) { popupbox.style.display = "none"; } }); } });