Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (function (d){
- let b = d.querySelector('body');
- let target = document;
- let observer = null;
- const config = {
- attributes: true,
- childList: true,
- subtree: true
- };
- const observerCallback = function(mutationsList, observer) {
- b = d.querySelector("body");
- for (let mutation of mutationsList) {
- console.log(mutation);
- if (b && mutation.target === b && !d.querySelector("body > script[src=https://relap.io/v7/relap.js]"))
- {
- addScript();
- observer.disconnect();
- }
- }
- };
- const addScript = function() {
- let s = d.createElement("script");
- s.setAttribute('async', 'async');
- s.setAttribute('type', 'text/javascript');
- s.setAttribute('src', 'https://relap.io/v7/relap.js');
- s.setAttribute('data-relap-token', '45vjvDi8uv8CO87L');
- b.insertBefore(s, d.querySelector('body > :first-child'));
- };
- if(b)
- {
- addScript();
- }
- else
- {
- observer = new MutationObserver(observerCallback);
- observer.observe(target, config);
- }
- })(document);
Add Comment
Please, Sign In to add comment