Skip to content

Commit

Permalink
Fix glitches (#23)
Browse files Browse the repository at this point in the history
* fix minimum fontSize to 12px preventing major glitches

* fix tooltip i18n for service

* fix conflict between extension and service

* remove console.log

* remove default icon when asking for website
  • Loading branch information
Pierre-RA authored Oct 31, 2016
1 parent 790098b commit 6507079
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 10 deletions.
2 changes: 2 additions & 0 deletions toolbar/toolbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,9 @@ function setFontSize(variant) {
window.getComputedStyle(elements[i], null).getPropertyValue('line-height')
);
newSize = currentFontSize + variant;
newSize = newSize < 12 ? 12 : newSize;
newHeight = currentLineHeight + variant;
newHeight = newHeight < 12 ? 12 : newHeight;
elements[i].style.fontSize = newSize + 'px';
elements[i].style.lineHeight = newHeight + 'px';
}
Expand Down
8 changes: 6 additions & 2 deletions utils/js/lunette.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,18 +46,22 @@ function alterFont(document, font) {
/**
* Return the layout to its original style.
*/
function unalter(document) {
function unalter(document, url) {
// Fetch options
var options =
JSON.parse(window.localStorage.getItem(OPTIONS)) || {};

// If hash is defined, we revert to old style.
if (options.hash) {
if (!url && options.hash) {
document.documentElement.innerHTML = options.hash;
}

// Remove options
window.localStorage.removeItem(OPTIONS);

if (url) {
window.location = url;
}
}

/**
Expand Down
17 changes: 9 additions & 8 deletions web/views/layout.pug
Original file line number Diff line number Diff line change
Expand Up @@ -29,19 +29,20 @@ html
br
small.text-muted= i18n.appDescription.message
.btn-group(role='group', aria-label='...')
a.btn.btn-default.tooltip-nm(href=external, data-toggle='tooltip', data-placement='bottom', title='Voir la page optimisée pour les personnes ayant des problèmes de vision - Style Noir sur Blanc')
i.fa.fa-eye.fa-2x(aria-hidden='true')
a.btn.btn-default.tooltip-nm(href='javascript: alter(document, {style: \'normal\'});', data-toggle='tooltip', data-placement='bottom', title='Voir la page optimisée pour les personnes ayant des problèmes de vision - Style Noir sur Blanc')
if external
a.btn.btn-default.tooltip-nm(href='javascript: unalter(document, \'' + external + '\');', data-toggle='tooltip', data-placement='bottom', title=i18n.infoDefault.message)
i.fa.fa-eye.fa-2x(aria-hidden='true')
a.btn.btn-default.tooltip-nm(href='javascript: alter(document, {style: \'normal\'});', data-toggle='tooltip', data-placement='bottom', title=i18n.infoNormal.message)
i.fa.fa-low-vision.fa-2x(aria-hidden='true')
a.btn.btn-default.tooltip-bk(href='javascript: alter(document, {style: \'black\'});', data-toggle='tooltip', data-placement='bottom', title='Voir la page optimisée pour les personnes ayant des problèmes de vision - Style Blanc sur Noir')
a.btn.btn-default.tooltip-bk(href='javascript: alter(document, {style: \'black\'});', data-toggle='tooltip', data-placement='bottom', title=i18n.infoBlack.message)
i.fa.fa-low-vision.fa-2x(aria-hidden='true')
a.btn.btn-default.tooltip-bl(href='javascript: alter(document, {style: \'blue\'});', data-toggle='tooltip', data-placement='bottom', title='Voir la page optimisée pour les personnes ayant des problèmes de vision - Style Jaune sur Bleu')
a.btn.btn-default.tooltip-bl(href='javascript: alter(document, {style: \'blue\'});', data-toggle='tooltip', data-placement='bottom', title=i18n.infoBlue.message)
i.fa.fa-low-vision.fa-2x(aria-hidden='true')
a.btn.btn-default.tooltip-cy(href='javascript: alter(document, {style: \'cyan\'});', data-toggle='tooltip', data-placement='bottom', title='Voir la page optimisée pour les personnes ayant des problèmes de vision - Style Noir sur Bleu clair')
a.btn.btn-default.tooltip-cy(href='javascript: alter(document, {style: \'cyan\'});', data-toggle='tooltip', data-placement='bottom', title=i18n.infoCyan.message)
i.fa.fa-low-vision.fa-2x(aria-hidden='true')
a.btn.btn-default.tooltip-nm(href='javascript: alter(document, {font: \'smaller\'});', data-toggle='tooltip', data-placement='bottom', title='Diminuer la taille du texte')
a.btn.btn-default.tooltip-nm(href='javascript: alter(document, {font: \'smaller\'});', data-toggle='tooltip', data-placement='bottom', title=i18n.infoSmaller.message)
i.fa.fa-minus.fa-2x(aria-hidden='true')
a.btn.btn-default.tooltip-nm(href='javascript: alter(document, {font: \'bigger\'});', data-toggle='tooltip', data-placement='bottom', title='Augmenter la taille du texte')
a.btn.btn-default.tooltip-nm(href='javascript: alter(document, {font: \'bigger\'});', data-toggle='tooltip', data-placement='bottom', title=i18n.infoBigger.message)
i.fa.fa-plus.fa-2x(aria-hidden='true')

#ext-provisu-inner
Expand Down

0 comments on commit 6507079

Please sign in to comment.