var down = document.querySelector('a[href^="/get.php"]');

var anothernewItem = document.createElement("a");
anothernewItem.setAttribute("target", "_blank");
anothernewItem.setAttribute("title", "pcloud offline");
anothernewItem.setAttribute("href", "https://my.pcloud.com/";);
var anothertextnode = document.createTextNode("Offline");
anothernewItem.appendChild(anothertextnode);
anothernewItem.setAttribute("style", "position: absolute; margin-top: 0px; 
margin-left: 0px; background-image: 
url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAXVBMVEX///////8bytT///8fy9UbytQbytQfy9Ufy9UmzNYbytQgy9UizNUbytT///8bytQey9Ufy9Ugy9VG1NxB09sbytRg2uFS194bytT///9G1Nzx/Pzi+PpT19+c6OxZ7rqXAAAAGHRSTlMBG/AHxYAh49O3oWJBMRUR4bOLYV9RQz9fW5zbAAAAbUlEQVQY043MRxLCMBBE0WYkOQcyXybc/5hIhUuww2/3u2pGG1WdYV1VujcyG9ceWdmcM8jDK8bHE0LqCzMQF5Y7NOnNgeE7MATBMQ+fE/q9wCwNkDUetUAZPLVuxq+z3LWlqE9OctOumFL/9QYClwvt3NkDkgAAAABJRU5ErkJggg==');
 
background-color: rgb(241, 241, 241);");
down.parentNode.insertBefore(anothernewItem, down);

anothernewItem.click(function (event) {
GM_setValue("eoUrl", document.querySelector('a[href^="/get.php"]').href);
});
alert(GM_getValue("eoUrl"));

(function () {
if (location.href.indexOf("my.pcloud.com") != -1) {
//window.clearInterval(t);
curlink = GM_getValue('eoUrl');
if (curlink) {
var psc = setInterval(function () {
var upBtn = document.querySelector('div.upload_button');
if (upBtn) {
clearInterval(psc);
upBtn.click();
document.querySelector('span.remoteupload-ctrl').click();
var remotearea = document.querySelector('textarea.remotearea');
remotearea.value = curlink;
remotearea.nextSibling.click();
}
}, 500);
GM_deleteValue('eoUrl');
}
}
}
());


When I click the link in the first page, it opens pcloud page.
Error:
TypeError: Cannot read property 'href' of null

How can I handle this?

To get the variable 'eoUrl' from GM_setValue() in the first page.
And send it to opened pcloud page with GM_getValue('eoUrl') ?



-- 
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 [email protected].
To post to this group, send email to [email protected].
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