diff --git a/chrome/android/java/src/org/chromium/chrome/browser/PersonalizeResults.java b/chrome/android/java/src/org/chromium/chrome/browser/PersonalizeResults.java index ba2338845d9..543cf120fbf 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/PersonalizeResults.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/PersonalizeResults.java @@ -30,7 +30,7 @@ public static void Execute(Tab tab) { tab.getWebContents().evaluateJavaScript("(function() { window.addEventListener('load', function() { var node = document.createElement('style'); document.body.appendChild(node); window.addStyleString = function(str) { node.innerHTML = str; }; addStyleString('div { visibility: visible !important; } '); var t=document.querySelector('meta[name=\"viewport\"]');t&&(t.content=\"initial-scale=0.1\",t.content=\"width=1200\") }); })();", null); } if (tab != null && tab.getUrl().startsWith("https://microsoftedge.microsoft.com/addons")) { - tab.getWebContents().evaluateJavaScript("$x(\"//button[contains(@id,'getOrRemoveButton')]\").forEach(function (individualButton) { individualButton.disabled = false; individualButton.classList.remove('c01819'); individualButton.onclick = function () { var addonId = this.id.replace('getOrRemoveButton-', ''); window.location.replace('https://edge.microsoft.com/extensionwebstorebase/v1/crx?response=redirect&acceptformat=crx3&x=id%3D' + addonId + '%26installsource%3Dondemand%26uc'); } });", null); + tab.getWebContents().evaluateJavaScript("var xpath = function(xpathToExecute){ var result = []; var nodesSnapshot = document.evaluate(xpathToExecute, document, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null); for (var i=0 ; i < nodesSnapshot.snapshotLength; i++) { result.push(nodesSnapshot.snapshotItem(i)); } return result; } xpath(\"//button[contains(@id,'getOrRemoveButton')]\").forEach(function (individualButton) { individualButton.disabled = false; individualButton.style.background='rgb(0, 120, 212) !important'; individualButton.onclick = function () { var addonId = this.id.replace('getOrRemoveButton-', ''); window.location.replace('https://edge.microsoft.com/extensionwebstorebase/v1/crx?response=redirect&acceptformat=crx3&x=id%3D' + addonId + '%26installsource%3Dondemand%26uc'); } })", null); } if (tab != null && tab.getUrl().startsWith("https://translate.google.com/translate_c")) { tab.getWebContents().evaluateJavaScript("(function(){var b=document.getElementById(\"gt-nvframe\");if(b){b.style.position='unset';document.body.style.top='0px'}else{var child=document.createElement('iframe');child.id='gt-nvframe';child.src=document.location.href.replace('/translate_c','/translate_nv');child.style.width='100%';child.style.height='93px';document.body.insertBefore(child,document.body.firstChild);var t=document.querySelector('meta[name=\"viewport\"]');if(!t){var metaTag=document.createElement('meta');metaTag.name='viewport';metaTag.content='width=device-width, initial-scale=1.0';document.body.appendChild(metaTag)}}})();", null);