Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add link to info on deprecated devices #138

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions assets/firmware.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
---
---
document.addEventListener("DOMContentLoaded", function() {
document.addEventListener("DOMContentLoaded", function() {
var
firmware_base_url = 'https://downloads.bremen.freifunk.net/firmware/',
branch = 'stable',
Expand Down Expand Up @@ -33,7 +31,9 @@ document.addEventListener("DOMContentLoaded", function() {
"ocedo": "OCEDO",
"vocore": "VoCore",
},
blogpost_4_32 = "/blog/2020/07/21/zukunft-841.html",
no_factory = ["avm", "8devices", "meraki", "unifi-ac", "gl-ar150", "allnet", "wzr-600dhp"],
no_factory_deprecated = ["tl-wr841", "alfa-network", "dap-1330", "dir-615", "dir-825"],
xhr = window.XMLHttpRequest? new XMLHttpRequest() : new ActiveXObject('Microsoft.XMLHTTP'),
searchbox = document.getElementById('model-search');

Expand Down Expand Up @@ -88,7 +88,8 @@ document.addEventListener("DOMContentLoaded", function() {
models.forEach(function(model) {
var tmpl = document.importNode(model_template, true),
container = tmpl.querySelector('.model'),
has_factory = true;
has_factory = true,
is_deprecated = false;
container.style.backgroundImage = "url('/images/routers/" + model.vendor + "-" + model.id + ".svg')";
container.dataset.searchterms =
vendors[model.vendor].toLowerCase().replace(/[^a-z0-9]/g, '')
Expand All @@ -100,6 +101,10 @@ document.addEventListener("DOMContentLoaded", function() {
if (model.file.indexOf(pattern) != -1)
has_factory = false;
});
no_factory_deprecated.forEach(function(pattern) {
if (model.file.indexOf(pattern) != -1)
is_deprecated = true;
});
if (has_factory)
container.querySelector('.factory a').href =
firmware_base_url + branch + '/factory/' +
Expand All @@ -108,6 +113,11 @@ document.addEventListener("DOMContentLoaded", function() {
tmpl.querySelector('.factory').remove();
container.querySelector('.update a').textContent +=' / Erstinstallation';
}
if(is_deprecated) {
container.querySelector('.factory a').href = blogpost_4_32;
container.querySelector('.factory a').textContent ='Gerät veraltet';

}
model_div.appendChild(tmpl);
});
}
Expand Down