/* 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('
'); var $gotop = $('#gotop'); $(window).scroll(function () { if ($(this).scrollTop() > 300) { $gotop.fadeIn(200); } else { $gotop.fadeOut(200); } }); $gotop.click(function () { $('html, body').animate({scrollTop: 0}, 'slow'); }); } ; }); $(document).ready(function () { /*! * jQuery Cookie Plugin v1.3 * https://github.com/carhartl/jquery-cookie * * Copyright 2011, Klaus Hartl * Dual licensed under the MIT or GPL Version 2 licenses. * http://www.opensource.org/licenses/mit-license.php * http://www.opensource.org/licenses/GPL-2.0 */ (function (e, h, j) { function k(b) { return b } function l(b) { return decodeURIComponent(b.replace(m, " ")) } var m = /\+/g, d = e.cookie = function (b, c, a) { if (c !== j) { a = e.extend({}, d.defaults, a); null === c && (a.expires = -1); if ("number" === typeof a.expires) { var f = a.expires, g = a.expires = new Date; g.setDate(g.getDate() + f) } c = d.json ? JSON.stringify(c) : String(c); return h.cookie = [encodeURIComponent(b), "=", d.raw ? c : encodeURIComponent(c), a.expires ? "; expires=" + a.expires.toUTCString() : "", a.path ? "; path=" + a.path : "", a.domain ? "; domain=" + a.domain : "", a.secure ? "; secure" : ""].join("") } c = d.raw ? k : l; a = h.cookie.split("; "); f = 0; for (g = a.length; f < g; f++) { var i = a[f].split("="); if (c(i.shift()) === b) return b = c(i.join("=")), d.json ? JSON.parse(b) : b } return null }; d.defaults = {}; e.removeCookie = function (b, c) { return null !== e.cookie(b) ? (e.cookie(b, null, c), !0) : !1 } })(jQuery, document); function doRateLD(rate, id) { ShowLoading(''); $.get(dle_root + "engine/ajax/rating.php", {go_rate: rate, news_id: id, skin: dle_skin}, function (data) { HideLoading(''); if (data.success) { var rating = data.rating; rating = rating.replace(/</g, "<"); rating = rating.replace(/>/g, ">"); rating = rating.replace(/&/g, "&"); $("#ratig-layer-" + id).html(rating); $("#vote-num-id-" + id).html(data.votenum); var ratingtext = parseInt($(rating).text()); var minusik = (data.votenum - ratingtext) / 2; var plusik = data.votenum - minusik; $("#pluss-" + id).children('.plusik').text(plusik); $("#minuss-" + id).children('.minusik').text(minusik); } else if (data.error) { DLEalert(data.errorinfo, dle_info); } }, "json"); }; if ($.cookie('loop_view') == 'grid-list') { $('#grid').removeClass('grid-thumb').addClass('grid-list').attr('data-view', 'grid-list'); $('#grid-select > span:nth-child(1)').addClass('current').siblings('span').removeClass('current'); } if ($.cookie('loop_view') == 'grid-thumb') { $('#grid').removeClass('grid-list').addClass('grid-thumb').attr('data-view', 'grid-thumb'); $('#grid-select > span:nth-child(2)').addClass('current').siblings('span').removeClass('current'); } $('#grid-select > span').on('click', function (e) { e.preventDefault(); var viewType = $(this).attr('data-type'), loop = $('#grid'), loopView = loop.attr('data-view'); if (viewType == loopView) return false; $(this).addClass('current').siblings('span').removeClass('current'); loop.stop().fadeOut(100, function () { if (loopView) loop.removeClass(loopView); $(this).fadeIn().attr('data-view', viewType).addClass(viewType); }); $.cookie('loop_view', viewType, {path: '/', expires: 7}); return false; }); }); /* This plugins by Aleksey Skubaev, askubaev@gmail.com, icq - 322253350, test-templates.com */ $(document).ready(function () { if ($(window).width() > 950) { var LinkTitle = $(document).attr('title'); var LinkUrl = window.location.href; LinkTitle = encodeURIComponent(LinkTitle); LinkUrl = encodeURIComponent(LinkUrl); var leftvar = (screen.width - 600) / 2; var topvar = (screen.height - 400) / 2; var LinksItem = [ 'http://www.facebook.com/sharer.php?u=' + LinkUrl + '&t=' + LinkTitle + '" onClick="popupWin = window.open(this.href, \'contacts\', \'location,width=600,height=400,left=' + leftvar + ',top=' + topvar + '\'); popupWin.focus(); return false;" title="Facebook"', 'http://twitter.com/share?text=' + LinkTitle + '&url=' + LinkUrl + '" onClick="popupWin = window.open(this.href, \'contacts\', \'location,width=600,height=400,left=' + leftvar + ',top=' + topvar + '\'); popupWin.focus(); return false;" title="Twitter"', 'https://plus.google.com/share?url=' + LinkUrl + '" onClick="popupWin = window.open(this.href, \'contacts\', \'location,width=600,height=400,left=' + leftvar + ',top=' + topvar + '\'); popupWin.focus(); return false;" title="Google"' ]; $('.share-box').each(function () { var $share = $(this); var $urlImg = $share.attr("data-img"); var sdvig = 0; for (i = 0; i < LinksItem.length; i++) { var getLinks = $(''); getLinks.appendTo($share); var sdvig = sdvig + 27; } }); } ; }); $(document).ready(function () { jQuery.fn.tcarusel = function (options) { return this.each(function () { var tcaruselBlock = $(this); var tcaruselScroll = tcaruselBlock.find('.tcarusel-scroll'); var tcaruselFirstItem = tcaruselBlock.find('.tcarusel-item:first'); var tcaruselLastItem = tcaruselBlock.find('.tcarusel-item:last'); var tcaruselBlockWidth = tcaruselBlock.find(tcaruselFirstItem).outerWidth(true); function tcaruselShowNext() { tcaruselScroll.animate({'left': -tcaruselBlockWidth}, 200, function () { tcaruselBlock.find('.tcarusel-item:first').appendTo(tcaruselScroll); tcaruselScroll.css({'left': '0'}); }); } function tcaruselShowPrev() { tcaruselBlock.find('.tcarusel-item:last').prependTo(tcaruselScroll); tcaruselScroll.css({'left': -tcaruselBlockWidth}); tcaruselScroll.animate({'left': 0}, 200); } tcaruselBlock.find('.tcarusel-next').click(tcaruselShowNext); tcaruselBlock.find('.tcarusel-prev').click(tcaruselShowPrev); }); }; $('.tcarusel').tcarusel(); });