Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
7e0f0df
More standardized JS libraries.
Jan 2, 2013
c103caf
Moving index to example.
Jan 2, 2013
9ac5a77
Removing unneeded js files.
Jan 2, 2013
dd7a0e1
Renaming main JS file.
Jan 2, 2013
332845c
Pearing down example file.
Jan 2, 2013
5b366f8
Moving images with CSS.
Jan 2, 2013
b8d9b82
Changing reference to images.
Jan 2, 2013
00f9dc3
Bringing in changes from our timeline project.
Jan 2, 2013
aa9bce0
Adding group by year function.
Jan 2, 2013
a1a26fb
Pearing down CSS.
Jan 2, 2013
4c711fb
Abstracting out markup for timeline.
Jan 2, 2013
f8f73e4
Putting marker and post templates in JS.
Jan 2, 2013
a570c52
Renaming to something a little more specific.
Jan 2, 2013
b7850ee
Turning into basic jQuery plugin.
Jan 2, 2013
cb82f38
Taking out IDs.
Jan 2, 2013
838d4ad
remove call for loading message.
Jan 2, 2013
589e57d
Changing jquery selecting calls to use current context.
Jan 2, 2013
c9bcbb2
CSS namespacing each timeline instance so not to interfere with other…
Jan 2, 2013
d8cd0bb
Fixing use of remote images to local.
Jan 2, 2013
8a6694c
Ran CSS through beautifier.
Jan 2, 2013
c339ef7
Centering timeline in container.
Jan 2, 2013
93b390f
Adding another example.
Jan 2, 2013
d5bd63e
Adding custom column mapping.
Jan 2, 2013
a6a6d47
Updating README.
Jan 2, 2013
8a95779
Adding options to readme.
Jan 2, 2013
cf4bb4d
Minor tweak to README.
Jan 2, 2013
2cf4532
Note about IE7.
Jan 2, 2013
bbb6154
Fixed issue with use of replace for column mapping.
Jan 2, 2013
c16504a
Cleaning up JS a bit.
Jan 2, 2013
97787de
Adding option for default expansion state of posts.
Jan 2, 2013
50565a3
Adding build process.
Jan 3, 2013
c76bdef
Reversing column mapping to be more appropriate.
Jan 3, 2013
f1c5b08
Adding gutterwidth as an option.
Jan 3, 2013
27fd4f2
Changing styles to use more flexible widths.
Jan 3, 2013
031e29d
Minor edit to description of gutter width.
Jan 3, 2013
123931e
Added ability to adjust width of timeline.
Jan 3, 2013
3741729
Note on resizing.
Jan 3, 2013
6ce75c1
Built for 0.1.1.
Jan 3, 2013
c8c20b5
Adding ability to directly use a javascript array for data source.
Feb 14, 2013
26e41cc
Building.
Feb 14, 2013
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
145 changes: 119 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
# Super Awesome Vertical Timeline
# jQuery Vertical Timeline

**Timeline** shows a series of events in a vertically time-sorted structure.

