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

Add Etymonline completion #3981

Closed
wants to merge 1 commit into from
Closed
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
16 changes: 16 additions & 0 deletions background_scripts/completion_engines.js
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,21 @@ class UpToDate extends BaseEngine {
parse(xhr) { return JSON.parse(xhr.responseText).data.searchTerms; }
}

class Etymonline extends BaseEngine {
constructor() {
super({
engineUrl: "https://www.etymonline.com/api/etymology/fuzzy?key=%s",
regexps: ["^https?://www\\.etymonline\\.com/"],
example: {
searchUrl: "https://www.etymonline.com/search?q=%s",
keyword: "e"
}
});
}

parse(xhr) { return JSON.parse(xhr.responseText); }
}

// A dummy search engine which is guaranteed to match any search URL, but never produces completions. This
// allows the rest of the logic to be written knowing that there will always be a completion engine match.
class DummyCompletionEngine extends BaseEngine {
Expand All @@ -252,6 +267,7 @@ const CompletionEngines = [
Webster,
Qwant,
UpToDate,
Etymonline,
DummyCompletionEngine
];

Expand Down