Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Google search result image/video thumbnails #2476

Merged
merged 1 commit into from
Oct 8, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/js/firstparties/google-search.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@ let trap_link = "a[onmousedown^='return rwt(this,'], a[ping]";

// Remove excessive attributes and event listeners from link a
function cleanLink(a) {
// remove all attributes from a link except for href,
// remove all attributes except for href,
// target (to support "Open each selected result in a new browser window"),
// class and ARIA attributes
// class, style and ARIA attributes
for (let i = a.attributes.length - 1; i >= 0; --i) {
const attr = a.attributes[i];
if (attr.name !== 'href' && attr.name !== 'target' &&
attr.name !== 'class' && !attr.name.startsWith('aria-')) {
attr.name !== 'class' && attr.name !== 'style' &&
!attr.name.startsWith('aria-')) {
a.removeAttribute(attr.name);
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/js/firstparties/google-static.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ function unwrapLink(a) {
return;
}

// remove all attributes from a link except for target, class, and aria-*
// remove all attributes except for target, class, style and aria-*
// attributes. This should prevent the script from breaking styles and
// features for people with disabilities.
for (let i = a.attributes.length - 1; i >= 0; --i) {
const attr = a.attributes[i];
if (attr.name !== 'target' && attr.name !== 'class' &&
!attr.name.startsWith('aria-')) {
attr.name !== 'style' && !attr.name.startsWith('aria-')) {
a.removeAttribute(attr.name);
}
}
Expand Down