./webpack: remove more dead code

The install-row and hide-for-windows were only used for the old
installer, they now do not seem to be used anymore.
This commit is contained in:
Jakob Schnitzer 2022-12-17 09:02:06 +01:00
parent 00a45487da
commit c31d457506
2 changed files with 3 additions and 65 deletions

View File

@ -2,39 +2,19 @@
require("bootstrap"); require("bootstrap");
function selectText(text) {
if (document.body.createTextRange) {
let range = document.body.createTextRange();
range.moveToElementText(text);
range.select();
} else if (window.getSelection) {
let selection = window.getSelection();
let range = document.createRange();
range.selectNodeContents(text);
selection.removeAllRanges();
selection.addRange(range);
}
}
function initDownloadButton() { function initDownloadButton() {
const buttons = $(".download-btn"); const buttons = $(".download-btn");
if (buttons.length <= 0) { if (buttons.length <= 0) {
return; return;
} }
buttons.hide();
$.ajax({ $.ajax({
method: "GET", method: "GET",
url: "https://api.github.com/repos/lektor/lektor/releases", url: "https://api.github.com/repos/lektor/lektor/releases",
crossDomain: true, crossDomain: true,
}).then( }).then((releases) => {
(releases) => { updateDownloadButtons(buttons.toArray(), releases);
updateDownloadButtons(buttons.toArray(), releases); });
},
() => {
buttons.show();
}
);
} }
function updateDownloadButtons(buttons, releases) { function updateDownloadButtons(buttons, releases) {
@ -45,20 +25,9 @@ function updateDownloadButtons(buttons, releases) {
link.attr("href", "/downloads/"); link.attr("href", "/downloads/");
link.append($('<span class="version"></span>').text(tag)); link.append($('<span class="version"></span>').text(tag));
$(button).fadeIn("slow");
}); });
} }
function initInstallRow() {
let code = $(".install-row pre");
if (code.length > 0) {
code.on("dblclick", function () {
selectText(this);
});
}
}
function initGoogleSearch() { function initGoogleSearch() {
var container = $(".google-custom-search"); var container = $(".google-custom-search");
if (container.length == 0) { if (container.length == 0) {
@ -109,15 +78,7 @@ function initGoogleSearch() {
} }
} }
function hideThingsForWindows() {
if (navigator.appVersion.indexOf("Win") >= 0) {
$(".hide-for-windows").hide();
}
}
$(function () { $(function () {
initDownloadButton(); initDownloadButton();
initInstallRow();
initGoogleSearch(); initGoogleSearch();
hideThingsForWindows();
}); });

View File

@ -538,29 +538,6 @@ div.lektor-intro {
font-weight: bold; font-weight: bold;
text-decoration: underline; text-decoration: underline;
} }
div.install-row {
background: rgba(40, 30, 30, 0.8);
position: absolute;
bottom: 0;
left: 120px;
right: 120px;
pre {
margin: 0;
background: transparent;
color: white;
}
@media (max-width: $screen-md-max) {
left: 10px;
right: 10px;
}
@media (max-width: $screen-sm-max) {
display: none;
}
}
} }
div.download-btn { div.download-btn {