From 58635a65dfd39b70509ce16cbb77373cf4ce147b Mon Sep 17 00:00:00 2001 From: Ayham Al-Ali <20037329+AyhamAl-Ali@users.noreply.github.com> Date: Wed, 15 Mar 2023 16:48:32 +0300 Subject: [PATCH 1/6] =?UTF-8?q?=F0=9F=9A=80=20Add=20Structures=20Template?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Changed event priority pattern to a note instead of showing in event patterns - Fixed cookies styling -- placement still to be improved - Fixed element IDs searching case sensitive - --- doc-templates/css/styles.css | 2 +- doc-templates/js/main.js | 4 ++-- doc-templates/structures.html | 12 ++++++++++++ doc-templates/templates/desc_full.html | 13 +++++++++++++ doc-templates/templates/navbar.html | 1 + 5 files changed, 29 insertions(+), 3 deletions(-) create mode 100644 doc-templates/structures.html diff --git a/doc-templates/css/styles.css b/doc-templates/css/styles.css index a13696ee29f..e078cf6dcb5 100644 --- a/doc-templates/css/styles.css +++ b/doc-templates/css/styles.css @@ -1168,7 +1168,7 @@ pre code { /* override styling for code blocks */ #cookies-bar { position: sticky; - margin: 0 -8vw; + margin: 0; bottom: 0; background-color: #353535; color: white; diff --git a/doc-templates/js/main.js b/doc-templates/js/main.js index 0b48675990d..1793bd0f570 100644 --- a/doc-templates/js/main.js +++ b/doc-templates/js/main.js @@ -241,7 +241,7 @@ function searchNow(value = "") { let regex = new RegExp(searchValue, "gi") let name = document.querySelectorAll(`#${e.id} .item-title h1`)[0].textContent // Syntax Name let desc = document.querySelectorAll(`#${e.id} .item-description`)[0].textContent // Syntax Desc - let keywords = e.getAttribute("data-keywords") + let keywords = e.getAttribute("data-keywords") let id = e.id // Syntax ID let filtersFound = false; @@ -285,7 +285,7 @@ function searchNow(value = "") { filtersFound = true if ((regex.test(pattern.textContent.replaceAll("[ ]", " ")) || regex.test(name) || - regex.test(desc) || regex.test(keywords) || "#" + id == searchValue || searchValue == "") && filtersFound) { // Replacing '[ ]' will improve some searching cases such as 'off[ ]hand' + regex.test(desc) || regex.test(keywords) || "#" + id.toLowerCase() == searchValue.toLowerCase() || searchValue == "") && filtersFound) { // Replacing '[ ]' will improve some searching cases such as 'off[ ]hand' pass = true break; // Performance } diff --git a/doc-templates/structures.html b/doc-templates/structures.html new file mode 100644 index 00000000000..85a3179d1cc --- /dev/null +++ b/doc-templates/structures.html @@ -0,0 +1,12 @@ +

Structures

+ +
+ +

Note:

+

+ You can specify the event priority after each event syntax using the following syntax [with priority (lowest|low|normal|high|highest|monitor)] e.g. on spawn with priority lowest.
+ Note that not all of the events support event priority and will throw an error. +

+ + ${generate structures desc_full.html} +
\ No newline at end of file diff --git a/doc-templates/templates/desc_full.html b/doc-templates/templates/desc_full.html index 2a82c110f95..d68d5c97b4f 100644 --- a/doc-templates/templates/desc_full.html +++ b/doc-templates/templates/desc_full.html @@ -14,6 +14,19 @@

${element.name}

+ ${if structure-required-entrydata} + + Required Entries: + ${element.structure-required-entrydata} + + + ${end} ${if structure-optional-entrydata} + + Optional Entries: + ${element.structure-optional-entrydata} + + + ${end} Since: ${element.since} diff --git a/doc-templates/templates/navbar.html b/doc-templates/templates/navbar.html index 6d34dc12128..e2e00ca2945 100644 --- a/doc-templates/templates/navbar.html +++ b/doc-templates/templates/navbar.html @@ -10,6 +10,7 @@ Effects Expressions Types + Structures Functions From 3d3cd61d3eae7b5d697effef8f82f21ca087be32 Mon Sep 17 00:00:00 2001 From: Ayham Al-Ali <20037329+AyhamAl-Ali@users.noreply.github.com> Date: Wed, 15 Mar 2023 20:06:10 +0300 Subject: [PATCH 2/6] Note text improvement --- doc-templates/structures.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc-templates/structures.html b/doc-templates/structures.html index 85a3179d1cc..868b8ad7119 100644 --- a/doc-templates/structures.html +++ b/doc-templates/structures.html @@ -5,7 +5,7 @@

Structures

Note:

You can specify the event priority after each event syntax using the following syntax [with priority (lowest|low|normal|high|highest|monitor)] e.g. on spawn with priority lowest.
- Note that not all of the events support event priority and will throw an error. + Note that not all of the events support event priority feature and they will throw an error.

${generate structures desc_full.html} From 5276fd142f4df0ec976c54b75e6ad78a2b67633c Mon Sep 17 00:00:00 2001 From: Ayham Al-Ali <20037329+AyhamAl-Ali@users.noreply.github.com> Date: Wed, 15 Mar 2023 20:14:45 +0300 Subject: [PATCH 3/6] Improve template grid - Improve cookies bar placement --- doc-templates/css/styles.css | 24 ++++++++++++++++++++---- doc-templates/js/main.js | 2 +- doc-templates/template.html | 25 ++++++++++++++----------- 3 files changed, 35 insertions(+), 16 deletions(-) diff --git a/doc-templates/css/styles.css b/doc-templates/css/styles.css index e078cf6dcb5..c72b13111a1 100644 --- a/doc-templates/css/styles.css +++ b/doc-templates/css/styles.css @@ -119,6 +119,9 @@ html { body { font-family: "Poppins", sans-serif; +} + +#docs-body { background-color: var(--bg-color); display: grid; /* @@ -256,6 +259,19 @@ a:visited { color: white; } +.type-Structure { + border-left: 5px solid rgb(0, 219, 255); +} + +.type-Structure .item-type { + color: rgb(0, 219, 255); +} + +.type-Structure .item-examples p { + background-color: rgb(0, 219, 255); + color: white; +} + /* Pattern right section list items */ .item-details:nth-child(1) ul li:nth-child(odd) { @@ -669,7 +685,7 @@ td ul { @media (max-width: 1200px) { - body { + #docs-body { grid-template-columns: 20% minmax(80%, 100%); } @@ -712,7 +728,7 @@ td ul { @media (max-width: 1024px) { - body { + #docs-body { grid-template-columns: 20% minmax(80%, 100%); } @@ -724,7 +740,7 @@ td ul { } @media (max-width: 768px) { - body { + #docs-body { grid-template-columns: 20% minmax(80%, 100%); } @@ -751,7 +767,7 @@ td ul { } @media (max-width: 550px) { - body { + #docs-body { grid-template-columns: 0 100%; } diff --git a/doc-templates/js/main.js b/doc-templates/js/main.js index 1793bd0f570..e80dd7bc95d 100644 --- a/doc-templates/js/main.js +++ b/doc-templates/js/main.js @@ -390,7 +390,7 @@ if (examples) { // <> Cookies Accecpt if (!isCookiesAccepted) { - content.insertAdjacentHTML('beforeend', `

We use cookies and local storage to enhance your browsing experience and store github related statistics. By clicking "Accept", you consent to our use of cookies and local storage.

`); + document.body.insertAdjacentHTML('beforeend', `

We use cookies and local storage to enhance your browsing experience and store github related statistics. By clicking "Accept", you consent to our use of cookies and local storage.

`); } let cookiesBar = document.querySelector("#cookies-bar");; diff --git a/doc-templates/template.html b/doc-templates/template.html index aace63cb500..e7ed453e13f 100644 --- a/doc-templates/template.html +++ b/doc-templates/template.html @@ -35,17 +35,20 @@ - - - - ${include navbar.html} - - - ${content} +
+ + + + ${include navbar.html} + + + ${content} + +
From 6f7f319ca71e1bb0a47ae698b23554d246ff4875 Mon Sep 17 00:00:00 2001 From: Ayham Al-Ali <20037329+AyhamAl-Ali@users.noreply.github.com> Date: Wed, 15 Mar 2023 20:51:46 +0300 Subject: [PATCH 4/6] Move event priority note to events.html --- doc-templates/css/styles.css | 1 + doc-templates/events.html | 7 +++++++ doc-templates/structures.html | 6 ------ 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/doc-templates/css/styles.css b/doc-templates/css/styles.css index c72b13111a1..35ef9f9ee1d 100644 --- a/doc-templates/css/styles.css +++ b/doc-templates/css/styles.css @@ -119,6 +119,7 @@ html { body { font-family: "Poppins", sans-serif; + overflow: hidden; } #docs-body { diff --git a/doc-templates/events.html b/doc-templates/events.html index 119fd0e558b..7f8adee7000 100644 --- a/doc-templates/events.html +++ b/doc-templates/events.html @@ -1,5 +1,12 @@

Events

+ +

Note:

+

+ You can specify the event priority after each event syntax using the following syntax [with priority (lowest|low|normal|high|highest|monitor)] e.g. on spawn with priority lowest.
+ Note that not all of the events support event priority feature and they will throw an error. +

+ ${generate events desc_full.html}
diff --git a/doc-templates/structures.html b/doc-templates/structures.html index 868b8ad7119..61adabbe56a 100644 --- a/doc-templates/structures.html +++ b/doc-templates/structures.html @@ -2,11 +2,5 @@

Structures

-

Note:

-

- You can specify the event priority after each event syntax using the following syntax [with priority (lowest|low|normal|high|highest|monitor)] e.g. on spawn with priority lowest.
- Note that not all of the events support event priority feature and they will throw an error. -

- ${generate structures desc_full.html}
\ No newline at end of file From 5acb663400134b89aea14df0a1f378bd689d0c77 Mon Sep 17 00:00:00 2001 From: Ayham Al-Ali <20037329+AyhamAl-Ali@users.noreply.github.com> Date: Thu, 16 Mar 2023 10:56:50 +0300 Subject: [PATCH 5/6] Fix type searching not working with structures/new types --- doc-templates/js/main.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc-templates/js/main.js b/doc-templates/js/main.js index e80dd7bc95d..802cea11505 100644 --- a/doc-templates/js/main.js +++ b/doc-templates/js/main.js @@ -90,7 +90,7 @@ document.querySelectorAll(".new-element").forEach((e) => { // <> Search Bar const versionComparePattern = /.*?(\d\.\d(?:\.\d|))(\+|-|).*/gi; const versionPattern = / ?v(?:ersion|):(\d\.\d(?:\.\d|-(?:beta|alpha|dev)\d*|))(\+|-|)/gi; -const typePattern = / ?t(?:ype|):(condition|expression|type|effect|event|section|effectsection|function)/gi; +const typePattern = / ?t(?:ype|):(\w+)/gi; const newPattern = / ?is:(new)/gi; const resultsFoundText = "result(s) found"; From d4e709766971d633fe030e6e1b7354fd6a57b53f Mon Sep 17 00:00:00 2001 From: AyhamAl-Ali <20037329+AyhamAl-Ali@users.noreply.github.com> Date: Sun, 19 Mar 2023 00:14:20 +0300 Subject: [PATCH 6/6] Change structures font color --- doc-templates/css/styles.css | 1 - 1 file changed, 1 deletion(-) diff --git a/doc-templates/css/styles.css b/doc-templates/css/styles.css index 35ef9f9ee1d..eaf92d8dd28 100644 --- a/doc-templates/css/styles.css +++ b/doc-templates/css/styles.css @@ -270,7 +270,6 @@ a:visited { .type-Structure .item-examples p { background-color: rgb(0, 219, 255); - color: white; } /* Pattern right section list items */