Refractoring Every single feature and ADDING ALOT of functionalities so Theo don't have to work and can sleep with Unduck #138
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.
Unduck-Custom Search Engine Features
Features
1. Domain-Agnostic Functionality
The tool now works from any domain, not just unduck.link. The URL displayed in the interface automatically adapts to the current domain, making it easy to use the tool from different locations.
2. Built-in Search Engines
Users can select from 10 popular search engines as their default:
g)d)b)y)ya)e)sp)q)br)m)3. Custom Search Engines
Users can add their own custom search engines with:
{{{s}}}as the placeholder for search queries4. Bang Redirects
Full compatibility with DuckDuckGo's bang system is maintained. Users can still use any of the thousands of available bangs by prefixing their search with
!followed by the bang identifier.5. Search Priority
The search logic follows this priority order:
How It Works
Setting Your Default Search Engine
Using Bang Redirects
!gh unduck!ghwithout a query, you'll be taken directly to github.comAdding Custom Search Engines
{{{s}}}for the search query (e.g.,https://example.com/search?q={{{s}}})!mce search terms)Technical Implementation
Storage
User preferences and custom engines are stored in the browser's localStorage:
default-engine: The user's selected default search engine bangcustom-engines: An array of user-defined search enginesSearch Logic
When a search is performed:
Domain Agnosticism
The tool uses
window.location.originto dynamically generate the correct URL for any domain, ensuring it works regardless of where it's hosted.Chrome Extension
Simple Chrome extension to use unduck as the default search engine
Testing
The implementation includes comprehensive automated tests covering:
All tests are passing, ensuring the reliability of the implementation.