Skip to content
This repository was archived by the owner on Jan 10, 2021. It is now read-only.

Commit 17d2658

Browse files
committed
Only include logos that actually exist
This only adds an img tag to the generated page for services that a logo exists for.
1 parent 507b99e commit 17d2658

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

build/renderPages.js

+11-3
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,11 @@ function renderDetails(grunt, name, points, toslinks, obj) {
104104
grunt.log.writeln(toslinks);
105105
grunt.log.writeln(obj);
106106
//this renders one service (for instance 'Facebook' or 'Google') on our main index.html page:
107-
var header = '<h3><img src="logo/' + name + '.png" class="favlogo"><a class="modal-link" data-service-name="' + name + '" href="#' + name + '">' + obj.name + '</a>\n';
107+
var logo = '';
108+
if (grunt.file.exists(grunt.config.get('conf').src, 'logo', `${name}.png`)) {
109+
logo = `<img src="logo/${name}.png" class="favlogo">`;
110+
}
111+
var header = '<h3>' + logo + '<a class="modal-link" data-service-name="' + name + '" href="#' + name + '">' + obj.name + '</a>\n';
108112
var rating;
109113
if (!obj.tosdr) {
110114
obj.tosdr = {rated:false};
@@ -203,9 +207,13 @@ function renderPopup(grunt, name, obj, points, links) {
203207
var longName = obj.name,
204208
domain = obj.url,
205209
verdict = obj.tosdr.rated,
206-
ratingText = getRatingText(obj.tosdr.rated);
210+
ratingText = getRatingText(obj.tosdr.rated),
211+
logo = '';
212+
if (grunt.file.exists(grunt.config.get('conf').src, 'logo', `${name}.png`)) {
213+
logo = `<img src="logo/${name}.png" alt="" class="pull-left favlogo" heigh="36">`;
214+
}
207215
var headerHtml = '<div class="modal-header"><button data-dismiss="modal" class="close" type="button">×</button>' +
208-
'<img src="logo/' + name + '.png" alt="" class="pull-left favlogo" height="36" >' +
216+
logo +
209217
'<h3>' + longName +
210218
'<small class="service-url">Share review <input class="share-link" type="text" value="https://tosdr.org/#' + name + '" readonly /></small>' +
211219
'</h3></div>\n';

0 commit comments

Comments
 (0)