Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Revert "This needs to be put away"

This reverts commit fdac81c.
  • Loading branch information...
commit 8aa061a8654c4ca7b8d276aac91628015e10eaa2 1 parent fdac81c
King Sidharth authored
Showing with 20,728 additions and 97 deletions.
  1. BIN  .DS_Store
  2. +20 −0 MIT-LICENSE.txt
  3. +18 −0 Rakefile
  4. BIN  _layouts/.DS_Store
  5. +0 −79 _layouts/default.html
  6. +26 −0 config.rb
  7. +5,821 −0 css/app.css
  8. +8 −0 humans.txt
  9. BIN  images/foundation/orbit/bullets.jpg
  10. BIN  images/foundation/orbit/left-arrow-small.png
  11. BIN  images/foundation/orbit/left-arrow.png
  12. BIN  images/foundation/orbit/loading.gif
  13. BIN  images/foundation/orbit/mask-black.png
  14. BIN  images/foundation/orbit/pause-black.png
  15. BIN  images/foundation/orbit/right-arrow-small.png
  16. BIN  images/foundation/orbit/right-arrow.png
  17. BIN  images/foundation/orbit/rotator-black.png
  18. BIN  images/foundation/orbit/timer-black.png
  19. +4 −3 _layouts/default.haml → index.haml
  20. +79 −15 index.html
  21. +38 −0 js/foundation/app.js
  22. +72 −0 js/foundation/jquery.cookie.js
  23. +580 −0 js/foundation/jquery.event.move.js
  24. +130 −0 js/foundation/jquery.event.swipe.js
  25. +34 −0 js/foundation/jquery.foundation.accordion.js
  26. +20 −0 js/foundation/jquery.foundation.alerts.js
  27. +74 −0 js/foundation/jquery.foundation.buttons.js
  28. +468 −0 js/foundation/jquery.foundation.clearing.js
  29. +486 −0 js/foundation/jquery.foundation.forms.js
  30. +639 −0 js/foundation/jquery.foundation.joyride.js
  31. +85 −0 js/foundation/jquery.foundation.magellan.js
  32. +27 −0 js/foundation/jquery.foundation.mediaQueryToggle.js
  33. +55 −0 js/foundation/jquery.foundation.navigation.js
  34. +897 −0 js/foundation/jquery.foundation.orbit.js
  35. +794 −0 js/foundation/jquery.foundation.reveal.js
  36. +43 −0 js/foundation/jquery.foundation.tabs.js
  37. +193 −0 js/foundation/jquery.foundation.tooltips.js
  38. +152 −0 js/foundation/jquery.foundation.topbar.js
  39. +9,440 −0 js/foundation/jquery.js
  40. +50 −0 js/foundation/jquery.offcanvas.js
  41. +157 −0 js/foundation/jquery.placeholder.js
  42. +4 −0 js/foundation/modernizr.foundation.js
  43. +4 −0 robots.txt
  44. +9 −0 sass/_layout.sass
  45. +242 −0 sass/_settings.sass
  46. +10 −0 sass/_style.sass
  47. +49 −0 sass/app.sass
