cinera.c: Add <!-- __CINERA_CUSTOMn__--> tags
Also compress the template code cinera_player_pre.js: Fix bug in which onRefChanged() tried to call player.jumpToNextMarker(); before the player was ready. This could happen if its first marker's timecode is 0:00 and medium is :afk Enable Theatre mode to work in containers styled with max-width or max-height
This commit is contained in:
parent
c5bc487313
commit
2cac3ed03b
293
cinera/cinera.c
293
cinera/cinera.c
|
@ -14,7 +14,7 @@ typedef struct
|
|||
version CINERA_APP_VERSION = {
|
||||
.Major = 0,
|
||||
.Minor = 5,
|
||||
.Patch = 34
|
||||
.Patch = 35
|
||||
};
|
||||
|
||||
// TODO(matt): Copy in the DB 3 stuff from cinera_working.c
|
||||
|
@ -56,6 +56,9 @@ typedef unsigned int bool;
|
|||
#define MAX_BASE_FILENAME_LENGTH 31
|
||||
#define MAX_TITLE_LENGTH 128 - (MAX_BASE_FILENAME_LENGTH + 1) - (int)sizeof(link_insertion_offsets) - (int)sizeof(unsigned short int) - 1 // NOTE(matt): We size this such that index_metadata is 128 bytes total
|
||||
|
||||
#define MAX_CUSTOM_SNIPPET_SHORT_LENGTH 255
|
||||
#define MAX_CUSTOM_SNIPPET_LONG_LENGTH 1023
|
||||
|
||||
enum
|
||||
{
|
||||
EDITION_SINGLE,
|
||||
|
@ -180,6 +183,24 @@ typedef struct
|
|||
buffer Menus;
|
||||
buffer Player;
|
||||
buffer ScriptPlayer;
|
||||
|
||||
char Custom0[MAX_CUSTOM_SNIPPET_SHORT_LENGTH + 1];
|
||||
char Custom1[MAX_CUSTOM_SNIPPET_SHORT_LENGTH + 1];
|
||||
char Custom2[MAX_CUSTOM_SNIPPET_SHORT_LENGTH + 1];
|
||||
char Custom3[MAX_CUSTOM_SNIPPET_SHORT_LENGTH + 1];
|
||||
char Custom4[MAX_CUSTOM_SNIPPET_SHORT_LENGTH + 1];
|
||||
char Custom5[MAX_CUSTOM_SNIPPET_SHORT_LENGTH + 1];
|
||||
char Custom6[MAX_CUSTOM_SNIPPET_SHORT_LENGTH + 1];
|
||||
char Custom7[MAX_CUSTOM_SNIPPET_SHORT_LENGTH + 1];
|
||||
char Custom8[MAX_CUSTOM_SNIPPET_SHORT_LENGTH + 1];
|
||||
char Custom9[MAX_CUSTOM_SNIPPET_SHORT_LENGTH + 1];
|
||||
char Custom10[MAX_CUSTOM_SNIPPET_SHORT_LENGTH + 1];
|
||||
char Custom11[MAX_CUSTOM_SNIPPET_SHORT_LENGTH + 1];
|
||||
char Custom12[MAX_CUSTOM_SNIPPET_LONG_LENGTH + 1];
|
||||
char Custom13[MAX_CUSTOM_SNIPPET_LONG_LENGTH + 1];
|
||||
char Custom14[MAX_CUSTOM_SNIPPET_LONG_LENGTH + 1];
|
||||
char Custom15[MAX_CUSTOM_SNIPPET_LONG_LENGTH + 1];
|
||||
|
||||
char ProjectName[MAX_PROJECT_NAME_LENGTH + 1];
|
||||
char Title[MAX_TITLE_LENGTH + 1];
|
||||
char URLIndex[MAX_BASE_URL_LENGTH + 1 + MAX_RELATIVE_PAGE_LOCATION_LENGTH + 1];
|
||||
|
@ -189,20 +210,42 @@ typedef struct
|
|||
|
||||
enum
|
||||
{
|
||||
// Contents Page
|
||||
// Contents and Player Pages Mandatory
|
||||
TAG_INCLUDES,
|
||||
|
||||
// Contents Page Mandatory
|
||||
TAG_INDEX,
|
||||
|
||||
// Player Page
|
||||
TAG_INCLUDES,
|
||||
// Player Page Mandatory
|
||||
TAG_MENUS,
|
||||
TAG_PLAYER,
|
||||
TAG_SCRIPT,
|
||||
|
||||
// Anywhere
|
||||
TAG_PROJECT,
|
||||
// Player Page Optional
|
||||
TAG_CUSTOM0,
|
||||
TAG_CUSTOM1,
|
||||
TAG_CUSTOM2,
|
||||
TAG_CUSTOM3,
|
||||
TAG_CUSTOM4,
|
||||
TAG_CUSTOM5,
|
||||
TAG_CUSTOM6,
|
||||
TAG_CUSTOM7,
|
||||
TAG_CUSTOM8,
|
||||
TAG_CUSTOM9,
|
||||
TAG_CUSTOM10,
|
||||
TAG_CUSTOM11,
|
||||
|
||||
TAG_CUSTOM12,
|
||||
TAG_CUSTOM13,
|
||||
TAG_CUSTOM14,
|
||||
TAG_CUSTOM15,
|
||||
|
||||
TAG_TITLE,
|
||||
TAG_URL,
|
||||
TAG_VIDEO_ID,
|
||||
|
||||
// Anywhere Optional
|
||||
TAG_PROJECT,
|
||||
TAG_URL,
|
||||
} template_tags;
|
||||
|
||||
typedef struct
|
||||
|
@ -212,15 +255,37 @@ typedef struct
|
|||
} tag;
|
||||
|
||||
tag Tags[] = {
|
||||
{ TAG_INDEX, "__CINERA_INDEX__" },
|
||||
{ TAG_INCLUDES, "__CINERA_INCLUDES__" },
|
||||
|
||||
{ TAG_INDEX, "__CINERA_INDEX__" },
|
||||
|
||||
{ TAG_MENUS, "__CINERA_MENUS__" },
|
||||
{ TAG_PLAYER, "__CINERA_PLAYER__" },
|
||||
{ TAG_SCRIPT, "__CINERA_SCRIPT__" },
|
||||
{ TAG_PROJECT, "__CINERA_PROJECT__" },
|
||||
|
||||
{ TAG_CUSTOM0, "__CINERA_CUSTOM0__" },
|
||||
{ TAG_CUSTOM1, "__CINERA_CUSTOM1__" },
|
||||
{ TAG_CUSTOM2, "__CINERA_CUSTOM2__" },
|
||||
{ TAG_CUSTOM3, "__CINERA_CUSTOM3__" },
|
||||
{ TAG_CUSTOM4, "__CINERA_CUSTOM4__" },
|
||||
{ TAG_CUSTOM5, "__CINERA_CUSTOM5__" },
|
||||
{ TAG_CUSTOM6, "__CINERA_CUSTOM6__" },
|
||||
{ TAG_CUSTOM7, "__CINERA_CUSTOM7__" },
|
||||
{ TAG_CUSTOM8, "__CINERA_CUSTOM8__" },
|
||||
{ TAG_CUSTOM9, "__CINERA_CUSTOM9__" },
|
||||
{ TAG_CUSTOM10, "__CINERA_CUSTOM10__" },
|
||||
{ TAG_CUSTOM11, "__CINERA_CUSTOM11__" },
|
||||
|
||||
{ TAG_CUSTOM12, "__CINERA_CUSTOM12__" },
|
||||
{ TAG_CUSTOM13, "__CINERA_CUSTOM13__" },
|
||||
{ TAG_CUSTOM14, "__CINERA_CUSTOM14__" },
|
||||
{ TAG_CUSTOM15, "__CINERA_CUSTOM15__" },
|
||||
|
||||
{ TAG_TITLE, "__CINERA_TITLE__" },
|
||||
{ TAG_URL, "__CINERA_URL__" },
|
||||
{ TAG_VIDEO_ID, "__CINERA_VIDEO_ID__" },
|
||||
|
||||
{ TAG_PROJECT, "__CINERA_PROJECT__" },
|
||||
{ TAG_URL, "__CINERA_URL__" },
|
||||
};
|
||||
|
||||
typedef struct
|
||||
|
@ -438,7 +503,10 @@ project_info ProjectInfo[] =
|
|||
{ "misc", "Handmade Miscellany", "", NS_LINEAR, "admin", "" },
|
||||
{ "ray", "Handmade Ray", "Day", NS_LINEAR, "programming", "" },
|
||||
|
||||
{ "hmdshow", "HandmadeDev Show", "", NS_SEASONAL, "speech", "" },
|
||||
{ "hmdshow", "HandmadeDev Show", "", NS_SEASONAL, "speech", "ep" },
|
||||
{ "lecture", "Abner Talks", "", NS_SEASONAL, "speech", "" },
|
||||
{ "stream", "Abner Programs", "", NS_SEASONAL, "programming", "" },
|
||||
{ "special", "Abner Show Special", "", NS_SEASONAL, "programming", "" },
|
||||
|
||||
{ "obbg", "Open Block Building Game", "Episode", NS_LINEAR, "programming", "" },
|
||||
|
||||
|
@ -553,6 +621,16 @@ CopyStringToBuffer(buffer *Dest, char *Format, ...)
|
|||
Dest->Ptr += Length;
|
||||
}
|
||||
|
||||
void
|
||||
CopyStringToBufferNoFormat(buffer *Dest, char *String)
|
||||
{
|
||||
while(*String)
|
||||
{
|
||||
*Dest->Ptr++ = *String++;
|
||||
}
|
||||
*Dest->Ptr = '\0';
|
||||
}
|
||||
|
||||
void
|
||||
CopyStringToBufferHTMLSafe(buffer *Dest, char *String)
|
||||
{
|
||||
|
@ -1878,9 +1956,9 @@ GenerateTopicColours(char *Topic)
|
|||
|
||||
#if DEBUG_MEM
|
||||
FILE *MemLog = fopen("/home/matt/cinera_mem", "a+");
|
||||
fprintf(MemLog, " Allocated Topics (%d)\n", Topics.Size);
|
||||
fprintf(MemLog, " Allocated Topics (%d)\n", Topics.Buffer.Size);
|
||||
fclose(MemLog);
|
||||
printf(" Allocated Topics (%d)\n", Topics.Size);
|
||||
printf(" Allocated Topics (%d)\n", Topics.Buffer.Size);
|
||||
#endif
|
||||
|
||||
Topics.Buffer.Ptr = Topics.Buffer.Location;
|
||||
|
@ -2058,6 +2136,17 @@ PrintUsage(char *BinaryLocation, config *DefaultConfig)
|
|||
" <!-- __CINERA_PROJECT__ -->\n"
|
||||
" <!-- __CINERA_URL__ -->\n"
|
||||
" Only really usable if BaseURL is set \e[1;30m(-B)\e[0m\n"
|
||||
" <!-- __CINERA_CUSTOM0__ -->\n"
|
||||
" <!-- __CINERA_CUSTOM1__ -->\n"
|
||||
" <!-- __CINERA_CUSTOM2__ -->\n"
|
||||
" ⋮\n"
|
||||
" <!-- __CINERA_CUSTOM15__ -->\n"
|
||||
" Freeform buffers for small snippets of localised information, e.g. a\n"
|
||||
" single <a> element or perhaps a <!-- comment -->\n"
|
||||
" They correspond to the custom0 to custom15 attributes in the [video]\n"
|
||||
" node in your .hmml files\n"
|
||||
" 0 to 11 may hold up to 255 characters\n"
|
||||
" 12 to 15 may hold up to 1023 characters\n"
|
||||
"\n"
|
||||
"HMML Specification:\n"
|
||||
" https://git.handmade.network/Annotation-Pushers/Annotation-System/wikis/hmmlspec\n",
|
||||
|
@ -2119,7 +2208,7 @@ ValidateTemplate(template **Template, char *Location, int TemplateType)
|
|||
|
||||
while((*Template)->Buffer.Ptr - (*Template)->Buffer.Location < (*Template)->Buffer.Size)
|
||||
{
|
||||
Here:
|
||||
NextTagSearch:
|
||||
if(*(*Template)->Buffer.Ptr == '!' && ((*Template)->Buffer.Ptr > (*Template)->Buffer.Location && !StringsDifferT("<!--", &(*Template)->Buffer.Ptr[-1], 0)))
|
||||
{
|
||||
char *CommentStart = &(*Template)->Buffer.Ptr[-1];
|
||||
|
@ -2140,56 +2229,38 @@ Here:
|
|||
* -insofaras
|
||||
*
|
||||
*/
|
||||
//printf("Switching on the tags\n");
|
||||
switch(Tags[i].Code)
|
||||
|
||||
int ThisTagCode = Tags[i].Code;
|
||||
char *ThisTagName = Tags[i].Tag;
|
||||
switch(ThisTagCode)
|
||||
{
|
||||
case TAG_INDEX:
|
||||
(*Template)->Metadata.Tag[(*Template)->Metadata.TagCount].Offset = CommentStart - Previous;
|
||||
(*Template)->Metadata.Tag[(*Template)->Metadata.TagCount].TagCode = TAG_INDEX;
|
||||
(*Template)->Metadata.TagCount++;
|
||||
DepartComment(&(*Template)->Buffer);
|
||||
Previous = (*Template)->Buffer.Ptr;
|
||||
FoundIndex = TRUE;
|
||||
goto Here;
|
||||
goto RecordTag;
|
||||
case TAG_INCLUDES:
|
||||
if(!Config.ForceIntegration && FoundIncludes == TRUE)
|
||||
{
|
||||
CopyStringToBuffer(&Errors, "Template contains more than one <!-- %s --> tag\n", Tags[i].Tag);
|
||||
CopyStringToBuffer(&Errors, "Template contains more than one <!-- %s --> tag\n", ThisTagName);
|
||||
HaveErrors = TRUE;
|
||||
}
|
||||
(*Template)->Metadata.Tag[(*Template)->Metadata.TagCount].Offset = CommentStart - Previous;
|
||||
(*Template)->Metadata.Tag[(*Template)->Metadata.TagCount].TagCode = TAG_INCLUDES;
|
||||
(*Template)->Metadata.TagCount++;
|
||||
DepartComment(&(*Template)->Buffer);
|
||||
Previous = (*Template)->Buffer.Ptr;
|
||||
FoundIncludes = TRUE;
|
||||
goto Here;
|
||||
goto RecordTag;
|
||||
case TAG_MENUS:
|
||||
if(!Config.ForceIntegration && FoundMenus == TRUE)
|
||||
{
|
||||
CopyStringToBuffer(&Errors, "Template contains more than one <!-- %s --> tag\n", Tags[i].Tag);
|
||||
HaveErrors = TRUE;
|
||||
}
|
||||
(*Template)->Metadata.Tag[(*Template)->Metadata.TagCount].Offset = CommentStart - Previous;
|
||||
(*Template)->Metadata.Tag[(*Template)->Metadata.TagCount].TagCode = TAG_MENUS;
|
||||
(*Template)->Metadata.TagCount++;
|
||||
DepartComment(&(*Template)->Buffer);
|
||||
Previous = (*Template)->Buffer.Ptr;
|
||||
FoundMenus = TRUE;
|
||||
goto Here;
|
||||
goto RecordTag;
|
||||
case TAG_PLAYER:
|
||||
if(!Config.ForceIntegration && FoundPlayer == TRUE)
|
||||
{
|
||||
CopyStringToBuffer(&Errors, "Template contains more than one <!-- %s --> tag\n", Tags[i].Tag);
|
||||
HaveErrors = TRUE;
|
||||
}
|
||||
(*Template)->Metadata.Tag[(*Template)->Metadata.TagCount].Offset = CommentStart - Previous;
|
||||
(*Template)->Metadata.Tag[(*Template)->Metadata.TagCount].TagCode = TAG_PLAYER;
|
||||
(*Template)->Metadata.TagCount++;
|
||||
DepartComment(&(*Template)->Buffer);
|
||||
Previous = (*Template)->Buffer.Ptr;
|
||||
FoundPlayer = TRUE;
|
||||
goto Here;
|
||||
goto RecordTag;
|
||||
case TAG_SCRIPT:
|
||||
if(!Config.ForceIntegration && FoundPlayer == FALSE)
|
||||
{
|
||||
|
@ -2201,41 +2272,16 @@ Here:
|
|||
CopyStringToBuffer(&Errors, "Template contains more than one <!-- %s --> tag\n", Tags[i].Tag);
|
||||
HaveErrors = TRUE;
|
||||
}
|
||||
(*Template)->Metadata.Tag[(*Template)->Metadata.TagCount].Offset = CommentStart - Previous;
|
||||
(*Template)->Metadata.Tag[(*Template)->Metadata.TagCount].TagCode = TAG_SCRIPT;
|
||||
(*Template)->Metadata.TagCount++;
|
||||
DepartComment(&(*Template)->Buffer);
|
||||
Previous = (*Template)->Buffer.Ptr;
|
||||
FoundScript = TRUE;
|
||||
goto Here;
|
||||
case TAG_PROJECT:
|
||||
goto RecordTag;
|
||||
default: // NOTE(matt): All freely usable tags should hit this case
|
||||
RecordTag:
|
||||
(*Template)->Metadata.Tag[(*Template)->Metadata.TagCount].Offset = CommentStart - Previous;
|
||||
(*Template)->Metadata.Tag[(*Template)->Metadata.TagCount].TagCode = TAG_PROJECT;
|
||||
(*Template)->Metadata.Tag[(*Template)->Metadata.TagCount].TagCode = ThisTagCode;
|
||||
(*Template)->Metadata.TagCount++;
|
||||
DepartComment(&(*Template)->Buffer);
|
||||
Previous = (*Template)->Buffer.Ptr;
|
||||
goto Here;
|
||||
case TAG_TITLE:
|
||||
(*Template)->Metadata.Tag[(*Template)->Metadata.TagCount].Offset = CommentStart - Previous;
|
||||
(*Template)->Metadata.Tag[(*Template)->Metadata.TagCount].TagCode = TAG_TITLE;
|
||||
(*Template)->Metadata.TagCount++;
|
||||
DepartComment(&(*Template)->Buffer);
|
||||
Previous = (*Template)->Buffer.Ptr;
|
||||
goto Here;
|
||||
case TAG_URL:
|
||||
(*Template)->Metadata.Tag[(*Template)->Metadata.TagCount].Offset = CommentStart - Previous;
|
||||
(*Template)->Metadata.Tag[(*Template)->Metadata.TagCount].TagCode = TAG_URL;
|
||||
(*Template)->Metadata.TagCount++;
|
||||
DepartComment(&(*Template)->Buffer);
|
||||
Previous = (*Template)->Buffer.Ptr;
|
||||
goto Here;
|
||||
case TAG_VIDEO_ID:
|
||||
(*Template)->Metadata.Tag[(*Template)->Metadata.TagCount].Offset = CommentStart - Previous;
|
||||
(*Template)->Metadata.Tag[(*Template)->Metadata.TagCount].TagCode = TAG_VIDEO_ID;
|
||||
(*Template)->Metadata.TagCount++;
|
||||
DepartComment(&(*Template)->Buffer);
|
||||
Previous = (*Template)->Buffer.Ptr;
|
||||
goto Here;
|
||||
goto NextTagSearch;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -2495,6 +2541,22 @@ HMMLToBuffers(buffers *CollationBuffers, template **BespokeTemplate, char *Filen
|
|||
RewindBuffer(&CollationBuffers->Player);
|
||||
RewindBuffer(&CollationBuffers->ScriptPlayer);
|
||||
RewindBuffer(&CollationBuffers->IncludesIndex);
|
||||
*CollationBuffers->Custom0 = '\0';
|
||||
*CollationBuffers->Custom1 = '\0';
|
||||
*CollationBuffers->Custom2 = '\0';
|
||||
*CollationBuffers->Custom3 = '\0';
|
||||
*CollationBuffers->Custom4 = '\0';
|
||||
*CollationBuffers->Custom5 = '\0';
|
||||
*CollationBuffers->Custom6 = '\0';
|
||||
*CollationBuffers->Custom7 = '\0';
|
||||
*CollationBuffers->Custom8 = '\0';
|
||||
*CollationBuffers->Custom9 = '\0';
|
||||
*CollationBuffers->Custom10 = '\0';
|
||||
*CollationBuffers->Custom11 = '\0';
|
||||
*CollationBuffers->Custom12 = '\0';
|
||||
*CollationBuffers->Custom13 = '\0';
|
||||
*CollationBuffers->Custom14 = '\0';
|
||||
*CollationBuffers->Custom15 = '\0';
|
||||
*CollationBuffers->Title = '\0';
|
||||
*CollationBuffers->ProjectName = '\0';
|
||||
|
||||
|
@ -2597,6 +2659,52 @@ HMMLToBuffers(buffers *CollationBuffers, template **BespokeTemplate, char *Filen
|
|||
else { HaveErrors = TRUE; }
|
||||
}
|
||||
|
||||
// TODO(matt): Consider simply making these as buffers and claiming the necessary amount for them
|
||||
// The nice thing about doing it this way, though, is that it encourages bespoke template use, which should
|
||||
// usually be the more convenient way for people to write greater amounts of localised information
|
||||
for(int CustomIndex = 0; CustomIndex < HMML_CUSTOM_ATTR_COUNT; ++CustomIndex)
|
||||
{
|
||||
if(HMML.metadata.custom[CustomIndex])
|
||||
{
|
||||
int LengthOfString = StringLength(HMML.metadata.custom[CustomIndex]);
|
||||
if(LengthOfString > (CustomIndex < 12 ? MAX_CUSTOM_SNIPPET_SHORT_LENGTH : MAX_CUSTOM_SNIPPET_LONG_LENGTH))
|
||||
{
|
||||
fprintf(stderr, "\e[1;31mCustom string %d \"\e[0m%s\e[1;31m\" is too long (%d/%d characters)\e[0m\n", CustomIndex, HMML.metadata.custom[CustomIndex], LengthOfString, CustomIndex < 12 ? MAX_CUSTOM_SNIPPET_SHORT_LENGTH : MAX_CUSTOM_SNIPPET_LONG_LENGTH);
|
||||
if(LengthOfString < MAX_CUSTOM_SNIPPET_LONG_LENGTH)
|
||||
{
|
||||
fprintf(stderr, "Consider using custom12 to custom15, which can hold %d characters\n", MAX_CUSTOM_SNIPPET_LONG_LENGTH);
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf(stderr, "Consider using a bespoke template for longer amounts of localised information\n");
|
||||
}
|
||||
HaveErrors = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
switch(CustomIndex)
|
||||
{
|
||||
case 0: CopyStringNoFormat(CollationBuffers->Custom0, HMML.metadata.custom[CustomIndex]); break;
|
||||
case 1: CopyStringNoFormat(CollationBuffers->Custom1, HMML.metadata.custom[CustomIndex]); break;
|
||||
case 2: CopyStringNoFormat(CollationBuffers->Custom2, HMML.metadata.custom[CustomIndex]); break;
|
||||
case 3: CopyStringNoFormat(CollationBuffers->Custom3, HMML.metadata.custom[CustomIndex]); break;
|
||||
case 4: CopyStringNoFormat(CollationBuffers->Custom4, HMML.metadata.custom[CustomIndex]); break;
|
||||
case 5: CopyStringNoFormat(CollationBuffers->Custom5, HMML.metadata.custom[CustomIndex]); break;
|
||||
case 6: CopyStringNoFormat(CollationBuffers->Custom6, HMML.metadata.custom[CustomIndex]); break;
|
||||
case 7: CopyStringNoFormat(CollationBuffers->Custom7, HMML.metadata.custom[CustomIndex]); break;
|
||||
case 8: CopyStringNoFormat(CollationBuffers->Custom8, HMML.metadata.custom[CustomIndex]); break;
|
||||
case 9: CopyStringNoFormat(CollationBuffers->Custom9, HMML.metadata.custom[CustomIndex]); break;
|
||||
case 10: CopyStringNoFormat(CollationBuffers->Custom10, HMML.metadata.custom[CustomIndex]); break;
|
||||
case 11: CopyStringNoFormat(CollationBuffers->Custom11, HMML.metadata.custom[CustomIndex]); break;
|
||||
case 12: CopyStringNoFormat(CollationBuffers->Custom12, HMML.metadata.custom[CustomIndex]); break;
|
||||
case 13: CopyStringNoFormat(CollationBuffers->Custom13, HMML.metadata.custom[CustomIndex]); break;
|
||||
case 14: CopyStringNoFormat(CollationBuffers->Custom14, HMML.metadata.custom[CustomIndex]); break;
|
||||
case 15: CopyStringNoFormat(CollationBuffers->Custom15, HMML.metadata.custom[CustomIndex]); break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(!HaveErrors)
|
||||
{
|
||||
if(HMML.metadata.template)
|
||||
|
@ -3360,7 +3468,7 @@ AppendedIdentifier:
|
|||
if(HasFilterMenu)
|
||||
{
|
||||
// NOTE(matt): Two loops, one for each JS "object"
|
||||
CopyStringToBuffer(&FilterState, "\n<script>\n"
|
||||
CopyStringToBuffer(&FilterState, "<script>\n"
|
||||
" var filterInitState = {\n");
|
||||
for(int i = 0; i < Topics.Count; ++i)
|
||||
{
|
||||
|
@ -3421,7 +3529,7 @@ AppendedIdentifier:
|
|||
|
||||
CopyStringToBuffer(&FilterState,
|
||||
" };\n"
|
||||
" </script>");
|
||||
"</script>\n");
|
||||
|
||||
buffer URLPrefix;
|
||||
ClaimBuffer(&URLPrefix, "URLPrefix", 1024);
|
||||
|
@ -3905,16 +4013,16 @@ AppendedIdentifier:
|
|||
" <script type=\"text/javascript\" src=\"%scinera_player_pre.js\"></script>",
|
||||
URLPrefix.Location);
|
||||
|
||||
CopyStringToBuffer(&CollationBuffers->ScriptPlayer,
|
||||
"<script type=\"text/javascript\" src=\"%scinera_player_post.js\"></script>",
|
||||
URLPrefix.Location);
|
||||
DeclaimBuffer(&URLPrefix);
|
||||
|
||||
if(HasFilterMenu)
|
||||
{
|
||||
CopyBuffer(&CollationBuffers->ScriptPlayer, &FilterState);
|
||||
}
|
||||
|
||||
CopyStringToBuffer(&CollationBuffers->ScriptPlayer,
|
||||
" <script type=\"text/javascript\" src=\"%scinera_player_post.js\"></script>",
|
||||
URLPrefix.Location);
|
||||
DeclaimBuffer(&URLPrefix);
|
||||
|
||||
// NOTE(matt): Tree structure of "global" buffer dependencies
|
||||
// FilterState
|
||||
// CreditsMenu
|
||||
|
@ -3954,7 +4062,7 @@ BuffersToHTML(buffers *CollationBuffers, template *Template, char *OutputPath, i
|
|||
|
||||
#if DEBUG_MEM
|
||||
FILE *MemLog = fopen("/home/matt/cinera_mem", "a+");
|
||||
fprintf(MemLog, "\nEntered BuffersToHTML(%s)\n", OutputPath ? OutputPath : Config->OutLocation);
|
||||
fprintf(MemLog, "\nEntered BuffersToHTML(%s)\n", OutputPath ? OutputPath : Config.OutLocation);
|
||||
fclose(MemLog);
|
||||
#endif
|
||||
|
||||
|
@ -4003,24 +4111,24 @@ BuffersToHTML(buffers *CollationBuffers, template *Template, char *OutputPath, i
|
|||
}
|
||||
else
|
||||
{
|
||||
CopyStringToBuffer(&Output, CollationBuffers->ProjectName);
|
||||
CopyStringToBufferNoFormat(&Output, CollationBuffers->ProjectName);
|
||||
}
|
||||
break;
|
||||
case TAG_TITLE:
|
||||
CopyStringToBuffer(&Output, CollationBuffers->Title);
|
||||
CopyStringToBufferNoFormat(&Output, CollationBuffers->Title);
|
||||
break;
|
||||
case TAG_URL:
|
||||
if(PageType == PAGE_PLAYER)
|
||||
{
|
||||
CopyStringToBuffer(&Output, CollationBuffers->URLPlayer);
|
||||
CopyStringToBufferNoFormat(&Output, CollationBuffers->URLPlayer);
|
||||
}
|
||||
else
|
||||
{
|
||||
CopyStringToBuffer(&Output, CollationBuffers->URLIndex);
|
||||
CopyStringToBufferNoFormat(&Output, CollationBuffers->URLIndex);
|
||||
}
|
||||
break;
|
||||
case TAG_VIDEO_ID:
|
||||
CopyStringToBuffer(&Output, CollationBuffers->VideoID);
|
||||
CopyStringToBufferNoFormat(&Output, CollationBuffers->VideoID);
|
||||
break;
|
||||
case TAG_INDEX:
|
||||
if(Config.Edition == EDITION_SINGLE)
|
||||
|
@ -4054,6 +4162,22 @@ BuffersToHTML(buffers *CollationBuffers, template *Template, char *OutputPath, i
|
|||
case TAG_SCRIPT:
|
||||
CopyBuffer(&Output, &CollationBuffers->ScriptPlayer);
|
||||
break;
|
||||
case TAG_CUSTOM0: CopyStringToBufferNoFormat(&Output, CollationBuffers->Custom0); break;
|
||||
case TAG_CUSTOM1: CopyStringToBufferNoFormat(&Output, CollationBuffers->Custom1); break;
|
||||
case TAG_CUSTOM2: CopyStringToBufferNoFormat(&Output, CollationBuffers->Custom2); break;
|
||||
case TAG_CUSTOM3: CopyStringToBufferNoFormat(&Output, CollationBuffers->Custom3); break;
|
||||
case TAG_CUSTOM4: CopyStringToBufferNoFormat(&Output, CollationBuffers->Custom4); break;
|
||||
case TAG_CUSTOM5: CopyStringToBufferNoFormat(&Output, CollationBuffers->Custom5); break;
|
||||
case TAG_CUSTOM6: CopyStringToBufferNoFormat(&Output, CollationBuffers->Custom6); break;
|
||||
case TAG_CUSTOM7: CopyStringToBufferNoFormat(&Output, CollationBuffers->Custom7); break;
|
||||
case TAG_CUSTOM8: CopyStringToBufferNoFormat(&Output, CollationBuffers->Custom8); break;
|
||||
case TAG_CUSTOM9: CopyStringToBufferNoFormat(&Output, CollationBuffers->Custom9); break;
|
||||
case TAG_CUSTOM10: CopyStringToBufferNoFormat(&Output, CollationBuffers->Custom10); break;
|
||||
case TAG_CUSTOM11: CopyStringToBufferNoFormat(&Output, CollationBuffers->Custom11); break;
|
||||
case TAG_CUSTOM12: CopyStringToBufferNoFormat(&Output, CollationBuffers->Custom12); break;
|
||||
case TAG_CUSTOM13: CopyStringToBufferNoFormat(&Output, CollationBuffers->Custom13); break;
|
||||
case TAG_CUSTOM14: CopyStringToBufferNoFormat(&Output, CollationBuffers->Custom14); break;
|
||||
case TAG_CUSTOM15: CopyStringToBufferNoFormat(&Output, CollationBuffers->Custom15); break;
|
||||
}
|
||||
|
||||
DepartComment(&Template->Buffer);
|
||||
|
@ -5967,7 +6091,6 @@ main(int ArgC, char **Args)
|
|||
|
||||
if(ClaimBuffer(&CollationBuffers.IncludesIndex, "IncludesIndex", Kilobytes(1)) == RC_ARENA_FULL) { goto RIP; };
|
||||
if(ClaimBuffer(&CollationBuffers.Search, "Search", Kilobytes(32)) == RC_ARENA_FULL) { goto RIP; };
|
||||
|
||||
// NOTE(matt): Templating
|
||||
//
|
||||
// Config will contain paths of multiple templates
|
||||
|
|
|
@ -417,7 +417,7 @@
|
|||
.cineraMenus > .menu > .filter_container .filter_content,
|
||||
.cineraPlayerContainer .markers_container > .markers .marker .cineraContent .cineraCategories {
|
||||
cursor: pointer;
|
||||
display: flex;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
|
@ -575,7 +575,6 @@
|
|||
}
|
||||
|
||||
.cineraPlayerContainer .markers_container > .markers .marker .cineraContent .cineraCategories {
|
||||
display: inline-flex;
|
||||
margin: 4px;
|
||||
}
|
||||
|
||||
|
|
|
@ -107,7 +107,9 @@ var cineraProps = {
|
|||
X: null,
|
||||
Y: null,
|
||||
W: null,
|
||||
mW: null,
|
||||
H: null,
|
||||
mH: null,
|
||||
P: null
|
||||
};
|
||||
|
||||
|
|
|
@ -465,7 +465,9 @@ function toggleTheatreMode() {
|
|||
cineraProps.X = cinera.style.left;
|
||||
cineraProps.Y = cinera.style.top;
|
||||
cineraProps.W = cinera.style.width;
|
||||
cineraProps.mW = cinera.style.maxWidth;
|
||||
cineraProps.H = cinera.style.height;
|
||||
cineraProps.mH = cinera.style.maxHeight;
|
||||
cineraProps.P = cinera.style.position;
|
||||
|
||||
cinera.style.backgroundColor = "#000";
|
||||
|
@ -473,7 +475,9 @@ function toggleTheatreMode() {
|
|||
cinera.style.left = 0;
|
||||
cinera.style.top = 0;
|
||||
cinera.style.width = "100%";
|
||||
cinera.style.maxWidth = "100%";
|
||||
cinera.style.height = "100%";
|
||||
cinera.style.maxHeight = "100%";
|
||||
cinera.style.position = "fixed";
|
||||
|
||||
viewItems[0].setAttribute("data-id", "regular");
|
||||
|
@ -491,7 +495,9 @@ function toggleTheatreMode() {
|
|||
cinera.style.left = cineraProps.X;
|
||||
cinera.style.top = cineraProps.Y;
|
||||
cinera.style.width = cineraProps.W;
|
||||
cinera.style.maxWidth = cineraProps.mW;
|
||||
cinera.style.height = cineraProps.H;
|
||||
cinera.style.maxHeight = cineraProps.mH;
|
||||
cinera.style.position = cineraProps.P;
|
||||
|
||||
viewItems[0].setAttribute("data-id", "theatre");
|
||||
|
@ -1173,7 +1179,7 @@ function onRefChanged(ref, element) {
|
|||
filter.querySelector(".filter_content." + element.classList[selector].replace(/^off_/, "")).classList.add("responsible");
|
||||
}
|
||||
}
|
||||
if((element.classList[selector].startsWith("cat_") || element.classList[selector] in filterState))
|
||||
if(element.classList[selector].startsWith("cat_") || element.classList[selector] in filterState)
|
||||
{
|
||||
if(!filter.querySelector(".filter_mode").classList.add("responsible"))
|
||||
{
|
||||
|
@ -1182,7 +1188,10 @@ function onRefChanged(ref, element) {
|
|||
}
|
||||
setTimeout(resetFade, 8000);
|
||||
}
|
||||
player.jumpToNextMarker();
|
||||
if(player && player.playing)
|
||||
{
|
||||
player.jumpToNextMarker();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue