|
|
|
|
@ -1,17 +1,20 @@ |
|
|
|
|
(function() { |
|
|
|
|
const activeElement = document.activeElement; |
|
|
|
|
var inputs = ["input", "select", "textarea"]; |
|
|
|
|
var pageUrl = window.location.href; |
|
|
|
|
var tagName = activeElement.tagName.toLowerCase(); |
|
|
|
|
|
|
|
|
|
if (window.location.href === "https://mail.qq.com/" && activeElement) { |
|
|
|
|
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(activeElement.tagName.toLowerCase()) !== -1) { |
|
|
|
|
} else if (activeElement && inputs.indexOf(tagName) !== -1) { |
|
|
|
|
return activeElement.value; |
|
|
|
|
} else { |
|
|
|
|
if (window.location.href.startsWith("https://web.telegram.org/") && activeElement.hasAttribute("placeholder")) { |
|
|
|
|
if (pageUrl.startsWith("https://web.telegram.org/") && activeElement.hasAttribute("placeholder")) { |
|
|
|
|
return activeElement.textContent; |
|
|
|
|
} else if ((window.location.href.startsWith("https://console.cloud.google.com/") || window.location.href.startsWith("https://ssh.cloud.google.com/")) && activeElement.tagName.toLowerCase() == "iframe") { |
|
|
|
|
} 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; |
|
|
|
|
|