From 2332fb41e34441f34c267d15a8c3ee47953f479a Mon Sep 17 00:00:00 2001 From: darkred Date: Thu, 17 Feb 2022 20:35:29 +0200 Subject: [PATCH 01/43] Add `security-and-quality` analysis suite See: - https://github.blog/2022-02-17-code-scanning-finds-vulnerabilities-using-machine-learning/ - https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs --- .github/workflows/codeql-analysis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index e610910..b9d2149 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -50,6 +50,7 @@ jobs: # By default, queries listed here will override any specified in a config file. # Prefix the list here with "+" to use these queries and those in the config file. # queries: ./path/to/local/query, your-org/your-repo/queries@main + queries: +security-and-quality # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). # If this step fails, then you should remove it and run the build manually (see below) From 83cea7fed1f2c0e5e0570763df6a446396673b7c Mon Sep 17 00:00:00 2001 From: darkred Date: Thu, 7 Apr 2022 23:43:13 +0300 Subject: [PATCH 02/43] Create dependency-review.yml --- .github/workflows/dependency-review.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 .github/workflows/dependency-review.yml diff --git a/.github/workflows/dependency-review.yml b/.github/workflows/dependency-review.yml new file mode 100644 index 0000000..f2605b7 --- /dev/null +++ b/.github/workflows/dependency-review.yml @@ -0,0 +1,14 @@ +name: 'Dependency Review' +on: [pull_request] + +permissions: + contents: read + +jobs: + dependency-review: + runs-on: ubuntu-latest + steps: + - name: 'Checkout Repository' + uses: actions/checkout@v3 + - name: 'Dependency Review' + uses: actions/dependency-review-action@v1 From efc693d60485d3af52b2201212525e51a9c224c6 Mon Sep 17 00:00:00 2001 From: darkred Date: Sat, 7 May 2022 20:18:26 +0300 Subject: [PATCH 03/43] Update ProtonMail_-_remove_forced_signature.user.js Updated iframe selector after recent html changes. Closes #48 --- .../ProtonMail_-_remove_forced_signature.user.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ProtonMail_-_remove_forced_signature/ProtonMail_-_remove_forced_signature.user.js b/ProtonMail_-_remove_forced_signature/ProtonMail_-_remove_forced_signature.user.js index cbd365e..d58b0ec 100644 --- a/ProtonMail_-_remove_forced_signature/ProtonMail_-_remove_forced_signature.user.js +++ b/ProtonMail_-_remove_forced_signature/ProtonMail_-_remove_forced_signature.user.js @@ -1,7 +1,7 @@ // ==UserScript== // @name ProtonMail - remove forced signature // @namespace darkred -// @version 2021.6.9 +// @version 2022.5.7 // @description Removes the forced ProtonMail signature from the 'New message' textboxes // @author darkred // @license MIT @@ -13,7 +13,7 @@ // @icon https://protonmail.com/images/favicon.ico // ==/UserScript== -const elementToWatch = 'iframe[title="Editor"]'; +const elementToWatch = 'iframe[title="Email composer"]'; document.arrive(elementToWatch, function () { let iframe = this.contentDocument; // refers to the newly created element From d6fa68f8b17d51ba6f2df28a78c4050f74cfd111 Mon Sep 17 00:00:00 2001 From: darkred Date: Sat, 14 May 2022 20:23:22 +0300 Subject: [PATCH 04/43] Update after recent html changes --- ...d_add_link_to_the_FB_comments_area.user.js | 113 +++++++++--------- 1 file changed, 57 insertions(+), 56 deletions(-) diff --git a/Blabbermouth_-_generate_timestamps_and_add_link_to_the_FB_comments_area/Blabbermouth_-_generate_timestamps_and_add_link_to_the_FB_comments_area.user.js b/Blabbermouth_-_generate_timestamps_and_add_link_to_the_FB_comments_area/Blabbermouth_-_generate_timestamps_and_add_link_to_the_FB_comments_area.user.js index 7d18c7c..d28f711 100644 --- a/Blabbermouth_-_generate_timestamps_and_add_link_to_the_FB_comments_area/Blabbermouth_-_generate_timestamps_and_add_link_to_the_FB_comments_area.user.js +++ b/Blabbermouth_-_generate_timestamps_and_add_link_to_the_FB_comments_area/Blabbermouth_-_generate_timestamps_and_add_link_to_the_FB_comments_area.user.js @@ -1,18 +1,18 @@ // ==UserScript== // @name Blabbermouth - generate timestamps and add link to the fb comments area // @namespace darkred -// @version 1.3 -// @date 2022.1.8 +// @version 2.0 +// @date 2022.5.14 // @description Generates missing timestamps or converts the existing ones in relative format, and adds link to the fb comments area // @author darkred // @license MIT -// @include /^(https?:)?\/\/(www\.)?blabbermouth\.net\/(news|cdreviews|dvdreviews)?/ -// @exclude /^(https?:)?\/\/(www\.)?blabbermouth\.net\/(cdreviews|dvdreviews)(\/page|$)/ +// @include /^(https?:)?\/\/(www\.)?blabbermouth\.net\/(news|reviews)?/ +// @exclude /^(https?:)?\/\/(www\.)?blabbermouth\.net\/reviews(\/page|$)/ // @include https://www.facebook.com/plugins/feedback.php* // @grant none // @require https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.24.0/moment.min.js // @supportURL https://github.com/darkred/Userscripts/issues -// @icon https://www.blabbermouth.net/assets/favicon-309148577f1b67c003487c069cccf8731e6f68e4d847c5576d6f5453b083c27a.png +// @icon https://drnizx3otcofi.cloudfront.net/b64e6010-2ac1-4e95-b545-1a2994bbbd04/img/favicon/favicon-32x32.png // ==/UserScript== @@ -43,11 +43,12 @@ moment.updateLocale('en', { function convertToLocalTimezone(timestamp) { // (the timestamp is in ISO 8601 format and its trailing Z means that it's in UTC ) - // 2020-03-05T15:40:38.000Z + // 2020-03-05T15:40:38.000Z old + // 2022-05-11T12:16:05+00:00 new let initialTimestamp = timestamp; if (moment(initialTimestamp, moment.ISO_8601, true).isValid()) { // let convertedToLocalTimezone = moment(initialTimestamp.replace('Z','') + '-05:00', 'YYYY-MM-DDTHH:mm:ssZ'); // the server's timezone is GMT-5 - let convertedToLocalTimezone = moment(initialTimestamp.replace('Z','') + '-03:47', 'YYYY-MM-DDTHH:mm:ssZ'); // the server's timezone is GMT-4 plus 13 min, in order to sync with the relevant post timestamps in both Facebook and Twitter(TW is 1 min later than FB) blabbbermouth pages + let convertedToLocalTimezone = moment(initialTimestamp + '-03:47', 'YYYY-MM-DDTHH:mm:ss+Z'); // the server's timezone is GMT-4 plus 13 min, in order to sync with the relevant post timestamps in both Facebook and Twitter(TW is 1 min later than FB) blabbbermouth pages publishedTimeLTZ = convertedToLocalTimezone.fromNow(); let format = 'YYYY-MM-DD HH:mm:ss'; publishedTimeLTZtitle = convertedToLocalTimezone.format(format); @@ -65,6 +66,11 @@ function recalc(existingTimestampElement, format, notitle) { } +function onClick(){ + document.querySelector('iframe[title="fb:comments Facebook Social Plugin"]').scrollIntoView(); +} + + // 1. IF ON NEWS PAGES LISTINGS (convertTolocal + apply to pagination) if ( window.location.href.endsWith('blabbermouth.net/') || @@ -87,8 +93,8 @@ if ( if (entry.isIntersecting && !entry.target.classList.contains('in-viewport') ) { entry.target.classList.add('in-viewport'); - var xhr = new XMLHttpRequest(); - var url = entry.target.parentElement.parentElement.firstElementChild.firstElementChild.href; + const xhr = new XMLHttpRequest(); + const url = entry.target.parentElement.parentElement.firstElementChild.firstElementChild.href; xhr.open('GET', url, true); // XMLHttpRequest.open(method, url, async) xhr.onload = function () { @@ -114,7 +120,7 @@ if ( let observer = new IntersectionObserver(callback, options); - var allTimestamps = document.querySelectorAll('span.date-time'); + let allTimestamps = document.querySelectorAll('.news-single span.date'); allTimestamps.forEach((element) => { observer.observe(element); }); @@ -122,13 +128,13 @@ if ( // ---------------------------------------- // Watch for pagination events (when new '.article' children are added inside the '.infinite_scroll' element) - const targetNode2 = document.querySelector('.infinite_scroll'); + const targetNode2 = document.querySelector('.infinite-scroll-component'); const config2 = { attributes: false, childList: true, subtree: false }; const callback2 = function(mutationsList) { for(const mutation of mutationsList) { if (mutation.type === 'childList') { - var allTimestamps = document.querySelectorAll('span.date-time'); + let allTimestamps = document.querySelectorAll('.news-single span.date'); allTimestamps.forEach((element) => { observer.observe(element); }); @@ -140,13 +146,13 @@ if ( observer2.observe(targetNode2, config2); // ---------------------------------------- -// 2+3. ELSE IF ON CD/DVD PAGE REVIEWS ((convertTolocal + generate timestamp) -} else if -(( window.location.href.includes('blabbermouth.net/cdreviews/') || - window.location.href.includes('blabbermouth.net/dvdreviews/') || - window.location.href.includes('blabbermouth.net/news/') ) - && !window.location.href.includes('/page/')) -{ + + // /blabbermouth\.net/\(reviews|news)/i.test(window.location.href) + +// 2+3. ELSE IF ON CD/DVD REVIEWS OR NEWS PAGES ((convertTolocal + generate timestamp) +} else if ( /blabbermouth\.net\/(reviews|news)/i.test(window.location.href) && + !window.location.href.includes('/page/') ) { + //--- Double-check that this iframe is on the expected domain: if (/blabbermouth\.net/i.test(location.host)) { console.log('Userscript is in the MAIN page.'); @@ -154,8 +160,9 @@ if ( // 2019-10-17T15:32:18.000Z + let publishedTimestamp; if (document.querySelector('meta[property="article:published_time"]') !== null) { - var publishedTimestamp = document.querySelector('meta[property="article:published_time"]').content; + publishedTimestamp = document.querySelector('meta[property="article:published_time"]').content; } console.log('publishedTimestamp: ' + publishedTimestamp); @@ -167,7 +174,7 @@ if ( convertToLocalTimezone(publishedTimestamp); - let existingTimestampElement = document.querySelector('.date-time'); + let existingTimestampElement = document.querySelector('div > h1+span.date'); existingTimestampElement.textContent = publishedTimeLTZ; existingTimestampElement.title = publishedTimeLTZtitle; @@ -183,56 +190,50 @@ if ( - if (!window.location.href.includes('blabbermouth.net/news/')){ - - - var currentURL = window.location.href; + if (!window.location.href.includes('blabbermouth.net/news/page/')){ convertToLocalTimezone(publishedTimestamp); var commentcount = '0'; + var datePart = !window.location.href.includes('blabbermouth.net/news/') ? `${publishedTimeLTZ}` : ''; + var HTML = ` -
+ +${commentcount} Comments -

