From b3b8b14b1e3a081fb98bde5ff8fb769cee9e5ea5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Oli=C5=A1ar?= Date: Wed, 1 Apr 2015 20:18:55 +0200 Subject: [PATCH] update js --- .gitignore | 2 ++ client-side/googleMapAPI.js | 19 +++++++++++-------- composer.json | 4 +++- 3 files changed, 16 insertions(+), 9 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e675067 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +/vendor/ +*.lock diff --git a/client-side/googleMapAPI.js b/client-side/googleMapAPI.js index fd9372a..3c9a270 100644 --- a/client-side/googleMapAPI.js +++ b/client-side/googleMapAPI.js @@ -1,10 +1,10 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. +/** + * Copyright (c) 2015 Petr OliĊĦar (http://olisar.eu) + * + * For the full copyright and license information, please view + * the file LICENSE.md that was distributed with this source code. */ - var GoogleMap = GoogleMap || {}; GoogleMap = function(element) @@ -259,6 +259,11 @@ var map; Array.prototype.forEach.call(document.getElementsByClassName('googleMapAPI'), function(el, i){ map = new GoogleMap(el); map.doProportions(); + if (typeof google === "undefined") { + loadScript(); + } else { + map.initialize(); + } }); function loadScript() { @@ -268,6 +273,4 @@ function loadScript() { script.src = 'https://maps.googleapis.com/maps/api/js?v=3.exp&' + 'callback=map.initialize'+key; document.body.appendChild(script); -} - -window.onload = loadScript; \ No newline at end of file +} \ No newline at end of file diff --git a/composer.json b/composer.json index 36433a6..1ed80a6 100644 --- a/composer.json +++ b/composer.json @@ -13,7 +13,9 @@ } ], "require": { - "php": ">=5.3.0", + "php": ">=5.4.0" + }, + "require-dev": { "nette/nette": ">=2.1" }, "autoload": {