From 877aa0efc0a29cea64f7e5f6b60d4172b8e41093 Mon Sep 17 00:00:00 2001 From: Rumperuu Date: Thu, 21 Jan 2021 12:03:14 +0000 Subject: [PATCH 1/2] Fix timeline date coercion, styling, add external/empty href styling --- icons/extlink.svg | 64 ++++++++++++++++++++++++++++++++++++ page-experience-timeline.php | 11 ++++--- style.css | 46 +++++++++++++++++++++++++- taxonomy-company.php | 42 +++++++++++++---------- 4 files changed, 140 insertions(+), 23 deletions(-) create mode 100644 icons/extlink.svg diff --git a/icons/extlink.svg b/icons/extlink.svg new file mode 100644 index 0000000..54632e7 --- /dev/null +++ b/icons/extlink.svg @@ -0,0 +1,64 @@ + + + + + + + + + +image/svg+xmlOpenclipart diff --git a/page-experience-timeline.php b/page-experience-timeline.php index 082bb82..7e8a196 100644 --- a/page-experience-timeline.php +++ b/page-experience-timeline.php @@ -92,7 +92,9 @@ get_header(); ?> $loop->the_post(); ?> date('Y-m-d') ) ) ? true : false; $company = wp_get_object_terms( get_the_ID(), 'company', @@ -100,9 +102,10 @@ get_header(); ?> 'fields' => 'names', ) ); - $title = html_entity_decode( get_the_title() ); - $start = get_the_date(); - $end = ( ! get_post_meta( get_the_ID(), 'end-date', true ) ) ? date( 'c' ) : get_post_meta( get_the_ID(), 'end-date', true ); + + $title = htmlspecialchars_decode(strip_tags( get_the_title() )); + $start = get_the_date(); + $end = ( ! $endDate || ( $endDate && $endDate > date('Y-m-d') ) ) ? date( 'Y-m-d' ) : $endDate; ?> [ '', diff --git a/style.css b/style.css index a0ee558..71569ec 100644 --- a/style.css +++ b/style.css @@ -320,7 +320,7 @@ html { align-items: center; grid-template-areas: "post-content-header post-content" - " post-meta post-content" + " post-meta post-content" " . post-content"; } } @@ -957,6 +957,7 @@ body > header h1 { #split-page > #wrapper > header { text-align: center; + margin-right: 4em; } #split-page > #wrapper > header > div { opacity: 0.8; @@ -1272,6 +1273,7 @@ a:hover, a:focus { display: block; margin: auto; min-height: 200px; + max-width: 950%; } .loading { @@ -1396,3 +1398,45 @@ table:not(.footnote-reference-container) td { padding: 0.5em 1em; text-align: left; } + +details { + background-color: #eee; + color: #444; + cursor: pointer; + padding: 18px; + width: 50%; + text-align: left; + border: none; + outline: none; + transition: 0.4s; + margin-bottom: 0.5em; +} + +details[open] { + background-color: #ccc; +} + +/* Style the accordion panel. Note: hidden by default */ +details p:first-child { + padding-top: 1em; +} + +details p { + line-height: 1em; +} + +summary { + font-size: 1.1em; + font-weight: bold; +} + +/* shorter version! +a[href*="//"]:not([href*="bengoldsworthy.net"]):after { + content: url('./icons/extlink.svg'); + margin: 0 0 0 5px; +} + +a[href="#"] { + color: red; +} + */ diff --git a/taxonomy-company.php b/taxonomy-company.php index fa46c19..4246a28 100644 --- a/taxonomy-company.php +++ b/taxonomy-company.php @@ -1,11 +1,10 @@ @@ -63,10 +62,12 @@ $lowestDepthCompany = $i++; } } + + $endDate = get_post_meta( get_the_ID(), 'end-date', true ); - $title = html_entity_decode( get_the_title() ); + $title = htmlspecialchars_decode(strip_tags( get_the_title() )); $start = get_the_date(); - $end = ( ! get_post_meta( get_the_ID(), 'end-date', true ) ) ? date( 'c' ) : get_post_meta( get_the_ID(), 'end-date', true ); + $end = ( ! $endDate || ( $endDate && $endDate > date('Y-m-d') ) ) ? date( 'Y-m-d' ) : $endDate; echo "[ '" . html_entity_decode( $companies[ $lowestDepthCompany ]->name ) . "', '$title', new Date('$start'), new Date('$end') ],\n"; endwhile; ?> @@ -74,10 +75,17 @@ // Draws the table, then resizes the element height and re-draws it // to avoid needing to scroll vertically. - chart.draw(dataTable); - var realheight = parseInt(jQuery("#timeline div:first-child div:first-child div:first-child svg").attr("height"))+70; - var options = {}; - options.height = realheight; + var rowHeight = 15; + var chartHeight = dataTable.getNumberOfRows() * rowHeight + 50; + var options = { + tooltip: {isHtml: true}, + timeline: { + showRowLabels: true, + }, + height: chartHeight, + width: '100%', + }; + chart.draw(dataTable, options); } @@ -111,11 +119,9 @@ have_posts() ) : ?>
-
-
- -
-
+
+ +