Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make meta available in javascript and add shortName to program if it is missing. #256

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion includes/head.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,4 +97,8 @@ function rootPath()
<meta name="twitter:description" content="<?php echo $META['name']; ?>" />
<meta property="twitter:image" content="https://iacr.org/img/logo/iacr_wordmark_twitter.png" />
<!-- apple format for iMessage and search -->
<link rel="apple-touch-icon" href="https://iacr.org/img/logo/iacrlogo_small.png">
<link rel="apple-touch-icon" href="https://iacr.org/img/logo/iacrlogo_small.png">
<script>
// This makes the meta variables available in javascript as well as PHP.
<?php echo "var meta=" . json_encode($META, JSON_PRETTY_PRINT) . ";"?>
</script>
9 changes: 9 additions & 0 deletions js/program.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,15 @@ function scrollToSession() {
function drawProgram() {
/* Every timeslot gets a tabbedSessions variable when
it is drawn, to detect which ones should use tabs. */
// Populate the shortName in the program if it wasn't already set.
if (!Object.hasOwn(currentProgram.config.timezone, 'shortName')) {
// If the metadata.json doesn't have a city set, we use 'Local'
if (meta.city) {
currentProgram.config.timezone.shortName = meta.city;
} else {
currentProgram.config.timezone.shortName = 'Local'
}
}
let days = currentProgram['days'];
for (var i = 0; i < days.length; i++) {
var timeslots = days[i]['timeslots'];
Expand Down
2 changes: 1 addition & 1 deletion program.php
Original file line number Diff line number Diff line change
Expand Up @@ -251,4 +251,4 @@

</body>

</html>
</html>