+
`; + const refSelector = '.reviews-single-article > div > .reviews-rate-comments,div > h1+span.date'; - if (document.querySelector('.entry-content') !== null) { - document - .querySelector('.entry-content') - .insertAdjacentHTML('beforebegin', HTML); - document.querySelector('.date-time').title = publishedTimeLTZtitle; + if (document.querySelector(refSelector) !== null) { + document.querySelector(refSelector).insertAdjacentHTML('afterend', HTML); + document.querySelector(refSelector).title = publishedTimeLTZtitle; - let newDateTimeElement = document.querySelector('.date-time'); + document.getElementById('commentCount').addEventListener('click', onClick, false); + + let newDateTimeElement = document.querySelector('span.date'); recalc(newDateTimeElement, 'YYYY-MM-DD HH:mm:ss'); } } // Wait for messages [commentcount] (from iframe) - window.addEventListener( - 'message', - function addFbCounter(e) { - // something from an unknown domain, or doesn't contain the string "Comment" let's ignore it - // console.log('Received message: ' + e.data); - if (e.origin !== 'https://www.facebook.com' || e.data.indexOf(' Comment') === -1) { - return; - } - console.log('Received message: ' + e.data); - document.querySelector( - '#main > article > p > span.date-comments > a:nth-child(1), #main header > p > span.date-comments > a:nth-child(1)' - ).innerText = e.data.replace(/ Comments?/i,''); - window.removeEventListener('message', addFbCounter); - }, - false + window.addEventListener('message', function addFbCounter(e) { + // something from an unknown domain, or doesn't contain the string "Comment" let's ignore it + console.log('Received message: ' + e.data); + if (e.origin !== 'https://www.facebook.com' || e.data.indexOf(' Comment') === -1) { + return; + } + console.log('Received message: ' + e.data); + // document.querySelector('#commentCount').innerText = e.data.replace(/ Comments?/i,''); + document.querySelector('#commentCount').innerText = e.data; + window.removeEventListener('message', addFbCounter); + }, + false ); console.log('Waiting for Message 1, from iframe...'); } @@ -245,10 +246,10 @@ if (window.location.href.includes('facebook.com')) { console.log('Userscript is in the FRAMED page.'); - var selector = '._50f7'; + const selector = '._50f7'; // Send commentcount to MAIN page window.parent.postMessage( document.querySelector(selector).innerText, - 'https://www.blabbermouth.net/cdreviews/' + 'https://blabbermouth.net/reviews/' ); } From 871be7fab8183b55983af7dab45038c8286e472d Mon Sep 17 00:00:00 2001 From: darkred Date: Sun, 15 May 2022 20:33:06 +0300 Subject: [PATCH 05/43] There are now two occurrences of '3.5 stars or higher' in the AUDIENCE descriptive text overlay hence the change to `querySelectorAll()` . --- .../Rotten_Tomatoes_Decimal_Rating.user.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/Rotten_Tomatoes_Decimal_Rating/Rotten_Tomatoes_Decimal_Rating.user.js b/Rotten_Tomatoes_Decimal_Rating/Rotten_Tomatoes_Decimal_Rating.user.js index b50d9d1..696d328 100644 --- a/Rotten_Tomatoes_Decimal_Rating/Rotten_Tomatoes_Decimal_Rating.user.js +++ b/Rotten_Tomatoes_Decimal_Rating/Rotten_Tomatoes_Decimal_Rating.user.js @@ -1,7 +1,7 @@ // ==UserScript== // @name Rotten Tomatoes Decimal Rating // @namespace darkred -// @version 6.0.1 +// @version 6.0.2 // @description Changes base-5 Rating of Rotten Tomatoes to base-10 // @author wOxxOm, darkred // @license MIT @@ -104,15 +104,18 @@ scoreBoard.onclick = function(event) { buttonQuestionmarkAudienceScore.addEventListener('click', function(){ - let descriptiveTextAudienceScode = document.querySelector('#mainColumn > overlay-base > score-details > score-details-audience > tool-tip').shadowRoot.querySelector('.description'); + // There are now two occurrences of '3.5 stars or higher' in the AUDIENCE descriptive text overlay, hence the querySelectorAll() + let descriptiveTextAudienceScode = document.querySelector('#mainColumn > overlay-base > score-details > score-details-audience > tool-tip').shadowRoot.querySelectorAll('.description'); /* descriptiveTextAudienceScode.innerHTML = descriptiveTextAudienceScode.innerHTML.replace(/([\d.]+)( stars)/g, function (m, s1, s2) { return 2 * s1 + s2; }); */ - if (!descriptiveTextAudienceScode.textContent.includes('7 stars or higher')) { - descriptiveTextAudienceScode.textContent = descriptiveTextAudienceScode.textContent.replace('3.5 stars or higher', '7 stars or higher'); - } + descriptiveTextAudienceScode.forEach((el) => { + if (!el.textContent.includes('7 stars or higher')) { + el.textContent = el.textContent.replace('3.5 stars or higher', '7 stars or higher'); + } + }); }); From 93e496ac6670bcf2e4db88246919c7fc1105d4a9 Mon Sep 17 00:00:00 2001 From: darkred Date: Sun, 15 May 2022 22:43:27 +0300 Subject: [PATCH 06/43] Use `innerHTML` instead of `textContent` to maintain the existing link --- .../Rotten_Tomatoes_Decimal_Rating.user.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Rotten_Tomatoes_Decimal_Rating/Rotten_Tomatoes_Decimal_Rating.user.js b/Rotten_Tomatoes_Decimal_Rating/Rotten_Tomatoes_Decimal_Rating.user.js index 696d328..78eb5dc 100644 --- a/Rotten_Tomatoes_Decimal_Rating/Rotten_Tomatoes_Decimal_Rating.user.js +++ b/Rotten_Tomatoes_Decimal_Rating/Rotten_Tomatoes_Decimal_Rating.user.js @@ -1,7 +1,8 @@ // ==UserScript== // @name Rotten Tomatoes Decimal Rating // @namespace darkred -// @version 6.0.2 +// @version 6.0.3 +// @date 2022.5.15 // @description Changes base-5 Rating of Rotten Tomatoes to base-10 // @author wOxxOm, darkred // @license MIT @@ -113,7 +114,7 @@ scoreBoard.onclick = function(event) { */ descriptiveTextAudienceScode.forEach((el) => { if (!el.textContent.includes('7 stars or higher')) { - el.textContent = el.textContent.replace('3.5 stars or higher', '7 stars or higher'); + el.innerHTML = el.innerHTML.replace('3.5 stars or higher', '7 stars or higher'); } }); From ff35c6a35d7cdb837a40551ae5a1279c3d19ca0f Mon Sep 17 00:00:00 2001 From: darkred Date: Wed, 25 May 2022 23:30:44 +0300 Subject: [PATCH 07/43] Update ProtonMail_-_remove_forced_signature.user.js Added `@include` and `@icon` patterns for the new unified proton website `proton.me` + updated the Tor (.onion) address. (see https://proton.me/news/updated-proton) --- .../ProtonMail_-_remove_forced_signature.user.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ProtonMail_-_remove_forced_signature/ProtonMail_-_remove_forced_signature.user.js b/ProtonMail_-_remove_forced_signature/ProtonMail_-_remove_forced_signature.user.js index d58b0ec..8e630f4 100644 --- a/ProtonMail_-_remove_forced_signature/ProtonMail_-_remove_forced_signature.user.js +++ b/ProtonMail_-_remove_forced_signature/ProtonMail_-_remove_forced_signature.user.js @@ -1,16 +1,18 @@ // ==UserScript== // @name ProtonMail - remove forced signature // @namespace darkred -// @version 2022.5.7 +// @version 2022.5.25 // @description Removes the forced ProtonMail signature from the 'New message' textboxes // @author darkred // @license MIT // @include https://mail.protonmail.com/* +// @include https://mail.proton.me/* // @include https://protonirockerxow.onion/* +// @include https://protonmailrmez3lotccipshtkleegetolb73fuirgj7r4o4vfu7ozyd.onion/* // @grant none // @require https://greasyfork.org/scripts/21927-arrive-js/code/arrivejs.js // @supportURL https://github.com/darkred/Userscripts/issues -// @icon https://protonmail.com/images/favicon.ico +// @icon https://proton.me/favicons/favicon.ico // ==/UserScript== const elementToWatch = 'iframe[title="Email composer"]'; From 92c85eea4b713cd5e2c05ad7b43dd818c17b7294 Mon Sep 17 00:00:00 2001 From: darkred Date: Fri, 27 May 2022 01:25:49 +0300 Subject: [PATCH 08/43] Update for when the active tab is 'Videos' after recent html changes (per https://greasyfork.org/en/scripts/24895-google-youtube-search-link/discussions/135480) --- .../Google_youtube_search_link.user.js | 26 ++++++++++--------- 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/Google_youtube_search_link/Google_youtube_search_link.user.js b/Google_youtube_search_link/Google_youtube_search_link.user.js index f0118d8..b02a475 100644 --- a/Google_youtube_search_link/Google_youtube_search_link.user.js +++ b/Google_youtube_search_link/Google_youtube_search_link.user.js @@ -4,7 +4,7 @@ // @author wOxxOm, darkred // @license MIT // @description Adds a YouTube search link next to the Videos link (e.g. Web, Images, Videos, YouTube, News, Maps, Shopping, ...) -// @version 2022.2.11 +// @version 2022.5.27 // @include https://www.google.com/* // @include /https?:\/\/(www\.)?google\.(com|(?:com?\.)?\w\w)\/.*/ // @grant none @@ -27,17 +27,17 @@ function process(mutations) { if (youtube) return; - // var menu = document.querySelector('#hdtb'); // selector for the element that contains all the links (Web, Images, Videos, News, Maps, Shopping, ...) - var menu = document.querySelector('#hdtb, .ndYZfc'); // .ndYZfc is for when Images tab is selected + // Selectors for the bar element that contains all the links (Web, Images, Videos, News, Maps, Shopping, ...) + // '.ndYZfc', is for when the 'Images' tab is selected. The other, '#hdtb', is for all other cases. + var menu = document.querySelector('#hdtb, .ndYZfc'); if (!menu) return; - // var menuContainer = menu.querySelector('#hdtb-msb').parentNode; - var menuContainer = menu.querySelector('#hdtb-msb, .tAcEof').parentNode; // .tAcEof is for when Images tab is selected + var menuContainer = menu.querySelector('#hdtb-msb, .tAcEof').parentNode; // '.tAcEof' is for when the 'Images' tab is selected. The other, '#hdtb-msb', is for all other cases. if (!youtube) { var q = '', - queryElement = document.querySelector('input[name="q"]'); // selector for the Google search input textbox + queryElement = document.querySelector('input[name="q"]'); // The google search input textbox if (queryElement) { if (queryElement.value) q = encodeURIComponent(queryElement.value); @@ -79,14 +79,16 @@ function process(mutations) { '' + svg + 'YouTube' + ''; - var node = document.querySelector(`a[href*='tbm=vid']`) || document.querySelector('path[d^="M10 16.5l6-4.5-6-4.5"]').closest('span'); + const isVideosTabSelected = !!document.querySelector('.hdtb-mitem.hdtb-msel path[d^="M10 16.5l6-4.5-6-4.5"]'); + var node = isVideosTabSelected === false ? document.querySelector(`a[href*='tbm=vid']`) : document.querySelector('.hdtb-mitem.hdtb-msel path[d^="M10 16.5l6-4.5-6-4.5"]').closest('span').parentNode; - // select the 'Images' selected tab svg icon by its path[d] attribute - var imagesTabElement = document.querySelector('path[d^="M14 13l"]').closest('span.rQEFy'); - if (imagesTabElement) { - text = '' + svg + 'YouTube'; - // select the 'Videos' tab svg icon by its path[d] attribute + // select the (next, non-selected/non-active) 'Videos' tab svg icon by its path[d] attribute node = document.querySelector('path[d^="M10 16.5l6-4.5-6-4.5"]').closest('span'); } From 06f73214b0afa45baecb7a8d6cae478783d0a0ef Mon Sep 17 00:00:00 2001 From: darkred Date: Fri, 27 May 2022 01:54:40 +0300 Subject: [PATCH 09/43] Remove unneeded specificity --- Google_youtube_search_link/Google_youtube_search_link.user.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Google_youtube_search_link/Google_youtube_search_link.user.js b/Google_youtube_search_link/Google_youtube_search_link.user.js index b02a475..e998740 100644 --- a/Google_youtube_search_link/Google_youtube_search_link.user.js +++ b/Google_youtube_search_link/Google_youtube_search_link.user.js @@ -80,7 +80,7 @@ function process(mutations) { ''; const isVideosTabSelected = !!document.querySelector('.hdtb-mitem.hdtb-msel path[d^="M10 16.5l6-4.5-6-4.5"]'); - var node = isVideosTabSelected === false ? document.querySelector(`a[href*='tbm=vid']`) : document.querySelector('.hdtb-mitem.hdtb-msel path[d^="M10 16.5l6-4.5-6-4.5"]').closest('span').parentNode; + var node = isVideosTabSelected === false ? document.querySelector(`a[href*='tbm=vid']`) : document.querySelector('path[d^="M10 16.5l6-4.5-6-4.5"]').closest('span').parentNode; // (when the selected/active tab is 'Images') select the 'Images' selected tab svg icon by its path[d] attribute From f6302aea0f81a025b37bccf2a528de4f34859ff7 Mon Sep 17 00:00:00 2001 From: darkred Date: Fri, 3 Jun 2022 17:22:53 +0300 Subject: [PATCH 10/43] Create dependabot.yml --- .github/dependabot.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 .github/dependabot.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..000d73e --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,11 @@ +# To get started with Dependabot version updates, you'll need to specify which +# package ecosystems to update and where the package manifests are located. +# Please see the documentation for all configuration options: +# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates + +version: 2 +updates: + - package-ecosystem: "npm" # See documentation for possible values + directory: "/" # Location of package manifests + schedule: + interval: "daily" From f47e8b2b5adebfe2bf3f54928e7218b72ebfefc3 Mon Sep 17 00:00:00 2001 From: darkred Date: Sat, 11 Jun 2022 21:45:01 +0300 Subject: [PATCH 11/43] Maintain custom signature if it exists (per https://github.com/darkred/Userscripts/discussions/49 ) --- ...otonMail_-_remove_forced_signature.user.js | 32 +++++++++++++++---- 1 file changed, 25 insertions(+), 7 deletions(-) diff --git a/ProtonMail_-_remove_forced_signature/ProtonMail_-_remove_forced_signature.user.js b/ProtonMail_-_remove_forced_signature/ProtonMail_-_remove_forced_signature.user.js index 8e630f4..c8a73d4 100644 --- a/ProtonMail_-_remove_forced_signature/ProtonMail_-_remove_forced_signature.user.js +++ b/ProtonMail_-_remove_forced_signature/ProtonMail_-_remove_forced_signature.user.js @@ -1,7 +1,7 @@ // ==UserScript== // @name ProtonMail - remove forced signature // @namespace darkred -// @version 2022.5.25 +// @version 2022.6.11 // @description Removes the forced ProtonMail signature from the 'New message' textboxes // @author darkred // @license MIT @@ -28,14 +28,32 @@ document.arrive(elementToWatch, function () { mutationList.forEach( (mutation) => { mutation.addedNodes.forEach( (node) => { if (node.className === 'protonmail_signature_block') { - const parent = node.parentElement; // it's '#squire' and has 3 children: two with
and the signature itself - node.previousSibling.remove(); // remove the element that contains a leftover newline (
) ( children[1] ) - node.remove(); // remove the signature element itself ( children[2] ) + // DOM STRUCTURE: + // + // The 2 previous element siblings of the main signature element, '.protonmail_signature_block', are both
elements with
: + //
|
| .protonmail_signature_block + // + // The '.protonmail_signature_block' itself has 3
children which can be: + // (when user signature doesn't exist) 2 with
, and the proton signature + //
|
| .protonmail_signature_block-proton + // (when user signature exists) the user signature (.protonmail_signature_block-user) , 1 with
, and the signature itself + // .protonmail_signature_block-user |
| .protonmail_signature_block-proton + // + // Our aim is: + // 1. if there user signature exists, to also remove the 2
elements before the main '.protonmail_signature_block' element. + // 2. Regardless of whether user signature exists, to remove the last element ('.protonmail_signature_block-proton') and the
before it. - // Simulate a 'Delete' key press on the message textarea to remove the remaining
element ( children[0] ) - parent.firstChild.dispatchEvent(new KeyboardEvent('keydown', {'key':'Delete'} )); - parent.firstChild.dispatchEvent(new KeyboardEvent( 'keyup' , {'key':'Delete'} )); + const signatureUser = '.protonmail_signature_block-user'; + const signatureProton = '.protonmail_signature_block-proton'; + + if (node.querySelector(signatureUser).firstElementChild.innerText === '' ) { + node.previousElementSibling.remove(); + node.previousElementSibling.remove(); + } + + node.querySelector(signatureProton).previousElementSibling.remove(); + node.querySelector(signatureProton).remove(); observer.disconnect(); } From 4fad14032204d2f229a89ce46e72761dde7d1547 Mon Sep 17 00:00:00 2001 From: darkred Date: Sun, 12 Jun 2022 18:58:14 +0300 Subject: [PATCH 12/43] Updated most selectors after recent site code changes + create trust policy conditionally --- ...Instagram_-_visible_images_counter.user.js | 24 ++++++++++++++----- 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/Instagram_-_visible_images_counter/Instagram_-_visible_images_counter.user.js b/Instagram_-_visible_images_counter/Instagram_-_visible_images_counter.user.js index 93df7cc..0d94536 100644 --- a/Instagram_-_visible_images_counter/Instagram_-_visible_images_counter.user.js +++ b/Instagram_-_visible_images_counter/Instagram_-_visible_images_counter.user.js @@ -1,7 +1,7 @@ // ==UserScript== // @name Instagram - visible images counter // @namespace darkred -// @version 2022.2.13 +// @version 2022.6.12 // @description Shows in instagram profile pages how many images out of total (as a number and as a percentage) are currently visible, as you scroll down the page. // @author darkred // @license MIT @@ -14,6 +14,14 @@ /* eslint-disable no-console */ +const escapeHTMLPolicy = (({ trustedTypes }, policy) => + trustedTypes + ? trustedTypes.createPolicy('myEscapePolicy', policy) + : policy)(window, { + createHTML: (str) => str, +}); + + var stylesheet = `