diff --git a/docs/css/styles.css b/docs/css/styles.css
index e35ce476b24..017020892e9 100644
--- a/docs/css/styles.css
+++ b/docs/css/styles.css
@@ -143,9 +143,11 @@ a:visited {
.type-Event {
border-left: 5px solid rgb(28, 181, 152);
}
+
.type-Event .item-type {
color: rgb(28, 181, 152);
}
+
.type-Event .item-examples p {
background-color: rgb(28, 181, 152);
}
@@ -153,9 +155,11 @@ a:visited {
.type-Effect {
border-left: 5px solid rgb(139, 255, 0);
}
+
.type-Effect .item-type {
color: rgb(139, 255, 0);
}
+
.type-Effect .item-examples p {
background-color: rgb(139, 255, 0);
}
@@ -163,9 +167,11 @@ a:visited {
.type-Expression {
border-left: 5px solid rgb(255, 152, 0);
}
+
.type-Expression .item-type {
color: rgb(255, 152, 0);
}
+
.type-Expression .item-examples p {
background-color: rgb(255, 152, 0);
}
@@ -173,9 +179,11 @@ a:visited {
.type-Condition {
border-left: 5px solid rgb(181, 28, 28);
}
+
.type-Condition .item-type {
color: rgb(181, 28, 28);
}
+
.type-Condition .item-examples p {
background-color: rgb(181, 28, 28);
color: white;
@@ -184,20 +192,37 @@ a:visited {
.type-Section {
border-left: 5px solid rgb(181, 28, 121);
}
+
.type-Section .item-type {
color: rgb(181, 28, 121);
}
+
.type-Section .item-examples p {
background-color: rgb(181, 28, 121);
color: white;
}
+.type-EffectSection {
+ border-left: 5px solid rgb(199, 0, 255);
+}
+
+.type-EffectSection .item-type {
+ color: rgb(199, 0, 255);
+}
+
+.type-EffectSection .item-examples p {
+ background-color: rgb(199, 0, 255);
+ color: white;
+}
+
.type-Type {
border-left: 5px solid rgb(0, 100, 255);
}
+
.type-Type .item-type {
color: rgb(0, 100, 255);
}
+
.type-Type .item-examples p {
background-color: rgb(0, 100, 255);
color: white;
@@ -206,9 +231,11 @@ a:visited {
.type-Function {
border-left: 5px solid rgb(128, 0, 255);
}
+
.type-Function .item-type {
color: rgb(128, 0, 255);
}
+
.type-Function .item-examples p {
background-color: rgb(128, 0, 255);
color: white;
@@ -269,11 +296,24 @@ a:visited {
div.active-syntax {
border-left: 5px solid #ff4e4e;
}
+
div.active-syntax .item-examples p {
background-color: #ff4e4e;
color: white;
}
+.item-examples p {
+ cursor: pointer;
+}
+
+.example-details-closed:before {
+ content: '▶ ';
+}
+
+.example-details-opened:before {
+ content: '▼ ';
+}
+
/* Active tab for sub menus */
.menu-subtabs .active-tab {
color: #ffc107 !important;
@@ -364,7 +404,8 @@ div.active-syntax .item-examples p {
margin-top: 110px;
height: calc(100vh - 110px);
/* Fixed the TOP CSS 110px due to body having overflow hidden and top = 110px so the last 110px is hidden, this will fix it */
- /* padding: calc(0.22em + 30px); */ /* When applied it will break the padding when an anchor is clicked */
+ /* padding: calc(0.22em + 30px); */
+ /* When applied it will break the padding when an anchor is clicked */
padding-right: 30px;
overflow-x: hidden;
overflow-y: scroll;
@@ -572,6 +613,7 @@ td ul {
padding: 30px;
font-size: 0.9em;
color: var(--code-font-color);
+ display: none;
}
.box-title {
@@ -639,7 +681,8 @@ td ul {
display: none;
}
- span .search-bar-version { /* More specific to override the other */
+ span .search-bar-version {
+ /* More specific to override the other */
left: calc(20% + 150px) !important;
}
@@ -732,7 +775,8 @@ td ul {
top: calc(4.1em + 24px) !important;
}
- span .search-bar-version { /* More specific to override the other */
+ span .search-bar-version {
+ /* More specific to override the other */
left: 150px !important;
}
@@ -750,13 +794,16 @@ td ul {
div.item-content {
max-width: 100vw;
}
+
div.grid-container {
grid-template-columns: initial;
}
+
.box.code {
height: 300px;
font-size: 14px;
}
+
p.item-type {
display: none;
}
@@ -772,7 +819,12 @@ td ul {
color: var(--font-color);
}
-p, h1, h2, h3, h4, h5 {
+p,
+h1,
+h2,
+h3,
+h4,
+h5 {
color: var(--font-color);
}
@@ -929,7 +981,7 @@ pre {
color: var(--search-color);
box-shadow: 0 3px 5px 0 rgba(0, 0, 0, .05);
right: 0.8%;
- top: 102px;
+ top: 101px;
text-align: right;
}
@@ -1009,58 +1061,76 @@ pre {
#global-navigation .menu-subtabs a:hover {
box-shadow: unset;
/* border-left: 3px solid #ff9800; */
- background: rgba(0,0,0,.1);
+ background: rgba(0, 0, 0, .1);
}
/* Syntax Highlighting */
-.sk-cond, .sk-loop {
+.sk-cond,
+.sk-loop {
color: #a52e91;
font-weight: bold;
}
-.sk-eff {
+
+.sk-eff {
color: rgb(255, 174, 0)
}
+
.sk-expr {
color: rgb(199, 152, 66)
}
+
.sk-event {
color: #c23838;
}
+
.sk-command {
color: #c27715;
}
+
.sk-arg-type {
color: #dbab28;
}
+
.sk-loop-value {
color: #ff6600;
}
+
.sk-false {
color: #b10000;
font-weight: bold;
}
+
.sk-true {
color: #20b628;
font-weight: bold;
}
+
.sk-operators {
font-weight: bold;
}
+
.sk-var {
color: #e74040;
}
-.sk-string [class*="sk-"], .sk-string { /* More specific = higher priority to override other css in strings and comments */
+
+.sk-string [class*="sk-"],
+.sk-string {
+ /* More specific = higher priority to override other css in strings and comments */
color: #34a52a !important;
font-weight: unset;
}
-.sk-comment, .sk-comment [class*="sk-"] {
+
+.sk-comment,
+.sk-comment [class*="sk-"] {
color: #696969 !important;
font-weight: unset;
}
+
.sk-function {
color: #e873ff;
font-weight: bold;
}
+
.sk-timespan {
color: #ff5967;
font-style: italic;
diff --git a/docs/js/main.js b/docs/js/main.js
index 051fa3805b5..fd0681ed3b9 100644
--- a/docs/js/main.js
+++ b/docs/js/main.js
@@ -279,7 +279,7 @@ function checkVersionFilter() {
function searchNow(value = "") {
if (value != "") // Update searchBar value
searchBar.value = value;
-
+
let allElements = document.querySelectorAll(".item-wrapper");
let searchValue = searchBar.value;
let count = 0; // Check if any matches found
@@ -298,7 +298,7 @@ function searchNow(value = "") {
}
searchValue = searchValue.replaceAll(versionPattern, "") // Don't include filters in the search
}
-
+
// Type
let filterType;
if (searchValue.match(typePattern)) {
@@ -323,12 +323,12 @@ function searchNow(value = "") {
let regex = new RegExp(searchValue, "gi")
let name = document.querySelectorAll(`#${e.id} .item-title h1`)[0].textContent // Syntax Name
let filtersFound = false;
-
+
// Version check
let versionFound;
if (version != "") {
versionFound = document.querySelectorAll(`#${e.id} .item-details:nth-child(2) td:nth-child(2)`)[0].textContent.includes(version);
-
+
if (versionAndUp || versionAndDown) {
let versions = document.querySelectorAll(`#${e.id} .item-details:nth-child(2) td:nth-child(2)`)[0].textContent.split(",");
for (const v in versions) { // split on ',' without space in case some version didn't have space and versionCompare will handle it
@@ -415,11 +415,11 @@ if (searchBar) {
setTimeout(() => { // Important to actually get the value after typing or deleting + better performance
searchNow();
}, 100);
- });
+ });
}
// Search Bar >
-// <> Dark Mode
+// <> Dark Mode
// Auto load DarkMode from cookies
if (getCookie("darkMode") == "false") {
@@ -550,7 +550,7 @@ function getCookie(cname) {
// Example: (.+) = ✓
const patterns = [ // [REGEX, CLASS]
[/((?")
-
+
for (let j = 0; j < lines.length; j++) {
Loop2:
for (let i = 0; i < patterns.length; i++) {
@@ -580,7 +580,7 @@ function highlightElement(element) {
let regex = patterns[i][0];
let oldLine = lines[j];
// console.log(regex)
-
+
while ((match = regex.exec(oldLine)) != null) {
lines[j] = lines[j].replaceAll(regex, `$1`)
if (regex.lastIndex == 0) // Break after it reaches the end of exec count to avoid inf loop
@@ -591,7 +591,7 @@ function highlightElement(element) {
element.innerHTML = lines.join("
")
}
-document.addEventListener("DOMContentLoaded", function(event) {
+document.addEventListener("DOMContentLoaded", function(event) {
setTimeout(() => {
document.querySelectorAll('.item-examples .skript-code-block').forEach(el => {
highlightElement(el);
@@ -604,4 +604,26 @@ document.addEventListener("DOMContentLoaded", function(event) {
});
}, 100);
});
-// Syntax Highlighting >
\ No newline at end of file
+// Syntax Highlighting >
+
+
+// <> Collapsible Examples
+var examples = document.querySelectorAll(".item-examples p");
+if (examples) {
+ examples.forEach(e => {
+ let pElement = e;
+ let divElement = e.parentElement.children[1];
+ pElement.addEventListener("click", ev => {
+ if (pElement.classList.contains("example-details-opened")) {
+ pElement.classList.remove("example-details-opened");
+ pElement.classList.add("example-details-closed");
+ divElement.style.display = "none";
+ } else {
+ pElement.classList.remove("example-details-closed");
+ pElement.classList.add("example-details-opened");
+ divElement.style.display = "block";
+ }
+ })
+ })
+}
+// Collapsible Examples >
\ No newline at end of file
diff --git a/docs/templates/desc_full.html b/docs/templates/desc_full.html
index 6e6e47fb9b7..cfd49e28142 100644
--- a/docs/templates/desc_full.html
+++ b/docs/templates/desc_full.html
@@ -30,6 +30,12 @@
Examples:
+Examples:
")); - desc = desc.replace("${element.desc-safe}", Joiner.on("\n").join(getNullOrEmptyDefault(description.value(), "Unknown description.")) + desc = desc.replace("${element.desc}", Joiner.on("\n").join(getNullOrEmptyDefault((description != null ? description.value() : null), "Unknown description.")).replace("\n\n", "
"));
+ desc = desc.replace("${element.desc-safe}", Joiner.on("\n").join(getNullOrEmptyDefault((description != null ? description.value() : null), "Unknown description."))
.replace("\\", "\\\\").replace("\"", "\\\"").replace("\t", " "));
Examples examples = c.getAnnotation(Examples.class);
- desc = desc.replace("${element.examples}", Joiner.on("
").join(getNullOrEmptyDefault(examples.value(), "Missing examples.")));
- desc = desc.replace("${element.examples-safe}", Joiner.on("\\n").join(getNullOrEmptyDefault(examples.value(), "Missing examples."))
+ desc = desc.replace("${element.examples}", Joiner.on("
").join(getNullOrEmptyDefault((examples != null ? examples.value() : null), "Missing examples.")));
+ desc = desc.replace("${element.examples-safe}", Joiner.on("\\n").join(getNullOrEmptyDefault((examples != null ? examples.value() : null), "Missing examples."))
.replace("\\", "\\\\").replace("\"", "\\\"").replace("\t", " "));
DocumentationId DocID = c.getAnnotation(DocumentationId.class);
- String ID = DocID != null ? DocID.value() : info.c.getSimpleName();
+ String ID = DocID != null ? (DocID != null ? DocID.value() : null) : info.c.getSimpleName();
// Fix duplicated IDs
if (page != null) {
if (page.contains("href=\"#" + ID + "\"")) {
@@ -434,7 +442,7 @@ private String generateAnnotated(String descTemp, SyntaxElementInfo> info, @Nu
assert desc != null;
desc = handleIf(desc, "${if events}", events != null);
if (events != null) {
- String[] eventNames = events.value();
+ String[] eventNames = (events != null ? events.value() : null);
String[] eventLinks = new String[eventNames.length];
for (int i = 0; i < eventNames.length; i++) {
String eventName = eventNames[i];
@@ -442,15 +450,20 @@ private String generateAnnotated(String descTemp, SyntaxElementInfo> info, @Nu
}
desc = desc.replace("${element.events}", Joiner.on(", ").join(eventLinks));
}
- desc = desc.replace("${element.events-safe}", events == null ? "" : Joiner.on(", ").join(events.value()));
+ desc = desc.replace("${element.events-safe}", events == null ? "" : Joiner.on(", ").join((events != null ? events.value() : null)));
RequiredPlugins plugins = c.getAnnotation(RequiredPlugins.class);
assert desc != null;
desc = handleIf(desc, "${if required-plugins}", plugins != null);
- desc = desc.replace("${element.required-plugins}", plugins == null ? "" : Joiner.on(", ").join(plugins.value()));
+ desc = desc.replace("${element.required-plugins}", plugins == null ? "" : Joiner.on(", ").join((plugins != null ? plugins.value() : null)));
+
+// TODO LATER
+// String addon = info.originClassPath;
+// desc = handleIf(desc, "${if by-addon}", true && !addon.isEmpty());
+// desc = desc.replace("${element.by-addon}", addon);
+ desc = handleIf(desc, "${if by-addon}", false);
- desc = handleIf(desc, "${if new-element}", Pattern.compile(skriptVersion + "(?!\\.)").matcher(since.value()).find()); // (?!\\.) to avoid matching 2.6 in 2.6.1 etc.
-// System.out.println(since.value() + " | " + skriptVersion);
+ desc = handleIf(desc, "${if new-element}", NEW_TAG_PATTERN.matcher((since != null ? since.value() : "")).find()); // (?!\\.) to avoid matching 2.6 in 2.6.1 etc.
desc = desc.replace("${element.type}", type);
List
").join(examples));
desc = desc
@@ -524,7 +542,7 @@ private String generateEvent(String descTemp, SkriptEventInfo> info, @Nullable
assert desc != null;
desc = handleIf(desc, "${if events}", events != null);
if (events != null) {
- String[] eventNames = events.value();
+ String[] eventNames = (events != null ? events.value() : null);
String[] eventLinks = new String[eventNames.length];
for (int i = 0; i < eventNames.length; i++) {
String eventName = eventNames[i];
@@ -532,13 +550,13 @@ private String generateEvent(String descTemp, SkriptEventInfo> info, @Nullable
}
desc = desc.replace("${element.events}", Joiner.on(", ").join(eventLinks));
}
- desc = desc.replace("${element.events-safe}", events == null ? "" : Joiner.on(", ").join(events.value()));
+ desc = desc.replace("${element.events-safe}", events == null ? "" : Joiner.on(", ").join((events != null ? events.value() : null)));
String[] requiredPlugins = info.getRequiredPlugins();
desc = handleIf(desc, "${if required-plugins}", requiredPlugins != null);
desc = desc.replace("${element.required-plugins}", Joiner.on(", ").join(requiredPlugins == null ? new String[0] : requiredPlugins));
- desc = handleIf(desc, "${if new-element}", Pattern.compile(skriptVersion + "(?!\\.)").matcher(since).find());
+ desc = handleIf(desc, "${if new-element}", NEW_TAG_PATTERN.matcher(since).find());
desc = desc.replace("${element.type}", "Event");
List
").join(examples));
desc = desc.replace("${element.examples-safe}", Joiner.on("\\n").join(examples)
@@ -605,7 +628,7 @@ private String generateClass(String descTemp, ClassInfo> info, @Nullable Strin
Events events = c.getAnnotation(Events.class);
desc = handleIf(desc, "${if events}", events != null);
if (events != null) {
- String[] eventNames = events.value();
+ String[] eventNames = (events != null ? events.value() : null);
String[] eventLinks = new String[eventNames.length];
for (int i = 0; i < eventNames.length; i++) {
String eventName = eventNames[i];
@@ -613,14 +636,14 @@ private String generateClass(String descTemp, ClassInfo> info, @Nullable Strin
}
desc = desc.replace("${element.events}", Joiner.on(", ").join(eventLinks));
}
- desc = desc.replace("${element.events-safe}", events == null ? "" : Joiner.on(", ").join(events.value()));
+ desc = desc.replace("${element.events-safe}", events == null ? "" : Joiner.on(", ").join((events != null ? events.value() : null)));
String[] requiredPlugins = info.getRequiredPlugins();
desc = handleIf(desc, "${if required-plugins}", requiredPlugins != null);
desc = desc.replace("${element.required-plugins}", Joiner.on(", ").join(requiredPlugins == null ? new String[0] : requiredPlugins));
- desc = handleIf(desc, "${if new-element}", Pattern.compile(skriptVersion + "(?!\\.)").matcher(since).find());
+ desc = handleIf(desc, "${if new-element}", NEW_TAG_PATTERN.matcher(since).find());
desc = desc.replace("${element.type}", "Type");
List
").join(examples));
desc = desc
@@ -683,7 +711,7 @@ private String generateFunction(String descTemp, JavaFunction> info) {
desc = handleIf(desc, "${if events}", false); // Functions do not require events nor plugins (at time writing this)
desc = handleIf(desc, "${if required-plugins}", false);
- desc = handleIf(desc, "${if new-element}", Pattern.compile(skriptVersion + "(?!\\.)").matcher(since).find());
+ desc = handleIf(desc, "${if new-element}", NEW_TAG_PATTERN.matcher(since).find());
desc = desc.replace("${element.type}", "Function");
List