+doc #18295 add close button with 1day delay to reappear
This commit is contained in:
parent
c527987cc3
commit
d4dd75cb49
2 changed files with 81 additions and 26 deletions
|
|
@ -187,9 +187,10 @@ div.align-center { width: 100%; text-align: center; }
|
||||||
p.caption { width: 80%; text-align: justify; font-size: 0.95em; font-style: italic; position: relative; left: 10%; }
|
p.caption { width: 80%; text-align: justify; font-size: 0.95em; font-style: italic; position: relative; left: 10%; }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* floaty warning about old version of docs */
|
/* floaty warning about old version of docs */
|
||||||
#floaty-warning {
|
#floaty-warning {
|
||||||
display: block;
|
display: none;
|
||||||
position: fixed;
|
position: fixed;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
|
|
@ -215,3 +216,12 @@ p.caption { width: 80%; text-align: justify; font-size: 0.95em; font-style: ital
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
text-decoration: underline;
|
text-decoration: underline;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#close-floaty-window {
|
||||||
|
position: absolute;
|
||||||
|
top: 1em;
|
||||||
|
right: 2em;
|
||||||
|
color: white;
|
||||||
|
font-weight: normal;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
@ -30,48 +30,63 @@ function showVersionWarning(version, akkaVersionsData, seriesInfo) {
|
||||||
console.log("Current version info", seriesInfo);
|
console.log("Current version info", seriesInfo);
|
||||||
|
|
||||||
var isOutdated = !!seriesInfo.outdated;
|
var isOutdated = !!seriesInfo.outdated;
|
||||||
var isLatestInSeries = version != seriesInfo.latest;
|
var isLatestInSeries = version == seriesInfo.latest;
|
||||||
|
var needsToShow = false;
|
||||||
|
|
||||||
if (isOutdated) {
|
if (isOutdated) {
|
||||||
|
needsToShow = true;
|
||||||
$floatyWarning.addClass("warning");
|
$floatyWarning.addClass("warning");
|
||||||
var instead = akkaVersionsData[seriesInfo.instead].latest;
|
var instead = akkaVersionsData[seriesInfo.instead].latest;
|
||||||
|
|
||||||
console.log("Akka " + version + " is outdated. Suggesting 'latest' of ", seriesInfo.instead, "by 'instead' key.");
|
console.log("Akka " + version + " is outdated. Suggesting 'latest' of ", seriesInfo.instead, "by 'instead' key.");
|
||||||
var unsupportedMessage = '<p>' +
|
$floatyWarning
|
||||||
'<span style="font-weight: bold">This version of Akka (' + version + ') has been end-of-lifed and is currently not supported! </span><br/>' +
|
.append(
|
||||||
'Please upgrade to <a href="' + insteadUrl(version, instead) + '">Akka ' + instead + '</a> or <a href="http://www.typesafe.com/products/typesafe-reactive-platform">Typesafe Reactive Platform</a> as soon as possible.' +
|
'<p>' +
|
||||||
'</p>';
|
'<span style="font-weight: bold">This version of Akka (' + version + ') has been end-of-lifed and is currently not supported! </span><br/>' +
|
||||||
$floatyWarning.append(unsupportedMessage);
|
'Please upgrade to <a href="' + insteadUrl(version, instead) + '">Akka ' + instead + '</a> or <a href="http://www.typesafe.com/products/typesafe-reactive-platform">Typesafe Reactive Platform</a> as soon as possible.' +
|
||||||
|
'</p>');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isLatestInSeries) {
|
if (!isLatestInSeries) {
|
||||||
|
needsToShow = true;
|
||||||
$floatyWarning
|
$floatyWarning
|
||||||
.append('<p>' +
|
.append(
|
||||||
|
'<p>' +
|
||||||
'You are browsing the docs for Akka ' + version + ', ' +
|
'You are browsing the docs for Akka ' + version + ', ' +
|
||||||
'however the latest release in this series is: ' +
|
'however the latest release in this series is: ' +
|
||||||
'<a href="' + targetUrl + '">' + seriesInfo.latest + '</a>. <br/>' +
|
'<a href="' + targetUrl + '">' + seriesInfo.latest + '</a>. <br/>' +
|
||||||
'</p>');
|
'</p>');
|
||||||
}
|
}
|
||||||
|
|
||||||
// add bottom clicky link "to same page"
|
|
||||||
if (isOutdated) {
|
if (isOutdated) {
|
||||||
$floatyWarning.append(
|
$floatyWarning
|
||||||
'<p>' +
|
.append(
|
||||||
'<a href="' + insteadUrl(version, instead) + '">Click here to go to the same page on the ' + akkaVersionsData[seriesInfo.instead].latest + ' version of the docs.</a>' +
|
'<p>' +
|
||||||
'</p>')
|
'<a href="' + insteadUrl(version, instead) + '">Click here to go to the same page on the ' + akkaVersionsData[seriesInfo.instead].latest + ' version of the docs.</a>' +
|
||||||
} else if (isLatestInSeries && isOutdated) {
|
'</p>');
|
||||||
$floatyWarning.append(
|
} else if (!isLatestInSeries) {
|
||||||
'<p>' +
|
$floatyWarning
|
||||||
'<a href="' + targetUrl + '">Click here to go to the same page on the ' + seriesInfo.latest + ' version of the docs.</a>' +
|
.append(
|
||||||
'</p>')
|
'<p>' +
|
||||||
|
'<a href="' + targetUrl + '">Click here to go to the same page on the ' + seriesInfo.latest + ' version of the docs.</a>' +
|
||||||
|
'</p>')
|
||||||
}
|
}
|
||||||
|
|
||||||
$floatyWarning
|
if (needsToShow && !outdatedVersionWasAcked(version)) {
|
||||||
.hide()
|
var $close = $('<span id="close-floaty-window">Close [X]</span>')
|
||||||
.prependTo("body")
|
.click(function () {
|
||||||
.show()
|
ackOutdatedVersionForADay(version);
|
||||||
.delay(10 * 1000)
|
$floatyWarning.hide();
|
||||||
.fadeOut()
|
});
|
||||||
|
|
||||||
|
$floatyWarning
|
||||||
|
.hide()
|
||||||
|
.append($close)
|
||||||
|
.prependTo("body")
|
||||||
|
.show()
|
||||||
|
.delay(10 * 1000)
|
||||||
|
.fadeOut();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// e.g. "docs/akka/2.3.10/scala/persistence.html" => "2.3.10"
|
// e.g. "docs/akka/2.3.10/scala/persistence.html" => "2.3.10"
|
||||||
|
|
@ -90,7 +105,37 @@ function browsedAkkaVersion() {
|
||||||
|
|
||||||
function versionsJsonUri() {
|
function versionsJsonUri() {
|
||||||
if (window.location.pathname.includes("stream-and-http"))
|
if (window.location.pathname.includes("stream-and-http"))
|
||||||
return "http://doc.akka.io/docs/akka-stream-and-http-experimental/versions.json"
|
return "http://doc.akka.io/docs/akka-stream-and-http-experimental/versions.json";
|
||||||
else
|
else
|
||||||
return "http://doc.akka.io/docs/akka/versions.json";
|
return "http://doc.akka.io/docs/akka/versions.json";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// --- ack outdated versions ---
|
||||||
|
|
||||||
|
function ackOutdatedVersionCookieName(version) {
|
||||||
|
return "ack-outdated-" + version;
|
||||||
|
}
|
||||||
|
|
||||||
|
function ackOutdatedVersionForADay(version) {
|
||||||
|
function setCookie(cname, cvalue, exdays) {
|
||||||
|
var d = new Date();
|
||||||
|
d.setTime(d.getTime() + (exdays*24*60*60*1000));
|
||||||
|
var expires = "expires="+d.toUTCString();
|
||||||
|
document.cookie = cname + "=" + cvalue + "; " + expires;
|
||||||
|
}
|
||||||
|
setCookie(ackOutdatedVersionCookieName(version), 'true', 1)
|
||||||
|
}
|
||||||
|
function outdatedVersionWasAcked(version) {
|
||||||
|
function getCookie(cname) {
|
||||||
|
var name = cname + "=";
|
||||||
|
var ca = document.cookie.split(';');
|
||||||
|
for(var i=0; i<ca.length; i++) {
|
||||||
|
var c = ca[i];
|
||||||
|
while (c.charAt(0)==' ') c = c.substring(1);
|
||||||
|
if (c.indexOf(name) == 0) return c.substring(name.length,c.length);
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
return getCookie(ackOutdatedVersionCookieName(version)) === 'true';
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue