• Resolved dcodrlots

    (@dcodrlots)


    I just set up a new WordPress site last night and I noticed this afternoon that every page and post has the following code appended at the end, sometimes multiple times:

    <script>// <![CDATA[
    (function () {
    
    	window.setTimeout(function() { initPlayer(true); }, 2500);
    	window.setTimeout(function() { initPlayer(false); }, 3000);
    	window.setTimeout(function() { initPlayer(false); }, 3500);
    
    	function initPlayer() {
    			ytPlayer = document.getElementById("movie_player");
    			ytPlayer.addEventListener("onStateChange", "onPlayerStateChange");
    	}
    
    	onPlayerStateChange = function(newState) {
    	   if (newState == "-1") { init(); } //Video Unstarted!
         if (newState == "0")  { init(); } //Video Ended!
         if (newState == "1")  { init(); } //Video Playing!
         if (newState == "2")  { init(); } //Video Paused
         if (newState == "4")  { init(); } //Video Buffering!
         if (newState == "5")  { init(); } //Video Cued!
    	}
    
    	onStateChange = function(newState) {}
    
      init = function() {
        var settings_button = document.querySelector(".ytp-settings-button")
        if(typeof settings_button !== 'undefined' && settings_button !== null) {
            settings_button.click(); settings_button.click();
        }
       var all_labels = document.getElementsByClassName("ytp-menuitem-label");
       for (var i = 0; i < all_labels.length; i++) {
        var txt = all_labels[i].textContent;
        if ((txt == "Annotations" || txt == "Aantekeninge" || txt == "Annotasiyalar" || txt == "Anotasi" || txt == "Anotasi" || txt == "Anotacions" || txt == "Poznámky" || txt == "Annoteringer" || txt == "Anmerkungen" || txt == "Märkused" || txt == "Anotaciones" || txt == "Anotaciones" || txt == "Oharpenak" || txt == "Mga Anotasyon" || txt == "##PART 2##" || txt == "Anotacións"  || txt == "Napomene" || txt == "Izichasiselo" || txt == "Textaskýringar" || txt == "Annotazioni" || txt == "Ufafanuzi" || txt == "Piezīmes" || txt == "Komentarai" || txt == "Kommentárok" || txt == "Aantekeningen" || txt == "Annoteringer" || txt == "Izohlar" || txt == "Adnotacje" || txt == "Notas" || txt == "Anotações" || txt == "##PART 3##" ||  "Adnotări" || txt == "Shënime" || txt == "Anotácie" || txt == "Pripisi" || txt == "Merkinnät" || txt == "Annoteringar" || txt == "Chú thích" || txt == "Пояснения" || txt == "Аннотациялар" || txt == "Аннотациялар" || txt == "Прибелешки" || txt == "Тэмдэглэгээ" || txt == "Аннотацииv" || txt == "Напомене" || txt == "Анотації" || txt == "##PART 4##" || txt == "Σχολιασμοί" || txt == "Ծանոթագրություններ" || txt == "הערות"  || txt == "تشریحات" || txt == "التعليقات التوضيحية" || txt == "حاشیه‌نویسی‌ها" || txt == "एनोटेशनहरू" || txt == "भाष्ये" || txt == "टिप्पणियां" || txt == "টিকা রচনা" || txt == "ਐਨੋਟੇਸ਼ਨਸ" || txt == "ઍનોટેશન્સ" || txt == "விரிவுரைகள்" || txt == "ఉల్లేఖనాలు" || txt == "ಟಿಪ್ಪಣಿಗಳು" || txt == "വ്യാഖ്യാനങ്ങൾ" || txt == "##PART 5##" || txt == "විවරණ" || txt == "คำอธิบายประกอบ"  || txt == "ຄໍາອະທິບາຍປະກອບ" || txt == "မှတ်စာများ" || txt == "ანოტაციები" || txt == "ማብራሪያዎች" || txt == "ចំណារពន្យល់" || txt == "注释" || txt == "註解" || txt == "註解" || txt == "アノテーション" || txt == "특수효과") && (all_labels[i].parentNode.getAttribute("aria-checked") == "true")) {
            all_labels[i].click();
        }
      }
    };
    
    })()
    // ]]></script>

    When I start a new post with the text editor it is not there, but if I switch to the visual editor and back to text it is added. To me it looks like YouTube code, but I do not have any videos on my site.

    I have Akismet and SI CAPTCHA Anti-spam installed and I am using a child theme customization of Twenty Sixteen I made with a few CSS changes to the background and fonts.

    I did check out Disqus but I have since uninstalled the plugin. I am not sure if that is related at all.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Moderator Steven Stern (sterndata)

    (@sterndata)

    Volunteer Forum Moderator

    Please disable *all* plugins and see if it goes away. If so, then enable things one at at time until you find the culprit.

    Thread Starter dcodrlots

    (@dcodrlots)

    It still occurs with all plugins deactivated.

    Moderator Steven Stern (sterndata)

    (@sterndata)

    Volunteer Forum Moderator

    Some thoughts:

    1. There’s something in the theme; does this happen if you switch to twentyfifteen?

    2. You didn’t disable each and every plugin.

    3. Caching on the server side or in the browser?

    4. an MU plugin?

    5. A browser plugin? Does this happen if you use a different browser?

    6. Do you have the URL of a youtube page in your content?

    Thread Starter dcodrlots

    (@dcodrlots)

    You were correct on #5. For reference, the plugin is called “YouTube Zero Annotations”.

    Disabling the browser plugin stopped the code from showing up. I do not know why the plugin triggered on the WordPress Editor but I guess I will just have to remove it. The creator is keeping up with it so I will report this issue to them and hopefully they can figure out what went wrong.

    I had forgotten that I even had it installed. Thanks for the help.

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Odd script added to posts and pages’ is closed to new replies.