hmml_to_html.c: Fix lastFocused stuff [#24]

This commit is contained in:
Matt Mascarenhas 2017-06-03 04:47:07 +01:00
parent 4ad0a0e737
commit 97332baf52
2 changed files with 38 additions and 10 deletions

View File

@ -69,6 +69,7 @@ char *Credentials[ ][5] =
{ "nothings", "Sean Barrett", "https://nothings.org/", "", ""}, { "nothings", "Sean Barrett", "https://nothings.org/", "", ""},
{ "cmuratori", "Casey Muratori", "https://handmadehero.org", "patreon_logo.png", "https://patreon.com/cmuratori"}, { "cmuratori", "Casey Muratori", "https://handmadehero.org", "patreon_logo.png", "https://patreon.com/cmuratori"},
{ "fierydrake", "Mike Tunnicliffe", "", "", ""}, { "fierydrake", "Mike Tunnicliffe", "", "", ""},
{ "abnercoimbre", "Abner Coimbre", "https://handmade.network/m/abnercoimbre", "patreon_logo.png", "https://patreon.com/handmade_dev"},
}; };
#define ArrayCount(A) sizeof(A)/sizeof(*(A)) #define ArrayCount(A) sizeof(A)/sizeof(*(A))
@ -1231,6 +1232,10 @@ TimecodeToSeconds(Anno->time));
"<span class=\"author\" style=\"color: %s;\">%s</span> ", "<span class=\"author\" style=\"color: %s;\">%s</span> ",
StringToColourHash(&Colour, Anno->author), StringToColourHash(&Colour, Anno->author),
Anno->author); Anno->author);
if(!HasMedium)
{
HasMedium = TRUE;
}
} }
InPtr = Anno->text; InPtr = Anno->text;
@ -1738,12 +1743,12 @@ CategoryMedium[j][2]
if(HasFilterMenu) if(HasFilterMenu)
{ {
CopyStringToBuffer(&Title, CopyStringToBuffer(&Title,
" <span class=\"help_key\">V</span> <span class=\"help_text\">Reset filter</span> <span class=\"help_key\">z</span> <span class=\"help_text\">Toggle filter mode between \"inclusive\" and \"exclusive\"</span>\n"); " <span class=\"help_key\">z</span> <span class=\"help_text\">Toggle filter mode</span> <span class=\"help_key\">V</span> <span class=\"help_text\">Revert filter to original state</span>\n");
} }
else else
{ {
CopyStringToBuffer(&Title, CopyStringToBuffer(&Title,
" <span class=\"help_key unavailable\">V</span> <span class=\"help_text unavailable\">Reset filter</span> <span class=\"help_key unavailable\">z</span> <span class=\"help_text unavailable\">Toggle filter mode between \"inclusive\" and \"exclusive\"</span>\n"); " <span class=\"help_key unavailable\">z</span> <span class=\"help_text unavailable\">Toggle filter mode</span> <span class=\"help_key unavailable\">V</span> <span class=\"help_text unavailable\">Revert filter to original state</span>\n");
} }
CopyStringToBuffer(&Title, CopyStringToBuffer(&Title,
@ -1976,10 +1981,14 @@ HMML.metadata.project);
"\n" "\n"
"var menuState = [];\n"); "var menuState = [];\n");
CopyStringToBuffer(&Script,
"var quotesMenu = document.querySelector(\".quotes_container\");\n");
if(HasQuoteMenu) if(HasQuoteMenu)
{ {
CopyStringToBuffer(&Script, CopyStringToBuffer(&Script,
"var quotesMenu = document.querySelector(\".quotes_container\");\n" "if(quotesMenu)\n"
"{\n"
"menuState.push(quotesMenu);\n" "menuState.push(quotesMenu);\n"
"var quoteItems = quotesMenu.querySelectorAll(\".ref\");\n" "var quoteItems = quotesMenu.querySelectorAll(\".ref\");\n"
"for(var i = 0; i < quoteItems.length; ++i)\n" "for(var i = 0; i < quoteItems.length; ++i)\n"
@ -1988,13 +1997,18 @@ HMML.metadata.project);
" mouseOverQuotes(this);\n" " mouseOverQuotes(this);\n"
" })\n" " })\n"
"};\n" "};\n"
"var lastFocusedQuote = null;\n"); "var lastFocusedQuote = null;\n"
"}\n");
} }
CopyStringToBuffer(&Script,
"var referencesMenu = document.querySelector(\".references_container\");\n");
if(HasReferenceMenu) if(HasReferenceMenu)
{ {
CopyStringToBuffer(&Script, CopyStringToBuffer(&Script,
"var referencesMenu = document.querySelector(\".references_container\");\n" "if(referencesMenu)\n"
"{\n"
"menuState.push(referencesMenu);\n" "menuState.push(referencesMenu);\n"
"var referenceItems = referencesMenu.querySelectorAll(\".ref\");\n" "var referenceItems = referencesMenu.querySelectorAll(\".ref\");\n"
"for(var i = 0; i < referenceItems.length; ++i)\n" "for(var i = 0; i < referenceItems.length; ++i)\n"
@ -2004,13 +2018,18 @@ HMML.metadata.project);
" })\n" " })\n"
"};\n" "};\n"
"var lastFocusedReference = null;\n" "var lastFocusedReference = null;\n"
"var lastFocusedIdentifier = null;\n"); "var lastFocusedIdentifier = null;\n"
"}\n");
} }
CopyStringToBuffer(&Script,
"var filterMenu = document.querySelector(\".filter_container\");\n");
if(HasFilterMenu) if(HasFilterMenu)
{ {
CopyStringToBuffer(&Script, CopyStringToBuffer(&Script,
"var filterMenu = document.querySelector(\".filter_container\");\n" "if(filterMenu)\n"
"{\n"
" menuState.push(filterMenu);\n" " menuState.push(filterMenu);\n"
" var lastFocusedCategory = null;\n" " var lastFocusedCategory = null;\n"
" var lastFocusedTopic = null;\n" " var lastFocusedTopic = null;\n"
@ -2036,13 +2055,16 @@ HMML.metadata.project);
" });\n" " });\n"
"\n" "\n"
"%s\n" "%s\n"
"}\n"
"}\n", FilterState.Location); "}\n", FilterState.Location);
} }
CopyStringToBuffer(&Script,
"var creditsMenu = document.querySelector(\".credits_container\");\n");
if(HasCreditsMenu) if(HasCreditsMenu)
{ {
CopyStringToBuffer(&Script, CopyStringToBuffer(&Script,
"var creditsMenu = document.querySelector(\".credits_container\");\n"
"if(creditsMenu)\n" "if(creditsMenu)\n"
"{\n" "{\n"
" menuState.push(creditsMenu);\n" " menuState.push(creditsMenu);\n"

View File

@ -336,7 +336,8 @@
word-wrap: break-word; word-wrap: break-word;
} }
.markers_container > .marker.authored .content .author { .markers_container > .marker.authored .content .author,
.markers_container > .marker.off_authored .content .author {
font-style: normal; font-style: normal;
font-variant: normal; font-variant: normal;
font-weight: bold; font-weight: bold;
@ -344,10 +345,15 @@
.title > .menu > .refs .ref .ref_title, .title > .menu > .refs .ref .ref_title,
.title .filter_content.authored .text, .title .filter_content.authored .text,
.markers_container > .marker.authored { .markers_container > .marker.authored,
.markers_container > .marker.off_authored {
font-style: oblique; font-style: oblique;
} }
.markers_container > .marker.off_authored {
opacity: 0.5;
}
.markers_container > .marker .content sup { .markers_container > .marker .content sup {
font-style: normal; font-style: normal;
font-variant: normal; font-variant: normal;