<div>
<h3 class="tr-downloads">Downloads</h3>
- <a id="sysupgrade-image" class="download-link" href="#"><span></span>SYSUPGRADE</a>
<a id="factory-image" class="download-link" href="#"><span></span>FACTORY</a>
+ <a id="sysupgrade-image" class="download-link" href="#"><span></span>SYSUPGRADE</a>
<a id="kernel-image" class="download-link" href="#"><span></span>KERNEL</a>
<a id="rootfs-image" class="download-link" href="#"><span></span>ROOTFS</a>
<a id="tftp-image" class="download-link" href="#"><span></span>TFTP</a>
</div>
+
+ <div>
+ <span id="factory-help" class="tr-factory-help">Factory images are for flashing routers with OpenWrt for the first time using the vendors web interface.</span>
+ <span id="sysupgrade-help" class="tr-sysupgrade-help">Sysupgrade images are for flashing routers that already run OpenWrt. The image can be applied using the web interface or the console.</span>
+ <span id="kernel-help" class="tr-kernel-help">Linux kernel as a separate image.</span>
+ <span id="rootfs-help" class="tr-rootfs-help">Root file system as a separate image.</span>
+ <span id="tftp-help" class="tr-tftp-help">Image that can be applied using the tftp meachnism of the boot loader</span>
+ </div>
</div>
</div>
}
function updateImages(model, target, release, commit, images) {
+ var types = ['sysupgrade', 'factory', 'rootfs', 'kernel', 'tftp'];
+
+ function hideLinks() {
+ types.forEach(function(type) {
+ $(type + '-image').style.display = 'none';
+ });
+ }
+
+ function hideHelps() {
+ types.forEach(function(type) {
+ $(type + '-help').style.display = 'none';
+ });
+ }
+
+ function showLink(type, path) {
+ var e = $(type + '-image');
+ e.href = path;
+ e.style.display = 'inline-flex';
+ if (config.showHelp) {
+ e.onmouseover = function() {
+ hideHelps();
+ $(type + '-help').style.display = 'block';
+ };
+ }
+ }
+
+ hideLinks();
+ hideHelps();
+
if (model && target && release && commit && images) {
+ // fill out build info
$('image-model').innerText = model;
$('image-target').innerText = target;
$('image-release').innerText = release;
$('image-commit').innerText = commit;
+ // show links to images
for(var i in images) {
- var filename = images[i];
- var path = "https://" + target + "/" + filename;
- var type = extractImageType(filename);
-
- if (type == "sysupgrade") {
- $("sysupgrade-image").href = path;
- $("sysupgrade-image").style.display = "inline-flex";
- }
-
- if (type == "factory") {
- $("factory-image").href = path;
- $("factory-image").style.display = "inline-flex";
- }
-
- if (type == "tftp") {
- $("tftp-image").href = path;
- $("tftp-image").style.display = "inline-flex";
- }
-
- if (type == "kernel") {
- $("kernel-image").href = path;
- $("kernel-image").style.display = "inline-flex";
- }
-
- if (type == "rootfs") {
- $("rootfs-image").href = path;
- $("rootfs-image").style.display = "inline-flex";
+ var file = images[i];
+ var path = config.downloadLink
+ .replace('%target', target)
+ .replace('%release', release)
+ .replace('%file', file)
+ .replace('%commit', commit);
+ var type = extractImageType(file);
+
+ if (types.includes(type)) {
+ showLink(type, path);
}
}
- $("images").style.display = 'block';
+
+ $('images').style.display = 'block';
} else {
- $("images").style.display = 'none';
- $("sysupgrade-image").style.display = "none";
- $("factory-image").style.display = "none";
- $("tftp-image").style.display = "none";
- $("kernel-image").style.display = "none";
- $("rootfs-image").style.display = "none";
+ $('images').style.display = 'none';
}
}