-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #254 from NEU-Libraries/timeline-v2-1
Timeline v2 1
- Loading branch information
Showing
32 changed files
with
1,874 additions
and
125 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
.leaflet-container { | ||
height: 100%; | ||
position: relative; } | ||
|
||
.map-block-leaflet-header { | ||
width: 100%; | ||
max-width: 32rem; | ||
margin: 0 0 .5rem; | ||
position: absolute; | ||
pointer-events: none; | ||
z-index: 9999; | ||
opacity: 0; | ||
transition: opacity .25; } | ||
|
||
.is-map-block-leaflet-selected { | ||
pointer-events: all; | ||
position: relative; | ||
opacity: 1; } | ||
|
||
.map_block_leaflet a { | ||
text-decoration: none; } | ||
|
||
.resizable-handle { | ||
pointer-events: none; | ||
position: absolute; | ||
-webkit-user-select: none; | ||
-moz-user-select: none; | ||
-ms-user-select: none; | ||
user-select: none; | ||
bottom: -8px; | ||
left: calc(50% - 8px); | ||
width: 16px; | ||
height: 16px; | ||
border: 2px solid #fff; | ||
border-radius: 50%; | ||
background: #00a0d2; | ||
box-sizing: border-box; | ||
z-index: 999; } | ||
|
||
.theme-picker-wrapper { | ||
display: grid; | ||
grid-template-columns: repeat(2, 1fr); | ||
grid-gap: 8px; } | ||
|
||
.theme-picker-button { | ||
padding: 4px; | ||
overflow: hidden; | ||
color: inherit; | ||
cursor: pointer; | ||
background: none; | ||
border: none; | ||
border-radius: 4px; } | ||
.theme-picker-button:hover { | ||
color: #191e23; | ||
background: #f8f9f9; } | ||
.theme-picker-button[aria-pressed="true"] { | ||
color: #191e23; | ||
outline: 2px solid transparent; | ||
outline-offset: -2px; | ||
box-shadow: 0 0 0 2px #555d66; } | ||
.theme-picker-button:focus { | ||
color: #191e23; | ||
outline: 2px solid transparent; | ||
outline-offset: -2px; | ||
box-shadow: 0 0 0 2px #00a0d2; } | ||
.theme-picker-button img { | ||
display: block; | ||
border: 1px solid rgba(79, 89, 105, 0.2); | ||
border-radius: 4px; | ||
outline: 1px solid transparent; } | ||
|
||
.theme-picker-name-button { | ||
padding: 2px; | ||
text-align: center; } |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
jQuery(document).ready(function ($) { | ||
$(".wp-block-drs-tk-gallery-carousel").each(function () { | ||
var $gallery = $(this); | ||
var slideCount = null; | ||
|
||
console.log($gallery); | ||
|
||
$gallery.on("init", function (event, slick) { | ||
slideCount = slick.slideCount; | ||
setSlideCount(); | ||
setCurrentSlideNumber(slick.currentSlide); | ||
}); | ||
|
||
$gallery.slick({ | ||
fade: $gallery.data("effect") == "fade", | ||
autoplay: $gallery.data("autoplay"), | ||
dots: $gallery.data("dots"), | ||
arrows: $gallery.data("arrows"), | ||
speed: $gallery.data("speed"), | ||
adaptiveHeight: $gallery.data("adaptiveheight"), | ||
pauseOnHover: $gallery.data("pauseOnHover"), | ||
pauseOnFocus: false, | ||
cssEase: "linear", | ||
lazyLoad: "anticipated", | ||
}); | ||
|
||
$gallery.on( | ||
"beforeChange", | ||
function (event, slick, currentSlide, nextSlide) { | ||
setCurrentSlideNumber(nextSlide); | ||
} | ||
); | ||
|
||
function setSlideCount() { | ||
var $el = $(".counter").find(".total"); | ||
$el.text(slideCount); | ||
} | ||
|
||
function setCurrentSlideNumber(currentSlide) { | ||
var $el = $(".counter").find(".current"); | ||
$el.text(currentSlide + 1); | ||
} | ||
}); | ||
}); | ||
|
||
function convertToTimelineJSON(files) { | ||
const timelineJSON = files.map((file) => { | ||
console.log(file); | ||
return { | ||
media: { | ||
url: file.fileUrl, | ||
caption: "", | ||
credit: file.creator, | ||
}, | ||
start_date: { | ||
year: file.date, | ||
}, | ||
text: { | ||
headline: "", | ||
text: file.description, | ||
}, | ||
}; | ||
}); | ||
|
||
return { | ||
events: timelineJSON, | ||
}; | ||
} | ||
|
||
function createTimeline(files = [], options = {}) { | ||
new TL.Timeline("timeline-embed", convertToTimelineJSON(files), options); | ||
} | ||
|
||
// jquery code that checks for wp-block-drs-tk-timelinev2 class and create a timeline using the data from children with data-timeline-item data attributes | ||
// wait untill the page is loaded | ||
jQuery(document).ready(function ($) { | ||
$(".wp-block-drs-tk-timelinev2").each(function () { | ||
var $timeline = $(this); | ||
var files = []; | ||
|
||
// get all divs with data-timeline-item class | ||
$timeline.find(".data-timeline-item").each(function () { | ||
var $item = $(this); | ||
// get data from data attributes | ||
var file = { | ||
fileUrl: $item.data("fileurl"), | ||
creator: $item.data("creator"), | ||
date: $item.data("date"), | ||
description: $item.data("description"), | ||
}; | ||
// push data to files array | ||
files.push(file); | ||
}); | ||
|
||
//options | ||
var options = { | ||
width: "100%", | ||
height: "100%", | ||
// source: convertToTimelineJSON(files), | ||
}; | ||
// check if timeline-embed div exists | ||
const timelineEmbed = $timeline.find("#timeline-embed"); | ||
console.log(timelineEmbed); | ||
const timelineFiles = convertToTimelineJSON(files); | ||
console.log(timelineFiles); | ||
// createTimeline | ||
new TL.Timeline(timelineEmbed[0], timelineFiles, options); | ||
}); | ||
}); |
Oops, something went wrong.