Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: gyaresu/oslogigs-node
base: 15711ad639
...
head fork: gyaresu/oslogigs-node
compare: adaacaa8ed
  • 2 commits
  • 5 files changed
  • 0 commit comments
  • 1 contributor
View
8 public/javascripts/all.js
@@ -1,3 +1,5 @@
-$("#venues").live("pageshow",function(){$("#listview").hasClass("loaded")||($.parse.init({app_id:"9vbpyfY5iHZqFmq4Fjh2mbUeCAs9vXLjfnIgmUm5",rest_key:"ptYuPEQ4l6mugCYtu2uRHi5X4S0taWNc4Tdd61rC"}),$.parse.get("Pub",{limit:1E3},function(b){var c="",d;$.each(b.results,function(b,f){d=99===f.beer_price?"?":f.beer_price;c+="<li>"+f.pub_name+": \u00f8l pris "+d+" kr.</li>"});$("#listview").append(c).listview("refresh");$("#listview").addClass("loaded")}))});$(".page-map").live("pageshow",function(){$.parse.init({app_id:"9vbpyfY5iHZqFmq4Fjh2mbUeCAs9vXLjfnIgmUm5",rest_key:"ptYuPEQ4l6mugCYtu2uRHi5X4S0taWNc4Tdd61rC"});$.parse.get("Pub",{limit:1E3},function(b){var c=new google.maps.LatLng(59.92,10.75),d=new google.maps.Map(document.getElementById("map-canvas"),{zoom:12,center:c,backgroundColor:"black",mapTypeControlOptions:{style:google.maps.MapTypeControlStyle.DROPDOWN_MENU},mapTypeId:google.maps.MapTypeId.HYBRID}),g=new google.maps.InfoWindow;$.each(b.results,
-function(c,a){var b,h=encodeURI(a.pub_address),i=encodeURI(a.pub_name),e=new google.maps.LatLng(a.lat,a.lng),e=new google.maps.Marker({animation:!0===a.pub_bounce?google.maps.Animation.BOUNCE:null,map:d,icon:"images/"+a.beer_price+".png",shadow:"images/shadow.png",position:e,title:a.pub_name});99===a.beer_price?e.setZIndex(1):e.setZIndex(100);google.maps.event.addListener(e,"click",function(){b=99===a.beer_price?"?":a.beer_price;tweet='<a href="https://twitter.com/share" class="twitter-share-button" data-url="http://oslogigs.com" data-text="'+
-a.pub_name+" "+a.beer_price+' kr." data-lang="en" data-via="OsloGigs" data-hashtags="oslo, oslogigs, norway">Tweet</a>';content_string="<h1>"+a.pub_name+'</h1><p><a href="http://maps.google.com/?saddr=Current%20Location&daddr='+h+"+("+i+')&dirflg=w&t=h">Google Maps Directions</a></p><p>Phone:<a href="tel:'+a.pub_phone+'">'+a.pub_phone+"</a></p><p>Halvliterpris: NOK <b>"+b+"</b></p><p>"+tweet+"</p>";g.setContent(content_string);g.open(d,this);twttr.widgets.load()})})})});
+$("#venues").live("pageshow",function(){$("#listview").hasClass("loaded")||($.parse.init({app_id:"9vbpyfY5iHZqFmq4Fjh2mbUeCAs9vXLjfnIgmUm5",rest_key:"ptYuPEQ4l6mugCYtu2uRHi5X4S0taWNc4Tdd61rC"}),$.parse.get("Pub",{limit:1E3},function(c){var i="",g;$.each(c.results,function(c,d){g=99===d.beer_price?"?":d.beer_price;i+="<li>"+d.pub_name+": \u00f8l pris "+g+" kr.</li>"});$("#listview").append(i).listview("refresh");$("#listview").addClass("loaded")}))});$(".page-map").live("pageshow",function(){$.parse.init({app_id:"9vbpyfY5iHZqFmq4Fjh2mbUeCAs9vXLjfnIgmUm5",rest_key:"ptYuPEQ4l6mugCYtu2uRHi5X4S0taWNc4Tdd61rC"});$.parse.get("Pub",{limit:1E3},function(c){var i=new google.maps.LatLng(59.92,10.75),g=new google.maps.Map(document.getElementById("map-canvas"),{zoom:12,center:i,backgroundColor:"black",mapTypeControlOptions:{style:google.maps.MapTypeControlStyle.DROPDOWN_MENU},mapTypeId:google.maps.MapTypeId.HYBRID}),h=new google.maps.InfoWindow;$.each(c.results,
+function(c,a){var l,j=encodeURI(a.pub_address),k=encodeURI(a.pub_name),b=new google.maps.LatLng(a.lat,a.lng),b=new google.maps.Marker({animation:!0===a.pub_bounce?google.maps.Animation.BOUNCE:null,map:g,icon:"images/"+a.beer_price+".png",shadow:"images/shadow.png",position:b,title:a.pub_name});99===a.beer_price?b.setZIndex(1):b.setZIndex(100);google.maps.event.addListener(b,"click",function(){l=99===a.beer_price?"?":a.beer_price;tweet='<a href="https://twitter.com/share" class="twitter-share-button" data-url="http://oslogigs.com" data-text="'+
+a.pub_name+" "+a.beer_price+' kr." data-lang="en" data-via="OsloGigs" data-hashtags="oslo, oslogigs, norway">Tweet</a>';content_string="<h1>"+a.pub_name+'</h1><p><a href="http://maps.google.com/?saddr=Current%20Location&daddr='+j+"+("+k+')&dirflg=w&t=h">Google Maps Directions</a></p><p>Phone:<a href="tel:'+a.pub_phone+'">'+a.pub_phone+"</a></p><p>Halvliterpris: NOK <b>"+l+"</b></p><p>"+tweet+"</p>";h.setContent(content_string);h.open(g,this);twttr.widgets.load()})})})});(function(c){function i(a,j,k){c.error("$."+g+" :"+j+" "+k)}var g,h,d,a;g="parse";h={base:"https://api.parse.com/1/"};d={};a=/(users|login|files|push|requestPasswordReset)/;d.init=function(a){c.extend(h,"object"===typeof a?a:{},!0);return c[g]};c.each(["GET","POST","PUT","DELETE"],function(l,j){var k=j.toLowerCase();d[k]=function(){var b,f,e,d;b=arguments;f=b[0];e=b[1];d=b[2];error=b[3];"function"===typeof b[1]&&(e=!1,d=b[1],error=b[2]);b=["$.",g,".",k,"(",'"',f,'"'];e&&b.push(", "+(JSON?JSON.stringify(e):
+"data"));b=b.join("")+");";c.publish&&c.publish("parse.log",[b]);h.app_id&&h.rest_key?b=!0:(b="Missing app_id, or rest_key authentication parameters.\nPass these credentials to $."+g+".init\napp_id = Application Id\nrest_key = REST API Key",alert(b),c.error(b),b=!1);b?(f={contentType:"application/json",processData:!1,dataType:"json",url:h.base+(a.test(f)?f:"classes/"+f),type:j,headers:{"X-Parse-Application-Id":h.app_id,"X-Parse-REST-API-Key":h.rest_key}},"object"===typeof e&&("GET"===j?(f.processData=
+!0,e.where&&"object"===typeof e.where&&(e.where=JSON.stringify(e.where))):e=JSON.stringify(e),f.data=e),e=c.ajax(f)):e=!1;f=error;"function"===typeof d&&e.done(d);f="function"===typeof f?f:i;e.fail(f);return c[g]}});c.extend(d,{signup:function(a,c,d){return this.post("users",a,c,d)},login:function(a,c,d,b){return this.get("login",{username:a,password:c},d,b)},requestPasswordReset:function(a,c,d){return this.post("requestPasswordReset",{email:a},c,d)}});c[g]=d})(jQuery);
View
190 public/javascripts/jquery-parse.js
@@ -0,0 +1,190 @@
+(function($) {
+
+ var ns, _opts, methods, uriRgx;
+
+ //Plugin namespace you can change this if you want..
+ //i.e, ns = "db" = $.db.get/post/put/delete
+ ns = "parse";
+
+ //default opts
+ _opts = {
+ base: "https://api.parse.com/1/"
+ };
+
+ //public methods
+ methods = {};
+
+ //uriRgx
+ uriRgx = /(users|login|files|push|requestPasswordReset)/;
+
+ function _creds() {
+ var error;
+
+ if (_opts.app_id && _opts.rest_key) {
+ return true;
+ }
+
+ error = "Missing app_id, or rest_key authentication parameters.\n" +
+ "Pass these credentials to $." + ns + ".init\n" +
+ "app_id = Application Id\n" +
+ "rest_key = REST API Key";
+ alert(error);
+ $.error(error);
+
+ return false;
+ }
+
+ function _error(jqXHR, textStatus, errorThrown) {
+ $.error("$." + ns + " :" + textStatus + " " + errorThrown);
+ }
+
+ //TODO JSON.stringify dependency?
+ function _http(method, uri, data) {
+ var req;
+
+ if (!_creds()) {
+ return false;
+ }
+
+
+ req = {
+ //data
+ contentType: "application/json",
+ processData: false,
+ dataType: 'json',
+
+ //action
+ url: _opts.base + (uriRgx.test(uri) ? uri: "classes/" + uri),
+ type: method,
+
+ //Credentials
+ //NEW! Parse.com now supports CORS...https://parse.com/docs/rest
+ headers: {
+ "X-Parse-Application-Id": _opts.app_id,
+ "X-Parse-REST-API-Key": _opts.rest_key
+ }
+ };
+
+
+ //if no data passed just return ajax
+ if (typeof data !== 'object') {
+ return $.ajax(req);
+ }
+
+ //if get request process data as application/x-www-form-urlencoded
+ if (method === 'GET') {
+ req.processData = true;
+ //if there is a where object it needs to be stringified first.
+ //no need to encodeURIComponent on data.where as $.ajax does that natively
+ if (data.where && typeof data.where === 'object') {
+ data.where = JSON.stringify(data.where);
+ }
+ }
+ //otherwise stringify all data.
+ else {
+ data = JSON.stringify(data);
+ }
+
+ //set request data
+ req.data = data;
+
+ return $.ajax(req);
+ }
+
+
+ function _response(req, cb, error) {
+ typeof cb === "function" && req.done(cb);
+ error = typeof error === 'function' ? error : _error;
+ req.fail(error);
+ return $[ns];
+ }
+
+ function _logger(method, uri, data){
+ var str = [ "$.", ns, ".", method, "(", "\"",uri,"\""];
+ data && str.push(", " + (JSON ? JSON.stringify(data) : "data") );
+ str = str.join('')+");";
+ $.publish && $.publish("parse.log", [str]);
+ return str;
+ }
+ //exports
+ methods.init = function(customOpts) {
+ $.extend(_opts, typeof customOpts === 'object' ? customOpts: {}, true);
+ return $[ns];
+ };
+
+
+ /*
+ Creates $.parse.get/post/put/delete methods
+ Examples....
+
+ $.parse.post('tasks',{ body : "Build all the things!" },function(json){
+ console.log(json);
+ });
+
+ */
+ $.each(['GET', 'POST', 'PUT', 'DELETE'], function(i, action) {
+ var m = action.toLowerCase();
+
+ methods[m] = function() {
+ var args, uri, data, cb, req;
+
+ args = arguments;
+
+ uri = args[0];
+ data = args[1];
+ cb = args[2];
+ error = args[3]
+
+ if (typeof args[1] === 'function') {
+ data = false;
+ cb = args[1];
+ error = args[2];
+ }
+
+ _logger(m, uri, data);
+
+ req = _http(action, uri, data);
+
+ return _response(req, cb, error);
+ };
+
+ });
+
+ //alias methods
+ $.extend(methods, {
+
+ //@param Object data eg.. '{"username": "cooldude6", "password": "p_n7!-e8", "phone": "415-392-0202"}'
+ //@param Function optional callback
+ //@param Function optional error callback
+ //@return $[ns] aka $.parse
+ signup: function(data, cb, error) {
+ return this.post('users', data, cb, error);
+ },
+
+ //@param String username
+ //@param String password
+ //@param Function optional callback
+ //@param Function optional error callback
+ //@return $[ns] aka $.parse
+ login: function(username, password, cb, error) {
+ return this.get('login', { username: username, password: password }, cb, error);
+ },
+
+ //@param String email address of user
+ //@param Function optional callback
+ //@param Function optional error callback
+ //@return $[ns] aka $.parse
+ requestPasswordReset: function(email, cb, error) {
+ return this.post('requestPasswordReset', { email: email }, cb, error);
+ }
+
+ });
+
+
+
+
+
+ //attach methods to jQuery object using ns var aka 'parse'
+ $[ns] = methods;
+
+})(jQuery);
View
20 public/javascripts/map.js
@@ -3,26 +3,6 @@
$('.page-map').live("pageshow", function() {
-/*
-var me = function(lat, lng) {
- var posi = new google.maps.LatLng(lat, lng);
- var marker = new google.maps.Marker({
- map: map,
- position: posi,
- title: "You are here!"
- });
- bubble.open(map, marker);
-};
-
-if(navigator.geolocation) {
- navigator.geolocation.getCurrentPosition(function(position) {
- me(position.coords.latitude, position.coords.latitude);
- }, function() {
- });
-} else {
-}
-*/
-
$.parse.init({
app_id: "9vbpyfY5iHZqFmq4Fjh2mbUeCAs9vXLjfnIgmUm5",
rest_key: "ptYuPEQ4l6mugCYtu2uRHi5X4S0taWNc4Tdd61rC"
View
2  public/javascripts/remember_to_run_minifier.sh
@@ -1,2 +1,2 @@
#!/bin/bash
-java -jar ../../../clojure_compiler/compiler.jar listview.js map.js > all.js
+java -jar ../../../clojure_compiler/compiler.jar listview.js map.js jquery-parse.js > all.js
View
2  views/layout.jade
@@ -16,7 +16,7 @@ html
script(src='http://code.jquery.com/jquery-1.7.1.min.js')
script(src='http://code.jquery.com/mobile/1.1.0/jquery.mobile-1.1.0.min.js')
script(src='http://maps.googleapis.com/maps/api/js?sensor=true')
- script(type="application/javascript", src='https://raw.github.com/srhyne/jQuery-Parse/master/jquery.parse.js')
+ //script(type="application/javascript", src='https://raw.github.com/srhyne/jQuery-Parse/master/jquery.parse.js')
script(type="application/javascript", src='/javascripts/all.js')
script(type="application/javascript", src='/javascripts/twitter.js')
body!= body

No commit comments for this range

Something went wrong with that request. Please try again.