MyWebsitesGenerator/TestWebGen/ThePraArt.h
2017-05-01 21:51:45 +02:00

234 lines
9.3 KiB
C++

#pragma once
#include "Utilities.h"
#include <iostream>
#include <fstream>
class ThePraArt : Utilities
{
public:
string blog = "index.html",
about = "aboutme.html",
patreon = "https://www.patreon.com/thepra",
youtube = "https://www.youtube.com/channel/UCW-00DYkKRXLO6C_IIy8EEw",
youtubePosts = "youtubeposts.html",
twitch = "https://www.twitch.tv/thepra",
tumblr = "http://thepra.tumblr.com",
deviantArt = "http://thepra.deviantart.com",
instagram = "https://www.instagram.com/_thepra_",
facebook = "https://www.facebook.com/ThePratribal",
twitter = "https://twitter.com/_ThePra_";
string Home = "Blog",
AboutMe = "About Me",
Patreon = "Patreon",
YouTube = "YouTube",
Twitch = "Twitch",
Tumblr = "Tumblr",
DeviantArt = "DeviantArt",
Instagram = "Instagram",
Facebook = "Facebook",
Twitter = "Twitter",
Menu = "Menu";
string contentFolder = "\\thepraart\\content\\";
string contentLinks[3]{
contentFolder + "index.txt",
contentFolder + "aboutme.txt",
contentFolder + "youtubeposts.txt"
};
string outputPath{current_path().append("output_thepraart\\").string()};
string outputLinks[3]{
outputPath + "index.html",
outputPath + "aboutme.html",
outputPath + "youtubeposts.html"
};
static void BuildBody(Document &file, string cPath, Levels level, Col color, PageType ptype = NORMAL);
private:
static list<Node> NavigationBar(Levels level, DeskOrMob mtype, Col color);
static list<Node> SingleMainContent(Levels level, string cPath, DeskOrMob mtype, list<string> content = {""});
static Node Player(Levels level, Col color);
};
inline void ThePraArt::BuildBody(Document &file, string cPath, Levels level, Col color, PageType ptype)
{
list<Node> navBar = NavigationBar(level, D, color);
list<Node> navBarM = NavigationBar(level, M, color);
list<Node> main = SingleMainContent(level, cPath, D);
list<Node> mainM = SingleMainContent(level, cPath, M);
navBar.push_front(Node());
Node desktop = Node("section.desktop");
Node mobile = Node("section.mobile");
for each (Node item in navBar)
{
desktop.AppendChild(item);
}
for each (Node item in navBarM)
{
mobile.AppendChild(item);
}
for each (Node item in main)
{
desktop.AppendChild(item);
}
for each (Node item in mainM)
{
mobile.AppendChild(item);
}
file.AddNodeToBody(desktop);
file.AddNodeToBody(mobile);
}
inline list<Node> ThePraArt::NavigationBar(Levels level, DeskOrMob mtype, Col color)
{
ThePraArt a;
string whichLevel = ChooseLevel(level);
string c = (color == White) ? "" : "t";
switch (mtype)
{
case D:
{
//leftfixed
Node elem00 = Node("div.leftfixed"),
elem01 = Node("img").SetAttribute(a.src, "/images/navdecups"+c+".png").SetAttribute(a.alt, "Upper Left Decoration").UseClosingTag(false),
elem02 = Node(a.ul),
elem03 = Node(a.li).AppendChild(Node(a.a).SetAttribute(a.href, a.blog).SetContent(a.Home)),
elem04 = Node(a.li).AppendChild(Node(a.a).SetAttribute(a.href, a.patreon).SetAttribute("target","_blank").SetContent(a.Patreon)),
elem05 = Node(a.li).AppendChild(Node(a.a).SetAttribute(a.href, a.youtubePosts).SetContent(a.YouTube)),
elem06 = Node(a.li).AppendChild(Node(a.a).SetAttribute(a.href, a.about).SetContent(a.AboutMe)),
elem07 = Node(a.li).SetContent("( ・ω・)ノ<!--Hello there!-->"),
elem08 = Node(a.li).SetContent("\\(゜ロ゜)<!--Oh shit! Look up guys, someone who read the source file!! They uncovered us!!! WE ARE DOOMED!!!!-->"),
elem09 = Node(a.li).AppendChild(Node(a.a).SetAttribute(a.href, a.twitch).SetAttribute("target", "_blank").SetContent(a.Twitch)),
elem10 = Node("img").SetAttribute(a.src, "/images/navdecupg" + c + ".png").SetAttribute(a.alt, "Bottom Left Decoration").UseClosingTag(false);
elem02.AppendChild(elem03)
.AppendChild(elem04)
.AppendChild(elem05)
.AppendChild(elem06)
.AppendChild(elem07)
.AppendChild(elem08)
.AppendChild(elem09);
elem00.AppendChild(elem01)
.AppendChild(elem02)
.AppendChild(elem10);
//player
Node player = Player(level,color);
//rightfixed
Node elem20 = Node("div.rightfixed"),
elem21 = Node("img").SetAttribute(a.src,"/images/navdecupds" + c + ".png").SetAttribute(a.alt, "Upper Right Decoration").UseClosingTag(false),
elem22 = Node(a.ul),
elem23 = Node(a.li).AppendChild(Node(a.a).SetAttribute(a.href, a.tumblr).SetAttribute("target", "_blank").SetContent(a.Tumblr)),
elem24 = Node(a.li).AppendChild(Node(a.a).SetAttribute(a.href, a.deviantArt).SetAttribute("target", "_blank").SetContent(a.DeviantArt)),
elem25 = Node(a.li).AppendChild(Node(a.a).SetAttribute(a.href, a.instagram).SetAttribute("target", "_blank").SetContent(a.Instagram)),
elem26 = Node(a.li).AppendChild(Node(a.a).SetAttribute(a.href, a.facebook).SetAttribute("target", "_blank").SetContent(a.Facebook)),
elem27 = Node(a.li).SetContent("ヾ(・ω・o)<!--Hello!-->"),
elem28 = Node(a.li).AppendChild(Node(a.a).SetAttribute(a.href, a.twitter).SetAttribute("target", "_blank").SetContent(a.Twitter)),
elem29 = Node("img").SetAttribute(a.src, "/images/navdecupdg" + c + ".png").SetAttribute(a.alt, "Bottom Right Decoration").UseClosingTag(false);
elem22.AppendChild(elem23)
.AppendChild(elem24)
.AppendChild(elem25)
.AppendChild(elem26)
.AppendChild(elem27)
.AppendChild(elem28);
elem20.AppendChild(elem21)
.AppendChild(elem22)
.AppendChild(elem29);
return{elem00,player,elem20};
}
break;
case M:
{
Node elem00 = Node("img.immagini_laterali").SetAttribute(a.alt,"Top Left Decoration").SetAttribute(a.src,"/images/mobile/navdecupds" + c + ".png").UseClosingTag(false),
elem01 = Node("div.navigation_barm"),
elem02 = Node("nav"),
elem03 = Node("label.toggle").SetAttribute("for","drop").SetContent(a.Menu),
elem04 = Node("input#drop").SetAttribute("type","checkbox").UseClosingTag(false),
elem05 = Node(a.ul+".menu"),
elem06 = Node(a.li+".topRounds").AppendChild(Node(a.a).SetAttribute(a.href,a.blog).SetAttribute("target","_blank").SetContent(a.Home)),
elem07 = Node(a.li).AppendChild(Node(a.a).SetAttribute(a.href, a.patreon).SetAttribute("target", "_blank").SetContent(a.Patreon)),
elem08 = Node(a.li).AppendChild(Node(a.a).SetAttribute(a.href, a.youtubePosts).SetAttribute("target", "_blank").SetContent(a.YouTube)),
elem09 = Node(a.li).AppendChild(Node(a.a).SetAttribute(a.href, a.about).SetAttribute("target", "_blank").SetContent(a.AboutMe)),
elem10 = Node(a.li).AppendChild(Node(a.a).SetAttribute(a.href, a.twitch).SetAttribute("target", "_blank").SetContent(a.Twitch)),
elem11 = Node(a.li).AppendChild(Node(a.a).SetAttribute(a.href, a.tumblr).SetAttribute("target", "_blank").SetContent(a.Tumblr)),
elem12 = Node(a.li).AppendChild(Node(a.a).SetAttribute(a.href, a.deviantArt).SetAttribute("target", "_blank").SetContent(a.DeviantArt)),
elem13 = Node(a.li).AppendChild(Node(a.a).SetAttribute(a.href, a.instagram).SetAttribute("target", "_blank").SetContent(a.Instagram)),
elem14 = Node(a.li).AppendChild(Node(a.a).SetAttribute(a.href, a.facebook).SetAttribute("target", "_blank").SetContent(a.Facebook)),
elem15 = Node(a.li).AppendChild(Node(a.a).SetAttribute(a.href, a.twitter).SetAttribute("target", "_blank").SetContent(a.Twitter)),
elem16 = Node(a.li+".fs60").SetContent("( ・ω・)ノ <!--Hello there!--> <!--Hello!-->ヾ(・ω・o)"),
elem17 = Node(a.li+".bottomRounds.fs60").SetContent("\(゜ロ゜) <!--Oh shit!Look up guys, someone who read the source file!!They uncovered us!!!WE ARE DOOMED!!!!-->"),
elem18 = Node("img.immagini_laterali").SetAttribute(a.alt, "Top Right Decoration").SetAttribute(a.src, "/images/mobile/navdecups" + c + ".png").UseClosingTag(false);
elem01.AppendChild(elem02
.AppendChild(elem03)
.AppendChild(elem04)
.AppendChild(elem05
.AppendChild(elem06)
.AppendChild(elem07)
.AppendChild(elem08)
.AppendChild(elem09)
.AppendChild(elem10)
.AppendChild(elem11)
.AppendChild(elem12)
.AppendChild(elem13)
.AppendChild(elem14)
.AppendChild(elem15)
.AppendChild(elem16)
.AppendChild(elem17)));
return{elem00,elem01,elem18};
}
break;
default: return{{}};
break;
}
}
inline list<Node> ThePraArt::SingleMainContent(Levels level, string cPath, DeskOrMob mtype, list<string> content)
{
ThePraArt a;
string whichLevel = ChooseLevel(level);
Node mainC = Node("div.main");
Node mainMC = mainC;
string STRING;
string contentDesktop = "";
string contentMobile = "";
FullFillContent(cPath, &contentDesktop, &contentMobile);
mainC.SetContent(contentDesktop);
mainMC.SetContent(contentMobile);
/*for each (string item in contentTest)
{
mainC.SetContent(item+"\n");
}*/
if (mtype == D)
return{mainC};
else return{mainMC};
}
inline Node ThePraArt::Player(Levels level, Col color)
{
ThePraArt a;
string pl = (color == White) ? "" : "box-shadow: rgba(204,24,30,.5) 0 0 20px 0";
string whichLevel = ChooseLevel(level);
Node player = Node("div.playerfixed").SetAttribute("style",pl)
.AppendChild(Node("audio")
.SetAttribute("controls", "controls")
.SetAttribute("preload", "auto")
.SetAttribute("class","player")
.SetContent("Your browser does not support the audio element.")
.AppendChild(Node("source")
.SetAttribute(a.src, whichLevel + "videoplayback.ogg")
.SetAttribute("type", "audio/ogg")
.UseClosingTag(false)));
return player;
}