-
-
Notifications
You must be signed in to change notification settings - Fork 2
Selectors were hiding search results. #18
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
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
cfa1c34
Selectors were hiding search results.
mkazin 1253891
YouTubeNoComment - now hides Live Chat
mkazin 8b0c3c4
New Amazon script to de-empty extended warranty button
mkazin 823d614
Fix for observer import (#15)
mkazin 62e3cb2
Observer- extensive changes, now v0.1.0 :
mkazin 8d1fcc5
Observer 0.1.0 ready for userscript testing
mkazin 5733fba
[SECURITY] Package upgrades
mkazin fd166ef
ObserverTracker 0.1.0 shakedown complete
mkazin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| { | ||
| // Use IntelliSense to learn about possible attributes. | ||
| // Hover to view descriptions of existing attributes. | ||
| // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 | ||
| "version": "0.2.0", | ||
| "configurations": [ | ||
| { | ||
| "type": "node", | ||
| "name": "vscode-jest-tests.v2.OhMonkey", | ||
| "request": "launch", | ||
| "args": [ | ||
| "--runInBand", | ||
| "--watchAll=false", | ||
| "--testNamePattern", | ||
| "${jest.testNamePattern}", | ||
|
|
||
| ], | ||
| "cwd": "${workspaceFolder}", | ||
| "console": "integratedTerminal", | ||
| "internalConsoleOptions": "neverOpen", | ||
| "disableOptimisticBPs": true, | ||
| "program": "${workspaceFolder}/node_modules/.bin/jest", | ||
| "windows": { | ||
| "program": "${workspaceFolder}/node_modules/jest/bin/jest" | ||
| } | ||
| } | ||
| ] | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| { | ||
| "jest.runMode": "on-demand", | ||
| "jest.rootPath": ".", | ||
| "testing.automaticallyOpenPeekView": "never", | ||
| "jest.jestCommandLine": "npx jest", | ||
| "editor.trimWhitespaceOnDelete": true, | ||
| "files.trimFinalNewlines": true, | ||
| "files.trimTrailingWhitespace": true | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| // ==UserScript== | ||
| // @name Amazon Neutral Protection Button | ||
| // @description Remove the bright yellow background on button labeled "Add Protection" (extended warranty) | ||
| // @author https://github.com/mkazin | ||
| // @homepage https://github.com/mkazin/OhMonkey/tree/main/Amazon | ||
| // @version 0.1 | ||
| // @license BSD-3-Clause | ||
| // @namespace http://tampermonkey.net/ | ||
| // @match https://www.amazon.com/*/dp/* | ||
| // @icon https://www.google.com/s2/favicons?sz=64&domain=amazon.com | ||
| // @grant GM_addStyle | ||
| // ==/UserScript== | ||
|
|
||
| const EITHER_BUTTON_SELECTOR = "div.attach-warranty-button-row span.a-button" | ||
|
|
||
| GM_addStyle(`${EITHER_BUTTON_SELECTOR} { background-color: white; border-color: black; }`) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| # Reddit Scripts | ||
|
|
||
| ## Reddit.com main page | ||
|
|
||
| ### [Subreddit Hider](RedditSubredditHider.user.js) | ||
| Adds a button to filter out subreddits you don't want to see. | ||
|
|
||
| For example, this annoying karma-farming Subreddit: | ||
|
|
||
| <img src="./img/SubredditHider.png"> | ||
|
|
||
| Does not require an account or being logged in. Stores the list of hidden subreddits in your browser. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,78 @@ | ||
| // ==UserScript== | ||
| // @name Reddit Subreddit Hider | ||
| // @namespace https://github.com/mkazin/OhMonkey | ||
| // @author Michael Kazin | ||
| // @version 1.0 | ||
| // @description Subreddit filter | ||
| // @license BSD-3-Clause | ||
| // @match https://www.reddit.com/ | ||
| // @icon https://www.google.com/s2/favicons?sz=64&domain=reddit.com | ||
| // @grant GM_setValue | ||
| // @grant GM_getValue | ||
| // @grant GM_addStyle | ||
| // @run-at document-end | ||
| // @require https://raw.githubusercontent.com/mkazin/OhMonkey/refs/heads/main/_Utils/Observer.js | ||
| // ==/UserScript== | ||
|
|
||
| const POST_SELECTOR = 'shreddit-post[subreddit-name]'; | ||
| const CACHE_KEY = 'rsh-subreddit-list' | ||
|
|
||
| async function init() { | ||
| // Hide previously saved subreddits | ||
| const subreddits = (await GM_getValue(CACHE_KEY))?.split(',') || []; | ||
| subreddits.forEach(name => hideSubreddit(name)); | ||
| // console.log(`Loaded list of ${subreddits.length} hidden subreddits: ${subreddits.join(',')}`); | ||
|
|
||
| // Add filter button to posts on page load | ||
| document.querySelectorAll(POST_SELECTOR).forEach(postElement => { | ||
| const subredditName = postElement.getAttribute('subreddit-name'); | ||
| if (!subreddits.includes(subredditName) && !postElement.querySelector('#hide-subreddit-button')) { | ||
| createFilterButton(postElement); | ||
| } | ||
| }); | ||
|
|
||
| // Observe for new posts being added and add a filter button to each | ||
| wheneverElementAppears( | ||
| POST_SELECTOR, | ||
| (postElement) => { createFilterButton(postElement); }, | ||
| document, | ||
| 0, | ||
| "RedditSubredditHider" | ||
| ); | ||
| } | ||
|
|
||
| function hideSubreddit(subredditName) { | ||
| const rule = `article:has(shreddit-post[subreddit-name="${subredditName}"]) { display: none; }`; | ||
| GM_addStyle(rule); | ||
| } | ||
|
|
||
| function createFilterButton(postElement) { | ||
| const newSection = document.createElement('div') | ||
| const creditBar = postElement.querySelector(`[id*="feed-post-credit-bar-"]`); | ||
| creditBar.prepend(newSection) | ||
|
|
||
| const newButton = document.createElement('button'); | ||
| newButton.classList.add('button-primary'); | ||
| newButton.id = 'hide-subreddit-button'; | ||
| newButton.innerText = 'Hide Subreddit' | ||
| newButton.onclick = clickHandler; | ||
| newSection.appendChild(newButton); | ||
| } | ||
|
|
||
| async function clickHandler(event) { | ||
| const subreddits = (await GM_getValue(CACHE_KEY))?.split(',') || []; | ||
| const postElement = event.target.closest('shreddit-post'); | ||
| const subredditName = postElement.getAttribute('subreddit-name'); | ||
| if (subreddits.includes(subredditName)) { | ||
| console.warn(`Subreddit ${subredditName} is already hidden.`); | ||
| return; | ||
| } | ||
|
|
||
| hideSubreddit(subredditName); | ||
| subreddits.push(subredditName); | ||
| await GM_setValue(CACHE_KEY, subreddits.join(',')); | ||
| // console.log(`Subreddit ${subredditName} has been hidden.`); | ||
| // console.log(`New list of hidden subreddits: ${subreddits.join(',')}`); | ||
| } | ||
|
|
||
| init(); |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Consider removing the commented-out selectors if they are no longer needed, to reduce clutter and avoid potential confusion during future maintenance.