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

allow setting a different extension than .jpg for router pictures #155

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
11 changes: 8 additions & 3 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,11 @@ var firmwarewizard = function() {
PREVIEW_PICTURES_DIR = config.preview_pictures;
}

var PREVIEW_PICTURES_EXT = '.jpg';
if(config.preview_pictures_ext !== undefined) {
PREVIEW_PICTURES_EXT = config.preview_pictures_ext;
}

var enabled_device_categories = ['recommended'];
if ("enabled_device_categories" in config) {
enabled_device_categories = config.enabled_device_categories;
Expand Down Expand Up @@ -502,7 +507,7 @@ var firmwarewizard = function() {
'version': version,
'location': location,
'size': size,
'preview': preview+".jpg",
'preview': preview,
'category': device.category
});
}
Expand Down Expand Up @@ -670,7 +675,7 @@ var firmwarewizard = function() {

var image = document.createElement('img');

image.src = PREVIEW_PICTURES_DIR+images[vendor][model][latestRevisionIndex].preview;
image.src = PREVIEW_PICTURES_DIR+images[vendor][model][latestRevisionIndex].preview+PREVIEW_PICTURES_EXT;
image.alt = name;
image.addEventListener('error', firmwarewizard.setDefaultImg);

Expand Down Expand Up @@ -698,7 +703,7 @@ var firmwarewizard = function() {
}

function setDefaultImg(e) {
fallbackImg = PREVIEW_PICTURES_DIR+'no_picture_available.jpg';
fallbackImg = 'pictures/no_picture_available.jpg';
if (e.target.src.indexOf(fallbackImg) == -1) {
e.target.src = fallbackImg;
}
Expand Down
1 change: 1 addition & 0 deletions config_template.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ var config = {
experimental_branches: ['experimental'],
// path to preview pictures directory
preview_pictures: 'pictures/',
preview_pictures_ext: '.jpg',
// link to changelog
changelog: 'CHANGELOG.html',
// links for instructions like flashing of certain devices (optional)
Expand Down