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

Add option to change label font size #39

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
3 changes: 3 additions & 0 deletions src/_locales/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,9 @@
"Labels": {
"message": "Labels"
},
"labelFontSize": {
"message": "Label Font Size"
},
"addSiteButton": {
"message": "Add Site Button"
},
Expand Down
8 changes: 8 additions & 0 deletions src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,14 @@ <h1 data-locale="settingsTitle">Settings</h1>
</label>
</div>
</div>
<div class='row' id="labelContainer">
<div class='column'>
<label data-locale="labelFontSize">Label Font Size</label>
</div>
<div class='column controls'>
<input type="number" id="labelFontSize" value="14" size="1" class="settingsCtl">
</div>
</div>
<div class='row'>
<div class='column'>
<label data-locale="addSiteButton">Add Site Button</label>
Expand Down
1 change: 1 addition & 0 deletions src/js/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ let defaults = {
backgroundColor: '#111111',
largeTiles: true,
showTitles: true,
labelFontSize: 14,
showAddSite: true,
showFolders: true,
showSettingsBtn: true,
Expand Down
23 changes: 23 additions & 0 deletions src/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ const wallPaperEnabled = document.getElementById("wallpaper");
const previewContainer = document.getElementById("previewContainer");
const largeTilesInput = document.getElementById("largeTiles");
const showTitlesInput = document.getElementById("showTitles");
const labelContainer = document.getElementById("labelContainer");
const labelFontSizeInput = document.getElementById("labelFontSize");
const showCreateDialInput = document.getElementById("showCreateDial");
const showFoldersInput = document.getElementById("showFolders");
const showClockInput = document.getElementById("showClock");
Expand Down Expand Up @@ -117,6 +119,14 @@ function displayClock() {

displayClock();

// detect label settings
function changeLabelFontSize(){
var input = document.getElementById("labelFontSize").value;
document.getElementById("tileContainer").style.fontSize = input + "pt";
}

changeLabelFontSize();

function getBookmarks(folderId) {
browser.bookmarks.getChildren(folderId).then(result => {
if (folderId === speedDialId && !result.length && settings.showFolders) {
Expand Down Expand Up @@ -1008,6 +1018,7 @@ function applySettings() {
textColor_picker.value = settings.textColor;
textColor_picker_wrapper.style.backgroundColor = settings.textColor;
showTitlesInput.checked = settings.showTitles;
labelFontSizeInput.checked = settings.labelFontSize;
showCreateDialInput.checked = settings.showAddSite;
largeTilesInput.checked = settings.largeTiles;
showFoldersInput.checked = settings.showFolders;
Expand All @@ -1023,6 +1034,9 @@ function applySettings() {
if (settings.wallpaper) {
previewContainer.style.display = 'flex';
}
if (settings.showTitles) {
labelContainer.style.display = 'flex';
}

});
}
Expand All @@ -1033,6 +1047,7 @@ function saveSettings() {
settings.backgroundColor = color_picker.value;
settings.textColor = textColor_picker.value;
settings.showTitles = showTitlesInput.checked;
settings.labelFontSize = labelFontSizeInput.checked;
settings.showAddSite = showCreateDialInput.checked;
settings.largeTiles = largeTilesInput.checked;
settings.showFolders = showFoldersInput.checked;
Expand Down Expand Up @@ -1292,6 +1307,14 @@ wallPaperEnabled.onchange = function () {
}
};

showTitlesInput.onchange = function () {
if (this.checked) {
labelContainer.style.display = "flex";
} else {
labelContainer.style.display = "none";
}
};

// native handlers for folder tab target
function dragenterHandler(ev) {
// temporary fix for firefox < v92
Expand Down