Skip to content

Commit 0b29744

Browse files
committed
1.4.11 process images in all of google.com/search
1 parent b7ce593 commit 0b29744

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

script.user.js

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
// @grant GM.setValue
2626
// @grant GM.xmlHttpRequest
2727
//
28-
// @version 1.4.10
28+
// @version 1.4.11
2929
// @author tophf
3030
//
3131
// @original-version 2017.9.29
@@ -1636,17 +1636,21 @@ const Ruler = {
16361636
}`,
16371637
}); break;
16381638

1639-
case 'google': if (/[&?](sclient=img|udm=2)(&|$)/.test(location.search)) rules.push({
1640-
e: '[data-docid] img',
1641-
s: (m, el) => {
1642-
const {docid} = (el = el.closest('[data-docid]')).dataset;
1639+
case 'google': if (location.pathname === '/search') rules.push({
1640+
e: /[&?](sclient=img|udm=2)(&|$)/.test(location.search)
1641+
? '[data-docid] img'
1642+
: '[jsdata][id] img',
1643+
s: (m, el, rule) => {
1644+
el = el.closest(rule.e.split(' ')[0]);
1645+
const id = el.dataset.docid || el.id;
16431646
if (isFF) el = el.wrappedJSObject || el;
16441647
if ((el = el.__jscontroller) && (el = el.pending) && (el = el.value))
16451648
for (let a in el)
16461649
if (({}).toString.call(a = el[a]) === '[object Object]')
16471650
for (const b in a)
1648-
if (Array.isArray(m = a[b]) && m.includes(docid) && (m = m[1])
1649-
&& Array.isArray(m = m[b]) && m[1] === docid && Array.isArray(m = m[3]))
1651+
if (Array.isArray(m = a[b]) && m.includes(id)
1652+
&& (m[1] === id || (m = m[1]) && Array.isArray(m = m[b]) && m[1] === id)
1653+
&& Array.isArray(m = m[3]))
16501654
return m[0];
16511655
},
16521656
}); break;

0 commit comments

Comments
 (0)