Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

create minified cwf.bundle.js; start stubbing out work to create mini…

…fied jquery bundle(s) in the Makefile
  • Loading branch information...
commit e6549481d9421b20c3a1aad0cb2aa5882ee394ec 1 parent 0582ee5
straup authored
View
8 Makefile
@@ -17,14 +17,18 @@ js:
# these needs to be cleaned up per the google compiler's whinging...
# java -jar lib/google-compiler/compiler-20100616.jar --js www/javascript/htmapl.js > www/javascript/htmapl.min.js
# java -jar lib/google-compiler/compiler-20100616.jar --js www/javascript/modestmaps.markers.js > www/javascript/modestmaps.markers.min.js
- java -Xmx64m -jar lib/google-compiler/compiler-20100616.jar --js www/javascript/punchcard.js > www/javascript/punchcard.min.js
+
java -Xmx64m -jar lib/google-compiler/compiler-20100616.jar --js www/javascript/cwf.js > www/javascript/cwf.min.js
java -Xmx64m -jar lib/google-compiler/compiler-20100616.jar --js www/javascript/ffbp.js > www/javascript/ffbp.min.js
- java -Xmx64m -jar lib/google-compiler/compiler-20100616.jar --js www/javascript/jquery.lightbox.ffbp.js > www/javascript/jquery.lightbox.ffbp.min.js
java -Xmx64m -jar lib/google-compiler/compiler-20100616.jar --js www/javascript/photo.geo.js > www/javascript/photo.geo.min.js
java -Xmx64m -jar lib/google-compiler/compiler-20100616.jar --js www/javascript/flickr.auth.js > www/javascript/flickr.auth.min.js
java -Xmx64m -jar lib/google-compiler/compiler-20100616.jar --js www/javascript/photo.favorites.js > www/javascript/photo.favorites.min.js
java -Xmx64m -jar lib/google-compiler/compiler-20100616.jar --js www/javascript/sharkify.js > www/javascript/sharkify.min.js
+ java -Xmx64m -jar lib/google-compiler/compiler-20100616.jar --js www/javascript/jquery.lightbox.ffbp.js > www/javascript/jquery.lightbox.ffbp.min.js
+
+ # java -Xmx64m -jar lib/google-compiler/compiler-20100616.jar --js www/javascript/backstretch.js --js www/jquery-ui-1.8.16.custom.js --js jquery.imageloader.js --js www/javascript/simplemodal.js --js www/javascript/screenfull.js --js www/javascript/jquery.touchwipe.1.1.1.js --js www/javascript/jquery.ios-shake.js > www/javascript/cwf.jquery.bundle.min.js
+
+ java -Xmx64m -jar lib/google-compiler/compiler-20100616.jar --js www/javascript/cwf.js --js www/javascript/photo.favorites.js --js www/javascript/flickr.auth.js > www/javascript/cwf.bundle.min.js
templates:
php -q ./bin/compile-templates.php
View
18 www/javascript/cwf.bundle.min.js
@@ -0,0 +1,18 @@
+var photos=[],thumbs=[],images=[],count_photos=0,count_updates=0,can_fave=0,idx=0;
+function cwf_init(a){photos=a;count_photos=photos.length;cwf_init_layout();cwf_init_shortcuts();a=location.hash;var b=null;if(a)a=parseInt(a.substring(1,a.length));for(var c=0;c<count_photos;c++){thumbs.push(photos[c][6]);images.push(photos[c][7]);if(a&&!b&&photos[c][0]==a)b=c}if(b)idx=b;$.backstretch(thumbs[idx]);$({}).imageLoader({images:thumbs,async:true});$({}).imageLoader({images:[images.shift()],async:false,complete:function(){cwf_show_photo(idx)}});a=parseInt(new Date/1E3);cwf_schedule_check_photos(a)}
+function cwf_init_subscription(){var a=function(b){b=JSON.parse(b);b=b.photos;var c=b.length;if(c){for(var d=[],e=0;e<c;e++){var f=b[e];d.push([f.photo_id,f.title,f.owner,f.ownername,f.faved_by_nsid,f.faved_by,f.thumb_url,f.display_url])}cwf_init(d)}else{b=new Date;b=String(b);b="Last checked at "+b+", still nothing yet.";$("#last_check").html(b);cwf_init_subscription(6E4)}};setTimeout(function(){$.ajax({url:"/api",data:{method:"flickr.photos.friends.faves"},success:a})},6E4)}
+function cwf_init_layout(){$("#content").hide();$("#main").css("background-color","transparent");$("#footer").css("opacity",".75");$("#main").append('<div id="cwf_about"></div>')}
+function cwf_init_shortcuts(){var a=false,b=null,c=function(g){g||(g=2E4);b=setTimeout(function(){cwf_show_next_photo("overflow");c()},g)},d=function(){if(a=a?0:1){cwf_toggle_pixel_mode(1);c(1E3)}else{clearTimeout(b);cwf_toggle_pixel_mode()}},e=function(){cwf_show_previous_photo("overflow")},f=function(){cwf_show_next_photo("overflow")},h=function(){cwf_show_photo(0)},i=function(){cwf_show_photo(photos.length-1)};$(document).keydown(function(g){if(g.keyCode==37)e();else if(g.keyCode==38)h();else if(g.keyCode==
+39)f();else if(g.keyCode==40)i();else if(g.keyCode==65)d();else g.keyCode==80&&cwf_toggle_pixel_mode(g.shiftKey)});$(document).touchwipe({wipeLeft:f,wipeRight:e,wipeUp:h,wipeDown:i,min_move_x:20,min_move_y:20,preventDefaultEvents:true});$.shake({callback:d})}function cwf_schedule_check_photos(a){setTimeout(function(){$.ajax({url:"/api",data:{method:"flickr.photos.friends.faves",older_than:a},success:cwf_check_photos_callback,error:function(b){console.log(b);cwf_schedule_check_photos(a)}})},6E4)}
+function cwf_check_photos_callback(a){try{_cwf_check_photos_callback(a)}catch(b){console.log(b);console.log(a)}last_check=parseInt(new Date/1E3);cwf_schedule_check_photos(last_check)}
+function _cwf_check_photos_callback(a){a=JSON.parse(a);a=a.photos;var b=a.length;if(b){a.reverse();for(var c=[],d=0;d<b;d++){var e=a[d];c.push(e.display_url);c.push(e.thumb_url);photos.unshift([e.photo_id,e.title,e.owner,e.ownername,e.faved_by_nsid,e.faved_by,e.thumb_url,e.display_url])}$({}).imageLoader({images:c,async:true});idx+=b;count_updates+=b;a='<a href="#" onclick="cwf_show_photo(0);return false;">';a+=count_updates>1?"there are "+count_updates+" new faves":"there are new faves";a+="</a>";
+$("#cwf_updates").html(a);$("#cwf_photo_idx").html(idx+1);$("#cwf_count_photos").html(photos.length)}}function cwf_next_photo(a){if(a)return idx<photos.length-1?idx+1:0;return idx<photos.length-1?idx+1:-1}function cwf_previous_photo(a){if(a)return idx>0?idx-1:count_photos-1;return idx>0?idx-1:-1}function cwf_show_previous_photo(a){a=cwf_previous_photo(a);cwf_show_photo(a)}function cwf_show_next_photo(a){a=cwf_next_photo(a);cwf_show_photo(a)}
+function cwf_show_photo(a){count_updates=0;idx=a;for(var b=[],c=0;c<2;c++){if(!images.length)break;b.push(images.shift());b.push(images.unshift())}b.length&&$({}).imageLoader({images:b,async:true});var d=photos[a];b=d[0];c=d[1];var e=d[2],f=d[3],h=d[4],i=d[5],g=d[6],j=d[7];d=d[8];a=a+1;c=c+", by "+f;msg='<a href="http://www.flickr.com/photos/'+e+"/"+b+'/" target="_flickr" title="'+c+'">';msg+='<img src="'+j+'" /></a><br >';msg+='<div id="cwf_about_text">';msg+='<a href="http://www.flickr.com/photos/'+
+h+'/faves/" target="_flickr">'+i+"</a>";msg+=" <span>"+symbols_faved+"</span> ";msg+='<a href="http://www.flickr.com/photos/'+e+'/" target="_flickr">'+f+"</a><br />";msg+='no. <span id="cwf_photo_idx">'+a+'</span> of <span id="cwf_count_photos">'+photos.length+"</span> faves";if(a>1)msg+=' / <a href="#" onclick="cwf_show_next_photo();return false;" title="before, keyboard shortcut: \u21e6">before</a>';if(a<count_photos)msg+=' / <a href="#" onclick="cwf_show_previous_photo();return false;" title="after, keyboard short: \u21e8">after</a>';
+msg+=" / "+photo_favorites_generate_html(b,d);msg+='<div id="cwf_updates"></div>';msg+="</div>";$("#cwf_about").html("");$.backstretch(g);$("#cwf_about").html(msg)}function cwf_toggle_pixel_mode(a){var b=$("#cwf_about"),c=$("#footer");if(b.css("display")=="none"){b.show();c.show();screenfull&&screenfull.exit()}else{b.hide();c.hide();a&&screenfull&&screenfull.request()}};var symbols_faved="\u2605",symbols_notfaved="\u2606";function photo_favorites_add(a){if(can_fave){$.ajax({url:"/api",type:"POST",data:{method:"flickr.favorites.add",photo_id:a},success:function(d){photo_favorites_toggle_html(d.photo_id,1)}});photo_favorites_toggle_html_api(a)}else{var b=location.host,c=location.href.split("#")[0];c=c.replace("http://","");c=c.replace(b,"");c+="#"+a;flickr_auth_dialog_request_write_perms("fave",c)}}
+function photo_favorites_remove(a){$.ajax({url:"/api",type:"POST",data:{method:"flickr.favorites.remove",photo_id:a},success:function(b){photo_favorites_toggle_html(b.photo_id,0)}});photo_favorites_toggle_html_api(a)}
+function photo_favorites_generate_html(a,b){var c=photo_favorites_uid(a),d=photo_favorites_symbol(a,b),e=photo_favorites_onclick(a,b),f=photo_favorites_title(a,b),h=photo_favorites_classname(a,b);c='<a href="#" id="'+c+'" onclick="'+e+'" title="'+f+'" class="'+h+'">';c+=d;c+="</a>";return c}function photo_favorites_toggle_html_api(a){a=photo_favorites_selector(a);a=$(a);a.html("...");a.attr("onclick","return false;");a.attr("title","talking to the sky");a.attr("class","")}
+function photo_favorites_toggle_html(a,b){var c=photo_favorites_selector(a),d=photo_favorites_symbol(a,b),e=photo_favorites_onclick(a,b),f=photo_favorites_title(a,b),h=photo_favorites_classname(a,b);c=$(c);c.html(d);c.attr("onclick",e);c.attr("title",f);c.attr("class",h)}function photo_favorites_symbol(a,b){return b?symbols_faved:symbols_notfaved}function photo_favorites_onclick(a,b){return(b?"photo_favorites_remove":"photo_favorites_add")+"("+a+"); return false;"}
+function photo_favorites_title(a,b){return b?"remove as favourite":"add as favourite"}function photo_favorites_classname(a,b){return b?"photo_faved":"photo_notfaved"}function photo_favorites_uid(a){return"photo_favorites_"+a}function photo_favorites_selector(a){return"#"+photo_favorites_uid(a)};function flickr_auth_dialog_request_write_perms(a,b){var c=abs_root_url+"account/flickr/auth?perms=write";if(b)c+="&redir="+encodeURIComponent(b);var d='<div id="modal_flickr_auth">';d+="<h3>Hey look, a modal dialog!</h3>";d+="<p>When you first signed up and authorized this application with Flickr you allowed it access your account with a <q>read</q> only token. ";d+='<span style="font-style:italic;">';if(a=="fave"){d+="In order to fave another users photos we need to bounce you back through Flickr ";
+d+="again so that you can authorize us to access your account with a <q>write</q> token. "}else if(a=="geo"){d+="In order to be able to edit your photos we need to bounce you back through Flickr ";d+="again so that you can authorize us to access your account with a <q>write</q> token. "}d+="</span>";d+="You'll only have to do this once (or until you revoke the token itself <a href=\"http://www.flickr.com/services/auth/list.gne\">on Flickr</a>). Once you've approved the new token you will be sent back to this webpage.</p>";
+d+='<div class="buttons"><button onclick="location.href=\''+c+"'; return false;\">Get started</button>&#160;&#160;";d+='<button onclick="$.modal.close(); return false;">Nevermind, maybe another time.</button></div>';d+="</div>";$.modal(d)};
View
29 www/javascript/cwf.js
@@ -152,6 +152,21 @@ function cwf_init_shortcuts(){
}, delay);
};
+ var toggle_automatic = function(){
+
+ auto = (auto) ? 0 : 1;
+
+ if (auto){
+ cwf_toggle_pixel_mode(1);
+ automatic(1000);
+ }
+
+ else {
+ clearTimeout(auto_timeout);
+ cwf_toggle_pixel_mode();
+ }
+ };
+
var left = function(){
cwf_show_previous_photo("overflow");
};
@@ -191,15 +206,7 @@ function cwf_init_shortcuts(){
/* to do: automode on shake */
else if (e.keyCode == 65){
- auto = (auto) ? 0 : 1;
-
- if (auto){
- automatic(1000);
- }
-
- else {
- clearTimeout(auto_timeout);
- }
+ toggle_automatic();
}
else if (e.keyCode == 80){
@@ -222,6 +229,10 @@ function cwf_init_shortcuts(){
min_move_y: 20,
preventDefaultEvents: true
});
+
+ $.shake({
+ callback: toggle_automatic
+ });
}
function cwf_schedule_check_photos(older_than){
View
10 www/javascript/cwf.min.js
@@ -2,11 +2,11 @@ var photos=[],thumbs=[],images=[],count_photos=0,count_updates=0,can_fave=0,idx=
function cwf_init(a){photos=a;count_photos=photos.length;cwf_init_layout();cwf_init_shortcuts();a=location.hash;var b=null;if(a)a=parseInt(a.substring(1,a.length));for(var c=0;c<count_photos;c++){thumbs.push(photos[c][6]);images.push(photos[c][7]);if(a&&!b&&photos[c][0]==a)b=c}if(b)idx=b;$.backstretch(thumbs[idx]);$({}).imageLoader({images:thumbs,async:true});$({}).imageLoader({images:[images.shift()],async:false,complete:function(){cwf_show_photo(idx)}});a=parseInt(new Date/1E3);cwf_schedule_check_photos(a)}
function cwf_init_subscription(){var a=function(b){b=JSON.parse(b);b=b.photos;var c=b.length;if(c){for(var d=[],e=0;e<c;e++){var f=b[e];d.push([f.photo_id,f.title,f.owner,f.ownername,f.faved_by_nsid,f.faved_by,f.thumb_url,f.display_url])}cwf_init(d)}else{b=new Date;b=String(b);b="Last checked at "+b+", still nothing yet.";$("#last_check").html(b);cwf_init_subscription(6E4)}};setTimeout(function(){$.ajax({url:"/api",data:{method:"flickr.photos.friends.faves"},success:a})},6E4)}
function cwf_init_layout(){$("#content").hide();$("#main").css("background-color","transparent");$("#footer").css("opacity",".75");$("#main").append('<div id="cwf_about"></div>')}
-function cwf_init_shortcuts(){var a=false,b=null,c=function(g){g||(g=2E4);b=setTimeout(function(){cwf_show_next_photo("overflow");c()},g)},d=function(){cwf_show_previous_photo("overflow")},e=function(){cwf_show_next_photo("overflow")},f=function(){cwf_show_photo(0)},h=function(){cwf_show_photo(photos.length-1)};$(document).keydown(function(g){if(g.keyCode==37)d();else if(g.keyCode==38)f();else if(g.keyCode==39)e();else if(g.keyCode==40)h();else if(g.keyCode==65)(a=a?0:1)?c(1E3):clearTimeout(b);else g.keyCode==
-80&&cwf_toggle_pixel_mode(g.shiftKey)});$(document).touchwipe({wipeLeft:e,wipeRight:d,wipeUp:f,wipeDown:h,min_move_x:20,min_move_y:20,preventDefaultEvents:true})}function cwf_schedule_check_photos(a){setTimeout(function(){$.ajax({url:"/api",data:{method:"flickr.photos.friends.faves",older_than:a},success:cwf_check_photos_callback,error:function(b){console.log(b);cwf_schedule_check_photos(a)}})},6E4)}
+function cwf_init_shortcuts(){var a=false,b=null,c=function(g){g||(g=2E4);b=setTimeout(function(){cwf_show_next_photo("overflow");c()},g)},d=function(){if(a=a?0:1){cwf_toggle_pixel_mode(1);c(1E3)}else{clearTimeout(b);cwf_toggle_pixel_mode()}},e=function(){cwf_show_previous_photo("overflow")},f=function(){cwf_show_next_photo("overflow")},h=function(){cwf_show_photo(0)},i=function(){cwf_show_photo(photos.length-1)};$(document).keydown(function(g){if(g.keyCode==37)e();else if(g.keyCode==38)h();else if(g.keyCode==
+39)f();else if(g.keyCode==40)i();else if(g.keyCode==65)d();else g.keyCode==80&&cwf_toggle_pixel_mode(g.shiftKey)});$(document).touchwipe({wipeLeft:f,wipeRight:e,wipeUp:h,wipeDown:i,min_move_x:20,min_move_y:20,preventDefaultEvents:true});$.shake({callback:d})}function cwf_schedule_check_photos(a){setTimeout(function(){$.ajax({url:"/api",data:{method:"flickr.photos.friends.faves",older_than:a},success:cwf_check_photos_callback,error:function(b){console.log(b);cwf_schedule_check_photos(a)}})},6E4)}
function cwf_check_photos_callback(a){try{_cwf_check_photos_callback(a)}catch(b){console.log(b);console.log(a)}last_check=parseInt(new Date/1E3);cwf_schedule_check_photos(last_check)}
function _cwf_check_photos_callback(a){a=JSON.parse(a);a=a.photos;var b=a.length;if(b){a.reverse();for(var c=[],d=0;d<b;d++){var e=a[d];c.push(e.display_url);c.push(e.thumb_url);photos.unshift([e.photo_id,e.title,e.owner,e.ownername,e.faved_by_nsid,e.faved_by,e.thumb_url,e.display_url])}$({}).imageLoader({images:c,async:true});idx+=b;count_updates+=b;a='<a href="#" onclick="cwf_show_photo(0);return false;">';a+=count_updates>1?"there are "+count_updates+" new faves":"there are new faves";a+="</a>";
$("#cwf_updates").html(a);$("#cwf_photo_idx").html(idx+1);$("#cwf_count_photos").html(photos.length)}}function cwf_next_photo(a){if(a)return idx<photos.length-1?idx+1:0;return idx<photos.length-1?idx+1:-1}function cwf_previous_photo(a){if(a)return idx>0?idx-1:count_photos-1;return idx>0?idx-1:-1}function cwf_show_previous_photo(a){a=cwf_previous_photo(a);cwf_show_photo(a)}function cwf_show_next_photo(a){a=cwf_next_photo(a);cwf_show_photo(a)}
-function cwf_show_photo(a){count_updates=0;idx=a;for(var b=[],c=0;c<2;c++){if(!images.length)break;b.push(images.shift());b.push(images.unshift())}b.length&&$({}).imageLoader({images:b,async:true});var d=photos[a];b=d[0];c=d[1];var e=d[2],f=d[3],h=d[4],g=d[5],i=d[6],j=d[7];d=d[8];a=a+1;c=c+", by "+f;msg='<a href="http://www.flickr.com/photos/'+e+"/"+b+'/" target="_flickr" title="'+c+'">';msg+='<img src="'+j+'" /></a><br >';msg+='<div id="cwf_about_text">';msg+='<a href="http://www.flickr.com/photos/'+
-h+'/faves/" target="_flickr">'+g+"</a>";msg+=" <span>"+symbols_faved+"</span> ";msg+='<a href="http://www.flickr.com/photos/'+e+'/" target="_flickr">'+f+"</a><br />";msg+='no. <span id="cwf_photo_idx">'+a+'</span> of <span id="cwf_count_photos">'+photos.length+"</span> faves";if(a>1)msg+=' / <a href="#" onclick="cwf_show_next_photo();return false;" title="before, keyboard shortcut: \u21e6">before</a>';if(a<count_photos)msg+=' / <a href="#" onclick="cwf_show_previous_photo();return false;" title="after, keyboard short: \u21e8">after</a>';
-msg+=" / "+photo_favorites_generate_html(b,d);msg+='<div id="cwf_updates"></div>';msg+="</div>";$("#cwf_about").html("");$.backstretch(i);$("#cwf_about").html(msg)}function cwf_toggle_pixel_mode(a){var b=$("#cwf_about"),c=$("#footer");if(b.css("display")=="none"){b.show();c.show();screenfull&&screenfull.exit()}else{b.hide();c.hide();a&&screenfull&&screenfull.request()}};
+function cwf_show_photo(a){count_updates=0;idx=a;for(var b=[],c=0;c<2;c++){if(!images.length)break;b.push(images.shift());b.push(images.unshift())}b.length&&$({}).imageLoader({images:b,async:true});var d=photos[a];b=d[0];c=d[1];var e=d[2],f=d[3],h=d[4],i=d[5],g=d[6],j=d[7];d=d[8];a=a+1;c=c+", by "+f;msg='<a href="http://www.flickr.com/photos/'+e+"/"+b+'/" target="_flickr" title="'+c+'">';msg+='<img src="'+j+'" /></a><br >';msg+='<div id="cwf_about_text">';msg+='<a href="http://www.flickr.com/photos/'+
+h+'/faves/" target="_flickr">'+i+"</a>";msg+=" <span>"+symbols_faved+"</span> ";msg+='<a href="http://www.flickr.com/photos/'+e+'/" target="_flickr">'+f+"</a><br />";msg+='no. <span id="cwf_photo_idx">'+a+'</span> of <span id="cwf_count_photos">'+photos.length+"</span> faves";if(a>1)msg+=' / <a href="#" onclick="cwf_show_next_photo();return false;" title="before, keyboard shortcut: \u21e6">before</a>';if(a<count_photos)msg+=' / <a href="#" onclick="cwf_show_previous_photo();return false;" title="after, keyboard short: \u21e8">after</a>';
+msg+=" / "+photo_favorites_generate_html(b,d);msg+='<div id="cwf_updates"></div>';msg+="</div>";$("#cwf_about").html("");$.backstretch(g);$("#cwf_about").html(msg)}function cwf_toggle_pixel_mode(a){var b=$("#cwf_about"),c=$("#footer");if(b.css("display")=="none"){b.show();c.show();screenfull&&screenfull.exit()}else{b.hide();c.hide();a&&screenfull&&screenfull.request()}};
View
4 www/javascript/jquery-swooshy-swoosh.min.js
@@ -0,0 +1,4 @@
+(function(c){c.fn.touchwipe=function(d){var a={min_move_x:20,min_move_y:20,wipeLeft:function(){},wipeRight:function(){},wipeUp:function(){},wipeDown:function(){},preventDefaultEvents:true};d&&c.extend(a,d);this.each(function(){function e(){this.removeEventListener("touchmove",f);g=null;h=false}function f(b){a.preventDefaultEvents&&b.preventDefault();if(h){var i=g-b.touches[0].pageX;b=j-b.touches[0].pageY;if(Math.abs(i)>=a.min_move_x){e();i>0?a.wipeLeft():a.wipeRight()}else if(Math.abs(b)>=a.min_move_y){e();
+b>0?a.wipeDown():a.wipeUp()}}}function k(b){if(b.touches.length==1){g=b.touches[0].pageX;j=b.touches[0].pageY;h=true;this.addEventListener("touchmove",f,false)}}var g,j,h=false;"ontouchstart"in document.documentElement&&this.addEventListener("touchstart",k,false)});return this}})(jQuery);(function(c){jQuery.shake=function(d){var a=jQuery.extend({},jQuery.shake.defaults,d);if(a.debug!==""){d=c(a.debug);d.append('x: <span id="x">0</span><br>');d.append('y: <span id="y">0</span><br>');d.append('z: <span id="z">0</span><br><br>');d.append('shake: <span id="shake">0</span><br>');d.append('shakeaccum: <span id="shakeaccum"></span><br>');d.append('debug: <span id="console"></span><br>')}var e=0,f=0,k=0,g=0,j=0,h=0,b=0,i=0,n=new Date,o=new Date,m=false;if(window.DeviceMotionEvent===undefined)a.supported!==
+""&&c(a.supported).html("Your browser does not support Device Orientation and Motion API. Try it on an iPhone, iPod or iPad with iOS 4.2+.");else window.ondevicemotion=function(l){l=l.accelerationIncludingGravity;e=l.x;k=f=l.y;g=e-(e*a.hf+g*(1-a.hf));j=f-(f*a.hf+j*(1-a.hf));h=k-(k*a.hf+h*(1-a.hf));if(Math.abs(e-2*g)>a.violence*1.5||Math.abs(f-2*j)>a.violence*2||Math.abs(k-2*h)>a.violence*3&&m===false)i+=1;n=new Date;l=n.getTime()-o.getTime();c("#console").html(l);if(m){m=l>=a.debounce?false:true;
+i=0}if(i>=a.shakethreshold&&m===false){b+=1;c("#shake").html(b);o=n;m=true;a.callback.call()}};a.debug!==""&&setInterval(function(){c("#x").html(Math.abs(e-2*g).toFixed(1));c("#y").html(Math.abs(f-2*j).toFixed(1));c("#z").html(Math.abs(k-2*h).toFixed(1));c("#shakeaccum").html(i)},10)}})(jQuery);jQuery.shake.defaults={debug:"",supported:"",violence:3,hf:0.2,shakethreshold:5,debounce:1E3,callback:function(){}};
View
157 www/javascript/jquery.ios-shake.js
@@ -0,0 +1,157 @@
+/*
+jquery.ios-shake: A jQuery plugin that detects a 'shake' event using
+Safari's accelerometer support in iOS 4.2+.
+
+Revision History:
+0.1.0 - 2011-01-24 - initial release
+
+Copyright 2011 Luke D Hagan, http://lukehagan.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.
+
+*/
+
+(function($) {
+ jQuery.shake = function(options) {
+ // Merge passed options with defaults
+ var opts = jQuery.extend({},
+ jQuery.shake.defaults, options);
+
+ // insert debug content
+ if (opts.debug !== "") {
+ var debug = $(opts.debug);
+ debug.append('x: <span id="x">0</span><br>');
+ debug.append('y: <span id="y">0</span><br>');
+ debug.append('z: <span id="z">0</span><br><br>');
+
+ debug.append('shake: <span id="shake">0</span><br>');
+ debug.append('shakeaccum: <span id="shakeaccum"></span><br>');
+ debug.append('debug: <span id="console"></span><br>');
+ }
+
+ // initialize acceleration variables
+ var ax = 0;
+ var ay = 0;
+ var az = 0;
+ var axa = 0;
+ var aya = 0;
+ var aza = 0;
+
+ // initialize misc internal variables
+ var shakecount = 0;
+ var shakeaccum = 0;
+ var curtime = new Date();
+ var prevtime = new Date();
+ var timeout = false;
+
+ // http://www.mobilexweb.com/samples/ball.html
+ // detect whether acceleration is supported
+ if (window.DeviceMotionEvent === undefined) {
+ if (opts.supported !== "") {
+ $(opts.supported).html("Your browser does not support Device Orientation and Motion API. Try it on an iPhone, iPod or iPad with iOS 4.2+.");
+ }
+ } else {
+ window.ondevicemotion = function(event) {
+ // get acceleration values
+ var acc = event.accelerationIncludingGravity;
+ ax = acc.x;
+ ay = acc.y;
+ az = acc.y;
+
+ // high pass-filter to remove gravity
+ // TODO detect and use gyro (no gravity) on supported devices
+ // http://iphonedevelopertips.com/user-interface/accelerometer-101.html
+ axa = ax - ((ax * opts.hf) + (axa * (1.0 - opts.hf)));
+ aya = ay - ((ay * opts.hf) + (aya * (1.0 - opts.hf)));
+ aza = az - ((az * opts.hf) + (aza * (1.0 - opts.hf)));
+
+ // detect single shake
+ // http://discussions.apple.com/thread.jspa?messageID=8224655
+ var beenhere = false;
+ var shake = false;
+ if (beenhere) {
+ return;
+ }
+ beenhere = true;
+ if (Math.abs(ax - 2 * axa) > opts.violence * 1.5 || Math.abs(ay - 2 * aya) > opts.violence * 2 || Math.abs(az - 2 * aza) > opts.violence * 3 && timeout === false) {
+ shakeaccum += 1;
+ }
+
+ // detect shake event (several shakes)
+ curtime = new Date();
+ var timedelta = curtime.getTime() - prevtime.getTime();
+ $('#console').html(timedelta);
+
+ if (timeout) {
+ if (timedelta >= opts.debounce) {
+ timeout = false;
+ } else {
+ timeout = true;
+ }
+ shakeaccum = 0;
+ }
+
+ if (shakeaccum >= opts.shakethreshold && timeout === false) {
+ shakecount += 1;
+ $("#shake").html(shakecount);
+ prevtime = curtime;
+ timeout = true;
+ opts.callback.call();
+ }
+ beenhere = true;
+ };
+ }
+ if (opts.debug !== "") {
+ setInterval(function() {
+ // output debug data
+ $('#x').html(Math.abs(ax - 2 * axa).toFixed(1));
+ $('#y').html(Math.abs(ay - 2 * aya).toFixed(1));
+ $('#z').html(Math.abs(az - 2 * aza).toFixed(1));
+ $('#shakeaccum').html(shakeaccum);
+ },
+ 10);
+ }
+ };
+})(jQuery);
+
+// plugin default options
+jQuery.shake.defaults = {
+ // debug div id
+ debug: "",
+
+ // not supported message div
+ supported: "",
+
+ // single shake sensitivity
+ violence: 3.0,
+
+ // high-pass filter constant
+ hf: 0.2,
+
+ // number of single shakes required to fire a shake event
+ shakethreshold: 5,
+
+ // delay between shake events (in ms)
+ debounce: 1000,
+
+ // anonymous callback function
+ callback: function() {}
+};
+
View
3  www/javascript/jquery.ios-shake.min.js
@@ -0,0 +1,3 @@
+(function(b){jQuery.shake=function(c){var a=jQuery.extend({},jQuery.shake.defaults,c);if(a.debug!==""){c=b(a.debug);c.append('x: <span id="x">0</span><br>');c.append('y: <span id="y">0</span><br>');c.append('z: <span id="z">0</span><br><br>');c.append('shake: <span id="shake">0</span><br>');c.append('shakeaccum: <span id="shakeaccum"></span><br>');c.append('debug: <span id="console"></span><br>')}var e=0,f=0,g=0,i=0,j=0,k=0,n=0,l=0,m=new Date,o=new Date,h=false;if(window.DeviceMotionEvent===undefined)a.supported!==
+""&&b(a.supported).html("Your browser does not support Device Orientation and Motion API. Try it on an iPhone, iPod or iPad with iOS 4.2+.");else window.ondevicemotion=function(d){d=d.accelerationIncludingGravity;e=d.x;g=f=d.y;i=e-(e*a.hf+i*(1-a.hf));j=f-(f*a.hf+j*(1-a.hf));k=g-(g*a.hf+k*(1-a.hf));if(Math.abs(e-2*i)>a.violence*1.5||Math.abs(f-2*j)>a.violence*2||Math.abs(g-2*k)>a.violence*3&&h===false)l+=1;m=new Date;d=m.getTime()-o.getTime();b("#console").html(d);if(h){h=d>=a.debounce?false:true;
+l=0}if(l>=a.shakethreshold&&h===false){n+=1;b("#shake").html(n);o=m;h=true;a.callback.call()}};a.debug!==""&&setInterval(function(){b("#x").html(Math.abs(e-2*i).toFixed(1));b("#y").html(Math.abs(f-2*j).toFixed(1));b("#z").html(Math.abs(g-2*k).toFixed(1));b("#shakeaccum").html(l)},10)}})(jQuery);jQuery.shake.defaults={debug:"",supported:"",violence:3,hf:0.2,shakethreshold:5,debounce:1E3,callback:function(){}};
View
82 www/javascript/jquery.touchwipe.1.1.1.js
@@ -0,0 +1,82 @@
+/**
+ * jQuery Plugin to obtain touch gestures from iPhone, iPod Touch and iPad, should also work with Android mobile phones (not tested yet!)
+ * Common usage: wipe images (left and right to show the previous or next image)
+ *
+ * @author Andreas Waltl, netCU Internetagentur (http://www.netcu.de)
+ * @version 1.1.1 (9th December 2010) - fix bug (older IE's had problems)
+ * @version 1.1 (1st September 2010) - support wipe up and wipe down
+ * @version 1.0 (15th July 2010)
+ */
+(function($) {
+ $.fn.touchwipe = function(settings) {
+ var config = {
+ min_move_x: 20,
+ min_move_y: 20,
+ wipeLeft: function() { },
+ wipeRight: function() { },
+ wipeUp: function() { },
+ wipeDown: function() { },
+ preventDefaultEvents: true
+ };
+
+ if (settings) $.extend(config, settings);
+
+ this.each(function() {
+ var startX;
+ var startY;
+ var isMoving = false;
+
+ function cancelTouch() {
+ this.removeEventListener('touchmove', onTouchMove);
+ startX = null;
+ isMoving = false;
+ }
+
+ function onTouchMove(e) {
+ if(config.preventDefaultEvents) {
+ e.preventDefault();
+ }
+ if(isMoving) {
+ var x = e.touches[0].pageX;
+ var y = e.touches[0].pageY;
+ var dx = startX - x;
+ var dy = startY - y;
+ if(Math.abs(dx) >= config.min_move_x) {
+ cancelTouch();
+ if(dx > 0) {
+ config.wipeLeft();
+ }
+ else {
+ config.wipeRight();
+ }
+ }
+ else if(Math.abs(dy) >= config.min_move_y) {
+ cancelTouch();
+ if(dy > 0) {
+ config.wipeDown();
+ }
+ else {
+ config.wipeUp();
+ }
+ }
+ }
+ }
+
+ function onTouchStart(e)
+ {
+ if (e.touches.length == 1) {
+ startX = e.touches[0].pageX;
+ startY = e.touches[0].pageY;
+ isMoving = true;
+ this.addEventListener('touchmove', onTouchMove, false);
+ }
+ }
+ if ('ontouchstart' in document.documentElement) {
+ this.addEventListener('touchstart', onTouchStart, false);
+ }
+ });
+
+ return this;
+ };
+
+ })(jQuery);
View
11 www/templates/page_flickr_photos_friends_faves.txt
@@ -2,15 +2,18 @@
{capture assign="extra_head"}
<link rel="stylesheet" type="text/css" href="{$cfg.abs_root_url}css/jquery.simplemodal.css" />
<script type="text/javascript" src="{$cfg.abs_root_url}javascript/jquery.backstretch.min.js"></script>
- <script type="text/javascript" src="{$cfg.abs_root_url}javascript/jquery.touchwipe.min.js"></script>
+
<script type="text/javascript" src="{$cfg.abs_root_url}javascript/jquery-ui-1.8.16.custom.min.js"></script>
<script type="text/javascript" src="{$cfg.abs_root_url}javascript/jquery.imageloader.min.js"></script>
<script type="text/javascript" src="{$cfg.abs_root_url}javascript/jquery.simplemodal.min.js"></script>
+{if 0}
+ <script type="text/javascript" src="{$cfg.abs_root_url}javascript/jquery.ios-shake.min.js"></script>
+ <script type="text/javascript" src="{$cfg.abs_root_url}javascript/jquery.touchwipe.min.js"></script>
+{/if}
+ <script type="text/javascript" src="{$cfg.abs_root_url}javascript/jquery-swooshy-swoosh.min.js"></script>
<script type="text/javascript" src="{$cfg.abs_root_url}javascript/screenfull.min.js"></script>
{if $cfg.environment=='prod'}
- <script type="text/javascript" src="{$cfg.abs_root_url}javascript/cwf.min.js"></script>
- <script type="text/javascript" src="{$cfg.abs_root_url}javascript/photo.favorites.min.js"></script>
- <script type="text/javascript" src="{$cfg.abs_root_url}javascript/flickr.auth.min.js"></script>
+ <script type="text/javascript" src="{$cfg.abs_root_url}javascript/cwf.bundle.min.js"></script>
{else}
<script type="text/javascript" src="{$cfg.abs_root_url}javascript/cwf.js"></script>
<script type="text/javascript" src="{$cfg.abs_root_url}javascript/photo.favorites.js"></script>
Please sign in to comment.
Something went wrong with that request. Please try again.