class GotoMeeting {
constructor() {
//get the dom element
let self = this;
this.audioBtn = null;
this.email = null;
this.name = null;
self.clicked = false;
}
getElement() {
let target = document.body;
let MutationObserver =
window.MutationObserver ||
window.WebKitMutationObserver ||
window.MozMutationObserver;
let mutation = new MutationObserver(mutations => {
mutations.forEach(function(mutation) {
console.log(mutation.type);
});
this.audioBtn = document.getElementById("select-audio-none");
let emailBtn = document.getElementById("join-email");
let nameBtn = document.getElementById("join-name");
let submitBtn = document.getElementById("join-submit");
if (this.audioBtn) {
this.audioBtn.click();
}
if (emailBtn && nameBtn) {
if (this.email !== null && this.name !== null) {
emailBtn.value = this.email;
nameBtn.value = this.name;
if (self.clicked === false && emailBtn.value && nameBtn.value) {
submitBtn.click();
self.clicked === true;
console.log("it worked :)")
}
}else{
setTimeout(()=>{checkDetail()},1000);
}
this.triggerMouseEvent(nameBtn, "keydown");
}
});
let config = {
childList: true,
subtree: true
};
mutation.observe(target, config);
}
triggerMouseEvent(node, eventType) {
let keyboardEvent = new KeyboardEvent(eventType);
node.dispatchEvent(keyboardEvent);
}
}
let gotomeeting = new GotoMeeting();
gotomeeting.getElement();
iam调用getElement()
方法的原因是因为它必须在页面加载时加载,因为它有变异观察者。
我从另一个网站上获取了一些电子邮件和名字,我也得到了
响应,但在确定此对象的值gotomeeting
时不起作用
并且检查电子邮件的if语句没有执行
gotomeeting.email = (response from other site)
任何人都可以告诉我为什么回应没有将价值赋予
gotomeeting object property email and name