BIN  .DS_Store
View
Binary file not shown
20 MIT-LICENSE.txt
View
@@ -0,0 +1,20 @@
+Copyright (c) 2011 ZURB, http://www.zurb.com/
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
18 Rakefile
View
@@ -0,0 +1,18 @@
+# Save as Rakefile, and run `rake watch`
+
+def recompile(base, relative)
+ haml = File.join(base, relative)
+ html = File.join(base, relative.gsub(/\.haml$/, '.html'))
+ print ">>> Change detected to #{relative} >> "
+ system "haml", haml, html
+ puts "Compiled <<<"
+end
+desc "Watch HAML files for changes"
+task :watch do
+ require 'fssm'
+ puts ">>> Watching for changes <<<"
+ FSSM.monitor(Dir.pwd, '**/*.haml') do
+ update &method(:recompile)
+ create &method(:recompile)
+ end
+end
BIN  _layouts/.DS_Store
View
Binary file not shown
79 _layouts/default.html
View
@@ -1,79 +0,0 @@
-<!-- paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither/ -->
-<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7" lang="en"> <![endif]-->
-<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8" lang="en"> <![endif]-->
-<!--[if IE 8]> <html class="no-js lt-ie9" lang="en"> <![endif]-->
-<!--[if gt IE 8]><!-->
-<html class='no-js'>
- <!--<![endif]-->
- <head></head>
- <meta charset="utf-8" />
- <!-- Set the viewport width to device width for mobile -->
- <meta name="viewport" content="width=device-width" />
- <title>{% if page.title %} {{ page.title }} {% endif %}</title>
- <!-- Included CSS Files -->
- <link rel="stylesheet" href="css/app.css">
- <script src="js/foundation/modernizr.foundation.js"></script>
- <script src="js/foundation/jquery.js"></script>
- <script src="js/scripts.js"></script>
- <link rel="icon" href="images/favicons/favicon.ico" type="image/x-icon" />
- <!-- IE Fix for HTML5 Tags -->
- <!--[if lt IE 9]>
- <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
- <![endif]-->
- <body>
- <div id='header_area'></div>
- <!-- #header_area -->
- <div id='content_area'>
- <div class='row'>
- <div id='sidebar'>
- <ul class='side-nav'>
- <li class='name'>
- <!-- /if homepage -->
- <h1 id='logo'>King Sidharth</h1>
- </li>
- <li class='divider'></li>
- <li class='active'>
- <a href='/'>Home</a>
- </li>
- <li>
- <a href='/projects'>Projects</a>
- </li>
- <li>
- <a href='/speaking'>Speaking</a>
- </li>
- <li>
- <a href='/writings'>Writings</a>
- </li>
- <li>
- <a href='/media-mentions'>Media Mentions</a>
- </li>
- <li>
- <a href='/contact'>Contact</a>
- </li>
- </ul>
- <ul class='side-nav'>
- <li class='facebook'>
- Facebook
- </li>
- <li class='twitter'>
- Twitter
- </li>
- <li class='gplus'>
- Google+
- </li>
- <li class='divider'></li>
- <li class='copyright'>
- &copy; Does it matter?
- </li>
- </ul>
- </div>
- <!-- #sidebar -->
- <div id='content'>
- {{content}}
- </div>
- <!-- #content -->
- </div>
- </div>
- <!-- #content_area -->
- </body>
-</html>
26 config.rb
View
@@ -0,0 +1,26 @@
+require 'zurb-foundation'
+# Require any additional compass plugins here.
+
+
+# Set this to the root of your project when deployed:
+http_path = "/"
+css_dir = "css"
+sass_dir = "sass"
+images_dir = "images"
+javascripts_dir = "js"
+
+# You can select your preferred output style here (can be overridden via the command line):
+# output_style = :expanded or :nested or :compact or :compressed
+
+# To enable relative paths to assets via compass helper functions. Uncomment:
+# relative_assets = true
+
+# To disable debugging comments that display the original location of your selectors. Uncomment:
+# line_comments = false
+
+
+# If you prefer the indented syntax, you might want to regenerate this
+# project again passing --syntax sass, or you can uncomment this:
+preferred_syntax = :sass
+# and then run:
+# sass-convert -R --from scss --to sass sass scss && rm -rf sass && mv scss sass
5,821 css/app.css
View
5,821 additions, 0 deletions not shown
8 humans.txt
View
@@ -0,0 +1,8 @@
+/* Foundation was made by ZURB, an interaction design and design strategy firm in Campbell, CA */
+/* zurb.com */
+/* humanstxt.org */
+
+/* SITE */
+ Standards: HTML5, CSS3
+ Components: jQuery, Orbit, Reveal
+ Software: Coda, Textmate, Git
BIN  images/foundation/orbit/bullets.jpg
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN  images/foundation/orbit/left-arrow-small.png
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN  images/foundation/orbit/left-arrow.png
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN  images/foundation/orbit/loading.gif
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN  images/foundation/orbit/mask-black.png
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN  images/foundation/orbit/pause-black.png
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN  images/foundation/orbit/right-arrow-small.png
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN  images/foundation/orbit/right-arrow.png
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN  images/foundation/orbit/rotator-black.png
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN  images/foundation/orbit/timer-black.png
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 _layouts/default.haml → index.haml
View
@@ -10,7 +10,7 @@
<!-- Set the viewport width to device width for mobile -->
<meta name="viewport" content="width=device-width" />
- %title {% if page.title %} {{ page.title }} {% endif %}
+ %title King Sidharth
<!-- Included CSS Files -->
<link rel="stylesheet" href="css/app.css">
@@ -25,7 +25,7 @@
<!--[if lt IE 9]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
- %body
+ %body.home
#header_area
/#header_area
@@ -61,6 +61,7 @@
&copy; Does it matter?
/#sidebar
#content
- {{content}}
+ //content here
+
/#content
/#content_area
94 index.html
View
@@ -1,15 +1,79 @@
----
-layout: default
-title: King Sidharth
----
-Hi I am Sidharth
-
-But hardly anyone knows me by that name, so - King Sidharth!
-Read this if you want to know why.
-
-I am 21.
-
-An Entrepreneur and an Artist. (They both go together)
-
-A Designer and Co-founder at Web Mutiny.
-
+<!-- paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither/ -->
+<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7" lang="en"> <![endif]-->
+<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8" lang="en"> <![endif]-->
+<!--[if IE 8]> <html class="no-js lt-ie9" lang="en"> <![endif]-->
+<!--[if gt IE 8]><!-->
+<html class='no-js'>
+ <!--<![endif]-->
+ <head></head>
+ <meta charset="utf-8" />
+ <!-- Set the viewport width to device width for mobile -->
+ <meta name="viewport" content="width=device-width" />
+ <title>King Sidharth</title>
+ <!-- Included CSS Files -->
+ <link rel="stylesheet" href="css/app.css">
+ <script src="js/foundation/modernizr.foundation.js"></script>
+ <script src="js/foundation/jquery.js"></script>
+ <script src="js/scripts.js"></script>
+ <link rel="icon" href="images/favicons/favicon.ico" type="image/x-icon" />
+ <!-- IE Fix for HTML5 Tags -->
+ <!--[if lt IE 9]>
+ <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+ <![endif]-->
+ <body class='home'>
+ <div id='header_area'></div>
+ <!-- #header_area -->
+ <div id='content_area'>
+ <div class='row'>
+ <div id='sidebar'>
+ <ul class='side-nav'>
+ <li class='name'>
+ <!-- /if homepage -->
+ <h1 id='logo'>King Sidharth</h1>
+ </li>
+ <li class='divider'></li>
+ <li class='active'>
+ <a href='/'>Home</a>
+ </li>
+ <li>
+ <a href='/projects'>Projects</a>
+ </li>
+ <li>
+ <a href='/speaking'>Speaking</a>
+ </li>
+ <li>
+ <a href='/writings'>Writings</a>
+ </li>
+ <li>
+ <a href='/media-mentions'>Media Mentions</a>
+ </li>
+ <li>
+ <a href='/contact'>Contact</a>
+ </li>
+ </ul>
+ <ul class='side-nav'>
+ <li class='facebook'>
+ Facebook
+ </li>
+ <li class='twitter'>
+ Twitter
+ </li>
+ <li class='gplus'>
+ Google+
+ </li>
+ <li class='divider'></li>
+ <li class='copyright'>
+ &copy; Does it matter?
+ </li>
+ </ul>
+ </div>
+ <!-- #sidebar -->
+ <div id='content'>
+ <!-- /content here -->
+ </div>
+ <!-- #content -->
+ </div>
+ </div>
+ <!-- #content_area -->
+ </body>
+</html>
38 js/foundation/app.js
View
@@ -0,0 +1,38 @@
+;(function ($, window, undefined) {
+ 'use strict';
+
+ var $doc = $(document),
+ Modernizr = window.Modernizr;
+
+ $(document).ready(function() {
+ $.fn.foundationAlerts ? $doc.foundationAlerts() : null;
+ $.fn.foundationButtons ? $doc.foundationButtons() : null;
+ $.fn.foundationAccordion ? $doc.foundationAccordion() : null;
+ $.fn.foundationNavigation ? $doc.foundationNavigation() : null;
+ $.fn.foundationTopBar ? $doc.foundationTopBar() : null;
+ $.fn.foundationCustomForms ? $doc.foundationCustomForms() : null;
+ $.fn.foundationMediaQueryViewer ? $doc.foundationMediaQueryViewer() : null;
+ $.fn.foundationTabs ? $doc.foundationTabs({callback : $.foundation.customForms.appendCustomMarkup}) : null;
+ $.fn.foundationTooltips ? $doc.foundationTooltips() : null;
+ $.fn.foundationMagellan ? $doc.foundationMagellan() : null;
+ $.fn.foundationClearing ? $doc.foundationClearing() : null;
+
+ $('input, textarea').placeholder();
+ });
+
+ // UNCOMMENT THE LINE YOU WANT BELOW IF YOU WANT IE8 SUPPORT AND ARE USING .block-grids
+ // $('.block-grid.two-up>li:nth-child(2n+1)').css({clear: 'both'});
+ // $('.block-grid.three-up>li:nth-child(3n+1)').css({clear: 'both'});
+ // $('.block-grid.four-up>li:nth-child(4n+1)').css({clear: 'both'});
+ // $('.block-grid.five-up>li:nth-child(5n+1)').css({clear: 'both'});
+
+ // Hide address bar on mobile devices (except if #hash present, so we don't mess up deep linking).
+ if (Modernizr.touch && !window.location.hash) {
+ $(window).load(function () {
+ setTimeout(function () {
+ window.scrollTo(0, 1);
+ }, 0);
+ });
+ }
+
+})(jQuery, this);
72 js/foundation/jquery.cookie.js
View
@@ -0,0 +1,72 @@
+/*!
+ * jQuery Cookie Plugin v1.3
+ * https://github.com/carhartl/jquery-cookie
+ *
+ * Copyright 2011, Klaus Hartl
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://www.opensource.org/licenses/mit-license.php
+ * http://www.opensource.org/licenses/GPL-2.0
+ */
+(function ($, document, undefined) {
+
+ var pluses = /\+/g;
+
+ function raw(s) {
+ return s;
+ }
+
+ function decoded(s) {
+ return decodeURIComponent(s.replace(pluses, ' '));
+ }
+
+ var config = $.cookie = function (key, value, options) {
+
+ // write
+ if (value !== undefined) {
+ options = $.extend({}, config.defaults, options);
+
+ if (value === null) {
+ options.expires = -1;
+ }
+
+ if (typeof options.expires === 'number') {
+ var days = options.expires, t = options.expires = new Date();
+ t.setDate(t.getDate() + days);
+ }
+
+ value = config.json ? JSON.stringify(value) : String(value);
+
+ return (document.cookie = [
+ encodeURIComponent(key), '=', config.raw ? value : encodeURIComponent(value),
+ options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE
+ options.path ? '; path=' + options.path : '',
+ options.domain ? '; domain=' + options.domain : '',
+ options.secure ? '; secure' : ''
+ ].join(''));
+ }
+
+ // read
+ var decode = config.raw ? raw : decoded;
+ var cookies = document.cookie.split('; ');
+ for (var i = 0, l = cookies.length; i < l; i++) {
+ var parts = cookies[i].split('=');
+ if (decode(parts.shift()) === key) {
+ var cookie = decode(parts.join('='));
+ return config.json ? JSON.parse(cookie) : cookie;
+ }
+ }
+
+ return null;
+ };
+
+ config.defaults = {};
+
+ $.removeCookie = function (key, options) {
+ if ($.cookie(key) !== null) {
+ $.cookie(key, null, options);
+ return true;
+ }
+ return false;
+ };
+
+})(jQuery, document);
580 js/foundation/jquery.event.move.js
View
@@ -0,0 +1,580 @@
+// jquery.event.move
+//
+// 1.3.1
+//
+// Stephen Band
+//
+// Triggers 'movestart', 'move' and 'moveend' events after
+// mousemoves following a mousedown cross a distance threshold,
+// similar to the native 'dragstart', 'drag' and 'dragend' events.
+// Move events are throttled to animation frames. Move event objects
+// have the properties:
+//
+// pageX:
+// pageY: Page coordinates of pointer.
+// startX:
+// startY: Page coordinates of pointer at movestart.
+// distX:
+// distY: Distance the pointer has moved since movestart.
+// deltaX:
+// deltaY: Distance the finger has moved since last event.
+// velocityX:
+// velocityY: Average velocity over last few events.
+
+
+(function (module) {
+ if (typeof define === 'function' && define.amd) {
+ // AMD. Register as an anonymous module.
+ define(['jquery'], module);
+ } else {
+ // Browser globals
+ module(jQuery);
+ }
+})(function(jQuery, undefined){
+
+ var // Number of pixels a pressed pointer travels before movestart
+ // event is fired.
+ threshold = 6,
+
+ add = jQuery.event.add,
+
+ remove = jQuery.event.remove,
+
+ // Just sugar, so we can have arguments in the same order as
+ // add and remove.
+ trigger = function(node, type, data) {
+ jQuery.event.trigger(type, data, node);
+ },
+
+ // Shim for requestAnimationFrame, falling back to timer. See:
+ // see http://paulirish.com/2011/requestanimationframe-for-smart-animating/
+ requestFrame = (function(){
+ return (
+ window.requestAnimationFrame ||
+ window.webkitRequestAnimationFrame ||
+ window.mozRequestAnimationFrame ||
+ window.oRequestAnimationFrame ||
+ window.msRequestAnimationFrame ||
+ function(fn, element){
+ return window.setTimeout(function(){
+ fn();
+ }, 25);
+ }
+ );
+ })(),
+
+ ignoreTags = {
+ textarea: true,
+ input: true,
+ select: true,
+ button: true
+ },
+
+ mouseevents = {
+ move: 'mousemove',
+ cancel: 'mouseup dragstart',
+ end: 'mouseup'
+ },
+
+ touchevents = {
+ move: 'touchmove',
+ cancel: 'touchend',
+ end: 'touchend'
+ };
+
+
+ // Constructors
+
+ function Timer(fn){
+ var callback = fn,
+ active = false,
+ running = false;
+
+ function trigger(time) {
+ if (active){
+ callback();
+ requestFrame(trigger);
+ running = true;
+ active = false;
+ }
+ else {
+ running = false;
+ }
+ }
+
+ this.kick = function(fn) {
+ active = true;
+ if (!running) { trigger(); }
+ };
+
+ this.end = function(fn) {
+ var cb = callback;
+
+ if (!fn) { return; }
+
+ // If the timer is not running, simply call the end callback.
+ if (!running) {
+ fn();
+ }
+ // If the timer is running, and has been kicked lately, then
+ // queue up the current callback and the end callback, otherwise
+ // just the end callback.
+ else {
+ callback = active ?
+ function(){ cb(); fn(); } :
+ fn ;
+
+ active = true;
+ }
+ };
+ }
+
+
+ // Functions
+
+ function returnTrue() {
+ return true;
+ }
+
+ function returnFalse() {
+ return false;
+ }
+
+ function preventDefault(e) {
+ e.preventDefault();
+ }
+
+ function preventIgnoreTags(e) {
+ // Don't prevent interaction with form elements.
+ if (ignoreTags[ e.target.tagName.toLowerCase() ]) { return; }
+
+ e.preventDefault();
+ }
+
+ function isLeftButton(e) {
+ // Ignore mousedowns on any button other than the left (or primary)
+ // mouse button, or when a modifier key is pressed.
+ return (e.which === 1 && !e.ctrlKey && !e.altKey);
+ }
+
+ function identifiedTouch(touchList, id) {
+ var i, l;
+
+ if (touchList.identifiedTouch) {
+ return touchList.identifiedTouch(id);
+ }
+
+ // touchList.identifiedTouch() does not exist in
+ // webkit yet… we must do the search ourselves...
+
+ i = -1;
+ l = touchList.length;
+
+ while (++i < l) {
+ if (touchList[i].identifier === id) {
+ return touchList[i];
+ }
+ }
+ }
+
+ function changedTouch(e, event) {
+ var touch = identifiedTouch(e.changedTouches, event.identifier);
+
+ // This isn't the touch you're looking for.
+ if (!touch) { return; }
+
+ // Chrome Android (at least) includes touches that have not
+ // changed in e.changedTouches. That's a bit annoying. Check
+ // that this touch has changed.
+ if (touch.pageX === event.pageX && touch.pageY === event.pageY) { return; }
+
+ return touch;
+ }
+
+
+ // Handlers that decide when the first movestart is triggered
+
+ function mousedown(e){
+ var data;
+
+ if (!isLeftButton(e)) { return; }
+
+ data = {
+ target: e.target,
+ startX: e.pageX,
+ startY: e.pageY,
+ timeStamp: e.timeStamp
+ };
+
+ add(document, mouseevents.move, mousemove, data);
+ add(document, mouseevents.cancel, mouseend, data);
+ }
+
+ function mousemove(e){
+ var data = e.data;
+
+ checkThreshold(e, data, e, removeMouse);
+ }
+
+ function mouseend(e) {
+ removeMouse();
+ }
+
+ function removeMouse() {
+ remove(document, mouseevents.move, mousemove);
+ remove(document, mouseevents.cancel, removeMouse);
+ }
+
+ function touchstart(e) {
+ var touch, template;
+
+ // Don't get in the way of interaction with form elements.
+ if (ignoreTags[ e.target.tagName.toLowerCase() ]) { return; }
+
+ touch = e.changedTouches[0];
+
+ // iOS live updates the touch objects whereas Android gives us copies.
+ // That means we can't trust the touchstart object to stay the same,
+ // so we must copy the data. This object acts as a template for
+ // movestart, move and moveend event objects.
+ template = {
+ target: touch.target,
+ startX: touch.pageX,
+ startY: touch.pageY,
+ timeStamp: e.timeStamp,
+ identifier: touch.identifier
+ };
+
+ // Use the touch identifier as a namespace, so that we can later
+ // remove handlers pertaining only to this touch.
+ add(document, touchevents.move + '.' + touch.identifier, touchmove, template);
+ add(document, touchevents.cancel + '.' + touch.identifier, touchend, template);
+ }
+
+ function touchmove(e){
+ var data = e.data,
+ touch = changedTouch(e, data);
+
+ if (!touch) { return; }
+
+ checkThreshold(e, data, touch, removeTouch);
+ }
+
+ function touchend(e) {
+ var template = e.data,
+ touch = identifiedTouch(e.changedTouches, template.identifier);
+
+ if (!touch) { return; }
+
+ removeTouch(template.identifier);
+ }
+
+ function removeTouch(identifier) {
+ remove(document, '.' + identifier, touchmove);
+ remove(document, '.' + identifier, touchend);
+ }
+
+
+ // Logic for deciding when to trigger a movestart.
+
+ function checkThreshold(e, template, touch, fn) {
+ var distX = touch.pageX - template.startX,
+ distY = touch.pageY - template.startY;
+
+ // Do nothing if the threshold has not been crossed.
+ if ((distX * distX) + (distY * distY) < (threshold * threshold)) { return; }
+
+ triggerStart(e, template, touch, distX, distY, fn);
+ }
+
+ function handled() {
+ // this._handled should return false once, and after return true.
+ this._handled = returnTrue;
+ return false;
+ }
+
+ function flagAsHandled(e) {
+ e._handled();
+ }
+
+ function triggerStart(e, template, touch, distX, distY, fn) {
+ var node = template.target,
+ touches, time;
+
+ touches = e.targetTouches;
+ time = e.timeStamp - template.timeStamp;
+
+ // Create a movestart object with some special properties that
+ // are passed only to the movestart handlers.
+ template.type = 'movestart';
+ template.distX = distX;
+ template.distY = distY;
+ template.deltaX = distX;
+ template.deltaY = distY;
+ template.pageX = touch.pageX;
+ template.pageY = touch.pageY;
+ template.velocityX = distX / time;
+ template.velocityY = distY / time;
+ template.targetTouches = touches;
+ template.finger = touches ?
+ touches.length :
+ 1 ;
+
+ // The _handled method is fired to tell the default movestart
+ // handler that one of the move events is bound.
+ template._handled = handled;
+
+ // Pass the touchmove event so it can be prevented if or when
+ // movestart is handled.
+ template._preventTouchmoveDefault = function() {
+ e.preventDefault();
+ };
+
+ // Trigger the movestart event.
+ trigger(template.target, template);
+
+ // Unbind handlers that tracked the touch or mouse up till now.
+ fn(template.identifier);
+ }
+
+
+ // Handlers that control what happens following a movestart
+
+ function activeMousemove(e) {
+ var event = e.data.event,
+ timer = e.data.timer;
+
+ updateEvent(event, e, e.timeStamp, timer);
+ }
+
+ function activeMouseend(e) {
+ var event = e.data.event,
+ timer = e.data.timer;
+
+ removeActiveMouse();
+
+ endEvent(event, timer, function() {
+ // Unbind the click suppressor, waiting until after mouseup
+ // has been handled.
+ setTimeout(function(){
+ remove(event.target, 'click', returnFalse);
+ }, 0);
+ });
+ }
+
+ function removeActiveMouse(event) {
+ remove(document, mouseevents.move, activeMousemove);
+ remove(document, mouseevents.end, activeMouseend);
+ }
+
+ function activeTouchmove(e) {
+ var event = e.data.event,
+ timer = e.data.timer,
+ touch = changedTouch(e, event);
+
+ if (!touch) { return; }
+
+ // Stop the interface from gesturing
+ e.preventDefault();
+
+ event.targetTouches = e.targetTouches;
+ updateEvent(event, touch, e.timeStamp, timer);
+ }
+
+ function activeTouchend(e) {
+ var event = e.data.event,
+ timer = e.data.timer,
+ touch = identifiedTouch(e.changedTouches, event.identifier);
+
+ // This isn't the touch you're looking for.
+ if (!touch) { return; }
+
+ removeActiveTouch(event);
+ endEvent(event, timer);
+ }
+
+ function removeActiveTouch(event) {
+ remove(document, '.' + event.identifier, activeTouchmove);
+ remove(document, '.' + event.identifier, activeTouchend);
+ }
+
+
+ // Logic for triggering move and moveend events
+
+ function updateEvent(event, touch, timeStamp, timer) {
+ var time = timeStamp - event.timeStamp;
+
+ event.type = 'move';
+ event.distX = touch.pageX - event.startX;
+ event.distY = touch.pageY - event.startY;
+ event.deltaX = touch.pageX - event.pageX;
+ event.deltaY = touch.pageY - event.pageY;
+
+ // Average the velocity of the last few events using a decay
+ // curve to even out spurious jumps in values.
+ event.velocityX = 0.3 * event.velocityX + 0.7 * event.deltaX / time;
+ event.velocityY = 0.3 * event.velocityY + 0.7 * event.deltaY / time;
+ event.pageX = touch.pageX;
+ event.pageY = touch.pageY;
+
+ timer.kick();
+ }
+
+ function endEvent(event, timer, fn) {
+ timer.end(function(){
+ event.type = 'moveend';
+
+ trigger(event.target, event);
+
+ return fn && fn();
+ });
+ }
+
+
+ // jQuery special event definition
+
+ function setup(data, namespaces, eventHandle) {
+ // Stop the node from being dragged
+ //add(this, 'dragstart.move drag.move', preventDefault);
+
+ // Prevent text selection and touch interface scrolling
+ //add(this, 'mousedown.move', preventIgnoreTags);
+
+ // Tell movestart default handler that we've handled this
+ add(this, 'movestart.move', flagAsHandled);
+
+ // Don't bind to the DOM. For speed.
+ return true;
+ }
+
+ function teardown(namespaces) {
+ remove(this, 'dragstart drag', preventDefault);
+ remove(this, 'mousedown touchstart', preventIgnoreTags);
+ remove(this, 'movestart', flagAsHandled);
+
+ // Don't bind to the DOM. For speed.
+ return true;
+ }
+
+ function addMethod(handleObj) {
+ // We're not interested in preventing defaults for handlers that
+ // come from internal move or moveend bindings
+ if (handleObj.namespace === "move" || handleObj.namespace === "moveend") {
+ return;
+ }
+
+ // Stop the node from being dragged
+ add(this, 'dragstart.' + handleObj.guid + ' drag.' + handleObj.guid, preventDefault, undefined, handleObj.selector);
+
+ // Prevent text selection and touch interface scrolling
+ add(this, 'mousedown.' + handleObj.guid, preventIgnoreTags, undefined, handleObj.selector);
+ }
+
+ function removeMethod(handleObj) {
+ if (handleObj.namespace === "move" || handleObj.namespace === "moveend") {
+ return;
+ }
+
+ remove(this, 'dragstart.' + handleObj.guid + ' drag.' + handleObj.guid);
+ remove(this, 'mousedown.' + handleObj.guid);
+ }
+
+ jQuery.event.special.movestart = {
+ setup: setup,
+ teardown: teardown,
+ add: addMethod,
+ remove: removeMethod,
+
+ _default: function(e) {
+ var template, data;
+
+ // If no move events were bound to any ancestors of this
+ // target, high tail it out of here.
+ if (!e._handled()) { return; }
+
+ template = {
+ target: e.target,
+ startX: e.startX,
+ startY: e.startY,
+ pageX: e.pageX,
+ pageY: e.pageY,
+ distX: e.distX,
+ distY: e.distY,
+ deltaX: e.deltaX,
+ deltaY: e.deltaY,
+ velocityX: e.velocityX,
+ velocityY: e.velocityY,
+ timeStamp: e.timeStamp,
+ identifier: e.identifier,
+ targetTouches: e.targetTouches,
+ finger: e.finger
+ };
+
+ data = {
+ event: template,
+ timer: new Timer(function(time){
+ trigger(e.target, template);
+ })
+ };
+
+ if (e.identifier === undefined) {
+ // We're dealing with a mouse
+ // Stop clicks from propagating during a move
+ add(e.target, 'click', returnFalse);
+ add(document, mouseevents.move, activeMousemove, data);
+ add(document, mouseevents.end, activeMouseend, data);
+ }
+ else {
+ // We're dealing with a touch. Stop touchmove doing
+ // anything defaulty.
+ e._preventTouchmoveDefault();
+ add(document, touchevents.move + '.' + e.identifier, activeTouchmove, data);
+ add(document, touchevents.end + '.' + e.identifier, activeTouchend, data);
+ }
+ }
+ };
+
+ jQuery.event.special.move = {
+ setup: function() {
+ // Bind a noop to movestart. Why? It's the movestart
+ // setup that decides whether other move events are fired.
+ add(this, 'movestart.move', jQuery.noop);
+ },
+
+ teardown: function() {
+ remove(this, 'movestart.move', jQuery.noop);
+ }
+ };
+
+ jQuery.event.special.moveend = {
+ setup: function() {
+ // Bind a noop to movestart. Why? It's the movestart
+ // setup that decides whether other move events are fired.
+ add(this, 'movestart.moveend', jQuery.noop);
+ },
+
+ teardown: function() {
+ remove(this, 'movestart.moveend', jQuery.noop);
+ }
+ };
+
+ add(document, 'mousedown.move', mousedown);
+ add(document, 'touchstart.move', touchstart);
+
+ // Make jQuery copy touch event properties over to the jQuery event
+ // object, if they are not already listed. But only do the ones we
+ // really need. IE7/8 do not have Array#indexOf(), but nor do they
+ // have touch events, so let's assume we can ignore them.
+ if (typeof Array.prototype.indexOf === 'function') {
+ (function(jQuery, undefined){
+ var props = ["changedTouches", "targetTouches"],
+ l = props.length;
+
+ while (l--) {
+ if (jQuery.event.props.indexOf(props[l]) === -1) {
+ jQuery.event.props.push(props[l]);
+ }
+ }
+ })(jQuery);
+ };
+});
130 js/foundation/jquery.event.swipe.js
View
@@ -0,0 +1,130 @@
+// jQuery.event.swipe
+// 0.5
+// Stephen Band
+
+// Dependencies
+// jQuery.event.move 1.2
+
+// One of swipeleft, swiperight, swipeup or swipedown is triggered on
+// moveend, when the move has covered a threshold ratio of the dimension
+// of the target node, or has gone really fast. Threshold and velocity
+// sensitivity changed with:
+//
+// jQuery.event.special.swipe.settings.threshold
+// jQuery.event.special.swipe.settings.sensitivity
+
+(function (module) {
+ if (typeof define === 'function' && define.amd) {
+ // AMD. Register as an anonymous module.
+ define(['jquery'], module);
+ } else {
+ // Browser globals
+ module(jQuery);
+ }
+})(function(jQuery, undefined){
+ var add = jQuery.event.add,
+
+ remove = jQuery.event.remove,
+
+ // Just sugar, so we can have arguments in the same order as
+ // add and remove.
+ trigger = function(node, type, data) {
+ jQuery.event.trigger(type, data, node);
+ },
+
+ settings = {
+ // Ratio of distance over target finger must travel to be
+ // considered a swipe.
+ threshold: 0.4,
+ // Faster fingers can travel shorter distances to be considered
+ // swipes. 'sensitivity' controls how much. Bigger is shorter.
+ sensitivity: 6
+ };
+
+ function moveend(e) {
+ var w, h, event;
+
+ w = e.target.offsetWidth;
+ h = e.target.offsetHeight;
+
+ // Copy over some useful properties from the move event
+ event = {
+ distX: e.distX,
+ distY: e.distY,
+ velocityX: e.velocityX,
+ velocityY: e.velocityY,
+ finger: e.finger
+ };
+
+ // Find out which of the four directions was swiped
+ if (e.distX > e.distY) {
+ if (e.distX > -e.distY) {
+ if (e.distX/w > settings.threshold || e.velocityX * e.distX/w * settings.sensitivity > 1) {
+ event.type = 'swiperight';
+ trigger(e.currentTarget, event);
+ }
+ }
+ else {
+ if (-e.distY/h > settings.threshold || e.velocityY * e.distY/w * settings.sensitivity > 1) {
+ event.type = 'swipeup';
+ trigger(e.currentTarget, event);
+ }
+ }
+ }
+ else {
+ if (e.distX > -e.distY) {
+ if (e.distY/h > settings.threshold || e.velocityY * e.distY/w * settings.sensitivity > 1) {
+ event.type = 'swipedown';
+ trigger(e.currentTarget, event);
+ }
+ }
+ else {
+ if (-e.distX/w > settings.threshold || e.velocityX * e.distX/w * settings.sensitivity > 1) {
+ event.type = 'swipeleft';
+ trigger(e.currentTarget, event);
+ }
+ }
+ }
+ }
+
+ function getData(node) {
+ var data = jQuery.data(node, 'event_swipe');
+
+ if (!data) {
+ data = { count: 0 };
+ jQuery.data(node, 'event_swipe', data);
+ }
+
+ return data;
+ }
+
+ jQuery.event.special.swipe =
+ jQuery.event.special.swipeleft =
+ jQuery.event.special.swiperight =
+ jQuery.event.special.swipeup =
+ jQuery.event.special.swipedown = {
+ setup: function( data, namespaces, eventHandle ) {
+ var data = getData(this);
+
+ // If another swipe event is already setup, don't setup again.
+ if (data.count++ > 0) { return; }
+
+ add(this, 'moveend', moveend);
+
+ return true;
+ },
+
+ teardown: function() {
+ var data = getData(this);
+
+ // If another swipe event is still setup, don't teardown.
+ if (--data.count > 0) { return; }
+
+ remove(this, 'moveend', moveend);
+
+ return true;
+ },
+
+ settings: settings
+ };
+});
34 js/foundation/jquery.foundation.accordion.js
View
@@ -0,0 +1,34 @@
+;(function ($, window, undefined){
+ 'use strict';
+
+ $.fn.foundationAccordion = function (options) {
+ var $accordion = $('.accordion');
+
+ if ($accordion.hasClass('hover') && !Modernizr.touch) {
+ $('.accordion li', this).on({
+ mouseenter : function () {
+ console.log('due');
+ var p = $(this).parent(),
+ flyout = $(this).children('.content').first();
+
+ $('.content', p).not(flyout).hide().parent('li').removeClass('active'); //changed this
+ flyout.show(0, function () {
+ flyout.parent('li').addClass('active');
+ });
+ }
+ });
+ } else {
+ $('.accordion li', this).on('click.fndtn', function () {
+ var p = $(this).parent(),
+ flyout = $(this).children('.content').first();
+
+ $('.content', p).not(flyout).hide().parent('li').removeClass('active'); //changed this
+ flyout.show(0, function () {
+ flyout.parent('li').addClass('active');
+ });
+ });
+ }
+
+ };
+
+})( jQuery, this );
20 js/foundation/jquery.foundation.alerts.js
View
@@ -0,0 +1,20 @@
+;(function ($, window, undefined) {
+ 'use strict';
+
+ $.fn.foundationAlerts = function (options) {
+ var settings = $.extend({
+ callback: $.noop
+ }, options);
+
+ $(document).on("click", ".alert-box a.close", function (e) {
+ e.preventDefault();
+ $(this).closest(".alert-box").fadeOut(function () {
+ $(this).remove();
+ // Do something else after the alert closes
+ settings.callback();
+ });
+ });
+
+ };
+
+})(jQuery, this);
74 js/foundation/jquery.foundation.buttons.js
View
@@ -0,0 +1,74 @@
+;(function ($, window, undefined) {
+ 'use strict';
+
+ $.fn.foundationButtons = function (options) {
+ var $doc = $(document),
+ config = $.extend({
+ dropdownAsToggle:true,
+ activeClass:'active'
+ }, options),
+
+ // close all dropdowns except for the dropdown passed
+ closeDropdowns = function (dropdown) {
+ $('.button.dropdown').find('ul').not(dropdown).removeClass('show-dropdown');
+ },
+ // reset all toggle states except for the button passed
+ resetToggles = function (button) {
+ var buttons = $('.button.dropdown').not(button);
+ buttons.add($('> span.' + config.activeClass, buttons)).removeClass(config.activeClass);
+ };
+
+ // Prevent event propagation on disabled buttons
+ $doc.on('click.fndtn', '.button.disabled', function (e) {
+ e.preventDefault();
+ });
+
+ $('.button.dropdown > ul', this).addClass('no-hover');
+
+ // reset other active states
+ $doc.on('click.fndtn', '.button.dropdown:not(.split), .button.dropdown.split span', function (e) {
+ var $el = $(this),
+ button = $el.closest('.button.dropdown'),
+ dropdown = $('> ul', button);
+ e.preventDefault();
+
+ // close other dropdowns
+ closeDropdowns(config.dropdownAsToggle ? dropdown : '');
+ dropdown.toggleClass('show-dropdown');
+
+ if (config.dropdownAsToggle) {
+ resetToggles(button);
+ $el.toggleClass(config.activeClass);
+ }
+ });
+
+ // close all dropdowns and deactivate all buttons
+ $doc.on('click.fndtn', 'body, html', function (e) {
+ // check original target instead of stopping event propagation to play nice with other events
+ if (!$(e.originalEvent.target).is('.button.dropdown:not(.split), .button.dropdown.split span')) {
+ closeDropdowns();
+ if (config.dropdownAsToggle) {
+ resetToggles();
+ }
+ }
+ });
+
+ // Positioning the Flyout List
+ var normalButtonHeight = $('.button.dropdown:not(.large):not(.small):not(.tiny)', this).outerHeight() - 1,
+ largeButtonHeight = $('.button.large.dropdown', this).outerHeight() - 1,
+ smallButtonHeight = $('.button.small.dropdown', this).outerHeight() - 1,
+ tinyButtonHeight = $('.button.tiny.dropdown', this).outerHeight() - 1;
+
+ $('.button.dropdown:not(.large):not(.small):not(.tiny) > ul', this).css('top', normalButtonHeight);
+ $('.button.dropdown.large > ul', this).css('top', largeButtonHeight);
+ $('.button.dropdown.small > ul', this).css('top', smallButtonHeight);
+ $('.button.dropdown.tiny > ul', this).css('top', tinyButtonHeight);
+
+ $('.button.dropdown.up:not(.large):not(.small):not(.tiny) > ul', this).css('top', 'auto').css('bottom', normalButtonHeight - 2);
+ $('.button.dropdown.up.large > ul', this).css('top', 'auto').css('bottom', largeButtonHeight - 2);
+ $('.button.dropdown.up.small > ul', this).css('top', 'auto').css('bottom', smallButtonHeight - 2);
+ $('.button.dropdown.up.tiny > ul', this).css('top', 'auto').css('bottom', tinyButtonHeight - 2);
+
+ };
+
+})( jQuery, this );
468 js/foundation/jquery.foundation.clearing.js
View
@@ -0,0 +1,468 @@
+/*
+ * jQuery Foundation Clearing 1.0
+ * http://foundation.zurb.com
+ * Copyright 2012, ZURB
+ * Free to use under the MIT license.
+ * http://www.opensource.org/licenses/mit-license.php
+*/
+
+/*jslint unparam: true, browser: true, indent: 2 */
+
+;(function ($, window, undefined) {
+ 'use strict';
+
+ var defaults = {
+ templates : {
+ viewing : '<a href="#" class="clearing-close">&times;</a>' +
+ '<div class="visible-img" style="display: none"><img src="#">' +
+ '<p class="clearing-caption"></p><a href="#" class="clearing-main-left"></a>' +
+ '<a href="#" class="clearing-main-right"></a></div>'
+ },
+ locked : false
+ },
+
+ superMethods = {},
+
+ methods = {
+ init : function (options, extendMethods) {
+ return this.find('ul[data-clearing]').each(function () {
+ var doc = $(document),
+ $el = $(this),
+ options = options || {},
+ extendMethods = extendMethods || {},
+ settings = $el.data('fndtn.clearing.settings');
+
+ if (!settings) {
+ options.$parent = $el.parent();
+
+ $el.data('fndtn.clearing.settings', $.extend({}, defaults, options));
+
+ // developer goodness experiment
+ methods.extend(methods, extendMethods);
+
+ // if the gallery hasn't been built yet...build it
+ methods.assemble($el.find('li'));
+
+ methods.events();
+
+ }
+ });
+ },
+
+ events : function () {
+ var doc = $(document);
+
+ doc.on('click.fndtn.clearing', 'ul[data-clearing] li', function (e, current, target) {
+ var current = current || $(this),
+ target = target || current;
+
+ e.preventDefault();
+
+ // set current and target to the clicked li if not otherwise defined.
+ methods.open($(e.target), current, target);
+ methods.update_paddles(target);
+ });
+
+ $(window).on('resize.fndtn.clearing', function () {
+ var image = $('.clearing-blackout .visible-img').find('img');
+
+ if (image.length > 0) {
+ methods.center(image);
+ }
+ });
+
+ doc.on('click.fndtn.clearing', '.clearing-main-right', function (e) {
+ var clearing = $('.clearing-blackout').find('ul[data-clearing]');
+
+ e.preventDefault();
+ methods.go(clearing, 'next');
+ });
+
+ doc.on('click.fndtn.clearing', '.clearing-main-left', function (e) {
+ var clearing = $('.clearing-blackout').find('ul[data-clearing]');
+
+ e.preventDefault();
+ methods.go(clearing, 'prev');
+ });
+
+ doc.on('click.fndtn.clearing', 'a.clearing-close, div.clearing-blackout', function (e) {
+ var root = (function (target) {
+ if (/blackout/.test(target.selector)) {
+ return target;
+ } else {
+ return target.closest('.clearing-blackout');
+ }
+ }($(this))), container, visible_image;
+
+ if (this === e.target && root) {
+ container = root.find('div:first'),
+ visible_image = container.find('.visible-img');
+
+ defaults.prev_index = 0;
+
+ root.find('ul[data-clearing]').attr('style', '')
+ root.removeClass('clearing-blackout');
+ container.removeClass('clearing-container');
+ visible_image.hide();
+ }
+
+ return false;
+ });
+
+ // should specify a target selector
+ doc.on('keydown.fndtn.clearing', function (e) {
+ var clearing = $('.clearing-blackout').find('ul[data-clearing]');
+
+ // right
+ if (e.which === 39) {
+ methods.go(clearing, 'next');
+ }
+
+ // left
+ if (e.which === 37) {
+ methods.go(clearing, 'prev');
+ }
+ });
+
+ doc.on('movestart', function(e) {
+
+ // If the movestart is heading off in an upwards or downwards
+ // direction, prevent it so that the browser scrolls normally.
+
+ if ((e.distX > e.distY && e.distX < -e.distY) ||
+ (e.distX < e.distY && e.distX > -e.distY)) {
+ e.preventDefault();
+ }
+ });
+
+ doc.bind('swipeleft', 'ul[data-clearing] li', function () {
+ var clearing = $('.clearing-blackout').find('ul[data-clearing]');
+ methods.go(clearing, 'next');
+ });
+
+ doc.bind('swiperight', 'ul[data-clearing] li', function () {
+ var clearing = $('.clearing-blackout').find('ul[data-clearing]');
+ methods.go(clearing, 'prev');
+ });
+ },
+
+ assemble : function ($li, target) {
+ var $el = $li.parent(),
+ settings = $el.data('fndtn.clearing.settings'),
+ grid = $el.detach(),
+ data = {
+ grid: '<div class="carousel">' + this.outerHTML(grid[0]) + '</div>',
+ viewing: settings.templates.viewing
+ },
+ wrapper = '<div class="clearing-assembled"><div>' + data.viewing + data.grid + '</div></div>';
+
+ return settings.$parent.append(wrapper);
+ },
+
+ open : function ($image, current, target) {
+ var root = target.closest('.clearing-assembled'),
+ container = root.find('div:first'),
+ visible_image = container.find('.visible-img'),
+ image = visible_image.find('img').not($image);
+
+ if (!methods.locked()) {
+
+ // set the image to the selected thumbnail
+ image.attr('src', this.load($image));
+
+ image.is_good(function () {
+ // toggle the gallery if not visible
+ root.addClass('clearing-blackout');
+ container.addClass('clearing-container');
+ methods.caption(visible_image.find('.clearing-caption'), $image);
+ visible_image.show();
+ methods.fix_height(target);
+
+ methods.center(image);
+
+ // shift the thumbnails if necessary
+ methods.shift(current, target, function () {
+ target.siblings().removeClass('visible');
+ target.addClass('visible');
+ });
+ });
+ }
+ },
+
+ fix_height : function (target) {
+ var lis = target.siblings();
+
+ lis.each(function () {
+ var li = $(this),
+ image = li.find('img');
+
+ if (li.height() > image.outerHeight()) {
+ li.addClass('fix-height');
+ }
+ });
+ lis.closest('ul').width(lis.length * 100 + '%');
+ },
+
+ update_paddles : function (target) {
+ var visible_image = target.closest('.carousel').siblings('.visible-img');
+
+ if (target.next().length > 0) {
+ visible_image.find('.clearing-main-right').removeClass('disabled');
+ } else {
+ visible_image.find('.clearing-main-right').addClass('disabled');
+ }
+
+ if (target.prev().length > 0) {
+ visible_image.find('.clearing-main-left').removeClass('disabled');
+ } else {
+ visible_image.find('.clearing-main-left').addClass('disabled');
+ }
+ },
+
+ load : function ($image) {
+ var href = $image.parent().attr('href');
+
+ // preload next and previous
+ this.preload($image);
+
+ if (href) {
+ return href;
+ }
+
+ return $image.attr('src');
+ },
+
+ preload : function ($image) {
+ var next = $image.closest('li').next(),
+ prev = $image.closest('li').prev(),
+ next_a, prev_a,
+ next_img, prev_img;
+
+ if (next.length > 0) {
+ next_img = new Image();
+ next_a = next.find('a');
+ if (next_a.length > 0) {
+ next_img.src = next_a.attr('href');
+ } else {
+ next_img.src = next.find('img').attr('src');
+ }
+ }
+
+ if (prev.length > 0) {
+ prev_img = new Image();
+ prev_a = prev.find('a');
+ if (prev_a.length > 0) {
+ prev_img.src = prev_a.attr('href');
+ } else {
+ prev_img.src = prev.find('img').attr('src');
+ }
+ }
+ },
+
+ caption : function (container, $image) {
+ var caption = $image.data('caption');
+
+ if (caption) {
+ container.text(caption).show();
+ } else {
+ container.text('').hide();
+ }
+ },
+
+ go : function ($ul, direction) {
+ var current = $ul.find('.visible'),
+ target = current[direction]();
+
+ if (target.length > 0) {
+ target.find('img').trigger('click', [current, target]);
+ }
+ },
+
+ shift : function (current, target, callback) {
+ var clearing = target.parent(),
+ container = clearing.closest('.clearing-container'),
+ target_offset = target.position().left,
+ thumbs_offset = clearing.position().left,
+ old_index = defaults.prev_index,
+ direction = this.direction(clearing, current, target),
+ left = parseInt(clearing.css('left'), 10),
+ width = target.outerWidth(),
+ skip_shift;
+
+ // we use jQuery animate instead of CSS transitions because we
+ // need a callback to unlock the next animation
+
+ if (target.index() !== old_index && !/skip/.test(direction)){
+ if (/left/.test(direction)) {
+ methods.lock();
+ clearing.animate({left : left + width}, 300, methods.unlock);
+ } else if (/right/.test(direction)) {
+ methods.lock();
+ clearing.animate({left : left - width}, 300, methods.unlock);
+ }
+ } else if (/skip/.test(direction)) {
+
+ // the target image is not adjacent to the current image, so
+ // do we scroll right or not
+ skip_shift = target.index() - defaults.up_count;
+ methods.lock();
+
+ if (skip_shift > 0) {
+ clearing.animate({left : -(skip_shift * width)}, 300, methods.unlock);
+ } else {
+ clearing.animate({left : 0}, 300, methods.unlock);
+ }
+ }
+
+ callback();
+ },
+
+ lock : function () {
+ defaults.locked = true;
+ },
+
+ unlock : function () {
+ defaults.locked = false;
+ },
+
+ locked : function () {
+ return defaults.locked;
+ },
+
+ direction : function ($el, current, target) {
+ var lis = $el.find('li'),
+ li_width = lis.outerWidth() + (lis.outerWidth() / 4),
+ container = $('.clearing-container'),
+ up_count = Math.floor(container.outerWidth() / li_width) - 1,
+ shift_count = lis.length - up_count,
+ target_index = lis.index(target),
+ current_index = lis.index(current),
+ response;
+
+ defaults.up_count = up_count;
+
+ if (this.adjacent(defaults.prev_index, target_index)) {
+ if ((target_index > up_count) && target_index > defaults.prev_index) {
+ response = 'right';
+ } else if ((target_index > up_count - 1) && target_index <= defaults.prev_index) {
+ response = 'left';
+ } else {
+ response = false;
+ }
+ } else {
+ response = 'skip';
+ }
+
+ defaults.prev_index = target_index;
+
+ return response;
+ },
+
+ adjacent : function (current_index, target_index) {
+ if (target_index - 1 === current_index) {
+ return true;
+ } else if (target_index + 1 === current_index) {
+ return true;
+ } else if (target_index === current_index) {
+ return true;
+ }
+
+ return false;
+ },
+
+ center : function (target) {
+ target.css({
+ marginLeft : -(target.outerWidth() / 2),
+ marginTop : -(target.outerHeight() / 2)
+ });
+ },
+
+ outerHTML : function (el) {
+ // support FireFox < 11
+ return el.outerHTML || new XMLSerializer().serializeToString(el);
+ },
+
+ // experimental functionality for overwriting or extending
+ // clearing methods during initialization.
+ //
+ // ex $doc.foundationClearing({}, {
+ // shift : function (current, target, callback) {
+ // // modify arguments, etc.
+ // this._super('shift', [current, target, callback]);
+ // // do something else here.
+ // }
+ // });
+
+ extend : function (supers, extendMethods) {
+ $.each(supers, function (name, method) {
+ if (extendMethods.hasOwnProperty(name)) {
+ superMethods[name] = method;
+ }
+ });
+
+ $.extend(methods, extendMethods);
+ },
+
+ // you can call this._super('methodName', [args]) to call
+ // the original method and wrap it in your own code
+
+ _super : function (method, args) {
+ return superMethods[method].apply(this, args);
+ }
+ };
+
+ $.fn.foundationClearing = function (method) {
+ if (methods[method]) {
+ return methods[method].apply(this, Array.prototype.slice.call(arguments, 1));
+ } else if (typeof method === 'object' || !method) {
+ return methods.init.apply(this, arguments);
+ } else {
+ $.error('Method ' + method + ' does not exist on jQuery.foundationClearing');
+ }
+ };
+
+ // jquery.imageready.js
+ // @weblinc, @jsantell, (c) 2012
+
+ (function( $ ) {
+ $.fn.is_good = function ( callback, userSettings ) {
+ var
+ options = $.extend( {}, $.fn.is_good.defaults, userSettings ),
+ $images = this.find( 'img' ).add( this.filter( 'img' ) ),
+ unloadedImages = $images.length;
+
+ function loaded () {
+ unloadedImages -= 1;
+ !unloadedImages && callback();
+ }
+
+ function bindLoad () {
+ this.one( 'load', loaded );
+ if ( $.browser.msie ) {
+ var
+ src = this.attr( 'src' ),
+ param = src.match( /\?/ ) ? '&' : '?';
+ param += options.cachePrefix + '=' + ( new Date() ).getTime();
+ this.attr( 'src', src + param );
+ }
+ }
+
+ return $images.each(function () {
+ var $this = $( this );
+ if ( !$this.attr( 'src' ) ) {
+ loaded();
+ return;
+ }
+ this.complete || this.readyState === 4 ?
+ loaded() :
+ bindLoad.call( $this );
+ });
+ };
+
+ $.fn.is_good.defaults = {
+ cachePrefix: 'random'
+ };
+
+ }(jQuery));
+
+}(jQuery, this));
486 js/foundation/jquery.foundation.forms.js
View
@@ -0,0 +1,486 @@
+/*
+ * jQuery Custom Forms Plugin 1.0
+ * www.ZURB.com
+ * Copyright 2010, ZURB
+ * Free to use under the MIT license.
+ * http://www.opensource.org/licenses/mit-license.php
+*/
+
+(function( $ ){
+
+ /**
+ * Helper object used to quickly adjust all hidden parent element's, display and visibility properties.
+ * This is currently used for the custom drop downs. When the dropdowns are contained within a reveal modal
+ * we cannot accurately determine the list-item elements width property, since the modal's display property is set
+ * to 'none'.
+ *
+ * This object will help us work around that problem.
+ *
+ * NOTE: This could also be plugin.
+ *
+ * @function hiddenFix
+ */
+ var hiddenFix = function() {
+
+ return {
+ /**
+ * Sets all hidden parent elements and self to visibile.
+ *
+ * @method adjust
+ * @param {jQuery Object} $child
+ */
+
+ // We'll use this to temporarily store style properties.
+ tmp : [],
+
+ // We'll use this to set hidden parent elements.
+ hidden : null,
+
+ adjust : function( $child ) {
+ // Internal reference.
+ var _self = this;
+
+ // Set all hidden parent elements, including this element.
+ _self.hidden = $child.parents().andSelf().filter( ":hidden" );
+
+ // Loop through all hidden elements.
+ _self.hidden.each( function() {
+
+ // Cache the element.
+ var $elem = $( this );
+
+ // Store the style attribute.
+ // Undefined if element doesn't have a style attribute.
+ _self.tmp.push( $elem.attr( 'style' ) );
+
+ // Set the element's display property to block,
+ // but ensure it's visibility is hidden.
+ $elem.css( { 'visibility' : 'hidden', 'display' : 'block' } );
+ });
+
+ }, // end adjust
+
+ /**
+ * Resets the elements previous state.
+ *
+ * @method reset
+ */
+ reset : function() {
+ // Internal reference.
+ var _self = this;
+ // Loop through our hidden element collection.
+ _self.hidden.each( function( i ) {
+ // Cache this element.
+ var $elem = $( this ),
+ _tmp = _self.tmp[ i ]; // Get the stored 'style' value for this element.
+
+ // If the stored value is undefined.
+ if( _tmp === undefined )
+ // Remove the style attribute.
+ $elem.removeAttr( 'style' );
+ else
+ // Otherwise, reset the element style attribute.
+ $elem.attr( 'style', _tmp );
+
+ });
+ // Reset the tmp array.
+ _self.tmp = [];
+ // Reset the hidden elements variable.
+ _self.hidden = null;
+
+ } // end reset
+
+ }; // end return
+
+ };
+
+ jQuery.foundation = jQuery.foundation || {};
+ jQuery.foundation.customForms = jQuery.foundation.customForms || {};
+
+ $.foundation.customForms.appendCustomMarkup = function ( options ) {
+
+ var defaults = {
+ disable_class: "js-disable-custom"
+ };
+
+ options = $.extend( defaults, options );
+
+ function appendCustomMarkup(idx, sel) {
+ var $this = $(sel).hide(),
+ type = $this.attr('type'),
+ $span = $this.next('span.custom.' + type);
+
+ if ($span.length === 0) {
+ $span = $('<span class="custom ' + type + '"></span>').insertAfter($this);
+ }
+
+ $span.toggleClass('checked', $this.is(':checked'));
+ $span.toggleClass('disabled', $this.is(':disabled'));
+ }
+
+ function appendCustomSelect(idx, sel) {
+ var hiddenFixObj = hiddenFix();
+ //
+ // jQueryify the <select> element and cache it.
+ //
+ var $this = $( sel ),
+ //
+ // Find the custom drop down element.
+ //
+ $customSelect = $this.next( 'div.custom.dropdown' ),
+ //
+ // Find the custom select element within the custom drop down.
+ //
+ $customList = $customSelect.find( 'ul' ),
+ //
+ // Find the custom a.current element.
+ //
+ $selectCurrent = $customSelect.find( ".current" ),
+ //
+ // Find the custom a.selector element (the drop-down icon).
+ //
+ $selector = $customSelect.find( ".selector" ),
+ //
+ // Get the <options> from the <select> element.
+ //
+ $options = $this.find( 'option' ),
+ //
+ // Filter down the selected options
+ //
+ $selectedOption = $options.filter( ':selected' ),
+ //
+ // Initial max width.
+ //
+ maxWidth = 0,
+ //
+ // We'll use this variable to create the <li> elements for our custom select.
+ //
+ liHtml = '',
+ //
+ // We'll use this to cache the created <li> elements within our custom select.
+ //
+ $listItems
+ ;
+ var $currentSelect = false;
+ //
+ // Should we not create a custom list?
+ //
+ if ( $this.hasClass( 'no-custom' ) ) return;
+
+ //
+ // Did we not create a custom select element yet?
+ //
+ if ( $customSelect.length === 0 ) {
+ //
+ // Let's create our custom select element!
+ //
+
+ //
+ // Determine what select size to use.
+ //
+ var customSelectSize = $this.hasClass( 'small' ) ? 'small' :
+ $this.hasClass( 'medium' ) ? 'medium' :
+ $this.hasClass( 'large' ) ? 'large' :
+ $this.hasClass( 'expand' ) ? 'expand' : ''
+ ;
+ //
+ // Build our custom list.
+ //
+ $customSelect = $('<div class="' + ['custom', 'dropdown', customSelectSize ].join( ' ' ) + '"><a href="#" class="selector"></a><ul /></div>"');
+ //
+ // Grab the selector element
+ //
+ $selector = $customSelect.find( ".selector" );
+ //
+ // Grab the unordered list element from the custom list.
+ //
+ $customList = $customSelect.find( "ul" );
+ //
+ // Build our <li> elements.
+ //
+ liHtml = $options.map( function() { return "<li>" + $( this ).html() + "</li>"; } ).get().join( '' );
+ //
+ // Append our <li> elements to the custom list (<ul>).
+ //
+ $customList.append( liHtml );
+ //
+ // Insert the the currently selected list item before all other elements.
+ // Then, find the element and assign it to $currentSelect.
+ //
+
+ $currentSelect = $customSelect.prepend( '<a href="#" class="current">' + $selectedOption.html() + '</a>' ).find( ".current" );
+ //
+ // Add the custom select element after the <select> element.
+ //
+ $this.after( $customSelect )
+ //
+ //then hide the <select> element.
+ //
+ .hide();
+
+ } else {
+ //
+ // Create our list item <li> elements.
+ //
+ liHtml = $options.map( function() { return "<li>" + $( this ).html() + "</li>"; } ).get().join( '' );
+ //
+ // Refresh the ul with options from the select in case the supplied markup doesn't match.
+ // Clear what's currently in the <ul> element.
+ //
+ $customList.html( '' )
+ //
+ // Populate the list item <li> elements.
+ //
+ .append( liHtml );
+
+ } // endif $customSelect.length === 0
+
+ //
+ // Determine whether or not the custom select element should be disabled.
+ //
+ $customSelect.toggleClass( 'disabled', $this.is( ':disabled' ) );
+ //
+ // Cache our List item elements.
+ //
+ $listItems = $customList.find( 'li' );
+
+ //
+ // Determine which elements to select in our custom list.
+ //
+ $options.each( function ( index ) {
+
+ if ( this.selected ) {
+ //
+ // Add the selected class to the current li element
+ //
+ $listItems.eq( index ).addClass( 'selected' );
+ //
+ // Update the current element with the option value.
+ //
+ if ($currentSelect) {
+ $currentSelect.html( $( this ).html() );
+ }
+
+ }
+
+ });
+
+ //
+ // Update the custom <ul> list width property.
+ //
+ $customList.css( 'width', 'inherit' );
+ //
+ // Set the custom select width property.
+ //
+ $customSelect.css( 'width', 'inherit' );
+
+ //
+ // If we're not specifying a predetermined form size.
+ //
+ if ( !$customSelect.is( '.small, .medium, .large, .expand' ) ) {
+
+ // ------------------------------------------------------------------------------------
+ // This is a work-around for when elements are contained within hidden parents.
+ // For example, when custom-form elements are inside of a hidden reveal modal.
+ //
+ // We need to display the current custom list element as well as hidden parent elements
+ // in order to properly calculate the list item element's width property.
+ // -------------------------------------------------------------------------------------
+
+ //
+ // Show the drop down.
+ // This should ensure that the list item's width values are properly calculated.
+ //
+ $customSelect.addClass( 'open' );
+ //
+ // Quickly, display all parent elements.
+ // This should help us calcualate the width of the list item's within the drop down.
+ //
+ hiddenFixObj.adjust( $customList );
+ //
+ // Grab the largest list item width.
+ //
+ maxWidth = ( $listItems.outerWidth() > maxWidth ) ? $listItems.outerWidth() : maxWidth;
+ //
+ // Okay, now reset the parent elements.
+ // This will hide them again.
+ //
+ hiddenFixObj.reset();
+ //
+ // Finally, hide the drop down.
+ //
+ $customSelect.removeClass( 'open' );
+ //
+ // Set the custom list width.
+ //
+ $customSelect.width( maxWidth + 18);
+ //
+ // Set the custom list element (<ul />) width.
+ //
+ $customList.width( maxWidth + 16 );
+
+ } // endif
+
+ }
+
+ $('form.custom input:radio[data-customforms!=disabled]').each(appendCustomMarkup);
+ $('form.custom input:checkbox[data-customforms!=disabled]').each(appendCustomMarkup);
+ $('form.custom select[data-customforms!=disabled]').each(appendCustomSelect);
+ };
+
+ var refreshCustomSelect = function($select) {
+ var maxWidth = 0,
+ $customSelect = $select.next();
+ $options = $select.find('option');
+ $customSelect.find('ul').html('');
+
+ $options.each(function () {
+ $li = $('<li>' + $(this).html() + '</li>');
+ $customSelect.find('ul').append($li);
+ });
+
+ // re-populate
+ $options.each(function (index) {
+ if (this.selected) {
+ $customSelect.find('li').eq(index).addClass('selected');
+ $customSelect.find('.current').html($(this).html());
+ }
+ });
+
+ // fix width
+ $customSelect.removeAttr('style')
+ .find('ul').removeAttr('style');
+ $customSelect.find('li').each(function () {
+ $customSelect.addClass('open');
+ if ($(this).outerWidth() > maxWidth) {
+ maxWidth = $(this).outerWidth();
+ }
+ $customSelect.removeClass('open');
+ });
+ $customSelect.css('width', maxWidth + 18 + 'px');
+ $customSelect.find('ul').css('width', maxWidth + 16 + 'px');
+
+ };
+
+ var toggleCheckbox = function($element) {
+ var $input = $element.prev(),
+ input = $input[0];
+
+ if (false === $input.is(':disabled')) {
+ input.checked = ((input.checked) ? false : true);
+ $element.toggleClass('checked');
+
+ $input.trigger('change');
+ }
+ };
+
+ var toggleRadio = function($element) {
+ var $input = $element.prev(),
+ input = $input[0];
+
+ if (false === $input.is(':disabled')) {
+
+ $('input:radio[name="' + $input.attr('name') + '"]').next().not($element).removeClass('checked');
+ if ( !$element.hasClass('checked') ) {
+ $element.toggleClass('checked');
+ }
+ input.checked = $element.hasClass('checked');
+
+ $input.trigger('change');
+ }
+ };
+
+ $(document).on('click', 'form.custom span.custom.checkbox', function (event) {
+ event.preventDefault();
+ event.stopPropagation();
+
+ toggleCheckbox($(this));
+ });
+
+ $(document).on('click', 'form.custom span.custom.radio', function (event) {
+ event.preventDefault();
+ event.stopPropagation();
+
+ toggleRadio($(this));
+ });
+
+ $(document).on('change', 'form.custom select[data-customforms!=disabled]', function (event) {
+ refreshCustomSelect($(this));
+ });
+
+ $(document).on('click', 'form.custom label', function (event) {
+ var $associatedElement = $('#' + $(this).attr('for') + '[data-customforms!=disabled]'),
+ $customCheckbox,
+ $customRadio;
+ if ($associatedElement.length !== 0) {
+ if ($associatedElement.attr('type') === 'checkbox') {
+ event.preventDefault();
+ $customCheckbox = $(this).find('span.custom.checkbox');
+ toggleCheckbox($customCheckbox);
+ } else if ($associatedElement.attr('type') === 'radio') {
+ event.preventDefault();
+ $customRadio = $(this).find('span.custom.radio');
+ toggleRadio($customRadio);
+ }
+ }
+ });
+
+ $(document).on('click', 'form.custom div.custom.dropdown a.current, form.custom div.custom.dropdown a.selector', function (event) {
+ var $this = $(this),
+ $dropdown = $this.closest('div.custom.dropdown'),
+ $select = $dropdown.prev();
+
+ event.preventDefault();
+ $('div.dropdown').removeClass('open');
+
+ if (false === $select.is(':disabled')) {
+ $dropdown.toggleClass('open');
+
+ if ($dropdown.hasClass('open')) {
+ $(document).bind('click.customdropdown', function (event) {
+ $dropdown.removeClass('open');
+ $(document).unbind('.customdropdown');
+ });
+ } else {
+ $(document).unbind('.customdropdown');
+ }
+ return false;
+ }
+ });
+
+ $(document).on('click', 'form.custom div.custom.dropdown li', function (event) {
+ var $this = $(this),
+ $customDropdown = $this.closest('div.custom.dropdown'),
+ $select = $customDropdown.prev(),
+ selectedIndex = 0;
+
+ event.preventDefault();
+ event.stopPropagation();
+ $('div.dropdown').removeClass('open');
+
+ $this
+ .closest('ul')
+ .find('li')
+ .removeClass('selected');
+ $this.addClass('selected');
+
+ $customDropdown
+ .removeClass('open')
+ .find('a.current')
+ .html($this.html());
+
+ $this.closest('ul').find('li').each(function (index) {
+ if ($this[0] == this) {
+ selectedIndex = index;
+ }
+
+ });
+ $select[0].selectedIndex = selectedIndex;
+
+ $select.trigger('change');
+ });
+
+
+ $.fn.foundationCustomForms = $.foundation.customForms.appendCustomMarkup;
+
+})( jQuery );
639 js/foundation/jquery.foundation.joyride.js
View
@@ -0,0 +1,639 @@
+/*
+ * jQuery Foundation Joyride Plugin 2.0.1
+ * http://foundation.zurb.com
+ * Copyright 2012, ZURB
+ * Free to use under the MIT license.
+ * http://www.opensource.org/licenses/mit-license.php
+*/
+
+/*jslint unparam: true, browser: true, indent: 2 */
+
+;(function ($, window, undefined) {
+ 'use strict';
+
+ var defaults = {
+ 'version' : '2.0.1',
+ 'tipLocation' : 'bottom', // 'top' or 'bottom' in relation to parent
+ 'nubPosition' : 'auto', // override on a per tooltip bases
+ 'scrollSpeed' : 300, // Page scrolling speed in milliseconds
+ 'timer' : 0, // 0 = no timer , all other numbers = timer in milliseconds
+ 'startTimerOnClick' : true, // true or false - true requires clicking the first button start the timer
+ 'startOffset' : 0, // the index of the tooltip you want to start on (index of the li)
+ 'nextButton' : true, // true or false to control whether a next button is used
+ 'tipAnimation' : 'fade', // 'pop' or 'fade' in each tip
+ 'pauseAfter' : [], // array of indexes where to pause the tour after
+ 'tipAnimationFadeSpeed': 300, // when tipAnimation = 'fade' this is speed in milliseconds for the transition
+ 'cookieMonster' : false, // true or false to control whether cookies are used
+ 'cookieName' : 'joyride', // Name the cookie you'll use
+ 'cookieDomain' : false, // Will this cookie be attached to a domain, ie. '.notableapp.com'
+ 'tipContainer' : 'body', // Where will the tip be attached
+ 'postRideCallback' : $.noop, // A method to call once the tour closes (canceled or complete)
+ 'postStepCallback' : $.noop, // A method to call after each step
+ 'template' : { // HTML segments for tip layout
+ 'link' : '<a href="#close" class="joyride-close-tip">X</a>',
+ 'timer' : '<div class="joyride-timer-indicator-wrap"><span class="joyride-timer-indicator"></span></div>',
+ 'tip' : '<div class="joyride-tip-guide"><span class="joyride-nub"></span></div>',
+ 'wrapper' : '<div class="joyride-content-wrapper"></div>',
+ 'button' : '<a href="#" class="small button joyride-next-tip"></a>'
+ }
+ },
+
+ Modernizr = Modernizr || false,
+
+ settings = {},
+
+ methods = {
+
+ init : function (opts) {
+ return this.each(function () {
+
+ if ($.isEmptyObject(settings)) {
+ settings = $.extend(defaults, opts);
+
+ // non configureable settings
+ settings.document = window.document;
+ settings.$document = $(settings.document);
+ settings.$window = $(window);
+ settings.$content_el = $(this);
+ settings.body_offset = $(settings.tipContainer).position();
+ settings.$tip_content = $('li', settings.$content_el);
+ settings.paused = false;
+ settings.attempts = 0;
+
+ settings.tipLocationPatterns = {
+ top: ['bottom'],
+ bottom: [], // bottom should not need to be repositioned
+ left: ['right', 'top', 'bottom'],
+ right: ['left', 'top', 'bottom']
+ };
+
+ // are we using jQuery 1.7+
+ methods.jquery_check();
+
+ // can we create cookies?
+ if (!$.isFunction($.cookie)) {
+ settings.cookieMonster = false;
+ }
+
+ // generate the tips and insert into dom.
+ if (!settings.cookieMonster || !$.cookie(settings.cookieName)) {
+
+ settings.$tip_content.each(function (index) {
+ methods.create({$li : $(this), index : index});
+ });
+
+ // show first tip
+ if (!settings.startTimerOnClick && settings.timer > 0) {
+ methods.show('init');
+ methods.startTimer();
+ } else {
+ methods.show('init');
+ }
+
+ }
+
+ settings.$document.on('click.joyride', '.joyride-next-tip, .joyride-modal-bg', function (e) {
+ e.preventDefault();
+
+ if (settings.$li.next().length < 1) {
+ methods.end();
+ } else if (settings.timer > 0) {
+ clearTimeout(settings.automate);
+ methods.hide();
+ methods.show();
+ methods.startTimer();
+ } else {
+ methods.hide();
+ methods.show();
+ }
+
+ });
+
+ $('.joyride-close-tip').on('click.joyride', function (e) {
+ e.preventDefault();
+ methods.end();
+ });
+
+ settings.$window.on('resize.joyride', function (e) {
+ if (methods.is_phone()) {
+ methods.pos_phone();
+ } else {
+ methods.pos_default();
+ }
+ });
+ } else {
+ methods.restart();
+ }
+
+ });
+ },
+
+ // call this method when you want to resume the tour
+ resume : function () {
+ methods.set_li();
+ methods.show();
+ },
+
+ tip_template : function (opts) {
+ var $blank, content;
+
+ opts.tip_class = opts.tip_class || '';
+
+ $blank = $(settings.template.tip).addClass(opts.tip_class);
+ content = $.trim($(opts.li).html()) +
+ methods.button_text(opts.button_text) +
+ settings.template.link +
+ methods.timer_instance(opts.index);
+
+ $blank.append($(settings.template.wrapper));
+ $blank.first().attr('data-index', opts.index);
+ $('.joyride-content-wrapper', $blank).append(content);
+
+ return $blank[0];
+ },
+
+ timer_instance : function (index) {
+ var txt;
+
+ if ((index === 0 && settings.startTimerOnClick && settings.timer > 0) || settings.timer === 0) {
+ txt = '';
+ } else {
+ txt = methods.outerHTML($(settings.template.timer)[0]);
+ }
+ return txt;
+ },
+
+ button_text : function (txt) {
+ if (settings.nextButton) {
+ txt = $.trim(txt) || 'Next';
+ txt = methods.outerHTML($(settings.template.button).append(txt)[0]);
+ } else {
+ txt = '';
+ }
+ return txt;
+ },
+
+ create : function (opts) {
+ // backwards compatability with data-text attribute
+ var buttonText = opts.$li.attr('data-button') || opts.$li.attr('data-text'),
+ tipClass = opts.$li.attr('class'),
+ $tip_content = $(methods.tip_template({
+ tip_class : tipClass,
+ index : opts.index,
+ button_text : buttonText,
+ li : opts.$li
+ }));
+
+ $(settings.tipContainer).append($tip_content);
+ },
+
+ show : function (init) {
+ var opts = {}, ii, opts_arr = [], opts_len = 0, p,
+ $timer = null;
+
+ // are we paused?
+ if (settings.$li === undefined || ($.inArray(settings.$li.index(), settings.pauseAfter) === -1)) {
+
+ // don't go to the next li if the tour was paused
+ if (settings.paused) {
+ settings.paused = false;
+ } else {
+ methods.set_li(init);
+ }
+
+ settings.attempts = 0;
+
+ if (settings.$li.length && settings.$target.length > 0) {
+ opts_arr = (settings.$li.data('options') || ':').split(';');
+ opts_len = opts_arr.length;
+
+ // parse options
+ for (ii = opts_len - 1; ii >= 0; ii--) {
+ p = opts_arr[ii].split(':');
+
+ if (p.length === 2) {
+ opts[$.trim(p[0])] = $.trim(p[1]);
+ }
+ }
+
+ settings.tipSettings = $.extend({}, settings, opts);
+
+ settings.tipSettings.tipLocationPattern = settings.tipLocationPatterns[settings.tipSettings.tipLocation];
+
+ // scroll if not modal
+ if (!/body/i.test(settings.$target.selector)) {
+ methods.scroll_to();
+ }
+
+ if (methods.is_phone()) {
+ methods.pos_phone(true);
+ } else {
+ methods.pos_default(true);
+ }
+
+ $timer = $('.joyride-timer-indicator', settings.$next_tip);
+
+ if (/pop/i.test(settings.tipAnimation)) {
+
+ $timer.outerWidth(0);
+
+ if (settings.timer > 0) {
+
+ settings.$next_tip.show();
+ $timer.animate({
+ width: $('.joyride-timer-indicator-wrap', s