2017-04-02 18:07:06 +02:00
# pragma once
# include "Utilities.h"
class ThePraDev : Utilities
{
public :
2017-05-02 08:00:52 +02:00
string description = " ThePra's profile about computer-science/programming " ;
2017-04-02 18:07:06 +02:00
string index = " index.html " ;
string code = " code.html " ;
string blog = " blog.html " ;
string about = " about.html " ;
string contact = " contact.html " ;
string Home = " Home " ;
string Code = " Code " ;
string Blog = " Blog " ;
string About = " About " ;
string Contact = " Contact " ;
string Menu = " Menu " ;
string contentFolder = " \\ thepradev \\ content \\ " ;
string contentLinks [ 5 ] {
contentFolder + " index.txt " ,
contentFolder + " code.txt " ,
contentFolder + " blog.txt " ,
contentFolder + " about.txt " ,
contentFolder + " contact.txt "
} ;
2017-05-25 22:35:59 +02:00
string outputPath { current_path ( ) . append ( " output_thepradev \\ " ) . string ( ) } ;
2017-05-01 12:50:38 +02:00
string outputLinks [ 5 ] {
outputPath + " index.html " ,
outputPath + " code.html " ,
outputPath + " blog.html " ,
outputPath + " about.html " ,
outputPath + " contact.html "
2017-04-09 18:38:01 +02:00
} ;
2017-05-25 22:35:59 +02:00
2017-04-02 18:07:06 +02:00
2017-04-09 18:38:01 +02:00
static void BuildBody ( Document & file , string cPath , Levels level , PageType ptype = NORMAL ) ;
2017-04-02 18:07:06 +02:00
private :
static list < Node > NavigationBar ( Levels level , DeskOrMob mtype ) ;
2017-05-25 22:35:59 +02:00
static list < Node > SingleMainContent ( Levels level , string cPath , DeskOrMob mtype , list < string > content = { " " } ) ;
2017-04-02 18:07:06 +02:00
static Node Extra ( Levels level ) ;
static Node Player ( Levels level ) ;
} ;
2017-04-09 18:38:01 +02:00
inline void ThePraDev : : BuildBody ( Document & file , string cPath , Levels level , PageType ptype )
2017-04-02 18:07:06 +02:00
{
list < Node > navBar = NavigationBar ( level , D ) ;
list < Node > navBarM = NavigationBar ( level , M ) ;
list < Node > main = SingleMainContent ( level , cPath , D ) ;
list < Node > mainM = SingleMainContent ( level , cPath , M ) ;
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 > ThePraDev : : NavigationBar ( Levels level , DeskOrMob mtype )
{
ThePraDev a ;
string whichLevel = ChooseLevel ( level ) ;
switch ( mtype )
{
2017-05-25 22:35:59 +02:00
case D :
{
Node elem0 = Node ( " div#header " ) ;
Node elem05 = Node ( " div.navigation_bar " ) ;
Node elem1 = Node ( " img " ) . SetAttribute ( a . src , whichLevel + " icon/up.png " ) . SetAttribute ( a . alt , " Upper Decoration " ) . UseClosingTag ( false ) ;
Node elem2 = Node ( " ul.bortrr.borbrr " ) ;
Node elem3 = Node ( " li.bortrr " ) . AppendChild ( Node ( a . a , a . Home ) . SetAttribute ( a . href , whichLevel + a . index ) ) ;
Node elem4 = Node ( a . li ) . AppendChild ( Node ( a . a , a . Code ) . SetAttribute ( a . href , whichLevel + a . code ) ) ;
Node elem5 = Node ( a . li ) . AppendChild ( Node ( a . a , a . Blog ) . SetAttribute ( a . href , whichLevel + a . blog ) ) ;
Node elem6 = Node ( a . li ) . AppendChild ( Node ( a . a , a . About ) . SetAttribute ( a . href , whichLevel + a . about ) ) ;
Node elem7 = Node ( a . li ) . AppendChild ( Node ( a . a , a . Contact ) . SetAttribute ( a . href , whichLevel + a . contact ) ) ;
Node elem8 = Extra ( level ) ;
Node elem9 = Node ( " img " ) . SetAttribute ( a . src , whichLevel + " icon/down.png " ) . SetAttribute ( a . alt , " Down Decoration " ) . UseClosingTag ( false ) ;
elem05 . AppendChild ( elem1 )
. AppendChild ( elem2
. AppendChild ( elem3 )
. AppendChild ( elem4 )
. AppendChild ( elem5 )
. AppendChild ( elem6 )
. AppendChild ( elem7 )
. AppendChild ( elem8 ) )
. AppendChild ( elem9 ) ;
elem0 . AppendChild ( elem05 ) ;
return { { elem0 } } ;
}
break ;
case M :
{
Node elem0 = Node ( " div#headerm " ) ;
Node elem05 = Node ( " div.navigation_barm " ) ;
Node elem1 = Node ( " img.immagini_laterali " ) . SetAttribute ( a . src , whichLevel + " icon/left.png " ) . SetAttribute ( a . alt , " Upper Left Decoration " ) . UseClosingTag ( false ) ;
Node elem2 = Node ( " div.navigation_barminner " ) ;
Node elem3 = Node ( " nav._nav " ) ;
Node elem4 = Node ( " label.toggle " ) . SetAttribute ( " for " , " drop " ) . SetContent ( a . Menu ) ;
Node elem5 = Node ( " input#drop " ) . SetAttribute ( " type " , " checkbox " ) . UseClosingTag ( false ) ;
Node elem6 = Node ( " ul.menu " ) ;
Node elem7 = Node ( a . li ) . AppendChild ( Node ( a . a , a . Home ) . SetAttribute ( a . href , whichLevel + a . index ) ) ;
Node elem8 = Node ( a . li ) . AppendChild ( Node ( a . a , a . Code ) . SetAttribute ( a . href , whichLevel + a . code ) ) ;
Node elem9 = Node ( a . li ) . AppendChild ( Node ( a . a , a . Blog ) . SetAttribute ( a . href , whichLevel + a . blog ) ) ;
Node elem10 = Node ( a . li ) . AppendChild ( Node ( a . a , a . About ) . SetAttribute ( a . href , whichLevel + a . about ) ) ;
Node elem11 = Node ( a . li ) . AppendChild ( Node ( a . a , a . Contact ) . SetAttribute ( a . href , whichLevel + a . contact ) ) ;
Node elem12 = Node ( " img.immagini_laterali " ) . SetAttribute ( a . src , whichLevel + " icon/right.png " ) . SetAttribute ( a . alt , " Upper Right Decoration " ) . UseClosingTag ( false ) ;
elem05 . AppendChild ( elem2
. AppendChild ( elem3
. AppendChild ( elem4 )
. AppendChild ( elem5 )
. AppendChild ( elem6
. AppendChild ( elem7 )
. AppendChild ( elem8 )
. AppendChild ( elem9 )
. AppendChild ( elem10 )
. AppendChild ( elem11 ) ) ) ) ;
elem0 . AppendChild ( elem1 ) . AppendChild ( elem05 ) . AppendChild ( elem12 ) ;
//cout << elem0.ToString(Readability::MULTILINE, 5) << endl;
return { { elem0 } } ;
}
break ;
default : return { { } } ;
break ;
2017-04-02 18:07:06 +02:00
}
}
2017-04-09 18:38:01 +02:00
inline list < Node > ThePraDev : : SingleMainContent ( Levels level , string cPath , DeskOrMob mtype , list < string > content )
2017-04-02 18:07:06 +02:00
{
ThePraDev a ;
string whichLevel = ChooseLevel ( level ) ;
2017-05-25 22:35:59 +02:00
Node mainC = Node ( " div.main " ) ;
2017-04-02 18:07:06 +02:00
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 )
2017-05-25 22:35:59 +02:00
return { mainC } ;
else return { mainMC } ;
2017-04-02 18:07:06 +02:00
}
inline Node ThePraDev : : Extra ( Levels level )
{
ThePraDev a ;
string whichLevel = ChooseLevel ( level ) ;
Node extra = Node ( " li.borbrr " )
. AppendChild ( Node ( a . a , " + Extra + " ) )
. AppendChild ( Node ( " ul.borbrr " )
2017-05-25 22:35:59 +02:00
. AppendChild ( Node ( " li.colbk " )
. AppendChild ( Node ( " img.fiximgmenu " ) . SetAttribute ( a . src , whichLevel + " icon/signbot.gif " ) . SetAttribute ( a . alt , " MotD " ) . UseClosingTag ( false ) ) )
. AppendChild ( Node ( a . li )
. AppendChild ( Player ( level ) ) ) ) ;
2017-04-02 18:07:06 +02:00
return extra ;
}
inline Node ThePraDev : : Player ( Levels level )
{
ThePraDev a ;
string whichLevel = ChooseLevel ( level ) ;
Node player = Node ( " div.player " )
2017-05-01 21:51:45 +02:00
. AppendChild ( Node ( " audio " )
2017-05-25 22:35:59 +02:00
. SetAttribute ( " controls " , " controls " )
. SetAttribute ( " preload " , " auto " )
. SetAttribute ( a . src , whichLevel + " videoplayback.ogg " )
. SetContent ( " Your browser does not support the <code>audio</code> element. " ) ) ;
return player ;
2017-04-02 18:07:06 +02:00
}