Merge pull request #8798 from fredj/rawgit

Use unpkg.com instead of rawgit.com
This commit is contained in:
Frédéric Junod
2018-10-12 11:04:39 +02:00
committed by GitHub
6 changed files with 42 additions and 41 deletions
+1 -1
View File
@@ -8,7 +8,7 @@ docs: >
normalize the events from the browser. normalize the events from the browser.
tags: "device, orientation, gyronorm" tags: "device, orientation, gyronorm"
resources: resources:
- https://cdn.rawgit.com/dorukeker/gyronorm.js/v2.0.6/dist/gyronorm.complete.min.js - https://unpkg.com/gyronorm@2.0.6/dist/gyronorm.complete.min.js
--- ---
<div id="map" class="map"></div> <div id="map" class="map"></div>
<p> <p>
+1 -1
View File
@@ -7,6 +7,6 @@ docs: >
with OpenLayers. with OpenLayers.
tags: "vector, jsts, buffer" tags: "vector, jsts, buffer"
resources: resources:
- https://cdn.rawgit.com/bjornharrtell/jsts/gh-pages/1.6.0/jsts.min.js - https://unpkg.com/jsts@2.0.2/dist/jsts.min.js
--- ---
<div id="map" class="map"></div> <div id="map" class="map"></div>
@@ -15,7 +15,7 @@ function createMapboxStreetsV6Style(Style, Fill, Stroke, Icon, Text) {
var icon = iconCache[iconName]; var icon = iconCache[iconName];
if (!icon) { if (!icon) {
icon = new Style({image: new Icon({ icon = new Style({image: new Icon({
src: 'https://cdn.rawgit.com/mapbox/maki/master/icons/' + iconName + '-15.svg', src: 'https://unpkg.com/@mapbox/maki@4.0.0/icons/' + iconName + '-15.svg',
imgSize: [15, 15] imgSize: [15, 15]
})}); })});
iconCache[iconName] = icon; iconCache[iconName] = icon;
+1 -1
View File
@@ -7,7 +7,7 @@ docs: >
with OpenLayers, enabling creating and editing topological geometry. Standard interaction draws edges, snapping to existing edges. Delete an edge by drawing a new edge crossing the one to delete. with OpenLayers, enabling creating and editing topological geometry. Standard interaction draws edges, snapping to existing edges. Delete an edge by drawing a new edge crossing the one to delete.
tags: "draw, edit, vector, topology, topolis" tags: "draw, edit, vector, topology, topolis"
resources: resources:
- https://cdn.rawgit.com/bjornharrtell/topolis/releases/0.1.1/topolis.min.js - https://unpkg.com/topolis@0.2.5/dist/topolis.js
- https://code.jquery.com/jquery-3.1.1.min.js - https://code.jquery.com/jquery-3.1.1.min.js
- https://cdnjs.cloudflare.com/ajax/libs/toastr.js/2.1.3/toastr.min.js - https://cdnjs.cloudflare.com/ajax/libs/toastr.js/2.1.3/toastr.min.js
- https://cdnjs.cloudflare.com/ajax/libs/toastr.js/2.1.3/toastr.min.css - https://cdnjs.cloudflare.com/ajax/libs/toastr.js/2.1.3/toastr.min.css
+9 -9
View File
@@ -92,30 +92,30 @@ class TileRange {
} }
/** /**
* @return {number} Height. * @return {number} Height.
*/ */
getHeight() { getHeight() {
return this.maxY - this.minY + 1; return this.maxY - this.minY + 1;
} }
/** /**
* @return {import("./size.js").Size} Size. * @return {import("./size.js").Size} Size.
*/ */
getSize() { getSize() {
return [this.getWidth(), this.getHeight()]; return [this.getWidth(), this.getHeight()];
} }
/** /**
* @return {number} Width. * @return {number} Width.
*/ */
getWidth() { getWidth() {
return this.maxX - this.minX + 1; return this.maxX - this.minX + 1;
} }
/** /**
* @param {TileRange} tileRange Tile range. * @param {TileRange} tileRange Tile range.
* @return {boolean} Intersects. * @return {boolean} Intersects.
*/ */
intersects(tileRange) { intersects(tileRange) {
return this.minX <= tileRange.maxX && return this.minX <= tileRange.maxX &&
this.maxX >= tileRange.minX && this.maxX >= tileRange.minX &&
+29 -28
View File
@@ -32,8 +32,8 @@ import SourceState from './State.js';
* @typedef {Object} Options * @typedef {Object} Options
* @property {AttributionLike} [attributions] * @property {AttributionLike} [attributions]
* @property {import("../proj.js").ProjectionLike} projection * @property {import("../proj.js").ProjectionLike} projection
* @property {SourceState} [state] * @property {SourceState} [state='ready']
* @property {boolean} [wrapX] * @property {boolean} [wrapX=false]
*/ */
@@ -64,7 +64,7 @@ class Source extends BaseObject {
* @private * @private
* @type {?Attribution} * @type {?Attribution}
*/ */
this.attributions_ = this.adaptAttributions_(options.attributions); this.attributions_ = adaptAttributions(options.attributions);
/** /**
* This source is currently loading data. Sources that defer loading to the * This source is currently loading data. Sources that defer loading to the
@@ -88,30 +88,6 @@ class Source extends BaseObject {
} }
/**
* Turns the attributions option into an attributions function.
* @param {AttributionLike|undefined} attributionLike The attribution option.
* @return {?Attribution} An attribution function (or null).
*/
adaptAttributions_(attributionLike) {
if (!attributionLike) {
return null;
}
if (Array.isArray(attributionLike)) {
return function(frameState) {
return attributionLike;
};
}
if (typeof attributionLike === 'function') {
return attributionLike;
}
return function(frameState) {
return [attributionLike];
};
}
/** /**
* Get the attribution function for the source. * Get the attribution function for the source.
* @return {?Attribution} Attribution function. * @return {?Attribution} Attribution function.
@@ -167,7 +143,7 @@ class Source extends BaseObject {
* @api * @api
*/ */
setAttributions(attributions) { setAttributions(attributions) {
this.attributions_ = this.adaptAttributions_(attributions); this.attributions_ = adaptAttributions(attributions);
this.changed(); this.changed();
} }
@@ -195,4 +171,29 @@ class Source extends BaseObject {
Source.prototype.forEachFeatureAtCoordinate = VOID; Source.prototype.forEachFeatureAtCoordinate = VOID;
/**
* Turns the attributions option into an attributions function.
* @param {AttributionLike|undefined} attributionLike The attribution option.
* @return {?Attribution} An attribution function (or null).
*/
function adaptAttributions(attributionLike) {
if (!attributionLike) {
return null;
}
if (Array.isArray(attributionLike)) {
return function(frameState) {
return attributionLike;
};
}
if (typeof attributionLike === 'function') {
return attributionLike;
}
return function(frameState) {
return [attributionLike];
};
}
export default Source; export default Source;