Permalink
Browse files

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

…fied jquery bundle(s) in the Makefile
  • Loading branch information...
1 parent 0582ee5 commit e6549481d9421b20c3a1aad0cb2aa5882ee394ec straup committed Jun 18, 2012
View
@@ -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
@@ -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
@@ -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){
@@ -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()}};
Oops, something went wrong.

0 comments on commit e654948

Please sign in to comment.