I tried to run the next code with Gracemonkey:
var myWindow = null;
var setTiming = 5; //sec
var isMSGOUT = 0;
var msgs = [];
function us_openWAwindows() {
myWindow = window.open("", "_blank", "toolbar=no,scrollbars=no,resizable=yes,top=500,left=500,width=400,height=400");
myWindow.document.body.innerHTML = "<p>Plz wait, loading...</p>";
//document.getElementById("startButton").disabled = true;
var main = document.getElementById("main").getElementsByClassName("message-list");
var list = main[0].getElementsByClassName("msg");
var i;
for (i = 0; i < list.length; i++) {
list[i].innerHTML += '<button type="button" class="addButton" onclick="javascript:addNewMsg(this.parentElement)">Add</button>';
}
us_loadNewMsg();
}
function us_loadNewMsg() {
if (msgs.length > 0)
{
myWindow.document.body.innerHTML = "<h3>" + msgs[0][0] + "</h3>";
if ( msgs[0][2] == 1 )
{
myWindow.document.body.innerHTML += "<img id='showIMG' src='" + msgs[0][1].src + "' style='height:" + msgs[0][1].height +"'>";
}
else
{
myWindow.document.body.innerHTML += msgs[0][1];
}
msgs.shift();
isMSGOUT=0;
} else if (isMSGOUT == 0) { myWindow.document.body.innerHTML += "<br /><br />add new"; isMSGOUT=1;}
us_timing();
}
function us_timing() {
setTimeout(loadNewMsg, setTiming*1000);
}
function us_addNewMsg(thisMSG) {
if ( thisMSG.getElementsByClassName("message-text").length > 0 )
{
msgs.push ([ thisMSG.getElementsByClassName("message-author")[0].getElementsByClassName("emojitext")[0].innerHTML,
thisMSG.getElementsByClassName("message-text")[0].getElementsByClassName("emojitext")[0].innerHTML,
0
]);
}
else if ( thisMSG.getElementsByClassName("image-thumb").length > 0 )
{
msgs.push ([ thisMSG.getElementsByClassName("message-author")[0].getElementsByClassName("emojitext")[0].innerHTML,
thisMSG.getElementsByClassName("image-thumb")[0].getElementsByClassName("image-thumb-body")[0],
1
]);
}
thisMSG.getElementsByClassName("addButton")[0].disabled = true;
}
document.body.innerHTML += '<div style="position:absolute;bottom:20px;right:20px;z-index:80;border:1px black solid"><button type="button" id="startButton" onclick="javascript:us_openWAwindows()">Start</button></div>';
however, it's add the button, but cannot click on it...
I tried bypass it and run
us_openWAwindows
, but it won't work
--
You received this message because you are subscribed to the Google Groups "JavaScript Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
javascript-information+unsubscribe@googlegroups.com.
For more options, visit
https://groups.google.com/d/optout.