Skip to content

Commit

Permalink
Update MS Edge add-ons executed code
Browse files Browse the repository at this point in the history
  • Loading branch information
kiwibrowser authored Oct 6, 2020
1 parent 15020cb commit cbfea6d
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit cbfea6d

Please sign in to comment.