Skip to content

Commit e5e65ad

Browse files
committed
finish sidebar
1 parent 516a767 commit e5e65ad

File tree

10 files changed

+186
-119
lines changed

10 files changed

+186
-119
lines changed

_doc/start.md

Lines changed: 108 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,115 @@ icon:
66
type: fa
77
name: fa-paper-plane
88
color: green
9-
sections:
10-
- /start/prerequisites
11-
- /start/install_vscode
12-
- /start/install_wurst
139
---
1410

1511
WurstScript is a programming language and modding toolkit working in unison to create awesome Warcraft 3 maps.
1612
In this guide we will show you how to install WurstScript and set up your first project.
13+
14+
## Prerequisites
15+
16+
WurstScript and its related tools require Java 11+ to run. Editor support is provided via a VSCode extension.
17+
18+
### Download JRE
19+
20+
[_ _{: .fa .fa-download} Download Java from Adoptium](https://adoptium.net/?variant=openjdk11){: .btn .btn-orange}
21+
22+
Download the Java Runtime appropriate for your system and follow the installation procedure.
23+
24+
Once finished, continue to the next step.
25+
26+
### Verify Java Installation
27+
28+
Many tasks rely on a environment variable called **JAVA_HOME** which might not have been set by the installer.
29+
To verify your installation, open a command prompt and enter `java -version`.
30+
31+
A valid installation will return something like this:
32+
33+
```powershell
34+
> java -version
35+
openjdk version "11.0.17" 2022-10-18
36+
OpenJDK Runtime Environment Temurin-11.0.17+8 (build 11.0.17+8)
37+
OpenJDK 64-Bit Server VM Temurin-11.0.17+8 (build 11.0.17+8, mixed mode)
38+
```
39+
40+
The major version should be `11` or higher. If it is lower, you must update your Java installation.
41+
42+
If you get an error or get a lower versions displayed, even though you installed a newer one, your **JAVA_HOME** is either missing or configured wrong.
43+
44+
Refer to this [_ _{: .fa .fa-external-link-square} Windows tutorial](https://confluence.atlassian.com/doc/setting-the-java_home-variable-in-windows-8895.html) in order to setup your **JAVA_HOME** correctly.
45+
46+
Once you have setup Java correctly, continue by installing VSCode.
47+
48+
## Install Wurstscript
49+
50+
Now we will setup a Wurst compiler environment and create a project using the the WurstSetup, also known as `grill`.
51+
52+
[_ _{: .fa .fa-download} Download WurstSetup](https://grill.wurstlang.org/hudson/job/WurstSetup/lastSuccessfulBuild/artifact/downloads/WurstSetup.jar){: .btn .btn-green}
53+
54+
The Wurstsetup can be used either from the commandline or as a graphical application.
55+
56+
## Commandline
57+
58+
Usage by invoking `grill` via the commandline is recommended and provides a similar user experience to tools such as `npm`, `maven`. etc. To use the setup from the commandline you need to complete the initial installation once.
59+
After that you can invoke `grill` from your commandline.
60+
61+
### Initial installation
62+
63+
For the first time you have to run the .jar file directly, because the executable hasn't been installed yet.
64+
65+
`java -jar WurstSetup.jar install wurstscript`
66+
67+
Now you need to add the `~/.wurst` folder to your PATH environment variable, so you can use it from the commandline.
68+
Refer to this [tutorial](https://www.java.com/en/download/help/path.xml). On Windows 10, the result should look like this:
69+
70+
![](https://i.imgur.com/8bFJJVT.jpg){: .img-responsive}
71+
72+
The `grill` command should now be recognized by your terminal of choice.
73+
74+
![](https://i.imgur.com/FNSBYgD.jpg){: .img-responsive}
75+
76+
If not, a restart might be required.
77+
78+
### Updating the Compiler
79+
80+
Use the special `wurstscript` keyword to install or update wurst on your system for the current user.
81+
82+
`grill install wurstscript`
83+
84+
### Create a Wurst Project
85+
86+
Use `generate` to create new projects. The project will be generated in a folder inside your current location with the name provided.
87+
88+
`grill generate my-wurst-project`
89+
90+
### Open in VSCode
91+
92+
After you finished installation and project setup, you can open the project's root folder in VSCode.
93+
94+
`code my-wurst-project`
95+
96+
{: .answer}
97+
98+
_ _{: .fa .fa-exclamation-circle} Make sure you are opening the project's root folder (contains wurst.build file) using `File -> Open Folder`
99+
100+
Once the project is opened, you can click the `Hello.wurst` file on the left to activate the Wurst plugin. The code should compile and the setup should be done. Using VSCode's command console (`F1`) you can execute wurst commands such as running or building your map.
101+
102+
If you are new to WurstScript but not new to programming, you probably want to continue with the [_ _{: .fa .fa-external-link-square} Beginner's Guide](tutorials/wurstbeginner.html)
103+
104+
### Installing and Updating a project
105+
106+
Run the `install` command to update your project's dependencies, or to initially setup a fresly cloned project to work on your machine.
107+
108+
`grill install`
109+
110+
### Adding dependencies
111+
112+
To add a new dependency, run the `install` command with a second parameter that points to a git repo.
113+
114+
`grill install https://github.com/Frotty/wurst-astar-jps`
115+
116+
## Graphical User Interface
117+
118+
By running the `WurstSetup.jar` without any arguments or simply by double-clicking, you can alternatively use the deprecated, graphical user interface.
119+
120+
![](/assets/images/setup/WurstSetup.png){: .img-responsive}

_doc/start/install_wurst.md

Lines changed: 0 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -6,74 +6,3 @@ sections:
66
- Update and import Projects
77
---
88

9-
Now we will setup a Wurst compiler environment and create a project using the the WurstSetup, also known as `grill`.
10-
11-
[_ _{: .fa .fa-download} Download WurstSetup](https://grill.wurstlang.org/hudson/job/WurstSetup/lastSuccessfulBuild/artifact/downloads/WurstSetup.jar){: .btn .btn-green}
12-
13-
The Wurstsetup can be used either from the commandline or as a graphical application.
14-
15-
## Commandline
16-
17-
Usage by invoking `grill` via the commandline is recommended and provides a similar user experience to tools such as `npm`, `maven`. etc. To use the setup from the commandline you need to complete the initial installation once.
18-
After that you can invoke `grill` from your commandline.
19-
20-
### Initial installation
21-
22-
For the first time you have to run the .jar file directly, because the executable hasn't been installed yet.
23-
24-
`java -jar WurstSetup.jar install wurstscript`
25-
26-
Now you need to add the `~/.wurst` folder to your PATH environment variable, so you can use it from the commandline.
27-
Refer to this [tutorial](https://www.java.com/en/download/help/path.xml). On Windows 10, the result should look like this:
28-
29-
![](https://i.imgur.com/8bFJJVT.jpg){: .img-responsive}
30-
31-
The `grill` command should now be recognized by your terminal of choice.
32-
33-
![](https://i.imgur.com/FNSBYgD.jpg){: .img-responsive}
34-
35-
If not, a restart might be required.
36-
37-
### Updating the Compiler
38-
39-
Use the special `wurstscript` keyword to install or update wurst on your system for the current user.
40-
41-
`grill install wurstscript`
42-
43-
### Create a Wurst Project
44-
45-
Use `generate` to create new projects. The project will be generated in a folder inside your current location with the name provided.
46-
47-
`grill generate my-wurst-project`
48-
49-
### Open in VSCode
50-
51-
After you finished installation and project setup, you can open the project's root folder in VSCode.
52-
53-
`code my-wurst-project`
54-
55-
{: .answer}
56-
57-
_ _{: .fa .fa-exclamation-circle} Make sure you are opening the project's root folder (contains wurst.build file) using `File -> Open Folder`
58-
59-
Once the project is opened, you can click the `Hello.wurst` file on the left to activate the Wurst plugin. The code should compile and the setup should be done. Using VSCode's command console (`F1`) you can execute wurst commands such as running or building your map.
60-
61-
If you are new to WurstScript but not new to programming, you probably want to continue with the [_ _{: .fa .fa-external-link-square} Beginner's Guide](tutorials/wurstbeginner.html)
62-
63-
### Installing and Updating a project
64-
65-
Run the `install` command to update your project's dependencies, or to initially setup a fresly cloned project to work on your machine.
66-
67-
`grill install`
68-
69-
### Adding dependencies
70-
71-
To add a new dependency, run the `install` command with a second parameter that points to a git repo.
72-
73-
`grill install https://github.com/Frotty/wurst-astar-jps`
74-
75-
## Graphical User Interface
76-
77-
By running the `WurstSetup.jar` without any arguments or simply by double-clicking, you can alternatively use the deprecated, graphical user interface.
78-
79-
![](/assets/images/setup/WurstSetup.png){: .img-responsive}

_doc/start/prerequisites.md

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -5,34 +5,3 @@ sections:
55
- VSCode
66
---
77

8-
WurstScript and its related tools require Java 11+ to run. Editor support is provided via a VSCode extension.
9-
10-
### Download JRE
11-
12-
[_ _{: .fa .fa-download} Download Java from Adoptium](https://adoptium.net/?variant=openjdk11){: .btn .btn-orange}
13-
14-
Download the Java Runtime appropriate for your system and follow the installation procedure.
15-
16-
Once finished, continue to the next step.
17-
18-
### Verify Java Installation
19-
20-
Many tasks rely on a environment variable called **JAVA_HOME** which might not have been set by the installer.
21-
To verify your installation, open a command prompt and enter `java -version`.
22-
23-
A valid installation will return something like this:
24-
25-
```powershell
26-
> java -version
27-
openjdk version "11.0.17" 2022-10-18
28-
OpenJDK Runtime Environment Temurin-11.0.17+8 (build 11.0.17+8)
29-
OpenJDK 64-Bit Server VM Temurin-11.0.17+8 (build 11.0.17+8, mixed mode)
30-
```
31-
32-
The major version should be `11` or higher. If it is lower, you must update your Java installation.
33-
34-
If you get an error or get a lower versions displayed, even though you installed a newer one, your **JAVA_HOME** is either missing or configured wrong.
35-
36-
Refer to this [_ _{: .fa .fa-external-link-square} Windows tutorial](https://confluence.atlassian.com/doc/setting-the-java_home-variable-in-windows-8895.html) in order to setup your **JAVA_HOME** correctly.
37-
38-
Once you have setup Java correctly, continue by installing VSCode.

_includes/sidebar.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<div id="doc-menu" data-spy="affix">
55
<div class="doc-menu-scroll">
66
<ul class="nav doc-menu hidden-xs">
7-
<li class="nav-heading"><a class="scrollto" href="#">{{ page.title }}</a></li>
7+
<li class="nav-heading"><a class="scrollto" href="{{page.url}}">{{ page.title }}</a></li>
88
</ul>
99
</div>
1010
</div>

_layouts/doc.html

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
{% include meta_properties.html %} {% include google_analytics.html %} {% seo %}
3939
</head>
4040

41-
<body class="body-{{ page.color }}">
41+
<body class="body-{{ page.color }} doc-body">
4242

4343
<div class="page-wrapper">
4444

@@ -88,6 +88,10 @@ <h1 class="doc-title">
8888
<!-- CONTENT -->
8989
<div class="doc-content">
9090
<div class="content-inner">
91+
<span class="github-propose">
92+
<svg viewBox="0 0 24 24" class="wt-icon wt-icon_size_m sub-title__editing-icon"><path d="m20.9 12.2a8.94 8.94 0 0 1 -6.4 8.6.39176.39176 0 0 1 -.4-.4v-3a1.58066 1.58066 0 0 0 -.5-1.2 3.7342 3.7342 0 0 0 3.9-3.4 4.24447 4.24447 0 0 0 -.9-3.5 2.8554 2.8554 0 0 0 -.2-2.4 7.23943 7.23943 0 0 0 -2.4.9 8.21667 8.21667 0 0 0 -4.4 0 4.61924 4.61924 0 0 0 -2.3-.9h-.1a2.74943 2.74943 0 0 0 -.2 2.4 4.07472 4.07472 0 0 0 -.9 3.5 3.81064 3.81064 0 0 0 3.9 3.4 1.08192 1.08192 0 0 0 -.4.6 2.63862 2.63862 0 0 0 -.1.7 1.94273 1.94273 0 0 1 -2.2-.5c-.5-.8-.9-1.2-1.4-1.3s-.6.2-.6.2a1.00419 1.00419 0 0 0 .5.6 1.69523 1.69523 0 0 1 .8 1 1.82656 1.82656 0 0 0 1.2 1.2 3.9156 3.9156 0 0 0 1.9 0v1.7a.29725.29725 0 0 1 -.4.3 8.82071 8.82071 0 0 1 -6.3-8.5 8.95014 8.95014 0 0 1 17.9 0z"></path></svg>
93+
<a href="https://github.com/wurstscript/wurstscript.github.io/edit/master/_doc{{ page.url | replace: ".html", ".md" }}" target="_blank">Edit page</a>
94+
</span>
9195

9296
{{ content | markdownify }} {% for id in page.sections %} {% assign section = site.doc | where: "id", id | first %}
9397

_sass/base.scss

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,28 @@ color: var(--text-color-dark);
4242
font-size: 16px;
4343
}
4444

45-
html, body {
46-
height: 100%;
47-
overflow: hidden;
45+
46+
.content-inner {
47+
padding-bottom: 200px;
48+
}
49+
50+
.github-propose {
51+
display: flex;
52+
align-items: center;
53+
gap: 8px;
54+
font-size: 16px;
55+
padding: 6px;
56+
border: 1px solid #d7d7d7;
57+
border-radius: 4px;
58+
width: 120px;
59+
margin-bottom: 12px;
60+
61+
svg {
62+
width: 24px;
63+
height: 24px;
64+
background-color: white;
65+
border-radius: 100%;
66+
}
4867
}
4968

5069
.nav-heading {

_sass/doc.scss

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
2+
.doc-body {
3+
height: 100%;
4+
overflow: hidden;
5+
}
6+
17
/* ======= Doc Styling ======= */
28
.doc-wrapper {
39
display: flex;
@@ -738,6 +744,14 @@ code {
738744

739745
/* Extra small devices (phones, less than 768px) */
740746
@media (max-width: 767px) {
747+
.doc-sidebar {
748+
display: none;
749+
}
750+
751+
.doc-container {
752+
width: 100%;
753+
padding: 10px;
754+
}
741755
.doc-content {
742756
margin-left: 0;
743757
}

_sass/landing.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@
136136
background-image: url("../images/empty.png"); /* for IE8 */
137137
}
138138

139-
transition: 0.4s ease;
139+
transition: 0.2s ease;
140140

141141
&:hover {
142142
transform: translateY(-1px);

_sass/theme-default.scss

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,22 @@
5252
}
5353

5454
@media (prefers-color-scheme: dark) {
55+
/* For the scrollbar track (background) */
56+
::-webkit-scrollbar {
57+
background-color: #2e2e2e; /* Dark grey background */
58+
}
59+
60+
/* For the scrollbar handle */
61+
::-webkit-scrollbar-thumb {
62+
background-color: #555; /* Darker grey scrollbar handle */
63+
border-radius: 6px; /* Rounded corners on the scrollbar handle */
64+
border: 3px solid #2e2e2e; /* Creates a small border with the same color as the track */
65+
}
66+
67+
/* For the scrollbar handle on hover */
68+
::-webkit-scrollbar-thumb:hover {
69+
background-color: #888; /* Lighter grey on hover */
70+
}
5571
/*
5672
* Dark Colors
5773
* -------------------------------------------

assets/js/main.js

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ $(document).ready(function () {
9999

100100
navContainer.appendChild(navItem);
101101
h2List = undefined;
102-
offsetMap[index] = { nav: navItem, offset: heading.getBoundingClientRect().top };
102+
offsetMap[index] = { nav: navItem, offset: heading.getBoundingClientRect().top + scrollContainer.scrollTop };
103103
} else if (heading.tagName == "H3") {
104104
if (!h2List) {
105105
h2List = document.createElement("ul");
@@ -109,7 +109,7 @@ $(document).ready(function () {
109109
const navItem = document.createElement("li");
110110
navItem.innerHTML = `<a class="scrollto" href="#${heading.textContent}">${heading.textContent}</a>`;
111111
h2List.appendChild(navItem);
112-
offsetMap[index] = { nav: navItem, offset: heading.getBoundingClientRect().top };
112+
offsetMap[index] = { nav: navItem, offset: heading.getBoundingClientRect().top + scrollContainer.scrollTop };
113113
}
114114
});
115115

@@ -129,14 +129,26 @@ $(document).ready(function () {
129129
});
130130
});
131131

132+
var selected;
133+
132134

133135
scrollContainer.addEventListener("scroll", function () {
134-
var selected = offsetMap[0].nav;
135-
for (const section of offsetMap) {
136-
if (section.offset < scrollContainer.scrollTop) {
137-
selected = section.nav;
136+
selected?.classList.remove("active");
137+
selected = offsetMap[0].nav;
138+
console.log("top: " + scrollContainer.scrollTop);
139+
for (var i = 1; i < offsetMap.length; i++) {
140+
const section = offsetMap[i];
141+
if (section.offset < scrollContainer.scrollTop + 220) {
142+
const section2 = offsetMap[i + 1];
143+
if (!section2) {
144+
selected = section.nav;
145+
break;
146+
}
147+
if (!(section2.offset < scrollContainer.scrollTop + 220)) {
148+
selected = section.nav;
149+
break;
150+
}
138151
}
139-
section.nav.classList.remove("active");
140152
}
141153

142154
if (selected) {

0 commit comments

Comments
 (0)