From 6dbcb1a0eb5f1c9b0a9508c9b3b146a55d5057ad Mon Sep 17 00:00:00 2001 From: Atomos821 Date: Wed, 21 Oct 2020 17:15:47 +0200 Subject: [PATCH] simplier nav script + mov old doc --- docs/assets/js/aki-navigator.js | 59 +++++++++++++ docs/assets/js/akiNavigatorRouter.js | 85 ------------------ docs/index.html | 67 ++++++++++---- docs/md/{ => .old}/index.md | 1 + docs/md/{ => .old}/resources/index.md | 0 .../resources/itemsStats_resources.md | 50 ++++++++--- .../resources/locations_resources.md | 0 .../{ => .old}/resources/other_resources.md | 0 .../resources/playerProfile_resources.md | 0 .../{ => .old}/resources/quests_resources.md | 0 .../{ => .old}/sp-tarkov/install_sp-tarkov.md | 0 .../{ => .old}/tutorials/add_new_bundles.md | 0 docs/md/{ => .old}/tutorials/bug-report.md | 0 docs/md/{ => .old}/tutorials/create_a_mod.md | 0 .../md/{ => .old}/tutorials/create_weather.md | 0 .../development-environment-setup.md | 0 .../tutorials/edit_globals_values.md | 0 .../tutorials/edit_location_values.md | 0 .../tutorials/edit_the_player_profile.md | 0 .../tutorials/edit_traders_values.md | 0 .../tutorials/edit_weapons_texture.md | 0 docs/md/{ => .old}/tutorials/index.md | 0 .../tutorials/photoshop_texture_editing.md | 0 docs/md/{ => spt-aki}/about.md | 0 docs/md/{ => spt-aki}/faq.md | 0 www/info.html => docs/md/spt-aki/install.md | 0 www/assets/js/aki-navigator.js | 59 +++++++++++++ www/assets/js/akiNavigatorTemplate.js | 88 ------------------- www/{templates => content}/community.html | 0 www/{templates => content}/download.html | 0 www/{templates => content}/features.html | 0 www/{templates => content}/home.html | 0 www/index.html | 12 ++- 33 files changed, 208 insertions(+), 213 deletions(-) create mode 100644 docs/assets/js/aki-navigator.js delete mode 100644 docs/assets/js/akiNavigatorRouter.js rename docs/md/{ => .old}/index.md (99%) rename docs/md/{ => .old}/resources/index.md (100%) rename docs/md/{ => .old}/resources/itemsStats_resources.md (96%) rename docs/md/{ => .old}/resources/locations_resources.md (100%) rename docs/md/{ => .old}/resources/other_resources.md (100%) rename docs/md/{ => .old}/resources/playerProfile_resources.md (100%) rename docs/md/{ => .old}/resources/quests_resources.md (100%) rename docs/md/{ => .old}/sp-tarkov/install_sp-tarkov.md (100%) rename docs/md/{ => .old}/tutorials/add_new_bundles.md (100%) rename docs/md/{ => .old}/tutorials/bug-report.md (100%) rename docs/md/{ => .old}/tutorials/create_a_mod.md (100%) rename docs/md/{ => .old}/tutorials/create_weather.md (100%) rename docs/md/{ => .old}/tutorials/development-environment-setup.md (100%) rename docs/md/{ => .old}/tutorials/edit_globals_values.md (100%) rename docs/md/{ => .old}/tutorials/edit_location_values.md (100%) rename docs/md/{ => .old}/tutorials/edit_the_player_profile.md (100%) rename docs/md/{ => .old}/tutorials/edit_traders_values.md (100%) rename docs/md/{ => .old}/tutorials/edit_weapons_texture.md (100%) rename docs/md/{ => .old}/tutorials/index.md (100%) rename docs/md/{ => .old}/tutorials/photoshop_texture_editing.md (100%) rename docs/md/{ => spt-aki}/about.md (100%) rename docs/md/{ => spt-aki}/faq.md (100%) rename www/info.html => docs/md/spt-aki/install.md (100%) create mode 100644 www/assets/js/aki-navigator.js delete mode 100644 www/assets/js/akiNavigatorTemplate.js rename www/{templates => content}/community.html (100%) rename www/{templates => content}/download.html (100%) rename www/{templates => content}/features.html (100%) rename www/{templates => content}/home.html (100%) diff --git a/docs/assets/js/aki-navigator.js b/docs/assets/js/aki-navigator.js new file mode 100644 index 0000000..51dfe70 --- /dev/null +++ b/docs/assets/js/aki-navigator.js @@ -0,0 +1,59 @@ +'use strict'; + +class AkiNavigator { + constructor(defaultView, fetchPath = 'content') { + this.header = undefined; + this.contentOutlet = undefined; + this.defaultView = defaultView; + this.fetchPath = fetchPath; + + this.onExec(); + } + + onExec() { + this.header = document.querySelector('header'); + this.contentOutlet = document.querySelector('#router-outlet'); + + window.addEventListener('hashchange', () => this.displayView(window.location.hash.substr(1))); + + if (window.location.hash) { + this.displayView(window.location.hash.substr(1)); + } else if (typeof this.defaultView !== 'undefined') { + this.displayView(this.defaultView); + } + } + + removeChildren(element) { + let count = element.childNodes.length; + + while (count--) { + element.removeChild(element.lastChild); + } + } + + async fetchView(view) { + const response = await fetch(`${this.fetchPath}/${view}.html`); + const text = await response.text(); + + this.removeChildren(this.contentOutlet); + this.contentOutlet.innerHTML = text; + } + + displayView(view) { + this.fetchView(view); + + const activeLinks = document.querySelectorAll('a[active]'); + const newActiveLinks = document.querySelectorAll(`a[href='#${view}']`); + + if (activeLinks.length > 0) { + activeLinks.forEach(link => link.removeAttribute('active')); + } + + newActiveLinks.forEach(newLink => newLink.setAttribute('active', '')); + + this.contentOutlet.scrollTop = 0; + + // FIXME: history push is fucked rn. + // window.history.pushState(null, `${view}`, `#${view}`); + } +} diff --git a/docs/assets/js/akiNavigatorRouter.js b/docs/assets/js/akiNavigatorRouter.js deleted file mode 100644 index fadad97..0000000 --- a/docs/assets/js/akiNavigatorRouter.js +++ /dev/null @@ -1,85 +0,0 @@ -/** - * Contains edits to better suit the docs web app. - */ - -'use strict'; - -class AkiNavigatorRouter { - constructor(routes, ...callbacks) { - this._header = undefined; - this._routerOutlet = undefined; - this._routes = routes; - - this._onExec(callbacks); - } - - _onExec(callbacks) { - this._getReferences(); - - window.addEventListener("hashchange", () => this.displayView(window.location.hash.substr(1))); - - if (window.location.hash) { - this.displayView(window.location.hash.substr(1)); - } - - if (callbacks.length > 0) { - callbacks.forEach(callback => { - if (typeof callback == 'function') { - callback(); - } - }); - } - } - - _getReferences() { - this._header = document.querySelector('header'); - this._routerOutlet = document.querySelector('#router-outlet'); - } - - _removeChildren(element) { - let count = element.childNodes.length; - - while (count--) { - element.removeChild(element.lastChild); - } - } - - async _fetchView(view) { - const response = await fetch(`md/${view}`); - const text = await response.text(); - - this._removeChildren(this._routerOutlet); - // this._routerOutlet.innerHTML = text; - - this._routerOutlet.innerHTML = marked(text); - Prism.highlightAll(); - } - - displayView(view) { - // Useless here. Only fetch is used. - // if (this._mode === 'fetch') { - // this._fetchView(view); - // } else { - // this._setView(view); - // } - - this._fetchView(view); - - const activeLinks = document.querySelectorAll('a[active]'); - const newActiveLinks = document.querySelectorAll(`a[href='#${view}']`); - - console.log('view:', view); - console.log('activeLinks:', activeLinks); - console.log('newActiveLinks:', newActiveLinks); - - if (activeLinks.length > 0) { - activeLinks.forEach(link => link.removeAttribute('active')); - } - - newActiveLinks.forEach(newLink => newLink.setAttribute('active', '')); - - this._routerOutlet.scrollTop = 0; - // FIXME: history push is fucked rn. - // window.history.pushState(null, `${view}`, `#${view}`); - } -} \ No newline at end of file diff --git a/docs/index.html b/docs/index.html index e79f179..d7bfdff 100644 --- a/docs/index.html +++ b/docs/index.html @@ -24,7 +24,6 @@ Website Workshop Gitea - @@ -42,17 +41,37 @@ - + \ No newline at end of file diff --git a/docs/md/index.md b/docs/md/.old/index.md similarity index 99% rename from docs/md/index.md rename to docs/md/.old/index.md index 959a312..f069510 100644 --- a/docs/md/index.md +++ b/docs/md/.old/index.md @@ -11,6 +11,7 @@ sidebar_label: Home > A complete documentation website for SP-Tarkov. What will you find here ? + - [A FAQ page](faq.md) - [Tutorials](tutorials/index.md) - [Modders resources](resources/index.md) diff --git a/docs/md/resources/index.md b/docs/md/.old/resources/index.md similarity index 100% rename from docs/md/resources/index.md rename to docs/md/.old/resources/index.md diff --git a/docs/md/resources/itemsStats_resources.md b/docs/md/.old/resources/itemsStats_resources.md similarity index 96% rename from docs/md/resources/itemsStats_resources.md rename to docs/md/.old/resources/itemsStats_resources.md index 0114606..a8b9677 100644 --- a/docs/md/resources/itemsStats_resources.md +++ b/docs/md/.old/resources/itemsStats_resources.md @@ -4,7 +4,7 @@ ## Color list -``` +```json { blue, yellow, @@ -22,7 +22,7 @@ ## Stimulator buff list -``` +```json { HealthRate, EnergyRate, @@ -45,7 +45,8 @@ ## All nodes ID ### Barters item -``` + +```json "57864bb7245977548b3b66c2" //Tools "57864c8c245977548867e7f1" //Medical Supplies "57864e4c24597754843f8723" //Flammable materials @@ -56,8 +57,10 @@ "57864ee62459775490116fc1" //Battery "590c745b86f7743cc433c5f2" //Other ``` + ### Gear -``` + +```json "57bef4c42459772e8d35a53b" //GearComponents "5448e54d4bdc2dcc718b4568" //Armor "5448bf274bdc2dfc2f8b456a" //Secured Containers @@ -70,25 +73,32 @@ "5a341c4686f77469e155819e" //Facecover "5b3f15d486f77432d0509248" //Armband ``` + ### Weapon Parts & mod + #### Vital Parts -``` + +```json "55818a304bdc2db5418b457d" //Receiver "55818a684bdc2ddd698b456d" //PistolGrip "56ea9461d2720b67698b456f" //Gasblock "55818a104bdc2db9688b4569" //Handguard "555ef6e44bdc2de9068b457e" //Barrel ``` + #### Gear Mods -``` + +```json "55818a594bdc2db9688b456a" //Stock "55818b224bdc2dde698b456f" //Mounts "5448bc234bdc2d3c308b4569" //Magazines "55818b014bdc2ddc698b456b" //Launcher "55818a6f4bdc2db9688b456b" //Charging Handle ``` + #### Functional Mods -``` + +```json "5a74651486f7744e73386dd1" //Auxiliary Parts "5448fe7a4bdc2d6f028b456b" //Sights "55818b0e4bdc2dde698b456e" //LightLasers @@ -96,8 +106,10 @@ "55818af64bdc2d5b648b4570" //Foregrip "55818afb4bdc2dde698b456d" //Bipods ``` + #### Weapons -``` + +```json "543be6564bdc2df4348b4568" //Throwable "5447e1d04bdc2dff2f8b4567" //Melee Weapons "5447bed64bdc2d97278b4568" //Machine Guns @@ -109,32 +121,42 @@ "5447b5f14bdc2d61278b4567" //AssaultRifles "5447b5fc4bdc2d87278b4567" //AssaultCarbines ``` + #### Ammo -``` + +```json "543be5cb4bdc2deb348b4568" //Ammobox "5485a8684bdc2da71d8b4567" //Rounds ``` + #### Provisions -``` + +```json "5448e8d04bdc2ddf718b4569" //Food "5448e8d64bdc2dce718b4568" //Drinks ``` + #### Medical Treatment -``` + +```json "5448f3a64bdc2d60728b456a" //Injectors "5448f3ac4bdc2dce718b4569" //Injury Treatments "5448f39d4bdc2d0a728b4568" //Medkit "5448f3a14bdc2d27728b4569" //Pills ``` + #### Keys -``` + +```json "5c164d2286f774194c5e69fa" //Keycards "5c99f98d86f7745c314214b3" //MechanicalKeys ``` + #### Other -``` + +```json "5448ecbe4bdc2d60728b4568" //Info items "5447e0e74bdc2d3c308b4567" //Special Equipments "567849dd4bdc2d150f8b456e" //Maps "543be5dd4bdc2deb348b4569" //Money -``` \ No newline at end of file +``` diff --git a/docs/md/resources/locations_resources.md b/docs/md/.old/resources/locations_resources.md similarity index 100% rename from docs/md/resources/locations_resources.md rename to docs/md/.old/resources/locations_resources.md diff --git a/docs/md/resources/other_resources.md b/docs/md/.old/resources/other_resources.md similarity index 100% rename from docs/md/resources/other_resources.md rename to docs/md/.old/resources/other_resources.md diff --git a/docs/md/resources/playerProfile_resources.md b/docs/md/.old/resources/playerProfile_resources.md similarity index 100% rename from docs/md/resources/playerProfile_resources.md rename to docs/md/.old/resources/playerProfile_resources.md diff --git a/docs/md/resources/quests_resources.md b/docs/md/.old/resources/quests_resources.md similarity index 100% rename from docs/md/resources/quests_resources.md rename to docs/md/.old/resources/quests_resources.md diff --git a/docs/md/sp-tarkov/install_sp-tarkov.md b/docs/md/.old/sp-tarkov/install_sp-tarkov.md similarity index 100% rename from docs/md/sp-tarkov/install_sp-tarkov.md rename to docs/md/.old/sp-tarkov/install_sp-tarkov.md diff --git a/docs/md/tutorials/add_new_bundles.md b/docs/md/.old/tutorials/add_new_bundles.md similarity index 100% rename from docs/md/tutorials/add_new_bundles.md rename to docs/md/.old/tutorials/add_new_bundles.md diff --git a/docs/md/tutorials/bug-report.md b/docs/md/.old/tutorials/bug-report.md similarity index 100% rename from docs/md/tutorials/bug-report.md rename to docs/md/.old/tutorials/bug-report.md diff --git a/docs/md/tutorials/create_a_mod.md b/docs/md/.old/tutorials/create_a_mod.md similarity index 100% rename from docs/md/tutorials/create_a_mod.md rename to docs/md/.old/tutorials/create_a_mod.md diff --git a/docs/md/tutorials/create_weather.md b/docs/md/.old/tutorials/create_weather.md similarity index 100% rename from docs/md/tutorials/create_weather.md rename to docs/md/.old/tutorials/create_weather.md diff --git a/docs/md/tutorials/development-environment-setup.md b/docs/md/.old/tutorials/development-environment-setup.md similarity index 100% rename from docs/md/tutorials/development-environment-setup.md rename to docs/md/.old/tutorials/development-environment-setup.md diff --git a/docs/md/tutorials/edit_globals_values.md b/docs/md/.old/tutorials/edit_globals_values.md similarity index 100% rename from docs/md/tutorials/edit_globals_values.md rename to docs/md/.old/tutorials/edit_globals_values.md diff --git a/docs/md/tutorials/edit_location_values.md b/docs/md/.old/tutorials/edit_location_values.md similarity index 100% rename from docs/md/tutorials/edit_location_values.md rename to docs/md/.old/tutorials/edit_location_values.md diff --git a/docs/md/tutorials/edit_the_player_profile.md b/docs/md/.old/tutorials/edit_the_player_profile.md similarity index 100% rename from docs/md/tutorials/edit_the_player_profile.md rename to docs/md/.old/tutorials/edit_the_player_profile.md diff --git a/docs/md/tutorials/edit_traders_values.md b/docs/md/.old/tutorials/edit_traders_values.md similarity index 100% rename from docs/md/tutorials/edit_traders_values.md rename to docs/md/.old/tutorials/edit_traders_values.md diff --git a/docs/md/tutorials/edit_weapons_texture.md b/docs/md/.old/tutorials/edit_weapons_texture.md similarity index 100% rename from docs/md/tutorials/edit_weapons_texture.md rename to docs/md/.old/tutorials/edit_weapons_texture.md diff --git a/docs/md/tutorials/index.md b/docs/md/.old/tutorials/index.md similarity index 100% rename from docs/md/tutorials/index.md rename to docs/md/.old/tutorials/index.md diff --git a/docs/md/tutorials/photoshop_texture_editing.md b/docs/md/.old/tutorials/photoshop_texture_editing.md similarity index 100% rename from docs/md/tutorials/photoshop_texture_editing.md rename to docs/md/.old/tutorials/photoshop_texture_editing.md diff --git a/docs/md/about.md b/docs/md/spt-aki/about.md similarity index 100% rename from docs/md/about.md rename to docs/md/spt-aki/about.md diff --git a/docs/md/faq.md b/docs/md/spt-aki/faq.md similarity index 100% rename from docs/md/faq.md rename to docs/md/spt-aki/faq.md diff --git a/www/info.html b/docs/md/spt-aki/install.md similarity index 100% rename from www/info.html rename to docs/md/spt-aki/install.md diff --git a/www/assets/js/aki-navigator.js b/www/assets/js/aki-navigator.js new file mode 100644 index 0000000..ed8d242 --- /dev/null +++ b/www/assets/js/aki-navigator.js @@ -0,0 +1,59 @@ +'use strict'; + +class AkiNavigator { + constructor(defaultView, fetchPath = 'content') { + this.header = undefined; + this.contentOutlet = undefined; + this.defaultView = defaultView; + this.fetchPath = fetchPath; + + this.onExec(); + } + + onExec() { + this.header = document.querySelector('header'); + this.contentOutlet = document.querySelector('#router-outlet'); + + window.addEventListener('hashchange', () => this.displayView(window.location.hash.substr(1))); + + if (window.location.hash) { + this.displayView(window.location.hash.substr(1)); + } else if (typeof this.defaultView !== 'undefined') { + this.displayView(this.defaultView); + } + } + + removeChildren(element) { + let count = element.childNodes.length; + + while (count--) { + element.removeChild(element.lastChild); + } + } + + async fetchView(view) { + const response = await fetch(`${this.fetchPath}/${view}.html`); + const text = await response.text(); + + this.removeChildren(this.contentOutlet); + this.contentOutlet.innerHTML = text; + } + + displayView(view) { + this.fetchView(view); + + const activeLinks = document.querySelectorAll('a[active]'); + const newActiveLinks = document.querySelectorAll(`a[href='#${view}']`); + + if (activeLinks.length > 0) { + activeLinks.forEach(link => link.removeAttribute('active')); + } + + newActiveLinks.forEach(newLink => newLink.setAttribute('active', '')); + + this.contentOutlet.scrollTop = 0; + + // FIXME: history push is fucked rn. + // window.history.pushState(null, `${view}`, `#${view}`); + } +} diff --git a/www/assets/js/akiNavigatorTemplate.js b/www/assets/js/akiNavigatorTemplate.js deleted file mode 100644 index 534df7e..0000000 --- a/www/assets/js/akiNavigatorTemplate.js +++ /dev/null @@ -1,88 +0,0 @@ -'use strict'; - -class AkiNavigatorTemplate { - constructor(mode) { - this._header = undefined; - this._templates = undefined; - this._routerOutlet = undefined; - this._mode = mode; - - this._onExec(); - } - - _onExec() { - console.log('Navigating using mode:', this._mode); - - this._getReferences(); - this._getTemplates(); - - window.addEventListener('hashchange', () => this.displayView(window.location.hash.substr(1))); - - if (!window.location.hash) { - this._mode === 'fetch' ? this.displayView('home') : this.displayView('home'); - } else { - this.displayView(window.location.hash.substr(1)); - } - } - - _getReferences() { - this._header = document.querySelector('header'); - this._routerOutlet = document.querySelector('#router-outlet'); - } - - _getTemplates() { - this._templates = [].slice.call(document.getElementsByTagName('template')); - } - - _viewModeAction() { - if (this._mode === 'fetch') { - this.fetchView(window.location.hash.substr(1)) - } else { - this.setView(window.location.hash.substr(1)); - } - } - - _removeChildren(element) { - let count = element.childNodes.length; - - while (count--) { - element.removeChild(element.lastChild); - } - } - - _setView(view) { - const template = this._templates.filter(template => template.id === `template-${view}`)[0]; - this._removeChildren(this._routerOutlet); - this._routerOutlet.appendChild(template.content.cloneNode(true)); - } - - async _fetchView(view) { - const response = await fetch(`templates/${view}.html`); - const text = await response.text(); - - this._removeChildren(this._routerOutlet); - this._routerOutlet.innerHTML = text; // innerHTML gets the job done. - } - - displayView(view) { - if (this._mode === 'fetch') { - this._fetchView(view); - } else { - this._setView(view); - } - - const activeLinks = document.querySelectorAll('a[active]'); - const newActiveLinks = document.querySelectorAll(`a[href='#${view}']`); - - if (activeLinks.length > 0) { - activeLinks.forEach(link => { - link.removeAttribute('active') - }); - } - - newActiveLinks.forEach(newLink => newLink.setAttribute('active', '')); - - // FIXME: history push is fucked rn. - // window.history.pushState(null, `${view}`, `#${view}`); - } -} \ No newline at end of file diff --git a/www/templates/community.html b/www/content/community.html similarity index 100% rename from www/templates/community.html rename to www/content/community.html diff --git a/www/templates/download.html b/www/content/download.html similarity index 100% rename from www/templates/download.html rename to www/content/download.html diff --git a/www/templates/features.html b/www/content/features.html similarity index 100% rename from www/templates/features.html rename to www/content/features.html diff --git a/www/templates/home.html b/www/content/home.html similarity index 100% rename from www/templates/home.html rename to www/content/home.html diff --git a/www/index.html b/www/index.html index 6ed4a4e..0643563 100644 --- a/www/index.html +++ b/www/index.html @@ -31,8 +31,8 @@ @@ -54,6 +54,7 @@ +
Home Download @@ -63,13 +64,10 @@ SPT-AKI is not affiliated with Battlestate Games Ltd. in any way.
- - - - +