Permalink
Browse files

Dependencies were minified

  • Loading branch information...
1 parent e1b5b0b commit b14219f0998eff4a37c28a0d0b828e0bbd308fc8 @dmfrancisco committed Aug 5, 2011
Showing with 41 additions and 331 deletions.
  1. +0 −96 lib/jquery.jswipe-0.1.2.js
  2. +16 −0 lib/jquery.jswipe-0.1.2.min.js
  3. +0 −233 lib/live.js
  4. +23 −0 lib/live.min.js
  5. +2 −2 slideshow/master.html
View
@@ -1,96 +0,0 @@
-/*
- * jSwipe - jQuery Plugin
- * http://plugins.jquery.com/project/swipe
- * http://www.ryanscherf.com/demos/swipe/
- *
- * Copyright (c) 2009 Ryan Scherf (www.ryanscherf.com)
- * Licensed under the MIT license
- *
- * $Date: 2009-07-14 (Tue, 14 Jul 2009) $
- * $version: 0.1.2
- *
- * This jQuery plugin will only run on devices running Mobile Safari
- * on iPhone or iPod Touch devices running iPhone OS 2.0 or later.
- * http://developer.apple.com/iphone/library/documentation/AppleApplications/Reference/SafariWebContent/HandlingEvents/HandlingEvents.html#//apple_ref/doc/uid/TP40006511-SW5
- */
-(function($) {
- $.fn.swipe = function(options) {
-
- // Default thresholds & swipe functions
- var defaults = {
- threshold: {
- x: 30,
- y: 10
- },
- swipeLeft: function() { alert('swiped left') },
- swipeRight: function() { alert('swiped right') }
- };
-
- var options = $.extend(defaults, options);
-
- if (!this) return false;
-
- return this.each(function() {
-
- var me = $(this)
-
- // Private variables for each element
- var originalCoord = { x: 0, y: 0 }
- var finalCoord = { x: 0, y: 0 }
-
- // Screen touched, store the original coordinate
- function touchStart(event) {
- //console.log('Starting swipe gesture...')
- originalCoord.x = event.targetTouches[0].pageX
- originalCoord.y = event.targetTouches[0].pageY
- }
-
- // Store coordinates as finger is swiping
- function touchMove(event) {
- event.preventDefault();
- finalCoord.x = event.targetTouches[0].pageX // Updated X,Y coordinates
- finalCoord.y = event.targetTouches[0].pageY
- }
-
- // Done Swiping
- // Swipe should only be on X axis, ignore if swipe on Y axis
- // Calculate if the swipe was left or right
- function touchEnd(event) {
- //console.log('Ending swipe gesture...')
- var changeY = originalCoord.y - finalCoord.y
- if(changeY < defaults.threshold.y && changeY > (defaults.threshold.y*-1)) {
- changeX = originalCoord.x - finalCoord.x
-
- if(changeX > defaults.threshold.x) {
- defaults.swipeLeft()
- }
- if(changeX < (defaults.threshold.x*-1)) {
- defaults.swipeRight()
- }
- }
- }
-
- // Swipe was started
- function touchStart(event) {
- //console.log('Starting swipe gesture...')
- originalCoord.x = event.targetTouches[0].pageX
- originalCoord.y = event.targetTouches[0].pageY
-
- finalCoord.x = originalCoord.x
- finalCoord.y = originalCoord.y
- }
-
- // Swipe was canceled
- function touchCancel(event) {
- //console.log('Canceling swipe gesture...')
- }
-
- // Add gestures to all swipable areas
- this.addEventListener("touchstart", touchStart, false);
- this.addEventListener("touchmove", touchMove, false);
- this.addEventListener("touchend", touchEnd, false);
- this.addEventListener("touchcancel", touchCancel, false);
-
- });
- };
-})(jQuery);
@@ -0,0 +1,16 @@
+/*
+ * jSwipe - jQuery Plugin
+ * http://plugins.jquery.com/project/swipe
+ * http://www.ryanscherf.com/demos/swipe/
+ *
+ * Copyright (c) 2009 Ryan Scherf (www.ryanscherf.com)
+ * Licensed under the MIT license
+ *
+ * $Date: 2009-07-14 (Tue, 14 Jul 2009) $
+ * $version: 0.1.2
+ *
+ * This jQuery plugin will only run on devices running Mobile Safari
+ * on iPhone or iPod Touch devices running iPhone OS 2.0 or later.
+ * http://developer.apple.com/iphone/library/documentation/AppleApplications/Reference/SafariWebContent/HandlingEvents/HandlingEvents.html#//apple_ref/doc/uid/TP40006511-SW5
+ */
+(function(a){a.fn.swipe=function(b){var c={threshold:{x:30,y:10},swipeLeft:function(){alert("swiped left")},swipeRight:function(){alert("swiped right")}};var b=a.extend(c,b);if(!this)return false;return this.each(function(){function i(a){}function f(a){d.x=a.targetTouches[0].pageX;d.y=a.targetTouches[0].pageY;e.x=d.x;e.y=d.y}function h(a){var b=d.y-e.y;if(b<c.threshold.y&&b>c.threshold.y*-1){changeX=d.x-e.x;if(changeX>c.threshold.x){c.swipeLeft()}if(changeX<c.threshold.x*-1){c.swipeRight()}}}function g(a){a.preventDefault();e.x=a.targetTouches[0].pageX;e.y=a.targetTouches[0].pageY}function f(a){d.x=a.targetTouches[0].pageX;d.y=a.targetTouches[0].pageY}var b=a(this);var d={x:0,y:0};var e={x:0,y:0};this.addEventListener("touchstart",f,false);this.addEventListener("touchmove",g,false);this.addEventListener("touchend",h,false);this.addEventListener("touchcancel",i,false)})}})(jQuery)
View
@@ -1,233 +0,0 @@
-/*
- Live.js - One script closer to Designing in the Browser
- Written for Handcraft.com by Martin Kool (@mrtnkl).
-
- Version 4.
- Recent change: Made stylesheet and mimetype checks case insensitive.
-
- http://livejs.com
- http://livejs.com/license (MIT)
- @livejs
-
- Include live.js#css to monitor css changes only.
- Include live.js#js to monitor js changes only.
- Include live.js#html to monitor html changes only.
- Mix and match to monitor a preferred combination such as live.js#html,css
-
- By default, just include live.js to monitor all css, js and html changes.
-
- Live.js can also be loaded as a bookmarklet. It is best to only use it for CSS then,
- as a page reload due to a change in html or css would not re-include the bookmarklet.
- To monitor CSS and be notified that it has loaded, include it as: live.js#css,notify
-*/
-(function () {
-
- var headers = { "Etag": 1, "Last-Modified": 1, "Content-Length": 1, "Content-Type": 1 },
- resources = {},
- pendingRequests = {},
- currentLinkElements = {},
- oldLinkElements = {},
- interval = 1000,
- loaded = false,
- active = { "html": 1, "css": 1, "js": 1 };
-
- var Live = {
-
- // performs a cycle per interval
- heartbeat: function () {
- if (document.body) {
- // make sure all resources are loaded on first activation
- if (!loaded) Live.loadresources();
- Live.checkForChanges();
- }
- setTimeout(Live.heartbeat, interval);
- },
-
- // loads all local css and js resources upon first activation
- loadresources: function () {
-
- // helper method to assert if a given url is local
- function isLocal(url) {
- var loc = document.location,
- reg = new RegExp("^\\.|^\/(?!\/)|^[\\w]((?!://).)*$|" + loc.protocol + "//" + loc.host);
- return url.match(reg);
- }
-
- // gather all resources
- var scripts = document.getElementsByTagName("script"),
- links = document.getElementsByTagName("link"),
- uris = [];
-
- // track local js urls
- for (var i = 0; i < scripts.length; i++) {
- var script = scripts[i], src = script.getAttribute("src");
- if (src && isLocal(src))
- uris.push(src);
- if (src && src.match(/\blive.js#/)) {
- for (var type in active)
- active[type] = src.match("[#,|]" + type) != null
- if (src.match("notify"))
- alert("Live.js is loaded.");
- }
- }
- if (!active.js) uris = [];
- if (active.html) uris.push(document.location.href);
-
- // track local css urls
- for (var i = 0; i < links.length && active.css; i++) {
- var link = links[i], rel = link.getAttribute("rel"), href = link.getAttribute("href", 2);
- if (href && rel && rel.match(new RegExp("stylesheet", "i")) && isLocal(href)) {
- uris.push(href);
- currentLinkElements[href] = link;
- }
- }
-
- // initialize the resources info
- for (var i = 0; i < uris.length; i++) {
- var url = uris[i];
- Live.getHead(url, function (url, info) {
- resources[url] = info;
- });
- }
-
- // add rule for morphing between old and new css files
- var head = document.getElementsByTagName("head")[0],
- style = document.createElement("style"),
- rule = "transition: all .3s ease-out;"
- css = [".livejs-loading * { ", rule, " -webkit-", rule, "-moz-", rule, "-o-", rule, "}"].join('');
- style.setAttribute("type", "text/css");
- head.appendChild(style);
- style.styleSheet ? style.styleSheet.cssText = css : style.appendChild(document.createTextNode(css));
-
- // yep
- loaded = true;
- },
-
- // check all tracking resources for changes
- checkForChanges: function () {
- for (var url in resources) {
- if (pendingRequests[url])
- continue;
-
- Live.getHead(url, function (url, newInfo) {
- var oldInfo = resources[url],
- hasChanged = false;
- resources[url] = newInfo;
- for (var header in oldInfo) {
- // do verification based on the header type
- var oldValue = oldInfo[header],
- newValue = newInfo[header],
- contentType = newInfo["Content-Type"];
- switch (header.toLowerCase()) {
- case "etag":
- if (!newValue) break;
- // fall through to default
- default:
- hasChanged = oldValue != newValue;
- break;
- }
- // if changed, act
- if (hasChanged) {
- Live.refreshResource(url, contentType);
- break;
- }
- }
- });
- }
- },
-
- // act upon a changed url of certain content type
- refreshResource: function (url, type) {
- switch (type.toLowerCase()) {
- // css files can be reloaded dynamically by replacing the link element
- case "text/css":
- var link = currentLinkElements[url],
- html = document.body.parentNode,
- head = link.parentNode,
- next = link.nextSibling,
- newLink = document.createElement("link");
-
- html.className = html.className.replace(/\s*livejs\-loading/gi, '') + ' livejs-loading';
- newLink.setAttribute("type", "text/css");
- newLink.setAttribute("rel", "stylesheet");
- newLink.setAttribute("href", url + "?now=" + new Date() * 1);
- next ? head.insertBefore(newLink, next) : head.appendChild(newLink);
- currentLinkElements[url] = newLink;
- oldLinkElements[url] = link;
-
- // schedule removal of the old link
- Live.removeoldLinkElements();
- break;
-
- // check if an html resource is our current url, then reload
- case "text/html":
- if (url != document.location.href)
- return;
-
- // local javascript changes cause a reload as well
- case "text/javascript":
- case "application/javascript":
- case "application/x-javascript":
- document.location.reload();
- }
- },
-
- // removes the old stylesheet rules only once the new one has finished loading
- removeoldLinkElements: function () {
- var pending = 0;
- for (var url in oldLinkElements) {
- // if this sheet has any cssRules, delete the old link
- try {
- var link = currentLinkElements[url],
- oldLink = oldLinkElements[url],
- html = document.body.parentNode,
- sheet = link.sheet || link.styleSheet,
- rules = sheet.rules || sheet.cssRules;
- if (rules.length >= 0) {
- oldLink.parentNode.removeChild(oldLink);
- delete oldLinkElements[url];
- setTimeout(function () {
- html.className = html.className.replace(/\s*livejs\-loading/gi, '');
- }, 100);
- }
- } catch (e) {
- pending++;
- }
- if (pending) setTimeout(Live.removeoldLinkElements, 50);
- }
- },
-
- // performs a HEAD request and passes the header info to the given callback
- getHead: function (url, callback) {
- pendingRequests[url] = true;
- var xhr = window.XMLHttpRequest ? new XMLHttpRequest() : new ActiveXObject("Microsoft.XmlHttp");
- xhr.open("HEAD", url, true);
- xhr.onreadystatechange = function () {
- delete pendingRequests[url];
- if (xhr.readyState == 4 && xhr.status != 304) {
- xhr.getAllResponseHeaders();
- var info = {};
- for (var h in headers) {
- var value = xhr.getResponseHeader(h);
- // adjust the simple Etag variant to match on its significant part
- if (h.toLowerCase() == "etag" && value) value = value.replace(/^W\//, '');
- if (h.toLowerCase() == "content-type" && value) value = value.replace(/^(.*?);.*?$/i, "$1");
- info[h] = value;
- }
- callback(url, info);
- }
- }
- xhr.send();
- }
- };
-
- // start listening
- if (document.location.protocol != "file:") {
- if (!window.liveJsLoaded)
- Live.heartbeat();
-
- window.liveJsLoaded = true;
- }
- else if (window.console)
- console.log("Live.js doesn't support the file protocol. It needs http.");
-})();
View

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
View
@@ -57,9 +57,9 @@ <h1 class="hide">An example slideshow</h1>
</noscript>
<script src="lib/jquery-1.5.2.min.js"></script>
- <script src="lib/jquery.jswipe-0.1.2.js"></script>
+ <script src="lib/jquery.jswipe-0.1.2.min.js"></script>
<script src="lib/html-slides.js"></script>
- <% if @live %><script src="lib/live.js"></script><% end %>
+ <% if @live %><script src="lib/live.min.js"></script><% end %>
<script>
// Block access from older browsers (you probably want to remove this; keep in mind that there're still some issues)

0 comments on commit b14219f

Please sign in to comment.