Long time ago, I downloaded script that opens all links from current reddit 
in new tabs. This is useful, for me, to browse for example 
reddit.com/r/funny, and instead of clicking 25 links, I just click one 
button, and instantly get 25 tabs.

The script as I have it now is:

========================
// ==UserScript==
// @name           Reddit open all in tabs
// @namespace      reddit
// @include        https://www.reddit.com/*
// @grant       none
// ==/UserScript==

unsafeWindow.openAlltheTABS = function (){
  console.log("xxx");
    var alltheas = document.querySelectorAll('#siteTable a.title');
    for (var j = 0;j<alltheas.length;j++){
        if (alltheas[j].className.indexOf("title") > -1){
            F = window.open(alltheas[j].href,'_blank');
        }
    }
};

window.addButton = function () {

    var newDiv = document.createElement('div');
    newDiv.setAttribute('id','buttonDiv');
    var inputButton = document.createElement('input');
    inputButton.type = 'button';
    inputButton.value = 'Start the Magic';
    inputButton.setAttribute("onclick", "openAlltheTABS();");
  console.log( inputButton );
    
    // Append the button to the div
    document.getElementsByTagName("body")[0].appendChild(newDiv);
    document.getElementById("buttonDiv").appendChild(inputButton); 
};
addButton();

var myButtonDiv = document.getElementById("buttonDiv");
myButtonDiv.style.position = "fixed";
myButtonDiv.style.left = "0px";
myButtonDiv.style.bottom = "0px";
myButtonDiv.style.backgroundColor = "black";
===========================

After I upgraded to 57, clicking on the created "Start the Magic" button no 
longer does anything.

In JS console, upon clicking on the button I see:

"Client Error: "Error: Permission denied to access object" thrown at L1:1 
in https://www.reddit.com/r/pics/ Message: "Error: Permission denied to 
access object" 
Object { tag: "unknown" }
reddit-init.en.7vxo6_oFIqI.js:5:27446"

and

"Error: Permission denied to access object
pics:1:1"

I guess it has to do with the "unsafeWindow", but when I changed it to 
create the openAlltheTABS function in "window", I get error that the 
function is not found.

Is there any workaround I could use to get this functionality back?

Best regards,

depesz

-- 
You received this message because you are subscribed to the Google Groups 
"greasemonkey-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to greasemonkey-users+unsubscr...@googlegroups.com.
To post to this group, send email to greasemonkey-users@googlegroups.com.
Visit this group at https://groups.google.com/group/greasemonkey-users.
For more options, visit https://groups.google.com/d/optout.

Reply via email to