• R/O
  • HTTP
  • SSH
  • HTTPS

magic3: コミット

Cloud computing platform


コミットメタ情報

リビジョンe40a8e06799300b31f2e68a3a1eef300846228ee (tree)
日時2017-02-27 14:28:13
作者naoki hirata <naoki@magi...>
コミッターnaoki hirata

ログメッセージ

CKEditorのGoogleマッププラグイン更新。

変更サマリ

差分

--- a/scripts/ckeditor4.6.2/plugins/googlemaps/dialogs/googlemaps.js
+++ b/scripts/ckeditor4.6.2/plugins/googlemaps/dialogs/googlemaps.js
@@ -7,7 +7,7 @@
77 *
88 * @package Magic3 Framework
99 * @author 平田直毅(Naoki Hirata) <naoki@aplo.co.jp>
10- * @copyright Copyright 2006-2016 Magic3 Project.
10+ * @copyright Copyright 2006-2017 Magic3 Project.
1111 * @license http://www.gnu.org/copyleft/gpl.html GPL License
1212 * @version 1.3
1313 * @link http://www.magic3.org
@@ -71,7 +71,7 @@ var GoogleMap = function()
7171 this.mapType = 0;
7272 }
7373
74-GoogleMap.prototype.generateStaticMap = function()
74+GoogleMap.prototype.generateStaticMap = function(apiKey)
7575 {
7676 var w = Math.min(this.width, 640);
7777 var h = Math.min(this.height, 640);
@@ -80,14 +80,8 @@ GoogleMap.prototype.generateStaticMap = function()
8080
8181 var staticMapTypes = ['roadmap', 'satellite', 'hybrid', 'terrain'];
8282
83-// var mapUrl = 'http://maps.google.com/maps/api/staticmap?center=' + this.centerLat + ',' + this.centerLon
8483 var mapUrl = 'https://maps.googleapis.com/maps/api/staticmap?';
85-// if (M3_GOOGLEMAPS_KEY) mapUrl += 'key=' + M3_GOOGLEMAPS_KEY + '&';
86- if (typeof(M3_GOOGLEMAPS_KEY) === "undefined"){
87- alert('Googleマップを表示するにはAPIキーの設定が必要です');
88- } else {
89- mapUrl += 'key=' + M3_GOOGLEMAPS_KEY + '&';
90- }
84+ if (apiKey) mapUrl += 'key=' + apiKey + '&';
9185
9286 mapUrl += 'center=' + this.centerLat + ',' + this.centerLon
9387 + '&zoom=' + this.zoom + '&size=' + w + 'x' + h
--- a/scripts/ckeditor4.6.2/plugins/googlemaps/dialogs/main.js
+++ b/scripts/ckeditor4.6.2/plugins/googlemaps/dialogs/main.js
@@ -7,7 +7,7 @@
77 *
88 * @package Magic3 Framework
99 * @author 平田直毅(Naoki Hirata) <naoki@aplo.co.jp>
10- * @copyright Copyright 2006-2014 Magic3 Project.
10+ * @copyright Copyright 2006-2017 Magic3 Project.
1111 * @license http://www.gnu.org/copyleft/gpl.html GPL License
1212 * @version 1.2
1313 * @link http://www.magic3.org
@@ -28,8 +28,19 @@
2828 var fakeImage;
2929 var infoWindow;
3030 var polyline;
31+ var apiKey = '';
3132 // var inLoading;
3233
34+ // GoogleMapsAPIキーが設定されているかチェック
35+ if (typeof(editor.config.googlemapsPlugin) === "undefined" || typeof(editor.config.googlemapsPlugin.apiKey) === "undefined"){
36+ alert(editor.lang.googlemaps.msgApiKeyNotConfigured);
37+ } else {
38+ apiKey = editor.config.googlemapsPlugin.apiKey;
39+ }
40+
41+ // GoogleMapsAPIが読み込まれていない場合は読み込む
42+ if (typeof(google) === "undefined") $.getScript("https://maps.googleapis.com/maps/api/js?key=" + apiKey);
43+
3344 // スクリプト読み込み
3445 var pluginUrl = CKEDITOR.getUrl(CKEDITOR.plugins.getPath( 'googlemaps' ));
3546
@@ -493,7 +504,7 @@
493504 });
494505
495506 // ビュー更新前、画像のみ変更
496- var extraStyles = { 'background-image': 'url(' + mapInfo.generateStaticMap() + ')',
507+ var extraStyles = { 'background-image': 'url(' + mapInfo.generateStaticMap(apiKey) + ')',
497508 'background-position': 'center center',
498509 'background-repeat': 'no-repeat',
499510 'border': '0px',
--- a/scripts/ckeditor4.6.2/plugins/googlemaps/lang/en.js
+++ b/scripts/ckeditor4.6.2/plugins/googlemaps/lang/en.js
@@ -7,7 +7,7 @@
77 *
88 * @package Magic3 Framework
99 * @author 平田直毅(Naoki Hirata) <naoki@aplo.co.jp>
10- * @copyright Copyright 2006-2014 Magic3 Project.
10+ * @copyright Copyright 2006-2017 Magic3 Project.
1111 * @license http://www.gnu.org/copyleft/gpl.html GPL License
1212 * @version 1.0
1313 * @link http://www.magic3.org
@@ -42,5 +42,6 @@ CKEDITOR.plugins.setLang( 'googlemaps', 'en', {
4242 mapType: 'Map Type',
4343 msgDefaultMarkerText: 'Input text.',
4444 msgInputStyleJsonData: 'Input style data by JSON format.',
45- msgInvalidStyle: 'Invalid JSON data.'
45+ msgInvalidStyle: 'Invalid JSON data.',
46+ msgApiKeyNotConfigured: 'Google Maps API key not configured.'
4647 });
--- a/scripts/ckeditor4.6.2/plugins/googlemaps/lang/ja.js
+++ b/scripts/ckeditor4.6.2/plugins/googlemaps/lang/ja.js
@@ -7,7 +7,7 @@
77 *
88 * @package Magic3 Framework
99 * @author 平田直毅(Naoki Hirata) <naoki@aplo.co.jp>
10- * @copyright Copyright 2006-2014 Magic3 Project.
10+ * @copyright Copyright 2006-2017 Magic3 Project.
1111 * @license http://www.gnu.org/copyleft/gpl.html GPL License
1212 * @version 1.0
1313 * @link http://www.magic3.org
@@ -55,5 +55,6 @@ CKEDITOR.plugins.setLang( 'googlemaps', 'ja', {
5555 line: 'ライン',
5656 msgLineInstruction: 'クリックするとポイントが追加されます。<br />ポイントはドラッグすることもDELキーで削除することもできます。',
5757 msgInputStyleJsonData: 'JSONフォーマットのスタイルデータを入力してください。',
58- msgInvalidStyle: '無効なJSONデータです。'
58+ msgInvalidStyle: '無効なJSONデータです。',
59+ msgApiKeyNotConfigured: 'GoogleマップAPIキーが設定されていません。'
5960 });
--- a/scripts/ckeditor4.6.2/plugins/googlemaps/plugin.js
+++ b/scripts/ckeditor4.6.2/plugins/googlemaps/plugin.js
@@ -7,7 +7,7 @@
77 *
88 * @package Magic3 Framework
99 * @author 平田直毅(Naoki Hirata) <naoki@aplo.co.jp>
10- * @copyright Copyright 2006-2014 Magic3 Project.
10+ * @copyright Copyright 2006-2017 Magic3 Project.
1111 * @license http://www.gnu.org/copyleft/gpl.html GPL License
1212 * @version 1.2
1313 * @link http://www.magic3.org
@@ -51,6 +51,13 @@
5151 },
5252 // 初期起動時、ソースモード切替時に呼び出し
5353 afterInit: function(editor){
54+ var apiKey = '';
55+ if (typeof(editor.config.googlemapsPlugin) === "undefined" || typeof(editor.config.googlemapsPlugin.apiKey) === "undefined"){
56+ alert(editor.lang.googlemaps.msgApiKeyNotConfigured);
57+ } else {
58+ apiKey = editor.config.googlemapsPlugin.apiKey;
59+ }
60+
5461 // SCRIPTタグのGoogleマップ情報読み込み
5562 var div = document.createElement('div');
5663 div.innerHTML = editor.getData();
@@ -113,7 +120,7 @@
113120 CKEDITOR.addCss(
114121 'img.cke_googlemaps' + mapNumber +
115122 '{' +
116- 'background-image: url(' + mapInfo.generateStaticMap() + ');' +
123+ 'background-image: url(' + mapInfo.generateStaticMap(apiKey) + ');' +
117124 'background-position: center center;' +
118125 'background-repeat: no-repeat;' +
119126 'border: 0px;' +
旧リポジトリブラウザで表示