Dudaevskiy
5/8/2020 - 8:20 PM

https://elementor.com/blog

// jQuery
console.log('СТАРТ Удаленной загрузки');  

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


/* ==== START ============
Горячие клавиши
=========================*/
setTimeout(function(){ 
jQuery(document).ready(function($){
 
    document.onkeyup = function(e) {
        if (e.which == 50) {

        // 2️⃣⌨ - Скрол вверх  
        // = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
          jQuery("html, body").animate({ scrollTop: 0 }, "slow");
        
        // Удаляем не нужные элементы  
        $('section').each(function(){
            $(this).find('font:contains("об авторе")').closest('section').remove();
            $(this).find('font:contains("вам также может понравиться")').closest('section').remove();
            $(this).find('font:contains("Понравилась эта статья?")').closest('section').remove();
            $(this).find('font:contains("Понравилась эта статья?")').closest('section').remove();
            $(this).find('font:contains("Комментарии")').closest('section').remove();
        });

        } else if ( e.which == 49) {

        // 1️⃣⌨ - Переход по следующей ссылке из Google Sheets
        // = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
        //https://html-to-markdown.test/PARSING_ALL_LINKS.txt

            // ID of the Google Spreadsheet
            // https://bionicteaching.com/google-sheets-json-with-jquery/
            // ⭐ Укзываем ID именно листа
            //var spreadsheetID = "1cZtSuTWWKQAvyDCxdnyfM6KQJUgqs_T37p4gtSif_Mo";
			//https://docs.google.com/spreadsheets/d/1EvG_2XI1A1o1pScTEXbqrCZE1-sYyGxR7cxIYIrSJjs/edit?usp=sharing
            var spreadsheetID = "1Wg8OxWv6U3c_YoKODU1hFYWq0KPs2XvFbeI3Wh1O4t4";

            // Make sure it is public or set to Anyone with link can view 
            var url = "https://spreadsheets.google.com/feeds/list/" + spreadsheetID + "/1/public/values?alt=json"; //this is the part that's changed
            // ===========================================

            var ThisURL = window.location.href;
            console.log('1⭐ Текущий линк - '+ThisURL);
            console.log('============================');

            // Объявляем счетчик
            var i = 0;
            // Заготавливаем переменку для следующей ссылки
            var NEXT_LINK_NUM_LINK_IN_FILE = '';
            // Ссылка на следующую страницу
            var NEXT_LINK = '';


            $.getJSON(url, function(data) {

                var entry = data.feed.entry;

                $(entry).each(function(){
                i++;
                // +++++++++++++++++++++++++++++++++++

                    // Получаем номер ячейки для текущей ссылки
                    if (ThisURL === this.title.$t){
                        NEXT_LINK_NUM_LINK_IN_FILE = i+1;
                    }

                    // Получаем ссылку на следующую страницу
                    if (NEXT_LINK_NUM_LINK_IN_FILE == i){
                        NEXT_LINK = this.title.$t;
                    }
                // +++++++++++++++++++++++++++++++++++   
                })
                    if (NEXT_LINK !== ""){
                        console.log('2 ✅ Следующий линк - '+NEXT_LINK);  
                        // И переходим на следующую страницу 😊
                        window.location.href = NEXT_LINK;
                    } else {
                        $( "body" ).empty();
                        $( "body" ).css('background-color','red');
                        console.log('🔴🔴🔴🔴🔴🔴 Весь лист ссылок окончен!!! Очищаем body и красим в красный');    
                    }
            });
    
        } else if ( e.which == 51) {

        //3️⃣⌨ - Добавление RU слага 
        // = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 


        }
    // = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
    };
});
}, 10000);
console.log('END Удаленной загрузки');  
/*END Горячие клавиши */