mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 10:56:53 +00:00
Added definitions and tests for timelinejs (https://github.com/NUKnightLab/TimelineJS)
This commit is contained in:
parent
48effe219f
commit
626a765e5c
41
timelinejs/timelinejs-tests.ts
Normal file
41
timelinejs/timelinejs-tests.ts
Normal file
@ -0,0 +1,41 @@
|
||||
/**
|
||||
* Created by Roland on 6/15/2014.
|
||||
*/
|
||||
///<reference path='timelinejs.d.ts'/>
|
||||
|
||||
var timelineSource:knightlab.ITimelineModel = {
|
||||
timeline: {
|
||||
headline: 'Test Headline',
|
||||
type: 'default',
|
||||
text: 'Test Text',
|
||||
asset: {
|
||||
media: 'http://www.vertex42.com/ExcelArticles/Images/timeline/Timeline-for-Benjamin-Franklin.gif',
|
||||
credit: 'http://www.vertex42.com',
|
||||
caption: 'Test Caption'
|
||||
},
|
||||
date: [
|
||||
{
|
||||
startDate: '2011,12,09',
|
||||
endDate: '2011,12,10',
|
||||
headline: 'Test Date Headline',
|
||||
text: 'Test test test test'
|
||||
},
|
||||
{
|
||||
startDate: '2012,12,09',
|
||||
endDate: '2012,12,10',
|
||||
headline: 'Test Date Headline 2',
|
||||
text: 'Test2 test2 test2 test2'
|
||||
}
|
||||
]
|
||||
}
|
||||
};
|
||||
|
||||
var source:knightlab.ITimeLineConfiguration = {
|
||||
width: '100%',
|
||||
height: '100%',
|
||||
type: 'timeline',
|
||||
embed_id: 'test',
|
||||
source: timelineSource
|
||||
};
|
||||
|
||||
createStoryJS(source);
|
||||
136
timelinejs/timelinejs.d.ts
vendored
Normal file
136
timelinejs/timelinejs.d.ts
vendored
Normal file
@ -0,0 +1,136 @@
|
||||
// Type definitions for timelinejs
|
||||
// Project: https://github.com/NUKnightLab/TimelineJS
|
||||
// Definitions by: Roland Zwaga <https://github.com/rolandzwaga>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare function createStoryJS(config:knightlab.ITimeLineConfiguration):void;
|
||||
|
||||
declare module knightlab {
|
||||
|
||||
export interface ITimeLineConfiguration {
|
||||
width: string;
|
||||
height: string;
|
||||
/*
|
||||
* path to json/ or link to googlespreadsheet
|
||||
* source Should be either the path to the JSON resource to load, or a JavaScript object corresponding to the
|
||||
* Timeline model.
|
||||
*
|
||||
* Here is an example using a data object:
|
||||
*
|
||||
* var dataObject = {timeline: {headline: "Headline", type: ... }}
|
||||
* createStoryJS({
|
||||
* type: 'timeline',
|
||||
* width: '800',
|
||||
* height: '600',
|
||||
* source: dataObject,
|
||||
* embed_id: 'my-timeline'
|
||||
* });
|
||||
* If source is a string, we will try to automatically recognize resources that are Twitter searches, Google
|
||||
* Spreadsheets or Storify stories. Failing that, we assume the source is either JSON or JSONP. If string
|
||||
* matches on .jsonp, we will treat it as JSONP, otherwise, we will append ?callback=onJSONP_Data.
|
||||
*/
|
||||
source: any;
|
||||
type?: string;
|
||||
/*
|
||||
* Optional use a different div id for embed
|
||||
*/
|
||||
embed_id?: string;
|
||||
/*
|
||||
* Optional start at latest date
|
||||
*/
|
||||
start_at_end?: boolean;
|
||||
/*
|
||||
* Optional start at specific slide
|
||||
*/
|
||||
start_at_slide?: string;
|
||||
/*
|
||||
* Optional tweak the default zoom level
|
||||
*/
|
||||
start_zoom_adjust?: string;
|
||||
/*
|
||||
* Optional location bar hashes
|
||||
*/
|
||||
hash_bookmark?: boolean;
|
||||
/*
|
||||
* Optional font
|
||||
*/
|
||||
font?: string;
|
||||
/*
|
||||
* Optional debug to console
|
||||
*/
|
||||
debug?: boolean;
|
||||
/*
|
||||
* Optional language
|
||||
*/
|
||||
lang?: string;
|
||||
/*
|
||||
* Optional path to css
|
||||
*/
|
||||
css?: string;
|
||||
/*
|
||||
* Optional path to js
|
||||
*/
|
||||
js?: string;
|
||||
/*
|
||||
* required in order to use maptype
|
||||
*/
|
||||
gmap_key?: string;
|
||||
/*
|
||||
* Stamen Maps:
|
||||
* toner
|
||||
* toner-lines
|
||||
* toner-labels
|
||||
* watercolor
|
||||
* sterrain
|
||||
*
|
||||
* Google Maps:
|
||||
* ROADMAP
|
||||
* TERRAIN
|
||||
* HYBRID
|
||||
* SATELLITE
|
||||
*
|
||||
* OpenStreetMap:
|
||||
* osm
|
||||
*/
|
||||
maptype?: string;
|
||||
}
|
||||
|
||||
export interface ITimelineModel {
|
||||
timeline:ITimeLine;
|
||||
}
|
||||
|
||||
export interface ITimeLine {
|
||||
headline?:string;
|
||||
type?:string;
|
||||
text?:string;
|
||||
asset?:ITimeLineAsset;
|
||||
date?:ITimelineDate[];
|
||||
era?:ITimelineEra[];
|
||||
}
|
||||
|
||||
export interface ITimeLineAsset {
|
||||
media:string;
|
||||
thumbnail?:string;
|
||||
credit:string;
|
||||
caption:string;
|
||||
}
|
||||
|
||||
export interface ITimelineDate extends ITimelineEra {
|
||||
classname?:string;
|
||||
asset?:ITimeLineAsset;
|
||||
}
|
||||
|
||||
export interface ITimelineEra {
|
||||
/*
|
||||
* format example: 2011,12,10
|
||||
*/
|
||||
startDate:string;
|
||||
/*
|
||||
* format example: 2011,12,10
|
||||
*/
|
||||
endDate:string;
|
||||
headline:string;
|
||||
text:string;
|
||||
tag?:string;
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user