Timeline utilizes a handful of super cool libraries, including [Tabletop.js](http://github.com/jsoma/tabletop) (for the data storage) and [Isotope](http://isotope.metafizzy.co/) for the layout.

A running example can be found [here](http://builtbybalance.com/github-timeline/).
Forked from the [Super Awesome Vertical Timeline](https://github.com/balancemedia/Timeline). A running example can be found [here](http://minnpost.github.com/jquery-vertical-timeline/example.html). Please see the Credits below for some restrictions on use.

## How to Use

### 1) Set up your data using Tabletop.js
### Data

Create a Google Spreadsheet with the following columns (see options for different names) and publish it. An example can be found [here](https://docs.google.com/spreadsheet/ccc?key=0AsmHVq28GtVJdG1fX3dsQlZrY18zTVA2ZG8wTXdtNHc#gid=0);

Create a Google Spreadsheet with the following columns:
* title
* date
* display date
Expand All @@ -20,29 +17,125 @@ Create a Google Spreadsheet with the following columns:
* read more url

**Please note that the the _display date_ column must be in the format _Month day, Year_ (April 25, 2012) for proper javascript parsing.**
**Also, all columns must be _plain text_ format, including the two date columns.**

Now follow the instructions over at Tabletop.js to publish the Spreadsheet.

The Spreadsheet used in the example index.html file is at [https://docs.google.com/spreadsheet/ccc?key=0AsmHVq28GtVJdG1fX3dsQlZrY18zTVA2ZG8wTXdtNHc](https://docs.google.com/spreadsheet/ccc?key=0AsmHVq28GtVJdG1fX3dsQlZrY18zTVA2ZG8wTXdtNHc)

### 2) Insert the Spreadsheet key into script.js

Find your Spreadsheet key (see Tabletop.js for instructions), and replace the sample key on line 3 of `js/script.js` with the key to your Spreadsheet.

You also need to update the name of the spreadsheet 'sheet' that holds the data on line 4 of 'js/script.js'.
**Also, all columns must be _plain text_ format, including the two date columns.**

### 3) Enjoy!
### Include CSS and JS

Include the CSS:

<link rel="stylesheet" href="css/style.css">

Include the Javascript. The following is the un-minified and un-combined version.

<script type="text/javascript" src="js/libs/jquery-1.7.1.min.js"></script>
<script type="text/javascript" src="js/libs/handlebars-1.0.rc.1.min.js"></script>
<script type="text/javascript" src="js/libs/tabletop.master-20121204.min.js"></script>
<script type="text/javascript" src="js/libs/jquery.isotope.v1.5.21.min.js"></script>
<script type="text/javascript" src="js/libs/jquery.ba-resize.v1.1.min.js"></script>
<script type="text/javascript" src="js/libs/jquery.imagesloaded.v2.1.0.min.js"></script>
<script type="text/javascript" src="js/jquery-veritcal-timeline.js"></script>

OR, use the built version (note, this will only be updated with a specific version):

<script type="text/javascript" src="js/libs.combined.min.js"></script>
<script type="text/javascript" src="js/jquery-veritcal-timeline.min.js"></script>

### Run

First, include a container for the timeline:

<div class="timeline-jquery-example-1">
</div>

Call timeline with options. Note that the ```key``` is the ID of the Google Spreadsheet, and the ```sheetname``` is the name of the sheet.

<script type="text/javascript">
$(document).ready(function() {
$('.timeline-jquery-example-1').verticalTimeline({
key: '0AsmHVq28GtVJdG1fX3dsQlZrY18zTVA2ZG8wTXdtNHc',
sheetName: 'Posts'
});
});
</script>

You can also use JSON data directly. See options below.

## Options

The following options can be passed to the plugin when called:

* ```key```: This is the ID of the Google Spreadsheet.
* Data type: string
* Default value: ```0AsmHVq28GtVJdG1fX3dsQlZrY18zTVA2ZG8wTXdtNHc```
* ```sheetName```: This is name of the sheet in the Google Spreadsheet.
* Data type: string
* Default value: ```Posts```
* ```defaultDirection```: This is default order of the timeline.
* Data type: string
* Allowed values: ```newest```, ```oldest```
* Default value: ```newest```
* ```defaultExpansion```: This is default state of the posts.
* Data type: string
* Allowed values: ```expanded```, ```collapsed```
* Default value: ```expanded```
* ```groupFunction```: The function that will handle the grouping of the timeline. There are two functions that can be called with a string, otherwise provide your own custom function.
* Data type: string or function
* Allowed values: function, ```groupSegmentByYear```, ```groupSegmentByDecade```
* Default value: ```groupSegmentByYear```
* ```sharing```: This turns off and on sharing, but currently should not be used.
* Data type: boolean
* Allowed values: ```false```, ```true```
* Default value: ```false```
* ```gutterWidth```: The distance in pixels between post bodies.
* Data type: integer
* Default value: ```56```
* ```width```: The CSS-valid width of the timeline. The default is ```auto``` and will use the container.
* Data type: string
* Default value: ```auto```
* ```handleResize```: Enables handling the resize of the timeline to adjust widths. This is a bit buggy.
* Data type: boolean
* Allowed values: ```false```, ```true```
* Default value: ```false```
* ```columnMapping```: This maps specific columns. This should be an a simple object, where the key is the value is the column expected by the timeline, and the name of the column in the spreadsheet.
* Data type: object
* Default value: ```{
'title': 'title',
'date': 'date',
'display_date': 'display date',
'photo_url': 'photo url',
'caption': 'caption',
'body': 'body',
'read_more_url': 'read more url',
'title': 'title'
}```
* ```postTemplate```: HTML template for each post.
* Data type: string
* Default value: (see code)
* ```groupMarkerTemplate```: HTML template for each group marker.
* Data type: string
* Default value: (see code)
* ```buttonTemplate```: HTML template for the top buttons.
* Data type: string
* Default value: (see code)
* ```timelineTemplate```: HTML template for the timeline and middle line.
* Data type: string
* Default value: (see code)
* ```data```: A javascript array of objects that can be substitued for getting data from a Google Spreadsheet. See the ```example.json``` file for an example structure of the data.
* Data type: object
* Default value: [none]

## Building

Building is only done for specific versions; it simply combines all the libraries and minifies the timeline plugin. To run the build process, make sure you have [UglifyJS](https://github.com/mishoo/UglifyJS) and run the following:

bash build.sh

## Bugs

* None? Tested on Chrome, Firefox, Safari, & IE 7-9.

## Possible Improvements

* Turn this into a jQuery plugin.
* Remove hard coded Tabletop.js Spreadsheet key
* Remove hard coded `#timeline` element from script, and allow for multiple Timelines per page
* IE7 has some styling issues.
* The original sharing code did not work anymore so that is currently removed.
* Please use the [issue queue](https://github.com/MinnPost/jquery-vertical-timeline/issues) to report any more bugs.

## Credits

Expand Down
22 changes: 22 additions & 0 deletions builld.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/bash

echo "Building..."

echo "Combining JS libraries (in specific order)"
cat js/libs/jquery-1.7.1.min.js > js/libs.combined.min.js
echo >> js/libs.combined.min.js
cat js/libs/handlebars-1.0.rc.1.min.js >> js/libs.combined.min.js
echo >> js/libs.combined.min.js
cat js/libs/tabletop.master-20121204.min.js >> js/libs.combined.min.js
echo >> js/libs.combined.min.js
cat js/libs/jquery.isotope.v1.5.21.min.js >> js/libs.combined.min.js
echo >> js/libs.combined.min.js
cat js/libs/jquery.ba-resize.v1.1.min.js >> js/libs.combined.min.js
echo >> js/libs.combined.min.js
cat js/libs/jquery.imagesloaded.v2.1.0.min.js >> js/libs.combined.min.js
echo >> js/libs.combined.min.js

echo "Uglifying vertical timeline script"
uglifyjs js/jquery-veritcal-timeline.js > js/jquery-veritcal-timeline.min.js

echo "Now you should commit and tag a new version!"
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
Loading