You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

23 lines
1.0 KiB

(function() {
const activeElement = document.activeElement;
var inputs = ["input", "select", "textarea"];
var pageUrl = window.location.href;
var tagName = activeElement.tagName.toLowerCase();
if (pageUrl === "https://mail.qq.com/" && activeElement) {
// QQ mail have some security mechanism that we can't fetch value of activeElement.
// So we just return empty string make is_focus method works well in browser.py
return "";
} else if (activeElement && inputs.indexOf(tagName) !== -1) {
return activeElement.value;
} else {
if (pageUrl.startsWith("https://web.telegram.org/") && activeElement.hasAttribute("placeholder")) {
return activeElement.textContent;
} else if ((pageUrl.startsWith("https://console.cloud.google.com/") || pageUrl.startsWith("https://ssh.cloud.google.com/")) && tagName == "iframe") {
// Make user can type text in Terminal of Google Cloud.
return "";
} else {
return undefined;
}
}
})();