Make get_focus_text and set_focus_text support Telegram Web's input widget.

master
Andy Stewart 6 years ago
parent abf0c081b3
commit 7691d1b90e
  1. 6
      core/js/get_focus_text.js
  2. 7
      core/js/set_focus_text.js

@ -5,6 +5,10 @@
if (activeElement && inputs.indexOf(activeElement.tagName.toLowerCase()) !== -1) {
return activeElement.value;
} else {
return undefined;
if (window.location.href.startsWith("https://web.telegram.org/") && activeElement.hasAttribute("placeholder")) {
return activeElement.textContent;
} else {
return undefined;
}
}
})();

@ -1,7 +1,12 @@
(function() {
let newText = "%1";
const activeElement = document.activeElement;
activeElement.value = decodeURIComponent(escape(window.atob(newText)));
if (window.location.href.startsWith("https://web.telegram.org/")) {
activeElement.textContent = decodeURIComponent(escape(window.atob(newText)));
} else {
activeElement.value = decodeURIComponent(escape(window.atob(newText)));
}
// Note: simulate input event on active element after set focus text.
// Some website need input event before submit form.

Loading…
Cancel
Save