diff --git a/src/_locales/en/messages.json b/src/_locales/en/messages.json index e6ea937..c112f83 100644 --- a/src/_locales/en/messages.json +++ b/src/_locales/en/messages.json @@ -9,8 +9,13 @@ "description": "Text of add bookmark menu item." }, - "menuAddBookmark": { - "message": "Add Bookmark", + "menuNew": { + "message": "New", + "description": "Text of new menu item." + }, + + "menuNewBookmark": { + "message": "Bookmark", "description": "Text of add bookmark menu item." }, @@ -19,8 +24,8 @@ "description": "Text of the add bookmark prompt." }, - "menuAddFolder": { - "message": "Add Folder", + "menuNewFolder": { + "message": "Folder", "description": "Text of add folder menu item." }, diff --git a/src/_locales/fr/messages.json b/src/_locales/fr/messages.json index b66e9cd..c701c87 100644 --- a/src/_locales/fr/messages.json +++ b/src/_locales/fr/messages.json @@ -9,8 +9,13 @@ "description": "Text of add bookmark menu item." }, - "menuAddBookmark": { - "message": "Ajouter un marque-page", + "menuNew": { + "message": "Nouveau", + "description": "Text of new menu item." + }, + + "menuNewBookmark": { + "message": "Marque-page", "description": "Text of add bookmark menu item." }, @@ -19,8 +24,8 @@ "description": "Text of the add bookmark prompt." }, - "menuAddFolder": { - "message": "Ajouter un dossier", + "menuNewFolder": { + "message": "Dossier", "description": "Text of add folder menu item." }, diff --git a/src/html/settings.html b/src/html/settings.html index a07f18e..0055d8e 100644 --- a/src/html/settings.html +++ b/src/html/settings.html @@ -6,75 +6,111 @@ Quick Dial Settings -

Page :

- - - - - - - - - -
Background Color :
Background Image : - - -
-

Grid :

- - - - - - - - - -
Rows x Columns : - - -
Margins :
-

Grid Cells:

- - - - - - - - - - - - - - - - - +
+
Default :Hover :
Margins :
Border Radius:
+ + + + + + +
PageGridCells
+
+
+ + + + + + + + + + + + + +
Background Color :
Background Image : + + +
Preview :
+
+ + +
+ - - Border Color: - - - - - - Title Color: - - - - - - - -
+
diff --git a/src/js/background.js b/src/js/background.js index 003401b..64db6a8 100644 --- a/src/js/background.js +++ b/src/js/background.js @@ -21,11 +21,13 @@ core.Settings.load = function(callback){ // Load settings columns: 5, cells: { margin: 4, + marginHover: 4, ratioX: 4, ratioY: 3, borderColor: '#333333', borderColorHover: '#a9a9a9', borderRadius: 4, + borderRadiusHover: 4, title: true, titleHeight: 16, titleFontSize: 10, diff --git a/src/js/dial.js b/src/js/dial.js index 980aa17..1118236 100644 --- a/src/js/dial.js +++ b/src/js/dial.js @@ -15,10 +15,6 @@ window.onload = function(){ switch(request.command){ case 'SettingsChanged': if(app.settings){ - /* - dial.styles.body.backgroundColor = app.settings.backgroundColor; - dial.styles.body.backgroundImage = app.settings.backgroundImage; - */ dial.Head.removeChild(dial.Style); dial.Body.removeChild(dial.Grid); dial.initStyles(); @@ -98,8 +94,9 @@ dial.initStyles = function(){ dial.styles.grid = {}; dial.styles.grid.grid = dial.Style.sheet.cssRules[dial.Style.sheet.insertRule('.Grid { border-collapse: collapse; margin: auto; }')].style; dial.styles.grid.cell = dial.Style.sheet.cssRules[dial.Style.sheet.insertRule('.Grid td { margin: 0px; padding: 0px; }')].style; - dial.styles.grid.link = dial.Style.sheet.cssRules[dial.Style.sheet.insertRule('.Grid td>a { display: block; outline: none; text-decoration: none; margin: ' + app.settings.grid.cells.margin + 'px; border: 1px solid ' + app.settings.grid.cells.borderColor + '; border-radius: ' + app.settings.grid.cells.borderRadius + 'px; }')].style; - dial.styles.grid.linkHover = dial.Style.sheet.cssRules[dial.Style.sheet.insertRule('.Grid td>a:hover { border-color: ' + app.settings.grid.cells.borderColorHover + '; }')].style; + dial.styles.grid.link = dial.Style.sheet.cssRules[dial.Style.sheet.insertRule('.Grid td>a { display: block; outline: none; overflow: hidden; text-decoration: none; margin: ' + app.settings.grid.cells.margin + 'px; border: 1px solid ' + app.settings.grid.cells.borderColor + '; border-radius: ' + app.settings.grid.cells.borderRadius + 'px; }')].style; + //dial.styles.grid.linkHover = dial.Style.sheet.cssRules[dial.Style.sheet.insertRule('.Grid td>a:hover { border-color: ' + app.settings.grid.cells.borderColorHover + '; border-radius: ' + app.settings.grid.cells.borderRadiusHover + 'px; }')].style; + dial.styles.grid.linkHover = dial.Style.sheet.cssRules[dial.Style.sheet.insertRule('.Grid td>a:hover { border-color: ' + app.settings.grid.cells.borderColorHover + '; margin: ' + app.settings.grid.cells.marginHover + 'px; border-radius: ' + app.settings.grid.cells.borderRadiusHover + 'px; }')].style; dial.styles.grid.linkPanel = dial.Style.sheet.cssRules[dial.Style.sheet.insertRule('.Grid td>a>div:first-child { background-repeat: no-repeat; }')].style; dial.styles.grid.linkTitle = dial.Style.sheet.cssRules[dial.Style.sheet.insertRule('.Grid td>a>div:last-child { height: ' + app.settings.grid.cells.titleHeight + 'px; font-size: ' + app.settings.grid.cells.titleFontSize + 'pt; font-family: ' + app.settings.grid.cells.titleFont + 'pt; text-align: center; overflow: hidden; color: ' + app.settings.grid.cells.titleColor + '; border-top: 1px solid ' + app.settings.grid.cells.borderColor + '; }')].style; dial.styles.grid.linkTitleHover = dial.Style.sheet.cssRules[dial.Style.sheet.insertRule('.Grid td>a:hover>div:last-child { color: ' + app.settings.grid.cells.titleColorHover + '; border-top-color: ' + app.settings.grid.cells.borderColorHover + ' }')].style; @@ -114,18 +111,21 @@ dial.initMenus = function(){ dial.PageMenu = document.createElement('menu'); dial.PageMenu.type = 'context'; dial.PageMenu.id = 'page' + dial.PageMenuNew = document.createElement('menu'); + dial.PageMenuNew.label = browser.i18n.getMessage("menuNew"); dial.PageMenuCreateBookmark = document.createElement('menuitem'); - dial.PageMenuCreateBookmark.label = 'Add bookmark'; + dial.PageMenuCreateBookmark.label = browser.i18n.getMessage("menuNewBookmark"); dial.PageMenuCreateBookmark.onclick = dial.createBookmark; dial.PageMenuCreateFolder = document.createElement('menuitem'); - dial.PageMenuCreateFolder.label = 'Add folder'; + dial.PageMenuCreateFolder.label = browser.i18n.getMessage("menuNewFolder"); dial.PageMenuCreateFolder.onclick = dial.createFolder; dial.PageMenuSettings = document.createElement('menuitem'); dial.PageMenuSettings.label = browser.i18n.getMessage("menuSettings"); dial.PageMenuSettings.onclick = dial.editSettings; - dial.PageMenu.appendChild(dial.PageMenuCreateBookmark); - dial.PageMenu.appendChild(dial.PageMenuCreateFolder); + dial.PageMenu.appendChild(dial.PageMenuNew); + dial.PageMenuNew.appendChild(dial.PageMenuCreateBookmark); + dial.PageMenuNew.appendChild(dial.PageMenuCreateFolder); dial.PageMenu.appendChild(document.createElement('hr')); dial.PageMenu.appendChild(dial.PageMenuSettings); dial.Body.appendChild(dial.PageMenu); @@ -133,11 +133,15 @@ dial.initMenus = function(){ dial.ItemMenu = document.createElement('menu'); dial.ItemMenu.type = 'context'; dial.ItemMenu.id = 'item' + + dial.ItemMenuNew = document.createElement('menu'); + dial.ItemMenuNew.label = browser.i18n.getMessage("menuNew"); + dial.ItemMenuCreateBookmark = document.createElement('menuitem'); - dial.ItemMenuCreateBookmark.label = browser.i18n.getMessage("menuAddBookmark"); + dial.ItemMenuCreateBookmark.label = browser.i18n.getMessage("menuNewBookmark"); dial.ItemMenuCreateBookmark.onclick = dial.createBookmark; dial.ItemMenuCreateFolder = document.createElement('menuitem'); - dial.ItemMenuCreateFolder.label = browser.i18n.getMessage("menuAddFolder"); + dial.ItemMenuCreateFolder.label = browser.i18n.getMessage("menuNewFolder"); dial.ItemMenuCreateFolder.onclick = dial.createFolder; /* dial.ItemMenuEdit = document.createElement('menuitem'); @@ -160,8 +164,9 @@ dial.initMenus = function(){ dial.ItemMenuSettings.label = browser.i18n.getMessage("menuSettings"); dial.ItemMenuSettings.onclick = dial.editSettings; - dial.ItemMenu.appendChild(dial.ItemMenuCreateBookmark); - dial.ItemMenu.appendChild(dial.ItemMenuCreateFolder); + dial.ItemMenu.appendChild(dial.ItemMenuNew); + dial.ItemMenuNew.appendChild(dial.ItemMenuCreateBookmark); + dial.ItemMenuNew.appendChild(dial.ItemMenuCreateFolder); dial.ItemMenu.appendChild(document.createElement('hr')); //dial.ItemMenu.appendChild(dial.ItemMenuEdit); dial.ItemMenu.appendChild(dial.ItemMenuRefresh); @@ -232,10 +237,13 @@ dial.updateGridLayout = function(grid, settings, styles){ var linkHeight = fullHeight / settings.rows; if(linkWidth <= linkHeight * settings.cells.ratioX / settings.cells.ratioY) linkHeight = linkWidth / settings.cells.ratioX * settings.cells.ratioY; else linkWidth = linkHeight / settings.cells.ratioY * settings.cells.ratioX; + styles.cell.width = linkWidth.toString() + 'px'; styles.cell.height = linkHeight.toString() + 'px'; + linkWidth = linkWidth - 2 * (settings.cells.margin + 1); linkHeight = linkHeight - 2 * (settings.cells.margin + 1); + styles.link.width = linkWidth.toString() + 'px'; styles.link.height = linkHeight.toString() + 'px'; if(settings.cells.title) styles.linkPanel.height = (linkHeight - settings.cells.titleHeight - 1).toString() + 'px'; diff --git a/src/js/settings.js b/src/js/settings.js index 6507f88..9b120ec 100644 --- a/src/js/settings.js +++ b/src/js/settings.js @@ -5,31 +5,26 @@ window.onload = function(){ app = page.app; BackgroundColor.value = app.settings.backgroundColor; BackgroundImage = app.settings.backgroundImage; + BackgroundPreview.style.backgroundColor = app.settings.backgroundColor; + BackgroundPreview.style.backgroundImage = app.settings.backgroundImage; + BackgroundPreview.style.backgroundRepeat = 'no-repeat'; + BackgroundPreview.style.backgroundSize = '100% 100%'; GridRows.value = app.settings.grid.rows; GridMargins.value = app.settings.grid.margin; GridColumns.value = app.settings.grid.columns; GridCellsMargins.value = app.settings.grid.cells.margin; + GridCellsMarginsHover.value = app.settings.grid.cells.marginHover; GridCellsBorderRadius.value = app.settings.grid.cells.borderRadius; + GridCellsBorderRadiusHover.value = app.settings.grid.cells.borderRadiusHover; GridCellsBorderColor.value = app.settings.grid.cells.borderColor; GridCellsBorderColorHover.value = app.settings.grid.cells.borderColorHover; + GridCellsTitle.checked = app.settings.grid.cells.title; + GridCellsTitleHeight.value = app.settings.grid.cells.titleHeight; + GridCellsTitleFontSize.value = app.settings.grid.cells.titleFontSize; GridCellsTitleColor.value = app.settings.grid.cells.titleColor; GridCellsTitleColorHover.value = app.settings.grid.cells.titleColorHover; }); - BackgroundImageClear.onclick = function(){ - BackgroundImage = null; - } - BackgroundImageFile.onclick = function(){ - this.value = null; - } - BackgroundImageFile.onchange = function(){ - var fileReader = new FileReader(); - fileReader.onload = function(e){ - BackgroundImage = 'url(' + e.target.result + ')'; - } - fileReader.readAsDataURL(BackgroundImageFile.files[0]); - } - BtnOk.onclick = function(){ BtnApply.onclick(); window.frameElement.popup.close(); @@ -41,9 +36,15 @@ window.onload = function(){ app.settings.grid.margin = +(GridMargins.value); app.settings.grid.columns = +(GridColumns.value); app.settings.grid.cells.margin = +(GridCellsMargins.value); + //app.settings.grid.cells.marginHover = +(GridCellsMarginsHover.value); + app.settings.grid.cells.marginHover = +(GridCellsMargins.value); app.settings.grid.cells.borderRadius = +(GridCellsBorderRadius.value); + app.settings.grid.cells.borderRadiusHover = +(GridCellsBorderRadiusHover.value); app.settings.grid.cells.borderColor = GridCellsBorderColor.value; app.settings.grid.cells.borderColorHover = GridCellsBorderColorHover.value; + app.settings.grid.cells.title = GridCellsTitle.checked; + app.settings.grid.cells.titleHeight = GridCellsTitleHeight.value; + app.settings.grid.cells.titleFontSize = GridCellsTitleFontSize.value; app.settings.grid.cells.titleColor = GridCellsTitleColor.value; app.settings.grid.cells.titleColorHover = GridCellsTitleColorHover.value; app.saveSettings(); @@ -51,4 +52,41 @@ window.onload = function(){ BtnCancel.onclick = function(){ window.frameElement.popup.close(); } + + var tabButtons = Tabs.children[0].children[0].children[0]; + for(var i=0; i