From a0e487fcbda14c955d8acc5599960afaf81d901e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20Kr=C3=B6g?= Date: Mon, 27 Jul 2020 21:13:00 +0200 Subject: [PATCH 1/3] Update jquery version to 3.5.1 for all examples --- examples/layer-group.html | 2 +- examples/topolis.html | 2 +- examples/vector-esri-edit.html | 2 +- examples/vector-esri.html | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/layer-group.html b/examples/layer-group.html index 79b7be5c79..405bea1737 100644 --- a/examples/layer-group.html +++ b/examples/layer-group.html @@ -6,7 +6,7 @@ docs: > Example of a map with layer group. tags: "tilejson, input, bind, group, layergroup" resources: - - https://code.jquery.com/jquery-2.2.3.min.js + - https://code.jquery.com/jquery-3.5.1.min.js cloak: - key: pk.eyJ1IjoiYWhvY2V2YXIiLCJhIjoiY2pzbmg0Nmk5MGF5NzQzbzRnbDNoeHJrbiJ9.7_-_gL8ur7ZtEiNwRfCy7Q value: Your Mapbox access token from https://mapbox.com/ here diff --git a/examples/topolis.html b/examples/topolis.html index 396d380ba0..72b3463bd4 100644 --- a/examples/topolis.html +++ b/examples/topolis.html @@ -8,7 +8,7 @@ docs: > tags: "draw, edit, vector, topology, topolis" resources: - 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.5.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.css --- diff --git a/examples/vector-esri-edit.html b/examples/vector-esri-edit.html index 5342ba382a..ac9ac5cad7 100644 --- a/examples/vector-esri-edit.html +++ b/examples/vector-esri-edit.html @@ -6,7 +6,7 @@ docs: > This example loads features from ArcGIS REST Feature Service and allows to add new features or update existing features. tags: "vector, esri, ArcGIS, REST, Feature, Service, loading, server, edit, updateFeature, addFeature" resources: - - https://code.jquery.com/jquery-2.2.3.min.js + - https://code.jquery.com/jquery-3.5.1.min.js ---
diff --git a/examples/vector-esri.html b/examples/vector-esri.html index a4bfdc6d11..4391c8e090 100644 --- a/examples/vector-esri.html +++ b/examples/vector-esri.html @@ -6,7 +6,7 @@ docs: > This example loads new features from ArcGIS REST Feature Service when the view extent changes. tags: "vector, esri, ArcGIS, REST, Feature, Service, loading, server" resources: - - https://code.jquery.com/jquery-2.2.3.min.js + - https://code.jquery.com/jquery-3.5.1.min.js ---
 
From 3be9435a7088087fa48b00a9370e4f1433e3701e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20Kr=C3=B6g?= Date: Mon, 27 Jul 2020 21:49:18 +0200 Subject: [PATCH 2/3] Remove unused codepen resources, duplicate bootstrap / jquery js Use push instead of setting by index, gets rid of some empty lines generated by sparse resource array --- examples/webpack/example-builder.js | 47 +++++++++++++---------------- 1 file changed, 21 insertions(+), 26 deletions(-) diff --git a/examples/webpack/example-builder.js b/examples/webpack/example-builder.js index 038eaf5289..93ae36cb88 100644 --- a/examples/webpack/example-builder.js +++ b/examples/webpack/example-builder.js @@ -9,9 +9,11 @@ const promisify = require('util').promisify; const RawSource = require('webpack-sources').RawSource; const readFile = promisify(fs.readFile); -const isCssRegEx = /\.css$/; +const isCssRegEx = /\.css(\?.*)?$/; const isJsRegEx = /\.js(\?.*)?$/; const importRegEx = /^import .* from '(.*)';$/; +const isTemplateJs = /\/(jquery(-\d+\.\d+\.\d+)?|(bootstrap(\.bundle)?))(\.min)?\.js(\?.*)?$/; +const isTemplateCss = /\/bootstrap(\.min)?\.css(\?.*)?$/; handlebars.registerHelper( 'md', @@ -361,41 +363,34 @@ class ExampleBuilder { // add additional resources if (data.resources) { - const resources = []; + const localResources = []; const remoteResources = []; - const codePenResources = []; - for (let i = 0, ii = data.resources.length; i < ii; ++i) { - const resource = data.resources[i]; - const remoteResource = - resource.indexOf('//') === -1 - ? `https://openlayers.org/en/v${pkg.version}/examples/${resource}` - : resource; - codePenResources[i] = remoteResource; + data.resources.forEach((resource) => { + const remoteResource = /^https?:\/\//.test(resource) + ? resource + : `https://openlayers.org/en/v${pkg.version}/examples/${resource}`; if (isJsRegEx.test(resource)) { - resources[i] = ``; - remoteResources[i] = ``; - } else if (isCssRegEx.test(resource)) { - if (resource.indexOf('bootstrap.min.css') === -1) { - resources[i] = ''; + if (!isTemplateJs.test(resource)) { + localResources.push(``); } - remoteResources[i] = - ''; + remoteResources.push(``); + } else if (isCssRegEx.test(resource)) { + if (!isTemplateCss.test(resource)) { + localResources.push(``); + } + remoteResources.push( + `` + ); } else { throw new Error( - 'Invalid value for resource: ' + - resource + - ' is not .js or .css: ' + - data.filename + `Invalid resource: '${resource}' is not .js or .css: ${data.filename}` ); } - } + }); data.extraHead = { - local: resources.join('\n'), + local: localResources.join('\n'), remote: remoteResources.join('\n'), }; - data.extraResources = data.resources.length - ? ',' + codePenResources.join(',') - : ''; } const templatePath = path.join(this.templates, data.layout); From edf512514917706db7c1be0b18f0ccbc9ce0cf13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20Kr=C3=B6g?= Date: Mon, 27 Jul 2020 22:12:20 +0200 Subject: [PATCH 3/3] Fix kml-earthquakes tooltip --- examples/kml-earthquakes.js | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/examples/kml-earthquakes.js b/examples/kml-earthquakes.js index b2ea2b175d..0462230a81 100644 --- a/examples/kml-earthquakes.js +++ b/examples/kml-earthquakes.js @@ -73,11 +73,7 @@ const displayFeatureInfo = function (pixel) { return feature; }); if (feature) { - info - .tooltip('hide') - .attr('data-original-title', feature.get('name')) - .tooltip('fixTitle') - .tooltip('show'); + info.attr('data-original-title', feature.get('name')).tooltip('show'); } else { info.tooltip('hide'); }