Script tag not allowed out side body / head
This commit is contained in:
@@ -240,41 +240,39 @@
|
|||||||
modal.find('.modal-title').text(title);
|
modal.find('.modal-title').text(title);
|
||||||
modal.find('.modal-body').html(content);
|
modal.find('.modal-body').html(content);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
var packageUrl = 'https://raw.githubusercontent.com/openlayers/openlayers.github.io/build/package.json';
|
||||||
|
fetch(packageUrl).then(function(response) {
|
||||||
|
return response.json();
|
||||||
|
}).then(function(json) {
|
||||||
|
var latestVersion = json.version;
|
||||||
|
document.getElementById('latest-version').innerHTML = latestVersion;
|
||||||
|
var url = window.location.href;
|
||||||
|
var branchSearch = url.match(/\/([^\/]*)\/examples\//);
|
||||||
|
var cookieText = 'dismissed=-' + latestVersion + '-';
|
||||||
|
var dismissed = document.cookie.indexOf(cookieText) != -1;
|
||||||
|
if (branchSearch && !dismissed && /^v[0-9\.]*$/.test(branchSearch[1]) && '{{ olVersion }}' != latestVersion) {
|
||||||
|
var link = url.replace(branchSearch[0], '/latest/examples/');
|
||||||
|
fetch(link, {method: 'head'}).then(function(response) {
|
||||||
|
var a = document.getElementById('latest-link');
|
||||||
|
a.href = response.status == 200 ? link : '../../latest/examples/';
|
||||||
|
});
|
||||||
|
var latestCheck = document.getElementById('latest-check');
|
||||||
|
latestCheck.style.display = '';
|
||||||
|
document.getElementById('latest-dismiss').onclick = function() {
|
||||||
|
latestCheck.style.display = 'none';
|
||||||
|
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>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
<script>
|
|
||||||
var packageUrl = 'https://raw.githubusercontent.com/openlayers/openlayers.github.io/build/package.json';
|
|
||||||
fetch(packageUrl).then(function(response) {
|
|
||||||
return response.json();
|
|
||||||
}).then(function(json) {
|
|
||||||
var latestVersion = json.version;
|
|
||||||
document.getElementById('latest-version').innerHTML = latestVersion;
|
|
||||||
var url = window.location.href;
|
|
||||||
var branchSearch = url.match(/\/([^\/]*)\/examples\//);
|
|
||||||
var cookieText = 'dismissed=-' + latestVersion + '-';
|
|
||||||
var dismissed = document.cookie.indexOf(cookieText) != -1;
|
|
||||||
if (branchSearch && !dismissed && /^v[0-9\.]*$/.test(branchSearch[1]) && '{{ olVersion }}' != latestVersion) {
|
|
||||||
var link = url.replace(branchSearch[0], '/latest/examples/');
|
|
||||||
fetch(link, {method: 'head'}).then(function(response) {
|
|
||||||
var a = document.getElementById('latest-link');
|
|
||||||
a.href = response.status == 200 ? link : '../../latest/examples/';
|
|
||||||
});
|
|
||||||
var latestCheck = document.getElementById('latest-check');
|
|
||||||
latestCheck.style.display = '';
|
|
||||||
document.getElementById('latest-dismiss').onclick = function() {
|
|
||||||
latestCheck.style.display = 'none';
|
|
||||||
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>
|
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
Reference in New Issue
Block a user