Skip to content

Commit 009ef42

Browse files
fix linking on some pages
1 parent 5ee7d26 commit 009ef42

File tree

4 files changed

+348
-381
lines changed

4 files changed

+348
-381
lines changed

full/index.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ import { onMounted } from 'vue';
9797

9898
onMounted(() => {
9999
// idk much about vitepress stuff so there may be a better way of doing this :>
100-
const content = document; // was going to scope it to just the page content but not sure how...
100+
const content = document.querySelector('.vp-doc'); // was going to scope it to just the page content but not sure how...
101101
if (content) {
102102
// fix links via magical anchor links
103103
const links = content.querySelectorAll(`a`);
@@ -108,13 +108,14 @@ onMounted(() => {
108108
&& url.pathname.startsWith('/scratch-spec/') // And it's a link under the spec base path...
109109
&& url.pathname !== '/scratch-spec/' // And it's not the homepage...
110110
&& url.host === window.location.host // And it's not linking to another domain...
111-
&& !link.parentElement?.classList.contains('VPNavBarMenu') // And it's not a link in the navbar...
112-
&& !link.parentElement?.parentElement?.classList.contains('VPDocOutlineItem') // And it's not a link in the outline...
111+
&& link.closest('.vp-doc') // And it's a link on the actual page...
113112
) {
114113
if (url.hash === '') {
115-
url.hash = '#'+(url.pathname.startsWith('/scratch-spec/full/') ? url.pathname.slice('/scratch-spec/full'.length) : url.pathname.slice('/scratch-spec'.length));
114+
url.hash = '#'+url.pathname.slice('/scratch-spec'.length);
116115
}
117-
link.href = url.hash;
116+
if (document.getElementById(url.hash.slice(1))) { // And the element being linked to actually exists...
117+
link.href = url.hash;
118+
} // Otherwise it is linked to as a separate page.
118119
}
119120
}
120121

ideas/values/index.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,11 @@ A special type of [value](#value) used to represent the result of a logical oper
3232

3333
### True
3434

35-
A kind of [boolean](#boolean) used to represent a yes or an affirmative answer as a result of a logical operation. When casted to a [string](#string), it is written as `true`. When casted to a [number](#number), it is casted to `1`. It is considered [truthy](/ideas/logic/#casting#truthy), as it is itself the definition of truthy.
35+
A kind of [boolean](#boolean) used to represent a yes or an affirmative answer as a result of a logical operation. When casted to a [string](#string), it is written as `true`. When casted to a [number](#number), it is casted to `1`. It is considered [truthy](/ideas/logic/#truthy), as it is itself the definition of truthy.
3636

3737
### False
3838

39-
A kind of [boolean](#boolean) used to represent a no or a negative answer as a result of a logical operation. When casted to a [string](#string), it is written as `false`. When casted to a [number](#number), it is casted to `0`. It is considered [falsy](/ideas/logic/#casting#falsy), as it is itself the definition of falsy.
39+
A kind of [boolean](#boolean) used to represent a no or a negative answer as a result of a logical operation. When casted to a [string](#string), it is written as `false`. When casted to a [number](#number), it is casted to `0`. It is considered [falsy](/ideas/logic/#falsy), as it is itself the definition of falsy.
4040

4141
## Direction
4242

@@ -170,11 +170,11 @@ The following table describes a sprite's *rendered* direction when using differe
170170

171171
## String
172172

173-
A type of [value](#value) consisting of a series (i.e. string) of [letters](#letter), also known as text. All strings are considered [truthy](/ideas/logic/#casting#truthy) except for the [empty string](#empty-string), the string `0`, and the string `false` (case-insensitive), which are considered [falsy](/ideas/logic/#casting#falsy).
173+
A type of [value](#value) consisting of a series (i.e. string) of [letters](#letter), also known as text. All strings are considered [truthy](/ideas/logic/#truthy) except for the [empty string](#empty-string), the string `0`, and the string `false` (case-insensitive), which are considered [falsy](/ideas/logic/#falsy).
174174

175175
### Empty String
176176

177-
A [string](#string) containing no letters. It has a [length](#length) of `0` and is one of the only strings considered [falsy](/ideas/logic/#casting#falsy). Also known as a "null string," it is typically used in place of a value where there is none, e.g. getting an [item](#item) from a [list](/ideas/concepts/#list) when it does not exist, or getting the [answer](#answer) provided by a user when they have not been [asked](/palette/standard/#ask-and-wait-block) anything yet.
177+
A [string](#string) containing no letters. It has a [length](#length) of `0` and is one of the only strings considered [falsy](/ideas/logic/#falsy). Also known as a "null string," it is typically used in place of a value where there is none, e.g. getting an [item](#item) from a [list](/ideas/concepts/#list) when it does not exist, or getting the [answer](#answer) provided by a user when they have not been [asked](/palette/standard/#ask-and-wait-block) anything yet.
178178

179179
## Undefined
180180

@@ -247,4 +247,4 @@ They will not be specified in this specification as of yet (since they cannot be
247247
* This value can be casted to other data types. (`null` was obtained via "custom extensions" in [a modification of Scratch](/palette/nonstandard/#turbowarp) that still has largely the same behaviors as standard Scratch to see how it would behave if somehow obtained.)
248248
* When [casted](/ideas/logic/#to-string) to a [string](#string), it is written as `null`.
249249
* When [casted](/ideas/logic/#to-number) to a [number](#number), it is casted to `0`.
250-
* When [casted](/ideas/logic/#to-boolean) to a [boolean](#boolean), it is [`false`](/ideas/logic/#casting#falsy).
250+
* When [casted](/ideas/logic/#to-boolean) to a [boolean](#boolean), it is [`false`](/ideas/logic/#falsy).

0 commit comments

Comments
 (0)