diff --git a/main.php b/main.php
index 1dad653..b314ee4 100644
--- a/main.php
+++ b/main.php
@@ -28,91 +28,117 @@ function redirect($path)
exit(0); // TERMINATE CURRENT SCRIPT!
}
-if (isset($_GET["rescan"]))
+$te = new template_engine();
+if ($display == "main")
{
- $lib->rescan_library(json_decode(file_get_contents("session/settings.json"), true)["osu_folder"]);
- $lib->save_db();
- redirect("./");
-}
-
-if (isset($_GET["scan"]))
-{
- $lib->scan_library(json_decode(file_get_contents("session/settings.json"), true)["osu_folder"]);
- $lib->save_db();
- redirect("./");
-}
-
-if (isset($_GET["blacken"]))
-{
- @optimizer::blacken_backgrounds($lib);
- redirect("./");
-}
-
-if (isset($_GET["nosb"]))
-{
- @optimizer::remove_storyboards($lib);
- redirect("./");
-}
-
-if (isset($_GET["novid"]))
-{
- @optimizer::remove_videos($lib);
- redirect("./");
-}
-
-if (isset($_GET["noskin"]))
-{
- @optimizer::remove_skins($lib);
- redirect("./");
-}
-
-if (isset($_GET["nohit"]))
-{
- @optimizer::remove_hitsounds($lib);
- redirect("./");
-}
-
-if (isset($_GET["purify"]))
-{
- @optimizer::remove_other($lib);
- redirect("./");
-}
-
-if (isset($_GET["nuke"]))
-{
- @optimizer::full_nuke($lib);
- redirect("./");
-}
-
-$start = file_get_contents("resources/start.html");
-$start = str_replace("{{ STYLE }}", file_get_contents("resources/style.css"), $start);
-echo $start;
-// dump($lib, "lib");
-echo '[Scan] ';
-echo '[Force rescan] ';
-echo '[Remove backgrounds] ';
-echo '[Remove videos] ';
-echo '[Remove storyboards] ';
-echo '[Remove beatmap skins] ';
-echo '[Remove custom hitsounds] ';
-echo '[Remove junk files] ';
-echo '[NUKE] ';
-echo '
[Explore] ';
-echo "
';
diff --git a/templates/base.html b/templates/base.html
new file mode 100644
index 0000000..263a0bb
--- /dev/null
+++ b/templates/base.html
@@ -0,0 +1 @@
+{{ HEAD }}{{ BODY }}
\ No newline at end of file
diff --git a/templates/body.html b/templates/body.html
new file mode 100644
index 0000000..b108db0
--- /dev/null
+++ b/templates/body.html
@@ -0,0 +1,3 @@
+
+{{ CONTENT }}
+
\ No newline at end of file
diff --git a/templates/head.html b/templates/head.html
new file mode 100644
index 0000000..62f239d
--- /dev/null
+++ b/templates/head.html
@@ -0,0 +1,3 @@
+
osu! Optimizer by Thayol
+
+
\ No newline at end of file
diff --git a/templates/main-browser-script.js b/templates/main-browser-script.js
new file mode 100644
index 0000000..d5ff95e
--- /dev/null
+++ b/templates/main-browser-script.js
@@ -0,0 +1,30 @@
+var xmlhttp = new XMLHttpRequest();
+var page = 1;
+var url = "./splitter.php?format=json&page=" + page.toString();
+
+xmlhttp.onreadystatechange = function() {
+ // done & success
+ if (this.readyState == 4 && this.status == 200) {
+ var result = JSON.parse(this.responseText);
+ alert(result);
+ changeBrowser(result);
+ }
+};
+
+xmlhttp.open("GET", url, true);
+xmlhttp.send();
+
+function changeBrowser(mapsets)
+{
+ var browser = document.getElementById("browser");
+
+ var output = "";
+
+ var template = "
";
+ for (var beatmap of mapsets.entries)
+ {
+ output += template.replaceAll(/\{\{ MAP_TITLE \}\}/g, beatmap.Metadata.Title);
+ }
+
+ browser.innerHTML = output;
+}
diff --git a/templates/main-option.html b/templates/main-option.html
new file mode 100644
index 0000000..faaa271
--- /dev/null
+++ b/templates/main-option.html
@@ -0,0 +1,5 @@
+
+
{{ MAIN_OPTION_NAME }}
+
{{ MAIN_OPTION_DESCRIPTION }}
+
[ Do it! ]
+
\ No newline at end of file
diff --git a/templates/main.html b/templates/main.html
new file mode 100644
index 0000000..868ea7b
--- /dev/null
+++ b/templates/main.html
@@ -0,0 +1,24 @@
+
+
osu! optimizer (PHP)
+
by Thayol
+
+
Stats
+
+ {{ MAIN_MAPSET_COUNT }} mapsets loaded.
+ osu! folder: {{ MAIN_FOLDER_LOCATION }}
+ Sum of individual file parse times: {{ MAIN_PARSE_TIME }}
+ Last scan took {{ MAIN_SCAN_TIME }} seconds.
+
+
+
+
Actions
+
{{ MAIN_OPTIONS }}
+
+
+
\ No newline at end of file
diff --git a/templates/style.css b/templates/style.css
new file mode 100644
index 0000000..77676e9
--- /dev/null
+++ b/templates/style.css
@@ -0,0 +1,67 @@
+html {
+ font-family: Roboto, sans-serif;
+ background-color: #111111;
+ color: White;
+}
+.beatmapset, .beatmap {
+ border: 1px solid white;
+}
+
+.beatmap {
+ margin: 5px 0;
+ padding: 10px;
+}
+a:link, a:hover, a:active, a:visited {
+ color: HotPink;
+ text-decoration: inherit;
+}
+.small-background {
+ max-height: 100px;
+}
+.option-description {
+ font-size: 0.9em;
+ text-decoration: italics;
+ color: #dddddd;
+}
+.option-title, .option-description, .option-link {
+ margin: 0;
+}
+.option-link {
+ position: absolute;
+ right: 10px; bottom: 10px;
+}
+.options {
+ display: flex;
+ flex-flow: row wrap;
+ justify-content: flex-start;
+}
+.option {
+ position: relative;
+ flex: 1;
+ min-width: 300px;
+ margin: 5px;
+ padding: 10px;
+ border: 1px solid white;
+}
+.main-container {
+ display: flex;
+ flex-flow: column nowrap;
+}
+.main-item {
+ flex: 1;
+ border: 1px solid white;
+ padding: 10px;
+ margin: 5px;
+}
+.main-container>h1, .main-container>h3 {
+ text-align: center;
+ margin: 0;
+ padding: 0;
+}
+.main-item>h2 {
+ border-bottom: 1px solid white;
+}
+.main-item>h2, .main-item>h3 {
+ margin: 5px;
+ padding: 5px;
+}
\ No newline at end of file