DEV: De-jQuerify `get-url` (#17314)
This commit is contained in:
parent
9f83e8e33c
commit
e1f16b4641
|
@ -5,7 +5,11 @@ let snapshot;
|
||||||
|
|
||||||
export default function getURL(url) {
|
export default function getURL(url) {
|
||||||
if (baseUri === undefined) {
|
if (baseUri === undefined) {
|
||||||
setPrefix($('meta[name="discourse-base-uri"]').attr("content") || "");
|
setPrefix(
|
||||||
|
document
|
||||||
|
.querySelector('meta[name="discourse-base-uri"]')
|
||||||
|
?.getAttribute("content") || ""
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!url) {
|
if (!url) {
|
||||||
|
@ -104,9 +108,14 @@ export function setupS3CDN(configS3BaseUrl, configS3CDN, opts) {
|
||||||
// prefix directory. For example from `/forum` to `/about-us` which is not discourse
|
// prefix directory. For example from `/forum` to `/about-us` which is not discourse
|
||||||
export function samePrefix(url) {
|
export function samePrefix(url) {
|
||||||
if (baseUri === undefined) {
|
if (baseUri === undefined) {
|
||||||
setPrefix($('meta[name="discourse-base-uri"]').attr("content") || "");
|
setPrefix(
|
||||||
|
document
|
||||||
|
.querySelector('meta[name="discourse-base-uri"]')
|
||||||
|
?.getAttribute("content") || ""
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
let origin = window.location.origin;
|
let origin = window.location.origin;
|
||||||
let cmp = url[0] === "/" ? baseUri || "/" : origin + baseUri || origin;
|
let cmp = url[0] === "/" ? baseUri || "/" : origin + baseUri || origin;
|
||||||
return url.indexOf(cmp) === 0;
|
return url.startsWith(cmp);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue