-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13 from IdealistCat/main
V0.2.6 Modding Update
- Loading branch information
Showing
26 changed files
with
348 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
0.1.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
# DraggingBlog Modding API (v0.1) | ||
## Explanation | ||
The ``0.1`` version of the DraggingBlog Modding API is a robust system of image and text content replacement. | ||
|
||
Using Modding Script Packets, | ||
you are allowed to create simple mods to the DraggingBlog site. | ||
Unfortunately through forks unless | ||
we make a desktop website application, which would be a waste | ||
|
||
# Setup | ||
Setting up the Mod is simple as making a folder, | ||
and having an image or some text to replace using script packets and if replacing an image, | ||
have an image. | ||
|
||
So basically, create a folder in the mod folder inside the Content folder. | ||
|
||
Make sure it's with the mod name that you will set inside the SP modding folder's ``api.js`` script packet! | ||
|
||
Don't forget to set MOD_ENABLED to true if you are using script packets! | ||
|
||
# Production | ||
## Nerdy Explanation Stuff for later | ||
In the ``/Mod/Test`` folder. | ||
There is the folder ``Site/`` and the text file ``version.txt``. | ||
|
||
In the ``Site/`` folder, there is the ``WIP.png`` image. | ||
|
||
When linking to the Test mod WIP.png image, the file path in the second quotation set will be ``Site/WIP.png``. | ||
|
||
This is because the ``replaceImg()`` function uses the modding api's | ||
file path of ``Mod/ MOD_NAME /``. Cause the function uses ``returnPath()`` from | ||
``SP/util/files.js`` which uses the inital path of ``/Blog/Content/`` which makes | ||
sure it works and we don't have to put in the path... | ||
``/Blog/Content/Mod/Test/Site/WIP.png`` | ||
|
||
Because that would get annoying. | ||
|
||
## Image Replacement | ||
### Base Explanation | ||
Image Replacement is probably the first thing you would wanna do, but hold your horses, | ||
it's not going to be a "replicate the file location and just add file replacement". | ||
|
||
You gotta go to the ``SP/modding/templates`` folder first! | ||
|
||
### Script Packet Scripting | ||
And go into the page script packet where you wanna replace the base image with the image you are going to replace it with. | ||
|
||
Add the line: ``replaceImg("", "");``. | ||
|
||
In the first quotation set you will put the class name of the image tag you are going to replace. | ||
|
||
In the second quotation set you will put the file path of the image you have. | ||
|
||
### Ending | ||
After you inputted the needed data you should be good to go! | ||
|
||
## Text Replacement | ||
### Base Explanation | ||
Text Replacement is as simple as finding the text you wanna replace, and input the text you wanna replace it WITH. | ||
|
||
### Script Packet Scripting | ||
Go to ``SP/modding/templates`` and go to the page packet you wanna edit. | ||
|
||
Now add the line: ``replaceText('', '');``. | ||
|
||
In the first quotation set you could put the text id, like ``name`` | ||
|
||
Now in the second quotation set you will put the text you want to use. | ||
|
||
And your done :) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<html data-theme="dark"> | ||
<head> | ||
<link rel="stylesheet" href="/Blog/Pages/Styles/base.css"> | ||
<link rel="stylesheet" href="/Blog/Pages/Styles/mod-page.css"> | ||
<title>DraggingBlog - Mod Page</title> | ||
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no" /> | ||
</head> | ||
<body class="color1" align="center"> | ||
<div class="color4" align="center"> | ||
<a href="/Blog/index.html" id="backBtn">Back</a> | ||
<a href="/Blog/Pages/Help.html" id="HelpPage">Help</a> | ||
<a href="/Blog/Pages/ComicList.html" id="ComicsPage">Comics</a> | ||
<a href="/Blog/Pages/Settings.html" id="SettingsPage">Settings</a> | ||
<a href="/Blog/Pages/Credits.html" id="CreditsPage">Credits</a> | ||
</div> | ||
<div class="color2"> | ||
<h1 id="name"></h1> | ||
<div class="stick"> | ||
<p id="version"></p> | ||
<p id="description"></p> | ||
</div> | ||
<button | ||
class="settingsButton" | ||
id="toggle" | ||
toggle> | ||
Mod Toggle | ||
</button> | ||
</div> | ||
<br> | ||
|
||
<script type="module" src="/Blog/SP/href-setup.js"></script> | ||
<script type="module" src="/Blog/SP/mod-page.js"></script> | ||
<script type="module" src="/Blog/SP/modding/templates/mod.js"></script> | ||
<script type="module" src="/Blog/SP/settings/themeSet.js"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.stick { | ||
padding: -8; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,12 @@ | ||
import { validVersion } from '/Blog/SP/util/version.js'; | ||
import { MOD_NAME, MOD_ENABLED } from '/Blog/SP/modding/api.js'; | ||
|
||
var string_ver = "" | ||
string_ver = validVersion(); | ||
var string_ver = ''; | ||
string_ver = validVersion("version"); | ||
|
||
document.getElementById('version').innerHTML = "Blog Version: " + string_ver | ||
var name = "Blog"; | ||
|
||
if (MOD_ENABLED == true) | ||
name = MOD_NAME; | ||
|
||
document.getElementById('version').innerHTML = name + " Version: " + string_ver |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
// TODO: redo this in v0.2.7 or later |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
export let API_VERSION = '0.1.8'; | ||
|
||
export let MOD_NAME = "Test"; | ||
export let MOD_VERSION = "0.1.0"; | ||
|
||
export let MOD_ENABLED = false; | ||
|
||
export function replaceImg(id, replacement, ignore_enable) { | ||
// https://stackoverflow.com/a/48344753 | ||
// Tomas Kenzgaila | ||
|
||
var path = "/Blog/Content/Mod/" + MOD_NAME + '/' + replacement; | ||
|
||
var imgReplace = document.getElementsByClassName(id)[0]; | ||
|
||
if (MOD_ENABLED == true || ignore_enable == true){ | ||
if (replacement != "") | ||
imgReplace.src = path; | ||
|
||
imgReplace.style.visibility = "visible"; | ||
} | ||
} | ||
|
||
export function replaceText(id, replacement, ignore_enable) { | ||
var txtReplace = document.getElementById(id); | ||
|
||
if (MOD_ENABLED == true || ignore_enable == true){ | ||
if (replacement != "") | ||
txtReplace.innerHTML = replacement; | ||
} | ||
} | ||
|
||
export function toggleMod() { | ||
if (MOD_ENABLED == true) | ||
MOD_ENABLED = false; | ||
else | ||
MOD_ENABLED = true; | ||
|
||
return MOD_ENABLED; | ||
} | ||
|
||
export function returnModStats() { | ||
return MOD_ENABLED; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { replaceImg, replaceText } from '/Blog/SP/modding/api.js'; | ||
|
||
// Text | ||
replaceText('name', ''); | ||
replaceText('nonexist', ''); |
Oops, something went wrong.