Show notice when using experimental features
This commit is contained in:
@@ -7,6 +7,7 @@ docs: >
|
||||
makes it so the map view uses geographic coordinates (even if the view projection is
|
||||
not geographic).
|
||||
tags: "geographic"
|
||||
experimental: true
|
||||
---
|
||||
<div id="map" class="map"></div>
|
||||
<select id="mode">
|
||||
|
||||
@@ -99,6 +99,12 @@
|
||||
This example uses OpenLayers v<span>{{ olVersion }}</span>. The <a id="latest-link" href="#" class="alert-link">latest</a> is v<span id="latest-version"></span>.
|
||||
</div>
|
||||
|
||||
<div id="experimental" class="alert alert-warning alert-dismissible" role="alert" style="display:none">
|
||||
<button id="experimental-dismiss" type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>
|
||||
This example uses features that are not part of the stable API and subject to change between releases. Consult the <a href="https://openlayers.org/en/latest/apidoc/">API documentation</a>
|
||||
to see what is supported in the latest release.
|
||||
</div>
|
||||
|
||||
<div class="row-fluid">
|
||||
<a class="codepen-button pull-right"><i class="fa fa-codepen"></i> Edit</a>
|
||||
<div class="span12">
|
||||
@@ -183,6 +189,15 @@
|
||||
document.cookie = cookieText;
|
||||
}
|
||||
}
|
||||
|
||||
var experimentalNotice = document.getElementById('experimental');
|
||||
if (window.experimental) {
|
||||
experimentalNotice.style.display = 'block';
|
||||
document.getElementById('experimental-dismiss').onclick = function() {
|
||||
experimentalNotice.style.display = 'none';
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
</script>
|
||||
</html>
|
||||
|
||||
@@ -200,6 +200,12 @@ ExampleBuilder.prototype.render = async function(dir, chunk) {
|
||||
tag: `<script src="${this.common}.js"></script><script src="${jsName}"></script>`,
|
||||
source: jsSource
|
||||
};
|
||||
|
||||
if (data.experimental) {
|
||||
const prelude = '<script>window.experimental = true;</script>';
|
||||
data.js.tag = prelude + data.js.tag;
|
||||
}
|
||||
|
||||
data.pkgJson = JSON.stringify({
|
||||
name: name,
|
||||
dependencies: getDependencies(jsSource),
|
||||
|
||||
Reference in New Issue
Block a user