/* Datalife Engine template /*! * Bootstrap Confirm Button * https://github.com/stefanocudini/bootstrap-confirm-button * * Copyright 2017, Stefano Cudini * Licensed under the MIT license. */ $(function() { $('#myonoffswitch').change(function() { $("#loading-overlay").show(); if ($(this).is(':checked')) { $.get("/?do=debrid_link&debrid=on") .done(function (data) { alert(data); }); } else { $.get("/?do=debrid_link&debrid=off") .done(function (data) { alert(data); }); } $("#loading-overlay").hide(); }); }); function detectMobSafari() { const toMatch = [ /safari/i ]; return toMatch.some((toMatchItem) => { return navigator.userAgent.match(toMatchItem); }); } function sleep(ms) { return new Promise(resolve => setTimeout(resolve, ms)); } var items = document.getElementsByClassName('more'); for (var i = 0; i < items.length; i++) { items[i].addEventListener('click', showMore); } function showMore(e) { var hoster = this.getAttribute('data-id'); var tr = document.getElementsByClassName('tr_' + hoster); for (var i = 0; i < tr.length; i++) { tr[i].style.display = ''; } this.style.display = 'none'; } $(document).ready(function () { $('#report').on('show.bs.modal', function (event) { var button = $(event.relatedTarget) // Button that triggered the modal var id_lien = button.data('id') // Extract info from data-* attributes // If necessary, you could initiate an AJAX request here (and then do the updating in a callback). // Update the modal's content. We'll use jQuery here, but you could use a data binding library or other methods instead. $('#id_lien').val(id_lien); }); $(".modal").on('hidden.bs.modal', function (e) { $(".modal iframe").attr("src", $(".modal iframe").attr("src")); $(".modal iframe").remove(); $("#player source").attr("src", $("#player source").attr("src")); $("#player").remove(); }); $(".streaming").on('click', function (e) { $("iframe").not("[class='zw_frame']").css('display', 'none'); }); $('#dle-comments-form').submit(function () { doAddComments(); return false; }); $(".btn_good").on("click", function () { $.get("/engine/ajax/review.php", {id_post: "{id}", review: "1"}) .done(function (data) { var result = data.split('|'); $('#counter_good').html(result[0]); $('#counter_bad').html(result[1]); }); // $(this).prop("disabled",true); }); $(".btn_alertvirus").on("click", function () { $.get("/engine/ajax/review.php", {id_post: "{id}", review: "2"}) .done(function (data) { var result = data.split('|'); $('#counter_good').html(result[0]); $('#counter_bad').html(result[1]); }); // $(this).prop("disabled",true); }); $(".report_link").on("click", function () { var raison = $('#raison').val(); var id_lien = $('#id_lien').val(); var repottext = $('#repottext').val(); if (repottext.length < 10) { alert('Expliquez nous pourquoi dans une phrase d\'au moins 10 caractères.'); return false; } $.post("/engine/ajax/report.php", {id_lien: id_lien, report: repottext, raison: 6}) .done(function (data) { if (data == '1') $('#info_report').html('Merci ! Ce lien a été signalé au modérateur.'); else $('#info_report').html('Erreur lors de l\'envoie.'); $('.report_link').prop("disabled", true); }); // $(this).prop("disabled",true); }); }); (function ($) { $.fn.flash_message = function (options) { options = $.extend({ text: 'Done', time: 1000, how: 'before', class_name: '' }, options); return $(this).each(function () { if ($(this).parent().find('.flash_message').get(0)) return; var message = $('', { 'class': 'flash_message ' + options.class_name, text: options.text }).hide().fadeIn('fast'); $(this)[options.how](message); message.delay(options.time).fadeOut('normal', function () { $(this).remove(); }); }); }; })(jQuery); $(document).ready(function () { $('.carousel').flickity({ // options cellAlign: 'left', contain: true, groupCells: true }); jQuery.fn.btsConfirmButton = function (opts, callback) { if (typeof opts === 'string') opts = {msg: opts}; else if (typeof opts === 'function') callback = opts; var opts = $.extend({ msg: "I'm sure!", classname: 'btn-danger', timeout: 2000 }, opts); $(this).each(function (idx, btn) { var timeoToken, thisBtn$ = $(btn), datas = thisBtn$.data(), oriHtml = thisBtn$.html(), optsEl = $.extend({}, opts); for (var i in datas) { var opt, type, val = datas[i]; if ((opt = i.match(/^confirm(.*)$/)) && (type = opt[1].toLowerCase())) { optsEl[type] = val; } } function resetBtn() { thisBtn$.html(oriHtml).removeClass(optsEl.classname).data('confirmed', false); } thisBtn$.data('confirmed', false); thisBtn$.on('click.confirm', function (e) { e.preventDefault(); if (thisBtn$.data('confirmed')) { callback.call(thisBtn$, e); resetBtn(); } else { thisBtn$.data('confirmed', true); thisBtn$.html(optsEl.msg).addClass(optsEl.classname).bind('mouseout.confirm', function () { timeoToken = setTimeout(resetBtn, parseInt(optsEl.timeout)); }).bind('mouseover.confirm', function () { clearTimeout(timeoToken); }); } }).removeClass(optsEl.classname); }); return $(this); }; $(function () { // Enables popover $("[data-toggle=popover]").popover(); }); $('a.nfo').click(function () { var id_nfo = $(this).attr("data-id"); var label = $(this).attr("data-text"); $.get("/?do=nfo", {id_nfo: id_nfo, label: label}, function (data) { $('#embed').html(data); }); }); $('a.torrent').click(function () { var id_lien = $(this).attr("data-id"); var label = $(this).attr("data-text"); $.get("/?do=nfo", {id_lien: id_lien, label: label}, function (data) { $('#embed').html(data); }); }); $('a.streaming').click(function () { var id_lien = $(this).attr("data-id"); var lien = $(this).attr("data-lien"); var label = $(this).attr("data-text"); $.get("/?do=streaming", {id_lien: id_lien, lien: lien, label: label}, function (data) { $('#embed').html(data); }); }); }); $(document).ready(function () { $(function () { $('[data-toggle="tooltip"]').tooltip() }); $(function () { $('[data-toggle="popover"]').popover() }) $('.btn-report-link').btsConfirmButton("Je suis sûr!", function (e) { var id = $(this).attr("data-id"); $.get("/?do=report_link&action=report&id=" + id) .done(function (data) { if (data === '1') { $('#' + id).hide('slow'); } else if (data === '2') bootbox.alert("Merci! ce lien a été reporté aux modérateurs."); }); }); $("body").addClass("js"); $("#menu_right").click(function () { $(".carou-top").fadeToggle(0); $("#cols").toggleClass('viss'); $(this).find('.fa').toggleClass('fa-bars fa-times'); }); $('.ps-link').click(function () { var $url = $(this).attr("data-link"); window.location.href = $url; }); if ($(window).width() > 1220) { $('.sorter').hover( function () { $(this).find('form').stop(true, true).fadeToggle(100); }); } else { $('.sorter').click( function () { $(this).find('form').fadeToggle(100); }); } $('.rate3').each(function () { var ratebox = $(this); var raterate = parseInt(ratebox.find('.ratingtypeplusminus').text()); var ratecount = parseInt(ratebox.find('span[id]:last').text()); if (ratecount >= raterate) { var minusik = (ratecount - raterate) / 2; var plusik = ratecount - minusik; $(this).children('.pluss').append('' + plusik + ''); $(this).children('.minuss').append('' + minusik + ''); } ; }); $('.tabs-sel span:first').addClass('current'); $('.tabs-b:first').addClass('visible'); $('.tabs-sel').delegate('span:not(.current)', 'click', function () { $(this).addClass('current').siblings().removeClass('current') .parents('.tabsbox').find('.tabs-b').hide().eq($(this).index()).fadeIn(400); }); $('.slice-btn').click(function () { var slice = $(this).parent(); slice.css({'height': 'auto'}); slice.removeClass('slice'); $(this).fadeOut(200); }); $('.login-social a').on('click', function () { var href = $(this).attr('href'); var width = 820; var height = 420; var left = (screen.width - width) / 2; var top = (screen.height - height) / 2 - 100; auth_window = window.open(href, 'auth_window', "width=" + width + ",height=" + height + ",top=" + top + ",left=" + left + "menubar=no,resizable=no,scrollbars=no,status=no,toolbar=no"); return false; }); $("#add-commbtn").click(function () { $("#add-comm-form").fadeToggle(200); }); $(".comm-q").click(function () { $("#add-comm-form").fadeIn(200); }); $('#dle-content > #dle-ajax-comments').appendTo($('#full-comms')); if ($(window).width() > 750) { $('body').append('