Skip to content

Commit

Permalink
suppress low weight labels
Browse files Browse the repository at this point in the history
  • Loading branch information
dschwen committed Jan 30, 2021
1 parent ea726b6 commit c8f1d09
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
2 changes: 2 additions & 0 deletions wikiminiatlas_extern_dev.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
require( 'min/poly2tri.min.js' );
echo "\n";

require( 'medians.js' );
echo "\n";
require( 'wikiminiatlas_i18n.inc' );

if( true ) {
Expand Down
19 changes: 15 additions & 4 deletions wmacore_dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -1169,13 +1169,18 @@ function wikiminiatlasInstall(wma_widget, url_params)
}
// otherwise follow the link (allows for middle click opening the commons page)
}
}).attr('href', '//commons.wikimedia.org/wiki/File:' + n);
}).attr('href', 'https://commons.wikimedia.org/wiki/File:' + n);
}

tile.text('');
for (i=0; i<l.length; ++i) {
a = $('<a></a>');

if (wma_zoom <= 8) {
var lang = l[i].lang || 'commons'
if (l[i].wg < wma_median_weights[lang][wma_zoom]) continue;
}

if ("img" in l[i]) {
// thumbnails
thumbLink(a, l[i].img, l[i].w, l[i].h, l[i].m5);
Expand Down Expand Up @@ -1214,7 +1219,7 @@ function wikiminiatlasInstall(wma_widget, url_params)
// text labels
a.addClass('label').addClass('label' + l[i].style).addClass('label-'+l[i].lang).css(wmaLinkStyle)
.attr({
href: '//' + l[i].lang + '.wikipedia.org/wiki/' + l[i].page,
href: 'https://' + l[i].lang + '.wikipedia.org/wiki/' + l[i].page,
target: '_top'
})
.css({
Expand Down Expand Up @@ -1242,6 +1247,12 @@ function wikiminiatlasInstall(wma_widget, url_params)
a.text(l[i].name);
}

/*if (wma_zoom <= 8) {
var lang = l[i].lang || 'commons'
if (l[i].wg < wma_median_weights[lang][wma_zoom]/10) {
a.css('border', '2px solid red');
}
}*/
tile.append(a);
}
}
Expand Down Expand Up @@ -2081,8 +2092,8 @@ function wikiminiatlasInstall(wma_widget, url_params)
}

return m5 ?
'//upload.wikimedia.org/wikipedia/commons/thumb/' + m5[0] + '/' + m5 + '/' + img + '/' + getSize(w) + 'px-' + img :
'//commons.wikimedia.org/w/thumb.php?w=' + getSize(w) + '&f=' + img;
'https://upload.wikimedia.org/wikipedia/commons/thumb/' + m5[0] + '/' + m5 + '/' + img + '/' + getSize(w) + 'px-' + img :
'https://commons.wikimedia.org/w/thumb.php?w=' + getSize(w) + '&f=' + img;
}

function wmaCommonsImageClose()
Expand Down

0 comments on commit c8f1d09

Please sign in to comment.