From 02ad95058182ddf25fcfe58c8ae3f27a9207af52 Mon Sep 17 00:00:00 2001 From: Gani Georgiev Date: Sun, 29 Aug 2021 11:21:57 +0300 Subject: [PATCH] [#5] added toggle to on/off the google search ratings blur --- css/google.css | 27 ++++++++++++++------------- js/google.js | 7 ++++++- js/options.js | 3 ++- manifest.json | 2 +- options.html | 6 +++++- 5 files changed, 28 insertions(+), 17 deletions(-) diff --git a/css/google.css b/css/google.css index ca7131d..2a7a60a 100644 --- a/css/google.css +++ b/css/google.css @@ -1,30 +1,31 @@ +g-review-stars, .f.slp, .yQ8hqd.ksSzJd.w6Utff, .dhIWPd { visibility: hidden; } +.settings-loaded g-review-stars, .settings-loaded .f.slp, .settings-loaded .yQ8hqd.ksSzJd.w6Utff, .settings-loaded .dhIWPd { visibility: visible; } -/* blur all rating elements for the cases when the rating source can't be identified */ -g-review-stars, -g-review-stars ~ span, -[data-attrid="kc:/ugc:user_reviews"], -[data-attrid="kc:/film/film:reviews"], -[data-attrid="kc:/book/book:reviews"], -[data-attrid="kc:/tv/tv_program:reviews"] { +.blur-ratings g-review-stars, +.blur-ratings g-review-stars ~ span, +.blur-ratings [data-attrid="kc:/ugc:user_reviews"], +.blur-ratings [data-attrid="kc:/film/film:reviews"], +.blur-ratings [data-attrid="kc:/book/book:reviews"], +.blur-ratings [data-attrid="kc:/tv/tv_program:reviews"] { filter: blur(15px); transition: filter 0.2s; } -g-review-stars:hover, -g-review-stars:hover ~ span, -[data-attrid="kc:/ugc:user_reviews"]:hover, -[data-attrid="kc:/film/film:reviews"]:hover, -[data-attrid="kc:/book/book:reviews"]:hover, -[data-attrid="kc:/tv/tv_program:reviews"]:hover { +.blur-ratings g-review-stars:hover, +.blur-ratings g-review-stars:hover ~ span, +.blur-ratings [data-attrid="kc:/ugc:user_reviews"]:hover, +.blur-ratings [data-attrid="kc:/film/film:reviews"]:hover, +.blur-ratings [data-attrid="kc:/book/book:reviews"]:hover, +.blur-ratings [data-attrid="kc:/tv/tv_program:reviews"]:hover { filter: blur(0); } diff --git a/js/google.js b/js/google.js index f8c7a72..2b0db00 100644 --- a/js/google.js +++ b/js/google.js @@ -14,11 +14,14 @@ var sourceIdentifiers = { }; // Load initial ratings visibility state from chrome.storage -chrome.storage.sync.get(Object.keys(sourceIdentifiers), function (items) { +chrome.storage.sync.get(Object.keys(sourceIdentifiers).concat('google'), function (items) { var urls = document.querySelectorAll('#search .g h3 ~ div cite'); var totalUrls = urls.length; var parent = null; + // check global search page ratings blur state + showRatings(!items.google, 'blur-ratings'); + // mark search items based on their source identifier for (let i = urls.length - 1; i >= 0; i--) { if (!urls[i].textContent) { @@ -49,4 +52,6 @@ chrome.runtime.onMessage.addListener(function (msg, sender, sendResponse) { for (let source in sourceIdentifiers) { showRatings(!msg[source], source + '-hide-ratings'); } + + showRatings(!msg.google, 'blur-ratings'); }); diff --git a/js/options.js b/js/options.js index 2c25981..7a3248c 100644 --- a/js/options.js +++ b/js/options.js @@ -6,7 +6,8 @@ 'imdb': false, 'mal': false, 'goodreads': false, - 'letterboxd': false + 'letterboxd': false, + 'google': false, }; // Checks if chrome storage is defined diff --git a/manifest.json b/manifest.json index 82fe08e..d059b87 100644 --- a/manifest.json +++ b/manifest.json @@ -2,7 +2,7 @@ "manifest_version": 2, "name": "Hide ratings (IMDB,Goodreads,MyAnimeList,...)", "description": "Protect you from other people influence by hiding the rating bars from IMDB, Goodreads, MyAnimeList and Letterboxd.", - "version": "1.7.1", + "version": "1.8.0", "browser_action": { "default_icon": "images/icon64.png", "default_popup": "options.html" diff --git a/options.html b/options.html index 7171f6e..67f4718 100644 --- a/options.html +++ b/options.html @@ -23,10 +23,14 @@ Hide Letterboxd ratings
+
+ Blur Google Search ratings +
+
- +