Cleanup experimental notice

With bootstrap js always included there is no need to add own js to dismiss it.
Only generate the notice for experimental pages, no need to have js for that.
This commit is contained in:
Maximilian Krög
2020-07-25 14:28:37 +02:00
parent 4f76334c92
commit 8b733c2eba
2 changed files with 5 additions and 15 deletions

View File

@@ -117,11 +117,13 @@
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-notice" class="alert alert-warning alert-dismissible" role="alert" style="display:none">
{{#if ./experimental}}
<div id="experimental-notice" class="alert alert-warning alert-dismissible" role="alert">
<button id="experimental-dismiss" type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</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>
{{/if}}
<div class="row-fluid">
<a href="" class="codepen-button float-right"><i class="fa fa-codepen fa-lg"></i> Edit</a>
@@ -264,14 +266,6 @@
document.cookie = cookieText;
}
}
var experimentalNotice = document.getElementById('experimental-notice');
if (window.experimental) {
experimentalNotice.style.display = 'block';
document.getElementById('experimental-dismiss').onclick = function() {
experimentalNotice.style.display = 'none';
}
}
});
</script>
</body>

View File

@@ -291,15 +291,11 @@ class ExampleBuilder {
jsSource = jsSource.replace('new Worker()', "new Worker('./worker.js')");
data.js = {
tag: `<script src="${this.common}.js"></script><script src="${jsName}"></script>`,
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;
}
// check for worker js
const workerName = `${name}.worker.js`;
const workerPath = path.join(data.dir, workerName);