[DRE-commits] [ruby-timeline-setter] 01/04: Imported Upstream version 0.3.2
Balasankar C
balasankarc-guest at moszumanska.debian.org
Fri Aug 15 19:03:04 UTC 2014
This is an automated email from the git hooks/post-receive script.
balasankarc-guest pushed a commit to branch master
in repository ruby-timeline-setter.
commit 94b8539464fae520912e2bf5811cd50720f7d2ba
Author: Balasankar C <balasankarc at autistici.org>
Date: Sat Aug 16 00:14:15 2014 +0530
Imported Upstream version 0.3.2
---
.document | 4 +
LICENSE.txt | 18 +
README | 15 +
Rakefile | 98 +
bin/timeline-setter | 9 +
config/assets.yml | 9 +
doc/doc.markdown | 370 +
doc/doc_wrapper.erb | 87 +
doc/docco.css | 186 +
doc/static-demo.html | 34 +
doc/templates.html | 3 +
doc/timeline-setter.html | 780 ++
doc/timeline-setter.min.html | 3 +
doc/todo.markdown | 28 +
doc/twitter-demo.html | 71 +
documentation/TimelineSetter.html | 136 +
documentation/TimelineSetter/CLI.html | 690 ++
documentation/TimelineSetter/Parser.html | 313 +
documentation/TimelineSetter/Timeline.html | 613 ++
documentation/TimelineSetter/Util.html | 246 +
documentation/_index.html | 147 +
documentation/class_list.html | 53 +
documentation/css/common.css | 1 +
documentation/css/full_list.css | 57 +
documentation/css/style.css | 328 +
documentation/file.README.html | 91 +
documentation/file_list.html | 55 +
documentation/frames.html | 28 +
documentation/index.html | 91 +
documentation/js/app.js | 214 +
documentation/js/full_list.js | 173 +
documentation/js/jquery.js | 4 +
documentation/method_list.html | 188 +
documentation/top-level-namespace.html | 112 +
index.html | 533 ++
lib/timeline_setter.rb | 15 +
lib/timeline_setter/cli.rb | 98 +
lib/timeline_setter/parser.rb | 28 +
lib/timeline_setter/timeline.rb | 52 +
lib/timeline_setter/version.rb | 3 +
metadata.yml | 200 +
public/javascripts/templates.js | 1 +
public/javascripts/templates/card.jst | 21 +
public/javascripts/templates/notch.jst | 1 +
public/javascripts/templates/series_legend.jst | 3 +
public/javascripts/templates/timeline.jst | 23 +
public/javascripts/templates/year_notch.jst | 3 +
public/javascripts/timeline-setter.js | 1098 +++
public/javascripts/timeline-setter.min.js | 1 +
public/javascripts/vendor/jquery-min.js | 5 +
public/javascripts/vendor/jquery.js | 9597 ++++++++++++++++++++++++
public/javascripts/vendor/underscore-min.js | 31 +
public/javascripts/vendor/underscore.js | 999 +++
public/stylesheets/timeline-setter.css | 422 ++
spec/spec_helper.rb | 10 +
spec/test_data.csv | 7 +
spec/timeline-debug.html | 19 +
spec/timeline_setter_spec.rb | 103 +
templates/timeline-markup.erb | 31 +
templates/timeline-min.erb | 1 +
templates/timeline.erb | 12 +
timeline_setter.gemspec | 112 +
62 files changed, 18684 insertions(+)
diff --git a/.document b/.document
new file mode 100644
index 0000000..85914e3
--- /dev/null
+++ b/.document
@@ -0,0 +1,4 @@
+README
+lib/**/*.rb
+bin/*
+LICENSE
\ No newline at end of file
diff --git a/LICENSE.txt b/LICENSE.txt
new file mode 100644
index 0000000..2476b47
--- /dev/null
+++ b/LICENSE.txt
@@ -0,0 +1,18 @@
+Copyright © 2011 ProPublica
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the “Software”), to deal in
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+of the Software, and to permit persons to whom the Software is furnished to
+do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
\ No newline at end of file
diff --git a/README b/README
new file mode 100644
index 0000000..3af160c
--- /dev/null
+++ b/README
@@ -0,0 +1,15 @@
+=
+ '
+ _______ ___ _____ __ __
+ /_ __(_)___ ___ ___ / (_)___ ___ / ___/___ / /_/ /____ _____
+ / / / / __ `__ \/ _ \/ / / __ \/ _ \\__ \/ _ \/ __/ __/ _ \/ ___/
+ / / / / / / / / / __/ / / / / / __/__/ / __/ /_/ /_/ __/ /
+ /_/ /_/_/ /_/ /_/\___/_/_/_/ /_/\___/____/\___/\__/\__/\___/_/
+
+ TimelineSetter is a tool to create HTML timelines from spreadsheets of events.
+
+ For usage and installation instructions, see:
+ http://propublica.github.com/timeline-setter/
+
+ To report a bug or suggest a feature:
+ http://github.com/propublica/timeline-setter/issues
diff --git a/Rakefile b/Rakefile
new file mode 100644
index 0000000..81a2ddc
--- /dev/null
+++ b/Rakefile
@@ -0,0 +1,98 @@
+require 'rubygems'
+require 'rake'
+require 'rake/clean'
+require 'rdoc/task'
+require 'rspec/core/rake_task'
+require './lib/timeline_setter'
+
+desc "generate templates and minified JS. Stash them in public/javascripts"
+task :jammit do
+ %x{
+ cd #{TimelineSetter::ROOT} &&
+ jammit &&
+ mv public/assets/templates.js public/javascripts/templates.js &&
+ mv public/assets/main.js public/javascripts/timeline-setter.min.js
+ rm -rf public/assets
+ }
+end
+
+desc "build docs"
+task :docs do
+ require 'rdiscount'
+ require 'erb'
+ version = TimelineSetter::VERSION
+ license = File.open('LICENSE.txt','r').read
+ mdown = RDiscount.new(ERB.new(File.open('doc/doc.markdown','r').read).result(binding), :smart).to_html
+ wrapper = File.open('doc/doc_wrapper.erb','r').read
+ mdown = File.open('index.html','w+') do |f|
+ f.write ERB.new(wrapper).result(binding)
+ end
+end
+
+desc "generate gh-pages"
+task :gh_pages do
+ `rake docs`
+ `rake yard`
+ `rake docco`
+
+ `git branch` =~ /^\* (.+)?\n/
+ current_branch = $1
+
+ `git commit -am "docs"`
+ `git push github #{current_branch}`
+ `git checkout gh-pages`
+ `git merge #{current_branch}`
+ `git push -f github gh-pages`
+ `git checkout #{current_branch}`
+end
+
+desc "generate docco"
+task :docco do
+ `docco ./public/javascripts/*.js`
+ `cp -R ./docs/* ./doc`
+ `rm -R docs`
+end
+
+begin
+ require 'jeweler'
+ Jeweler::Tasks.new do |gem|
+ gem.name = "timeline_setter"
+ gem.summary = %Q{TimelineSetter is a tool to create HTML timelines from spreadsheets of events.}
+ gem.description = %Q{TimelineSetter is a tool to create HTML timelines from spreadsheets of events.}
+ gem.email = "almshaw at gmail.com"
+ gem.homepage = "http://github.com/propublica/timeline-setter"
+ gem.authors = ["Al Shaw", "Jeff Larson"]
+ gem.executables = "timeline-setter"
+ gem.require_paths = ['lib']
+ gem.add_dependency "json"
+ gem.add_dependency "table_fu"
+ gem.add_dependency "kompress", ">= 0.0.2"
+ gem.add_dependency "jammit"
+ gem.add_development_dependency "rspec", ">= 2.0.0"
+ gem.version = TimelineSetter::VERSION
+ end
+ Jeweler::GemcutterTasks.new
+rescue LoadError
+ puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
+end
+
+Rake::RDocTask.new do |rdoc|
+ version = File.exist?('VERSION') ? File.read('VERSION') : ""
+ rdoc.rdoc_dir = 'rdoc'
+ rdoc.title = "TimelineSetter #{version}"
+ rdoc.rdoc_files.include('README*')
+ rdoc.rdoc_files.include('lib/**/*.rb')
+end
+
+# run tests with `rake spec`
+RSpec::Core::RakeTask.new(:spec) do |spec|
+ spec.pattern = 'spec/*_spec.rb'
+ spec.rspec_opts = ['--color', '--format nested']
+end
+
+desc "generate yard docs"
+task :yard do
+ `yard -o ./documentation`
+end
+
+
diff --git a/bin/timeline-setter b/bin/timeline-setter
new file mode 100755
index 0000000..319ef19
--- /dev/null
+++ b/bin/timeline-setter
@@ -0,0 +1,9 @@
+#!/usr/bin/env ruby
+
+# $ ./bin/timeline-setter -c ./test.csv -o ./public/ -O
+
+require 'rubygems'
+require File.expand_path("../../lib/timeline_setter.rb", __FILE__)
+require File.expand_path("../../lib/timeline_setter/cli.rb", __FILE__)
+
+TimelineSetter::CLI.new
\ No newline at end of file
diff --git a/config/assets.yml b/config/assets.yml
new file mode 100644
index 0000000..e0620f9
--- /dev/null
+++ b/config/assets.yml
@@ -0,0 +1,9 @@
+embed_assets :on
+template_function: _.template
+
+javascripts:
+ main:
+ - public/javascripts/timeline-setter.js
+ - public/javascripts/templates/*.jst
+ templates:
+ - public/javascripts/templates/*.jst
\ No newline at end of file
diff --git a/doc/doc.markdown b/doc/doc.markdown
new file mode 100644
index 0000000..cb97a1e
--- /dev/null
+++ b/doc/doc.markdown
@@ -0,0 +1,370 @@
+# TimelineSetter <%= version %>
+
+TimelineSetter creates beautiful timelines.
+
+It is a command-line utility that takes a [specially-structured CSV file](#csv)
+as input and outputs standards-compliant HTML/CSS/JavaScript. It supports any
+span of time from minutes to years, and supports multiple parallel event
+series in a single timeline. It can handle custom descriptions and even
+arbitrary HTML in each event "card." It creates fluid embeds that will look
+great at any width.
+
+TimelineSetter "bakes out" timelines, ready for uploading directly into your
+CMS, Amazon S3, or however you typically serve static files. It requires no
+server-side processing at all once you've generated a timeline.
+
+TimelineSetter [source on Github](https://github.com/propublica/timeline-setter/).
+
+<a id="samples"></a>
+## Assorted Docs and Samples
+
+* TimelineSetter Ruby source [documentation](documentation/index.html)
+* timeline-setter.js [annotated source](doc/timeline-setter.html)
+* A [TimelineSetter demo](doc/twitter-demo.html) using Twitter data
+
+<a id="innards"></a>
+## How it Works
+
+The project is broken into two parts: a Ruby package (along with a binary) for
+generating the assets, and the HTML, CSS and JavaScript for the timeline
+itself. TimelineSetter will create a unique HTML page that embeds a JSON
+object with your data. The CSS and JavaScript are identical for every timeline
+created, so you can host those centrally and simply point to them when you
+deploy a timeline, or (with the minified option) you can package them up with your HTML
+and paste it into your CMS all at once. You can [customize the CSS](#styling) to match the look
+and feel of your site.
+
+<a id="deps"></a>
+## Dependencies
+
+TimelineSetter relies on [TableFu](http://propublica.github.com/table-fu/), as
+well as the JavaScript libraries
+[Underscore](http://documentcloud.github.com/underscore/) and
+[jQuery](http://jquery.com/). All of these are either installed along with
+TableSetter, or packaged with the source. It has been tested with jQuery 1.5.1
+and Underscore 1.1.5.
+
+<a id="install"></a>
+## Installation
+
+Install TimelineSetter through RubyGems on Unix-like OSes:
+
+ gem install timeline_setter
+
+(Note: We haven't tested using the TimelineSetter tools on Windows even once,
+though the timelines themselves have been tested in modern browsers on
+Windows, Mac and Linux.)
+
+<a id="commandline"></a>
+## The \`timeline-setter\` command
+
+After TimelineSetter is installed, the `timeline-setter` command should be
+available in your shell. The command looks for a CSV file to parse and outputs
+static assets. At any point, you can find help by running `timeline-setter`
+without any arguments, or by adding the `-h` flag. Run the command like so:
+
+ timeline-setter -c /path/to/data.csv -o /path/to/output/directory
+
+Running `timeline-setter` with no `-o` option will generate the timeline (and
+supporting assets if applicable) within the current directory.
+
+Full list of options:
+
+* `-c CSV` Path to your CSV file.
+* `-o OUTPUT_PATH` Path to output timeline and assets. If absent, timeline will be created in current directory.
+* `-a` Do not output supporting assets such as CSS and JavaScript. This is useful if you're customizing those and don't want your versions clobbered.
+* `-m` Create a minified one-page version of your timeline with all supporting assets inline.
+* `-O` Open a browser to your new timeline after it is generated (currently Mac OS only).
+* `-i` Add a custom interval for background "interval notches." These take the format of JavaScript date [getter methods](https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Date#Methods). For example, year would be `FullYear.` All the options are available [below](#interval_notch_options). If absent, TimelineSetter will attempt to automatically create interval notches based on the first and last dates in your timeline.
+* `-h` Print help to standard output.
+
+<a id="csv"></a>
+## Setting Up Your CSV File
+
+TimelineSetter looks for certain column names in your CSV file in order to
+generate a timeline. All columns are required, though as you'll see, some of
+them can be left blank (see a [sample CSV](https://github.com/propublica/timeline-setter/blob/master/spec/test_data.csv)). Here's a summary of each column and its significance:
+
+<a id="date-csv"></a>
+### date
+
+The date the event happened. Right now, TimelineSetter only supports
+single-date events, but this can be specific down to the second. The generator
+will try its best to parse out human dates. Try "March 20, 2010," "3/20/2010,"
+"Mar. 20, 2010 11:59 PM" etc.
+
+<a id="display-date-csv"></a>
+### display\_date
+
+The date *displayed* on the event's card in the timeline. If this is blank, it
+will fall back to `date`
+
+<a id="desc-csv"></a>
+### description
+
+A description of the event.
+
+<a id="link-csv"></a>
+### link
+
+A URL to send users to more details about an event. This will generate a "read
+more" button at the bottom of the card pointing to the URL.
+
+<a id="series-csv"></a>
+### series
+
+A string representing the name of the series of events this particular event
+is a part of. TimelineSetter will find all the unique series among events in
+the spreadsheet and assign both colors and checkboxes for them at the top of
+the spreadsheet. Events not assigned to a series will be part of the "default"
+series, which have their timeline notches colored charcoal, and have no
+associated checkbox. **Note:** As a corollary, if you only have one series, it is
+best not to assign a name.
+
+<a id="html-csv"></a>
+### html
+
+Any arbitrary HTML that will be inserted above `description`. This
+field may contain image tags, YouTube tags, etc. -- nearly everything except
+`<script>` tags. If you choose to use JavaScript, you must do it inside an
+iframe and call that iframe inside this field. **Note**: If you put an image or iframe in this field, make sure to set `height` and `width` attributes, or the card may not extend around the image.
+
+<a id="deployment"></a>
+## Folder structure and deployment
+
+After you've generated a timeline with the `timeline-setter` command, you
+should see a structure much like this where you've specified your output:
+
+ |-output
+ |---timeline.html
+ |---javascripts
+ |-----timeline-setter.js
+ |-----vendor
+ |-------underscore-min.js
+ |-------jquery-min.js
+ |---stylesheets
+ |-----timeline-setter.css
+
+Dropping the whole folder onto your server or an asset host like S3 will allow
+the app to run self-contained. It requires no server-side processing at all.
+To drop into your CMS, simply copy the relevant bits of `timeline.html` and
+paste into your site's template. Then, adjust the `<link>` and `<script>` tags
+to point to their appropriate destinations.
+
+<a id="defn"></a>
+## Definitions
+
+The timeline is made up of non-clickable *interval notches* used to denote
+periods of time, and *event notches*, which, when clicked, reveal their
+associated *event cards*.
+
+<a id="configuring"></a>
+## Configuring the Timeline JavaScript Embed
+
+Although the `timeline-setter` command generates a JavaScript embed that prepopulates your data, you can also create this yourself by calling `TimelineSetter.timeline.boot` with an array of card objects, and a config object.
+
+ var myTimeline = TimelineSetter.Timeline.boot([{card}...], {config})
+
+The config object looks for `interval`, `container`, and `formatter` options.
+
+The `interval` option takes an [interval](#interval_notch_options) in the form of a JavaScript date getter. The `container` option allows you to inject the entire timeline into an element with the given selector. (By default this is `#timeline`). Finally, `formatter` is a way to format dates on the timeline's interval notches. Write a formatter like so:
+
+ formatter : function(d, defaults) {
+ var months = ['enero', 'febrero', 'marzo', 'abril', 'mayo', 'junio', 'julio', 'agosto', 'septiembre', 'octubre', 'noviembre', 'diciembre'];
+ defaults.month = months[d.getMonth()];
+ return defaults;
+ }
+
+
+
+<a name="styling"></a>
+## Styling Your Timeline
+
+TimelineSetter timelines are fully style-able. The default "ProPublica theme"
+stylesheet is packaged alongside each generated asset bundle, and is available
+in `stylesheets/timeline-setter.css`. You can alter this stylesheet, or
+replace it completely. Here's a guide to do that.
+
+<a id="styling-container"></a>
+### Overview and Styling the Container and Top Matter
+
+All TimelineSetter CSS is scoped within a namespace starting with `TS` except for the outermost container (by default `#timeline`.) The container is configurable with the `container` argument in the TimelineSetter boot function's config object.
+
+Upon first glance, it may not seem like there is much markup at all. That's
+because we make extensive use of JavaScript (ERB-style) templating via
+[Underscore.js](http://documentcloud.github.com/underscore/#template) --
+templates for each part of the timeline reside in a JST object at the end of timeline-setter.js.
+
+Currently, series colors are hard coded in the
+JavaScript. We support a maximum of nine series colors (assigned in this order:
+``#065718, #EDC047, #91ADD1, #929E5E, #9E5E23, #C44846, #465363, #EDD4A5, #CECECE``,
+they can be overridden in the "color priority" section of `timeline-setter.css`). Technically
+you can create an unlimited number of series, but they will eventually fall back
+to the default charcoal notch color.
+
+<a id="styling-bar"></a>
+### Styling the bar, notches and cards
+
+The position of interval notches is based on the interval of time between events as automatically determined by the JavaScript. Here's a sampling of what you might see in interval notches:
+
+ year => 2001
+ month => June, 2004
+ day => May 1, 2005
+ hour/minute => 11:59
+ second => 11:59:22
+
+<a id="interval_notch_options"></a>
+The interval notches date spans themselves can be customized by using the `-i` flag when generating a timeline. The available parameters are
+
+ Decade
+ Lustrum
+ FullYear
+ Month
+ Week
+ Date
+ Hours
+ Minutes
+ Seconds
+
+<a id="js_api"></a>
+## The JavaScript API
+
+As of version 0.3.0, TimelineSetter has a JavaScript API that allows programmatic access to certain events, and the ability to activate cards. To use the API, assign the `TimelineSetter.Timeline.boot()` function to a variable, and then use methods in the `api` object like so:
+
+ var currentTimeline = TimelineSetter.Timeline.boot(options);
+ currentTimeline.api.onLoad(function() {
+ console.log("I'm ready")
+ });
+
+Here are the API methods:
+
+### onLoad
+
+Register a callback for when the timeline is loaded.
+
+### onCardAdd
+
+Register a callback for when a card is added to the timeline. This method has access to the event name and the card object.
+
+ currentTimeline.api.onCardAdd(function(evtName, obj, card) {
+ console.log(obj);
+ console.log(card);
+ });
+
+If you want to customize the card's template, set `card.template` to an undescore template function.
+
+### onCardActivate
+
+Register a callback for when a card is activated (i.e. shown). This method has access to the event name and the card object.
+
+### onBarMove
+
+Register a callback for when the bar is moved or zoomed. Be careful with this one: Bar move events can be fast and furious, especially with scroll wheels in Safari.
+
+### activateCard
+
+Show the card matching a given timestamp. Right now, timelines only support one card per timestamp.
+
+<a id="roadmap"></a>
+## Roadmap
+
+On the client side, there are a number of features we plan to add, including:
+
+* Smoother zooming
+* Deactivating series checkboxes if none of its events are within the zoomed viewport
+* Auto-zooming the timeline if embedded into smaller containers
+* More iOS gestures such as "pinching"
+* Zooming to fit a series when the series is activated
+* Ranges of events (e.g. Elizabeth Taylor was married to Michael Wilding between
+ Feb. 21, 1952 and Jan. 26, 1957, as shown
+ [here](http://www.nytimes.com/interactive/2011/03/23/movies/20110323-ELIZABETH-TAYLOR-TIMELINE.html))
+* Embed code
+* JavaScript tests
+
+<a id="orgs"></a>
+## Media Organizations Using TimelineSetter
+
+* [ProPublica](http://www.propublica.org/special/tbi-psycho-platoon-timeline)
+* [Los Angeles Times](http://timelines.latimes.com/bell/)
+* [Chicago Tribune](http://www.chicagotribune.com/news/local/chi-taxi-ts-docs-20111118,0,3641202.htmlstory)
+* [Huffington Post](http://www.huffingtonpost.com/2011/09/09/ground-zero-world-trade-center-freedom-tower_n_955845.html)
+* [Talking Points Memo](http://www.talkingpointsmemo.com/interactive/2011/04/the-wisconsin-union-struggle-timeline.php)
+* [MinnPost](http://www.minnpost.com/bachmanntimeline/)
+* [Milwaukee Journal-Sentinel](http://www.jsonline.com/news/129159038.html)
+* [WNYC](http://www.wnyc.org/articles/its-free-country/2011/may/20/timeline-gay-marriage-nystate/)
+* [ArtInfo](http://www.artinfo.com/news/story/37506/getting-to-know-ai-weiwei-a-multimedia-biographical-timeline/)
+* [Global TV News (Canada)](http://www.globalnews.ca/afghanistan/timeline/index.html?utm_source=facebook-twitter&utm_medium=link&utm_campaign=community)
+* [PBS Newshour](http://www.pbs.org/newshour/timeline/uprising/)
+* [American Public Media: Marketplace](http://www.marketplace.org/topics/economy/raising-debt-ceiling)
+* [San Antonio Express-News](http://blog.chron.com/rickperry/timeline-the-rise-of-rick-perry/)
+* [Voice of America](http://www.voanews.com/english/news/asia/southeast/Burma-Timeline-134760588.html#1183262400000-)
+* [effecinque](http://www.effecinque.org/wp/processo-assange-timeline.html)
+
+<a id="credits"></a>
+## Credits
+
+[Al Shaw](http://github.com/ashaw), [Jeff Larson](http://github.com/thejefflarson), ProPublica, [Ben Welsh](http://github.com/palewire), Los Angeles Times
+
+<a id="contact"></a>
+## Contact
+
+For issues with TimelineSetter, use the
+[Issue Tracker](https://github.com/propublica/timeline-setter/issues). General
+questions should go to <a href="mailto:opensource at propublica.org">opensource at propublica.org</a>.
+
+<a id="changelog"></a>
+## Change Log
+
+<a id="release-032"></a>
+### 0.3.2
+
+* Fix reliance on jQuery's `.toggle(handler, handler)` which was deprecated in 1.8
+
+<a id="release-031"></a>
+### 0.3.1
+
+* Fix position bug that was preventing card flipping in IE <= 8
+* Add `noscript` fallback
+* Add Century, HalfCentury, Quincenenary, HalfHour, QuarterHour, Millenium intervals
+* Fix CLI in cases where output directory already exists
+
+<a id="release-030"></a>
+### 0.3.0
+
+* Add JavaScript API
+* Scope timeline to a given element to support multiple timelines on a page
+* Add date formatter config option. _Thanks [@omega](https://github.com/propublica/timeline-setter/pull/26)_
+
+<a id="release-020"></a>
+### 0.2.0
+
+* New feature adds support for custom interval notch ranges.
+* Change command line to output supporting assets by default unless `-a` is specified
+
+<a id="release-012"></a>
+### 0.1.2
+
+* Support for decade and lustrum (five year period) interval notches. _Thanks, [Ben Welsh](http://github.com/palewire)_
+
+
+<a id="release-011"></a>
+### 0.1.1
+
+* Made JavaScript smarter about image widths, so now images can be used without specifying height and width attributes
+* Fixed "read more" buttons so they can be clicked everywhere, not just on the text
+* Fixed a CLI bug where timeline was being put in the wrong place when output directory is specified without a trailing slash
+* Fixed duplicate colors in CSS
+* Fixed layout rendering problems when a card was more than half the size of the timeline
+* Fixed an issue where JSON couldn't be generated in Ruby 1.9
+
+_Thanks to [Ben Welsh](http://github.com/palewire) for pointing out most of these issues_
+
+<a id="release-010"></a>
+### 0.1.0
+
+Initial release
+
+<a id="license"></a>
+## License
+
+<%= license %>
diff --git a/doc/doc_wrapper.erb b/doc/doc_wrapper.erb
new file mode 100644
index 0000000..ab5eb52
--- /dev/null
+++ b/doc/doc_wrapper.erb
@@ -0,0 +1,87 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
+ <link href="http://cloud.webtype.com/css/50942e7d-aebe-4c83-9824-ead7e49ec5af.css" rel="stylesheet" type="text/css" />
+ <style>
+ html {
+ background: #f7f7f7;
+ }
+ body {
+ font-family: Georgia, serif;
+ font-size: 16px;
+ line-height:24px;
+ width: 600px;
+ margin-left:auto;
+ margin-right:auto;
+ margin-top:10px;
+ background: #fff;
+ padding:10px 10px;
+ color:#444;
+ border-top:1px solid #cecece;
+ border-bottom:1px solid #cecece;
+ }
+ h1,h2,h3,h4,h5 {
+ font-family: 'Helvetica Neue', Arial, sans-serif;
+ color:#444;
+ }
+ h1 {
+ padding-top:0;
+ margin-top:0;
+ }
+ h2,h3 {
+ }
+ a.propublica{
+ position:absolute;
+ background: transparent url(http://propublica.github.com/table-fu/documentation/images/proplogo.png) no-repeat -40px -20px;
+ top: 0;
+ left: 0;
+ width: 160px;
+ height: 141px;
+ }
+
+ pre,code {
+ font-family: Monaco, Courier, monospace;
+ font-size:12px;
+ }
+ pre {
+ line-height: 16px;
+ padding:0.5em 1em;
+ overflow: auto;
+ border-left: 1px solid #cecece;
+ margin-left: 0;
+ background:#f7f7f7;
+ }
+ code {
+ padding: 2px;
+ background-color: #f7f7f7;
+ }
+ pre > code {
+ padding:0;
+ }
+ a {
+ color: #4369AF;
+ text-decoration: none;
+ font-weight: bold;
+ }
+ a:hover {
+ text-decoration:underline;
+ }
+ ul {
+ margin:0 1em;
+ padding:0;
+ list-style: disc;
+ }
+ li {
+ margin:0;
+ padding:0;
+ }
+
+ </style>
+ <title>TimelineSetter</title>
+ </head>
+ <body>
+ <a href="http://www.propublica.org" class="propublica"> </a>
+ <%= mdown %>
+ </body>
+</html>
diff --git a/doc/docco.css b/doc/docco.css
new file mode 100644
index 0000000..5aa0a8d
--- /dev/null
+++ b/doc/docco.css
@@ -0,0 +1,186 @@
+/*--------------------- Layout and Typography ----------------------------*/
+body {
+ font-family: 'Palatino Linotype', 'Book Antiqua', Palatino, FreeSerif, serif;
+ font-size: 15px;
+ line-height: 22px;
+ color: #252519;
+ margin: 0; padding: 0;
+}
+a {
+ color: #261a3b;
+}
+ a:visited {
+ color: #261a3b;
+ }
+p {
+ margin: 0 0 15px 0;
+}
+h1, h2, h3, h4, h5, h6 {
+ margin: 0px 0 15px 0;
+}
+ h1 {
+ margin-top: 40px;
+ }
+#container {
+ position: relative;
+}
+#background {
+ position: fixed;
+ top: 0; left: 525px; right: 0; bottom: 0;
+ background: #f5f5ff;
+ border-left: 1px solid #e5e5ee;
+ z-index: -1;
+}
+#jump_to, #jump_page {
+ background: white;
+ -webkit-box-shadow: 0 0 25px #777; -moz-box-shadow: 0 0 25px #777;
+ -webkit-border-bottom-left-radius: 5px; -moz-border-radius-bottomleft: 5px;
+ font: 10px Arial;
+ text-transform: uppercase;
+ cursor: pointer;
+ text-align: right;
+}
+#jump_to, #jump_wrapper {
+ position: fixed;
+ right: 0; top: 0;
+ padding: 5px 10px;
+}
+ #jump_wrapper {
+ padding: 0;
+ display: none;
+ }
+ #jump_to:hover #jump_wrapper {
+ display: block;
+ }
+ #jump_page {
+ padding: 5px 0 3px;
+ margin: 0 0 25px 25px;
+ }
+ #jump_page .source {
+ display: block;
+ padding: 5px 10px;
+ text-decoration: none;
+ border-top: 1px solid #eee;
+ }
+ #jump_page .source:hover {
+ background: #f5f5ff;
+ }
+ #jump_page .source:first-child {
+ }
+table td {
+ border: 0;
+ outline: 0;
+}
+ td.docs, th.docs {
+ max-width: 450px;
+ min-width: 450px;
+ min-height: 5px;
+ padding: 10px 25px 1px 50px;
+ overflow-x: hidden;
+ vertical-align: top;
+ text-align: left;
+ }
+ .docs pre {
+ margin: 15px 0 15px;
+ padding-left: 15px;
+ }
+ .docs p tt, .docs p code {
+ background: #f8f8ff;
+ border: 1px solid #dedede;
+ font-size: 12px;
+ padding: 0 0.2em;
+ }
+ .pilwrap {
+ position: relative;
+ }
+ .pilcrow {
+ font: 12px Arial;
+ text-decoration: none;
+ color: #454545;
+ position: absolute;
+ top: 3px; left: -20px;
+ padding: 1px 2px;
+ opacity: 0;
+ -webkit-transition: opacity 0.2s linear;
+ }
+ td.docs:hover .pilcrow {
+ opacity: 1;
+ }
+ td.code, th.code {
+ padding: 14px 15px 16px 25px;
+ width: 100%;
+ vertical-align: top;
+ background: #f5f5ff;
+ border-left: 1px solid #e5e5ee;
+ }
+ pre, tt, code {
+ font-size: 12px; line-height: 18px;
+ font-family: Monaco, Consolas, "Lucida Console", monospace;
+ margin: 0; padding: 0;
+ }
+
+
+/*---------------------- Syntax Highlighting -----------------------------*/
+td.linenos { background-color: #f0f0f0; padding-right: 10px; }
+span.lineno { background-color: #f0f0f0; padding: 0 5px 0 5px; }
+body .hll { background-color: #ffffcc }
+body .c { color: #408080; font-style: italic } /* Comment */
+body .err { border: 1px solid #FF0000 } /* Error */
+body .k { color: #954121 } /* Keyword */
+body .o { color: #666666 } /* Operator */
+body .cm { color: #408080; font-style: italic } /* Comment.Multiline */
+body .cp { color: #BC7A00 } /* Comment.Preproc */
+body .c1 { color: #408080; font-style: italic } /* Comment.Single */
+body .cs { color: #408080; font-style: italic } /* Comment.Special */
+body .gd { color: #A00000 } /* Generic.Deleted */
+body .ge { font-style: italic } /* Generic.Emph */
+body .gr { color: #FF0000 } /* Generic.Error */
+body .gh { color: #000080; font-weight: bold } /* Generic.Heading */
+body .gi { color: #00A000 } /* Generic.Inserted */
+body .go { color: #808080 } /* Generic.Output */
+body .gp { color: #000080; font-weight: bold } /* Generic.Prompt */
+body .gs { font-weight: bold } /* Generic.Strong */
+body .gu { color: #800080; font-weight: bold } /* Generic.Subheading */
+body .gt { color: #0040D0 } /* Generic.Traceback */
+body .kc { color: #954121 } /* Keyword.Constant */
+body .kd { color: #954121; font-weight: bold } /* Keyword.Declaration */
+body .kn { color: #954121; font-weight: bold } /* Keyword.Namespace */
+body .kp { color: #954121 } /* Keyword.Pseudo */
+body .kr { color: #954121; font-weight: bold } /* Keyword.Reserved */
+body .kt { color: #B00040 } /* Keyword.Type */
+body .m { color: #666666 } /* Literal.Number */
+body .s { color: #219161 } /* Literal.String */
+body .na { color: #7D9029 } /* Name.Attribute */
+body .nb { color: #954121 } /* Name.Builtin */
+body .nc { color: #0000FF; font-weight: bold } /* Name.Class */
+body .no { color: #880000 } /* Name.Constant */
+body .nd { color: #AA22FF } /* Name.Decorator */
+body .ni { color: #999999; font-weight: bold } /* Name.Entity */
+body .ne { color: #D2413A; font-weight: bold } /* Name.Exception */
+body .nf { color: #0000FF } /* Name.Function */
+body .nl { color: #A0A000 } /* Name.Label */
+body .nn { color: #0000FF; font-weight: bold } /* Name.Namespace */
+body .nt { color: #954121; font-weight: bold } /* Name.Tag */
+body .nv { color: #19469D } /* Name.Variable */
+body .ow { color: #AA22FF; font-weight: bold } /* Operator.Word */
+body .w { color: #bbbbbb } /* Text.Whitespace */
+body .mf { color: #666666 } /* Literal.Number.Float */
+body .mh { color: #666666 } /* Literal.Number.Hex */
+body .mi { color: #666666 } /* Literal.Number.Integer */
+body .mo { color: #666666 } /* Literal.Number.Oct */
+body .sb { color: #219161 } /* Literal.String.Backtick */
+body .sc { color: #219161 } /* Literal.String.Char */
+body .sd { color: #219161; font-style: italic } /* Literal.String.Doc */
+body .s2 { color: #219161 } /* Literal.String.Double */
+body .se { color: #BB6622; font-weight: bold } /* Literal.String.Escape */
+body .sh { color: #219161 } /* Literal.String.Heredoc */
+body .si { color: #BB6688; font-weight: bold } /* Literal.String.Interpol */
+body .sx { color: #954121 } /* Literal.String.Other */
+body .sr { color: #BB6688 } /* Literal.String.Regex */
+body .s1 { color: #219161 } /* Literal.String.Single */
+body .ss { color: #19469D } /* Literal.String.Symbol */
+body .bp { color: #954121 } /* Name.Builtin.Pseudo */
+body .vc { color: #19469D } /* Name.Variable.Class */
+body .vg { color: #19469D } /* Name.Variable.Global */
+body .vi { color: #19469D } /* Name.Variable.Instance */
+body .il { color: #666666 } /* Literal.Number.Integer.Long */
\ No newline at end of file
diff --git a/doc/static-demo.html b/doc/static-demo.html
new file mode 100644
index 0000000..b42ac36
--- /dev/null
+++ b/doc/static-demo.html
@@ -0,0 +1,34 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <link href="http://propublica.github.com/timeline-setter/public/stylesheets/timeline-setter.css" rel="stylesheet" />
+ <script src="../public/javascripts/vendor/jquery-min.js"></script>
+ <script src="../public/javascripts/vendor/underscore-min.js"></script>
+ <script src="//s3.documentcloud.org/notes/loader.js"></script>
+ <script src="../public/javascripts/timeline-setter.js"></script>
+ <script src="../public/javascripts/templates.js"></script>
+ <style>
+ #timeline_setter .TS-item_label a {
+ color:#2262CC;
+ }
+ #timeline_setter .TS-item_label a:hover {
+ text-decoration:underline;
+ }
+ </style>
+ </head>
+ <body style="height: 100%">
+
+ <div id="timeline"></div>
+
+ <script type="text/javascript">
+ $(function() {
+ var currentTimeline = TimelineSetter.Timeline.boot(
+ [{"timestamp":1050379200000,"display_date":"Power to Fine","html":"<h2>April 15, 2003<\/h2>\r\r<div id=\"DC-note-43304\" class=\"DC-note-container\"><\/div>\r\r<script>\r dc.embed.loadNote('http:\/\/www.documentcloud.org\/documents\/287734\/annotations\/43304.js');\r<\/script>\r<a class=\"readmore\" href=\"https:\/\/www.propublica.org\/documents\/item\/287734-fda-consent-decree#document\/p1\/a43304\">Read the whole document »<\/a> ","description":"","date":"4\/15\/03","s [...]
+ {"container":"#timeline","interval":""}
+ );
+
+ });
+
+ </script>
+ </body>
+</html>
diff --git a/doc/templates.html b/doc/templates.html
new file mode 100644
index 0000000..b988f21
--- /dev/null
+++ b/doc/templates.html
@@ -0,0 +1,3 @@
+<!DOCTYPE html> <html> <head> <title>templates.js</title> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <link rel="stylesheet" media="all" href="docco.css" /> </head> <body> <div id="container"> <div id="background"></div> <div id="jump_to"> Jump To … <div id="jump_wrapper"> <div id="jump_page"> <a class="source" href="templates.html"> templates.js [...]
+
+</pre></div> </td> </tr> </tbody> </table> </div> </body> </html>
\ No newline at end of file
diff --git a/doc/timeline-setter.html b/doc/timeline-setter.html
new file mode 100644
index 0000000..fb2a0f6
--- /dev/null
+++ b/doc/timeline-setter.html
@@ -0,0 +1,780 @@
+<!DOCTYPE html> <html> <head> <title>timeline-setter.js</title> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <link rel="stylesheet" media="all" href="docco.css" /> </head> <body> <div id="container"> <div id="background"></div> <div id="jump_to"> Jump To … <div id="jump_wrapper"> <div id="jump_page"> <a class="source" href="templates.html"> templates.j [...]
+to kick off at any point.</p> </td> <td class="code"> <div class="highlight"><pre> <span class="kd">var</span> <span class="nx">TimelineSetter</span> <span class="o">=</span> <span class="nb">window</span><span class="p">.</span><span class="nx">TimelineSetter</span> <span class="o">=</span> <span class="p">(</span><span class="nb">window</span><span class="p">.</span><span class="nx">TimelineSetter</span> <span class="o">||</span> <span class="p">{ [...]
+
+<p>Each mixin operates on an object's <code>prototype</code>.</p> </td> <td class="code"> <div class="highlight"><pre></pre></div> </td> </tr> <tr id="section-5"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-5">¶</a> </div> <p>The <code>observable</code> mixin adds simple event notifications to th [...]
+object. Unlike other notification systems, when an event is triggered every
+callback bound to the object is invoked.</p> </td> <td class="code"> <div class="highlight"><pre> <span class="kd">var</span> <span class="nx">observable</span> <span class="o">=</span> <span class="kd">function</span><span class="p">(</span><span class="nx">obj</span><span class="p">){</span></pre></div> </td> </tr> <tr id="section-6"> <td class="docs"> <div class="pilwra [...]
+ <span class="kd">var</span> <span class="nx">callbacks</span> <span class="o">=</span> <span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">_callbacks</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">_callbacks</span> <span class="o">||</span> <span class="p">{});</span>
+ <span class="kd">var</span> <span class="nx">list</span> <span class="o">=</span> <span class="p">(</span><span class="nx">callbacks</span><span class="p">[</span><span class="nx">e</span><span class="p">]</span> <span class="o">=</span> <span class="nx">callbacks</span><span class="p">[</span><span class="nx">e</span><span class="p">]</span> <span class="o">||</span> <span class="p">[]);</span>
+ <span class="nx">list</span><span class="p">.</span><span class="nx">push</span><span class="p">(</span><span class="nx">cb</span><span class="p">);</span>
+ <span class="p">};</span></pre></div> </td> </tr> <tr id="section-7"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-7">¶</a> </div> <p>Invoke all callbacks registered to the object with <code>bind</code>.</p> </td> <td class="code"> <div class="highlight"><pre> <span class="nx">obj</span><sp [...]
+ <span class="k">if</span><span class="p">(</span><span class="o">!</span><span class="k">this</span><span class="p">.</span><span class="nx">_callbacks</span><span class="p">)</span> <span class="k">return</span><span class="p">;</span>
+ <span class="kd">var</span> <span class="nx">list</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">_callbacks</span><span class="p">[</span><span class="nx">e</span><span class="p">];</span>
+ <span class="k">if</span><span class="p">(</span><span class="o">!</span><span class="nx">list</span><span class="p">)</span> <span class="k">return</span><span class="p">;</span>
+ <span class="k">for</span><span class="p">(</span><span class="kd">var</span> <span class="nx">i</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span> <span class="nx">i</span> <span class="o"><</span> <span class="nx">list</span><span class="p">.</span><span class="nx">length</span><span class="p">;</span> <span class="nx">i</span><span class="o">++</span><span class="p">)</span> <span class="nx">list</span><span class="p">[</span><span class="nx">i< [...]
+ <span class="p">};</span>
+ <span class="p">};</span></pre></div> </td> </tr> <tr id="section-8"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-8">¶</a> </div> <p>Each <code>transformable</code> contains two event listeners that handle moving associated
+DOM elements around the page.</p> </td> <td class="code"> <div class="highlight"><pre> <span class="kd">var</span> <span class="nx">transformable</span> <span class="o">=</span> <span class="kd">function</span><span class="p">(</span><span class="nx">obj</span><span class="p">){</span></pre></div> </td> </tr> <tr id="section-9"> <td class="docs"> <div class="pilwrap"> [...]
+ <span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="nx">e</span><span class="p">.</span><span class="nx">deltaX</span><span class="p">)</span> <span class="k">return</span><span class="p">;</span>
+ <span class="k">if</span> <span class="p">(</span><span class="nx">_</span><span class="p">.</span><span class="nx">isUndefined</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">currOffset</span><span class="p">))</span> <span class="k">this</span><span class="p">.</span><span class="nx">currOffset</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span>
+ <span class="k">this</span><span class="p">.</span><span class="nx">currOffset</span> <span class="o">+=</span> <span class="nx">e</span><span class="p">.</span><span class="nx">deltaX</span><span class="p">;</span>
+ <span class="k">this</span><span class="p">.</span><span class="nx">el</span><span class="p">.</span><span class="nx">css</span><span class="p">({</span><span class="s2">"left"</span> <span class="o">:</span> <span class="k">this</span><span class="p">.</span><span class="nx">currOffset</span><span class="p">});</span>
+ <span class="p">};</span></pre></div> </td> </tr> <tr id="section-10"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-10">¶</a> </div> <p>The width for the <code>Bar</code> and <code>CardContainer</code> objects is set in percentages,
+in order to zoom the Timeline all that's needed is to increase or decrease
+the percentage width.</p> </td> <td class="code"> <div class="highlight"><pre> <span class="nx">obj</span><span class="p">.</span><span class="nx">zoom</span> <span class="o">=</span> <span class="kd">function</span><span class="p">(</span><span class="nx">evtName</span><span class="p">,</span> <span class="nx">e</span><span class="p">){</span>
+ <span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="nx">e</span><span class="p">.</span><span class="nx">width</span><span class="p">)</span> <span class="k">return</span><span class="p">;</span>
+ <span class="k">this</span><span class="p">.</span><span class="nx">el</span><span class="p">.</span><span class="nx">css</span><span class="p">({</span> <span class="s2">"width"</span><span class="o">:</span> <span class="nx">e</span><span class="p">.</span><span class="nx">width</span> <span class="p">});</span>
+ <span class="p">};</span>
+ <span class="p">};</span></pre></div> </td> </tr> <tr id="section-11"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-11">¶</a> </div> <p>The <code>queryable</code> mixin scopes jQuery to
+a given container.</p> </td> <td class="code"> <div class="highlight"><pre> <span class="kd">var</span> <span class="nx">queryable</span> <span class="o">=</span> <span class="kd">function</span><span class="p">(</span><span class="nx">obj</span><span class="p">,</span> <span class="nx">container</span><span class="p">)</span> <span class="p">{</span>
+ <span class="nx">obj</span><span class="p">.</span><span class="nx">$</span> <span class="o">=</span> <span class="kd">function</span><span class="p">(</span><span class="nx">query</span><span class="p">)</span> <span class="p">{</span>
+ <span class="k">return</span> <span class="nb">window</span><span class="p">.</span><span class="nx">$</span><span class="p">(</span><span class="nx">query</span><span class="p">,</span> <span class="nx">container</span><span class="p">);</span>
+ <span class="p">};</span>
+ <span class="p">};</span></pre></div> </td> </tr> <tr id="section-12"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-12">¶</a> </div> <h2>Plugins</h2>
+
+<p>Each plugin operates on an instance of an object.</p> </td> <td class="code"> <div class="highlight"><pre></pre></div> </td> </tr> <tr id="section-13"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-13">¶</a> </div> <p>Check to see if we're on a mobile device.</p> </td> <t [...]
+ <span class="k">if</span> <span class="p">(</span><span class="nx">touchInit</span><span class="p">)</span> <span class="nx">$</span><span class="p">.</span><span class="nx">event</span><span class="p">.</span><span class="nx">props</span><span class="p">.</span><span class="nx">push</span><span class="p">(</span><span class="s2">"touches"</span><span class="p">);</span></pre></div> </td> </tr> <tr id="section-14"> [...]
+or finger gestures and proxies associated events on a particular element.
+Most of this is inspired by polymaps.</p> </td> <td class="code"> <div class="highlight"><pre> <span class="kd">var</span> <span class="nx">draggable</span> <span class="o">=</span> <span class="kd">function</span><span class="p">(</span><span class="nx">obj</span><span class="p">){</span>
+ <span class="kd">var</span> <span class="nx">drag</span><span class="p">;</span></pre></div> </td> </tr> <tr id="section-15"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-15">¶</a> </div> <p>Start tracking deltas due to a tap or single click.</p> </td> <td class="code"> <div class="highlight"> [...]
+ <span class="nx">e</span><span class="p">.</span><span class="nx">preventDefault</span><span class="p">();</span>
+ <span class="nx">drag</span> <span class="o">=</span> <span class="p">{</span><span class="nx">x</span><span class="o">:</span> <span class="nx">e</span><span class="p">.</span><span class="nx">pageX</span><span class="p">};</span>
+ <span class="nx">e</span><span class="p">.</span><span class="nx">type</span> <span class="o">=</span> <span class="s2">"dragstart"</span><span class="p">;</span>
+ <span class="nx">obj</span><span class="p">.</span><span class="nx">el</span><span class="p">.</span><span class="nx">trigger</span><span class="p">(</span><span class="nx">e</span><span class="p">);</span>
+ <span class="p">}</span></pre></div> </td> </tr> <tr id="section-16"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-16">¶</a> </div> <p>The user is interacting; capture the offset and trigger a <code>dragging</code> event.</p> </td> <td class="code"> <div class="highlight"><pre> <span class= [...]
+ <span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="nx">drag</span><span class="p">)</span> <span class="k">return</span><span class="p">;</span>
+ <span class="nx">e</span><span class="p">.</span><span class="nx">preventDefault</span><span class="p">();</span>
+ <span class="nx">e</span><span class="p">.</span><span class="nx">type</span> <span class="o">=</span> <span class="s2">"dragging"</span><span class="p">;</span>
+ <span class="nx">e</span> <span class="o">=</span> <span class="nx">_</span><span class="p">.</span><span class="nx">extend</span><span class="p">(</span><span class="nx">e</span><span class="p">,</span> <span class="p">{</span>
+ <span class="nx">deltaX</span><span class="o">:</span> <span class="p">(</span><span class="nx">e</span><span class="p">.</span><span class="nx">pageX</span> <span class="o">||</span> <span class="nx">e</span><span class="p">.</span><span class="nx">touches</span><span class="p">[</span><span class="mi">0</span><span class="p">].</span><span class="nx">pageX</span><span class="p">)</span> <span class="o">-</span> <span class="nx">drag</span><span class="p">.</span><span class="nx [...]
+ <span class="p">});</span>
+ <span class="nx">drag</span> <span class="o">=</span> <span class="p">{</span> <span class="nx">x</span><span class="o">:</span> <span class="p">(</span><span class="nx">e</span><span class="p">.</span><span class="nx">pageX</span> <span class="o">||</span> <span class="nx">e</span><span class="p">.</span><span class="nx">touches</span><span class="p">[</span><span class="mi">0</span><span class="p">].</span><span class="nx">pageX</span><span class="p">)</span> <span class="p">};</span>
+ <span class="nx">obj</span><span class="p">.</span><span class="nx">el</span><span class="p">.</span><span class="nx">trigger</span><span class="p">(</span><span class="nx">e</span><span class="p">);</span>
+ <span class="p">}</span></pre></div> </td> </tr> <tr id="section-17"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-17">¶</a> </div> <p>We're done tracking the movement set drag back to <code>null</code> for the next event.</p> </td> <td class="code"> <div class="highlight"><pre> <span class [...]
+ <span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="nx">drag</span><span class="p">)</span> <span class="k">return</span><span class="p">;</span>
+ <span class="nx">drag</span> <span class="o">=</span> <span class="kc">null</span><span class="p">;</span>
+ <span class="nx">e</span><span class="p">.</span><span class="nx">type</span> <span class="o">=</span> <span class="s2">"dragend"</span><span class="p">;</span>
+ <span class="nx">obj</span><span class="p">.</span><span class="nx">el</span><span class="p">.</span><span class="nx">trigger</span><span class="p">(</span><span class="nx">e</span><span class="p">);</span>
+ <span class="p">}</span>
+
+ <span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="nx">touchInit</span><span class="p">)</span> <span class="p">{</span></pre></div> </td> </tr> <tr id="section-18"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-18">¶</a> </div> <p>Bind on mouse events if we have a mouse...</p> </td> [...]
+
+ <span class="nx">$</span><span class="p">(</span><span class="nb">document</span><span class="p">).</span><span class="nx">bind</span><span class="p">(</span><span class="s2">"mousemove"</span><span class="p">,</span> <span class="nx">mousemove</span><span class="p">);</span>
+ <span class="nx">$</span><span class="p">(</span><span class="nb">document</span><span class="p">).</span><span class="nx">bind</span><span class="p">(</span><span class="s2">"mouseup"</span><span class="p">,</span> <span class="nx">mouseup</span><span class="p">);</span>
+ <span class="p">}</span> <span class="k">else</span> <span class="p">{</span></pre></div> </td> </tr> <tr id="section-19"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-19">¶</a> </div> <p>otherwise capture <code>touchstart</code> events in order to simulate <code>doubletap</code> events.</p> </td> <td class [...]
+ <span class="nx">obj</span><span class="p">.</span><span class="nx">el</span><span class="p">.</span><span class="nx">bind</span><span class="p">(</span><span class="s2">"touchstart"</span><span class="p">,</span> <span class="kd">function</span><span class="p">(</span><span class="nx">e</span><span class="p">)</span> <span class="p">{</span>
+ <span class="kd">var</span> <span class="nx">now</span> <span class="o">=</span> <span class="nb">Date</span><span class="p">.</span><span class="nx">now</span><span class="p">();</span>
+ <span class="kd">var</span> <span class="nx">delta</span> <span class="o">=</span> <span class="nx">now</span> <span class="o">-</span> <span class="p">(</span><span class="nx">last</span> <span class="o">||</span> <span class="nx">now</span><span class="p">);</span>
+ <span class="kd">var</span> <span class="nx">type</span> <span class="o">=</span> <span class="nx">delta</span> <span class="o">></span> <span class="mi">0</span> <span class="o">&&</span> <span class="nx">delta</span> <span class="o"><=</span> <span class="mi">250</span> <span class="o">?</span> <span class="s2">"doubletap"</span> <span class="o">:</span> <span class="s2">"tap"</span><span class="p">;</span>
+ <span class="nx">drag</span> <span class="o">=</span> <span class="p">{</span><span class="nx">x</span><span class="o">:</span> <span class="nx">e</span><span class="p">.</span><span class="nx">touches</span><span class="p">[</span><span class="mi">0</span><span class="p">].</span><span class="nx">pageX</span><span class="p">};</span>
+ <span class="nx">last</span> <span class="o">=</span> <span class="nx">now</span><span class="p">;</span>
+ <span class="nx">obj</span><span class="p">.</span><span class="nx">el</span><span class="p">.</span><span class="nx">trigger</span><span class="p">(</span><span class="nx">$</span><span class="p">.</span><span class="nx">Event</span><span class="p">(</span><span class="nx">type</span><span class="p">));</span>
+ <span class="p">});</span>
+
+ <span class="nx">obj</span><span class="p">.</span><span class="nx">el</span><span class="p">.</span><span class="nx">bind</span><span class="p">(</span><span class="s2">"touchmove"</span><span class="p">,</span> <span class="nx">mousemove</span><span class="p">);</span>
+ <span class="nx">obj</span><span class="p">.</span><span class="nx">el</span><span class="p">.</span><span class="nx">bind</span><span class="p">(</span><span class="s2">"touchend"</span><span class="p">,</span> <span class="nx">mouseup</span><span class="p">);</span>
+ <span class="p">}</span>
+ <span class="p">};</span></pre></div> </td> </tr> <tr id="section-20"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-20">¶</a> </div> <p>Older versions of safari fire incredibly huge mousewheel deltas. We'll need
+to dampen the effects.</p> </td> <td class="code"> <div class="highlight"><pre> <span class="kd">var</span> <span class="nx">safari</span> <span class="o">=</span> <span class="sr">/WebKit\/533/</span><span class="p">.</span><span class="nx">test</span><span class="p">(</span><span class="nx">navigator</span><span class="p">.</span><span class="nx">userAgent</span><span class="p">);</span></pre></div> </td> </tr> [...]
+<code>delta</code> if running in Safari.</p> </td> <td class="code"> <div class="highlight"><pre> <span class="kd">var</span> <span class="nx">wheel</span> <span class="o">=</span> <span class="kd">function</span><span class="p">(</span><span class="nx">obj</span><span class="p">){</span>
+ <span class="kd">function</span> <span class="nx">mousewheel</span><span class="p">(</span><span class="nx">e</span><span class="p">){</span>
+ <span class="nx">e</span><span class="p">.</span><span class="nx">preventDefault</span><span class="p">();</span>
+ <span class="kd">var</span> <span class="nx">delta</span> <span class="o">=</span> <span class="p">(</span><span class="nx">e</span><span class="p">.</span><span class="nx">wheelDelta</span> <span class="o">||</span> <span class="o">-</span><span class="nx">e</span><span class="p">.</span><span class="nx">detail</span><span class="p">);</span>
+ <span class="k">if</span> <span class="p">(</span><span class="nx">safari</span><span class="p">){</span>
+ <span class="kd">var</span> <span class="nx">negative</span> <span class="o">=</span> <span class="nx">delta</span> <span class="o"><</span> <span class="mi">0</span> <span class="o">?</span> <span class="o">-</span><span class="mi">1</span> <span class="o">:</span> <span class="mi">1</span><span class="p">;</span>
+ <span class="nx">delta</span> <span class="o">=</span> <span class="nb">Math</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="nb">Math</span><span class="p">.</span><span class="nx">abs</span><span class="p">(</span><span class="nx">delta</span><span class="p">))</span> <span class="o">*</span> <span class="nx">negative</span> <span class="o">*</span> <span class="mi">2</span><span class="p">;</span>
+ <span class="p">}</span>
+ <span class="nx">e</span><span class="p">.</span><span class="nx">type</span> <span class="o">=</span> <span class="s2">"scrolled"</span><span class="p">;</span>
+ <span class="nx">e</span><span class="p">.</span><span class="nx">deltaX</span> <span class="o">=</span> <span class="nx">delta</span><span class="p">;</span>
+ <span class="nx">obj</span><span class="p">.</span><span class="nx">el</span><span class="p">.</span><span class="nx">trigger</span><span class="p">(</span><span class="nx">e</span><span class="p">);</span>
+ <span class="p">}</span>
+
+ <span class="nx">obj</span><span class="p">.</span><span class="nx">el</span><span class="p">.</span><span class="nx">bind</span><span class="p">(</span><span class="s2">"mousewheel DOMMouseScroll"</span><span class="p">,</span> <span class="nx">mousewheel</span><span class="p">);</span>
+ <span class="p">};</span></pre></div> </td> </tr> <tr id="section-22"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-22">¶</a> </div> <h2>Utilities</h2> </td> <td class="code"> <div class="highlight"><pre></pre></div> </td> </tr> <tr id="section [...]
+ <span class="k">this</span><span class="p">.</span><span class="nx">min</span> <span class="o">=</span> <span class="o">+</span><span class="kc">Infinity</span><span class="p">;</span>
+ <span class="k">this</span><span class="p">.</span><span class="nx">max</span> <span class="o">=</span> <span class="o">-</span><span class="kc">Infinity</span><span class="p">;</span>
+ <span class="p">};</span>
+
+ <span class="nx">Bounds</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">extend</span> <span class="o">=</span> <span class="kd">function</span><span class="p">(</span><span class="nx">num</span><span class="p">){</span>
+ <span class="k">this</span><span class="p">.</span><span class="nx">min</span> <span class="o">=</span> <span class="nb">Math</span><span class="p">.</span><span class="nx">min</span><span class="p">(</span><span class="nx">num</span><span class="p">,</span> <span class="k">this</span><span class="p">.</span><span class="nx">min</span><span class="p">);</span>
+ <span class="k">this</span><span class="p">.</span><span class="nx">max</span> <span class="o">=</span> <span class="nb">Math</span><span class="p">.</span><span class="nx">max</span><span class="p">(</span><span class="nx">num</span><span class="p">,</span> <span class="k">this</span><span class="p">.</span><span class="nx">max</span><span class="p">);</span>
+ <span class="p">};</span>
+
+ <span class="nx">Bounds</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">width</span> <span class="o">=</span> <span class="kd">function</span><span class="p">(){</span>
+ <span class="k">return</span> <span class="k">this</span><span class="p">.</span><span class="nx">max</span> <span class="o">-</span> <span class="k">this</span><span class="p">.</span><span class="nx">min</span><span class="p">;</span>
+ <span class="p">};</span></pre></div> </td> </tr> <tr id="section-24"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-24">¶</a> </div> <p>Translate a particular number from the current bounds to a given range.</p> </td> <td class="code"> <div class="highlight"><pre> <span class="nx">Bounds</span> [...]
+ <span class="k">return</span> <span class="p">(</span><span class="nx">num</span> <span class="o">-</span> <span class="k">this</span><span class="p">.</span><span class="nx">min</span><span class="p">)</span> <span class="o">/</span> <span class="k">this</span><span class="p">.</span><span class="nx">width</span><span class="p">()</span> <span class="o">*</span> <span class="nx">max</span><span class="p">;</span>
+ <span class="p">};</span></pre></div> </td> </tr> <tr id="section-25"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-25">¶</a> </div> <p><code>Intervals</code> is a particularly focused class to calculate even breaks based
+on the passed in <code>Bounds</code>.</p> </td> <td class="code"> <div class="highlight"><pre> <span class="kd">var</span> <span class="nx">Intervals</span> <span class="o">=</span> <span class="kd">function</span><span class="p">(</span><span class="nx">bounds</span><span class="p">,</span> <span class="nx">interval</span><span class="p">)</span> <span class="p">{</span>
+ <span class="k">this</span><span class="p">.</span><span class="nx">max</span> <span class="o">=</span> <span class="nx">bounds</span><span class="p">.</span><span class="nx">max</span><span class="p">;</span>
+ <span class="k">this</span><span class="p">.</span><span class="nx">min</span> <span class="o">=</span> <span class="nx">bounds</span><span class="p">.</span><span class="nx">min</span><span class="p">;</span>
+
+ <span class="k">if</span><span class="p">(</span><span class="o">!</span><span class="nx">interval</span> <span class="o">||</span> <span class="o">!</span><span class="k">this</span><span class="p">.</span><span class="nx">INTERVALS</span><span class="p">[</span><span class="nx">interval</span><span class="p">])</span> <span class="p">{</span>
+ <span class="kd">var</span> <span class="nx">i</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">computeMaxInterval</span><span class="p">();</span>
+ <span class="k">this</span><span class="p">.</span><span class="nx">maxInterval</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">INTERVAL_ORDER</span><span class="p">[</span><span class="nx">i</span><span class="p">];</span>
+ <span class="k">this</span><span class="p">.</span><span class="nx">idx</span> <span class="o">=</span> <span class="nx">i</span><span class="p">;</span>
+ <span class="p">}</span> <span class="k">else</span> <span class="p">{</span>
+ <span class="k">this</span><span class="p">.</span><span class="nx">maxInterval</span> <span class="o">=</span> <span class="nx">interval</span><span class="p">;</span>
+ <span class="k">this</span><span class="p">.</span><span class="nx">idx</span> <span class="o">=</span> <span class="nx">_</span><span class="p">.</span><span class="nx">indexOf</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">INTERVAL_ORDER</span><span class="p">,</span> <span class="nx">interval</span><span class="p">);</span>
+ <span class="p">}</span>
+ <span class="p">};</span></pre></div> </td> </tr> <tr id="section-26"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-26">¶</a> </div> <p>Format dates based for AP style.
+Pass an override function in the config object to override.</p> </td> <td class="code"> <div class="highlight"><pre> <span class="nx">Intervals</span><span class="p">.</span><span class="nx">dateFormats</span> <span class="o">=</span> <span class="kd">function</span><span class="p">(</span><span class="nx">timestamp</span><span class="p">)</span> <span class="p">{</span>
+ <span class="kd">var</span> <span class="nx">d</span> <span class="o">=</span> <span class="k">new</span> <span class="nb">Date</span><span class="p">(</span><span class="nx">timestamp</span><span class="p">);</span>
+ <span class="kd">var</span> <span class="nx">defaults</span> <span class="o">=</span> <span class="p">{};</span>
+ <span class="kd">var</span> <span class="nx">months</span> <span class="o">=</span> <span class="p">[</span><span class="s1">'Jan.'</span><span class="p">,</span> <span class="s1">'Feb.'</span><span class="p">,</span> <span class="s1">'March'</span><span class="p">,</span> <span class="s1">'April'</span><span class="p">,</span> <span class="s1">'May'</span><span class="p">,</span> <span class="s1">'June'</span><span class="p">,</span> [...]
+ <span class="kd">var</span> <span class="nx">bigHours</span> <span class="o">=</span> <span class="nx">d</span><span class="p">.</span><span class="nx">getHours</span><span class="p">()</span> <span class="o">></span> <span class="mi">12</span><span class="p">;</span>
+ <span class="kd">var</span> <span class="nx">ampm</span> <span class="o">=</span> <span class="s2">" "</span> <span class="o">+</span> <span class="p">(</span><span class="nx">d</span><span class="p">.</span><span class="nx">getHours</span><span class="p">()</span> <span class="o">>=</span> <span class="mi">12</span> <span class="o">?</span> <span class="s1">'p.m.'</span> <span class="o">:</span> <span class="s1">'a.m.'</span><span class="p">);</span>
+
+
+ <span class="nx">defaults</span><span class="p">.</span><span class="nx">month</span> <span class="o">=</span> <span class="nx">months</span><span class="p">[</span><span class="nx">d</span><span class="p">.</span><span class="nx">getMonth</span><span class="p">()];</span>
+ <span class="nx">defaults</span><span class="p">.</span><span class="nx">year</span> <span class="o">=</span> <span class="nx">d</span><span class="p">.</span><span class="nx">getFullYear</span><span class="p">();</span>
+ <span class="nx">defaults</span><span class="p">.</span><span class="nx">date</span> <span class="o">=</span> <span class="nx">defaults</span><span class="p">.</span><span class="nx">month</span> <span class="o">+</span> <span class="s2">" "</span> <span class="o">+</span> <span class="nx">d</span><span class="p">.</span><span class="nx">getDate</span><span class="p">()</span> <span class="o">+</span> <span class="s1">', '</span> <span class="o">+</span> <span clas [...]
+
+ <span class="kd">var</span> <span class="nx">hours</span><span class="p">;</span>
+ <span class="k">if</span><span class="p">(</span><span class="nx">bigHours</span><span class="p">)</span> <span class="p">{</span>
+ <span class="nx">hours</span> <span class="o">=</span> <span class="nx">d</span><span class="p">.</span><span class="nx">getHours</span><span class="p">()</span> <span class="o">-</span> <span class="mi">12</span><span class="p">;</span>
+ <span class="p">}</span> <span class="k">else</span> <span class="p">{</span>
+ <span class="nx">hours</span> <span class="o">=</span> <span class="nx">d</span><span class="p">.</span><span class="nx">getHours</span><span class="p">()</span> <span class="o">></span> <span class="mi">0</span> <span class="o">?</span> <span class="nx">d</span><span class="p">.</span><span class="nx">getHours</span><span class="p">()</span> <span class="o">:</span> <span class="s2">"12"</span><span class="p">;</span>
+ <span class="p">}</span>
+
+ <span class="nx">hours</span> <span class="o">+=</span> <span class="s2">":"</span> <span class="o">+</span> <span class="nx">padNumber</span><span class="p">(</span><span class="nx">d</span><span class="p">.</span><span class="nx">getMinutes</span><span class="p">());</span>
+ <span class="nx">defaults</span><span class="p">.</span><span class="nx">hourWithMinutes</span> <span class="o">=</span> <span class="nx">hours</span> <span class="o">+</span> <span class="nx">ampm</span><span class="p">;</span>
+ <span class="nx">defaults</span><span class="p">.</span><span class="nx">hourWithMinutesAndSeconds</span> <span class="o">=</span> <span class="nx">hours</span> <span class="o">+</span> <span class="s2">":"</span> <span class="o">+</span> <span class="nx">padNumber</span><span class="p">(</span><span class="nx">d</span><span class="p">.</span><span class="nx">getSeconds</span><span class="p">())</span> <span class="o">+</span> <span class="nx">ampm</span><span class="p">;</ [...]
+ <span class="p">};</span></pre></div> </td> </tr> <tr id="section-28"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-28">¶</a> </div> <p>A utility function to format dates in AP Style.</p> </td> <td class="code"> <div class="highlight"><pre> <span class="nx">Intervals</span><span class="p">.</sp [...]
+ <span class="kd">var</span> <span class="nx">d</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">Intervals</span><span class="p">.</span><span class="nx">dateFormats</span><span class="p">(</span><span class="nx">timestamp</span><span class="p">);</span>
+ <span class="k">switch</span> <span class="p">(</span><span class="nx">interval</span><span class="p">)</span> <span class="p">{</span>
+ <span class="k">case</span> <span class="s2">"Millennium"</span><span class="o">:</span>
+ <span class="k">return</span> <span class="nx">d</span><span class="p">.</span><span class="nx">year</span><span class="p">;</span>
+ <span class="k">case</span> <span class="s2">"Quincentenary"</span><span class="o">:</span>
+ <span class="k">return</span> <span class="nx">d</span><span class="p">.</span><span class="nx">year</span><span class="p">;</span>
+ <span class="k">case</span> <span class="s2">"Century"</span><span class="o">:</span>
+ <span class="k">return</span> <span class="nx">d</span><span class="p">.</span><span class="nx">year</span><span class="p">;</span>
+ <span class="k">case</span> <span class="s2">"HalfCentury"</span><span class="o">:</span>
+ <span class="k">return</span> <span class="nx">d</span><span class="p">.</span><span class="nx">year</span><span class="p">;</span>
+ <span class="k">case</span> <span class="s2">"Decade"</span><span class="o">:</span>
+ <span class="k">return</span> <span class="nx">d</span><span class="p">.</span><span class="nx">year</span><span class="p">;</span>
+ <span class="k">case</span> <span class="s2">"Lustrum"</span><span class="o">:</span>
+ <span class="k">return</span> <span class="nx">d</span><span class="p">.</span><span class="nx">year</span><span class="p">;</span>
+ <span class="k">case</span> <span class="s2">"FullYear"</span><span class="o">:</span>
+ <span class="k">return</span> <span class="nx">d</span><span class="p">.</span><span class="nx">year</span><span class="p">;</span>
+ <span class="k">case</span> <span class="s2">"Month"</span><span class="o">:</span>
+ <span class="k">return</span> <span class="nx">d</span><span class="p">.</span><span class="nx">month</span> <span class="o">+</span> <span class="s1">', '</span> <span class="o">+</span> <span class="nx">d</span><span class="p">.</span><span class="nx">year</span><span class="p">;</span>
+ <span class="k">case</span> <span class="s2">"Week"</span><span class="o">:</span>
+ <span class="k">return</span> <span class="nx">d</span><span class="p">.</span><span class="nx">date</span><span class="p">;</span>
+ <span class="k">case</span> <span class="s2">"Date"</span><span class="o">:</span>
+ <span class="k">return</span> <span class="nx">d</span><span class="p">.</span><span class="nx">date</span><span class="p">;</span>
+ <span class="k">case</span> <span class="s2">"Hours"</span><span class="o">:</span>
+ <span class="k">return</span> <span class="nx">d</span><span class="p">.</span><span class="nx">hourWithMinutes</span><span class="p">;</span>
+ <span class="k">case</span> <span class="s2">"HalfHour"</span><span class="o">:</span>
+ <span class="k">return</span> <span class="nx">d</span><span class="p">.</span><span class="nx">hourWithMinutes</span><span class="p">;</span>
+ <span class="k">case</span> <span class="s2">"QuarterHour"</span><span class="o">:</span>
+ <span class="k">return</span> <span class="nx">d</span><span class="p">.</span><span class="nx">hourWithMinutes</span><span class="p">;</span>
+ <span class="k">case</span> <span class="s2">"Minutes"</span><span class="o">:</span>
+ <span class="k">return</span> <span class="nx">d</span><span class="p">.</span><span class="nx">hourWithMinutes</span><span class="p">;</span>
+ <span class="k">case</span> <span class="s2">"Seconds"</span><span class="o">:</span>
+ <span class="k">return</span> <span class="nx">d</span><span class="p">.</span><span class="nx">hourWithMinutesAndSeconds</span><span class="p">;</span>
+ <span class="p">}</span>
+ <span class="p">};</span>
+
+ <span class="nx">Intervals</span><span class="p">.</span><span class="nx">prototype</span> <span class="o">=</span> <span class="p">{</span></pre></div> </td> </tr> <tr id="section-29"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-29">¶</a> </div> <p>Sane estimates of date ranges for the <code>isAtLeastA</code> test.</p> [...]
+ <span class="nx">Millennium</span> <span class="o">:</span> <span class="mi">69379200000000</span><span class="p">,</span> <span class="c1">// 2200 years is the trigger</span>
+ <span class="nx">Quincentenary</span> <span class="o">:</span> <span class="mi">34689600000000</span><span class="p">,</span> <span class="c1">// 1100 years is the trigger</span>
+ <span class="nx">Century</span> <span class="o">:</span> <span class="mi">9460800000000</span><span class="p">,</span> <span class="c1">// 300 years is the trigger</span>
+ <span class="nx">HalfCentury</span> <span class="o">:</span> <span class="mi">3153600000000</span><span class="p">,</span> <span class="c1">// 100 years is the trigger</span>
+ <span class="nx">Decade</span> <span class="o">:</span> <span class="mi">315360000000</span><span class="p">,</span>
+ <span class="nx">Lustrum</span> <span class="o">:</span> <span class="mi">157680000000</span><span class="p">,</span>
+ <span class="nx">FullYear</span> <span class="o">:</span> <span class="mi">31536000000</span><span class="p">,</span>
+ <span class="nx">Month</span> <span class="o">:</span> <span class="mi">2592000000</span><span class="p">,</span>
+ <span class="nx">Week</span> <span class="o">:</span> <span class="mi">604800000</span><span class="p">,</span>
+ <span class="nb">Date</span> <span class="o">:</span> <span class="mi">86400000</span><span class="p">,</span>
+ <span class="nx">Hours</span> <span class="o">:</span> <span class="mi">3600000</span><span class="p">,</span>
+ <span class="nx">HalfHour</span> <span class="o">:</span> <span class="mi">1800000</span><span class="p">,</span>
+ <span class="nx">QuarterHour</span> <span class="o">:</span> <span class="mi">900000</span><span class="p">,</span>
+ <span class="nx">Minutes</span> <span class="o">:</span> <span class="mi">60000</span><span class="p">,</span>
+ <span class="nx">Seconds</span> <span class="o">:</span> <span class="mi">1000</span> <span class="c1">// 1,000 millliseconds equals on second</span>
+ <span class="p">},</span></pre></div> </td> </tr> <tr id="section-30"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-30">¶</a> </div> <p>The order used when testing where exactly a timespan falls.</p> </td> <td class="code"> <div class="highlight"><pre> <span class="nx">INTERVAL_ORDER</span> [...]
+ <span class="s1">'Seconds'</span><span class="p">,</span>
+ <span class="s1">'Minutes'</span><span class="p">,</span>
+ <span class="s1">'QuarterHour'</span><span class="p">,</span>
+ <span class="s1">'HalfHour'</span><span class="p">,</span>
+ <span class="s1">'Hours'</span><span class="p">,</span>
+ <span class="s1">'Date'</span><span class="p">,</span>
+ <span class="s1">'Week'</span><span class="p">,</span>
+ <span class="s1">'Month'</span><span class="p">,</span>
+ <span class="s1">'FullYear'</span><span class="p">,</span>
+ <span class="s1">'Lustrum'</span><span class="p">,</span>
+ <span class="s1">'Decade'</span><span class="p">,</span>
+ <span class="s1">'HalfCentury'</span><span class="p">,</span>
+ <span class="s1">'Century'</span><span class="p">,</span>
+ <span class="s1">'Quincentenary'</span><span class="p">,</span>
+ <span class="s1">'Millennium'</span>
+ <span class="p">],</span></pre></div> </td> </tr> <tr id="section-31"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-31">¶</a> </div> <p>The year adjustment used for supra-year intervals.</p> </td> <td class="code"> <div class="highlight"><pre> <span class="nx">YEAR_FRACTIONS</span> <span cl [...]
+ <span class="nx">Millenium</span> <span class="o">:</span> <span class="mi">1000</span><span class="p">,</span>
+ <span class="nx">Quincentenary</span> <span class="o">:</span> <span class="mi">500</span><span class="p">,</span>
+ <span class="nx">Century</span> <span class="o">:</span> <span class="mi">100</span><span class="p">,</span>
+ <span class="nx">HalfCentury</span> <span class="o">:</span> <span class="mi">50</span><span class="p">,</span>
+ <span class="nx">Decade</span> <span class="o">:</span> <span class="mi">10</span><span class="p">,</span>
+ <span class="nx">Lustrum</span> <span class="o">:</span> <span class="mi">5</span>
+ <span class="p">},</span></pre></div> </td> </tr> <tr id="section-32"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-32">¶</a> </div> <p>A test to find the appropriate range of intervals, for example if a range of
+timestamps only spans hours this will return true when called with <code>"Hours"</code>.</p> </td> <td class="code"> <div class="highlight"><pre> <span class="nx">isAtLeastA</span> <span class="o">:</span> <span class="kd">function</span><span class="p">(</span><span class="nx">interval</span><span class="p">)</span> <span class="p">{</span>
+ <span class="k">return</span> <span class="p">((</span><span class="k">this</span><span class="p">.</span><span class="nx">max</span> <span class="o">-</span> <span class="k">this</span><span class="p">.</span><span class="nx">min</span><span class="p">)</span> <span class="o">></span> <span class="k">this</span><span class="p">.</span><span class="nx">INTERVALS</span><span class="p">[</span><span class="nx">interval</span><span class="p">]);</span>
+ <span class="p">},</span></pre></div> </td> </tr> <tr id="section-33"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-33">¶</a> </div> <p>Find the maximum interval we should use based on the estimates in <code>INTERVALS</code>.</p> </td> <td class="code"> <div class="highlight"><pre> <span cl [...]
+ <span class="k">for</span> <span class="p">(</span><span class="kd">var</span> <span class="nx">i</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span> <span class="nx">i</span> <span class="o"><</span> <span class="k">this</span><span class="p">.</span><span class="nx">INTERVAL_ORDER</span><span class="p">.</span><span class="nx">length</span><span class="p">;</span> <span class="nx">i</span><span class="o">++</span><span class="p">)</span> <span cla [...]
+ <span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="k">this</span><span class="p">.</span><span class="nx">isAtLeastA</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">INTERVAL_ORDER</span><span class="p">[</span><span class="nx">i</span><span class="p">]))</span> <span class="k">break</span><span class="p">;</span>
+ <span class="p">}</span>
+ <span class="k">return</span> <span class="nx">i</span> <span class="o">-</span> <span class="mi">1</span><span class="p">;</span>
+ <span class="p">},</span></pre></div> </td> </tr> <tr id="section-34"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-34">¶</a> </div> <p>Return the calculated <code>maxInterval</code>.</p> </td> <td class="code"> <div class="highlight"><pre> <span class="nx">getMaxInterval</span> <span class [...]
+ <span class="k">return</span> <span class="k">this</span><span class="p">.</span><span class="nx">INTERVALS</span><span class="p">[</span><span class="k">this</span><span class="p">.</span><span class="nx">INTERVAL_ORDER</span><span class="p">[</span><span class="k">this</span><span class="p">.</span><span class="nx">idx</span><span class="p">]];</span>
+ <span class="p">},</span></pre></div> </td> </tr> <tr id="section-35"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-35">¶</a> </div> <p>Floor the year to a given epoch.</p> </td> <td class="code"> <div class="highlight"><pre> <span class="nx">getYearFloor</span> <span class="o">:</span> <sp [...]
+ <span class="kd">var</span> <span class="nx">fudge</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">YEAR_FRACTIONS</span><span class="p">[</span><span class="nx">intvl</span><span class="p">]</span> <span class="o">||</span> <span class="mi">1</span><span class="p">;</span>
+ <span class="k">return</span> <span class="p">(</span><span class="nx">date</span><span class="p">.</span><span class="nx">getFullYear</span><span class="p">()</span> <span class="o">/</span> <span class="nx">fudge</span> <span class="o">|</span> <span class="mi">0</span><span class="p">)</span> <span class="o">*</span> <span class="nx">fudge</span><span class="p">;</span>
+ <span class="p">},</span></pre></div> </td> </tr> <tr id="section-36"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-36">¶</a> </div> <p>Return a date with the year set to the next interval in a given epoch.</p> </td> <td class="code"> <div class="highlight"><pre> <span class="nx">getYearCei [...]
+ <span class="k">if</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">YEAR_FRACTIONS</span><span class="p">[</span><span class="nx">intvl</span><span class="p">])</span> <span class="k">return</span> <span class="k">this</span><span class="p">.</span><span class="nx">getYearFloor</span><span class="p">(</span><span class="nx">date</span><span class="p">,</span> <span class="nx">intvl</span><span class="p">)</span> <span class="o">+</sp [...]
+ <span class="k">return</span> <span class="nx">date</span><span class="p">.</span><span class="nx">getFullYear</span><span class="p">();</span>
+ <span class="p">},</span></pre></div> </td> </tr> <tr id="section-37"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-37">¶</a> </div> <p>Return a Date object rounded down to the previous Sunday, a.k.a. the first day of the week.</p> </td> <td class="code"> <div class="highlight"><pre> <span [...]
+ <span class="nx">thisDate</span> <span class="o">=</span> <span class="k">new</span> <span class="nb">Date</span><span class="p">(</span><span class="nx">date</span><span class="p">.</span><span class="nx">getFullYear</span><span class="p">(),</span> <span class="nx">date</span><span class="p">.</span><span class="nx">getMonth</span><span class="p">(),</span> <span class="nx">date</span><span class="p">.</span><span class="nx">getDate</span><span class="p">());</span>
+ <span class="nx">thisDate</span><span class="p">.</span><span class="nx">setDate</span><span class="p">(</span><span class="nx">date</span><span class="p">.</span><span class="nx">getDate</span><span class="p">()</span> <span class="o">-</span> <span class="nx">date</span><span class="p">.</span><span class="nx">getDay</span><span class="p">());</span>
+ <span class="k">return</span> <span class="nx">thisDate</span><span class="p">;</span>
+ <span class="p">},</span></pre></div> </td> </tr> <tr id="section-38"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-38">¶</a> </div> <p>Return a Date object rounded up to the next Sunday, a.k.a. the start of the next week.</p> </td> <td class="code"> <div class="highlight"><pre> <span class [...]
+ <span class="nx">thisDate</span> <span class="o">=</span> <span class="k">new</span> <span class="nb">Date</span><span class="p">(</span><span class="nx">date</span><span class="p">.</span><span class="nx">getFullYear</span><span class="p">(),</span> <span class="nx">date</span><span class="p">.</span><span class="nx">getMonth</span><span class="p">(),</span> <span class="nx">date</span><span class="p">.</span><span class="nx">getDate</span><span class="p">());</span>
+ <span class="nx">thisDate</span><span class="p">.</span><span class="nx">setDate</span><span class="p">(</span><span class="nx">thisDate</span><span class="p">.</span><span class="nx">getDate</span><span class="p">()</span> <span class="o">+</span> <span class="p">(</span><span class="mi">7</span> <span class="o">-</span> <span class="nx">date</span><span class="p">.</span><span class="nx">getDay</span><span class="p">()));</span>
+ <span class="k">return</span> <span class="nx">thisDate</span><span class="p">;</span>
+ <span class="p">},</span></pre></div> </td> </tr> <tr id="section-39"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-39">¶</a> </div> <p>Return the half of the hour this date belongs to. Anything before 30 min.
+past the hour comes back as zero. Anything after comes back as 30.</p> </td> <td class="code"> <div class="highlight"><pre> <span class="nx">getHalfHour</span><span class="o">:</span> <span class="kd">function</span><span class="p">(</span><span class="nx">date</span><span class="p">)</span> <span class="p">{</span>
+ <span class="k">return</span> <span class="nx">date</span><span class="p">.</span><span class="nx">getMinutes</span><span class="p">()</span> <span class="o">></span> <span class="mi">30</span> <span class="o">?</span> <span class="mi">30</span> <span class="o">:</span> <span class="mi">0</span><span class="p">;</span>
+ <span class="p">},</span></pre></div> </td> </tr> <tr id="section-40"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-40">¶</a> </div> <p>Return the quarter of the hour this date belongs to. Anything before 15 min.
+past the hour comes back as zero; 15-30 comes back as 15; 30-45 as 30;
+45-60 as 45.</p> </td> <td class="code"> <div class="highlight"><pre> <span class="nx">getQuarterHour</span><span class="o">:</span> <span class="kd">function</span><span class="p">(</span><span class="nx">date</span><span class="p">)</span> <span class="p">{</span>
+ <span class="kd">var</span> <span class="nx">minutes</span> <span class="o">=</span> <span class="nx">date</span><span class="p">.</span><span class="nx">getMinutes</span><span class="p">();</span>
+ <span class="k">if</span> <span class="p">(</span><span class="nx">minutes</span> <span class="o"><</span> <span class="mi">15</span><span class="p">)</span> <span class="k">return</span> <span class="mi">0</span><span class="p">;</span>
+ <span class="k">if</span> <span class="p">(</span><span class="nx">minutes</span> <span class="o"><</span> <span class="mi">30</span><span class="p">)</span> <span class="k">return</span> <span class="mi">15</span><span class="p">;</span>
+ <span class="k">if</span> <span class="p">(</span><span class="nx">minutes</span> <span class="o"><</span> <span class="mi">45</span><span class="p">)</span> <span class="k">return</span> <span class="mi">30</span><span class="p">;</span>
+ <span class="k">return</span> <span class="mi">45</span><span class="p">;</span>
+ <span class="p">},</span></pre></div> </td> </tr> <tr id="section-41"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-41">¶</a> </div> <p>Zero out a date from the current interval down to seconds.</p> </td> <td class="code"> <div class="highlight"><pre> <span class="nx">floor</span> <span cla [...]
+ <span class="kd">var</span> <span class="nx">date</span> <span class="o">=</span> <span class="k">new</span> <span class="nb">Date</span><span class="p">(</span><span class="nx">ts</span><span class="p">);</span>
+ <span class="kd">var</span> <span class="nx">intvl</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">INTERVAL_ORDER</span><span class="p">[</span><span class="k">this</span><span class="p">.</span><span class="nx">idx</span><span class="p">];</span>
+ <span class="kd">var</span> <span class="nx">idx</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">idx</span> <span class="o">></span> <span class="nx">_</span><span class="p">.</span><span class="nx">indexOf</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">INTERVAL_ORDER</span><span class="p">,</span><span class="s1">'FullYear'</span><span class="p">)</span> <span class= [...]
+ <span class="nx">_</span><span class="p">.</span><span class="nx">indexOf</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">INTERVAL_ORDER</span><span class="p">,</span><span class="s1">'FullYear'</span><span class="p">)</span> <span class="o">:</span>
+ <span class="nx">idx</span><span class="p">;</span></pre></div> </td> </tr> <tr id="section-42"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-42">¶</a> </div> <p>Zero the special extensions, and adjust as idx necessary.</p> </td> <td class="code"> <div class="highlight"><pre> [...]
+ <span class="k">switch</span><span class="p">(</span><span class="nx">intvl</span><span class="p">){</span>
+ <span class="k">case</span> <span class="s1">'Week'</span><span class="o">:</span>
+ <span class="nx">date</span><span class="p">.</span><span class="nx">setDate</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">getWeekFloor</span><span class="p">(</span><span class="nx">date</span><span class="p">).</span><span class="nx">getDate</span><span class="p">());</span>
+ <span class="nx">idx</span> <span class="o">=</span> <span class="nx">_</span><span class="p">.</span><span class="nx">indexOf</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">INTERVAL_ORDER</span><span class="p">,</span> <span class="s1">'Week'</span><span class="p">);</span>
+ <span class="k">case</span> <span class="s1">'HalfHour'</span><span class="o">:</span>
+ <span class="nx">date</span><span class="p">.</span><span class="nx">setMinutes</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">getHalfHour</span><span class="p">(</span><span class="nx">date</span><span class="p">));</span>
+ <span class="k">case</span> <span class="s1">'QuarterHour'</span><span class="o">:</span>
+ <span class="nx">date</span><span class="p">.</span><span class="nx">setMinutes</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">getQuarterHour</span><span class="p">(</span><span class="nx">date</span><span class="p">));</span>
+ <span class="p">}</span></pre></div> </td> </tr> <tr id="section-43"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-43">¶</a> </div> <p>Zero out the rest</p> </td> <td class="code"> <div class="highlight"><pre> <span class="k">while</span><span class="p">(</span><span class="nx">idx</spa [...]
+ <span class="nx">intvl</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">INTERVAL_ORDER</span><span class="p">[</span><span class="nx">idx</span><span class="p">];</span>
+ <span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="p">(</span><span class="nx">_</span><span class="p">.</span><span class="nx">include</span><span class="p">([</span><span class="s1">'Week'</span><span class="p">,</span> <span class="s1">'HalfHour'</span><span class="p">,</span> <span class="s1">'QuarterHour'</span><span class="p">].</span><span class="nx">concat</span><span class="p">(</span><span class="nx">_</span><s [...]
+ <span class="nx">date</span><span class="p">[</span><span class="s2">"set"</span> <span class="o">+</span> <span class="nx">intvl</span><span class="p">](</span><span class="nx">intvl</span> <span class="o">===</span> <span class="s2">"Date"</span> <span class="o">?</span> <span class="mi">1</span> <span class="o">:</span> <span class="mi">0</span><span class="p">);</span>
+ <span class="p">}</span>
+
+ <span class="k">return</span> <span class="nx">date</span><span class="p">.</span><span class="nx">getTime</span><span class="p">();</span>
+ <span class="p">},</span></pre></div> </td> </tr> <tr id="section-44"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-44">¶</a> </div> <p>Find the next date based on the past in timestamp.</p> </td> <td class="code"> <div class="highlight"><pre> <span class="nx">ceil</span> <span class="o">:< [...]
+ <span class="kd">var</span> <span class="nx">date</span> <span class="o">=</span> <span class="k">new</span> <span class="nb">Date</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">floor</span><span class="p">(</span><span class="nx">ts</span><span class="p">));</span>
+ <span class="kd">var</span> <span class="nx">intvl</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">INTERVAL_ORDER</span><span class="p">[</span><span class="k">this</span><span class="p">.</span><span class="nx">idx</span><span class="p">];</span>
+
+ <span class="nx">date</span><span class="p">.</span><span class="nx">setFullYear</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">getYearCeil</span><span class="p">(</span><span class="nx">date</span><span class="p">,</span> <span class="nx">intvl</span><span class="p">));</span>
+ <span class="k">switch</span><span class="p">(</span><span class="nx">intvl</span><span class="p">){</span>
+ <span class="k">case</span> <span class="s1">'Week'</span><span class="o">:</span>
+ <span class="nx">date</span><span class="p">.</span><span class="nx">setTime</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">getWeekCeil</span><span class="p">(</span><span class="nx">date</span><span class="p">).</span><span class="nx">getTime</span><span class="p">());</span>
+ <span class="k">break</span><span class="p">;</span>
+ <span class="k">case</span> <span class="s1">'HalfHour'</span><span class="o">:</span>
+ <span class="nx">date</span><span class="p">.</span><span class="nx">setMinutes</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">getHalfHour</span><span class="p">(</span><span class="nx">date</span><span class="p">)</span> <span class="o">+</span> <span class="mi">30</span><span class="p">);</span>
+ <span class="k">break</span><span class="p">;</span>
+ <span class="k">case</span> <span class="s1">'QuarterHour'</span><span class="o">:</span>
+ <span class="nx">date</span><span class="p">.</span><span class="nx">setMinutes</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">getQuarterHour</span><span class="p">(</span><span class="nx">date</span><span class="p">)</span> <span class="o">+</span> <span class="mi">15</span><span class="p">);</span>
+ <span class="k">break</span><span class="p">;</span>
+ <span class="k">default</span><span class="o">:</span>
+ <span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="p">(</span><span class="nx">_</span><span class="p">.</span><span class="nx">include</span><span class="p">([</span><span class="s1">'Week'</span><span class="p">,</span> <span class="s1">'HalfHour'</span><span class="p">,</span> <span class="s1">'QuarterHour'</span><span class="p">].</span><span class="nx">concat</span><span class="p">(</span><span class="nx">_</span> [...]
+ <span class="nx">date</span><span class="p">[</span><span class="s2">"set"</span> <span class="o">+</span> <span class="nx">intvl</span><span class="p">](</span><span class="nx">date</span><span class="p">[</span><span class="s2">"get"</span> <span class="o">+</span> <span class="nx">intvl</span><span class="p">]()</span> <span class="o">+</span> <span class="mi">1</span><span class="p">);</span>
+ <span class="p">}</span>
+ <span class="k">return</span> <span class="nx">date</span><span class="p">.</span><span class="nx">getTime</span><span class="p">();</span>
+ <span class="p">},</span></pre></div> </td> </tr> <tr id="section-45"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-45">¶</a> </div> <p>The actual difference in timespans accounting for time oddities like
+different length months and leap years.</p> </td> <td class="code"> <div class="highlight"><pre> <span class="nx">span</span> <span class="o">:</span> <span class="kd">function</span><span class="p">(</span><span class="nx">ts</span><span class="p">){</span>
+ <span class="k">return</span> <span class="k">this</span><span class="p">.</span><span class="nx">ceil</span><span class="p">(</span><span class="nx">ts</span><span class="p">)</span> <span class="o">-</span> <span class="k">this</span><span class="p">.</span><span class="nx">floor</span><span class="p">(</span><span class="nx">ts</span><span class="p">);</span>
+ <span class="p">},</span></pre></div> </td> </tr> <tr id="section-46"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-46">¶</a> </div> <p>Calculate and return a list of human formatted strings and raw timestamps.</p> </td> <td class="code"> <div class="highlight"><pre> <span class="nx">getRan [...]
+ <span class="k">if</span> <span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">intervals</span><span class="p">)</span> <span class="k">return</span> <span class="k">this</span><span class="p">.</span><span class="nx">intervals</span><span class="p">;</span>
+ <span class="k">this</span><span class="p">.</span><span class="nx">intervals</span> <span class="o">=</span> <span class="p">[];</span>
+ <span class="k">for</span> <span class="p">(</span><span class="kd">var</span> <span class="nx">i</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">floor</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">min</span><span class="p">);</span> <span class="nx">i</span> <span class="o"><=</span> <span class="k">this</span><span class="p">.</span><span class="nx">ceil</span><span class="p [...]
+ <span class="k">this</span><span class="p">.</span><span class="nx">intervals</span><span class="p">.</span><span class="nx">push</span><span class="p">({</span>
+ <span class="nx">human</span> <span class="o">:</span> <span class="nx">Intervals</span><span class="p">.</span><span class="nx">dateStr</span><span class="p">(</span><span class="nx">i</span><span class="p">,</span> <span class="k">this</span><span class="p">.</span><span class="nx">maxInterval</span><span class="p">),</span>
+ <span class="nx">timestamp</span> <span class="o">:</span> <span class="nx">i</span>
+ <span class="p">});</span>
+ <span class="p">}</span>
+ <span class="k">return</span> <span class="k">this</span><span class="p">.</span><span class="nx">intervals</span><span class="p">;</span>
+ <span class="p">}</span>
+ <span class="p">};</span></pre></div> </td> </tr> <tr id="section-47"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-47">¶</a> </div> <p>Handy dandy function to bind a listener on multiple events. For example,
+<code>Bar</code> and <code>CardContainer</code> are bound like so on "move" and "zoom":</p>
+
+<pre><code> sync(this.bar, this.cardCont, "move", "zoom");
+</code></pre> </td> <td class="code"> <div class="highlight"><pre> <span class="kd">var</span> <span class="nx">sync</span> <span class="o">=</span> <span class="kd">function</span><span class="p">(</span><span class="nx">origin</span><span class="p">,</span> <span class="nx">listener</span><span class="p">){</span>
+ <span class="kd">var</span> <span class="nx">events</span> <span class="o">=</span> <span class="nb">Array</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">slice</span><span class="p">.</span><span class="nx">call</span><span class="p">(</span><span class="nx">arguments</span><span class="p">,</span> <span class="mi">2</span><span class="p">);</span>
+ <span class="nx">_</span><span class="p">.</span><span class="nx">each</span><span class="p">(</span><span class="nx">events</span><span class="p">,</span> <span class="kd">function</span><span class="p">(</span><span class="nx">ev</span><span class="p">){</span>
+ <span class="nx">origin</span><span class="p">.</span><span class="nx">bind</span><span class="p">(</span><span class="nx">ev</span><span class="p">,</span> <span class="kd">function</span><span class="p">(){</span> <span class="nx">listener</span><span class="p">[</span><span class="nx">ev</span><span class="p">].</span><span class="nx">apply</span><span class="p">(</span><span class="nx">listener</span><span class="p">,</span> <span class="nx">arguments</span><span class="p">);</ [...]
+ <span class="p">});</span>
+ <span class="p">};</span></pre></div> </td> </tr> <tr id="section-48"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-48">¶</a> </div> <p>Simple function to strip suffixes like <code>"px"</code> and return a clean integer for
+use.</p> </td> <td class="code"> <div class="highlight"><pre> <span class="kd">var</span> <span class="nx">cleanNumber</span> <span class="o">=</span> <span class="kd">function</span><span class="p">(</span><span class="nx">str</span><span class="p">){</span>
+ <span class="k">return</span> <span class="nb">parseInt</span><span class="p">(</span><span class="nx">str</span><span class="p">.</span><span class="nx">replace</span><span class="p">(</span><span class="sr">/^[^+\-\d]?([+\-]?\d+)?.*$/</span><span class="p">,</span> <span class="s2">"$1"</span><span class="p">),</span> <span class="mi">10</span><span class="p">);</span>
+ <span class="p">};</span></pre></div> </td> </tr> <tr id="section-49"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-49">¶</a> </div> <p>Zero pad a number less than 10 and return a 2 digit value.</p> </td> <td class="code"> <div class="highlight"><pre> <span class="kd">var</span> <span class="nx [...]
+ <span class="k">return</span> <span class="p">(</span><span class="nx">number</span> <span class="o"><</span> <span class="mi">10</span> <span class="o">?</span> <span class="s1">'0'</span> <span class="o">:</span> <span class="s1">''</span><span class="p">)</span> <span class="o">+</span> <span class="nx">number</span><span class="p">;</span>
+ <span class="p">};</span></pre></div> </td> </tr> <tr id="section-50"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-50">¶</a> </div> <p>A quick and dirty hash manager for setting and getting values from
+<code>window.location.hash</code></p> </td> <td class="code"> <div class="highlight"><pre> <span class="kd">var</span> <span class="nx">hashStrip</span> <span class="o">=</span> <span class="sr">/^#*/</span><span class="p">;</span>
+ <span class="kd">var</span> <span class="nx">history</span> <span class="o">=</span> <span class="p">{</span>
+ <span class="nx">get</span> <span class="o">:</span> <span class="kd">function</span><span class="p">(){</span>
+ <span class="k">return</span> <span class="nb">window</span><span class="p">.</span><span class="nx">location</span><span class="p">.</span><span class="nx">hash</span><span class="p">.</span><span class="nx">replace</span><span class="p">(</span><span class="nx">hashStrip</span><span class="p">,</span> <span class="s2">""</span><span class="p">);</span>
+ <span class="p">},</span>
+
+ <span class="nx">set</span> <span class="o">:</span> <span class="kd">function</span><span class="p">(</span><span class="nx">url</span><span class="p">){</span>
+ <span class="nb">window</span><span class="p">.</span><span class="nx">location</span><span class="p">.</span><span class="nx">hash</span> <span class="o">=</span> <span class="nx">url</span><span class="p">;</span>
+ <span class="p">}</span>
+ <span class="p">};</span></pre></div> </td> </tr> <tr id="section-51"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-51">¶</a> </div> <p>Every new <code>Series</code> gets new color. If there are too many series
+the remaining series will be a simple gray.</p> </td> <td class="code"> <div class="highlight"><pre></pre></div> </td> </tr> <tr id="section-52"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-52">¶</a> </div> <p>These colors can be styled like such in
+timeline-setter.css, where the numbers 1-9 cycle through in that order:</p>
+
+<pre><code> .TS-notch_color_1,.TS-series_legend_swatch_1 {
+ background: #065718 !important;
+ }
+ .TS-css_arrow_color_1 {
+ border-bottom-color:#065718 !important;
+ }
+ .TS-item_color_1 {
+ border-top:1px solid #065718 !important;
+ }
+</code></pre>
+
+<p>The default color will fall through to what is styled with
+<code>.TS-foo_color_default</code></p> </td> <td class="code"> <div class="highlight"><pre> <span class="kd">var</span> <span class="nx">curColor</span> <span class="o">=</span> <span class="mi">1</span><span class="p">;</span>
+ <span class="kd">var</span> <span class="nx">color</span> <span class="o">=</span> <span class="kd">function</span><span class="p">(){</span>
+ <span class="kd">var</span> <span class="nx">chosen</span><span class="p">;</span>
+ <span class="k">if</span> <span class="p">(</span><span class="nx">curColor</span> <span class="o"><</span> <span class="mi">10</span><span class="p">)</span> <span class="p">{</span>
+ <span class="nx">chosen</span> <span class="o">=</span> <span class="nx">curColor</span><span class="p">;</span>
+ <span class="nx">curColor</span> <span class="o">+=</span> <span class="mi">1</span><span class="p">;</span>
+ <span class="p">}</span> <span class="k">else</span> <span class="p">{</span>
+ <span class="nx">chosen</span> <span class="o">=</span> <span class="s2">"default"</span><span class="p">;</span>
+ <span class="p">}</span>
+ <span class="k">return</span> <span class="nx">chosen</span><span class="p">;</span>
+ <span class="p">};</span></pre></div> </td> </tr> <tr id="section-53"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-53">¶</a> </div> <h2>Models</h2> </td> <td class="code"> <div class="highlight"><pre></pre></div> </td> </tr> <tr id="section-54 [...]
+in the config object.</p> </td> <td class="code"> <div class="highlight"><pre> <span class="kd">var</span> <span class="nx">Timeline</span> <span class="o">=</span> <span class="nx">TimelineSetter</span><span class="p">.</span><span class="nx">Timeline</span> <span class="o">=</span> <span class="kd">function</span><span class="p">(</span><span class="nx">data</span><span class="p">,</span> <span class="nx">config</span><span class="p">)</span> <spa [...]
+ <span class="nx">_</span><span class="p">.</span><span class="nx">bindAll</span><span class="p">(</span><span class="k">this</span><span class="p">,</span> <span class="s1">'render'</span><span class="p">,</span> <span class="s1">'setCurrentTimeline'</span><span class="p">);</span>
+ <span class="k">this</span><span class="p">.</span><span class="nx">data</span> <span class="o">=</span> <span class="nx">data</span><span class="p">.</span><span class="nx">sort</span><span class="p">(</span><span class="kd">function</span><span class="p">(</span><span class="nx">a</span><span class="p">,</span> <span class="nx">b</span><span class="p">){</span> <span class="k">return</span> <span class="nx">a</span><span class="p">.</span><span class="nx">timestamp</span> <span cla [...]
+ <span class="k">this</span><span class="p">.</span><span class="nx">bySid</span> <span class="o">=</span> <span class="p">{};</span>
+ <span class="k">this</span><span class="p">.</span><span class="nx">cards</span> <span class="o">=</span> <span class="p">[];</span>
+ <span class="k">this</span><span class="p">.</span><span class="nx">series</span> <span class="o">=</span> <span class="p">[];</span>
+ <span class="k">this</span><span class="p">.</span><span class="nx">config</span> <span class="o">=</span> <span class="nx">config</span><span class="p">;</span>
+ <span class="k">this</span><span class="p">.</span><span class="nx">config</span><span class="p">.</span><span class="nx">container</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">config</span><span class="p">.</span><span class="nx">container</span> <span class="o">||</span> <span class="s2">"#timeline"</span><span class="p">;</span></pre></div> </td> </tr> <tr id="secti [...]
+by writing a <code>formatter</code> function that returns
+an object containing all the formats
+you'd like to override. Pass in <code>d</code>
+which is a date object, and <code>defaults</code>, which
+are the formatters we override.</p>
+
+<pre><code> formatter : function(d, defaults) {
+ defaults.months = ['enero', 'febrero', 'marzo',
+ 'abril', 'mayo', 'junio', 'julio',
+ 'agosto', 'septiembre', 'octubre',
+ 'noviembre', 'diciembre'];
+ return defaults;
+ }
+</code></pre> </td> <td class="code"> <div class="highlight"><pre> <span class="nx">Intervals</span><span class="p">.</span><span class="nx">formatter</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">config</span><span class="p">.</span><span class="nx">formatter</span> <span class="o">||</span> <span class="kd">function</span><span class="p">(</span><span class="nx">d</span><span class="p">,</spa [...]
+ <span class="p">};</span>
+ <span class="nx">observable</span><span class="p">(</span><span class="nx">Timeline</span><span class="p">.</span><span class="nx">prototype</span><span class="p">);</span>
+
+ <span class="nx">Timeline</span><span class="p">.</span><span class="nx">prototype</span> <span class="o">=</span> <span class="nx">_</span><span class="p">.</span><span class="nx">extend</span><span class="p">(</span><span class="nx">Timeline</span><span class="p">.</span><span class="nx">prototype</span><span class="p">,</span> <span class="p">{</span></pre></div> </td> </tr> <tr id="section-56"> <td class="docs"> [...]
+takes a JSON array of card representations and then builds series, calculates
+intervals <code>sync</code>s the <code>Bar</code> and <code>CardContainer</code> objects.</p> </td> <td class="code"> <div class="highlight"><pre> <span class="nx">render</span> <span class="o">:</span> <span class="kd">function</span><span class="p">()</span> <span class="p">{</span>
+ <span class="kd">var</span> <span class="nx">that</span> <span class="o">=</span> <span class="k">this</span><span class="p">;</span></pre></div> </td> </tr> <tr id="section-57"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-57">¶</a> </div> <p>create <code>this.$</code> from queryable mixin.</p> </td> <td [...]
+so we can play with it.</p> </td> <td class="code"> <div class="highlight"><pre> <span class="nx">$</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">config</span><span class="p">.</span><span class="nx">container</span><span class="p">).</span><span class="nx">html</span><span class="p">(</span><span class="nx">JST</span><span class="p">.</span><span class="nx">timeline</span><span class="p">());</span>
+
+ <span class="k">this</span><span class="p">.</span><span class="nx">bounds</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">Bounds</span><span class="p">();</span>
+ <span class="k">this</span><span class="p">.</span><span class="nx">bar</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">Bar</span><span class="p">(</span><span class="k">this</span><span class="p">);</span>
+ <span class="k">this</span><span class="p">.</span><span class="nx">cardCont</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">CardScroller</span><span class="p">(</span><span class="k">this</span><span class="p">);</span>
+ <span class="k">this</span><span class="p">.</span><span class="nx">createSeries</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">data</span><span class="p">);</span>
+ <span class="kd">var</span> <span class="nx">range</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">Intervals</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">bounds</span><span class="p">,</span> <span class="k">this</span><span class="p">.</span><span class="nx">config</span><span class="p">.</span><span class="nx">interval</span><span class="p">);</span>
+ <span class="k">this</span><span class="p">.</span><span class="nx">intervals</span> <span class="o">=</span> <span class="nx">range</span><span class="p">.</span><span class="nx">getRanges</span><span class="p">();</span>
+ <span class="k">this</span><span class="p">.</span><span class="nx">bounds</span><span class="p">.</span><span class="nx">extend</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">bounds</span><span class="p">.</span><span class="nx">min</span> <span class="o">-</span> <span class="nx">range</span><span class="p">.</span><span class="nx">getMaxInterval</span><span class="p">()</span> <span class="o">/</span> <span class="mi">2</span><s [...]
+ <span class="k">this</span><span class="p">.</span><span class="nx">bounds</span><span class="p">.</span><span class="nx">extend</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">bounds</span><span class="p">.</span><span class="nx">max</span> <span class="o">+</span> <span class="nx">range</span><span class="p">.</span><span class="nx">getMaxInterval</span><span class="p">()</span> <span class="o">/</span> <span class="mi">2</span><s [...]
+ <span class="k">this</span><span class="p">.</span><span class="nx">bar</span><span class="p">.</span><span class="nx">render</span><span class="p">();</span>
+ <span class="nx">sync</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">bar</span><span class="p">,</span> <span class="k">this</span><span class="p">.</span><span class="nx">cardCont</span><span class="p">,</span> <span class="s2">"move"</span><span class="p">,</span> <span class="s2">"zoom"</span><span class="p">);</span>
+ <span class="k">this</span><span class="p">.</span><span class="nx">trigger</span><span class="p">(</span><span class="s1">'render'</span><span class="p">);</span>
+
+ <span class="k">new</span> <span class="nx">Zoom</span><span class="p">(</span><span class="s2">"in"</span><span class="p">,</span> <span class="k">this</span><span class="p">);</span>
+ <span class="k">new</span> <span class="nx">Zoom</span><span class="p">(</span><span class="s2">"out"</span><span class="p">,</span> <span class="k">this</span><span class="p">);</span>
+ <span class="k">this</span><span class="p">.</span><span class="nx">chooseNext</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">Chooser</span><span class="p">(</span><span class="s2">"next"</span><span class="p">,</span> <span class="k">this</span><span class="p">);</span>
+ <span class="k">this</span><span class="p">.</span><span class="nx">choosePrev</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">Chooser</span><span class="p">(</span><span class="s2">"prev"</span><span class="p">,</span> <span class="k">this</span><span class="p">);</span>
+ <span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="k">this</span><span class="p">.</span><span class="nx">$</span><span class="p">(</span><span class="s2">".TS-card_active"</span><span class="p">).</span><span class="nx">is</span><span class="p">(</span><span class="s2">"*"</span><span class="p">))</span> <span class="k">this</span><span class="p">.</span><span class="nx">chooseNext</span><span class="p">.</span><span class="n [...]
+that sets it as as the global current timeline
+for key presses.</p> </td> <td class="code"> <div class="highlight"><pre> <span class="nx">$</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">config</span><span class="p">.</span><span class="nx">container</span><span class="p">).</span><span class="nx">bind</span><span class="p">(</span><span class="s1">'click'</span><span class="p">,</span> <span class="k">this</span><span class="p">.</s [...]
+
+ <span class="k">this</span><span class="p">.</span><span class="nx">trigger</span><span class="p">(</span><span class="s1">'load'</span><span class="p">);</span>
+ <span class="p">},</span></pre></div> </td> </tr> <tr id="section-60"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-60">¶</a> </div> <p>Set a global with the current timeline, mostly for key presses.</p> </td> <td class="code"> <div class="highlight"><pre> <span class="nx">setCurrentTimelin [...]
+ <span class="nx">TimelineSetter</span><span class="p">.</span><span class="nx">currentTimeline</span> <span class="o">=</span> <span class="k">this</span><span class="p">;</span>
+ <span class="p">},</span></pre></div> </td> </tr> <tr id="section-61"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-61">¶</a> </div> <p>Loop through the JSON and add each element to a series.</p> </td> <td class="code"> <div class="highlight"><pre> <span class="nx">createSeries</span> <span [...]
+ <span class="k">for</span><span class="p">(</span><span class="kd">var</span> <span class="nx">i</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span> <span class="nx">i</span> <span class="o"><</span> <span class="nx">series</span><span class="p">.</span><span class="nx">length</span><span class="p">;</span> <span class="nx">i</span><span class="o">++</span><span class="p">)</span>
+ <span class="k">this</span><span class="p">.</span><span class="nx">add</span><span class="p">(</span><span class="nx">series</span><span class="p">[</span><span class="nx">i</span><span class="p">]);</span>
+ <span class="p">},</span></pre></div> </td> </tr> <tr id="section-62"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-62">¶</a> </div> <p>If a particular element in the JSON array mentions a series that's not
+in the <code>bySid</code> object add it. Then add a card to the <code>Series</code> and extend
+the global <code>bounds</code>.</p> </td> <td class="code"> <div class="highlight"><pre> <span class="nx">add</span> <span class="o">:</span> <span class="kd">function</span><span class="p">(</span><span class="nx">card</span><span class="p">){</span>
+ <span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="p">(</span><span class="nx">card</span><span class="p">.</span><span class="nx">series</span> <span class="k">in</span> <span class="k">this</span><span class="p">.</span><span class="nx">bySid</span><span class="p">)){</span>
+ <span class="k">this</span><span class="p">.</span><span class="nx">bySid</span><span class="p">[</span><span class="nx">card</span><span class="p">.</span><span class="nx">series</span><span class="p">]</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">Series</span><span class="p">(</span><span class="nx">card</span><span class="p">,</span> <span class="k">this</span><span class="p">);</span>
+ <span class="k">this</span><span class="p">.</span><span class="nx">series</span><span class="p">.</span><span class="nx">push</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">bySid</span><span class="p">[</span><span class="nx">card</span><span class="p">.</span><span class="nx">series</span><span class="p">]);</span>
+ <span class="p">}</span>
+ <span class="kd">var</span> <span class="nx">series</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">bySid</span><span class="p">[</span><span class="nx">card</span><span class="p">.</span><span class="nx">series</span><span class="p">];</span>
+ <span class="kd">var</span> <span class="nx">crd</span> <span class="o">=</span> <span class="nx">series</span><span class="p">.</span><span class="nx">add</span><span class="p">(</span><span class="nx">card</span><span class="p">);</span>
+
+ <span class="k">this</span><span class="p">.</span><span class="nx">bounds</span><span class="p">.</span><span class="nx">extend</span><span class="p">(</span><span class="nx">series</span><span class="p">.</span><span class="nx">max</span><span class="p">());</span>
+ <span class="k">this</span><span class="p">.</span><span class="nx">bounds</span><span class="p">.</span><span class="nx">extend</span><span class="p">(</span><span class="nx">series</span><span class="p">.</span><span class="nx">min</span><span class="p">());</span>
+
+ <span class="k">this</span><span class="p">.</span><span class="nx">trigger</span><span class="p">(</span><span class="s1">'cardAdd'</span><span class="p">,</span> <span class="nx">card</span><span class="p">,</span> <span class="nx">crd</span><span class="p">);</span>
+ <span class="p">}</span>
+ <span class="p">});</span></pre></div> </td> </tr> <tr id="section-63"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-63">¶</a> </div> <h2>Views</h2> </td> <td class="code"> <div class="highlight"><pre></pre></div> </td> </tr> <tr id="section-64 [...]
+scenes <code>Bar</code> handles the moving and zooming behaviours through the <code>draggable</code>
+and <code>wheel</code> plugins.</p> </td> <td class="code"> <div class="highlight"><pre> <span class="kd">var</span> <span class="nx">Bar</span> <span class="o">=</span> <span class="kd">function</span><span class="p">(</span><span class="nx">timeline</span><span class="p">)</span> <span class="p">{</span>
+ <span class="kd">var</span> <span class="nx">that</span> <span class="o">=</span> <span class="k">this</span><span class="p">;</span>
+ <span class="k">this</span><span class="p">.</span><span class="nx">timeline</span> <span class="o">=</span> <span class="nx">timeline</span><span class="p">;</span>
+
+ <span class="k">this</span><span class="p">.</span><span class="nx">el</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">timeline</span><span class="p">.</span><span class="nx">$</span><span class="p">(</span><span class="s2">".TS-notchbar"</span><span class="p">);</span>
+ <span class="k">this</span><span class="p">.</span><span class="nx">el</span><span class="p">.</span><span class="nx">css</span><span class="p">({</span> <span class="s2">"left"</span><span class="o">:</span> <span class="mi">0</span> <span class="p">});</span>
+ <span class="nx">draggable</span><span class="p">(</span><span class="k">this</span><span class="p">);</span>
+ <span class="nx">wheel</span><span class="p">(</span><span class="k">this</span><span class="p">);</span>
+ <span class="nx">_</span><span class="p">.</span><span class="nx">bindAll</span><span class="p">(</span><span class="k">this</span><span class="p">,</span> <span class="s2">"moving"</span><span class="p">,</span> <span class="s2">"doZoom"</span><span class="p">);</span>
+ <span class="k">this</span><span class="p">.</span><span class="nx">el</span><span class="p">.</span><span class="nx">bind</span><span class="p">(</span><span class="s2">"dragging scrolled"</span><span class="p">,</span> <span class="k">this</span><span class="p">.</span><span class="nx">moving</span><span class="p">);</span>
+ <span class="k">this</span><span class="p">.</span><span class="nx">el</span><span class="p">.</span><span class="nx">bind</span><span class="p">(</span><span class="s2">"doZoom"</span><span class="p">,</span> <span class="k">this</span><span class="p">.</span><span class="nx">doZoom</span><span class="p">);</span>
+ <span class="k">this</span><span class="p">.</span><span class="nx">el</span><span class="p">.</span><span class="nx">bind</span><span class="p">(</span><span class="s2">"dblclick doubletap"</span><span class="p">,</span> <span class="kd">function</span><span class="p">(</span><span class="nx">e</span><span class="p">){</span>
+ <span class="nx">e</span><span class="p">.</span><span class="nx">preventDefault</span><span class="p">();</span>
+ <span class="nx">that</span><span class="p">.</span><span class="nx">timeline</span><span class="p">.</span><span class="nx">$</span><span class="p">(</span><span class="s2">".TS-zoom_in"</span><span class="p">).</span><span class="nx">click</span><span class="p">();</span>
+ <span class="p">});</span>
+ <span class="p">};</span>
+ <span class="nx">observable</span><span class="p">(</span><span class="nx">Bar</span><span class="p">.</span><span class="nx">prototype</span><span class="p">);</span>
+ <span class="nx">transformable</span><span class="p">(</span><span class="nx">Bar</span><span class="p">.</span><span class="nx">prototype</span><span class="p">);</span>
+
+ <span class="nx">Bar</span><span class="p">.</span><span class="nx">prototype</span> <span class="o">=</span> <span class="nx">_</span><span class="p">.</span><span class="nx">extend</span><span class="p">(</span><span class="nx">Bar</span><span class="p">.</span><span class="nx">prototype</span><span class="p">,</span> <span class="p">{</span></pre></div> </td> </tr> <tr id="section-65"> <td class="docs"> <d [...]
+will move the <code>.TS-notchbar</code> off of its parent. If so, it recaculates
+<code>deltaX</code> to be a more correct value.</p> </td> <td class="code"> <div class="highlight"><pre> <span class="nx">moving</span> <span class="o">:</span> <span class="kd">function</span><span class="p">(</span><span class="nx">e</span><span class="p">){</span>
+ <span class="kd">var</span> <span class="nx">parent</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">el</span><span class="p">.</span><span class="nx">parent</span><span class="p">();</span>
+ <span class="kd">var</span> <span class="nx">pOffset</span> <span class="o">=</span> <span class="nx">parent</span><span class="p">.</span><span class="nx">offset</span><span class="p">().</span><span class="nx">left</span><span class="p">;</span>
+ <span class="kd">var</span> <span class="nx">offset</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">el</span><span class="p">.</span><span class="nx">offset</span><span class="p">().</span><span class="nx">left</span><span class="p">;</span>
+ <span class="kd">var</span> <span class="nx">width</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">el</span><span class="p">.</span><span class="nx">width</span><span class="p">();</span>
+ <span class="k">if</span> <span class="p">(</span><span class="nx">_</span><span class="p">.</span><span class="nx">isUndefined</span><span class="p">(</span><span class="nx">e</span><span class="p">.</span><span class="nx">deltaX</span><span class="p">))</span> <span class="nx">e</span><span class="p">.</span><span class="nx">deltaX</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span>
+
+ <span class="k">if</span> <span class="p">(</span><span class="nx">offset</span> <span class="o">+</span> <span class="nx">width</span> <span class="o">+</span> <span class="nx">e</span><span class="p">.</span><span class="nx">deltaX</span> <span class="o"><</span> <span class="nx">pOffset</span> <span class="o">+</span> <span class="nx">parent</span><span class="p">.</span><span class="nx">width</span><span class="p">())</span>
+ <span class="nx">e</span><span class="p">.</span><span class="nx">deltaX</span> <span class="o">=</span> <span class="p">(</span><span class="nx">pOffset</span> <span class="o">+</span> <span class="nx">parent</span><span class="p">.</span><span class="nx">width</span><span class="p">())</span> <span class="o">-</span> <span class="p">(</span><span class="nx">offset</span> <span class="o">+</span> <span class="nx">width</span><span class="p">);</span>
+ <span class="k">if</span> <span class="p">(</span><span class="nx">offset</span> <span class="o">+</span> <span class="nx">e</span><span class="p">.</span><span class="nx">deltaX</span> <span class="o">></span> <span class="nx">pOffset</span><span class="p">)</span>
+ <span class="nx">e</span><span class="p">.</span><span class="nx">deltaX</span> <span class="o">=</span> <span class="nx">pOffset</span> <span class="o">-</span> <span class="nx">offset</span><span class="p">;</span>
+
+ <span class="k">this</span><span class="p">.</span><span class="nx">trigger</span><span class="p">(</span><span class="s2">"move"</span><span class="p">,</span> <span class="nx">e</span><span class="p">);</span>
+ <span class="k">this</span><span class="p">.</span><span class="nx">timeline</span><span class="p">.</span><span class="nx">trigger</span><span class="p">(</span><span class="s2">"move"</span><span class="p">,</span> <span class="nx">e</span><span class="p">);</span> <span class="c1">// for API</span>
+ <span class="k">this</span><span class="p">.</span><span class="nx">move</span><span class="p">(</span><span class="s2">"move"</span><span class="p">,</span> <span class="nx">e</span><span class="p">);</span>
+ <span class="p">},</span></pre></div> </td> </tr> <tr id="section-66"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-66">¶</a> </div> <p>As the timeline zooms, the <code>Bar</code> tries to keep the current notch (i.e.
+<code>.TS-notch_active</code>) as close to its original position as possible.
+There's a slight bug here because the timeline zooms and then moves the
+bar to correct for this behaviour, and in future versions we'll fix this.</p> </td> <td class="code"> <div class="highlight"><pre> <span class="nx">doZoom</span> <span class="o">:</span> <span class="kd">function</span><span class="p">(</span><span class="nx">e</span><span class="p">,</span> <span class="nx">width</span><span class="p">){</span>
+ <span class="kd">var</span> <span class="nx">that</span> <span class="o">=</span> <span class="k">this</span><span class="p">;</span>
+ <span class="kd">var</span> <span class="nx">notch</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">timeline</span><span class="p">.</span><span class="nx">$</span><span class="p">(</span><span class="s2">".TS-notch_active"</span><span class="p">);</span>
+ <span class="kd">var</span> <span class="nx">getCur</span> <span class="o">=</span> <span class="kd">function</span><span class="p">()</span> <span class="p">{</span>
+ <span class="k">return</span> <span class="nx">notch</span><span class="p">.</span><span class="nx">length</span> <span class="o">></span> <span class="mi">0</span> <span class="o">?</span> <span class="nx">notch</span><span class="p">.</span><span class="nx">position</span><span class="p">().</span><span class="nx">left</span> <span class="o">:</span> <span class="mi">0</span><span class="p">;</span>
+ <span class="p">};</span>
+ <span class="kd">var</span> <span class="nx">curr</span> <span class="o">=</span> <span class="nx">getCur</span><span class="p">();</span>
+
+ <span class="k">this</span><span class="p">.</span><span class="nx">el</span><span class="p">.</span><span class="nx">animate</span><span class="p">({</span><span class="s2">"width"</span><span class="o">:</span> <span class="nx">width</span> <span class="o">+</span> <span class="s2">"%"</span><span class="p">},</span> <span class="p">{</span>
+ <span class="nx">step</span><span class="o">:</span> <span class="kd">function</span><span class="p">(</span><span class="nx">current</span><span class="p">,</span> <span class="nx">fx</span><span class="p">)</span> <span class="p">{</span>
+ <span class="kd">var</span> <span class="nx">e</span> <span class="o">=</span> <span class="nx">$</span><span class="p">.</span><span class="nx">Event</span><span class="p">(</span><span class="s2">"dragging"</span><span class="p">);</span>
+ <span class="kd">var</span> <span class="nx">delta</span> <span class="o">=</span> <span class="nx">curr</span> <span class="o">-</span> <span class="nx">getCur</span><span class="p">();</span>
+ <span class="nx">e</span><span class="p">.</span><span class="nx">deltaX</span> <span class="o">=</span> <span class="nx">delta</span><span class="p">;</span>
+ <span class="nx">that</span><span class="p">.</span><span class="nx">moving</span><span class="p">(</span><span class="nx">e</span><span class="p">);</span>
+ <span class="nx">curr</span> <span class="o">=</span> <span class="nx">getCur</span><span class="p">();</span>
+ <span class="nx">e</span> <span class="o">=</span> <span class="nx">$</span><span class="p">.</span><span class="nx">Event</span><span class="p">(</span><span class="s2">"zoom"</span><span class="p">);</span>
+ <span class="nx">e</span><span class="p">.</span><span class="nx">width</span> <span class="o">=</span> <span class="nx">current</span> <span class="o">+</span> <span class="s2">"%"</span><span class="p">;</span>
+ <span class="nx">that</span><span class="p">.</span><span class="nx">trigger</span><span class="p">(</span><span class="s2">"zoom"</span><span class="p">,</span> <span class="nx">e</span><span class="p">);</span>
+ <span class="p">}</span>
+ <span class="p">});</span>
+ <span class="p">},</span></pre></div> </td> </tr> <tr id="section-67"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-67">¶</a> </div> <p>When asked to render the bar places the appropriate timestamp notches
+inside <code>.TS-notchbar</code>.</p> </td> <td class="code"> <div class="highlight"><pre> <span class="nx">render</span> <span class="o">:</span> <span class="kd">function</span><span class="p">(){</span>
+ <span class="kd">var</span> <span class="nx">intervals</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">timeline</span><span class="p">.</span><span class="nx">intervals</span><span class="p">;</span>
+ <span class="kd">var</span> <span class="nx">bounds</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">timeline</span><span class="p">.</span><span class="nx">bounds</span><span class="p">;</span>
+
+ <span class="k">for</span> <span class="p">(</span><span class="kd">var</span> <span class="nx">i</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span> <span class="nx">i</span> <span class="o"><</span> <span class="nx">intervals</span><span class="p">.</span><span class="nx">length</span><span class="p">;</span> <span class="nx">i</span><span class="o">++</span><span class="p">)</span> <span class="p">{</span>
+ <span class="kd">var</span> <span class="nx">html</span> <span class="o">=</span> <span class="nx">JST</span><span class="p">.</span><span class="nx">year_notch</span><span class="p">({</span><span class="s1">'timestamp'</span> <span class="o">:</span> <span class="nx">intervals</span><span class="p">[</span><span class="nx">i</span><span class="p">].</span><span class="nx">timestamp</span><span class="p">,</span> <span class="s1">'human'</span> <span class="o">:< [...]
+ <span class="k">this</span><span class="p">.</span><span class="nx">el</span><span class="p">.</span><span class="nx">append</span><span class="p">(</span><span class="nx">$</span><span class="p">(</span><span class="nx">html</span><span class="p">).</span><span class="nx">css</span><span class="p">(</span><span class="s2">"left"</span><span class="p">,</span> <span class="nx">bounds</span><span class="p">.</span><span class="nx">project</span><span class="p">(</span><s [...]
+ <span class="p">}</span>
+ <span class="p">}</span>
+ <span class="p">});</span></pre></div> </td> </tr> <tr id="section-68"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-68">¶</a> </div> <p>The <code>CardScroller</code> mirrors the moving and zooming of the <code>Bar</code> and is the
+canvas where individual cards are rendered.</p> </td> <td class="code"> <div class="highlight"><pre> <span class="kd">var</span> <span class="nx">CardScroller</span> <span class="o">=</span> <span class="kd">function</span><span class="p">(</span><span class="nx">timeline</span><span class="p">){</span>
+ <span class="k">this</span><span class="p">.</span><span class="nx">el</span> <span class="o">=</span> <span class="nx">timeline</span><span class="p">.</span><span class="nx">$</span><span class="p">(</span><span class="s2">".TS-card_scroller_inner"</span><span class="p">);</span>
+ <span class="p">};</span>
+ <span class="nx">observable</span><span class="p">(</span><span class="nx">CardScroller</span><span class="p">.</span><span class="nx">prototype</span><span class="p">);</span>
+ <span class="nx">transformable</span><span class="p">(</span><span class="nx">CardScroller</span><span class="p">.</span><span class="nx">prototype</span><span class="p">);</span></pre></div> </td> </tr> <tr id="section-69"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-69">¶</a> </div> <p>Each <code>Series</code> picks a unique colo [...]
+ <span class="k">this</span><span class="p">.</span><span class="nx">timeline</span> <span class="o">=</span> <span class="nx">timeline</span><span class="p">;</span>
+ <span class="k">this</span><span class="p">.</span><span class="nx">name</span> <span class="o">=</span> <span class="nx">series</span><span class="p">.</span><span class="nx">series</span><span class="p">;</span>
+ <span class="k">this</span><span class="p">.</span><span class="nx">color</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">name</span><span class="p">.</span><span class="nx">length</span> <span class="o">></span> <span class="mi">0</span> <span class="o">?</span> <span class="nx">color</span><span class="p">()</span> <span class="o">:</span> <span class="s2">"default"</span><span class="p">;</span>
+ <span class="k">this</span><span class="p">.</span><span class="nx">cards</span> <span class="o">=</span> <span class="p">[];</span>
+ <span class="nx">_</span><span class="p">.</span><span class="nx">bindAll</span><span class="p">(</span><span class="k">this</span><span class="p">,</span> <span class="s2">"render"</span><span class="p">,</span> <span class="s2">"showNotches"</span><span class="p">,</span> <span class="s2">"hideNotches"</span><span class="p">);</span>
+ <span class="k">this</span><span class="p">.</span><span class="nx">timeline</span><span class="p">.</span><span class="nx">bind</span><span class="p">(</span><span class="s2">"render"</span><span class="p">,</span> <span class="k">this</span><span class="p">.</span><span class="nx">render</span><span class="p">);</span>
+ <span class="p">};</span>
+ <span class="nx">observable</span><span class="p">(</span><span class="nx">Series</span><span class="p">.</span><span class="nx">prototype</span><span class="p">);</span>
+
+ <span class="nx">Series</span><span class="p">.</span><span class="nx">prototype</span> <span class="o">=</span> <span class="nx">_</span><span class="p">.</span><span class="nx">extend</span><span class="p">(</span><span class="nx">Series</span><span class="p">.</span><span class="nx">prototype</span><span class="p">,</span> <span class="p">{</span></pre></div> </td> </tr> <tr id="section-70"> <td class="docs"> [...]
+ <span class="kd">var</span> <span class="nx">crd</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">Card</span><span class="p">(</span><span class="nx">card</span><span class="p">,</span> <span class="k">this</span><span class="p">);</span>
+ <span class="k">this</span><span class="p">.</span><span class="nx">cards</span><span class="p">.</span><span class="nx">push</span><span class="p">(</span><span class="nx">crd</span><span class="p">);</span>
+ <span class="k">return</span> <span class="nx">crd</span><span class="p">;</span>
+ <span class="p">},</span></pre></div> </td> </tr> <tr id="section-71"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-71">¶</a> </div> <p>The comparing function for <code>max</code> and <code>min</code>.</p> </td> <td class="code"> <div class="highlight"><pre> <span class="nx">_comparator</sp [...]
+ <span class="k">return</span> <span class="nx">crd</span><span class="p">.</span><span class="nx">timestamp</span><span class="p">;</span>
+ <span class="p">},</span></pre></div> </td> </tr> <tr id="section-72"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-72">¶</a> </div> <p>Inactivate this series legend item and trigger a <code>hideNotch</code> event.</p> </td> <td class="code"> <div class="highlight"><pre> <span class="nx">hi [...]
+ <span class="nx">e</span><span class="p">.</span><span class="nx">preventDefault</span><span class="p">();</span>
+ <span class="k">this</span><span class="p">.</span><span class="nx">el</span><span class="p">.</span><span class="nx">addClass</span><span class="p">(</span><span class="s2">"TS-series_legend_item_inactive"</span><span class="p">);</span>
+ <span class="k">this</span><span class="p">.</span><span class="nx">trigger</span><span class="p">(</span><span class="s2">"hideNotch"</span><span class="p">);</span>
+ <span class="p">},</span></pre></div> </td> </tr> <tr id="section-73"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-73">¶</a> </div> <p>Activate the legend item and trigger the <code>showNotch</code> event.</p> </td> <td class="code"> <div class="highlight"><pre> <span class="nx">showNotche [...]
+ <span class="nx">e</span><span class="p">.</span><span class="nx">preventDefault</span><span class="p">();</span>
+ <span class="k">this</span><span class="p">.</span><span class="nx">el</span><span class="p">.</span><span class="nx">removeClass</span><span class="p">(</span><span class="s2">"TS-series_legend_item_inactive"</span><span class="p">);</span>
+ <span class="k">this</span><span class="p">.</span><span class="nx">trigger</span><span class="p">(</span><span class="s2">"showNotch"</span><span class="p">);</span>
+ <span class="p">},</span></pre></div> </td> </tr> <tr id="section-74"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-74">¶</a> </div> <p>Create and append the label to <code>.TS-series_nav_container</code> and bind up
+<code>hideNotches</code> and <code>showNotches</code>.</p> </td> <td class="code"> <div class="highlight"><pre> <span class="nx">render</span> <span class="o">:</span> <span class="kd">function</span><span class="p">(</span><span class="nx">e</span><span class="p">){</span>
+ <span class="k">if</span> <span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">name</span><span class="p">.</span><span class="nx">length</span> <span class="o">===</span> <span class="mi">0</span><span class="p">)</span> <span class="k">return</span><span class="p">;</span>
+ <span class="k">this</span><span class="p">.</span><span class="nx">el</span> <span class="o">=</span> <span class="nx">$</span><span class="p">(</span><span class="nx">JST</span><span class="p">.</span><span class="nx">series_legend</span><span class="p">(</span><span class="k">this</span><span class="p">));</span>
+ <span class="k">this</span><span class="p">.</span><span class="nx">timeline</span><span class="p">.</span><span class="nx">$</span><span class="p">(</span><span class="s2">".TS-series_nav_container"</span><span class="p">).</span><span class="nx">append</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">el</span><span class="p">);</span>
+ <span class="k">this</span><span class="p">.</span><span class="nx">el</span><span class="p">.</span><span class="nx">toggle</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">hideNotches</span><span class="p">,</span> <span class="k">this</span><span class="p">.</span><span class="nx">showNotches</span><span class="p">);</span>
+ <span class="p">}</span>
+ <span class="p">});</span></pre></div> </td> </tr> <tr id="section-75"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-75">¶</a> </div> <p>Proxy to underscore for <code>min</code> and <code>max</code>.</p> </td> <td class="code"> <div class="highlight"><pre> <span class="nx">_</span><span class=" [...]
+ <span class="nx">Series</span><span class="p">.</span><span class="nx">prototype</span><span class="p">[</span><span class="nx">key</span><span class="p">]</span> <span class="o">=</span> <span class="kd">function</span><span class="p">()</span> <span class="p">{</span>
+ <span class="k">return</span> <span class="nx">_</span><span class="p">[</span><span class="nx">key</span><span class="p">].</span><span class="nx">call</span><span class="p">(</span><span class="nx">_</span><span class="p">,</span> <span class="k">this</span><span class="p">.</span><span class="nx">cards</span><span class="p">,</span> <span class="k">this</span><span class="p">.</span><span class="nx">_comparator</span><span class="p">).</span><span class="nx">get</span><span clas [...]
+ <span class="p">};</span>
+ <span class="p">});</span></pre></div> </td> </tr> <tr id="section-76"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-76">¶</a> </div> <p>Every <code>Card</code> handles a notch div which is immediately appended to the <code>Bar</code>
+and a <code>.TS-card_container</code> which is lazily rendered.</p> </td> <td class="code"> <div class="highlight"><pre> <span class="kd">var</span> <span class="nx">Card</span> <span class="o">=</span> <span class="kd">function</span><span class="p">(</span><span class="nx">card</span><span class="p">,</span> <span class="nx">series</span><span class="p">)</span> <span class="p">{</span>
+ <span class="k">this</span><span class="p">.</span><span class="nx">series</span> <span class="o">=</span> <span class="nx">series</span><span class="p">;</span>
+ <span class="k">this</span><span class="p">.</span><span class="nx">timeline</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">series</span><span class="p">.</span><span class="nx">timeline</span><span class="p">;</span>
+ <span class="nx">card</span> <span class="o">=</span> <span class="nx">_</span><span class="p">.</span><span class="nx">clone</span><span class="p">(</span><span class="nx">card</span><span class="p">);</span>
+ <span class="k">this</span><span class="p">.</span><span class="nx">timestamp</span> <span class="o">=</span> <span class="nx">card</span><span class="p">.</span><span class="nx">timestamp</span><span class="p">;</span>
+ <span class="k">this</span><span class="p">.</span><span class="nx">attributes</span> <span class="o">=</span> <span class="nx">card</span><span class="p">;</span>
+ <span class="k">this</span><span class="p">.</span><span class="nx">attributes</span><span class="p">.</span><span class="nx">topcolor</span> <span class="o">=</span> <span class="nx">series</span><span class="p">.</span><span class="nx">color</span><span class="p">;</span>
+ <span class="nx">_</span><span class="p">.</span><span class="nx">bindAll</span><span class="p">(</span><span class="k">this</span><span class="p">,</span> <span class="s2">"render"</span><span class="p">,</span> <span class="s2">"activate"</span><span class="p">,</span> <span class="s2">"flip"</span><span class="p">,</span> <span class="s2">"setPermalink"</span><span class="p">,</span> <span class="s2">"toggleNotch"</span><span class [...]
+ <span class="k">this</span><span class="p">.</span><span class="nx">series</span><span class="p">.</span><span class="nx">bind</span><span class="p">(</span><span class="s2">"hideNotch"</span><span class="p">,</span> <span class="k">this</span><span class="p">.</span><span class="nx">toggleNotch</span><span class="p">);</span>
+ <span class="k">this</span><span class="p">.</span><span class="nx">series</span><span class="p">.</span><span class="nx">bind</span><span class="p">(</span><span class="s2">"showNotch"</span><span class="p">,</span> <span class="k">this</span><span class="p">.</span><span class="nx">toggleNotch</span><span class="p">);</span>
+ <span class="k">this</span><span class="p">.</span><span class="nx">timeline</span><span class="p">.</span><span class="nx">bind</span><span class="p">(</span><span class="s2">"render"</span><span class="p">,</span> <span class="k">this</span><span class="p">.</span><span class="nx">render</span><span class="p">);</span>
+ <span class="k">this</span><span class="p">.</span><span class="nx">timeline</span><span class="p">.</span><span class="nx">bar</span><span class="p">.</span><span class="nx">bind</span><span class="p">(</span><span class="s2">"move"</span><span class="p">,</span> <span class="k">this</span><span class="p">.</span><span class="nx">flip</span><span class="p">);</span>
+ <span class="k">this</span><span class="p">.</span><span class="nx">id</span> <span class="o">=</span> <span class="p">[</span>
+ <span class="k">this</span><span class="p">.</span><span class="nx">get</span><span class="p">(</span><span class="s1">'timestamp'</span><span class="p">),</span>
+ <span class="k">this</span><span class="p">.</span><span class="nx">get</span><span class="p">(</span><span class="s1">'description'</span><span class="p">).</span><span class="nx">split</span><span class="p">(</span><span class="sr">/ /</span><span class="p">)[</span><span class="mi">0</span><span class="p">].</span><span class="nx">replace</span><span class="p">(</span><span class="sr">/[^a-zA-Z\-]/g</span><span class="p">,</span><span class="s2">""</span><span [...]
+ <span class="p">].</span><span class="nx">join</span><span class="p">(</span><span class="s2">"-"</span><span class="p">);</span>
+ <span class="k">this</span><span class="p">.</span><span class="nx">timeline</span><span class="p">.</span><span class="nx">cards</span><span class="p">.</span><span class="nx">push</span><span class="p">(</span><span class="k">this</span><span class="p">);</span>
+ <span class="k">this</span><span class="p">.</span><span class="nx">template</span> <span class="o">=</span> <span class="nb">window</span><span class="p">.</span><span class="nx">JST</span><span class="p">.</span><span class="nx">card</span><span class="p">;</span>
+ <span class="p">};</span>
+
+ <span class="nx">Card</span><span class="p">.</span><span class="nx">prototype</span> <span class="o">=</span> <span class="nx">_</span><span class="p">.</span><span class="nx">extend</span><span class="p">(</span><span class="nx">Card</span><span class="p">.</span><span class="nx">prototype</span><span class="p">,</span> <span class="p">{</span></pre></div> </td> </tr> <tr id="section-77"> <td class="docs"> [...]
+ <span class="k">return</span> <span class="k">this</span><span class="p">.</span><span class="nx">attributes</span><span class="p">[</span><span class="nx">key</span><span class="p">];</span>
+ <span class="p">},</span></pre></div> </td> </tr> <tr id="section-78"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-78">¶</a> </div> <p>When each <code>Card</code> is rendered via a render event, it appends a notch to the
+<code>Bar</code> and binds a click handler so it can be activated. if the <code>Card</code>'s id
+is currently selected via <code>window.location.hash</code> it's activated.</p> </td> <td class="code"> <div class="highlight"><pre> <span class="nx">render</span> <span class="o">:</span> <span class="kd">function</span><span class="p">(){</span>
+ <span class="k">this</span><span class="p">.</span><span class="nx">offset</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">timeline</span><span class="p">.</span><span class="nx">bounds</span><span class="p">.</span><span class="nx">project</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">timestamp</span><span class="p">,</span> <span class="mi">100</span><span class="p">);</span>
+ <span class="kd">var</span> <span class="nx">html</span> <span class="o">=</span> <span class="nx">JST</span><span class="p">.</span><span class="nx">notch</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">attributes</span><span class="p">);</span>
+ <span class="k">this</span><span class="p">.</span><span class="nx">notch</span> <span class="o">=</span> <span class="nx">$</span><span class="p">(</span><span class="nx">html</span><span class="p">).</span><span class="nx">css</span><span class="p">({</span><span class="s2">"left"</span><span class="o">:</span> <span class="k">this</span><span class="p">.</span><span class="nx">offset</span> <span class="o">+</span> <span class="s2">"%"</span><span class="p">} [...]
+ <span class="k">this</span><span class="p">.</span><span class="nx">timeline</span><span class="p">.</span><span class="nx">$</span><span class="p">(</span><span class="s2">".TS-notchbar"</span><span class="p">).</span><span class="nx">append</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">notch</span><span class="p">);</span>
+ <span class="k">this</span><span class="p">.</span><span class="nx">notch</span><span class="p">.</span><span class="nx">click</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">activate</span><span class="p">);</span>
+ <span class="k">if</span> <span class="p">(</span><span class="nx">history</span><span class="p">.</span><span class="nx">get</span><span class="p">()</span> <span class="o">===</span> <span class="k">this</span><span class="p">.</span><span class="nx">id</span><span class="p">)</span> <span class="k">this</span><span class="p">.</span><span class="nx">activate</span><span class="p">();</span>
+ <span class="p">},</span></pre></div> </td> </tr> <tr id="section-79"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-79">¶</a> </div> <p>As the <code>Bar</code> moves the current card checks to see if it's outside the viewport,
+if it is the card is flipped so as to be visible for the longest period
+of time. The magic number here (7) is half the width of the css arrow.</p> </td> <td class="code"> <div class="highlight"><pre> <span class="nx">flip</span> <span class="o">:</span> <span class="kd">function</span><span class="p">()</span> <span class="p">{</span>
+ <span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="k">this</span><span class="p">.</span><span class="nx">el</span> <span class="o">||</span> <span class="o">!</span><span class="k">this</span><span class="p">.</span><span class="nx">el</span><span class="p">.</span><span class="nx">is</span><span class="p">(</span><span class="s2">":visible"</span><span class="p">))</span> <span class="k">return</span><span class="p">;</span>
+ <span class="kd">var</span> <span class="nx">rightEdge</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">$</span><span class="p">(</span><span class="s2">".TS-item"</span><span class="p">).</span><span class="nx">offset</span><span class="p">().</span><span class="nx">left</span> <span class="o">+</span> <span class="k">this</span><span class="p">.</span><span class="nx">$</span><span class="p">(</span><span class="s2">& [...]
+ <span class="kd">var</span> <span class="nx">tRightEdge</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">timeline</span><span class="p">.</span><span class="nx">$</span><span class="p">(</span><span class="s2">".timeline_setter"</span><span class="p">).</span><span class="nx">offset</span><span class="p">().</span><span class="nx">left</span> <span class="o">+</span> <span class="k">this</span><span class="p">.</span><sp [...]
+ <span class="kd">var</span> <span class="nx">margin</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">el</span><span class="p">.</span><span class="nx">css</span><span class="p">(</span><span class="s2">"margin-left"</span><span class="p">)</span> <span class="o">===</span> <span class="k">this</span><span class="p">.</span><span class="nx">originalMargin</span><span class="p">;</span>
+ <span class="kd">var</span> <span class="nx">flippable</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">$</span><span class="p">(</span><span class="s2">".TS-item"</span><span class="p">).</span><span class="nx">width</span><span class="p">()</span> <span class="o"><</span> <span class="k">this</span><span class="p">.</span><span class="nx">timeline</span><span class="p">.</span><span class="nx">$</span><span class=" [...]
+ <span class="kd">var</span> <span class="nx">offTimeline</span> <span class="o">=</span> <span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">el</span><span class="p">.</span><span class="nx">offset</span><span class="p">().</span><span class="nx">left</span> <span class="o">-</span> <span class="k">this</span><span class="p">.</span><span class="nx">el</span><span class="p">.</span><span class="nx">parent</span><span class="p">().</span><span [...]
+it's never been flipped before and it won't go off the timeline when
+flipped. We'll flip it.</p> </td> <td class="code"> <div class="highlight"><pre> <span class="k">if</span> <span class="p">(</span><span class="nx">tRightEdge</span> <span class="o">-</span> <span class="nx">rightEdge</span> <span class="o"><</span> <span class="mi">0</span> <span class="o">&&</span> <span class="nx">margin</span> <span class="o">&&</span> <span class="o">!</span><span class="nx">offTimeline</span><span class= [...]
+ <span class="k">this</span><span class="p">.</span><span class="nx">el</span><span class="p">.</span><span class="nx">css</span><span class="p">({</span><span class="s2">"margin-left"</span><span class="o">:</span> <span class="o">-</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">$</span><span class="p">(</span><span class="s2">".TS-item"</span><span class="p">).</span><span class="nx">width</span><span class=" [...]
+ <span class="k">this</span><span class="p">.</span><span class="nx">$</span><span class="p">(</span><span class="s2">".TS-css_arrow"</span><span class="p">).</span><span class="nx">css</span><span class="p">({</span><span class="s2">"left"</span> <span class="o">:</span> <span class="k">this</span><span class="p">.</span><span class="nx">$</span><span class="p">(</span><span class="s2">".TS-item"</span><span class="p">).</span><span class="nx">width< [...]
+flipped it before and the card's width is less than half of the width
+of the whole timeline, we'll flip it to the default position.</p> </td> <td class="code"> <div class="highlight"><pre> <span class="p">}</span> <span class="k">else</span> <span class="k">if</span> <span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">el</span><span class="p">.</span><span class="nx">offset</span><span class="p">().</span><span class="nx">left</span> <span class="o">-</span> <span class="k"> [...]
+ <span class="k">this</span><span class="p">.</span><span class="nx">el</span><span class="p">.</span><span class="nx">css</span><span class="p">({</span><span class="s2">"margin-left"</span><span class="o">:</span> <span class="k">this</span><span class="p">.</span><span class="nx">originalMargin</span><span class="p">});</span>
+ <span class="k">this</span><span class="p">.</span><span class="nx">$</span><span class="p">(</span><span class="s2">".TS-css_arrow"</span><span class="p">).</span><span class="nx">css</span><span class="p">({</span><span class="s2">"left"</span><span class="o">:</span> <span class="mi">0</span><span class="p">});</span>
+ <span class="p">}</span>
+ <span class="p">},</span></pre></div> </td> </tr> <tr id="section-82"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-82">¶</a> </div> <p>The first time a card is activated it renders its <code>template</code> and appends
+its element to the <code>Bar</code>. After doing so it sets the width if <code>.TS-item_label</code>
+and moves the <code>Bar</code> if its element outside the visible portion of the
+timeline.</p> </td> <td class="code"> <div class="highlight"><pre> <span class="nx">activate</span> <span class="o">:</span> <span class="kd">function</span><span class="p">(</span><span class="nx">e</span><span class="p">){</span>
+ <span class="kd">var</span> <span class="nx">that</span> <span class="o">=</span> <span class="k">this</span><span class="p">;</span>
+ <span class="k">this</span><span class="p">.</span><span class="nx">hideActiveCard</span><span class="p">();</span>
+ <span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="k">this</span><span class="p">.</span><span class="nx">el</span><span class="p">)</span> <span class="p">{</span>
+ <span class="k">this</span><span class="p">.</span><span class="nx">el</span> <span class="o">=</span> <span class="nx">$</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">template</span><span class="p">({</span><span class="nx">card</span><span class="o">:</span> <span class="k">this</span><span class="p">}));</span></pre></div> </td> </tr> <tr id="section-83"> <td cla [...]
+
+ <span class="k">this</span><span class="p">.</span><span class="nx">el</span><span class="p">.</span><span class="nx">css</span><span class="p">({</span><span class="s2">"left"</span><span class="o">:</span> <span class="k">this</span><span class="p">.</span><span class="nx">offset</span> <span class="o">+</span> <span class="s2">"%"</span><span class="p">});</span>
+ <span class="k">this</span><span class="p">.</span><span class="nx">timeline</span><span class="p">.</span><span class="nx">$</span><span class="p">(</span><span class="s2">".TS-card_scroller_inner"</span><span class="p">).</span><span class="nx">append</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">el</span><span class="p">);</span>
+ <span class="k">this</span><span class="p">.</span><span class="nx">originalMargin</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">el</span><span class="p">.</span><span class="nx">css</span><span class="p">(</span><span class="s2">"margin-left"</span><span class="p">);</span>
+ <span class="k">this</span><span class="p">.</span><span class="nx">el</span><span class="p">.</span><span class="nx">delegate</span><span class="p">(</span><span class="s2">".TS-permalink"</span><span class="p">,</span> <span class="s2">"click"</span><span class="p">,</span> <span class="k">this</span><span class="p">.</span><span class="nx">setPermalink</span><span class="p">);</span></pre></div> </td> </tr> [...]
+widths and position accordingly.</p> </td> <td class="code"> <div class="highlight"><pre> <span class="k">this</span><span class="p">.</span><span class="nx">timeline</span><span class="p">.</span><span class="nx">$</span><span class="p">(</span><span class="s2">"img"</span><span class="p">).</span><span class="nx">load</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">activate</span><s [...]
+ <span class="p">}</span>
+
+ <span class="k">this</span><span class="p">.</span><span class="nx">el</span><span class="p">.</span><span class="nx">show</span><span class="p">().</span><span class="nx">addClass</span><span class="p">((</span><span class="s2">"TS-card_active"</span><span class="p">));</span>
+ <span class="k">this</span><span class="p">.</span><span class="nx">notch</span><span class="p">.</span><span class="nx">addClass</span><span class="p">(</span><span class="s2">"TS-notch_active"</span><span class="p">);</span>
+ <span class="k">this</span><span class="p">.</span><span class="nx">setWidth</span><span class="p">();</span></pre></div> </td> </tr> <tr id="section-85"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-85">¶</a> </div> <p>In the case that the card is outside the bounds the wrong way when
+it's flipped, we'll take care of it here before we move the actual
+card.</p> </td> <td class="code"> <div class="highlight"><pre> <span class="k">this</span><span class="p">.</span><span class="nx">flip</span><span class="p">();</span>
+ <span class="k">this</span><span class="p">.</span><span class="nx">move</span><span class="p">();</span>
+ <span class="k">this</span><span class="p">.</span><span class="nx">series</span><span class="p">.</span><span class="nx">timeline</span><span class="p">.</span><span class="nx">trigger</span><span class="p">(</span><span class="s2">"cardActivate"</span><span class="p">,</span> <span class="k">this</span><span class="p">.</span><span class="nx">attributes</span><span class="p">);</span>
+ <span class="p">},</span></pre></div> </td> </tr> <tr id="section-86"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-86">¶</a> </div> <p>For Internet Explorer each card sets the width of<code>.TS-item_label</code> to
+the maximum width of the card's children, or if that is less than the
+<code>.TS-item_year</code> element's width, <code>.TS-item_label</code> gets <code>.TS-item_year</code>s
+width. Which is a funny way of saying, if you'd like to set the width of
+the card as a whole, fiddle with <code>.TS-item_year</code>s width.</p> </td> <td class="code"> <div class="highlight"><pre> <span class="nx">setWidth</span> <span class="o">:</span> <span class="kd">function</span><span class="p">(){</span>
+ <span class="kd">var</span> <span class="nx">that</span> <span class="o">=</span> <span class="k">this</span><span class="p">;</span>
+ <span class="kd">var</span> <span class="nx">max</span> <span class="o">=</span> <span class="nx">_</span><span class="p">.</span><span class="nx">max</span><span class="p">(</span><span class="nx">_</span><span class="p">.</span><span class="nx">toArray</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">$</span><span class="p">(</span><span class="s2">".TS-item_user_html"</span><span class="p">).</span><span class="nx">child [...]
+ <span class="k">if</span> <span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">$</span><span class="p">(</span><span class="nx">max</span><span class="p">).</span><span class="nx">width</span><span class="p">()</span> <span class="o">></span> <span class="k">this</span><span class="p">.</span><span class="nx">$</span><span class="p">(</span><span class="s2">".TS-item_year"</span><span class="p">).</span><span class="nx">width</spa [...]
+ <span class="k">this</span><span class="p">.</span><span class="nx">$</span><span class="p">(</span><span class="s2">".TS-item_label"</span><span class="p">).</span><span class="nx">css</span><span class="p">(</span><span class="s2">"width"</span><span class="p">,</span> <span class="k">this</span><span class="p">.</span><span class="nx">$</span><span class="p">(</span><span class="nx">max</span><span class="p">).</span><span class="nx">width</span><span class [...]
+ <span class="p">}</span> <span class="k">else</span> <span class="p">{</span>
+ <span class="k">this</span><span class="p">.</span><span class="nx">$</span><span class="p">(</span><span class="s2">".TS-item_label"</span><span class="p">).</span><span class="nx">css</span><span class="p">(</span><span class="s2">"width"</span><span class="p">,</span> <span class="k">this</span><span class="p">.</span><span class="nx">$</span><span class="p">(</span><span class="s2">".TS-item_year"</span><span class="p">).</span><span class="nx">w [...]
+ <span class="p">}</span>
+ <span class="p">},</span></pre></div> </td> </tr> <tr id="section-87"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-87">¶</a> </div> <p>Move the <code>Bar</code> if the card is outside the visible region on activation.</p> </td> <td class="code"> <div class="highlight"><pre> <span class="nx [...]
+ <span class="kd">var</span> <span class="nx">e</span> <span class="o">=</span> <span class="nx">$</span><span class="p">.</span><span class="nx">Event</span><span class="p">(</span><span class="s1">'moving'</span><span class="p">);</span>
+ <span class="kd">var</span> <span class="nx">offset</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">$</span><span class="p">(</span><span class="s2">".TS-item"</span><span class="p">).</span><span class="nx">offset</span><span class="p">();</span>
+ <span class="kd">var</span> <span class="nx">toffset</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">timeline</span><span class="p">.</span><span class="nx">$</span><span class="p">(</span><span class="s2">".timeline_setter"</span><span class="p">).</span><span class="nx">offset</span><span class="p">();</span>
+ <span class="k">if</span> <span class="p">(</span><span class="nx">offset</span><span class="p">.</span><span class="nx">left</span> <span class="o"><</span> <span class="nx">toffset</span><span class="p">.</span><span class="nx">left</span><span class="p">)</span> <span class="p">{</span>
+ <span class="nx">e</span><span class="p">.</span><span class="nx">deltaX</span> <span class="o">=</span> <span class="nx">toffset</span><span class="p">.</span><span class="nx">left</span> <span class="o">-</span> <span class="nx">offset</span><span class="p">.</span><span class="nx">left</span> <span class="o">+</span> <span class="nx">cleanNumber</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">$</span><span class="p">(</span><sp [...]
+ <span class="k">this</span><span class="p">.</span><span class="nx">timeline</span><span class="p">.</span><span class="nx">bar</span><span class="p">.</span><span class="nx">moving</span><span class="p">(</span><span class="nx">e</span><span class="p">);</span>
+ <span class="p">}</span> <span class="k">else</span> <span class="k">if</span> <span class="p">(</span><span class="nx">offset</span><span class="p">.</span><span class="nx">left</span> <span class="o">+</span> <span class="k">this</span><span class="p">.</span><span class="nx">$</span><span class="p">(</span><span class="s2">".TS-item"</span><span class="p">).</span><span class="nx">outerWidth</span><span class="p">()</span> <span class="o">></span> <span class="nx">t [...]
+ <span class="nx">e</span><span class="p">.</span><span class="nx">deltaX</span> <span class="o">=</span> <span class="nx">toffset</span><span class="p">.</span><span class="nx">left</span> <span class="o">+</span> <span class="k">this</span><span class="p">.</span><span class="nx">timeline</span><span class="p">.</span><span class="nx">$</span><span class="p">(</span><span class="s2">".timeline_setter"</span><span class="p">).</span><span class="nx">width</span><span cl [...]
+ <span class="k">this</span><span class="p">.</span><span class="nx">timeline</span><span class="p">.</span><span class="nx">bar</span><span class="p">.</span><span class="nx">moving</span><span class="p">(</span><span class="nx">e</span><span class="p">);</span>
+ <span class="p">}</span>
+ <span class="p">},</span></pre></div> </td> </tr> <tr id="section-88"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-88">¶</a> </div> <p>The click handler to set the current hash to the <code>Card</code>'s id.</p> </td> <td class="code"> <div class="highlight"><pre> <span class="nx">setPerma [...]
+ <span class="nx">history</span><span class="p">.</span><span class="nx">set</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">id</span><span class="p">);</span>
+ <span class="p">},</span></pre></div> </td> </tr> <tr id="section-89"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-89">¶</a> </div> <p>Globally hide any cards with <code>TS-card_active</code>.</p> </td> <td class="code"> <div class="highlight"><pre> <span class="nx">hideActiveCard</span> < [...]
+ <span class="k">this</span><span class="p">.</span><span class="nx">timeline</span><span class="p">.</span><span class="nx">$</span><span class="p">(</span><span class="s2">".TS-card_active"</span><span class="p">).</span><span class="nx">removeClass</span><span class="p">(</span><span class="s2">"TS-card_active"</span><span class="p">).</span><span class="nx">hide</span><span class="p">();</span>
+ <span class="k">this</span><span class="p">.</span><span class="nx">timeline</span><span class="p">.</span><span class="nx">$</span><span class="p">(</span><span class="s2">".TS-notch_active"</span><span class="p">).</span><span class="nx">removeClass</span><span class="p">(</span><span class="s2">"TS-notch_active"</span><span class="p">);</span>
+ <span class="p">},</span></pre></div> </td> </tr> <tr id="section-90"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-90">¶</a> </div> <p>An event listener to toggle this notch on and off via <code>Series</code>.</p> </td> <td class="code"> <div class="highlight"><pre> <span class="nx">toggle [...]
+ <span class="k">switch</span> <span class="p">(</span><span class="nx">e</span><span class="p">)</span> <span class="p">{</span>
+ <span class="k">case</span> <span class="s2">"hideNotch"</span><span class="o">:</span>
+ <span class="k">this</span><span class="p">.</span><span class="nx">notch</span><span class="p">.</span><span class="nx">hide</span><span class="p">().</span><span class="nx">removeClass</span><span class="p">(</span><span class="s2">"TS-notch_active"</span><span class="p">).</span><span class="nx">addClass</span><span class="p">(</span><span class="s2">"TS-series_inactive"</span><span class="p">);</span>
+ <span class="k">if</span> <span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">el</span><span class="p">)</span> <span class="k">this</span><span class="p">.</span><span class="nx">el</span><span class="p">.</span><span class="nx">hide</span><span class="p">();</span>
+ <span class="k">return</span><span class="p">;</span>
+ <span class="k">case</span> <span class="s2">"showNotch"</span><span class="o">:</span>
+ <span class="k">this</span><span class="p">.</span><span class="nx">notch</span><span class="p">.</span><span class="nx">removeClass</span><span class="p">(</span><span class="s2">"TS-series_inactive"</span><span class="p">).</span><span class="nx">show</span><span class="p">();</span>
+ <span class="p">}</span>
+ <span class="p">}</span>
+
+ <span class="p">});</span></pre></div> </td> </tr> <tr id="section-91"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-91">¶</a> </div> <p>Simple inheritance helper for <code>Controls</code>.</p> </td> <td class="code"> <div class="highlight"><pre> <span class="kd">var</span> <span class="nx">cto [...]
+ <span class="kd">var</span> <span class="nx">inherits</span> <span class="o">=</span> <span class="kd">function</span><span class="p">(</span><span class="nx">child</span><span class="p">,</span> <span class="nx">parent</span><span class="p">){</span>
+ <span class="nx">ctor</span><span class="p">.</span><span class="nx">prototype</span> <span class="o">=</span> <span class="nx">parent</span><span class="p">.</span><span class="nx">prototype</span><span class="p">;</span>
+ <span class="nx">child</span><span class="p">.</span><span class="nx">prototype</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">ctor</span><span class="p">();</span>
+ <span class="nx">child</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">constructor</span> <span class="o">=</span> <span class="nx">child</span><span class="p">;</span>
+ <span class="p">};</span></pre></div> </td> </tr> <tr id="section-92"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-92">¶</a> </div> <h2>Controls</h2> </td> <td class="code"> <div class="highlight"><pre></pre></div> </td> </tr> <tr id="section- [...]
+ <span class="k">this</span><span class="p">.</span><span class="nx">timeline</span> <span class="o">=</span> <span class="nx">timeline</span><span class="p">;</span>
+ <span class="k">this</span><span class="p">.</span><span class="nx">direction</span> <span class="o">=</span> <span class="nx">direction</span><span class="p">;</span>
+ <span class="k">this</span><span class="p">.</span><span class="nx">el</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">timeline</span><span class="p">.</span><span class="nx">$</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">prefix</span> <span class="o">+</span> <span class="nx">direction</span><span class="p">);</span>
+ <span class="kd">var</span> <span class="nx">that</span> <span class="o">=</span> <span class="k">this</span><span class="p">;</span>
+ <span class="k">this</span><span class="p">.</span><span class="nx">el</span><span class="p">.</span><span class="nx">bind</span><span class="p">(</span><span class="s1">'click'</span><span class="p">,</span> <span class="kd">function</span><span class="p">(</span><span class="nx">e</span><span class="p">)</span> <span class="p">{</span> <span class="nx">e</span><span class="p">.</span><span class="nx">preventDefault</span><span class="p">();</span> <span class="nx">that</spa [...]
+ <span class="p">};</span></pre></div> </td> </tr> <tr id="section-94"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-94">¶</a> </div> <p>Each <code>Zoom</code> control adjusts the <code>curZoom</code> when clicked.</p> </td> <td class="code"> <div class="highlight"><pre> <span class="kd">var</sp [...]
+ <span class="kd">var</span> <span class="nx">Zoom</span> <span class="o">=</span> <span class="kd">function</span><span class="p">(</span><span class="nx">direction</span><span class="p">,</span> <span class="nx">timeline</span><span class="p">)</span> <span class="p">{</span>
+ <span class="nx">Control</span><span class="p">.</span><span class="nx">apply</span><span class="p">(</span><span class="k">this</span><span class="p">,</span> <span class="nx">arguments</span><span class="p">);</span>
+ <span class="p">};</span>
+ <span class="nx">inherits</span><span class="p">(</span><span class="nx">Zoom</span><span class="p">,</span> <span class="nx">Control</span><span class="p">);</span>
+
+ <span class="nx">Zoom</span><span class="p">.</span><span class="nx">prototype</span> <span class="o">=</span> <span class="nx">_</span><span class="p">.</span><span class="nx">extend</span><span class="p">(</span><span class="nx">Zoom</span><span class="p">.</span><span class="nx">prototype</span><span class="p">,</span> <span class="p">{</span>
+ <span class="nx">prefix</span> <span class="o">:</span> <span class="s2">".TS-zoom_"</span><span class="p">,</span></pre></div> </td> </tr> <tr id="section-95"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-95">¶</a> </div> <p>Adjust the <code>curZoom</code> up or down by 100 and trigger a <code>doZoom</code> event on
+<code>.TS-notchbar</code></p> </td> <td class="code"> <div class="highlight"><pre> <span class="nx">click</span> <span class="o">:</span> <span class="kd">function</span><span class="p">()</span> <span class="p">{</span>
+ <span class="nx">curZoom</span> <span class="o">+=</span> <span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">direction</span> <span class="o">===</span> <span class="s2">"in"</span> <span class="o">?</span> <span class="o">+</span><span class="mi">100</span> <span class="o">:</span> <span class="o">-</span><span class="mi">100</span><span class="p">);</span>
+ <span class="k">if</span> <span class="p">(</span><span class="nx">curZoom</span> <span class="o">>=</span> <span class="mi">100</span><span class="p">)</span> <span class="p">{</span>
+ <span class="k">this</span><span class="p">.</span><span class="nx">timeline</span><span class="p">.</span><span class="nx">$</span><span class="p">(</span><span class="s2">".TS-notchbar"</span><span class="p">).</span><span class="nx">trigger</span><span class="p">(</span><span class="s1">'doZoom'</span><span class="p">,</span> <span class="p">[</span><span class="nx">curZoom</span><span class="p">]);</span>
+ <span class="p">}</span> <span class="k">else</span> <span class="p">{</span>
+ <span class="nx">curZoom</span> <span class="o">=</span> <span class="mi">100</span><span class="p">;</span>
+ <span class="p">}</span>
+ <span class="p">}</span>
+ <span class="p">});</span></pre></div> </td> </tr> <tr id="section-96"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-96">¶</a> </div> <p>Each <code>Chooser</code> activates the next or previous notch.</p> </td> <td class="code"> <div class="highlight"><pre> <span class="kd">var</span> <span cla [...]
+ <span class="nx">Control</span><span class="p">.</span><span class="nx">apply</span><span class="p">(</span><span class="k">this</span><span class="p">,</span> <span class="nx">arguments</span><span class="p">);</span>
+ <span class="k">this</span><span class="p">.</span><span class="nx">notches</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">timeline</span><span class="p">.</span><span class="nx">$</span><span class="p">(</span><span class="s2">".TS-notch"</span><span class="p">);</span>
+ <span class="p">};</span>
+ <span class="nx">inherits</span><span class="p">(</span><span class="nx">Chooser</span><span class="p">,</span> <span class="nx">Control</span><span class="p">);</span>
+
+ <span class="nx">Chooser</span><span class="p">.</span><span class="nx">prototype</span> <span class="o">=</span> <span class="nx">_</span><span class="p">.</span><span class="nx">extend</span><span class="p">(</span><span class="nx">Control</span><span class="p">.</span><span class="nx">prototype</span><span class="p">,</span> <span class="p">{</span>
+ <span class="nx">prefix</span><span class="o">:</span> <span class="s2">".TS-choose_"</span><span class="p">,</span></pre></div> </td> </tr> <tr id="section-97"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-97">¶</a> </div> <p>Figure out which notch to activate and do so by triggering a click on
+that notch.</p> </td> <td class="code"> <div class="highlight"><pre> <span class="nx">click</span><span class="o">:</span> <span class="kd">function</span><span class="p">(</span><span class="nx">e</span><span class="p">){</span>
+ <span class="kd">var</span> <span class="nx">el</span><span class="p">;</span>
+ <span class="kd">var</span> <span class="nx">notches</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">notches</span><span class="p">.</span><span class="nx">not</span><span class="p">(</span><span class="s2">".TS-series_inactive"</span><span class="p">);</span>
+ <span class="kd">var</span> <span class="nx">curCardIdx</span> <span class="o">=</span> <span class="nx">notches</span><span class="p">.</span><span class="nx">index</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">timeline</span><span class="p">.</span><span class="nx">$</span><span class="p">(</span><span class="s2">".TS-notch_active"</span><span class="p">));</span>
+ <span class="kd">var</span> <span class="nx">numOfCards</span> <span class="o">=</span> <span class="nx">notches</span><span class="p">.</span><span class="nx">length</span><span class="p">;</span>
+ <span class="k">if</span> <span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">direction</span> <span class="o">===</span> <span class="s2">"next"</span><span class="p">)</span> <span class="p">{</span>
+ <span class="nx">el</span> <span class="o">=</span> <span class="p">(</span><span class="nx">curCardIdx</span> <span class="o"><</span> <span class="nx">numOfCards</span> <span class="o">?</span> <span class="nx">notches</span><span class="p">.</span><span class="nx">eq</span><span class="p">(</span><span class="nx">curCardIdx</span> <span class="o">+</span> <span class="mi">1</span><span class="p">)</span> <span class="o">:</span> <span class="kc">false</span><span class="p"> [...]
+ <span class="p">}</span> <span class="k">else</span> <span class="p">{</span>
+ <span class="nx">el</span> <span class="o">=</span> <span class="p">(</span><span class="nx">curCardIdx</span> <span class="o">></span> <span class="mi">0</span> <span class="o">?</span> <span class="nx">notches</span><span class="p">.</span><span class="nx">eq</span><span class="p">(</span><span class="nx">curCardIdx</span> <span class="o">-</span> <span class="mi">1</span><span class="p">)</span> <span class="o">:</span> <span class="kc">false</span><span class="p">);</span>
+ <span class="p">}</span>
+ <span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="nx">el</span><span class="p">)</span> <span class="k">return</span><span class="p">;</span>
+ <span class="nx">el</span><span class="p">.</span><span class="nx">trigger</span><span class="p">(</span><span class="s2">"click"</span><span class="p">);</span>
+ <span class="p">}</span>
+ <span class="p">});</span></pre></div> </td> </tr> <tr id="section-98"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-98">¶</a> </div> <h2>JS API</h2> </td> <td class="code"> <div class="highlight"><pre></pre></div> </td> </tr> <tr id="section-9 [...]
+timeline events, and activate cards programmatically.
+To take advantage of it, assign the timeline boot function to a variable
+like so:</p>
+
+<pre><code>var currentTimeline = TimelineSetter.Timeline.boot(
+ [data], {config}
+);
+</code></pre>
+
+<p>then call methods on the <code>currentTimeline.api</code> object</p>
+
+<pre><code>currentTimeline.api.onLoad(function() {
+ console.log("I'm ready");
+});
+</code></pre> </td> <td class="code"> <div class="highlight"><pre> <span class="nx">TimelineSetter</span><span class="p">.</span><span class="nx">Api</span> <span class="o">=</span> <span class="kd">function</span><span class="p">(</span><span class="nx">timeline</span><span class="p">)</span> <span class="p">{</span>
+ <span class="k">this</span><span class="p">.</span><span class="nx">timeline</span> <span class="o">=</span> <span class="nx">timeline</span><span class="p">;</span>
+ <span class="p">};</span>
+
+ <span class="nx">TimelineSetter</span><span class="p">.</span><span class="nx">Api</span><span class="p">.</span><span class="nx">prototype</span> <span class="o">=</span> <span class="nx">_</span><span class="p">.</span><span class="nx">extend</span><span class="p">(</span><span class="nx">TimelineSetter</span><span class="p">.</span><span class="nx">Api</span><span class="p">.</span><span class="nx">prototype</span><span class="p">,</span> <span class="p">{</span></pre></div> [...]
+ <span class="k">this</span><span class="p">.</span><span class="nx">timeline</span><span class="p">.</span><span class="nx">bind</span><span class="p">(</span><span class="s1">'load'</span><span class="p">,</span> <span class="nx">cb</span><span class="p">);</span>
+ <span class="p">},</span></pre></div> </td> </tr> <tr id="section-101"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-101">¶</a> </div> <p>Register a callback for when a card is added to the timeline
+Callback has access to the event name and the card object</p> </td> <td class="code"> <div class="highlight"><pre> <span class="nx">onCardAdd</span> <span class="o">:</span> <span class="kd">function</span><span class="p">(</span><span class="nx">cb</span><span class="p">)</span> <span class="p">{</span>
+ <span class="k">this</span><span class="p">.</span><span class="nx">timeline</span><span class="p">.</span><span class="nx">bind</span><span class="p">(</span><span class="s1">'cardAdd'</span><span class="p">,</span> <span class="nx">cb</span><span class="p">);</span>
+ <span class="p">},</span></pre></div> </td> </tr> <tr id="section-102"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-102">¶</a> </div> <p>Register a callback for when a card is activated.
+Callback has access to the event name and the card object</p> </td> <td class="code"> <div class="highlight"><pre> <span class="nx">onCardActivate</span> <span class="o">:</span> <span class="kd">function</span><span class="p">(</span><span class="nx">cb</span><span class="p">)</span> <span class="p">{</span>
+ <span class="k">this</span><span class="p">.</span><span class="nx">timeline</span><span class="p">.</span><span class="nx">bind</span><span class="p">(</span><span class="s1">'cardActivate'</span><span class="p">,</span> <span class="nx">cb</span><span class="p">);</span>
+ <span class="p">},</span></pre></div> </td> </tr> <tr id="section-103"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-103">¶</a> </div> <p>Register a callback for when the bar is moved or zoomed.
+Be careful with this one: Bar move events can be fast
+and furious, especially with scroll wheels in Safari.</p> </td> <td class="code"> <div class="highlight"><pre> <span class="nx">onBarMove</span> <span class="o">:</span> <span class="kd">function</span><span class="p">(</span><span class="nx">cb</span><span class="p">)</span> <span class="p">{</span></pre></div> </td> </tr> <tr id="section-104"> <td class="docs"> <div cl [...]
+at this point, <code>timeline.bar</code> isn't available yet.
+To get around this, we'll trigger the bar's
+timeline's move event when the bar is moved.</p> </td> <td class="code"> <div class="highlight"><pre> <span class="k">this</span><span class="p">.</span><span class="nx">timeline</span><span class="p">.</span><span class="nx">bind</span><span class="p">(</span><span class="s1">'move'</span><span class="p">,</span> <span class="nx">cb</span><span class="p">);</span>
+ <span class="p">},</span></pre></div> </td> </tr> <tr id="section-105"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-105">¶</a> </div> <p>Show the card matching a given timestamp
+Right now, timelines only support one card per timestamp</p> </td> <td class="code"> <div class="highlight"><pre> <span class="nx">activateCard</span> <span class="o">:</span> <span class="kd">function</span><span class="p">(</span><span class="nx">timestamp</span><span class="p">)</span> <span class="p">{</span>
+ <span class="nx">_</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">timeline</span><span class="p">.</span><span class="nx">cards</span><span class="p">).</span><span class="nx">detect</span><span class="p">(</span><span class="kd">function</span><span class="p">(</span><span class="nx">card</span><span class="p">)</span> <span class="p">{</span> <span class="k">return</span> <span class="nx">card</span><span class="p">.</span><span [...]
+ <span class="p">}</span>
+ <span class="p">});</span></pre></div> </td> </tr> <tr id="section-106"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-106">¶</a> </div> <p>Global TS keydown function to bind key events to the
+current global currentTimeline.</p> </td> <td class="code"> <div class="highlight"><pre> <span class="nx">TimelineSetter</span><span class="p">.</span><span class="nx">bindKeydowns</span> <span class="o">=</span> <span class="kd">function</span><span class="p">()</span> <span class="p">{</span>
+ <span class="nx">$</span><span class="p">(</span><span class="nb">document</span><span class="p">).</span><span class="nx">bind</span><span class="p">(</span><span class="s1">'keydown'</span><span class="p">,</span> <span class="kd">function</span><span class="p">(</span><span class="nx">e</span><span class="p">)</span> <span class="p">{</span>
+ <span class="k">if</span> <span class="p">(</span><span class="nx">e</span><span class="p">.</span><span class="nx">keyCode</span> <span class="o">===</span> <span class="mi">39</span><span class="p">)</span> <span class="p">{</span>
+ <span class="nx">TimelineSetter</span><span class="p">.</span><span class="nx">currentTimeline</span><span class="p">.</span><span class="nx">chooseNext</span><span class="p">.</span><span class="nx">click</span><span class="p">();</span>
+ <span class="p">}</span> <span class="k">else</span> <span class="k">if</span> <span class="p">(</span><span class="nx">e</span><span class="p">.</span><span class="nx">keyCode</span> <span class="o">===</span> <span class="mi">37</span><span class="p">)</span> <span class="p">{</span>
+ <span class="nx">TimelineSetter</span><span class="p">.</span><span class="nx">currentTimeline</span><span class="p">.</span><span class="nx">choosePrev</span><span class="p">.</span><span class="nx">click</span><span class="p">();</span>
+ <span class="p">}</span> <span class="k">else</span> <span class="p">{</span>
+ <span class="k">return</span><span class="p">;</span>
+ <span class="p">}</span>
+ <span class="p">});</span>
+ <span class="p">};</span></pre></div> </td> </tr> <tr id="section-107"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-107">¶</a> </div> <p>Finally, let's create the whole timeline. Boot is exposed globally via
+<code>TimelineSetter.Timeline.boot()</code> which takes the JSON generated by
+the timeline-setter binary as its first argument, and a config hash as its second.
+The config hash looks for a container element, an interval for interval notches
+and a formatter function for dates. All of these are optional.</p>
+
+<p>We also initialize a new API object for each timeline, accessible via the
+timeline variable's <code>api</code> method (e.g. <code>currentTimeline.api</code>) and look for
+how many timelines are globally on the page for keydown purposes. We'll only
+bind keydowns globally if there's only one timeline on the page.</p> </td> <td class="code"> <div class="highlight"><pre> <span class="nx">Timeline</span><span class="p">.</span><span class="nx">boot</span> <span class="o">=</span> <span class="kd">function</span><span class="p">(</span><span class="nx">data</span><span class="p">,</span> <span class="nx">config</span><span class="p">)</span> <span class="p">{</span>
+ <span class="kd">var</span> <span class="nx">timeline</span> <span class="o">=</span> <span class="nx">TimelineSetter</span><span class="p">.</span><span class="nx">timeline</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">Timeline</span><span class="p">(</span><span class="nx">data</span><span class="p">,</span> <span class="nx">config</span> <span class="o">||</span> <span class="p">{});</span>
+ <span class="kd">var</span> <span class="nx">api</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">TimelineSetter</span><span class="p">.</span><span class="nx">Api</span><span class="p">(</span><span class="nx">timeline</span><span class="p">);</span>
+
+ <span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="nx">TimelineSetter</span><span class="p">.</span><span class="nx">pageTimelines</span><span class="p">)</span> <span class="p">{</span>
+ <span class="nx">TimelineSetter</span><span class="p">.</span><span class="nx">currentTimeline</span> <span class="o">=</span> <span class="nx">timeline</span><span class="p">;</span>
+ <span class="nx">TimelineSetter</span><span class="p">.</span><span class="nx">bindKeydowns</span><span class="p">();</span>
+ <span class="p">}</span>
+
+ <span class="nx">TimelineSetter</span><span class="p">.</span><span class="nx">pageTimelines</span> <span class="o">=</span> <span class="nx">TimelineSetter</span><span class="p">.</span><span class="nx">pageTimelines</span> <span class="o">?</span> <span class="nx">TimelineSetter</span><span class="p">.</span><span class="nx">pageTimelines</span> <span class="o">+=</span> <span class="mi">1</span> <span class="o">:</span> <span class="mi">1</span><span class="p">;</span>
+
+ <span class="nx">$</span><span class="p">(</span><span class="nx">timeline</span><span class="p">.</span><span class="nx">render</span><span class="p">);</span>
+
+ <span class="k">return</span> <span class="p">{</span>
+ <span class="nx">timeline</span> <span class="o">:</span> <span class="nx">timeline</span><span class="p">,</span>
+ <span class="nx">api</span> <span class="o">:</span> <span class="nx">api</span>
+ <span class="p">};</span>
+ <span class="p">};</span>
+
+<span class="p">})(</span><span class="nx">jQuery</span><span class="p">);</span>
+
+</pre></div> </td> </tr> </tbody> </table> </div> </body> </html>
\ No newline at end of file
diff --git a/doc/timeline-setter.min.html b/doc/timeline-setter.min.html
new file mode 100644
index 0000000..6d9eac1
--- /dev/null
+++ b/doc/timeline-setter.min.html
@@ -0,0 +1,3 @@
+<!DOCTYPE html> <html> <head> <title>timeline-setter.min.js</title> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <link rel="stylesheet" media="all" href="docco.css" /> </head> <body> <div id="container"> <div id="background"></div> <div id="jump_to"> Jump To … <div id="jump_wrapper"> <div id="jump_page"> <a class="source" href="templates.html"> templat [...]
+
+</pre></div> </td> </tr> </tbody> </table> </div> </body> </html>
\ No newline at end of file
diff --git a/doc/todo.markdown b/doc/todo.markdown
new file mode 100644
index 0000000..cbf91f4
--- /dev/null
+++ b/doc/todo.markdown
@@ -0,0 +1,28 @@
+# TimelineSetter ToDo
+
+
+## Blockers
+
+* ie
+* add one-file minified option in timeline-setter binary
+* docs & docco comments
+* scope events
+* Prettify cases with large numbers of series (they should stack up along the left)
+
+## Features
+
+* zoom to fit by series
+* autoresize
+* wider touch targets
+* pinch
+* generate from google spreadsheets key instead of local csv
+
+## Refactor
+
+
+
+## Bugs
+
+* Refactor single classes: .timeline\_notchbar should be #timeline_notchbar
+* center zooming if no card selection (now it falls back to 0)
+* only show scrubbing cursor if you're zoomed in
diff --git a/doc/twitter-demo.html b/doc/twitter-demo.html
new file mode 100644
index 0000000..5f58581
--- /dev/null
+++ b/doc/twitter-demo.html
@@ -0,0 +1,71 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <link href="http://propublica.github.com/timeline-setter/public/stylesheets/timeline-setter.css" rel="stylesheet" />
+ <script src="../public/javascripts/vendor/jquery-min.js"></script>
+ <script src="../public/javascripts/vendor/underscore-min.js"></script>
+ <script src="../public/javascripts/timeline-setter.js"></script>
+ <script src="../public/javascripts/templates.js"></script>
+
+ <script src="https://github.com/bcherry/twitter-text-js/raw/master/twitter-text.js"></script>
+ <style>
+ #timeline_setter .TS-item_label a {
+ color:#2262CC;
+ }
+ #timeline_setter .TS-item_label a:hover {
+ text-decoration:underline;
+ }
+ </style>
+ </head>
+ <body style="height: 100%">
+
+ <div id="timeline"></div>
+
+ <script type="text/javascript">
+ $(function() {
+ var reqsDone = 0;
+ var usernames = ['propublica', 'nytimes', 'latimes', 'tpm'];
+ var tsTimeline = [];
+
+ var getTwitter = function(username) {
+ $.getJSON("http://api.twitter.com/1/statuses/user_timeline.json?callback=?", {screen_name : username, count : 10}, function(data) {
+ twitterToTS(data);
+ reqsDone += 1;
+
+ if (reqsDone === usernames.length)
+ TimelineSetter.Timeline.boot(tsTimeline, {'container' : "#timeline"});
+ });
+ };
+
+ var twitterToTS = function(data) {
+ _(data).each(function(item) {
+ var datum = {};
+ var bits = item['created_at'].split(" ");
+ datum['timestamp'] = Date.parse(bits[1] + " " + bits[2] + ", " + bits[5] + " " + bits[3] + " UTC");
+ datum['date'] = item['created_at'];
+ datum['display_date'] = humanDate(datum['timestamp']);
+ datum['description'] = twttr.txt.autoLink(item['text']);
+ datum['link'] = "http://twitter.com/" + item['user']['screen_name'] + '/status/' + item['id_str'];
+ datum['series'] = item['user']['screen_name'];
+ tsTimeline.push(datum);
+ });
+ };
+
+ var humanDate = function(timestamp) {
+ var d = new Date(timestamp);
+ var bigHours = d.getHours() > 12;
+ var isPM = d.getHours() >= 12;
+ var strDate = (d.getMonth() + 1) + '/' + d.getDate() + ", "
+ var strTime = (bigHours ? d.getHours() - 12 : (d.getHours() > 0 ? d.getHours() : "12")) + ":" + padNumber(d.getMinutes()) + " " + (isPM ? 'p.m.' : 'a.m.');
+ return strDate + strTime;
+ };
+
+ var padNumber = function(number) {
+ return (number < 10 ? '0' : '') + number;
+ };
+
+ _(usernames).each(getTwitter);
+ });
+ </script>
+ </body>
+</html>
diff --git a/documentation/TimelineSetter.html b/documentation/TimelineSetter.html
new file mode 100644
index 0000000..8f167f9
--- /dev/null
+++ b/documentation/TimelineSetter.html
@@ -0,0 +1,136 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+<title>
+ Module: TimelineSetter
+
+ — Documentation by YARD 0.8.4.1
+
+</title>
+
+ <link rel="stylesheet" href="css/style.css" type="text/css" media="screen" charset="utf-8" />
+
+ <link rel="stylesheet" href="css/common.css" type="text/css" media="screen" charset="utf-8" />
+
+<script type="text/javascript" charset="utf-8">
+ hasFrames = window.top.frames.main ? true : false;
+ relpath = '';
+ framesUrl = "frames.html#!" + escape(window.location.href);
+</script>
+
+
+ <script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
+
+ <script type="text/javascript" charset="utf-8" src="js/app.js"></script>
+
+
+ </head>
+ <body>
+ <div id="header">
+ <div id="menu">
+
+ <a href="_index.html">Index (T)</a> »
+
+
+ <span class="title">TimelineSetter</span>
+
+
+ <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
+</div>
+
+ <div id="search">
+
+ <a class="full_list_link" id="class_list_link"
+ href="class_list.html">
+ Class List
+ </a>
+
+ <a class="full_list_link" id="method_list_link"
+ href="method_list.html">
+ Method List
+ </a>
+
+ <a class="full_list_link" id="file_list_link"
+ href="file_list.html">
+ File List
+ </a>
+
+</div>
+ <div class="clear"></div>
+ </div>
+
+ <iframe id="search_frame"></iframe>
+
+ <div id="content"><h1>Module: TimelineSetter
+
+
+
+</h1>
+
+<dl class="box">
+
+
+
+
+
+
+
+
+ <dt class="r1 last">Defined in:</dt>
+ <dd class="r1 last">lib/timeline_setter.rb<span class="defines">,<br />
+ lib/timeline_setter/cli.rb,<br /> lib/timeline_setter/parser.rb,<br /> lib/timeline_setter/version.rb,<br /> lib/timeline_setter/timeline.rb</span>
+</dd>
+
+</dl>
+<div class="clear"></div>
+
+<h2>Defined Under Namespace</h2>
+<p class="children">
+
+
+
+
+ <strong class="classes">Classes:</strong> <span class='object_link'><a href="TimelineSetter/CLI.html" title="TimelineSetter::CLI (class)">CLI</a></span>, <span class='object_link'><a href="TimelineSetter/Parser.html" title="TimelineSetter::Parser (class)">Parser</a></span>, <span class='object_link'><a href="TimelineSetter/Timeline.html" title="TimelineSetter::Timeline (class)">Timeline</a></span>
+
+
+</p>
+
+ <h2>Constant Summary</h2>
+
+ <dl class="constants">
+
+ <dt id="ROOT-constant" class="">ROOT =
+
+ </dt>
+ <dd><pre class="code"><span class='rubyid_File constant id'>File</span><span class='dot token'>.</span><span class='rubyid_expand_path identifier id'>expand_path</span> <span class='dstring node'>"#{File.dirname __FILE__}/.."</span>
+</pre></dd>
+
+ <dt id="VERSION-constant" class="">VERSION =
+
+ </dt>
+ <dd><pre class="code"><span class='string val'>"0.3.1"</span>
+</pre></dd>
+
+ </dl>
+
+
+
+
+
+
+
+
+
+
+</div>
+
+ <div id="footer">
+ Generated on Thu Feb 21 11:20:30 2013 by
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
+ 0.8.4.1 (ruby-1.8.7).
+</div>
+
+ </body>
+</html>
\ No newline at end of file
diff --git a/documentation/TimelineSetter/CLI.html b/documentation/TimelineSetter/CLI.html
new file mode 100644
index 0000000..b617b16
--- /dev/null
+++ b/documentation/TimelineSetter/CLI.html
@@ -0,0 +1,690 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+<title>
+ Class: TimelineSetter::CLI
+
+ — Documentation by YARD 0.8.4.1
+
+</title>
+
+ <link rel="stylesheet" href="../css/style.css" type="text/css" media="screen" charset="utf-8" />
+
+ <link rel="stylesheet" href="../css/common.css" type="text/css" media="screen" charset="utf-8" />
+
+<script type="text/javascript" charset="utf-8">
+ hasFrames = window.top.frames.main ? true : false;
+ relpath = '../';
+ framesUrl = "../frames.html#!" + escape(window.location.href);
+</script>
+
+
+ <script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
+
+ <script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
+
+
+ </head>
+ <body>
+ <div id="header">
+ <div id="menu">
+
+ <a href="../_index.html">Index (C)</a> »
+ <span class='title'><span class='object_link'><a href="../TimelineSetter.html" title="TimelineSetter (module)">TimelineSetter</a></span></span>
+ »
+ <span class="title">CLI</span>
+
+
+ <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
+</div>
+
+ <div id="search">
+
+ <a class="full_list_link" id="class_list_link"
+ href="../class_list.html">
+ Class List
+ </a>
+
+ <a class="full_list_link" id="method_list_link"
+ href="../method_list.html">
+ Method List
+ </a>
+
+ <a class="full_list_link" id="file_list_link"
+ href="../file_list.html">
+ File List
+ </a>
+
+</div>
+ <div class="clear"></div>
+ </div>
+
+ <iframe id="search_frame"></iframe>
+
+ <div id="content"><h1>Class: TimelineSetter::CLI
+
+
+
+</h1>
+
+<dl class="box">
+
+ <dt class="r1">Inherits:</dt>
+ <dd class="r1">
+ <span class="inheritName">Object</span>
+
+ <ul class="fullTree">
+ <li>Object</li>
+
+ <li class="next">TimelineSetter::CLI</li>
+
+ </ul>
+ <a href="#" class="inheritanceTree">show all</a>
+
+ </dd>
+
+
+
+
+
+
+
+
+
+ <dt class="r2 last">Defined in:</dt>
+ <dd class="r2 last">lib/timeline_setter/cli.rb</dd>
+
+</dl>
+<div class="clear"></div>
+
+
+
+
+
+
+
+
+
+ <h2>
+ Instance Method Summary
+ <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
+ </h2>
+
+ <ul class="summary">
+
+ <li class="public ">
+ <span class="summary_signature">
+
+ <a href="#compile%21-instance_method" title="#compile! (instance method)">- (Object) <strong>compile!</strong> </a>
+
+
+
+ </span>
+
+
+
+
+
+
+
+
+
+ <span class="summary_desc"><div class='inline'></div></span>
+
+</li>
+
+
+ <li class="public ">
+ <span class="summary_signature">
+
+ <a href="#events-instance_method" title="#events (instance method)">- (Object) <strong>events</strong> </a>
+
+
+
+ </span>
+
+
+
+
+
+
+
+
+
+ <span class="summary_desc"><div class='inline'></div></span>
+
+</li>
+
+
+ <li class="public ">
+ <span class="summary_signature">
+
+ <a href="#html-instance_method" title="#html (instance method)">- (Object) <strong>html</strong> </a>
+
+
+
+ </span>
+
+
+
+
+
+
+
+
+
+ <span class="summary_desc"><div class='inline'></div></span>
+
+</li>
+
+
+ <li class="public ">
+ <span class="summary_signature">
+
+ <a href="#initialize-instance_method" title="#initialize (instance method)">- (CLI) <strong>initialize</strong> </a>
+
+
+
+ </span>
+
+
+ <span class="note title constructor">constructor</span>
+
+
+
+
+
+
+
+
+ <span class="summary_desc"><div class='inline'>
+<p>A new instance of CLI.</p>
+</div></span>
+
+</li>
+
+
+ <li class="public ">
+ <span class="summary_signature">
+
+ <a href="#outdir-instance_method" title="#outdir (instance method)">- (Object) <strong>outdir</strong> </a>
+
+
+
+ </span>
+
+
+
+
+
+
+
+
+
+ <span class="summary_desc"><div class='inline'></div></span>
+
+</li>
+
+
+ <li class="public ">
+ <span class="summary_signature">
+
+ <a href="#parse_options%21-instance_method" title="#parse_options! (instance method)">- (Object) <strong>parse_options!</strong> </a>
+
+
+
+ </span>
+
+
+
+
+
+
+
+
+
+ <span class="summary_desc"><div class='inline'></div></span>
+
+</li>
+
+
+ <li class="public ">
+ <span class="summary_signature">
+
+ <a href="#sheet-instance_method" title="#sheet (instance method)">- (Object) <strong>sheet</strong> </a>
+
+
+
+ </span>
+
+
+
+
+
+
+
+
+
+ <span class="summary_desc"><div class='inline'></div></span>
+
+</li>
+
+
+ <li class="public ">
+ <span class="summary_signature">
+
+ <a href="#timeline_page_path-instance_method" title="#timeline_page_path (instance method)">- (Object) <strong>timeline_page_path</strong> </a>
+
+
+
+ </span>
+
+
+
+
+
+
+
+
+
+ <span class="summary_desc"><div class='inline'></div></span>
+
+</li>
+
+
+ </ul>
+
+
+<div id="constructor_details" class="method_details_list">
+ <h2>Constructor Details</h2>
+
+ <div class="method_details first">
+ <h3 class="signature first" id="initialize-instance_method">
+
+ - (<tt><span class='object_link'><a href="" title="TimelineSetter::CLI (class)">CLI</a></span></tt>) <strong>initialize</strong>
+
+
+
+
+
+</h3><div class="docstring">
+ <div class="discussion">
+
+<p>A new instance of CLI</p>
+
+
+ </div>
+</div>
+<div class="tags">
+
+
+</div><table class="source_code">
+ <tr>
+ <td>
+ <pre class="lines">
+
+
+6
+7
+8</pre>
+ </td>
+ <td>
+ <pre class="code"><span class="info file"># File 'lib/timeline_setter/cli.rb', line 6</span>
+
+<span class='rubyid_def def kw'>def</span> <span class='rubyid_initialize identifier id'>initialize</span>
+ <span class='rubyid_parse_options! fid id'>parse_options!</span>
+<span class='rubyid_end end kw'>end</span>
+</pre>
+ </td>
+ </tr>
+</table>
+</div>
+
+</div>
+
+
+ <div id="instance_method_details" class="method_details_list">
+ <h2>Instance Method Details</h2>
+
+
+ <div class="method_details first">
+ <h3 class="signature first" id="compile!-instance_method">
+
+ - (<tt>Object</tt>) <strong>compile!</strong>
+
+
+
+
+
+</h3><table class="source_code">
+ <tr>
+ <td>
+ <pre class="lines">
+
+
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96</pre>
+ </td>
+ <td>
+ <pre class="code"><span class="info file"># File 'lib/timeline_setter/cli.rb', line 78</span>
+
+<span class='rubyid_def def kw'>def</span> <span class='rubyid_compile! fid id'>compile!</span>
+ <span class='rubyid_FileUtils constant id'>FileUtils</span><span class='dot token'>.</span><span class='rubyid_mkdir_p identifier id'>mkdir_p</span> <span class='rubyid_outdir identifier id'>outdir</span> <span class='rubyid_unless unless_mod kw'>unless</span> <span class='rubyid_File constant id'>File</span><span class='dot token'>.</span><span class='rubyid_exists? fid id'>exists?</span> <span class='rubyid_outdir identifier id'>outdir</span>
+ <span class='rubyid_if if kw'>if</span> <span class='notop op'>!</span><span class='rubyid_ at options ivar id'>@options</span><span class='lbrack token'>[</span><span class='symbol val'>:no_assets</span><span class='rbrack token'>]</span> <span class='orop op'>||</span> <span class='notop op'>!</span><span class='rubyid_ at options ivar id'>@options</span><span class='lbrack token'>[</span><span class='symbol val'>:min</span><span class='rbrack token'>]</span>
+ <span class='rubyid_FileUtils constant id'>FileUtils</span><span class='dot token'>.</span><span class='rubyid_cp_r identifier id'>cp_r</span><span class='lparen token'>(</span><span class='rubyid_Dir constant id'>Dir</span><span class='dot token'>.</span><span class='rubyid_glob identifier id'>glob</span><span class='lparen token'>(</span><span class='dstring node'>"#{TimelineSetter::ROOT}/public/*"</span><span class='rparen token'>)</span><span class='comma token'>,</span [...]
+ <span class='comment val'># Concatenate JSTs to timeline-setter.js and remove templates.js</span>
+ <span class='dxstring node'>`cat #{outdir}/javascripts/templates.js >> #{outdir}/javascripts/timeline-setter.js && rm -rf #{outdir}/javascripts/templates*`</span>
+ <span class='rubyid_end end kw'>end</span>
+
+ <span class='rubyid_File constant id'>File</span><span class='dot token'>.</span><span class='rubyid_open identifier id'>open</span><span class='lparen token'>(</span><span class='rubyid_timeline_page_path identifier id'>timeline_page_path</span><span class='comma token'>,</span> <span class='string val'>'w+'</span><span class='rparen token'>)</span> <span class='rubyid_do do kw'>do</span> <span class='bitor op'>|</span><span class='rubyid_doc identifier id'>doc</span><span class='bito [...]
+ <span class='rubyid_doc identifier id'>doc</span><span class='dot token'>.</span><span class='rubyid_write identifier id'>write</span> <span class='rubyid_html identifier id'>html</span>
+ <span class='rubyid_end end kw'>end</span>
+
+ <span class='rubyid_puts identifier id'>puts</span> <span class='dstring node'>"== Files copied to #{outdir}"</span>
+
+ <span class='rubyid_if if kw'>if</span> <span class='rubyid_ at options ivar id'>@options</span><span class='lbrack token'>[</span><span class='symbol val'>:open</span><span class='rbrack token'>]</span>
+ <span class='rubyid_puts identifier id'>puts</span> <span class='string val'>"== Opening ..."</span>
+ <span class='dxstring node'>%x[ open #{timeline_page_path} ]</span>
+ <span class='rubyid_end end kw'>end</span>
+<span class='rubyid_end end kw'>end</span>
+</pre>
+ </td>
+ </tr>
+</table>
+</div>
+
+ <div class="method_details ">
+ <h3 class="signature " id="events-instance_method">
+
+ - (<tt>Object</tt>) <strong>events</strong>
+
+
+
+
+
+</h3><table class="source_code">
+ <tr>
+ <td>
+ <pre class="lines">
+
+
+59
+60
+61</pre>
+ </td>
+ <td>
+ <pre class="code"><span class="info file"># File 'lib/timeline_setter/cli.rb', line 59</span>
+
+<span class='rubyid_def def kw'>def</span> <span class='rubyid_events identifier id'>events</span>
+ <span class='rubyid_TimelineSetter constant id'>TimelineSetter</span><span class='colon2 op'>::</span><span class='rubyid_Parser constant id'>Parser</span><span class='dot token'>.</span><span class='rubyid_new identifier id'>new</span> <span class='rubyid_sheet identifier id'>sheet</span>
+<span class='rubyid_end end kw'>end</span>
+</pre>
+ </td>
+ </tr>
+</table>
+</div>
+
+ <div class="method_details ">
+ <h3 class="signature " id="html-instance_method">
+
+ - (<tt>Object</tt>) <strong>html</strong>
+
+
+
+
+
+</h3><table class="source_code">
+ <tr>
+ <td>
+ <pre class="lines">
+
+
+63
+64
+65
+66
+67
+68</pre>
+ </td>
+ <td>
+ <pre class="code"><span class="info file"># File 'lib/timeline_setter/cli.rb', line 63</span>
+
+<span class='rubyid_def def kw'>def</span> <span class='rubyid_html identifier id'>html</span>
+ <span class='rubyid_TimelineSetter constant id'>TimelineSetter</span><span class='colon2 op'>::</span><span class='rubyid_Timeline constant id'>Timeline</span><span class='dot token'>.</span><span class='rubyid_new identifier id'>new</span><span class='lparen token'>(</span><span class='lbrace token'>{</span>
+ <span class='symbol val'>:events</span> <span class='assign token'>=</span><span class='gt op'>></span> <span class='rubyid_events identifier id'>events</span><span class='dot token'>.</span><span class='rubyid_events identifier id'>events</span><span class='comma token'>,</span>
+ <span class='symbol val'>:interval</span> <span class='assign token'>=</span><span class='gt op'>></span> <span class='rubyid_ at options ivar id'>@options</span><span class='lbrack token'>[</span><span class='symbol val'>:interval</span><span class='rbrack token'>]</span> <span class='orop op'>||</span> <span class='string val'>''</span>
+ <span class='rbrace token'>}</span><span class='rparen token'>)</span><span class='dot token'>.</span><span class='rubyid_send identifier id'>send</span><span class='lparen token'>(</span><span class='rubyid_ at options ivar id'>@options</span><span class='lbrack token'>[</span><span class='symbol val'>:min</span><span class='rbrack token'>]</span> <span class='question op'>?</span> <span class='symbol val'>:timeline_min</span> <span class='colon op'>:</span> <span class='symbol val'>:tim [...]
+<span class='rubyid_end end kw'>end</span>
+</pre>
+ </td>
+ </tr>
+</table>
+</div>
+
+ <div class="method_details ">
+ <h3 class="signature " id="outdir-instance_method">
+
+ - (<tt>Object</tt>) <strong>outdir</strong>
+
+
+
+
+
+</h3><table class="source_code">
+ <tr>
+ <td>
+ <pre class="lines">
+
+
+70
+71
+72</pre>
+ </td>
+ <td>
+ <pre class="code"><span class="info file"># File 'lib/timeline_setter/cli.rb', line 70</span>
+
+<span class='rubyid_def def kw'>def</span> <span class='rubyid_outdir identifier id'>outdir</span>
+ <span class='rubyid_ at options ivar id'>@options</span><span class='lbrack token'>[</span><span class='symbol val'>:output</span><span class='rbrack token'>]</span> <span class='question op'>?</span> <span class='rubyid_ at options ivar id'>@options</span><span class='lbrack token'>[</span><span class='symbol val'>:output</span><span class='rbrack token'>]</span> <span class='colon op'>:</span> <span class='dstring node'>"#{`pwd`.strip}/"</span>
+<span class='rubyid_end end kw'>end</span>
+</pre>
+ </td>
+ </tr>
+</table>
+</div>
+
+ <div class="method_details ">
+ <h3 class="signature " id="parse_options!-instance_method">
+
+ - (<tt>Object</tt>) <strong>parse_options!</strong>
+
+
+
+
+
+</h3><table class="source_code">
+ <tr>
+ <td>
+ <pre class="lines">
+
+
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48</pre>
+ </td>
+ <td>
+ <pre class="code"><span class="info file"># File 'lib/timeline_setter/cli.rb', line 10</span>
+
+<span class='rubyid_def def kw'>def</span> <span class='rubyid_parse_options! fid id'>parse_options!</span>
+ <span class='rubyid_ at options ivar id'>@options</span> <span class='assign token'>=</span> <span class='lbrace token'>{</span><span class='rbrace token'>}</span>
+ <span class='rubyid_option_parser identifier id'>option_parser</span> <span class='assign token'>=</span> <span class='rubyid_OptionParser constant id'>OptionParser</span><span class='dot token'>.</span><span class='rubyid_new identifier id'>new</span> <span class='rubyid_do do kw'>do</span> <span class='bitor op'>|</span><span class='rubyid_opts identifier id'>opts</span><span class='bitor op'>|</span>
+ <span class='rubyid_opts identifier id'>opts</span><span class='dot token'>.</span><span class='rubyid_banner identifier id'>banner</span> <span class='assign token'>=</span> <span class='string val'>"TimelineSetter: A tool to generate HTML timelines from CSVs.\n\nUsage:\n"</span>
+
+ <span class='rubyid_opts identifier id'>opts</span><span class='dot token'>.</span><span class='rubyid_on identifier id'>on</span><span class='lparen token'>(</span><span class='string val'>'-c'</span><span class='comma token'>,</span> <span class='string val'>'--csv CSV'</span><span class='comma token'>,</span> <span class='string val'>'CSV input file'</span><span class='rparen token'>)</span> <span class='rubyid_do do kw'>do</span> <span class='bitor op'>|</span><span class='rubyid [...]
+ <span class='rubyid_ at options ivar id'>@options</span><span class='lbrack token'>[</span><span class='symbol val'>:csv</span><span class='rbrack token'>]</span> <span class='assign token'>=</span> <span class='rubyid_c identifier id'>c</span>
+ <span class='rubyid_end end kw'>end</span>
+ <span class='rubyid_opts identifier id'>opts</span><span class='dot token'>.</span><span class='rubyid_on identifier id'>on</span><span class='lparen token'>(</span><span class='string val'>'-o'</span><span class='comma token'>,</span> <span class='string val'>'--output OUTPUT'</span><span class='comma token'>,</span> <span class='string val'>'Output directory to install timeline into.'</span><span class='rparen token'>)</span> <span class='rubyid_do do kw'>do</span> <span class='bit [...]
+ <span class='rubyid_ at options ivar id'>@options</span><span class='lbrack token'>[</span><span class='symbol val'>:output</span><span class='rbrack token'>]</span> <span class='assign token'>=</span> <span class='rubyid_o identifier id'>o</span>
+ <span class='rubyid_end end kw'>end</span>
+ <span class='rubyid_opts identifier id'>opts</span><span class='dot token'>.</span><span class='rubyid_on identifier id'>on</span><span class='lparen token'>(</span><span class='string val'>'-a'</span><span class='comma token'>,</span> <span class='string val'>'--without-assets'</span><span class='comma token'>,</span> <span class='string val'>'Output timeline without supporting assets'</span><span class='rparen token'>)</span> <span class='rubyid_do do kw'>do</span> <span class='bit [...]
+ <span class='rubyid_ at options ivar id'>@options</span><span class='lbrack token'>[</span><span class='symbol val'>:no_assets</span><span class='rbrack token'>]</span> <span class='assign token'>=</span> <span class='rubyid_a identifier id'>a</span>
+ <span class='rubyid_end end kw'>end</span>
+ <span class='rubyid_opts identifier id'>opts</span><span class='dot token'>.</span><span class='rubyid_on identifier id'>on</span><span class='lparen token'>(</span><span class='string val'>'-O'</span><span class='comma token'>,</span> <span class='string val'>'--open'</span><span class='comma token'>,</span> <span class='string val'>'Open generated timeline in a browser'</span><span class='rparen token'>)</span> <span class='rubyid_do do kw'>do</span> <span class='bitor op'>|</span> [...]
+ <span class='rubyid_ at options ivar id'>@options</span><span class='lbrack token'>[</span><span class='symbol val'>:open</span><span class='rbrack token'>]</span> <span class='assign token'>=</span> <span class='rubyid_o identifier id'>o</span>
+ <span class='rubyid_end end kw'>end</span>
+ <span class='rubyid_opts identifier id'>opts</span><span class='dot token'>.</span><span class='rubyid_on identifier id'>on</span><span class='lparen token'>(</span><span class='string val'>'-m'</span><span class='comma token'>,</span> <span class='string val'>'--min'</span><span class='comma token'>,</span> <span class='string val'>'Create a minified one-page version of the timeline'</span><span class='rparen token'>)</span> <span class='rubyid_do do kw'>do</span> <span class='bitor [...]
+ <span class='rubyid_ at options ivar id'>@options</span><span class='lbrack token'>[</span><span class='symbol val'>:min</span><span class='rbrack token'>]</span> <span class='assign token'>=</span> <span class='rubyid_m identifier id'>m</span>
+ <span class='rubyid_end end kw'>end</span>
+ <span class='rubyid_opts identifier id'>opts</span><span class='dot token'>.</span><span class='rubyid_on identifier id'>on</span><span class='lparen token'>(</span><span class='string val'>'-i'</span><span class='comma token'>,</span> <span class='string val'>'--interval INTERVAL'</span><span class='comma token'>,</span> <span class='string val'>'Override automatic interval notches with a custom interval.'</span><span class='rparen token'>)</span> <span class='rubyid_do do kw'>do</s [...]
+ <span class='rubyid_ at options ivar id'>@options</span><span class='lbrack token'>[</span><span class='symbol val'>:interval</span><span class='rbrack token'>]</span> <span class='assign token'>=</span> <span class='rubyid_i identifier id'>i</span>
+ <span class='rubyid_end end kw'>end</span>
+
+
+ <span class='rubyid_opts identifier id'>opts</span><span class='dot token'>.</span><span class='rubyid_on_tail identifier id'>on_tail</span><span class='lparen token'>(</span><span class='string val'>"-h"</span><span class='comma token'>,</span> <span class='string val'>"--help"</span><span class='comma token'>,</span> <span class='string val'>"Show this message"</span><span class='rparen token'>)</span> <span class='rubyid_do do kw'>do</span>
+ <span class='rubyid_puts identifier id'>puts</span> <span class='rubyid_opts identifier id'>opts</span>
+ <span class='rubyid_exit identifier id'>exit</span>
+ <span class='rubyid_end end kw'>end</span>
+ <span class='rubyid_end end kw'>end</span>
+ <span class='rubyid_option_parser identifier id'>option_parser</span><span class='dot token'>.</span><span class='rubyid_parse! fid id'>parse!</span>
+
+ <span class='rubyid_if if kw'>if</span> <span class='rubyid_ at options ivar id'>@options</span><span class='dot token'>.</span><span class='rubyid_empty? fid id'>empty?</span>
+ <span class='rubyid_puts identifier id'>puts</span> <span class='rubyid_option_parser identifier id'>option_parser</span><span class='dot token'>.</span><span class='rubyid_on_tail identifier id'>on_tail</span>
+ <span class='rubyid_exit identifier id'>exit</span>
+ <span class='rubyid_else else kw'>else</span>
+ <span class='rubyid_compile! fid id'>compile!</span>
+ <span class='rubyid_end end kw'>end</span>
+<span class='rubyid_end end kw'>end</span>
+</pre>
+ </td>
+ </tr>
+</table>
+</div>
+
+ <div class="method_details ">
+ <h3 class="signature " id="sheet-instance_method">
+
+ - (<tt>Object</tt>) <strong>sheet</strong>
+
+
+
+
+
+</h3><table class="source_code">
+ <tr>
+ <td>
+ <pre class="lines">
+
+
+55
+56
+57</pre>
+ </td>
+ <td>
+ <pre class="code"><span class="info file"># File 'lib/timeline_setter/cli.rb', line 55</span>
+
+<span class='rubyid_def def kw'>def</span> <span class='rubyid_sheet identifier id'>sheet</span>
+ <span class='rubyid_File constant id'>File</span><span class='dot token'>.</span><span class='rubyid_open identifier id'>open</span><span class='lparen token'>(</span><span class='rubyid_ at options ivar id'>@options</span><span class='lbrack token'>[</span><span class='symbol val'>:csv</span><span class='rbrack token'>]</span><span class='rparen token'>)</span><span class='dot token'>.</span><span class='rubyid_read identifier id'>read</span>
+<span class='rubyid_end end kw'>end</span>
+</pre>
+ </td>
+ </tr>
+</table>
+</div>
+
+ <div class="method_details ">
+ <h3 class="signature " id="timeline_page_path-instance_method">
+
+ - (<tt>Object</tt>) <strong>timeline_page_path</strong>
+
+
+
+
+
+</h3><table class="source_code">
+ <tr>
+ <td>
+ <pre class="lines">
+
+
+74
+75
+76</pre>
+ </td>
+ <td>
+ <pre class="code"><span class="info file"># File 'lib/timeline_setter/cli.rb', line 74</span>
+
+<span class='rubyid_def def kw'>def</span> <span class='rubyid_timeline_page_path identifier id'>timeline_page_path</span>
+ <span class='rubyid_File constant id'>File</span><span class='dot token'>.</span><span class='rubyid_join identifier id'>join</span><span class='lparen token'>(</span><span class='rubyid_outdir identifier id'>outdir</span><span class='comma token'>,</span> <span class='string val'>'timeline.html'</span><span class='rparen token'>)</span>
+<span class='rubyid_end end kw'>end</span>
+</pre>
+ </td>
+ </tr>
+</table>
+</div>
+
+ </div>
+
+</div>
+
+ <div id="footer">
+ Generated on Thu Feb 21 11:20:30 2013 by
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
+ 0.8.4.1 (ruby-1.8.7).
+</div>
+
+ </body>
+</html>
\ No newline at end of file
diff --git a/documentation/TimelineSetter/Parser.html b/documentation/TimelineSetter/Parser.html
new file mode 100644
index 0000000..40c5c42
--- /dev/null
+++ b/documentation/TimelineSetter/Parser.html
@@ -0,0 +1,313 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+<title>
+ Class: TimelineSetter::Parser
+
+ — Documentation by YARD 0.8.4.1
+
+</title>
+
+ <link rel="stylesheet" href="../css/style.css" type="text/css" media="screen" charset="utf-8" />
+
+ <link rel="stylesheet" href="../css/common.css" type="text/css" media="screen" charset="utf-8" />
+
+<script type="text/javascript" charset="utf-8">
+ hasFrames = window.top.frames.main ? true : false;
+ relpath = '../';
+ framesUrl = "../frames.html#!" + escape(window.location.href);
+</script>
+
+
+ <script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
+
+ <script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
+
+
+ </head>
+ <body>
+ <div id="header">
+ <div id="menu">
+
+ <a href="../_index.html">Index (P)</a> »
+ <span class='title'><span class='object_link'><a href="../TimelineSetter.html" title="TimelineSetter (module)">TimelineSetter</a></span></span>
+ »
+ <span class="title">Parser</span>
+
+
+ <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
+</div>
+
+ <div id="search">
+
+ <a class="full_list_link" id="class_list_link"
+ href="../class_list.html">
+ Class List
+ </a>
+
+ <a class="full_list_link" id="method_list_link"
+ href="../method_list.html">
+ Method List
+ </a>
+
+ <a class="full_list_link" id="file_list_link"
+ href="../file_list.html">
+ File List
+ </a>
+
+</div>
+ <div class="clear"></div>
+ </div>
+
+ <iframe id="search_frame"></iframe>
+
+ <div id="content"><h1>Class: TimelineSetter::Parser
+
+
+
+</h1>
+
+<dl class="box">
+
+ <dt class="r1">Inherits:</dt>
+ <dd class="r1">
+ <span class="inheritName">Object</span>
+
+ <ul class="fullTree">
+ <li>Object</li>
+
+ <li class="next">TimelineSetter::Parser</li>
+
+ </ul>
+ <a href="#" class="inheritanceTree">show all</a>
+
+ </dd>
+
+
+
+
+
+
+
+
+
+ <dt class="r2 last">Defined in:</dt>
+ <dd class="r2 last">lib/timeline_setter/parser.rb</dd>
+
+</dl>
+<div class="clear"></div>
+
+
+
+
+
+ <h2>Instance Attribute Summary <small>(<a href="#" class="summary_toggle">collapse</a>)</small></h2>
+ <ul class="summary">
+
+ <li class="public ">
+ <span class="summary_signature">
+
+ <a href="#events-instance_method" title="#events (instance method)">- (Object) <strong>events</strong> </a>
+
+
+
+ </span>
+
+
+
+
+ <span class="note title readonly">readonly</span>
+
+
+
+
+
+
+
+
+
+ <span class="summary_desc"><div class='inline'>
+<p>Returns the value of attribute events.</p>
+</div></span>
+
+</li>
+
+
+ </ul>
+
+
+
+
+
+ <h2>
+ Instance Method Summary
+ <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
+ </h2>
+
+ <ul class="summary">
+
+ <li class="public ">
+ <span class="summary_signature">
+
+ <a href="#initialize-instance_method" title="#initialize (instance method)">- (Parser) <strong>initialize</strong>(sheet) </a>
+
+
+
+ </span>
+
+
+ <span class="note title constructor">constructor</span>
+
+
+
+
+
+
+
+
+ <span class="summary_desc"><div class='inline'>
+<p>Initialize a new timeline from a CSV file via TableFu, add a hash for each
+row (event) in the sheet to an events array.</p>
+</div></span>
+
+</li>
+
+
+ </ul>
+
+
+<div id="constructor_details" class="method_details_list">
+ <h2>Constructor Details</h2>
+
+ <div class="method_details first">
+ <h3 class="signature first" id="initialize-instance_method">
+
+ - (<tt><span class='object_link'><a href="" title="TimelineSetter::Parser (class)">Parser</a></span></tt>) <strong>initialize</strong>(sheet)
+
+
+
+
+
+</h3><div class="docstring">
+ <div class="discussion">
+
+<p>Initialize a new timeline from a CSV file via TableFu, add a hash for each
+row (event) in the sheet to an events array. Sheet should contain columns
+for</p>
+
+<pre class="code ruby18"><code class="ruby18">* date
+* display_date
+* description
+* link
+* thumbnail
+* series
+* html</code></pre>
+
+
+ </div>
+</div>
+<div class="tags">
+
+
+</div><table class="source_code">
+ <tr>
+ <td>
+ <pre class="lines">
+
+
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26</pre>
+ </td>
+ <td>
+ <pre class="code"><span class="info file"># File 'lib/timeline_setter/parser.rb', line 16</span>
+
+<span class='rubyid_def def kw'>def</span> <span class='rubyid_initialize identifier id'>initialize</span><span class='lparen token'>(</span><span class='rubyid_sheet identifier id'>sheet</span><span class='rparen token'>)</span>
+ <span class='rubyid_ at events ivar id'>@events</span> <span class='assign token'>=</span> <span class='lbrack token'>[</span><span class='rbrack token'>]</span>
+ <span class='rubyid_spreadsheet identifier id'>spreadsheet</span> <span class='assign token'>=</span> <span class='rubyid_TableFu constant id'>TableFu</span><span class='dot token'>.</span><span class='rubyid_new identifier id'>new</span><span class='lparen token'>(</span><span class='rubyid_sheet identifier id'>sheet</span><span class='rparen token'>)</span> <span class='rubyid_do do kw'>do</span> <span class='bitor op'>|</span><span class='rubyid_s identifier id'>s</span><span class= [...]
+ <span class='rubyid_s identifier id'>s</span><span class='dot token'>.</span><span class='rubyid_columns identifier id'>columns</span> <span class='assign token'>=</span> <span class='dstring node'>%w[date display_date description link series html]</span>
+ <span class='rubyid_end end kw'>end</span>
+
+ <span class='rubyid_spreadsheet identifier id'>spreadsheet</span><span class='dot token'>.</span><span class='rubyid_rows identifier id'>rows</span><span class='dot token'>.</span><span class='rubyid_each identifier id'>each</span> <span class='rubyid_do do kw'>do</span> <span class='bitor op'>|</span><span class='rubyid_row identifier id'>row</span><span class='bitor op'>|</span>
+ <span class='rubyid_hash identifier id'>hash</span> <span class='assign token'>=</span> <span class='rubyid_spreadsheet identifier id'>spreadsheet</span><span class='dot token'>.</span><span class='rubyid_columns identifier id'>columns</span><span class='dot token'>.</span><span class='rubyid_inject identifier id'>inject</span><span class='lparen token'>(</span><span class='lbrace token'>{</span><span class='rbrace token'>}</span><span class='rparen token'>)</span> <span class='lbrac [...]
+ <span class='rubyid_ at events ivar id'>@events</span> <span class='lshft op'><<</span> <span class='rubyid_hash identifier id'>hash</span>
+ <span class='rubyid_end end kw'>end</span>
+<span class='rubyid_end end kw'>end</span>
+</pre>
+ </td>
+ </tr>
+</table>
+</div>
+
+</div>
+
+ <div id="instance_attr_details" class="attr_details">
+ <h2>Instance Attribute Details</h2>
+
+
+ <span id=""></span>
+ <div class="method_details first">
+ <h3 class="signature first" id="events-instance_method">
+
+ - (<tt>Object</tt>) <strong>events</strong> <span class="extras">(readonly)</span>
+
+
+
+
+
+</h3><div class="docstring">
+ <div class="discussion">
+
+<p>Returns the value of attribute events</p>
+
+
+ </div>
+</div>
+<div class="tags">
+
+
+</div><table class="source_code">
+ <tr>
+ <td>
+ <pre class="lines">
+
+
+3
+4
+5</pre>
+ </td>
+ <td>
+ <pre class="code"><span class="info file"># File 'lib/timeline_setter/parser.rb', line 3</span>
+
+<span class='rubyid_def def kw'>def</span> <span class='rubyid_events identifier id'>events</span>
+ <span class='rubyid_ at events ivar id'>@events</span>
+<span class='rubyid_end end kw'>end</span>
+</pre>
+ </td>
+ </tr>
+</table>
+</div>
+
+ </div>
+
+
+</div>
+
+ <div id="footer">
+ Generated on Thu Feb 21 11:20:31 2013 by
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
+ 0.8.4.1 (ruby-1.8.7).
+</div>
+
+ </body>
+</html>
\ No newline at end of file
diff --git a/documentation/TimelineSetter/Timeline.html b/documentation/TimelineSetter/Timeline.html
new file mode 100644
index 0000000..b744e81
--- /dev/null
+++ b/documentation/TimelineSetter/Timeline.html
@@ -0,0 +1,613 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+<title>
+ Class: TimelineSetter::Timeline
+
+ — Documentation by YARD 0.8.4.1
+
+</title>
+
+ <link rel="stylesheet" href="../css/style.css" type="text/css" media="screen" charset="utf-8" />
+
+ <link rel="stylesheet" href="../css/common.css" type="text/css" media="screen" charset="utf-8" />
+
+<script type="text/javascript" charset="utf-8">
+ hasFrames = window.top.frames.main ? true : false;
+ relpath = '../';
+ framesUrl = "../frames.html#!" + escape(window.location.href);
+</script>
+
+
+ <script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
+
+ <script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
+
+
+ </head>
+ <body>
+ <div id="header">
+ <div id="menu">
+
+ <a href="../_index.html">Index (T)</a> »
+ <span class='title'><span class='object_link'><a href="../TimelineSetter.html" title="TimelineSetter (module)">TimelineSetter</a></span></span>
+ »
+ <span class="title">Timeline</span>
+
+
+ <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
+</div>
+
+ <div id="search">
+
+ <a class="full_list_link" id="class_list_link"
+ href="../class_list.html">
+ Class List
+ </a>
+
+ <a class="full_list_link" id="method_list_link"
+ href="../method_list.html">
+ Method List
+ </a>
+
+ <a class="full_list_link" id="file_list_link"
+ href="../file_list.html">
+ File List
+ </a>
+
+</div>
+ <div class="clear"></div>
+ </div>
+
+ <iframe id="search_frame"></iframe>
+
+ <div id="content"><h1>Class: TimelineSetter::Timeline
+
+
+
+</h1>
+
+<dl class="box">
+
+ <dt class="r1">Inherits:</dt>
+ <dd class="r1">
+ <span class="inheritName">Object</span>
+
+ <ul class="fullTree">
+ <li>Object</li>
+
+ <li class="next">TimelineSetter::Timeline</li>
+
+ </ul>
+ <a href="#" class="inheritanceTree">show all</a>
+
+ </dd>
+
+
+
+
+
+
+
+
+
+ <dt class="r2 last">Defined in:</dt>
+ <dd class="r2 last">lib/timeline_setter/timeline.rb</dd>
+
+</dl>
+<div class="clear"></div>
+
+
+
+
+
+ <h2>Instance Attribute Summary <small>(<a href="#" class="summary_toggle">collapse</a>)</small></h2>
+ <ul class="summary">
+
+ <li class="public ">
+ <span class="summary_signature">
+
+ <a href="#timeline-instance_method" title="#timeline (instance method)">- (Object) <strong>timeline</strong> </a>
+
+
+
+ </span>
+
+
+
+
+ <span class="note title readonly">readonly</span>
+
+
+
+
+
+
+
+
+
+ <span class="summary_desc"><div class='inline'>
+<p>Create timeline HTML by interpolating events hash into an ERB template.</p>
+</div></span>
+
+</li>
+
+
+ </ul>
+
+
+
+
+
+ <h2>
+ Instance Method Summary
+ <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
+ </h2>
+
+ <ul class="summary">
+
+ <li class="public ">
+ <span class="summary_signature">
+
+ <a href="#config_json-instance_method" title="#config_json (instance method)">- (Object) <strong>config_json</strong> </a>
+
+
+
+ </span>
+
+
+
+
+
+
+
+
+
+ <span class="summary_desc"><div class='inline'></div></span>
+
+</li>
+
+
+ <li class="public ">
+ <span class="summary_signature">
+
+ <a href="#initialize-instance_method" title="#initialize (instance method)">- (Timeline) <strong>initialize</strong>(opts = {}) </a>
+
+
+
+ </span>
+
+
+ <span class="note title constructor">constructor</span>
+
+
+
+
+
+
+
+
+ <span class="summary_desc"><div class='inline'>
+<p>Instantiate a new timeline from an events array created in
+Parser#initialize.</p>
+</div></span>
+
+</li>
+
+
+ <li class="public ">
+ <span class="summary_signature">
+
+ <a href="#timeline_markup-instance_method" title="#timeline_markup (instance method)">- (Object) <strong>timeline_markup</strong> </a>
+
+
+
+ </span>
+
+
+
+
+
+
+
+
+
+ <span class="summary_desc"><div class='inline'></div></span>
+
+</li>
+
+
+ <li class="public ">
+ <span class="summary_signature">
+
+ <a href="#timeline_min-instance_method" title="#timeline_min (instance method)">- (Object) <strong>timeline_min</strong> </a>
+
+
+
+ </span>
+
+
+
+
+
+
+
+
+
+ <span class="summary_desc"><div class='inline'>
+<p>Create a minified one-page version of a timeline by minifying CSS and JS
+and embedding all assets into our ERB template.</p>
+</div></span>
+
+</li>
+
+
+ <li class="public ">
+ <span class="summary_signature">
+
+ <a href="#tmpl-instance_method" title="#tmpl (instance method)">- (Object) <strong>tmpl</strong>(tmpl_file) </a>
+
+
+
+ </span>
+
+
+
+
+
+
+
+
+
+ <span class="summary_desc"><div class='inline'></div></span>
+
+</li>
+
+
+ <li class="public ">
+ <span class="summary_signature">
+
+ <a href="#to_json-instance_method" title="#to_json (instance method)">- (Object) <strong>to_json</strong> </a>
+
+
+
+ </span>
+
+
+
+
+
+
+
+
+
+ <span class="summary_desc"><div class='inline'>
+<p>Convert human dates to timestamps, sort the hash by timestamp, and convert
+the events hash to JSON to stick into our HTML.</p>
+</div></span>
+
+</li>
+
+
+ </ul>
+
+
+<div id="constructor_details" class="method_details_list">
+ <h2>Constructor Details</h2>
+
+ <div class="method_details first">
+ <h3 class="signature first" id="initialize-instance_method">
+
+ - (<tt><span class='object_link'><a href="" title="TimelineSetter::Timeline (class)">Timeline</a></span></tt>) <strong>initialize</strong>(opts = {})
+
+
+
+
+
+</h3><div class="docstring">
+ <div class="discussion">
+
+<p>Instantiate a new timeline from an events array created in
+Parser#initialize</p>
+
+
+ </div>
+</div>
+<div class="tags">
+
+
+</div><table class="source_code">
+ <tr>
+ <td>
+ <pre class="lines">
+
+
+6
+7
+8
+9</pre>
+ </td>
+ <td>
+ <pre class="code"><span class="info file"># File 'lib/timeline_setter/timeline.rb', line 6</span>
+
+<span class='rubyid_def def kw'>def</span> <span class='rubyid_initialize identifier id'>initialize</span><span class='lparen token'>(</span><span class='rubyid_opts identifier id'>opts</span> <span class='assign token'>=</span> <span class='lbrace token'>{</span><span class='rbrace token'>}</span><span class='rparen token'>)</span>
+ <span class='rubyid_ at events ivar id'>@events</span> <span class='assign token'>=</span> <span class='rubyid_opts identifier id'>opts</span><span class='lbrack token'>[</span><span class='symbol val'>:events</span><span class='rbrack token'>]</span>
+ <span class='rubyid_ at interval ivar id'>@interval</span> <span class='assign token'>=</span> <span class='rubyid_opts identifier id'>opts</span><span class='lbrack token'>[</span><span class='symbol val'>:interval</span><span class='rbrack token'>]</span> <span class='orop op'>||</span> <span class='string val'>''</span>
+<span class='rubyid_end end kw'>end</span>
+</pre>
+ </td>
+ </tr>
+</table>
+</div>
+
+</div>
+
+ <div id="instance_attr_details" class="attr_details">
+ <h2>Instance Attribute Details</h2>
+
+
+ <span id=""></span>
+ <div class="method_details first">
+ <h3 class="signature first" id="timeline-instance_method">
+
+ - (<tt>Object</tt>) <strong>timeline</strong> <span class="extras">(readonly)</span>
+
+
+
+
+
+</h3><div class="docstring">
+ <div class="discussion">
+
+<p>Create timeline HTML by interpolating events hash into an ERB template.
+Re-template timeline by editing ../templates/timeline.erb This version
+preserves external links to CSS and JS.</p>
+
+
+ </div>
+</div>
+<div class="tags">
+
+
+</div><table class="source_code">
+ <tr>
+ <td>
+ <pre class="lines">
+
+
+32
+33
+34</pre>
+ </td>
+ <td>
+ <pre class="code"><span class="info file"># File 'lib/timeline_setter/timeline.rb', line 32</span>
+
+<span class='rubyid_def def kw'>def</span> <span class='rubyid_timeline identifier id'>timeline</span>
+ <span class='rubyid_ at timeline ivar id'>@timeline</span>
+<span class='rubyid_end end kw'>end</span>
+</pre>
+ </td>
+ </tr>
+</table>
+</div>
+
+ </div>
+
+
+ <div id="instance_method_details" class="method_details_list">
+ <h2>Instance Method Details</h2>
+
+
+ <div class="method_details first">
+ <h3 class="signature first" id="config_json-instance_method">
+
+ - (<tt>Object</tt>) <strong>config_json</strong>
+
+
+
+
+
+</h3><table class="source_code">
+ <tr>
+ <td>
+ <pre class="lines">
+
+
+18
+19
+20
+21
+22
+23</pre>
+ </td>
+ <td>
+ <pre class="code"><span class="info file"># File 'lib/timeline_setter/timeline.rb', line 18</span>
+
+<span class='rubyid_def def kw'>def</span> <span class='rubyid_config_json identifier id'>config_json</span>
+ <span class='lbrace token'>{</span>
+ <span class='string val'>"interval"</span> <span class='assign token'>=</span><span class='gt op'>></span> <span class='dstring node'>"#{@interval}"</span><span class='comma token'>,</span>
+ <span class='string val'>"container"</span> <span class='assign token'>=</span><span class='gt op'>></span> <span class='string val'>"#timeline"</span>
+ <span class='rbrace token'>}</span><span class='dot token'>.</span><span class='rubyid_to_json identifier id'>to_json</span>
+<span class='rubyid_end end kw'>end</span>
+</pre>
+ </td>
+ </tr>
+</table>
+</div>
+
+ <div class="method_details ">
+ <h3 class="signature " id="timeline_markup-instance_method">
+
+ - (<tt>Object</tt>) <strong>timeline_markup</strong>
+
+
+
+
+
+</h3><table class="source_code">
+ <tr>
+ <td>
+ <pre class="lines">
+
+
+25
+26
+27</pre>
+ </td>
+ <td>
+ <pre class="code"><span class="info file"># File 'lib/timeline_setter/timeline.rb', line 25</span>
+
+<span class='rubyid_def def kw'>def</span> <span class='rubyid_timeline_markup identifier id'>timeline_markup</span>
+ <span class='rubyid_tmpl identifier id'>tmpl</span><span class='lparen token'>(</span><span class='string val'>"timeline-markup.erb"</span><span class='rparen token'>)</span>
+<span class='rubyid_end end kw'>end</span>
+</pre>
+ </td>
+ </tr>
+</table>
+</div>
+
+ <div class="method_details ">
+ <h3 class="signature " id="timeline_min-instance_method">
+
+ - (<tt>Object</tt>) <strong>timeline_min</strong>
+
+
+
+
+
+</h3><div class="docstring">
+ <div class="discussion">
+
+<p>Create a minified one-page version of a timeline by minifying CSS and JS
+and embedding all assets into our ERB template.</p>
+
+
+ </div>
+</div>
+<div class="tags">
+
+
+</div><table class="source_code">
+ <tr>
+ <td>
+ <pre class="lines">
+
+
+38
+39
+40
+41
+42
+43
+44
+45
+46</pre>
+ </td>
+ <td>
+ <pre class="code"><span class="info file"># File 'lib/timeline_setter/timeline.rb', line 38</span>
+
+<span class='rubyid_def def kw'>def</span> <span class='rubyid_timeline_min identifier id'>timeline_min</span>
+ <span class='rubyid_ at js ivar id'>@js</span> <span class='assign token'>=</span> <span class='string val'>""</span>
+ <span class='rubyid_ at css ivar id'>@css</span> <span class='assign token'>=</span> <span class='rubyid_Kompress constant id'>Kompress</span><span class='colon2 op'>::</span><span class='rubyid_CSS constant id'>CSS</span><span class='dot token'>.</span><span class='rubyid_new identifier id'>new</span><span class='lparen token'>(</span><span class='rubyid_File constant id'>File</span><span class='dot token'>.</span><span class='rubyid_open identifier id'>open</span><span class='lparen tok [...]
+ <span class='rubyid_libs identifier id'>libs</span> <span class='assign token'>=</span> <span class='rubyid_Dir constant id'>Dir</span><span class='dot token'>.</span><span class='rubyid_glob identifier id'>glob</span><span class='lparen token'>(</span><span class='dstring node'>"#{TimelineSetter::ROOT}/public/javascripts/vendor/**"</span><span class='rparen token'>)</span><span class='dot token'>.</span><span class='rubyid_select identifier id'>select</span> <span class='lbr [...]
+ <span class='rubyid_libs identifier id'>libs</span><span class='dot token'>.</span><span class='rubyid_each identifier id'>each</span> <span class='lbrace token'>{</span> <span class='bitor op'>|</span><span class='rubyid_lib identifier id'>lib</span><span class='bitor op'>|</span> <span class='rubyid_ at js ivar id'>@js</span> <span class='lshft op'><<</span> <span class='rubyid_File constant id'>File</span><span class='dot token'>.</span><span class='rubyid_open identifier id'>ope [...]
+ <span class='rubyid_ at min_html ivar id'>@min_html</span> <span class='assign token'>=</span> <span class='rubyid_Kompress constant id'>Kompress</span><span class='colon2 op'>::</span><span class='rubyid_HTML constant id'>HTML</span><span class='dot token'>.</span><span class='rubyid_new identifier id'>new</span><span class='lparen token'>(</span><span class='rubyid_timeline_markup identifier id'>timeline_markup</span><span class='rparen token'>)</span><span class='dot token'>.</span><sp [...]
+ <span class='rubyid_ at js ivar id'>@js</span> <span class='lshft op'><<</span> <span class='rubyid_File constant id'>File</span><span class='dot token'>.</span><span class='rubyid_open identifier id'>open</span><span class='lparen token'>(</span><span class='dstring node'>"#{TimelineSetter::ROOT}/public/javascripts/timeline-setter.min.js"</span><span class='comma token'>,</span> <span class='string val'>'r'</span><span class='rparen token'>)</span><span class='dot token'> [...]
+ <span class='rubyid_ at timeline ivar id'>@timeline</span> <span class='assign token'>=</span> <span class='rubyid_tmpl identifier id'>tmpl</span><span class='lparen token'>(</span><span class='string val'>"timeline-min.erb"</span><span class='rparen token'>)</span>
+<span class='rubyid_end end kw'>end</span>
+</pre>
+ </td>
+ </tr>
+</table>
+</div>
+
+ <div class="method_details ">
+ <h3 class="signature " id="tmpl-instance_method">
+
+ - (<tt>Object</tt>) <strong>tmpl</strong>(tmpl_file)
+
+
+
+
+
+</h3><table class="source_code">
+ <tr>
+ <td>
+ <pre class="lines">
+
+
+48
+49
+50</pre>
+ </td>
+ <td>
+ <pre class="code"><span class="info file"># File 'lib/timeline_setter/timeline.rb', line 48</span>
+
+<span class='rubyid_def def kw'>def</span> <span class='rubyid_tmpl identifier id'>tmpl</span><span class='lparen token'>(</span><span class='rubyid_tmpl_file identifier id'>tmpl_file</span><span class='rparen token'>)</span>
+ <span class='rubyid_ERB constant id'>ERB</span><span class='dot token'>.</span><span class='rubyid_new identifier id'>new</span><span class='lparen token'>(</span><span class='rubyid_File constant id'>File</span><span class='dot token'>.</span><span class='rubyid_open identifier id'>open</span><span class='lparen token'>(</span><span class='dstring node'>"#{TimelineSetter::ROOT}/templates/#{tmpl_file}"</span><span class='rparen token'>)</span><span class='dot token'>.</span>< [...]
+<span class='rubyid_end end kw'>end</span>
+</pre>
+ </td>
+ </tr>
+</table>
+</div>
+
+ <div class="method_details ">
+ <h3 class="signature " id="to_json-instance_method">
+
+ - (<tt>Object</tt>) <strong>to_json</strong>
+
+
+
+
+
+</h3><div class="docstring">
+ <div class="discussion">
+
+<p>Convert human dates to timestamps, sort the hash by timestamp, and convert
+the events hash to JSON to stick into our HTML.</p>
+
+
+ </div>
+</div>
+<div class="tags">
+
+
+</div><table class="source_code">
+ <tr>
+ <td>
+ <pre class="lines">
+
+
+13
+14
+15
+16</pre>
+ </td>
+ <td>
+ <pre class="code"><span class="info file"># File 'lib/timeline_setter/timeline.rb', line 13</span>
+
+<span class='rubyid_def def kw'>def</span> <span class='rubyid_to_json identifier id'>to_json</span>
+ <span class='rubyid_ at events ivar id'>@events</span><span class='dot token'>.</span><span class='rubyid_each identifier id'>each</span> <span class='lbrace token'>{</span><span class='bitor op'>|</span><span class='rubyid_r identifier id'>r</span><span class='bitor op'>|</span> <span class='rubyid_r identifier id'>r</span><span class='lbrack token'>[</span><span class='symbol val'>:timestamp</span><span class='rbrack token'>]</span> <span class='assign token'>=</span> <span class='rubyi [...]
+ <span class='rubyid_ at events ivar id'>@events</span><span class='dot token'>.</span><span class='rubyid_to_json identifier id'>to_json</span>
+<span class='rubyid_end end kw'>end</span>
+</pre>
+ </td>
+ </tr>
+</table>
+</div>
+
+ </div>
+
+</div>
+
+ <div id="footer">
+ Generated on Thu Feb 21 11:20:31 2013 by
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
+ 0.8.4.1 (ruby-1.8.7).
+</div>
+
+ </body>
+</html>
\ No newline at end of file
diff --git a/documentation/TimelineSetter/Util.html b/documentation/TimelineSetter/Util.html
new file mode 100644
index 0000000..38f9d48
--- /dev/null
+++ b/documentation/TimelineSetter/Util.html
@@ -0,0 +1,246 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+<title>Module: TimelineSetter::Util</title>
+<link rel="stylesheet" href="../css/style.css" type="text/css" media="screen" charset="utf-8" />
+<link rel="stylesheet" href="../css/common.css" type="text/css" media="screen" charset="utf-8" />
+
+<script type="text/javascript" charset="utf-8">
+ relpath = '..';
+ if (relpath != '') relpath += '/';
+</script>
+<script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
+<script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
+
+ </head>
+ <body>
+ <script type="text/javascript" charset="utf-8">
+ if (window.top.frames.main) document.body.className = 'frames';
+ </script>
+
+ <div id="header">
+ <div id="menu">
+
+ <a href="../_index.html">Index (U)</a> »
+ <span class='title'><span class='object_link'><a href="../TimelineSetter.html" title="TimelineSetter (module)">TimelineSetter</a></span></span>
+ »
+ <span class="title">Util</span>
+
+
+ <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
+</div>
+
+ <div id="search">
+ <a id="class_list_link" href="#">Class List</a>
+ <a id="method_list_link" href="#">Method List</a>
+ <a id ="file_list_link" href="#">File List</a>
+</div>
+
+ <div class="clear"></div>
+ </div>
+
+ <iframe id="search_frame"></iframe>
+
+ <div id="content"><h1>Module: TimelineSetter::Util
+
+
+
+</h1>
+
+<dl class="box">
+
+
+
+
+
+
+
+ <dt class="r1">Included in:</dt>
+ <dd class="r1"><span class='object_link'><a href="Timeline.html" title="TimelineSetter::Timeline (class)">Timeline</a></span></dd>
+
+
+
+ <dt class="r2 last">Defined in:</dt>
+ <dd class="r2 last">lib/timeline_setter/util.rb</dd>
+
+</dl>
+<div class="clear"></div>
+
+
+
+
+
+ <h2>
+ Instance Method Summary
+ <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
+ </h2>
+
+ <ul class="summary">
+
+ <li class="public ">
+ <span class="summary_signature">
+
+ <a href="#minify_css-instance_method" title="#minify_css (instance method)">- (Object) <strong>minify_css</strong>(css) </a>
+
+
+
+ </span>
+
+
+
+
+
+
+
+
+ <span class="summary_desc"><div class='inline'><p>
+Utility method to lightly minify CSS — just remove \s+ where we can.
+</p>
+</div></span>
+
+</li>
+
+
+ <li class="public ">
+ <span class="summary_signature">
+
+ <a href="#minify_html-instance_method" title="#minify_html (instance method)">- (Object) <strong>minify_html</strong>(html) </a>
+
+
+
+ </span>
+
+
+
+
+
+
+
+
+ <span class="summary_desc"><div class='inline'></div></span>
+
+</li>
+
+
+ </ul>
+
+
+
+
+ <div id="instance_method_details" class="method_details_list">
+ <h2>Instance Method Details</h2>
+
+
+ <div class="method_details first">
+ <p class="signature first" id="minify_css-instance_method">
+
+ - (<tt>Object</tt>) <strong>minify_css</strong>(css)
+
+
+
+</p><div class="docstring">
+ <div class="discussion">
+ <p>
+Utility method to lightly minify CSS — just remove \s+ where we can.
+</p>
+
+
+ </div>
+</div>
+<div class="tags">
+
+</div><table class="source_code">
+ <tr>
+ <td>
+ <pre class="lines">
+
+
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22</pre>
+ </td>
+ <td>
+ <pre class="code"><span class="info file"># File 'lib/timeline_setter/util.rb', line 5</span>
+
+<span class='def def kw'>def</span> <span class='minify_css identifier id'>minify_css</span><span class='lparen token'>(</span><span class='css identifier id'>css</span><span class='rparen token'>)</span>
+ <span class='comment val'># take out new lines</span>
+ <span class='css identifier id'>css</span><span class='dot token'>.</span><span class='gsub! fid id'>gsub!</span><span class='lparen token'>(</span><span class='regexp val'>/\n/</span><span class='comma token'>,</span><span class='string val'>''</span><span class='rparen token'>)</span>
+
+ <span class='comment val'># take out spaces between selectors and rule blocks</span>
+ <span class='css identifier id'>css</span><span class='dot token'>.</span><span class='gsub! fid id'>gsub!</span><span class='lparen token'>(</span><span class='regexp val'>/([\.a-zA-Z_\-\#]+?)\s*\{\s*([^\{\}\s])?/</span><span class='comma token'>,</span><span class='string val'>'\1{\2'</span><span class='rparen token'>)</span>
+
+ <span class='comment val'># take out spaces between rule block endings and selectors</span>
+ <span class='css identifier id'>css</span><span class='dot token'>.</span><span class='gsub! fid id'>gsub!</span><span class='lparen token'>(</span><span class='regexp val'>/\}\s*([\.a-zA-Z_\-\#]+?)/</span><span class='comma token'>,</span><span class='string val'>'}\1'</span><span class='rparen token'>)</span>
+
+ <span class='comment val'># take out spaces between rules</span>
+ <span class='css identifier id'>css</span><span class='dot token'>.</span><span class='gsub! fid id'>gsub!</span><span class='lparen token'>(</span><span class='regexp val'>/(:|;)(\s+)?([\.a-zA-Z_0-9]+)?/</span><span class='comma token'>,</span><span class='string val'>'\1\3'</span><span class='rparen token'>)</span>
+
+ <span class='comment val'># take out comments</span>
+ <span class='css identifier id'>css</span><span class='dot token'>.</span><span class='gsub! fid id'>gsub!</span><span class='lparen token'>(</span><span class='regexp val'>/(\/\*.*?\*\/)/</span><span class='comma token'>,</span><span class='string val'>' '</span><span class='rparen token'>)</span>
+
+ <span class='css identifier id'>css</span>
+<span class='end end kw'>end</span>
+</pre>
+ </td>
+ </tr>
+</table>
+</div>
+
+ <div class="method_details ">
+ <p class="signature " id="minify_html-instance_method">
+
+ - (<tt>Object</tt>) <strong>minify_html</strong>(html)
+
+
+
+</p><table class="source_code">
+ <tr>
+ <td>
+ <pre class="lines">
+
+
+24
+25
+26</pre>
+ </td>
+ <td>
+ <pre class="code"><span class="info file"># File 'lib/timeline_setter/util.rb', line 24</span>
+
+<span class='def def kw'>def</span> <span class='minify_html identifier id'>minify_html</span><span class='lparen token'>(</span><span class='html identifier id'>html</span><span class='rparen token'>)</span>
+ <span class='html identifier id'>html</span><span class='dot token'>.</span><span class='gsub identifier id'>gsub</span><span class='lparen token'>(</span><span class='regexp val'>/(?:^|\s+?)(<.*?>)/</span><span class='comma token'>,</span> <span class='string val'>'\1'</span><span class='rparen token'>)</span>
+<span class='end end kw'>end</span>
+</pre>
+ </td>
+ </tr>
+</table>
+</div>
+
+ </div>
+
+</div>
+
+ <div id="footer">
+ Generated on Thu Mar 31 16:14:15 2011 by
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
+ 0.6.5 (ruby-1.8.7).
+</div>
+
+ </body>
+</html>
\ No newline at end of file
diff --git a/documentation/_index.html b/documentation/_index.html
new file mode 100644
index 0000000..22b46b1
--- /dev/null
+++ b/documentation/_index.html
@@ -0,0 +1,147 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+<title>
+ Documentation by YARD 0.8.4.1
+
+</title>
+
+ <link rel="stylesheet" href="css/style.css" type="text/css" media="screen" charset="utf-8" />
+
+ <link rel="stylesheet" href="css/common.css" type="text/css" media="screen" charset="utf-8" />
+
+<script type="text/javascript" charset="utf-8">
+ hasFrames = window.top.frames.main ? true : false;
+ relpath = '';
+ framesUrl = "frames.html#!" + escape(window.location.href);
+</script>
+
+
+ <script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
+
+ <script type="text/javascript" charset="utf-8" src="js/app.js"></script>
+
+
+ </head>
+ <body>
+ <div id="header">
+ <div id="menu">
+
+
+ <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
+</div>
+
+ <div id="search">
+
+ <a class="full_list_link" id="class_list_link"
+ href="class_list.html">
+ Class List
+ </a>
+
+ <a class="full_list_link" id="method_list_link"
+ href="method_list.html">
+ Method List
+ </a>
+
+ <a class="full_list_link" id="file_list_link"
+ href="file_list.html">
+ File List
+ </a>
+
+</div>
+ <div class="clear"></div>
+ </div>
+
+ <iframe id="search_frame"></iframe>
+
+ <div id="content"><h1 class="noborder title">Documentation by YARD 0.8.4.1</h1>
+<div id="listing">
+ <h1 class="alphaindex">Alphabetic Index</h1>
+
+ <h2>File Listing</h2>
+ <ul id="files" class="index_inline_list">
+
+
+ <li class="r1"><a href="index.html" title="README">README</a></li>
+
+
+ </ul>
+
+<div class="clear"></div>
+<h2>Namespace Listing A-Z</h2>
+
+
+
+
+<table>
+ <tr>
+ <td valign='top' width="33%">
+
+
+ <ul id="alpha_C" class="alpha">
+ <li class="letter">C</li>
+ <ul>
+
+ <li>
+ <span class='object_link'><a href="TimelineSetter/CLI.html" title="TimelineSetter::CLI (class)">CLI</a></span>
+
+ <small>(TimelineSetter)</small>
+
+ </li>
+
+ </ul>
+ </ul>
+
+
+ <ul id="alpha_P" class="alpha">
+ <li class="letter">P</li>
+ <ul>
+
+ <li>
+ <span class='object_link'><a href="TimelineSetter/Parser.html" title="TimelineSetter::Parser (class)">Parser</a></span>
+
+ <small>(TimelineSetter)</small>
+
+ </li>
+
+ </ul>
+ </ul>
+
+
+ <ul id="alpha_T" class="alpha">
+ <li class="letter">T</li>
+ <ul>
+
+ <li>
+ <span class='object_link'><a href="TimelineSetter/Timeline.html" title="TimelineSetter::Timeline (class)">Timeline</a></span>
+
+ <small>(TimelineSetter)</small>
+
+ </li>
+
+ <li>
+ <span class='object_link'><a href="TimelineSetter.html" title="TimelineSetter (module)">TimelineSetter</a></span>
+
+ </li>
+
+ </ul>
+ </ul>
+
+ </td>
+ </tr>
+</table>
+
+</div>
+
+</div>
+
+ <div id="footer">
+ Generated on Thu Feb 21 11:20:30 2013 by
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
+ 0.8.4.1 (ruby-1.8.7).
+</div>
+
+ </body>
+</html>
\ No newline at end of file
diff --git a/documentation/class_list.html b/documentation/class_list.html
new file mode 100644
index 0000000..fa7dfef
--- /dev/null
+++ b/documentation/class_list.html
@@ -0,0 +1,53 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+
+ <link rel="stylesheet" href="css/full_list.css" type="text/css" media="screen" charset="utf-8" />
+
+ <link rel="stylesheet" href="css/common.css" type="text/css" media="screen" charset="utf-8" />
+
+
+
+ <script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
+
+ <script type="text/javascript" charset="utf-8" src="js/full_list.js"></script>
+
+
+ <base id="base_target" target="_parent" />
+ </head>
+ <body>
+ <script type="text/javascript" charset="utf-8">
+ if (window.top.frames.main) {
+ document.getElementById('base_target').target = 'main';
+ document.body.className = 'frames';
+ }
+ </script>
+ <div id="content">
+ <h1 id="full_list_header">Class List</h1>
+ <div id="nav">
+
+ <span><a target="_self" href="class_list.html">
+ Classes
+ </a></span>
+
+ <span><a target="_self" href="method_list.html">
+ Methods
+ </a></span>
+
+ <span><a target="_self" href="file_list.html">
+ Files
+ </a></span>
+
+ </div>
+ <div id="search">Search: <input type="text" /></div>
+
+ <ul id="full_list" class="class">
+ <li><span class='object_link'><a href="top-level-namespace.html" title=" (root)">Top Level Namespace</a></span></li>
+<li><a class='toggle'></a> <span class='object_link'><a href="TimelineSetter.html" title="TimelineSetter (module)">TimelineSetter</a></span><small class='search_info'>Top Level Namespace</small></li><ul><li><span class='object_link'><a href="TimelineSetter/CLI.html" title="TimelineSetter::CLI (class)">CLI</a></span> < Object<small class='search_info'>TimelineSetter</small></li><li><span class='object_link'><a href="TimelineSetter/Parser.html" title="TimelineSetter::Parser (class)">Par [...]
+
+ </ul>
+ </div>
+ </body>
+</html>
diff --git a/documentation/css/common.css b/documentation/css/common.css
new file mode 100644
index 0000000..cf25c45
--- /dev/null
+++ b/documentation/css/common.css
@@ -0,0 +1 @@
+/* Override this file with custom rules */
\ No newline at end of file
diff --git a/documentation/css/full_list.css b/documentation/css/full_list.css
new file mode 100644
index 0000000..c918cf1
--- /dev/null
+++ b/documentation/css/full_list.css
@@ -0,0 +1,57 @@
+body {
+ margin: 0;
+ font-family: "Lucida Sans", "Lucida Grande", Verdana, Arial, sans-serif;
+ font-size: 13px;
+ height: 101%;
+ overflow-x: hidden;
+}
+
+h1 { padding: 12px 10px; padding-bottom: 0; margin: 0; font-size: 1.4em; }
+.clear { clear: both; }
+#search { position: absolute; right: 5px; top: 9px; padding-left: 24px; }
+#content.insearch #search, #content.insearch #noresults { background: url(data:image/gif;base64,R0lGODlhEAAQAPYAAP///wAAAPr6+pKSkoiIiO7u7sjIyNjY2J6engAAAI6OjsbGxjIyMlJSUuzs7KamppSUlPLy8oKCghwcHLKysqSkpJqamvT09Pj4+KioqM7OzkRERAwMDGBgYN7e3ujo6Ly8vCoqKjY2NkZGRtTU1MTExDw8PE5OTj4+PkhISNDQ0MrKylpaWrS0tOrq6nBwcKysrLi4uLq6ul5eXlxcXGJiYoaGhuDg4H5+fvz8/KKiohgYGCwsLFZWVgQEBFBQUMzMzDg4OFhYWBoaGvDw8NbW1pycnOLi4ubm5kBAQKqqqiQkJCAgIK6urnJyckpKSjQ0NGpqatLS0sDAwCYmJnx8fEJCQlRUVAoKCggICLCwsOTk5ExMTPb29ra2 [...]
+#full_list { padding: 0; list-style: none; margin-left: 0; }
+#full_list ul { padding: 0; }
+#full_list li { padding: 5px; padding-left: 12px; margin: 0; font-size: 1.1em; list-style: none; }
+#noresults { padding: 7px 12px; }
+#content.insearch #noresults { margin-left: 7px; }
+ul.collapsed ul, ul.collapsed li { display: none; }
+ul.collapsed.search_uncollapsed { display: block; }
+ul.collapsed.search_uncollapsed li { display: list-item; }
+li a.toggle { cursor: default; position: relative; left: -5px; top: 4px; text-indent: -999px; width: 10px; height: 9px; margin-left: -10px; display: block; float: left; background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAASCAYAAABb0P4QAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAK8AAACvABQqw0mAAAABx0RVh0U29mdHdhcmUAQWRvYmUgRmlyZXdvcmtzIENTM5jWRgMAAAAVdEVYdENyZWF0aW9uIFRpbWUAMy8xNC8wOeNZPpQAAAE2SURBVDiNrZTBccIwEEXfelIAHUA6CZ24BGaWO+FuzZAK4k6gg5QAdGAq+Bxs2Yqx7BzyL7Llp/VfzZeQhCTc/ezuG [...]
+li.collapsed a.toggle { opacity: 0.5; cursor: default; background-position: top left; }
+li { color: #888; cursor: pointer; }
+li.deprecated { text-decoration: line-through; font-style: italic; }
+li.r1 { background: #f0f0f0; }
+li.r2 { background: #fafafa; }
+li:hover { background: #ddd; }
+li small:before { content: "("; }
+li small:after { content: ")"; }
+li small.search_info { display: none; }
+a:link, a:visited { text-decoration: none; color: #05a; }
+li.clicked { background: #05a; color: #ccc; }
+li.clicked a:link, li.clicked a:visited { color: #eee; }
+li.clicked a.toggle { opacity: 0.5; background-position: bottom right; }
+li.collapsed.clicked a.toggle { background-position: top right; }
+#search input { border: 1px solid #bbb; -moz-border-radius: 3px; -webkit-border-radius: 3px; }
+#nav { margin-left: 10px; font-size: 0.9em; display: none; color: #aaa; }
+#nav a:link, #nav a:visited { color: #358; }
+#nav a:hover { background: transparent; color: #5af; }
+.frames #nav span:after { content: ' | '; }
+.frames #nav span:last-child:after { content: ''; }
+
+.frames #content h1 { margin-top: 0; }
+.frames li { white-space: nowrap; cursor: normal; }
+.frames li small { display: block; font-size: 0.8em; }
+.frames li small:before { content: ""; }
+.frames li small:after { content: ""; }
+.frames li small.search_info { display: none; }
+.frames #search { width: 170px; position: static; margin: 3px; margin-left: 10px; font-size: 0.9em; color: #888; padding-left: 0; padding-right: 24px; }
+.frames #content.insearch #search { background-position: center right; }
+.frames #search input { width: 110px; }
+.frames #nav { display: block; }
+
+#full_list.insearch li { display: none; }
+#full_list.insearch li.found { display: list-item; padding-left: 10px; }
+#full_list.insearch li a.toggle { display: none; }
+#full_list.insearch li small.search_info { display: block; }
diff --git a/documentation/css/style.css b/documentation/css/style.css
new file mode 100644
index 0000000..ca54c2b
--- /dev/null
+++ b/documentation/css/style.css
@@ -0,0 +1,328 @@
+body {
+ padding: 0 20px;
+ font-family: "Lucida Sans", "Lucida Grande", Verdana, Arial, sans-serif;
+ font-size: 13px;
+}
+body.frames { padding: 0 5px; }
+h1 { font-size: 25px; margin: 1em 0 0.5em; padding-top: 4px; border-top: 1px dotted #d5d5d5; }
+h1.noborder { border-top: 0px; margin-top: 0; padding-top: 4px; }
+h1.title { margin-bottom: 10px; }
+h1.alphaindex { margin-top: 0; font-size: 22px; }
+h2 {
+ padding: 0;
+ padding-bottom: 3px;
+ border-bottom: 1px #aaa solid;
+ font-size: 1.4em;
+ margin: 1.8em 0 0.5em;
+}
+h2 small { font-weight: normal; font-size: 0.7em; display: block; float: right; }
+.clear { clear: both; }
+.inline { display: inline; }
+.inline p:first-child { display: inline; }
+.docstring h1, .docstring h2, .docstring h3, .docstring h4 { padding: 0; border: 0; border-bottom: 1px dotted #bbb; }
+.docstring h1 { font-size: 1.2em; }
+.docstring h2 { font-size: 1.1em; }
+.docstring h3, .docstring h4 { font-size: 1em; border-bottom: 0; padding-top: 10px; }
+.summary_desc .object_link, .docstring .object_link { font-family: monospace; }
+.rdoc-term { padding-right: 25px; font-weight: bold; }
+.rdoc-list p { margin: 0; padding: 0; margin-bottom: 4px; }
+
+/* style for <ul> */
+#filecontents li > p, .docstring li > p { margin: 0px; }
+#filecontents ul, .docstring ul { padding-left: 20px; }
+/* style for <dl> */
+#filecontents dl, .docstring dl { border: 1px solid #ccc; }
+#filecontents dt, .docstring dt { background: #ddd; font-weight: bold; padding: 3px 5px; }
+#filecontents dd, .docstring dd { padding: 5px 0px; margin-left: 18px; }
+#filecontents dd > p, .docstring dd > p { margin: 0px; }
+
+.note {
+ color: #222;
+ -moz-border-radius: 3px; -webkit-border-radius: 3px;
+ background: #e3e4e3; border: 1px solid #d5d5d5; padding: 7px 10px;
+ display: block;
+}
+.note.todo { background: #ffffc5; border-color: #ececaa; }
+.note.returns_void { background: #efefef; }
+.note.deprecated { background: #ffe5e5; border-color: #e9dada; }
+.note.private { background: #ffffc5; border-color: #ececaa; }
+.note.title { padding: 1px 5px; font-size: 0.9em; font-family: "Lucida Sans", "Lucida Grande", Verdana, Arial, sans-serif; display: inline; }
+.summary_signature + .note.title { margin-left: 7px; }
+h1 .note.title { font-size: 0.5em; font-weight: normal; padding: 3px 5px; position: relative; top: -3px; text-transform: capitalize; }
+.note.title.constructor { color: #fff; background: #6a98d6; border-color: #6689d6; }
+.note.title.writeonly { color: #fff; background: #45a638; border-color: #2da31d; }
+.note.title.readonly { color: #fff; background: #6a98d6; border-color: #6689d6; }
+.note.title.private { background: #d5d5d5; border-color: #c5c5c5; }
+.note.title.not_defined_here { background: transparent; border: none; font-style: italic; }
+.discussion .note { margin-top: 6px; }
+.discussion .note:first-child { margin-top: 0; }
+
+h3.inherited {
+ font-style: italic;
+ font-family: "Lucida Sans", "Lucida Grande", Verdana, Arial, sans-serif;
+ font-weight: normal;
+ padding: 0;
+ margin: 0;
+ margin-top: 12px;
+ margin-bottom: 3px;
+ font-size: 13px;
+}
+p.inherited {
+ padding: 0;
+ margin: 0;
+ margin-left: 25px;
+}
+
+#filecontents dl.box, dl.box {
+ border: 0;
+ width: 520px;
+ font-size: 1em;
+}
+#filecontents dl.box dt, dl.box dt {
+ float: left;
+ display: block;
+ width: 100px;
+ margin: 0;
+ text-align: right;
+ font-weight: bold;
+ background: transparent;
+ border: 1px solid #aaa;
+ border-width: 1px 0px 0px 1px;
+ padding: 6px 0;
+ padding-right: 10px;
+}
+#filecontents dl.box dd, dl.box dd {
+ float: left;
+ display: block;
+ width: 380px;
+ margin: 0;
+ padding: 6px 0;
+ padding-right: 20px;
+ border: 1px solid #aaa;
+ border-width: 1px 1px 0 0;
+}
+#filecontents dl.box .last, dl.box .last {
+ border-bottom: 1px solid #aaa;
+}
+#filecontents dl.box .r1, dl.box .r1 { background: #eee; }
+
+ul.toplevel { list-style: none; padding-left: 0; font-size: 1.1em; }
+.index_inline_list { padding-left: 0; font-size: 1.1em; }
+.index_inline_list li { list-style: none; display: inline; padding: 7px 12px; line-height: 35px; }
+
+dl.constants { margin-left: 40px; }
+dl.constants dt { font-weight: bold; font-size: 1.1em; margin-bottom: 5px; }
+dl.constants dd { width: 75%; white-space: pre; font-family: monospace; margin-bottom: 18px; }
+
+.summary_desc { margin-left: 32px; display: block; font-family: sans-serif; }
+.summary_desc tt { font-size: 0.9em; }
+dl.constants .note { padding: 2px 6px; padding-right: 12px; margin-top: 6px; }
+dl.constants .docstring { margin-left: 32px; font-size: 0.9em; font-weight: normal; }
+dl.constants .tags { padding-left: 32px; font-size: 0.9em; line-height: 0.8em; }
+dl.constants .discussion *:first-child { margin-top: 0; }
+dl.constants .discussion *:last-child { margin-bottom: 0; }
+
+.method_details { border-top: 1px dotted #aaa; margin-top: 15px; padding-top: 0; }
+.method_details.first { border: 0; }
+p.signature, h3.signature {
+ font-size: 1.1em; font-weight: normal; font-family: Monaco, Consolas, Courier, monospace;
+ padding: 6px 10px; margin-top: 18px;
+ background: #e5e8ff; border: 1px solid #d8d8e5; -moz-border-radius: 3px; -webkit-border-radius: 3px;
+}
+p.signature tt,
+h3.signature tt { font-family: Monaco, Consolas, Courier, monospace; }
+p.signature .overload,
+h3.signature .overload { display: block; }
+p.signature .extras,
+h3.signature .extras { font-weight: normal; font-family: sans-serif; color: #444; font-size: 1em; }
+p.signature .not_defined_here,
+h3.signature .not_defined_here,
+p.signature .aliases,
+h3.signature .aliases { display: block; font-weight: normal; font-size: 0.9em; font-family: sans-serif; margin-top: 0px; color: #555; }
+p.signature .aliases .names,
+h3.signature .aliases .names { font-family: Monaco, Consolas, Courier, monospace; font-weight: bold; color: #000; font-size: 1.2em; }
+
+.tags .tag_title { font-size: 1em; margin-bottom: 0; font-weight: bold; }
+.tags ul { margin-top: 5px; padding-left: 30px; list-style: square; }
+.tags ul li { margin-bottom: 3px; }
+.tags ul .name { font-family: monospace; font-weight: bold; }
+.tags ul .note { padding: 3px 6px; }
+.tags { margin-bottom: 12px; }
+
+.tags .examples .tag_title { margin-bottom: 10px; font-weight: bold; }
+.tags .examples .inline p { padding: 0; margin: 0; margin-left: 15px; font-weight: bold; font-size: 0.9em; }
+
+.tags .overload .overload_item { list-style: none; margin-bottom: 25px; }
+.tags .overload .overload_item .signature {
+ padding: 2px 8px;
+ background: #e5e8ff; border: 1px solid #d8d8e5; -moz-border-radius: 3px; -webkit-border-radius: 3px;
+}
+.tags .overload .signature { margin-left: -15px; font-family: monospace; display: block; font-size: 1.1em; }
+.tags .overload .docstring { margin-top: 15px; }
+
+.defines { display: none; }
+
+#method_missing_details .notice.this { position: relative; top: -8px; color: #888; padding: 0; margin: 0; }
+
+.showSource { font-size: 0.9em; }
+.showSource a:link, .showSource a:visited { text-decoration: none; color: #666; }
+
+#content a:link, #content a:visited { text-decoration: none; color: #05a; }
+#content a:hover { background: #ffffa5; }
+div.docstring, p.docstring { margin-right: 6em; }
+
+ul.summary {
+ list-style: none;
+ font-family: monospace;
+ font-size: 1em;
+ line-height: 1.5em;
+}
+ul.summary a:link, ul.summary a:visited {
+ text-decoration: none; font-size: 1.1em;
+}
+ul.summary li { margin-bottom: 5px; }
+.summary .summary_signature {
+ padding: 1px 10px;
+ background: #eaeaff; border: 1px solid #dfdfe5;
+ -moz-border-radius: 3px; -webkit-border-radius: 3px;
+}
+.summary_signature:hover { background: #eeeeff; cursor: pointer; }
+ul.summary.compact li { display: inline-block; margin: 0px 5px 0px 0px; line-height: 2.6em;}
+ul.summary.compact .summary_signature { padding: 5px 7px; padding-right: 4px; }
+#content .summary_signature:hover a:link,
+#content .summary_signature:hover a:visited {
+ background: transparent;
+ color: #48f;
+}
+
+p.inherited a { font-family: monospace; font-size: 0.9em; }
+p.inherited { word-spacing: 5px; font-size: 1.2em; }
+
+p.children { font-size: 1.2em; }
+p.children a { font-size: 0.9em; }
+p.children strong { font-size: 0.8em; }
+p.children strong.modules { padding-left: 5px; }
+
+ul.fullTree { display: none; padding-left: 0; list-style: none; margin-left: 0; margin-bottom: 10px; }
+ul.fullTree ul { margin-left: 0; padding-left: 0; list-style: none; }
+ul.fullTree li { text-align: center; padding-top: 18px; padding-bottom: 12px; background: url(data:image/gif;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAACXBIWXMAAAsTAAALEwEAmpwYAAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNnVFPpFj333vRCS4iAlEtvUhUIIFJCi4AUkSYqIQkQSoghodkVUcERRUUEG8igiAOOjoCMFVEsDIoK2AfkIaKOg6OIisr74Xuja9a89+bN/rXXPues852zzwfACAyWSDNRNYAMqUIeEeCDx8TG4eQuQIEKJHAAEAizZCFz/SMBAPh+PDwrIsAHvgABeNMLCADATZvAMByH/w/qQplcAYCEAcB0kThLCIAUAEB6jkKmAEBGAYCdmCZTAKAEAGDLY2Lj [...]
+ul.fullTree li:first-child { padding-top: 0; background: transparent; }
+ul.fullTree li:last-child { padding-bottom: 0; }
+.showAll ul.fullTree { display: block; }
+.showAll .inheritName { display: none; }
+
+#search { position: absolute; right: 14px; top: 0px; }
+#search a:link, #search a:visited {
+ display: block; float: left; margin-right: 4px;
+ padding: 8px 10px; text-decoration: none; color: #05a;
+ border: 1px solid #d8d8e5;
+ -moz-border-radius-bottomleft: 3px; -moz-border-radius-bottomright: 3px;
+ -webkit-border-bottom-left-radius: 3px; -webkit-border-bottom-right-radius: 3px;
+ background: #eaf0ff;
+ -webkit-box-shadow: -1px 1px 3px #ddd;
+}
+#search a:hover { background: #f5faff; color: #06b; }
+#search a.active {
+ background: #568; padding-bottom: 20px; color: #fff; border: 1px solid #457;
+ -moz-border-radius-topleft: 5px; -moz-border-radius-topright: 5px;
+ -webkit-border-top-left-radius: 5px; -webkit-border-top-right-radius: 5px;
+}
+#search a.inactive { color: #999; }
+.frames #search { display: none; }
+.inheritanceTree, .toggleDefines { float: right; }
+
+#menu { font-size: 1.3em; color: #bbb; top: -5px; position: relative; }
+#menu .title, #menu a { font-size: 0.7em; }
+#menu .title a { font-size: 1em; }
+#menu .title { color: #555; }
+#menu a:link, #menu a:visited { color: #333; text-decoration: none; border-bottom: 1px dotted #bbd; }
+#menu a:hover { color: #05a; }
+#menu .noframes { display: inline; }
+.frames #menu .noframes { display: inline; float: right; }
+
+#footer { margin-top: 15px; border-top: 1px solid #ccc; text-align: center; padding: 7px 0; color: #999; }
+#footer a:link, #footer a:visited { color: #444; text-decoration: none; border-bottom: 1px dotted #bbd; }
+#footer a:hover { color: #05a; }
+
+#listing ul.alpha { font-size: 1.1em; }
+#listing ul.alpha { margin: 0; padding: 0; padding-bottom: 10px; list-style: none; }
+#listing ul.alpha li.letter { font-size: 1.4em; padding-bottom: 10px; }
+#listing ul.alpha ul { margin: 0; padding-left: 15px; }
+#listing ul small { color: #666; font-size: 0.7em; }
+
+li.r1 { background: #f0f0f0; }
+li.r2 { background: #fafafa; }
+
+#search_frame {
+ z-index: 9999;
+ background: #fff;
+ display: none;
+ position: absolute;
+ top: 36px;
+ right: 18px;
+ width: 500px;
+ height: 80%;
+ overflow-y: scroll;
+ border: 1px solid #999;
+ border-collapse: collapse;
+ -webkit-box-shadow: -7px 5px 25px #aaa;
+ -moz-box-shadow: -7px 5px 25px #aaa;
+ -moz-border-radius: 2px;
+ -webkit-border-radius: 2px;
+}
+
+#content ul.summary li.deprecated .summary_signature a:link,
+#content ul.summary li.deprecated .summary_signature a:visited { text-decoration: line-through; font-style: italic; }
+
+#toc {
+ padding: 20px; padding-right: 30px; border: 1px solid #ddd; float: right; background: #fff; margin-left: 20px; margin-bottom: 20px;
+ max-width: 300px;
+ -webkit-box-shadow: -2px 2px 6px #bbb;
+ -moz-box-shadow: -2px 2px 6px #bbb;
+ z-index: 5000;
+ position: relative;
+}
+#toc.nofloat { float: none; max-width: none; border: none; padding: 0; margin: 20px 0; -webkit-box-shadow: none; -moz-box-shadow: none; }
+#toc.nofloat.hidden { padding: 0; background: 0; margin-bottom: 5px; }
+#toc .title { margin: 0; }
+#toc ol { padding-left: 1.8em; }
+#toc li { font-size: 1.1em; line-height: 1.7em; }
+#toc > ol > li { font-size: 1.1em; font-weight: bold; }
+#toc ol > ol { font-size: 0.9em; }
+#toc ol ol > ol { padding-left: 2.3em; }
+#toc ol + li { margin-top: 0.3em; }
+#toc.hidden { padding: 10px; background: #f6f6f6; -webkit-box-shadow: none; -moz-box-shadow: none; }
+#filecontents h1 + #toc.nofloat { margin-top: 0; }
+
+/* syntax highlighting */
+.source_code { display: none; padding: 3px 8px; border-left: 8px solid #ddd; margin-top: 5px; }
+#filecontents pre.code, .docstring pre.code, .source_code pre { font-family: monospace; }
+#filecontents pre.code, .docstring pre.code { display: block; }
+.source_code .lines { padding-right: 12px; color: #555; text-align: right; }
+#filecontents pre.code, .docstring pre.code,
+.tags pre.example { padding: 5px 12px; margin-top: 4px; border: 1px solid #eef; background: #f5f5ff; }
+pre.code { color: #000; }
+pre.code .info.file { color: #555; }
+pre.code .val { color: #036A07; }
+pre.code .tstring_content,
+pre.code .heredoc_beg, pre.code .heredoc_end,
+pre.code .qwords_beg, pre.code .qwords_end,
+pre.code .tstring, pre.code .dstring { color: #036A07; }
+pre.code .fid, pre.code .rubyid_new, pre.code .rubyid_to_s,
+pre.code .rubyid_to_sym, pre.code .rubyid_to_f,
+pre.code .dot + pre.code .id,
+pre.code .rubyid_to_i pre.code .rubyid_each { color: #0085FF; }
+pre.code .comment { color: #0066FF; }
+pre.code .const, pre.code .constant { color: #585CF6; }
+pre.code .symbol { color: #C5060B; }
+pre.code .kw,
+pre.code .label,
+pre.code .rubyid_require,
+pre.code .rubyid_extend,
+pre.code .rubyid_include { color: #0000FF; }
+pre.code .ivar { color: #318495; }
+pre.code .gvar,
+pre.code .rubyid_backref,
+pre.code .rubyid_nth_ref { color: #6D79DE; }
+pre.code .regexp, .dregexp { color: #036A07; }
+pre.code a { border-bottom: 1px dotted #bbf; }
diff --git a/documentation/file.README.html b/documentation/file.README.html
new file mode 100644
index 0000000..2411db5
--- /dev/null
+++ b/documentation/file.README.html
@@ -0,0 +1,91 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+<title>
+ File: README
+
+ — Documentation by YARD 0.8.4.1
+
+</title>
+
+ <link rel="stylesheet" href="css/style.css" type="text/css" media="screen" charset="utf-8" />
+
+ <link rel="stylesheet" href="css/common.css" type="text/css" media="screen" charset="utf-8" />
+
+<script type="text/javascript" charset="utf-8">
+ hasFrames = window.top.frames.main ? true : false;
+ relpath = '';
+ framesUrl = "frames.html#!" + escape(window.location.href);
+</script>
+
+
+ <script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
+
+ <script type="text/javascript" charset="utf-8" src="js/app.js"></script>
+
+
+ </head>
+ <body>
+ <div id="header">
+ <div id="menu">
+
+ <a href="_index.html">Index</a> »
+ <span class="title">File: README</span>
+
+
+ <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
+</div>
+
+ <div id="search">
+
+ <a class="full_list_link" id="class_list_link"
+ href="class_list.html">
+ Class List
+ </a>
+
+ <a class="full_list_link" id="method_list_link"
+ href="method_list.html">
+ Method List
+ </a>
+
+ <a class="full_list_link" id="file_list_link"
+ href="file_list.html">
+ File List
+ </a>
+
+</div>
+ <div class="clear"></div>
+ </div>
+
+ <iframe id="search_frame"></iframe>
+
+ <div id="content"><div id='filecontents'>
+<h1 id="label-"></h1>
+
+<pre class="code ruby"><code class="ruby"><span class='string val'>'
+ _______ ___ _____ __ __
+ /_ __(_)___ ___ ___ / (_)___ ___ / ___/___ / /_/ /____ _____
+ / / / / __ `__ \/ _ \/ / / __ \/ _ \\__ \/ _ \/ __/ __/ _ \/ ___/
+ / / / / / / / / / __/ / / / / / __/__/ / __/ /_/ /_/ __/ /
+/_/ /_/_/ /_/ /_/\___/_/_/_/ /_/\___/____/\___/\__/\__/\___/_/
+
+TimelineSetter is a tool to create HTML timelines from spreadsheets of events.
+
+For usage and installation instructions, see:
+http://propublica.github.com/timeline-setter/
+
+To report a bug or suggest a feature:
+http://github.com/propublica/timeline-setter/issues
+</span></code></pre>
+</div></div>
+
+ <div id="footer">
+ Generated on Thu Feb 21 11:20:30 2013 by
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
+ 0.8.4.1 (ruby-1.8.7).
+</div>
+
+ </body>
+</html>
\ No newline at end of file
diff --git a/documentation/file_list.html b/documentation/file_list.html
new file mode 100644
index 0000000..9393d92
--- /dev/null
+++ b/documentation/file_list.html
@@ -0,0 +1,55 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+
+ <link rel="stylesheet" href="css/full_list.css" type="text/css" media="screen" charset="utf-8" />
+
+ <link rel="stylesheet" href="css/common.css" type="text/css" media="screen" charset="utf-8" />
+
+
+
+ <script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
+
+ <script type="text/javascript" charset="utf-8" src="js/full_list.js"></script>
+
+
+ <base id="base_target" target="_parent" />
+ </head>
+ <body>
+ <script type="text/javascript" charset="utf-8">
+ if (window.top.frames.main) {
+ document.getElementById('base_target').target = 'main';
+ document.body.className = 'frames';
+ }
+ </script>
+ <div id="content">
+ <h1 id="full_list_header">File List</h1>
+ <div id="nav">
+
+ <span><a target="_self" href="class_list.html">
+ Classes
+ </a></span>
+
+ <span><a target="_self" href="method_list.html">
+ Methods
+ </a></span>
+
+ <span><a target="_self" href="file_list.html">
+ Files
+ </a></span>
+
+ </div>
+ <div id="search">Search: <input type="text" /></div>
+
+ <ul id="full_list" class="file">
+
+
+ <li class="r1"><a href="index.html" title="README">README</a></li>
+
+
+ </ul>
+ </div>
+ </body>
+</html>
diff --git a/documentation/frames.html b/documentation/frames.html
new file mode 100644
index 0000000..b35ed7b
--- /dev/null
+++ b/documentation/frames.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
+ <title>Documentation by YARD 0.8.4.1</title>
+</head>
+<script type="text/javascript" charset="utf-8">
+window.onload = function() {
+ var match = window.location.hash.match(/^#!(.+)/);
+ var name = 'index.html';
+ if (match) {
+ name = unescape(match[1]);
+ }
+ document.writeln('<frameset cols="20%,*">' +
+ '<frame name="list" src="class_list.html" />' +
+ '<frame name="main" src="' + name + '" />' +
+ '</frameset>');
+}
+</script>
+<noscript>
+ <frameset cols="20%,*">
+ <frame name="list" src="class_list.html" />
+ <frame name="main" src="index.html" />
+ </frameset>
+</noscript>
+</html>
diff --git a/documentation/index.html b/documentation/index.html
new file mode 100644
index 0000000..2411db5
--- /dev/null
+++ b/documentation/index.html
@@ -0,0 +1,91 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+<title>
+ File: README
+
+ — Documentation by YARD 0.8.4.1
+
+</title>
+
+ <link rel="stylesheet" href="css/style.css" type="text/css" media="screen" charset="utf-8" />
+
+ <link rel="stylesheet" href="css/common.css" type="text/css" media="screen" charset="utf-8" />
+
+<script type="text/javascript" charset="utf-8">
+ hasFrames = window.top.frames.main ? true : false;
+ relpath = '';
+ framesUrl = "frames.html#!" + escape(window.location.href);
+</script>
+
+
+ <script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
+
+ <script type="text/javascript" charset="utf-8" src="js/app.js"></script>
+
+
+ </head>
+ <body>
+ <div id="header">
+ <div id="menu">
+
+ <a href="_index.html">Index</a> »
+ <span class="title">File: README</span>
+
+
+ <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
+</div>
+
+ <div id="search">
+
+ <a class="full_list_link" id="class_list_link"
+ href="class_list.html">
+ Class List
+ </a>
+
+ <a class="full_list_link" id="method_list_link"
+ href="method_list.html">
+ Method List
+ </a>
+
+ <a class="full_list_link" id="file_list_link"
+ href="file_list.html">
+ File List
+ </a>
+
+</div>
+ <div class="clear"></div>
+ </div>
+
+ <iframe id="search_frame"></iframe>
+
+ <div id="content"><div id='filecontents'>
+<h1 id="label-"></h1>
+
+<pre class="code ruby"><code class="ruby"><span class='string val'>'
+ _______ ___ _____ __ __
+ /_ __(_)___ ___ ___ / (_)___ ___ / ___/___ / /_/ /____ _____
+ / / / / __ `__ \/ _ \/ / / __ \/ _ \\__ \/ _ \/ __/ __/ _ \/ ___/
+ / / / / / / / / / __/ / / / / / __/__/ / __/ /_/ /_/ __/ /
+/_/ /_/_/ /_/ /_/\___/_/_/_/ /_/\___/____/\___/\__/\__/\___/_/
+
+TimelineSetter is a tool to create HTML timelines from spreadsheets of events.
+
+For usage and installation instructions, see:
+http://propublica.github.com/timeline-setter/
+
+To report a bug or suggest a feature:
+http://github.com/propublica/timeline-setter/issues
+</span></code></pre>
+</div></div>
+
+ <div id="footer">
+ Generated on Thu Feb 21 11:20:30 2013 by
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
+ 0.8.4.1 (ruby-1.8.7).
+</div>
+
+ </body>
+</html>
\ No newline at end of file
diff --git a/documentation/js/app.js b/documentation/js/app.js
new file mode 100644
index 0000000..c150289
--- /dev/null
+++ b/documentation/js/app.js
@@ -0,0 +1,214 @@
+function createSourceLinks() {
+ $('.method_details_list .source_code').
+ before("<span class='showSource'>[<a href='#' class='toggleSource'>View source</a>]</span>");
+ $('.toggleSource').toggle(function() {
+ $(this).parent().nextAll('.source_code').slideDown(100);
+ $(this).text("Hide source");
+ },
+ function() {
+ $(this).parent().nextAll('.source_code').slideUp(100);
+ $(this).text("View source");
+ });
+}
+
+function createDefineLinks() {
+ var tHeight = 0;
+ $('.defines').after(" <a href='#' class='toggleDefines'>more...</a>");
+ $('.toggleDefines').toggle(function() {
+ tHeight = $(this).parent().prev().height();
+ $(this).prev().show();
+ $(this).parent().prev().height($(this).parent().height());
+ $(this).text("(less)");
+ },
+ function() {
+ $(this).prev().hide();
+ $(this).parent().prev().height(tHeight);
+ $(this).text("more...");
+ });
+}
+
+function createFullTreeLinks() {
+ var tHeight = 0;
+ $('.inheritanceTree').toggle(function() {
+ tHeight = $(this).parent().prev().height();
+ $(this).parent().toggleClass('showAll');
+ $(this).text("(hide)");
+ $(this).parent().prev().height($(this).parent().height());
+ },
+ function() {
+ $(this).parent().toggleClass('showAll');
+ $(this).parent().prev().height(tHeight);
+ $(this).text("show all");
+ });
+}
+
+function fixBoxInfoHeights() {
+ $('dl.box dd.r1, dl.box dd.r2').each(function() {
+ $(this).prev().height($(this).height());
+ });
+}
+
+function searchFrameLinks() {
+ $('.full_list_link').click(function() {
+ toggleSearchFrame(this, $(this).attr('href'));
+ return false;
+ });
+}
+
+function toggleSearchFrame(id, link) {
+ var frame = $('#search_frame');
+ $('#search a').removeClass('active').addClass('inactive');
+ if (frame.attr('src') == link && frame.css('display') != "none") {
+ frame.slideUp(100);
+ $('#search a').removeClass('active inactive');
+ }
+ else {
+ $(id).addClass('active').removeClass('inactive');
+ frame.attr('src', link).slideDown(100);
+ }
+}
+
+function linkSummaries() {
+ $('.summary_signature').click(function() {
+ document.location = $(this).find('a').attr('href');
+ });
+}
+
+function framesInit() {
+ if (hasFrames) {
+ document.body.className = 'frames';
+ $('#menu .noframes a').attr('href', document.location);
+ window.top.document.title = $('html head title').text();
+ }
+ else {
+ $('#menu .noframes a').text('frames').attr('href', framesUrl);
+ }
+}
+
+function keyboardShortcuts() {
+ if (window.top.frames.main) return;
+ $(document).keypress(function(evt) {
+ if (evt.altKey || evt.ctrlKey || evt.metaKey || evt.shiftKey) return;
+ if (typeof evt.target !== "undefined" &&
+ (evt.target.nodeName == "INPUT" ||
+ evt.target.nodeName == "TEXTAREA")) return;
+ switch (evt.charCode) {
+ case 67: case 99: $('#class_list_link').click(); break; // 'c'
+ case 77: case 109: $('#method_list_link').click(); break; // 'm'
+ case 70: case 102: $('#file_list_link').click(); break; // 'f'
+ default: break;
+ }
+ });
+}
+
+function summaryToggle() {
+ $('.summary_toggle').click(function() {
+ if (localStorage) {
+ localStorage.summaryCollapsed = $(this).text();
+ }
+ $('.summary_toggle').each(function() {
+ $(this).text($(this).text() == "collapse" ? "expand" : "collapse");
+ var next = $(this).parent().parent().nextAll('ul.summary').first();
+ if (next.hasClass('compact')) {
+ next.toggle();
+ next.nextAll('ul.summary').first().toggle();
+ }
+ else if (next.hasClass('summary')) {
+ var list = $('<ul class="summary compact" />');
+ list.html(next.html());
+ list.find('.summary_desc, .note').remove();
+ list.find('a').each(function() {
+ $(this).html($(this).find('strong').html());
+ $(this).parent().html($(this)[0].outerHTML);
+ });
+ next.before(list);
+ next.toggle();
+ }
+ });
+ return false;
+ });
+ if (localStorage) {
+ if (localStorage.summaryCollapsed == "collapse") {
+ $('.summary_toggle').first().click();
+ }
+ else localStorage.summaryCollapsed = "expand";
+ }
+}
+
+function fixOutsideWorldLinks() {
+ $('a').each(function() {
+ if (window.location.host != this.host) this.target = '_parent';
+ });
+}
+
+function generateTOC() {
+ if ($('#filecontents').length === 0) return;
+ var _toc = $('<ol class="top"></ol>');
+ var show = false;
+ var toc = _toc;
+ var counter = 0;
+ var tags = ['h2', 'h3', 'h4', 'h5', 'h6'];
+ var i;
+ if ($('#filecontents h1').length > 1) tags.unshift('h1');
+ for (i = 0; i < tags.length; i++) { tags[i] = '#filecontents ' + tags[i]; }
+ var lastTag = parseInt(tags[0][1], 10);
+ $(tags.join(', ')).each(function() {
+ if ($(this).parents('.method_details .docstring').length != 0) return;
+ if (this.id == "filecontents") return;
+ show = true;
+ var thisTag = parseInt(this.tagName[1], 10);
+ if (this.id.length === 0) {
+ var proposedId = $(this).attr('toc-id');
+ if (typeof(proposedId) != "undefined") this.id = proposedId;
+ else {
+ var proposedId = $(this).text().replace(/[^a-z0-9-]/ig, '_');
+ if ($('#' + proposedId).length > 0) { proposedId += counter; counter++; }
+ this.id = proposedId;
+ }
+ }
+ if (thisTag > lastTag) {
+ for (i = 0; i < thisTag - lastTag; i++) {
+ var tmp = $('<ol/>'); toc.append(tmp); toc = tmp;
+ }
+ }
+ if (thisTag < lastTag) {
+ for (i = 0; i < lastTag - thisTag; i++) toc = toc.parent();
+ }
+ var title = $(this).attr('toc-title');
+ if (typeof(title) == "undefined") title = $(this).text();
+ toc.append('<li><a href="#' + this.id + '">' + title + '</a></li>');
+ lastTag = thisTag;
+ });
+ if (!show) return;
+ html = '<div id="toc"><p class="title"><a class="hide_toc" href="#"><strong>Table of Contents</strong></a> <small>(<a href="#" class="float_toc">left</a>)</small></p></div>';
+ $('#content').prepend(html);
+ $('#toc').append(_toc);
+ $('#toc .hide_toc').toggle(function() {
+ $('#toc .top').slideUp('fast');
+ $('#toc').toggleClass('hidden');
+ $('#toc .title small').toggle();
+ }, function() {
+ $('#toc .top').slideDown('fast');
+ $('#toc').toggleClass('hidden');
+ $('#toc .title small').toggle();
+ });
+ $('#toc .float_toc').toggle(function() {
+ $(this).text('float');
+ $('#toc').toggleClass('nofloat');
+ }, function() {
+ $(this).text('left');
+ $('#toc').toggleClass('nofloat');
+ });
+}
+
+$(framesInit);
+$(createSourceLinks);
+$(createDefineLinks);
+$(createFullTreeLinks);
+$(fixBoxInfoHeights);
+$(searchFrameLinks);
+$(linkSummaries);
+$(keyboardShortcuts);
+$(summaryToggle);
+$(fixOutsideWorldLinks);
+$(generateTOC);
\ No newline at end of file
diff --git a/documentation/js/full_list.js b/documentation/js/full_list.js
new file mode 100644
index 0000000..e760063
--- /dev/null
+++ b/documentation/js/full_list.js
@@ -0,0 +1,173 @@
+var inSearch = null;
+var searchIndex = 0;
+var searchCache = [];
+var searchString = '';
+var regexSearchString = '';
+var caseSensitiveMatch = false;
+var ignoreKeyCodeMin = 8;
+var ignoreKeyCodeMax = 46;
+var commandKey = 91;
+
+RegExp.escape = function(text) {
+ return text.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
+}
+
+function fullListSearch() {
+ // generate cache
+ searchCache = [];
+ $('#full_list li').each(function() {
+ var link = $(this).find('.object_link a');
+ var fullName = link.attr('title').split(' ')[0];
+ searchCache.push({name:link.text(), fullName:fullName, node:$(this), link:link});
+ });
+
+ $('#search input').keyup(function(event) {
+ if ((event.keyCode > ignoreKeyCodeMin && event.keyCode < ignoreKeyCodeMax)
+ || event.keyCode == commandKey)
+ return;
+ searchString = this.value;
+ caseSensitiveMatch = searchString.match(/[A-Z]/) != null;
+ regexSearchString = RegExp.escape(searchString);
+ if (caseSensitiveMatch) {
+ regexSearchString += "|" +
+ $.map(searchString.split(''), function(e) { return RegExp.escape(e); }).
+ join('.+?');
+ }
+ if (searchString === "") {
+ clearTimeout(inSearch);
+ inSearch = null;
+ $('ul .search_uncollapsed').removeClass('search_uncollapsed');
+ $('#full_list, #content').removeClass('insearch');
+ $('#full_list li').removeClass('found').each(function() {
+
+ var link = $(this).find('.object_link a');
+ link.text(link.text());
+ });
+ if (clicked) {
+ clicked.parents('ul').each(function() {
+ $(this).removeClass('collapsed').prev().removeClass('collapsed');
+ });
+ }
+ highlight();
+ }
+ else {
+ if (inSearch) clearTimeout(inSearch);
+ searchIndex = 0;
+ lastRowClass = '';
+ $('#full_list, #content').addClass('insearch');
+ $('#noresults').text('');
+ searchItem();
+ }
+ });
+
+ $('#search input').focus();
+ $('#full_list').after("<div id='noresults'></div>");
+}
+
+var lastRowClass = '';
+function searchItem() {
+ for (var i = 0; i < searchCache.length / 50; i++) {
+ var item = searchCache[searchIndex];
+ var searchName = (searchString.indexOf('::') != -1 ? item.fullName : item.name);
+ var matchString = regexSearchString;
+ var matchRegexp = new RegExp(matchString, caseSensitiveMatch ? "" : "i");
+ if (searchName.match(matchRegexp) == null) {
+ item.node.removeClass('found');
+ }
+ else {
+ item.node.css('padding-left', '10px').addClass('found');
+ item.node.parents().addClass('search_uncollapsed');
+ item.node.removeClass(lastRowClass).addClass(lastRowClass == 'r1' ? 'r2' : 'r1');
+ lastRowClass = item.node.hasClass('r1') ? 'r1' : 'r2';
+ item.link.html(item.name.replace(matchRegexp, "<strong>$&</strong>"));
+ }
+
+ if (searchCache.length === searchIndex + 1) {
+ searchDone();
+ return;
+ }
+ else {
+ searchIndex++;
+ }
+ }
+ inSearch = setTimeout('searchItem()', 0);
+}
+
+function searchDone() {
+ highlight(true);
+ if ($('#full_list li:visible').size() === 0) {
+ $('#noresults').text('No results were found.').hide().fadeIn();
+ }
+ else {
+ $('#noresults').text('');
+ }
+ $('#content').removeClass('insearch');
+ clearTimeout(inSearch);
+ inSearch = null;
+}
+
+clicked = null;
+function linkList() {
+ $('#full_list li, #full_list li a:last').click(function(evt) {
+ if ($(this).hasClass('toggle')) return true;
+ if (this.tagName.toLowerCase() == "li") {
+ var toggle = $(this).children('a.toggle');
+ if (toggle.size() > 0 && evt.pageX < toggle.offset().left) {
+ toggle.click();
+ return false;
+ }
+ }
+ if (clicked) clicked.removeClass('clicked');
+ var win = window.top.frames.main ? window.top.frames.main : window.parent;
+ if (this.tagName.toLowerCase() == "a") {
+ clicked = $(this).parent('li').addClass('clicked');
+ win.location = this.href;
+ }
+ else {
+ clicked = $(this).addClass('clicked');
+ win.location = $(this).find('a:last').attr('href');
+ }
+ return false;
+ });
+}
+
+function collapse() {
+ if (!$('#full_list').hasClass('class')) return;
+ $('#full_list.class a.toggle').click(function() {
+ $(this).parent().toggleClass('collapsed').next().toggleClass('collapsed');
+ highlight();
+ return false;
+ });
+ $('#full_list.class ul').each(function() {
+ $(this).addClass('collapsed').prev().addClass('collapsed');
+ });
+ $('#full_list.class').children().removeClass('collapsed');
+ highlight();
+}
+
+function highlight(no_padding) {
+ var n = 1;
+ $('#full_list li:visible').each(function() {
+ var next = n == 1 ? 2 : 1;
+ $(this).removeClass("r" + next).addClass("r" + n);
+ if (!no_padding && $('#full_list').hasClass('class')) {
+ $(this).css('padding-left', (10 + $(this).parents('ul').size() * 15) + 'px');
+ }
+ n = next;
+ });
+}
+
+function escapeShortcut() {
+ $(document).keydown(function(evt) {
+ if (evt.which == 27) {
+ $('#search_frame', window.top.document).slideUp(100);
+ $('#search a', window.top.document).removeClass('active inactive');
+ $(window.top).focus();
+ }
+ });
+}
+
+$(escapeShortcut);
+$(fullListSearch);
+$(linkList);
+$(collapse);
diff --git a/documentation/js/jquery.js b/documentation/js/jquery.js
new file mode 100644
index 0000000..198b3ff
--- /dev/null
+++ b/documentation/js/jquery.js
@@ -0,0 +1,4 @@
+/*! jQuery v1.7.1 jquery.com | jquery.org/license */
+(function(a,b){function cy(a){return f.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:!1}function cv(a){if(!ck[a]){var b=c.body,d=f("<"+a+">").appendTo(b),e=d.css("display");d.remove();if(e==="none"||e===""){cl||(cl=c.createElement("iframe"),cl.frameBorder=cl.width=cl.height=0),b.appendChild(cl);if(!cm||!cl.createElement)cm=(cl.contentWindow||cl.contentDocument).document,cm.write((c.compatMode==="CSS1Compat"?"<!doctype html>":"")+"<html><body>"),cm.close();d=cm.createElement( [...]
+f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3||a.nodeType===8||!c||!d||!(h=f._data(a)))){d.handler&&(p=d,d=p.handler),d.guid||(d.guid=f.guid++),j=h.events,j||(h.events=j={}),i=h.handle,i||(h.handle=i=function(a){return typeof f!="undefined"&&(!a||f.event.triggered!==a.type)?f.event.dispatch.apply(i.elem,arguments):b},i.elem=a),c=f.trim(I(c)).split(" ");for(k=0;k<c.length;k++){l=A.exec(c[k])||[],m=l[1],n=(l[2]||"").split(".").sort(),s=f.event.special[m]| [...]
+{for(var a=0,b;(b=this[a])!=null;a++){b.nodeType===1&&f.cleanData(b.getElementsByTagName("*"));while(b.firstChild)b.removeChild(b.firstChild)}return this},clone:function(a,b){a=a==null?!1:a,b=b==null?a:b;return this.map(function(){return f.clone(this,a,b)})},html:function(a){if(a===b)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(W,""):null;if(typeof a=="string"&&!ba.test(a)&&(f.support.leadingWhitespace||!X.test(a))&&!bg[(Z.exec(a)||["",""])[1].toLowerCase()]){a=a.replac [...]
\ No newline at end of file
diff --git a/documentation/method_list.html b/documentation/method_list.html
new file mode 100644
index 0000000..5128dc4
--- /dev/null
+++ b/documentation/method_list.html
@@ -0,0 +1,188 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+
+ <link rel="stylesheet" href="css/full_list.css" type="text/css" media="screen" charset="utf-8" />
+
+ <link rel="stylesheet" href="css/common.css" type="text/css" media="screen" charset="utf-8" />
+
+
+
+ <script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
+
+ <script type="text/javascript" charset="utf-8" src="js/full_list.js"></script>
+
+
+ <base id="base_target" target="_parent" />
+ </head>
+ <body>
+ <script type="text/javascript" charset="utf-8">
+ if (window.top.frames.main) {
+ document.getElementById('base_target').target = 'main';
+ document.body.className = 'frames';
+ }
+ </script>
+ <div id="content">
+ <h1 id="full_list_header">Method List</h1>
+ <div id="nav">
+
+ <span><a target="_self" href="class_list.html">
+ Classes
+ </a></span>
+
+ <span><a target="_self" href="method_list.html">
+ Methods
+ </a></span>
+
+ <span><a target="_self" href="file_list.html">
+ Files
+ </a></span>
+
+ </div>
+ <div id="search">Search: <input type="text" /></div>
+
+ <ul id="full_list" class="method">
+
+
+ <li class="r1 ">
+ <span class='object_link'><a href="TimelineSetter/CLI.html#compile%21-instance_method" title="TimelineSetter::CLI#compile! (method)">#compile!</a></span>
+
+ <small>TimelineSetter::CLI</small>
+
+ </li>
+
+
+ <li class="r2 ">
+ <span class='object_link'><a href="TimelineSetter/Timeline.html#config_json-instance_method" title="TimelineSetter::Timeline#config_json (method)">#config_json</a></span>
+
+ <small>TimelineSetter::Timeline</small>
+
+ </li>
+
+
+ <li class="r1 ">
+ <span class='object_link'><a href="TimelineSetter/Parser.html#events-instance_method" title="TimelineSetter::Parser#events (method)">#events</a></span>
+
+ <small>TimelineSetter::Parser</small>
+
+ </li>
+
+
+ <li class="r2 ">
+ <span class='object_link'><a href="TimelineSetter/CLI.html#events-instance_method" title="TimelineSetter::CLI#events (method)">#events</a></span>
+
+ <small>TimelineSetter::CLI</small>
+
+ </li>
+
+
+ <li class="r1 ">
+ <span class='object_link'><a href="TimelineSetter/CLI.html#html-instance_method" title="TimelineSetter::CLI#html (method)">#html</a></span>
+
+ <small>TimelineSetter::CLI</small>
+
+ </li>
+
+
+ <li class="r2 ">
+ <span class='object_link'><a href="TimelineSetter/CLI.html#initialize-instance_method" title="TimelineSetter::CLI#initialize (method)">#initialize</a></span>
+
+ <small>TimelineSetter::CLI</small>
+
+ </li>
+
+
+ <li class="r1 ">
+ <span class='object_link'><a href="TimelineSetter/Timeline.html#initialize-instance_method" title="TimelineSetter::Timeline#initialize (method)">#initialize</a></span>
+
+ <small>TimelineSetter::Timeline</small>
+
+ </li>
+
+
+ <li class="r2 ">
+ <span class='object_link'><a href="TimelineSetter/Parser.html#initialize-instance_method" title="TimelineSetter::Parser#initialize (method)">#initialize</a></span>
+
+ <small>TimelineSetter::Parser</small>
+
+ </li>
+
+
+ <li class="r1 ">
+ <span class='object_link'><a href="TimelineSetter/CLI.html#outdir-instance_method" title="TimelineSetter::CLI#outdir (method)">#outdir</a></span>
+
+ <small>TimelineSetter::CLI</small>
+
+ </li>
+
+
+ <li class="r2 ">
+ <span class='object_link'><a href="TimelineSetter/CLI.html#parse_options%21-instance_method" title="TimelineSetter::CLI#parse_options! (method)">#parse_options!</a></span>
+
+ <small>TimelineSetter::CLI</small>
+
+ </li>
+
+
+ <li class="r1 ">
+ <span class='object_link'><a href="TimelineSetter/CLI.html#sheet-instance_method" title="TimelineSetter::CLI#sheet (method)">#sheet</a></span>
+
+ <small>TimelineSetter::CLI</small>
+
+ </li>
+
+
+ <li class="r2 ">
+ <span class='object_link'><a href="TimelineSetter/Timeline.html#timeline-instance_method" title="TimelineSetter::Timeline#timeline (method)">#timeline</a></span>
+
+ <small>TimelineSetter::Timeline</small>
+
+ </li>
+
+
+ <li class="r1 ">
+ <span class='object_link'><a href="TimelineSetter/Timeline.html#timeline_markup-instance_method" title="TimelineSetter::Timeline#timeline_markup (method)">#timeline_markup</a></span>
+
+ <small>TimelineSetter::Timeline</small>
+
+ </li>
+
+
+ <li class="r2 ">
+ <span class='object_link'><a href="TimelineSetter/Timeline.html#timeline_min-instance_method" title="TimelineSetter::Timeline#timeline_min (method)">#timeline_min</a></span>
+
+ <small>TimelineSetter::Timeline</small>
+
+ </li>
+
+
+ <li class="r1 ">
+ <span class='object_link'><a href="TimelineSetter/CLI.html#timeline_page_path-instance_method" title="TimelineSetter::CLI#timeline_page_path (method)">#timeline_page_path</a></span>
+
+ <small>TimelineSetter::CLI</small>
+
+ </li>
+
+
+ <li class="r2 ">
+ <span class='object_link'><a href="TimelineSetter/Timeline.html#tmpl-instance_method" title="TimelineSetter::Timeline#tmpl (method)">#tmpl</a></span>
+
+ <small>TimelineSetter::Timeline</small>
+
+ </li>
+
+
+ <li class="r1 ">
+ <span class='object_link'><a href="TimelineSetter/Timeline.html#to_json-instance_method" title="TimelineSetter::Timeline#to_json (method)">#to_json</a></span>
+
+ <small>TimelineSetter::Timeline</small>
+
+ </li>
+
+
+ </ul>
+ </div>
+ </body>
+</html>
diff --git a/documentation/top-level-namespace.html b/documentation/top-level-namespace.html
new file mode 100644
index 0000000..1b965b4
--- /dev/null
+++ b/documentation/top-level-namespace.html
@@ -0,0 +1,112 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+<title>
+ Top Level Namespace
+
+ — Documentation by YARD 0.8.4.1
+
+</title>
+
+ <link rel="stylesheet" href="css/style.css" type="text/css" media="screen" charset="utf-8" />
+
+ <link rel="stylesheet" href="css/common.css" type="text/css" media="screen" charset="utf-8" />
+
+<script type="text/javascript" charset="utf-8">
+ hasFrames = window.top.frames.main ? true : false;
+ relpath = '';
+ framesUrl = "frames.html#!" + escape(window.location.href);
+</script>
+
+
+ <script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
+
+ <script type="text/javascript" charset="utf-8" src="js/app.js"></script>
+
+
+ </head>
+ <body>
+ <div id="header">
+ <div id="menu">
+
+ <a href="_index.html">Index</a> »
+
+
+ <span class="title">Top Level Namespace</span>
+
+
+ <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
+</div>
+
+ <div id="search">
+
+ <a class="full_list_link" id="class_list_link"
+ href="class_list.html">
+ Class List
+ </a>
+
+ <a class="full_list_link" id="method_list_link"
+ href="method_list.html">
+ Method List
+ </a>
+
+ <a class="full_list_link" id="file_list_link"
+ href="file_list.html">
+ File List
+ </a>
+
+</div>
+ <div class="clear"></div>
+ </div>
+
+ <iframe id="search_frame"></iframe>
+
+ <div id="content"><h1>Top Level Namespace
+
+
+
+</h1>
+
+<dl class="box">
+
+
+
+
+
+
+
+
+</dl>
+<div class="clear"></div>
+
+<h2>Defined Under Namespace</h2>
+<p class="children">
+
+
+ <strong class="modules">Modules:</strong> <span class='object_link'><a href="TimelineSetter.html" title="TimelineSetter (module)">TimelineSetter</a></span>
+
+
+
+
+</p>
+
+
+
+
+
+
+
+
+
+</div>
+
+ <div id="footer">
+ Generated on Thu Feb 21 11:20:30 2013 by
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
+ 0.8.4.1 (ruby-1.8.7).
+</div>
+
+ </body>
+</html>
\ No newline at end of file
diff --git a/index.html b/index.html
new file mode 100644
index 0000000..e2d7630
--- /dev/null
+++ b/index.html
@@ -0,0 +1,533 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
+ <link href="http://cloud.webtype.com/css/50942e7d-aebe-4c83-9824-ead7e49ec5af.css" rel="stylesheet" type="text/css" />
+ <style>
+ html {
+ background: #f7f7f7;
+ }
+ body {
+ font-family: Georgia, serif;
+ font-size: 16px;
+ line-height:24px;
+ width: 600px;
+ margin-left:auto;
+ margin-right:auto;
+ margin-top:10px;
+ background: #fff;
+ padding:10px 10px;
+ color:#444;
+ border-top:1px solid #cecece;
+ border-bottom:1px solid #cecece;
+ }
+ h1,h2,h3,h4,h5 {
+ font-family: 'Helvetica Neue', Arial, sans-serif;
+ color:#444;
+ }
+ h1 {
+ padding-top:0;
+ margin-top:0;
+ }
+ h2,h3 {
+ }
+ a.propublica{
+ position:absolute;
+ background: transparent url(http://propublica.github.com/table-fu/documentation/images/proplogo.png) no-repeat -40px -20px;
+ top: 0;
+ left: 0;
+ width: 160px;
+ height: 141px;
+ }
+
+ pre,code {
+ font-family: Monaco, Courier, monospace;
+ font-size:12px;
+ }
+ pre {
+ line-height: 16px;
+ padding:0.5em 1em;
+ overflow: auto;
+ border-left: 1px solid #cecece;
+ margin-left: 0;
+ background:#f7f7f7;
+ }
+ code {
+ padding: 2px;
+ background-color: #f7f7f7;
+ }
+ pre > code {
+ padding:0;
+ }
+ a {
+ color: #4369AF;
+ text-decoration: none;
+ font-weight: bold;
+ }
+ a:hover {
+ text-decoration:underline;
+ }
+ ul {
+ margin:0 1em;
+ padding:0;
+ list-style: disc;
+ }
+ li {
+ margin:0;
+ padding:0;
+ }
+
+ </style>
+ <title>TimelineSetter</title>
+ </head>
+ <body>
+ <a href="http://www.propublica.org" class="propublica"> </a>
+ <h1>TimelineSetter 0.3.1</h1>
+
+<p>TimelineSetter creates beautiful timelines.</p>
+
+<p>It is a command-line utility that takes a <a href="#csv">specially-structured CSV file</a>
+as input and outputs standards-compliant HTML/CSS/JavaScript. It supports any
+span of time from minutes to years, and supports multiple parallel event
+series in a single timeline. It can handle custom descriptions and even
+arbitrary HTML in each event “card.” It creates fluid embeds that will look
+great at any width.</p>
+
+<p>TimelineSetter “bakes out” timelines, ready for uploading directly into your
+CMS, Amazon S3, or however you typically serve static files. It requires no
+server-side processing at all once you’ve generated a timeline.</p>
+
+<p>TimelineSetter <a href="https://github.com/propublica/timeline-setter/">source on Github</a>.</p>
+
+<p><a id="samples"></a></p>
+
+<h2>Assorted Docs and Samples</h2>
+
+<ul>
+<li>TimelineSetter Ruby source <a href="documentation/index.html">documentation</a></li>
+<li>timeline-setter.js <a href="doc/timeline-setter.html">annotated source</a></li>
+<li>A <a href="doc/twitter-demo.html">TimelineSetter demo</a> using Twitter data</li>
+</ul>
+
+
+<p><a id="innards"></a></p>
+
+<h2>How it Works</h2>
+
+<p>The project is broken into two parts: a Ruby package (along with a binary) for
+generating the assets, and the HTML, CSS and JavaScript for the timeline
+itself. TimelineSetter will create a unique HTML page that embeds a JSON
+object with your data. The CSS and JavaScript are identical for every timeline
+created, so you can host those centrally and simply point to them when you
+deploy a timeline, or (with the minified option) you can package them up with your HTML
+and paste it into your CMS all at once. You can <a href="#styling">customize the CSS</a> to match the look
+and feel of your site.</p>
+
+<p><a id="deps"></a></p>
+
+<h2>Dependencies</h2>
+
+<p>TimelineSetter relies on <a href="http://propublica.github.com/table-fu/">TableFu</a>, as
+well as the JavaScript libraries
+<a href="http://documentcloud.github.com/underscore/">Underscore</a> and
+<a href="http://jquery.com/">jQuery</a>. All of these are either installed along with
+TableSetter, or packaged with the source. It has been tested with jQuery 1.5.1
+and Underscore 1.1.5.</p>
+
+<p><a id="install"></a></p>
+
+<h2>Installation</h2>
+
+<p>Install TimelineSetter through RubyGems on Unix-like OSes:</p>
+
+<pre><code>gem install timeline_setter
+</code></pre>
+
+<p>(Note: We haven’t tested using the TimelineSetter tools on Windows even once,
+though the timelines themselves have been tested in modern browsers on
+Windows, Mac and Linux.)</p>
+
+<p><a id="commandline"></a></p>
+
+<h2>The `timeline-setter` command</h2>
+
+<p>After TimelineSetter is installed, the <code>timeline-setter</code> command should be
+available in your shell. The command looks for a CSV file to parse and outputs
+static assets. At any point, you can find help by running <code>timeline-setter</code>
+without any arguments, or by adding the <code>-h</code> flag. Run the command like so:</p>
+
+<pre><code>timeline-setter -c /path/to/data.csv -o /path/to/output/directory
+</code></pre>
+
+<p>Running <code>timeline-setter</code> with no <code>-o</code> option will generate the timeline (and
+supporting assets if applicable) within the current directory.</p>
+
+<p>Full list of options:</p>
+
+<ul>
+<li><code>-c CSV</code> Path to your CSV file.</li>
+<li><code>-o OUTPUT_PATH</code> Path to output timeline and assets. If absent, timeline will be created in current directory.</li>
+<li><code>-a</code> Do not output supporting assets such as CSS and JavaScript. This is useful if you’re customizing those and don’t want your versions clobbered.</li>
+<li><code>-m</code> Create a minified one-page version of your timeline with all supporting assets inline.</li>
+<li><code>-O</code> Open a browser to your new timeline after it is generated (currently Mac OS only).</li>
+<li><code>-i</code> Add a custom interval for background “interval notches.” These take the format of JavaScript date <a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Date#Methods">getter methods</a>. For example, year would be <code>FullYear.</code> All the options are available <a href="#interval_notch_options">below</a>. If absent, TimelineSetter will attempt to automatically create interval notches based on the first and last dates in your tim [...]
+<li><code>-h</code> Print help to standard output.</li>
+</ul>
+
+
+<p><a id="csv"></a></p>
+
+<h2>Setting Up Your CSV File</h2>
+
+<p>TimelineSetter looks for certain column names in your CSV file in order to
+generate a timeline. All columns are required, though as you’ll see, some of
+them can be left blank (see a <a href="https://github.com/propublica/timeline-setter/blob/master/spec/test_data.csv">sample CSV</a>). Here’s a summary of each column and its significance:</p>
+
+<p><a id="date-csv"></a></p>
+
+<h3>date</h3>
+
+<p>The date the event happened. Right now, TimelineSetter only supports
+single-date events, but this can be specific down to the second. The generator
+will try its best to parse out human dates. Try “March 20, 2010,” “3/20/2010,”
+“Mar. 20, 2010 11:59 PM” etc.</p>
+
+<p><a id="display-date-csv"></a></p>
+
+<h3>display_date</h3>
+
+<p>The date <em>displayed</em> on the event’s card in the timeline. If this is blank, it
+will fall back to <code>date</code></p>
+
+<p><a id="desc-csv"></a></p>
+
+<h3>description</h3>
+
+<p>A description of the event.</p>
+
+<p><a id="link-csv"></a></p>
+
+<h3>link</h3>
+
+<p>A URL to send users to more details about an event. This will generate a “read
+more” button at the bottom of the card pointing to the URL.</p>
+
+<p><a id="series-csv"></a></p>
+
+<h3>series</h3>
+
+<p>A string representing the name of the series of events this particular event
+is a part of. TimelineSetter will find all the unique series among events in
+the spreadsheet and assign both colors and checkboxes for them at the top of
+the spreadsheet. Events not assigned to a series will be part of the “default”
+series, which have their timeline notches colored charcoal, and have no
+associated checkbox. <strong>Note:</strong> As a corollary, if you only have one series, it is
+best not to assign a name.</p>
+
+<p><a id="html-csv"></a></p>
+
+<h3>html</h3>
+
+<p>Any arbitrary HTML that will be inserted above <code>description</code>. This
+field may contain image tags, YouTube tags, etc. — nearly everything except
+<code><script></code> tags. If you choose to use JavaScript, you must do it inside an
+iframe and call that iframe inside this field. <strong>Note</strong>: If you put an image or iframe in this field, make sure to set <code>height</code> and <code>width</code> attributes, or the card may not extend around the image.</p>
+
+<p><a id="deployment"></a></p>
+
+<h2>Folder structure and deployment</h2>
+
+<p>After you’ve generated a timeline with the <code>timeline-setter</code> command, you
+should see a structure much like this where you’ve specified your output:</p>
+
+<pre><code> |-output
+ |---timeline.html
+ |---javascripts
+ |-----timeline-setter.js
+ |-----vendor
+ |-------underscore-min.js
+ |-------jquery-min.js
+ |---stylesheets
+ |-----timeline-setter.css
+</code></pre>
+
+<p>Dropping the whole folder onto your server or an asset host like S3 will allow
+the app to run self-contained. It requires no server-side processing at all.
+To drop into your CMS, simply copy the relevant bits of <code>timeline.html</code> and
+paste into your site’s template. Then, adjust the <code><link></code> and <code><script></code> tags
+to point to their appropriate destinations.</p>
+
+<p><a id="defn"></a></p>
+
+<h2>Definitions</h2>
+
+<p>The timeline is made up of non-clickable <em>interval notches</em> used to denote
+periods of time, and <em>event notches</em>, which, when clicked, reveal their
+associated <em>event cards</em>.</p>
+
+<p><a id="configuring"></a></p>
+
+<h2>Configuring the Timeline JavaScript Embed</h2>
+
+<p>Although the <code>timeline-setter</code> command generates a JavaScript embed that prepopulates your data, you can also create this yourself by calling <code>TimelineSetter.timeline.boot</code> with an array of card objects, and a config object.</p>
+
+<pre><code>var myTimeline = TimelineSetter.Timeline.boot([{card}...], {config})
+</code></pre>
+
+<p>The config object looks for <code>interval</code>, <code>container</code>, and <code>formatter</code> options.</p>
+
+<p>The <code>interval</code> option takes an <a href="#interval_notch_options">interval</a> in the form of a JavaScript date getter. The <code>container</code> option allows you to inject the entire timeline into an element with the given selector. (By default this is <code>#timeline</code>). Finally, <code>formatter</code> is a way to format dates on the timeline’s interval notches. Write a formatter like so:</p>
+
+<pre><code>formatter : function(d, defaults) {
+ var months = ['enero', 'febrero', 'marzo', 'abril', 'mayo', 'junio', 'julio', 'agosto', 'septiembre', 'octubre', 'noviembre', 'diciembre'];
+ defaults.month = months[d.getMonth()];
+ return defaults;
+}
+</code></pre>
+
+<p><a name="styling"></a></p>
+
+<h2>Styling Your Timeline</h2>
+
+<p>TimelineSetter timelines are fully style-able. The default “ProPublica theme”
+stylesheet is packaged alongside each generated asset bundle, and is available
+in <code>stylesheets/timeline-setter.css</code>. You can alter this stylesheet, or
+replace it completely. Here’s a guide to do that.</p>
+
+<p><a id="styling-container"></a></p>
+
+<h3>Overview and Styling the Container and Top Matter</h3>
+
+<p>All TimelineSetter CSS is scoped within a namespace starting with <code>TS</code> except for the outermost container (by default <code>#timeline</code>.) The container is configurable with the <code>container</code> argument in the TimelineSetter boot function’s config object.</p>
+
+<p>Upon first glance, it may not seem like there is much markup at all. That’s
+because we make extensive use of JavaScript (ERB-style) templating via
+<a href="http://documentcloud.github.com/underscore/#template">Underscore.js</a> —
+templates for each part of the timeline reside in a JST object at the end of timeline-setter.js.</p>
+
+<p>Currently, series colors are hard coded in the
+JavaScript. We support a maximum of nine series colors (assigned in this order:
+<code>#065718, #EDC047, #91ADD1, #929E5E, #9E5E23, #C44846, #465363, #EDD4A5, #CECECE</code>,
+they can be overridden in the “color priority” section of <code>timeline-setter.css</code>). Technically
+you can create an unlimited number of series, but they will eventually fall back
+to the default charcoal notch color.</p>
+
+<p><a id="styling-bar"></a></p>
+
+<h3>Styling the bar, notches and cards</h3>
+
+<p>The position of interval notches is based on the interval of time between events as automatically determined by the JavaScript. Here’s a sampling of what you might see in interval notches:</p>
+
+<pre><code>year => 2001
+month => June, 2004
+day => May 1, 2005
+hour/minute => 11:59
+second => 11:59:22
+</code></pre>
+
+<p><a id="interval_notch_options"></a>
+The interval notches date spans themselves can be customized by using the <code>-i</code> flag when generating a timeline. The available parameters are</p>
+
+<pre><code>Decade
+Lustrum
+FullYear
+Month
+Week
+Date
+Hours
+Minutes
+Seconds
+</code></pre>
+
+<p><a id="js_api"></a></p>
+
+<h2>The JavaScript API</h2>
+
+<p>As of version 0.3.0, TimelineSetter has a JavaScript API that allows programmatic access to certain events, and the ability to activate cards. To use the API, assign the <code>TimelineSetter.Timeline.boot()</code> function to a variable, and then use methods in the <code>api</code> object like so:</p>
+
+<pre><code>var currentTimeline = TimelineSetter.Timeline.boot(options);
+currentTimeline.api.onLoad(function() {
+ console.log("I'm ready")
+});
+</code></pre>
+
+<p>Here are the API methods:</p>
+
+<h3>onLoad</h3>
+
+<p>Register a callback for when the timeline is loaded.</p>
+
+<h3>onCardAdd</h3>
+
+<p>Register a callback for when a card is added to the timeline. This method has access to the event name and the card object.</p>
+
+<pre><code>currentTimeline.api.onCardAdd(function(evtName, obj, card) {
+ console.log(obj);
+ console.log(card);
+});
+</code></pre>
+
+<p>If you want to customize the card’s template, set <code>card.template</code> to an undescore template function.</p>
+
+<h3>onCardActivate</h3>
+
+<p>Register a callback for when a card is activated (i.e. shown). This method has access to the event name and the card object.</p>
+
+<h3>onBarMove</h3>
+
+<p>Register a callback for when the bar is moved or zoomed. Be careful with this one: Bar move events can be fast and furious, especially with scroll wheels in Safari.</p>
+
+<h3>activateCard</h3>
+
+<p>Show the card matching a given timestamp. Right now, timelines only support one card per timestamp.</p>
+
+<p><a id="roadmap"></a></p>
+
+<h2>Roadmap</h2>
+
+<p>On the client side, there are a number of features we plan to add, including:</p>
+
+<ul>
+<li>Smoother zooming</li>
+<li>Deactivating series checkboxes if none of its events are within the zoomed viewport</li>
+<li>Auto-zooming the timeline if embedded into smaller containers</li>
+<li>More iOS gestures such as “pinching”</li>
+<li>Zooming to fit a series when the series is activated</li>
+<li>Ranges of events (e.g. Elizabeth Taylor was married to Michael Wilding between
+Feb. 21, 1952 and Jan. 26, 1957, as shown
+<a href="http://www.nytimes.com/interactive/2011/03/23/movies/20110323-ELIZABETH-TAYLOR-TIMELINE.html">here</a>)</li>
+<li>Embed code</li>
+<li>JavaScript tests</li>
+</ul>
+
+
+<p><a id="orgs"></a></p>
+
+<h2>Media Organizations Using TimelineSetter</h2>
+
+<ul>
+<li><a href="http://www.propublica.org/special/tbi-psycho-platoon-timeline">ProPublica</a></li>
+<li><a href="http://timelines.latimes.com/bell/">Los Angeles Times</a></li>
+<li><a href="http://www.chicagotribune.com/news/local/chi-taxi-ts-docs-20111118,0,3641202.htmlstory">Chicago Tribune</a></li>
+<li><a href="http://www.huffingtonpost.com/2011/09/09/ground-zero-world-trade-center-freedom-tower_n_955845.html">Huffington Post</a></li>
+<li><a href="http://www.talkingpointsmemo.com/interactive/2011/04/the-wisconsin-union-struggle-timeline.php">Talking Points Memo</a></li>
+<li><a href="http://www.minnpost.com/bachmanntimeline/">MinnPost</a></li>
+<li><a href="http://www.jsonline.com/news/129159038.html">Milwaukee Journal-Sentinel</a></li>
+<li><a href="http://www.wnyc.org/articles/its-free-country/2011/may/20/timeline-gay-marriage-nystate/">WNYC</a></li>
+<li><a href="http://www.artinfo.com/news/story/37506/getting-to-know-ai-weiwei-a-multimedia-biographical-timeline/">ArtInfo</a></li>
+<li><a href="http://www.globalnews.ca/afghanistan/timeline/index.html?utm_source=facebook-twitter&utm_medium=link&utm_campaign=community">Global TV News (Canada)</a></li>
+<li><a href="http://www.pbs.org/newshour/timeline/uprising/">PBS Newshour</a></li>
+<li><a href="http://www.marketplace.org/topics/economy/raising-debt-ceiling">American Public Media: Marketplace</a></li>
+<li><a href="http://blog.chron.com/rickperry/timeline-the-rise-of-rick-perry/">San Antonio Express-News</a></li>
+<li><a href="http://www.voanews.com/english/news/asia/southeast/Burma-Timeline-134760588.html#1183262400000-">Voice of America</a></li>
+<li><a href="http://www.effecinque.org/wp/processo-assange-timeline.html">effecinque</a></li>
+</ul>
+
+
+<p><a id="credits"></a></p>
+
+<h2>Credits</h2>
+
+<p><a href="http://github.com/ashaw">Al Shaw</a>, <a href="http://github.com/thejefflarson">Jeff Larson</a>, ProPublica, <a href="http://github.com/palewire">Ben Welsh</a>, Los Angeles Times</p>
+
+<p><a id="contact"></a></p>
+
+<h2>Contact</h2>
+
+<p>For issues with TimelineSetter, use the
+<a href="https://github.com/propublica/timeline-setter/issues">Issue Tracker</a>. General
+questions should go to <a href="mailto:opensource at propublica.org">opensource at propublica.org</a>.</p>
+
+<p><a id="changelog"></a></p>
+
+<h2>Change Log</h2>
+
+<p><a id="release-031"></a></p>
+
+<h3>0.3.1</h3>
+
+<ul>
+<li>Fix position bug that was preventing card flipping in IE <= 8</li>
+<li>Add <code>noscript</code> fallback</li>
+<li>Add Century, HalfCentury, Quincenenary, HalfHour, QuarterHour, Millenium intervals</li>
+<li>Fix CLI in cases where output directory already exists</li>
+</ul>
+
+
+<p><a id="release-030"></a></p>
+
+<h3>0.3.0</h3>
+
+<ul>
+<li>Add JavaScript API</li>
+<li>Scope timeline to a given element to support multiple timelines on a page</li>
+<li>Add date formatter config option. <em>Thanks <a href="https://github.com/propublica/timeline-setter/pull/26">@omega</a></em></li>
+</ul>
+
+
+<p><a id="release-020"></a></p>
+
+<h3>0.2.0</h3>
+
+<ul>
+<li>New feature adds support for custom interval notch ranges.</li>
+<li>Change command line to output supporting assets by default unless <code>-a</code> is specified</li>
+</ul>
+
+
+<p><a id="release-012"></a></p>
+
+<h3>0.1.2</h3>
+
+<ul>
+<li>Support for decade and lustrum (five year period) interval notches. <em>Thanks, <a href="http://github.com/palewire">Ben Welsh</a></em></li>
+</ul>
+
+
+<p><a id="release-011"></a></p>
+
+<h3>0.1.1</h3>
+
+<ul>
+<li>Made JavaScript smarter about image widths, so now images can be used without specifying height and width attributes</li>
+<li>Fixed “read more” buttons so they can be clicked everywhere, not just on the text</li>
+<li>Fixed a CLI bug where timeline was being put in the wrong place when output directory is specified without a trailing slash</li>
+<li>Fixed duplicate colors in CSS</li>
+<li>Fixed layout rendering problems when a card was more than half the size of the timeline</li>
+<li>Fixed an issue where JSON couldn’t be generated in Ruby 1.9</li>
+</ul>
+
+
+<p><em>Thanks to <a href="http://github.com/palewire">Ben Welsh</a> for pointing out most of these issues</em></p>
+
+<p><a id="release-010"></a></p>
+
+<h3>0.1.0</h3>
+
+<p>Initial release</p>
+
+<p><a id="license"></a></p>
+
+<h2>License</h2>
+
+<p>Copyright © 2011 ProPublica</p>
+
+<p>Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the “Software”), to deal in
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+of the Software, and to permit persons to whom the Software is furnished to
+do so, subject to the following conditions:</p>
+
+<p>The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.</p>
+
+<p>THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.</p>
+
+ </body>
+</html>
diff --git a/lib/timeline_setter.rb b/lib/timeline_setter.rb
new file mode 100644
index 0000000..fcce55a
--- /dev/null
+++ b/lib/timeline_setter.rb
@@ -0,0 +1,15 @@
+
+module TimelineSetter
+ ROOT = File.expand_path "#{File.dirname __FILE__}/.."
+end
+
+require 'date'
+require 'time'
+require 'erb'
+require 'table_fu'
+require 'json'
+require 'kompress'
+
+require "#{TimelineSetter::ROOT}/lib/timeline_setter/version"
+require "#{TimelineSetter::ROOT}/lib/timeline_setter/parser"
+require "#{TimelineSetter::ROOT}/lib/timeline_setter/timeline"
diff --git a/lib/timeline_setter/cli.rb b/lib/timeline_setter/cli.rb
new file mode 100644
index 0000000..d5ac9a0
--- /dev/null
+++ b/lib/timeline_setter/cli.rb
@@ -0,0 +1,98 @@
+require 'optparse'
+require 'fileutils'
+
+module TimelineSetter
+ class CLI
+ def initialize
+ parse_options!
+ end
+
+ def parse_options!
+ @options = {}
+ option_parser = OptionParser.new do |opts|
+ opts.banner = <<-BANNER
+ TimelineSetter: A tool to generate HTML timelines from CSVs.
+
+ Usage:
+ BANNER
+
+ opts.on('-c', '--csv CSV', 'CSV input file') do |c|
+ @options[:csv] = c
+ end
+ opts.on('-o', '--output OUTPUT', 'Output directory to install timeline into.') do |o|
+ @options[:output] = o
+ end
+ opts.on('-a', '--without-assets', 'Output timeline without supporting assets') do |a|
+ @options[:no_assets] = a
+ end
+ opts.on('-O', '--open', 'Open generated timeline in a browser') do |o|
+ @options[:open] = o
+ end
+ opts.on('-m', '--min', 'Create a minified one-page version of the timeline') do |m|
+ @options[:min] = m
+ end
+ opts.on('-i', '--interval INTERVAL', 'Override automatic interval notches with a custom interval.') do |i|
+ @options[:interval] = i
+ end
+
+
+ opts.on_tail("-h", "--help", "Show this message") do
+ puts opts
+ exit
+ end
+ end
+ option_parser.parse!
+
+ if @options.empty?
+ puts option_parser.on_tail
+ exit
+ else
+ compile!
+ end
+ end
+
+ def sheet
+ File.open(@options[:csv]).read
+ end
+
+ def events
+ TimelineSetter::Parser.new sheet
+ end
+
+ def html
+ TimelineSetter::Timeline.new({
+ :events => events.events,
+ :interval => @options[:interval] || ''
+ }).send(@options[:min] ? :timeline_min : :timeline)
+ end
+
+ def outdir
+ @options[:output] ? @options[:output] : "#{`pwd`.strip}/"
+ end
+
+ def timeline_page_path
+ File.join(outdir, 'timeline.html')
+ end
+
+ def compile!
+ FileUtils.mkdir_p outdir unless File.exists? outdir
+ if !@options[:no_assets] || !@options[:min]
+ FileUtils.cp_r(Dir.glob("#{TimelineSetter::ROOT}/public/*"), outdir)
+ # Concatenate JSTs to timeline-setter.js and remove templates.js
+ `cat #{outdir}/javascripts/templates.js >> #{outdir}/javascripts/timeline-setter.js && rm -rf #{outdir}/javascripts/templates*`
+ end
+
+ File.open(timeline_page_path, 'w+') do |doc|
+ doc.write html
+ end
+
+ puts "== Files copied to #{outdir}"
+
+ if @options[:open]
+ puts "== Opening ..."
+ %x[ open #{timeline_page_path} ]
+ end
+ end
+
+ end
+end
diff --git a/lib/timeline_setter/parser.rb b/lib/timeline_setter/parser.rb
new file mode 100644
index 0000000..b7dcc72
--- /dev/null
+++ b/lib/timeline_setter/parser.rb
@@ -0,0 +1,28 @@
+module TimelineSetter
+ class Parser
+ attr_reader :events
+
+ # Initialize a new timeline from a CSV file via TableFu,
+ # add a hash for each row (event) in the sheet to an events array.
+ # Sheet should contain columns for
+ # * date
+ # * display_date
+ # * description
+ # * link
+ # * thumbnail
+ # * series
+ # * html
+ #
+ def initialize(sheet)
+ @events = []
+ spreadsheet = TableFu.new(sheet) do |s|
+ s.columns = %w[date display_date description link series html]
+ end
+
+ spreadsheet.rows.each do |row|
+ hash = spreadsheet.columns.inject({}) {|memo, column| memo[column.to_sym] = row[column].to_s ; memo}
+ @events << hash
+ end
+ end
+ end
+end
diff --git a/lib/timeline_setter/timeline.rb b/lib/timeline_setter/timeline.rb
new file mode 100644
index 0000000..749d03e
--- /dev/null
+++ b/lib/timeline_setter/timeline.rb
@@ -0,0 +1,52 @@
+module TimelineSetter
+ class Timeline
+ attr_reader :timeline
+ # Instantiate a new timeline from an events
+ # array created in Parser#initialize
+ def initialize(opts = {})
+ @events = opts[:events]
+ @interval = opts[:interval] || ''
+ end
+
+ # Convert human dates to timestamps, sort the hash by timestamp, and
+ # convert the events hash to JSON to stick into our HTML.
+ def to_json
+ @events.each {|r| r[:timestamp] = Time.parse(r[:date]).to_i * 1000 }
+ @events.to_json
+ end
+
+ def config_json
+ {
+ "interval" => "#{@interval}",
+ "container" => "#timeline"
+ }.to_json
+ end
+
+ def timeline_markup
+ tmpl("timeline-markup.erb")
+ end
+
+ # Create timeline HTML by interpolating events hash into an ERB template.
+ # Re-template timeline by editing ../templates/timeline.erb
+ # This version preserves external links to CSS and JS.
+ def timeline
+ @timeline = tmpl("timeline.erb")
+ end
+
+ # Create a minified one-page version of a timeline by minifying CSS and JS and embedding all assets
+ # into our ERB template.
+ def timeline_min
+ @js = ""
+ @css = Kompress::CSS.new(File.open("#{TimelineSetter::ROOT}/public/stylesheets/timeline-setter.css").read).css
+ libs = Dir.glob("#{TimelineSetter::ROOT}/public/javascripts/vendor/**").select {|q| q =~ /min/ }
+ libs.each { |lib| @js << File.open(lib,'r').read }
+ @min_html = Kompress::HTML.new(timeline_markup).html
+ @js << File.open("#{TimelineSetter::ROOT}/public/javascripts/timeline-setter.min.js", 'r').read
+ @timeline = tmpl("timeline-min.erb")
+ end
+
+ def tmpl(tmpl_file)
+ ERB.new(File.open("#{TimelineSetter::ROOT}/templates/#{tmpl_file}").read).result(binding)
+ end
+ end
+end
diff --git a/lib/timeline_setter/version.rb b/lib/timeline_setter/version.rb
new file mode 100644
index 0000000..d8fb033
--- /dev/null
+++ b/lib/timeline_setter/version.rb
@@ -0,0 +1,3 @@
+module TimelineSetter
+ VERSION = "0.3.2"
+end
diff --git a/metadata.yml b/metadata.yml
new file mode 100644
index 0000000..1f2afaa
--- /dev/null
+++ b/metadata.yml
@@ -0,0 +1,200 @@
+--- !ruby/object:Gem::Specification
+name: timeline_setter
+version: !ruby/object:Gem::Version
+ hash: 23
+ prerelease:
+ segments:
+ - 0
+ - 3
+ - 2
+ version: 0.3.2
+platform: ruby
+authors:
+- Al Shaw
+- Jeff Larson
+autorequire:
+bindir: bin
+cert_chain: []
+
+date: 2013-02-21 00:00:00 Z
+dependencies:
+- !ruby/object:Gem::Dependency
+ name: json
+ prerelease: false
+ requirement: &id001 !ruby/object:Gem::Requirement
+ none: false
+ requirements:
+ - - ">="
+ - !ruby/object:Gem::Version
+ hash: 3
+ segments:
+ - 0
+ version: "0"
+ type: :runtime
+ version_requirements: *id001
+- !ruby/object:Gem::Dependency
+ name: table_fu
+ prerelease: false
+ requirement: &id002 !ruby/object:Gem::Requirement
+ none: false
+ requirements:
+ - - ">="
+ - !ruby/object:Gem::Version
+ hash: 3
+ segments:
+ - 0
+ version: "0"
+ type: :runtime
+ version_requirements: *id002
+- !ruby/object:Gem::Dependency
+ name: kompress
+ prerelease: false
+ requirement: &id003 !ruby/object:Gem::Requirement
+ none: false
+ requirements:
+ - - ">="
+ - !ruby/object:Gem::Version
+ hash: 27
+ segments:
+ - 0
+ - 0
+ - 2
+ version: 0.0.2
+ type: :runtime
+ version_requirements: *id003
+- !ruby/object:Gem::Dependency
+ name: jammit
+ prerelease: false
+ requirement: &id004 !ruby/object:Gem::Requirement
+ none: false
+ requirements:
+ - - ">="
+ - !ruby/object:Gem::Version
+ hash: 3
+ segments:
+ - 0
+ version: "0"
+ type: :runtime
+ version_requirements: *id004
+- !ruby/object:Gem::Dependency
+ name: rspec
+ prerelease: false
+ requirement: &id005 !ruby/object:Gem::Requirement
+ none: false
+ requirements:
+ - - ">="
+ - !ruby/object:Gem::Version
+ hash: 15
+ segments:
+ - 2
+ - 0
+ - 0
+ version: 2.0.0
+ type: :development
+ version_requirements: *id005
+description: TimelineSetter is a tool to create HTML timelines from spreadsheets of events.
+email: almshaw at gmail.com
+executables:
+- timeline-setter
+extensions: []
+
+extra_rdoc_files:
+- LICENSE.txt
+- README
+files:
+- .document
+- LICENSE.txt
+- README
+- Rakefile
+- bin/timeline-setter
+- config/assets.yml
+- doc/doc.markdown
+- doc/doc_wrapper.erb
+- doc/docco.css
+- doc/static-demo.html
+- doc/templates.html
+- doc/timeline-setter.html
+- doc/timeline-setter.min.html
+- doc/todo.markdown
+- doc/twitter-demo.html
+- documentation/TimelineSetter.html
+- documentation/TimelineSetter/CLI.html
+- documentation/TimelineSetter/Parser.html
+- documentation/TimelineSetter/Timeline.html
+- documentation/TimelineSetter/Util.html
+- documentation/_index.html
+- documentation/class_list.html
+- documentation/css/common.css
+- documentation/css/full_list.css
+- documentation/css/style.css
+- documentation/file.README.html
+- documentation/file_list.html
+- documentation/frames.html
+- documentation/index.html
+- documentation/js/app.js
+- documentation/js/full_list.js
+- documentation/js/jquery.js
+- documentation/method_list.html
+- documentation/top-level-namespace.html
+- index.html
+- lib/timeline_setter.rb
+- lib/timeline_setter/cli.rb
+- lib/timeline_setter/parser.rb
+- lib/timeline_setter/timeline.rb
+- lib/timeline_setter/version.rb
+- public/javascripts/templates.js
+- public/javascripts/templates/card.jst
+- public/javascripts/templates/notch.jst
+- public/javascripts/templates/series_legend.jst
+- public/javascripts/templates/timeline.jst
+- public/javascripts/templates/year_notch.jst
+- public/javascripts/timeline-setter.js
+- public/javascripts/timeline-setter.min.js
+- public/javascripts/vendor/jquery-min.js
+- public/javascripts/vendor/jquery.js
+- public/javascripts/vendor/underscore-min.js
+- public/javascripts/vendor/underscore.js
+- public/stylesheets/timeline-setter.css
+- spec/spec_helper.rb
+- spec/test_data.csv
+- spec/timeline-debug.html
+- spec/timeline_setter_spec.rb
+- templates/timeline-markup.erb
+- templates/timeline-min.erb
+- templates/timeline.erb
+- timeline_setter.gemspec
+homepage: http://github.com/propublica/timeline-setter
+licenses: []
+
+post_install_message:
+rdoc_options: []
+
+require_paths:
+- lib
+required_ruby_version: !ruby/object:Gem::Requirement
+ none: false
+ requirements:
+ - - ">="
+ - !ruby/object:Gem::Version
+ hash: 3
+ segments:
+ - 0
+ version: "0"
+required_rubygems_version: !ruby/object:Gem::Requirement
+ none: false
+ requirements:
+ - - ">="
+ - !ruby/object:Gem::Version
+ hash: 3
+ segments:
+ - 0
+ version: "0"
+requirements: []
+
+rubyforge_project:
+rubygems_version: 1.8.24
+signing_key:
+specification_version: 3
+summary: TimelineSetter is a tool to create HTML timelines from spreadsheets of events.
+test_files: []
+
diff --git a/public/javascripts/templates.js b/public/javascripts/templates.js
new file mode 100644
index 0000000..27d2465
--- /dev/null
+++ b/public/javascripts/templates.js
@@ -0,0 +1 @@
+(function(){window.JST=window.JST||{};var a=function(c){var b=new Function("obj","var __p=[],print=function(){__p.push.apply(__p,arguments);};with(obj||{}){__p.push('"+c.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/<%=([\s\S]+?)%>/g,function(d,e){return"',"+e.replace(/\\'/g,"'")+",'"}).replace(/<%([\s\S]+?)%>/g,function(d,e){return"');"+e.replace(/\\'/g,"'").replace(/[\r\n\t]/g," ")+"__p.push('"}).replace(/\r/g,"\\r").replace(/\n/g,"\\n").replace(/\t/g,"\\t")+"');}return __p.join(' [...]
\ No newline at end of file
diff --git a/public/javascripts/templates/card.jst b/public/javascripts/templates/card.jst
new file mode 100644
index 0000000..47a6761
--- /dev/null
+++ b/public/javascripts/templates/card.jst
@@ -0,0 +1,21 @@
+<div class="TS-card_container TS-card_container_<%= (card.get("series") || "").replace(/\W/g, "") %>">
+<div class="TS-css_arrow TS-css_arrow_up TS-css_arrow_color_<%= card.get("topcolor") %>"></div>
+ <div class="TS-item TS-item_color_<%= card.get("topcolor") %>" data-timestamp="<%= card.get("timestamp") %>">
+ <div class="TS-item_label">
+ <% if (!_.isEmpty(card.get("html"))){ %>
+ <div class="TS-item_user_html">
+ <%= card.get("html") %>
+ </div>
+ <% } %>
+ <%= card.get("description") %>
+ </div>
+ <% if (!_.isEmpty(card.get("link"))){ %>
+ <a class="TS-read_btn" target="_blank" href="<%= card.get("link") %>">Read More</a>
+ <% } %>
+
+ <div class="TS-item_year">
+ <span class="TS-item_year_text"><%= (card.get("display_date") || "").length > 0 ? card.get("display_date") : card.get("date") %></span>
+ <div class="TS-permalink">∞</div>
+ </div>
+ </div>
+</div>
\ No newline at end of file
diff --git a/public/javascripts/templates/notch.jst b/public/javascripts/templates/notch.jst
new file mode 100644
index 0000000..7b874b9
--- /dev/null
+++ b/public/javascripts/templates/notch.jst
@@ -0,0 +1 @@
+<div class="TS-notch TS-notch_<%= timestamp %> TS-notch_<%= series.replace(/\W/g, "") %> TS-notch_color_<%= topcolor %>"></div>
diff --git a/public/javascripts/templates/series_legend.jst b/public/javascripts/templates/series_legend.jst
new file mode 100644
index 0000000..8377c04
--- /dev/null
+++ b/public/javascripts/templates/series_legend.jst
@@ -0,0 +1,3 @@
+<div class="TS-series_legend_item TS-series_legend_item_<%= name.replace(/\W/g, "") %>">
+ <span class="TS-series_legend_swatch TS-series_legend_swatch_<%= color %>"> </span> <span class="TS-series_legend_text"><%= name %></span>
+</div>
diff --git a/public/javascripts/templates/timeline.jst b/public/javascripts/templates/timeline.jst
new file mode 100644
index 0000000..e477216
--- /dev/null
+++ b/public/javascripts/templates/timeline.jst
@@ -0,0 +1,23 @@
+<div class="timeline_setter">
+ <div class="TS-top_matter_container">
+ <div class="TS-controls">
+ <div class="TS-zoom-container">
+ <a href="#" class="TS-zoom TS-zoom_in"><span class="TS-controls_inner_text TS-zoom_inner_text">+</span></a>
+ <a href="#" class="TS-zoom TS-zoom_out"><span class="TS-controls_inner_text TS-zoom_inner_text">-</span></a>
+ </div>
+ <div class="TS-choose-container">
+ <a href="#" class="TS-choose TS-choose_prev">« <span class="TS-controls_inner_text">Previous</span></a>
+ <a href="#" class="TS-choose TS-choose_next"><span class="TS-controls_inner_text">Next</span> »</a>
+ </div>
+ </div>
+ <div class="TS-series_nav_container"></div>
+ </div>
+
+ <div class="TS-notchbar_container">
+ <div class="TS-notchbar"></div>
+ </div>
+ <div class="TS-card_scroller">
+ <div class="TS-card_scroller_inner">
+ </div>
+ </div>
+</div>
\ No newline at end of file
diff --git a/public/javascripts/templates/year_notch.jst b/public/javascripts/templates/year_notch.jst
new file mode 100644
index 0000000..a8a97f5
--- /dev/null
+++ b/public/javascripts/templates/year_notch.jst
@@ -0,0 +1,3 @@
+<div class="TS-year_notch TS-year_notch_<%= timestamp %>">
+ <span class="TS-year_notch_year_text"><%= human %></span>
+</div>
diff --git a/public/javascripts/timeline-setter.js b/public/javascripts/timeline-setter.js
new file mode 100644
index 0000000..0f16eed
--- /dev/null
+++ b/public/javascripts/timeline-setter.js
@@ -0,0 +1,1098 @@
+(function($, undefined){
+
+ // Expose `TimelineSetter` globally, so we can call `Timeline.Timeline.boot()`
+ // to kick off at any point.
+ var TimelineSetter = window.TimelineSetter = (window.TimelineSetter || {});
+
+ // Current version of `TimelineSetter`
+ TimelineSetter.VERSION = "0.3.2";
+
+ // Mixins
+ // ------
+ // Each mixin operates on an object's `prototype`.
+
+ // The `observable` mixin adds simple event notifications to the passed in
+ // object. Unlike other notification systems, when an event is triggered every
+ // callback bound to the object is invoked.
+ var observable = function(obj){
+ // Registers a callback function for notification at a later time.
+ obj.bind = function(e, cb){
+ var callbacks = (this._callbacks = this._callbacks || {});
+ var list = (callbacks[e] = callbacks[e] || []);
+ list.push(cb);
+ };
+
+ // Invoke all callbacks registered to the object with `bind`.
+ obj.trigger = function(e){
+ if(!this._callbacks) return;
+ var list = this._callbacks[e];
+ if(!list) return;
+ for(var i = 0; i < list.length; i++) list[i].apply(this, arguments);
+ };
+ };
+
+
+ // Each `transformable` contains two event listeners that handle moving associated
+ // DOM elements around the page.
+ var transformable = function(obj){
+ // Move the associated element a specified delta.
+ obj.move = function(evtName, e){
+ if (!e.deltaX) return;
+ if (_.isUndefined(this.currOffset)) this.currOffset = 0;
+ this.currOffset += e.deltaX;
+ this.el.css({"left" : this.currOffset});
+ };
+
+ // The width for the `Bar` and `CardContainer` objects is set in percentages,
+ // in order to zoom the Timeline all that's needed is to increase or decrease
+ // the percentage width.
+ obj.zoom = function(evtName, e){
+ if (!e.width) return;
+ this.el.css({ "width": e.width });
+ };
+ };
+
+ // The `queryable` mixin scopes jQuery to
+ // a given container.
+ var queryable = function(obj, container) {
+ obj.$ = function(query) {
+ return window.$(query, container);
+ };
+ };
+
+
+ // Plugins
+ // -------
+ // Each plugin operates on an instance of an object.
+
+ // Check to see if we're on a mobile device.
+ var touchInit = 'ontouchstart' in document;
+ if (touchInit) $.event.props.push("touches");
+
+ // The `draggable` plugin tracks changes in X offsets due to mouse movement
+ // or finger gestures and proxies associated events on a particular element.
+ // Most of this is inspired by polymaps.
+ var draggable = function(obj){
+ var drag;
+
+ // Start tracking deltas due to a tap or single click.
+ function mousedown(e){
+ e.preventDefault();
+ drag = {x: e.pageX};
+ e.type = "dragstart";
+ obj.el.trigger(e);
+ }
+
+ // The user is interacting; capture the offset and trigger a `dragging` event.
+ function mousemove(e){
+ if (!drag) return;
+ e.preventDefault();
+ e.type = "dragging";
+ e = _.extend(e, {
+ deltaX: (e.pageX || e.touches[0].pageX) - drag.x
+ });
+ drag = { x: (e.pageX || e.touches[0].pageX) };
+ obj.el.trigger(e);
+ }
+
+ // We're done tracking the movement set drag back to `null` for the next event.
+ function mouseup(e){
+ if (!drag) return;
+ drag = null;
+ e.type = "dragend";
+ obj.el.trigger(e);
+ }
+
+ if (!touchInit) {
+ // Bind on mouse events if we have a mouse...
+ obj.el.bind("mousedown", mousedown);
+
+ $(document).bind("mousemove", mousemove);
+ $(document).bind("mouseup", mouseup);
+ } else {
+ // otherwise capture `touchstart` events in order to simulate `doubletap` events.
+ var last;
+ obj.el.bind("touchstart", function(e) {
+ var now = Date.now();
+ var delta = now - (last || now);
+ var type = delta > 0 && delta <= 250 ? "doubletap" : "tap";
+ drag = {x: e.touches[0].pageX};
+ last = now;
+ obj.el.trigger($.Event(type));
+ });
+
+ obj.el.bind("touchmove", mousemove);
+ obj.el.bind("touchend", mouseup);
+ }
+ };
+
+
+ // Older versions of safari fire incredibly huge mousewheel deltas. We'll need
+ // to dampen the effects.
+ var safari = /WebKit\/533/.test(navigator.userAgent);
+
+ // The `wheel` plugin captures events triggered by mousewheel, and dampen the
+ // `delta` if running in Safari.
+ var wheel = function(obj){
+ function mousewheel(e){
+ e.preventDefault();
+ var delta = (e.wheelDelta || -e.detail);
+ if (safari){
+ var negative = delta < 0 ? -1 : 1;
+ delta = Math.log(Math.abs(delta)) * negative * 2;
+ }
+ e.type = "scrolled";
+ e.deltaX = delta;
+ obj.el.trigger(e);
+ }
+
+ obj.el.bind("mousewheel DOMMouseScroll", mousewheel);
+ };
+
+ // Utilities
+ // -----
+
+ // A utility class for storing the extent of the timeline.
+ var Bounds = function(){
+ this.min = +Infinity;
+ this.max = -Infinity;
+ };
+
+ Bounds.prototype.extend = function(num){
+ this.min = Math.min(num, this.min);
+ this.max = Math.max(num, this.max);
+ };
+
+ Bounds.prototype.width = function(){
+ return this.max - this.min;
+ };
+
+ // Translate a particular number from the current bounds to a given range.
+ Bounds.prototype.project = function(num, max){
+ return (num - this.min) / this.width() * max;
+ };
+
+
+ // `Intervals` is a particularly focused class to calculate even breaks based
+ // on the passed in `Bounds`.
+ var Intervals = function(bounds, interval) {
+ this.max = bounds.max;
+ this.min = bounds.min;
+
+ if(!interval || !this.INTERVALS[interval]) {
+ var i = this.computeMaxInterval();
+ this.maxInterval = this.INTERVAL_ORDER[i];
+ this.idx = i;
+ } else {
+ this.maxInterval = interval;
+ this.idx = _.indexOf(this.INTERVAL_ORDER, interval);
+ }
+ };
+
+ // Format dates based for AP style.
+ // Pass an override function in the config object to override.
+ Intervals.dateFormats = function(timestamp) {
+ var d = new Date(timestamp);
+ var defaults = {};
+ var months = ['Jan.', 'Feb.', 'March', 'April', 'May', 'June', 'July', 'Aug.', 'Sept.', 'Oct.', 'Nov.', 'Dec.'];
+ var bigHours = d.getHours() > 12;
+ var ampm = " " + (d.getHours() >= 12 ? 'p.m.' : 'a.m.');
+
+
+ defaults.month = months[d.getMonth()];
+ defaults.year = d.getFullYear();
+ defaults.date = defaults.month + " " + d.getDate() + ', ' + defaults.year;
+
+ var hours;
+ if(bigHours) {
+ hours = d.getHours() - 12;
+ } else {
+ hours = d.getHours() > 0 ? d.getHours() : "12";
+ }
+
+ hours += ":" + padNumber(d.getMinutes());
+ defaults.hourWithMinutes = hours + ampm;
+ defaults.hourWithMinutesAndSeconds = hours + ":" + padNumber(d.getSeconds()) + ampm;
+ // If we have user overrides, set them to defaults.
+ return Intervals.formatter(d, defaults) || defaults;
+ };
+
+ // A utility function to format dates in AP Style.
+ Intervals.dateStr = function(timestamp, interval) {
+ var d = new Intervals.dateFormats(timestamp);
+ switch (interval) {
+ case "Millennium":
+ return d.year;
+ case "Quincentenary":
+ return d.year;
+ case "Century":
+ return d.year;
+ case "HalfCentury":
+ return d.year;
+ case "Decade":
+ return d.year;
+ case "Lustrum":
+ return d.year;
+ case "FullYear":
+ return d.year;
+ case "Month":
+ return d.month + ', ' + d.year;
+ case "Week":
+ return d.date;
+ case "Date":
+ return d.date;
+ case "Hours":
+ return d.hourWithMinutes;
+ case "HalfHour":
+ return d.hourWithMinutes;
+ case "QuarterHour":
+ return d.hourWithMinutes;
+ case "Minutes":
+ return d.hourWithMinutes;
+ case "Seconds":
+ return d.hourWithMinutesAndSeconds;
+ }
+ };
+
+ Intervals.prototype = {
+ // Sane estimates of date ranges for the `isAtLeastA` test.
+ INTERVALS : {
+ Millennium : 69379200000000, // 2200 years is the trigger
+ Quincentenary : 34689600000000, // 1100 years is the trigger
+ Century : 9460800000000, // 300 years is the trigger
+ HalfCentury : 3153600000000, // 100 years is the trigger
+ Decade : 315360000000,
+ Lustrum : 157680000000,
+ FullYear : 31536000000,
+ Month : 2592000000,
+ Week : 604800000,
+ Date : 86400000,
+ Hours : 3600000,
+ HalfHour : 1800000,
+ QuarterHour : 900000,
+ Minutes : 60000,
+ Seconds : 1000 // 1,000 millliseconds equals on second
+ },
+
+ // The order used when testing where exactly a timespan falls.
+ INTERVAL_ORDER : [
+ 'Seconds',
+ 'Minutes',
+ 'QuarterHour',
+ 'HalfHour',
+ 'Hours',
+ 'Date',
+ 'Week',
+ 'Month',
+ 'FullYear',
+ 'Lustrum',
+ 'Decade',
+ 'HalfCentury',
+ 'Century',
+ 'Quincentenary',
+ 'Millennium'
+ ],
+
+ // The year adjustment used for supra-year intervals.
+ YEAR_FRACTIONS : {
+ Millenium : 1000,
+ Quincentenary : 500,
+ Century : 100,
+ HalfCentury : 50,
+ Decade : 10,
+ Lustrum : 5
+ },
+
+ // A test to find the appropriate range of intervals, for example if a range of
+ // timestamps only spans hours this will return true when called with `"Hours"`.
+ isAtLeastA : function(interval) {
+ return ((this.max - this.min) > this.INTERVALS[interval]);
+ },
+
+ // Find the maximum interval we should use based on the estimates in `INTERVALS`.
+ computeMaxInterval : function() {
+ for (var i = 0; i < this.INTERVAL_ORDER.length; i++) {
+ if (!this.isAtLeastA(this.INTERVAL_ORDER[i])) break;
+ }
+ return i - 1;
+ },
+
+ // Return the calculated `maxInterval`.
+ getMaxInterval : function() {
+ return this.INTERVALS[this.INTERVAL_ORDER[this.idx]];
+ },
+
+ // Floor the year to a given epoch.
+ getYearFloor : function(date, intvl){
+ var fudge = this.YEAR_FRACTIONS[intvl] || 1;
+ return (date.getFullYear() / fudge | 0) * fudge;
+ },
+
+ // Return a date with the year set to the next interval in a given epoch.
+ getYearCeil : function(date, intvl){
+ if(this.YEAR_FRACTIONS[intvl]) return this.getYearFloor(date, intvl) + this.YEAR_FRACTIONS[intvl];
+ return date.getFullYear();
+ },
+
+ // Return a Date object rounded down to the previous Sunday, a.k.a. the first day of the week.
+ getWeekFloor: function(date) {
+ thisDate = new Date(date.getFullYear(), date.getMonth(), date.getDate());
+ thisDate.setDate(date.getDate() - date.getDay());
+ return thisDate;
+ },
+
+ // Return a Date object rounded up to the next Sunday, a.k.a. the start of the next week.
+ getWeekCeil: function(date) {
+ thisDate = new Date(date.getFullYear(), date.getMonth(), date.getDate());
+ thisDate.setDate(thisDate.getDate() + (7 - date.getDay()));
+ return thisDate;
+ },
+
+ // Return the half of the hour this date belongs to. Anything before 30 min.
+ // past the hour comes back as zero. Anything after comes back as 30.
+ getHalfHour: function(date) {
+ return date.getMinutes() > 30 ? 30 : 0;
+ },
+
+ // Return the quarter of the hour this date belongs to. Anything before 15 min.
+ // past the hour comes back as zero; 15-30 comes back as 15; 30-45 as 30;
+ // 45-60 as 45.
+ getQuarterHour: function(date) {
+ var minutes = date.getMinutes();
+ if (minutes < 15) return 0;
+ if (minutes < 30) return 15;
+ if (minutes < 45) return 30;
+ return 45;
+ },
+
+ // Zero out a date from the current interval down to seconds.
+ floor : function(ts){
+ var date = new Date(ts);
+ var intvl = this.INTERVAL_ORDER[this.idx];
+ var idx = this.idx > _.indexOf(this.INTERVAL_ORDER,'FullYear') ?
+ _.indexOf(this.INTERVAL_ORDER,'FullYear') :
+ idx;
+
+ // Zero the special extensions, and adjust as idx necessary.
+ date.setFullYear(this.getYearFloor(date, intvl));
+ switch(intvl){
+ case 'Week':
+ date.setDate(this.getWeekFloor(date).getDate());
+ idx = _.indexOf(this.INTERVAL_ORDER, 'Week');
+ case 'HalfHour':
+ date.setMinutes(this.getHalfHour(date));
+ case 'QuarterHour':
+ date.setMinutes(this.getQuarterHour(date));
+ }
+
+ // Zero out the rest
+ while(idx--){
+ intvl = this.INTERVAL_ORDER[idx];
+ if (!(_.include(['Week', 'HalfHour', 'QuarterHour'].concat(_.keys(this.YEAR_FRACTIONS)), intvl)))
+ date["set" + intvl](intvl === "Date" ? 1 : 0);
+ }
+
+ return date.getTime();
+ },
+
+ // Find the next date based on the past in timestamp.
+ ceil : function(ts){
+ var date = new Date(this.floor(ts));
+ var intvl = this.INTERVAL_ORDER[this.idx];
+
+ date.setFullYear(this.getYearCeil(date, intvl));
+ switch(intvl){
+ case 'Week':
+ date.setTime(this.getWeekCeil(date).getTime());
+ break;
+ case 'HalfHour':
+ date.setMinutes(this.getHalfHour(date) + 30);
+ break;
+ case 'QuarterHour':
+ date.setMinutes(this.getQuarterHour(date) + 15);
+ break;
+ default:
+ if (!(_.include(['Week', 'HalfHour', 'QuarterHour'].concat(_.keys(this.YEAR_FRACTIONS)), intvl)))
+ date["set" + intvl](date["get" + intvl]() + 1);
+ }
+ return date.getTime();
+ },
+
+ // The actual difference in timespans accounting for time oddities like
+ // different length months and leap years.
+ span : function(ts){
+ return this.ceil(ts) - this.floor(ts);
+ },
+
+ // Calculate and return a list of human formatted strings and raw timestamps.
+ getRanges : function() {
+ if (this.intervals) return this.intervals;
+ this.intervals = [];
+ for (var i = this.floor(this.min); i <= this.ceil(this.max); i += this.span(i)) {
+ this.intervals.push({
+ human : Intervals.dateStr(i, this.maxInterval),
+ timestamp : i
+ });
+ }
+ return this.intervals;
+ }
+ };
+
+ // Handy dandy function to bind a listener on multiple events. For example,
+ // `Bar` and `CardContainer` are bound like so on "move" and "zoom":
+ //
+ // sync(this.bar, this.cardCont, "move", "zoom");
+ //
+ var sync = function(origin, listener){
+ var events = Array.prototype.slice.call(arguments, 2);
+ _.each(events, function(ev){
+ origin.bind(ev, function(){ listener[ev].apply(listener, arguments); });
+ });
+ };
+
+ // Simple function to strip suffixes like `"px"` and return a clean integer for
+ // use.
+ var cleanNumber = function(str){
+ return parseInt(str.replace(/^[^+\-\d]?([+\-]?\d+)?.*$/, "$1"), 10);
+ };
+
+ // Zero pad a number less than 10 and return a 2 digit value.
+ var padNumber = function(number) {
+ return (number < 10 ? '0' : '') + number;
+ };
+
+ // A quick and dirty hash manager for setting and getting values from
+ // `window.location.hash`
+ var hashStrip = /^#*/;
+ var history = {
+ get : function(){
+ return window.location.hash.replace(hashStrip, "");
+ },
+
+ set : function(url){
+ window.location.hash = url;
+ }
+ };
+
+ // Every new `Series` gets new color. If there are too many series
+ // the remaining series will be a simple gray.
+
+ // These colors can be styled like such in
+ // timeline-setter.css, where the numbers 1-9 cycle through in that order:
+ //
+ // .TS-notch_color_1,.TS-series_legend_swatch_1 {
+ // background: #065718 !important;
+ // }
+ // .TS-css_arrow_color_1 {
+ // border-bottom-color:#065718 !important;
+ // }
+ // .TS-item_color_1 {
+ // border-top:1px solid #065718 !important;
+ // }
+ //
+ // The default color will fall through to what is styled with
+ // `.TS-foo_color_default`
+ var curColor = 1;
+ var color = function(){
+ var chosen;
+ if (curColor < 10) {
+ chosen = curColor;
+ curColor += 1;
+ } else {
+ chosen = "default";
+ }
+ return chosen;
+ };
+
+
+
+ // Models
+ // ------
+
+ // Initialize a Timeline object in a container element specified
+ // in the config object.
+ var Timeline = TimelineSetter.Timeline = function(data, config) {
+ _.bindAll(this, 'render', 'setCurrentTimeline');
+ this.data = data.sort(function(a, b){ return a.timestamp - b.timestamp; });
+ this.bySid = {};
+ this.cards = [];
+ this.series = [];
+ this.config = config;
+ this.config.container = this.config.container || "#timeline";
+
+ // Override default date formats
+ // by writing a `formatter` function that returns
+ // an object containing all the formats
+ // you'd like to override. Pass in `d`
+ // which is a date object, and `defaults`, which
+ // are the formatters we override.
+ //
+ // formatter : function(d, defaults) {
+ // defaults.months = ['enero', 'febrero', 'marzo',
+ // 'abril', 'mayo', 'junio', 'julio',
+ // 'agosto', 'septiembre', 'octubre',
+ // 'noviembre', 'diciembre'];
+ // return defaults;
+ // }
+ Intervals.formatter = this.config.formatter || function(d, defaults) { return defaults; };
+ };
+ observable(Timeline.prototype);
+
+ Timeline.prototype = _.extend(Timeline.prototype, {
+ // The main kickoff point for rendering the timeline. The `Timeline` constructor
+ // takes a JSON array of card representations and then builds series, calculates
+ // intervals `sync`s the `Bar` and `CardContainer` objects.
+ render : function() {
+ var that = this;
+
+ // create `this.$` from queryable mixin.
+ queryable(this, this.config.container);
+
+ // Stick the barebones HTML structure in the dom,
+ // so we can play with it.
+ $(this.config.container).html(JST.timeline());
+
+ this.bounds = new Bounds();
+ this.bar = new Bar(this);
+ this.cardCont = new CardScroller(this);
+ this.createSeries(this.data);
+ var range = new Intervals(this.bounds, this.config.interval);
+ this.intervals = range.getRanges();
+ this.bounds.extend(this.bounds.min - range.getMaxInterval() / 2);
+ this.bounds.extend(this.bounds.max + range.getMaxInterval() / 2);
+ this.bar.render();
+ sync(this.bar, this.cardCont, "move", "zoom");
+ this.trigger('render');
+
+ new Zoom("in", this);
+ new Zoom("out", this);
+ this.chooseNext = new Chooser("next", this);
+ this.choosePrev = new Chooser("prev", this);
+ if (!this.$(".TS-card_active").is("*")) this.chooseNext.click();
+
+ // Bind a click handler to this timeline container
+ // that sets it as as the global current timeline
+ // for key presses.
+ $(this.config.container).bind('click', this.setCurrentTimeline);
+
+ this.trigger('load');
+ },
+
+ // Set a global with the current timeline, mostly for key presses.
+ setCurrentTimeline : function() {
+ TimelineSetter.currentTimeline = this;
+ },
+
+ // Loop through the JSON and add each element to a series.
+ createSeries : function(series){
+ for(var i = 0; i < series.length; i++)
+ this.add(series[i]);
+ },
+
+ // If a particular element in the JSON array mentions a series that's not
+ // in the `bySid` object add it. Then add a card to the `Series` and extend
+ // the global `bounds`.
+ add : function(card){
+ if (!(card.series in this.bySid)){
+ this.bySid[card.series] = new Series(card, this);
+ this.series.push(this.bySid[card.series]);
+ }
+ var series = this.bySid[card.series];
+ var crd = series.add(card);
+
+ this.bounds.extend(series.max());
+ this.bounds.extend(series.min());
+
+ this.trigger('cardAdd', card, crd);
+ }
+ });
+
+
+
+
+ // Views
+ // -----
+
+ // The main interactive element in the timeline is `.TS-notchbar`. Behind the
+ // scenes `Bar` handles the moving and zooming behaviours through the `draggable`
+ // and `wheel` plugins.
+ var Bar = function(timeline) {
+ var that = this;
+ this.timeline = timeline;
+
+ this.el = this.timeline.$(".TS-notchbar");
+ this.el.css({ "left": 0 });
+ draggable(this);
+ wheel(this);
+ _.bindAll(this, "moving", "doZoom");
+ this.el.bind("dragging scrolled", this.moving);
+ this.el.bind("doZoom", this.doZoom);
+ this.el.bind("dblclick doubletap", function(e){
+ e.preventDefault();
+ that.timeline.$(".TS-zoom_in").click();
+ });
+ };
+ observable(Bar.prototype);
+ transformable(Bar.prototype);
+
+ Bar.prototype = _.extend(Bar.prototype, {
+ // Every time the `Bar` is moved, it calculates whether the proposed movement
+ // will move the `.TS-notchbar` off of its parent. If so, it recaculates
+ // `deltaX` to be a more correct value.
+ moving : function(e){
+ var parent = this.el.parent();
+ var pOffset = parent.offset().left;
+ var offset = this.el.offset().left;
+ var width = this.el.width();
+ if (_.isUndefined(e.deltaX)) e.deltaX = 0;
+
+ if (offset + width + e.deltaX < pOffset + parent.width())
+ e.deltaX = (pOffset + parent.width()) - (offset + width);
+ if (offset + e.deltaX > pOffset)
+ e.deltaX = pOffset - offset;
+
+ this.trigger("move", e);
+ this.timeline.trigger("move", e); // for API
+ this.move("move", e);
+ },
+
+ // As the timeline zooms, the `Bar` tries to keep the current notch (i.e.
+ // `.TS-notch_active`) as close to its original position as possible.
+ // There's a slight bug here because the timeline zooms and then moves the
+ // bar to correct for this behaviour, and in future versions we'll fix this.
+ doZoom : function(e, width){
+ var that = this;
+ var notch = this.timeline.$(".TS-notch_active");
+ var getCur = function() {
+ return notch.length > 0 ? notch.position().left : 0;
+ };
+ var curr = getCur();
+
+ this.el.animate({"width": width + "%"}, {
+ step: function(current, fx) {
+ var e = $.Event("dragging");
+ var delta = curr - getCur();
+ e.deltaX = delta;
+ that.moving(e);
+ curr = getCur();
+ e = $.Event("zoom");
+ e.width = current + "%";
+ that.trigger("zoom", e);
+ }
+ });
+ },
+
+ // When asked to render the bar places the appropriate timestamp notches
+ // inside `.TS-notchbar`.
+ render : function(){
+ var intervals = this.timeline.intervals;
+ var bounds = this.timeline.bounds;
+
+ for (var i = 0; i < intervals.length; i++) {
+ var html = JST.year_notch({'timestamp' : intervals[i].timestamp, 'human' : intervals[i].human });
+ this.el.append($(html).css("left", bounds.project(intervals[i].timestamp, 100) + "%"));
+ }
+ }
+ });
+
+
+ // The `CardScroller` mirrors the moving and zooming of the `Bar` and is the
+ // canvas where individual cards are rendered.
+ var CardScroller = function(timeline){
+ this.el = timeline.$(".TS-card_scroller_inner");
+ };
+ observable(CardScroller.prototype);
+ transformable(CardScroller.prototype);
+
+
+ // Each `Series` picks a unique color and keeps an array of `Cards`.
+ var Series = function(series, timeline) {
+ this.timeline = timeline;
+ this.name = series.series;
+ this.color = this.name.length > 0 ? color() : "default";
+ this.cards = [];
+ _.bindAll(this, "render", "showNotches", "hideNotches");
+ this.timeline.bind("render", this.render);
+ };
+ observable(Series.prototype);
+
+ Series.prototype = _.extend(Series.prototype, {
+ // Create and add a particular card to the cards array.
+ add : function(card){
+ var crd = new Card(card, this);
+ this.cards.push(crd);
+ return crd;
+ },
+
+ // The comparing function for `max` and `min`.
+ _comparator : function(crd){
+ return crd.timestamp;
+ },
+
+ // Inactivate this series legend item and trigger a `hideNotch` event.
+ hideNotches : function(e){
+ if(e) e.preventDefault();
+ this.el.addClass("TS-series_legend_item_inactive");
+ this.trigger("hideNotch");
+ },
+
+ // Activate the legend item and trigger the `showNotch` event.
+ showNotches : function(e){
+ if(e) e.preventDefault();
+ this.el.removeClass("TS-series_legend_item_inactive");
+ this.trigger("showNotch");
+ },
+
+ // Create and append the label to `.TS-series_nav_container` and bind up
+ // `hideNotches` and `showNotches`.
+ render : function(e){
+ if (this.name.length === 0) return;
+ this.el = $(JST.series_legend(this));
+ this.timeline.$(".TS-series_nav_container").append(this.el);
+ var counter = 0, that = this;
+ this.el.on("click", function(){
+ counter++;
+ if(counter % 2)
+ that.hideNotches();
+ else
+ that.showNotches();
+ });
+ }
+ });
+
+ // Proxy to underscore for `min` and `max`.
+ _(["min", "max"]).each(function(key){
+ Series.prototype[key] = function() {
+ return _[key].call(_, this.cards, this._comparator).get("timestamp");
+ };
+ });
+
+
+ // Every `Card` handles a notch div which is immediately appended to the `Bar`
+ // and a `.TS-card_container` which is lazily rendered.
+ var Card = function(card, series) {
+ this.series = series;
+ this.timeline = this.series.timeline;
+ card = _.clone(card);
+ this.timestamp = card.timestamp;
+ this.attributes = card;
+ this.attributes.topcolor = series.color;
+ _.bindAll(this, "render", "activate", "flip", "setPermalink", "toggleNotch");
+ this.series.bind("hideNotch", this.toggleNotch);
+ this.series.bind("showNotch", this.toggleNotch);
+ this.timeline.bind("render", this.render);
+ this.timeline.bar.bind("move", this.flip);
+ this.id = [
+ this.get('timestamp'),
+ this.get('description').split(/ /)[0].replace(/[^a-zA-Z\-]/g,"")
+ ].join("-");
+ this.timeline.cards.push(this);
+ this.template = window.JST.card;
+ };
+
+ Card.prototype = _.extend(Card.prototype, {
+ // Get a particular attribute by key.
+ get : function(key){
+ return this.attributes[key];
+ },
+
+ // When each `Card` is rendered via a render event, it appends a notch to the
+ // `Bar` and binds a click handler so it can be activated. if the `Card`'s id
+ // is currently selected via `window.location.hash` it's activated.
+ render : function(){
+ this.offset = this.timeline.bounds.project(this.timestamp, 100);
+ var html = JST.notch(this.attributes);
+ this.notch = $(html).css({"left": this.offset + "%"});
+ this.timeline.$(".TS-notchbar").append(this.notch);
+ this.notch.click(this.activate);
+ if (history.get() === this.id) this.activate();
+ },
+
+ // As the `Bar` moves the current card checks to see if it's outside the viewport,
+ // if it is the card is flipped so as to be visible for the longest period
+ // of time. The magic number here (7) is half the width of the css arrow.
+ flip : function() {
+ if (!this.el || !this.el.is(":visible")) return;
+ var rightEdge = this.$(".TS-item").offset().left + this.$(".TS-item").width();
+ var tRightEdge = this.timeline.$(".timeline_setter").offset().left + this.timeline.$(".timeline_setter").width();
+ var margin = this.el.css("margin-left") === this.originalMargin;
+ var flippable = this.$(".TS-item").width() < this.timeline.$(".timeline_setter").width() / 2;
+ var offTimeline = (this.el.offset().left - this.el.parent().offset().left) - this.$(".TS-item").width() < 0;
+
+ // If the card's right edge is more than the timeline's right edge and
+ // it's never been flipped before and it won't go off the timeline when
+ // flipped. We'll flip it.
+ if (tRightEdge - rightEdge < 0 && margin && !offTimeline) {
+ this.el.css({"margin-left": -(this.$(".TS-item").width() + 7)});
+ this.$(".TS-css_arrow").css({"left" : this.$(".TS-item").width()});
+ // Otherwise, if the card is off the left side of the timeline and we have
+ // flipped it before and the card's width is less than half of the width
+ // of the whole timeline, we'll flip it to the default position.
+ } else if (this.el.offset().left - this.timeline.$(".timeline_setter").offset().left < 0 && !margin && flippable) {
+ this.el.css({"margin-left": this.originalMargin});
+ this.$(".TS-css_arrow").css({"left": 0});
+ }
+ },
+
+ // The first time a card is activated it renders its `template` and appends
+ // its element to the `Bar`. After doing so it sets the width if `.TS-item_label`
+ // and moves the `Bar` if its element outside the visible portion of the
+ // timeline.
+ activate : function(e){
+ var that = this;
+ this.hideActiveCard();
+ if (!this.el) {
+ this.el = $(this.template({card: this}));
+
+ // create a `this.$` scoped to its card.
+ queryable(this, this.el);
+
+ this.el.css({"left": this.offset + "%"});
+ this.timeline.$(".TS-card_scroller_inner").append(this.el);
+ this.originalMargin = this.el.css("margin-left");
+ this.el.delegate(".TS-permalink", "click", this.setPermalink);
+ // Reactivate if there are images in the html so we can recalculate
+ // widths and position accordingly.
+ this.timeline.$("img").load(this.activate);
+ }
+
+ this.el.show().addClass(("TS-card_active"));
+ this.notch.addClass("TS-notch_active");
+ this.setWidth();
+
+ // In the case that the card is outside the bounds the wrong way when
+ // it's flipped, we'll take care of it here before we move the actual
+ // card.
+ this.flip();
+ this.move();
+ this.series.timeline.trigger("cardActivate", this.attributes);
+ },
+
+ // For Internet Explorer each card sets the width of` .TS-item_label` to
+ // the maximum width of the card's children, or if that is less than the
+ // `.TS-item_year` element's width, `.TS-item_label` gets `.TS-item_year`s
+ // width. Which is a funny way of saying, if you'd like to set the width of
+ // the card as a whole, fiddle with `.TS-item_year`s width.
+ setWidth : function(){
+ var that = this;
+ var max = _.max(_.toArray(this.$(".TS-item_user_html").children()), function(el){ return that.$(el).width(); });
+ if (this.$(max).width() > this.$(".TS-item_year").width()) {
+ this.$(".TS-item_label").css("width", this.$(max).width());
+ } else {
+ this.$(".TS-item_label").css("width", this.$(".TS-item_year").width());
+ }
+ },
+
+ // Move the `Bar` if the card is outside the visible region on activation.
+ move : function() {
+ var e = $.Event('moving');
+ var offset = this.$(".TS-item").offset();
+ var toffset = this.timeline.$(".timeline_setter").offset();
+ if (offset.left < toffset.left) {
+ e.deltaX = toffset.left - offset.left + cleanNumber(this.$(".TS-item").css("padding-left"));
+ this.timeline.bar.moving(e);
+ } else if (offset.left + this.$(".TS-item").outerWidth() > toffset.left + this.timeline.$(".timeline_setter").width()) {
+ e.deltaX = toffset.left + this.timeline.$(".timeline_setter").width() - (offset.left + this.$(".TS-item").outerWidth());
+ this.timeline.bar.moving(e);
+ }
+ },
+
+ // The click handler to set the current hash to the `Card`'s id.
+ setPermalink : function() {
+ history.set(this.id);
+ },
+
+ // Globally hide any cards with `TS-card_active`.
+ hideActiveCard : function() {
+ this.timeline.$(".TS-card_active").removeClass("TS-card_active").hide();
+ this.timeline.$(".TS-notch_active").removeClass("TS-notch_active");
+ },
+
+ // An event listener to toggle this notch on and off via `Series`.
+ toggleNotch : function(e){
+ switch (e) {
+ case "hideNotch":
+ this.notch.hide().removeClass("TS-notch_active").addClass("TS-series_inactive");
+ if (this.el) this.el.hide();
+ return;
+ case "showNotch":
+ this.notch.removeClass("TS-series_inactive").show();
+ }
+ }
+
+ });
+
+
+ // Simple inheritance helper for `Controls`.
+ var ctor = function(){};
+ var inherits = function(child, parent){
+ ctor.prototype = parent.prototype;
+ child.prototype = new ctor();
+ child.prototype.constructor = child;
+ };
+
+ // Controls
+ // --------
+
+ // Each control is basically a callback wrapper for a given DOM element.
+ var Control = function(direction, timeline){
+ this.timeline = timeline;
+ this.direction = direction;
+ this.el = this.timeline.$(this.prefix + direction);
+ var that = this;
+ this.el.bind('click', function(e) { e.preventDefault(); that.click(e);});
+ };
+
+ // Each `Zoom` control adjusts the `curZoom` when clicked.
+ var curZoom = 100;
+ var Zoom = function(direction, timeline) {
+ Control.apply(this, arguments);
+ };
+ inherits(Zoom, Control);
+
+ Zoom.prototype = _.extend(Zoom.prototype, {
+ prefix : ".TS-zoom_",
+
+ // Adjust the `curZoom` up or down by 100 and trigger a `doZoom` event on
+ // `.TS-notchbar`
+ click : function() {
+ curZoom += (this.direction === "in" ? +100 : -100);
+ if (curZoom >= 100) {
+ this.timeline.$(".TS-notchbar").trigger('doZoom', [curZoom]);
+ } else {
+ curZoom = 100;
+ }
+ }
+ });
+
+
+ // Each `Chooser` activates the next or previous notch.
+ var Chooser = function(direction, timeline) {
+ Control.apply(this, arguments);
+ this.notches = this.timeline.$(".TS-notch");
+ };
+ inherits(Chooser, Control);
+
+ Chooser.prototype = _.extend(Control.prototype, {
+ prefix: ".TS-choose_",
+
+ // Figure out which notch to activate and do so by triggering a click on
+ // that notch.
+ click: function(e){
+ var el;
+ var notches = this.notches.not(".TS-series_inactive");
+ var curCardIdx = notches.index(this.timeline.$(".TS-notch_active"));
+ var numOfCards = notches.length;
+ if (this.direction === "next") {
+ el = (curCardIdx < numOfCards ? notches.eq(curCardIdx + 1) : false);
+ } else {
+ el = (curCardIdx > 0 ? notches.eq(curCardIdx - 1) : false);
+ }
+ if (!el) return;
+ el.trigger("click");
+ }
+ });
+
+ // JS API
+ // ------
+
+ // The TimelineSetter JS API allows you to listen to certain
+ // timeline events, and activate cards programmatically.
+ // To take advantage of it, assign the timeline boot function to a variable
+ // like so:
+ //
+ // var currentTimeline = TimelineSetter.Timeline.boot(
+ // [data], {config}
+ // );
+ //
+ // then call methods on the `currentTimeline.api` object
+ //
+ // currentTimeline.api.onLoad(function() {
+ // console.log("I'm ready");
+ // });
+ //
+ TimelineSetter.Api = function(timeline) {
+ this.timeline = timeline;
+ };
+
+ TimelineSetter.Api.prototype = _.extend(TimelineSetter.Api.prototype, {
+ // Register a callback for when the timeline is loaded
+ onLoad : function(cb) {
+ this.timeline.bind('load', cb);
+ },
+
+ // Register a callback for when a card is added to the timeline
+ // Callback has access to the event name and the card object
+ onCardAdd : function(cb) {
+ this.timeline.bind('cardAdd', cb);
+ },
+
+ // Register a callback for when a card is activated.
+ // Callback has access to the event name and the card object
+ onCardActivate : function(cb) {
+ this.timeline.bind('cardActivate', cb);
+ },
+
+ // Register a callback for when the bar is moved or zoomed.
+ // Be careful with this one: Bar move events can be fast
+ // and furious, especially with scroll wheels in Safari.
+ onBarMove : function(cb) {
+ // Bind a 'move' event to the timeline, because
+ // at this point, `timeline.bar` isn't available yet.
+ // To get around this, we'll trigger the bar's
+ // timeline's move event when the bar is moved.
+ this.timeline.bind('move', cb);
+ },
+
+ // Show the card matching a given timestamp
+ // Right now, timelines only support one card per timestamp
+ activateCard : function(timestamp) {
+ _(this.timeline.cards).detect(function(card) { return card.timestamp === timestamp; }).activate();
+ }
+ });
+
+ // Global TS keydown function to bind key events to the
+ // current global currentTimeline.
+ TimelineSetter.bindKeydowns = function() {
+ $(document).bind('keydown', function(e) {
+ if (e.keyCode === 39) {
+ TimelineSetter.currentTimeline.chooseNext.click();
+ } else if (e.keyCode === 37) {
+ TimelineSetter.currentTimeline.choosePrev.click();
+ } else {
+ return;
+ }
+ });
+ };
+
+
+ // Finally, let's create the whole timeline. Boot is exposed globally via
+ // `TimelineSetter.Timeline.boot()` which takes the JSON generated by
+ // the timeline-setter binary as its first argument, and a config hash as its second.
+ // The config hash looks for a container element, an interval for interval notches
+ // and a formatter function for dates. All of these are optional.
+ //
+ // We also initialize a new API object for each timeline, accessible via the
+ // timeline variable's `api` method (e.g. `currentTimeline.api`) and look for
+ // how many timelines are globally on the page for keydown purposes. We'll only
+ // bind keydowns globally if there's only one timeline on the page.
+ Timeline.boot = function(data, config) {
+ var timeline = TimelineSetter.timeline = new Timeline(data, config || {});
+ var api = new TimelineSetter.Api(timeline);
+
+ if (!TimelineSetter.pageTimelines) {
+ TimelineSetter.currentTimeline = timeline;
+ TimelineSetter.bindKeydowns();
+ }
+
+ TimelineSetter.pageTimelines = TimelineSetter.pageTimelines ? TimelineSetter.pageTimelines += 1 : 1;
+
+ $(timeline.render);
+
+ return {
+ timeline : timeline,
+ api : api
+ };
+ };
+
+})(jQuery);
diff --git a/public/javascripts/timeline-setter.min.js b/public/javascripts/timeline-setter.min.js
new file mode 100644
index 0000000..ed8f6d2
--- /dev/null
+++ b/public/javascripts/timeline-setter.min.js
@@ -0,0 +1 @@
+(function(e,i){var m=window.TimelineSetter=(window.TimelineSetter||{});m.VERSION="0.3.1";var s=function(E){E.bind=function(I,F){var G=(this._callbacks=this._callbacks||{});var H=(G[I]=G[I]||[]);H.push(F)};E.trigger=function(H){if(!this._callbacks){return}var G=this._callbacks[H];if(!G){return}for(var F=0;F<G.length;F++){G[F].apply(this,arguments)}}};var B=function(E){E.move=function(G,F){if(!F.deltaX){return}if(_.isUndefined(this.currOffset)){this.currOffset=0}this.currOffset+=F.deltaX;t [...]
\ No newline at end of file
diff --git a/public/javascripts/vendor/jquery-min.js b/public/javascripts/vendor/jquery-min.js
new file mode 100644
index 0000000..006e953
--- /dev/null
+++ b/public/javascripts/vendor/jquery-min.js
@@ -0,0 +1,5 @@
+/*! jQuery v1.9.1 | (c) 2005, 2012 jQuery Foundation, Inc. | jquery.org/license
+//@ sourceMappingURL=jquery.min.map
+*/(function(e,t){var n,r,i=typeof t,o=e.document,a=e.location,s=e.jQuery,u=e.$,l={},c=[],p="1.9.1",f=c.concat,d=c.push,h=c.slice,g=c.indexOf,m=l.toString,y=l.hasOwnProperty,v=p.trim,b=function(e,t){return new b.fn.init(e,t,r)},x=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,w=/\S+/g,T=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,N=/^(?:(<[\w\W]+>)[^>]*|#([\w-]*))$/,C=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,k=/^[\],:{}\s]*$/,E=/(?:^|:|,)(?:\s*\[)+/g,S=/\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,A=/"[^"\\\r\n]*"|tru [...]
+return(!i||i!==r&&!b.contains(r,i))&&(e.type=o.origType,n=o.handler.apply(this,arguments),e.type=t),n}}}),b.support.submitBubbles||(b.event.special.submit={setup:function(){return b.nodeName(this,"form")?!1:(b.event.add(this,"click._submit keypress._submit",function(e){var n=e.target,r=b.nodeName(n,"input")||b.nodeName(n,"button")?n.form:t;r&&!b._data(r,"submitBubbles")&&(b.event.add(r,"submit._submit",function(e){e._submit_bubble=!0}),b._data(r,"submitBubbles",!0))}),t)},postDispatch:fu [...]
+}b.merge(d,s.childNodes),s.textContent="";while(s.firstChild)s.removeChild(s.firstChild);s=f.lastChild}else d.push(t.createTextNode(o));s&&f.removeChild(s),b.support.appendChecked||b.grep(Ot(d,"input"),Bt),h=0;while(o=d[h++])if((!r||-1===b.inArray(o,r))&&(a=b.contains(o.ownerDocument,o),s=Ot(f.appendChild(o),"script"),a&&Mt(s),n)){i=0;while(o=s[i++])kt.test(o.type||"")&&n.push(o)}return s=null,f},cleanData:function(e,t){var n,r,o,a,s=0,u=b.expando,l=b.cache,p=b.support.deleteExpando,f=b. [...]
\ No newline at end of file
diff --git a/public/javascripts/vendor/jquery.js b/public/javascripts/vendor/jquery.js
new file mode 100644
index 0000000..c508b0a
--- /dev/null
+++ b/public/javascripts/vendor/jquery.js
@@ -0,0 +1,9597 @@
+/*!
+ * jQuery JavaScript Library v1.9.1
+ * http://jquery.com/
+ *
+ * Includes Sizzle.js
+ * http://sizzlejs.com/
+ *
+ * Copyright 2005, 2012 jQuery Foundation, Inc. and other contributors
+ * Released under the MIT license
+ * http://jquery.org/license
+ *
+ * Date: 2013-2-4
+ */
+(function( window, undefined ) {
+
+// Can't do this because several apps including ASP.NET trace
+// the stack via arguments.caller.callee and Firefox dies if
+// you try to trace through "use strict" call chains. (#13335)
+// Support: Firefox 18+
+//"use strict";
+var
+ // The deferred used on DOM ready
+ readyList,
+
+ // A central reference to the root jQuery(document)
+ rootjQuery,
+
+ // Support: IE<9
+ // For `typeof node.method` instead of `node.method !== undefined`
+ core_strundefined = typeof undefined,
+
+ // Use the correct document accordingly with window argument (sandbox)
+ document = window.document,
+ location = window.location,
+
+ // Map over jQuery in case of overwrite
+ _jQuery = window.jQuery,
+
+ // Map over the $ in case of overwrite
+ _$ = window.$,
+
+ // [[Class]] -> type pairs
+ class2type = {},
+
+ // List of deleted data cache ids, so we can reuse them
+ core_deletedIds = [],
+
+ core_version = "1.9.1",
+
+ // Save a reference to some core methods
+ core_concat = core_deletedIds.concat,
+ core_push = core_deletedIds.push,
+ core_slice = core_deletedIds.slice,
+ core_indexOf = core_deletedIds.indexOf,
+ core_toString = class2type.toString,
+ core_hasOwn = class2type.hasOwnProperty,
+ core_trim = core_version.trim,
+
+ // Define a local copy of jQuery
+ jQuery = function( selector, context ) {
+ // The jQuery object is actually just the init constructor 'enhanced'
+ return new jQuery.fn.init( selector, context, rootjQuery );
+ },
+
+ // Used for matching numbers
+ core_pnum = /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,
+
+ // Used for splitting on whitespace
+ core_rnotwhite = /\S+/g,
+
+ // Make sure we trim BOM and NBSP (here's looking at you, Safari 5.0 and IE)
+ rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,
+
+ // A simple way to check for HTML strings
+ // Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
+ // Strict HTML recognition (#11290: must start with <)
+ rquickExpr = /^(?:(<[\w\W]+>)[^>]*|#([\w-]*))$/,
+
+ // Match a standalone tag
+ rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>|)$/,
+
+ // JSON RegExp
+ rvalidchars = /^[\],:{}\s]*$/,
+ rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g,
+ rvalidescape = /\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,
+ rvalidtokens = /"[^"\\\r\n]*"|true|false|null|-?(?:\d+\.|)\d+(?:[eE][+-]?\d+|)/g,
+
+ // Matches dashed string for camelizing
+ rmsPrefix = /^-ms-/,
+ rdashAlpha = /-([\da-z])/gi,
+
+ // Used by jQuery.camelCase as callback to replace()
+ fcamelCase = function( all, letter ) {
+ return letter.toUpperCase();
+ },
+
+ // The ready event handler
+ completed = function( event ) {
+
+ // readyState === "complete" is good enough for us to call the dom ready in oldIE
+ if ( document.addEventListener || event.type === "load" || document.readyState === "complete" ) {
+ detach();
+ jQuery.ready();
+ }
+ },
+ // Clean-up method for dom ready events
+ detach = function() {
+ if ( document.addEventListener ) {
+ document.removeEventListener( "DOMContentLoaded", completed, false );
+ window.removeEventListener( "load", completed, false );
+
+ } else {
+ document.detachEvent( "onreadystatechange", completed );
+ window.detachEvent( "onload", completed );
+ }
+ };
+
+jQuery.fn = jQuery.prototype = {
+ // The current version of jQuery being used
+ jquery: core_version,
+
+ constructor: jQuery,
+ init: function( selector, context, rootjQuery ) {
+ var match, elem;
+
+ // HANDLE: $(""), $(null), $(undefined), $(false)
+ if ( !selector ) {
+ return this;
+ }
+
+ // Handle HTML strings
+ if ( typeof selector === "string" ) {
+ if ( selector.charAt(0) === "<" && selector.charAt( selector.length - 1 ) === ">" && selector.length >= 3 ) {
+ // Assume that strings that start and end with <> are HTML and skip the regex check
+ match = [ null, selector, null ];
+
+ } else {
+ match = rquickExpr.exec( selector );
+ }
+
+ // Match html or make sure no context is specified for #id
+ if ( match && (match[1] || !context) ) {
+
+ // HANDLE: $(html) -> $(array)
+ if ( match[1] ) {
+ context = context instanceof jQuery ? context[0] : context;
+
+ // scripts is true for back-compat
+ jQuery.merge( this, jQuery.parseHTML(
+ match[1],
+ context && context.nodeType ? context.ownerDocument || context : document,
+ true
+ ) );
+
+ // HANDLE: $(html, props)
+ if ( rsingleTag.test( match[1] ) && jQuery.isPlainObject( context ) ) {
+ for ( match in context ) {
+ // Properties of context are called as methods if possible
+ if ( jQuery.isFunction( this[ match ] ) ) {
+ this[ match ]( context[ match ] );
+
+ // ...and otherwise set as attributes
+ } else {
+ this.attr( match, context[ match ] );
+ }
+ }
+ }
+
+ return this;
+
+ // HANDLE: $(#id)
+ } else {
+ elem = document.getElementById( match[2] );
+
+ // Check parentNode to catch when Blackberry 4.6 returns
+ // nodes that are no longer in the document #6963
+ if ( elem && elem.parentNode ) {
+ // Handle the case where IE and Opera return items
+ // by name instead of ID
+ if ( elem.id !== match[2] ) {
+ return rootjQuery.find( selector );
+ }
+
+ // Otherwise, we inject the element directly into the jQuery object
+ this.length = 1;
+ this[0] = elem;
+ }
+
+ this.context = document;
+ this.selector = selector;
+ return this;
+ }
+
+ // HANDLE: $(expr, $(...))
+ } else if ( !context || context.jquery ) {
+ return ( context || rootjQuery ).find( selector );
+
+ // HANDLE: $(expr, context)
+ // (which is just equivalent to: $(context).find(expr)
+ } else {
+ return this.constructor( context ).find( selector );
+ }
+
+ // HANDLE: $(DOMElement)
+ } else if ( selector.nodeType ) {
+ this.context = this[0] = selector;
+ this.length = 1;
+ return this;
+
+ // HANDLE: $(function)
+ // Shortcut for document ready
+ } else if ( jQuery.isFunction( selector ) ) {
+ return rootjQuery.ready( selector );
+ }
+
+ if ( selector.selector !== undefined ) {
+ this.selector = selector.selector;
+ this.context = selector.context;
+ }
+
+ return jQuery.makeArray( selector, this );
+ },
+
+ // Start with an empty selector
+ selector: "",
+
+ // The default length of a jQuery object is 0
+ length: 0,
+
+ // The number of elements contained in the matched element set
+ size: function() {
+ return this.length;
+ },
+
+ toArray: function() {
+ return core_slice.call( this );
+ },
+
+ // Get the Nth element in the matched element set OR
+ // Get the whole matched element set as a clean array
+ get: function( num ) {
+ return num == null ?
+
+ // Return a 'clean' array
+ this.toArray() :
+
+ // Return just the object
+ ( num < 0 ? this[ this.length + num ] : this[ num ] );
+ },
+
+ // Take an array of elements and push it onto the stack
+ // (returning the new matched element set)
+ pushStack: function( elems ) {
+
+ // Build a new jQuery matched element set
+ var ret = jQuery.merge( this.constructor(), elems );
+
+ // Add the old object onto the stack (as a reference)
+ ret.prevObject = this;
+ ret.context = this.context;
+
+ // Return the newly-formed element set
+ return ret;
+ },
+
+ // Execute a callback for every element in the matched set.
+ // (You can seed the arguments with an array of args, but this is
+ // only used internally.)
+ each: function( callback, args ) {
+ return jQuery.each( this, callback, args );
+ },
+
+ ready: function( fn ) {
+ // Add the callback
+ jQuery.ready.promise().done( fn );
+
+ return this;
+ },
+
+ slice: function() {
+ return this.pushStack( core_slice.apply( this, arguments ) );
+ },
+
+ first: function() {
+ return this.eq( 0 );
+ },
+
+ last: function() {
+ return this.eq( -1 );
+ },
+
+ eq: function( i ) {
+ var len = this.length,
+ j = +i + ( i < 0 ? len : 0 );
+ return this.pushStack( j >= 0 && j < len ? [ this[j] ] : [] );
+ },
+
+ map: function( callback ) {
+ return this.pushStack( jQuery.map(this, function( elem, i ) {
+ return callback.call( elem, i, elem );
+ }));
+ },
+
+ end: function() {
+ return this.prevObject || this.constructor(null);
+ },
+
+ // For internal use only.
+ // Behaves like an Array's method, not like a jQuery method.
+ push: core_push,
+ sort: [].sort,
+ splice: [].splice
+};
+
+// Give the init function the jQuery prototype for later instantiation
+jQuery.fn.init.prototype = jQuery.fn;
+
+jQuery.extend = jQuery.fn.extend = function() {
+ var src, copyIsArray, copy, name, options, clone,
+ target = arguments[0] || {},
+ i = 1,
+ length = arguments.length,
+ deep = false;
+
+ // Handle a deep copy situation
+ if ( typeof target === "boolean" ) {
+ deep = target;
+ target = arguments[1] || {};
+ // skip the boolean and the target
+ i = 2;
+ }
+
+ // Handle case when target is a string or something (possible in deep copy)
+ if ( typeof target !== "object" && !jQuery.isFunction(target) ) {
+ target = {};
+ }
+
+ // extend jQuery itself if only one argument is passed
+ if ( length === i ) {
+ target = this;
+ --i;
+ }
+
+ for ( ; i < length; i++ ) {
+ // Only deal with non-null/undefined values
+ if ( (options = arguments[ i ]) != null ) {
+ // Extend the base object
+ for ( name in options ) {
+ src = target[ name ];
+ copy = options[ name ];
+
+ // Prevent never-ending loop
+ if ( target === copy ) {
+ continue;
+ }
+
+ // Recurse if we're merging plain objects or arrays
+ if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) {
+ if ( copyIsArray ) {
+ copyIsArray = false;
+ clone = src && jQuery.isArray(src) ? src : [];
+
+ } else {
+ clone = src && jQuery.isPlainObject(src) ? src : {};
+ }
+
+ // Never move original objects, clone them
+ target[ name ] = jQuery.extend( deep, clone, copy );
+
+ // Don't bring in undefined values
+ } else if ( copy !== undefined ) {
+ target[ name ] = copy;
+ }
+ }
+ }
+ }
+
+ // Return the modified object
+ return target;
+};
+
+jQuery.extend({
+ noConflict: function( deep ) {
+ if ( window.$ === jQuery ) {
+ window.$ = _$;
+ }
+
+ if ( deep && window.jQuery === jQuery ) {
+ window.jQuery = _jQuery;
+ }
+
+ return jQuery;
+ },
+
+ // Is the DOM ready to be used? Set to true once it occurs.
+ isReady: false,
+
+ // A counter to track how many items to wait for before
+ // the ready event fires. See #6781
+ readyWait: 1,
+
+ // Hold (or release) the ready event
+ holdReady: function( hold ) {
+ if ( hold ) {
+ jQuery.readyWait++;
+ } else {
+ jQuery.ready( true );
+ }
+ },
+
+ // Handle when the DOM is ready
+ ready: function( wait ) {
+
+ // Abort if there are pending holds or we're already ready
+ if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {
+ return;
+ }
+
+ // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443).
+ if ( !document.body ) {
+ return setTimeout( jQuery.ready );
+ }
+
+ // Remember that the DOM is ready
+ jQuery.isReady = true;
+
+ // If a normal DOM Ready event fired, decrement, and wait if need be
+ if ( wait !== true && --jQuery.readyWait > 0 ) {
+ return;
+ }
+
+ // If there are functions bound, to execute
+ readyList.resolveWith( document, [ jQuery ] );
+
+ // Trigger any bound ready events
+ if ( jQuery.fn.trigger ) {
+ jQuery( document ).trigger("ready").off("ready");
+ }
+ },
+
+ // See test/unit/core.js for details concerning isFunction.
+ // Since version 1.3, DOM methods and functions like alert
+ // aren't supported. They return false on IE (#2968).
+ isFunction: function( obj ) {
+ return jQuery.type(obj) === "function";
+ },
+
+ isArray: Array.isArray || function( obj ) {
+ return jQuery.type(obj) === "array";
+ },
+
+ isWindow: function( obj ) {
+ return obj != null && obj == obj.window;
+ },
+
+ isNumeric: function( obj ) {
+ return !isNaN( parseFloat(obj) ) && isFinite( obj );
+ },
+
+ type: function( obj ) {
+ if ( obj == null ) {
+ return String( obj );
+ }
+ return typeof obj === "object" || typeof obj === "function" ?
+ class2type[ core_toString.call(obj) ] || "object" :
+ typeof obj;
+ },
+
+ isPlainObject: function( obj ) {
+ // Must be an Object.
+ // Because of IE, we also have to check the presence of the constructor property.
+ // Make sure that DOM nodes and window objects don't pass through, as well
+ if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) {
+ return false;
+ }
+
+ try {
+ // Not own constructor property must be Object
+ if ( obj.constructor &&
+ !core_hasOwn.call(obj, "constructor") &&
+ !core_hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) {
+ return false;
+ }
+ } catch ( e ) {
+ // IE8,9 Will throw exceptions on certain host objects #9897
+ return false;
+ }
+
+ // Own properties are enumerated firstly, so to speed up,
+ // if last one is own, then all properties are own.
+
+ var key;
+ for ( key in obj ) {}
+
+ return key === undefined || core_hasOwn.call( obj, key );
+ },
+
+ isEmptyObject: function( obj ) {
+ var name;
+ for ( name in obj ) {
+ return false;
+ }
+ return true;
+ },
+
+ error: function( msg ) {
+ throw new Error( msg );
+ },
+
+ // data: string of html
+ // context (optional): If specified, the fragment will be created in this context, defaults to document
+ // keepScripts (optional): If true, will include scripts passed in the html string
+ parseHTML: function( data, context, keepScripts ) {
+ if ( !data || typeof data !== "string" ) {
+ return null;
+ }
+ if ( typeof context === "boolean" ) {
+ keepScripts = context;
+ context = false;
+ }
+ context = context || document;
+
+ var parsed = rsingleTag.exec( data ),
+ scripts = !keepScripts && [];
+
+ // Single tag
+ if ( parsed ) {
+ return [ context.createElement( parsed[1] ) ];
+ }
+
+ parsed = jQuery.buildFragment( [ data ], context, scripts );
+ if ( scripts ) {
+ jQuery( scripts ).remove();
+ }
+ return jQuery.merge( [], parsed.childNodes );
+ },
+
+ parseJSON: function( data ) {
+ // Attempt to parse using the native JSON parser first
+ if ( window.JSON && window.JSON.parse ) {
+ return window.JSON.parse( data );
+ }
+
+ if ( data === null ) {
+ return data;
+ }
+
+ if ( typeof data === "string" ) {
+
+ // Make sure leading/trailing whitespace is removed (IE can't handle it)
+ data = jQuery.trim( data );
+
+ if ( data ) {
+ // Make sure the incoming data is actual JSON
+ // Logic borrowed from http://json.org/json2.js
+ if ( rvalidchars.test( data.replace( rvalidescape, "@" )
+ .replace( rvalidtokens, "]" )
+ .replace( rvalidbraces, "")) ) {
+
+ return ( new Function( "return " + data ) )();
+ }
+ }
+ }
+
+ jQuery.error( "Invalid JSON: " + data );
+ },
+
+ // Cross-browser xml parsing
+ parseXML: function( data ) {
+ var xml, tmp;
+ if ( !data || typeof data !== "string" ) {
+ return null;
+ }
+ try {
+ if ( window.DOMParser ) { // Standard
+ tmp = new DOMParser();
+ xml = tmp.parseFromString( data , "text/xml" );
+ } else { // IE
+ xml = new ActiveXObject( "Microsoft.XMLDOM" );
+ xml.async = "false";
+ xml.loadXML( data );
+ }
+ } catch( e ) {
+ xml = undefined;
+ }
+ if ( !xml || !xml.documentElement || xml.getElementsByTagName( "parsererror" ).length ) {
+ jQuery.error( "Invalid XML: " + data );
+ }
+ return xml;
+ },
+
+ noop: function() {},
+
+ // Evaluates a script in a global context
+ // Workarounds based on findings by Jim Driscoll
+ // http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context
+ globalEval: function( data ) {
+ if ( data && jQuery.trim( data ) ) {
+ // We use execScript on Internet Explorer
+ // We use an anonymous function so that context is window
+ // rather than jQuery in Firefox
+ ( window.execScript || function( data ) {
+ window[ "eval" ].call( window, data );
+ } )( data );
+ }
+ },
+
+ // Convert dashed to camelCase; used by the css and data modules
+ // Microsoft forgot to hump their vendor prefix (#9572)
+ camelCase: function( string ) {
+ return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
+ },
+
+ nodeName: function( elem, name ) {
+ return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
+ },
+
+ // args is for internal usage only
+ each: function( obj, callback, args ) {
+ var value,
+ i = 0,
+ length = obj.length,
+ isArray = isArraylike( obj );
+
+ if ( args ) {
+ if ( isArray ) {
+ for ( ; i < length; i++ ) {
+ value = callback.apply( obj[ i ], args );
+
+ if ( value === false ) {
+ break;
+ }
+ }
+ } else {
+ for ( i in obj ) {
+ value = callback.apply( obj[ i ], args );
+
+ if ( value === false ) {
+ break;
+ }
+ }
+ }
+
+ // A special, fast, case for the most common use of each
+ } else {
+ if ( isArray ) {
+ for ( ; i < length; i++ ) {
+ value = callback.call( obj[ i ], i, obj[ i ] );
+
+ if ( value === false ) {
+ break;
+ }
+ }
+ } else {
+ for ( i in obj ) {
+ value = callback.call( obj[ i ], i, obj[ i ] );
+
+ if ( value === false ) {
+ break;
+ }
+ }
+ }
+ }
+
+ return obj;
+ },
+
+ // Use native String.trim function wherever possible
+ trim: core_trim && !core_trim.call("\uFEFF\xA0") ?
+ function( text ) {
+ return text == null ?
+ "" :
+ core_trim.call( text );
+ } :
+
+ // Otherwise use our own trimming functionality
+ function( text ) {
+ return text == null ?
+ "" :
+ ( text + "" ).replace( rtrim, "" );
+ },
+
+ // results is for internal usage only
+ makeArray: function( arr, results ) {
+ var ret = results || [];
+
+ if ( arr != null ) {
+ if ( isArraylike( Object(arr) ) ) {
+ jQuery.merge( ret,
+ typeof arr === "string" ?
+ [ arr ] : arr
+ );
+ } else {
+ core_push.call( ret, arr );
+ }
+ }
+
+ return ret;
+ },
+
+ inArray: function( elem, arr, i ) {
+ var len;
+
+ if ( arr ) {
+ if ( core_indexOf ) {
+ return core_indexOf.call( arr, elem, i );
+ }
+
+ len = arr.length;
+ i = i ? i < 0 ? Math.max( 0, len + i ) : i : 0;
+
+ for ( ; i < len; i++ ) {
+ // Skip accessing in sparse arrays
+ if ( i in arr && arr[ i ] === elem ) {
+ return i;
+ }
+ }
+ }
+
+ return -1;
+ },
+
+ merge: function( first, second ) {
+ var l = second.length,
+ i = first.length,
+ j = 0;
+
+ if ( typeof l === "number" ) {
+ for ( ; j < l; j++ ) {
+ first[ i++ ] = second[ j ];
+ }
+ } else {
+ while ( second[j] !== undefined ) {
+ first[ i++ ] = second[ j++ ];
+ }
+ }
+
+ first.length = i;
+
+ return first;
+ },
+
+ grep: function( elems, callback, inv ) {
+ var retVal,
+ ret = [],
+ i = 0,
+ length = elems.length;
+ inv = !!inv;
+
+ // Go through the array, only saving the items
+ // that pass the validator function
+ for ( ; i < length; i++ ) {
+ retVal = !!callback( elems[ i ], i );
+ if ( inv !== retVal ) {
+ ret.push( elems[ i ] );
+ }
+ }
+
+ return ret;
+ },
+
+ // arg is for internal usage only
+ map: function( elems, callback, arg ) {
+ var value,
+ i = 0,
+ length = elems.length,
+ isArray = isArraylike( elems ),
+ ret = [];
+
+ // Go through the array, translating each of the items to their
+ if ( isArray ) {
+ for ( ; i < length; i++ ) {
+ value = callback( elems[ i ], i, arg );
+
+ if ( value != null ) {
+ ret[ ret.length ] = value;
+ }
+ }
+
+ // Go through every key on the object,
+ } else {
+ for ( i in elems ) {
+ value = callback( elems[ i ], i, arg );
+
+ if ( value != null ) {
+ ret[ ret.length ] = value;
+ }
+ }
+ }
+
+ // Flatten any nested arrays
+ return core_concat.apply( [], ret );
+ },
+
+ // A global GUID counter for objects
+ guid: 1,
+
+ // Bind a function to a context, optionally partially applying any
+ // arguments.
+ proxy: function( fn, context ) {
+ var args, proxy, tmp;
+
+ if ( typeof context === "string" ) {
+ tmp = fn[ context ];
+ context = fn;
+ fn = tmp;
+ }
+
+ // Quick check to determine if target is callable, in the spec
+ // this throws a TypeError, but we will just return undefined.
+ if ( !jQuery.isFunction( fn ) ) {
+ return undefined;
+ }
+
+ // Simulated bind
+ args = core_slice.call( arguments, 2 );
+ proxy = function() {
+ return fn.apply( context || this, args.concat( core_slice.call( arguments ) ) );
+ };
+
+ // Set the guid of unique handler to the same of original handler, so it can be removed
+ proxy.guid = fn.guid = fn.guid || jQuery.guid++;
+
+ return proxy;
+ },
+
+ // Multifunctional method to get and set values of a collection
+ // The value/s can optionally be executed if it's a function
+ access: function( elems, fn, key, value, chainable, emptyGet, raw ) {
+ var i = 0,
+ length = elems.length,
+ bulk = key == null;
+
+ // Sets many values
+ if ( jQuery.type( key ) === "object" ) {
+ chainable = true;
+ for ( i in key ) {
+ jQuery.access( elems, fn, i, key[i], true, emptyGet, raw );
+ }
+
+ // Sets one value
+ } else if ( value !== undefined ) {
+ chainable = true;
+
+ if ( !jQuery.isFunction( value ) ) {
+ raw = true;
+ }
+
+ if ( bulk ) {
+ // Bulk operations run against the entire set
+ if ( raw ) {
+ fn.call( elems, value );
+ fn = null;
+
+ // ...except when executing function values
+ } else {
+ bulk = fn;
+ fn = function( elem, key, value ) {
+ return bulk.call( jQuery( elem ), value );
+ };
+ }
+ }
+
+ if ( fn ) {
+ for ( ; i < length; i++ ) {
+ fn( elems[i], key, raw ? value : value.call( elems[i], i, fn( elems[i], key ) ) );
+ }
+ }
+ }
+
+ return chainable ?
+ elems :
+
+ // Gets
+ bulk ?
+ fn.call( elems ) :
+ length ? fn( elems[0], key ) : emptyGet;
+ },
+
+ now: function() {
+ return ( new Date() ).getTime();
+ }
+});
+
+jQuery.ready.promise = function( obj ) {
+ if ( !readyList ) {
+
+ readyList = jQuery.Deferred();
+
+ // Catch cases where $(document).ready() is called after the browser event has already occurred.
+ // we once tried to use readyState "interactive" here, but it caused issues like the one
+ // discovered by ChrisS here: http://bugs.jquery.com/ticket/12282#comment:15
+ if ( document.readyState === "complete" ) {
+ // Handle it asynchronously to allow scripts the opportunity to delay ready
+ setTimeout( jQuery.ready );
+
+ // Standards-based browsers support DOMContentLoaded
+ } else if ( document.addEventListener ) {
+ // Use the handy event callback
+ document.addEventListener( "DOMContentLoaded", completed, false );
+
+ // A fallback to window.onload, that will always work
+ window.addEventListener( "load", completed, false );
+
+ // If IE event model is used
+ } else {
+ // Ensure firing before onload, maybe late but safe also for iframes
+ document.attachEvent( "onreadystatechange", completed );
+
+ // A fallback to window.onload, that will always work
+ window.attachEvent( "onload", completed );
+
+ // If IE and not a frame
+ // continually check to see if the document is ready
+ var top = false;
+
+ try {
+ top = window.frameElement == null && document.documentElement;
+ } catch(e) {}
+
+ if ( top && top.doScroll ) {
+ (function doScrollCheck() {
+ if ( !jQuery.isReady ) {
+
+ try {
+ // Use the trick by Diego Perini
+ // http://javascript.nwbox.com/IEContentLoaded/
+ top.doScroll("left");
+ } catch(e) {
+ return setTimeout( doScrollCheck, 50 );
+ }
+
+ // detach all dom ready events
+ detach();
+
+ // and execute any waiting functions
+ jQuery.ready();
+ }
+ })();
+ }
+ }
+ }
+ return readyList.promise( obj );
+};
+
+// Populate the class2type map
+jQuery.each("Boolean Number String Function Array Date RegExp Object Error".split(" "), function(i, name) {
+ class2type[ "[object " + name + "]" ] = name.toLowerCase();
+});
+
+function isArraylike( obj ) {
+ var length = obj.length,
+ type = jQuery.type( obj );
+
+ if ( jQuery.isWindow( obj ) ) {
+ return false;
+ }
+
+ if ( obj.nodeType === 1 && length ) {
+ return true;
+ }
+
+ return type === "array" || type !== "function" &&
+ ( length === 0 ||
+ typeof length === "number" && length > 0 && ( length - 1 ) in obj );
+}
+
+// All jQuery objects should point back to these
+rootjQuery = jQuery(document);
+// String to Object options format cache
+var optionsCache = {};
+
+// Convert String-formatted options into Object-formatted ones and store in cache
+function createOptions( options ) {
+ var object = optionsCache[ options ] = {};
+ jQuery.each( options.match( core_rnotwhite ) || [], function( _, flag ) {
+ object[ flag ] = true;
+ });
+ return object;
+}
+
+/*
+ * Create a callback list using the following parameters:
+ *
+ * options: an optional list of space-separated options that will change how
+ * the callback list behaves or a more traditional option object
+ *
+ * By default a callback list will act like an event callback list and can be
+ * "fired" multiple times.
+ *
+ * Possible options:
+ *
+ * once: will ensure the callback list can only be fired once (like a Deferred)
+ *
+ * memory: will keep track of previous values and will call any callback added
+ * after the list has been fired right away with the latest "memorized"
+ * values (like a Deferred)
+ *
+ * unique: will ensure a callback can only be added once (no duplicate in the list)
+ *
+ * stopOnFalse: interrupt callings when a callback returns false
+ *
+ */
+jQuery.Callbacks = function( options ) {
+
+ // Convert options from String-formatted to Object-formatted if needed
+ // (we check in cache first)
+ options = typeof options === "string" ?
+ ( optionsCache[ options ] || createOptions( options ) ) :
+ jQuery.extend( {}, options );
+
+ var // Flag to know if list is currently firing
+ firing,
+ // Last fire value (for non-forgettable lists)
+ memory,
+ // Flag to know if list was already fired
+ fired,
+ // End of the loop when firing
+ firingLength,
+ // Index of currently firing callback (modified by remove if needed)
+ firingIndex,
+ // First callback to fire (used internally by add and fireWith)
+ firingStart,
+ // Actual callback list
+ list = [],
+ // Stack of fire calls for repeatable lists
+ stack = !options.once && [],
+ // Fire callbacks
+ fire = function( data ) {
+ memory = options.memory && data;
+ fired = true;
+ firingIndex = firingStart || 0;
+ firingStart = 0;
+ firingLength = list.length;
+ firing = true;
+ for ( ; list && firingIndex < firingLength; firingIndex++ ) {
+ if ( list[ firingIndex ].apply( data[ 0 ], data[ 1 ] ) === false && options.stopOnFalse ) {
+ memory = false; // To prevent further calls using add
+ break;
+ }
+ }
+ firing = false;
+ if ( list ) {
+ if ( stack ) {
+ if ( stack.length ) {
+ fire( stack.shift() );
+ }
+ } else if ( memory ) {
+ list = [];
+ } else {
+ self.disable();
+ }
+ }
+ },
+ // Actual Callbacks object
+ self = {
+ // Add a callback or a collection of callbacks to the list
+ add: function() {
+ if ( list ) {
+ // First, we save the current length
+ var start = list.length;
+ (function add( args ) {
+ jQuery.each( args, function( _, arg ) {
+ var type = jQuery.type( arg );
+ if ( type === "function" ) {
+ if ( !options.unique || !self.has( arg ) ) {
+ list.push( arg );
+ }
+ } else if ( arg && arg.length && type !== "string" ) {
+ // Inspect recursively
+ add( arg );
+ }
+ });
+ })( arguments );
+ // Do we need to add the callbacks to the
+ // current firing batch?
+ if ( firing ) {
+ firingLength = list.length;
+ // With memory, if we're not firing then
+ // we should call right away
+ } else if ( memory ) {
+ firingStart = start;
+ fire( memory );
+ }
+ }
+ return this;
+ },
+ // Remove a callback from the list
+ remove: function() {
+ if ( list ) {
+ jQuery.each( arguments, function( _, arg ) {
+ var index;
+ while( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {
+ list.splice( index, 1 );
+ // Handle firing indexes
+ if ( firing ) {
+ if ( index <= firingLength ) {
+ firingLength--;
+ }
+ if ( index <= firingIndex ) {
+ firingIndex--;
+ }
+ }
+ }
+ });
+ }
+ return this;
+ },
+ // Check if a given callback is in the list.
+ // If no argument is given, return whether or not list has callbacks attached.
+ has: function( fn ) {
+ return fn ? jQuery.inArray( fn, list ) > -1 : !!( list && list.length );
+ },
+ // Remove all callbacks from the list
+ empty: function() {
+ list = [];
+ return this;
+ },
+ // Have the list do nothing anymore
+ disable: function() {
+ list = stack = memory = undefined;
+ return this;
+ },
+ // Is it disabled?
+ disabled: function() {
+ return !list;
+ },
+ // Lock the list in its current state
+ lock: function() {
+ stack = undefined;
+ if ( !memory ) {
+ self.disable();
+ }
+ return this;
+ },
+ // Is it locked?
+ locked: function() {
+ return !stack;
+ },
+ // Call all callbacks with the given context and arguments
+ fireWith: function( context, args ) {
+ args = args || [];
+ args = [ context, args.slice ? args.slice() : args ];
+ if ( list && ( !fired || stack ) ) {
+ if ( firing ) {
+ stack.push( args );
+ } else {
+ fire( args );
+ }
+ }
+ return this;
+ },
+ // Call all the callbacks with the given arguments
+ fire: function() {
+ self.fireWith( this, arguments );
+ return this;
+ },
+ // To know if the callbacks have already been called at least once
+ fired: function() {
+ return !!fired;
+ }
+ };
+
+ return self;
+};
+jQuery.extend({
+
+ Deferred: function( func ) {
+ var tuples = [
+ // action, add listener, listener list, final state
+ [ "resolve", "done", jQuery.Callbacks("once memory"), "resolved" ],
+ [ "reject", "fail", jQuery.Callbacks("once memory"), "rejected" ],
+ [ "notify", "progress", jQuery.Callbacks("memory") ]
+ ],
+ state = "pending",
+ promise = {
+ state: function() {
+ return state;
+ },
+ always: function() {
+ deferred.done( arguments ).fail( arguments );
+ return this;
+ },
+ then: function( /* fnDone, fnFail, fnProgress */ ) {
+ var fns = arguments;
+ return jQuery.Deferred(function( newDefer ) {
+ jQuery.each( tuples, function( i, tuple ) {
+ var action = tuple[ 0 ],
+ fn = jQuery.isFunction( fns[ i ] ) && fns[ i ];
+ // deferred[ done | fail | progress ] for forwarding actions to newDefer
+ deferred[ tuple[1] ](function() {
+ var returned = fn && fn.apply( this, arguments );
+ if ( returned && jQuery.isFunction( returned.promise ) ) {
+ returned.promise()
+ .done( newDefer.resolve )
+ .fail( newDefer.reject )
+ .progress( newDefer.notify );
+ } else {
+ newDefer[ action + "With" ]( this === promise ? newDefer.promise() : this, fn ? [ returned ] : arguments );
+ }
+ });
+ });
+ fns = null;
+ }).promise();
+ },
+ // Get a promise for this deferred
+ // If obj is provided, the promise aspect is added to the object
+ promise: function( obj ) {
+ return obj != null ? jQuery.extend( obj, promise ) : promise;
+ }
+ },
+ deferred = {};
+
+ // Keep pipe for back-compat
+ promise.pipe = promise.then;
+
+ // Add list-specific methods
+ jQuery.each( tuples, function( i, tuple ) {
+ var list = tuple[ 2 ],
+ stateString = tuple[ 3 ];
+
+ // promise[ done | fail | progress ] = list.add
+ promise[ tuple[1] ] = list.add;
+
+ // Handle state
+ if ( stateString ) {
+ list.add(function() {
+ // state = [ resolved | rejected ]
+ state = stateString;
+
+ // [ reject_list | resolve_list ].disable; progress_list.lock
+ }, tuples[ i ^ 1 ][ 2 ].disable, tuples[ 2 ][ 2 ].lock );
+ }
+
+ // deferred[ resolve | reject | notify ]
+ deferred[ tuple[0] ] = function() {
+ deferred[ tuple[0] + "With" ]( this === deferred ? promise : this, arguments );
+ return this;
+ };
+ deferred[ tuple[0] + "With" ] = list.fireWith;
+ });
+
+ // Make the deferred a promise
+ promise.promise( deferred );
+
+ // Call given func if any
+ if ( func ) {
+ func.call( deferred, deferred );
+ }
+
+ // All done!
+ return deferred;
+ },
+
+ // Deferred helper
+ when: function( subordinate /* , ..., subordinateN */ ) {
+ var i = 0,
+ resolveValues = core_slice.call( arguments ),
+ length = resolveValues.length,
+
+ // the count of uncompleted subordinates
+ remaining = length !== 1 || ( subordinate && jQuery.isFunction( subordinate.promise ) ) ? length : 0,
+
+ // the master Deferred. If resolveValues consist of only a single Deferred, just use that.
+ deferred = remaining === 1 ? subordinate : jQuery.Deferred(),
+
+ // Update function for both resolve and progress values
+ updateFunc = function( i, contexts, values ) {
+ return function( value ) {
+ contexts[ i ] = this;
+ values[ i ] = arguments.length > 1 ? core_slice.call( arguments ) : value;
+ if( values === progressValues ) {
+ deferred.notifyWith( contexts, values );
+ } else if ( !( --remaining ) ) {
+ deferred.resolveWith( contexts, values );
+ }
+ };
+ },
+
+ progressValues, progressContexts, resolveContexts;
+
+ // add listeners to Deferred subordinates; treat others as resolved
+ if ( length > 1 ) {
+ progressValues = new Array( length );
+ progressContexts = new Array( length );
+ resolveContexts = new Array( length );
+ for ( ; i < length; i++ ) {
+ if ( resolveValues[ i ] && jQuery.isFunction( resolveValues[ i ].promise ) ) {
+ resolveValues[ i ].promise()
+ .done( updateFunc( i, resolveContexts, resolveValues ) )
+ .fail( deferred.reject )
+ .progress( updateFunc( i, progressContexts, progressValues ) );
+ } else {
+ --remaining;
+ }
+ }
+ }
+
+ // if we're not waiting on anything, resolve the master
+ if ( !remaining ) {
+ deferred.resolveWith( resolveContexts, resolveValues );
+ }
+
+ return deferred.promise();
+ }
+});
+jQuery.support = (function() {
+
+ var support, all, a,
+ input, select, fragment,
+ opt, eventName, isSupported, i,
+ div = document.createElement("div");
+
+ // Setup
+ div.setAttribute( "className", "t" );
+ div.innerHTML = " <link/><table></table><a href='/a'>a</a><input type='checkbox'/>";
+
+ // Support tests won't run in some limited or non-browser environments
+ all = div.getElementsByTagName("*");
+ a = div.getElementsByTagName("a")[ 0 ];
+ if ( !all || !a || !all.length ) {
+ return {};
+ }
+
+ // First batch of tests
+ select = document.createElement("select");
+ opt = select.appendChild( document.createElement("option") );
+ input = div.getElementsByTagName("input")[ 0 ];
+
+ a.style.cssText = "top:1px;float:left;opacity:.5";
+ support = {
+ // Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7)
+ getSetAttribute: div.className !== "t",
+
+ // IE strips leading whitespace when .innerHTML is used
+ leadingWhitespace: div.firstChild.nodeType === 3,
+
+ // Make sure that tbody elements aren't automatically inserted
+ // IE will insert them into empty tables
+ tbody: !div.getElementsByTagName("tbody").length,
+
+ // Make sure that link elements get serialized correctly by innerHTML
+ // This requires a wrapper element in IE
+ htmlSerialize: !!div.getElementsByTagName("link").length,
+
+ // Get the style information from getAttribute
+ // (IE uses .cssText instead)
+ style: /top/.test( a.getAttribute("style") ),
+
+ // Make sure that URLs aren't manipulated
+ // (IE normalizes it by default)
+ hrefNormalized: a.getAttribute("href") === "/a",
+
+ // Make sure that element opacity exists
+ // (IE uses filter instead)
+ // Use a regex to work around a WebKit issue. See #5145
+ opacity: /^0.5/.test( a.style.opacity ),
+
+ // Verify style float existence
+ // (IE uses styleFloat instead of cssFloat)
+ cssFloat: !!a.style.cssFloat,
+
+ // Check the default checkbox/radio value ("" on WebKit; "on" elsewhere)
+ checkOn: !!input.value,
+
+ // Make sure that a selected-by-default option has a working selected property.
+ // (WebKit defaults to false instead of true, IE too, if it's in an optgroup)
+ optSelected: opt.selected,
+
+ // Tests for enctype support on a form (#6743)
+ enctype: !!document.createElement("form").enctype,
+
+ // Makes sure cloning an html5 element does not cause problems
+ // Where outerHTML is undefined, this still works
+ html5Clone: document.createElement("nav").cloneNode( true ).outerHTML !== "<:nav></:nav>",
+
+ // jQuery.support.boxModel DEPRECATED in 1.8 since we don't support Quirks Mode
+ boxModel: document.compatMode === "CSS1Compat",
+
+ // Will be defined later
+ deleteExpando: true,
+ noCloneEvent: true,
+ inlineBlockNeedsLayout: false,
+ shrinkWrapBlocks: false,
+ reliableMarginRight: true,
+ boxSizingReliable: true,
+ pixelPosition: false
+ };
+
+ // Make sure checked status is properly cloned
+ input.checked = true;
+ support.noCloneChecked = input.cloneNode( true ).checked;
+
+ // Make sure that the options inside disabled selects aren't marked as disabled
+ // (WebKit marks them as disabled)
+ select.disabled = true;
+ support.optDisabled = !opt.disabled;
+
+ // Support: IE<9
+ try {
+ delete div.test;
+ } catch( e ) {
+ support.deleteExpando = false;
+ }
+
+ // Check if we can trust getAttribute("value")
+ input = document.createElement("input");
+ input.setAttribute( "value", "" );
+ support.input = input.getAttribute( "value" ) === "";
+
+ // Check if an input maintains its value after becoming a radio
+ input.value = "t";
+ input.setAttribute( "type", "radio" );
+ support.radioValue = input.value === "t";
+
+ // #11217 - WebKit loses check when the name is after the checked attribute
+ input.setAttribute( "checked", "t" );
+ input.setAttribute( "name", "t" );
+
+ fragment = document.createDocumentFragment();
+ fragment.appendChild( input );
+
+ // Check if a disconnected checkbox will retain its checked
+ // value of true after appended to the DOM (IE6/7)
+ support.appendChecked = input.checked;
+
+ // WebKit doesn't clone checked state correctly in fragments
+ support.checkClone = fragment.cloneNode( true ).cloneNode( true ).lastChild.checked;
+
+ // Support: IE<9
+ // Opera does not clone events (and typeof div.attachEvent === undefined).
+ // IE9-10 clones events bound via attachEvent, but they don't trigger with .click()
+ if ( div.attachEvent ) {
+ div.attachEvent( "onclick", function() {
+ support.noCloneEvent = false;
+ });
+
+ div.cloneNode( true ).click();
+ }
+
+ // Support: IE<9 (lack submit/change bubble), Firefox 17+ (lack focusin event)
+ // Beware of CSP restrictions (https://developer.mozilla.org/en/Security/CSP), test/csp.php
+ for ( i in { submit: true, change: true, focusin: true }) {
+ div.setAttribute( eventName = "on" + i, "t" );
+
+ support[ i + "Bubbles" ] = eventName in window || div.attributes[ eventName ].expando === false;
+ }
+
+ div.style.backgroundClip = "content-box";
+ div.cloneNode( true ).style.backgroundClip = "";
+ support.clearCloneStyle = div.style.backgroundClip === "content-box";
+
+ // Run tests that need a body at doc ready
+ jQuery(function() {
+ var container, marginDiv, tds,
+ divReset = "padding:0;margin:0;border:0;display:block;box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;",
+ body = document.getElementsByTagName("body")[0];
+
+ if ( !body ) {
+ // Return for frameset docs that don't have a body
+ return;
+ }
+
+ container = document.createElement("div");
+ container.style.cssText = "border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px";
+
+ body.appendChild( container ).appendChild( div );
+
+ // Support: IE8
+ // Check if table cells still have offsetWidth/Height when they are set
+ // to display:none and there are still other visible table cells in a
+ // table row; if so, offsetWidth/Height are not reliable for use when
+ // determining if an element has been hidden directly using
+ // display:none (it is still safe to use offsets if a parent element is
+ // hidden; don safety goggles and see bug #4512 for more information).
+ div.innerHTML = "<table><tr><td></td><td>t</td></tr></table>";
+ tds = div.getElementsByTagName("td");
+ tds[ 0 ].style.cssText = "padding:0;margin:0;border:0;display:none";
+ isSupported = ( tds[ 0 ].offsetHeight === 0 );
+
+ tds[ 0 ].style.display = "";
+ tds[ 1 ].style.display = "none";
+
+ // Support: IE8
+ // Check if empty table cells still have offsetWidth/Height
+ support.reliableHiddenOffsets = isSupported && ( tds[ 0 ].offsetHeight === 0 );
+
+ // Check box-sizing and margin behavior
+ div.innerHTML = "";
+ div.style.cssText = "box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;";
+ support.boxSizing = ( div.offsetWidth === 4 );
+ support.doesNotIncludeMarginInBodyOffset = ( body.offsetTop !== 1 );
+
+ // Use window.getComputedStyle because jsdom on node.js will break without it.
+ if ( window.getComputedStyle ) {
+ support.pixelPosition = ( window.getComputedStyle( div, null ) || {} ).top !== "1%";
+ support.boxSizingReliable = ( window.getComputedStyle( div, null ) || { width: "4px" } ).width === "4px";
+
+ // Check if div with explicit width and no margin-right incorrectly
+ // gets computed margin-right based on width of container. (#3333)
+ // Fails in WebKit before Feb 2011 nightlies
+ // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
+ marginDiv = div.appendChild( document.createElement("div") );
+ marginDiv.style.cssText = div.style.cssText = divReset;
+ marginDiv.style.marginRight = marginDiv.style.width = "0";
+ div.style.width = "1px";
+
+ support.reliableMarginRight =
+ !parseFloat( ( window.getComputedStyle( marginDiv, null ) || {} ).marginRight );
+ }
+
+ if ( typeof div.style.zoom !== core_strundefined ) {
+ // Support: IE<8
+ // Check if natively block-level elements act like inline-block
+ // elements when setting their display to 'inline' and giving
+ // them layout
+ div.innerHTML = "";
+ div.style.cssText = divReset + "width:1px;padding:1px;display:inline;zoom:1";
+ support.inlineBlockNeedsLayout = ( div.offsetWidth === 3 );
+
+ // Support: IE6
+ // Check if elements with layout shrink-wrap their children
+ div.style.display = "block";
+ div.innerHTML = "<div></div>";
+ div.firstChild.style.width = "5px";
+ support.shrinkWrapBlocks = ( div.offsetWidth !== 3 );
+
+ if ( support.inlineBlockNeedsLayout ) {
+ // Prevent IE 6 from affecting layout for positioned elements #11048
+ // Prevent IE from shrinking the body in IE 7 mode #12869
+ // Support: IE<8
+ body.style.zoom = 1;
+ }
+ }
+
+ body.removeChild( container );
+
+ // Null elements to avoid leaks in IE
+ container = div = tds = marginDiv = null;
+ });
+
+ // Null elements to avoid leaks in IE
+ all = select = fragment = opt = a = input = null;
+
+ return support;
+})();
+
+var rbrace = /(?:\{[\s\S]*\}|\[[\s\S]*\])$/,
+ rmultiDash = /([A-Z])/g;
+
+function internalData( elem, name, data, pvt /* Internal Use Only */ ){
+ if ( !jQuery.acceptData( elem ) ) {
+ return;
+ }
+
+ var thisCache, ret,
+ internalKey = jQuery.expando,
+ getByName = typeof name === "string",
+
+ // We have to handle DOM nodes and JS objects differently because IE6-7
+ // can't GC object references properly across the DOM-JS boundary
+ isNode = elem.nodeType,
+
+ // Only DOM nodes need the global jQuery cache; JS object data is
+ // attached directly to the object so GC can occur automatically
+ cache = isNode ? jQuery.cache : elem,
+
+ // Only defining an ID for JS objects if its cache already exists allows
+ // the code to shortcut on the same path as a DOM node with no cache
+ id = isNode ? elem[ internalKey ] : elem[ internalKey ] && internalKey;
+
+ // Avoid doing any more work than we need to when trying to get data on an
+ // object that has no data at all
+ if ( (!id || !cache[id] || (!pvt && !cache[id].data)) && getByName && data === undefined ) {
+ return;
+ }
+
+ if ( !id ) {
+ // Only DOM nodes need a new unique ID for each element since their data
+ // ends up in the global cache
+ if ( isNode ) {
+ elem[ internalKey ] = id = core_deletedIds.pop() || jQuery.guid++;
+ } else {
+ id = internalKey;
+ }
+ }
+
+ if ( !cache[ id ] ) {
+ cache[ id ] = {};
+
+ // Avoids exposing jQuery metadata on plain JS objects when the object
+ // is serialized using JSON.stringify
+ if ( !isNode ) {
+ cache[ id ].toJSON = jQuery.noop;
+ }
+ }
+
+ // An object can be passed to jQuery.data instead of a key/value pair; this gets
+ // shallow copied over onto the existing cache
+ if ( typeof name === "object" || typeof name === "function" ) {
+ if ( pvt ) {
+ cache[ id ] = jQuery.extend( cache[ id ], name );
+ } else {
+ cache[ id ].data = jQuery.extend( cache[ id ].data, name );
+ }
+ }
+
+ thisCache = cache[ id ];
+
+ // jQuery data() is stored in a separate object inside the object's internal data
+ // cache in order to avoid key collisions between internal data and user-defined
+ // data.
+ if ( !pvt ) {
+ if ( !thisCache.data ) {
+ thisCache.data = {};
+ }
+
+ thisCache = thisCache.data;
+ }
+
+ if ( data !== undefined ) {
+ thisCache[ jQuery.camelCase( name ) ] = data;
+ }
+
+ // Check for both converted-to-camel and non-converted data property names
+ // If a data property was specified
+ if ( getByName ) {
+
+ // First Try to find as-is property data
+ ret = thisCache[ name ];
+
+ // Test for null|undefined property data
+ if ( ret == null ) {
+
+ // Try to find the camelCased property
+ ret = thisCache[ jQuery.camelCase( name ) ];
+ }
+ } else {
+ ret = thisCache;
+ }
+
+ return ret;
+}
+
+function internalRemoveData( elem, name, pvt ) {
+ if ( !jQuery.acceptData( elem ) ) {
+ return;
+ }
+
+ var i, l, thisCache,
+ isNode = elem.nodeType,
+
+ // See jQuery.data for more information
+ cache = isNode ? jQuery.cache : elem,
+ id = isNode ? elem[ jQuery.expando ] : jQuery.expando;
+
+ // If there is already no cache entry for this object, there is no
+ // purpose in continuing
+ if ( !cache[ id ] ) {
+ return;
+ }
+
+ if ( name ) {
+
+ thisCache = pvt ? cache[ id ] : cache[ id ].data;
+
+ if ( thisCache ) {
+
+ // Support array or space separated string names for data keys
+ if ( !jQuery.isArray( name ) ) {
+
+ // try the string as a key before any manipulation
+ if ( name in thisCache ) {
+ name = [ name ];
+ } else {
+
+ // split the camel cased version by spaces unless a key with the spaces exists
+ name = jQuery.camelCase( name );
+ if ( name in thisCache ) {
+ name = [ name ];
+ } else {
+ name = name.split(" ");
+ }
+ }
+ } else {
+ // If "name" is an array of keys...
+ // When data is initially created, via ("key", "val") signature,
+ // keys will be converted to camelCase.
+ // Since there is no way to tell _how_ a key was added, remove
+ // both plain key and camelCase key. #12786
+ // This will only penalize the array argument path.
+ name = name.concat( jQuery.map( name, jQuery.camelCase ) );
+ }
+
+ for ( i = 0, l = name.length; i < l; i++ ) {
+ delete thisCache[ name[i] ];
+ }
+
+ // If there is no data left in the cache, we want to continue
+ // and let the cache object itself get destroyed
+ if ( !( pvt ? isEmptyDataObject : jQuery.isEmptyObject )( thisCache ) ) {
+ return;
+ }
+ }
+ }
+
+ // See jQuery.data for more information
+ if ( !pvt ) {
+ delete cache[ id ].data;
+
+ // Don't destroy the parent cache unless the internal data object
+ // had been the only thing left in it
+ if ( !isEmptyDataObject( cache[ id ] ) ) {
+ return;
+ }
+ }
+
+ // Destroy the cache
+ if ( isNode ) {
+ jQuery.cleanData( [ elem ], true );
+
+ // Use delete when supported for expandos or `cache` is not a window per isWindow (#10080)
+ } else if ( jQuery.support.deleteExpando || cache != cache.window ) {
+ delete cache[ id ];
+
+ // When all else fails, null
+ } else {
+ cache[ id ] = null;
+ }
+}
+
+jQuery.extend({
+ cache: {},
+
+ // Unique for each copy of jQuery on the page
+ // Non-digits removed to match rinlinejQuery
+ expando: "jQuery" + ( core_version + Math.random() ).replace( /\D/g, "" ),
+
+ // The following elements throw uncatchable exceptions if you
+ // attempt to add expando properties to them.
+ noData: {
+ "embed": true,
+ // Ban all objects except for Flash (which handle expandos)
+ "object": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",
+ "applet": true
+ },
+
+ hasData: function( elem ) {
+ elem = elem.nodeType ? jQuery.cache[ elem[jQuery.expando] ] : elem[ jQuery.expando ];
+ return !!elem && !isEmptyDataObject( elem );
+ },
+
+ data: function( elem, name, data ) {
+ return internalData( elem, name, data );
+ },
+
+ removeData: function( elem, name ) {
+ return internalRemoveData( elem, name );
+ },
+
+ // For internal use only.
+ _data: function( elem, name, data ) {
+ return internalData( elem, name, data, true );
+ },
+
+ _removeData: function( elem, name ) {
+ return internalRemoveData( elem, name, true );
+ },
+
+ // A method for determining if a DOM node can handle the data expando
+ acceptData: function( elem ) {
+ // Do not set data on non-element because it will not be cleared (#8335).
+ if ( elem.nodeType && elem.nodeType !== 1 && elem.nodeType !== 9 ) {
+ return false;
+ }
+
+ var noData = elem.nodeName && jQuery.noData[ elem.nodeName.toLowerCase() ];
+
+ // nodes accept data unless otherwise specified; rejection can be conditional
+ return !noData || noData !== true && elem.getAttribute("classid") === noData;
+ }
+});
+
+jQuery.fn.extend({
+ data: function( key, value ) {
+ var attrs, name,
+ elem = this[0],
+ i = 0,
+ data = null;
+
+ // Gets all values
+ if ( key === undefined ) {
+ if ( this.length ) {
+ data = jQuery.data( elem );
+
+ if ( elem.nodeType === 1 && !jQuery._data( elem, "parsedAttrs" ) ) {
+ attrs = elem.attributes;
+ for ( ; i < attrs.length; i++ ) {
+ name = attrs[i].name;
+
+ if ( !name.indexOf( "data-" ) ) {
+ name = jQuery.camelCase( name.slice(5) );
+
+ dataAttr( elem, name, data[ name ] );
+ }
+ }
+ jQuery._data( elem, "parsedAttrs", true );
+ }
+ }
+
+ return data;
+ }
+
+ // Sets multiple values
+ if ( typeof key === "object" ) {
+ return this.each(function() {
+ jQuery.data( this, key );
+ });
+ }
+
+ return jQuery.access( this, function( value ) {
+
+ if ( value === undefined ) {
+ // Try to fetch any internally stored data first
+ return elem ? dataAttr( elem, key, jQuery.data( elem, key ) ) : null;
+ }
+
+ this.each(function() {
+ jQuery.data( this, key, value );
+ });
+ }, null, value, arguments.length > 1, null, true );
+ },
+
+ removeData: function( key ) {
+ return this.each(function() {
+ jQuery.removeData( this, key );
+ });
+ }
+});
+
+function dataAttr( elem, key, data ) {
+ // If nothing was found internally, try to fetch any
+ // data from the HTML5 data-* attribute
+ if ( data === undefined && elem.nodeType === 1 ) {
+
+ var name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase();
+
+ data = elem.getAttribute( name );
+
+ if ( typeof data === "string" ) {
+ try {
+ data = data === "true" ? true :
+ data === "false" ? false :
+ data === "null" ? null :
+ // Only convert to a number if it doesn't change the string
+ +data + "" === data ? +data :
+ rbrace.test( data ) ? jQuery.parseJSON( data ) :
+ data;
+ } catch( e ) {}
+
+ // Make sure we set the data so it isn't changed later
+ jQuery.data( elem, key, data );
+
+ } else {
+ data = undefined;
+ }
+ }
+
+ return data;
+}
+
+// checks a cache object for emptiness
+function isEmptyDataObject( obj ) {
+ var name;
+ for ( name in obj ) {
+
+ // if the public data object is empty, the private is still empty
+ if ( name === "data" && jQuery.isEmptyObject( obj[name] ) ) {
+ continue;
+ }
+ if ( name !== "toJSON" ) {
+ return false;
+ }
+ }
+
+ return true;
+}
+jQuery.extend({
+ queue: function( elem, type, data ) {
+ var queue;
+
+ if ( elem ) {
+ type = ( type || "fx" ) + "queue";
+ queue = jQuery._data( elem, type );
+
+ // Speed up dequeue by getting out quickly if this is just a lookup
+ if ( data ) {
+ if ( !queue || jQuery.isArray(data) ) {
+ queue = jQuery._data( elem, type, jQuery.makeArray(data) );
+ } else {
+ queue.push( data );
+ }
+ }
+ return queue || [];
+ }
+ },
+
+ dequeue: function( elem, type ) {
+ type = type || "fx";
+
+ var queue = jQuery.queue( elem, type ),
+ startLength = queue.length,
+ fn = queue.shift(),
+ hooks = jQuery._queueHooks( elem, type ),
+ next = function() {
+ jQuery.dequeue( elem, type );
+ };
+
+ // If the fx queue is dequeued, always remove the progress sentinel
+ if ( fn === "inprogress" ) {
+ fn = queue.shift();
+ startLength--;
+ }
+
+ hooks.cur = fn;
+ if ( fn ) {
+
+ // Add a progress sentinel to prevent the fx queue from being
+ // automatically dequeued
+ if ( type === "fx" ) {
+ queue.unshift( "inprogress" );
+ }
+
+ // clear up the last queue stop function
+ delete hooks.stop;
+ fn.call( elem, next, hooks );
+ }
+
+ if ( !startLength && hooks ) {
+ hooks.empty.fire();
+ }
+ },
+
+ // not intended for public consumption - generates a queueHooks object, or returns the current one
+ _queueHooks: function( elem, type ) {
+ var key = type + "queueHooks";
+ return jQuery._data( elem, key ) || jQuery._data( elem, key, {
+ empty: jQuery.Callbacks("once memory").add(function() {
+ jQuery._removeData( elem, type + "queue" );
+ jQuery._removeData( elem, key );
+ })
+ });
+ }
+});
+
+jQuery.fn.extend({
+ queue: function( type, data ) {
+ var setter = 2;
+
+ if ( typeof type !== "string" ) {
+ data = type;
+ type = "fx";
+ setter--;
+ }
+
+ if ( arguments.length < setter ) {
+ return jQuery.queue( this[0], type );
+ }
+
+ return data === undefined ?
+ this :
+ this.each(function() {
+ var queue = jQuery.queue( this, type, data );
+
+ // ensure a hooks for this queue
+ jQuery._queueHooks( this, type );
+
+ if ( type === "fx" && queue[0] !== "inprogress" ) {
+ jQuery.dequeue( this, type );
+ }
+ });
+ },
+ dequeue: function( type ) {
+ return this.each(function() {
+ jQuery.dequeue( this, type );
+ });
+ },
+ // Based off of the plugin by Clint Helfers, with permission.
+ // http://blindsignals.com/index.php/2009/07/jquery-delay/
+ delay: function( time, type ) {
+ time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
+ type = type || "fx";
+
+ return this.queue( type, function( next, hooks ) {
+ var timeout = setTimeout( next, time );
+ hooks.stop = function() {
+ clearTimeout( timeout );
+ };
+ });
+ },
+ clearQueue: function( type ) {
+ return this.queue( type || "fx", [] );
+ },
+ // Get a promise resolved when queues of a certain type
+ // are emptied (fx is the type by default)
+ promise: function( type, obj ) {
+ var tmp,
+ count = 1,
+ defer = jQuery.Deferred(),
+ elements = this,
+ i = this.length,
+ resolve = function() {
+ if ( !( --count ) ) {
+ defer.resolveWith( elements, [ elements ] );
+ }
+ };
+
+ if ( typeof type !== "string" ) {
+ obj = type;
+ type = undefined;
+ }
+ type = type || "fx";
+
+ while( i-- ) {
+ tmp = jQuery._data( elements[ i ], type + "queueHooks" );
+ if ( tmp && tmp.empty ) {
+ count++;
+ tmp.empty.add( resolve );
+ }
+ }
+ resolve();
+ return defer.promise( obj );
+ }
+});
+var nodeHook, boolHook,
+ rclass = /[\t\r\n]/g,
+ rreturn = /\r/g,
+ rfocusable = /^(?:input|select|textarea|button|object)$/i,
+ rclickable = /^(?:a|area)$/i,
+ rboolean = /^(?:checked|selected|autofocus|autoplay|async|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped)$/i,
+ ruseDefault = /^(?:checked|selected)$/i,
+ getSetAttribute = jQuery.support.getSetAttribute,
+ getSetInput = jQuery.support.input;
+
+jQuery.fn.extend({
+ attr: function( name, value ) {
+ return jQuery.access( this, jQuery.attr, name, value, arguments.length > 1 );
+ },
+
+ removeAttr: function( name ) {
+ return this.each(function() {
+ jQuery.removeAttr( this, name );
+ });
+ },
+
+ prop: function( name, value ) {
+ return jQuery.access( this, jQuery.prop, name, value, arguments.length > 1 );
+ },
+
+ removeProp: function( name ) {
+ name = jQuery.propFix[ name ] || name;
+ return this.each(function() {
+ // try/catch handles cases where IE balks (such as removing a property on window)
+ try {
+ this[ name ] = undefined;
+ delete this[ name ];
+ } catch( e ) {}
+ });
+ },
+
+ addClass: function( value ) {
+ var classes, elem, cur, clazz, j,
+ i = 0,
+ len = this.length,
+ proceed = typeof value === "string" && value;
+
+ if ( jQuery.isFunction( value ) ) {
+ return this.each(function( j ) {
+ jQuery( this ).addClass( value.call( this, j, this.className ) );
+ });
+ }
+
+ if ( proceed ) {
+ // The disjunction here is for better compressibility (see removeClass)
+ classes = ( value || "" ).match( core_rnotwhite ) || [];
+
+ for ( ; i < len; i++ ) {
+ elem = this[ i ];
+ cur = elem.nodeType === 1 && ( elem.className ?
+ ( " " + elem.className + " " ).replace( rclass, " " ) :
+ " "
+ );
+
+ if ( cur ) {
+ j = 0;
+ while ( (clazz = classes[j++]) ) {
+ if ( cur.indexOf( " " + clazz + " " ) < 0 ) {
+ cur += clazz + " ";
+ }
+ }
+ elem.className = jQuery.trim( cur );
+
+ }
+ }
+ }
+
+ return this;
+ },
+
+ removeClass: function( value ) {
+ var classes, elem, cur, clazz, j,
+ i = 0,
+ len = this.length,
+ proceed = arguments.length === 0 || typeof value === "string" && value;
+
+ if ( jQuery.isFunction( value ) ) {
+ return this.each(function( j ) {
+ jQuery( this ).removeClass( value.call( this, j, this.className ) );
+ });
+ }
+ if ( proceed ) {
+ classes = ( value || "" ).match( core_rnotwhite ) || [];
+
+ for ( ; i < len; i++ ) {
+ elem = this[ i ];
+ // This expression is here for better compressibility (see addClass)
+ cur = elem.nodeType === 1 && ( elem.className ?
+ ( " " + elem.className + " " ).replace( rclass, " " ) :
+ ""
+ );
+
+ if ( cur ) {
+ j = 0;
+ while ( (clazz = classes[j++]) ) {
+ // Remove *all* instances
+ while ( cur.indexOf( " " + clazz + " " ) >= 0 ) {
+ cur = cur.replace( " " + clazz + " ", " " );
+ }
+ }
+ elem.className = value ? jQuery.trim( cur ) : "";
+ }
+ }
+ }
+
+ return this;
+ },
+
+ toggleClass: function( value, stateVal ) {
+ var type = typeof value,
+ isBool = typeof stateVal === "boolean";
+
+ if ( jQuery.isFunction( value ) ) {
+ return this.each(function( i ) {
+ jQuery( this ).toggleClass( value.call(this, i, this.className, stateVal), stateVal );
+ });
+ }
+
+ return this.each(function() {
+ if ( type === "string" ) {
+ // toggle individual class names
+ var className,
+ i = 0,
+ self = jQuery( this ),
+ state = stateVal,
+ classNames = value.match( core_rnotwhite ) || [];
+
+ while ( (className = classNames[ i++ ]) ) {
+ // check each className given, space separated list
+ state = isBool ? state : !self.hasClass( className );
+ self[ state ? "addClass" : "removeClass" ]( className );
+ }
+
+ // Toggle whole class name
+ } else if ( type === core_strundefined || type === "boolean" ) {
+ if ( this.className ) {
+ // store className if set
+ jQuery._data( this, "__className__", this.className );
+ }
+
+ // If the element has a class name or if we're passed "false",
+ // then remove the whole classname (if there was one, the above saved it).
+ // Otherwise bring back whatever was previously saved (if anything),
+ // falling back to the empty string if nothing was stored.
+ this.className = this.className || value === false ? "" : jQuery._data( this, "__className__" ) || "";
+ }
+ });
+ },
+
+ hasClass: function( selector ) {
+ var className = " " + selector + " ",
+ i = 0,
+ l = this.length;
+ for ( ; i < l; i++ ) {
+ if ( this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) >= 0 ) {
+ return true;
+ }
+ }
+
+ return false;
+ },
+
+ val: function( value ) {
+ var ret, hooks, isFunction,
+ elem = this[0];
+
+ if ( !arguments.length ) {
+ if ( elem ) {
+ hooks = jQuery.valHooks[ elem.type ] || jQuery.valHooks[ elem.nodeName.toLowerCase() ];
+
+ if ( hooks && "get" in hooks && (ret = hooks.get( elem, "value" )) !== undefined ) {
+ return ret;
+ }
+
+ ret = elem.value;
+
+ return typeof ret === "string" ?
+ // handle most common string cases
+ ret.replace(rreturn, "") :
+ // handle cases where value is null/undef or number
+ ret == null ? "" : ret;
+ }
+
+ return;
+ }
+
+ isFunction = jQuery.isFunction( value );
+
+ return this.each(function( i ) {
+ var val,
+ self = jQuery(this);
+
+ if ( this.nodeType !== 1 ) {
+ return;
+ }
+
+ if ( isFunction ) {
+ val = value.call( this, i, self.val() );
+ } else {
+ val = value;
+ }
+
+ // Treat null/undefined as ""; convert numbers to string
+ if ( val == null ) {
+ val = "";
+ } else if ( typeof val === "number" ) {
+ val += "";
+ } else if ( jQuery.isArray( val ) ) {
+ val = jQuery.map(val, function ( value ) {
+ return value == null ? "" : value + "";
+ });
+ }
+
+ hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];
+
+ // If set returns undefined, fall back to normal setting
+ if ( !hooks || !("set" in hooks) || hooks.set( this, val, "value" ) === undefined ) {
+ this.value = val;
+ }
+ });
+ }
+});
+
+jQuery.extend({
+ valHooks: {
+ option: {
+ get: function( elem ) {
+ // attributes.value is undefined in Blackberry 4.7 but
+ // uses .value. See #6932
+ var val = elem.attributes.value;
+ return !val || val.specified ? elem.value : elem.text;
+ }
+ },
+ select: {
+ get: function( elem ) {
+ var value, option,
+ options = elem.options,
+ index = elem.selectedIndex,
+ one = elem.type === "select-one" || index < 0,
+ values = one ? null : [],
+ max = one ? index + 1 : options.length,
+ i = index < 0 ?
+ max :
+ one ? index : 0;
+
+ // Loop through all the selected options
+ for ( ; i < max; i++ ) {
+ option = options[ i ];
+
+ // oldIE doesn't update selected after form reset (#2551)
+ if ( ( option.selected || i === index ) &&
+ // Don't return options that are disabled or in a disabled optgroup
+ ( jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null ) &&
+ ( !option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" ) ) ) {
+
+ // Get the specific value for the option
+ value = jQuery( option ).val();
+
+ // We don't need an array for one selects
+ if ( one ) {
+ return value;
+ }
+
+ // Multi-Selects return an array
+ values.push( value );
+ }
+ }
+
+ return values;
+ },
+
+ set: function( elem, value ) {
+ var values = jQuery.makeArray( value );
+
+ jQuery(elem).find("option").each(function() {
+ this.selected = jQuery.inArray( jQuery(this).val(), values ) >= 0;
+ });
+
+ if ( !values.length ) {
+ elem.selectedIndex = -1;
+ }
+ return values;
+ }
+ }
+ },
+
+ attr: function( elem, name, value ) {
+ var hooks, notxml, ret,
+ nType = elem.nodeType;
+
+ // don't get/set attributes on text, comment and attribute nodes
+ if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
+ return;
+ }
+
+ // Fallback to prop when attributes are not supported
+ if ( typeof elem.getAttribute === core_strundefined ) {
+ return jQuery.prop( elem, name, value );
+ }
+
+ notxml = nType !== 1 || !jQuery.isXMLDoc( elem );
+
+ // All attributes are lowercase
+ // Grab necessary hook if one is defined
+ if ( notxml ) {
+ name = name.toLowerCase();
+ hooks = jQuery.attrHooks[ name ] || ( rboolean.test( name ) ? boolHook : nodeHook );
+ }
+
+ if ( value !== undefined ) {
+
+ if ( value === null ) {
+ jQuery.removeAttr( elem, name );
+
+ } else if ( hooks && notxml && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) {
+ return ret;
+
+ } else {
+ elem.setAttribute( name, value + "" );
+ return value;
+ }
+
+ } else if ( hooks && notxml && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) {
+ return ret;
+
+ } else {
+
+ // In IE9+, Flash objects don't have .getAttribute (#12945)
+ // Support: IE9+
+ if ( typeof elem.getAttribute !== core_strundefined ) {
+ ret = elem.getAttribute( name );
+ }
+
+ // Non-existent attributes return null, we normalize to undefined
+ return ret == null ?
+ undefined :
+ ret;
+ }
+ },
+
+ removeAttr: function( elem, value ) {
+ var name, propName,
+ i = 0,
+ attrNames = value && value.match( core_rnotwhite );
+
+ if ( attrNames && elem.nodeType === 1 ) {
+ while ( (name = attrNames[i++]) ) {
+ propName = jQuery.propFix[ name ] || name;
+
+ // Boolean attributes get special treatment (#10870)
+ if ( rboolean.test( name ) ) {
+ // Set corresponding property to false for boolean attributes
+ // Also clear defaultChecked/defaultSelected (if appropriate) for IE<8
+ if ( !getSetAttribute && ruseDefault.test( name ) ) {
+ elem[ jQuery.camelCase( "default-" + name ) ] =
+ elem[ propName ] = false;
+ } else {
+ elem[ propName ] = false;
+ }
+
+ // See #9699 for explanation of this approach (setting first, then removal)
+ } else {
+ jQuery.attr( elem, name, "" );
+ }
+
+ elem.removeAttribute( getSetAttribute ? name : propName );
+ }
+ }
+ },
+
+ attrHooks: {
+ type: {
+ set: function( elem, value ) {
+ if ( !jQuery.support.radioValue && value === "radio" && jQuery.nodeName(elem, "input") ) {
+ // Setting the type on a radio button after the value resets the value in IE6-9
+ // Reset value to default in case type is set after value during creation
+ var val = elem.value;
+ elem.setAttribute( "type", value );
+ if ( val ) {
+ elem.value = val;
+ }
+ return value;
+ }
+ }
+ }
+ },
+
+ propFix: {
+ tabindex: "tabIndex",
+ readonly: "readOnly",
+ "for": "htmlFor",
+ "class": "className",
+ maxlength: "maxLength",
+ cellspacing: "cellSpacing",
+ cellpadding: "cellPadding",
+ rowspan: "rowSpan",
+ colspan: "colSpan",
+ usemap: "useMap",
+ frameborder: "frameBorder",
+ contenteditable: "contentEditable"
+ },
+
+ prop: function( elem, name, value ) {
+ var ret, hooks, notxml,
+ nType = elem.nodeType;
+
+ // don't get/set properties on text, comment and attribute nodes
+ if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
+ return;
+ }
+
+ notxml = nType !== 1 || !jQuery.isXMLDoc( elem );
+
+ if ( notxml ) {
+ // Fix name and attach hooks
+ name = jQuery.propFix[ name ] || name;
+ hooks = jQuery.propHooks[ name ];
+ }
+
+ if ( value !== undefined ) {
+ if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) {
+ return ret;
+
+ } else {
+ return ( elem[ name ] = value );
+ }
+
+ } else {
+ if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) {
+ return ret;
+
+ } else {
+ return elem[ name ];
+ }
+ }
+ },
+
+ propHooks: {
+ tabIndex: {
+ get: function( elem ) {
+ // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set
+ // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
+ var attributeNode = elem.getAttributeNode("tabindex");
+
+ return attributeNode && attributeNode.specified ?
+ parseInt( attributeNode.value, 10 ) :
+ rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ?
+ 0 :
+ undefined;
+ }
+ }
+ }
+});
+
+// Hook for boolean attributes
+boolHook = {
+ get: function( elem, name ) {
+ var
+ // Use .prop to determine if this attribute is understood as boolean
+ prop = jQuery.prop( elem, name ),
+
+ // Fetch it accordingly
+ attr = typeof prop === "boolean" && elem.getAttribute( name ),
+ detail = typeof prop === "boolean" ?
+
+ getSetInput && getSetAttribute ?
+ attr != null :
+ // oldIE fabricates an empty string for missing boolean attributes
+ // and conflates checked/selected into attroperties
+ ruseDefault.test( name ) ?
+ elem[ jQuery.camelCase( "default-" + name ) ] :
+ !!attr :
+
+ // fetch an attribute node for properties not recognized as boolean
+ elem.getAttributeNode( name );
+
+ return detail && detail.value !== false ?
+ name.toLowerCase() :
+ undefined;
+ },
+ set: function( elem, value, name ) {
+ if ( value === false ) {
+ // Remove boolean attributes when set to false
+ jQuery.removeAttr( elem, name );
+ } else if ( getSetInput && getSetAttribute || !ruseDefault.test( name ) ) {
+ // IE<8 needs the *property* name
+ elem.setAttribute( !getSetAttribute && jQuery.propFix[ name ] || name, name );
+
+ // Use defaultChecked and defaultSelected for oldIE
+ } else {
+ elem[ jQuery.camelCase( "default-" + name ) ] = elem[ name ] = true;
+ }
+
+ return name;
+ }
+};
+
+// fix oldIE value attroperty
+if ( !getSetInput || !getSetAttribute ) {
+ jQuery.attrHooks.value = {
+ get: function( elem, name ) {
+ var ret = elem.getAttributeNode( name );
+ return jQuery.nodeName( elem, "input" ) ?
+
+ // Ignore the value *property* by using defaultValue
+ elem.defaultValue :
+
+ ret && ret.specified ? ret.value : undefined;
+ },
+ set: function( elem, value, name ) {
+ if ( jQuery.nodeName( elem, "input" ) ) {
+ // Does not return so that setAttribute is also used
+ elem.defaultValue = value;
+ } else {
+ // Use nodeHook if defined (#1954); otherwise setAttribute is fine
+ return nodeHook && nodeHook.set( elem, value, name );
+ }
+ }
+ };
+}
+
+// IE6/7 do not support getting/setting some attributes with get/setAttribute
+if ( !getSetAttribute ) {
+
+ // Use this for any attribute in IE6/7
+ // This fixes almost every IE6/7 issue
+ nodeHook = jQuery.valHooks.button = {
+ get: function( elem, name ) {
+ var ret = elem.getAttributeNode( name );
+ return ret && ( name === "id" || name === "name" || name === "coords" ? ret.value !== "" : ret.specified ) ?
+ ret.value :
+ undefined;
+ },
+ set: function( elem, value, name ) {
+ // Set the existing or create a new attribute node
+ var ret = elem.getAttributeNode( name );
+ if ( !ret ) {
+ elem.setAttributeNode(
+ (ret = elem.ownerDocument.createAttribute( name ))
+ );
+ }
+
+ ret.value = value += "";
+
+ // Break association with cloned elements by also using setAttribute (#9646)
+ return name === "value" || value === elem.getAttribute( name ) ?
+ value :
+ undefined;
+ }
+ };
+
+ // Set contenteditable to false on removals(#10429)
+ // Setting to empty string throws an error as an invalid value
+ jQuery.attrHooks.contenteditable = {
+ get: nodeHook.get,
+ set: function( elem, value, name ) {
+ nodeHook.set( elem, value === "" ? false : value, name );
+ }
+ };
+
+ // Set width and height to auto instead of 0 on empty string( Bug #8150 )
+ // This is for removals
+ jQuery.each([ "width", "height" ], function( i, name ) {
+ jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], {
+ set: function( elem, value ) {
+ if ( value === "" ) {
+ elem.setAttribute( name, "auto" );
+ return value;
+ }
+ }
+ });
+ });
+}
+
+
+// Some attributes require a special call on IE
+// http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
+if ( !jQuery.support.hrefNormalized ) {
+ jQuery.each([ "href", "src", "width", "height" ], function( i, name ) {
+ jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], {
+ get: function( elem ) {
+ var ret = elem.getAttribute( name, 2 );
+ return ret == null ? undefined : ret;
+ }
+ });
+ });
+
+ // href/src property should get the full normalized URL (#10299/#12915)
+ jQuery.each([ "href", "src" ], function( i, name ) {
+ jQuery.propHooks[ name ] = {
+ get: function( elem ) {
+ return elem.getAttribute( name, 4 );
+ }
+ };
+ });
+}
+
+if ( !jQuery.support.style ) {
+ jQuery.attrHooks.style = {
+ get: function( elem ) {
+ // Return undefined in the case of empty string
+ // Note: IE uppercases css property names, but if we were to .toLowerCase()
+ // .cssText, that would destroy case senstitivity in URL's, like in "background"
+ return elem.style.cssText || undefined;
+ },
+ set: function( elem, value ) {
+ return ( elem.style.cssText = value + "" );
+ }
+ };
+}
+
+// Safari mis-reports the default selected property of an option
+// Accessing the parent's selectedIndex property fixes it
+if ( !jQuery.support.optSelected ) {
+ jQuery.propHooks.selected = jQuery.extend( jQuery.propHooks.selected, {
+ get: function( elem ) {
+ var parent = elem.parentNode;
+
+ if ( parent ) {
+ parent.selectedIndex;
+
+ // Make sure that it also works with optgroups, see #5701
+ if ( parent.parentNode ) {
+ parent.parentNode.selectedIndex;
+ }
+ }
+ return null;
+ }
+ });
+}
+
+// IE6/7 call enctype encoding
+if ( !jQuery.support.enctype ) {
+ jQuery.propFix.enctype = "encoding";
+}
+
+// Radios and checkboxes getter/setter
+if ( !jQuery.support.checkOn ) {
+ jQuery.each([ "radio", "checkbox" ], function() {
+ jQuery.valHooks[ this ] = {
+ get: function( elem ) {
+ // Handle the case where in Webkit "" is returned instead of "on" if a value isn't specified
+ return elem.getAttribute("value") === null ? "on" : elem.value;
+ }
+ };
+ });
+}
+jQuery.each([ "radio", "checkbox" ], function() {
+ jQuery.valHooks[ this ] = jQuery.extend( jQuery.valHooks[ this ], {
+ set: function( elem, value ) {
+ if ( jQuery.isArray( value ) ) {
+ return ( elem.checked = jQuery.inArray( jQuery(elem).val(), value ) >= 0 );
+ }
+ }
+ });
+});
+var rformElems = /^(?:input|select|textarea)$/i,
+ rkeyEvent = /^key/,
+ rmouseEvent = /^(?:mouse|contextmenu)|click/,
+ rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
+ rtypenamespace = /^([^.]*)(?:\.(.+)|)$/;
+
+function returnTrue() {
+ return true;
+}
+
+function returnFalse() {
+ return false;
+}
+
+/*
+ * Helper functions for managing events -- not part of the public interface.
+ * Props to Dean Edwards' addEvent library for many of the ideas.
+ */
+jQuery.event = {
+
+ global: {},
+
+ add: function( elem, types, handler, data, selector ) {
+ var tmp, events, t, handleObjIn,
+ special, eventHandle, handleObj,
+ handlers, type, namespaces, origType,
+ elemData = jQuery._data( elem );
+
+ // Don't attach events to noData or text/comment nodes (but allow plain objects)
+ if ( !elemData ) {
+ return;
+ }
+
+ // Caller can pass in an object of custom data in lieu of the handler
+ if ( handler.handler ) {
+ handleObjIn = handler;
+ handler = handleObjIn.handler;
+ selector = handleObjIn.selector;
+ }
+
+ // Make sure that the handler has a unique ID, used to find/remove it later
+ if ( !handler.guid ) {
+ handler.guid = jQuery.guid++;
+ }
+
+ // Init the element's event structure and main handler, if this is the first
+ if ( !(events = elemData.events) ) {
+ events = elemData.events = {};
+ }
+ if ( !(eventHandle = elemData.handle) ) {
+ eventHandle = elemData.handle = function( e ) {
+ // Discard the second event of a jQuery.event.trigger() and
+ // when an event is called after a page has unloaded
+ return typeof jQuery !== core_strundefined && (!e || jQuery.event.triggered !== e.type) ?
+ jQuery.event.dispatch.apply( eventHandle.elem, arguments ) :
+ undefined;
+ };
+ // Add elem as a property of the handle fn to prevent a memory leak with IE non-native events
+ eventHandle.elem = elem;
+ }
+
+ // Handle multiple events separated by a space
+ // jQuery(...).bind("mouseover mouseout", fn);
+ types = ( types || "" ).match( core_rnotwhite ) || [""];
+ t = types.length;
+ while ( t-- ) {
+ tmp = rtypenamespace.exec( types[t] ) || [];
+ type = origType = tmp[1];
+ namespaces = ( tmp[2] || "" ).split( "." ).sort();
+
+ // If event changes its type, use the special event handlers for the changed type
+ special = jQuery.event.special[ type ] || {};
+
+ // If selector defined, determine special event api type, otherwise given type
+ type = ( selector ? special.delegateType : special.bindType ) || type;
+
+ // Update special based on newly reset type
+ special = jQuery.event.special[ type ] || {};
+
+ // handleObj is passed to all event handlers
+ handleObj = jQuery.extend({
+ type: type,
+ origType: origType,
+ data: data,
+ handler: handler,
+ guid: handler.guid,
+ selector: selector,
+ needsContext: selector && jQuery.expr.match.needsContext.test( selector ),
+ namespace: namespaces.join(".")
+ }, handleObjIn );
+
+ // Init the event handler queue if we're the first
+ if ( !(handlers = events[ type ]) ) {
+ handlers = events[ type ] = [];
+ handlers.delegateCount = 0;
+
+ // Only use addEventListener/attachEvent if the special events handler returns false
+ if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
+ // Bind the global event handler to the element
+ if ( elem.addEventListener ) {
+ elem.addEventListener( type, eventHandle, false );
+
+ } else if ( elem.attachEvent ) {
+ elem.attachEvent( "on" + type, eventHandle );
+ }
+ }
+ }
+
+ if ( special.add ) {
+ special.add.call( elem, handleObj );
+
+ if ( !handleObj.handler.guid ) {
+ handleObj.handler.guid = handler.guid;
+ }
+ }
+
+ // Add to the element's handler list, delegates in front
+ if ( selector ) {
+ handlers.splice( handlers.delegateCount++, 0, handleObj );
+ } else {
+ handlers.push( handleObj );
+ }
+
+ // Keep track of which events have ever been used, for event optimization
+ jQuery.event.global[ type ] = true;
+ }
+
+ // Nullify elem to prevent memory leaks in IE
+ elem = null;
+ },
+
+ // Detach an event or set of events from an element
+ remove: function( elem, types, handler, selector, mappedTypes ) {
+ var j, handleObj, tmp,
+ origCount, t, events,
+ special, handlers, type,
+ namespaces, origType,
+ elemData = jQuery.hasData( elem ) && jQuery._data( elem );
+
+ if ( !elemData || !(events = elemData.events) ) {
+ return;
+ }
+
+ // Once for each type.namespace in types; type may be omitted
+ types = ( types || "" ).match( core_rnotwhite ) || [""];
+ t = types.length;
+ while ( t-- ) {
+ tmp = rtypenamespace.exec( types[t] ) || [];
+ type = origType = tmp[1];
+ namespaces = ( tmp[2] || "" ).split( "." ).sort();
+
+ // Unbind all events (on this namespace, if provided) for the element
+ if ( !type ) {
+ for ( type in events ) {
+ jQuery.event.remove( elem, type + types[ t ], handler, selector, true );
+ }
+ continue;
+ }
+
+ special = jQuery.event.special[ type ] || {};
+ type = ( selector ? special.delegateType : special.bindType ) || type;
+ handlers = events[ type ] || [];
+ tmp = tmp[2] && new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" );
+
+ // Remove matching events
+ origCount = j = handlers.length;
+ while ( j-- ) {
+ handleObj = handlers[ j ];
+
+ if ( ( mappedTypes || origType === handleObj.origType ) &&
+ ( !handler || handler.guid === handleObj.guid ) &&
+ ( !tmp || tmp.test( handleObj.namespace ) ) &&
+ ( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector ) ) {
+ handlers.splice( j, 1 );
+
+ if ( handleObj.selector ) {
+ handlers.delegateCount--;
+ }
+ if ( special.remove ) {
+ special.remove.call( elem, handleObj );
+ }
+ }
+ }
+
+ // Remove generic event handler if we removed something and no more handlers exist
+ // (avoids potential for endless recursion during removal of special event handlers)
+ if ( origCount && !handlers.length ) {
+ if ( !special.teardown || special.teardown.call( elem, namespaces, elemData.handle ) === false ) {
+ jQuery.removeEvent( elem, type, elemData.handle );
+ }
+
+ delete events[ type ];
+ }
+ }
+
+ // Remove the expando if it's no longer used
+ if ( jQuery.isEmptyObject( events ) ) {
+ delete elemData.handle;
+
+ // removeData also checks for emptiness and clears the expando if empty
+ // so use it instead of delete
+ jQuery._removeData( elem, "events" );
+ }
+ },
+
+ trigger: function( event, data, elem, onlyHandlers ) {
+ var handle, ontype, cur,
+ bubbleType, special, tmp, i,
+ eventPath = [ elem || document ],
+ type = core_hasOwn.call( event, "type" ) ? event.type : event,
+ namespaces = core_hasOwn.call( event, "namespace" ) ? event.namespace.split(".") : [];
+
+ cur = tmp = elem = elem || document;
+
+ // Don't do events on text and comment nodes
+ if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
+ return;
+ }
+
+ // focus/blur morphs to focusin/out; ensure we're not firing them right now
+ if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
+ return;
+ }
+
+ if ( type.indexOf(".") >= 0 ) {
+ // Namespaced trigger; create a regexp to match event type in handle()
+ namespaces = type.split(".");
+ type = namespaces.shift();
+ namespaces.sort();
+ }
+ ontype = type.indexOf(":") < 0 && "on" + type;
+
+ // Caller can pass in a jQuery.Event object, Object, or just an event type string
+ event = event[ jQuery.expando ] ?
+ event :
+ new jQuery.Event( type, typeof event === "object" && event );
+
+ event.isTrigger = true;
+ event.namespace = namespaces.join(".");
+ event.namespace_re = event.namespace ?
+ new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" ) :
+ null;
+
+ // Clean up the event in case it is being reused
+ event.result = undefined;
+ if ( !event.target ) {
+ event.target = elem;
+ }
+
+ // Clone any incoming data and prepend the event, creating the handler arg list
+ data = data == null ?
+ [ event ] :
+ jQuery.makeArray( data, [ event ] );
+
+ // Allow special events to draw outside the lines
+ special = jQuery.event.special[ type ] || {};
+ if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) {
+ return;
+ }
+
+ // Determine event propagation path in advance, per W3C events spec (#9951)
+ // Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
+ if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) {
+
+ bubbleType = special.delegateType || type;
+ if ( !rfocusMorph.test( bubbleType + type ) ) {
+ cur = cur.parentNode;
+ }
+ for ( ; cur; cur = cur.parentNode ) {
+ eventPath.push( cur );
+ tmp = cur;
+ }
+
+ // Only add window if we got to document (e.g., not plain obj or detached DOM)
+ if ( tmp === (elem.ownerDocument || document) ) {
+ eventPath.push( tmp.defaultView || tmp.parentWindow || window );
+ }
+ }
+
+ // Fire handlers on the event path
+ i = 0;
+ while ( (cur = eventPath[i++]) && !event.isPropagationStopped() ) {
+
+ event.type = i > 1 ?
+ bubbleType :
+ special.bindType || type;
+
+ // jQuery handler
+ handle = ( jQuery._data( cur, "events" ) || {} )[ event.type ] && jQuery._data( cur, "handle" );
+ if ( handle ) {
+ handle.apply( cur, data );
+ }
+
+ // Native handler
+ handle = ontype && cur[ ontype ];
+ if ( handle && jQuery.acceptData( cur ) && handle.apply && handle.apply( cur, data ) === false ) {
+ event.preventDefault();
+ }
+ }
+ event.type = type;
+
+ // If nobody prevented the default action, do it now
+ if ( !onlyHandlers && !event.isDefaultPrevented() ) {
+
+ if ( (!special._default || special._default.apply( elem.ownerDocument, data ) === false) &&
+ !(type === "click" && jQuery.nodeName( elem, "a" )) && jQuery.acceptData( elem ) ) {
+
+ // Call a native DOM method on the target with the same name name as the event.
+ // Can't use an .isFunction() check here because IE6/7 fails that test.
+ // Don't do default actions on window, that's where global variables be (#6170)
+ if ( ontype && elem[ type ] && !jQuery.isWindow( elem ) ) {
+
+ // Don't re-trigger an onFOO event when we call its FOO() method
+ tmp = elem[ ontype ];
+
+ if ( tmp ) {
+ elem[ ontype ] = null;
+ }
+
+ // Prevent re-triggering of the same event, since we already bubbled it above
+ jQuery.event.triggered = type;
+ try {
+ elem[ type ]();
+ } catch ( e ) {
+ // IE<9 dies on focus/blur to hidden element (#1486,#12518)
+ // only reproducible on winXP IE8 native, not IE9 in IE8 mode
+ }
+ jQuery.event.triggered = undefined;
+
+ if ( tmp ) {
+ elem[ ontype ] = tmp;
+ }
+ }
+ }
+ }
+
+ return event.result;
+ },
+
+ dispatch: function( event ) {
+
+ // Make a writable jQuery.Event from the native event object
+ event = jQuery.event.fix( event );
+
+ var i, ret, handleObj, matched, j,
+ handlerQueue = [],
+ args = core_slice.call( arguments ),
+ handlers = ( jQuery._data( this, "events" ) || {} )[ event.type ] || [],
+ special = jQuery.event.special[ event.type ] || {};
+
+ // Use the fix-ed jQuery.Event rather than the (read-only) native event
+ args[0] = event;
+ event.delegateTarget = this;
+
+ // Call the preDispatch hook for the mapped type, and let it bail if desired
+ if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {
+ return;
+ }
+
+ // Determine handlers
+ handlerQueue = jQuery.event.handlers.call( this, event, handlers );
+
+ // Run delegates first; they may want to stop propagation beneath us
+ i = 0;
+ while ( (matched = handlerQueue[ i++ ]) && !event.isPropagationStopped() ) {
+ event.currentTarget = matched.elem;
+
+ j = 0;
+ while ( (handleObj = matched.handlers[ j++ ]) && !event.isImmediatePropagationStopped() ) {
+
+ // Triggered event must either 1) have no namespace, or
+ // 2) have namespace(s) a subset or equal to those in the bound event (both can have no namespace).
+ if ( !event.namespace_re || event.namespace_re.test( handleObj.namespace ) ) {
+
+ event.handleObj = handleObj;
+ event.data = handleObj.data;
+
+ ret = ( (jQuery.event.special[ handleObj.origType ] || {}).handle || handleObj.handler )
+ .apply( matched.elem, args );
+
+ if ( ret !== undefined ) {
+ if ( (event.result = ret) === false ) {
+ event.preventDefault();
+ event.stopPropagation();
+ }
+ }
+ }
+ }
+ }
+
+ // Call the postDispatch hook for the mapped type
+ if ( special.postDispatch ) {
+ special.postDispatch.call( this, event );
+ }
+
+ return event.result;
+ },
+
+ handlers: function( event, handlers ) {
+ var sel, handleObj, matches, i,
+ handlerQueue = [],
+ delegateCount = handlers.delegateCount,
+ cur = event.target;
+
+ // Find delegate handlers
+ // Black-hole SVG <use> instance trees (#13180)
+ // Avoid non-left-click bubbling in Firefox (#3861)
+ if ( delegateCount && cur.nodeType && (!event.button || event.type !== "click") ) {
+
+ for ( ; cur != this; cur = cur.parentNode || this ) {
+
+ // Don't check non-elements (#13208)
+ // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
+ if ( cur.nodeType === 1 && (cur.disabled !== true || event.type !== "click") ) {
+ matches = [];
+ for ( i = 0; i < delegateCount; i++ ) {
+ handleObj = handlers[ i ];
+
+ // Don't conflict with Object.prototype properties (#13203)
+ sel = handleObj.selector + " ";
+
+ if ( matches[ sel ] === undefined ) {
+ matches[ sel ] = handleObj.needsContext ?
+ jQuery( sel, this ).index( cur ) >= 0 :
+ jQuery.find( sel, this, null, [ cur ] ).length;
+ }
+ if ( matches[ sel ] ) {
+ matches.push( handleObj );
+ }
+ }
+ if ( matches.length ) {
+ handlerQueue.push({ elem: cur, handlers: matches });
+ }
+ }
+ }
+ }
+
+ // Add the remaining (directly-bound) handlers
+ if ( delegateCount < handlers.length ) {
+ handlerQueue.push({ elem: this, handlers: handlers.slice( delegateCount ) });
+ }
+
+ return handlerQueue;
+ },
+
+ fix: function( event ) {
+ if ( event[ jQuery.expando ] ) {
+ return event;
+ }
+
+ // Create a writable copy of the event object and normalize some properties
+ var i, prop, copy,
+ type = event.type,
+ originalEvent = event,
+ fixHook = this.fixHooks[ type ];
+
+ if ( !fixHook ) {
+ this.fixHooks[ type ] = fixHook =
+ rmouseEvent.test( type ) ? this.mouseHooks :
+ rkeyEvent.test( type ) ? this.keyHooks :
+ {};
+ }
+ copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props;
+
+ event = new jQuery.Event( originalEvent );
+
+ i = copy.length;
+ while ( i-- ) {
+ prop = copy[ i ];
+ event[ prop ] = originalEvent[ prop ];
+ }
+
+ // Support: IE<9
+ // Fix target property (#1925)
+ if ( !event.target ) {
+ event.target = originalEvent.srcElement || document;
+ }
+
+ // Support: Chrome 23+, Safari?
+ // Target should not be a text node (#504, #13143)
+ if ( event.target.nodeType === 3 ) {
+ event.target = event.target.parentNode;
+ }
+
+ // Support: IE<9
+ // For mouse/key events, metaKey==false if it's undefined (#3368, #11328)
+ event.metaKey = !!event.metaKey;
+
+ return fixHook.filter ? fixHook.filter( event, originalEvent ) : event;
+ },
+
+ // Includes some event props shared by KeyEvent and MouseEvent
+ props: "altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),
+
+ fixHooks: {},
+
+ keyHooks: {
+ props: "char charCode key keyCode".split(" "),
+ filter: function( event, original ) {
+
+ // Add which for key events
+ if ( event.which == null ) {
+ event.which = original.charCode != null ? original.charCode : original.keyCode;
+ }
+
+ return event;
+ }
+ },
+
+ mouseHooks: {
+ props: "button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),
+ filter: function( event, original ) {
+ var body, eventDoc, doc,
+ button = original.button,
+ fromElement = original.fromElement;
+
+ // Calculate pageX/Y if missing and clientX/Y available
+ if ( event.pageX == null && original.clientX != null ) {
+ eventDoc = event.target.ownerDocument || document;
+ doc = eventDoc.documentElement;
+ body = eventDoc.body;
+
+ event.pageX = original.clientX + ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) - ( doc && doc.clientLeft || body && body.clientLeft || 0 );
+ event.pageY = original.clientY + ( doc && doc.scrollTop || body && body.scrollTop || 0 ) - ( doc && doc.clientTop || body && body.clientTop || 0 );
+ }
+
+ // Add relatedTarget, if necessary
+ if ( !event.relatedTarget && fromElement ) {
+ event.relatedTarget = fromElement === event.target ? original.toElement : fromElement;
+ }
+
+ // Add which for click: 1 === left; 2 === middle; 3 === right
+ // Note: button is not normalized, so don't use it
+ if ( !event.which && button !== undefined ) {
+ event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) );
+ }
+
+ return event;
+ }
+ },
+
+ special: {
+ load: {
+ // Prevent triggered image.load events from bubbling to window.load
+ noBubble: true
+ },
+ click: {
+ // For checkbox, fire native event so checked state will be right
+ trigger: function() {
+ if ( jQuery.nodeName( this, "input" ) && this.type === "checkbox" && this.click ) {
+ this.click();
+ return false;
+ }
+ }
+ },
+ focus: {
+ // Fire native event if possible so blur/focus sequence is correct
+ trigger: function() {
+ if ( this !== document.activeElement && this.focus ) {
+ try {
+ this.focus();
+ return false;
+ } catch ( e ) {
+ // Support: IE<9
+ // If we error on focus to hidden element (#1486, #12518),
+ // let .trigger() run the handlers
+ }
+ }
+ },
+ delegateType: "focusin"
+ },
+ blur: {
+ trigger: function() {
+ if ( this === document.activeElement && this.blur ) {
+ this.blur();
+ return false;
+ }
+ },
+ delegateType: "focusout"
+ },
+
+ beforeunload: {
+ postDispatch: function( event ) {
+
+ // Even when returnValue equals to undefined Firefox will still show alert
+ if ( event.result !== undefined ) {
+ event.originalEvent.returnValue = event.result;
+ }
+ }
+ }
+ },
+
+ simulate: function( type, elem, event, bubble ) {
+ // Piggyback on a donor event to simulate a different one.
+ // Fake originalEvent to avoid donor's stopPropagation, but if the
+ // simulated event prevents default then we do the same on the donor.
+ var e = jQuery.extend(
+ new jQuery.Event(),
+ event,
+ { type: type,
+ isSimulated: true,
+ originalEvent: {}
+ }
+ );
+ if ( bubble ) {
+ jQuery.event.trigger( e, null, elem );
+ } else {
+ jQuery.event.dispatch.call( elem, e );
+ }
+ if ( e.isDefaultPrevented() ) {
+ event.preventDefault();
+ }
+ }
+};
+
+jQuery.removeEvent = document.removeEventListener ?
+ function( elem, type, handle ) {
+ if ( elem.removeEventListener ) {
+ elem.removeEventListener( type, handle, false );
+ }
+ } :
+ function( elem, type, handle ) {
+ var name = "on" + type;
+
+ if ( elem.detachEvent ) {
+
+ // #8545, #7054, preventing memory leaks for custom events in IE6-8
+ // detachEvent needed property on element, by name of that event, to properly expose it to GC
+ if ( typeof elem[ name ] === core_strundefined ) {
+ elem[ name ] = null;
+ }
+
+ elem.detachEvent( name, handle );
+ }
+ };
+
+jQuery.Event = function( src, props ) {
+ // Allow instantiation without the 'new' keyword
+ if ( !(this instanceof jQuery.Event) ) {
+ return new jQuery.Event( src, props );
+ }
+
+ // Event object
+ if ( src && src.type ) {
+ this.originalEvent = src;
+ this.type = src.type;
+
+ // Events bubbling up the document may have been marked as prevented
+ // by a handler lower down the tree; reflect the correct value.
+ this.isDefaultPrevented = ( src.defaultPrevented || src.returnValue === false ||
+ src.getPreventDefault && src.getPreventDefault() ) ? returnTrue : returnFalse;
+
+ // Event type
+ } else {
+ this.type = src;
+ }
+
+ // Put explicitly provided properties onto the event object
+ if ( props ) {
+ jQuery.extend( this, props );
+ }
+
+ // Create a timestamp if incoming event doesn't have one
+ this.timeStamp = src && src.timeStamp || jQuery.now();
+
+ // Mark it as fixed
+ this[ jQuery.expando ] = true;
+};
+
+// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
+// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
+jQuery.Event.prototype = {
+ isDefaultPrevented: returnFalse,
+ isPropagationStopped: returnFalse,
+ isImmediatePropagationStopped: returnFalse,
+
+ preventDefault: function() {
+ var e = this.originalEvent;
+
+ this.isDefaultPrevented = returnTrue;
+ if ( !e ) {
+ return;
+ }
+
+ // If preventDefault exists, run it on the original event
+ if ( e.preventDefault ) {
+ e.preventDefault();
+
+ // Support: IE
+ // Otherwise set the returnValue property of the original event to false
+ } else {
+ e.returnValue = false;
+ }
+ },
+ stopPropagation: function() {
+ var e = this.originalEvent;
+
+ this.isPropagationStopped = returnTrue;
+ if ( !e ) {
+ return;
+ }
+ // If stopPropagation exists, run it on the original event
+ if ( e.stopPropagation ) {
+ e.stopPropagation();
+ }
+
+ // Support: IE
+ // Set the cancelBubble property of the original event to true
+ e.cancelBubble = true;
+ },
+ stopImmediatePropagation: function() {
+ this.isImmediatePropagationStopped = returnTrue;
+ this.stopPropagation();
+ }
+};
+
+// Create mouseenter/leave events using mouseover/out and event-time checks
+jQuery.each({
+ mouseenter: "mouseover",
+ mouseleave: "mouseout"
+}, function( orig, fix ) {
+ jQuery.event.special[ orig ] = {
+ delegateType: fix,
+ bindType: fix,
+
+ handle: function( event ) {
+ var ret,
+ target = this,
+ related = event.relatedTarget,
+ handleObj = event.handleObj;
+
+ // For mousenter/leave call the handler if related is outside the target.
+ // NB: No relatedTarget if the mouse left/entered the browser window
+ if ( !related || (related !== target && !jQuery.contains( target, related )) ) {
+ event.type = handleObj.origType;
+ ret = handleObj.handler.apply( this, arguments );
+ event.type = fix;
+ }
+ return ret;
+ }
+ };
+});
+
+// IE submit delegation
+if ( !jQuery.support.submitBubbles ) {
+
+ jQuery.event.special.submit = {
+ setup: function() {
+ // Only need this for delegated form submit events
+ if ( jQuery.nodeName( this, "form" ) ) {
+ return false;
+ }
+
+ // Lazy-add a submit handler when a descendant form may potentially be submitted
+ jQuery.event.add( this, "click._submit keypress._submit", function( e ) {
+ // Node name check avoids a VML-related crash in IE (#9807)
+ var elem = e.target,
+ form = jQuery.nodeName( elem, "input" ) || jQuery.nodeName( elem, "button" ) ? elem.form : undefined;
+ if ( form && !jQuery._data( form, "submitBubbles" ) ) {
+ jQuery.event.add( form, "submit._submit", function( event ) {
+ event._submit_bubble = true;
+ });
+ jQuery._data( form, "submitBubbles", true );
+ }
+ });
+ // return undefined since we don't need an event listener
+ },
+
+ postDispatch: function( event ) {
+ // If form was submitted by the user, bubble the event up the tree
+ if ( event._submit_bubble ) {
+ delete event._submit_bubble;
+ if ( this.parentNode && !event.isTrigger ) {
+ jQuery.event.simulate( "submit", this.parentNode, event, true );
+ }
+ }
+ },
+
+ teardown: function() {
+ // Only need this for delegated form submit events
+ if ( jQuery.nodeName( this, "form" ) ) {
+ return false;
+ }
+
+ // Remove delegated handlers; cleanData eventually reaps submit handlers attached above
+ jQuery.event.remove( this, "._submit" );
+ }
+ };
+}
+
+// IE change delegation and checkbox/radio fix
+if ( !jQuery.support.changeBubbles ) {
+
+ jQuery.event.special.change = {
+
+ setup: function() {
+
+ if ( rformElems.test( this.nodeName ) ) {
+ // IE doesn't fire change on a check/radio until blur; trigger it on click
+ // after a propertychange. Eat the blur-change in special.change.handle.
+ // This still fires onchange a second time for check/radio after blur.
+ if ( this.type === "checkbox" || this.type === "radio" ) {
+ jQuery.event.add( this, "propertychange._change", function( event ) {
+ if ( event.originalEvent.propertyName === "checked" ) {
+ this._just_changed = true;
+ }
+ });
+ jQuery.event.add( this, "click._change", function( event ) {
+ if ( this._just_changed && !event.isTrigger ) {
+ this._just_changed = false;
+ }
+ // Allow triggered, simulated change events (#11500)
+ jQuery.event.simulate( "change", this, event, true );
+ });
+ }
+ return false;
+ }
+ // Delegated event; lazy-add a change handler on descendant inputs
+ jQuery.event.add( this, "beforeactivate._change", function( e ) {
+ var elem = e.target;
+
+ if ( rformElems.test( elem.nodeName ) && !jQuery._data( elem, "changeBubbles" ) ) {
+ jQuery.event.add( elem, "change._change", function( event ) {
+ if ( this.parentNode && !event.isSimulated && !event.isTrigger ) {
+ jQuery.event.simulate( "change", this.parentNode, event, true );
+ }
+ });
+ jQuery._data( elem, "changeBubbles", true );
+ }
+ });
+ },
+
+ handle: function( event ) {
+ var elem = event.target;
+
+ // Swallow native change events from checkbox/radio, we already triggered them above
+ if ( this !== elem || event.isSimulated || event.isTrigger || (elem.type !== "radio" && elem.type !== "checkbox") ) {
+ return event.handleObj.handler.apply( this, arguments );
+ }
+ },
+
+ teardown: function() {
+ jQuery.event.remove( this, "._change" );
+
+ return !rformElems.test( this.nodeName );
+ }
+ };
+}
+
+// Create "bubbling" focus and blur events
+if ( !jQuery.support.focusinBubbles ) {
+ jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) {
+
+ // Attach a single capturing handler while someone wants focusin/focusout
+ var attaches = 0,
+ handler = function( event ) {
+ jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ), true );
+ };
+
+ jQuery.event.special[ fix ] = {
+ setup: function() {
+ if ( attaches++ === 0 ) {
+ document.addEventListener( orig, handler, true );
+ }
+ },
+ teardown: function() {
+ if ( --attaches === 0 ) {
+ document.removeEventListener( orig, handler, true );
+ }
+ }
+ };
+ });
+}
+
+jQuery.fn.extend({
+
+ on: function( types, selector, data, fn, /*INTERNAL*/ one ) {
+ var type, origFn;
+
+ // Types can be a map of types/handlers
+ if ( typeof types === "object" ) {
+ // ( types-Object, selector, data )
+ if ( typeof selector !== "string" ) {
+ // ( types-Object, data )
+ data = data || selector;
+ selector = undefined;
+ }
+ for ( type in types ) {
+ this.on( type, selector, data, types[ type ], one );
+ }
+ return this;
+ }
+
+ if ( data == null && fn == null ) {
+ // ( types, fn )
+ fn = selector;
+ data = selector = undefined;
+ } else if ( fn == null ) {
+ if ( typeof selector === "string" ) {
+ // ( types, selector, fn )
+ fn = data;
+ data = undefined;
+ } else {
+ // ( types, data, fn )
+ fn = data;
+ data = selector;
+ selector = undefined;
+ }
+ }
+ if ( fn === false ) {
+ fn = returnFalse;
+ } else if ( !fn ) {
+ return this;
+ }
+
+ if ( one === 1 ) {
+ origFn = fn;
+ fn = function( event ) {
+ // Can use an empty set, since event contains the info
+ jQuery().off( event );
+ return origFn.apply( this, arguments );
+ };
+ // Use same guid so caller can remove using origFn
+ fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
+ }
+ return this.each( function() {
+ jQuery.event.add( this, types, fn, data, selector );
+ });
+ },
+ one: function( types, selector, data, fn ) {
+ return this.on( types, selector, data, fn, 1 );
+ },
+ off: function( types, selector, fn ) {
+ var handleObj, type;
+ if ( types && types.preventDefault && types.handleObj ) {
+ // ( event ) dispatched jQuery.Event
+ handleObj = types.handleObj;
+ jQuery( types.delegateTarget ).off(
+ handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType,
+ handleObj.selector,
+ handleObj.handler
+ );
+ return this;
+ }
+ if ( typeof types === "object" ) {
+ // ( types-object [, selector] )
+ for ( type in types ) {
+ this.off( type, selector, types[ type ] );
+ }
+ return this;
+ }
+ if ( selector === false || typeof selector === "function" ) {
+ // ( types [, fn] )
+ fn = selector;
+ selector = undefined;
+ }
+ if ( fn === false ) {
+ fn = returnFalse;
+ }
+ return this.each(function() {
+ jQuery.event.remove( this, types, fn, selector );
+ });
+ },
+
+ bind: function( types, data, fn ) {
+ return this.on( types, null, data, fn );
+ },
+ unbind: function( types, fn ) {
+ return this.off( types, null, fn );
+ },
+
+ delegate: function( selector, types, data, fn ) {
+ return this.on( types, selector, data, fn );
+ },
+ undelegate: function( selector, types, fn ) {
+ // ( namespace ) or ( selector, types [, fn] )
+ return arguments.length === 1 ? this.off( selector, "**" ) : this.off( types, selector || "**", fn );
+ },
+
+ trigger: function( type, data ) {
+ return this.each(function() {
+ jQuery.event.trigger( type, data, this );
+ });
+ },
+ triggerHandler: function( type, data ) {
+ var elem = this[0];
+ if ( elem ) {
+ return jQuery.event.trigger( type, data, elem, true );
+ }
+ }
+});
+/*!
+ * Sizzle CSS Selector Engine
+ * Copyright 2012 jQuery Foundation and other contributors
+ * Released under the MIT license
+ * http://sizzlejs.com/
+ */
+(function( window, undefined ) {
+
+var i,
+ cachedruns,
+ Expr,
+ getText,
+ isXML,
+ compile,
+ hasDuplicate,
+ outermostContext,
+
+ // Local document vars
+ setDocument,
+ document,
+ docElem,
+ documentIsXML,
+ rbuggyQSA,
+ rbuggyMatches,
+ matches,
+ contains,
+ sortOrder,
+
+ // Instance-specific data
+ expando = "sizzle" + -(new Date()),
+ preferredDoc = window.document,
+ support = {},
+ dirruns = 0,
+ done = 0,
+ classCache = createCache(),
+ tokenCache = createCache(),
+ compilerCache = createCache(),
+
+ // General-purpose constants
+ strundefined = typeof undefined,
+ MAX_NEGATIVE = 1 << 31,
+
+ // Array methods
+ arr = [],
+ pop = arr.pop,
+ push = arr.push,
+ slice = arr.slice,
+ // Use a stripped-down indexOf if we can't use a native one
+ indexOf = arr.indexOf || function( elem ) {
+ var i = 0,
+ len = this.length;
+ for ( ; i < len; i++ ) {
+ if ( this[i] === elem ) {
+ return i;
+ }
+ }
+ return -1;
+ },
+
+
+ // Regular expressions
+
+ // Whitespace characters http://www.w3.org/TR/css3-selectors/#whitespace
+ whitespace = "[\\x20\\t\\r\\n\\f]",
+ // http://www.w3.org/TR/css3-syntax/#characters
+ characterEncoding = "(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",
+
+ // Loosely modeled on CSS identifier characters
+ // An unquoted value should be a CSS identifier http://www.w3.org/TR/css3-selectors/#attribute-selectors
+ // Proper syntax: http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
+ identifier = characterEncoding.replace( "w", "w#" ),
+
+ // Acceptable operators http://www.w3.org/TR/selectors/#attribute-selectors
+ operators = "([*^$|!~]?=)",
+ attributes = "\\[" + whitespace + "*(" + characterEncoding + ")" + whitespace +
+ "*(?:" + operators + whitespace + "*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|(" + identifier + ")|)|)" + whitespace + "*\\]",
+
+ // Prefer arguments quoted,
+ // then not containing pseudos/brackets,
+ // then attribute selectors/non-parenthetical expressions,
+ // then anything else
+ // These preferences are here to reduce the number of selectors
+ // needing tokenize in the PSEUDO preFilter
+ pseudos = ":(" + characterEncoding + ")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|" + attributes.replace( 3, 8 ) + ")*)|.*)\\)|)",
+
+ // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
+ rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ),
+
+ rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
+ rcombinators = new RegExp( "^" + whitespace + "*([\\x20\\t\\r\\n\\f>+~])" + whitespace + "*" ),
+ rpseudo = new RegExp( pseudos ),
+ ridentifier = new RegExp( "^" + identifier + "$" ),
+
+ matchExpr = {
+ "ID": new RegExp( "^#(" + characterEncoding + ")" ),
+ "CLASS": new RegExp( "^\\.(" + characterEncoding + ")" ),
+ "NAME": new RegExp( "^\\[name=['\"]?(" + characterEncoding + ")['\"]?\\]" ),
+ "TAG": new RegExp( "^(" + characterEncoding.replace( "w", "w*" ) + ")" ),
+ "ATTR": new RegExp( "^" + attributes ),
+ "PSEUDO": new RegExp( "^" + pseudos ),
+ "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace +
+ "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace +
+ "*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
+ // For use in libraries implementing .is()
+ // We use this for POS matching in `select`
+ "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" +
+ whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )
+ },
+
+ rsibling = /[\x20\t\r\n\f]*[+~]/,
+
+ rnative = /^[^{]+\{\s*\[native code/,
+
+ // Easily-parseable/retrievable ID or TAG or CLASS selectors
+ rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
+
+ rinputs = /^(?:input|select|textarea|button)$/i,
+ rheader = /^h\d$/i,
+
+ rescape = /'|\\/g,
+ rattributeQuotes = /\=[\x20\t\r\n\f]*([^'"\]]*)[\x20\t\r\n\f]*\]/g,
+
+ // CSS escapes http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
+ runescape = /\\([\da-fA-F]{1,6}[\x20\t\r\n\f]?|.)/g,
+ funescape = function( _, escaped ) {
+ var high = "0x" + escaped - 0x10000;
+ // NaN means non-codepoint
+ return high !== high ?
+ escaped :
+ // BMP codepoint
+ high < 0 ?
+ String.fromCharCode( high + 0x10000 ) :
+ // Supplemental Plane codepoint (surrogate pair)
+ String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
+ };
+
+// Use a stripped-down slice if we can't use a native one
+try {
+ slice.call( preferredDoc.documentElement.childNodes, 0 )[0].nodeType;
+} catch ( e ) {
+ slice = function( i ) {
+ var elem,
+ results = [];
+ while ( (elem = this[i++]) ) {
+ results.push( elem );
+ }
+ return results;
+ };
+}
+
+/**
+ * For feature detection
+ * @param {Function} fn The function to test for native support
+ */
+function isNative( fn ) {
+ return rnative.test( fn + "" );
+}
+
+/**
+ * Create key-value caches of limited size
+ * @returns {Function(string, Object)} Returns the Object data after storing it on itself with
+ * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
+ * deleting the oldest entry
+ */
+function createCache() {
+ var cache,
+ keys = [];
+
+ return (cache = function( key, value ) {
+ // Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
+ if ( keys.push( key += " " ) > Expr.cacheLength ) {
+ // Only keep the most recent entries
+ delete cache[ keys.shift() ];
+ }
+ return (cache[ key ] = value);
+ });
+}
+
+/**
+ * Mark a function for special use by Sizzle
+ * @param {Function} fn The function to mark
+ */
+function markFunction( fn ) {
+ fn[ expando ] = true;
+ return fn;
+}
+
+/**
+ * Support testing using an element
+ * @param {Function} fn Passed the created div and expects a boolean result
+ */
+function assert( fn ) {
+ var div = document.createElement("div");
+
+ try {
+ return fn( div );
+ } catch (e) {
+ return false;
+ } finally {
+ // release memory in IE
+ div = null;
+ }
+}
+
+function Sizzle( selector, context, results, seed ) {
+ var match, elem, m, nodeType,
+ // QSA vars
+ i, groups, old, nid, newContext, newSelector;
+
+ if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) {
+ setDocument( context );
+ }
+
+ context = context || document;
+ results = results || [];
+
+ if ( !selector || typeof selector !== "string" ) {
+ return results;
+ }
+
+ if ( (nodeType = context.nodeType) !== 1 && nodeType !== 9 ) {
+ return [];
+ }
+
+ if ( !documentIsXML && !seed ) {
+
+ // Shortcuts
+ if ( (match = rquickExpr.exec( selector )) ) {
+ // Speed-up: Sizzle("#ID")
+ if ( (m = match[1]) ) {
+ if ( nodeType === 9 ) {
+ elem = context.getElementById( m );
+ // Check parentNode to catch when Blackberry 4.6 returns
+ // nodes that are no longer in the document #6963
+ if ( elem && elem.parentNode ) {
+ // Handle the case where IE, Opera, and Webkit return items
+ // by name instead of ID
+ if ( elem.id === m ) {
+ results.push( elem );
+ return results;
+ }
+ } else {
+ return results;
+ }
+ } else {
+ // Context is not a document
+ if ( context.ownerDocument && (elem = context.ownerDocument.getElementById( m )) &&
+ contains( context, elem ) && elem.id === m ) {
+ results.push( elem );
+ return results;
+ }
+ }
+
+ // Speed-up: Sizzle("TAG")
+ } else if ( match[2] ) {
+ push.apply( results, slice.call(context.getElementsByTagName( selector ), 0) );
+ return results;
+
+ // Speed-up: Sizzle(".CLASS")
+ } else if ( (m = match[3]) && support.getByClassName && context.getElementsByClassName ) {
+ push.apply( results, slice.call(context.getElementsByClassName( m ), 0) );
+ return results;
+ }
+ }
+
+ // QSA path
+ if ( support.qsa && !rbuggyQSA.test(selector) ) {
+ old = true;
+ nid = expando;
+ newContext = context;
+ newSelector = nodeType === 9 && selector;
+
+ // qSA works strangely on Element-rooted queries
+ // We can work around this by specifying an extra ID on the root
+ // and working up from there (Thanks to Andrew Dupont for the technique)
+ // IE 8 doesn't work on object elements
+ if ( nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) {
+ groups = tokenize( selector );
+
+ if ( (old = context.getAttribute("id")) ) {
+ nid = old.replace( rescape, "\\$&" );
+ } else {
+ context.setAttribute( "id", nid );
+ }
+ nid = "[id='" + nid + "'] ";
+
+ i = groups.length;
+ while ( i-- ) {
+ groups[i] = nid + toSelector( groups[i] );
+ }
+ newContext = rsibling.test( selector ) && context.parentNode || context;
+ newSelector = groups.join(",");
+ }
+
+ if ( newSelector ) {
+ try {
+ push.apply( results, slice.call( newContext.querySelectorAll(
+ newSelector
+ ), 0 ) );
+ return results;
+ } catch(qsaError) {
+ } finally {
+ if ( !old ) {
+ context.removeAttribute("id");
+ }
+ }
+ }
+ }
+ }
+
+ // All others
+ return select( selector.replace( rtrim, "$1" ), context, results, seed );
+}
+
+/**
+ * Detect xml
+ * @param {Element|Object} elem An element or a document
+ */
+isXML = Sizzle.isXML = function( elem ) {
+ // documentElement is verified for cases where it doesn't yet exist
+ // (such as loading iframes in IE - #4833)
+ var documentElement = elem && (elem.ownerDocument || elem).documentElement;
+ return documentElement ? documentElement.nodeName !== "HTML" : false;
+};
+
+/**
+ * Sets document-related variables once based on the current document
+ * @param {Element|Object} [doc] An element or document object to use to set the document
+ * @returns {Object} Returns the current document
+ */
+setDocument = Sizzle.setDocument = function( node ) {
+ var doc = node ? node.ownerDocument || node : preferredDoc;
+
+ // If no document and documentElement is available, return
+ if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) {
+ return document;
+ }
+
+ // Set our document
+ document = doc;
+ docElem = doc.documentElement;
+
+ // Support tests
+ documentIsXML = isXML( doc );
+
+ // Check if getElementsByTagName("*") returns only elements
+ support.tagNameNoComments = assert(function( div ) {
+ div.appendChild( doc.createComment("") );
+ return !div.getElementsByTagName("*").length;
+ });
+
+ // Check if attributes should be retrieved by attribute nodes
+ support.attributes = assert(function( div ) {
+ div.innerHTML = "<select></select>";
+ var type = typeof div.lastChild.getAttribute("multiple");
+ // IE8 returns a string for some attributes even when not present
+ return type !== "boolean" && type !== "string";
+ });
+
+ // Check if getElementsByClassName can be trusted
+ support.getByClassName = assert(function( div ) {
+ // Opera can't find a second classname (in 9.6)
+ div.innerHTML = "<div class='hidden e'></div><div class='hidden'></div>";
+ if ( !div.getElementsByClassName || !div.getElementsByClassName("e").length ) {
+ return false;
+ }
+
+ // Safari 3.2 caches class attributes and doesn't catch changes
+ div.lastChild.className = "e";
+ return div.getElementsByClassName("e").length === 2;
+ });
+
+ // Check if getElementById returns elements by name
+ // Check if getElementsByName privileges form controls or returns elements by ID
+ support.getByName = assert(function( div ) {
+ // Inject content
+ div.id = expando + 0;
+ div.innerHTML = "<a name='" + expando + "'></a><div name='" + expando + "'></div>";
+ docElem.insertBefore( div, docElem.firstChild );
+
+ // Test
+ var pass = doc.getElementsByName &&
+ // buggy browsers will return fewer than the correct 2
+ doc.getElementsByName( expando ).length === 2 +
+ // buggy browsers will return more than the correct 0
+ doc.getElementsByName( expando + 0 ).length;
+ support.getIdNotName = !doc.getElementById( expando );
+
+ // Cleanup
+ docElem.removeChild( div );
+
+ return pass;
+ });
+
+ // IE6/7 return modified attributes
+ Expr.attrHandle = assert(function( div ) {
+ div.innerHTML = "<a href='#'></a>";
+ return div.firstChild && typeof div.firstChild.getAttribute !== strundefined &&
+ div.firstChild.getAttribute("href") === "#";
+ }) ?
+ {} :
+ {
+ "href": function( elem ) {
+ return elem.getAttribute( "href", 2 );
+ },
+ "type": function( elem ) {
+ return elem.getAttribute("type");
+ }
+ };
+
+ // ID find and filter
+ if ( support.getIdNotName ) {
+ Expr.find["ID"] = function( id, context ) {
+ if ( typeof context.getElementById !== strundefined && !documentIsXML ) {
+ var m = context.getElementById( id );
+ // Check parentNode to catch when Blackberry 4.6 returns
+ // nodes that are no longer in the document #6963
+ return m && m.parentNode ? [m] : [];
+ }
+ };
+ Expr.filter["ID"] = function( id ) {
+ var attrId = id.replace( runescape, funescape );
+ return function( elem ) {
+ return elem.getAttribute("id") === attrId;
+ };
+ };
+ } else {
+ Expr.find["ID"] = function( id, context ) {
+ if ( typeof context.getElementById !== strundefined && !documentIsXML ) {
+ var m = context.getElementById( id );
+
+ return m ?
+ m.id === id || typeof m.getAttributeNode !== strundefined && m.getAttributeNode("id").value === id ?
+ [m] :
+ undefined :
+ [];
+ }
+ };
+ Expr.filter["ID"] = function( id ) {
+ var attrId = id.replace( runescape, funescape );
+ return function( elem ) {
+ var node = typeof elem.getAttributeNode !== strundefined && elem.getAttributeNode("id");
+ return node && node.value === attrId;
+ };
+ };
+ }
+
+ // Tag
+ Expr.find["TAG"] = support.tagNameNoComments ?
+ function( tag, context ) {
+ if ( typeof context.getElementsByTagName !== strundefined ) {
+ return context.getElementsByTagName( tag );
+ }
+ } :
+ function( tag, context ) {
+ var elem,
+ tmp = [],
+ i = 0,
+ results = context.getElementsByTagName( tag );
+
+ // Filter out possible comments
+ if ( tag === "*" ) {
+ while ( (elem = results[i++]) ) {
+ if ( elem.nodeType === 1 ) {
+ tmp.push( elem );
+ }
+ }
+
+ return tmp;
+ }
+ return results;
+ };
+
+ // Name
+ Expr.find["NAME"] = support.getByName && function( tag, context ) {
+ if ( typeof context.getElementsByName !== strundefined ) {
+ return context.getElementsByName( name );
+ }
+ };
+
+ // Class
+ Expr.find["CLASS"] = support.getByClassName && function( className, context ) {
+ if ( typeof context.getElementsByClassName !== strundefined && !documentIsXML ) {
+ return context.getElementsByClassName( className );
+ }
+ };
+
+ // QSA and matchesSelector support
+
+ // matchesSelector(:active) reports false when true (IE9/Opera 11.5)
+ rbuggyMatches = [];
+
+ // qSa(:focus) reports false when true (Chrome 21),
+ // no need to also add to buggyMatches since matches checks buggyQSA
+ // A support test would require too much code (would include document ready)
+ rbuggyQSA = [ ":focus" ];
+
+ if ( (support.qsa = isNative(doc.querySelectorAll)) ) {
+ // Build QSA regex
+ // Regex strategy adopted from Diego Perini
+ assert(function( div ) {
+ // Select is set to empty string on purpose
+ // This is to test IE's treatment of not explictly
+ // setting a boolean content attribute,
+ // since its presence should be enough
+ // http://bugs.jquery.com/ticket/12359
+ div.innerHTML = "<select><option selected=''></option></select>";
+
+ // IE8 - Some boolean attributes are not treated correctly
+ if ( !div.querySelectorAll("[selected]").length ) {
+ rbuggyQSA.push( "\\[" + whitespace + "*(?:checked|disabled|ismap|multiple|readonly|selected|value)" );
+ }
+
+ // Webkit/Opera - :checked should return selected option elements
+ // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
+ // IE8 throws error here and will not see later tests
+ if ( !div.querySelectorAll(":checked").length ) {
+ rbuggyQSA.push(":checked");
+ }
+ });
+
+ assert(function( div ) {
+
+ // Opera 10-12/IE8 - ^= $= *= and empty values
+ // Should not select anything
+ div.innerHTML = "<input type='hidden' i=''/>";
+ if ( div.querySelectorAll("[i^='']").length ) {
+ rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:\"\"|'')" );
+ }
+
+ // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
+ // IE8 throws error here and will not see later tests
+ if ( !div.querySelectorAll(":enabled").length ) {
+ rbuggyQSA.push( ":enabled", ":disabled" );
+ }
+
+ // Opera 10-11 does not throw on post-comma invalid pseudos
+ div.querySelectorAll("*,:x");
+ rbuggyQSA.push(",.*:");
+ });
+ }
+
+ if ( (support.matchesSelector = isNative( (matches = docElem.matchesSelector ||
+ docElem.mozMatchesSelector ||
+ docElem.webkitMatchesSelector ||
+ docElem.oMatchesSelector ||
+ docElem.msMatchesSelector) )) ) {
+
+ assert(function( div ) {
+ // Check to see if it's possible to do matchesSelector
+ // on a disconnected node (IE 9)
+ support.disconnectedMatch = matches.call( div, "div" );
+
+ // This should fail with an exception
+ // Gecko does not error, returns false instead
+ matches.call( div, "[s!='']:x" );
+ rbuggyMatches.push( "!=", pseudos );
+ });
+ }
+
+ rbuggyQSA = new RegExp( rbuggyQSA.join("|") );
+ rbuggyMatches = new RegExp( rbuggyMatches.join("|") );
+
+ // Element contains another
+ // Purposefully does not implement inclusive descendent
+ // As in, an element does not contain itself
+ contains = isNative(docElem.contains) || docElem.compareDocumentPosition ?
+ function( a, b ) {
+ var adown = a.nodeType === 9 ? a.documentElement : a,
+ bup = b && b.parentNode;
+ return a === bup || !!( bup && bup.nodeType === 1 && (
+ adown.contains ?
+ adown.contains( bup ) :
+ a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
+ ));
+ } :
+ function( a, b ) {
+ if ( b ) {
+ while ( (b = b.parentNode) ) {
+ if ( b === a ) {
+ return true;
+ }
+ }
+ }
+ return false;
+ };
+
+ // Document order sorting
+ sortOrder = docElem.compareDocumentPosition ?
+ function( a, b ) {
+ var compare;
+
+ if ( a === b ) {
+ hasDuplicate = true;
+ return 0;
+ }
+
+ if ( (compare = b.compareDocumentPosition && a.compareDocumentPosition && a.compareDocumentPosition( b )) ) {
+ if ( compare & 1 || a.parentNode && a.parentNode.nodeType === 11 ) {
+ if ( a === doc || contains( preferredDoc, a ) ) {
+ return -1;
+ }
+ if ( b === doc || contains( preferredDoc, b ) ) {
+ return 1;
+ }
+ return 0;
+ }
+ return compare & 4 ? -1 : 1;
+ }
+
+ return a.compareDocumentPosition ? -1 : 1;
+ } :
+ function( a, b ) {
+ var cur,
+ i = 0,
+ aup = a.parentNode,
+ bup = b.parentNode,
+ ap = [ a ],
+ bp = [ b ];
+
+ // Exit early if the nodes are identical
+ if ( a === b ) {
+ hasDuplicate = true;
+ return 0;
+
+ // Parentless nodes are either documents or disconnected
+ } else if ( !aup || !bup ) {
+ return a === doc ? -1 :
+ b === doc ? 1 :
+ aup ? -1 :
+ bup ? 1 :
+ 0;
+
+ // If the nodes are siblings, we can do a quick check
+ } else if ( aup === bup ) {
+ return siblingCheck( a, b );
+ }
+
+ // Otherwise we need full lists of their ancestors for comparison
+ cur = a;
+ while ( (cur = cur.parentNode) ) {
+ ap.unshift( cur );
+ }
+ cur = b;
+ while ( (cur = cur.parentNode) ) {
+ bp.unshift( cur );
+ }
+
+ // Walk down the tree looking for a discrepancy
+ while ( ap[i] === bp[i] ) {
+ i++;
+ }
+
+ return i ?
+ // Do a sibling check if the nodes have a common ancestor
+ siblingCheck( ap[i], bp[i] ) :
+
+ // Otherwise nodes in our document sort first
+ ap[i] === preferredDoc ? -1 :
+ bp[i] === preferredDoc ? 1 :
+ 0;
+ };
+
+ // Always assume the presence of duplicates if sort doesn't
+ // pass them to our comparison function (as in Google Chrome).
+ hasDuplicate = false;
+ [0, 0].sort( sortOrder );
+ support.detectDuplicates = hasDuplicate;
+
+ return document;
+};
+
+Sizzle.matches = function( expr, elements ) {
+ return Sizzle( expr, null, null, elements );
+};
+
+Sizzle.matchesSelector = function( elem, expr ) {
+ // Set document vars if needed
+ if ( ( elem.ownerDocument || elem ) !== document ) {
+ setDocument( elem );
+ }
+
+ // Make sure that attribute selectors are quoted
+ expr = expr.replace( rattributeQuotes, "='$1']" );
+
+ // rbuggyQSA always contains :focus, so no need for an existence check
+ if ( support.matchesSelector && !documentIsXML && (!rbuggyMatches || !rbuggyMatches.test(expr)) && !rbuggyQSA.test(expr) ) {
+ try {
+ var ret = matches.call( elem, expr );
+
+ // IE 9's matchesSelector returns false on disconnected nodes
+ if ( ret || support.disconnectedMatch ||
+ // As well, disconnected nodes are said to be in a document
+ // fragment in IE 9
+ elem.document && elem.document.nodeType !== 11 ) {
+ return ret;
+ }
+ } catch(e) {}
+ }
+
+ return Sizzle( expr, document, null, [elem] ).length > 0;
+};
+
+Sizzle.contains = function( context, elem ) {
+ // Set document vars if needed
+ if ( ( context.ownerDocument || context ) !== document ) {
+ setDocument( context );
+ }
+ return contains( context, elem );
+};
+
+Sizzle.attr = function( elem, name ) {
+ var val;
+
+ // Set document vars if needed
+ if ( ( elem.ownerDocument || elem ) !== document ) {
+ setDocument( elem );
+ }
+
+ if ( !documentIsXML ) {
+ name = name.toLowerCase();
+ }
+ if ( (val = Expr.attrHandle[ name ]) ) {
+ return val( elem );
+ }
+ if ( documentIsXML || support.attributes ) {
+ return elem.getAttribute( name );
+ }
+ return ( (val = elem.getAttributeNode( name )) || elem.getAttribute( name ) ) && elem[ name ] === true ?
+ name :
+ val && val.specified ? val.value : null;
+};
+
+Sizzle.error = function( msg ) {
+ throw new Error( "Syntax error, unrecognized expression: " + msg );
+};
+
+// Document sorting and removing duplicates
+Sizzle.uniqueSort = function( results ) {
+ var elem,
+ duplicates = [],
+ i = 1,
+ j = 0;
+
+ // Unless we *know* we can detect duplicates, assume their presence
+ hasDuplicate = !support.detectDuplicates;
+ results.sort( sortOrder );
+
+ if ( hasDuplicate ) {
+ for ( ; (elem = results[i]); i++ ) {
+ if ( elem === results[ i - 1 ] ) {
+ j = duplicates.push( i );
+ }
+ }
+ while ( j-- ) {
+ results.splice( duplicates[ j ], 1 );
+ }
+ }
+
+ return results;
+};
+
+function siblingCheck( a, b ) {
+ var cur = b && a,
+ diff = cur && ( ~b.sourceIndex || MAX_NEGATIVE ) - ( ~a.sourceIndex || MAX_NEGATIVE );
+
+ // Use IE sourceIndex if available on both nodes
+ if ( diff ) {
+ return diff;
+ }
+
+ // Check if b follows a
+ if ( cur ) {
+ while ( (cur = cur.nextSibling) ) {
+ if ( cur === b ) {
+ return -1;
+ }
+ }
+ }
+
+ return a ? 1 : -1;
+}
+
+// Returns a function to use in pseudos for input types
+function createInputPseudo( type ) {
+ return function( elem ) {
+ var name = elem.nodeName.toLowerCase();
+ return name === "input" && elem.type === type;
+ };
+}
+
+// Returns a function to use in pseudos for buttons
+function createButtonPseudo( type ) {
+ return function( elem ) {
+ var name = elem.nodeName.toLowerCase();
+ return (name === "input" || name === "button") && elem.type === type;
+ };
+}
+
+// Returns a function to use in pseudos for positionals
+function createPositionalPseudo( fn ) {
+ return markFunction(function( argument ) {
+ argument = +argument;
+ return markFunction(function( seed, matches ) {
+ var j,
+ matchIndexes = fn( [], seed.length, argument ),
+ i = matchIndexes.length;
+
+ // Match elements found at the specified indexes
+ while ( i-- ) {
+ if ( seed[ (j = matchIndexes[i]) ] ) {
+ seed[j] = !(matches[j] = seed[j]);
+ }
+ }
+ });
+ });
+}
+
+/**
+ * Utility function for retrieving the text value of an array of DOM nodes
+ * @param {Array|Element} elem
+ */
+getText = Sizzle.getText = function( elem ) {
+ var node,
+ ret = "",
+ i = 0,
+ nodeType = elem.nodeType;
+
+ if ( !nodeType ) {
+ // If no nodeType, this is expected to be an array
+ for ( ; (node = elem[i]); i++ ) {
+ // Do not traverse comment nodes
+ ret += getText( node );
+ }
+ } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
+ // Use textContent for elements
+ // innerText usage removed for consistency of new lines (see #11153)
+ if ( typeof elem.textContent === "string" ) {
+ return elem.textContent;
+ } else {
+ // Traverse its children
+ for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
+ ret += getText( elem );
+ }
+ }
+ } else if ( nodeType === 3 || nodeType === 4 ) {
+ return elem.nodeValue;
+ }
+ // Do not include comment or processing instruction nodes
+
+ return ret;
+};
+
+Expr = Sizzle.selectors = {
+
+ // Can be adjusted by the user
+ cacheLength: 50,
+
+ createPseudo: markFunction,
+
+ match: matchExpr,
+
+ find: {},
+
+ relative: {
+ ">": { dir: "parentNode", first: true },
+ " ": { dir: "parentNode" },
+ "+": { dir: "previousSibling", first: true },
+ "~": { dir: "previousSibling" }
+ },
+
+ preFilter: {
+ "ATTR": function( match ) {
+ match[1] = match[1].replace( runescape, funescape );
+
+ // Move the given value to match[3] whether quoted or unquoted
+ match[3] = ( match[4] || match[5] || "" ).replace( runescape, funescape );
+
+ if ( match[2] === "~=" ) {
+ match[3] = " " + match[3] + " ";
+ }
+
+ return match.slice( 0, 4 );
+ },
+
+ "CHILD": function( match ) {
+ /* matches from matchExpr["CHILD"]
+ 1 type (only|nth|...)
+ 2 what (child|of-type)
+ 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
+ 4 xn-component of xn+y argument ([+-]?\d*n|)
+ 5 sign of xn-component
+ 6 x of xn-component
+ 7 sign of y-component
+ 8 y of y-component
+ */
+ match[1] = match[1].toLowerCase();
+
+ if ( match[1].slice( 0, 3 ) === "nth" ) {
+ // nth-* requires argument
+ if ( !match[3] ) {
+ Sizzle.error( match[0] );
+ }
+
+ // numeric x and y parameters for Expr.filter.CHILD
+ // remember that false/true cast respectively to 0/1
+ match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) );
+ match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" );
+
+ // other types prohibit arguments
+ } else if ( match[3] ) {
+ Sizzle.error( match[0] );
+ }
+
+ return match;
+ },
+
+ "PSEUDO": function( match ) {
+ var excess,
+ unquoted = !match[5] && match[2];
+
+ if ( matchExpr["CHILD"].test( match[0] ) ) {
+ return null;
+ }
+
+ // Accept quoted arguments as-is
+ if ( match[4] ) {
+ match[2] = match[4];
+
+ // Strip excess characters from unquoted arguments
+ } else if ( unquoted && rpseudo.test( unquoted ) &&
+ // Get excess from tokenize (recursively)
+ (excess = tokenize( unquoted, true )) &&
+ // advance to the next closing parenthesis
+ (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) {
+
+ // excess is a negative index
+ match[0] = match[0].slice( 0, excess );
+ match[2] = unquoted.slice( 0, excess );
+ }
+
+ // Return only captures needed by the pseudo filter method (type and argument)
+ return match.slice( 0, 3 );
+ }
+ },
+
+ filter: {
+
+ "TAG": function( nodeName ) {
+ if ( nodeName === "*" ) {
+ return function() { return true; };
+ }
+
+ nodeName = nodeName.replace( runescape, funescape ).toLowerCase();
+ return function( elem ) {
+ return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
+ };
+ },
+
+ "CLASS": function( className ) {
+ var pattern = classCache[ className + " " ];
+
+ return pattern ||
+ (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) &&
+ classCache( className, function( elem ) {
+ return pattern.test( elem.className || (typeof elem.getAttribute !== strundefined && elem.getAttribute("class")) || "" );
+ });
+ },
+
+ "ATTR": function( name, operator, check ) {
+ return function( elem ) {
+ var result = Sizzle.attr( elem, name );
+
+ if ( result == null ) {
+ return operator === "!=";
+ }
+ if ( !operator ) {
+ return true;
+ }
+
+ result += "";
+
+ return operator === "=" ? result === check :
+ operator === "!=" ? result !== check :
+ operator === "^=" ? check && result.indexOf( check ) === 0 :
+ operator === "*=" ? check && result.indexOf( check ) > -1 :
+ operator === "$=" ? check && result.slice( -check.length ) === check :
+ operator === "~=" ? ( " " + result + " " ).indexOf( check ) > -1 :
+ operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" :
+ false;
+ };
+ },
+
+ "CHILD": function( type, what, argument, first, last ) {
+ var simple = type.slice( 0, 3 ) !== "nth",
+ forward = type.slice( -4 ) !== "last",
+ ofType = what === "of-type";
+
+ return first === 1 && last === 0 ?
+
+ // Shortcut for :nth-*(n)
+ function( elem ) {
+ return !!elem.parentNode;
+ } :
+
+ function( elem, context, xml ) {
+ var cache, outerCache, node, diff, nodeIndex, start,
+ dir = simple !== forward ? "nextSibling" : "previousSibling",
+ parent = elem.parentNode,
+ name = ofType && elem.nodeName.toLowerCase(),
+ useCache = !xml && !ofType;
+
+ if ( parent ) {
+
+ // :(first|last|only)-(child|of-type)
+ if ( simple ) {
+ while ( dir ) {
+ node = elem;
+ while ( (node = node[ dir ]) ) {
+ if ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) {
+ return false;
+ }
+ }
+ // Reverse direction for :only-* (if we haven't yet done so)
+ start = dir = type === "only" && !start && "nextSibling";
+ }
+ return true;
+ }
+
+ start = [ forward ? parent.firstChild : parent.lastChild ];
+
+ // non-xml :nth-child(...) stores cache data on `parent`
+ if ( forward && useCache ) {
+ // Seek `elem` from a previously-cached index
+ outerCache = parent[ expando ] || (parent[ expando ] = {});
+ cache = outerCache[ type ] || [];
+ nodeIndex = cache[0] === dirruns && cache[1];
+ diff = cache[0] === dirruns && cache[2];
+ node = nodeIndex && parent.childNodes[ nodeIndex ];
+
+ while ( (node = ++nodeIndex && node && node[ dir ] ||
+
+ // Fallback to seeking `elem` from the start
+ (diff = nodeIndex = 0) || start.pop()) ) {
+
+ // When found, cache indexes on `parent` and break
+ if ( node.nodeType === 1 && ++diff && node === elem ) {
+ outerCache[ type ] = [ dirruns, nodeIndex, diff ];
+ break;
+ }
+ }
+
+ // Use previously-cached element index if available
+ } else if ( useCache && (cache = (elem[ expando ] || (elem[ expando ] = {}))[ type ]) && cache[0] === dirruns ) {
+ diff = cache[1];
+
+ // xml :nth-child(...) or :nth-last-child(...) or :nth(-last)?-of-type(...)
+ } else {
+ // Use the same loop as above to seek `elem` from the start
+ while ( (node = ++nodeIndex && node && node[ dir ] ||
+ (diff = nodeIndex = 0) || start.pop()) ) {
+
+ if ( ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) && ++diff ) {
+ // Cache the index of each encountered element
+ if ( useCache ) {
+ (node[ expando ] || (node[ expando ] = {}))[ type ] = [ dirruns, diff ];
+ }
+
+ if ( node === elem ) {
+ break;
+ }
+ }
+ }
+ }
+
+ // Incorporate the offset, then check against cycle size
+ diff -= last;
+ return diff === first || ( diff % first === 0 && diff / first >= 0 );
+ }
+ };
+ },
+
+ "PSEUDO": function( pseudo, argument ) {
+ // pseudo-class names are case-insensitive
+ // http://www.w3.org/TR/selectors/#pseudo-classes
+ // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
+ // Remember that setFilters inherits from pseudos
+ var args,
+ fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||
+ Sizzle.error( "unsupported pseudo: " + pseudo );
+
+ // The user may use createPseudo to indicate that
+ // arguments are needed to create the filter function
+ // just as Sizzle does
+ if ( fn[ expando ] ) {
+ return fn( argument );
+ }
+
+ // But maintain support for old signatures
+ if ( fn.length > 1 ) {
+ args = [ pseudo, pseudo, "", argument ];
+ return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?
+ markFunction(function( seed, matches ) {
+ var idx,
+ matched = fn( seed, argument ),
+ i = matched.length;
+ while ( i-- ) {
+ idx = indexOf.call( seed, matched[i] );
+ seed[ idx ] = !( matches[ idx ] = matched[i] );
+ }
+ }) :
+ function( elem ) {
+ return fn( elem, 0, args );
+ };
+ }
+
+ return fn;
+ }
+ },
+
+ pseudos: {
+ // Potentially complex pseudos
+ "not": markFunction(function( selector ) {
+ // Trim the selector passed to compile
+ // to avoid treating leading and trailing
+ // spaces as combinators
+ var input = [],
+ results = [],
+ matcher = compile( selector.replace( rtrim, "$1" ) );
+
+ return matcher[ expando ] ?
+ markFunction(function( seed, matches, context, xml ) {
+ var elem,
+ unmatched = matcher( seed, null, xml, [] ),
+ i = seed.length;
+
+ // Match elements unmatched by `matcher`
+ while ( i-- ) {
+ if ( (elem = unmatched[i]) ) {
+ seed[i] = !(matches[i] = elem);
+ }
+ }
+ }) :
+ function( elem, context, xml ) {
+ input[0] = elem;
+ matcher( input, null, xml, results );
+ return !results.pop();
+ };
+ }),
+
+ "has": markFunction(function( selector ) {
+ return function( elem ) {
+ return Sizzle( selector, elem ).length > 0;
+ };
+ }),
+
+ "contains": markFunction(function( text ) {
+ return function( elem ) {
+ return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1;
+ };
+ }),
+
+ // "Whether an element is represented by a :lang() selector
+ // is based solely on the element's language value
+ // being equal to the identifier C,
+ // or beginning with the identifier C immediately followed by "-".
+ // The matching of C against the element's language value is performed case-insensitively.
+ // The identifier C does not have to be a valid language name."
+ // http://www.w3.org/TR/selectors/#lang-pseudo
+ "lang": markFunction( function( lang ) {
+ // lang value must be a valid identifider
+ if ( !ridentifier.test(lang || "") ) {
+ Sizzle.error( "unsupported lang: " + lang );
+ }
+ lang = lang.replace( runescape, funescape ).toLowerCase();
+ return function( elem ) {
+ var elemLang;
+ do {
+ if ( (elemLang = documentIsXML ?
+ elem.getAttribute("xml:lang") || elem.getAttribute("lang") :
+ elem.lang) ) {
+
+ elemLang = elemLang.toLowerCase();
+ return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0;
+ }
+ } while ( (elem = elem.parentNode) && elem.nodeType === 1 );
+ return false;
+ };
+ }),
+
+ // Miscellaneous
+ "target": function( elem ) {
+ var hash = window.location && window.location.hash;
+ return hash && hash.slice( 1 ) === elem.id;
+ },
+
+ "root": function( elem ) {
+ return elem === docElem;
+ },
+
+ "focus": function( elem ) {
+ return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
+ },
+
+ // Boolean properties
+ "enabled": function( elem ) {
+ return elem.disabled === false;
+ },
+
+ "disabled": function( elem ) {
+ return elem.disabled === true;
+ },
+
+ "checked": function( elem ) {
+ // In CSS3, :checked should return both checked and selected elements
+ // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
+ var nodeName = elem.nodeName.toLowerCase();
+ return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected);
+ },
+
+ "selected": function( elem ) {
+ // Accessing this property makes selected-by-default
+ // options in Safari work properly
+ if ( elem.parentNode ) {
+ elem.parentNode.selectedIndex;
+ }
+
+ return elem.selected === true;
+ },
+
+ // Contents
+ "empty": function( elem ) {
+ // http://www.w3.org/TR/selectors/#empty-pseudo
+ // :empty is only affected by element nodes and content nodes(including text(3), cdata(4)),
+ // not comment, processing instructions, or others
+ // Thanks to Diego Perini for the nodeName shortcut
+ // Greater than "@" means alpha characters (specifically not starting with "#" or "?")
+ for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
+ if ( elem.nodeName > "@" || elem.nodeType === 3 || elem.nodeType === 4 ) {
+ return false;
+ }
+ }
+ return true;
+ },
+
+ "parent": function( elem ) {
+ return !Expr.pseudos["empty"]( elem );
+ },
+
+ // Element/input types
+ "header": function( elem ) {
+ return rheader.test( elem.nodeName );
+ },
+
+ "input": function( elem ) {
+ return rinputs.test( elem.nodeName );
+ },
+
+ "button": function( elem ) {
+ var name = elem.nodeName.toLowerCase();
+ return name === "input" && elem.type === "button" || name === "button";
+ },
+
+ "text": function( elem ) {
+ var attr;
+ // IE6 and 7 will map elem.type to 'text' for new HTML5 types (search, etc)
+ // use getAttribute instead to test this case
+ return elem.nodeName.toLowerCase() === "input" &&
+ elem.type === "text" &&
+ ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === elem.type );
+ },
+
+ // Position-in-collection
+ "first": createPositionalPseudo(function() {
+ return [ 0 ];
+ }),
+
+ "last": createPositionalPseudo(function( matchIndexes, length ) {
+ return [ length - 1 ];
+ }),
+
+ "eq": createPositionalPseudo(function( matchIndexes, length, argument ) {
+ return [ argument < 0 ? argument + length : argument ];
+ }),
+
+ "even": createPositionalPseudo(function( matchIndexes, length ) {
+ var i = 0;
+ for ( ; i < length; i += 2 ) {
+ matchIndexes.push( i );
+ }
+ return matchIndexes;
+ }),
+
+ "odd": createPositionalPseudo(function( matchIndexes, length ) {
+ var i = 1;
+ for ( ; i < length; i += 2 ) {
+ matchIndexes.push( i );
+ }
+ return matchIndexes;
+ }),
+
+ "lt": createPositionalPseudo(function( matchIndexes, length, argument ) {
+ var i = argument < 0 ? argument + length : argument;
+ for ( ; --i >= 0; ) {
+ matchIndexes.push( i );
+ }
+ return matchIndexes;
+ }),
+
+ "gt": createPositionalPseudo(function( matchIndexes, length, argument ) {
+ var i = argument < 0 ? argument + length : argument;
+ for ( ; ++i < length; ) {
+ matchIndexes.push( i );
+ }
+ return matchIndexes;
+ })
+ }
+};
+
+// Add button/input type pseudos
+for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {
+ Expr.pseudos[ i ] = createInputPseudo( i );
+}
+for ( i in { submit: true, reset: true } ) {
+ Expr.pseudos[ i ] = createButtonPseudo( i );
+}
+
+function tokenize( selector, parseOnly ) {
+ var matched, match, tokens, type,
+ soFar, groups, preFilters,
+ cached = tokenCache[ selector + " " ];
+
+ if ( cached ) {
+ return parseOnly ? 0 : cached.slice( 0 );
+ }
+
+ soFar = selector;
+ groups = [];
+ preFilters = Expr.preFilter;
+
+ while ( soFar ) {
+
+ // Comma and first run
+ if ( !matched || (match = rcomma.exec( soFar )) ) {
+ if ( match ) {
+ // Don't consume trailing commas as valid
+ soFar = soFar.slice( match[0].length ) || soFar;
+ }
+ groups.push( tokens = [] );
+ }
+
+ matched = false;
+
+ // Combinators
+ if ( (match = rcombinators.exec( soFar )) ) {
+ matched = match.shift();
+ tokens.push( {
+ value: matched,
+ // Cast descendant combinators to space
+ type: match[0].replace( rtrim, " " )
+ } );
+ soFar = soFar.slice( matched.length );
+ }
+
+ // Filters
+ for ( type in Expr.filter ) {
+ if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||
+ (match = preFilters[ type ]( match ))) ) {
+ matched = match.shift();
+ tokens.push( {
+ value: matched,
+ type: type,
+ matches: match
+ } );
+ soFar = soFar.slice( matched.length );
+ }
+ }
+
+ if ( !matched ) {
+ break;
+ }
+ }
+
+ // Return the length of the invalid excess
+ // if we're just parsing
+ // Otherwise, throw an error or return tokens
+ return parseOnly ?
+ soFar.length :
+ soFar ?
+ Sizzle.error( selector ) :
+ // Cache the tokens
+ tokenCache( selector, groups ).slice( 0 );
+}
+
+function toSelector( tokens ) {
+ var i = 0,
+ len = tokens.length,
+ selector = "";
+ for ( ; i < len; i++ ) {
+ selector += tokens[i].value;
+ }
+ return selector;
+}
+
+function addCombinator( matcher, combinator, base ) {
+ var dir = combinator.dir,
+ checkNonElements = base && dir === "parentNode",
+ doneName = done++;
+
+ return combinator.first ?
+ // Check against closest ancestor/preceding element
+ function( elem, context, xml ) {
+ while ( (elem = elem[ dir ]) ) {
+ if ( elem.nodeType === 1 || checkNonElements ) {
+ return matcher( elem, context, xml );
+ }
+ }
+ } :
+
+ // Check against all ancestor/preceding elements
+ function( elem, context, xml ) {
+ var data, cache, outerCache,
+ dirkey = dirruns + " " + doneName;
+
+ // We can't set arbitrary data on XML nodes, so they don't benefit from dir caching
+ if ( xml ) {
+ while ( (elem = elem[ dir ]) ) {
+ if ( elem.nodeType === 1 || checkNonElements ) {
+ if ( matcher( elem, context, xml ) ) {
+ return true;
+ }
+ }
+ }
+ } else {
+ while ( (elem = elem[ dir ]) ) {
+ if ( elem.nodeType === 1 || checkNonElements ) {
+ outerCache = elem[ expando ] || (elem[ expando ] = {});
+ if ( (cache = outerCache[ dir ]) && cache[0] === dirkey ) {
+ if ( (data = cache[1]) === true || data === cachedruns ) {
+ return data === true;
+ }
+ } else {
+ cache = outerCache[ dir ] = [ dirkey ];
+ cache[1] = matcher( elem, context, xml ) || cachedruns;
+ if ( cache[1] === true ) {
+ return true;
+ }
+ }
+ }
+ }
+ }
+ };
+}
+
+function elementMatcher( matchers ) {
+ return matchers.length > 1 ?
+ function( elem, context, xml ) {
+ var i = matchers.length;
+ while ( i-- ) {
+ if ( !matchers[i]( elem, context, xml ) ) {
+ return false;
+ }
+ }
+ return true;
+ } :
+ matchers[0];
+}
+
+function condense( unmatched, map, filter, context, xml ) {
+ var elem,
+ newUnmatched = [],
+ i = 0,
+ len = unmatched.length,
+ mapped = map != null;
+
+ for ( ; i < len; i++ ) {
+ if ( (elem = unmatched[i]) ) {
+ if ( !filter || filter( elem, context, xml ) ) {
+ newUnmatched.push( elem );
+ if ( mapped ) {
+ map.push( i );
+ }
+ }
+ }
+ }
+
+ return newUnmatched;
+}
+
+function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
+ if ( postFilter && !postFilter[ expando ] ) {
+ postFilter = setMatcher( postFilter );
+ }
+ if ( postFinder && !postFinder[ expando ] ) {
+ postFinder = setMatcher( postFinder, postSelector );
+ }
+ return markFunction(function( seed, results, context, xml ) {
+ var temp, i, elem,
+ preMap = [],
+ postMap = [],
+ preexisting = results.length,
+
+ // Get initial elements from seed or context
+ elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ),
+
+ // Prefilter to get matcher input, preserving a map for seed-results synchronization
+ matcherIn = preFilter && ( seed || !selector ) ?
+ condense( elems, preMap, preFilter, context, xml ) :
+ elems,
+
+ matcherOut = matcher ?
+ // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
+ postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
+
+ // ...intermediate processing is necessary
+ [] :
+
+ // ...otherwise use results directly
+ results :
+ matcherIn;
+
+ // Find primary matches
+ if ( matcher ) {
+ matcher( matcherIn, matcherOut, context, xml );
+ }
+
+ // Apply postFilter
+ if ( postFilter ) {
+ temp = condense( matcherOut, postMap );
+ postFilter( temp, [], context, xml );
+
+ // Un-match failing elements by moving them back to matcherIn
+ i = temp.length;
+ while ( i-- ) {
+ if ( (elem = temp[i]) ) {
+ matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem);
+ }
+ }
+ }
+
+ if ( seed ) {
+ if ( postFinder || preFilter ) {
+ if ( postFinder ) {
+ // Get the final matcherOut by condensing this intermediate into postFinder contexts
+ temp = [];
+ i = matcherOut.length;
+ while ( i-- ) {
+ if ( (elem = matcherOut[i]) ) {
+ // Restore matcherIn since elem is not yet a final match
+ temp.push( (matcherIn[i] = elem) );
+ }
+ }
+ postFinder( null, (matcherOut = []), temp, xml );
+ }
+
+ // Move matched elements from seed to results to keep them synchronized
+ i = matcherOut.length;
+ while ( i-- ) {
+ if ( (elem = matcherOut[i]) &&
+ (temp = postFinder ? indexOf.call( seed, elem ) : preMap[i]) > -1 ) {
+
+ seed[temp] = !(results[temp] = elem);
+ }
+ }
+ }
+
+ // Add elements to results, through postFinder if defined
+ } else {
+ matcherOut = condense(
+ matcherOut === results ?
+ matcherOut.splice( preexisting, matcherOut.length ) :
+ matcherOut
+ );
+ if ( postFinder ) {
+ postFinder( null, results, matcherOut, xml );
+ } else {
+ push.apply( results, matcherOut );
+ }
+ }
+ });
+}
+
+function matcherFromTokens( tokens ) {
+ var checkContext, matcher, j,
+ len = tokens.length,
+ leadingRelative = Expr.relative[ tokens[0].type ],
+ implicitRelative = leadingRelative || Expr.relative[" "],
+ i = leadingRelative ? 1 : 0,
+
+ // The foundational matcher ensures that elements are reachable from top-level context(s)
+ matchContext = addCombinator( function( elem ) {
+ return elem === checkContext;
+ }, implicitRelative, true ),
+ matchAnyContext = addCombinator( function( elem ) {
+ return indexOf.call( checkContext, elem ) > -1;
+ }, implicitRelative, true ),
+ matchers = [ function( elem, context, xml ) {
+ return ( !leadingRelative && ( xml || context !== outermostContext ) ) || (
+ (checkContext = context).nodeType ?
+ matchContext( elem, context, xml ) :
+ matchAnyContext( elem, context, xml ) );
+ } ];
+
+ for ( ; i < len; i++ ) {
+ if ( (matcher = Expr.relative[ tokens[i].type ]) ) {
+ matchers = [ addCombinator(elementMatcher( matchers ), matcher) ];
+ } else {
+ matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches );
+
+ // Return special upon seeing a positional matcher
+ if ( matcher[ expando ] ) {
+ // Find the next relative operator (if any) for proper handling
+ j = ++i;
+ for ( ; j < len; j++ ) {
+ if ( Expr.relative[ tokens[j].type ] ) {
+ break;
+ }
+ }
+ return setMatcher(
+ i > 1 && elementMatcher( matchers ),
+ i > 1 && toSelector( tokens.slice( 0, i - 1 ) ).replace( rtrim, "$1" ),
+ matcher,
+ i < j && matcherFromTokens( tokens.slice( i, j ) ),
+ j < len && matcherFromTokens( (tokens = tokens.slice( j )) ),
+ j < len && toSelector( tokens )
+ );
+ }
+ matchers.push( matcher );
+ }
+ }
+
+ return elementMatcher( matchers );
+}
+
+function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
+ // A counter to specify which element is currently being matched
+ var matcherCachedRuns = 0,
+ bySet = setMatchers.length > 0,
+ byElement = elementMatchers.length > 0,
+ superMatcher = function( seed, context, xml, results, expandContext ) {
+ var elem, j, matcher,
+ setMatched = [],
+ matchedCount = 0,
+ i = "0",
+ unmatched = seed && [],
+ outermost = expandContext != null,
+ contextBackup = outermostContext,
+ // We must always have either seed elements or context
+ elems = seed || byElement && Expr.find["TAG"]( "*", expandContext && context.parentNode || context ),
+ // Use integer dirruns iff this is the outermost matcher
+ dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1);
+
+ if ( outermost ) {
+ outermostContext = context !== document && context;
+ cachedruns = matcherCachedRuns;
+ }
+
+ // Add elements passing elementMatchers directly to results
+ // Keep `i` a string if there are no elements so `matchedCount` will be "00" below
+ for ( ; (elem = elems[i]) != null; i++ ) {
+ if ( byElement && elem ) {
+ j = 0;
+ while ( (matcher = elementMatchers[j++]) ) {
+ if ( matcher( elem, context, xml ) ) {
+ results.push( elem );
+ break;
+ }
+ }
+ if ( outermost ) {
+ dirruns = dirrunsUnique;
+ cachedruns = ++matcherCachedRuns;
+ }
+ }
+
+ // Track unmatched elements for set filters
+ if ( bySet ) {
+ // They will have gone through all possible matchers
+ if ( (elem = !matcher && elem) ) {
+ matchedCount--;
+ }
+
+ // Lengthen the array for every element, matched or not
+ if ( seed ) {
+ unmatched.push( elem );
+ }
+ }
+ }
+
+ // Apply set filters to unmatched elements
+ matchedCount += i;
+ if ( bySet && i !== matchedCount ) {
+ j = 0;
+ while ( (matcher = setMatchers[j++]) ) {
+ matcher( unmatched, setMatched, context, xml );
+ }
+
+ if ( seed ) {
+ // Reintegrate element matches to eliminate the need for sorting
+ if ( matchedCount > 0 ) {
+ while ( i-- ) {
+ if ( !(unmatched[i] || setMatched[i]) ) {
+ setMatched[i] = pop.call( results );
+ }
+ }
+ }
+
+ // Discard index placeholder values to get only actual matches
+ setMatched = condense( setMatched );
+ }
+
+ // Add matches to results
+ push.apply( results, setMatched );
+
+ // Seedless set matches succeeding multiple successful matchers stipulate sorting
+ if ( outermost && !seed && setMatched.length > 0 &&
+ ( matchedCount + setMatchers.length ) > 1 ) {
+
+ Sizzle.uniqueSort( results );
+ }
+ }
+
+ // Override manipulation of globals by nested matchers
+ if ( outermost ) {
+ dirruns = dirrunsUnique;
+ outermostContext = contextBackup;
+ }
+
+ return unmatched;
+ };
+
+ return bySet ?
+ markFunction( superMatcher ) :
+ superMatcher;
+}
+
+compile = Sizzle.compile = function( selector, group /* Internal Use Only */ ) {
+ var i,
+ setMatchers = [],
+ elementMatchers = [],
+ cached = compilerCache[ selector + " " ];
+
+ if ( !cached ) {
+ // Generate a function of recursive functions that can be used to check each element
+ if ( !group ) {
+ group = tokenize( selector );
+ }
+ i = group.length;
+ while ( i-- ) {
+ cached = matcherFromTokens( group[i] );
+ if ( cached[ expando ] ) {
+ setMatchers.push( cached );
+ } else {
+ elementMatchers.push( cached );
+ }
+ }
+
+ // Cache the compiled function
+ cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) );
+ }
+ return cached;
+};
+
+function multipleContexts( selector, contexts, results ) {
+ var i = 0,
+ len = contexts.length;
+ for ( ; i < len; i++ ) {
+ Sizzle( selector, contexts[i], results );
+ }
+ return results;
+}
+
+function select( selector, context, results, seed ) {
+ var i, tokens, token, type, find,
+ match = tokenize( selector );
+
+ if ( !seed ) {
+ // Try to minimize operations if there is only one group
+ if ( match.length === 1 ) {
+
+ // Take a shortcut and set the context if the root selector is an ID
+ tokens = match[0] = match[0].slice( 0 );
+ if ( tokens.length > 2 && (token = tokens[0]).type === "ID" &&
+ context.nodeType === 9 && !documentIsXML &&
+ Expr.relative[ tokens[1].type ] ) {
+
+ context = Expr.find["ID"]( token.matches[0].replace( runescape, funescape ), context )[0];
+ if ( !context ) {
+ return results;
+ }
+
+ selector = selector.slice( tokens.shift().value.length );
+ }
+
+ // Fetch a seed set for right-to-left matching
+ i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length;
+ while ( i-- ) {
+ token = tokens[i];
+
+ // Abort if we hit a combinator
+ if ( Expr.relative[ (type = token.type) ] ) {
+ break;
+ }
+ if ( (find = Expr.find[ type ]) ) {
+ // Search, expanding context for leading sibling combinators
+ if ( (seed = find(
+ token.matches[0].replace( runescape, funescape ),
+ rsibling.test( tokens[0].type ) && context.parentNode || context
+ )) ) {
+
+ // If seed is empty or no tokens remain, we can return early
+ tokens.splice( i, 1 );
+ selector = seed.length && toSelector( tokens );
+ if ( !selector ) {
+ push.apply( results, slice.call( seed, 0 ) );
+ return results;
+ }
+
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ // Compile and execute a filtering function
+ // Provide `match` to avoid retokenization if we modified the selector above
+ compile( selector, match )(
+ seed,
+ context,
+ documentIsXML,
+ results,
+ rsibling.test( selector )
+ );
+ return results;
+}
+
+// Deprecated
+Expr.pseudos["nth"] = Expr.pseudos["eq"];
+
+// Easy API for creating new setFilters
+function setFilters() {}
+Expr.filters = setFilters.prototype = Expr.pseudos;
+Expr.setFilters = new setFilters();
+
+// Initialize with the default document
+setDocument();
+
+// Override sizzle attribute retrieval
+Sizzle.attr = jQuery.attr;
+jQuery.find = Sizzle;
+jQuery.expr = Sizzle.selectors;
+jQuery.expr[":"] = jQuery.expr.pseudos;
+jQuery.unique = Sizzle.uniqueSort;
+jQuery.text = Sizzle.getText;
+jQuery.isXMLDoc = Sizzle.isXML;
+jQuery.contains = Sizzle.contains;
+
+
+})( window );
+var runtil = /Until$/,
+ rparentsprev = /^(?:parents|prev(?:Until|All))/,
+ isSimple = /^.[^:#\[\.,]*$/,
+ rneedsContext = jQuery.expr.match.needsContext,
+ // methods guaranteed to produce a unique set when starting from a unique set
+ guaranteedUnique = {
+ children: true,
+ contents: true,
+ next: true,
+ prev: true
+ };
+
+jQuery.fn.extend({
+ find: function( selector ) {
+ var i, ret, self,
+ len = this.length;
+
+ if ( typeof selector !== "string" ) {
+ self = this;
+ return this.pushStack( jQuery( selector ).filter(function() {
+ for ( i = 0; i < len; i++ ) {
+ if ( jQuery.contains( self[ i ], this ) ) {
+ return true;
+ }
+ }
+ }) );
+ }
+
+ ret = [];
+ for ( i = 0; i < len; i++ ) {
+ jQuery.find( selector, this[ i ], ret );
+ }
+
+ // Needed because $( selector, context ) becomes $( context ).find( selector )
+ ret = this.pushStack( len > 1 ? jQuery.unique( ret ) : ret );
+ ret.selector = ( this.selector ? this.selector + " " : "" ) + selector;
+ return ret;
+ },
+
+ has: function( target ) {
+ var i,
+ targets = jQuery( target, this ),
+ len = targets.length;
+
+ return this.filter(function() {
+ for ( i = 0; i < len; i++ ) {
+ if ( jQuery.contains( this, targets[i] ) ) {
+ return true;
+ }
+ }
+ });
+ },
+
+ not: function( selector ) {
+ return this.pushStack( winnow(this, selector, false) );
+ },
+
+ filter: function( selector ) {
+ return this.pushStack( winnow(this, selector, true) );
+ },
+
+ is: function( selector ) {
+ return !!selector && (
+ typeof selector === "string" ?
+ // If this is a positional/relative selector, check membership in the returned set
+ // so $("p:first").is("p:last") won't return true for a doc with two "p".
+ rneedsContext.test( selector ) ?
+ jQuery( selector, this.context ).index( this[0] ) >= 0 :
+ jQuery.filter( selector, this ).length > 0 :
+ this.filter( selector ).length > 0 );
+ },
+
+ closest: function( selectors, context ) {
+ var cur,
+ i = 0,
+ l = this.length,
+ ret = [],
+ pos = rneedsContext.test( selectors ) || typeof selectors !== "string" ?
+ jQuery( selectors, context || this.context ) :
+ 0;
+
+ for ( ; i < l; i++ ) {
+ cur = this[i];
+
+ while ( cur && cur.ownerDocument && cur !== context && cur.nodeType !== 11 ) {
+ if ( pos ? pos.index(cur) > -1 : jQuery.find.matchesSelector(cur, selectors) ) {
+ ret.push( cur );
+ break;
+ }
+ cur = cur.parentNode;
+ }
+ }
+
+ return this.pushStack( ret.length > 1 ? jQuery.unique( ret ) : ret );
+ },
+
+ // Determine the position of an element within
+ // the matched set of elements
+ index: function( elem ) {
+
+ // No argument, return index in parent
+ if ( !elem ) {
+ return ( this[0] && this[0].parentNode ) ? this.first().prevAll().length : -1;
+ }
+
+ // index in selector
+ if ( typeof elem === "string" ) {
+ return jQuery.inArray( this[0], jQuery( elem ) );
+ }
+
+ // Locate the position of the desired element
+ return jQuery.inArray(
+ // If it receives a jQuery object, the first element is used
+ elem.jquery ? elem[0] : elem, this );
+ },
+
+ add: function( selector, context ) {
+ var set = typeof selector === "string" ?
+ jQuery( selector, context ) :
+ jQuery.makeArray( selector && selector.nodeType ? [ selector ] : selector ),
+ all = jQuery.merge( this.get(), set );
+
+ return this.pushStack( jQuery.unique(all) );
+ },
+
+ addBack: function( selector ) {
+ return this.add( selector == null ?
+ this.prevObject : this.prevObject.filter(selector)
+ );
+ }
+});
+
+jQuery.fn.andSelf = jQuery.fn.addBack;
+
+function sibling( cur, dir ) {
+ do {
+ cur = cur[ dir ];
+ } while ( cur && cur.nodeType !== 1 );
+
+ return cur;
+}
+
+jQuery.each({
+ parent: function( elem ) {
+ var parent = elem.parentNode;
+ return parent && parent.nodeType !== 11 ? parent : null;
+ },
+ parents: function( elem ) {
+ return jQuery.dir( elem, "parentNode" );
+ },
+ parentsUntil: function( elem, i, until ) {
+ return jQuery.dir( elem, "parentNode", until );
+ },
+ next: function( elem ) {
+ return sibling( elem, "nextSibling" );
+ },
+ prev: function( elem ) {
+ return sibling( elem, "previousSibling" );
+ },
+ nextAll: function( elem ) {
+ return jQuery.dir( elem, "nextSibling" );
+ },
+ prevAll: function( elem ) {
+ return jQuery.dir( elem, "previousSibling" );
+ },
+ nextUntil: function( elem, i, until ) {
+ return jQuery.dir( elem, "nextSibling", until );
+ },
+ prevUntil: function( elem, i, until ) {
+ return jQuery.dir( elem, "previousSibling", until );
+ },
+ siblings: function( elem ) {
+ return jQuery.sibling( ( elem.parentNode || {} ).firstChild, elem );
+ },
+ children: function( elem ) {
+ return jQuery.sibling( elem.firstChild );
+ },
+ contents: function( elem ) {
+ return jQuery.nodeName( elem, "iframe" ) ?
+ elem.contentDocument || elem.contentWindow.document :
+ jQuery.merge( [], elem.childNodes );
+ }
+}, function( name, fn ) {
+ jQuery.fn[ name ] = function( until, selector ) {
+ var ret = jQuery.map( this, fn, until );
+
+ if ( !runtil.test( name ) ) {
+ selector = until;
+ }
+
+ if ( selector && typeof selector === "string" ) {
+ ret = jQuery.filter( selector, ret );
+ }
+
+ ret = this.length > 1 && !guaranteedUnique[ name ] ? jQuery.unique( ret ) : ret;
+
+ if ( this.length > 1 && rparentsprev.test( name ) ) {
+ ret = ret.reverse();
+ }
+
+ return this.pushStack( ret );
+ };
+});
+
+jQuery.extend({
+ filter: function( expr, elems, not ) {
+ if ( not ) {
+ expr = ":not(" + expr + ")";
+ }
+
+ return elems.length === 1 ?
+ jQuery.find.matchesSelector(elems[0], expr) ? [ elems[0] ] : [] :
+ jQuery.find.matches(expr, elems);
+ },
+
+ dir: function( elem, dir, until ) {
+ var matched = [],
+ cur = elem[ dir ];
+
+ while ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until )) ) {
+ if ( cur.nodeType === 1 ) {
+ matched.push( cur );
+ }
+ cur = cur[dir];
+ }
+ return matched;
+ },
+
+ sibling: function( n, elem ) {
+ var r = [];
+
+ for ( ; n; n = n.nextSibling ) {
+ if ( n.nodeType === 1 && n !== elem ) {
+ r.push( n );
+ }
+ }
+
+ return r;
+ }
+});
+
+// Implement the identical functionality for filter and not
+function winnow( elements, qualifier, keep ) {
+
+ // Can't pass null or undefined to indexOf in Firefox 4
+ // Set to 0 to skip string check
+ qualifier = qualifier || 0;
+
+ if ( jQuery.isFunction( qualifier ) ) {
+ return jQuery.grep(elements, function( elem, i ) {
+ var retVal = !!qualifier.call( elem, i, elem );
+ return retVal === keep;
+ });
+
+ } else if ( qualifier.nodeType ) {
+ return jQuery.grep(elements, function( elem ) {
+ return ( elem === qualifier ) === keep;
+ });
+
+ } else if ( typeof qualifier === "string" ) {
+ var filtered = jQuery.grep(elements, function( elem ) {
+ return elem.nodeType === 1;
+ });
+
+ if ( isSimple.test( qualifier ) ) {
+ return jQuery.filter(qualifier, filtered, !keep);
+ } else {
+ qualifier = jQuery.filter( qualifier, filtered );
+ }
+ }
+
+ return jQuery.grep(elements, function( elem ) {
+ return ( jQuery.inArray( elem, qualifier ) >= 0 ) === keep;
+ });
+}
+function createSafeFragment( document ) {
+ var list = nodeNames.split( "|" ),
+ safeFrag = document.createDocumentFragment();
+
+ if ( safeFrag.createElement ) {
+ while ( list.length ) {
+ safeFrag.createElement(
+ list.pop()
+ );
+ }
+ }
+ return safeFrag;
+}
+
+var nodeNames = "abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|" +
+ "header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",
+ rinlinejQuery = / jQuery\d+="(?:null|\d+)"/g,
+ rnoshimcache = new RegExp("<(?:" + nodeNames + ")[\\s/>]", "i"),
+ rleadingWhitespace = /^\s+/,
+ rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,
+ rtagName = /<([\w:]+)/,
+ rtbody = /<tbody/i,
+ rhtml = /<|&#?\w+;/,
+ rnoInnerhtml = /<(?:script|style|link)/i,
+ manipulation_rcheckableType = /^(?:checkbox|radio)$/i,
+ // checked="checked" or checked
+ rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
+ rscriptType = /^$|\/(?:java|ecma)script/i,
+ rscriptTypeMasked = /^true\/(.*)/,
+ rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,
+
+ // We have to close these tags to support XHTML (#13200)
+ wrapMap = {
+ option: [ 1, "<select multiple='multiple'>", "</select>" ],
+ legend: [ 1, "<fieldset>", "</fieldset>" ],
+ area: [ 1, "<map>", "</map>" ],
+ param: [ 1, "<object>", "</object>" ],
+ thead: [ 1, "<table>", "</table>" ],
+ tr: [ 2, "<table><tbody>", "</tbody></table>" ],
+ col: [ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ],
+ td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
+
+ // IE6-8 can't serialize link, script, style, or any html5 (NoScope) tags,
+ // unless wrapped in a div with non-breaking characters in front of it.
+ _default: jQuery.support.htmlSerialize ? [ 0, "", "" ] : [ 1, "X<div>", "</div>" ]
+ },
+ safeFragment = createSafeFragment( document ),
+ fragmentDiv = safeFragment.appendChild( document.createElement("div") );
+
+wrapMap.optgroup = wrapMap.option;
+wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
+wrapMap.th = wrapMap.td;
+
+jQuery.fn.extend({
+ text: function( value ) {
+ return jQuery.access( this, function( value ) {
+ return value === undefined ?
+ jQuery.text( this ) :
+ this.empty().append( ( this[0] && this[0].ownerDocument || document ).createTextNode( value ) );
+ }, null, value, arguments.length );
+ },
+
+ wrapAll: function( html ) {
+ if ( jQuery.isFunction( html ) ) {
+ return this.each(function(i) {
+ jQuery(this).wrapAll( html.call(this, i) );
+ });
+ }
+
+ if ( this[0] ) {
+ // The elements to wrap the target around
+ var wrap = jQuery( html, this[0].ownerDocument ).eq(0).clone(true);
+
+ if ( this[0].parentNode ) {
+ wrap.insertBefore( this[0] );
+ }
+
+ wrap.map(function() {
+ var elem = this;
+
+ while ( elem.firstChild && elem.firstChild.nodeType === 1 ) {
+ elem = elem.firstChild;
+ }
+
+ return elem;
+ }).append( this );
+ }
+
+ return this;
+ },
+
+ wrapInner: function( html ) {
+ if ( jQuery.isFunction( html ) ) {
+ return this.each(function(i) {
+ jQuery(this).wrapInner( html.call(this, i) );
+ });
+ }
+
+ return this.each(function() {
+ var self = jQuery( this ),
+ contents = self.contents();
+
+ if ( contents.length ) {
+ contents.wrapAll( html );
+
+ } else {
+ self.append( html );
+ }
+ });
+ },
+
+ wrap: function( html ) {
+ var isFunction = jQuery.isFunction( html );
+
+ return this.each(function(i) {
+ jQuery( this ).wrapAll( isFunction ? html.call(this, i) : html );
+ });
+ },
+
+ unwrap: function() {
+ return this.parent().each(function() {
+ if ( !jQuery.nodeName( this, "body" ) ) {
+ jQuery( this ).replaceWith( this.childNodes );
+ }
+ }).end();
+ },
+
+ append: function() {
+ return this.domManip(arguments, true, function( elem ) {
+ if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
+ this.appendChild( elem );
+ }
+ });
+ },
+
+ prepend: function() {
+ return this.domManip(arguments, true, function( elem ) {
+ if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
+ this.insertBefore( elem, this.firstChild );
+ }
+ });
+ },
+
+ before: function() {
+ return this.domManip( arguments, false, function( elem ) {
+ if ( this.parentNode ) {
+ this.parentNode.insertBefore( elem, this );
+ }
+ });
+ },
+
+ after: function() {
+ return this.domManip( arguments, false, function( elem ) {
+ if ( this.parentNode ) {
+ this.parentNode.insertBefore( elem, this.nextSibling );
+ }
+ });
+ },
+
+ // keepData is for internal use only--do not document
+ remove: function( selector, keepData ) {
+ var elem,
+ i = 0;
+
+ for ( ; (elem = this[i]) != null; i++ ) {
+ if ( !selector || jQuery.filter( selector, [ elem ] ).length > 0 ) {
+ if ( !keepData && elem.nodeType === 1 ) {
+ jQuery.cleanData( getAll( elem ) );
+ }
+
+ if ( elem.parentNode ) {
+ if ( keepData && jQuery.contains( elem.ownerDocument, elem ) ) {
+ setGlobalEval( getAll( elem, "script" ) );
+ }
+ elem.parentNode.removeChild( elem );
+ }
+ }
+ }
+
+ return this;
+ },
+
+ empty: function() {
+ var elem,
+ i = 0;
+
+ for ( ; (elem = this[i]) != null; i++ ) {
+ // Remove element nodes and prevent memory leaks
+ if ( elem.nodeType === 1 ) {
+ jQuery.cleanData( getAll( elem, false ) );
+ }
+
+ // Remove any remaining nodes
+ while ( elem.firstChild ) {
+ elem.removeChild( elem.firstChild );
+ }
+
+ // If this is a select, ensure that it displays empty (#12336)
+ // Support: IE<9
+ if ( elem.options && jQuery.nodeName( elem, "select" ) ) {
+ elem.options.length = 0;
+ }
+ }
+
+ return this;
+ },
+
+ clone: function( dataAndEvents, deepDataAndEvents ) {
+ dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
+ deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
+
+ return this.map( function () {
+ return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
+ });
+ },
+
+ html: function( value ) {
+ return jQuery.access( this, function( value ) {
+ var elem = this[0] || {},
+ i = 0,
+ l = this.length;
+
+ if ( value === undefined ) {
+ return elem.nodeType === 1 ?
+ elem.innerHTML.replace( rinlinejQuery, "" ) :
+ undefined;
+ }
+
+ // See if we can take a shortcut and just use innerHTML
+ if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
+ ( jQuery.support.htmlSerialize || !rnoshimcache.test( value ) ) &&
+ ( jQuery.support.leadingWhitespace || !rleadingWhitespace.test( value ) ) &&
+ !wrapMap[ ( rtagName.exec( value ) || ["", ""] )[1].toLowerCase() ] ) {
+
+ value = value.replace( rxhtmlTag, "<$1></$2>" );
+
+ try {
+ for (; i < l; i++ ) {
+ // Remove element nodes and prevent memory leaks
+ elem = this[i] || {};
+ if ( elem.nodeType === 1 ) {
+ jQuery.cleanData( getAll( elem, false ) );
+ elem.innerHTML = value;
+ }
+ }
+
+ elem = 0;
+
+ // If using innerHTML throws an exception, use the fallback method
+ } catch(e) {}
+ }
+
+ if ( elem ) {
+ this.empty().append( value );
+ }
+ }, null, value, arguments.length );
+ },
+
+ replaceWith: function( value ) {
+ var isFunc = jQuery.isFunction( value );
+
+ // Make sure that the elements are removed from the DOM before they are inserted
+ // this can help fix replacing a parent with child elements
+ if ( !isFunc && typeof value !== "string" ) {
+ value = jQuery( value ).not( this ).detach();
+ }
+
+ return this.domManip( [ value ], true, function( elem ) {
+ var next = this.nextSibling,
+ parent = this.parentNode;
+
+ if ( parent ) {
+ jQuery( this ).remove();
+ parent.insertBefore( elem, next );
+ }
+ });
+ },
+
+ detach: function( selector ) {
+ return this.remove( selector, true );
+ },
+
+ domManip: function( args, table, callback ) {
+
+ // Flatten any nested arrays
+ args = core_concat.apply( [], args );
+
+ var first, node, hasScripts,
+ scripts, doc, fragment,
+ i = 0,
+ l = this.length,
+ set = this,
+ iNoClone = l - 1,
+ value = args[0],
+ isFunction = jQuery.isFunction( value );
+
+ // We can't cloneNode fragments that contain checked, in WebKit
+ if ( isFunction || !( l <= 1 || typeof value !== "string" || jQuery.support.checkClone || !rchecked.test( value ) ) ) {
+ return this.each(function( index ) {
+ var self = set.eq( index );
+ if ( isFunction ) {
+ args[0] = value.call( this, index, table ? self.html() : undefined );
+ }
+ self.domManip( args, table, callback );
+ });
+ }
+
+ if ( l ) {
+ fragment = jQuery.buildFragment( args, this[ 0 ].ownerDocument, false, this );
+ first = fragment.firstChild;
+
+ if ( fragment.childNodes.length === 1 ) {
+ fragment = first;
+ }
+
+ if ( first ) {
+ table = table && jQuery.nodeName( first, "tr" );
+ scripts = jQuery.map( getAll( fragment, "script" ), disableScript );
+ hasScripts = scripts.length;
+
+ // Use the original fragment for the last item instead of the first because it can end up
+ // being emptied incorrectly in certain situations (#8070).
+ for ( ; i < l; i++ ) {
+ node = fragment;
+
+ if ( i !== iNoClone ) {
+ node = jQuery.clone( node, true, true );
+
+ // Keep references to cloned scripts for later restoration
+ if ( hasScripts ) {
+ jQuery.merge( scripts, getAll( node, "script" ) );
+ }
+ }
+
+ callback.call(
+ table && jQuery.nodeName( this[i], "table" ) ?
+ findOrAppend( this[i], "tbody" ) :
+ this[i],
+ node,
+ i
+ );
+ }
+
+ if ( hasScripts ) {
+ doc = scripts[ scripts.length - 1 ].ownerDocument;
+
+ // Reenable scripts
+ jQuery.map( scripts, restoreScript );
+
+ // Evaluate executable scripts on first document insertion
+ for ( i = 0; i < hasScripts; i++ ) {
+ node = scripts[ i ];
+ if ( rscriptType.test( node.type || "" ) &&
+ !jQuery._data( node, "globalEval" ) && jQuery.contains( doc, node ) ) {
+
+ if ( node.src ) {
+ // Hope ajax is available...
+ jQuery.ajax({
+ url: node.src,
+ type: "GET",
+ dataType: "script",
+ async: false,
+ global: false,
+ "throws": true
+ });
+ } else {
+ jQuery.globalEval( ( node.text || node.textContent || node.innerHTML || "" ).replace( rcleanScript, "" ) );
+ }
+ }
+ }
+ }
+
+ // Fix #11809: Avoid leaking memory
+ fragment = first = null;
+ }
+ }
+
+ return this;
+ }
+});
+
+function findOrAppend( elem, tag ) {
+ return elem.getElementsByTagName( tag )[0] || elem.appendChild( elem.ownerDocument.createElement( tag ) );
+}
+
+// Replace/restore the type attribute of script elements for safe DOM manipulation
+function disableScript( elem ) {
+ var attr = elem.getAttributeNode("type");
+ elem.type = ( attr && attr.specified ) + "/" + elem.type;
+ return elem;
+}
+function restoreScript( elem ) {
+ var match = rscriptTypeMasked.exec( elem.type );
+ if ( match ) {
+ elem.type = match[1];
+ } else {
+ elem.removeAttribute("type");
+ }
+ return elem;
+}
+
+// Mark scripts as having already been evaluated
+function setGlobalEval( elems, refElements ) {
+ var elem,
+ i = 0;
+ for ( ; (elem = elems[i]) != null; i++ ) {
+ jQuery._data( elem, "globalEval", !refElements || jQuery._data( refElements[i], "globalEval" ) );
+ }
+}
+
+function cloneCopyEvent( src, dest ) {
+
+ if ( dest.nodeType !== 1 || !jQuery.hasData( src ) ) {
+ return;
+ }
+
+ var type, i, l,
+ oldData = jQuery._data( src ),
+ curData = jQuery._data( dest, oldData ),
+ events = oldData.events;
+
+ if ( events ) {
+ delete curData.handle;
+ curData.events = {};
+
+ for ( type in events ) {
+ for ( i = 0, l = events[ type ].length; i < l; i++ ) {
+ jQuery.event.add( dest, type, events[ type ][ i ] );
+ }
+ }
+ }
+
+ // make the cloned public data object a copy from the original
+ if ( curData.data ) {
+ curData.data = jQuery.extend( {}, curData.data );
+ }
+}
+
+function fixCloneNodeIssues( src, dest ) {
+ var nodeName, e, data;
+
+ // We do not need to do anything for non-Elements
+ if ( dest.nodeType !== 1 ) {
+ return;
+ }
+
+ nodeName = dest.nodeName.toLowerCase();
+
+ // IE6-8 copies events bound via attachEvent when using cloneNode.
+ if ( !jQuery.support.noCloneEvent && dest[ jQuery.expando ] ) {
+ data = jQuery._data( dest );
+
+ for ( e in data.events ) {
+ jQuery.removeEvent( dest, e, data.handle );
+ }
+
+ // Event data gets referenced instead of copied if the expando gets copied too
+ dest.removeAttribute( jQuery.expando );
+ }
+
+ // IE blanks contents when cloning scripts, and tries to evaluate newly-set text
+ if ( nodeName === "script" && dest.text !== src.text ) {
+ disableScript( dest ).text = src.text;
+ restoreScript( dest );
+
+ // IE6-10 improperly clones children of object elements using classid.
+ // IE10 throws NoModificationAllowedError if parent is null, #12132.
+ } else if ( nodeName === "object" ) {
+ if ( dest.parentNode ) {
+ dest.outerHTML = src.outerHTML;
+ }
+
+ // This path appears unavoidable for IE9. When cloning an object
+ // element in IE9, the outerHTML strategy above is not sufficient.
+ // If the src has innerHTML and the destination does not,
+ // copy the src.innerHTML into the dest.innerHTML. #10324
+ if ( jQuery.support.html5Clone && ( src.innerHTML && !jQuery.trim(dest.innerHTML) ) ) {
+ dest.innerHTML = src.innerHTML;
+ }
+
+ } else if ( nodeName === "input" && manipulation_rcheckableType.test( src.type ) ) {
+ // IE6-8 fails to persist the checked state of a cloned checkbox
+ // or radio button. Worse, IE6-7 fail to give the cloned element
+ // a checked appearance if the defaultChecked value isn't also set
+
+ dest.defaultChecked = dest.checked = src.checked;
+
+ // IE6-7 get confused and end up setting the value of a cloned
+ // checkbox/radio button to an empty string instead of "on"
+ if ( dest.value !== src.value ) {
+ dest.value = src.value;
+ }
+
+ // IE6-8 fails to return the selected option to the default selected
+ // state when cloning options
+ } else if ( nodeName === "option" ) {
+ dest.defaultSelected = dest.selected = src.defaultSelected;
+
+ // IE6-8 fails to set the defaultValue to the correct value when
+ // cloning other types of input fields
+ } else if ( nodeName === "input" || nodeName === "textarea" ) {
+ dest.defaultValue = src.defaultValue;
+ }
+}
+
+jQuery.each({
+ appendTo: "append",
+ prependTo: "prepend",
+ insertBefore: "before",
+ insertAfter: "after",
+ replaceAll: "replaceWith"
+}, function( name, original ) {
+ jQuery.fn[ name ] = function( selector ) {
+ var elems,
+ i = 0,
+ ret = [],
+ insert = jQuery( selector ),
+ last = insert.length - 1;
+
+ for ( ; i <= last; i++ ) {
+ elems = i === last ? this : this.clone(true);
+ jQuery( insert[i] )[ original ]( elems );
+
+ // Modern browsers can apply jQuery collections as arrays, but oldIE needs a .get()
+ core_push.apply( ret, elems.get() );
+ }
+
+ return this.pushStack( ret );
+ };
+});
+
+function getAll( context, tag ) {
+ var elems, elem,
+ i = 0,
+ found = typeof context.getElementsByTagName !== core_strundefined ? context.getElementsByTagName( tag || "*" ) :
+ typeof context.querySelectorAll !== core_strundefined ? context.querySelectorAll( tag || "*" ) :
+ undefined;
+
+ if ( !found ) {
+ for ( found = [], elems = context.childNodes || context; (elem = elems[i]) != null; i++ ) {
+ if ( !tag || jQuery.nodeName( elem, tag ) ) {
+ found.push( elem );
+ } else {
+ jQuery.merge( found, getAll( elem, tag ) );
+ }
+ }
+ }
+
+ return tag === undefined || tag && jQuery.nodeName( context, tag ) ?
+ jQuery.merge( [ context ], found ) :
+ found;
+}
+
+// Used in buildFragment, fixes the defaultChecked property
+function fixDefaultChecked( elem ) {
+ if ( manipulation_rcheckableType.test( elem.type ) ) {
+ elem.defaultChecked = elem.checked;
+ }
+}
+
+jQuery.extend({
+ clone: function( elem, dataAndEvents, deepDataAndEvents ) {
+ var destElements, node, clone, i, srcElements,
+ inPage = jQuery.contains( elem.ownerDocument, elem );
+
+ if ( jQuery.support.html5Clone || jQuery.isXMLDoc(elem) || !rnoshimcache.test( "<" + elem.nodeName + ">" ) ) {
+ clone = elem.cloneNode( true );
+
+ // IE<=8 does not properly clone detached, unknown element nodes
+ } else {
+ fragmentDiv.innerHTML = elem.outerHTML;
+ fragmentDiv.removeChild( clone = fragmentDiv.firstChild );
+ }
+
+ if ( (!jQuery.support.noCloneEvent || !jQuery.support.noCloneChecked) &&
+ (elem.nodeType === 1 || elem.nodeType === 11) && !jQuery.isXMLDoc(elem) ) {
+
+ // We eschew Sizzle here for performance reasons: http://jsperf.com/getall-vs-sizzle/2
+ destElements = getAll( clone );
+ srcElements = getAll( elem );
+
+ // Fix all IE cloning issues
+ for ( i = 0; (node = srcElements[i]) != null; ++i ) {
+ // Ensure that the destination node is not null; Fixes #9587
+ if ( destElements[i] ) {
+ fixCloneNodeIssues( node, destElements[i] );
+ }
+ }
+ }
+
+ // Copy the events from the original to the clone
+ if ( dataAndEvents ) {
+ if ( deepDataAndEvents ) {
+ srcElements = srcElements || getAll( elem );
+ destElements = destElements || getAll( clone );
+
+ for ( i = 0; (node = srcElements[i]) != null; i++ ) {
+ cloneCopyEvent( node, destElements[i] );
+ }
+ } else {
+ cloneCopyEvent( elem, clone );
+ }
+ }
+
+ // Preserve script evaluation history
+ destElements = getAll( clone, "script" );
+ if ( destElements.length > 0 ) {
+ setGlobalEval( destElements, !inPage && getAll( elem, "script" ) );
+ }
+
+ destElements = srcElements = node = null;
+
+ // Return the cloned set
+ return clone;
+ },
+
+ buildFragment: function( elems, context, scripts, selection ) {
+ var j, elem, contains,
+ tmp, tag, tbody, wrap,
+ l = elems.length,
+
+ // Ensure a safe fragment
+ safe = createSafeFragment( context ),
+
+ nodes = [],
+ i = 0;
+
+ for ( ; i < l; i++ ) {
+ elem = elems[ i ];
+
+ if ( elem || elem === 0 ) {
+
+ // Add nodes directly
+ if ( jQuery.type( elem ) === "object" ) {
+ jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem );
+
+ // Convert non-html into a text node
+ } else if ( !rhtml.test( elem ) ) {
+ nodes.push( context.createTextNode( elem ) );
+
+ // Convert html into DOM nodes
+ } else {
+ tmp = tmp || safe.appendChild( context.createElement("div") );
+
+ // Deserialize a standard representation
+ tag = ( rtagName.exec( elem ) || ["", ""] )[1].toLowerCase();
+ wrap = wrapMap[ tag ] || wrapMap._default;
+
+ tmp.innerHTML = wrap[1] + elem.replace( rxhtmlTag, "<$1></$2>" ) + wrap[2];
+
+ // Descend through wrappers to the right content
+ j = wrap[0];
+ while ( j-- ) {
+ tmp = tmp.lastChild;
+ }
+
+ // Manually add leading whitespace removed by IE
+ if ( !jQuery.support.leadingWhitespace && rleadingWhitespace.test( elem ) ) {
+ nodes.push( context.createTextNode( rleadingWhitespace.exec( elem )[0] ) );
+ }
+
+ // Remove IE's autoinserted <tbody> from table fragments
+ if ( !jQuery.support.tbody ) {
+
+ // String was a <table>, *may* have spurious <tbody>
+ elem = tag === "table" && !rtbody.test( elem ) ?
+ tmp.firstChild :
+
+ // String was a bare <thead> or <tfoot>
+ wrap[1] === "<table>" && !rtbody.test( elem ) ?
+ tmp :
+ 0;
+
+ j = elem && elem.childNodes.length;
+ while ( j-- ) {
+ if ( jQuery.nodeName( (tbody = elem.childNodes[j]), "tbody" ) && !tbody.childNodes.length ) {
+ elem.removeChild( tbody );
+ }
+ }
+ }
+
+ jQuery.merge( nodes, tmp.childNodes );
+
+ // Fix #12392 for WebKit and IE > 9
+ tmp.textContent = "";
+
+ // Fix #12392 for oldIE
+ while ( tmp.firstChild ) {
+ tmp.removeChild( tmp.firstChild );
+ }
+
+ // Remember the top-level container for proper cleanup
+ tmp = safe.lastChild;
+ }
+ }
+ }
+
+ // Fix #11356: Clear elements from fragment
+ if ( tmp ) {
+ safe.removeChild( tmp );
+ }
+
+ // Reset defaultChecked for any radios and checkboxes
+ // about to be appended to the DOM in IE 6/7 (#8060)
+ if ( !jQuery.support.appendChecked ) {
+ jQuery.grep( getAll( nodes, "input" ), fixDefaultChecked );
+ }
+
+ i = 0;
+ while ( (elem = nodes[ i++ ]) ) {
+
+ // #4087 - If origin and destination elements are the same, and this is
+ // that element, do not do anything
+ if ( selection && jQuery.inArray( elem, selection ) !== -1 ) {
+ continue;
+ }
+
+ contains = jQuery.contains( elem.ownerDocument, elem );
+
+ // Append to fragment
+ tmp = getAll( safe.appendChild( elem ), "script" );
+
+ // Preserve script evaluation history
+ if ( contains ) {
+ setGlobalEval( tmp );
+ }
+
+ // Capture executables
+ if ( scripts ) {
+ j = 0;
+ while ( (elem = tmp[ j++ ]) ) {
+ if ( rscriptType.test( elem.type || "" ) ) {
+ scripts.push( elem );
+ }
+ }
+ }
+ }
+
+ tmp = null;
+
+ return safe;
+ },
+
+ cleanData: function( elems, /* internal */ acceptData ) {
+ var elem, type, id, data,
+ i = 0,
+ internalKey = jQuery.expando,
+ cache = jQuery.cache,
+ deleteExpando = jQuery.support.deleteExpando,
+ special = jQuery.event.special;
+
+ for ( ; (elem = elems[i]) != null; i++ ) {
+
+ if ( acceptData || jQuery.acceptData( elem ) ) {
+
+ id = elem[ internalKey ];
+ data = id && cache[ id ];
+
+ if ( data ) {
+ if ( data.events ) {
+ for ( type in data.events ) {
+ if ( special[ type ] ) {
+ jQuery.event.remove( elem, type );
+
+ // This is a shortcut to avoid jQuery.event.remove's overhead
+ } else {
+ jQuery.removeEvent( elem, type, data.handle );
+ }
+ }
+ }
+
+ // Remove cache only if it was not already removed by jQuery.event.remove
+ if ( cache[ id ] ) {
+
+ delete cache[ id ];
+
+ // IE does not allow us to delete expando properties from nodes,
+ // nor does it have a removeAttribute function on Document nodes;
+ // we must handle all of these cases
+ if ( deleteExpando ) {
+ delete elem[ internalKey ];
+
+ } else if ( typeof elem.removeAttribute !== core_strundefined ) {
+ elem.removeAttribute( internalKey );
+
+ } else {
+ elem[ internalKey ] = null;
+ }
+
+ core_deletedIds.push( id );
+ }
+ }
+ }
+ }
+ }
+});
+var iframe, getStyles, curCSS,
+ ralpha = /alpha\([^)]*\)/i,
+ ropacity = /opacity\s*=\s*([^)]*)/,
+ rposition = /^(top|right|bottom|left)$/,
+ // swappable if display is none or starts with table except "table", "table-cell", or "table-caption"
+ // see here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
+ rdisplayswap = /^(none|table(?!-c[ea]).+)/,
+ rmargin = /^margin/,
+ rnumsplit = new RegExp( "^(" + core_pnum + ")(.*)$", "i" ),
+ rnumnonpx = new RegExp( "^(" + core_pnum + ")(?!px)[a-z%]+$", "i" ),
+ rrelNum = new RegExp( "^([+-])=(" + core_pnum + ")", "i" ),
+ elemdisplay = { BODY: "block" },
+
+ cssShow = { position: "absolute", visibility: "hidden", display: "block" },
+ cssNormalTransform = {
+ letterSpacing: 0,
+ fontWeight: 400
+ },
+
+ cssExpand = [ "Top", "Right", "Bottom", "Left" ],
+ cssPrefixes = [ "Webkit", "O", "Moz", "ms" ];
+
+// return a css property mapped to a potentially vendor prefixed property
+function vendorPropName( style, name ) {
+
+ // shortcut for names that are not vendor prefixed
+ if ( name in style ) {
+ return name;
+ }
+
+ // check for vendor prefixed names
+ var capName = name.charAt(0).toUpperCase() + name.slice(1),
+ origName = name,
+ i = cssPrefixes.length;
+
+ while ( i-- ) {
+ name = cssPrefixes[ i ] + capName;
+ if ( name in style ) {
+ return name;
+ }
+ }
+
+ return origName;
+}
+
+function isHidden( elem, el ) {
+ // isHidden might be called from jQuery#filter function;
+ // in that case, element will be second argument
+ elem = el || elem;
+ return jQuery.css( elem, "display" ) === "none" || !jQuery.contains( elem.ownerDocument, elem );
+}
+
+function showHide( elements, show ) {
+ var display, elem, hidden,
+ values = [],
+ index = 0,
+ length = elements.length;
+
+ for ( ; index < length; index++ ) {
+ elem = elements[ index ];
+ if ( !elem.style ) {
+ continue;
+ }
+
+ values[ index ] = jQuery._data( elem, "olddisplay" );
+ display = elem.style.display;
+ if ( show ) {
+ // Reset the inline display of this element to learn if it is
+ // being hidden by cascaded rules or not
+ if ( !values[ index ] && display === "none" ) {
+ elem.style.display = "";
+ }
+
+ // Set elements which have been overridden with display: none
+ // in a stylesheet to whatever the default browser style is
+ // for such an element
+ if ( elem.style.display === "" && isHidden( elem ) ) {
+ values[ index ] = jQuery._data( elem, "olddisplay", css_defaultDisplay(elem.nodeName) );
+ }
+ } else {
+
+ if ( !values[ index ] ) {
+ hidden = isHidden( elem );
+
+ if ( display && display !== "none" || !hidden ) {
+ jQuery._data( elem, "olddisplay", hidden ? display : jQuery.css( elem, "display" ) );
+ }
+ }
+ }
+ }
+
+ // Set the display of most of the elements in a second loop
+ // to avoid the constant reflow
+ for ( index = 0; index < length; index++ ) {
+ elem = elements[ index ];
+ if ( !elem.style ) {
+ continue;
+ }
+ if ( !show || elem.style.display === "none" || elem.style.display === "" ) {
+ elem.style.display = show ? values[ index ] || "" : "none";
+ }
+ }
+
+ return elements;
+}
+
+jQuery.fn.extend({
+ css: function( name, value ) {
+ return jQuery.access( this, function( elem, name, value ) {
+ var len, styles,
+ map = {},
+ i = 0;
+
+ if ( jQuery.isArray( name ) ) {
+ styles = getStyles( elem );
+ len = name.length;
+
+ for ( ; i < len; i++ ) {
+ map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles );
+ }
+
+ return map;
+ }
+
+ return value !== undefined ?
+ jQuery.style( elem, name, value ) :
+ jQuery.css( elem, name );
+ }, name, value, arguments.length > 1 );
+ },
+ show: function() {
+ return showHide( this, true );
+ },
+ hide: function() {
+ return showHide( this );
+ },
+ toggle: function( state ) {
+ var bool = typeof state === "boolean";
+
+ return this.each(function() {
+ if ( bool ? state : isHidden( this ) ) {
+ jQuery( this ).show();
+ } else {
+ jQuery( this ).hide();
+ }
+ });
+ }
+});
+
+jQuery.extend({
+ // Add in style property hooks for overriding the default
+ // behavior of getting and setting a style property
+ cssHooks: {
+ opacity: {
+ get: function( elem, computed ) {
+ if ( computed ) {
+ // We should always get a number back from opacity
+ var ret = curCSS( elem, "opacity" );
+ return ret === "" ? "1" : ret;
+ }
+ }
+ }
+ },
+
+ // Exclude the following css properties to add px
+ cssNumber: {
+ "columnCount": true,
+ "fillOpacity": true,
+ "fontWeight": true,
+ "lineHeight": true,
+ "opacity": true,
+ "orphans": true,
+ "widows": true,
+ "zIndex": true,
+ "zoom": true
+ },
+
+ // Add in properties whose names you wish to fix before
+ // setting or getting the value
+ cssProps: {
+ // normalize float css property
+ "float": jQuery.support.cssFloat ? "cssFloat" : "styleFloat"
+ },
+
+ // Get and set the style property on a DOM Node
+ style: function( elem, name, value, extra ) {
+ // Don't set styles on text and comment nodes
+ if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
+ return;
+ }
+
+ // Make sure that we're working with the right name
+ var ret, type, hooks,
+ origName = jQuery.camelCase( name ),
+ style = elem.style;
+
+ name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( style, origName ) );
+
+ // gets hook for the prefixed version
+ // followed by the unprefixed version
+ hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
+
+ // Check if we're setting a value
+ if ( value !== undefined ) {
+ type = typeof value;
+
+ // convert relative number strings (+= or -=) to relative numbers. #7345
+ if ( type === "string" && (ret = rrelNum.exec( value )) ) {
+ value = ( ret[1] + 1 ) * ret[2] + parseFloat( jQuery.css( elem, name ) );
+ // Fixes bug #9237
+ type = "number";
+ }
+
+ // Make sure that NaN and null values aren't set. See: #7116
+ if ( value == null || type === "number" && isNaN( value ) ) {
+ return;
+ }
+
+ // If a number was passed in, add 'px' to the (except for certain CSS properties)
+ if ( type === "number" && !jQuery.cssNumber[ origName ] ) {
+ value += "px";
+ }
+
+ // Fixes #8908, it can be done more correctly by specifing setters in cssHooks,
+ // but it would mean to define eight (for every problematic property) identical functions
+ if ( !jQuery.support.clearCloneStyle && value === "" && name.indexOf("background") === 0 ) {
+ style[ name ] = "inherit";
+ }
+
+ // If a hook was provided, use that value, otherwise just set the specified value
+ if ( !hooks || !("set" in hooks) || (value = hooks.set( elem, value, extra )) !== undefined ) {
+
+ // Wrapped to prevent IE from throwing errors when 'invalid' values are provided
+ // Fixes bug #5509
+ try {
+ style[ name ] = value;
+ } catch(e) {}
+ }
+
+ } else {
+ // If a hook was provided get the non-computed value from there
+ if ( hooks && "get" in hooks && (ret = hooks.get( elem, false, extra )) !== undefined ) {
+ return ret;
+ }
+
+ // Otherwise just get the value from the style object
+ return style[ name ];
+ }
+ },
+
+ css: function( elem, name, extra, styles ) {
+ var num, val, hooks,
+ origName = jQuery.camelCase( name );
+
+ // Make sure that we're working with the right name
+ name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( elem.style, origName ) );
+
+ // gets hook for the prefixed version
+ // followed by the unprefixed version
+ hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
+
+ // If a hook was provided get the computed value from there
+ if ( hooks && "get" in hooks ) {
+ val = hooks.get( elem, true, extra );
+ }
+
+ // Otherwise, if a way to get the computed value exists, use that
+ if ( val === undefined ) {
+ val = curCSS( elem, name, styles );
+ }
+
+ //convert "normal" to computed value
+ if ( val === "normal" && name in cssNormalTransform ) {
+ val = cssNormalTransform[ name ];
+ }
+
+ // Return, converting to number if forced or a qualifier was provided and val looks numeric
+ if ( extra === "" || extra ) {
+ num = parseFloat( val );
+ return extra === true || jQuery.isNumeric( num ) ? num || 0 : val;
+ }
+ return val;
+ },
+
+ // A method for quickly swapping in/out CSS properties to get correct calculations
+ swap: function( elem, options, callback, args ) {
+ var ret, name,
+ old = {};
+
+ // Remember the old values, and insert the new ones
+ for ( name in options ) {
+ old[ name ] = elem.style[ name ];
+ elem.style[ name ] = options[ name ];
+ }
+
+ ret = callback.apply( elem, args || [] );
+
+ // Revert the old values
+ for ( name in options ) {
+ elem.style[ name ] = old[ name ];
+ }
+
+ return ret;
+ }
+});
+
+// NOTE: we've included the "window" in window.getComputedStyle
+// because jsdom on node.js will break without it.
+if ( window.getComputedStyle ) {
+ getStyles = function( elem ) {
+ return window.getComputedStyle( elem, null );
+ };
+
+ curCSS = function( elem, name, _computed ) {
+ var width, minWidth, maxWidth,
+ computed = _computed || getStyles( elem ),
+
+ // getPropertyValue is only needed for .css('filter') in IE9, see #12537
+ ret = computed ? computed.getPropertyValue( name ) || computed[ name ] : undefined,
+ style = elem.style;
+
+ if ( computed ) {
+
+ if ( ret === "" && !jQuery.contains( elem.ownerDocument, elem ) ) {
+ ret = jQuery.style( elem, name );
+ }
+
+ // A tribute to the "awesome hack by Dean Edwards"
+ // Chrome < 17 and Safari 5.0 uses "computed value" instead of "used value" for margin-right
+ // Safari 5.1.7 (at least) returns percentage for a larger set of values, but width seems to be reliably pixels
+ // this is against the CSSOM draft spec: http://dev.w3.org/csswg/cssom/#resolved-values
+ if ( rnumnonpx.test( ret ) && rmargin.test( name ) ) {
+
+ // Remember the original values
+ width = style.width;
+ minWidth = style.minWidth;
+ maxWidth = style.maxWidth;
+
+ // Put in the new values to get a computed value out
+ style.minWidth = style.maxWidth = style.width = ret;
+ ret = computed.width;
+
+ // Revert the changed values
+ style.width = width;
+ style.minWidth = minWidth;
+ style.maxWidth = maxWidth;
+ }
+ }
+
+ return ret;
+ };
+} else if ( document.documentElement.currentStyle ) {
+ getStyles = function( elem ) {
+ return elem.currentStyle;
+ };
+
+ curCSS = function( elem, name, _computed ) {
+ var left, rs, rsLeft,
+ computed = _computed || getStyles( elem ),
+ ret = computed ? computed[ name ] : undefined,
+ style = elem.style;
+
+ // Avoid setting ret to empty string here
+ // so we don't default to auto
+ if ( ret == null && style && style[ name ] ) {
+ ret = style[ name ];
+ }
+
+ // From the awesome hack by Dean Edwards
+ // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291
+
+ // If we're not dealing with a regular pixel number
+ // but a number that has a weird ending, we need to convert it to pixels
+ // but not position css attributes, as those are proportional to the parent element instead
+ // and we can't measure the parent instead because it might trigger a "stacking dolls" problem
+ if ( rnumnonpx.test( ret ) && !rposition.test( name ) ) {
+
+ // Remember the original values
+ left = style.left;
+ rs = elem.runtimeStyle;
+ rsLeft = rs && rs.left;
+
+ // Put in the new values to get a computed value out
+ if ( rsLeft ) {
+ rs.left = elem.currentStyle.left;
+ }
+ style.left = name === "fontSize" ? "1em" : ret;
+ ret = style.pixelLeft + "px";
+
+ // Revert the changed values
+ style.left = left;
+ if ( rsLeft ) {
+ rs.left = rsLeft;
+ }
+ }
+
+ return ret === "" ? "auto" : ret;
+ };
+}
+
+function setPositiveNumber( elem, value, subtract ) {
+ var matches = rnumsplit.exec( value );
+ return matches ?
+ // Guard against undefined "subtract", e.g., when used as in cssHooks
+ Math.max( 0, matches[ 1 ] - ( subtract || 0 ) ) + ( matches[ 2 ] || "px" ) :
+ value;
+}
+
+function augmentWidthOrHeight( elem, name, extra, isBorderBox, styles ) {
+ var i = extra === ( isBorderBox ? "border" : "content" ) ?
+ // If we already have the right measurement, avoid augmentation
+ 4 :
+ // Otherwise initialize for horizontal or vertical properties
+ name === "width" ? 1 : 0,
+
+ val = 0;
+
+ for ( ; i < 4; i += 2 ) {
+ // both box models exclude margin, so add it if we want it
+ if ( extra === "margin" ) {
+ val += jQuery.css( elem, extra + cssExpand[ i ], true, styles );
+ }
+
+ if ( isBorderBox ) {
+ // border-box includes padding, so remove it if we want content
+ if ( extra === "content" ) {
+ val -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
+ }
+
+ // at this point, extra isn't border nor margin, so remove border
+ if ( extra !== "margin" ) {
+ val -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
+ }
+ } else {
+ // at this point, extra isn't content, so add padding
+ val += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
+
+ // at this point, extra isn't content nor padding, so add border
+ if ( extra !== "padding" ) {
+ val += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
+ }
+ }
+ }
+
+ return val;
+}
+
+function getWidthOrHeight( elem, name, extra ) {
+
+ // Start with offset property, which is equivalent to the border-box value
+ var valueIsBorderBox = true,
+ val = name === "width" ? elem.offsetWidth : elem.offsetHeight,
+ styles = getStyles( elem ),
+ isBorderBox = jQuery.support.boxSizing && jQuery.css( elem, "boxSizing", false, styles ) === "border-box";
+
+ // some non-html elements return undefined for offsetWidth, so check for null/undefined
+ // svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285
+ // MathML - https://bugzilla.mozilla.org/show_bug.cgi?id=491668
+ if ( val <= 0 || val == null ) {
+ // Fall back to computed then uncomputed css if necessary
+ val = curCSS( elem, name, styles );
+ if ( val < 0 || val == null ) {
+ val = elem.style[ name ];
+ }
+
+ // Computed unit is not pixels. Stop here and return.
+ if ( rnumnonpx.test(val) ) {
+ return val;
+ }
+
+ // we need the check for style in case a browser which returns unreliable values
+ // for getComputedStyle silently falls back to the reliable elem.style
+ valueIsBorderBox = isBorderBox && ( jQuery.support.boxSizingReliable || val === elem.style[ name ] );
+
+ // Normalize "", auto, and prepare for extra
+ val = parseFloat( val ) || 0;
+ }
+
+ // use the active box-sizing model to add/subtract irrelevant styles
+ return ( val +
+ augmentWidthOrHeight(
+ elem,
+ name,
+ extra || ( isBorderBox ? "border" : "content" ),
+ valueIsBorderBox,
+ styles
+ )
+ ) + "px";
+}
+
+// Try to determine the default display value of an element
+function css_defaultDisplay( nodeName ) {
+ var doc = document,
+ display = elemdisplay[ nodeName ];
+
+ if ( !display ) {
+ display = actualDisplay( nodeName, doc );
+
+ // If the simple way fails, read from inside an iframe
+ if ( display === "none" || !display ) {
+ // Use the already-created iframe if possible
+ iframe = ( iframe ||
+ jQuery("<iframe frameborder='0' width='0' height='0'/>")
+ .css( "cssText", "display:block !important" )
+ ).appendTo( doc.documentElement );
+
+ // Always write a new HTML skeleton so Webkit and Firefox don't choke on reuse
+ doc = ( iframe[0].contentWindow || iframe[0].contentDocument ).document;
+ doc.write("<!doctype html><html><body>");
+ doc.close();
+
+ display = actualDisplay( nodeName, doc );
+ iframe.detach();
+ }
+
+ // Store the correct default display
+ elemdisplay[ nodeName ] = display;
+ }
+
+ return display;
+}
+
+// Called ONLY from within css_defaultDisplay
+function actualDisplay( name, doc ) {
+ var elem = jQuery( doc.createElement( name ) ).appendTo( doc.body ),
+ display = jQuery.css( elem[0], "display" );
+ elem.remove();
+ return display;
+}
+
+jQuery.each([ "height", "width" ], function( i, name ) {
+ jQuery.cssHooks[ name ] = {
+ get: function( elem, computed, extra ) {
+ if ( computed ) {
+ // certain elements can have dimension info if we invisibly show them
+ // however, it must have a current display style that would benefit from this
+ return elem.offsetWidth === 0 && rdisplayswap.test( jQuery.css( elem, "display" ) ) ?
+ jQuery.swap( elem, cssShow, function() {
+ return getWidthOrHeight( elem, name, extra );
+ }) :
+ getWidthOrHeight( elem, name, extra );
+ }
+ },
+
+ set: function( elem, value, extra ) {
+ var styles = extra && getStyles( elem );
+ return setPositiveNumber( elem, value, extra ?
+ augmentWidthOrHeight(
+ elem,
+ name,
+ extra,
+ jQuery.support.boxSizing && jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
+ styles
+ ) : 0
+ );
+ }
+ };
+});
+
+if ( !jQuery.support.opacity ) {
+ jQuery.cssHooks.opacity = {
+ get: function( elem, computed ) {
+ // IE uses filters for opacity
+ return ropacity.test( (computed && elem.currentStyle ? elem.currentStyle.filter : elem.style.filter) || "" ) ?
+ ( 0.01 * parseFloat( RegExp.$1 ) ) + "" :
+ computed ? "1" : "";
+ },
+
+ set: function( elem, value ) {
+ var style = elem.style,
+ currentStyle = elem.currentStyle,
+ opacity = jQuery.isNumeric( value ) ? "alpha(opacity=" + value * 100 + ")" : "",
+ filter = currentStyle && currentStyle.filter || style.filter || "";
+
+ // IE has trouble with opacity if it does not have layout
+ // Force it by setting the zoom level
+ style.zoom = 1;
+
+ // if setting opacity to 1, and no other filters exist - attempt to remove filter attribute #6652
+ // if value === "", then remove inline opacity #12685
+ if ( ( value >= 1 || value === "" ) &&
+ jQuery.trim( filter.replace( ralpha, "" ) ) === "" &&
+ style.removeAttribute ) {
+
+ // Setting style.filter to null, "" & " " still leave "filter:" in the cssText
+ // if "filter:" is present at all, clearType is disabled, we want to avoid this
+ // style.removeAttribute is IE Only, but so apparently is this code path...
+ style.removeAttribute( "filter" );
+
+ // if there is no filter style applied in a css rule or unset inline opacity, we are done
+ if ( value === "" || currentStyle && !currentStyle.filter ) {
+ return;
+ }
+ }
+
+ // otherwise, set new filter values
+ style.filter = ralpha.test( filter ) ?
+ filter.replace( ralpha, opacity ) :
+ filter + " " + opacity;
+ }
+ };
+}
+
+// These hooks cannot be added until DOM ready because the support test
+// for it is not run until after DOM ready
+jQuery(function() {
+ if ( !jQuery.support.reliableMarginRight ) {
+ jQuery.cssHooks.marginRight = {
+ get: function( elem, computed ) {
+ if ( computed ) {
+ // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
+ // Work around by temporarily setting element display to inline-block
+ return jQuery.swap( elem, { "display": "inline-block" },
+ curCSS, [ elem, "marginRight" ] );
+ }
+ }
+ };
+ }
+
+ // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
+ // getComputedStyle returns percent when specified for top/left/bottom/right
+ // rather than make the css module depend on the offset module, we just check for it here
+ if ( !jQuery.support.pixelPosition && jQuery.fn.position ) {
+ jQuery.each( [ "top", "left" ], function( i, prop ) {
+ jQuery.cssHooks[ prop ] = {
+ get: function( elem, computed ) {
+ if ( computed ) {
+ computed = curCSS( elem, prop );
+ // if curCSS returns percentage, fallback to offset
+ return rnumnonpx.test( computed ) ?
+ jQuery( elem ).position()[ prop ] + "px" :
+ computed;
+ }
+ }
+ };
+ });
+ }
+
+});
+
+if ( jQuery.expr && jQuery.expr.filters ) {
+ jQuery.expr.filters.hidden = function( elem ) {
+ // Support: Opera <= 12.12
+ // Opera reports offsetWidths and offsetHeights less than zero on some elements
+ return elem.offsetWidth <= 0 && elem.offsetHeight <= 0 ||
+ (!jQuery.support.reliableHiddenOffsets && ((elem.style && elem.style.display) || jQuery.css( elem, "display" )) === "none");
+ };
+
+ jQuery.expr.filters.visible = function( elem ) {
+ return !jQuery.expr.filters.hidden( elem );
+ };
+}
+
+// These hooks are used by animate to expand properties
+jQuery.each({
+ margin: "",
+ padding: "",
+ border: "Width"
+}, function( prefix, suffix ) {
+ jQuery.cssHooks[ prefix + suffix ] = {
+ expand: function( value ) {
+ var i = 0,
+ expanded = {},
+
+ // assumes a single number if not a string
+ parts = typeof value === "string" ? value.split(" ") : [ value ];
+
+ for ( ; i < 4; i++ ) {
+ expanded[ prefix + cssExpand[ i ] + suffix ] =
+ parts[ i ] || parts[ i - 2 ] || parts[ 0 ];
+ }
+
+ return expanded;
+ }
+ };
+
+ if ( !rmargin.test( prefix ) ) {
+ jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;
+ }
+});
+var r20 = /%20/g,
+ rbracket = /\[\]$/,
+ rCRLF = /\r?\n/g,
+ rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
+ rsubmittable = /^(?:input|select|textarea|keygen)/i;
+
+jQuery.fn.extend({
+ serialize: function() {
+ return jQuery.param( this.serializeArray() );
+ },
+ serializeArray: function() {
+ return this.map(function(){
+ // Can add propHook for "elements" to filter or add form elements
+ var elements = jQuery.prop( this, "elements" );
+ return elements ? jQuery.makeArray( elements ) : this;
+ })
+ .filter(function(){
+ var type = this.type;
+ // Use .is(":disabled") so that fieldset[disabled] works
+ return this.name && !jQuery( this ).is( ":disabled" ) &&
+ rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) &&
+ ( this.checked || !manipulation_rcheckableType.test( type ) );
+ })
+ .map(function( i, elem ){
+ var val = jQuery( this ).val();
+
+ return val == null ?
+ null :
+ jQuery.isArray( val ) ?
+ jQuery.map( val, function( val ){
+ return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
+ }) :
+ { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
+ }).get();
+ }
+});
+
+//Serialize an array of form elements or a set of
+//key/values into a query string
+jQuery.param = function( a, traditional ) {
+ var prefix,
+ s = [],
+ add = function( key, value ) {
+ // If value is a function, invoke it and return its value
+ value = jQuery.isFunction( value ) ? value() : ( value == null ? "" : value );
+ s[ s.length ] = encodeURIComponent( key ) + "=" + encodeURIComponent( value );
+ };
+
+ // Set traditional to true for jQuery <= 1.3.2 behavior.
+ if ( traditional === undefined ) {
+ traditional = jQuery.ajaxSettings && jQuery.ajaxSettings.traditional;
+ }
+
+ // If an array was passed in, assume that it is an array of form elements.
+ if ( jQuery.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
+ // Serialize the form elements
+ jQuery.each( a, function() {
+ add( this.name, this.value );
+ });
+
+ } else {
+ // If traditional, encode the "old" way (the way 1.3.2 or older
+ // did it), otherwise encode params recursively.
+ for ( prefix in a ) {
+ buildParams( prefix, a[ prefix ], traditional, add );
+ }
+ }
+
+ // Return the resulting serialization
+ return s.join( "&" ).replace( r20, "+" );
+};
+
+function buildParams( prefix, obj, traditional, add ) {
+ var name;
+
+ if ( jQuery.isArray( obj ) ) {
+ // Serialize array item.
+ jQuery.each( obj, function( i, v ) {
+ if ( traditional || rbracket.test( prefix ) ) {
+ // Treat each array item as a scalar.
+ add( prefix, v );
+
+ } else {
+ // Item is non-scalar (array or object), encode its numeric index.
+ buildParams( prefix + "[" + ( typeof v === "object" ? i : "" ) + "]", v, traditional, add );
+ }
+ });
+
+ } else if ( !traditional && jQuery.type( obj ) === "object" ) {
+ // Serialize object item.
+ for ( name in obj ) {
+ buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
+ }
+
+ } else {
+ // Serialize scalar item.
+ add( prefix, obj );
+ }
+}
+jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " +
+ "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
+ "change select submit keydown keypress keyup error contextmenu").split(" "), function( i, name ) {
+
+ // Handle event binding
+ jQuery.fn[ name ] = function( data, fn ) {
+ return arguments.length > 0 ?
+ this.on( name, null, data, fn ) :
+ this.trigger( name );
+ };
+});
+
+jQuery.fn.hover = function( fnOver, fnOut ) {
+ return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
+};
+var
+ // Document location
+ ajaxLocParts,
+ ajaxLocation,
+ ajax_nonce = jQuery.now(),
+
+ ajax_rquery = /\?/,
+ rhash = /#.*$/,
+ rts = /([?&])_=[^&]*/,
+ rheaders = /^(.*?):[ \t]*([^\r\n]*)\r?$/mg, // IE leaves an \r character at EOL
+ // #7653, #8125, #8152: local protocol detection
+ rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
+ rnoContent = /^(?:GET|HEAD)$/,
+ rprotocol = /^\/\//,
+ rurl = /^([\w.+-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/,
+
+ // Keep a copy of the old load method
+ _load = jQuery.fn.load,
+
+ /* Prefilters
+ * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
+ * 2) These are called:
+ * - BEFORE asking for a transport
+ * - AFTER param serialization (s.data is a string if s.processData is true)
+ * 3) key is the dataType
+ * 4) the catchall symbol "*" can be used
+ * 5) execution will start with transport dataType and THEN continue down to "*" if needed
+ */
+ prefilters = {},
+
+ /* Transports bindings
+ * 1) key is the dataType
+ * 2) the catchall symbol "*" can be used
+ * 3) selection will start with transport dataType and THEN go to "*" if needed
+ */
+ transports = {},
+
+ // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
+ allTypes = "*/".concat("*");
+
+// #8138, IE may throw an exception when accessing
+// a field from window.location if document.domain has been set
+try {
+ ajaxLocation = location.href;
+} catch( e ) {
+ // Use the href attribute of an A element
+ // since IE will modify it given document.location
+ ajaxLocation = document.createElement( "a" );
+ ajaxLocation.href = "";
+ ajaxLocation = ajaxLocation.href;
+}
+
+// Segment location into parts
+ajaxLocParts = rurl.exec( ajaxLocation.toLowerCase() ) || [];
+
+// Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
+function addToPrefiltersOrTransports( structure ) {
+
+ // dataTypeExpression is optional and defaults to "*"
+ return function( dataTypeExpression, func ) {
+
+ if ( typeof dataTypeExpression !== "string" ) {
+ func = dataTypeExpression;
+ dataTypeExpression = "*";
+ }
+
+ var dataType,
+ i = 0,
+ dataTypes = dataTypeExpression.toLowerCase().match( core_rnotwhite ) || [];
+
+ if ( jQuery.isFunction( func ) ) {
+ // For each dataType in the dataTypeExpression
+ while ( (dataType = dataTypes[i++]) ) {
+ // Prepend if requested
+ if ( dataType[0] === "+" ) {
+ dataType = dataType.slice( 1 ) || "*";
+ (structure[ dataType ] = structure[ dataType ] || []).unshift( func );
+
+ // Otherwise append
+ } else {
+ (structure[ dataType ] = structure[ dataType ] || []).push( func );
+ }
+ }
+ }
+ };
+}
+
+// Base inspection function for prefilters and transports
+function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) {
+
+ var inspected = {},
+ seekingTransport = ( structure === transports );
+
+ function inspect( dataType ) {
+ var selected;
+ inspected[ dataType ] = true;
+ jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) {
+ var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR );
+ if( typeof dataTypeOrTransport === "string" && !seekingTransport && !inspected[ dataTypeOrTransport ] ) {
+ options.dataTypes.unshift( dataTypeOrTransport );
+ inspect( dataTypeOrTransport );
+ return false;
+ } else if ( seekingTransport ) {
+ return !( selected = dataTypeOrTransport );
+ }
+ });
+ return selected;
+ }
+
+ return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" );
+}
+
+// A special extend for ajax options
+// that takes "flat" options (not to be deep extended)
+// Fixes #9887
+function ajaxExtend( target, src ) {
+ var deep, key,
+ flatOptions = jQuery.ajaxSettings.flatOptions || {};
+
+ for ( key in src ) {
+ if ( src[ key ] !== undefined ) {
+ ( flatOptions[ key ] ? target : ( deep || (deep = {}) ) )[ key ] = src[ key ];
+ }
+ }
+ if ( deep ) {
+ jQuery.extend( true, target, deep );
+ }
+
+ return target;
+}
+
+jQuery.fn.load = function( url, params, callback ) {
+ if ( typeof url !== "string" && _load ) {
+ return _load.apply( this, arguments );
+ }
+
+ var selector, response, type,
+ self = this,
+ off = url.indexOf(" ");
+
+ if ( off >= 0 ) {
+ selector = url.slice( off, url.length );
+ url = url.slice( 0, off );
+ }
+
+ // If it's a function
+ if ( jQuery.isFunction( params ) ) {
+
+ // We assume that it's the callback
+ callback = params;
+ params = undefined;
+
+ // Otherwise, build a param string
+ } else if ( params && typeof params === "object" ) {
+ type = "POST";
+ }
+
+ // If we have elements to modify, make the request
+ if ( self.length > 0 ) {
+ jQuery.ajax({
+ url: url,
+
+ // if "type" variable is undefined, then "GET" method will be used
+ type: type,
+ dataType: "html",
+ data: params
+ }).done(function( responseText ) {
+
+ // Save response for use in complete callback
+ response = arguments;
+
+ self.html( selector ?
+
+ // If a selector was specified, locate the right elements in a dummy div
+ // Exclude scripts to avoid IE 'Permission Denied' errors
+ jQuery("<div>").append( jQuery.parseHTML( responseText ) ).find( selector ) :
+
+ // Otherwise use the full result
+ responseText );
+
+ }).complete( callback && function( jqXHR, status ) {
+ self.each( callback, response || [ jqXHR.responseText, status, jqXHR ] );
+ });
+ }
+
+ return this;
+};
+
+// Attach a bunch of functions for handling common AJAX events
+jQuery.each( [ "ajaxStart", "ajaxStop", "ajaxComplete", "ajaxError", "ajaxSuccess", "ajaxSend" ], function( i, type ){
+ jQuery.fn[ type ] = function( fn ){
+ return this.on( type, fn );
+ };
+});
+
+jQuery.each( [ "get", "post" ], function( i, method ) {
+ jQuery[ method ] = function( url, data, callback, type ) {
+ // shift arguments if data argument was omitted
+ if ( jQuery.isFunction( data ) ) {
+ type = type || callback;
+ callback = data;
+ data = undefined;
+ }
+
+ return jQuery.ajax({
+ url: url,
+ type: method,
+ dataType: type,
+ data: data,
+ success: callback
+ });
+ };
+});
+
+jQuery.extend({
+
+ // Counter for holding the number of active queries
+ active: 0,
+
+ // Last-Modified header cache for next request
+ lastModified: {},
+ etag: {},
+
+ ajaxSettings: {
+ url: ajaxLocation,
+ type: "GET",
+ isLocal: rlocalProtocol.test( ajaxLocParts[ 1 ] ),
+ global: true,
+ processData: true,
+ async: true,
+ contentType: "application/x-www-form-urlencoded; charset=UTF-8",
+ /*
+ timeout: 0,
+ data: null,
+ dataType: null,
+ username: null,
+ password: null,
+ cache: null,
+ throws: false,
+ traditional: false,
+ headers: {},
+ */
+
+ accepts: {
+ "*": allTypes,
+ text: "text/plain",
+ html: "text/html",
+ xml: "application/xml, text/xml",
+ json: "application/json, text/javascript"
+ },
+
+ contents: {
+ xml: /xml/,
+ html: /html/,
+ json: /json/
+ },
+
+ responseFields: {
+ xml: "responseXML",
+ text: "responseText"
+ },
+
+ // Data converters
+ // Keys separate source (or catchall "*") and destination types with a single space
+ converters: {
+
+ // Convert anything to text
+ "* text": window.String,
+
+ // Text to html (true = no transformation)
+ "text html": true,
+
+ // Evaluate text as a json expression
+ "text json": jQuery.parseJSON,
+
+ // Parse text as xml
+ "text xml": jQuery.parseXML
+ },
+
+ // For options that shouldn't be deep extended:
+ // you can add your own custom options here if
+ // and when you create one that shouldn't be
+ // deep extended (see ajaxExtend)
+ flatOptions: {
+ url: true,
+ context: true
+ }
+ },
+
+ // Creates a full fledged settings object into target
+ // with both ajaxSettings and settings fields.
+ // If target is omitted, writes into ajaxSettings.
+ ajaxSetup: function( target, settings ) {
+ return settings ?
+
+ // Building a settings object
+ ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) :
+
+ // Extending ajaxSettings
+ ajaxExtend( jQuery.ajaxSettings, target );
+ },
+
+ ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),
+ ajaxTransport: addToPrefiltersOrTransports( transports ),
+
+ // Main method
+ ajax: function( url, options ) {
+
+ // If url is an object, simulate pre-1.5 signature
+ if ( typeof url === "object" ) {
+ options = url;
+ url = undefined;
+ }
+
+ // Force options to be an object
+ options = options || {};
+
+ var // Cross-domain detection vars
+ parts,
+ // Loop variable
+ i,
+ // URL without anti-cache param
+ cacheURL,
+ // Response headers as string
+ responseHeadersString,
+ // timeout handle
+ timeoutTimer,
+
+ // To know if global events are to be dispatched
+ fireGlobals,
+
+ transport,
+ // Response headers
+ responseHeaders,
+ // Create the final options object
+ s = jQuery.ajaxSetup( {}, options ),
+ // Callbacks context
+ callbackContext = s.context || s,
+ // Context for global events is callbackContext if it is a DOM node or jQuery collection
+ globalEventContext = s.context && ( callbackContext.nodeType || callbackContext.jquery ) ?
+ jQuery( callbackContext ) :
+ jQuery.event,
+ // Deferreds
+ deferred = jQuery.Deferred(),
+ completeDeferred = jQuery.Callbacks("once memory"),
+ // Status-dependent callbacks
+ statusCode = s.statusCode || {},
+ // Headers (they are sent all at once)
+ requestHeaders = {},
+ requestHeadersNames = {},
+ // The jqXHR state
+ state = 0,
+ // Default abort message
+ strAbort = "canceled",
+ // Fake xhr
+ jqXHR = {
+ readyState: 0,
+
+ // Builds headers hashtable if needed
+ getResponseHeader: function( key ) {
+ var match;
+ if ( state === 2 ) {
+ if ( !responseHeaders ) {
+ responseHeaders = {};
+ while ( (match = rheaders.exec( responseHeadersString )) ) {
+ responseHeaders[ match[1].toLowerCase() ] = match[ 2 ];
+ }
+ }
+ match = responseHeaders[ key.toLowerCase() ];
+ }
+ return match == null ? null : match;
+ },
+
+ // Raw string
+ getAllResponseHeaders: function() {
+ return state === 2 ? responseHeadersString : null;
+ },
+
+ // Caches the header
+ setRequestHeader: function( name, value ) {
+ var lname = name.toLowerCase();
+ if ( !state ) {
+ name = requestHeadersNames[ lname ] = requestHeadersNames[ lname ] || name;
+ requestHeaders[ name ] = value;
+ }
+ return this;
+ },
+
+ // Overrides response content-type header
+ overrideMimeType: function( type ) {
+ if ( !state ) {
+ s.mimeType = type;
+ }
+ return this;
+ },
+
+ // Status-dependent callbacks
+ statusCode: function( map ) {
+ var code;
+ if ( map ) {
+ if ( state < 2 ) {
+ for ( code in map ) {
+ // Lazy-add the new callback in a way that preserves old ones
+ statusCode[ code ] = [ statusCode[ code ], map[ code ] ];
+ }
+ } else {
+ // Execute the appropriate callbacks
+ jqXHR.always( map[ jqXHR.status ] );
+ }
+ }
+ return this;
+ },
+
+ // Cancel the request
+ abort: function( statusText ) {
+ var finalText = statusText || strAbort;
+ if ( transport ) {
+ transport.abort( finalText );
+ }
+ done( 0, finalText );
+ return this;
+ }
+ };
+
+ // Attach deferreds
+ deferred.promise( jqXHR ).complete = completeDeferred.add;
+ jqXHR.success = jqXHR.done;
+ jqXHR.error = jqXHR.fail;
+
+ // Remove hash character (#7531: and string promotion)
+ // Add protocol if not provided (#5866: IE7 issue with protocol-less urls)
+ // Handle falsy url in the settings object (#10093: consistency with old signature)
+ // We also use the url parameter if available
+ s.url = ( ( url || s.url || ajaxLocation ) + "" ).replace( rhash, "" ).replace( rprotocol, ajaxLocParts[ 1 ] + "//" );
+
+ // Alias method option to type as per ticket #12004
+ s.type = options.method || options.type || s.method || s.type;
+
+ // Extract dataTypes list
+ s.dataTypes = jQuery.trim( s.dataType || "*" ).toLowerCase().match( core_rnotwhite ) || [""];
+
+ // A cross-domain request is in order when we have a protocol:host:port mismatch
+ if ( s.crossDomain == null ) {
+ parts = rurl.exec( s.url.toLowerCase() );
+ s.crossDomain = !!( parts &&
+ ( parts[ 1 ] !== ajaxLocParts[ 1 ] || parts[ 2 ] !== ajaxLocParts[ 2 ] ||
+ ( parts[ 3 ] || ( parts[ 1 ] === "http:" ? 80 : 443 ) ) !=
+ ( ajaxLocParts[ 3 ] || ( ajaxLocParts[ 1 ] === "http:" ? 80 : 443 ) ) )
+ );
+ }
+
+ // Convert data if not already a string
+ if ( s.data && s.processData && typeof s.data !== "string" ) {
+ s.data = jQuery.param( s.data, s.traditional );
+ }
+
+ // Apply prefilters
+ inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );
+
+ // If request was aborted inside a prefilter, stop there
+ if ( state === 2 ) {
+ return jqXHR;
+ }
+
+ // We can fire global events as of now if asked to
+ fireGlobals = s.global;
+
+ // Watch for a new set of requests
+ if ( fireGlobals && jQuery.active++ === 0 ) {
+ jQuery.event.trigger("ajaxStart");
+ }
+
+ // Uppercase the type
+ s.type = s.type.toUpperCase();
+
+ // Determine if request has content
+ s.hasContent = !rnoContent.test( s.type );
+
+ // Save the URL in case we're toying with the If-Modified-Since
+ // and/or If-None-Match header later on
+ cacheURL = s.url;
+
+ // More options handling for requests with no content
+ if ( !s.hasContent ) {
+
+ // If data is available, append data to url
+ if ( s.data ) {
+ cacheURL = ( s.url += ( ajax_rquery.test( cacheURL ) ? "&" : "?" ) + s.data );
+ // #9682: remove data so that it's not used in an eventual retry
+ delete s.data;
+ }
+
+ // Add anti-cache in url if needed
+ if ( s.cache === false ) {
+ s.url = rts.test( cacheURL ) ?
+
+ // If there is already a '_' parameter, set its value
+ cacheURL.replace( rts, "$1_=" + ajax_nonce++ ) :
+
+ // Otherwise add one to the end
+ cacheURL + ( ajax_rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ajax_nonce++;
+ }
+ }
+
+ // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
+ if ( s.ifModified ) {
+ if ( jQuery.lastModified[ cacheURL ] ) {
+ jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] );
+ }
+ if ( jQuery.etag[ cacheURL ] ) {
+ jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] );
+ }
+ }
+
+ // Set the correct header, if data is being sent
+ if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
+ jqXHR.setRequestHeader( "Content-Type", s.contentType );
+ }
+
+ // Set the Accepts header for the server, depending on the dataType
+ jqXHR.setRequestHeader(
+ "Accept",
+ s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[0] ] ?
+ s.accepts[ s.dataTypes[0] ] + ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
+ s.accepts[ "*" ]
+ );
+
+ // Check for headers option
+ for ( i in s.headers ) {
+ jqXHR.setRequestHeader( i, s.headers[ i ] );
+ }
+
+ // Allow custom headers/mimetypes and early abort
+ if ( s.beforeSend && ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || state === 2 ) ) {
+ // Abort if not done already and return
+ return jqXHR.abort();
+ }
+
+ // aborting is no longer a cancellation
+ strAbort = "abort";
+
+ // Install callbacks on deferreds
+ for ( i in { success: 1, error: 1, complete: 1 } ) {
+ jqXHR[ i ]( s[ i ] );
+ }
+
+ // Get transport
+ transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );
+
+ // If no transport, we auto-abort
+ if ( !transport ) {
+ done( -1, "No Transport" );
+ } else {
+ jqXHR.readyState = 1;
+
+ // Send global event
+ if ( fireGlobals ) {
+ globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
+ }
+ // Timeout
+ if ( s.async && s.timeout > 0 ) {
+ timeoutTimer = setTimeout(function() {
+ jqXHR.abort("timeout");
+ }, s.timeout );
+ }
+
+ try {
+ state = 1;
+ transport.send( requestHeaders, done );
+ } catch ( e ) {
+ // Propagate exception as error if not done
+ if ( state < 2 ) {
+ done( -1, e );
+ // Simply rethrow otherwise
+ } else {
+ throw e;
+ }
+ }
+ }
+
+ // Callback for when everything is done
+ function done( status, nativeStatusText, responses, headers ) {
+ var isSuccess, success, error, response, modified,
+ statusText = nativeStatusText;
+
+ // Called once
+ if ( state === 2 ) {
+ return;
+ }
+
+ // State is "done" now
+ state = 2;
+
+ // Clear timeout if it exists
+ if ( timeoutTimer ) {
+ clearTimeout( timeoutTimer );
+ }
+
+ // Dereference transport for early garbage collection
+ // (no matter how long the jqXHR object will be used)
+ transport = undefined;
+
+ // Cache response headers
+ responseHeadersString = headers || "";
+
+ // Set readyState
+ jqXHR.readyState = status > 0 ? 4 : 0;
+
+ // Get response data
+ if ( responses ) {
+ response = ajaxHandleResponses( s, jqXHR, responses );
+ }
+
+ // If successful, handle type chaining
+ if ( status >= 200 && status < 300 || status === 304 ) {
+
+ // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
+ if ( s.ifModified ) {
+ modified = jqXHR.getResponseHeader("Last-Modified");
+ if ( modified ) {
+ jQuery.lastModified[ cacheURL ] = modified;
+ }
+ modified = jqXHR.getResponseHeader("etag");
+ if ( modified ) {
+ jQuery.etag[ cacheURL ] = modified;
+ }
+ }
+
+ // if no content
+ if ( status === 204 ) {
+ isSuccess = true;
+ statusText = "nocontent";
+
+ // if not modified
+ } else if ( status === 304 ) {
+ isSuccess = true;
+ statusText = "notmodified";
+
+ // If we have data, let's convert it
+ } else {
+ isSuccess = ajaxConvert( s, response );
+ statusText = isSuccess.state;
+ success = isSuccess.data;
+ error = isSuccess.error;
+ isSuccess = !error;
+ }
+ } else {
+ // We extract error from statusText
+ // then normalize statusText and status for non-aborts
+ error = statusText;
+ if ( status || !statusText ) {
+ statusText = "error";
+ if ( status < 0 ) {
+ status = 0;
+ }
+ }
+ }
+
+ // Set data for the fake xhr object
+ jqXHR.status = status;
+ jqXHR.statusText = ( nativeStatusText || statusText ) + "";
+
+ // Success/Error
+ if ( isSuccess ) {
+ deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
+ } else {
+ deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
+ }
+
+ // Status-dependent callbacks
+ jqXHR.statusCode( statusCode );
+ statusCode = undefined;
+
+ if ( fireGlobals ) {
+ globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError",
+ [ jqXHR, s, isSuccess ? success : error ] );
+ }
+
+ // Complete
+ completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );
+
+ if ( fireGlobals ) {
+ globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );
+ // Handle the global AJAX counter
+ if ( !( --jQuery.active ) ) {
+ jQuery.event.trigger("ajaxStop");
+ }
+ }
+ }
+
+ return jqXHR;
+ },
+
+ getScript: function( url, callback ) {
+ return jQuery.get( url, undefined, callback, "script" );
+ },
+
+ getJSON: function( url, data, callback ) {
+ return jQuery.get( url, data, callback, "json" );
+ }
+});
+
+/* Handles responses to an ajax request:
+ * - sets all responseXXX fields accordingly
+ * - finds the right dataType (mediates between content-type and expected dataType)
+ * - returns the corresponding response
+ */
+function ajaxHandleResponses( s, jqXHR, responses ) {
+ var firstDataType, ct, finalDataType, type,
+ contents = s.contents,
+ dataTypes = s.dataTypes,
+ responseFields = s.responseFields;
+
+ // Fill responseXXX fields
+ for ( type in responseFields ) {
+ if ( type in responses ) {
+ jqXHR[ responseFields[type] ] = responses[ type ];
+ }
+ }
+
+ // Remove auto dataType and get content-type in the process
+ while( dataTypes[ 0 ] === "*" ) {
+ dataTypes.shift();
+ if ( ct === undefined ) {
+ ct = s.mimeType || jqXHR.getResponseHeader("Content-Type");
+ }
+ }
+
+ // Check if we're dealing with a known content-type
+ if ( ct ) {
+ for ( type in contents ) {
+ if ( contents[ type ] && contents[ type ].test( ct ) ) {
+ dataTypes.unshift( type );
+ break;
+ }
+ }
+ }
+
+ // Check to see if we have a response for the expected dataType
+ if ( dataTypes[ 0 ] in responses ) {
+ finalDataType = dataTypes[ 0 ];
+ } else {
+ // Try convertible dataTypes
+ for ( type in responses ) {
+ if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[0] ] ) {
+ finalDataType = type;
+ break;
+ }
+ if ( !firstDataType ) {
+ firstDataType = type;
+ }
+ }
+ // Or just use first one
+ finalDataType = finalDataType || firstDataType;
+ }
+
+ // If we found a dataType
+ // We add the dataType to the list if needed
+ // and return the corresponding response
+ if ( finalDataType ) {
+ if ( finalDataType !== dataTypes[ 0 ] ) {
+ dataTypes.unshift( finalDataType );
+ }
+ return responses[ finalDataType ];
+ }
+}
+
+// Chain conversions given the request and the original response
+function ajaxConvert( s, response ) {
+ var conv2, current, conv, tmp,
+ converters = {},
+ i = 0,
+ // Work with a copy of dataTypes in case we need to modify it for conversion
+ dataTypes = s.dataTypes.slice(),
+ prev = dataTypes[ 0 ];
+
+ // Apply the dataFilter if provided
+ if ( s.dataFilter ) {
+ response = s.dataFilter( response, s.dataType );
+ }
+
+ // Create converters map with lowercased keys
+ if ( dataTypes[ 1 ] ) {
+ for ( conv in s.converters ) {
+ converters[ conv.toLowerCase() ] = s.converters[ conv ];
+ }
+ }
+
+ // Convert to each sequential dataType, tolerating list modification
+ for ( ; (current = dataTypes[++i]); ) {
+
+ // There's only work to do if current dataType is non-auto
+ if ( current !== "*" ) {
+
+ // Convert response if prev dataType is non-auto and differs from current
+ if ( prev !== "*" && prev !== current ) {
+
+ // Seek a direct converter
+ conv = converters[ prev + " " + current ] || converters[ "* " + current ];
+
+ // If none found, seek a pair
+ if ( !conv ) {
+ for ( conv2 in converters ) {
+
+ // If conv2 outputs current
+ tmp = conv2.split(" ");
+ if ( tmp[ 1 ] === current ) {
+
+ // If prev can be converted to accepted input
+ conv = converters[ prev + " " + tmp[ 0 ] ] ||
+ converters[ "* " + tmp[ 0 ] ];
+ if ( conv ) {
+ // Condense equivalence converters
+ if ( conv === true ) {
+ conv = converters[ conv2 ];
+
+ // Otherwise, insert the intermediate dataType
+ } else if ( converters[ conv2 ] !== true ) {
+ current = tmp[ 0 ];
+ dataTypes.splice( i--, 0, current );
+ }
+
+ break;
+ }
+ }
+ }
+ }
+
+ // Apply converter (if not an equivalence)
+ if ( conv !== true ) {
+
+ // Unless errors are allowed to bubble, catch and return them
+ if ( conv && s["throws"] ) {
+ response = conv( response );
+ } else {
+ try {
+ response = conv( response );
+ } catch ( e ) {
+ return { state: "parsererror", error: conv ? e : "No conversion from " + prev + " to " + current };
+ }
+ }
+ }
+ }
+
+ // Update prev for next iteration
+ prev = current;
+ }
+ }
+
+ return { state: "success", data: response };
+}
+// Install script dataType
+jQuery.ajaxSetup({
+ accepts: {
+ script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"
+ },
+ contents: {
+ script: /(?:java|ecma)script/
+ },
+ converters: {
+ "text script": function( text ) {
+ jQuery.globalEval( text );
+ return text;
+ }
+ }
+});
+
+// Handle cache's special case and global
+jQuery.ajaxPrefilter( "script", function( s ) {
+ if ( s.cache === undefined ) {
+ s.cache = false;
+ }
+ if ( s.crossDomain ) {
+ s.type = "GET";
+ s.global = false;
+ }
+});
+
+// Bind script tag hack transport
+jQuery.ajaxTransport( "script", function(s) {
+
+ // This transport only deals with cross domain requests
+ if ( s.crossDomain ) {
+
+ var script,
+ head = document.head || jQuery("head")[0] || document.documentElement;
+
+ return {
+
+ send: function( _, callback ) {
+
+ script = document.createElement("script");
+
+ script.async = true;
+
+ if ( s.scriptCharset ) {
+ script.charset = s.scriptCharset;
+ }
+
+ script.src = s.url;
+
+ // Attach handlers for all browsers
+ script.onload = script.onreadystatechange = function( _, isAbort ) {
+
+ if ( isAbort || !script.readyState || /loaded|complete/.test( script.readyState ) ) {
+
+ // Handle memory leak in IE
+ script.onload = script.onreadystatechange = null;
+
+ // Remove the script
+ if ( script.parentNode ) {
+ script.parentNode.removeChild( script );
+ }
+
+ // Dereference the script
+ script = null;
+
+ // Callback if not abort
+ if ( !isAbort ) {
+ callback( 200, "success" );
+ }
+ }
+ };
+
+ // Circumvent IE6 bugs with base elements (#2709 and #4378) by prepending
+ // Use native DOM manipulation to avoid our domManip AJAX trickery
+ head.insertBefore( script, head.firstChild );
+ },
+
+ abort: function() {
+ if ( script ) {
+ script.onload( undefined, true );
+ }
+ }
+ };
+ }
+});
+var oldCallbacks = [],
+ rjsonp = /(=)\?(?=&|$)|\?\?/;
+
+// Default jsonp settings
+jQuery.ajaxSetup({
+ jsonp: "callback",
+ jsonpCallback: function() {
+ var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( ajax_nonce++ ) );
+ this[ callback ] = true;
+ return callback;
+ }
+});
+
+// Detect, normalize options and install callbacks for jsonp requests
+jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
+
+ var callbackName, overwritten, responseContainer,
+ jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ?
+ "url" :
+ typeof s.data === "string" && !( s.contentType || "" ).indexOf("application/x-www-form-urlencoded") && rjsonp.test( s.data ) && "data"
+ );
+
+ // Handle iff the expected data type is "jsonp" or we have a parameter to set
+ if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) {
+
+ // Get callback name, remembering preexisting value associated with it
+ callbackName = s.jsonpCallback = jQuery.isFunction( s.jsonpCallback ) ?
+ s.jsonpCallback() :
+ s.jsonpCallback;
+
+ // Insert callback into url or form data
+ if ( jsonProp ) {
+ s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName );
+ } else if ( s.jsonp !== false ) {
+ s.url += ( ajax_rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName;
+ }
+
+ // Use data converter to retrieve json after script execution
+ s.converters["script json"] = function() {
+ if ( !responseContainer ) {
+ jQuery.error( callbackName + " was not called" );
+ }
+ return responseContainer[ 0 ];
+ };
+
+ // force json dataType
+ s.dataTypes[ 0 ] = "json";
+
+ // Install callback
+ overwritten = window[ callbackName ];
+ window[ callbackName ] = function() {
+ responseContainer = arguments;
+ };
+
+ // Clean-up function (fires after converters)
+ jqXHR.always(function() {
+ // Restore preexisting value
+ window[ callbackName ] = overwritten;
+
+ // Save back as free
+ if ( s[ callbackName ] ) {
+ // make sure that re-using the options doesn't screw things around
+ s.jsonpCallback = originalSettings.jsonpCallback;
+
+ // save the callback name for future use
+ oldCallbacks.push( callbackName );
+ }
+
+ // Call if it was a function and we have a response
+ if ( responseContainer && jQuery.isFunction( overwritten ) ) {
+ overwritten( responseContainer[ 0 ] );
+ }
+
+ responseContainer = overwritten = undefined;
+ });
+
+ // Delegate to script
+ return "script";
+ }
+});
+var xhrCallbacks, xhrSupported,
+ xhrId = 0,
+ // #5280: Internet Explorer will keep connections alive if we don't abort on unload
+ xhrOnUnloadAbort = window.ActiveXObject && function() {
+ // Abort all pending requests
+ var key;
+ for ( key in xhrCallbacks ) {
+ xhrCallbacks[ key ]( undefined, true );
+ }
+ };
+
+// Functions to create xhrs
+function createStandardXHR() {
+ try {
+ return new window.XMLHttpRequest();
+ } catch( e ) {}
+}
+
+function createActiveXHR() {
+ try {
+ return new window.ActiveXObject("Microsoft.XMLHTTP");
+ } catch( e ) {}
+}
+
+// Create the request object
+// (This is still attached to ajaxSettings for backward compatibility)
+jQuery.ajaxSettings.xhr = window.ActiveXObject ?
+ /* Microsoft failed to properly
+ * implement the XMLHttpRequest in IE7 (can't request local files),
+ * so we use the ActiveXObject when it is available
+ * Additionally XMLHttpRequest can be disabled in IE7/IE8 so
+ * we need a fallback.
+ */
+ function() {
+ return !this.isLocal && createStandardXHR() || createActiveXHR();
+ } :
+ // For all other browsers, use the standard XMLHttpRequest object
+ createStandardXHR;
+
+// Determine support properties
+xhrSupported = jQuery.ajaxSettings.xhr();
+jQuery.support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported );
+xhrSupported = jQuery.support.ajax = !!xhrSupported;
+
+// Create transport if the browser can provide an xhr
+if ( xhrSupported ) {
+
+ jQuery.ajaxTransport(function( s ) {
+ // Cross domain only allowed if supported through XMLHttpRequest
+ if ( !s.crossDomain || jQuery.support.cors ) {
+
+ var callback;
+
+ return {
+ send: function( headers, complete ) {
+
+ // Get a new xhr
+ var handle, i,
+ xhr = s.xhr();
+
+ // Open the socket
+ // Passing null username, generates a login popup on Opera (#2865)
+ if ( s.username ) {
+ xhr.open( s.type, s.url, s.async, s.username, s.password );
+ } else {
+ xhr.open( s.type, s.url, s.async );
+ }
+
+ // Apply custom fields if provided
+ if ( s.xhrFields ) {
+ for ( i in s.xhrFields ) {
+ xhr[ i ] = s.xhrFields[ i ];
+ }
+ }
+
+ // Override mime type if needed
+ if ( s.mimeType && xhr.overrideMimeType ) {
+ xhr.overrideMimeType( s.mimeType );
+ }
+
+ // X-Requested-With header
+ // For cross-domain requests, seeing as conditions for a preflight are
+ // akin to a jigsaw puzzle, we simply never set it to be sure.
+ // (it can always be set on a per-request basis or even using ajaxSetup)
+ // For same-domain requests, won't change header if already provided.
+ if ( !s.crossDomain && !headers["X-Requested-With"] ) {
+ headers["X-Requested-With"] = "XMLHttpRequest";
+ }
+
+ // Need an extra try/catch for cross domain requests in Firefox 3
+ try {
+ for ( i in headers ) {
+ xhr.setRequestHeader( i, headers[ i ] );
+ }
+ } catch( err ) {}
+
+ // Do send the request
+ // This may raise an exception which is actually
+ // handled in jQuery.ajax (so no try/catch here)
+ xhr.send( ( s.hasContent && s.data ) || null );
+
+ // Listener
+ callback = function( _, isAbort ) {
+ var status, responseHeaders, statusText, responses;
+
+ // Firefox throws exceptions when accessing properties
+ // of an xhr when a network error occurred
+ // http://helpful.knobs-dials.com/index.php/Component_returned_failure_code:_0x80040111_(NS_ERROR_NOT_AVAILABLE)
+ try {
+
+ // Was never called and is aborted or complete
+ if ( callback && ( isAbort || xhr.readyState === 4 ) ) {
+
+ // Only called once
+ callback = undefined;
+
+ // Do not keep as active anymore
+ if ( handle ) {
+ xhr.onreadystatechange = jQuery.noop;
+ if ( xhrOnUnloadAbort ) {
+ delete xhrCallbacks[ handle ];
+ }
+ }
+
+ // If it's an abort
+ if ( isAbort ) {
+ // Abort it manually if needed
+ if ( xhr.readyState !== 4 ) {
+ xhr.abort();
+ }
+ } else {
+ responses = {};
+ status = xhr.status;
+ responseHeaders = xhr.getAllResponseHeaders();
+
+ // When requesting binary data, IE6-9 will throw an exception
+ // on any attempt to access responseText (#11426)
+ if ( typeof xhr.responseText === "string" ) {
+ responses.text = xhr.responseText;
+ }
+
+ // Firefox throws an exception when accessing
+ // statusText for faulty cross-domain requests
+ try {
+ statusText = xhr.statusText;
+ } catch( e ) {
+ // We normalize with Webkit giving an empty statusText
+ statusText = "";
+ }
+
+ // Filter status for non standard behaviors
+
+ // If the request is local and we have data: assume a success
+ // (success with no data won't get notified, that's the best we
+ // can do given current implementations)
+ if ( !status && s.isLocal && !s.crossDomain ) {
+ status = responses.text ? 200 : 404;
+ // IE - #1450: sometimes returns 1223 when it should be 204
+ } else if ( status === 1223 ) {
+ status = 204;
+ }
+ }
+ }
+ } catch( firefoxAccessException ) {
+ if ( !isAbort ) {
+ complete( -1, firefoxAccessException );
+ }
+ }
+
+ // Call complete if needed
+ if ( responses ) {
+ complete( status, statusText, responses, responseHeaders );
+ }
+ };
+
+ if ( !s.async ) {
+ // if we're in sync mode we fire the callback
+ callback();
+ } else if ( xhr.readyState === 4 ) {
+ // (IE6 & IE7) if it's in cache and has been
+ // retrieved directly we need to fire the callback
+ setTimeout( callback );
+ } else {
+ handle = ++xhrId;
+ if ( xhrOnUnloadAbort ) {
+ // Create the active xhrs callbacks list if needed
+ // and attach the unload handler
+ if ( !xhrCallbacks ) {
+ xhrCallbacks = {};
+ jQuery( window ).unload( xhrOnUnloadAbort );
+ }
+ // Add to list of active xhrs callbacks
+ xhrCallbacks[ handle ] = callback;
+ }
+ xhr.onreadystatechange = callback;
+ }
+ },
+
+ abort: function() {
+ if ( callback ) {
+ callback( undefined, true );
+ }
+ }
+ };
+ }
+ });
+}
+var fxNow, timerId,
+ rfxtypes = /^(?:toggle|show|hide)$/,
+ rfxnum = new RegExp( "^(?:([+-])=|)(" + core_pnum + ")([a-z%]*)$", "i" ),
+ rrun = /queueHooks$/,
+ animationPrefilters = [ defaultPrefilter ],
+ tweeners = {
+ "*": [function( prop, value ) {
+ var end, unit,
+ tween = this.createTween( prop, value ),
+ parts = rfxnum.exec( value ),
+ target = tween.cur(),
+ start = +target || 0,
+ scale = 1,
+ maxIterations = 20;
+
+ if ( parts ) {
+ end = +parts[2];
+ unit = parts[3] || ( jQuery.cssNumber[ prop ] ? "" : "px" );
+
+ // We need to compute starting value
+ if ( unit !== "px" && start ) {
+ // Iteratively approximate from a nonzero starting point
+ // Prefer the current property, because this process will be trivial if it uses the same units
+ // Fallback to end or a simple constant
+ start = jQuery.css( tween.elem, prop, true ) || end || 1;
+
+ do {
+ // If previous iteration zeroed out, double until we get *something*
+ // Use a string for doubling factor so we don't accidentally see scale as unchanged below
+ scale = scale || ".5";
+
+ // Adjust and apply
+ start = start / scale;
+ jQuery.style( tween.elem, prop, start + unit );
+
+ // Update scale, tolerating zero or NaN from tween.cur()
+ // And breaking the loop if scale is unchanged or perfect, or if we've just had enough
+ } while ( scale !== (scale = tween.cur() / target) && scale !== 1 && --maxIterations );
+ }
+
+ tween.unit = unit;
+ tween.start = start;
+ // If a +=/-= token was provided, we're doing a relative animation
+ tween.end = parts[1] ? start + ( parts[1] + 1 ) * end : end;
+ }
+ return tween;
+ }]
+ };
+
+// Animations created synchronously will run synchronously
+function createFxNow() {
+ setTimeout(function() {
+ fxNow = undefined;
+ });
+ return ( fxNow = jQuery.now() );
+}
+
+function createTweens( animation, props ) {
+ jQuery.each( props, function( prop, value ) {
+ var collection = ( tweeners[ prop ] || [] ).concat( tweeners[ "*" ] ),
+ index = 0,
+ length = collection.length;
+ for ( ; index < length; index++ ) {
+ if ( collection[ index ].call( animation, prop, value ) ) {
+
+ // we're done with this property
+ return;
+ }
+ }
+ });
+}
+
+function Animation( elem, properties, options ) {
+ var result,
+ stopped,
+ index = 0,
+ length = animationPrefilters.length,
+ deferred = jQuery.Deferred().always( function() {
+ // don't match elem in the :animated selector
+ delete tick.elem;
+ }),
+ tick = function() {
+ if ( stopped ) {
+ return false;
+ }
+ var currentTime = fxNow || createFxNow(),
+ remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),
+ // archaic crash bug won't allow us to use 1 - ( 0.5 || 0 ) (#12497)
+ temp = remaining / animation.duration || 0,
+ percent = 1 - temp,
+ index = 0,
+ length = animation.tweens.length;
+
+ for ( ; index < length ; index++ ) {
+ animation.tweens[ index ].run( percent );
+ }
+
+ deferred.notifyWith( elem, [ animation, percent, remaining ]);
+
+ if ( percent < 1 && length ) {
+ return remaining;
+ } else {
+ deferred.resolveWith( elem, [ animation ] );
+ return false;
+ }
+ },
+ animation = deferred.promise({
+ elem: elem,
+ props: jQuery.extend( {}, properties ),
+ opts: jQuery.extend( true, { specialEasing: {} }, options ),
+ originalProperties: properties,
+ originalOptions: options,
+ startTime: fxNow || createFxNow(),
+ duration: options.duration,
+ tweens: [],
+ createTween: function( prop, end ) {
+ var tween = jQuery.Tween( elem, animation.opts, prop, end,
+ animation.opts.specialEasing[ prop ] || animation.opts.easing );
+ animation.tweens.push( tween );
+ return tween;
+ },
+ stop: function( gotoEnd ) {
+ var index = 0,
+ // if we are going to the end, we want to run all the tweens
+ // otherwise we skip this part
+ length = gotoEnd ? animation.tweens.length : 0;
+ if ( stopped ) {
+ return this;
+ }
+ stopped = true;
+ for ( ; index < length ; index++ ) {
+ animation.tweens[ index ].run( 1 );
+ }
+
+ // resolve when we played the last frame
+ // otherwise, reject
+ if ( gotoEnd ) {
+ deferred.resolveWith( elem, [ animation, gotoEnd ] );
+ } else {
+ deferred.rejectWith( elem, [ animation, gotoEnd ] );
+ }
+ return this;
+ }
+ }),
+ props = animation.props;
+
+ propFilter( props, animation.opts.specialEasing );
+
+ for ( ; index < length ; index++ ) {
+ result = animationPrefilters[ index ].call( animation, elem, props, animation.opts );
+ if ( result ) {
+ return result;
+ }
+ }
+
+ createTweens( animation, props );
+
+ if ( jQuery.isFunction( animation.opts.start ) ) {
+ animation.opts.start.call( elem, animation );
+ }
+
+ jQuery.fx.timer(
+ jQuery.extend( tick, {
+ elem: elem,
+ anim: animation,
+ queue: animation.opts.queue
+ })
+ );
+
+ // attach callbacks from options
+ return animation.progress( animation.opts.progress )
+ .done( animation.opts.done, animation.opts.complete )
+ .fail( animation.opts.fail )
+ .always( animation.opts.always );
+}
+
+function propFilter( props, specialEasing ) {
+ var value, name, index, easing, hooks;
+
+ // camelCase, specialEasing and expand cssHook pass
+ for ( index in props ) {
+ name = jQuery.camelCase( index );
+ easing = specialEasing[ name ];
+ value = props[ index ];
+ if ( jQuery.isArray( value ) ) {
+ easing = value[ 1 ];
+ value = props[ index ] = value[ 0 ];
+ }
+
+ if ( index !== name ) {
+ props[ name ] = value;
+ delete props[ index ];
+ }
+
+ hooks = jQuery.cssHooks[ name ];
+ if ( hooks && "expand" in hooks ) {
+ value = hooks.expand( value );
+ delete props[ name ];
+
+ // not quite $.extend, this wont overwrite keys already present.
+ // also - reusing 'index' from above because we have the correct "name"
+ for ( index in value ) {
+ if ( !( index in props ) ) {
+ props[ index ] = value[ index ];
+ specialEasing[ index ] = easing;
+ }
+ }
+ } else {
+ specialEasing[ name ] = easing;
+ }
+ }
+}
+
+jQuery.Animation = jQuery.extend( Animation, {
+
+ tweener: function( props, callback ) {
+ if ( jQuery.isFunction( props ) ) {
+ callback = props;
+ props = [ "*" ];
+ } else {
+ props = props.split(" ");
+ }
+
+ var prop,
+ index = 0,
+ length = props.length;
+
+ for ( ; index < length ; index++ ) {
+ prop = props[ index ];
+ tweeners[ prop ] = tweeners[ prop ] || [];
+ tweeners[ prop ].unshift( callback );
+ }
+ },
+
+ prefilter: function( callback, prepend ) {
+ if ( prepend ) {
+ animationPrefilters.unshift( callback );
+ } else {
+ animationPrefilters.push( callback );
+ }
+ }
+});
+
+function defaultPrefilter( elem, props, opts ) {
+ /*jshint validthis:true */
+ var prop, index, length,
+ value, dataShow, toggle,
+ tween, hooks, oldfire,
+ anim = this,
+ style = elem.style,
+ orig = {},
+ handled = [],
+ hidden = elem.nodeType && isHidden( elem );
+
+ // handle queue: false promises
+ if ( !opts.queue ) {
+ hooks = jQuery._queueHooks( elem, "fx" );
+ if ( hooks.unqueued == null ) {
+ hooks.unqueued = 0;
+ oldfire = hooks.empty.fire;
+ hooks.empty.fire = function() {
+ if ( !hooks.unqueued ) {
+ oldfire();
+ }
+ };
+ }
+ hooks.unqueued++;
+
+ anim.always(function() {
+ // doing this makes sure that the complete handler will be called
+ // before this completes
+ anim.always(function() {
+ hooks.unqueued--;
+ if ( !jQuery.queue( elem, "fx" ).length ) {
+ hooks.empty.fire();
+ }
+ });
+ });
+ }
+
+ // height/width overflow pass
+ if ( elem.nodeType === 1 && ( "height" in props || "width" in props ) ) {
+ // Make sure that nothing sneaks out
+ // Record all 3 overflow attributes because IE does not
+ // change the overflow attribute when overflowX and
+ // overflowY are set to the same value
+ opts.overflow = [ style.overflow, style.overflowX, style.overflowY ];
+
+ // Set display property to inline-block for height/width
+ // animations on inline elements that are having width/height animated
+ if ( jQuery.css( elem, "display" ) === "inline" &&
+ jQuery.css( elem, "float" ) === "none" ) {
+
+ // inline-level elements accept inline-block;
+ // block-level elements need to be inline with layout
+ if ( !jQuery.support.inlineBlockNeedsLayout || css_defaultDisplay( elem.nodeName ) === "inline" ) {
+ style.display = "inline-block";
+
+ } else {
+ style.zoom = 1;
+ }
+ }
+ }
+
+ if ( opts.overflow ) {
+ style.overflow = "hidden";
+ if ( !jQuery.support.shrinkWrapBlocks ) {
+ anim.always(function() {
+ style.overflow = opts.overflow[ 0 ];
+ style.overflowX = opts.overflow[ 1 ];
+ style.overflowY = opts.overflow[ 2 ];
+ });
+ }
+ }
+
+
+ // show/hide pass
+ for ( index in props ) {
+ value = props[ index ];
+ if ( rfxtypes.exec( value ) ) {
+ delete props[ index ];
+ toggle = toggle || value === "toggle";
+ if ( value === ( hidden ? "hide" : "show" ) ) {
+ continue;
+ }
+ handled.push( index );
+ }
+ }
+
+ length = handled.length;
+ if ( length ) {
+ dataShow = jQuery._data( elem, "fxshow" ) || jQuery._data( elem, "fxshow", {} );
+ if ( "hidden" in dataShow ) {
+ hidden = dataShow.hidden;
+ }
+
+ // store state if its toggle - enables .stop().toggle() to "reverse"
+ if ( toggle ) {
+ dataShow.hidden = !hidden;
+ }
+ if ( hidden ) {
+ jQuery( elem ).show();
+ } else {
+ anim.done(function() {
+ jQuery( elem ).hide();
+ });
+ }
+ anim.done(function() {
+ var prop;
+ jQuery._removeData( elem, "fxshow" );
+ for ( prop in orig ) {
+ jQuery.style( elem, prop, orig[ prop ] );
+ }
+ });
+ for ( index = 0 ; index < length ; index++ ) {
+ prop = handled[ index ];
+ tween = anim.createTween( prop, hidden ? dataShow[ prop ] : 0 );
+ orig[ prop ] = dataShow[ prop ] || jQuery.style( elem, prop );
+
+ if ( !( prop in dataShow ) ) {
+ dataShow[ prop ] = tween.start;
+ if ( hidden ) {
+ tween.end = tween.start;
+ tween.start = prop === "width" || prop === "height" ? 1 : 0;
+ }
+ }
+ }
+ }
+}
+
+function Tween( elem, options, prop, end, easing ) {
+ return new Tween.prototype.init( elem, options, prop, end, easing );
+}
+jQuery.Tween = Tween;
+
+Tween.prototype = {
+ constructor: Tween,
+ init: function( elem, options, prop, end, easing, unit ) {
+ this.elem = elem;
+ this.prop = prop;
+ this.easing = easing || "swing";
+ this.options = options;
+ this.start = this.now = this.cur();
+ this.end = end;
+ this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" );
+ },
+ cur: function() {
+ var hooks = Tween.propHooks[ this.prop ];
+
+ return hooks && hooks.get ?
+ hooks.get( this ) :
+ Tween.propHooks._default.get( this );
+ },
+ run: function( percent ) {
+ var eased,
+ hooks = Tween.propHooks[ this.prop ];
+
+ if ( this.options.duration ) {
+ this.pos = eased = jQuery.easing[ this.easing ](
+ percent, this.options.duration * percent, 0, 1, this.options.duration
+ );
+ } else {
+ this.pos = eased = percent;
+ }
+ this.now = ( this.end - this.start ) * eased + this.start;
+
+ if ( this.options.step ) {
+ this.options.step.call( this.elem, this.now, this );
+ }
+
+ if ( hooks && hooks.set ) {
+ hooks.set( this );
+ } else {
+ Tween.propHooks._default.set( this );
+ }
+ return this;
+ }
+};
+
+Tween.prototype.init.prototype = Tween.prototype;
+
+Tween.propHooks = {
+ _default: {
+ get: function( tween ) {
+ var result;
+
+ if ( tween.elem[ tween.prop ] != null &&
+ (!tween.elem.style || tween.elem.style[ tween.prop ] == null) ) {
+ return tween.elem[ tween.prop ];
+ }
+
+ // passing an empty string as a 3rd parameter to .css will automatically
+ // attempt a parseFloat and fallback to a string if the parse fails
+ // so, simple values such as "10px" are parsed to Float.
+ // complex values such as "rotate(1rad)" are returned as is.
+ result = jQuery.css( tween.elem, tween.prop, "" );
+ // Empty strings, null, undefined and "auto" are converted to 0.
+ return !result || result === "auto" ? 0 : result;
+ },
+ set: function( tween ) {
+ // use step hook for back compat - use cssHook if its there - use .style if its
+ // available and use plain properties where available
+ if ( jQuery.fx.step[ tween.prop ] ) {
+ jQuery.fx.step[ tween.prop ]( tween );
+ } else if ( tween.elem.style && ( tween.elem.style[ jQuery.cssProps[ tween.prop ] ] != null || jQuery.cssHooks[ tween.prop ] ) ) {
+ jQuery.style( tween.elem, tween.prop, tween.now + tween.unit );
+ } else {
+ tween.elem[ tween.prop ] = tween.now;
+ }
+ }
+ }
+};
+
+// Remove in 2.0 - this supports IE8's panic based approach
+// to setting things on disconnected nodes
+
+Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
+ set: function( tween ) {
+ if ( tween.elem.nodeType && tween.elem.parentNode ) {
+ tween.elem[ tween.prop ] = tween.now;
+ }
+ }
+};
+
+jQuery.each([ "toggle", "show", "hide" ], function( i, name ) {
+ var cssFn = jQuery.fn[ name ];
+ jQuery.fn[ name ] = function( speed, easing, callback ) {
+ return speed == null || typeof speed === "boolean" ?
+ cssFn.apply( this, arguments ) :
+ this.animate( genFx( name, true ), speed, easing, callback );
+ };
+});
+
+jQuery.fn.extend({
+ fadeTo: function( speed, to, easing, callback ) {
+
+ // show any hidden elements after setting opacity to 0
+ return this.filter( isHidden ).css( "opacity", 0 ).show()
+
+ // animate to the value specified
+ .end().animate({ opacity: to }, speed, easing, callback );
+ },
+ animate: function( prop, speed, easing, callback ) {
+ var empty = jQuery.isEmptyObject( prop ),
+ optall = jQuery.speed( speed, easing, callback ),
+ doAnimation = function() {
+ // Operate on a copy of prop so per-property easing won't be lost
+ var anim = Animation( this, jQuery.extend( {}, prop ), optall );
+ doAnimation.finish = function() {
+ anim.stop( true );
+ };
+ // Empty animations, or finishing resolves immediately
+ if ( empty || jQuery._data( this, "finish" ) ) {
+ anim.stop( true );
+ }
+ };
+ doAnimation.finish = doAnimation;
+
+ return empty || optall.queue === false ?
+ this.each( doAnimation ) :
+ this.queue( optall.queue, doAnimation );
+ },
+ stop: function( type, clearQueue, gotoEnd ) {
+ var stopQueue = function( hooks ) {
+ var stop = hooks.stop;
+ delete hooks.stop;
+ stop( gotoEnd );
+ };
+
+ if ( typeof type !== "string" ) {
+ gotoEnd = clearQueue;
+ clearQueue = type;
+ type = undefined;
+ }
+ if ( clearQueue && type !== false ) {
+ this.queue( type || "fx", [] );
+ }
+
+ return this.each(function() {
+ var dequeue = true,
+ index = type != null && type + "queueHooks",
+ timers = jQuery.timers,
+ data = jQuery._data( this );
+
+ if ( index ) {
+ if ( data[ index ] && data[ index ].stop ) {
+ stopQueue( data[ index ] );
+ }
+ } else {
+ for ( index in data ) {
+ if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) {
+ stopQueue( data[ index ] );
+ }
+ }
+ }
+
+ for ( index = timers.length; index--; ) {
+ if ( timers[ index ].elem === this && (type == null || timers[ index ].queue === type) ) {
+ timers[ index ].anim.stop( gotoEnd );
+ dequeue = false;
+ timers.splice( index, 1 );
+ }
+ }
+
+ // start the next in the queue if the last step wasn't forced
+ // timers currently will call their complete callbacks, which will dequeue
+ // but only if they were gotoEnd
+ if ( dequeue || !gotoEnd ) {
+ jQuery.dequeue( this, type );
+ }
+ });
+ },
+ finish: function( type ) {
+ if ( type !== false ) {
+ type = type || "fx";
+ }
+ return this.each(function() {
+ var index,
+ data = jQuery._data( this ),
+ queue = data[ type + "queue" ],
+ hooks = data[ type + "queueHooks" ],
+ timers = jQuery.timers,
+ length = queue ? queue.length : 0;
+
+ // enable finishing flag on private data
+ data.finish = true;
+
+ // empty the queue first
+ jQuery.queue( this, type, [] );
+
+ if ( hooks && hooks.cur && hooks.cur.finish ) {
+ hooks.cur.finish.call( this );
+ }
+
+ // look for any active animations, and finish them
+ for ( index = timers.length; index--; ) {
+ if ( timers[ index ].elem === this && timers[ index ].queue === type ) {
+ timers[ index ].anim.stop( true );
+ timers.splice( index, 1 );
+ }
+ }
+
+ // look for any animations in the old queue and finish them
+ for ( index = 0; index < length; index++ ) {
+ if ( queue[ index ] && queue[ index ].finish ) {
+ queue[ index ].finish.call( this );
+ }
+ }
+
+ // turn off finishing flag
+ delete data.finish;
+ });
+ }
+});
+
+// Generate parameters to create a standard animation
+function genFx( type, includeWidth ) {
+ var which,
+ attrs = { height: type },
+ i = 0;
+
+ // if we include width, step value is 1 to do all cssExpand values,
+ // if we don't include width, step value is 2 to skip over Left and Right
+ includeWidth = includeWidth? 1 : 0;
+ for( ; i < 4 ; i += 2 - includeWidth ) {
+ which = cssExpand[ i ];
+ attrs[ "margin" + which ] = attrs[ "padding" + which ] = type;
+ }
+
+ if ( includeWidth ) {
+ attrs.opacity = attrs.width = type;
+ }
+
+ return attrs;
+}
+
+// Generate shortcuts for custom animations
+jQuery.each({
+ slideDown: genFx("show"),
+ slideUp: genFx("hide"),
+ slideToggle: genFx("toggle"),
+ fadeIn: { opacity: "show" },
+ fadeOut: { opacity: "hide" },
+ fadeToggle: { opacity: "toggle" }
+}, function( name, props ) {
+ jQuery.fn[ name ] = function( speed, easing, callback ) {
+ return this.animate( props, speed, easing, callback );
+ };
+});
+
+jQuery.speed = function( speed, easing, fn ) {
+ var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : {
+ complete: fn || !fn && easing ||
+ jQuery.isFunction( speed ) && speed,
+ duration: speed,
+ easing: fn && easing || easing && !jQuery.isFunction( easing ) && easing
+ };
+
+ opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration :
+ opt.duration in jQuery.fx.speeds ? jQuery.fx.speeds[ opt.duration ] : jQuery.fx.speeds._default;
+
+ // normalize opt.queue - true/undefined/null -> "fx"
+ if ( opt.queue == null || opt.queue === true ) {
+ opt.queue = "fx";
+ }
+
+ // Queueing
+ opt.old = opt.complete;
+
+ opt.complete = function() {
+ if ( jQuery.isFunction( opt.old ) ) {
+ opt.old.call( this );
+ }
+
+ if ( opt.queue ) {
+ jQuery.dequeue( this, opt.queue );
+ }
+ };
+
+ return opt;
+};
+
+jQuery.easing = {
+ linear: function( p ) {
+ return p;
+ },
+ swing: function( p ) {
+ return 0.5 - Math.cos( p*Math.PI ) / 2;
+ }
+};
+
+jQuery.timers = [];
+jQuery.fx = Tween.prototype.init;
+jQuery.fx.tick = function() {
+ var timer,
+ timers = jQuery.timers,
+ i = 0;
+
+ fxNow = jQuery.now();
+
+ for ( ; i < timers.length; i++ ) {
+ timer = timers[ i ];
+ // Checks the timer has not already been removed
+ if ( !timer() && timers[ i ] === timer ) {
+ timers.splice( i--, 1 );
+ }
+ }
+
+ if ( !timers.length ) {
+ jQuery.fx.stop();
+ }
+ fxNow = undefined;
+};
+
+jQuery.fx.timer = function( timer ) {
+ if ( timer() && jQuery.timers.push( timer ) ) {
+ jQuery.fx.start();
+ }
+};
+
+jQuery.fx.interval = 13;
+
+jQuery.fx.start = function() {
+ if ( !timerId ) {
+ timerId = setInterval( jQuery.fx.tick, jQuery.fx.interval );
+ }
+};
+
+jQuery.fx.stop = function() {
+ clearInterval( timerId );
+ timerId = null;
+};
+
+jQuery.fx.speeds = {
+ slow: 600,
+ fast: 200,
+ // Default speed
+ _default: 400
+};
+
+// Back Compat <1.8 extension point
+jQuery.fx.step = {};
+
+if ( jQuery.expr && jQuery.expr.filters ) {
+ jQuery.expr.filters.animated = function( elem ) {
+ return jQuery.grep(jQuery.timers, function( fn ) {
+ return elem === fn.elem;
+ }).length;
+ };
+}
+jQuery.fn.offset = function( options ) {
+ if ( arguments.length ) {
+ return options === undefined ?
+ this :
+ this.each(function( i ) {
+ jQuery.offset.setOffset( this, options, i );
+ });
+ }
+
+ var docElem, win,
+ box = { top: 0, left: 0 },
+ elem = this[ 0 ],
+ doc = elem && elem.ownerDocument;
+
+ if ( !doc ) {
+ return;
+ }
+
+ docElem = doc.documentElement;
+
+ // Make sure it's not a disconnected DOM node
+ if ( !jQuery.contains( docElem, elem ) ) {
+ return box;
+ }
+
+ // If we don't have gBCR, just use 0,0 rather than error
+ // BlackBerry 5, iOS 3 (original iPhone)
+ if ( typeof elem.getBoundingClientRect !== core_strundefined ) {
+ box = elem.getBoundingClientRect();
+ }
+ win = getWindow( doc );
+ return {
+ top: box.top + ( win.pageYOffset || docElem.scrollTop ) - ( docElem.clientTop || 0 ),
+ left: box.left + ( win.pageXOffset || docElem.scrollLeft ) - ( docElem.clientLeft || 0 )
+ };
+};
+
+jQuery.offset = {
+
+ setOffset: function( elem, options, i ) {
+ var position = jQuery.css( elem, "position" );
+
+ // set position first, in-case top/left are set even on static elem
+ if ( position === "static" ) {
+ elem.style.position = "relative";
+ }
+
+ var curElem = jQuery( elem ),
+ curOffset = curElem.offset(),
+ curCSSTop = jQuery.css( elem, "top" ),
+ curCSSLeft = jQuery.css( elem, "left" ),
+ calculatePosition = ( position === "absolute" || position === "fixed" ) && jQuery.inArray("auto", [curCSSTop, curCSSLeft]) > -1,
+ props = {}, curPosition = {}, curTop, curLeft;
+
+ // need to be able to calculate position if either top or left is auto and position is either absolute or fixed
+ if ( calculatePosition ) {
+ curPosition = curElem.position();
+ curTop = curPosition.top;
+ curLeft = curPosition.left;
+ } else {
+ curTop = parseFloat( curCSSTop ) || 0;
+ curLeft = parseFloat( curCSSLeft ) || 0;
+ }
+
+ if ( jQuery.isFunction( options ) ) {
+ options = options.call( elem, i, curOffset );
+ }
+
+ if ( options.top != null ) {
+ props.top = ( options.top - curOffset.top ) + curTop;
+ }
+ if ( options.left != null ) {
+ props.left = ( options.left - curOffset.left ) + curLeft;
+ }
+
+ if ( "using" in options ) {
+ options.using.call( elem, props );
+ } else {
+ curElem.css( props );
+ }
+ }
+};
+
+
+jQuery.fn.extend({
+
+ position: function() {
+ if ( !this[ 0 ] ) {
+ return;
+ }
+
+ var offsetParent, offset,
+ parentOffset = { top: 0, left: 0 },
+ elem = this[ 0 ];
+
+ // fixed elements are offset from window (parentOffset = {top:0, left: 0}, because it is it's only offset parent
+ if ( jQuery.css( elem, "position" ) === "fixed" ) {
+ // we assume that getBoundingClientRect is available when computed position is fixed
+ offset = elem.getBoundingClientRect();
+ } else {
+ // Get *real* offsetParent
+ offsetParent = this.offsetParent();
+
+ // Get correct offsets
+ offset = this.offset();
+ if ( !jQuery.nodeName( offsetParent[ 0 ], "html" ) ) {
+ parentOffset = offsetParent.offset();
+ }
+
+ // Add offsetParent borders
+ parentOffset.top += jQuery.css( offsetParent[ 0 ], "borderTopWidth", true );
+ parentOffset.left += jQuery.css( offsetParent[ 0 ], "borderLeftWidth", true );
+ }
+
+ // Subtract parent offsets and element margins
+ // note: when an element has margin: auto the offsetLeft and marginLeft
+ // are the same in Safari causing offset.left to incorrectly be 0
+ return {
+ top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ),
+ left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true)
+ };
+ },
+
+ offsetParent: function() {
+ return this.map(function() {
+ var offsetParent = this.offsetParent || document.documentElement;
+ while ( offsetParent && ( !jQuery.nodeName( offsetParent, "html" ) && jQuery.css( offsetParent, "position") === "static" ) ) {
+ offsetParent = offsetParent.offsetParent;
+ }
+ return offsetParent || document.documentElement;
+ });
+ }
+});
+
+
+// Create scrollLeft and scrollTop methods
+jQuery.each( {scrollLeft: "pageXOffset", scrollTop: "pageYOffset"}, function( method, prop ) {
+ var top = /Y/.test( prop );
+
+ jQuery.fn[ method ] = function( val ) {
+ return jQuery.access( this, function( elem, method, val ) {
+ var win = getWindow( elem );
+
+ if ( val === undefined ) {
+ return win ? (prop in win) ? win[ prop ] :
+ win.document.documentElement[ method ] :
+ elem[ method ];
+ }
+
+ if ( win ) {
+ win.scrollTo(
+ !top ? val : jQuery( win ).scrollLeft(),
+ top ? val : jQuery( win ).scrollTop()
+ );
+
+ } else {
+ elem[ method ] = val;
+ }
+ }, method, val, arguments.length, null );
+ };
+});
+
+function getWindow( elem ) {
+ return jQuery.isWindow( elem ) ?
+ elem :
+ elem.nodeType === 9 ?
+ elem.defaultView || elem.parentWindow :
+ false;
+}
+// Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
+jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
+ jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name }, function( defaultExtra, funcName ) {
+ // margin is only for outerHeight, outerWidth
+ jQuery.fn[ funcName ] = function( margin, value ) {
+ var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
+ extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );
+
+ return jQuery.access( this, function( elem, type, value ) {
+ var doc;
+
+ if ( jQuery.isWindow( elem ) ) {
+ // As of 5/8/2012 this will yield incorrect results for Mobile Safari, but there
+ // isn't a whole lot we can do. See pull request at this URL for discussion:
+ // https://github.com/jquery/jquery/pull/764
+ return elem.document.documentElement[ "client" + name ];
+ }
+
+ // Get document width or height
+ if ( elem.nodeType === 9 ) {
+ doc = elem.documentElement;
+
+ // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height], whichever is greatest
+ // unfortunately, this causes bug #3838 in IE6/8 only, but there is currently no good, small way to fix it.
+ return Math.max(
+ elem.body[ "scroll" + name ], doc[ "scroll" + name ],
+ elem.body[ "offset" + name ], doc[ "offset" + name ],
+ doc[ "client" + name ]
+ );
+ }
+
+ return value === undefined ?
+ // Get width or height on the element, requesting but not forcing parseFloat
+ jQuery.css( elem, type, extra ) :
+
+ // Set width or height on the element
+ jQuery.style( elem, type, value, extra );
+ }, type, chainable ? margin : undefined, chainable, null );
+ };
+ });
+});
+// Limit scope pollution from any deprecated API
+// (function() {
+
+// })();
+// Expose jQuery to the global object
+window.jQuery = window.$ = jQuery;
+
+// Expose jQuery as an AMD module, but only for AMD loaders that
+// understand the issues with loading multiple versions of jQuery
+// in a page that all might call define(). The loader will indicate
+// they have special allowances for multiple jQuery versions by
+// specifying define.amd.jQuery = true. Register as a named module,
+// since jQuery can be concatenated with other files that may use define,
+// but not use a proper concatenation script that understands anonymous
+// AMD modules. A named AMD is safest and most robust way to register.
+// Lowercase jquery is used because AMD module names are derived from
+// file names, and jQuery is normally delivered in a lowercase file name.
+// Do this after creating the global so that if an AMD module wants to call
+// noConflict to hide this version of jQuery, it will work.
+if ( typeof define === "function" && define.amd && define.amd.jQuery ) {
+ define( "jquery", [], function () { return jQuery; } );
+}
+
+})( window );
\ No newline at end of file
diff --git a/public/javascripts/vendor/underscore-min.js b/public/javascripts/vendor/underscore-min.js
new file mode 100644
index 0000000..5b55f32
--- /dev/null
+++ b/public/javascripts/vendor/underscore-min.js
@@ -0,0 +1,31 @@
+// Underscore.js 1.3.1
+// (c) 2009-2012 Jeremy Ashkenas, DocumentCloud Inc.
+// Underscore is freely distributable under the MIT license.
+// Portions of Underscore are inspired or borrowed from Prototype,
+// Oliver Steele's Functional, and John Resig's Micro-Templating.
+// For all details and documentation:
+// http://documentcloud.github.com/underscore
+(function(){function q(a,c,d){if(a===c)return a!==0||1/a==1/c;if(a==null||c==null)return a===c;if(a._chain)a=a._wrapped;if(c._chain)c=c._wrapped;if(a.isEqual&&b.isFunction(a.isEqual))return a.isEqual(c);if(c.isEqual&&b.isFunction(c.isEqual))return c.isEqual(a);var e=l.call(a);if(e!=l.call(c))return false;switch(e){case "[object String]":return a==String(c);case "[object Number]":return a!=+a?c!=+c:a==0?1/a==1/c:a==+c;case "[object Date]":case "[object Boolean]":return+a==+c;case "[object [...]
+c.source&&a.global==c.global&&a.multiline==c.multiline&&a.ignoreCase==c.ignoreCase}if(typeof a!="object"||typeof c!="object")return false;for(var f=d.length;f--;)if(d[f]==a)return true;d.push(a);var f=0,g=true;if(e=="[object Array]"){if(f=a.length,g=f==c.length)for(;f--;)if(!(g=f in a==f in c&&q(a[f],c[f],d)))break}else{if("constructor"in a!="constructor"in c||a.constructor!=c.constructor)return false;for(var h in a)if(b.has(a,h)&&(f++,!(g=b.has(c,h)&&q(a[h],c[h],d))))break;if(g){for(h i [...]
+h)&&!f--)break;g=!f}}d.pop();return g}var r=this,G=r._,n={},k=Array.prototype,o=Object.prototype,i=k.slice,H=k.unshift,l=o.toString,I=o.hasOwnProperty,w=k.forEach,x=k.map,y=k.reduce,z=k.reduceRight,A=k.filter,B=k.every,C=k.some,p=k.indexOf,D=k.lastIndexOf,o=Array.isArray,J=Object.keys,s=Function.prototype.bind,b=function(a){return new m(a)};if(typeof exports!=="undefined"){if(typeof module!=="undefined"&&module.exports)exports=module.exports=b;exports._=b}else r._=b;b.VERSION="1.3.1";var [...]
+b.forEach=function(a,c,d){if(a!=null)if(w&&a.forEach===w)a.forEach(c,d);else if(a.length===+a.length)for(var e=0,f=a.length;e<f;e++){if(e in a&&c.call(d,a[e],e,a)===n)break}else for(e in a)if(b.has(a,e)&&c.call(d,a[e],e,a)===n)break};b.map=b.collect=function(a,c,b){var e=[];if(a==null)return e;if(x&&a.map===x)return a.map(c,b);j(a,function(a,g,h){e[e.length]=c.call(b,a,g,h)});if(a.length===+a.length)e.length=a.length;return e};b.reduce=b.foldl=b.inject=function(a,c,d,e){var f=arguments.l [...]
+null&&(a=[]);if(y&&a.reduce===y)return e&&(c=b.bind(c,e)),f?a.reduce(c,d):a.reduce(c);j(a,function(a,b,i){f?d=c.call(e,d,a,b,i):(d=a,f=true)});if(!f)throw new TypeError("Reduce of empty array with no initial value");return d};b.reduceRight=b.foldr=function(a,c,d,e){var f=arguments.length>2;a==null&&(a=[]);if(z&&a.reduceRight===z)return e&&(c=b.bind(c,e)),f?a.reduceRight(c,d):a.reduceRight(c);var g=b.toArray(a).reverse();e&&!f&&(c=b.bind(c,e));return f?b.reduce(g,c,d,e):b.reduce(g,c)};b.f [...]
+function(a,c,b){var e;E(a,function(a,g,h){if(c.call(b,a,g,h))return e=a,true});return e};b.filter=b.select=function(a,c,b){var e=[];if(a==null)return e;if(A&&a.filter===A)return a.filter(c,b);j(a,function(a,g,h){c.call(b,a,g,h)&&(e[e.length]=a)});return e};b.reject=function(a,c,b){var e=[];if(a==null)return e;j(a,function(a,g,h){c.call(b,a,g,h)||(e[e.length]=a)});return e};b.every=b.all=function(a,c,b){var e=true;if(a==null)return e;if(B&&a.every===B)return a.every(c,b);j(a,function(a,g, [...]
+e&&c.call(b,a,g,h)))return n});return e};var E=b.some=b.any=function(a,c,d){c||(c=b.identity);var e=false;if(a==null)return e;if(C&&a.some===C)return a.some(c,d);j(a,function(a,b,h){if(e||(e=c.call(d,a,b,h)))return n});return!!e};b.include=b.contains=function(a,c){var b=false;if(a==null)return b;return p&&a.indexOf===p?a.indexOf(c)!=-1:b=E(a,function(a){return a===c})};b.invoke=function(a,c){var d=i.call(arguments,2);return b.map(a,function(a){return(b.isFunction(c)?c||a:a[c]).apply(a,d) [...]
+function(a,c){return b.map(a,function(a){return a[c]})};b.max=function(a,c,d){if(!c&&b.isArray(a))return Math.max.apply(Math,a);if(!c&&b.isEmpty(a))return-Infinity;var e={computed:-Infinity};j(a,function(a,b,h){b=c?c.call(d,a,b,h):a;b>=e.computed&&(e={value:a,computed:b})});return e.value};b.min=function(a,c,d){if(!c&&b.isArray(a))return Math.min.apply(Math,a);if(!c&&b.isEmpty(a))return Infinity;var e={computed:Infinity};j(a,function(a,b,h){b=c?c.call(d,a,b,h):a;b<e.computed&&(e={value:a [...]
+return e.value};b.shuffle=function(a){var b=[],d;j(a,function(a,f){f==0?b[0]=a:(d=Math.floor(Math.random()*(f+1)),b[f]=b[d],b[d]=a)});return b};b.sortBy=function(a,c,d){return b.pluck(b.map(a,function(a,b,g){return{value:a,criteria:c.call(d,a,b,g)}}).sort(function(a,b){var c=a.criteria,d=b.criteria;return c<d?-1:c>d?1:0}),"value")};b.groupBy=function(a,c){var d={},e=b.isFunction(c)?c:function(a){return a[c]};j(a,function(a,b){var c=e(a,b);(d[c]||(d[c]=[])).push(a)});return d};b.sortedInd [...]
+c,d){d||(d=b.identity);for(var e=0,f=a.length;e<f;){var g=e+f>>1;d(a[g])<d(c)?e=g+1:f=g}return e};b.toArray=function(a){return!a?[]:a.toArray?a.toArray():b.isArray(a)?i.call(a):b.isArguments(a)?i.call(a):b.values(a)};b.size=function(a){return b.toArray(a).length};b.first=b.head=function(a,b,d){return b!=null&&!d?i.call(a,0,b):a[0]};b.initial=function(a,b,d){return i.call(a,0,a.length-(b==null||d?1:b))};b.last=function(a,b,d){return b!=null&&!d?i.call(a,Math.max(a.length-b,0)):a[a.length- [...]
+b.tail=function(a,b,d){return i.call(a,b==null||d?1:b)};b.compact=function(a){return b.filter(a,function(a){return!!a})};b.flatten=function(a,c){return b.reduce(a,function(a,e){if(b.isArray(e))return a.concat(c?e:b.flatten(e));a[a.length]=e;return a},[])};b.without=function(a){return b.difference(a,i.call(arguments,1))};b.uniq=b.unique=function(a,c,d){var d=d?b.map(a,d):a,e=[];b.reduce(d,function(d,g,h){if(0==h||(c===true?b.last(d)!=g:!b.include(d,g)))d[d.length]=g,e[e.length]=a[h];retur [...]
+return e};b.union=function(){return b.uniq(b.flatten(arguments,true))};b.intersection=b.intersect=function(a){var c=i.call(arguments,1);return b.filter(b.uniq(a),function(a){return b.every(c,function(c){return b.indexOf(c,a)>=0})})};b.difference=function(a){var c=b.flatten(i.call(arguments,1));return b.filter(a,function(a){return!b.include(c,a)})};b.zip=function(){for(var a=i.call(arguments),c=b.max(b.pluck(a,"length")),d=Array(c),e=0;e<c;e++)d[e]=b.pluck(a,""+e);return d};b.indexOf=func [...]
+d){if(a==null)return-1;var e;if(d)return d=b.sortedIndex(a,c),a[d]===c?d:-1;if(p&&a.indexOf===p)return a.indexOf(c);for(d=0,e=a.length;d<e;d++)if(d in a&&a[d]===c)return d;return-1};b.lastIndexOf=function(a,b){if(a==null)return-1;if(D&&a.lastIndexOf===D)return a.lastIndexOf(b);for(var d=a.length;d--;)if(d in a&&a[d]===b)return d;return-1};b.range=function(a,b,d){arguments.length<=1&&(b=a||0,a=0);for(var d=arguments[2]||1,e=Math.max(Math.ceil((b-a)/d),0),f=0,g=Array(e);f<e;)g[f++]=a,a+=d; [...]
+var F=function(){};b.bind=function(a,c){var d,e;if(a.bind===s&&s)return s.apply(a,i.call(arguments,1));if(!b.isFunction(a))throw new TypeError;e=i.call(arguments,2);return d=function(){if(!(this instanceof d))return a.apply(c,e.concat(i.call(arguments)));F.prototype=a.prototype;var b=new F,g=a.apply(b,e.concat(i.call(arguments)));return Object(g)===g?g:b}};b.bindAll=function(a){var c=i.call(arguments,1);c.length==0&&(c=b.functions(a));j(c,function(c){a[c]=b.bind(a[c],a)});return a};b.mem [...]
+c){var d={};c||(c=b.identity);return function(){var e=c.apply(this,arguments);return b.has(d,e)?d[e]:d[e]=a.apply(this,arguments)}};b.delay=function(a,b){var d=i.call(arguments,2);return setTimeout(function(){return a.apply(a,d)},b)};b.defer=function(a){return b.delay.apply(b,[a,1].concat(i.call(arguments,1)))};b.throttle=function(a,c){var d,e,f,g,h,i=b.debounce(function(){h=g=false},c);return function(){d=this;e=arguments;var b;f||(f=setTimeout(function(){f=null;h&&a.apply(d,e);i()},c)) [...]
+a.apply(d,e);i();g=true}};b.debounce=function(a,b){var d;return function(){var e=this,f=arguments;clearTimeout(d);d=setTimeout(function(){d=null;a.apply(e,f)},b)}};b.once=function(a){var b=false,d;return function(){if(b)return d;b=true;return d=a.apply(this,arguments)}};b.wrap=function(a,b){return function(){var d=[a].concat(i.call(arguments,0));return b.apply(this,d)}};b.compose=function(){var a=arguments;return function(){for(var b=arguments,d=a.length-1;d>=0;d--)b=[a[d].apply(this,b)] [...]
+b.after=function(a,b){return a<=0?b():function(){if(--a<1)return b.apply(this,arguments)}};b.keys=J||function(a){if(a!==Object(a))throw new TypeError("Invalid object");var c=[],d;for(d in a)b.has(a,d)&&(c[c.length]=d);return c};b.values=function(a){return b.map(a,b.identity)};b.functions=b.methods=function(a){var c=[],d;for(d in a)b.isFunction(a[d])&&c.push(d);return c.sort()};b.extend=function(a){j(i.call(arguments,1),function(b){for(var d in b)a[d]=b[d]});return a};b.defaults=function( [...]
+1),function(b){for(var d in b)a[d]==null&&(a[d]=b[d])});return a};b.clone=function(a){return!b.isObject(a)?a:b.isArray(a)?a.slice():b.extend({},a)};b.tap=function(a,b){b(a);return a};b.isEqual=function(a,b){return q(a,b,[])};b.isEmpty=function(a){if(b.isArray(a)||b.isString(a))return a.length===0;for(var c in a)if(b.has(a,c))return false;return true};b.isElement=function(a){return!!(a&&a.nodeType==1)};b.isArray=o||function(a){return l.call(a)=="[object Array]"};b.isObject=function(a){ret [...]
+b.isArguments=function(a){return l.call(a)=="[object Arguments]"};if(!b.isArguments(arguments))b.isArguments=function(a){return!(!a||!b.has(a,"callee"))};b.isFunction=function(a){return l.call(a)=="[object Function]"};b.isString=function(a){return l.call(a)=="[object String]"};b.isNumber=function(a){return l.call(a)=="[object Number]"};b.isNaN=function(a){return a!==a};b.isBoolean=function(a){return a===true||a===false||l.call(a)=="[object Boolean]"};b.isDate=function(a){return l.call(a) [...]
+b.isRegExp=function(a){return l.call(a)=="[object RegExp]"};b.isNull=function(a){return a===null};b.isUndefined=function(a){return a===void 0};b.has=function(a,b){return I.call(a,b)};b.noConflict=function(){r._=G;return this};b.identity=function(a){return a};b.times=function(a,b,d){for(var e=0;e<a;e++)b.call(d,e)};b.escape=function(a){return(""+a).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'").replace(/\//g,"/")};b.mixin [...]
+function(c){K(c,b[c]=a[c])})};var L=0;b.uniqueId=function(a){var b=L++;return a?a+b:b};b.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var t=/.^/,u=function(a){return a.replace(/\\\\/g,"\\").replace(/\\'/g,"'")};b.template=function(a,c){var d=b.templateSettings,d="var __p=[],print=function(){__p.push.apply(__p,arguments);};with(obj||{}){__p.push('"+a.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(d.escape||t,function(a,b){return [...]
+u(b)+"),'"}).replace(d.interpolate||t,function(a,b){return"',"+u(b)+",'"}).replace(d.evaluate||t,function(a,b){return"');"+u(b).replace(/[\r\n\t]/g," ")+";__p.push('"}).replace(/\r/g,"\\r").replace(/\n/g,"\\n").replace(/\t/g,"\\t")+"');}return __p.join('');",e=new Function("obj","_",d);return c?e(c,b):function(a){return e.call(this,a,b)}};b.chain=function(a){return b(a).chain()};var m=function(a){this._wrapped=a};b.prototype=m.prototype;var v=function(a,c){return c?b(a).chain():a},K=func [...]
+function(){var a=i.call(arguments);H.call(a,this._wrapped);return v(c.apply(b,a),this._chain)}};b.mixin(b);j("pop,push,reverse,shift,sort,splice,unshift".split(","),function(a){var b=k[a];m.prototype[a]=function(){var d=this._wrapped;b.apply(d,arguments);var e=d.length;(a=="shift"||a=="splice")&&e===0&&delete d[0];return v(d,this._chain)}});j(["concat","join","slice"],function(a){var b=k[a];m.prototype[a]=function(){return v(b.apply(this._wrapped,arguments),this._chain)}});m.prototype.ch [...]
+true;return this};m.prototype.value=function(){return this._wrapped}}).call(this);
diff --git a/public/javascripts/vendor/underscore.js b/public/javascripts/vendor/underscore.js
new file mode 100644
index 0000000..208d4cd
--- /dev/null
+++ b/public/javascripts/vendor/underscore.js
@@ -0,0 +1,999 @@
+// Underscore.js 1.3.1
+// (c) 2009-2012 Jeremy Ashkenas, DocumentCloud Inc.
+// Underscore is freely distributable under the MIT license.
+// Portions of Underscore are inspired or borrowed from Prototype,
+// Oliver Steele's Functional, and John Resig's Micro-Templating.
+// For all details and documentation:
+// http://documentcloud.github.com/underscore
+
+(function() {
+
+ // Baseline setup
+ // --------------
+
+ // Establish the root object, `window` in the browser, or `global` on the server.
+ var root = this;
+
+ // Save the previous value of the `_` variable.
+ var previousUnderscore = root._;
+
+ // Establish the object that gets returned to break out of a loop iteration.
+ var breaker = {};
+
+ // Save bytes in the minified (but not gzipped) version:
+ var ArrayProto = Array.prototype, ObjProto = Object.prototype, FuncProto = Function.prototype;
+
+ // Create quick reference variables for speed access to core prototypes.
+ var slice = ArrayProto.slice,
+ unshift = ArrayProto.unshift,
+ toString = ObjProto.toString,
+ hasOwnProperty = ObjProto.hasOwnProperty;
+
+ // All **ECMAScript 5** native function implementations that we hope to use
+ // are declared here.
+ var
+ nativeForEach = ArrayProto.forEach,
+ nativeMap = ArrayProto.map,
+ nativeReduce = ArrayProto.reduce,
+ nativeReduceRight = ArrayProto.reduceRight,
+ nativeFilter = ArrayProto.filter,
+ nativeEvery = ArrayProto.every,
+ nativeSome = ArrayProto.some,
+ nativeIndexOf = ArrayProto.indexOf,
+ nativeLastIndexOf = ArrayProto.lastIndexOf,
+ nativeIsArray = Array.isArray,
+ nativeKeys = Object.keys,
+ nativeBind = FuncProto.bind;
+
+ // Create a safe reference to the Underscore object for use below.
+ var _ = function(obj) { return new wrapper(obj); };
+
+ // Export the Underscore object for **Node.js**, with
+ // backwards-compatibility for the old `require()` API. If we're in
+ // the browser, add `_` as a global object via a string identifier,
+ // for Closure Compiler "advanced" mode.
+ if (typeof exports !== 'undefined') {
+ if (typeof module !== 'undefined' && module.exports) {
+ exports = module.exports = _;
+ }
+ exports._ = _;
+ } else {
+ root['_'] = _;
+ }
+
+ // Current version.
+ _.VERSION = '1.3.1';
+
+ // Collection Functions
+ // --------------------
+
+ // The cornerstone, an `each` implementation, aka `forEach`.
+ // Handles objects with the built-in `forEach`, arrays, and raw objects.
+ // Delegates to **ECMAScript 5**'s native `forEach` if available.
+ var each = _.each = _.forEach = function(obj, iterator, context) {
+ if (obj == null) return;
+ if (nativeForEach && obj.forEach === nativeForEach) {
+ obj.forEach(iterator, context);
+ } else if (obj.length === +obj.length) {
+ for (var i = 0, l = obj.length; i < l; i++) {
+ if (i in obj && iterator.call(context, obj[i], i, obj) === breaker) return;
+ }
+ } else {
+ for (var key in obj) {
+ if (_.has(obj, key)) {
+ if (iterator.call(context, obj[key], key, obj) === breaker) return;
+ }
+ }
+ }
+ };
+
+ // Return the results of applying the iterator to each element.
+ // Delegates to **ECMAScript 5**'s native `map` if available.
+ _.map = _.collect = function(obj, iterator, context) {
+ var results = [];
+ if (obj == null) return results;
+ if (nativeMap && obj.map === nativeMap) return obj.map(iterator, context);
+ each(obj, function(value, index, list) {
+ results[results.length] = iterator.call(context, value, index, list);
+ });
+ if (obj.length === +obj.length) results.length = obj.length;
+ return results;
+ };
+
+ // **Reduce** builds up a single result from a list of values, aka `inject`,
+ // or `foldl`. Delegates to **ECMAScript 5**'s native `reduce` if available.
+ _.reduce = _.foldl = _.inject = function(obj, iterator, memo, context) {
+ var initial = arguments.length > 2;
+ if (obj == null) obj = [];
+ if (nativeReduce && obj.reduce === nativeReduce) {
+ if (context) iterator = _.bind(iterator, context);
+ return initial ? obj.reduce(iterator, memo) : obj.reduce(iterator);
+ }
+ each(obj, function(value, index, list) {
+ if (!initial) {
+ memo = value;
+ initial = true;
+ } else {
+ memo = iterator.call(context, memo, value, index, list);
+ }
+ });
+ if (!initial) throw new TypeError('Reduce of empty array with no initial value');
+ return memo;
+ };
+
+ // The right-associative version of reduce, also known as `foldr`.
+ // Delegates to **ECMAScript 5**'s native `reduceRight` if available.
+ _.reduceRight = _.foldr = function(obj, iterator, memo, context) {
+ var initial = arguments.length > 2;
+ if (obj == null) obj = [];
+ if (nativeReduceRight && obj.reduceRight === nativeReduceRight) {
+ if (context) iterator = _.bind(iterator, context);
+ return initial ? obj.reduceRight(iterator, memo) : obj.reduceRight(iterator);
+ }
+ var reversed = _.toArray(obj).reverse();
+ if (context && !initial) iterator = _.bind(iterator, context);
+ return initial ? _.reduce(reversed, iterator, memo, context) : _.reduce(reversed, iterator);
+ };
+
+ // Return the first value which passes a truth test. Aliased as `detect`.
+ _.find = _.detect = function(obj, iterator, context) {
+ var result;
+ any(obj, function(value, index, list) {
+ if (iterator.call(context, value, index, list)) {
+ result = value;
+ return true;
+ }
+ });
+ return result;
+ };
+
+ // Return all the elements that pass a truth test.
+ // Delegates to **ECMAScript 5**'s native `filter` if available.
+ // Aliased as `select`.
+ _.filter = _.select = function(obj, iterator, context) {
+ var results = [];
+ if (obj == null) return results;
+ if (nativeFilter && obj.filter === nativeFilter) return obj.filter(iterator, context);
+ each(obj, function(value, index, list) {
+ if (iterator.call(context, value, index, list)) results[results.length] = value;
+ });
+ return results;
+ };
+
+ // Return all the elements for which a truth test fails.
+ _.reject = function(obj, iterator, context) {
+ var results = [];
+ if (obj == null) return results;
+ each(obj, function(value, index, list) {
+ if (!iterator.call(context, value, index, list)) results[results.length] = value;
+ });
+ return results;
+ };
+
+ // Determine whether all of the elements match a truth test.
+ // Delegates to **ECMAScript 5**'s native `every` if available.
+ // Aliased as `all`.
+ _.every = _.all = function(obj, iterator, context) {
+ var result = true;
+ if (obj == null) return result;
+ if (nativeEvery && obj.every === nativeEvery) return obj.every(iterator, context);
+ each(obj, function(value, index, list) {
+ if (!(result = result && iterator.call(context, value, index, list))) return breaker;
+ });
+ return result;
+ };
+
+ // Determine if at least one element in the object matches a truth test.
+ // Delegates to **ECMAScript 5**'s native `some` if available.
+ // Aliased as `any`.
+ var any = _.some = _.any = function(obj, iterator, context) {
+ iterator || (iterator = _.identity);
+ var result = false;
+ if (obj == null) return result;
+ if (nativeSome && obj.some === nativeSome) return obj.some(iterator, context);
+ each(obj, function(value, index, list) {
+ if (result || (result = iterator.call(context, value, index, list))) return breaker;
+ });
+ return !!result;
+ };
+
+ // Determine if a given value is included in the array or object using `===`.
+ // Aliased as `contains`.
+ _.include = _.contains = function(obj, target) {
+ var found = false;
+ if (obj == null) return found;
+ if (nativeIndexOf && obj.indexOf === nativeIndexOf) return obj.indexOf(target) != -1;
+ found = any(obj, function(value) {
+ return value === target;
+ });
+ return found;
+ };
+
+ // Invoke a method (with arguments) on every item in a collection.
+ _.invoke = function(obj, method) {
+ var args = slice.call(arguments, 2);
+ return _.map(obj, function(value) {
+ return (_.isFunction(method) ? method || value : value[method]).apply(value, args);
+ });
+ };
+
+ // Convenience version of a common use case of `map`: fetching a property.
+ _.pluck = function(obj, key) {
+ return _.map(obj, function(value){ return value[key]; });
+ };
+
+ // Return the maximum element or (element-based computation).
+ _.max = function(obj, iterator, context) {
+ if (!iterator && _.isArray(obj)) return Math.max.apply(Math, obj);
+ if (!iterator && _.isEmpty(obj)) return -Infinity;
+ var result = {computed : -Infinity};
+ each(obj, function(value, index, list) {
+ var computed = iterator ? iterator.call(context, value, index, list) : value;
+ computed >= result.computed && (result = {value : value, computed : computed});
+ });
+ return result.value;
+ };
+
+ // Return the minimum element (or element-based computation).
+ _.min = function(obj, iterator, context) {
+ if (!iterator && _.isArray(obj)) return Math.min.apply(Math, obj);
+ if (!iterator && _.isEmpty(obj)) return Infinity;
+ var result = {computed : Infinity};
+ each(obj, function(value, index, list) {
+ var computed = iterator ? iterator.call(context, value, index, list) : value;
+ computed < result.computed && (result = {value : value, computed : computed});
+ });
+ return result.value;
+ };
+
+ // Shuffle an array.
+ _.shuffle = function(obj) {
+ var shuffled = [], rand;
+ each(obj, function(value, index, list) {
+ if (index == 0) {
+ shuffled[0] = value;
+ } else {
+ rand = Math.floor(Math.random() * (index + 1));
+ shuffled[index] = shuffled[rand];
+ shuffled[rand] = value;
+ }
+ });
+ return shuffled;
+ };
+
+ // Sort the object's values by a criterion produced by an iterator.
+ _.sortBy = function(obj, iterator, context) {
+ return _.pluck(_.map(obj, function(value, index, list) {
+ return {
+ value : value,
+ criteria : iterator.call(context, value, index, list)
+ };
+ }).sort(function(left, right) {
+ var a = left.criteria, b = right.criteria;
+ return a < b ? -1 : a > b ? 1 : 0;
+ }), 'value');
+ };
+
+ // Groups the object's values by a criterion. Pass either a string attribute
+ // to group by, or a function that returns the criterion.
+ _.groupBy = function(obj, val) {
+ var result = {};
+ var iterator = _.isFunction(val) ? val : function(obj) { return obj[val]; };
+ each(obj, function(value, index) {
+ var key = iterator(value, index);
+ (result[key] || (result[key] = [])).push(value);
+ });
+ return result;
+ };
+
+ // Use a comparator function to figure out at what index an object should
+ // be inserted so as to maintain order. Uses binary search.
+ _.sortedIndex = function(array, obj, iterator) {
+ iterator || (iterator = _.identity);
+ var low = 0, high = array.length;
+ while (low < high) {
+ var mid = (low + high) >> 1;
+ iterator(array[mid]) < iterator(obj) ? low = mid + 1 : high = mid;
+ }
+ return low;
+ };
+
+ // Safely convert anything iterable into a real, live array.
+ _.toArray = function(iterable) {
+ if (!iterable) return [];
+ if (iterable.toArray) return iterable.toArray();
+ if (_.isArray(iterable)) return slice.call(iterable);
+ if (_.isArguments(iterable)) return slice.call(iterable);
+ return _.values(iterable);
+ };
+
+ // Return the number of elements in an object.
+ _.size = function(obj) {
+ return _.toArray(obj).length;
+ };
+
+ // Array Functions
+ // ---------------
+
+ // Get the first element of an array. Passing **n** will return the first N
+ // values in the array. Aliased as `head`. The **guard** check allows it to work
+ // with `_.map`.
+ _.first = _.head = function(array, n, guard) {
+ return (n != null) && !guard ? slice.call(array, 0, n) : array[0];
+ };
+
+ // Returns everything but the last entry of the array. Especcialy useful on
+ // the arguments object. Passing **n** will return all the values in
+ // the array, excluding the last N. The **guard** check allows it to work with
+ // `_.map`.
+ _.initial = function(array, n, guard) {
+ return slice.call(array, 0, array.length - ((n == null) || guard ? 1 : n));
+ };
+
+ // Get the last element of an array. Passing **n** will return the last N
+ // values in the array. The **guard** check allows it to work with `_.map`.
+ _.last = function(array, n, guard) {
+ if ((n != null) && !guard) {
+ return slice.call(array, Math.max(array.length - n, 0));
+ } else {
+ return array[array.length - 1];
+ }
+ };
+
+ // Returns everything but the first entry of the array. Aliased as `tail`.
+ // Especially useful on the arguments object. Passing an **index** will return
+ // the rest of the values in the array from that index onward. The **guard**
+ // check allows it to work with `_.map`.
+ _.rest = _.tail = function(array, index, guard) {
+ return slice.call(array, (index == null) || guard ? 1 : index);
+ };
+
+ // Trim out all falsy values from an array.
+ _.compact = function(array) {
+ return _.filter(array, function(value){ return !!value; });
+ };
+
+ // Return a completely flattened version of an array.
+ _.flatten = function(array, shallow) {
+ return _.reduce(array, function(memo, value) {
+ if (_.isArray(value)) return memo.concat(shallow ? value : _.flatten(value));
+ memo[memo.length] = value;
+ return memo;
+ }, []);
+ };
+
+ // Return a version of the array that does not contain the specified value(s).
+ _.without = function(array) {
+ return _.difference(array, slice.call(arguments, 1));
+ };
+
+ // Produce a duplicate-free version of the array. If the array has already
+ // been sorted, you have the option of using a faster algorithm.
+ // Aliased as `unique`.
+ _.uniq = _.unique = function(array, isSorted, iterator) {
+ var initial = iterator ? _.map(array, iterator) : array;
+ var result = [];
+ _.reduce(initial, function(memo, el, i) {
+ if (0 == i || (isSorted === true ? _.last(memo) != el : !_.include(memo, el))) {
+ memo[memo.length] = el;
+ result[result.length] = array[i];
+ }
+ return memo;
+ }, []);
+ return result;
+ };
+
+ // Produce an array that contains the union: each distinct element from all of
+ // the passed-in arrays.
+ _.union = function() {
+ return _.uniq(_.flatten(arguments, true));
+ };
+
+ // Produce an array that contains every item shared between all the
+ // passed-in arrays. (Aliased as "intersect" for back-compat.)
+ _.intersection = _.intersect = function(array) {
+ var rest = slice.call(arguments, 1);
+ return _.filter(_.uniq(array), function(item) {
+ return _.every(rest, function(other) {
+ return _.indexOf(other, item) >= 0;
+ });
+ });
+ };
+
+ // Take the difference between one array and a number of other arrays.
+ // Only the elements present in just the first array will remain.
+ _.difference = function(array) {
+ var rest = _.flatten(slice.call(arguments, 1));
+ return _.filter(array, function(value){ return !_.include(rest, value); });
+ };
+
+ // Zip together multiple lists into a single array -- elements that share
+ // an index go together.
+ _.zip = function() {
+ var args = slice.call(arguments);
+ var length = _.max(_.pluck(args, 'length'));
+ var results = new Array(length);
+ for (var i = 0; i < length; i++) results[i] = _.pluck(args, "" + i);
+ return results;
+ };
+
+ // If the browser doesn't supply us with indexOf (I'm looking at you, **MSIE**),
+ // we need this function. Return the position of the first occurrence of an
+ // item in an array, or -1 if the item is not included in the array.
+ // Delegates to **ECMAScript 5**'s native `indexOf` if available.
+ // If the array is large and already in sort order, pass `true`
+ // for **isSorted** to use binary search.
+ _.indexOf = function(array, item, isSorted) {
+ if (array == null) return -1;
+ var i, l;
+ if (isSorted) {
+ i = _.sortedIndex(array, item);
+ return array[i] === item ? i : -1;
+ }
+ if (nativeIndexOf && array.indexOf === nativeIndexOf) return array.indexOf(item);
+ for (i = 0, l = array.length; i < l; i++) if (i in array && array[i] === item) return i;
+ return -1;
+ };
+
+ // Delegates to **ECMAScript 5**'s native `lastIndexOf` if available.
+ _.lastIndexOf = function(array, item) {
+ if (array == null) return -1;
+ if (nativeLastIndexOf && array.lastIndexOf === nativeLastIndexOf) return array.lastIndexOf(item);
+ var i = array.length;
+ while (i--) if (i in array && array[i] === item) return i;
+ return -1;
+ };
+
+ // Generate an integer Array containing an arithmetic progression. A port of
+ // the native Python `range()` function. See
+ // [the Python documentation](http://docs.python.org/library/functions.html#range).
+ _.range = function(start, stop, step) {
+ if (arguments.length <= 1) {
+ stop = start || 0;
+ start = 0;
+ }
+ step = arguments[2] || 1;
+
+ var len = Math.max(Math.ceil((stop - start) / step), 0);
+ var idx = 0;
+ var range = new Array(len);
+
+ while(idx < len) {
+ range[idx++] = start;
+ start += step;
+ }
+
+ return range;
+ };
+
+ // Function (ahem) Functions
+ // ------------------
+
+ // Reusable constructor function for prototype setting.
+ var ctor = function(){};
+
+ // Create a function bound to a given object (assigning `this`, and arguments,
+ // optionally). Binding with arguments is also known as `curry`.
+ // Delegates to **ECMAScript 5**'s native `Function.bind` if available.
+ // We check for `func.bind` first, to fail fast when `func` is undefined.
+ _.bind = function bind(func, context) {
+ var bound, args;
+ if (func.bind === nativeBind && nativeBind) return nativeBind.apply(func, slice.call(arguments, 1));
+ if (!_.isFunction(func)) throw new TypeError;
+ args = slice.call(arguments, 2);
+ return bound = function() {
+ if (!(this instanceof bound)) return func.apply(context, args.concat(slice.call(arguments)));
+ ctor.prototype = func.prototype;
+ var self = new ctor;
+ var result = func.apply(self, args.concat(slice.call(arguments)));
+ if (Object(result) === result) return result;
+ return self;
+ };
+ };
+
+ // Bind all of an object's methods to that object. Useful for ensuring that
+ // all callbacks defined on an object belong to it.
+ _.bindAll = function(obj) {
+ var funcs = slice.call(arguments, 1);
+ if (funcs.length == 0) funcs = _.functions(obj);
+ each(funcs, function(f) { obj[f] = _.bind(obj[f], obj); });
+ return obj;
+ };
+
+ // Memoize an expensive function by storing its results.
+ _.memoize = function(func, hasher) {
+ var memo = {};
+ hasher || (hasher = _.identity);
+ return function() {
+ var key = hasher.apply(this, arguments);
+ return _.has(memo, key) ? memo[key] : (memo[key] = func.apply(this, arguments));
+ };
+ };
+
+ // Delays a function for the given number of milliseconds, and then calls
+ // it with the arguments supplied.
+ _.delay = function(func, wait) {
+ var args = slice.call(arguments, 2);
+ return setTimeout(function(){ return func.apply(func, args); }, wait);
+ };
+
+ // Defers a function, scheduling it to run after the current call stack has
+ // cleared.
+ _.defer = function(func) {
+ return _.delay.apply(_, [func, 1].concat(slice.call(arguments, 1)));
+ };
+
+ // Returns a function, that, when invoked, will only be triggered at most once
+ // during a given window of time.
+ _.throttle = function(func, wait) {
+ var context, args, timeout, throttling, more;
+ var whenDone = _.debounce(function(){ more = throttling = false; }, wait);
+ return function() {
+ context = this; args = arguments;
+ var later = function() {
+ timeout = null;
+ if (more) func.apply(context, args);
+ whenDone();
+ };
+ if (!timeout) timeout = setTimeout(later, wait);
+ if (throttling) {
+ more = true;
+ } else {
+ func.apply(context, args);
+ }
+ whenDone();
+ throttling = true;
+ };
+ };
+
+ // Returns a function, that, as long as it continues to be invoked, will not
+ // be triggered. The function will be called after it stops being called for
+ // N milliseconds.
+ _.debounce = function(func, wait) {
+ var timeout;
+ return function() {
+ var context = this, args = arguments;
+ var later = function() {
+ timeout = null;
+ func.apply(context, args);
+ };
+ clearTimeout(timeout);
+ timeout = setTimeout(later, wait);
+ };
+ };
+
+ // Returns a function that will be executed at most one time, no matter how
+ // often you call it. Useful for lazy initialization.
+ _.once = function(func) {
+ var ran = false, memo;
+ return function() {
+ if (ran) return memo;
+ ran = true;
+ return memo = func.apply(this, arguments);
+ };
+ };
+
+ // Returns the first function passed as an argument to the second,
+ // allowing you to adjust arguments, run code before and after, and
+ // conditionally execute the original function.
+ _.wrap = function(func, wrapper) {
+ return function() {
+ var args = [func].concat(slice.call(arguments, 0));
+ return wrapper.apply(this, args);
+ };
+ };
+
+ // Returns a function that is the composition of a list of functions, each
+ // consuming the return value of the function that follows.
+ _.compose = function() {
+ var funcs = arguments;
+ return function() {
+ var args = arguments;
+ for (var i = funcs.length - 1; i >= 0; i--) {
+ args = [funcs[i].apply(this, args)];
+ }
+ return args[0];
+ };
+ };
+
+ // Returns a function that will only be executed after being called N times.
+ _.after = function(times, func) {
+ if (times <= 0) return func();
+ return function() {
+ if (--times < 1) { return func.apply(this, arguments); }
+ };
+ };
+
+ // Object Functions
+ // ----------------
+
+ // Retrieve the names of an object's properties.
+ // Delegates to **ECMAScript 5**'s native `Object.keys`
+ _.keys = nativeKeys || function(obj) {
+ if (obj !== Object(obj)) throw new TypeError('Invalid object');
+ var keys = [];
+ for (var key in obj) if (_.has(obj, key)) keys[keys.length] = key;
+ return keys;
+ };
+
+ // Retrieve the values of an object's properties.
+ _.values = function(obj) {
+ return _.map(obj, _.identity);
+ };
+
+ // Return a sorted list of the function names available on the object.
+ // Aliased as `methods`
+ _.functions = _.methods = function(obj) {
+ var names = [];
+ for (var key in obj) {
+ if (_.isFunction(obj[key])) names.push(key);
+ }
+ return names.sort();
+ };
+
+ // Extend a given object with all the properties in passed-in object(s).
+ _.extend = function(obj) {
+ each(slice.call(arguments, 1), function(source) {
+ for (var prop in source) {
+ obj[prop] = source[prop];
+ }
+ });
+ return obj;
+ };
+
+ // Fill in a given object with default properties.
+ _.defaults = function(obj) {
+ each(slice.call(arguments, 1), function(source) {
+ for (var prop in source) {
+ if (obj[prop] == null) obj[prop] = source[prop];
+ }
+ });
+ return obj;
+ };
+
+ // Create a (shallow-cloned) duplicate of an object.
+ _.clone = function(obj) {
+ if (!_.isObject(obj)) return obj;
+ return _.isArray(obj) ? obj.slice() : _.extend({}, obj);
+ };
+
+ // Invokes interceptor with the obj, and then returns obj.
+ // The primary purpose of this method is to "tap into" a method chain, in
+ // order to perform operations on intermediate results within the chain.
+ _.tap = function(obj, interceptor) {
+ interceptor(obj);
+ return obj;
+ };
+
+ // Internal recursive comparison function.
+ function eq(a, b, stack) {
+ // Identical objects are equal. `0 === -0`, but they aren't identical.
+ // See the Harmony `egal` proposal: http://wiki.ecmascript.org/doku.php?id=harmony:egal.
+ if (a === b) return a !== 0 || 1 / a == 1 / b;
+ // A strict comparison is necessary because `null == undefined`.
+ if (a == null || b == null) return a === b;
+ // Unwrap any wrapped objects.
+ if (a._chain) a = a._wrapped;
+ if (b._chain) b = b._wrapped;
+ // Invoke a custom `isEqual` method if one is provided.
+ if (a.isEqual && _.isFunction(a.isEqual)) return a.isEqual(b);
+ if (b.isEqual && _.isFunction(b.isEqual)) return b.isEqual(a);
+ // Compare `[[Class]]` names.
+ var className = toString.call(a);
+ if (className != toString.call(b)) return false;
+ switch (className) {
+ // Strings, numbers, dates, and booleans are compared by value.
+ case '[object String]':
+ // Primitives and their corresponding object wrappers are equivalent; thus, `"5"` is
+ // equivalent to `new String("5")`.
+ return a == String(b);
+ case '[object Number]':
+ // `NaN`s are equivalent, but non-reflexive. An `egal` comparison is performed for
+ // other numeric values.
+ return a != +a ? b != +b : (a == 0 ? 1 / a == 1 / b : a == +b);
+ case '[object Date]':
+ case '[object Boolean]':
+ // Coerce dates and booleans to numeric primitive values. Dates are compared by their
+ // millisecond representations. Note that invalid dates with millisecond representations
+ // of `NaN` are not equivalent.
+ return +a == +b;
+ // RegExps are compared by their source patterns and flags.
+ case '[object RegExp]':
+ return a.source == b.source &&
+ a.global == b.global &&
+ a.multiline == b.multiline &&
+ a.ignoreCase == b.ignoreCase;
+ }
+ if (typeof a != 'object' || typeof b != 'object') return false;
+ // Assume equality for cyclic structures. The algorithm for detecting cyclic
+ // structures is adapted from ES 5.1 section 15.12.3, abstract operation `JO`.
+ var length = stack.length;
+ while (length--) {
+ // Linear search. Performance is inversely proportional to the number of
+ // unique nested structures.
+ if (stack[length] == a) return true;
+ }
+ // Add the first object to the stack of traversed objects.
+ stack.push(a);
+ var size = 0, result = true;
+ // Recursively compare objects and arrays.
+ if (className == '[object Array]') {
+ // Compare array lengths to determine if a deep comparison is necessary.
+ size = a.length;
+ result = size == b.length;
+ if (result) {
+ // Deep compare the contents, ignoring non-numeric properties.
+ while (size--) {
+ // Ensure commutative equality for sparse arrays.
+ if (!(result = size in a == size in b && eq(a[size], b[size], stack))) break;
+ }
+ }
+ } else {
+ // Objects with different constructors are not equivalent.
+ if ('constructor' in a != 'constructor' in b || a.constructor != b.constructor) return false;
+ // Deep compare objects.
+ for (var key in a) {
+ if (_.has(a, key)) {
+ // Count the expected number of properties.
+ size++;
+ // Deep compare each member.
+ if (!(result = _.has(b, key) && eq(a[key], b[key], stack))) break;
+ }
+ }
+ // Ensure that both objects contain the same number of properties.
+ if (result) {
+ for (key in b) {
+ if (_.has(b, key) && !(size--)) break;
+ }
+ result = !size;
+ }
+ }
+ // Remove the first object from the stack of traversed objects.
+ stack.pop();
+ return result;
+ }
+
+ // Perform a deep comparison to check if two objects are equal.
+ _.isEqual = function(a, b) {
+ return eq(a, b, []);
+ };
+
+ // Is a given array, string, or object empty?
+ // An "empty" object has no enumerable own-properties.
+ _.isEmpty = function(obj) {
+ if (_.isArray(obj) || _.isString(obj)) return obj.length === 0;
+ for (var key in obj) if (_.has(obj, key)) return false;
+ return true;
+ };
+
+ // Is a given value a DOM element?
+ _.isElement = function(obj) {
+ return !!(obj && obj.nodeType == 1);
+ };
+
+ // Is a given value an array?
+ // Delegates to ECMA5's native Array.isArray
+ _.isArray = nativeIsArray || function(obj) {
+ return toString.call(obj) == '[object Array]';
+ };
+
+ // Is a given variable an object?
+ _.isObject = function(obj) {
+ return obj === Object(obj);
+ };
+
+ // Is a given variable an arguments object?
+ _.isArguments = function(obj) {
+ return toString.call(obj) == '[object Arguments]';
+ };
+ if (!_.isArguments(arguments)) {
+ _.isArguments = function(obj) {
+ return !!(obj && _.has(obj, 'callee'));
+ };
+ }
+
+ // Is a given value a function?
+ _.isFunction = function(obj) {
+ return toString.call(obj) == '[object Function]';
+ };
+
+ // Is a given value a string?
+ _.isString = function(obj) {
+ return toString.call(obj) == '[object String]';
+ };
+
+ // Is a given value a number?
+ _.isNumber = function(obj) {
+ return toString.call(obj) == '[object Number]';
+ };
+
+ // Is the given value `NaN`?
+ _.isNaN = function(obj) {
+ // `NaN` is the only value for which `===` is not reflexive.
+ return obj !== obj;
+ };
+
+ // Is a given value a boolean?
+ _.isBoolean = function(obj) {
+ return obj === true || obj === false || toString.call(obj) == '[object Boolean]';
+ };
+
+ // Is a given value a date?
+ _.isDate = function(obj) {
+ return toString.call(obj) == '[object Date]';
+ };
+
+ // Is the given value a regular expression?
+ _.isRegExp = function(obj) {
+ return toString.call(obj) == '[object RegExp]';
+ };
+
+ // Is a given value equal to null?
+ _.isNull = function(obj) {
+ return obj === null;
+ };
+
+ // Is a given variable undefined?
+ _.isUndefined = function(obj) {
+ return obj === void 0;
+ };
+
+ // Has own property?
+ _.has = function(obj, key) {
+ return hasOwnProperty.call(obj, key);
+ };
+
+ // Utility Functions
+ // -----------------
+
+ // Run Underscore.js in *noConflict* mode, returning the `_` variable to its
+ // previous owner. Returns a reference to the Underscore object.
+ _.noConflict = function() {
+ root._ = previousUnderscore;
+ return this;
+ };
+
+ // Keep the identity function around for default iterators.
+ _.identity = function(value) {
+ return value;
+ };
+
+ // Run a function **n** times.
+ _.times = function (n, iterator, context) {
+ for (var i = 0; i < n; i++) iterator.call(context, i);
+ };
+
+ // Escape a string for HTML interpolation.
+ _.escape = function(string) {
+ return (''+string).replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"').replace(/'/g, ''').replace(/\//g,'/');
+ };
+
+ // Add your own custom functions to the Underscore object, ensuring that
+ // they're correctly added to the OOP wrapper as well.
+ _.mixin = function(obj) {
+ each(_.functions(obj), function(name){
+ addToWrapper(name, _[name] = obj[name]);
+ });
+ };
+
+ // Generate a unique integer id (unique within the entire client session).
+ // Useful for temporary DOM ids.
+ var idCounter = 0;
+ _.uniqueId = function(prefix) {
+ var id = idCounter++;
+ return prefix ? prefix + id : id;
+ };
+
+ // By default, Underscore uses ERB-style template delimiters, change the
+ // following template settings to use alternative delimiters.
+ _.templateSettings = {
+ evaluate : /<%([\s\S]+?)%>/g,
+ interpolate : /<%=([\s\S]+?)%>/g,
+ escape : /<%-([\s\S]+?)%>/g
+ };
+
+ // When customizing `templateSettings`, if you don't want to define an
+ // interpolation, evaluation or escaping regex, we need one that is
+ // guaranteed not to match.
+ var noMatch = /.^/;
+
+ // Within an interpolation, evaluation, or escaping, remove HTML escaping
+ // that had been previously added.
+ var unescape = function(code) {
+ return code.replace(/\\\\/g, '\\').replace(/\\'/g, "'");
+ };
+
+ // JavaScript micro-templating, similar to John Resig's implementation.
+ // Underscore templating handles arbitrary delimiters, preserves whitespace,
+ // and correctly escapes quotes within interpolated code.
+ _.template = function(str, data) {
+ var c = _.templateSettings;
+ var tmpl = 'var __p=[],print=function(){__p.push.apply(__p,arguments);};' +
+ 'with(obj||{}){__p.push(\'' +
+ str.replace(/\\/g, '\\\\')
+ .replace(/'/g, "\\'")
+ .replace(c.escape || noMatch, function(match, code) {
+ return "',_.escape(" + unescape(code) + "),'";
+ })
+ .replace(c.interpolate || noMatch, function(match, code) {
+ return "'," + unescape(code) + ",'";
+ })
+ .replace(c.evaluate || noMatch, function(match, code) {
+ return "');" + unescape(code).replace(/[\r\n\t]/g, ' ') + ";__p.push('";
+ })
+ .replace(/\r/g, '\\r')
+ .replace(/\n/g, '\\n')
+ .replace(/\t/g, '\\t')
+ + "');}return __p.join('');";
+ var func = new Function('obj', '_', tmpl);
+ if (data) return func(data, _);
+ return function(data) {
+ return func.call(this, data, _);
+ };
+ };
+
+ // Add a "chain" function, which will delegate to the wrapper.
+ _.chain = function(obj) {
+ return _(obj).chain();
+ };
+
+ // The OOP Wrapper
+ // ---------------
+
+ // If Underscore is called as a function, it returns a wrapped object that
+ // can be used OO-style. This wrapper holds altered versions of all the
+ // underscore functions. Wrapped objects may be chained.
+ var wrapper = function(obj) { this._wrapped = obj; };
+
+ // Expose `wrapper.prototype` as `_.prototype`
+ _.prototype = wrapper.prototype;
+
+ // Helper function to continue chaining intermediate results.
+ var result = function(obj, chain) {
+ return chain ? _(obj).chain() : obj;
+ };
+
+ // A method to easily add functions to the OOP wrapper.
+ var addToWrapper = function(name, func) {
+ wrapper.prototype[name] = function() {
+ var args = slice.call(arguments);
+ unshift.call(args, this._wrapped);
+ return result(func.apply(_, args), this._chain);
+ };
+ };
+
+ // Add all of the Underscore functions to the wrapper object.
+ _.mixin(_);
+
+ // Add all mutator Array functions to the wrapper.
+ each(['pop', 'push', 'reverse', 'shift', 'sort', 'splice', 'unshift'], function(name) {
+ var method = ArrayProto[name];
+ wrapper.prototype[name] = function() {
+ var wrapped = this._wrapped;
+ method.apply(wrapped, arguments);
+ var length = wrapped.length;
+ if ((name == 'shift' || name == 'splice') && length === 0) delete wrapped[0];
+ return result(wrapped, this._chain);
+ };
+ });
+
+ // Add all accessor Array functions to the wrapper.
+ each(['concat', 'join', 'slice'], function(name) {
+ var method = ArrayProto[name];
+ wrapper.prototype[name] = function() {
+ return result(method.apply(this._wrapped, arguments), this._chain);
+ };
+ });
+
+ // Start chaining a wrapped Underscore object.
+ wrapper.prototype.chain = function() {
+ this._chain = true;
+ return this;
+ };
+
+ // Extracts the result from a wrapped and chained object.
+ wrapper.prototype.value = function() {
+ return this._wrapped;
+ };
+
+}).call(this);
diff --git a/public/stylesheets/timeline-setter.css b/public/stylesheets/timeline-setter.css
new file mode 100644
index 0000000..e7ccd3d
--- /dev/null
+++ b/public/stylesheets/timeline-setter.css
@@ -0,0 +1,422 @@
+.timeline_setter {
+ width:85%;
+ margin:0 auto;
+ padding:10px;
+ position:relative;
+ height:100%;
+ background-color:white;
+}
+.TS-item {
+ z-index:1;
+ position:absolute;
+ border:1px solid #EBEBEB;
+ -webkit-border-radius: 3px;
+ -moz-border-radius: 3px;
+ border-radius: 3px;
+ padding:10px;
+ background:#F7F7F7;
+ color:#333;
+ min-width: 150px;
+}
+.TS-item_user_html {
+ padding-bottom:5px;
+}
+.TS-item_label {
+ font-family:Georgia,"Times New Roman",Times,serif;
+ font-size:12px;
+ line-height:16px;
+ height:85%;
+ display:block;
+}
+.TS-item_year {
+ font-family:"Helvetica Neue",Helvetica,arial,sans-serif;
+ font-weight:bold;
+ font-size:16px;
+ padding-top:10px;
+ float:left;
+ clear:left;
+ display:block;
+ width:150px;
+}
+.TS-item_year_text {
+ float:left;
+}
+.TS-css_arrow {
+ border-style: solid;
+ height: 0px;
+ width: 0px;
+ position:relative;
+ top: 2px;
+ border-width: 10px 10px 10px 10px;
+}
+.TS-css_arrow_up {
+ border-color: transparent transparent #7C93AF transparent;
+}
+.TS-read_btn {
+ -webkit-box-shadow: #CECECE 0px 0px 2px;
+ -moz-box-shadow: #CECECE 0px 0px 2px;
+ box-shadow: #CECECE 0px 0px 2px;
+ -webkit-user-select: none;
+ background: #E9F0F8;
+ border-bottom-left-radius: 4px 4px;
+ border-bottom-right-radius: 4px 4px;
+ border-top-left-radius: 4px 4px;
+ border-top-right-radius: 4px 4px;
+ color: black;
+ cursor: pointer;
+ font-weight: bold;
+ padding: 5px;
+ margin-top:8px;
+ font-size:11px;
+ font-family:"Helvetica Neue",arial,sans-serif;
+ text-transform:uppercase;
+ font-weight:normal;
+ text-align:center;
+ display:block;
+}
+.TS-read_btn:hover {
+ color:black;cursor:pointer;text-decoration:none;background:#cecece;
+}
+.timeline_setter a {
+ text-decoration:none;
+ color:#333;
+}
+
+.TS-top_matter_container {
+ -webkit-user-select: none;
+ -khtml-user-select: none;
+ -moz-user-select: none;
+ -o-user-select: none;
+ user-select: none;
+ overflow:visible;
+}
+.TS-notchbar_container {
+ border:1px solid #cecece;
+ -webkit-box-shadow: #CECECE 0px 0px 2px;
+ -moz-box-shadow: #CECECE 0px 0px 2px;
+ box-shadow: #CECECE 0px 0px 2px;
+ background:#f7f7f7;
+ width:100%;
+ height:20px;
+ position:relative;
+ overflow:hidden;
+ clear:left;
+ -webkit-user-select: none;
+ -khtml-user-select: none;
+ -moz-user-select: none;
+ -o-user-select: none;
+ user-select: none;
+ cursor: col-resize;
+}
+.TS-card_scroller {
+ width:100%;
+ position:relative;
+ overflow:hidden;
+ height:800px; /* FIX THIS!!! */
+}
+.TS-card_scroller_inner {
+ width:100%;
+ position:relative;
+}
+.TS-notchbar {
+ height:20px;
+ position:relative;
+ width:100%;
+ margin: 0 auto;
+}
+.TS-notchbar_draggable {
+ cursor: col-resize;
+}
+.TS-notch, .TS-year_notch {
+ height:100%;
+ position:absolute;
+ color:#999;
+}
+.TS-year_notch {
+ border-left: 1px solid #999;
+}
+.TS-year_notch_year_text {
+ display:block;
+ /*
+ Arial actually looks better than Helvetica at
+ small sizes. See Comment 6 here:
+ http://www.subtraction.com/2007/11/01/the-elements#7497
+ */
+ font-family:Arial,sans-serif;
+ font-size:9px;
+ padding:2px 0 0 5px;
+}
+
+.TS-notch{
+ width:4px;
+ cursor:pointer;
+}
+.TS-card_container {
+ position:absolute;
+ margin-left:-5px;
+ z-index: 9999;
+}
+.TS-controls {
+ margin: 0 0 0 0;
+ float:right;
+ height:40px;
+ overflow:visible;
+ text-align: right;
+ width: 210px;
+}
+.TS-zoom-container {
+ width:50px;
+}
+.TS-choose-container {
+ width:155px;
+ margin-left:55px;
+ margin-top:-15px;
+}
+.TS-controls a {
+ border:1px solid #cecece;
+ background-color:#f0f0f0;
+ padding:3px 5px 3px 5px;
+ color:#444;
+ font-family:"Helvetica Neue",Arial,sans-serif;
+ font-weight:normal;
+ font-size:14px;
+ -webkit-border-radius: 2px;
+ -moz-border-radius: 2px;
+ border-radius: 2px;
+ display: inline;
+ cursor:pointer;
+ -webkit-box-shadow: #f0f0f0 0 0 2px;
+ -moz-box-shadow: #f0f0f0 0 0 2px;
+}
+.TS-controls a.TS-choose {
+ padding: 7px;
+ background: #f0f0f0;
+ -webkit-border-radius: 04px;
+ -moz-border-radius: 04px;
+ border-radius: 04px;
+ font-weight: bold;
+ cursor: pointer;
+ user-select: none;
+ -moz-user-select: none;
+ -khtml-user-select: none;
+ -webkit-user-select: none;
+ color: #444;
+ text-decoration: none;
+ margin: 3px 0 10px 0;
+ font-family: "Helvetica",Arial,sans-serif;
+ font-size: 14px;
+ text-align: center;
+}
+.TS-controls a.TS-choose:hover {
+ text-decoration: none;
+ background: #fff;
+}
+.TS-choose_next {
+ margin-left:4px;
+}
+.TS-controls a.TS-controls_disabled {
+ color:#cecece;
+ background-color:#f7f7f7;
+ cursor:default;
+}
+.TS-controls a:hover {
+ background-color:#fff;
+}
+.TS-notch_active {
+ -webkit-box-shadow: 0px 0px 10px #333;
+ -moz-box-shadow: 0px 0px 10px #333;
+ box-shadow: 0px 0px 10px #333;
+
+ /* let's throw IE7 users a bone */
+ *border: 1px solid #333;
+}
+.TS-zoom {
+ background-repeat:no-repeat;
+ background-position:center center;
+ width:20px !important;
+ padding:3px 8px 3px 8px !important;
+ margin-right:4px;
+}
+.TS-zoom_inner_text {
+ display:none;
+ /* IE7 */
+ *display:inline;
+}
+.TS-zoom_in {
+ background-image:url("data:image/gif;charset=utf-8;base64,R0lGODlhCgAKALMAADMzM//M/5GRkdXV1fDw8GZmZk1NTf////r6+gAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAEHAAEALAAAAAAKAAoAAAQpMMhJpyiihjLIKJTQGV4mFYShEqAkHIiBHKYEHHhhVAWgY5qToFZRRQAAOw==");
+}
+.TS-zoom_out {
+ background-image:url("data:image/gif;charset=utf-8;base64,R0lGODlhCgAKALMAADMzM//M/5GRkdXV1fDw8GZmZk1NTf////r6+gAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAEHAAEALAAAAAAKAAoAAAQoMMhJpyiihjLIKJTQEV4mFYShEqAkHAh8mBJw3IVRFUCOaScBraKKAAA7");
+}
+
+/* legend */
+
+.TS-series_nav_container {
+ font-family:Arial,sans-serif;
+ font-size:11px;
+ height:30px;
+ margin-left:-10px;
+ width:75%;
+}
+.TS-series_legend_swatch {
+ background-image:url("data:image/gif;charset=utf-8;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAIBJREFUeNrskksKwCAMBev9byS4UfEOoh7AA4hu9JUG2kVb+8FVoYFsQmbghTAA00ix7wumRfC0nXPYz97Ca70ThBA20hhzL7DWIsZIi957AmutB7gryDkTlFLaYKUUznZPBUIIlFIIbq1BSolevG5uzjnF0Frj6j7sf+VxwSzAAG/ifZQMhRJhAAAAAElFTkSuQmCC");
+ background-repeat:no-repeat;
+ background-position:center center;
+ width: 16px;
+ height: 16px;
+ display: block;
+ float: left;
+ -webkit-border-radius: 2px;
+ -moz-border-radius: 2px;
+ border-radius: 2px;
+ border-top-left-radius: 2px 2px;
+ border-top-right-radius: 2px 2px;
+ border-bottom-right-radius: 2px 2px;
+ border-bottom-left-radius: 2px 2px;
+ margin-right:5px;
+}
+.TS-series_legend_item {
+ float:left;
+ margin:-3px 10px 6px 10px;
+ cursor:pointer;
+}
+.TS-series_legend_item_inactive .TS-series_legend_swatch {
+ background-image:none !important;
+ filter:alpha(opacity=40); /* IE can't do data URLs, so this will serve as 'inactive' UI for series heds in IE */
+}
+.TS-item h2, .TS-img-hed {
+ font-family: 'Helvetica Neue',arial,sans-serif;
+ font-size: 18px;
+ font-weight: bold;
+ display:inline-block;
+ margin:0;
+ margin-bottom: 10px;
+ line-height:20px;
+}
+.TS-permalink {
+ font-family:"Helvetica Neue",arial,sans-serif;
+ font-size:12px;
+ color:#404040;
+ cursor:pointer;
+ padding:0 0 0 15px;
+ margin-top:-5px;
+ float:left;
+ -webkit-transform:rotate(45deg);
+ -moz-transform:rotate(45deg);
+}
+
+/* color priority */
+/* "#065718", "#EDC047", "#91ADD1", "#929E5E", "#9E5E23", "#C44846", "#465363", "#EDD4A5", "#CECECE" */
+
+/* default */
+.TS-notch_color_default,.TS-series_legend_swatch_default {
+ background-color: #444;
+}
+.TS-css_arrow_color_default {
+ border-bottom-color:#444;
+}
+.TS-item_color_default {
+ border-top:1px solid #444;
+}
+
+/* 1 */
+.TS-notch_color_1,.TS-series_legend_swatch_1 {
+ background-color: #065718 !important;
+}
+.TS-css_arrow_color_1 {
+ border-bottom-color:#065718 !important;
+}
+.TS-item_color_1 {
+ border-top:1px solid #065718 !important;
+}
+
+/* 2 */
+.TS-notch_color_2,.TS-series_legend_swatch_2 {
+ background-color: #EDC047 !important;
+}
+.TS-css_arrow_color_2 {
+ border-bottom-color:#EDC047 !important;
+}
+.TS-item_color_2 {
+ border-top:1px solid #EDC047 !important;
+}
+
+/* 3 */
+.TS-notch_color_3,.TS-series_legend_swatch_3 {
+ background-color: #91ADD1 !important;
+}
+.TS-css_arrow_color_3 {
+ border-bottom-color:#91ADD1 !important;
+}
+.TS-item_color_3 {
+ border-top:1px solid #91ADD1 !important;
+}
+
+/* 4 */
+.TS-notch_color_4,.TS-series_legend_swatch_4 {
+ background-color: #929E5E !important;
+}
+.TS-css_arrow_color_4 {
+ border-bottom-color:#929E5E !important;
+}
+.TS-item_color_4 {
+ border-top:1px solid #929E5E !important;
+}
+
+/* 5 */
+.TS-notch_color_5,.TS-series_legend_swatch_5 {
+ background-color: #9E5E23 !important;
+}
+.TS-css_arrow_color_5 {
+ border-bottom-color:#9E5E23 !important;
+}
+.TS-item_color_5 {
+ border-top:1px solid #9E5E23 !important;
+}
+
+/* 6 */
+.TS-notch_color_6,.TS-series_legend_swatch_6 {
+ background-color: #C44846 !important;
+}
+.TS-css_arrow_color_6 {
+ border-bottom-color:#C44846 !important;
+}
+.TS-item_color_6 {
+ border-top:1px solid #C44846 !important;
+}
+
+/* 7 */
+.TS-notch_color_7,.TS-series_legend_swatch_7 {
+ background-color: #465363 !important;
+}
+.TS-css_arrow_color_7 {
+ border-bottom-color:#465363 !important;
+}
+.TS-item_color_7 {
+ border-top:1px solid #465363 !important;
+}
+
+
+/* 8 */
+.TS-notch_color_8,.TS-series_legend_swatch_8 {
+ background-color: #EDD4A5 !important;
+}
+.TS-css_arrow_color_8 {
+ border-bottom-color:#EDD4A5 !important;
+}
+.TS-item_color_8 {
+ border-top:1px solid #EDD4A5 !important;
+}
+
+/* 9 */
+.TS-notch_color_9,.TS-series_legend_swatch_9 {
+ background-color: #CECECE !important;
+}
+.TS-css_arrow_color_9 {
+ border-bottom-color:#CECECE !important;
+}
+.TS-item_color_9 {
+ border-top:1px solid #CECECE !important;
+}
+
+
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
new file mode 100644
index 0000000..6b5f621
--- /dev/null
+++ b/spec/spec_helper.rb
@@ -0,0 +1,10 @@
+$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
+
+require 'rubygems'
+require 'timeline_setter'
+require 'timeline_setter/cli'
+require 'rspec'
+
+TEST_CSV_PATH = File.expand_path(File.dirname(__FILE__) + '/test_data.csv')
+TEST_CSV = File.open(TEST_CSV_PATH,'r').read
+TS_BINARY = File.expand_path('../../bin/timeline-setter',__FILE__)
\ No newline at end of file
diff --git a/spec/test_data.csv b/spec/test_data.csv
new file mode 100644
index 0000000..8244b30
--- /dev/null
+++ b/spec/test_data.csv
@@ -0,0 +1,7 @@
+date,display_date,description,link,series,html
+"Feb. 18, 2003",,"Brock Savelkoul joins the Army and is stationed at Fort Riley, Kan., in the artillery division. His assigned position is artillery survey, meaning he prepares terrain for mounting artillery canon.",,,Brock Savelkoul,"<h2 class=""timeline-img-hed"">Savelkoul Joins the Army</h2><img src=""http://maps.google.com/maps/api/staticmap?size=300x200&markers=color:blue|Fort%20Riley,KS&sensor=false&zoom=6"" width=""300"" height=""200""><iframe width=""560"" height=""315"" src=""h [...]
+"Aug. 10, 2003",,"Savelkoul deploys to Iraq, where he is based at Camp Forehead, near the Mansour District of Baghdad. ",,,Brock Savelkoul,
+"Dec. 1, 2003",December 2003,Savelkoul and his unit are ambushed in the Mansour district. Many of them are shaken by the experience.,,,Brock Savelkoul,
+"Oct. 9, 2005",,"Savelkoul, who learned how to operate Ravens, or small surveillance drones used to fly above roads to make sure they're clear of bombs, is quoted in an article for a base newsletter: ""We're protecting them from the sky.""",http://www.dvidshub.net/publication/issues/0388,,Brock Savelkoul,
+"Oct. 1, 2006",Oct-06,Junge leaves the Air Force.,,,Derrick Junge,
+"Nov. 1, 2006",Nov-06,Junge enlists in the Army.,,,Derrick Junge,
diff --git a/spec/timeline-debug.html b/spec/timeline-debug.html
new file mode 100644
index 0000000..22d8946
--- /dev/null
+++ b/spec/timeline-debug.html
@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <link href="../public/stylesheets/timeline-setter.css" rel="stylesheet" />
+ <script src="../public/javascripts/vendor/jquery.js"></script>
+ <script src="../public/javascripts/vendor/underscore.js"></script>
+ <script src="../public/javascripts/timeline-setter.js"></script>
+ <script src="../public/javascripts/templates.js"></script>
+ <!-- for the document embeds -->
+ <script src="http://s3.documentcloud.org/notes/loader.js"></script>
+
+ </head>
+ <body style="height: 100%">
+ <div id="timeline"></div>
+ <script>
+ var currentTimeline = TimelineSetter.Timeline.boot([{"description":"The FDA first approves the use of the antibiotics penicillin and chlortetracycline as animal feed additives. ","date":"1/1/1951","link":"","display_date":"1951","timestamp":-599598000000,"series":"FDA Decisions","html":"<img src= \"https://www.propublica.org/images/fda_antibiotic_2.jpg\" width=\"300\" height= \"400\"/> "},{"description":"FDA approves the use of the antibiotic oxytetracycline as an animal feed addit [...]
+ </script>
+ </body>
+</html>
diff --git a/spec/timeline_setter_spec.rb b/spec/timeline_setter_spec.rb
new file mode 100644
index 0000000..9311576
--- /dev/null
+++ b/spec/timeline_setter_spec.rb
@@ -0,0 +1,103 @@
+require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
+
+describe "TimelineSetter core" do
+ it 'should build a hash from a spreadsheet' do
+ TimelineSetter::Parser.new(TEST_CSV).events[0][:date].should eql("Feb. 18, 2003")
+ end
+
+ it 'should create json from an events hash' do
+ events = TimelineSetter::Parser.new(TEST_CSV)
+ j = TimelineSetter::Timeline.new({
+ :events => events.events
+ }).to_json
+ JSON.parse(j)[0]['date'].should eql "Feb. 18, 2003"
+ end
+
+ it 'should create html from an events hash' do
+ events = TimelineSetter::Parser.new(TEST_CSV)
+ html = TimelineSetter::Timeline.new({
+ :events => events.events
+ }).timeline.to_s
+ html.should =~ /"timestamp":1045544400/
+ end
+
+ it 'should create custom intervals' do
+ events = TimelineSetter::Parser.new(TEST_CSV)
+ html = TimelineSetter::Timeline.new({
+ :events => events.events,
+ :interval => "FullYear"
+ }).timeline.to_s
+ html.should =~ /"interval":"FullYear"/
+ end
+
+ it 'should create minified timelines' do
+ events = TimelineSetter::Parser.new(TEST_CSV)
+ html = TimelineSetter::Timeline.new({
+ :events => events.events
+ }).timeline_min.to_s
+
+ # test to see we've compiled all the assets
+
+ # test CSS
+ html.should =~ /#timeline/
+ # test timeline
+ html.should =~ /"timestamp":1045544400/
+ # test underscore
+ html.should =~ /Underscore\.js/
+ # test jQuery
+ html.should =~ /jQuery JavaScript Library/
+ # test timeline-setter.js
+ html.should =~ /INTERVAL_ORDER/
+ end
+end
+
+describe "TimelineSetter CLI" do
+ it 'should drop just timeline.html into tmp' do
+ `mkdir /tmp/ts_test_1`
+ %x[ #{TS_BINARY} -c #{TEST_CSV_PATH} -o /tmp/ts_test_1/ -a ]
+ Dir.glob("/tmp/ts_test_1/*").should include("/tmp/ts_test_1/timeline.html")
+ file = File.open("/tmp/ts_test_1/timeline.html").read
+ file.should =~ /"timestamp":1045544400/
+ end
+
+ it 'should drop timeline.html and associated assets into tmp' do
+ `mkdir /tmp/ts_test_2`
+ %x[ #{TS_BINARY} -c #{TEST_CSV_PATH} -o /tmp/ts_test_2/ ]
+ Dir.glob("/tmp/ts_test_2/*").should include("/tmp/ts_test_2/timeline.html")
+ Dir.glob("/tmp/ts_test_2/javascripts/*").should include("/tmp/ts_test_2/javascripts/timeline-setter.js")
+ Dir.glob("/tmp/ts_test_2/javascripts/vendor/*").should include("/tmp/ts_test_2/javascripts/vendor/jquery-min.js")
+ Dir.glob("/tmp/ts_test_2/javascripts/vendor/*").should include("/tmp/ts_test_2/javascripts/vendor/underscore-min.js")
+ Dir.glob("/tmp/ts_test_2/stylesheets/*").should include("/tmp/ts_test_2/stylesheets/timeline-setter.css")
+ end
+
+ it 'should create a minified timeline in tmp' do
+ `mkdir /tmp/ts_test_3`
+ %x[ #{TS_BINARY} -c #{TEST_CSV_PATH} -o /tmp/ts_test_3/ -m ]
+ file = File.open("/tmp/ts_test_3/timeline.html").read
+ file.should =~ /"timestamp":1045544400/
+
+ # test to see we've compiled all the assets
+
+ # test CSS
+ file.should =~ /#timeline/
+ # test timeline
+ file.should =~ /"timestamp":1045544400/
+ # test underscore
+ file.should =~ /Underscore\.js/
+ # test jQuery
+ file.should =~ /jQuery JavaScript Library/
+ # test timeline-setter.js
+ file.should =~ /INTERVAL_ORDER/
+
+ # check to see that we DID NOT generate the assets
+ Dir.glob("/tmp/ts_test_3/*").should_not include("/tmp/ts_test_3/javascripts/timeline-setter.js")
+ end
+
+ after :all do
+ `rm -rf /tmp/ts_test_1`
+ `rm -rf /tmp/ts_test_2`
+ `rm -rf /tmp/ts_test_3`
+ end
+
+
+end
\ No newline at end of file
diff --git a/templates/timeline-markup.erb b/templates/timeline-markup.erb
new file mode 100644
index 0000000..8a4d7f0
--- /dev/null
+++ b/templates/timeline-markup.erb
@@ -0,0 +1,31 @@
+<div id="timeline"></div>
+<script type="text/javascript">
+ var currentTimeline = TimelineSetter.Timeline.boot(
+ <%= self.to_json %>,
+ <%= self.config_json %>
+ );
+</script>
+<noscript>
+ <table>
+ <thead>
+ <tr>
+ <th>date</th>
+ <th>series</th>
+ <th>description</th>
+ <th>link</th>
+ <th>html</th>
+ </tr>
+ </thead>
+ <tbody>
+ <% for @event in @events %>
+ <tr>
+ <td><%= @event[:date] %></td>
+ <td><%= @event[:series] %></td>
+ <td><%= @event[:description] %></td>
+ <td><%= @event[:link] %></td>
+ <td><%= @event[:html] %></td>
+ </tr>
+ <% end %>
+ </tbody>
+ </table>
+</noscript>
\ No newline at end of file
diff --git a/templates/timeline-min.erb b/templates/timeline-min.erb
new file mode 100644
index 0000000..6d1d2e8
--- /dev/null
+++ b/templates/timeline-min.erb
@@ -0,0 +1 @@
+<style><%= @css %></style><script><%= @js %></script><%= @min_html %>
\ No newline at end of file
diff --git a/templates/timeline.erb b/templates/timeline.erb
new file mode 100644
index 0000000..fa9a98d
--- /dev/null
+++ b/templates/timeline.erb
@@ -0,0 +1,12 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <link href="stylesheets/timeline-setter.css" rel="stylesheet" />
+ <script src="javascripts/vendor/jquery-min.js"></script>
+ <script src="javascripts/vendor/underscore-min.js"></script>
+ <script src="javascripts/timeline-setter.js"></script>
+ </head>
+ <body style="height: 100%">
+ <%= timeline_markup %>
+ </body>
+</html>
\ No newline at end of file
diff --git a/timeline_setter.gemspec b/timeline_setter.gemspec
new file mode 100644
index 0000000..9e7155f
--- /dev/null
+++ b/timeline_setter.gemspec
@@ -0,0 +1,112 @@
+# Generated by jeweler
+# DO NOT EDIT THIS FILE DIRECTLY
+# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
+# -*- encoding: utf-8 -*-
+
+Gem::Specification.new do |s|
+ s.name = "timeline_setter"
+ s.version = "0.3.2"
+
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
+ s.authors = ["Al Shaw", "Jeff Larson"]
+ s.date = "2013-02-21"
+ s.description = "TimelineSetter is a tool to create HTML timelines from spreadsheets of events."
+ s.email = "almshaw at gmail.com"
+ s.executables = ["timeline-setter"]
+ s.extra_rdoc_files = [
+ "LICENSE.txt",
+ "README"
+ ]
+ s.files = [
+ ".document",
+ "LICENSE.txt",
+ "README",
+ "Rakefile",
+ "bin/timeline-setter",
+ "config/assets.yml",
+ "doc/doc.markdown",
+ "doc/doc_wrapper.erb",
+ "doc/docco.css",
+ "doc/static-demo.html",
+ "doc/templates.html",
+ "doc/timeline-setter.html",
+ "doc/timeline-setter.min.html",
+ "doc/todo.markdown",
+ "doc/twitter-demo.html",
+ "documentation/TimelineSetter.html",
+ "documentation/TimelineSetter/CLI.html",
+ "documentation/TimelineSetter/Parser.html",
+ "documentation/TimelineSetter/Timeline.html",
+ "documentation/TimelineSetter/Util.html",
+ "documentation/_index.html",
+ "documentation/class_list.html",
+ "documentation/css/common.css",
+ "documentation/css/full_list.css",
+ "documentation/css/style.css",
+ "documentation/file.README.html",
+ "documentation/file_list.html",
+ "documentation/frames.html",
+ "documentation/index.html",
+ "documentation/js/app.js",
+ "documentation/js/full_list.js",
+ "documentation/js/jquery.js",
+ "documentation/method_list.html",
+ "documentation/top-level-namespace.html",
+ "index.html",
+ "lib/timeline_setter.rb",
+ "lib/timeline_setter/cli.rb",
+ "lib/timeline_setter/parser.rb",
+ "lib/timeline_setter/timeline.rb",
+ "lib/timeline_setter/version.rb",
+ "public/javascripts/templates.js",
+ "public/javascripts/templates/card.jst",
+ "public/javascripts/templates/notch.jst",
+ "public/javascripts/templates/series_legend.jst",
+ "public/javascripts/templates/timeline.jst",
+ "public/javascripts/templates/year_notch.jst",
+ "public/javascripts/timeline-setter.js",
+ "public/javascripts/timeline-setter.min.js",
+ "public/javascripts/vendor/jquery-min.js",
+ "public/javascripts/vendor/jquery.js",
+ "public/javascripts/vendor/underscore-min.js",
+ "public/javascripts/vendor/underscore.js",
+ "public/stylesheets/timeline-setter.css",
+ "spec/spec_helper.rb",
+ "spec/test_data.csv",
+ "spec/timeline-debug.html",
+ "spec/timeline_setter_spec.rb",
+ "templates/timeline-markup.erb",
+ "templates/timeline-min.erb",
+ "templates/timeline.erb",
+ "timeline_setter.gemspec"
+ ]
+ s.homepage = "http://github.com/propublica/timeline-setter"
+ s.require_paths = ["lib"]
+ s.rubygems_version = "1.8.24"
+ s.summary = "TimelineSetter is a tool to create HTML timelines from spreadsheets of events."
+
+ if s.respond_to? :specification_version then
+ s.specification_version = 3
+
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
+ s.add_runtime_dependency(%q<json>, [">= 0"])
+ s.add_runtime_dependency(%q<table_fu>, [">= 0"])
+ s.add_runtime_dependency(%q<kompress>, [">= 0.0.2"])
+ s.add_runtime_dependency(%q<jammit>, [">= 0"])
+ s.add_development_dependency(%q<rspec>, [">= 2.0.0"])
+ else
+ s.add_dependency(%q<json>, [">= 0"])
+ s.add_dependency(%q<table_fu>, [">= 0"])
+ s.add_dependency(%q<kompress>, [">= 0.0.2"])
+ s.add_dependency(%q<jammit>, [">= 0"])
+ s.add_dependency(%q<rspec>, [">= 2.0.0"])
+ end
+ else
+ s.add_dependency(%q<json>, [">= 0"])
+ s.add_dependency(%q<table_fu>, [">= 0"])
+ s.add_dependency(%q<kompress>, [">= 0.0.2"])
+ s.add_dependency(%q<jammit>, [">= 0"])
+ s.add_dependency(%q<rspec>, [">= 2.0.0"])
+ end
+end
+
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ruby-extras/ruby-timeline-setter.git
More information about the Pkg-ruby-extras-commits
mailing list