Dudaevskiy
12/27/2019 - 12:35 AM

Удалить все ссылки из массива до текущей ссылки

var jq = document.createElement('script');
jq.src = "https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js";
document.getElementsByTagName('head')[0].appendChild(jq);
// jQuery.noConflict();

// Получить список всех ссылок
// ===========================================
setTimeout(function(){
var i = 0;

    jQuery(document).ready(function($){
        
        var ThisURL = window.location.href;
        console.log(ThisURL);

        var AllLinks = ['https://wplift.com/can-you-sell-cbd-with-woocommerce','https://wplift.com/foogallery-review','https://wplift.com/event-calendar-wd-plugin','https://wplift.com/free-plugin-to-manage-multiple-wordpress-sites'];

        //console.log('1️⃣ Все линки - '+AllLinks);

        var AllLinks_to_STRING = AllLinks.toString();
        //console.log('2️⃣ Все линки в строке - '+AllLinks_to_STRING);

        var SPLIT = AllLinks_to_STRING.split(ThisURL);
        var NextLink = SPLIT[1].split(',');
        //console.log('3️⃣ Следующая ссылка - '+NextLink);

// Если следущей ссылки нет
if (typeof NextLink[1] === 'undefined') {

    $( "body" ).empty();
    $( "body" ).css('background-color','red');
    console.log('🔴🔴🔴🔴🔴🔴🔴');

// Если следующая ссылка есть
} else {

     NextLink = NextLink[1];
    console.log('3️⃣ Следующая ссылка - '+NextLink);

    window.location.href = NextLink;
    // --
}


// =======================================




});


}, 2000);

var jq = document.createElement('script');
jq.src = "https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js";
document.getElementsByTagName('head')[0].appendChild(jq);
// jQuery.noConflict();

// Получить список всех ссылок
// ===========================================
setTimeout(function(){
var i = 0;

    jQuery(document).ready(function($){
        
        var ThisURL = window.location.href;
        console.log(ThisURL);

        var AllLinks = ['https://wplift.com/can-you-sell-cbd-with-woocommerce','https://wplift.com/foogallery-review','https://wplift.com/event-calendar-wd-plugin','https://wplift.com/free-plugin-to-manage-multiple-wordpress-sites'];
        //console.log('1️⃣ Все линки - '+AllLinks);

        var AllLinks_to_STRING = AllLinks.toString();
        //console.log('2️⃣ Все линки в строке - '+AllLinks_to_STRING);

        var SPLIT = AllLinks_to_STRING.split(ThisURL);
        var NextLink = SPLIT[1].split(',');
        //console.log('3️⃣ Следующая ссылка - '+NextLink);

// Если следущей ссылки нет
if (typeof NextLink[1] === 'undefined') {

    $( "body" ).empty();
    $( "body" ).css('background-color','red');
    console.log('🔴🔴🔴🔴🔴🔴🔴');

// Если следующая ссылка есть
} else {

     NextLink = NextLink[1];
    console.log('3️⃣ Следующая ссылка - '+NextLink);

//https://github.com/milankyncl/jquery-copy-to-clipboard

// $(document).ready(function() {
//   $('.element').CopyToClipboard();
// });

/*
 * Copyright (c) 2016 Milan Kyncl
 * Licensed under the MIT license.
 *
 * jquery.copy-to-clipboard plugin
 * https://github.com/mmkyncl/jquery-copy-to-clipboard
 *
 */

$.fn.CopyToClipboard = function() {
    var textToCopy = false;
    if(this.is('select') || this.is('textarea') || this.is('input')){
        textToCopy = this.val();
    }else {
        textToCopy = this.text();
    }
    CopyToClipboard(textToCopy);
};

function CopyToClipboard( val ){
    var hiddenClipboard = $('#_hiddenClipboard_');
    if(!hiddenClipboard.length){
        $('body').append('<textarea style="position:absolute;top: -9999px;" id="_hiddenClipboard_"></textarea>');
        hiddenClipboard = $('#_hiddenClipboard_');
    }
    hiddenClipboard.html(val);
    hiddenClipboard.select();
    document.execCommand('copy');
    document.getSelection().removeAllRanges();
}

$(function(){
    $('[data-clipboard-target]').each(function(){
        $(this).click(function() {
            $($(this).data('clipboard-target')).CopyToClipboard();
        });
    });
    $('[data-clipboard-text]').each(function(){
        $(this).click(function(){
            CopyToClipboard($(this).data('clipboard-text'));
        });
    });
});

$('div#page').before("<blockquote id=\"SDS-Slug\" style=\"\"><h6>SDStudio-FileName-✅ = <span class=\"content\" data-clipboard-text=\""+NextLink+"\">"+NextLink+"</span></h6></blockquote>");
// Копируеем имя файла
$('#SDS-Slug span').CopyToClipboard();
// $($('#SDS-Slug span').data('clipboard-target')).CopyToClipboard();


// --
}


// =======================================




});


}, 2000);