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 RuneScape Wiki and OldSchool RuneScape Wiki #4238

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

class RuneScapeWiki extends BaseEngine {
constructor() {
super({
engineUrl: "https://runescape.wiki/api.php?action=opensearch&format=json&search=%s",
regexps: ["^https?://\\.runescape\\.wiki/"],
example: {
searchUrl: "https://runescape.wiki/?search=%s",
keyword: "rs"
}
});
}
parse(xhr) { return JSON.parse(xhr.responseText)[1]; }
}

class OldSchoolRuneScapeWiki extends BaseEngine {
constructor() {
super({
engineUrl: "https://oldschool.runescape.wiki/api.php?action=opensearch&format=json&search=%s",
regexps: ["^https?://oldschool\\.runescape\\.wiki/"],
example: {
searchUrl: "https://oldschool.runescape.wiki/?search=%s",
keyword: "os"
}
});
}
parse(xhr) { return JSON.parse(xhr.responseText)[1]; }
}



// 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 +282,8 @@ const CompletionEngines = [
Webster,
Qwant,
UpToDate,
RuneScapeWiki,
OldSchoolRuneScapeWiki,
DummyCompletionEngine
];

Expand Down