Skip to content
This repository was archived by the owner on Jan 23, 2025. It is now read-only.

Commit 8aac563

Browse files
authored
Add Edg/0.0 hint at the user-agent in MS Edge addon store
1 parent 71dfde1 commit 8aac563

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

chrome/android/java/src/org/chromium/chrome/browser/PersonalizeResults.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public static void Execute(Tab tab) {
3030
tab.getWebContents().evaluateJavaScript("(function() { function createProperty(value){var _value=value;function _get(){return _value}function _set(v){_value=v}return{'get':_get,'set':_set}};function makePropertyWritable(objBase,objScopeName,propName,initValue){var newProp,initObj;if(objBase&&objScopeName in objBase&&propName in objBase[objScopeName]){if(typeof initValue==='undefined'){initValue=objBase[objScopeName][propName]}newProp=createProperty(initValue);try{Object.defineProperty(objBase[objScopeName],propName,newProp)}catch(e){initObj={};initObj[propName]=newProp;try{objBase[objScopeName]=Object.create(objBase[objScopeName],initObj)}catch(e){}}}}; makePropertyWritable(window, 'navigator', 'userAgent'); window.navigator.userAgent='Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.90 Safari/537.36'; 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);
3131
}
3232
if (tab != null && tab.getUrl().startsWith("https://microsoftedge.microsoft.com/addons")) {
33-
tab.getWebContents().evaluateJavaScript("(function() { window.addEventListener('load', function() { 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.style.opacity='1'; individualButton.style.background='rgb(0, 120, 212) !important'; individualButton.onclick = function () { var addonId = this.id.split('-')[1]; window.location.replace('https://edge.microsoft.com/extensionwebstorebase/v1/crx?response=redirect&acceptformat=crx3&x=id%3D' + addonId + '%26installsource%3Dondemand%26uc'); } }); }); })();", null);
33+
tab.getWebContents().evaluateJavaScript("(function() { function createProperty(value){var _value=value;function _get(){return _value}function _set(v){_value=v}return{'get':_get,'set':_set}};function makePropertyWritable(objBase,objScopeName,propName,initValue){var newProp,initObj;if(objBase&&objScopeName in objBase&&propName in objBase[objScopeName]){if(typeof initValue==='undefined'){initValue=objBase[objScopeName][propName]}newProp=createProperty(initValue);try{Object.defineProperty(objBase[objScopeName],propName,newProp)}catch(e){initObj={};initObj[propName]=newProp;try{objBase[objScopeName]=Object.create(objBase[objScopeName],initObj)}catch(e){}}}}; makePropertyWritable(window, 'navigator', 'userAgent'); window.navigator.userAgent=window.navigator.userAgent + ' Edg/0.0'; window.addEventListener('load', function() { 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.style.opacity='1'; individualButton.style.background='rgb(0, 120, 212) !important'; individualButton.onclick = function () { var addonId = this.id.split('-')[1]; window.open('https://edge.microsoft.com/extensionwebstorebase/v1/crx?response=redirect&acceptformat=crx3&x=id%3D' + addonId + '%26installsource%3Dondemand%26uc', '_blank'); } }); }); })();", null);
3434
}
3535
if (tab != null && tab.getUrl().startsWith("https://translate.google.com/translate_c")) {
3636
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);

0 commit comments

Comments
 (0)