//関数:自動ポスト(ボタン一覧でのみ使用可能)
function autopost(_element, _text){
scrolllockstop = 1;
try{
var a = _element.parentNode.parentNode;
var b = _element; //ポスト全体
while(1){
a = a.nextSibling;
try{
if(a.getAttribute("role")=="button"){
var c = document.createEvent("MouseEvents");
c.initEvent("click", true, false);
a.dispatchEvent(c);
setTimeout(function(){
var d = b.getElementsByTagName("div");
var e = d.length;
for (var f=0; f < e; f++) {
if(d[f].id.match(reg_e)){
try{
var g = document.createEvent("TextEvent");
g.initTextEvent ('textInput', true, true, null, _text);
d[f].firstChild.firstChild.dispatchEvent(g);
var g = document.createEvent("KeyboardEvent");
g.initKeyboardEvent("keypress", true, false, window, 13, false, false, false, "", false);
d[f].firstChild.firstChild.dispatchEvent(g);
}catch( _error ){
d[f].firstChild.firstChild.firstChild.contentDocument.body.innerHTML = _text+"<br>";
var g = document.createEvent("KeyboardEvent");
g.initKeyEvent ("keypress", true, true, window, false, false, false, false, 0, 13);
d[f].firstChild.firstChild.firstChild.contentDocument.body.dispatchEvent(g);
}
var c = document.createEvent("MouseEvents");
c.initEvent("mousedown", true, true);
d[f].nextSibling.dispatchEvent(c);
var c = document.createEvent("MouseEvents");
c.initEvent("mouseup", true, true);
d[f].nextSibling.dispatchEvent(c);
break;
}
}
}, 150);
return;
}
}catch( _error ){
}
}
}catch( _error ){
}
}
More than 5 years have passed since last update.
Register as a new user and use Qiita more conveniently
- You get articles that match your needs
- You can efficiently read back useful information
- You can use dark theme