volkan-k / HTML5 Video & Audio Loop Everywhere!

// ==UserScript==
// @name         HTML5 Video & Audio Loop Everywhere!
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  Try to loop all HTML5 Video and Audio elements, everywhere!
// @author       volkan-k
// @match        *
// @include      *
// @grant        none
// @license      MIT
// ==/UserScript==

(function() {
    'use strict';

    function findall(selector) {
        return document.querySelectorAll(selector);
    }
    function setloop(){
        findall("video:not([loop]),audio:not([loop])").forEach(function(item) {
            //console.log(item); // for debug
            item.setAttribute("loop","loop");
        });
    }
    setInterval(setloop,500);
})();