Skip to content

Commit eed7736

Browse files
committed
Add workaround for image search mode
1 parent b2aa900 commit eed7736

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

main.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,19 @@ function process(details) {
1111
return;
1212
}
1313

14+
// Detect if we are in image search, don't do anything.
15+
// Otherwise this addon breaks image search...
16+
// Seems to work fine other modes.
17+
if (details.url.includes('udm=2')) {
18+
return;
19+
}
20+
21+
// add &udm=14 if URL already has search string, otherwise ?udm=14
1422
let udm14 = (details.url.includes('?') ? '&' : '?') + 'udm=14';
1523

16-
// check it doesn't have udm=14
1724
if (is_active && !details.url.includes('udm=14')) {
18-
// add &udm=14 if URL already has search string, otherwise ?udm=14
1925
return {redirectUrl: details.url + udm14};
2026
} else if (!is_active && !details.url.includes('udm=14')) {
21-
// Otherwise simply remove it
2227
return {redirectUrl: details.url.replace(udm14,'')};
2328
}
2429
}

manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"manifest_version": 2,
44
"name": "Straight to the web",
55
"homepage_url": "https://github.com/ShadowMitia/Straight-to-the-web",
6-
"version": "0.1",
6+
"version": "0.2",
77
"description": "Forces all Google searches to use the new 'Web' mode by appending links with udm=14",
88
"permissions": [
99
"webRequest",

0 commit comments

Comments
 (0)