Skip to content

Commit

Permalink
bumping version numbers
Browse files Browse the repository at this point in the history
  • Loading branch information
Deac committed Nov 8, 2016
1 parent 72a4936 commit a423a93
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 18 deletions.
8 changes: 7 additions & 1 deletion README.md
Expand Up @@ -27,7 +27,7 @@ Include these files in the head

| Optional | Type | Description | Default |
|----------|----------|-------------|----------|
| **render** | Array | Currently only supports reviews and schema | ['reviews']
| **render** | Array | supports reviews, schema, phone, address, hours, staticMap | ['reviews','phone','hours','address,'staticMap']
| **min_rating** | Int | Only display reviews with a minimum rating (not applicable for schema)| 0
| **max_rows** | Int | Maximum number of rows to show - 0 for all (not applicable for schema)| 0
| **rotateTime** | Int | Time in MS to show review before rotating or false for no rotate | false
Expand Down Expand Up @@ -80,5 +80,11 @@ $("#google-reviews").googlePlaces({
, phone:{
displayElement: "#custom-phone-id" // optional, will use "#google-phone" by default
}
, staticMap:{
displayElement: "#google-static-map" // optional, will use "#google-static-map" by default
}
, hours:{
displayElement: "#google-hours" // optional, will use "#google-hours" by default
}
});
```
2 changes: 1 addition & 1 deletion bower.json
@@ -1,6 +1,6 @@
{
"name": "google-places",
"version": "0.0.9",
"version": "0.1.0",
"authors": [
"Deac <peledies@gmail.com>"
],
Expand Down
52 changes: 36 additions & 16 deletions google-places.js
Expand Up @@ -22,6 +22,12 @@
, phone:{
displayElement: "#google-phone"
}
, staticMap:{
displayElement: "#google-static-map"
}
, hours:{
displayElement: "#google-hours"
}
};

var plugin = this;
Expand Down Expand Up @@ -56,27 +62,25 @@
, plugin.place_data.formatted_phone_number
);
}
if(plugin.settings.render.indexOf('staticMap') > -1){
renderStaticMap(
capture_element(plugin.settings.staticMap.displayElement)
, plugin.place_data.formatted_address
);
}
if(plugin.settings.render.indexOf('hours') > -1){
renderHours(
capture_element(plugin.settings.hours.displayElement)
, plugin.place_data.opening_hours
);
}

// render schema markup

addSchemaMarkup(
capture_element(plugin.settings.schema.displayElement)
, plugin.place_data
);
/*if(plugin.settings.schema.displayElement instanceof jQuery){
addSchemaMarkup(plugin.place_data);
}else if(typeof plugin.settings.schema.displayElement == 'string'){
try{
var ele = $(plugin.settings.schema.displayElement);
if( ele.length ){
plugin.settings.schema.displayElement = ele;
addSchemaMarkup(plugin.place_data);
}else{
throw 'Element [' + plugin.settings.schema.displayElement + '] couldnt be found in the DOM. Skipping schema markup generation.';
}
}catch(e){
console.warn(e);
}
}*/

});
}

Expand Down Expand Up @@ -149,6 +153,22 @@
$element.append(html);
}

var renderHours = function(element, data){
if(element instanceof jQuery){
var html = "<ul>";
data.weekday_text.forEach(function(day){
html += "<li>"+day+"</li>";
});
html += "</ul>";
element.append(html);
}
}

var renderStaticMap = function(element, data){
if(element instanceof jQuery){
element.append("<img src='https://maps.googleapis.com/maps/api/staticmap?size=512x512&zoom=17&maptype=roadmap&markers=size:large%7Ccolor:red%7C"+data+"'></img>");
}
}

var renderAddress = function(element, data){
if(element instanceof jQuery){
Expand Down

0 comments on commit a423a93

Please sign in to comment.