A 'Widget' is an app which can be used as a 'bolt on' to the installed Sakai Open Academic Environment to add additional functionality, expanding the value of the platform for tutors and students alike.
-
By adding custom widgets to Sakai OAE, you’ll be enriching the learning experience for students and staff alike.
-
A handful of the Universities benefiting from Sakai OAE:
+
By adding custom widgets to Apereo OAE, you’ll be enriching the learning experience for students and staff alike.
+
A handful of the Universities benefiting from Apereo OAE:
\ No newline at end of file
+
diff --git a/app/views/sdk/backend.html.erb b/app/views/sdk/backend.html.erb
index 1feef67..1e24763 100644
--- a/app/views/sdk/backend.html.erb
+++ b/app/views/sdk/backend.html.erb
@@ -1,13 +1,13 @@
<% content_for :title do %> - SDK - Back-end endpoints<% end %>
Back-end endpoints
-
Sakai OAE has a number of API functions available that your widgets should use to communicate with the Sakai OAE server. A full list of API functions will be coming soon, but documentation on some of the most used backend Widget API functions are provided below.
+
Apereo OAE has a number of API functions available that your widgets should use to communicate with the Apereo OAE server. A full list of API functions will be coming soon, but documentation on some of the most used backend Widget API functions are provided below.
If you are looking for API functions to build the interface of your widgets, check out the <%= link_to "front-end API", "/sdk/api/frontend", :class => "wl-regular-link" %>.
Back-end endpoints
More documentation will be added in the future. For now we recommend to run nakamura and go to <%= link_to "http://localhost:8080/system/doc", "http://localhost:8080/system/doc", :class => "wl-regular-link" %>.
-
If you can't run nakamura locally, you can go to any of the <%= link_to "Sakai OAE QA servers", "https://confluence.sakaiproject.org/display/QA/QA+Servers+-+Sakai+OAE", :class => "wl-regular-link" %> and add /system/doc to the URL.
+
If you can't run nakamura locally, you can go to any of the <%= link_to "Apereo OAE QA servers", "https://confluence.sakaiproject.org/display/QA/QA+Servers+-+Sakai+OAE", :class => "wl-regular-link" %> and add /system/doc to the URL.
<%= render :partial => "sdk/feedback" %>
-
\ No newline at end of file
+
diff --git a/app/views/sdk/colorpalette.html.erb b/app/views/sdk/colorpalette.html.erb
index 901d810..858dd23 100644
--- a/app/views/sdk/colorpalette.html.erb
+++ b/app/views/sdk/colorpalette.html.erb
@@ -1,7 +1,7 @@
<% content_for :title do %> - SDK - Color palette<% end %>
Color palette
-
This guide will help you style your widgets allowing them to fit seamlessly into the Sakai OAE suite of Widgets maintain a high standard for content presentation, and to maintain a high level of user experience across the system.
+
This guide will help you style your widgets allowing them to fit seamlessly into the Apereo OAE suite of Widgets maintain a high standard for content presentation, and to maintain a high level of user experience across the system.
HEX colors
@@ -126,4 +126,4 @@
<%= render :partial => "sdk/feedback" %>
-
\ No newline at end of file
+
diff --git a/app/views/sdk/contact.html.erb b/app/views/sdk/contact.html.erb
index 96725f3..1eb99d1 100644
--- a/app/views/sdk/contact.html.erb
+++ b/app/views/sdk/contact.html.erb
@@ -5,7 +5,7 @@
IRC
-
You can almost always find a 3akai-UX (Sakai OAE front-end codename) Developer or Nakamura (Sakai OAE back-end codename) Developer in the Sakai IRC group chat room. The purpose of this space is to get quick answers to issues you are having and for group discussions on various issues. All are welcome.
+
You can almost always find a 3akai-UX (Apereo OAE front-end codename) Developer or Nakamura (Apereo OAE back-end codename) Developer in the Sakai IRC group chat room. The purpose of this space is to get quick answers to issues you are having and for group discussions on various issues. All are welcome.
To join:
1. You will need an IRC Client:
@@ -24,8 +24,8 @@
Email
The Sakai community relies heavily on email lists for communication. Questions and ideas are welcome from anyone on these lists but you must sign up before you can send to the lists.
<%= render :partial => "sdk/feedback" %>
-
\ No newline at end of file
+
diff --git a/app/views/sdk/designguide.html.erb b/app/views/sdk/designguide.html.erb
index 7727216..d0e662b 100644
--- a/app/views/sdk/designguide.html.erb
+++ b/app/views/sdk/designguide.html.erb
@@ -1,13 +1,13 @@
<% content_for :title do %> - SDK - Design guide<% end %>
Design guide
-
Style your widgets and allow them to fit seamlessly into the Sakai OAE suite of Widgets. So we can maintain a high standard for content presentation and a high level of user experience across the system.
+
Style your widgets and allow them to fit seamlessly into the Apereo OAE suite of Widgets. So we can maintain a high standard for content presentation and a high level of user experience across the system.
The generic style of icons has to adhere to a few basic rules. The examples here will show you ho to creat your own icons to gel with the Sakai OAE icon family.
+
The generic style of icons has to adhere to a few basic rules. The examples here will show you ho to creat your own icons to gel with the Apereo OAE icon family.
While it's possible to quickly setup Sakai OAE, if you would like to be able to use the latest version of nakamura and add dummy data, we recommend the OAE-Builder.
+
While it's possible to quickly setup Apereo OAE, if you would like to be able to use the latest version of nakamura and add dummy data, we recommend the OAE-Builder.
<%= link_to "What kinds of technologies do I need to know to develop Sakai OAE widgets? How much experience will I need?", "#experience", :class => "wl-regular-link", :title => "What kinds of technologies do I need to know to develop Sakai OAE widgets? How much experience will I need?" %>
-
<%= link_to "How do I get and install Sakai OAE?", "#installation", :class => "wl-regular-link", :title => "How do I get and install Sakai OAE?" %>
+
<%= link_to "What kinds of technologies do I need to know to develop Apereo OAE widgets? How much experience will I need?", "#experience", :class => "wl-regular-link", :title => "What kinds of technologies do I need to know to develop Apereo OAE widgets? How much experience will I need?" %>
+
<%= link_to "How do I get and install Apereo OAE?", "#installation", :class => "wl-regular-link", :title => "How do I get and install Apereo OAE?" %>
<%= link_to "Where do I find detailed documentation on the services that are available for use in my widgets?", "#documentation", :class => "wl-regular-link", :title => "Where do I find detailed documentation on the services that are available for use in my widgets?" %>
<%= link_to "How can I use external JavaScript files and libraries within my widget?", "#requirejs", :class => "wl-regular-link", :title => "How can I use external JavaScript files and libraries within my widget?" %>
- <%= link_to "Contributing to Sakai OAE", "#contributing", :class => "wl-regular-link", :title => "Contributing to Sakai OAE" %>
+ <%= link_to "Contributing to Apereo OAE", "#contributing", :class => "wl-regular-link", :title => "Contributing to Apereo OAE" %>
<%= link_to "How do I report a bug?", "#reportbugs", :class => "wl-regular-link", :title => "How do I report a bug?" %>
<%= link_to "How do I suggest a feature?", "#suggestfeature", :class => "wl-regular-link", :title => "How do I suggest a feature?" %>
<%= link_to "How does Sakai OAE relate to Sakai CLE (the previous version of Sakai)?", "#clerelation", :class => "wl-regular-link", :title => "How does Sakai OAE relate to Sakai CLE (the previous version of Sakai)?" %>
-
<%= link_to "What releases of Sakai OAE are currently available?", "#releases", :class => "wl-regular-link", :title => "What releases of Sakai OAE are currently available?" %>
-
<%= link_to "What platform(s) does Sakai OAE run on?", "#platforms", :class => "wl-regular-link", :title => "What platform(s) does Sakai OAE run on?" %>
+
<%= link_to "How does Apereo OAE relate to Sakai CLE (the previous version of Sakai)?", "#clerelation", :class => "wl-regular-link", :title => "How does Apereo OAE relate to Sakai CLE (the previous version of Sakai)?" %>
+
<%= link_to "What releases of Apereo OAE are currently available?", "#releases", :class => "wl-regular-link", :title => "What releases of Apereo OAE are currently available?" %>
+
<%= link_to "What platform(s) does Apereo OAE run on?", "#platforms", :class => "wl-regular-link", :title => "What platform(s) does Apereo OAE run on?" %>
<%= link_to "What browsers does the OAE support?", "#browsers", :class => "wl-regular-link", :title => "What browsers does the OAE support?" %>
-
<%= link_to "How is Sakai OAE licensed?", "#license", :class => "wl-regular-link", :title => "How is Sakai OAE licensed?" %>
-
<%= link_to "Do I need to buy or pay anything to create Sakai OAE widgets?", "#cost", :class => "wl-regular-link", :title => "Do I need to buy or pay anything to create Sakai OAE widgets?" %>
-
<%= link_to "Where can I find working versions of Sakai OAE to experiment with or share with colleagues?", "#experiment", :class => "wl-regular-link", :title => "Where can I find working versions of Sakai OAE to experiment with or share with colleagues?" %>
+
<%= link_to "How is Apereo OAE licensed?", "#license", :class => "wl-regular-link", :title => "How is Apereo OAE licensed?" %>
+
<%= link_to "Do I need to buy or pay anything to create Apereo OAE widgets?", "#cost", :class => "wl-regular-link", :title => "Do I need to buy or pay anything to create Apereo OAE widgets?" %>
+
<%= link_to "Where can I find working versions of Apereo OAE to experiment with or share with colleagues?", "#experiment", :class => "wl-regular-link", :title => "Where can I find working versions of Apereo OAE to experiment with or share with colleagues?" %>
Development Questions
-
Q: What kinds of technologies do I need to know to develop Sakai OAE widgets? How much experience will I need?
-
A: Sakai OAE widgets use front-end web technologies such as HTML (for widget layout), CSS (for widget styling), JavaScript (for widget behavior) and JSON (for widget data management). jQuery is a major JavaScript library used throughout Sakai OAE widgets. Sakai OAE has been designed to make widget development very easy and the architecture of a Sakai OAE widget is relatively simple.
-
If you are comfortable (but by no means an expert) with HTML, CSS, JavaScript/jQuery and JSON, you should have no problem at all in developing Sakai OAE widgets.
-
If you are new to any of the above technologies, you can expect a bit of a ramp up period to get up-to-speed, but because Sakai OAE widgets have a relatively simple architecture, you will be able to quickly learn from other simple widgets within the codebase as examples.
+
Q: What kinds of technologies do I need to know to develop Apereo OAE widgets? How much experience will I need?
+
A: Apereo OAE widgets use front-end web technologies such as HTML (for widget layout), CSS (for widget styling), JavaScript (for widget behavior) and JSON (for widget data management). jQuery is a major JavaScript library used throughout Apereo OAE widgets. Apereo OAE has been designed to make widget development very easy and the architecture of a Apereo OAE widget is relatively simple.
+
If you are comfortable (but by no means an expert) with HTML, CSS, JavaScript/jQuery and JSON, you should have no problem at all in developing Apereo OAE widgets.
+
If you are new to any of the above technologies, you can expect a bit of a ramp up period to get up-to-speed, but because Apereo OAE widgets have a relatively simple architecture, you will be able to quickly learn from other simple widgets within the codebase as examples.
For example widgets that have been heavily documented in this Widget SDK documentation, see the <%= link_to "Widget designs", "/sdk/designguide/widgetdesigns", :class => "wl-regular-link" %> page.
-
Q: How do I get and install Sakai OAE?
-
A: Depending on what you want to do with Sakai OAE, there are different methods for getting and installing Sakai OAE:
+
Q: How do I get and install Apereo OAE?
+
A: Depending on what you want to do with Apereo OAE, there are different methods for getting and installing Apereo OAE:
-
For building, deploying and developing for Sakai OAE on your own machine, follow the instructions on the <%= link_to "quick development setup", "/sdk/developwidget/quicksetup", :class => "wl-regular-link" %> page.
-
For simply running and experimenting with the latest Sakai OAE release on your own machine, you can download a one-click installer from the <%= link_to "Sakai OAE release page", "http://www.sakaiproject.org/node/2307", :class => "wl-regular-link" %>. This will not allow you to see or change any of the Sakai OAE code.
-
If you have trouble with the one-click installer, you may also download the binary package from the <%= link_to "Sakai OAE release page", "http://www.sakaiproject.org/node/2307", :class => "wl-regular-link" %> and run the server yourself. This option will not allow you to see or change any of the Sakai OAE code.
+
For building, deploying and developing for Apereo OAE on your own machine, follow the instructions on the <%= link_to "quick development setup", "/sdk/developwidget/quicksetup", :class => "wl-regular-link" %> page.
+
For simply running and experimenting with the latest Apereo OAE release on your own machine, you can download a one-click installer from the <%= link_to "Apereo OAE release page", "http://www.sakaiproject.org/node/2307", :class => "wl-regular-link" %>. This will not allow you to see or change any of the Apereo OAE code.
+
If you have trouble with the one-click installer, you may also download the binary package from the <%= link_to "Apereo OAE release page", "http://www.sakaiproject.org/node/2307", :class => "wl-regular-link" %> and run the server yourself. This option will not allow you to see or change any of the Apereo OAE code.
Q: Where do I find detailed documentation on the services that are available for use in my widgets?
-
A: <%= link_to "The Widget API section", "/sdk/api", :class => "wl-regular-link" %> of this documentation contains information on <%= link_to "front-end API", "/sdk/api/frontend", :class => "wl-regular-link" %>, <%= link_to "back-end endpoints", "/sdk/api/backend", :class => "wl-regular-link" %> and <%= link_to "3rd party libraries", "/sdk/api/thirdparty", :class => "wl-regular-link" %> available to Sakai OAE widgets. If you are unable to find information on the service you are looking for, there may be additional locations that would be worthwhile to search:
+
A: <%= link_to "The Widget API section", "/sdk/api", :class => "wl-regular-link" %> of this documentation contains information on <%= link_to "front-end API", "/sdk/api/frontend", :class => "wl-regular-link" %>, <%= link_to "back-end endpoints", "/sdk/api/backend", :class => "wl-regular-link" %> and <%= link_to "3rd party libraries", "/sdk/api/thirdparty", :class => "wl-regular-link" %> available to Apereo OAE widgets. If you are unable to find information on the service you are looking for, there may be additional locations that would be worthwhile to search:
-
All Sakai OAE Widget API functions can be found in the various sakai.api JavaScript files located in the /dev/lib/sakai directory
-
For information on services provided directly by the Sakai OAE server, check out these locations:
+
All Apereo OAE Widget API functions can be found in the various sakai.api JavaScript files located in the /dev/lib/sakai directory
+
For information on services provided directly by the Apereo OAE server, check out these locations:
Your local Sakai OAE server's built in documentation: <%= link_to "http://localhost:8080/system/doc", "http://localhost:8080/system/doc", :class => "wl-regular-link" %>
+
Your local Apereo OAE server's built in documentation: <%= link_to "http://localhost:8080/system/doc", "http://localhost:8080/system/doc", :class => "wl-regular-link" %>
If you cannot find what you are looking for, please feel free to <%= link_to "contact", "/sdk/contact", :class => "wl-regular-link" %> the Sakai OAE developers.
+
If you cannot find what you are looking for, please feel free to <%= link_to "contact", "/sdk/contact", :class => "wl-regular-link" %> the Apereo OAE developers.
-
Contributing to Sakai OAE
+
Contributing to Apereo OAE
Q: How do I report a bug?
-
A: Bugs can be reported in <%= link_to "our bug tracking system JIRA", "http://jira.sakaiproject.org", :title => "Sakai OAE bug tracking system JIRA", :class => "wl-regular-link", :target => "_blank" %> by Atlassian.
+
A: Bugs can be reported in <%= link_to "our bug tracking system JIRA", "http://jira.sakaiproject.org", :title => "Apereo OAE bug tracking system JIRA", :class => "wl-regular-link", :target => "_blank" %> by Atlassian.
Q: How do I suggest a feature?
-
A: We encourage the community to post and vote ideas on the <%= link_to "Sakai OAE Idea Informer", "http://sakaioae.idea.informer.com/", :title => "Sakai OAE Idea Informer", :class => "wl-regular-link", :target => "_blank" %> page. The Idea Informer is taken into account when setting up goals for the future.
+
A: We encourage the community to post and vote ideas on the <%= link_to "Apereo OAE Idea Informer", "http://sakaioae.idea.informer.com/", :title => "Apereo OAE Idea Informer", :class => "wl-regular-link", :target => "_blank" %> page. The Idea Informer is taken into account when setting up goals for the future.
Q: What is the best git workflow to use?
A: If you're looking for a detailed workflow for setting up your environment, take a look at the <%= link_to "quick development setup", "/sdk/developwidget/quicksetup", :class => "wl-regular-link" %> page.
There's a few ways of doing the same tasks with GIT, the following list has a few 'best practices' to take into account while developing for the OAE using the GIT version control system.
Q: How does Sakai OAE relate to Sakai CLE (the previous version of Sakai)?
-
Q: What releases of Sakai OAE are currently available?
-
Q: What platform(s) does Sakai OAE run on?
+
Apereo OAE Background information
+
Q: How does Apereo OAE relate to Sakai CLE (the previous version of Sakai)?
+
Q: What releases of Apereo OAE are currently available?
+
Q: What platform(s) does Apereo OAE run on?
Q: What browsers does the OAE support?
A: The OAE tries to support as many browsers as possible. However, due to the vast amount of browsers out there we support the 2 latest versions of the most popular browsers.
For users to fully enjoy your widgets it's best to test them in these browsers before submitting them to the Widget Library.
-
Q: How is Sakai OAE licensed?
-
A: Sakai OAE is released under the <%= link_to "Educational Community License version 2.0", "http://sakaiproject.org/foundation-licenses", :title => "Educational Community License version 2.0", :class => "wl-regular-link", :target => "blank" %>.
-
Q: Do I need to buy or pay anything to create Sakai OAE widgets?
-
A: Developing for Sakai OAE is free and we encourage everyone to participate and create widgets. Take a look at the '<%= link_to "Learn the basics, 'Hello World' tutorial", "/sdk/developwidget/learnbasics", :class => "wl-regular-link" %>' section to get started on your widget.
-
Q: Where can I find working versions of Sakai OAE to experiment with or share with colleagues?
-
A: All latest versions will be announced on the <%= link_to "Sakai OAE release page", "http://sakaiproject.org/oae-release", :title => "Sakai OAE release page", :class => "wl-regular-link", :target => "blank" %>. This page has binaries, web start packages and links to the source code to get you started with the latest version of the Open Academic Environment.
+
Q: How is Apereo OAE licensed?
+
A: Apereo OAE is released under the <%= link_to "Educational Community License version 2.0", "http://sakaiproject.org/foundation-licenses", :title => "Educational Community License version 2.0", :class => "wl-regular-link", :target => "blank" %>.
+
Q: Do I need to buy or pay anything to create Apereo OAE widgets?
+
A: Developing for Apereo OAE is free and we encourage everyone to participate and create widgets. Take a look at the '<%= link_to "Learn the basics, 'Hello World' tutorial", "/sdk/developwidget/learnbasics", :class => "wl-regular-link" %>' section to get started on your widget.
+
Q: Where can I find working versions of Apereo OAE to experiment with or share with colleagues?
+
A: All latest versions will be announced on the <%= link_to "Apereo OAE release page", "http://sakaiproject.org/oae-release", :title => "Apereo OAE release page", :class => "wl-regular-link", :target => "blank" %>. This page has binaries, web start packages and links to the source code to get you started with the latest version of the Open Academic Environment.
-
\ No newline at end of file
+
diff --git a/app/views/sdk/frontend.html.erb b/app/views/sdk/frontend.html.erb
index 9ec1ff5..c4e30e9 100644
--- a/app/views/sdk/frontend.html.erb
+++ b/app/views/sdk/frontend.html.erb
@@ -1,8 +1,8 @@
<% content_for :title do %> - SDK - Front-end API<% end %>
Front-end API
-
Sakai OAE has a number of API functions available that should be used to build the interface of your widgets. A full list of API functions will be coming soon, but documentation on some of the most used front-end Widget API functions are provided below.
-
If you are looking for URLs to communicate with the Sakai OAE server, check out the <%= link_to "back-end endpoints", "/sdk/api/backend", :class => "wl-regular-link" %>.
+
Apereo OAE has a number of API functions available that should be used to build the interface of your widgets. A full list of API functions will be coming soon, but documentation on some of the most used front-end Widget API functions are provided below.
+
If you are looking for URLs to communicate with the Apereo OAE server, check out the <%= link_to "back-end endpoints", "/sdk/api/backend", :class => "wl-regular-link" %>.
<%= link_to "Utility functions (sakai.api.Util.*)", "#utility", :class => "wl-regular-link", :title => "Utility functions (sakai.api.Util.*)" %>
@@ -180,7 +180,7 @@ sakai.api.Util.AutoSuggest.setup($('autosuggest_box'), {
:description => "Convert a file's size to a human readable size",
:parameters => "@param {Integer} filesize The file's size to convert",
:callback => "{String} size Filesize in readable format and localized
-
+
e.g. return '4.5 MB';",
:example => "sakai.api.Util.convertToHumanReadableFileSize(result['_length']);"
}%>
@@ -191,7 +191,7 @@ e.g. return '4.5 MB';",
:function => "sakai.api.Util.Draggable.setupDraggable(params, $container)",
:description => "Sets up draggables across the page or given container",
:parameters => "@param {Object} params Optional parameters that override defaults
-@param {Object} $container container element to add draggables, defaults to
+@param {Object} $container container element to add draggables, defaults to
$('html') if not set",
:callback => "None",
:example => "sakai.api.Util.Draggable.setupDraggable({
@@ -216,7 +216,7 @@ e.g. return '4.5 MB';",
:function => "sakai.api.Util.Droppable.setupDroppable(params, $container)",
:description => "Sets up containers that allow dropping of elements on them across the page or given container",
:parameters => "@param {Object} params Optional parameters that override defaults
-@param {Object} $container container element to add droppable containers, defaults
+@param {Object} $container container element to add droppable containers, defaults
to $('html') if not set",
:callback => "None",
:example => "sakai.api.Util.Droppable.setupDroppable({
@@ -256,7 +256,7 @@ debug.log(formattedTags);
validate
<%= render :partial => "sdk/apifunction", :locals => {
:function => "sakai.api.Util.formatTags(inputTags)",
- :description => "A wrapper for jquery.validate with a custom Sakai OAE styling.",
+ :description => "A wrapper for jquery.validate with a custom Apereo OAE styling.",
:parameters => "@param {Object} $form $form the jQuery element of the form in question
@param {Object} opts options to pass through to jquery.validate
NOTE: There is one additional option you can pass in
@@ -482,4 +482,4 @@ e.g. callback(true, data);"
}%>
<%= render :partial => "sdk/feedback" %>
-
\ No newline at end of file
+
diff --git a/app/views/sdk/gitbasics.html.erb b/app/views/sdk/gitbasics.html.erb
index daa28bd..c0341b1 100644
--- a/app/views/sdk/gitbasics.html.erb
+++ b/app/views/sdk/gitbasics.html.erb
@@ -20,7 +20,7 @@
Setup git
-
Setting up git for Sakai OAE is pretty easy.
+
Setting up git for Apereo OAE is pretty easy.
<%= link_to "Create", "https://github.com/signup/free", :title => "Create a github account", :class => "wl-regular-link" %> a free GitHub account
<%= link_to "Install git", "http://help.github.com/set-up-git-redirect", :title => "Git install page", :class => "wl-regular-link" %> on your machine.
@@ -84,7 +84,7 @@ Receiving objects: 100% (498/498), 56.96 KiB, done.
Resolving deltas: 100% (178/178), completed with 51 local objects.
From https://github.com/sakaiproject/3akai-ux
36f3121..06333a3 master -> sakaiproject/master
-
+
$ git merge sakaiproject/master -> Synchronizes your local branch with the remote branch
Updating 36f3121..06333a3
Fast-forward
@@ -150,7 +150,7 @@ nothing to commit (working directory clean)
[OAEWDGT-152 3e3a95b] OAEWDGT-152 WIP Create a 'Git Basics' section
3 files changed, 148 insertions(+), 2 deletions(-)
create mode 100644 app/views/sdk/gitbasics.html.erb
-
+
$ git push bp323 OAEWDGT-152
Counting objects: 14, done.
Delta compression using up to 2 threads.
diff --git a/app/views/sdk/html.html.erb b/app/views/sdk/html.html.erb
index b22cc90..ec0aba7 100644
--- a/app/views/sdk/html.html.erb
+++ b/app/views/sdk/html.html.erb
@@ -3,14 +3,14 @@
HTML
Follow these simple few rules and you will be creating your own widgets for others to use on their Sakai platform.
-
A more in-depth guide on Sakai OAE Widget SDK coding standards is coming soon.
+
A more in-depth guide on Apereo OAE Widget SDK coding standards is coming soon.
If you:
start all your widgets using the template files provided in the 3akai-ux/devwidgets/_template directory,
follow the namespacing standards below and,
follow the patterns mentioned in the <%= link_to "Hello World Tutorial", "/sdk/developwidget/learnbasics", :class => "wl-regular-link" %>,
-
you should be just fine. The guidelines in the above resources should be considered the most up-to-date. If you have any questions about coding standards, please feel free to comment on this page or <%= link_to "contact", "/sdk/contact", :class => "wl-regular-link" %> the Sakai OAE developers.
+
you should be just fine. The guidelines in the above resources should be considered the most up-to-date. If you have any questions about coding standards, please feel free to comment on this page or <%= link_to "contact", "/sdk/contact", :class => "wl-regular-link" %> the Apereo OAE developers.
Name spacing
@@ -63,4 +63,4 @@ var $usernameContainer = $('#myhelloworld_username', $rootel);
<%= render :partial => "sdk/feedback" %>
-
\ No newline at end of file
+
diff --git a/app/views/sdk/iconography.html.erb b/app/views/sdk/iconography.html.erb
index 2662726..f3b33e4 100644
--- a/app/views/sdk/iconography.html.erb
+++ b/app/views/sdk/iconography.html.erb
@@ -1,7 +1,7 @@
<% content_for :title do %> - SDK - Iconography<% end %>
Iconography
-
This guide will help you style your widgets allowing them to fit seamlessly into the Sakai OAE suite of Widgets maintain a high standard for content presentation, and to maintain a high level of user experience across the system.
+
This guide will help you style your widgets allowing them to fit seamlessly into the Apereo OAE suite of Widgets maintain a high standard for content presentation, and to maintain a high level of user experience across the system.
Example in-page icons
@@ -139,4 +139,4 @@
<%= render :partial => "sdk/feedback" %>
-
\ No newline at end of file
+
diff --git a/app/views/sdk/index.html.erb b/app/views/sdk/index.html.erb
index bdc0898..eea1535 100644
--- a/app/views/sdk/index.html.erb
+++ b/app/views/sdk/index.html.erb
@@ -6,7 +6,7 @@
Getting started
-
Start developing Sakai OAE Widgets:
+
Start developing Apereo OAE Widgets:
Design. Develop. Inspire.
A 'Widget' is an app which can be used as a 'bolt on' to the installed Sakai Open Academic Environment to add additional functionality, expanding the value of the platform for tutors and students alike.
-
\ No newline at end of file
+
diff --git a/app/views/sdk/javascript.html.erb b/app/views/sdk/javascript.html.erb
index bf1b16b..09f19a7 100644
--- a/app/views/sdk/javascript.html.erb
+++ b/app/views/sdk/javascript.html.erb
@@ -1,7 +1,7 @@
<% content_for :title do %> - SDK - JavaScript<% end %>
JavaScript
-
This section of the Widget SDK helps clarify the JavaScript guidelines used by the Sakai OAE project. These guidelines exist to improve readability and maintenance of the various JavaScript files in the system. The guide borrows heavily from the <%= link_to "Node.js", "http://nodeguide.com/style.html", :class => "wl-regular-link", :target => "_blank" %> style guide but adds a few rules.
+
This section of the Widget SDK helps clarify the JavaScript guidelines used by the Apereo OAE project. These guidelines exist to improve readability and maintenance of the various JavaScript files in the system. The guide borrows heavily from the <%= link_to "Node.js", "http://nodeguide.com/style.html", :class => "wl-regular-link", :target => "_blank" %> style guide but adds a few rules.
Make sure your development environment is <%= link_to "set up", "/sdk/developwidget/quicksetup", :class => "wl-regular-link" %> so you can create the My Hello World widget and run it within Sakai OAE on your machine.
+
Make sure your development environment is <%= link_to "set up", "/sdk/developwidget/quicksetup", :class => "wl-regular-link" %> so you can create the My Hello World widget and run it within Apereo OAE on your machine.
@@ -56,9 +56,9 @@
All widgets should use this set of directories and files though some may be unnecessary (i.e. images, CSS). Of course, the names should match the ID of the widget. In this case, the ID for the My Hello World widget is myhelloworld. Let's take a look at the purpose of these directories and files:
-
3akai-ux: contains all Sakai OAE front-end code
+
3akai-ux: contains all Apereo OAE front-end code
-
devwidgets: contains all Sakai OAE widgets
+
devwidgets: contains all Apereo OAE widgets
myhelloworld: contains all My Hello World widget code
@@ -95,8 +95,8 @@
Step 3: Configure the widget
-
To let Sakai OAE know about our new widget, we need to set certain configuration parameters.
-
This is done by editing the widget's config.json file that the Sakai OAE frontend code reads to know which widgets are available (you can see all registered Sakai OAE widgets at http://localhost:8080/var/widgets.json). All widgets must have a config.json file.
+
To let Apereo OAE know about our new widget, we need to set certain configuration parameters.
+
This is done by editing the widget's config.json file that the Apereo OAE frontend code reads to know which widgets are available (you can see all registered Apereo OAE widgets at http://localhost:8080/var/widgets.json). All widgets must have a config.json file.
Here is the config.json you will need for My Hello World (minus the comments from the template file for brevity):
Here is a quick description of the configuration options you see here:
-
enabled - true | false: sets whether or not this widget may be usable by Sakai OAE
+
enabled - true | false: sets whether or not this widget may be usable by Apereo OAE
hasSettings - true | false: sets whether or not this widget has a settings menu option to allow users to configure or change the widget's settings. Since we want the user to be able to change the color of the text, we set hasSettings to true.
i18n - JSON object: sets the location of internationalization (abbreviated as 'i18n') files for this widget. Since we have a default properties file, we list its location here.
@@ -141,17 +141,17 @@
name - string: a short name for the widget that is displayed to users. Since this is a dashboard widget, the name will appear in the widget's header bar
-
id - string: a short, unique identifier for this widget. This ID should be used as the widget's directory name as well as the widget's main HTML template, CSS file and JavaScript file names. It should also be used throughout the widget code and other places in the Sakai OAE codebase to refer to this widget.
+
id - string: a short, unique identifier for this widget. This ID should be used as the widget's directory name as well as the widget's main HTML template, CSS file and JavaScript file names. It should also be used throughout the widget code and other places in the Apereo OAE codebase to refer to this widget.
personalportal - true | false: sets whether or not this widget may be used on a user's personal portal (more commonly known as 'My Sakai'). This is the page a user is taken to when they log in (/me.html). This property is not included in the helloworld config.json because we do not want to include a demonstration widget in My Sakai by default. For the purposes of this tutorial, we will test My Hello World on the My Sakai page.
-
type - "core" | "sakai" | "contrib": core widgets are essential for Sakai OAE to function properly (i.e. login, uploadcontent). sakai widgets are not essential for Sakai OAE to function properly, but are shipped with the main codebase (i.e. discussion, video). contrib widgets are written by individuals and institutions outside the core Sakai OAE team and contributed back to the Sakai OAE project.
-
url - string: the location of the main HTML template that should be loaded when Sakai OAE wants to display the widget
+
type - "core" | "sakai" | "contrib": core widgets are essential for Apereo OAE to function properly (i.e. login, uploadcontent). sakai widgets are not essential for Apereo OAE to function properly, but are shipped with the main codebase (i.e. discussion, video). contrib widgets are written by individuals and institutions outside the core Apereo OAE team and contributed back to the Apereo OAE project.
+
url - string: the location of the main HTML template that should be loaded when Apereo OAE wants to display the widget
Step 4: Create the HTML template
-
In config.json we instructed Sakai OAE to load our widget from /devwidgets/myhelloworld/myhelloworld.html. The HTML template acts as the "home" of our widget where we define our widget's interface and link to any of the other content our widget uses (CSS, JavaScript, images).
+
In config.json we instructed Apereo OAE to load our widget from /devwidgets/myhelloworld/myhelloworld.html. The HTML template acts as the "home" of our widget where we define our widget's interface and link to any of the other content our widget uses (CSS, JavaScript, images).
Here is the myhelloworld.html you will need for My Hello World:
The root container for the widget is given a class of myhelloworld_widget and has no id. This is important because the widget could appear multiple times within a page and we want to avoid top-level ids from clashing. Sakai OAE will automatically give each widget its own container with a unique id when it is loaded, even if it is an instance of the same widget.
+
The root container for the widget is given a class of myhelloworld_widget and has no id. This is important because the widget could appear multiple times within a page and we want to avoid top-level ids from clashing. Apereo OAE will automatically give each widget its own container with a unique id when it is loaded, even if it is an instance of the same widget.
@@ -239,7 +239,7 @@
Settings view replaces the main view
<%= image_tag "developer_helloworld_view_settings.png", :alt => "" %>
-
Because Sakai OAE can choose to load a widget in either Main or Settings mode, both views are initially hidden in our HTML template. The style="display:none;" is the only CSS style Sakai OAE allows within HTML as there are a number of HTML elements that may need to be hidden upon initial load of a widget. All other CSS styles should be placed in a separate CSS file.
+
Because Apereo OAE can choose to load a widget in either Main or Settings mode, both views are initially hidden in our HTML template. The style="display:none;" is the only CSS style Apereo OAE allows within HTML as there are a number of HTML elements that may need to be hidden upon initial load of a widget. All other CSS styles should be placed in a separate CSS file.
After our HTML template loads, we need to load the widget's JavaScript file to define this widget's dynamic behaviors. Because widgets are embedded in other pages, any work our widget does needs to be defined within the widget. Sakai OAE has a rich set of <%= link_to "JavaScript APIs", "/sdk/api/frontend", :class => "wl-regular-link" %> that our widget can use to get server data, save data to the server and many other common web application functions. For My Hello World, we will want to save the user's text color preference and be able to retrieve it again later.
+
After our HTML template loads, we need to load the widget's JavaScript file to define this widget's dynamic behaviors. Because widgets are embedded in other pages, any work our widget does needs to be defined within the widget. Apereo OAE has a rich set of <%= link_to "JavaScript APIs", "/sdk/api/frontend", :class => "wl-regular-link" %> that our widget can use to get server data, save data to the server and many other common web application functions. For My Hello World, we will want to save the user's text color preference and be able to retrieve it again later.
@@ -268,7 +268,7 @@ __MSG__ + KEY_NAME + __
Key names should be written in only caps and underscores. Key names do not have to mimic their values, but should be a pretty close match. For example, HELLO could resolve to Hello World.
-
To define what will eventually be placed in our template where we see message keys (Sakai OAE's internationalization processor automatically does this for us), we need to complete the default.properties file.
+
To define what will eventually be placed in our template where we see message keys (Apereo OAE's internationalization processor automatically does this for us), we need to complete the default.properties file.
@@ -286,14 +286,14 @@ HELLO_WORLD = Hello World
-
Step 6: Load My Hello World in Sakai OAE
+
Step 6: Load My Hello World in Apereo OAE
-
Now that our widget is configured and the message keys have been defined, we can see My Hello World in Sakai OAE. Of course, since we have not defined our CSS or JavaScript yet, the widget will not do much, but we can test to make sure we have set up our widget properly. Follow these steps to see the My Hello World widget in action.
+
Now that our widget is configured and the message keys have been defined, we can see My Hello World in Apereo OAE. Of course, since we have not defined our CSS or JavaScript yet, the widget will not do much, but we can test to make sure we have set up our widget properly. Follow these steps to see the My Hello World widget in action.
-
Log into Sakai OAE
-
Make sure Sakai OAE is running on your machine. If you are unsure about how to do this, look at the <%= link_to "quick development setup", "/sdk/developwidget/quicksetup", :class => "wl-regular-link" %> page.
+
Log into Apereo OAE
+
Make sure Apereo OAE is running on your machine. If you are unsure about how to do this, look at the <%= link_to "quick development setup", "/sdk/developwidget/quicksetup", :class => "wl-regular-link" %> page.
-
Once Sakai OAE is running, you should be able to see the homepage at <%= link_to "http://localhost:8080/", "http://localhost:8080/", :class => "wl-regular-link" %>. If you have not already, create an account by clicking the 'Sign Up' link on this page.
+
Once Apereo OAE is running, you should be able to see the homepage at <%= link_to "http://localhost:8080/", "http://localhost:8080/", :class => "wl-regular-link" %>. If you have not already, create an account by clicking the 'Sign Up' link on this page.
Once you have created an account, log in. You will automatically be taken to the user's personal dashboard and see something like the following:
@@ -329,7 +329,7 @@ HELLO_WORLD = Hello World
* specific language governing permissions and limitations under the License.
*/
-// load the master sakai object to access all Sakai OAE API methods
+// load the master sakai object to access all Apereo OAE API methods
require(["jquery", "sakai/sakai.api.core"], function($, sakai) {
/**
@@ -496,13 +496,13 @@ require(["jquery", "sakai/sakai.api.core"], function($, sakai) {
doInit();
};
- // inform Sakai OAE that this widget has loaded and is ready to run
+ // inform Apereo OAE that this widget has loaded and is ready to run
sakai.api.Widgets.widgetLoader.informOnLoad("helloworld");
});
-
Notice that all the code that pertains to this widget is wrapped in a require statement and a sakai_global.helloworld function. This is another measure to prevent clashes with other widgets that may have similarly named variables or functions (i.e. many widgets have a doInit() function). It also provides other parts of the Sakai OAE framework a standard, convenient way to reference this widget's functionality: JavaScript for all widgets is encapsulated in a sakai_global.WIDGET_ID function.
+
Notice that all the code that pertains to this widget is wrapped in a require statement and a sakai_global.helloworld function. This is another measure to prevent clashes with other widgets that may have similarly named variables or functions (i.e. many widgets have a doInit() function). It also provides other parts of the Apereo OAE framework a standard, convenient way to reference this widget's functionality: JavaScript for all widgets is encapsulated in a sakai_global.WIDGET_ID function.
The overall structure of the sakai_global.myhelloworld function is also important. All widgets should try and follow the same overall structure to make it easier to read and debug widget JavaScript code:
It's always a good idea to look at the <%= link_to "coding standards", "/sdk/codestyleguide", :class => "wl-regular-link" %> we use for Sakai OAE development.
+
It's always a good idea to look at the <%= link_to "coding standards", "/sdk/codestyleguide", :class => "wl-regular-link" %> we use for Apereo OAE development.
When you make your own widget and want to show it to the world, feel free to <%= link_to "submit it", new_version_path, :class => "wl-regular-link" %>.
<%= render :partial => "sdk/feedback" %>
diff --git a/app/views/sdk/navigationalitems.html.erb b/app/views/sdk/navigationalitems.html.erb
index 980a871..129e8fc 100644
--- a/app/views/sdk/navigationalitems.html.erb
+++ b/app/views/sdk/navigationalitems.html.erb
@@ -180,7 +180,7 @@ a.s3d-button.s3d-large-button
When there are multiple pages within a full page widget (e.g. search results)
-
Sakai OAE makes use of <%= link_to "Jon Paul Davies' jQuery Pager", "https://github.com/jonpauldavies/jquery-pager-plugin", :class => "wl-regular-link"%> to provide pagination. It is already included in the Sakai OAE code base and ready to use.
+
Apereo OAE makes use of <%= link_to "Jon Paul Davies' jQuery Pager", "https://github.com/jonpauldavies/jquery-pager-plugin", :class => "wl-regular-link"%> to provide pagination. It is already included in the Apereo OAE code base and ready to use.
CSS class to apply this style
@@ -227,4 +227,4 @@ a.s3d-button.s3d-large-button
<%= render :partial => "sdk/feedback" %>
-
\ No newline at end of file
+
diff --git a/app/views/sdk/quicksetup.html.erb b/app/views/sdk/quicksetup.html.erb
index 320e852..5ee02ce 100644
--- a/app/views/sdk/quicksetup.html.erb
+++ b/app/views/sdk/quicksetup.html.erb
@@ -1,7 +1,7 @@
<% content_for :title do %> - SDK - Quick setup<% end %>
Quick setup
-
This page will guide you through a quick setup of the Sakai OAE. If you would like to be able to add dummy data and use the latest nakamura, we recommend doing the <%= link_to "OAE-Builder setup", "/sdk/developwidget/devsetup", :class => "wl-regular-link" %> .
+
This page will guide you through a quick setup of the Apereo OAE. If you would like to be able to add dummy data and use the latest nakamura, we recommend doing the <%= link_to "OAE-Builder setup", "/sdk/developwidget/devsetup", :class => "wl-regular-link" %> .
For about a minute, you will see Nakamura starting up and a number of logging statements go by. Once it stops, Nakamura is up and running and this terminal will continue to print the server's logging statements. You can test whether it is running by pointing your browser to <%= link_to "http://localhost:8080", "http://localhost:8080", :class => "wl-regular-link" %> - you should see the Sakai OAE homepage.
+
For about a minute, you will see Nakamura starting up and a number of logging statements go by. Once it stops, Nakamura is up and running and this terminal will continue to print the server's logging statements. You can test whether it is running by pointing your browser to <%= link_to "http://localhost:8080", "http://localhost:8080", :class => "wl-regular-link" %> - you should see the Apereo OAE homepage.
Get the 3akai-ux code from GitHub:
-
After logging into <%= link_to "GitHub", "http://github.com", :class => "wl-regular-link", :target => "_blank" %> click the 'Fork' button in the upper-right of the Sakai OAE front-end codebase's GitHub repository, <%= link_to "3akai-ux", "http://github.com/sakaiproject/3akai-ux", :class => "wl-regular-link", :target => "_blank" %>. This will allow you to have a personal copy, or fork, of the 3akai-ux code that you can modify freely.
+
After logging into <%= link_to "GitHub", "http://github.com", :class => "wl-regular-link", :target => "_blank" %> click the 'Fork' button in the upper-right of the Apereo OAE front-end codebase's GitHub repository, <%= link_to "3akai-ux", "http://github.com/sakaiproject/3akai-ux", :class => "wl-regular-link", :target => "_blank" %>. This will allow you to have a personal copy, or fork, of the 3akai-ux code that you can modify freely.
After the fork completes, use git to clone your very own 3akai-ux repository from your sakaioae directory:
This will reach out to GitHub, download the 3akai-ux code and place it in a new 3akai-ux directory in your sakaioae directory. This is where you will do all of your widget development work. Because you own this clone of the main Sakai OAE 3akai-ux repository, you can use git to read and write to this repository.
+
This will reach out to GitHub, download the 3akai-ux code and place it in a new 3akai-ux directory in your sakaioae directory. This is where you will do all of your widget development work. Because you own this clone of the main Apereo OAE 3akai-ux repository, you can use git to read and write to this repository.
<%= image_tag "developer_quickdev_example.png", :alt => "Hello World Quick Dev Example" %>
-
Voila! You are up and running with Sakai OAE! You should now be able to edit 3akai-ux code, save it and refresh your browser to see the changes right away. If you feel ready to dive in, have a look at the <%= link_to "'Hello World' Tutorial", "/sdk/developwidget/learnbasics", :title => "Hello World tutorial", :class => "wl-regular-link" %> or the <%= link_to "Widget designs", "/sdk/designguide/widgetdesigns", :class => "wl-regular-link" %>.
+
Voila! You are up and running with Apereo OAE! You should now be able to edit 3akai-ux code, save it and refresh your browser to see the changes right away. If you feel ready to dive in, have a look at the <%= link_to "'Hello World' Tutorial", "/sdk/developwidget/learnbasics", :title => "Hello World tutorial", :class => "wl-regular-link" %> or the <%= link_to "Widget designs", "/sdk/designguide/widgetdesigns", :class => "wl-regular-link" %>.
Video walkthrough
diff --git a/app/views/sdk/thirdparty.html.erb b/app/views/sdk/thirdparty.html.erb
index 5c7f180..aedcbd4 100644
--- a/app/views/sdk/thirdparty.html.erb
+++ b/app/views/sdk/thirdparty.html.erb
@@ -1,7 +1,7 @@
<% content_for :title do %> - SDK - 3rd party libraries<% end %>
3rd party libraries
-
Sakai OAE employs a number of 3rd party JavaScript libraries. Some of them are core libraries without which the Sakai OAE front-end would not function properly. Others are utility libraries that widgets may use to enhance their interfaces. This page describes these 3rd party libraries, provides examples where useful and points to documentation for the libraries.
+
Apereo OAE employs a number of 3rd party JavaScript libraries. Some of them are core libraries without which the Apereo OAE front-end would not function properly. Others are utility libraries that widgets may use to enhance their interfaces. This page describes these 3rd party libraries, provides examples where useful and points to documentation for the libraries.
Nakamura, the server running Sakai OAE, uses the following components:
+
Nakamura, the server running Apereo OAE, uses the following components:
Apache Aries JMX API
Apache Aries JMX Core
@@ -241,4 +241,4 @@
Sakai Nakamura :: World Support
-
\ No newline at end of file
+
diff --git a/app/views/sdk/typography.html.erb b/app/views/sdk/typography.html.erb
index c57606b..88c5f22 100644
--- a/app/views/sdk/typography.html.erb
+++ b/app/views/sdk/typography.html.erb
@@ -1,7 +1,7 @@
<% content_for :title do %> - SDK - Typography<% end %>
Typography
-
The main font used in Sakai OAE is ‘Arial’, which can be used in all weights (Regular, Bold and Italic). See the <%= link_to "widget examples", "/sdk/designguide/widgetdesigns", :class => "wl-regular-link" %> for font usage.
+
The main font used in Apereo OAE is ‘Arial’, which can be used in all weights (Regular, Bold and Italic). See the <%= link_to "widget examples", "/sdk/designguide/widgetdesigns", :class => "wl-regular-link" %> for font usage.
Heading (Arial - Link color: 2683BC, Hover: 2383BC underline):
Once you've developed your widget, you can submit it to the Sakai OAE Widget Library and the general public via the <%= link_to "Widget submit page", new_version_path, :class => "wl-regular-link" %>.
+
Once you've developed your widget, you can submit it to the Apereo OAE Widget Library and the general public via the <%= link_to "Widget submit page", new_version_path, :class => "wl-regular-link" %>.
The form for submitting a widget is fairly concise. Here is a description of some of the key fields in the Submit Widget form:
@@ -48,4 +48,4 @@
<%= render :partial => "sdk/feedback" %>
-
\ No newline at end of file
+
diff --git a/lib/generators/sakaiwidget/sakaiwidget_generator.rb b/lib/generators/sakaiwidget/sakaiwidget_generator.rb
index e7470cf..2f6a8ef 100644
--- a/lib/generators/sakaiwidget/sakaiwidget_generator.rb
+++ b/lib/generators/sakaiwidget/sakaiwidget_generator.rb
@@ -1,17 +1,16 @@
class SakaiwidgetGenerator < Rails::Generators::NamedBase
-
+
source_root File.expand_path('../templates', __FILE__)
- def create_sakaiwidget
+ def create_sakaiwidget
@apptitle = @_initializer[2][:apptitle]
@appstyle = @_initializer[2][:appstyle]
- @appdesc = @_initializer[2][:appdesc]
- @createdir = @_initializer[2][:destination_root]
+ @createdir = @_initializer[2][:destination_root]
if @appstyle.eql? "skeleton" then
empty_directory "#{@createdir}"
empty_directory "#{@createdir}/#{file_name}"
- copy_file "_template/README.txt", "#{@createdir}/#{file_name}/README.txt"
+ copy_file "_template/README.md", "#{@createdir}/#{file_name}/README.md"
empty_directory "#{@createdir}/#{file_name}/bundles"
copy_file "_template/bundles/default.properties", "#{@createdir}/#{file_name}/bundles/default.properties"
empty_directory "#{@createdir}/#{file_name}/css"
@@ -23,16 +22,13 @@ def create_sakaiwidget
elsif @appstyle.eql? "helloworld" then
empty_directory "#{@createdir}"
empty_directory "#{@createdir}/#{file_name}"
- copy_file "helloworld/README.txt", "#{@createdir}/#{file_name}/README.txt"
+ copy_file "helloworld/README.md", "#{@createdir}/#{file_name}/README.md"
empty_directory "#{@createdir}/#{file_name}/bundles"
copy_file "helloworld/bundles/default.properties", "#{@createdir}/#{file_name}/bundles/default.properties"
- copy_file "helloworld/bundles/en_GB.properties", "#{@createdir}/#{file_name}/bundles/en_GB.properties"
- copy_file "helloworld/bundles/en_US.properties", "#{@createdir}/#{file_name}/bundles/en_US.properties"
+ copy_file "helloworld/bundles/de_DE.properties", "#{@createdir}/#{file_name}/bundles/de_DE.properties"
copy_file "helloworld/bundles/es_ES.properties", "#{@createdir}/#{file_name}/bundles/es_ES.properties"
copy_file "helloworld/bundles/fr_FR.properties", "#{@createdir}/#{file_name}/bundles/fr_FR.properties"
- copy_file "helloworld/bundles/nl_NL.properties", "#{@createdir}/#{file_name}/bundles/nl_NL.properties"
copy_file "helloworld/bundles/ru_RU.properties", "#{@createdir}/#{file_name}/bundles/ru_RU.properties"
- copy_file "helloworld/bundles/zh_CN.properties", "#{@createdir}/#{file_name}/bundles/zh_CN.properties"
empty_directory "#{@createdir}/#{file_name}/css"
template "helloworld/css/helloworld.css", "#{@createdir}/#{file_name}/css/#{file_name}.css"
empty_directory "#{@createdir}/#{file_name}/js"
diff --git a/lib/generators/sakaiwidget/templates/_template/README.md b/lib/generators/sakaiwidget/templates/_template/README.md
new file mode 100644
index 0000000..1b30119
--- /dev/null
+++ b/lib/generators/sakaiwidget/templates/_template/README.md
@@ -0,0 +1,78 @@
+# OAE Widgets
+
+A widget is a modular set of functionality that can be re-used throughout the OAE. Every widget follows the same structure and configuration. The [widget template builder](http://oae-widgets.sakaiproject.org/sdk/developwidget/widgetbuilder) provides a skeleton framework for developers to build on.
+
+## Getting to work with widgets
+### Downloading the widget skeleton framework
+Go to the [widget template builder](http://oae-widgets.sakaiproject.org/sdk/developwidget/widgetbuilder) and generate either an empty skeleton framework or an example `helloworld` widget. Once downloaded and unpacked the directory can be copied to the `3akai-ux/node_modules/oae-core` directory of your installation.
+
+### Widget structure
+Each widget consists of the following structure.
+
+- widgetID/bundles
+ - widgetID/bundles/default.properties
+- widgetID/css
+ - widgetID/css/widgetID.css
+- widgetID/js
+ - widgetID/js/widgetID.js
+- widgetID/widgetID.html
+- widgetID/manifest.json
+
+#### manifest.json
+The `manifest.json` file is the glue that pieces together all files in the widget.
+
+```json
+{
+ "i18n": {
+ "default": {
+ "bundle": "bundles/default.properties"
+ }
+ },
+ "triggers": {
+ "selectors": [".oae-trigger-helloworld"],
+ "events": ["oae.trigger.helloworld"]
+ },
+ "src": "helloworld.html"
+}
+```
+
+##### `i18n`
+The i18n object maps all translations that are available for the widget. In this example only the `default` language is active.
+
+##### `triggers`
+There are several ways to execute a widget.
+
+- Load the widget on page load by adding it to the core HTML pages. `e.g. `
+- **Lazy load** the widget when a specific `event` has been sent out `e.g. oae.trigger.helloworld`. This event needs to be caught by the widget `e.g. $(document).on('oae.trigger.helloworld', sayHi)`.
+- **Lazy load** the widget when a specific selector has been clicked `e.g. .oae-trigger-helloworld`. This click event needs to be caught by the widget `e.g. $(document).on('click', '.oae-trigger-helloworld', sayHi)`.
+
+##### `src`
+`src` links to the location of the HTML source code of the widget. The HTML is usually found in the same directory as the manifest file.
+
+#### widgetID.html
+Contains the HTML snippet for the widget and links to the CSS and JavaScript that needs to be included.
+
+#### i18n bundles
+Bundles are standard `.properties` files that contain translations specific to the widget. Frequently used words and sentences are consolidated in the bundles found at `/ui/bundles/`.
+
+#### JavaScript
+The `js` folder contains a single JavaScript file that handles all logic for the widget. The basic setup is simple. [RequireJS](http://requirejs.org/) is used to load dependencies for the widget (by default at least `jquery` and `oae.core`) and return a function that will be executed.
+
+```javascript
+define(['jquery', 'oae.core'], function($, oae) {
+ return function(uid) {
+ // JavaScript goes in here.
+ };
+});
+```
+
+#### CSS
+The `css` folder contains a single CSS file that handles all styles specific for the widget. A lot of reusable components are already available throughout the system so most widget CSS files have a minimal amount of custom styles defined.
+
+Every style definition should be prefixed with the widget container to scope the style change to the widget.
+
+```css
+#helloworld-container p {
+ margin: 7px 0;
+}
+```
diff --git a/lib/generators/sakaiwidget/templates/_template/README.txt b/lib/generators/sakaiwidget/templates/_template/README.txt
deleted file mode 100644
index 2934081..0000000
--- a/lib/generators/sakaiwidget/templates/_template/README.txt
+++ /dev/null
@@ -1,116 +0,0 @@
-This directory contains a complete set of files for making up a Sakai OAE Widget.
-
-1) You can copy this folder to your 3akai-ux/node_module/oae-core folder. The name of this folder is also the name of the widget. You will need this name if you want to load the widget.
-
-2) Each widget has a certain subfolders and files. We give them a default name by convention.
-
-- widget-name/bundles
-- widget-name/bundles/default.properties
-- widget-name/css
-- widget-name/css/widget-name.css
-- widget-name/js
-- widget-name/js/widget-name.js
-- widget-name/widget-name.html
-- widget-name/manifest.json
-
- 2.1) "Manifest.json"
-
- Manifest.json contains the settings for the widget.
-
- 2.1.1) "i18n"
-
- i18n stands for internationisation and contains the settings about that.
-
- We have a default item that will be used if a language isn't specified.
- Each item has a bundle, name and description.
-
- bundle is the relative path to the properties file of that language starting from the root folder of the widget. For the default value is this "bundles/default.properties".
-
- The languages that Sakai supports are:
-
- - en_GB
- - en_US
- - es_ES
- - fr_FR
- - nl_NL
- - ru_RU
- - zh_CN
-
- 2.1.2) "trigger"
-
- You can specify some trigger settings for the widget.
-
- - "selectors": selectors to load the widget. If you for example add "selectors": [".oae-trigger-widget-name"], you can add this class to a html element. Mostly used when the widget is a bootstrap modal and you didn't specified the widget on the page.
-
- - "events": you can specify some extra events for the widget that you can use with JavaScript to fire and handle that specific event. For example:
-
- // Defining in the manifest.json file
- "events": ["oae.trigger.widget-name"]
-
- // Event handler
- $(document).on('oae.trigger.widget-name', function(ev, data) {
- // Do something
- });
-
- // Fire that event
- $(document).trigger('oae.trigger.widget-name', { data });
-
- 2.1.3) "src"
-
- Contains the location of the html source code of the widget. We use by convention the name of the widget for the name of the html source code file. "widget-name.html".
-
- 2.2) "widget-name.html"
-
- This is the html source file of the widget with the link to the CSS and JavaScript files. There's a JavaScript template engine from TrimPath to render templates available.
- Source: https://code.google.com/p/trimpath/wiki/JavaScriptTemplates
-
- For example:
-
- // HTML code
-
-
- // JavaScript code
- oae.api.util.template().render('#widget-name-template', {}, $('#widget-name-container'));
-
- With this function you can render a template by passing the template, potential data and the selector where the template must be rendered.
-
- Internationalisation:
-
- Notice that we use a special tag for output to the user, everything between "__MSG__" and "__" will be translated into the user's language atleast when that language provides that tag. You have to specify each tag into the properties files. If a tag isn't specified into a properties file than will the default propertie file be used. The tag should always atleast be available in default.properties file. For example:
-
- // In the HTML code
-
__MSG__HELLO_WORLD__
-
- // In the propertie files: default.properties
- HELLO_WORLD = Hello world
-
- => in nl_NL.properties
- HELLO_WORLD = Dag wereld
-
- 2.3) Bundles folder "bundles"
-
- This folder contains all the propteries files for the internationalisation like the example above. This folder should atleast have the default.properties file. Depending on the other languages you have other files for example en_GB.properties.
-
- 2.4) JavaScriptfolder "js"
-
- In this folder are all the JavaScript files of the widget. By default we use always "js" as the name of the folder.
-
- 2.5) "widget-name.js"
-
- Is the main JavaScript of the widget. By default we use name of the widget. If you change this you have to remember that and change it into the html source file.
-
- 2.6) CSS folder "css"
-
- In this folder are all the CSS files of the widget. By default we use always "css" as the name of the folder.
-
- 2.7) "widget-name.css"
-
- Is the main CSS of the widget. By default we use name of the widget. If you change this you have to remember that and change it into the html source file.
-
-3) The last thing we need to do is load the widget on the page, you can do that by adding a data attribute "data-wiget" to a div like "", when loading the page the widget will be rendered there.
-
-You can also load the widget without specifying the widget on the page by using the selector specified in the manifest.json trigger settings, but therefore you have to add that selector to a html element like Load widget, the trigger setting will be: "selectors": [".oae-trigger-widget-name"].
-
-4) After reading this documentation you should have enough information to create you own widget. You can use the widget builder to create an empty widget with the name you want. The widgetbuilder is available at http://oae-widgets.sakaiproject.org/sdk/developwidget/widgetbuilder
\ No newline at end of file
diff --git a/lib/generators/sakaiwidget/templates/_template/WIDGET_ID.html b/lib/generators/sakaiwidget/templates/_template/WIDGET_ID.html
index f575a61..a3d36ed 100644
--- a/lib/generators/sakaiwidget/templates/_template/WIDGET_ID.html
+++ b/lib/generators/sakaiwidget/templates/_template/WIDGET_ID.html
@@ -3,7 +3,7 @@
-
+
diff --git a/lib/generators/sakaiwidget/templates/_template/js/WIDGET_ID.js b/lib/generators/sakaiwidget/templates/_template/js/WIDGET_ID.js
index a75ece4..588aed9 100644
--- a/lib/generators/sakaiwidget/templates/_template/js/WIDGET_ID.js
+++ b/lib/generators/sakaiwidget/templates/_template/js/WIDGET_ID.js
@@ -1,5 +1,5 @@
/*!
- * Copyright 2012 Sakai Foundation (SF) Licensed under the
+ * Copyright 2013 Apereo Foundation (AF) Licensed under the
* Educational Community License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License. You may
* obtain a copy of the License at
@@ -17,11 +17,21 @@ define(['jquery', 'oae.core'], function($, oae) {
return function(uid) {
- // Cache the widget container
+
+ //////////////////////
+ // WIDGET VARIABLES //
+ //////////////////////
+
+ // The widget container
var $rootel = $('#' + uid);
+
+ ////////////////////
+ // INITIALIZATION //
+ ////////////////////
+
/**
- * Initialize this <%= @file_name %> widget
+ * Initializes the `<%= @file_name %>` widget
*/
var init = function() {
diff --git a/lib/generators/sakaiwidget/templates/_template/manifest.json b/lib/generators/sakaiwidget/templates/_template/manifest.json
index 3db9c60..85b5548 100644
--- a/lib/generators/sakaiwidget/templates/_template/manifest.json
+++ b/lib/generators/sakaiwidget/templates/_template/manifest.json
@@ -1,9 +1,7 @@
{
"i18n": {
"default": {
- "bundle": "bundles/default.properties",
- "description": "<%= @appdesc %>",
- "name": "<%= @apptitle %>"
+ "bundle": "bundles/default.properties"
}
},
"src": "<%= @file_name %>.html"
diff --git a/lib/generators/sakaiwidget/templates/helloworld/README.md b/lib/generators/sakaiwidget/templates/helloworld/README.md
new file mode 100755
index 0000000..1b30119
--- /dev/null
+++ b/lib/generators/sakaiwidget/templates/helloworld/README.md
@@ -0,0 +1,78 @@
+# OAE Widgets
+
+A widget is a modular set of functionality that can be re-used throughout the OAE. Every widget follows the same structure and configuration. The [widget template builder](http://oae-widgets.sakaiproject.org/sdk/developwidget/widgetbuilder) provides a skeleton framework for developers to build on.
+
+## Getting to work with widgets
+### Downloading the widget skeleton framework
+Go to the [widget template builder](http://oae-widgets.sakaiproject.org/sdk/developwidget/widgetbuilder) and generate either an empty skeleton framework or an example `helloworld` widget. Once downloaded and unpacked the directory can be copied to the `3akai-ux/node_modules/oae-core` directory of your installation.
+
+### Widget structure
+Each widget consists of the following structure.
+
+- widgetID/bundles
+ - widgetID/bundles/default.properties
+- widgetID/css
+ - widgetID/css/widgetID.css
+- widgetID/js
+ - widgetID/js/widgetID.js
+- widgetID/widgetID.html
+- widgetID/manifest.json
+
+#### manifest.json
+The `manifest.json` file is the glue that pieces together all files in the widget.
+
+```json
+{
+ "i18n": {
+ "default": {
+ "bundle": "bundles/default.properties"
+ }
+ },
+ "triggers": {
+ "selectors": [".oae-trigger-helloworld"],
+ "events": ["oae.trigger.helloworld"]
+ },
+ "src": "helloworld.html"
+}
+```
+
+##### `i18n`
+The i18n object maps all translations that are available for the widget. In this example only the `default` language is active.
+
+##### `triggers`
+There are several ways to execute a widget.
+
+- Load the widget on page load by adding it to the core HTML pages. `e.g. `
+- **Lazy load** the widget when a specific `event` has been sent out `e.g. oae.trigger.helloworld`. This event needs to be caught by the widget `e.g. $(document).on('oae.trigger.helloworld', sayHi)`.
+- **Lazy load** the widget when a specific selector has been clicked `e.g. .oae-trigger-helloworld`. This click event needs to be caught by the widget `e.g. $(document).on('click', '.oae-trigger-helloworld', sayHi)`.
+
+##### `src`
+`src` links to the location of the HTML source code of the widget. The HTML is usually found in the same directory as the manifest file.
+
+#### widgetID.html
+Contains the HTML snippet for the widget and links to the CSS and JavaScript that needs to be included.
+
+#### i18n bundles
+Bundles are standard `.properties` files that contain translations specific to the widget. Frequently used words and sentences are consolidated in the bundles found at `/ui/bundles/`.
+
+#### JavaScript
+The `js` folder contains a single JavaScript file that handles all logic for the widget. The basic setup is simple. [RequireJS](http://requirejs.org/) is used to load dependencies for the widget (by default at least `jquery` and `oae.core`) and return a function that will be executed.
+
+```javascript
+define(['jquery', 'oae.core'], function($, oae) {
+ return function(uid) {
+ // JavaScript goes in here.
+ };
+});
+```
+
+#### CSS
+The `css` folder contains a single CSS file that handles all styles specific for the widget. A lot of reusable components are already available throughout the system so most widget CSS files have a minimal amount of custom styles defined.
+
+Every style definition should be prefixed with the widget container to scope the style change to the widget.
+
+```css
+#helloworld-container p {
+ margin: 7px 0;
+}
+```
diff --git a/lib/generators/sakaiwidget/templates/helloworld/README.txt b/lib/generators/sakaiwidget/templates/helloworld/README.txt
deleted file mode 100755
index 2934081..0000000
--- a/lib/generators/sakaiwidget/templates/helloworld/README.txt
+++ /dev/null
@@ -1,116 +0,0 @@
-This directory contains a complete set of files for making up a Sakai OAE Widget.
-
-1) You can copy this folder to your 3akai-ux/node_module/oae-core folder. The name of this folder is also the name of the widget. You will need this name if you want to load the widget.
-
-2) Each widget has a certain subfolders and files. We give them a default name by convention.
-
-- widget-name/bundles
-- widget-name/bundles/default.properties
-- widget-name/css
-- widget-name/css/widget-name.css
-- widget-name/js
-- widget-name/js/widget-name.js
-- widget-name/widget-name.html
-- widget-name/manifest.json
-
- 2.1) "Manifest.json"
-
- Manifest.json contains the settings for the widget.
-
- 2.1.1) "i18n"
-
- i18n stands for internationisation and contains the settings about that.
-
- We have a default item that will be used if a language isn't specified.
- Each item has a bundle, name and description.
-
- bundle is the relative path to the properties file of that language starting from the root folder of the widget. For the default value is this "bundles/default.properties".
-
- The languages that Sakai supports are:
-
- - en_GB
- - en_US
- - es_ES
- - fr_FR
- - nl_NL
- - ru_RU
- - zh_CN
-
- 2.1.2) "trigger"
-
- You can specify some trigger settings for the widget.
-
- - "selectors": selectors to load the widget. If you for example add "selectors": [".oae-trigger-widget-name"], you can add this class to a html element. Mostly used when the widget is a bootstrap modal and you didn't specified the widget on the page.
-
- - "events": you can specify some extra events for the widget that you can use with JavaScript to fire and handle that specific event. For example:
-
- // Defining in the manifest.json file
- "events": ["oae.trigger.widget-name"]
-
- // Event handler
- $(document).on('oae.trigger.widget-name', function(ev, data) {
- // Do something
- });
-
- // Fire that event
- $(document).trigger('oae.trigger.widget-name', { data });
-
- 2.1.3) "src"
-
- Contains the location of the html source code of the widget. We use by convention the name of the widget for the name of the html source code file. "widget-name.html".
-
- 2.2) "widget-name.html"
-
- This is the html source file of the widget with the link to the CSS and JavaScript files. There's a JavaScript template engine from TrimPath to render templates available.
- Source: https://code.google.com/p/trimpath/wiki/JavaScriptTemplates
-
- For example:
-
- // HTML code
-
-
- // JavaScript code
- oae.api.util.template().render('#widget-name-template', {}, $('#widget-name-container'));
-
- With this function you can render a template by passing the template, potential data and the selector where the template must be rendered.
-
- Internationalisation:
-
- Notice that we use a special tag for output to the user, everything between "__MSG__" and "__" will be translated into the user's language atleast when that language provides that tag. You have to specify each tag into the properties files. If a tag isn't specified into a properties file than will the default propertie file be used. The tag should always atleast be available in default.properties file. For example:
-
- // In the HTML code
-
__MSG__HELLO_WORLD__
-
- // In the propertie files: default.properties
- HELLO_WORLD = Hello world
-
- => in nl_NL.properties
- HELLO_WORLD = Dag wereld
-
- 2.3) Bundles folder "bundles"
-
- This folder contains all the propteries files for the internationalisation like the example above. This folder should atleast have the default.properties file. Depending on the other languages you have other files for example en_GB.properties.
-
- 2.4) JavaScriptfolder "js"
-
- In this folder are all the JavaScript files of the widget. By default we use always "js" as the name of the folder.
-
- 2.5) "widget-name.js"
-
- Is the main JavaScript of the widget. By default we use name of the widget. If you change this you have to remember that and change it into the html source file.
-
- 2.6) CSS folder "css"
-
- In this folder are all the CSS files of the widget. By default we use always "css" as the name of the folder.
-
- 2.7) "widget-name.css"
-
- Is the main CSS of the widget. By default we use name of the widget. If you change this you have to remember that and change it into the html source file.
-
-3) The last thing we need to do is load the widget on the page, you can do that by adding a data attribute "data-wiget" to a div like "", when loading the page the widget will be rendered there.
-
-You can also load the widget without specifying the widget on the page by using the selector specified in the manifest.json trigger settings, but therefore you have to add that selector to a html element like Load widget, the trigger setting will be: "selectors": [".oae-trigger-widget-name"].
-
-4) After reading this documentation you should have enough information to create you own widget. You can use the widget builder to create an empty widget with the name you want. The widgetbuilder is available at http://oae-widgets.sakaiproject.org/sdk/developwidget/widgetbuilder
\ No newline at end of file
diff --git a/lib/generators/sakaiwidget/templates/helloworld/bundles/de_DE.properties b/lib/generators/sakaiwidget/templates/helloworld/bundles/de_DE.properties
new file mode 100644
index 0000000..60a4b18
--- /dev/null
+++ b/lib/generators/sakaiwidget/templates/helloworld/bundles/de_DE.properties
@@ -0,0 +1,2 @@
+HELLO_WORLD= Hallo Welt
+HI_NAME= Hallo ${displayName}
diff --git a/lib/generators/sakaiwidget/templates/helloworld/bundles/default.properties b/lib/generators/sakaiwidget/templates/helloworld/bundles/default.properties
old mode 100755
new mode 100644
index 041a2f5..b323048
--- a/lib/generators/sakaiwidget/templates/helloworld/bundles/default.properties
+++ b/lib/generators/sakaiwidget/templates/helloworld/bundles/default.properties
@@ -1,7 +1,2 @@
HELLO_WORLD = Hello world
-PICTURE = Picture
-FIRST_NAME = First name
-LAST_NAME = Last name
-EMAIL = Email
-MALE = Male
-FEMALE = Female
+HI_NAME = Hi ${displayName}
diff --git a/lib/generators/sakaiwidget/templates/helloworld/bundles/en_GB.properties b/lib/generators/sakaiwidget/templates/helloworld/bundles/en_GB.properties
deleted file mode 100755
index 041a2f5..0000000
--- a/lib/generators/sakaiwidget/templates/helloworld/bundles/en_GB.properties
+++ /dev/null
@@ -1,7 +0,0 @@
-HELLO_WORLD = Hello world
-PICTURE = Picture
-FIRST_NAME = First name
-LAST_NAME = Last name
-EMAIL = Email
-MALE = Male
-FEMALE = Female
diff --git a/lib/generators/sakaiwidget/templates/helloworld/bundles/en_US.properties b/lib/generators/sakaiwidget/templates/helloworld/bundles/en_US.properties
deleted file mode 100755
index 041a2f5..0000000
--- a/lib/generators/sakaiwidget/templates/helloworld/bundles/en_US.properties
+++ /dev/null
@@ -1,7 +0,0 @@
-HELLO_WORLD = Hello world
-PICTURE = Picture
-FIRST_NAME = First name
-LAST_NAME = Last name
-EMAIL = Email
-MALE = Male
-FEMALE = Female
diff --git a/lib/generators/sakaiwidget/templates/helloworld/bundles/es_ES.properties b/lib/generators/sakaiwidget/templates/helloworld/bundles/es_ES.properties
old mode 100755
new mode 100644
index 44f2b78..f87cd5f
--- a/lib/generators/sakaiwidget/templates/helloworld/bundles/es_ES.properties
+++ b/lib/generators/sakaiwidget/templates/helloworld/bundles/es_ES.properties
@@ -1,7 +1,2 @@
-HELLO_WORLD = Hola mundo
-PICTURE = Imagen
-FIRST_NAME = Primer nombre
-LAST_NAME = Apellido
-EMAIL = Email
-MALE = Masculino
-FEMALE = Femenino
+HELLO_WORLD= Hola mundo
+HI_NAME= ¡Hola ${displayName}
diff --git a/lib/generators/sakaiwidget/templates/helloworld/bundles/fr_FR.properties b/lib/generators/sakaiwidget/templates/helloworld/bundles/fr_FR.properties
old mode 100755
new mode 100644
index 2e95769..1bbed2a
--- a/lib/generators/sakaiwidget/templates/helloworld/bundles/fr_FR.properties
+++ b/lib/generators/sakaiwidget/templates/helloworld/bundles/fr_FR.properties
@@ -1,7 +1,2 @@
-HELLO_WORLD = Bonjour tout le monde
-PICTURE = Image
-FIRST_NAME = Prénom
-LAST_NAME = Nom de famille
-EMAIL = Email
-MALE = Masculin
-FEMALE = Féminin
+HELLO_WORLD= Bonjour tout le monde
+HI_NAME= Bonjour ${displayName}
diff --git a/lib/generators/sakaiwidget/templates/helloworld/bundles/nl_NL.properties b/lib/generators/sakaiwidget/templates/helloworld/bundles/nl_NL.properties
deleted file mode 100755
index 0bbe6a1..0000000
--- a/lib/generators/sakaiwidget/templates/helloworld/bundles/nl_NL.properties
+++ /dev/null
@@ -1,7 +0,0 @@
-HELLO_WORLD = Dag iedereen
-PICTURE = Afbeelding
-FIRST_NAME = Voornaam
-LAST_NAME = Familienaam
-EMAIL = Email
-MALE = Man
-FEMALE = Vrouw
diff --git a/lib/generators/sakaiwidget/templates/helloworld/bundles/ru_RU.properties b/lib/generators/sakaiwidget/templates/helloworld/bundles/ru_RU.properties
old mode 100755
new mode 100644
index 4f0fcc7..af01d5e
--- a/lib/generators/sakaiwidget/templates/helloworld/bundles/ru_RU.properties
+++ b/lib/generators/sakaiwidget/templates/helloworld/bundles/ru_RU.properties
@@ -1,7 +1,2 @@
-HELLO_WORLD = привет мир
-PICTURE = картинка
-FIRST_NAME = имя
-LAST_NAME = фамилия
-EMAIL = письмо
-MALE = мужчина
-FEMALE = женщина
+HELLO_WORLD = Здравствуй, мир
+HI_NAME = привет ${displayName}
diff --git a/lib/generators/sakaiwidget/templates/helloworld/bundles/zh_CN.properties b/lib/generators/sakaiwidget/templates/helloworld/bundles/zh_CN.properties
deleted file mode 100755
index 84a0b01..0000000
--- a/lib/generators/sakaiwidget/templates/helloworld/bundles/zh_CN.properties
+++ /dev/null
@@ -1,7 +0,0 @@
-HELLO_WORLD = 你好世界
-PICTURE = 圖片
-FIRST_NAME = 名字
-LAST_NAME = 姓
-EMAIL = 電子郵件
-MALE = 男
-FEMALE = 女
diff --git a/lib/generators/sakaiwidget/templates/helloworld/css/helloworld.css b/lib/generators/sakaiwidget/templates/helloworld/css/helloworld.css
index 5f34a5e..71970f5 100755
--- a/lib/generators/sakaiwidget/templates/helloworld/css/helloworld.css
+++ b/lib/generators/sakaiwidget/templates/helloworld/css/helloworld.css
@@ -13,19 +13,3 @@
* permissions and limitations under the License.
*/
-#<%= @file_name %>-container {
-margin-left: 50px;
-}
-#<%= @file_name %>-container .tab-content, #<%= @file_name %>-container .nav-tabs {
- max-width:600px;
-}
-#<%= @file_name %>-container h1 {
- margin-bottom: 40px;
-}
-#<%= @file_name %>-container .nav > li.active > a {
- background-color: #ffffff;
-}
-#<%= @file_name %>-container div.oae-thumbnail {
- height: 75px;
- width: 75px;
-}
diff --git a/lib/generators/sakaiwidget/templates/helloworld/helloworld.html b/lib/generators/sakaiwidget/templates/helloworld/helloworld.html
index 73832c1..481a874 100755
--- a/lib/generators/sakaiwidget/templates/helloworld/helloworld.html
+++ b/lib/generators/sakaiwidget/templates/helloworld/helloworld.html
@@ -1,50 +1,18 @@
-
-
-
+
+
+
+
+
__MSG__HELLO_WORLD__
+
+
-
diff --git a/lib/generators/sakaiwidget/templates/helloworld/js/helloworld.js b/lib/generators/sakaiwidget/templates/helloworld/js/helloworld.js
index ae5d590..958a07d 100755
--- a/lib/generators/sakaiwidget/templates/helloworld/js/helloworld.js
+++ b/lib/generators/sakaiwidget/templates/helloworld/js/helloworld.js
@@ -1,5 +1,5 @@
/*!
- * Copyright 2012 Sakai Foundation (SF) Licensed under the
+ * Copyright 2013 Apereo Foundation (SF) Licensed under the
* Educational Community License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License. You may
* obtain a copy of the License at
@@ -17,33 +17,55 @@ define(['jquery', 'oae.core'], function($, oae) {
return function(uid) {
- // Cache the widget container
+
+ //////////////////////
+ // WIDGET VARIABLES //
+ //////////////////////
+
+ // The widget container
var $rootel = $('#' + uid);
+
+ ///////////
+ // VIEWS //
+ ///////////
+
/**
- * Initialize this <%= @file_name %> widget
+ * Says hi to the current user by rendering a template into the modal body
*/
- var init = function() {
- var profile1 = {firstname: "John", lastname: "Doe", email: "john.doe@johndoe.com", gender: "male"};
- var profile2 = {firstname: "Jane", lastname: "Doe", email: "jane.doe@janedoe.com", gender: "female"};
- var profile3 = {firstname: "John", lastname: "Smith", email: "john.smith@johnsmith.com", gender: "male"};
- var profile4 = {firstname: "Ivan", lastname: "Petrov", email: "ivan.petrov@ivanpetrov.com", gender: "male"};
- var profile5 = {firstname: "Ivan", lastname: "Horvat", email: "ivan.Horvat@ivanhorvat.com", gender: "male"};
- var profile6 = {firstname: "Jan", lastname: "Novak", email: "jan.novak@jannovak.com", gender: "male"};
- var profile7 = {firstname: "Jens", lastname: "Hansen", email: "jens.hansen@jenshansen.com", gender: "male"};
- var profile8 = {firstname: "Jan", lastname: "Janssen", email: "jan.janssen@janjanssen.com", gender: "male"};
- var profile9 = {firstname: "Pieter", lastname: "Pietersen", email: "pieter.pietersen@pieterpietersen.com", gender: "male"};
- var profile10 = {firstname: "Jean", lastname: "Dupont", email: "jean.dupont@jeandupont.com", gender: "male"};
- var profile11 = {firstname: "Jane", lastname: "Smith", email: "jane.smith@janesmith.com", gender: "female"};
- var profile12 = {firstname: "Marjan", lastname: "Devos", email: "marjan.devos@marjandevos.com", gender: "female"};
-
- var profiles = [];
-
- profiles.push(profile1, profile2, profile3, profile4, profile5, profile6, profile7, profile8, profile9, profile10, profile11, profile12);
-
- oae.api.util.template().render('#<%= @file_name %>-template', {"profiles": profiles}, $('#<%= @file_name %>-container'));
+ var sayHi = function() {
+ oae.api.util.template().render($('#<%= @file_name %>-template', $rootel), null, $('.modal-body', $rootel));
+ };
+
+
+ /////////////
+ // UTILITY //
+ /////////////
+
+ /**
+ * Shows the modal dialog and calls the `sayHi` function.
+ */
+ var show<%= @file_name %>Modal = function() {
+ $('#<%= @file_name %>-modal', $rootel).modal();
+ sayHi();
+ };
+
+
+ ////////////////////
+ // INITIALIZATION //
+ ////////////////////
+
+ /**
+ * Sets up the Hello World widget
+ */
+ var setUp<%= @file_name %> = function() {
+ // Bind to the <%= @file_name %> trigger event and show the modal dialog.
+ $(document).on('oae.trigger.<%= @file_name %>', show<%= @file_name %>Modal);
+
+ // Bind to the <%= @file_name %> click event and show the modal dialog.
+ $(document).on('click', '.oae-trigger-<%= @file_name %>', show<%= @file_name %>Modal);
};
- init();
+ setUp<%= @file_name %>();
};
});
diff --git a/lib/generators/sakaiwidget/templates/helloworld/manifest.json b/lib/generators/sakaiwidget/templates/helloworld/manifest.json
index 425e5c9..5bed090 100755
--- a/lib/generators/sakaiwidget/templates/helloworld/manifest.json
+++ b/lib/generators/sakaiwidget/templates/helloworld/manifest.json
@@ -1,49 +1,24 @@
{
"i18n": {
"default": {
- "bundle": "bundles/default.properties",
- "name": "<%= @apptitle %>",
- "description": "<%= @appdesc %>"
+ "bundle": "bundles/default.properties"
},
- "en_GB": {
- "bundle": "bundles/en_GB.properties",
- "name": "<%= @apptitle %>",
- "description": "<%= @appdesc %>"
- },
- "en_US": {
- "bundle": "bundles/en_US.properties",
- "name": "<%= @apptitle %>",
- "description": "<%= @appdesc %>"
+ "de_DE": {
+ "bundle": "bundles/de_DE.properties"
},
"es_ES": {
- "bundle": "bundles/es_ES.properties",
- "name": "<%= @apptitle %>",
- "description": "<%= @appdesc %>"
+ "bundle": "bundles/es_ES.properties"
},
"fr_FR": {
- "bundle": "bundles/fr_FR.properties",
- "name": "<%= @apptitle %>",
- "description": "<%= @appdesc %>"
- },
- "nl_NL": {
- "bundle": "bundles/nl_NL.properties",
- "name": "<%= @apptitle %>",
- "description": "<%= @appdesc %>"
+ "bundle": "bundles/fr_FR.properties"
},
"ru_RU": {
- "bundle": "bundles/ru_RU.properties",
- "name": "<%= @apptitle %>",
- "description": "<%= @appdesc %>"
- },
- "zh_CN": {
- "bundle": "bundles/zh_CN.properties",
- "name": "<%= @apptitle %>",
- "description": "<%= @appdesc %>"
+ "bundle": "bundles/ru_RU.properties"
}
},
"trigger": {
- "selectors": [".oae-trigger-<%= @file_name %>"],
- "events": ["oae.trigger.<%= @file_name %>"]
+ "events": ["oae.trigger.<%= @file_name %>"],
+ "selectors": [".oae-trigger-<%= @file_name %>"]
},
"src": "<%= @file_name %>.html"
}
diff --git a/public/favicon.ico b/public/favicon.ico
index e69de29..ff29da5 100644
Binary files a/public/favicon.ico and b/public/favicon.ico differ
diff --git a/vendor/assets/javascripts/history.js/history.adapter.jquery.js b/vendor/assets/javascripts/history.js/history.adapter.jquery.js
deleted file mode 100644
index 8c252d5..0000000
--- a/vendor/assets/javascripts/history.js/history.adapter.jquery.js
+++ /dev/null
@@ -1,77 +0,0 @@
-/**
- * History.js jQuery Adapter
- * @author Benjamin Arthur Lupton
- * @copyright 2010-2011 Benjamin Arthur Lupton
- * @license New BSD License
- */
-
-// Closure
-(function(window,undefined){
- "use strict";
-
- // Localise Globals
- var
- History = window.History = window.History||{},
- jQuery = window.jQuery;
-
- // Check Existence
- if ( typeof History.Adapter !== 'undefined' ) {
- throw new Error('History.js Adapter has already been loaded...');
- }
-
- // Add the Adapter
- History.Adapter = {
- /**
- * History.Adapter.bind(el,event,callback)
- * @param {Element|string} el
- * @param {string} event - custom and standard events
- * @param {function} callback
- * @return {void}
- */
- bind: function(el,event,callback){
- jQuery(el).bind(event,callback);
- },
-
- /**
- * History.Adapter.trigger(el,event)
- * @param {Element|string} el
- * @param {string} event - custom and standard events
- * @param {Object=} extra - a object of extra event data (optional)
- * @return {void}
- */
- trigger: function(el,event,extra){
- jQuery(el).trigger(event,extra);
- },
-
- /**
- * History.Adapter.extractEventData(key,event,extra)
- * @param {string} key - key for the event data to extract
- * @param {string} event - custom and standard events
- * @param {Object=} extra - a object of extra event data (optional)
- * @return {mixed}
- */
- extractEventData: function(key,event,extra){
- // jQuery Native then jQuery Custom
- var result = (event && event.originalEvent && event.originalEvent[key]) || (extra && extra[key]) || undefined;
-
- // Return
- return result;
- },
-
- /**
- * History.Adapter.onDomLoad(callback)
- * @param {function} callback
- * @return {void}
- */
- onDomLoad: function(callback) {
- jQuery(callback);
- }
- };
-
- // Try and Initialise History
- if ( typeof History.init !== 'undefined' ) {
- History.init();
- }
-
-})(window);
-
diff --git a/vendor/assets/javascripts/history.js/history.html4.js b/vendor/assets/javascripts/history.js/history.html4.js
deleted file mode 100644
index 6d8d427..0000000
--- a/vendor/assets/javascripts/history.js/history.html4.js
+++ /dev/null
@@ -1,621 +0,0 @@
-/**
- * History.js HTML4 Support
- * Depends on the HTML5 Support
- * @author Benjamin Arthur Lupton
- * @copyright 2010-2011 Benjamin Arthur Lupton
- * @license New BSD License
- */
-
-(function(window,undefined){
- "use strict";
-
- // ========================================================================
- // Initialise
-
- // Localise Globals
- var
- document = window.document, // Make sure we are using the correct document
- setTimeout = window.setTimeout||setTimeout,
- clearTimeout = window.clearTimeout||clearTimeout,
- setInterval = window.setInterval||setInterval,
- History = window.History = window.History||{}; // Public History Object
-
- // Check Existence
- if ( typeof History.initHtml4 !== 'undefined' ) {
- throw new Error('History.js HTML4 Support has already been loaded...');
- }
-
-
- // ========================================================================
- // Initialise HTML4 Support
-
- // Initialise HTML4 Support
- History.initHtml4 = function(){
- // Initialise
- if ( typeof History.initHtml4.initialized !== 'undefined' ) {
- // Already Loaded
- return false;
- }
- else {
- History.initHtml4.initialized = true;
- }
-
-
- // ====================================================================
- // Properties
-
- /**
- * History.enabled
- * Is History enabled?
- */
- History.enabled = true;
-
-
- // ====================================================================
- // Hash Storage
-
- /**
- * History.savedHashes
- * Store the hashes in an array
- */
- History.savedHashes = [];
-
- /**
- * History.isLastHash(newHash)
- * Checks if the hash is the last hash
- * @param {string} newHash
- * @return {boolean} true
- */
- History.isLastHash = function(newHash){
- // Prepare
- var oldHash = History.getHashByIndex(),
- isLast;
-
- // Check
- isLast = newHash === oldHash;
-
- // Return isLast
- return isLast;
- };
-
- /**
- * History.saveHash(newHash)
- * Push a Hash
- * @param {string} newHash
- * @return {boolean} true
- */
- History.saveHash = function(newHash){
- // Check Hash
- if ( History.isLastHash(newHash) ) {
- return false;
- }
-
- // Push the Hash
- History.savedHashes.push(newHash);
-
- // Return true
- return true;
- };
-
- /**
- * History.getHashByIndex()
- * Gets a hash by the index
- * @param {integer} index
- * @return {string}
- */
- History.getHashByIndex = function(index){
- // Prepare
- var hash = null;
-
- // Handle
- if ( typeof index === 'undefined' ) {
- // Get the last inserted
- hash = History.savedHashes[History.savedHashes.length-1];
- }
- else if ( index < 0 ) {
- // Get from the end
- hash = History.savedHashes[History.savedHashes.length+index];
- }
- else {
- // Get from the beginning
- hash = History.savedHashes[index];
- }
-
- // Return hash
- return hash;
- };
-
-
- // ====================================================================
- // Discarded States
-
- /**
- * History.discardedHashes
- * A hashed array of discarded hashes
- */
- History.discardedHashes = {};
-
- /**
- * History.discardedStates
- * A hashed array of discarded states
- */
- History.discardedStates = {};
-
- /**
- * History.discardState(State)
- * Discards the state by ignoring it through History
- * @param {object} State
- * @return {true}
- */
- History.discardState = function(discardedState,forwardState,backState){
- //History.debug('History.discardState', arguments);
- // Prepare
- var discardedStateHash = History.getHashByState(discardedState),
- discardObject;
-
- // Create Discard Object
- discardObject = {
- 'discardedState': discardedState,
- 'backState': backState,
- 'forwardState': forwardState
- };
-
- // Add to DiscardedStates
- History.discardedStates[discardedStateHash] = discardObject;
-
- // Return true
- return true;
- };
-
- /**
- * History.discardHash(hash)
- * Discards the hash by ignoring it through History
- * @param {string} hash
- * @return {true}
- */
- History.discardHash = function(discardedHash,forwardState,backState){
- //History.debug('History.discardState', arguments);
- // Create Discard Object
- var discardObject = {
- 'discardedHash': discardedHash,
- 'backState': backState,
- 'forwardState': forwardState
- };
-
- // Add to discardedHash
- History.discardedHashes[discardedHash] = discardObject;
-
- // Return true
- return true;
- };
-
- /**
- * History.discardState(State)
- * Checks to see if the state is discarded
- * @param {object} State
- * @return {bool}
- */
- History.discardedState = function(State){
- // Prepare
- var StateHash = History.getHashByState(State),
- discarded;
-
- // Check
- discarded = History.discardedStates[StateHash]||false;
-
- // Return true
- return discarded;
- };
-
- /**
- * History.discardedHash(hash)
- * Checks to see if the state is discarded
- * @param {string} State
- * @return {bool}
- */
- History.discardedHash = function(hash){
- // Check
- var discarded = History.discardedHashes[hash]||false;
-
- // Return true
- return discarded;
- };
-
- /**
- * History.recycleState(State)
- * Allows a discarded state to be used again
- * @param {object} data
- * @param {string} title
- * @param {string} url
- * @return {true}
- */
- History.recycleState = function(State){
- //History.debug('History.recycleState', arguments);
- // Prepare
- var StateHash = History.getHashByState(State);
-
- // Remove from DiscardedStates
- if ( History.discardedState(State) ) {
- delete History.discardedStates[StateHash];
- }
-
- // Return true
- return true;
- };
-
-
- // ====================================================================
- // HTML4 HashChange Support
-
- if ( History.emulated.hashChange ) {
- /*
- * We must emulate the HTML4 HashChange Support by manually checking for hash changes
- */
-
- /**
- * History.hashChangeInit()
- * Init the HashChange Emulation
- */
- History.hashChangeInit = function(){
- // Define our Checker Function
- History.checkerFunction = null;
-
- // Define some variables that will help in our checker function
- var lastDocumentHash = '',
- iframeId, iframe,
- lastIframeHash, checkerRunning;
-
- // Handle depending on the browser
- if ( History.isInternetExplorer() ) {
- // IE6 and IE7
- // We need to use an iframe to emulate the back and forward buttons
-
- // Create iFrame
- iframeId = 'historyjs-iframe';
- iframe = document.createElement('iframe');
-
- // Adjust iFarme
- iframe.setAttribute('id', iframeId);
- iframe.style.display = 'none';
-
- // Append iFrame
- document.body.appendChild(iframe);
-
- // Create initial history entry
- iframe.contentWindow.document.open();
- iframe.contentWindow.document.close();
-
- // Define some variables that will help in our checker function
- lastIframeHash = '';
- checkerRunning = false;
-
- // Define the checker function
- History.checkerFunction = function(){
- // Check Running
- if ( checkerRunning ) {
- return false;
- }
-
- // Update Running
- checkerRunning = true;
-
- // Fetch
- var documentHash = History.getHash()||'',
- iframeHash = History.unescapeHash(iframe.contentWindow.document.location.hash)||'';
-
- // The Document Hash has changed (application caused)
- if ( documentHash !== lastDocumentHash ) {
- // Equalise
- lastDocumentHash = documentHash;
-
- // Create a history entry in the iframe
- if ( iframeHash !== documentHash ) {
- //History.debug('hashchange.checker: iframe hash change', 'documentHash (new):', documentHash, 'iframeHash (old):', iframeHash);
-
- // Equalise
- lastIframeHash = iframeHash = documentHash;
-
- // Create History Entry
- iframe.contentWindow.document.open();
- iframe.contentWindow.document.close();
-
- // Update the iframe's hash
- iframe.contentWindow.document.location.hash = History.escapeHash(documentHash);
- }
-
- // Trigger Hashchange Event
- History.Adapter.trigger(window,'hashchange');
- }
-
- // The iFrame Hash has changed (back button caused)
- else if ( iframeHash !== lastIframeHash ) {
- //History.debug('hashchange.checker: iframe hash out of sync', 'iframeHash (new):', iframeHash, 'documentHash (old):', documentHash);
-
- // Equalise
- lastIframeHash = iframeHash;
-
- // Update the Hash
- History.setHash(iframeHash,false);
- }
-
- // Reset Running
- checkerRunning = false;
-
- // Return true
- return true;
- };
- }
- else {
- // We are not IE
- // Firefox 1 or 2, Opera
-
- // Define the checker function
- History.checkerFunction = function(){
- // Prepare
- var documentHash = History.getHash();
-
- // The Document Hash has changed (application caused)
- if ( documentHash !== lastDocumentHash ) {
- // Equalise
- lastDocumentHash = documentHash;
-
- // Trigger Hashchange Event
- History.Adapter.trigger(window,'hashchange');
- }
-
- // Return true
- return true;
- };
- }
-
- // Apply the checker function
- History.intervalList.push(setInterval(History.checkerFunction, History.options.hashChangeInterval));
-
- // Done
- return true;
- }; // History.hashChangeInit
-
- // Bind hashChangeInit
- History.Adapter.onDomLoad(History.hashChangeInit);
-
- } // History.emulated.hashChange
-
-
- // ====================================================================
- // HTML5 State Support
-
- // Non-Native pushState Implementation
- if ( History.emulated.pushState ) {
- /*
- * We must emulate the HTML5 State Management by using HTML4 HashChange
- */
-
- /**
- * History.onHashChange(event)
- * Trigger HTML5's window.onpopstate via HTML4 HashChange Support
- */
- History.onHashChange = function(event){
- //History.debug('History.onHashChange', arguments);
-
- // Prepare
- var currentUrl = ((event && event.newURL) || document.location.href),
- currentHash = History.getHashByUrl(currentUrl),
- currentState = null,
- currentStateHash = null,
- currentStateHashExits = null,
- discardObject;
-
- // Check if we are the same state
- if ( History.isLastHash(currentHash) ) {
- // There has been no change (just the page's hash has finally propagated)
- //History.debug('History.onHashChange: no change');
- History.busy(false);
- return false;
- }
-
- // Reset the double check
- History.doubleCheckComplete();
-
- // Store our location for use in detecting back/forward direction
- History.saveHash(currentHash);
-
- // Expand Hash
- if ( currentHash && History.isTraditionalAnchor(currentHash) ) {
- //History.debug('History.onHashChange: traditional anchor', currentHash);
- // Traditional Anchor Hash
- History.Adapter.trigger(window,'anchorchange');
- History.busy(false);
- return false;
- }
-
- // Create State
- currentState = History.extractState(History.getFullUrl(currentHash||document.location.href,false),true);
-
- // Check if we are the same state
- if ( History.isLastSavedState(currentState) ) {
- //History.debug('History.onHashChange: no change');
- // There has been no change (just the page's hash has finally propagated)
- History.busy(false);
- return false;
- }
-
- // Create the state Hash
- currentStateHash = History.getHashByState(currentState);
-
- // Check if we are DiscardedState
- discardObject = History.discardedState(currentState);
- if ( discardObject ) {
- // Ignore this state as it has been discarded and go back to the state before it
- if ( History.getHashByIndex(-2) === History.getHashByState(discardObject.forwardState) ) {
- // We are going backwards
- //History.debug('History.onHashChange: go backwards');
- History.back(false);
- } else {
- // We are going forwards
- //History.debug('History.onHashChange: go forwards');
- History.forward(false);
- }
- return false;
- }
-
- // Push the new HTML5 State
- //History.debug('History.onHashChange: success hashchange');
- History.pushState(currentState.data,currentState.title,currentState.url,false);
-
- // End onHashChange closure
- return true;
- };
- History.Adapter.bind(window,'hashchange',History.onHashChange);
-
- /**
- * History.pushState(data,title,url)
- * Add a new State to the history object, become it, and trigger onpopstate
- * We have to trigger for HTML4 compatibility
- * @param {object} data
- * @param {string} title
- * @param {string} url
- * @return {true}
- */
- History.pushState = function(data,title,url,queue){
- //History.debug('History.pushState: called', arguments);
-
- // Check the State
- if ( History.getHashByUrl(url) ) {
- throw new Error('History.js does not support states with fragement-identifiers (hashes/anchors).');
- }
-
- // Handle Queueing
- if ( queue !== false && History.busy() ) {
- // Wait + Push to Queue
- //History.debug('History.pushState: we must wait', arguments);
- History.pushQueue({
- scope: History,
- callback: History.pushState,
- args: arguments,
- queue: queue
- });
- return false;
- }
-
- // Make Busy
- History.busy(true);
-
- // Fetch the State Object
- var newState = History.createStateObject(data,title,url),
- newStateHash = History.getHashByState(newState),
- oldState = History.getState(false),
- oldStateHash = History.getHashByState(oldState),
- html4Hash = History.getHash();
-
- // Store the newState
- History.storeState(newState);
- History.expectedStateId = newState.id;
-
- // Recycle the State
- History.recycleState(newState);
-
- // Force update of the title
- History.setTitle(newState);
-
- // Check if we are the same State
- if ( newStateHash === oldStateHash ) {
- //History.debug('History.pushState: no change', newStateHash);
- History.busy(false);
- return false;
- }
-
- // Update HTML4 Hash
- if ( newStateHash !== html4Hash && newStateHash !== History.getShortUrl(document.location.href) ) {
- //History.debug('History.pushState: update hash', newStateHash, html4Hash);
- History.setHash(newStateHash,false);
- return false;
- }
-
- // Update HTML5 State
- History.saveState(newState);
-
- // Fire HTML5 Event
- //History.debug('History.pushState: trigger popstate');
- History.Adapter.trigger(window,'statechange');
- History.busy(false);
-
- // End pushState closure
- return true;
- };
-
- /**
- * History.replaceState(data,title,url)
- * Replace the State and trigger onpopstate
- * We have to trigger for HTML4 compatibility
- * @param {object} data
- * @param {string} title
- * @param {string} url
- * @return {true}
- */
- History.replaceState = function(data,title,url,queue){
- //History.debug('History.replaceState: called', arguments);
-
- // Check the State
- if ( History.getHashByUrl(url) ) {
- throw new Error('History.js does not support states with fragement-identifiers (hashes/anchors).');
- }
-
- // Handle Queueing
- if ( queue !== false && History.busy() ) {
- // Wait + Push to Queue
- //History.debug('History.replaceState: we must wait', arguments);
- History.pushQueue({
- scope: History,
- callback: History.replaceState,
- args: arguments,
- queue: queue
- });
- return false;
- }
-
- // Make Busy
- History.busy(true);
-
- // Fetch the State Objects
- var newState = History.createStateObject(data,title,url),
- oldState = History.getState(false),
- previousState = History.getStateByIndex(-2);
-
- // Discard Old State
- History.discardState(oldState,newState,previousState);
-
- // Alias to PushState
- History.pushState(newState.data,newState.title,newState.url,false);
-
- // End replaceState closure
- return true;
- };
-
- } // History.emulated.pushState
-
-
-
- // ====================================================================
- // Initialise
-
- // Non-Native pushState Implementation
- if ( History.emulated.pushState ) {
- /**
- * Ensure initial state is handled correctly
- */
- if ( History.getHash() && !History.emulated.hashChange ) {
- History.Adapter.onDomLoad(function(){
- History.Adapter.trigger(window,'hashchange');
- });
- }
-
- } // History.emulated.pushState
-
- }; // History.initHtml4
-
- // Try and Initialise History
- if ( typeof History.init !== 'undefined' ) {
- History.init();
- }
-
-})(window);
diff --git a/vendor/assets/javascripts/history.js/history.js b/vendor/assets/javascripts/history.js/history.js
deleted file mode 100644
index 0e7cb1e..0000000
--- a/vendor/assets/javascripts/history.js/history.js
+++ /dev/null
@@ -1,1943 +0,0 @@
-/**
- * History.js Core
- * @author Benjamin Arthur Lupton
- * @copyright 2010-2011 Benjamin Arthur Lupton
- * @license New BSD License
- */
-
-(function(window,undefined){
- "use strict";
-
- // ========================================================================
- // Initialise
-
- // Localise Globals
- var
- console = window.console||undefined, // Prevent a JSLint complain
- document = window.document, // Make sure we are using the correct document
- navigator = window.navigator, // Make sure we are using the correct navigator
- sessionStorage = window.sessionStorage||false, // sessionStorage
- setTimeout = window.setTimeout,
- clearTimeout = window.clearTimeout,
- setInterval = window.setInterval,
- clearInterval = window.clearInterval,
- JSON = window.JSON,
- alert = window.alert,
- History = window.History = window.History||{}, // Public History Object
- history = window.history; // Old History Object
-
- // MooTools Compatibility
- JSON.stringify = JSON.stringify||JSON.encode;
- JSON.parse = JSON.parse||JSON.decode;
-
- // Check Existence
- if ( typeof History.init !== 'undefined' ) {
- throw new Error('History.js Core has already been loaded...');
- }
-
- // Initialise History
- History.init = function(){
- // Check Load Status of Adapter
- if ( typeof History.Adapter === 'undefined' ) {
- return false;
- }
-
- // Check Load Status of Core
- if ( typeof History.initCore !== 'undefined' ) {
- History.initCore();
- }
-
- // Check Load Status of HTML4 Support
- if ( typeof History.initHtml4 !== 'undefined' ) {
- History.initHtml4();
- }
-
- // Return true
- return true;
- };
-
-
- // ========================================================================
- // Initialise Core
-
- // Initialise Core
- History.initCore = function(){
- // Initialise
- if ( typeof History.initCore.initialized !== 'undefined' ) {
- // Already Loaded
- return false;
- }
- else {
- History.initCore.initialized = true;
- }
-
-
- // ====================================================================
- // Options
-
- /**
- * History.options
- * Configurable options
- */
- History.options = History.options||{};
-
- /**
- * History.options.hashChangeInterval
- * How long should the interval be before hashchange checks
- */
- History.options.hashChangeInterval = History.options.hashChangeInterval || 100;
-
- /**
- * History.options.safariPollInterval
- * How long should the interval be before safari poll checks
- */
- History.options.safariPollInterval = History.options.safariPollInterval || 500;
-
- /**
- * History.options.doubleCheckInterval
- * How long should the interval be before we perform a double check
- */
- History.options.doubleCheckInterval = History.options.doubleCheckInterval || 500;
-
- /**
- * History.options.storeInterval
- * How long should we wait between store calls
- */
- History.options.storeInterval = History.options.storeInterval || 1000;
-
- /**
- * History.options.busyDelay
- * How long should we wait between busy events
- */
- History.options.busyDelay = History.options.busyDelay || 250;
-
- /**
- * History.options.debug
- * If true will enable debug messages to be logged
- */
- History.options.debug = History.options.debug || false;
-
- /**
- * History.options.initialTitle
- * What is the title of the initial state
- */
- History.options.initialTitle = History.options.initialTitle || document.title;
-
-
- // ====================================================================
- // Interval record
-
- /**
- * History.intervalList
- * List of intervals set, to be cleared when document is unloaded.
- */
- History.intervalList = [];
-
- /**
- * History.clearAllIntervals
- * Clears all setInterval instances.
- */
- History.clearAllIntervals = function(){
- var i, il = History.intervalList;
- if (typeof il !== "undefined" && il !== null) {
- for (i = 0; i < il.length; i++) {
- clearInterval(il[i]);
- }
- History.intervalList = null;
- }
- };
-
-
- // ====================================================================
- // Debug
-
- /**
- * History.debug(message,...)
- * Logs the passed arguments if debug enabled
- */
- History.debug = function(){
- if ( (History.options.debug||false) ) {
- History.log.apply(History,arguments);
- }
- };
-
- /**
- * History.log(message,...)
- * Logs the passed arguments
- */
- History.log = function(){
- // Prepare
- var
- consoleExists = !(typeof console === 'undefined' || typeof console.log === 'undefined' || typeof console.log.apply === 'undefined'),
- textarea = document.getElementById('log'),
- message,
- i,n,
- args,arg
- ;
-
- // Write to Console
- if ( consoleExists ) {
- args = Array.prototype.slice.call(arguments);
- message = args.shift();
- if ( typeof console.debug !== 'undefined' ) {
- console.debug.apply(console,[message,args]);
- }
- else {
- console.log.apply(console,[message,args]);
- }
- }
- else {
- message = ("\n"+arguments[0]+"\n");
- }
-
- // Write to log
- for ( i=1,n=arguments.length; i
- * @author James Padolsey
- */
- History.getInternetExplorerMajorVersion = function(){
- var result = History.getInternetExplorerMajorVersion.cached =
- (typeof History.getInternetExplorerMajorVersion.cached !== 'undefined')
- ? History.getInternetExplorerMajorVersion.cached
- : (function(){
- var v = 3,
- div = document.createElement('div'),
- all = div.getElementsByTagName('i');
- while ( (div.innerHTML = '') && all[0] ) {}
- return (v > 4) ? v : false;
- })()
- ;
- return result;
- };
-
- /**
- * History.isInternetExplorer()
- * Are we using Internet Explorer?
- * @return {boolean}
- * @license Public Domain
- * @author Benjamin Arthur Lupton
- */
- History.isInternetExplorer = function(){
- var result =
- History.isInternetExplorer.cached =
- (typeof History.isInternetExplorer.cached !== 'undefined')
- ? History.isInternetExplorer.cached
- : Boolean(History.getInternetExplorerMajorVersion())
- ;
- return result;
- };
-
- /**
- * History.emulated
- * Which features require emulating?
- */
- History.emulated = {
- pushState: !Boolean(
- window.history && window.history.pushState && window.history.replaceState
- && !(
- (/ Mobile\/([1-7][a-z]|(8([abcde]|f(1[0-8]))))/i).test(navigator.userAgent) /* disable for versions of iOS before version 4.3 (8F190) */
- || (/AppleWebKit\/5([0-2]|3[0-2])/i).test(navigator.userAgent) /* disable for the mercury iOS browser, or at least older versions of the webkit engine */
- )
- ),
- hashChange: Boolean(
- !(('onhashchange' in window) || ('onhashchange' in document))
- ||
- (History.isInternetExplorer() && History.getInternetExplorerMajorVersion() < 8)
- )
- };
-
- /**
- * History.enabled
- * Is History enabled?
- */
- History.enabled = !History.emulated.pushState;
-
- /**
- * History.bugs
- * Which bugs are present
- */
- History.bugs = {
- /**
- * Safari 5 and Safari iOS 4 fail to return to the correct state once a hash is replaced by a `replaceState` call
- * https://bugs.webkit.org/show_bug.cgi?id=56249
- */
- setHash: Boolean(!History.emulated.pushState && navigator.vendor === 'Apple Computer, Inc.' && /AppleWebKit\/5([0-2]|3[0-3])/.test(navigator.userAgent)),
-
- /**
- * Safari 5 and Safari iOS 4 sometimes fail to apply the state change under busy conditions
- * https://bugs.webkit.org/show_bug.cgi?id=42940
- */
- safariPoll: Boolean(!History.emulated.pushState && navigator.vendor === 'Apple Computer, Inc.' && /AppleWebKit\/5([0-2]|3[0-3])/.test(navigator.userAgent)),
-
- /**
- * MSIE 6 and 7 sometimes do not apply a hash even it was told to (requiring a second call to the apply function)
- */
- ieDoubleCheck: Boolean(History.isInternetExplorer() && History.getInternetExplorerMajorVersion() < 8),
-
- /**
- * MSIE 6 requires the entire hash to be encoded for the hashes to trigger the onHashChange event
- */
- hashEscape: Boolean(History.isInternetExplorer() && History.getInternetExplorerMajorVersion() < 7)
- };
-
- /**
- * History.isEmptyObject(obj)
- * Checks to see if the Object is Empty
- * @param {Object} obj
- * @return {boolean}
- */
- History.isEmptyObject = function(obj) {
- for ( var name in obj ) {
- return false;
- }
- return true;
- };
-
- /**
- * History.cloneObject(obj)
- * Clones a object and eliminate all references to the original contexts
- * @param {Object} obj
- * @return {Object}
- */
- History.cloneObject = function(obj) {
- var hash,newObj;
- if ( obj ) {
- hash = JSON.stringify(obj);
- newObj = JSON.parse(hash);
- }
- else {
- newObj = {};
- }
- return newObj;
- };
-
-
- // ====================================================================
- // URL Helpers
-
- /**
- * History.getRootUrl()
- * Turns "http://mysite.com/dir/page.html?asd" into "http://mysite.com"
- * @return {String} rootUrl
- */
- History.getRootUrl = function(){
- // Create
- var rootUrl = document.location.protocol+'//'+(document.location.hostname||document.location.host);
- if ( document.location.port||false ) {
- rootUrl += ':'+document.location.port;
- }
- rootUrl += '/';
-
- // Return
- return rootUrl;
- };
-
- /**
- * History.getBaseHref()
- * Fetches the `href` attribute of the `` element if it exists
- * @return {String} baseHref
- */
- History.getBaseHref = function(){
- // Create
- var
- baseElements = document.getElementsByTagName('base'),
- baseElement = null,
- baseHref = '';
-
- // Test for Base Element
- if ( baseElements.length === 1 ) {
- // Prepare for Base Element
- baseElement = baseElements[0];
- baseHref = baseElement.href.replace(/[^\/]+$/,'');
- }
-
- // Adjust trailing slash
- baseHref = baseHref.replace(/\/+$/,'');
- if ( baseHref ) baseHref += '/';
-
- // Return
- return baseHref;
- };
-
- /**
- * History.getBaseUrl()
- * Fetches the baseHref or basePageUrl or rootUrl (whichever one exists first)
- * @return {String} baseUrl
- */
- History.getBaseUrl = function(){
- // Create
- var baseUrl = History.getBaseHref()||History.getBasePageUrl()||History.getRootUrl();
-
- // Return
- return baseUrl;
- };
-
- /**
- * History.getPageUrl()
- * Fetches the URL of the current page
- * @return {String} pageUrl
- */
- History.getPageUrl = function(){
- // Fetch
- var
- State = History.getState(false,false),
- stateUrl = (State||{}).url||document.location.href,
- pageUrl;
-
- // Create
- pageUrl = stateUrl.replace(/\/+$/,'').replace(/[^\/]+$/,function(part,index,string){
- return (/\./).test(part) ? part : part+'/';
- });
-
- // Return
- return pageUrl;
- };
-
- /**
- * History.getBasePageUrl()
- * Fetches the Url of the directory of the current page
- * @return {String} basePageUrl
- */
- History.getBasePageUrl = function(){
- // Create
- var basePageUrl = document.location.href.replace(/[#\?].*/,'').replace(/[^\/]+$/,function(part,index,string){
- return (/[^\/]$/).test(part) ? '' : part;
- }).replace(/\/+$/,'')+'/';
-
- // Return
- return basePageUrl;
- };
-
- /**
- * History.getFullUrl(url)
- * Ensures that we have an absolute URL and not a relative URL
- * @param {string} url
- * @param {Boolean} allowBaseHref
- * @return {string} fullUrl
- */
- History.getFullUrl = function(url,allowBaseHref){
- // Prepare
- var fullUrl = url, firstChar = url.substring(0,1);
- allowBaseHref = (typeof allowBaseHref === 'undefined') ? true : allowBaseHref;
-
- // Check
- if ( /[a-z]+\:\/\//.test(url) ) {
- // Full URL
- }
- else if ( firstChar === '/' ) {
- // Root URL
- fullUrl = History.getRootUrl()+url.replace(/^\/+/,'');
- }
- else if ( firstChar === '#' ) {
- // Anchor URL
- fullUrl = History.getPageUrl().replace(/#.*/,'')+url;
- }
- else if ( firstChar === '?' ) {
- // Query URL
- fullUrl = History.getPageUrl().replace(/[\?#].*/,'')+url;
- }
- else {
- // Relative URL
- if ( allowBaseHref ) {
- fullUrl = History.getBaseUrl()+url.replace(/^(\.\/)+/,'');
- } else {
- fullUrl = History.getBasePageUrl()+url.replace(/^(\.\/)+/,'');
- }
- // We have an if condition above as we do not want hashes
- // which are relative to the baseHref in our URLs
- // as if the baseHref changes, then all our bookmarks
- // would now point to different locations
- // whereas the basePageUrl will always stay the same
- }
-
- // Return
- return fullUrl.replace(/\#$/,'');
- };
-
- /**
- * History.getShortUrl(url)
- * Ensures that we have a relative URL and not a absolute URL
- * @param {string} url
- * @return {string} url
- */
- History.getShortUrl = function(url){
- // Prepare
- var shortUrl = url, baseUrl = History.getBaseUrl(), rootUrl = History.getRootUrl();
-
- // Trim baseUrl
- if ( History.emulated.pushState ) {
- // We are in a if statement as when pushState is not emulated
- // The actual url these short urls are relative to can change
- // So within the same session, we the url may end up somewhere different
- shortUrl = shortUrl.replace(baseUrl,'');
- }
-
- // Trim rootUrl
- shortUrl = shortUrl.replace(rootUrl,'/');
-
- // Ensure we can still detect it as a state
- if ( History.isTraditionalAnchor(shortUrl) ) {
- shortUrl = './'+shortUrl;
- }
-
- // Clean It
- shortUrl = shortUrl.replace(/^(\.\/)+/g,'./').replace(/\#$/,'');
-
- // Return
- return shortUrl;
- };
-
-
- // ====================================================================
- // State Storage
-
- /**
- * History.store
- * The store for all session specific data
- */
- History.store = {};
-
- /**
- * History.idToState
- * 1-1: State ID to State Object
- */
- History.idToState = History.idToState||{};
-
- /**
- * History.stateToId
- * 1-1: State String to State ID
- */
- History.stateToId = History.stateToId||{};
-
- /**
- * History.urlToId
- * 1-1: State URL to State ID
- */
- History.urlToId = History.urlToId||{};
-
- /**
- * History.storedStates
- * Store the states in an array
- */
- History.storedStates = History.storedStates||[];
-
- /**
- * History.savedStates
- * Saved the states in an array
- */
- History.savedStates = History.savedStates||[];
-
- /**
- * History.noramlizeStore()
- * Noramlize the store by adding necessary values
- */
- History.normalizeStore = function(){
- History.store.idToState = History.store.idToState||{};
- History.store.urlToId = History.store.urlToId||{};
- History.store.stateToId = History.store.stateToId||{};
- };
-
- /**
- * History.getState()
- * Get an object containing the data, title and url of the current state
- * @param {Boolean} friendly
- * @param {Boolean} create
- * @return {Object} State
- */
- History.getState = function(friendly,create){
- // Prepare
- if ( typeof friendly === 'undefined' ) { friendly = true; }
- if ( typeof create === 'undefined' ) { create = true; }
-
- // Fetch
- var State = History.getLastSavedState();
-
- // Create
- if ( !State && create ) {
- State = History.createStateObject();
- }
-
- // Adjust
- if ( friendly ) {
- State = History.cloneObject(State);
- State.url = State.cleanUrl||State.url;
- }
-
- // Return
- return State;
- };
-
- /**
- * History.getIdByState(State)
- * Gets a ID for a State
- * @param {State} newState
- * @return {String} id
- */
- History.getIdByState = function(newState){
-
- // Fetch ID
- var id = History.extractId(newState.url),
- str;
-
- if ( !id ) {
- // Find ID via State String
- str = History.getStateString(newState);
- if ( typeof History.stateToId[str] !== 'undefined' ) {
- id = History.stateToId[str];
- }
- else if ( typeof History.store.stateToId[str] !== 'undefined' ) {
- id = History.store.stateToId[str];
- }
- else {
- // Generate a new ID
- while ( true ) {
- id = (new Date()).getTime() + String(Math.random()).replace(/\D/g,'');
- if ( typeof History.idToState[id] === 'undefined' && typeof History.store.idToState[id] === 'undefined' ) {
- break;
- }
- }
-
- // Apply the new State to the ID
- History.stateToId[str] = id;
- History.idToState[id] = newState;
- }
- }
-
- // Return ID
- return id;
- };
-
- /**
- * History.normalizeState(State)
- * Expands a State Object
- * @param {object} State
- * @return {object}
- */
- History.normalizeState = function(oldState){
- // Variables
- var newState, dataNotEmpty;
-
- // Prepare
- if ( !oldState || (typeof oldState !== 'object') ) {
- oldState = {};
- }
-
- // Check
- if ( typeof oldState.normalized !== 'undefined' ) {
- return oldState;
- }
-
- // Adjust
- if ( !oldState.data || (typeof oldState.data !== 'object') ) {
- oldState.data = {};
- }
-
- // ----------------------------------------------------------------
-
- // Create
- newState = {};
- newState.normalized = true;
- newState.title = oldState.title||'';
- newState.url = History.getFullUrl(History.unescapeString(oldState.url||document.location.href));
- newState.hash = History.getShortUrl(newState.url);
- newState.data = History.cloneObject(oldState.data);
-
- // Fetch ID
- newState.id = History.getIdByState(newState);
-
- // ----------------------------------------------------------------
-
- // Clean the URL
- newState.cleanUrl = newState.url.replace(/\??\&_suid.*/,'');
- newState.url = newState.cleanUrl;
-
- // Check to see if we have more than just a url
- dataNotEmpty = !History.isEmptyObject(newState.data);
-
- // Apply
- if ( newState.title || dataNotEmpty ) {
- // Add ID to Hash
- newState.hash = History.getShortUrl(newState.url).replace(/\??\&_suid.*/,'');
- if ( !/\?/.test(newState.hash) ) {
- newState.hash += '?';
- }
- newState.hash += '&_suid='+newState.id;
- }
-
- // Create the Hashed URL
- newState.hashedUrl = History.getFullUrl(newState.hash);
-
- // ----------------------------------------------------------------
-
- // Update the URL if we have a duplicate
- if ( (History.emulated.pushState || History.bugs.safariPoll) && History.hasUrlDuplicate(newState) ) {
- newState.url = newState.hashedUrl;
- }
-
- // ----------------------------------------------------------------
-
- // Return
- return newState;
- };
-
- /**
- * History.createStateObject(data,title,url)
- * Creates a object based on the data, title and url state params
- * @param {object} data
- * @param {string} title
- * @param {string} url
- * @return {object}
- */
- History.createStateObject = function(data,title,url){
- // Hashify
- var State = {
- 'data': data,
- 'title': title,
- 'url': url
- };
-
- // Expand the State
- State = History.normalizeState(State);
-
- // Return object
- return State;
- };
-
- /**
- * History.getStateById(id)
- * Get a state by it's UID
- * @param {String} id
- */
- History.getStateById = function(id){
- // Prepare
- id = String(id);
-
- // Retrieve
- var State = History.idToState[id] || History.store.idToState[id] || undefined;
-
- // Return State
- return State;
- };
-
- /**
- * Get a State's String
- * @param {State} passedState
- */
- History.getStateString = function(passedState){
- // Prepare
- var State, cleanedState, str;
-
- // Fetch
- State = History.normalizeState(passedState);
-
- // Clean
- cleanedState = {
- data: State.data,
- title: passedState.title,
- url: passedState.url
- };
-
- // Fetch
- str = JSON.stringify(cleanedState);
-
- // Return
- return str;
- };
-
- /**
- * Get a State's ID
- * @param {State} passedState
- * @return {String} id
- */
- History.getStateId = function(passedState){
- // Prepare
- var State, id;
-
- // Fetch
- State = History.normalizeState(passedState);
-
- // Fetch
- id = State.id;
-
- // Return
- return id;
- };
-
- /**
- * History.getHashByState(State)
- * Creates a Hash for the State Object
- * @param {State} passedState
- * @return {String} hash
- */
- History.getHashByState = function(passedState){
- // Prepare
- var State, hash;
-
- // Fetch
- State = History.normalizeState(passedState);
-
- // Hash
- hash = State.hash;
-
- // Return
- return hash;
- };
-
- /**
- * History.extractId(url_or_hash)
- * Get a State ID by it's URL or Hash
- * @param {string} url_or_hash
- * @return {string} id
- */
- History.extractId = function ( url_or_hash ) {
- // Prepare
- var id,parts,url;
-
- // Extract
- parts = /(.*)\&_suid=([0-9]+)$/.exec(url_or_hash);
- url = parts ? (parts[1]||url_or_hash) : url_or_hash;
- id = parts ? String(parts[2]||'') : '';
-
- // Return
- return id||false;
- };
-
- /**
- * History.isTraditionalAnchor
- * Checks to see if the url is a traditional anchor or not
- * @param {String} url_or_hash
- * @return {Boolean}
- */
- History.isTraditionalAnchor = function(url_or_hash){
- // Check
- var isTraditional = !(/[\/\?\.]/.test(url_or_hash));
-
- // Return
- return isTraditional;
- };
-
- /**
- * History.extractState
- * Get a State by it's URL or Hash
- * @param {String} url_or_hash
- * @return {State|null}
- */
- History.extractState = function(url_or_hash,create){
- // Prepare
- var State = null, id, url;
- create = create||false;
-
- // Fetch SUID
- id = History.extractId(url_or_hash);
- if ( id ) {
- State = History.getStateById(id);
- }
-
- // Fetch SUID returned no State
- if ( !State ) {
- // Fetch URL
- url = History.getFullUrl(url_or_hash);
-
- // Check URL
- id = History.getIdByUrl(url)||false;
- if ( id ) {
- State = History.getStateById(id);
- }
-
- // Create State
- if ( !State && create && !History.isTraditionalAnchor(url_or_hash) ) {
- State = History.createStateObject(null,null,url);
- }
- }
-
- // Return
- return State;
- };
-
- /**
- * History.getIdByUrl()
- * Get a State ID by a State URL
- */
- History.getIdByUrl = function(url){
- // Fetch
- var id = History.urlToId[url] || History.store.urlToId[url] || undefined;
-
- // Return
- return id;
- };
-
- /**
- * History.getLastSavedState()
- * Get an object containing the data, title and url of the current state
- * @return {Object} State
- */
- History.getLastSavedState = function(){
- return History.savedStates[History.savedStates.length-1]||undefined;
- };
-
- /**
- * History.getLastStoredState()
- * Get an object containing the data, title and url of the current state
- * @return {Object} State
- */
- History.getLastStoredState = function(){
- return History.storedStates[History.storedStates.length-1]||undefined;
- };
-
- /**
- * History.hasUrlDuplicate
- * Checks if a Url will have a url conflict
- * @param {Object} newState
- * @return {Boolean} hasDuplicate
- */
- History.hasUrlDuplicate = function(newState) {
- // Prepare
- var hasDuplicate = false,
- oldState;
-
- // Fetch
- oldState = History.extractState(newState.url);
-
- // Check
- hasDuplicate = oldState && oldState.id !== newState.id;
-
- // Return
- return hasDuplicate;
- };
-
- /**
- * History.storeState
- * Store a State
- * @param {Object} newState
- * @return {Object} newState
- */
- History.storeState = function(newState){
- // Store the State
- History.urlToId[newState.url] = newState.id;
-
- // Push the State
- History.storedStates.push(History.cloneObject(newState));
-
- // Return newState
- return newState;
- };
-
- /**
- * History.isLastSavedState(newState)
- * Tests to see if the state is the last state
- * @param {Object} newState
- * @return {boolean} isLast
- */
- History.isLastSavedState = function(newState){
- // Prepare
- var isLast = false,
- newId, oldState, oldId;
-
- // Check
- if ( History.savedStates.length ) {
- newId = newState.id;
- oldState = History.getLastSavedState();
- oldId = oldState.id;
-
- // Check
- isLast = (newId === oldId);
- }
-
- // Return
- return isLast;
- };
-
- /**
- * History.saveState
- * Push a State
- * @param {Object} newState
- * @return {boolean} changed
- */
- History.saveState = function(newState){
- // Check Hash
- if ( History.isLastSavedState(newState) ) {
- return false;
- }
-
- // Push the State
- History.savedStates.push(History.cloneObject(newState));
-
- // Return true
- return true;
- };
-
- /**
- * History.getStateByIndex()
- * Gets a state by the index
- * @param {integer} index
- * @return {Object}
- */
- History.getStateByIndex = function(index){
- // Prepare
- var State = null;
-
- // Handle
- if ( typeof index === 'undefined' ) {
- // Get the last inserted
- State = History.savedStates[History.savedStates.length-1];
- }
- else if ( index < 0 ) {
- // Get from the end
- State = History.savedStates[History.savedStates.length+index];
- }
- else {
- // Get from the beginning
- State = History.savedStates[index];
- }
-
- // Return State
- return State;
- };
-
-
- // ====================================================================
- // Hash Helpers
-
- /**
- * History.getHash()
- * Gets the current document hash
- * @return {string}
- */
- History.getHash = function(){
- var hash = History.unescapeHash(document.location.hash);
- return hash;
- };
-
- /**
- * History.unescapeString()
- * Unescape a string
- * @param {String} str
- * @return {string}
- */
- History.unescapeString = function(str){
- // Prepare
- var result = str,
- tmp;
-
- // Unescape hash
- while ( true ) {
- tmp = window.unescape(result);
- if ( tmp === result ) {
- break;
- }
- result = tmp;
- }
-
- // Return result
- return result;
- };
-
- /**
- * History.unescapeHash()
- * normalize and Unescape a Hash
- * @param {String} hash
- * @return {string}
- */
- History.unescapeHash = function(hash){
- // Prepare
- var result = History.normalizeHash(hash);
-
- // Unescape hash
- result = History.unescapeString(result);
-
- // Return result
- return result;
- };
-
- /**
- * History.normalizeHash()
- * normalize a hash across browsers
- * @return {string}
- */
- History.normalizeHash = function(hash){
- // Prepare
- var result = hash.replace(/[^#]*#/,'').replace(/#.*/, '');
-
- // Return result
- return result;
- };
-
- /**
- * History.setHash(hash)
- * Sets the document hash
- * @param {string} hash
- * @return {History}
- */
- History.setHash = function(hash,queue){
- // Prepare
- var adjustedHash, State, pageUrl;
-
- // Handle Queueing
- if ( queue !== false && History.busy() ) {
- // Wait + Push to Queue
- //History.debug('History.setHash: we must wait', arguments);
- History.pushQueue({
- scope: History,
- callback: History.setHash,
- args: arguments,
- queue: queue
- });
- return false;
- }
-
- // Log
- //History.debug('History.setHash: called',hash);
-
- // Prepare
- adjustedHash = History.escapeHash(hash);
-
- // Make Busy + Continue
- History.busy(true);
-
- // Check if hash is a state
- State = History.extractState(hash,true);
- if ( State && !History.emulated.pushState ) {
- // Hash is a state so skip the setHash
- //History.debug('History.setHash: Hash is a state so skipping the hash set with a direct pushState call',arguments);
-
- // PushState
- History.pushState(State.data,State.title,State.url,false);
- }
- else if ( document.location.hash !== adjustedHash ) {
- // Hash is a proper hash, so apply it
-
- // Handle browser bugs
- if ( History.bugs.setHash ) {
- // Fix Safari Bug https://bugs.webkit.org/show_bug.cgi?id=56249
-
- // Fetch the base page
- pageUrl = History.getPageUrl();
-
- // Safari hash apply
- History.pushState(null,null,pageUrl+'#'+adjustedHash,false);
- }
- else {
- // Normal hash apply
- document.location.hash = adjustedHash;
- }
- }
-
- // Chain
- return History;
- };
-
- /**
- * History.escape()
- * normalize and Escape a Hash
- * @return {string}
- */
- History.escapeHash = function(hash){
- // Prepare
- var result = History.normalizeHash(hash);
-
- // Escape hash
- result = window.escape(result);
-
- // IE6 Escape Bug
- if ( !History.bugs.hashEscape ) {
- // Restore common parts
- result = result
- .replace(/\%21/g,'!')
- .replace(/\%26/g,'&')
- .replace(/\%3D/g,'=')
- .replace(/\%3F/g,'?');
- }
-
- // Return result
- return result;
- };
-
- /**
- * History.getHashByUrl(url)
- * Extracts the Hash from a URL
- * @param {string} url
- * @return {string} url
- */
- History.getHashByUrl = function(url){
- // Extract the hash
- var hash = String(url)
- .replace(/([^#]*)#?([^#]*)#?(.*)/, '$2')
- ;
-
- // Unescape hash
- hash = History.unescapeHash(hash);
-
- // Return hash
- return hash;
- };
-
- /**
- * History.setTitle(title)
- * Applies the title to the document
- * @param {State} newState
- * @return {Boolean}
- */
- History.setTitle = function(newState){
- // Prepare
- var title = newState.title,
- firstState;
-
- // Initial
- if ( !title ) {
- firstState = History.getStateByIndex(0);
- if ( firstState && firstState.url === newState.url ) {
- title = firstState.title||History.options.initialTitle;
- }
- }
-
- // Apply
- try {
- document.getElementsByTagName('title')[0].innerHTML = title.replace('<','<').replace('>','>').replace(' & ',' & ');
- }
- catch ( Exception ) { }
- document.title = title;
-
- // Chain
- return History;
- };
-
-
- // ====================================================================
- // Queueing
-
- /**
- * History.queues
- * The list of queues to use
- * First In, First Out
- */
- History.queues = [];
-
- /**
- * History.busy(value)
- * @param {boolean} value [optional]
- * @return {boolean} busy
- */
- History.busy = function(value){
- // Apply
- if ( typeof value !== 'undefined' ) {
- //History.debug('History.busy: changing ['+(History.busy.flag||false)+'] to ['+(value||false)+']', History.queues.length);
- History.busy.flag = value;
- }
- // Default
- else if ( typeof History.busy.flag === 'undefined' ) {
- History.busy.flag = false;
- }
-
- // Queue
- if ( !History.busy.flag ) {
- // Execute the next item in the queue
- clearTimeout(History.busy.timeout);
- var fireNext = function(){
- var i, queue, item;
- if ( History.busy.flag ) return;
- for ( i=History.queues.length-1; i >= 0; --i ) {
- queue = History.queues[i];
- if ( queue.length === 0 ) continue;
- item = queue.shift();
- History.fireQueueItem(item);
- History.busy.timeout = setTimeout(fireNext,History.options.busyDelay);
- }
- };
- History.busy.timeout = setTimeout(fireNext,History.options.busyDelay);
- }
-
- // Return
- return History.busy.flag;
- };
-
- /**
- * History.busy.flag
- */
- History.busy.flag = false;
-
- /**
- * History.fireQueueItem(item)
- * Fire a Queue Item
- * @param {Object} item
- * @return {Mixed} result
- */
- History.fireQueueItem = function(item){
- return item.callback.apply(item.scope||History,item.args||[]);
- };
-
- /**
- * History.pushQueue(callback,args)
- * Add an item to the queue
- * @param {Object} item [scope,callback,args,queue]
- */
- History.pushQueue = function(item){
- // Prepare the queue
- History.queues[item.queue||0] = History.queues[item.queue||0]||[];
-
- // Add to the queue
- History.queues[item.queue||0].push(item);
-
- // Chain
- return History;
- };
-
- /**
- * History.queue (item,queue), (func,queue), (func), (item)
- * Either firs the item now if not busy, or adds it to the queue
- */
- History.queue = function(item,queue){
- // Prepare
- if ( typeof item === 'function' ) {
- item = {
- callback: item
- };
- }
- if ( typeof queue !== 'undefined' ) {
- item.queue = queue;
- }
-
- // Handle
- if ( History.busy() ) {
- History.pushQueue(item);
- } else {
- History.fireQueueItem(item);
- }
-
- // Chain
- return History;
- };
-
- /**
- * History.clearQueue()
- * Clears the Queue
- */
- History.clearQueue = function(){
- History.busy.flag = false;
- History.queues = [];
- return History;
- };
-
-
- // ====================================================================
- // IE Bug Fix
-
- /**
- * History.stateChanged
- * States whether or not the state has changed since the last double check was initialised
- */
- History.stateChanged = false;
-
- /**
- * History.doubleChecker
- * Contains the timeout used for the double checks
- */
- History.doubleChecker = false;
-
- /**
- * History.doubleCheckComplete()
- * Complete a double check
- * @return {History}
- */
- History.doubleCheckComplete = function(){
- // Update
- History.stateChanged = true;
-
- // Clear
- History.doubleCheckClear();
-
- // Chain
- return History;
- };
-
- /**
- * History.doubleCheckClear()
- * Clear a double check
- * @return {History}
- */
- History.doubleCheckClear = function(){
- // Clear
- if ( History.doubleChecker ) {
- clearTimeout(History.doubleChecker);
- History.doubleChecker = false;
- }
-
- // Chain
- return History;
- };
-
- /**
- * History.doubleCheck()
- * Create a double check
- * @return {History}
- */
- History.doubleCheck = function(tryAgain){
- // Reset
- History.stateChanged = false;
- History.doubleCheckClear();
-
- // Fix IE6,IE7 bug where calling history.back or history.forward does not actually change the hash (whereas doing it manually does)
- // Fix Safari 5 bug where sometimes the state does not change: https://bugs.webkit.org/show_bug.cgi?id=42940
- if ( History.bugs.ieDoubleCheck ) {
- // Apply Check
- History.doubleChecker = setTimeout(
- function(){
- History.doubleCheckClear();
- if ( !History.stateChanged ) {
- //History.debug('History.doubleCheck: State has not yet changed, trying again', arguments);
- // Re-Attempt
- tryAgain();
- }
- return true;
- },
- History.options.doubleCheckInterval
- );
- }
-
- // Chain
- return History;
- };
-
-
- // ====================================================================
- // Safari Bug Fix
-
- /**
- * History.safariStatePoll()
- * Poll the current state
- * @return {History}
- */
- History.safariStatePoll = function(){
- // Poll the URL
-
- // Get the Last State which has the new URL
- var
- urlState = History.extractState(document.location.href),
- newState;
-
- // Check for a difference
- if ( !History.isLastSavedState(urlState) ) {
- newState = urlState;
- }
- else {
- return;
- }
-
- // Check if we have a state with that url
- // If not create it
- if ( !newState ) {
- //History.debug('History.safariStatePoll: new');
- newState = History.createStateObject();
- }
-
- // Apply the New State
- //History.debug('History.safariStatePoll: trigger');
- History.Adapter.trigger(window,'popstate');
-
- // Chain
- return History;
- };
-
-
- // ====================================================================
- // State Aliases
-
- /**
- * History.back(queue)
- * Send the browser history back one item
- * @param {Integer} queue [optional]
- */
- History.back = function(queue){
- //History.debug('History.back: called', arguments);
-
- // Handle Queueing
- if ( queue !== false && History.busy() ) {
- // Wait + Push to Queue
- //History.debug('History.back: we must wait', arguments);
- History.pushQueue({
- scope: History,
- callback: History.back,
- args: arguments,
- queue: queue
- });
- return false;
- }
-
- // Make Busy + Continue
- History.busy(true);
-
- // Fix certain browser bugs that prevent the state from changing
- History.doubleCheck(function(){
- History.back(false);
- });
-
- // Go back
- history.go(-1);
-
- // End back closure
- return true;
- };
-
- /**
- * History.forward(queue)
- * Send the browser history forward one item
- * @param {Integer} queue [optional]
- */
- History.forward = function(queue){
- //History.debug('History.forward: called', arguments);
-
- // Handle Queueing
- if ( queue !== false && History.busy() ) {
- // Wait + Push to Queue
- //History.debug('History.forward: we must wait', arguments);
- History.pushQueue({
- scope: History,
- callback: History.forward,
- args: arguments,
- queue: queue
- });
- return false;
- }
-
- // Make Busy + Continue
- History.busy(true);
-
- // Fix certain browser bugs that prevent the state from changing
- History.doubleCheck(function(){
- History.forward(false);
- });
-
- // Go forward
- history.go(1);
-
- // End forward closure
- return true;
- };
-
- /**
- * History.go(index,queue)
- * Send the browser history back or forward index times
- * @param {Integer} queue [optional]
- */
- History.go = function(index,queue){
- //History.debug('History.go: called', arguments);
-
- // Prepare
- var i;
-
- // Handle
- if ( index > 0 ) {
- // Forward
- for ( i=1; i<=index; ++i ) {
- History.forward(queue);
- }
- }
- else if ( index < 0 ) {
- // Backward
- for ( i=-1; i>=index; --i ) {
- History.back(queue);
- }
- }
- else {
- throw new Error('History.go: History.go requires a positive or negative integer passed.');
- }
-
- // Chain
- return History;
- };
-
-
- // ====================================================================
- // HTML5 State Support
-
- // Non-Native pushState Implementation
- if ( History.emulated.pushState ) {
- /*
- * Provide Skeleton for HTML4 Browsers
- */
-
- // Prepare
- var emptyFunction = function(){};
- History.pushState = History.pushState||emptyFunction;
- History.replaceState = History.replaceState||emptyFunction;
- } // History.emulated.pushState
-
- // Native pushState Implementation
- else {
- /*
- * Use native HTML5 History API Implementation
- */
-
- /**
- * History.onPopState(event,extra)
- * Refresh the Current State
- */
- History.onPopState = function(event,extra){
- // Prepare
- var stateId = false, newState = false, currentHash, currentState;
-
- // Reset the double check
- History.doubleCheckComplete();
-
- // Check for a Hash, and handle apporiatly
- currentHash = History.getHash();
- if ( currentHash ) {
- // Expand Hash
- currentState = History.extractState(currentHash||document.location.href,true);
- if ( currentState ) {
- // We were able to parse it, it must be a State!
- // Let's forward to replaceState
- //History.debug('History.onPopState: state anchor', currentHash, currentState);
- History.replaceState(currentState.data, currentState.title, currentState.url, false);
- }
- else {
- // Traditional Anchor
- //History.debug('History.onPopState: traditional anchor', currentHash);
- History.Adapter.trigger(window,'anchorchange');
- History.busy(false);
- }
-
- // We don't care for hashes
- History.expectedStateId = false;
- return false;
- }
-
- // Ensure
- stateId = History.Adapter.extractEventData('state',event,extra) || false;
-
- // Fetch State
- if ( stateId ) {
- // Vanilla: Back/forward button was used
- newState = History.getStateById(stateId);
- }
- else if ( History.expectedStateId ) {
- // Vanilla: A new state was pushed, and popstate was called manually
- newState = History.getStateById(History.expectedStateId);
- }
- else {
- // Initial State
- newState = History.extractState(document.location.href);
- }
-
- // The State did not exist in our store
- if ( !newState ) {
- // Regenerate the State
- newState = History.createStateObject(null,null,document.location.href);
- }
-
- // Clean
- History.expectedStateId = false;
-
- // Check if we are the same state
- if ( History.isLastSavedState(newState) ) {
- // There has been no change (just the page's hash has finally propagated)
- //History.debug('History.onPopState: no change', newState, History.savedStates);
- History.busy(false);
- return false;
- }
-
- // Store the State
- History.storeState(newState);
- History.saveState(newState);
-
- // Force update of the title
- History.setTitle(newState);
-
- // Fire Our Event
- History.Adapter.trigger(window,'statechange');
- History.busy(false);
-
- // Return true
- return true;
- };
- History.Adapter.bind(window,'popstate',History.onPopState);
-
- /**
- * History.pushState(data,title,url)
- * Add a new State to the history object, become it, and trigger onpopstate
- * We have to trigger for HTML4 compatibility
- * @param {object} data
- * @param {string} title
- * @param {string} url
- * @return {true}
- */
- History.pushState = function(data,title,url,queue){
- //History.debug('History.pushState: called', arguments);
-
- // Check the State
- if ( History.getHashByUrl(url) && History.emulated.pushState ) {
- throw new Error('History.js does not support states with fragement-identifiers (hashes/anchors).');
- }
-
- // Handle Queueing
- if ( queue !== false && History.busy() ) {
- // Wait + Push to Queue
- //History.debug('History.pushState: we must wait', arguments);
- History.pushQueue({
- scope: History,
- callback: History.pushState,
- args: arguments,
- queue: queue
- });
- return false;
- }
-
- // Make Busy + Continue
- History.busy(true);
-
- // Create the newState
- var newState = History.createStateObject(data,title,url);
-
- // Check it
- if ( History.isLastSavedState(newState) ) {
- // Won't be a change
- History.busy(false);
- }
- else {
- // Store the newState
- History.storeState(newState);
- History.expectedStateId = newState.id;
-
- // Push the newState
- history.pushState(newState.id,newState.title,newState.url);
-
- // Fire HTML5 Event
- History.Adapter.trigger(window,'popstate');
- }
-
- // End pushState closure
- return true;
- };
-
- /**
- * History.replaceState(data,title,url)
- * Replace the State and trigger onpopstate
- * We have to trigger for HTML4 compatibility
- * @param {object} data
- * @param {string} title
- * @param {string} url
- * @return {true}
- */
- History.replaceState = function(data,title,url,queue){
- //History.debug('History.replaceState: called', arguments);
-
- // Check the State
- if ( History.getHashByUrl(url) && History.emulated.pushState ) {
- throw new Error('History.js does not support states with fragement-identifiers (hashes/anchors).');
- }
-
- // Handle Queueing
- if ( queue !== false && History.busy() ) {
- // Wait + Push to Queue
- //History.debug('History.replaceState: we must wait', arguments);
- History.pushQueue({
- scope: History,
- callback: History.replaceState,
- args: arguments,
- queue: queue
- });
- return false;
- }
-
- // Make Busy + Continue
- History.busy(true);
-
- // Create the newState
- var newState = History.createStateObject(data,title,url);
-
- // Check it
- if ( History.isLastSavedState(newState) ) {
- // Won't be a change
- History.busy(false);
- }
- else {
- // Store the newState
- History.storeState(newState);
- History.expectedStateId = newState.id;
-
- // Push the newState
- history.replaceState(newState.id,newState.title,newState.url);
-
- // Fire HTML5 Event
- History.Adapter.trigger(window,'popstate');
- }
-
- // End replaceState closure
- return true;
- };
-
- } // !History.emulated.pushState
-
-
- // ====================================================================
- // Initialise
-
- /**
- * Load the Store
- */
- if ( sessionStorage ) {
- // Fetch
- try {
- History.store = JSON.parse(sessionStorage.getItem('History.store'))||{};
- }
- catch ( err ) {
- History.store = {};
- }
-
- // Normalize
- History.normalizeStore();
- }
- else {
- // Default Load
- History.store = {};
- History.normalizeStore();
- }
-
- /**
- * Clear Intervals on exit to prevent memory leaks
- */
- History.Adapter.bind(window,"beforeunload",History.clearAllIntervals);
- History.Adapter.bind(window,"unload",History.clearAllIntervals);
-
- /**
- * Create the initial State
- */
- History.saveState(History.storeState(History.extractState(document.location.href,true)));
-
- /**
- * Bind for Saving Store
- */
- if ( sessionStorage ) {
- // When the page is closed
- History.onUnload = function(){
- // Prepare
- var currentStore, item;
-
- // Fetch
- try {
- currentStore = JSON.parse(sessionStorage.getItem('History.store'))||{};
- }
- catch ( err ) {
- currentStore = {};
- }
-
- // Ensure
- currentStore.idToState = currentStore.idToState || {};
- currentStore.urlToId = currentStore.urlToId || {};
- currentStore.stateToId = currentStore.stateToId || {};
-
- // Sync
- for ( item in History.idToState ) {
- if ( !History.idToState.hasOwnProperty(item) ) {
- continue;
- }
- currentStore.idToState[item] = History.idToState[item];
- }
- for ( item in History.urlToId ) {
- if ( !History.urlToId.hasOwnProperty(item) ) {
- continue;
- }
- currentStore.urlToId[item] = History.urlToId[item];
- }
- for ( item in History.stateToId ) {
- if ( !History.stateToId.hasOwnProperty(item) ) {
- continue;
- }
- currentStore.stateToId[item] = History.stateToId[item];
- }
-
- // Update
- History.store = currentStore;
- History.normalizeStore();
-
- // Store
- sessionStorage.setItem('History.store',JSON.stringify(currentStore));
- };
-
- // For Internet Explorer
- History.intervalList.push(setInterval(History.onUnload,History.options.storeInterval));
-
- // For Other Browsers
- History.Adapter.bind(window,'beforeunload',History.onUnload);
- History.Adapter.bind(window,'unload',History.onUnload);
-
- // Both are enabled for consistency
- }
-
- // Non-Native pushState Implementation
- if ( !History.emulated.pushState ) {
- // Be aware, the following is only for native pushState implementations
- // If you are wanting to include something for all browsers
- // Then include it above this if block
-
- /**
- * Setup Safari Fix
- */
- if ( History.bugs.safariPoll ) {
- History.intervalList.push(setInterval(History.safariStatePoll, History.options.safariPollInterval));
- }
-
- /**
- * Ensure Cross Browser Compatibility
- */
- if ( navigator.vendor === 'Apple Computer, Inc.' || (navigator.appCodeName||'') === 'Mozilla' ) {
- /**
- * Fix Safari HashChange Issue
- */
-
- // Setup Alias
- History.Adapter.bind(window,'hashchange',function(){
- History.Adapter.trigger(window,'popstate');
- });
-
- // Initialise Alias
- if ( History.getHash() ) {
- History.Adapter.onDomLoad(function(){
- History.Adapter.trigger(window,'hashchange');
- });
- }
- }
-
- } // !History.emulated.pushState
-
-
- }; // History.initCore
-
- // Try and Initialise History
- History.init();
-
-})(window);
diff --git a/vendor/assets/javascripts/history.js/json2.js b/vendor/assets/javascripts/history.js/json2.js
deleted file mode 100644
index 47bcc32..0000000
--- a/vendor/assets/javascripts/history.js/json2.js
+++ /dev/null
@@ -1,480 +0,0 @@
-/*
- http://www.JSON.org/json2.js
- 2011-01-18
-
- Public Domain.
-
- NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
-
- See http://www.JSON.org/js.html
-
-
- This code should be minified before deployment.
- See http://javascript.crockford.com/jsmin.html
-
- USE YOUR OWN COPY. IT IS EXTREMELY UNWISE TO LOAD CODE FROM SERVERS YOU DO
- NOT CONTROL.
-
-
- This file creates a global JSON object containing two methods: stringify
- and parse.
-
- JSON.stringify(value, replacer, space)
- value any JavaScript value, usually an object or array.
-
- replacer an optional parameter that determines how object
- values are stringified for objects. It can be a
- function or an array of strings.
-
- space an optional parameter that specifies the indentation
- of nested structures. If it is omitted, the text will
- be packed without extra whitespace. If it is a number,
- it will specify the number of spaces to indent at each
- level. If it is a string (such as '\t' or ' '),
- it contains the characters used to indent at each level.
-
- This method produces a JSON text from a JavaScript value.
-
- When an object value is found, if the object contains a toJSON
- method, its toJSON method will be called and the result will be
- stringified. A toJSON method does not serialize: it returns the
- value represented by the name/value pair that should be serialized,
- or undefined if nothing should be serialized. The toJSON method
- will be passed the key associated with the value, and this will be
- bound to the value
-
- For example, this would serialize Dates as ISO strings.
-
- Date.prototype.toJSON = function (key) {
- function f(n) {
- // Format integers to have at least two digits.
- return n < 10 ? '0' + n : n;
- }
-
- return this.getUTCFullYear() + '-' +
- f(this.getUTCMonth() + 1) + '-' +
- f(this.getUTCDate()) + 'T' +
- f(this.getUTCHours()) + ':' +
- f(this.getUTCMinutes()) + ':' +
- f(this.getUTCSeconds()) + 'Z';
- };
-
- You can provide an optional replacer method. It will be passed the
- key and value of each member, with this bound to the containing
- object. The value that is returned from your method will be
- serialized. If your method returns undefined, then the member will
- be excluded from the serialization.
-
- If the replacer parameter is an array of strings, then it will be
- used to select the members to be serialized. It filters the results
- such that only members with keys listed in the replacer array are
- stringified.
-
- Values that do not have JSON representations, such as undefined or
- functions, will not be serialized. Such values in objects will be
- dropped; in arrays they will be replaced with null. You can use
- a replacer function to replace those with JSON values.
- JSON.stringify(undefined) returns undefined.
-
- The optional space parameter produces a stringification of the
- value that is filled with line breaks and indentation to make it
- easier to read.
-
- If the space parameter is a non-empty string, then that string will
- be used for indentation. If the space parameter is a number, then
- the indentation will be that many spaces.
-
- Example:
-
- text = JSON.stringify(['e', {pluribus: 'unum'}]);
- // text is '["e",{"pluribus":"unum"}]'
-
-
- text = JSON.stringify(['e', {pluribus: 'unum'}], null, '\t');
- // text is '[\n\t"e",\n\t{\n\t\t"pluribus": "unum"\n\t}\n]'
-
- text = JSON.stringify([new Date()], function (key, value) {
- return this[key] instanceof Date ?
- 'Date(' + this[key] + ')' : value;
- });
- // text is '["Date(---current time---)"]'
-
-
- JSON.parse(text, reviver)
- This method parses a JSON text to produce an object or array.
- It can throw a SyntaxError exception.
-
- The optional reviver parameter is a function that can filter and
- transform the results. It receives each of the keys and values,
- and its return value is used instead of the original value.
- If it returns what it received, then the structure is not modified.
- If it returns undefined then the member is deleted.
-
- Example:
-
- // Parse the text. Values that look like ISO date strings will
- // be converted to Date objects.
-
- myData = JSON.parse(text, function (key, value) {
- var a;
- if (typeof value === 'string') {
- a =
-/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2}(?:\.\d*)?)Z$/.exec(value);
- if (a) {
- return new Date(Date.UTC(+a[1], +a[2] - 1, +a[3], +a[4],
- +a[5], +a[6]));
- }
- }
- return value;
- });
-
- myData = JSON.parse('["Date(09/09/2001)"]', function (key, value) {
- var d;
- if (typeof value === 'string' &&
- value.slice(0, 5) === 'Date(' &&
- value.slice(-1) === ')') {
- d = new Date(value.slice(5, -1));
- if (d) {
- return d;
- }
- }
- return value;
- });
-
-
- This is a reference implementation. You are free to copy, modify, or
- redistribute.
-*/
-
-/*jslint evil: true, strict: false, regexp: false */
-
-/*members "", "\b", "\t", "\n", "\f", "\r", "\"", JSON, "\\", apply,
- call, charCodeAt, getUTCDate, getUTCFullYear, getUTCHours,
- getUTCMinutes, getUTCMonth, getUTCSeconds, hasOwnProperty, join,
- lastIndex, length, parse, prototype, push, replace, slice, stringify,
- test, toJSON, toString, valueOf
-*/
-
-
-// Create a JSON object only if one does not already exist. We create the
-// methods in a closure to avoid creating global variables.
-
-if (!window.JSON) {
- window.JSON = {};
-}
-
-(function () {
- "use strict";
-
- function f(n) {
- // Format integers to have at least two digits.
- return n < 10 ? '0' + n : n;
- }
-
- if (typeof Date.prototype.toJSON !== 'function') {
-
- Date.prototype.toJSON = function (key) {
-
- return isFinite(this.valueOf()) ?
- this.getUTCFullYear() + '-' +
- f(this.getUTCMonth() + 1) + '-' +
- f(this.getUTCDate()) + 'T' +
- f(this.getUTCHours()) + ':' +
- f(this.getUTCMinutes()) + ':' +
- f(this.getUTCSeconds()) + 'Z' : null;
- };
-
- String.prototype.toJSON =
- Number.prototype.toJSON =
- Boolean.prototype.toJSON = function (key) {
- return this.valueOf();
- };
- }
-
- var JSON = window.JSON,
- cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
- escapable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
- gap,
- indent,
- meta = { // table of character substitutions
- '\b': '\\b',
- '\t': '\\t',
- '\n': '\\n',
- '\f': '\\f',
- '\r': '\\r',
- '"' : '\\"',
- '\\': '\\\\'
- },
- rep;
-
-
- function quote(string) {
-
-// If the string contains no control characters, no quote characters, and no
-// backslash characters, then we can safely slap some quotes around it.
-// Otherwise we must also replace the offending characters with safe escape
-// sequences.
-
- escapable.lastIndex = 0;
- return escapable.test(string) ? '"' + string.replace(escapable, function (a) {
- var c = meta[a];
- return typeof c === 'string' ? c :
- '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4);
- }) + '"' : '"' + string + '"';
- }
-
-
- function str(key, holder) {
-
-// Produce a string from holder[key].
-
- var i, // The loop counter.
- k, // The member key.
- v, // The member value.
- length,
- mind = gap,
- partial,
- value = holder[key];
-
-// If the value has a toJSON method, call it to obtain a replacement value.
-
- if (value && typeof value === 'object' &&
- typeof value.toJSON === 'function') {
- value = value.toJSON(key);
- }
-
-// If we were called with a replacer function, then call the replacer to
-// obtain a replacement value.
-
- if (typeof rep === 'function') {
- value = rep.call(holder, key, value);
- }
-
-// What happens next depends on the value's type.
-
- switch (typeof value) {
- case 'string':
- return quote(value);
-
- case 'number':
-
-// JSON numbers must be finite. Encode non-finite numbers as null.
-
- return isFinite(value) ? String(value) : 'null';
-
- case 'boolean':
- case 'null':
-
-// If the value is a boolean or null, convert it to a string. Note:
-// typeof null does not produce 'null'. The case is included here in
-// the remote chance that this gets fixed someday.
-
- return String(value);
-
-// If the type is 'object', we might be dealing with an object or an array or
-// null.
-
- case 'object':
-
-// Due to a specification blunder in ECMAScript, typeof null is 'object',
-// so watch out for that case.
-
- if (!value) {
- return 'null';
- }
-
-// Make an array to hold the partial results of stringifying this object value.
-
- gap += indent;
- partial = [];
-
-// Is the value an array?
-
- if (Object.prototype.toString.apply(value) === '[object Array]') {
-
-// The value is an array. Stringify every element. Use null as a placeholder
-// for non-JSON values.
-
- length = value.length;
- for (i = 0; i < length; i += 1) {
- partial[i] = str(i, value) || 'null';
- }
-
-// Join all of the elements together, separated with commas, and wrap them in
-// brackets.
-
- v = partial.length === 0 ? '[]' : gap ?
- '[\n' + gap + partial.join(',\n' + gap) + '\n' + mind + ']' :
- '[' + partial.join(',') + ']';
- gap = mind;
- return v;
- }
-
-// If the replacer is an array, use it to select the members to be stringified.
-
- if (rep && typeof rep === 'object') {
- length = rep.length;
- for (i = 0; i < length; i += 1) {
- k = rep[i];
- if (typeof k === 'string') {
- v = str(k, value);
- if (v) {
- partial.push(quote(k) + (gap ? ': ' : ':') + v);
- }
- }
- }
- } else {
-
-// Otherwise, iterate through all of the keys in the object.
-
- for (k in value) {
- if (Object.hasOwnProperty.call(value, k)) {
- v = str(k, value);
- if (v) {
- partial.push(quote(k) + (gap ? ': ' : ':') + v);
- }
- }
- }
- }
-
-// Join all of the member texts together, separated with commas,
-// and wrap them in braces.
-
- v = partial.length === 0 ? '{}' : gap ?
- '{\n' + gap + partial.join(',\n' + gap) + '\n' + mind + '}' :
- '{' + partial.join(',') + '}';
- gap = mind;
- return v;
- }
- }
-
-// If the JSON object does not yet have a stringify method, give it one.
-
- if (typeof JSON.stringify !== 'function') {
- JSON.stringify = function (value, replacer, space) {
-
-// The stringify method takes a value and an optional replacer, and an optional
-// space parameter, and returns a JSON text. The replacer can be a function
-// that can replace values, or an array of strings that will select the keys.
-// A default replacer method can be provided. Use of the space parameter can
-// produce text that is more easily readable.
-
- var i;
- gap = '';
- indent = '';
-
-// If the space parameter is a number, make an indent string containing that
-// many spaces.
-
- if (typeof space === 'number') {
- for (i = 0; i < space; i += 1) {
- indent += ' ';
- }
-
-// If the space parameter is a string, it will be used as the indent string.
-
- } else if (typeof space === 'string') {
- indent = space;
- }
-
-// If there is a replacer, it must be a function or an array.
-// Otherwise, throw an error.
-
- rep = replacer;
- if (replacer && typeof replacer !== 'function' &&
- (typeof replacer !== 'object' ||
- typeof replacer.length !== 'number')) {
- throw new Error('JSON.stringify');
- }
-
-// Make a fake root object containing our value under the key of ''.
-// Return the result of stringifying the value.
-
- return str('', {'': value});
- };
- }
-
-
-// If the JSON object does not yet have a parse method, give it one.
-
- if (typeof JSON.parse !== 'function') {
- JSON.parse = function (text, reviver) {
-
-// The parse method takes a text and an optional reviver function, and returns
-// a JavaScript value if the text is a valid JSON text.
-
- var j;
-
- function walk(holder, key) {
-
-// The walk method is used to recursively walk the resulting structure so
-// that modifications can be made.
-
- var k, v, value = holder[key];
- if (value && typeof value === 'object') {
- for (k in value) {
- if (Object.hasOwnProperty.call(value, k)) {
- v = walk(value, k);
- if (v !== undefined) {
- value[k] = v;
- } else {
- delete value[k];
- }
- }
- }
- }
- return reviver.call(holder, key, value);
- }
-
-
-// Parsing happens in four stages. In the first stage, we replace certain
-// Unicode characters with escape sequences. JavaScript handles many characters
-// incorrectly, either silently deleting them, or treating them as line endings.
-
- text = String(text);
- cx.lastIndex = 0;
- if (cx.test(text)) {
- text = text.replace(cx, function (a) {
- return '\\u' +
- ('0000' + a.charCodeAt(0).toString(16)).slice(-4);
- });
- }
-
-// In the second stage, we run the text against regular expressions that look
-// for non-JSON patterns. We are especially concerned with '()' and 'new'
-// because they can cause invocation, and '=' because it can cause mutation.
-// But just to be safe, we want to reject all unexpected forms.
-
-// We split the second stage into 4 regexp operations in order to work around
-// crippling inefficiencies in IE's and Safari's regexp engines. First we
-// replace the JSON backslash pairs with '@' (a non-JSON character). Second, we
-// replace all simple value tokens with ']' characters. Third, we delete all
-// open brackets that follow a colon or comma or that begin the text. Finally,
-// we look to see that the remaining characters are only whitespace or ']' or
-// ',' or ':' or '{' or '}'. If that is so, then the text is safe for eval.
-
- if (/^[\],:{}\s]*$/
- .test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@')
- .replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']')
- .replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) {
-
-// In the third stage we use the eval function to compile the text into a
-// JavaScript structure. The '{' operator is subject to a syntactic ambiguity
-// in JavaScript: it can begin a block or an object literal. We wrap the text
-// in parens to eliminate the ambiguity.
-
- j = eval('(' + text + ')');
-
-// In the optional fourth stage, we recursively walk the new structure, passing
-// each name/value pair to a reviver function for possible transformation.
-
- return typeof reviver === 'function' ?
- walk({'': j}, '') : j;
- }
-
-// If the text is not JSON parseable, then a SyntaxError is thrown.
-
- throw new SyntaxError('JSON.parse');
- };
- }
-}());
diff --git a/vendor/assets/javascripts/jquery-2.0.2.js b/vendor/assets/javascripts/jquery-2.0.2.js
new file mode 100644
index 0000000..280083f
--- /dev/null
+++ b/vendor/assets/javascripts/jquery-2.0.2.js
@@ -0,0 +1,8842 @@
+/*!
+ * jQuery JavaScript Library v2.0.2
+ * http://jquery.com/
+ *
+ * Includes Sizzle.js
+ * http://sizzlejs.com/
+ *
+ * Copyright 2005, 2013 jQuery Foundation, Inc. and other contributors
+ * Released under the MIT license
+ * http://jquery.org/license
+ *
+ * Date: 2013-05-30T21:25Z
+ */
+(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
+ // A central reference to the root jQuery(document)
+ rootjQuery,
+
+ // The deferred used on DOM ready
+ readyList,
+
+ // Support: IE9
+ // For `typeof xmlNode.method` instead of `xmlNode.method !== undefined`
+ core_strundefined = typeof undefined,
+
+ // Use the correct document accordingly with window argument (sandbox)
+ location = window.location,
+ document = window.document,
+ docElem = document.documentElement,
+
+ // 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 = "2.0.2",
+
+ // 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,
+
+ // A simple way to check for HTML strings
+ // Prioritize #id over to avoid XSS via location.hash (#9521)
+ // Strict HTML recognition (#11290: must start with <)
+ rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,
+
+ // Match a standalone tag
+ rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>|)$/,
+
+ // 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 and self cleanup method
+ completed = function() {
+ document.removeEventListener( "DOMContentLoaded", completed, false );
+ window.removeEventListener( "load", completed, false );
+ jQuery.ready();
+ };
+
+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 ) {
+ // 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,
+
+ 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 options, name, src, copy, copyIsArray, 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({
+ // Unique for each copy of jQuery on the page
+ expando: "jQuery" + ( core_version + Math.random() ).replace( /\D/g, "" ),
+
+ 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;
+ }
+
+ // 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,
+
+ 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 );
+ }
+ // Support: Safari <= 5.1 (functionish RegExp)
+ return typeof obj === "object" || typeof obj === "function" ?
+ class2type[ core_toString.call(obj) ] || "object" :
+ typeof obj;
+ },
+
+ isPlainObject: function( obj ) {
+ // Not plain objects:
+ // - Any object or value whose internal [[Class]] property is not "[object Object]"
+ // - DOM nodes
+ // - window
+ if ( jQuery.type( obj ) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) {
+ return false;
+ }
+
+ // Support: Firefox <20
+ // The try/catch suppresses exceptions thrown when attempting to access
+ // the "constructor" property of certain host objects, ie. |window.location|
+ // https://bugzilla.mozilla.org/show_bug.cgi?id=814622
+ try {
+ if ( obj.constructor &&
+ !core_hasOwn.call( obj.constructor.prototype, "isPrototypeOf" ) ) {
+ return false;
+ }
+ } catch ( e ) {
+ return false;
+ }
+
+ // If the function hasn't returned already, we're confident that
+ // |obj| is a plain object, created by {} or constructed with new Object
+ return true;
+ },
+
+ 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: JSON.parse,
+
+ // Cross-browser xml parsing
+ parseXML: function( data ) {
+ var xml, tmp;
+ if ( !data || typeof data !== "string" ) {
+ return null;
+ }
+
+ // Support: IE9
+ try {
+ tmp = new DOMParser();
+ xml = tmp.parseFromString( data , "text/xml" );
+ } catch ( e ) {
+ xml = undefined;
+ }
+
+ if ( !xml || xml.getElementsByTagName( "parsererror" ).length ) {
+ jQuery.error( "Invalid XML: " + data );
+ }
+ return xml;
+ },
+
+ noop: function() {},
+
+ // Evaluates a script in a global context
+ globalEval: function( code ) {
+ var script,
+ indirect = eval;
+
+ code = jQuery.trim( code );
+
+ if ( code ) {
+ // If the code includes a valid, prologue position
+ // strict mode pragma, execute code by injecting a
+ // script tag into the document.
+ if ( code.indexOf("use strict") === 1 ) {
+ script = document.createElement("script");
+ script.text = code;
+ document.head.appendChild( script ).parentNode.removeChild( script );
+ } else {
+ // Otherwise, avoid the DOM node creation, insertion
+ // and removal by using an indirect global eval
+ indirect( code );
+ }
+ }
+ },
+
+ // 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;
+ },
+
+ trim: function( text ) {
+ return text == null ? "" : core_trim.call( text );
+ },
+
+ // 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 ) {
+ return arr == null ? -1 : core_indexOf.call( arr, elem, i );
+ },
+
+ 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 tmp, args, proxy;
+
+ 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: Date.now,
+
+ // A method for quickly swapping in/out CSS properties to get correct calculations.
+ // Note: this method belongs to the css module but it's needed here for the support module.
+ // If support gets modularized, this method should be moved back to the css module.
+ 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;
+ }
+});
+
+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 );
+
+ } else {
+
+ // Use the handy event callback
+ document.addEventListener( "DOMContentLoaded", completed, false );
+
+ // A fallback to window.onload, that will always work
+ window.addEventListener( "load", completed, false );
+ }
+ }
+ 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);
+/*!
+ * Sizzle CSS Selector Engine v1.9.4-pre
+ * http://sizzlejs.com/
+ *
+ * Copyright 2013 jQuery Foundation, Inc. and other contributors
+ * Released under the MIT license
+ * http://jquery.org/license
+ *
+ * Date: 2013-05-27
+ */
+(function( window, undefined ) {
+
+var i,
+ support,
+ cachedruns,
+ Expr,
+ getText,
+ isXML,
+ compile,
+ outermostContext,
+ sortInput,
+
+ // Local document vars
+ setDocument,
+ document,
+ docElem,
+ documentIsHTML,
+ rbuggyQSA,
+ rbuggyMatches,
+ matches,
+ contains,
+
+ // Instance-specific data
+ expando = "sizzle" + -(new Date()),
+ preferredDoc = window.document,
+ dirruns = 0,
+ done = 0,
+ classCache = createCache(),
+ tokenCache = createCache(),
+ compilerCache = createCache(),
+ hasDuplicate = false,
+ sortOrder = function() { return 0; },
+
+ // General-purpose constants
+ strundefined = typeof undefined,
+ MAX_NEGATIVE = 1 << 31,
+
+ // Instance methods
+ hasOwn = ({}).hasOwnProperty,
+ arr = [],
+ pop = arr.pop,
+ push_native = arr.push,
+ 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;
+ },
+
+ booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",
+
+ // 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
+ attributes = "\\[" + whitespace + "*(" + characterEncoding + ")" + whitespace +
+ "*(?:([*^$|!~]?=)" + 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 + "*([>+~]|" + whitespace + ")" + whitespace + "*" ),
+
+ rsibling = new RegExp( whitespace + "*[+~]" ),
+ rattributeQuotes = new RegExp( "=" + whitespace + "*([^\\]'\"]*)" + whitespace + "*\\]", "g" ),
+
+ rpseudo = new RegExp( pseudos ),
+ ridentifier = new RegExp( "^" + identifier + "$" ),
+
+ matchExpr = {
+ "ID": new RegExp( "^#(" + characterEncoding + ")" ),
+ "CLASS": new RegExp( "^\\.(" + 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" ),
+ "bool": new RegExp( "^(?:" + booleans + ")$", "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" )
+ },
+
+ rnative = /^[^{]+\{\s*\[native \w/,
+
+ // 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,
+
+ // CSS escapes http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
+ runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ),
+ funescape = function( _, escaped, escapedWhitespace ) {
+ var high = "0x" + escaped - 0x10000;
+ // NaN means non-codepoint
+ // Support: Firefox
+ // Workaround erroneous numeric interpretation of +"0x"
+ return high !== high || escapedWhitespace ?
+ escaped :
+ // BMP codepoint
+ high < 0 ?
+ String.fromCharCode( high + 0x10000 ) :
+ // Supplemental Plane codepoint (surrogate pair)
+ String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
+ };
+
+// Optimize for push.apply( _, NodeList )
+try {
+ push.apply(
+ (arr = slice.call( preferredDoc.childNodes )),
+ preferredDoc.childNodes
+ );
+ // Support: Android<4.0
+ // Detect silently failing push.apply
+ arr[ preferredDoc.childNodes.length ].nodeType;
+} catch ( e ) {
+ push = { apply: arr.length ?
+
+ // Leverage slice if possible
+ function( target, els ) {
+ push_native.apply( target, slice.call(els) );
+ } :
+
+ // Support: IE<9
+ // Otherwise append directly
+ function( target, els ) {
+ var j = target.length,
+ i = 0;
+ // Can't trust NodeList.length
+ while ( (target[j++] = els[i++]) ) {}
+ target.length = j - 1;
+ }
+ };
+}
+
+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 ( documentIsHTML && !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, context.getElementsByTagName( selector ) );
+ return results;
+
+ // Speed-up: Sizzle(".CLASS")
+ } else if ( (m = match[3]) && support.getElementsByClassName && context.getElementsByClassName ) {
+ push.apply( results, context.getElementsByClassName( m ) );
+ return results;
+ }
+ }
+
+ // QSA path
+ if ( support.qsa && (!rbuggyQSA || !rbuggyQSA.test( selector )) ) {
+ nid = old = 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,
+ newContext.querySelectorAll( newSelector )
+ );
+ return results;
+ } catch(qsaError) {
+ } finally {
+ if ( !old ) {
+ context.removeAttribute("id");
+ }
+ }
+ }
+ }
+ }
+
+ // All others
+ return select( selector.replace( rtrim, "$1" ), context, results, seed );
+}
+
+/**
+ * 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 keys = [];
+
+ function cache( 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);
+ }
+ return cache;
+}
+
+/**
+ * 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 {
+ // Remove from its parent by default
+ if ( div.parentNode ) {
+ div.parentNode.removeChild( div );
+ }
+ // release memory in IE
+ div = null;
+ }
+}
+
+/**
+ * Adds the same handler for all of the specified attrs
+ * @param {String} attrs Pipe-separated list of attributes
+ * @param {Function} handler The method that will be applied if the test fails
+ * @param {Boolean} test The result of a test. If true, null will be set as the handler in leiu of the specified handler
+ */
+function addHandle( attrs, handler, test ) {
+ attrs = attrs.split("|");
+ var current,
+ i = attrs.length,
+ setHandle = test ? null : handler;
+
+ while ( i-- ) {
+ // Don't override a user's handler
+ if ( !(current = Expr.attrHandle[ attrs[i] ]) || current === handler ) {
+ Expr.attrHandle[ attrs[i] ] = setHandle;
+ }
+ }
+}
+
+/**
+ * Fetches boolean attributes by node
+ * @param {Element} elem
+ * @param {String} name
+ */
+function boolHandler( elem, name ) {
+ // XML does not need to be checked as this will not be assigned for XML documents
+ var val = elem.getAttributeNode( name );
+ return val && val.specified ?
+ val.value :
+ elem[ name ] === true ? name.toLowerCase() : null;
+}
+
+/**
+ * Fetches attributes without interpolation
+ * http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
+ * @param {Element} elem
+ * @param {String} name
+ */
+function interpolationHandler( elem, name ) {
+ // XML does not need to be checked as this will not be assigned for XML documents
+ return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 );
+}
+
+/**
+ * Uses defaultValue to retrieve value in IE6/7
+ * @param {Element} elem
+ * @param {String} name
+ */
+function valueHandler( elem ) {
+ // Ignore the value *property* on inputs by using defaultValue
+ // Fallback to Sizzle.attr by returning undefined where appropriate
+ // XML does not need to be checked as this will not be assigned for XML documents
+ if ( elem.nodeName.toLowerCase() === "input" ) {
+ return elem.defaultValue;
+ }
+}
+
+/**
+ * Checks document order of two siblings
+ * @param {Element} a
+ * @param {Element} b
+ * @returns Returns -1 if a precedes b, 1 if a follows b
+ */
+function siblingCheck( a, b ) {
+ var cur = b && a,
+ diff = cur && a.nodeType === 1 && b.nodeType === 1 &&
+ ( ~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
+ * @param {String} type
+ */
+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
+ * @param {String} type
+ */
+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
+ * @param {Function} fn
+ */
+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]);
+ }
+ }
+ });
+ });
+}
+
+/**
+ * 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;
+};
+
+// Expose support vars for convenience
+support = Sizzle.support = {};
+
+/**
+ * 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,
+ parent = doc.parentWindow;
+
+ // 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
+ documentIsHTML = !isXML( doc );
+
+ // Support: IE>8
+ // If iframe document is assigned to "document" variable and if iframe has been reloaded,
+ // IE will throw "permission denied" error when accessing "document" variable, see jQuery #13936
+ if ( parent && parent.frameElement ) {
+ parent.attachEvent( "onbeforeunload", function() {
+ setDocument();
+ });
+ }
+
+ /* Attributes
+ ---------------------------------------------------------------------- */
+
+ // Support: IE<8
+ // Verify that getAttribute really returns attributes and not properties (excepting IE8 booleans)
+ support.attributes = assert(function( div ) {
+
+ // Support: IE<8
+ // Prevent attribute/property "interpolation"
+ div.innerHTML = "";
+ addHandle( "type|href|height|width", interpolationHandler, div.firstChild.getAttribute("href") === "#" );
+
+ // Support: IE<9
+ // Use getAttributeNode to fetch booleans when getAttribute lies
+ addHandle( booleans, boolHandler, div.getAttribute("disabled") == null );
+
+ div.className = "i";
+ return !div.getAttribute("className");
+ });
+
+ // Support: IE<9
+ // Retrieving value should defer to defaultValue
+ support.input = assert(function( div ) {
+ div.innerHTML = "";
+ div.firstChild.setAttribute( "value", "" );
+ return div.firstChild.getAttribute( "value" ) === "";
+ });
+
+ // IE6/7 still return empty string for value,
+ // but are actually retrieving the property
+ addHandle( "value", valueHandler, support.attributes && support.input );
+
+ /* getElement(s)By*
+ ---------------------------------------------------------------------- */
+
+ // Check if getElementsByTagName("*") returns only elements
+ support.getElementsByTagName = assert(function( div ) {
+ div.appendChild( doc.createComment("") );
+ return !div.getElementsByTagName("*").length;
+ });
+
+ // Check if getElementsByClassName can be trusted
+ support.getElementsByClassName = assert(function( div ) {
+ div.innerHTML = "";
+
+ // Support: Safari<4
+ // Catch class over-caching
+ div.firstChild.className = "i";
+ // Support: Opera<10
+ // Catch gEBCN failure to find non-leading classes
+ return div.getElementsByClassName("i").length === 2;
+ });
+
+ // Support: IE<10
+ // Check if getElementById returns elements by name
+ // The broken getElementById methods don't pick up programatically-set names,
+ // so use a roundabout getElementsByName test
+ support.getById = assert(function( div ) {
+ docElem.appendChild( div ).id = expando;
+ return !doc.getElementsByName || !doc.getElementsByName( expando ).length;
+ });
+
+ // ID find and filter
+ if ( support.getById ) {
+ Expr.find["ID"] = function( id, context ) {
+ if ( typeof context.getElementById !== strundefined && documentIsHTML ) {
+ 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 {
+ // Support: IE6/7
+ // getElementById is not reliable as a find shortcut
+ delete Expr.find["ID"];
+
+ 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.getElementsByTagName ?
+ 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;
+ };
+
+ // Class
+ Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) {
+ if ( typeof context.getElementsByClassName !== strundefined && documentIsHTML ) {
+ return context.getElementsByClassName( className );
+ }
+ };
+
+ /* QSA/matchesSelector
+ ---------------------------------------------------------------------- */
+
+ // QSA and matchesSelector support
+
+ // matchesSelector(:active) reports false when true (IE9/Opera 11.5)
+ rbuggyMatches = [];
+
+ // qSa(:focus) reports false when true (Chrome 21)
+ // We allow this because of a bug in IE8/9 that throws an error
+ // whenever `document.activeElement` is accessed on an iframe
+ // So, we allow :focus to pass through QSA all the time to avoid the IE error
+ // See http://bugs.jquery.com/ticket/13378
+ rbuggyQSA = [];
+
+ 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 explicitly
+ // setting a boolean content attribute,
+ // since its presence should be enough
+ // http://bugs.jquery.com/ticket/12359
+ div.innerHTML = "";
+
+ // Support: IE8
+ // Boolean attributes and "value" are not treated correctly
+ if ( !div.querySelectorAll("[selected]").length ) {
+ rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" );
+ }
+
+ // 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 ) {
+
+ // Support: Opera 10-12/IE8
+ // ^= $= *= and empty values
+ // Should not select anything
+ // Support: Windows 8 Native Apps
+ // The type attribute is restricted during .innerHTML assignment
+ var input = doc.createElement("input");
+ input.setAttribute( "type", "hidden" );
+ div.appendChild( input ).setAttribute( "t", "" );
+
+ if ( div.querySelectorAll("[t^='']").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.webkitMatchesSelector ||
+ docElem.mozMatchesSelector ||
+ 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 = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") );
+ rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") );
+
+ /* Contains
+ ---------------------------------------------------------------------- */
+
+ // 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;
+ };
+
+ /* Sorting
+ ---------------------------------------------------------------------- */
+
+ // Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)
+ // Detached nodes confoundingly follow *each other*
+ support.sortDetached = assert(function( div1 ) {
+ // Should return 1, but returns 4 (following)
+ return div1.compareDocumentPosition( doc.createElement("div") ) & 1;
+ });
+
+ // Document order sorting
+ sortOrder = docElem.compareDocumentPosition ?
+ function( a, b ) {
+
+ // Flag for duplicate removal
+ if ( a === b ) {
+ hasDuplicate = true;
+ return 0;
+ }
+
+ var compare = b.compareDocumentPosition && a.compareDocumentPosition && a.compareDocumentPosition( b );
+
+ if ( compare ) {
+ // Disconnected nodes
+ if ( compare & 1 ||
+ (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) {
+
+ // Choose the first element that is related to our preferred document
+ if ( a === doc || contains(preferredDoc, a) ) {
+ return -1;
+ }
+ if ( b === doc || contains(preferredDoc, b) ) {
+ return 1;
+ }
+
+ // Maintain original order
+ return sortInput ?
+ ( indexOf.call( sortInput, a ) - indexOf.call( sortInput, b ) ) :
+ 0;
+ }
+
+ return compare & 4 ? -1 : 1;
+ }
+
+ // Not directly comparable, sort on existence of method
+ 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 :
+ sortInput ?
+ ( indexOf.call( sortInput, a ) - indexOf.call( sortInput, b ) ) :
+ 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;
+ };
+
+ return doc;
+};
+
+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']" );
+
+ if ( support.matchesSelector && documentIsHTML &&
+ ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) &&
+ ( !rbuggyQSA || !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 ) {
+ // Set document vars if needed
+ if ( ( elem.ownerDocument || elem ) !== document ) {
+ setDocument( elem );
+ }
+
+ var fn = Expr.attrHandle[ name.toLowerCase() ],
+ // Don't get fooled by Object.prototype properties (jQuery #13807)
+ val = ( fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ?
+ fn( elem, name, !documentIsHTML ) :
+ undefined );
+
+ return val === undefined ?
+ support.attributes || !documentIsHTML ?
+ elem.getAttribute( name ) :
+ (val = elem.getAttributeNode(name)) && val.specified ?
+ val.value :
+ null :
+ val;
+};
+
+Sizzle.error = function( msg ) {
+ throw new Error( "Syntax error, unrecognized expression: " + msg );
+};
+
+/**
+ * Document sorting and removing duplicates
+ * @param {ArrayLike} results
+ */
+Sizzle.uniqueSort = function( results ) {
+ var elem,
+ duplicates = [],
+ j = 0,
+ i = 0;
+
+ // Unless we *know* we can detect duplicates, assume their presence
+ hasDuplicate = !support.detectDuplicates;
+ sortInput = !support.sortStable && results.slice( 0 );
+ results.sort( sortOrder );
+
+ if ( hasDuplicate ) {
+ while ( (elem = results[i++]) ) {
+ if ( elem === results[ i ] ) {
+ j = duplicates.push( i );
+ }
+ }
+ while ( j-- ) {
+ results.splice( duplicates[ j ], 1 );
+ }
+ }
+
+ return results;
+};
+
+/**
+ * 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,
+
+ attrHandle: {},
+
+ 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[3] && match[4] !== undefined ) {
+ 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( nodeNameSelector ) {
+ var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase();
+ return nodeNameSelector === "*" ?
+ function() { return true; } :
+ 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( typeof elem.className === "string" && 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 identifier
+ if ( !ridentifier.test(lang || "") ) {
+ Sizzle.error( "unsupported lang: " + lang );
+ }
+ lang = lang.replace( runescape, funescape ).toLowerCase();
+ return function( elem ) {
+ var elemLang;
+ do {
+ if ( (elemLang = documentIsHTML ?
+ elem.lang :
+ elem.getAttribute("xml:lang") || elem.getAttribute("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(
+ // If the preceding token was a descendant combinator, insert an implicit any-element `*`
+ tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" })
+ ).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" &&
+ support.getById && context.nodeType === 9 && documentIsHTML &&
+ 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, seed );
+ 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,
+ !documentIsHTML,
+ results,
+ rsibling.test( selector )
+ );
+ return results;
+}
+
+// Deprecated
+Expr.pseudos["nth"] = Expr.pseudos["eq"];
+
+// Easy API for creating new setFilters
+function setFilters() {}
+setFilters.prototype = Expr.filters = Expr.pseudos;
+Expr.setFilters = new setFilters();
+
+// One-time assignments
+
+// Sort stability
+support.sortStable = expando.split("").sort( sortOrder ).join("") === expando;
+
+// Initialize against the default document
+setDocument();
+
+// Support: Chrome<<14
+// Always assume duplicates if they aren't passed to the comparison function
+[0, 0].sort( sortOrder );
+support.detectDuplicates = hasDuplicate;
+
+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 );
+// 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 // Last fire value (for non-forgettable lists)
+ memory,
+ // Flag to know if list was already fired
+ fired,
+ // Flag to know if list is currently firing
+ firing,
+ // First callback to fire (used internally by add and fireWith)
+ firingStart,
+ // End of the loop when firing
+ firingLength,
+ // Index of currently firing callback (modified by remove if needed)
+ firingIndex,
+ // 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 = [];
+ firingLength = 0;
+ 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( support ) {
+ var input = document.createElement("input"),
+ fragment = document.createDocumentFragment(),
+ div = document.createElement("div"),
+ select = document.createElement("select"),
+ opt = select.appendChild( document.createElement("option") );
+
+ // Finish early in limited environments
+ if ( !input.type ) {
+ return support;
+ }
+
+ input.type = "checkbox";
+
+ // Support: Safari 5.1, iOS 5.1, Android 4.x, Android 2.3
+ // Check the default checkbox/radio value ("" on old WebKit; "on" elsewhere)
+ support.checkOn = input.value !== "";
+
+ // Must access the parent to make an option select properly
+ // Support: IE9, IE10
+ support.optSelected = opt.selected;
+
+ // Will be defined later
+ support.reliableMarginRight = true;
+ support.boxSizingReliable = true;
+ support.pixelPosition = false;
+
+ // Make sure checked status is properly cloned
+ // Support: IE9, IE10
+ 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;
+
+ // Check if an input maintains its value after becoming a radio
+ // Support: IE9, IE10
+ input = document.createElement("input");
+ input.value = "t";
+ input.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.appendChild( input );
+
+ // Support: Safari 5.1, Android 4.x, Android 2.3
+ // old WebKit doesn't clone checked state correctly in fragments
+ support.checkClone = fragment.cloneNode( true ).cloneNode( true ).lastChild.checked;
+
+ // Support: Firefox, Chrome, Safari
+ // Beware of CSP restrictions (https://developer.mozilla.org/en/Security/CSP)
+ support.focusinBubbles = "onfocusin" in window;
+
+ 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,
+ // Support: Firefox, Android 2.3 (Prefixed box-sizing versions).
+ divReset = "padding:0;margin:0;border:0;display:block;-webkit-box-sizing:content-box;-moz-box-sizing:content-box;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";
+
+ // Check box-sizing and margin behavior.
+ body.appendChild( container ).appendChild( div );
+ div.innerHTML = "";
+ // Support: Firefox, Android 2.3 (Prefixed box-sizing versions).
+ div.style.cssText = "-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%";
+
+ // Workaround failing boxSizing test due to offsetWidth returning wrong value
+ // with some non-1 values of body zoom, ticket #13543
+ jQuery.swap( body, body.style.zoom != null ? { zoom: 1 } : {}, function() {
+ support.boxSizing = div.offsetWidth === 4;
+ });
+
+ // 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";
+
+ // Support: Android 2.3
+ // Check if div with explicit width and no margin-right incorrectly
+ // gets computed margin-right based on width of container. (#3333)
+ // 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 );
+ }
+
+ body.removeChild( container );
+ });
+
+ return support;
+})( {} );
+
+/*
+ Implementation Summary
+
+ 1. Enforce API surface and semantic compatibility with 1.9.x branch
+ 2. Improve the module's maintainability by reducing the storage
+ paths to a single mechanism.
+ 3. Use the same single mechanism to support "private" and "user" data.
+ 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData)
+ 5. Avoid exposing implementation details on user objects (eg. expando properties)
+ 6. Provide a clear path for implementation upgrade to WeakMap in 2014
+*/
+var data_user, data_priv,
+ rbrace = /(?:\{[\s\S]*\}|\[[\s\S]*\])$/,
+ rmultiDash = /([A-Z])/g;
+
+function Data() {
+ // Support: Android < 4,
+ // Old WebKit does not have Object.preventExtensions/freeze method,
+ // return new empty object instead with no [[set]] accessor
+ Object.defineProperty( this.cache = {}, 0, {
+ get: function() {
+ return {};
+ }
+ });
+
+ this.expando = jQuery.expando + Math.random();
+}
+
+Data.uid = 1;
+
+Data.accepts = function( owner ) {
+ // Accepts only:
+ // - Node
+ // - Node.ELEMENT_NODE
+ // - Node.DOCUMENT_NODE
+ // - Object
+ // - Any
+ return owner.nodeType ?
+ owner.nodeType === 1 || owner.nodeType === 9 : true;
+};
+
+Data.prototype = {
+ key: function( owner ) {
+ // We can accept data for non-element nodes in modern browsers,
+ // but we should not, see #8335.
+ // Always return the key for a frozen object.
+ if ( !Data.accepts( owner ) ) {
+ return 0;
+ }
+
+ var descriptor = {},
+ // Check if the owner object already has a cache key
+ unlock = owner[ this.expando ];
+
+ // If not, create one
+ if ( !unlock ) {
+ unlock = Data.uid++;
+
+ // Secure it in a non-enumerable, non-writable property
+ try {
+ descriptor[ this.expando ] = { value: unlock };
+ Object.defineProperties( owner, descriptor );
+
+ // Support: Android < 4
+ // Fallback to a less secure definition
+ } catch ( e ) {
+ descriptor[ this.expando ] = unlock;
+ jQuery.extend( owner, descriptor );
+ }
+ }
+
+ // Ensure the cache object
+ if ( !this.cache[ unlock ] ) {
+ this.cache[ unlock ] = {};
+ }
+
+ return unlock;
+ },
+ set: function( owner, data, value ) {
+ var prop,
+ // There may be an unlock assigned to this node,
+ // if there is no entry for this "owner", create one inline
+ // and set the unlock as though an owner entry had always existed
+ unlock = this.key( owner ),
+ cache = this.cache[ unlock ];
+
+ // Handle: [ owner, key, value ] args
+ if ( typeof data === "string" ) {
+ cache[ data ] = value;
+
+ // Handle: [ owner, { properties } ] args
+ } else {
+ // Fresh assignments by object are shallow copied
+ if ( jQuery.isEmptyObject( cache ) ) {
+ jQuery.extend( this.cache[ unlock ], data );
+ // Otherwise, copy the properties one-by-one to the cache object
+ } else {
+ for ( prop in data ) {
+ cache[ prop ] = data[ prop ];
+ }
+ }
+ }
+ return cache;
+ },
+ get: function( owner, key ) {
+ // Either a valid cache is found, or will be created.
+ // New caches will be created and the unlock returned,
+ // allowing direct access to the newly created
+ // empty data object. A valid owner object must be provided.
+ var cache = this.cache[ this.key( owner ) ];
+
+ return key === undefined ?
+ cache : cache[ key ];
+ },
+ access: function( owner, key, value ) {
+ // In cases where either:
+ //
+ // 1. No key was specified
+ // 2. A string key was specified, but no value provided
+ //
+ // Take the "read" path and allow the get method to determine
+ // which value to return, respectively either:
+ //
+ // 1. The entire cache object
+ // 2. The data stored at the key
+ //
+ if ( key === undefined ||
+ ((key && typeof key === "string") && value === undefined) ) {
+ return this.get( owner, key );
+ }
+
+ // [*]When the key is not a string, or both a key and value
+ // are specified, set or extend (existing objects) with either:
+ //
+ // 1. An object of properties
+ // 2. A key and value
+ //
+ this.set( owner, key, value );
+
+ // Since the "set" path can have two possible entry points
+ // return the expected data based on which path was taken[*]
+ return value !== undefined ? value : key;
+ },
+ remove: function( owner, key ) {
+ var i, name, camel,
+ unlock = this.key( owner ),
+ cache = this.cache[ unlock ];
+
+ if ( key === undefined ) {
+ this.cache[ unlock ] = {};
+
+ } else {
+ // Support array or space separated string of keys
+ if ( jQuery.isArray( key ) ) {
+ // 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 = key.concat( key.map( jQuery.camelCase ) );
+ } else {
+ camel = jQuery.camelCase( key );
+ // Try the string as a key before any manipulation
+ if ( key in cache ) {
+ name = [ key, camel ];
+ } else {
+ // If a key with the spaces exists, use it.
+ // Otherwise, create an array by matching non-whitespace
+ name = camel;
+ name = name in cache ?
+ [ name ] : ( name.match( core_rnotwhite ) || [] );
+ }
+ }
+
+ i = name.length;
+ while ( i-- ) {
+ delete cache[ name[ i ] ];
+ }
+ }
+ },
+ hasData: function( owner ) {
+ return !jQuery.isEmptyObject(
+ this.cache[ owner[ this.expando ] ] || {}
+ );
+ },
+ discard: function( owner ) {
+ if ( owner[ this.expando ] ) {
+ delete this.cache[ owner[ this.expando ] ];
+ }
+ }
+};
+
+// These may be used throughout the jQuery core codebase
+data_user = new Data();
+data_priv = new Data();
+
+
+jQuery.extend({
+ acceptData: Data.accepts,
+
+ hasData: function( elem ) {
+ return data_user.hasData( elem ) || data_priv.hasData( elem );
+ },
+
+ data: function( elem, name, data ) {
+ return data_user.access( elem, name, data );
+ },
+
+ removeData: function( elem, name ) {
+ data_user.remove( elem, name );
+ },
+
+ // TODO: Now that all calls to _data and _removeData have been replaced
+ // with direct calls to data_priv methods, these can be deprecated.
+ _data: function( elem, name, data ) {
+ return data_priv.access( elem, name, data );
+ },
+
+ _removeData: function( elem, name ) {
+ data_priv.remove( elem, name );
+ }
+});
+
+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 = data_user.get( elem );
+
+ if ( elem.nodeType === 1 && !data_priv.get( elem, "hasDataAttrs" ) ) {
+ attrs = elem.attributes;
+ for ( ; i < attrs.length; i++ ) {
+ name = attrs[ i ].name;
+
+ if ( name.indexOf( "data-" ) === 0 ) {
+ name = jQuery.camelCase( name.slice(5) );
+ dataAttr( elem, name, data[ name ] );
+ }
+ }
+ data_priv.set( elem, "hasDataAttrs", true );
+ }
+ }
+
+ return data;
+ }
+
+ // Sets multiple values
+ if ( typeof key === "object" ) {
+ return this.each(function() {
+ data_user.set( this, key );
+ });
+ }
+
+ return jQuery.access( this, function( value ) {
+ var data,
+ camelKey = jQuery.camelCase( key );
+
+ // The calling jQuery object (element matches) is not empty
+ // (and therefore has an element appears at this[ 0 ]) and the
+ // `value` parameter was not undefined. An empty jQuery object
+ // will result in `undefined` for elem = this[ 0 ] which will
+ // throw an exception if an attempt to read a data cache is made.
+ if ( elem && value === undefined ) {
+ // Attempt to get data from the cache
+ // with the key as-is
+ data = data_user.get( elem, key );
+ if ( data !== undefined ) {
+ return data;
+ }
+
+ // Attempt to get data from the cache
+ // with the key camelized
+ data = data_user.get( elem, camelKey );
+ if ( data !== undefined ) {
+ return data;
+ }
+
+ // Attempt to "discover" the data in
+ // HTML5 custom data-* attrs
+ data = dataAttr( elem, camelKey, undefined );
+ if ( data !== undefined ) {
+ return data;
+ }
+
+ // We tried really hard, but the data doesn't exist.
+ return;
+ }
+
+ // Set the data...
+ this.each(function() {
+ // First, attempt to store a copy or reference of any
+ // data that might've been store with a camelCased key.
+ var data = data_user.get( this, camelKey );
+
+ // For HTML5 data-* attribute interop, we have to
+ // store property names with dashes in a camelCase form.
+ // This might not apply to all properties...*
+ data_user.set( this, camelKey, value );
+
+ // *... In the case of properties that might _actually_
+ // have dashes, we need to also store a copy of that
+ // unchanged property.
+ if ( key.indexOf("-") !== -1 && data !== undefined ) {
+ data_user.set( this, key, value );
+ }
+ });
+ }, null, value, arguments.length > 1, null, true );
+ },
+
+ removeData: function( key ) {
+ return this.each(function() {
+ data_user.remove( this, key );
+ });
+ }
+});
+
+function dataAttr( elem, key, data ) {
+ var name;
+
+ // If nothing was found internally, try to fetch any
+ // data from the HTML5 data-* attribute
+ if ( data === undefined && elem.nodeType === 1 ) {
+ 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 ) ? JSON.parse( data ) :
+ data;
+ } catch( e ) {}
+
+ // Make sure we set the data so it isn't changed later
+ data_user.set( elem, key, data );
+ } else {
+ data = undefined;
+ }
+ }
+ return data;
+}
+jQuery.extend({
+ queue: function( elem, type, data ) {
+ var queue;
+
+ if ( elem ) {
+ type = ( type || "fx" ) + "queue";
+ queue = data_priv.get( elem, type );
+
+ // Speed up dequeue by getting out quickly if this is just a lookup
+ if ( data ) {
+ if ( !queue || jQuery.isArray( data ) ) {
+ queue = data_priv.access( 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--;
+ }
+
+ 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 data_priv.get( elem, key ) || data_priv.access( elem, key, {
+ empty: jQuery.Callbacks("once memory").add(function() {
+ data_priv.remove( elem, [ type + "queue", 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 = data_priv.get( 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\f]/g,
+ rreturn = /\r/g,
+ rfocusable = /^(?:input|select|textarea|button)$/i;
+
+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 ) {
+ return this.each(function() {
+ delete this[ jQuery.propFix[ name ] || name ];
+ });
+ },
+
+ 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
+ data_priv.set( 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 ? "" : data_priv.get( 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 hooks, ret, 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;
+
+ if ( this.nodeType !== 1 ) {
+ return;
+ }
+
+ if ( isFunction ) {
+ val = value.call( this, i, jQuery( this ).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 ];
+
+ // IE6-9 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 optionSet, option,
+ options = elem.options,
+ values = jQuery.makeArray( value ),
+ i = options.length;
+
+ while ( i-- ) {
+ option = options[ i ];
+ if ( (option.selected = jQuery.inArray( jQuery(option).val(), values ) >= 0) ) {
+ optionSet = true;
+ }
+ }
+
+ // force browsers to behave consistently when non-matching value is set
+ if ( !optionSet ) {
+ elem.selectedIndex = -1;
+ }
+ return values;
+ }
+ }
+ },
+
+ attr: function( elem, name, value ) {
+ var hooks, 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 );
+ }
+
+ // All attributes are lowercase
+ // Grab necessary hook if one is defined
+ if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
+ name = name.toLowerCase();
+ hooks = jQuery.attrHooks[ name ] ||
+ ( jQuery.expr.match.bool.test( name ) ? boolHook : nodeHook );
+ }
+
+ if ( value !== undefined ) {
+
+ if ( value === null ) {
+ jQuery.removeAttr( elem, name );
+
+ } else if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) {
+ return ret;
+
+ } else {
+ elem.setAttribute( name, value + "" );
+ return value;
+ }
+
+ } else if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) {
+ return ret;
+
+ } else {
+ ret = jQuery.find.attr( elem, 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 ( jQuery.expr.match.bool.test( name ) ) {
+ // Set corresponding property to false
+ elem[ propName ] = false;
+ }
+
+ elem.removeAttribute( name );
+ }
+ }
+ },
+
+ 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: {
+ "for": "htmlFor",
+ "class": "className"
+ },
+
+ 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 ) {
+ return hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ?
+ ret :
+ ( elem[ name ] = value );
+
+ } else {
+ return hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ?
+ ret :
+ elem[ name ];
+ }
+ },
+
+ propHooks: {
+ tabIndex: {
+ get: function( elem ) {
+ return elem.hasAttribute( "tabindex" ) || rfocusable.test( elem.nodeName ) || elem.href ?
+ elem.tabIndex :
+ -1;
+ }
+ }
+ }
+});
+
+// Hooks for boolean attributes
+boolHook = {
+ set: function( elem, value, name ) {
+ if ( value === false ) {
+ // Remove boolean attributes when set to false
+ jQuery.removeAttr( elem, name );
+ } else {
+ elem.setAttribute( name, name );
+ }
+ return name;
+ }
+};
+jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) {
+ var getter = jQuery.expr.attrHandle[ name ] || jQuery.find.attr;
+
+ jQuery.expr.attrHandle[ name ] = function( elem, name, isXML ) {
+ var fn = jQuery.expr.attrHandle[ name ],
+ ret = isXML ?
+ undefined :
+ /* jshint eqeqeq: false */
+ // Temporarily disable this handler to check existence
+ (jQuery.expr.attrHandle[ name ] = undefined) !=
+ getter( elem, name, isXML ) ?
+
+ name.toLowerCase() :
+ null;
+
+ // Restore handler
+ jQuery.expr.attrHandle[ name ] = fn;
+
+ return ret;
+ };
+});
+
+// Support: IE9+
+// Selectedness for an option in an optgroup can be inaccurate
+if ( !jQuery.support.optSelected ) {
+ jQuery.propHooks.selected = {
+ get: function( elem ) {
+ var parent = elem.parentNode;
+ if ( parent && parent.parentNode ) {
+ parent.parentNode.selectedIndex;
+ }
+ return null;
+ }
+ };
+}
+
+jQuery.each([
+ "tabIndex",
+ "readOnly",
+ "maxLength",
+ "cellSpacing",
+ "cellPadding",
+ "rowSpan",
+ "colSpan",
+ "useMap",
+ "frameBorder",
+ "contentEditable"
+], function() {
+ jQuery.propFix[ this.toLowerCase() ] = this;
+});
+
+// Radios and checkboxes getter/setter
+jQuery.each([ "radio", "checkbox" ], function() {
+ jQuery.valHooks[ this ] = {
+ set: function( elem, value ) {
+ if ( jQuery.isArray( value ) ) {
+ return ( elem.checked = jQuery.inArray( jQuery(elem).val(), value ) >= 0 );
+ }
+ }
+ };
+ if ( !jQuery.support.checkOn ) {
+ jQuery.valHooks[ this ].get = function( elem ) {
+ // Support: Webkit
+ // "" is returned instead of "on" if a value isn't specified
+ return elem.getAttribute("value") === null ? "on" : elem.value;
+ };
+ }
+});
+var rkeyEvent = /^key/,
+ rmouseEvent = /^(?:mouse|contextmenu)|click/,
+ rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
+ rtypenamespace = /^([^.]*)(?:\.(.+)|)$/;
+
+function returnTrue() {
+ return true;
+}
+
+function returnFalse() {
+ return false;
+}
+
+function safeActiveElement() {
+ try {
+ return document.activeElement;
+ } catch ( err ) { }
+}
+
+/*
+ * 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 handleObjIn, eventHandle, tmp,
+ events, t, handleObj,
+ special, handlers, type, namespaces, origType,
+ elemData = data_priv.get( 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
+ types = ( types || "" ).match( core_rnotwhite ) || [""];
+ t = types.length;
+ while ( t-- ) {
+ tmp = rtypenamespace.exec( types[t] ) || [];
+ type = origType = tmp[1];
+ namespaces = ( tmp[2] || "" ).split( "." ).sort();
+
+ // There *must* be a type, no attaching namespace-only handlers
+ if ( !type ) {
+ continue;
+ }
+
+ // 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 if the special events handler returns false
+ if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
+ if ( elem.addEventListener ) {
+ elem.addEventListener( type, eventHandle, false );
+ }
+ }
+ }
+
+ 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, origCount, tmp,
+ events, t, handleObj,
+ special, handlers, type, namespaces, origType,
+ elemData = data_priv.hasData( elem ) && data_priv.get( 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;
+ data_priv.remove( elem, "events" );
+ }
+ },
+
+ trigger: function( event, data, elem, onlyHandlers ) {
+
+ var i, cur, tmp, bubbleType, ontype, handle, special,
+ 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 );
+
+ // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)
+ event.isTrigger = onlyHandlers ? 2 : 3;
+ 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 = ( data_priv.get( cur, "events" ) || {} )[ event.type ] && data_priv.get( 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( eventPath.pop(), data ) === false) &&
+ jQuery.acceptData( elem ) ) {
+
+ // Call a native DOM method on the target with the same name name as the event.
+ // Don't do default actions on window, that's where global variables be (#6170)
+ if ( ontype && jQuery.isFunction( 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;
+ elem[ type ]();
+ 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, j, ret, matched, handleObj,
+ handlerQueue = [],
+ args = core_slice.call( arguments ),
+ handlers = ( data_priv.get( 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 i, matches, sel, handleObj,
+ handlerQueue = [],
+ delegateCount = handlers.delegateCount,
+ cur = event.target;
+
+ // Find delegate handlers
+ // Black-hole SVG