-
Notifications
You must be signed in to change notification settings - Fork 389
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1778 from yuvipanda/badgey
JS: Refactor link & badge generation, use URLs (not string) for base URLs
- Loading branch information
Showing
8 changed files
with
204 additions
and
106 deletions.
There are no files selected for viewing
This file contains 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 was deleted.
Oops, something went wrong.
This file contains 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 |
---|---|---|
@@ -1,13 +1,22 @@ | ||
/** | ||
* @type {string} | ||
* Base URL of this binderhub installation | ||
* @type {URL} | ||
* Base URL of this binderhub installation. | ||
* | ||
* Guaranteed to have a leading & trailing slash by the binderhub python configuration. | ||
*/ | ||
export const BASE_URL = $("#base-url").data().url; | ||
export const BASE_URL = new URL( | ||
document.getElementById("base-url").dataset.url, | ||
document.location.origin, | ||
); | ||
|
||
const badge_base_url = document.getElementById("badge-base-url").dataset.url; | ||
/** | ||
* @type {string} | ||
* Optional base URL to use for both badge images as well as launch links. | ||
* @type {URL} | ||
* Base URL to use for both badge images as well as launch links. | ||
* | ||
* Is different from BASE_URL primarily when used as part of a federation. | ||
* If not explicitly set, will default to BASE_URL. Primarily set up different than BASE_URL | ||
* when used as part of a federation | ||
*/ | ||
export const BADGE_BASE_URL = $("#badge-base-url").data().url; | ||
export const BADGE_BASE_URL = badge_base_url | ||
? new URL(badge_base_url, document.location.origin) | ||
: BASE_URL; |
This file contains 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 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 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 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
Oops, something went wrong.