Skip to content
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ build/website
build
*.log
dist
.vscode
.vscode
7 changes: 7 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
deploy_staging:
only:
- staging
script:
- yarn
- yarn run build
- rsync -a --del ./dist/* /app/timeline
Empty file modified API.md
100644 → 100755
Empty file.
Empty file modified API_TEST.html
100644 → 100755
Empty file.
Empty file modified AUTHORS
100644 → 100755
Empty file.
6 changes: 0 additions & 6 deletions CHANGELOG.md
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
3.9.1 (2022-11-29)
-------------------------
* Adapted to a change in Google Drive sharing links which caused TimelineJS to no longer select the correct media type.
* Fix rare date formatting issues
* #803 support m.youtube.com URLs same as other YouTube URLs

3.9.0 (2022-10-07)
-------------------------
* A bounty of accessibility improvements contributed by @OleksandrDanylchenko: #744, #747, #749, #750, #756, #758, #760, #764, #766, #768, #770, #783, #786, #787 and one from @madhaze #789
Expand Down
Empty file modified CONTRIBUTING.md
100644 → 100755
Empty file.
Empty file modified DEPLOYING.md
100644 → 100755
Empty file.
Binary file added Documentation_Technique_Timeline_2024.pdf
Binary file not shown.
Binary file added Documentation_Utilisateur_Timeline_2024.pdf
Binary file not shown.
Empty file modified LICENSE
100644 → 100755
Empty file.
Empty file modified README.md
100644 → 100755
Empty file.
Empty file modified RELEASING.md
100644 → 100755
Empty file.
Empty file modified babel.config.js
100644 → 100755
Empty file.
Empty file modified banner.tmpl
100644 → 100755
Empty file.
Empty file modified config.json
100644 → 100755
Empty file.
Empty file modified contrib/README.md
100644 → 100755
Empty file.
Empty file modified contrib/csv_to_json.py
100644 → 100755
Empty file.
Empty file modified contrib/docs/ImageHosting.md
100644 → 100755
Empty file.
Empty file modified contrib/examples/autoload.html
100644 → 100755
Empty file.
Empty file modified contrib/examples/iBooksAuthor/README.md
100644 → 100755
Empty file.
Empty file modified contrib/examples/iBooksAuthor/TimelineJS.wdgt/Default.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified contrib/examples/iBooksAuthor/TimelineJS.wdgt/Info.plist
100644 → 100755
Empty file.
Empty file modified contrib/examples/iBooksAuthor/TimelineJS.wdgt/index.html
100644 → 100755
Empty file.
Empty file modified contrib/examples/react.html
100644 → 100755
Empty file.
Empty file modified contrib/examples/vue.html
100644 → 100755
Empty file.
Empty file modified contrib/fedorbeets/README.md
100644 → 100755
Empty file.
Empty file modified contrib/fedorbeets/timeline.py.txt
100644 → 100755
Empty file.
Empty file modified contrib/iamamoose/README.md
100644 → 100755
Empty file.
Empty file modified contrib/iamamoose/timeline.py.txt
100644 → 100755
Empty file.
Empty file modified contrib/women_in_computing.csv
100644 → 100755
Empty file.
Empty file modified contrib/women_in_computing.json
100644 → 100755
Empty file.
Binary file added docs/Timeline_Technical_Documentation_2022.pdf
Binary file not shown.
Binary file added docs/Timeline_User_Documentation_2022.pdf
Binary file not shown.
Empty file modified fabfile.py
100644 → 100755
Empty file.
76 changes: 76 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
<!DOCTYPE html>
<html lang="en"><!--

88888888888 d8b 888 d8b 888888 d8888b
888 Y8P 888 Y8P 88b d88P Y88b
888 888 888 Y88b
888 888 88888b d88b d88b 888 888 88888b d88b 888 Y888b
888 888 888 888 88b d8P Y8b 888 888 888 88b d8P Y8b 888 Y88b
888 888 888 888 888 88888888 888 888 888 888 88888888 888 888
888 888 888 888 888 Y8b 888 888 888 888 Y8b 88P Y88b d88P
888 888 888 888 888 Y8888 888 888 888 888 Y8888 888 Y8888P
d88P
d88P
888P
-->
<head>
<title>HistoRade</title>
<meta name="description" content="Histoire des variations des ressources marines en rade de Brest">
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1,width=device-width">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-touch-fullscreen" content="yes">
<!-- Style-->
<style>
html, body {
width: 100%;
height: 100%;
padding: 0px;
margin: 0px;
}
</style>
<!-- HTML5 shim, for IE6-8 support of HTML elements--><!--[if lt IE 9]>
<script src="//html5shim.googlecode.com/svn/trunk/html5.js"></script><![endif]-->
<link rel="shortcut icon" href="https://cdn.knightlab.com/libs/blueline/latest/assets/logos/favicon.ico">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Lobster+Two:ital,wght@0,400;0,700;1,400;1,700&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Overlock&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=Bree+Serif&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=Dosis:wght@200;300;400&display=swap" rel="stylesheet">
</head>
<body>
<!-- Demo -->
<div id="timeline-embed">
<div id="timeline"></div>
</div>
<link rel="stylesheet" href="css/timeline.css">
<script type="text/javascript" src="js/timeline.js"></script>
<script>
$(document).ready(function() {
var options = {
language: 'fr',
height: 650,
soundcite: true,
hash_bookmark: true,
start_at_end: false,
start_at_slide: 11,
autolink: false,
zoom_sequence: [0.5, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89,144, 233,377,610],
max_range: "year",
}
var embed = document.getElementById('timeline-embed');
embed.style.height = getComputedStyle(document.body).height;
window.timeline = new TL.Timeline('timeline-embed', 'https://docs.google.com/spreadsheets/d/1JapQkE0LPfL-Mgep8GWJfo5A5LEH0hO4/edit#gid=528733894', options
);
window.addEventListener('resize', function() {
var embed = document.getElementById('timeline-embed');
embed.style.height = getComputedStyle(document.body).height;
timeline.updateDisplay();
})
});
</script>
<!--CSS specifiques-->
</body>
</html>
Empty file modified index.js
100644 → 100755
Empty file.
Empty file modified jest.config.js
100644 → 100755
Empty file.
4 changes: 2 additions & 2 deletions package-lock.json
100644 → 100755

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@knight-lab/timelinejs",
"version": "3.9.1",
"version": "3.9.0",
"license": "MPL-2.0",
"description": "TimelineJS v3: A Storytelling Timeline built in JavaScript, made by Northwestern University Knight Lab.",
"dependencies": {
Expand Down Expand Up @@ -70,4 +70,4 @@
"url": "https://github.com/JoeGermuska"
}
]
}
}
Empty file modified requirements.txt
100644 → 100755
Empty file.
Empty file modified src/css/icons/tl-icons.woff2
100644 → 100755
Empty file.
Empty file modified src/embed/compare.html
100644 → 100755
Empty file.
Empty file modified src/embed/index.html
100644 → 100755
Empty file.
Empty file modified src/embed/old-index.html
100644 → 100755
Empty file.
2 changes: 1 addition & 1 deletion src/embed/popular_timelines.json
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -5986,4 +5986,4 @@
"pageviews": "13,760(0.01%)",
"uniques": "10,729(0.01%)"
}
]
]
Empty file modified src/js/__tests__/Timeline.test.js
100644 → 100755
Empty file.
Empty file modified src/js/animation/Animate.js
100644 → 100755
Empty file.
Empty file modified src/js/animation/Ease.js
100644 → 100755
Empty file.
Empty file modified src/js/core/Browser.js
100644 → 100755
Empty file.
Empty file modified src/js/core/CSV.js
100644 → 100755
Empty file.
49 changes: 36 additions & 13 deletions src/js/core/ConfigFactory.js
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ function extractEventFromCSVObject(orig_row) {
Object.keys(orig_row).forEach(k => {
row[k] = trim(orig_row[k]) // get rid of white-space and reduce all-blank cells to empty strings
})

var d = {
media: {
caption: row['Media Caption'] || '',
Expand All @@ -74,8 +73,32 @@ function extractEventFromCSVObject(orig_row) {
display_date: row['Display Date'] || '', // only in v3 but no problem
group: row['Group'] || row['Tag'] || '', // small diff between v1 and v3 sheets
background: interpretBackground(row['Background']), // only in v3 but no problem
type: row['Type'] || ''

id: row['n°ID'] || '',
type: row['Type'] || '',
categories: row['Categorie'] || '',
markerColor: row['MarkerColor'] || '',
GroupOrder: row['GroupOrder'] || '',
GroupColor: row['GroupColor'] || '',
parentOf: row['parentOf'] || '',
childOf: row['childOf'] || '',
typeOfLink: row['TypeOfLink'] || '',
ZoomOnClick: row['ZoomOnClick'] || '',
}
if(d.parentOf != ''){
var parents = d.parentOf.split(/[,;]/);
d.parentOf = parents;


}
if(d.childOf != ''){
var children = d.childOf.split(/[,;]/);
d.childOf = children;



}


if (Object.keys(row).includes('Start Date') || Object.keys(row).includes('End Date')) {
// V1 date handling
Expand Down Expand Up @@ -136,8 +159,8 @@ function extractEventFromCSVObject(orig_row) {
/**
* Given a Google Sheets URL (or mere document ID), read the data and return
* a Timeline JSON file suitable for instantiating a timeline.
*
* @param {string} url
*
* @param {string} url
*/
export async function readGoogleAsCSV(url, sheets_proxy) {

Expand All @@ -147,7 +170,7 @@ export async function readGoogleAsCSV(url, sheets_proxy) {
let error = null;

await fetchCSV({
url: `${sheets_proxy}${url}`,
url: `${url}`,
}).then(d => {
rows = d;
}).catch(error_json => {
Expand Down Expand Up @@ -184,7 +207,7 @@ export async function readGoogleAsCSV(url, sheets_proxy) {
* Given a Google Sheets URL or a bare spreadsheet key, return a URL expected
* to retrieve a CSV file, assuming the Sheets doc has been "published to the web".
* No checking for the actual availability is done.
* @param {string} url_or_key
* @param {string} url_or_key
*/
export function makeGoogleCSVURL(url_or_key) {
url_or_key = url_or_key.trim()
Expand Down Expand Up @@ -231,13 +254,13 @@ async function jsonFromGoogleURL(google_url, options) {
}

/**
* Using the given URL, fetch or create a JS Object suitable for configuring a timeline. Use
* that to create a TimelineConfig, and invoke the callback with that object as its argument.
* If the second argument is an object instead of a callback function, it must have a
* Using the given URL, fetch or create a JS Object suitable for configuring a timeline. Use
* that to create a TimelineConfig, and invoke the callback with that object as its argument.
* If the second argument is an object instead of a callback function, it must have a
* 'callback' property which will be invoked with the config.
* Even in error cases, a minimal TimelineConfig object will be created and passed to the callback
* so that error messages can be displayed in the host page.
*
*
* @param {String} url the URL or Google Spreadsheet key which can be used to get configuration information
* @param {function|object} callback_or_options either a callback function or an object with a 'callback' property and other configuration properties
*/
Expand Down Expand Up @@ -265,8 +288,8 @@ export async function makeConfig(url, callback_or_options) {
try {
json = await jsonFromGoogleURL(url, options);
} catch (e) {
// even with an error, we make
// a TimelineConfig because it's
// even with an error, we make
// a TimelineConfig because it's
// the most straightforward way to display messages
// in the DOM
tc = new TimelineConfig();
Expand Down Expand Up @@ -334,4 +357,4 @@ function handleRow(event, timeline_config) {
} else {
timeline_config.events.push(event);
}
}
}
Empty file modified src/js/core/Events.js
100644 → 100755
Empty file.
Empty file modified src/js/core/Load.js
100644 → 100755
Empty file.
Empty file modified src/js/core/TLClass.js
100644 → 100755
Empty file.
Empty file modified src/js/core/TLError.js
100644 → 100755
Empty file.
19 changes: 11 additions & 8 deletions src/js/core/TimelineConfig.js
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ const STRIP_MARKUP_FIELDS = {
}

/**
* After sanitizing, make sure all <a> tags with 'href' attributes that
* don't have a target attribute are set to open in a new ('_blank')
* After sanitizing, make sure all <a> tags with 'href' attributes that
* don't have a target attribute are set to open in a new ('_blank')
* window. Also make sure that all <a> tags which are set to open in a '_blank'
* window set `rel="noopener"`
*/
Expand Down Expand Up @@ -58,7 +58,7 @@ function _process_fields(slide, callback, fieldmap) {
* Centralize use of HTML sanitizer so that we can enforce common
* rules. Maybe we would want to push this to Util and unit test
* but ultimately we're trusting the creators of the library.
* @param {string} txt
* @param {string} txt
*/
function _tl_sanitize(txt) {
return DOMPurify.sanitize(txt, {
Expand All @@ -72,6 +72,7 @@ export class TimelineConfig {
this.title = '';
this.scale = '';
this.events = [];
this.filtered_events = [];
this.eras = [];
this.event_dict = {}; // despite name, all slides (events + title) indexed by slide.unique_id
this.messages = {
Expand Down Expand Up @@ -101,6 +102,7 @@ export class TimelineConfig {
}
}


if (data.eras) {
data.eras.forEach((era_data, indexOf) => {
try {
Expand All @@ -111,8 +113,10 @@ export class TimelineConfig {
})
}


sortByDate(this.events);
sortByDate(this.eras);
this.filtered_events = [...this.events];

}
}
Expand Down Expand Up @@ -160,7 +164,7 @@ export class TimelineConfig {


/**
* @returns {boolean} whether or not this config has logged errors.
* @returns {boolean} whether or not this config has logged errors.
*/
isValid() {
return this.messages.errors.length == 0;
Expand All @@ -175,7 +179,6 @@ export class TimelineConfig {

if (typeof(data.start_date) == 'undefined') {
trace("Missing start date, skipping event")
console.log(data)
return null
}

Expand Down Expand Up @@ -354,10 +357,10 @@ export class TimelineConfig {
}

/**
* Do some simple cleanup for all slides and eras, including sanitizing
* Do some simple cleanup for all slides and eras, including sanitizing
* HTML input, or stripping markup for fields which are not intended to support
* it.
* @param { Slide | TimeEra } slide
* @param { Slide | TimeEra } slide
*/
_tidyFields(slide) {

Expand All @@ -381,4 +384,4 @@ export class TimelineConfig {
_process_fields(slide, stripMarkup, STRIP_MARKUP_FIELDS)

}
}
}
Empty file modified src/js/core/Util.js
100644 → 100755
Empty file.
Empty file modified src/js/core/__tests__/CSV.test.js
100644 → 100755
Empty file.
Empty file modified src/js/core/__tests__/ConfigFactory.test.js
100644 → 100755
Empty file.
Empty file modified src/js/core/__tests__/Util.test.js
100644 → 100755
Empty file.
Empty file modified src/js/core/__tests__/parser_test.csv
100644 → 100755
Empty file.
Empty file modified src/js/core/__tests__/women_in_computing.csv
100644 → 100755
Empty file.
Empty file modified src/js/date/DateUtil.js
100644 → 100755
Empty file.
35 changes: 2 additions & 33 deletions src/js/date/TLDate.js
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -178,24 +178,13 @@ export const TLDate = TLClass.extend({
this._createDateObj();
}

if (data.format && !format) {
format = data.format
}
this._setFormat(format, format_short);
},

setDateFormat: function(format) {
this.data.format = format;
},
/**
* Return a string representation of this date. If this date has been created with a `display_date` property,
* that value is always returned, regardless of arguments to the method invocation. Otherwise,
* the given `Language` is asked to create a string representation based on this Date's data, passing through the provided
* `format` String, or, if that is undefined, this date's default format string.
* @param {Language} language
* @param {String} format
* @returns {String} formattedDate
*/

getDisplayDate: function(language, format) {
if (this.data.display_date) {
return this.data.display_date;
Expand Down Expand Up @@ -356,14 +345,6 @@ export const TLDate = TLClass.extend({
} else if (!this.data.format_short) {
this.data.format_short = this.findBestFormat(true);
}
},
/**
* Get the year-only representation of this date. Ticks need this to layout
* the time axis, and this needs to work isomorphically for TLDate and BigDate
* @returns {Number}
*/
getFullYear: function() {
return this.data.date_obj.getFullYear()
}
});

Expand Down Expand Up @@ -496,10 +477,6 @@ export const BigDate = TLDate.extend({
this._createDateObj();
}

if (data.format && !format) {
format = data.format
}

this._setFormat(format, format_short);
},

Expand All @@ -520,13 +497,5 @@ export const BigDate = TLDate.extend({
}

throw new TLError("invalid_scale_err", scale);
},
/**
* Get the year-only representation of this date. Ticks need this to layout
* the time axis, and this needs to work isomorphically for TLDate and BigDate
* @returns {Number}
*/
getFullYear: function() {
return this.data.date_obj.getTime()
}
});
});
Loading