@knight-lab/timelinejs
Advanced tools
Comparing version 3.8.7 to 3.8.8
{ | ||
"name": "@knight-lab/timelinejs", | ||
"version": "3.8.7", | ||
"version": "3.8.8", | ||
"license": "MPL-2.0", | ||
@@ -5,0 +5,0 @@ "description": "TimelineJS v3: A Storytelling Timeline built in JavaScript, made by Northwestern University Knight Lab.", |
@@ -38,15 +38,20 @@ /* | ||
/** | ||
* Given a URL, or a limited set of non-URL strings, return the class which can | ||
* handle creating and showing an embed in the "media" section of a Timeline slide. | ||
* Used to assess the event.media.url attribute value for Timeline events (or, | ||
* more commonly, the value of the "Media" column of the Google Sheets configuration.) | ||
* | ||
* When the `image_only` argument is true, the input `url_or_text` will only be | ||
* Given a JavaScript Object for an event from a TimelineConfig, | ||
* determine the appropriate subclass of Media which can handle creating and showing an | ||
* embed in the "media" section of that event's slide. | ||
* | ||
* When the `image_only` argument is true, the input `url_or_text` will only be | ||
* tested against patterns which are known to return images suitable for use as | ||
* thumbnails and backgrounds. | ||
* thumbnails and backgrounds. | ||
* | ||
* @param {Object} m | ||
* @param {Boolean} image_only | ||
* | ||
* @param {String} url_or_text | ||
* @param {Boolean} image_only | ||
* @returns {Object} a JS object which represents the match, including a `type`, `name`, | ||
* `match_str`, and `cls`. These are all string values, except `cls`, which | ||
* is a JavaScript class which can be used to instantiate a media embed | ||
* or thumbnail. | ||
*/ | ||
export function lookupMediaType(url_or_text, image_only) { | ||
export function lookupMediaType(m, image_only) { | ||
var media = {}, | ||
@@ -206,3 +211,3 @@ media_types = [{ | ||
if (image_only) { | ||
if (url_or_text instanceof Array) { | ||
if (m instanceof Array) { | ||
return false; | ||
@@ -215,3 +220,3 @@ } | ||
case "instagram": | ||
if (url_or_text.url.match(media_types[i].match_str)) { | ||
if (m.url.match(media_types[i].match_str)) { | ||
media = media_types[i]; | ||
@@ -228,3 +233,3 @@ return media; | ||
for (var i = 0; i < media_types.length; i++) { | ||
if (url_or_text.url.match(media_types[i].match_str)) { | ||
if (m.url.match(media_types[i].match_str)) { | ||
return media_types[i]; | ||
@@ -231,0 +236,0 @@ } |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
5359418
23250