Skip to content

Commit e9c1825

Browse files
committed
Finish: use https for non-https? protocol env
1 parent 32b4eb1 commit e9c1825

6 files changed

Lines changed: 48 additions & 8632 deletions

File tree

.vscode/settings.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
// Place your settings in this file to overwrite default and user settings.
22
{
3-
"editor.formatOnSave": true,
4-
"html.format.enable": false,
5-
"files.associations": {
6-
"*.css": "postcss"
7-
}
8-
}
3+
"editor.formatOnSave": false,
4+
"html.format.enable": false,
5+
"files.associations": {
6+
"*.css": "postcss"
7+
}
8+
}

dist/angular-baidu-map.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
var a = typeof exports === 'object' ? factory(require("angular")) : factory(root["angular"]);
88
for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];
99
}
10-
})(this, function(__WEBPACK_EXTERNAL_MODULE_2__) {
10+
})(typeof self !== 'undefined' ? self : this, function(__WEBPACK_EXTERNAL_MODULE_2__) {
1111
return /******/ (function(modules) { // webpackBootstrap
1212
/******/ // The module cache
1313
/******/ var installedModules = {};
@@ -723,15 +723,20 @@ function appendScriptTag(url) {
723723

724724
this.setKey = function (val) {
725725
ak = val;
726-
MAP_URL = '//api.map.baidu.com/api?v=2.0&ak=' + ak + '&callback=baidumapinit&s=' + (location.protocol === 'https:' ? 1 : 0);
726+
MAP_URL = '//api.map.baidu.com/api?v=2.0&ak=' + ak + '&callback=baidumapinit';
727+
728+
if (location.protocol.indexOf('http') > -1) {
729+
MAP_URL = MAP_URL + '&s=' + (location.protocol === 'https:' ? 1 : 0);
730+
} else {
731+
MAP_URL = 'https:' + MAP_URL + '&s=1';
732+
}
727733
};
728734

729735
this.$get = function ($rootScope) {
730736
'ngInject';
731737

732738
return {
733739
load: function load() {
734-
735740
Object(__WEBPACK_IMPORTED_MODULE_0__helper_validate__["d" /* nullCheck */])(ak, 'ak should be set before use. Read: https://leftstick.github.io/BaiduMapForAngularJS/#!/quickstart');
736741

737742
var loadBaiduMapPromise = $rootScope.loadBaiduMapPromise;
@@ -754,7 +759,6 @@ function appendScriptTag(url) {
754759
script.type = 'text/javascript';
755760
script.src = url;
756761
script.onerror = function () {
757-
758762
Array.prototype.slice.call(document.querySelectorAll('baidu-map .baidu-map-offline')).forEach(function (node) {
759763
node.style.display = 'block';
760764
});

dist/angular-baidu-map.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)