Compare commits

..
97 Commits
Author SHA1 Message Date
matmoul e16698ad39 Version 0.1.25 2026-11-16 22:54:33 +01:00
MatMoul 01cb753277 Merge pull request #195 from xan2622/fix-back-button
Fix Back button not returning to the parent folder
2026-11-16 22:50:55 +01:00
xan2622 f32a72210c Fix Back button not returning to the parent folder
The Back link used href="#" with an onclick calling history.back()
without preventing the default action: the fragment navigation was
applied before the asynchronous history traversal, which then only went
back to the same folder URL without '#'.

The Back link now targets the parent folder, so it also works when the
folder was opened in a new tab (no usable history). On a plain click,
when the previous history entry is the parent folder (checked with the
Navigation API when available), it goes back in history instead, so no
extra entry is added and the parent page state is restored. If the
traversal fails, the direct link is used. Modified clicks keep the
default link behavior.

Grid cells now reset their link target with removeAttribute('target'):
'delete link.target' is a no-op on an HTMLAnchorElement, so a cell that
had held a bookmark opened in a new tab kept target="_blank" after
paging, and a folder later shown there opened in a new tab despite the
'open folder' setting.

The dial URL building is shared by folder and Back links through
utils.getDialUrl, removing an unreachable branch (dial.path is never
empty).
2026-11-12 20:09:33 +01:00
MatMoul b1f76dadde Merge pull request #193 from manner82/fix/issue-192-context-menus-sendmessage
Fix context menus on dial page for Firefox 152+ (replace deprecated tabs.executeScript)
2026-06-28 15:34:52 +02:00
Robert Manner 7dc29e5a70 Version 0.1.24 2026-06-25 09:25:59 +02:00
Robert Manner 3fd4cd6d3b js: replace deprecated tabs.executeScript with tabs.sendMessage
The dial-page context menus invoked window.dial.* functions via
browser.tabs.executeScript. That API is deprecated since Firefox 149 and
removed in Firefox 152, which broke creating/editing bookmarks and folders
from the dial page (issue #192).

Switch the menu handlers to browser.tabs.sendMessage. New menu command IDs
(200-207) are added to the Commands enum in both background.js and dial.js,
and the existing runtime.onMessage listener in dial.js now dispatches these
commands to the corresponding dial.* functions using the page-side
_selectedItem state.

Fixes #192
2026-06-24 12:42:21 +02:00
matmoul 42800d31c1 Version 0.1.23 2026-02-25 22:48:40 +01:00
matmoul 9cab257540 Fix iframe onload event positioning 2026-02-25 22:48:17 +01:00
matmoul 5a8e8bb745 Version 0.1.22 2026-02-25 18:45:42 +01:00
matmoul 8a54056392 fix:ESR compatibility 2026-02-25 18:45:05 +01:00
matmoul 20c106d5fa Version 0.1.21 2026-02-25 01:49:12 +01:00
matmoul 137bd470cf Fix: Replace 'dial' with 'dial.html' in URL paths and context menu patterns 2026-02-25 01:35:46 +01:00
matmoul a312b0b2d4 Rename dial to dial.html, update background.js to use dial.html URL, modify manifest.json to use dial.html for newtab and add data_collection_permissions 2026-02-25 01:07:47 +01:00
matmoul 806e134b52 Version 0.1.20 2021-01-30 15:12:34 +01:00
matmoul 633c5756a1 Patch Context Menu 2021-01-30 15:09:03 +01:00
MatMoul d2ea81d2ca Merge pull request #165 from tamiros/locale/hebrew
Locale/hebrew
2021-01-27 20:04:19 +01:00
Tamir 86f8063b11 missed one 2021-01-27 10:53:56 +02:00
Tamir 95a1ca420d added heberw translation 2021-01-27 10:46:09 +02:00
matmoul 41fc29660f Version 0.1.19 2019-03-17 19:05:31 +01:00
matmoul 725ad53d92 Merge pull request #122 from WaldiSt/patch-1
Translation to Polish language
2019-01-23 00:08:02 +01:00
Waldemar Stoczkowski 929431e66f Translation to Polish language
Added translation to Polish language
2019-01-20 11:46:47 +01:00
matmoul 75a6649b6c Version 0.1.18 2019-01-03 21:09:25 +01:00
matmoul 941772844a Add startpage timeout settings 2019-01-03 21:06:23 +01:00
matmoul cc1006042d Merge pull request #117 from de-es/de-es-patch-1
Remove pt from font-family
2018-12-26 00:15:15 +01:00
matmoul f992b75f45 Merge pull request #114 from Gonimy-Vetrom/patch-1
Add Ukrainian
2018-12-26 00:14:53 +01:00
de-es 3a3337b19c Remove pt from font-family 2018-12-11 00:16:55 +01:00
Gonimy-Vetrom ab3072cc21 Create messages.json 2018-11-13 17:21:31 +02:00
matmoul 5bc78f7da6 Version 0.1.17 2018-10-21 23:27:31 +02:00
matmoul 67fea9aa9c Bug Can move tile when this is the first added item 2018-10-21 22:47:59 +02:00
matmoul c68d2d4cfb Version 0.1.16 2018-10-21 16:04:55 +02:00
matmoul f07e530446 Bug Startpage not loaded 2018-10-21 16:03:50 +02:00
matmoul 8abd79bc5f Version 0.1.15 2018-10-21 04:37:05 +02:00
matmoul 723724f50b Bug White page on first install 2018-10-21 04:36:25 +02:00
matmoul ddd081672f Update makebeta 2018-10-21 04:11:04 +02:00
matmoul e03e684fb7 Version 0.1.14 2018-10-21 02:07:08 +02:00
matmoul 14ed1f4dd6 Patch Quick Dial as start page 2018-10-21 02:01:02 +02:00
matmoul 7ccd9be787 Merge pull request #69 from eridanired/patch-1
Add Spanish translation
2017-12-11 19:51:41 +01:00
Eridani 67d950bfea Add Spanish translation 2017-12-09 11:30:43 -06:00
matmoul ff0eebed69 Version 0.1.13 2017-11-26 19:02:25 +01:00
matmoul 9fdcc91ec6 Project: Remove description from manifest 2017-11-26 18:52:07 +01:00
matmoul 39ab845d58 Feature: Toolbar button can now open Quick Dial on current dial 2017-11-26 16:33:47 +01:00
matmoul 6815551c8c Feature: Add open in new tab for tiles 2017-11-26 15:47:22 +01:00
matmoul ce82a4c67e Version 0.1.12 2017-11-26 15:04:11 +01:00
matmoul 72ab3e5f6b Bug: Convert separator to empty cell 2017-11-26 13:20:10 +01:00
matmoul beb52273a2 Bug: Can't set cutom image on folder 2017-11-26 13:04:14 +01:00
matmoul 2e5bbce72f Version 0.1.11 2017-11-24 22:50:35 +01:00
matmoul ddbd2f40c8 Feature: Lock settings for image on tiles 2017-11-24 22:36:53 +01:00
matmoul 63569851d8 Feature: Option to diable context menu items 2017-11-24 21:54:08 +01:00
matmoul 88b6a8d45d Merge pull request #61 from fernandosantucci/develop
Add Brazilian Portuguese translation
2017-11-22 19:16:26 +00:00
fernandosantucci 7b6e112038 Add Brazilian Portuguese translation 2017-11-22 12:21:55 -02:00
matmoul ee310a9546 Merge pull request #49 from Faenriis/develop
Add Serbian translation
2017-11-19 18:22:34 +01:00
Xabre e400d07f01 Add Serbian translation 2017-11-19 14:19:49 +01:00
matmoul d8620464a3 Version 0.1.10 2017-11-19 01:05:43 +01:00
matmoul 1a71f96a91 Feature disabled: Auto ratio dont provide a stable solution 2017-11-19 00:56:00 +01:00
matmoul 45f7e60fb8 Improvement: Invert Ratio X,Y field in settings 2017-11-18 23:59:39 +01:00
matmoul 190d54a0f1 Bug: Settings page save problem 2017-11-18 23:47:05 +01:00
matmoul 05a78e2d63 Feature: Add custom ratio settings 2017-11-18 23:16:49 +01:00
matmoul 1ba60232f2 Version 0.1.9 2017-11-18 01:42:13 +01:00
matmoul eaf451c957 Code: Remove TODO, look now at issue 2017-11-18 01:02:32 +01:00
matmoul b2bb50d95e Feature: Add snapshot delay setting 2017-11-18 00:17:36 +01:00
matmoul a9a4212299 Improvement: Tile and snapshot relative to grid size 2017-11-18 00:06:49 +01:00
matmoul 7b0ac506d8 Bug: Transparent hover tile background doesn't has effect 2017-11-17 23:34:44 +01:00
matmoul 93a384b765 Version 0.1.8 2017-11-12 20:26:12 +01:00
matmoul 6cad651ee4 Improvement: Update default title height 2017-11-12 19:48:30 +01:00
matmoul 178627aa51 Project: Update git ignore 2017-11-12 17:04:00 +01:00
matmoul 0eae0a9919 Project: Update build scripts 2017-11-12 16:46:24 +01:00
matmoul 66418995b8 Project: Update build scripts 2017-11-12 16:39:37 +01:00
matmoul 17739110ff Bug: Updating bookmark url don't refresh tile 2017-11-12 16:13:13 +01:00
matmoul a64561835c Bug: Prevent drag drop from unmanaged data 2017-11-12 16:03:01 +01:00
matmoul 0be3f1df96 Bug: Editing bookmark url don't update tile url 2017-11-12 15:01:26 +01:00
matmoul 71df90fad4 Version 0.1.7 2017-11-11 15:53:28 +01:00
matmoul e300ae2142 Bug: Data not correclty upgraded 2017-11-11 15:34:34 +01:00
matmoul accb853a85 Bug: Tile instable when resizing to speed 2017-11-11 15:30:03 +01:00
matmoul 2a12e35320 Data: Version upgrade 2017-11-11 15:10:58 +01:00
matmoul 827680c906 Improvement: Handle Bookmark large change or restore 2017-11-11 14:19:41 +01:00
matmoul dedd421b85 Feature: Add stretch mode to each tiles 2017-11-11 02:59:25 +01:00
matmoul f3285e790d Feature: Add stretch mode for back and folder icon 2017-11-11 01:13:34 +01:00
matmoul 2aebed015f Feature: Add stretch mode for back and folder icon 2017-11-11 01:11:08 +01:00
matmoul 07dfa858e8 Feature: Add stretch mode for background 2017-11-11 00:44:56 +01:00
matmoul 5e07132316 Improvement: Bookmarks sync 2017-11-10 23:40:13 +01:00
matmoul 63c06fe5a5 Improvement: Bookmarks sync 2017-11-10 23:32:53 +01:00
matmoul dd95e95b20 Improvement: Update bookmark when setting tile parameters 2017-11-10 22:48:12 +01:00
matmoul 7f719497dc Feature Disabled: Capture here has too poor quality 2017-11-10 22:26:42 +01:00
matmoul 1592569ada Feature: Add support of default and hover state of all properties 2017-11-10 21:56:36 +01:00
matmoul 3156068ca7 Improvement: Add limit to input number 2017-11-10 20:55:12 +01:00
matmoul 1a608b634f Feature: Add opacity setting for tiles 2017-11-10 20:45:52 +01:00
matmoul 356bf74e8d Feature: Add border size setting for tiles 2017-11-10 20:34:19 +01:00
matmoul 0b59809758 Version 0.1.6 2017-11-03 21:21:12 +01:00
matmoul f387c3662f Feature: Add page up and page down to change page 2017-11-03 21:11:57 +01:00
matmoul dbbf5ff718 Feature: Add page up and page down to change page 2017-11-03 21:02:57 +01:00
matmoul 33c227a5a4 Merge branch 'patch-1' of https://github.com/Alexey71/quickdial-webext into Alexey71-patch-1 2017-11-03 20:54:11 +01:00
matmoul 351d043094 Improvement: Limit sync bookmark surcharge 2017-11-03 20:52:41 +01:00
Alexey b99ee356f0 Add Russian string 2017-11-01 15:35:47 +03:00
matmoul 340a84730e Merge pull request #22 from mrprobot/develop
add german translation
2017-10-26 21:10:41 +02:00
mrprobot ddd57dd446 add german translation 2017-10-25 13:04:20 +02:00
mrprobot 4a510a1a86 add german translation 2017-10-25 12:55:37 +02:00
matmoul 170b1a7dc6 Improvement: Add new capture method (Capture here) 2017-10-22 16:36:06 +02:00
23 changed files with 1477 additions and 172 deletions

No files matched your search

+1
View File
@@ -1 +1,2 @@
**/src.zip **/src.zip
/*.zip
-5
View File
@@ -1,5 +0,0 @@
Create style for popup
Add a visual hint for multipage
Need a best solution to update folder and bookmark when it are updated from Firefox
Improve screenshot result
Add favicon support
Executable
+44
View File
@@ -0,0 +1,44 @@
#!/bin/bash
if [ "$1" == "" ]; then
echo "Error: No version provided"
echo "./makebeta 0.0.1b1"
exit 1
fi
clear
branch=$(git rev-parse --abbrev-ref HEAD)
read -p "Current branch is $branch. Continue ? (y/N)" choice
case "$choice" in
n|N|'' )
echo "Cancel !"
exit 1
;;
y|Y ) echo "Make beta...";;
* )
echo "Cancel !"
exit 1
;;
esac
# Ready to update :
git branch beta
git checkout beta
version=$1
sed -i "/\"version\":/c\ \ \"version\": \"$version\"," src/manifest.json
sed -i 's/quickdial@matmoul.com/quickdialtest@matmoul.com/' src/manifest.json
git commit -a -m "Beta Version $version"
cd src
zip -r ../quickdial-beta-$version.zip . -x src.zip
cd ..
git checkout $branch
git branch -D beta
+4
View File
@@ -46,3 +46,7 @@ git tag -a "v$version" -m "Version $version"
git push --tags git push --tags
git checkout $branch git checkout $branch
cd src
zip -r ../quickdial-$version.zip . -x src.zip
cd ..
+67
View File
@@ -0,0 +1,67 @@
{
"menuAddToQuickDial": {
"message": "Zu Quick Dial hinzufügen",
"description": "Text of add bookmark menu item."
},
"menuNew": {
"message": "Neu",
"description": "Text of new menu item."
},
"menuNewBookmark": {
"message": "Lesezeichen",
"description": "Text of add bookmark menu item."
},
"AddBookmarkPrompt": {
"message": "Neue Lesezeichen URL eingeben:",
"description": "Text of the add bookmark prompt."
},
"menuNewFolder": {
"message": "Ordner",
"description": "Text of add folder menu item."
},
"AddFolderPrompt": {
"message": "Neuen Ordner Namen eingeben:",
"description": "Text of the add folder prompt."
},
"menuProperties": {
"message": "Bearbeiten",
"description": "Text of properties menu item."
},
"menuRefreshItem": {
"message": "Neu laden",
"description": "Text of refresh menu item."
},
"menuCaptureHere": {
"message": "Hier aufnehmen",
"description": "Text of capture here menu item."
},
"menuCapturePage": {
"message": "In einem neuen Tab aufnehmen",
"description": "Text of capture menu item."
},
"menuDeleteItem": {
"message": "Löschen",
"description": "Text of delete menu item."
},
"deleteItemConfimation": {
"message": "Löschen $1?",
"description": "Text of delete confirmation."
},
"menuSettings": {
"message": "Quick Dial Einstellungen",
"description": "Text of settings menu item."
}
}
+5 -5
View File
@@ -1,9 +1,4 @@
{ {
"extensionDescription": {
"message": "Quick Dial, a dial page inspired from fast dial.",
"description": "Description of the extension."
},
"menuAddToQuickDial": { "menuAddToQuickDial": {
"message": "Add to Quick Dial", "message": "Add to Quick Dial",
"description": "Text of add bookmark menu item." "description": "Text of add bookmark menu item."
@@ -44,6 +39,11 @@
"description": "Text of refresh menu item." "description": "Text of refresh menu item."
}, },
"menuCaptureHere": {
"message": "Capture here",
"description": "Text of capture here menu item."
},
"menuCapturePage": { "menuCapturePage": {
"message": "Capture in a new tab", "message": "Capture in a new tab",
"description": "Text of capture menu item." "description": "Text of capture menu item."
+67
View File
@@ -0,0 +1,67 @@
{
"menuAddToQuickDial": {
"message": "Agregar a Quick Dial",
"description": "Text of add bookmark menu item."
},
"menuNew": {
"message": "Nuevo",
"description": "Text of new menu item."
},
"menuNewBookmark": {
"message": "Marcador",
"description": "Text of add bookmark menu item."
},
"AddBookmarkPrompt": {
"message": "Dirección del nuevo marcador:",
"description": "Text of the add bookmark prompt."
},
"menuNewFolder": {
"message": "Carpeta",
"description": "Text of add folder menu item."
},
"AddFolderPrompt": {
"message": "Nombre de la nueva carpeta:",
"description": "Text of the add folder prompt."
},
"menuProperties": {
"message": "Propiedades",
"description": "Text of properties menu item."
},
"menuRefreshItem": {
"message": "Actualizar",
"description": "Text of refresh menu item."
},
"menuCaptureHere": {
"message": "Capturar aquí",
"description": "Text of capture here menu item."
},
"menuCapturePage": {
"message": "Capturar en una nueva pestaña",
"description": "Text of capture menu item."
},
"menuDeleteItem": {
"message": "Eliminar",
"description": "Text of delete menu item."
},
"deleteItemConfimation": {
"message": "¿Eliminar $1 ?",
"description": "Text of delete confirmation."
},
"menuSettings": {
"message": "Propiedades de Quick Dial",
"description": "Text of settings menu item."
}
}
+5 -5
View File
@@ -1,9 +1,4 @@
{ {
"extensionDescription": {
"message": "Quick Dial, page dial inspirée de fast dial.",
"description": "Description of the extension."
},
"menuAddToQuickDial": { "menuAddToQuickDial": {
"message": "Ajouter à Quick Dial", "message": "Ajouter à Quick Dial",
"description": "Text of add bookmark menu item." "description": "Text of add bookmark menu item."
@@ -44,6 +39,11 @@
"description": "Text of refresh menu item." "description": "Text of refresh menu item."
}, },
"menuCaptureHere": {
"message": "Capturer ici",
"description": "Text of capture here menu item."
},
"menuCapturePage": { "menuCapturePage": {
"message": "Capturer dans un nouvel onglet", "message": "Capturer dans un nouvel onglet",
"description": "Text of capture menu item." "description": "Text of capture menu item."
+67
View File
@@ -0,0 +1,67 @@
{
"menuAddToQuickDial": {
"message": "הוסף לחיוג מהיר",
"description": "Text of add bookmark menu item."
},
"menuNew": {
"message": "חדש",
"description": "Text of new menu item."
},
"menuNewBookmark": {
"message": "מועדף",
"description": "Text of add bookmark menu item."
},
"AddBookmarkPrompt": {
"message": "הכנס קישור חדש למועדף :",
"description": "Text of the add bookmark prompt."
},
"menuNewFolder": {
"message": "תיקייה",
"description": "Text of add folder menu item."
},
"AddFolderPrompt": {
"message": "הכנס שם חדש לתיקייה :",
"description": "Text of the add folder prompt."
},
"menuProperties": {
"message": "מאפיינים",
"description": "Text of properties menu item."
},
"menuRefreshItem": {
"message": "רענן",
"description": "Text of refresh menu item."
},
"menuCaptureHere": {
"message": "צלם מסך כאן",
"description": "Text of capture here menu item."
},
"menuCapturePage": {
"message": "צלם מסך בלשונית חדשה",
"description": "Text of capture menu item."
},
"menuDeleteItem": {
"message": "מחק",
"description": "Text of delete menu item."
},
"deleteItemConfimation": {
"message": "האם למחוק $1 ?",
"description": "Text of delete confirmation."
},
"menuSettings": {
"message": "הגדרות חיוג מהיר",
"description": "Text of settings menu item."
}
}
-5
View File
@@ -1,9 +1,4 @@
{ {
"extensionDescription": {
"message": "Quick Dial, una dial page inspirata a fast dial.",
"description": "Description of the extension."
},
"menuAddToQuickDial": { "menuAddToQuickDial": {
"message": "Aggiungi a Quick Dial", "message": "Aggiungi a Quick Dial",
"description": "Text of add bookmark menu item." "description": "Text of add bookmark menu item."
+67
View File
@@ -0,0 +1,67 @@
{
"menuAddToQuickDial": {
"message": "Dodaj do Quick Dial",
"description": "Text of add bookmark menu item."
},
"menuNew": {
"message": "Nowy",
"description": "Text of new menu item."
},
"menuNewBookmark": {
"message": "Zakładka",
"description": "Text of add bookmark menu item."
},
"AddBookmarkPrompt": {
"message": "Wprowadź nowy adres URL zakładki:",
"description": "Text of the add bookmark prompt."
},
"menuNewFolder": {
"message": "Folder",
"description": "Text of add folder menu item."
},
"AddFolderPrompt": {
"message": "Wprowadź nazwę nowego folderu:",
"description": "Text of the add folder prompt."
},
"menuProperties": {
"message": "Właściwości",
"description": "Text of properties menu item."
},
"menuRefreshItem": {
"message": "Odśwież",
"description": "Text of refresh menu item."
},
"menuCaptureHere": {
"message": "Zdjęcie tutaj",
"description": "Text of capture here menu item."
},
"menuCapturePage": {
"message": "Zdjęcie na nowej karcie",
"description": "Text of capture menu item."
},
"menuDeleteItem": {
"message": "Usuń",
"description": "Text of delete menu item."
},
"deleteItemConfimation": {
"message": "Usuń $1 ?",
"description": "Text of delete confirmation."
},
"menuSettings": {
"message": "Ustawienia Quick Dial",
"description": "Text of settings menu item."
}
}
+67
View File
@@ -0,0 +1,67 @@
{
"menuAddToQuickDial": {
"message": "Adicionar ao Quick Dial",
"description": "Texto do iten de menu adicionar ao Quick Dial."
},
"menuNew": {
"message": "Novo",
"description": "Texto do item de menu novo."
},
"menuNewBookmark": {
"message": "Favorito",
"description": "Texto do iten de menu adicionar favorito."
},
"AddBookmarkPrompt": {
"message": "Entre com a url do novo favorito :",
"description": "Texto do rótulo adicionar favorito."
},
"menuNewFolder": {
"message": "Pasta",
"description": "Texto do item de menu adicionar pasta."
},
"AddFolderPrompt": {
"message": "Entre com o nome da nova pasta :",
"description": "Texto do rótulo adicionar pasta."
},
"menuProperties": {
"message": "Propriedades",
"description": "Texto do item de menu propriedades."
},
"menuRefreshItem": {
"message": "Atualizar",
"description": "Texto do item de menu atualizar."
},
"menuCaptureHere": {
"message": "Capturar aqui",
"description": "Texto do item de menu capturar aqui."
},
"menuCapturePage": {
"message": "Capturar em uma nova guia",
"description": "Texto do item de menu capturar em uma nova guia."
},
"menuDeleteItem": {
"message": "Excluir",
"description": "Texto do item de menu excluir."
},
"deleteItemConfimation": {
"message": "Excluir $1 ?",
"description": "Texto de confirmação da exclusão."
},
"menuSettings": {
"message": " Configurações do Quick Dial",
"description": "Texto do item de menu configurações."
}
}
+67
View File
@@ -0,0 +1,67 @@
{
"menuAddToQuickDial": {
"message": "Добавить в Quick Dial",
"description": "Text of add bookmark menu item."
},
"menuNew": {
"message": "Добавить",
"description": "Text of new menu item."
},
"menuNewBookmark": {
"message": "Закладку",
"description": "Text of add bookmark menu item."
},
"AddBookmarkPrompt": {
"message": "Введите URL-адрес новой закладки:",
"description": "Text of the add bookmark prompt."
},
"menuNewFolder": {
"message": "Папку",
"description": "Text of add folder menu item."
},
"AddFolderPrompt": {
"message": "Введите имя новой папки:",
"description": "Text of the add folder prompt."
},
"menuProperties": {
"message": "Свойства",
"description": "Text of properties menu item."
},
"menuRefreshItem": {
"message": "Обновить",
"description": "Text of refresh menu item."
},
"menuCaptureHere": {
"message": "Захватить здесь",
"description": "Text of capture here menu item."
},
"menuCapturePage": {
"message": "Захватить на новой вкладке",
"description": "Text of capture menu item."
},
"menuDeleteItem": {
"message": "Удалить",
"description": "Text of delete menu item."
},
"deleteItemConfimation": {
"message": "Удалить $1?",
"description": "Text of delete confirmation."
},
"menuSettings": {
"message": "Настройки Quick Dial",
"description": "Text of settings menu item."
}
}
+67
View File
@@ -0,0 +1,67 @@
{
"menuAddToQuickDial": {
"message": "Додај у брзо бирање",
"description": "Text of add bookmark menu item."
},
"menuNew": {
"message": "Нова",
"description": "Text of new menu item."
},
"menuNewBookmark": {
"message": "Забелешка",
"description": "Text of add bookmark menu item."
},
"AddBookmarkPrompt": {
"message": "Унесите УРЛ нове забелешке :",
"description": "Text of the add bookmark prompt."
},
"menuNewFolder": {
"message": "Фасцикла",
"description": "Text of add folder menu item."
},
"AddFolderPrompt": {
"message": "Унесите име нове фасцикле :",
"description": "Text of the add folder prompt."
},
"menuProperties": {
"message": "Својства",
"description": "Text of properties menu item."
},
"menuRefreshItem": {
"message": "Обнови",
"description": "Text of refresh menu item."
},
"menuCaptureHere": {
"message": "Ухвати овде",
"description": "Text of capture here menu item."
},
"menuCapturePage": {
"message": "Ухвати у новом језичку",
"description": "Text of capture menu item."
},
"menuDeleteItem": {
"message": "Обриши",
"description": "Text of delete menu item."
},
"deleteItemConfimation": {
"message": "Обрисати $1 ?",
"description": "Text of delete confirmation."
},
"menuSettings": {
"message": "Подешавање брзог бирања",
"description": "Text of settings menu item."
}
}
+67
View File
@@ -0,0 +1,67 @@
{
"menuAddToQuickDial": {
"message": "Додати до Quick Dial",
"description": "Text of add bookmark menu item."
},
"menuNew": {
"message": "Додати",
"description": "Text of new menu item."
},
"menuNewBookmark": {
"message": "Закладку",
"description": "Text of add bookmark menu item."
},
"AddBookmarkPrompt": {
"message": "Введіть URL-адресу нової закладки:",
"description": "Text of the add bookmark prompt."
},
"menuNewFolder": {
"message": "Папку",
"description": "Text of add folder menu item."
},
"AddFolderPrompt": {
"message": "Введіть им'я нової папки:",
"description": "Text of the add folder prompt."
},
"menuProperties": {
"message": "Властивості",
"description": "Text of properties menu item."
},
"menuRefreshItem": {
"message": "Оновити",
"description": "Text of refresh menu item."
},
"menuCaptureHere": {
"message": "Захватити тут",
"description": "Text of capture here menu item."
},
"menuCapturePage": {
"message": "Захватити на новій вкладці",
"description": "Text of capture menu item."
},
"menuDeleteItem": {
"message": "Видалити",
"description": "Text of delete menu item."
},
"deleteItemConfimation": {
"message": "Видалити $1?",
"description": "Text of delete confirmation."
},
"menuSettings": {
"message": "Налаштування Quick Dial",
"description": "Text of settings menu item."
}
}
View File
File renamed without changes.
+9 -1
View File
@@ -43,13 +43,21 @@
<tr> <tr>
<td><span>Image :</span></td> <td><span>Image :</span></td>
<td colspan="2"> <td>
<select id="ImageMode">
<option value="-1">Default</option>
<option value="0">Stretch</option>
<option value="1">Cover</option>
<option value="2">Contain</option>
<option value="3">Center</option>
</select>
<button id="ImageReset">Reset</button> <button id="ImageReset">Reset</button>
<button id="ImageDefault">Default</button> <button id="ImageDefault">Default</button>
<button class="hidden" id="ImageRefresh">Refresh</button> <button class="hidden" id="ImageRefresh">Refresh</button>
<button class="hidden" id="ImageCapture">Capture</button> <button class="hidden" id="ImageCapture">Capture</button>
<input id="ImageFile" type="file" style="width:180px;"> <input id="ImageFile" type="file" style="width:180px;">
</td> </td>
<td style="width:20px"><input id="ImageLocked" type="checkbox" title="Lock image"></td>
</tr> </tr>
<tr> <tr>
<td></td> <td></td>
+100 -12
View File
@@ -12,6 +12,7 @@
input[type=color] { width: 60px; } input[type=color] { width: 60px; }
.hidden { display: none; } .hidden { display: none; }
.Tab>table { width: 100%; border-collapse: collapse; } .Tab>table { width: 100%; border-collapse: collapse; }
.Tab>div { overflow: auto; }
.Tab .TabSpace { width: 100%; border-bottom: solid 1px #505050; } .Tab .TabSpace { width: 100%; border-bottom: solid 1px #505050; }
.Tab .TabButton { border: solid 1px #505050; padding: 2px 6px 2px 6px; cursor: default; } .Tab .TabButton { border: solid 1px #505050; padding: 2px 6px 2px 6px; cursor: default; }
.Tab .TabButtonActive { border: solid 1px #505050; border-bottom: none; padding: 2px 6px 2px 6px; cursor: default; } .Tab .TabButtonActive { border: solid 1px #505050; border-bottom: none; padding: 2px 6px 2px 6px; cursor: default; }
@@ -35,6 +36,17 @@
<td><span>Background Color :</span></td> <td><span>Background Color :</span></td>
<td><input id="BackgroundColor" type="color"></td> <td><input id="BackgroundColor" type="color"></td>
</tr> </tr>
<tr>
<td><span>Background Mode :</span></td>
<td>
<select id="BackgroundMode">
<option value="0">Stretch</option>
<option value="1">Cover</option>
<option value="2">Contain</option>
<option value="3">Center</option>
</select>
</td>
</tr>
<tr> <tr>
<td><span>Background Image :</span></td> <td><span>Background Image :</span></td>
<td> <td>
@@ -46,6 +58,22 @@
<td>Preview :</td> <td>Preview :</td>
<td><div id="BackgroundPreview" style="width: 300px; height: 180px;"></div></td> <td><div id="BackgroundPreview" style="width: 300px; height: 180px;"></div></td>
</tr> </tr>
<tr>
<td>Show "Add to ..." :</td>
<td><input id="MenuShowAdd" type="checkbox"></td>
</tr>
<tr>
<td>Open QD in new page :</td>
<td><input id="ButtonOpenInNewPage" type="checkbox"></td>
</tr>
<tr>
<td>Startpage timeout :</td>
<td><input id="StartupTimeout" type="number"></td>
</tr>
</table> </table>
</div> </div>
<div class="hidden"> <div class="hidden">
@@ -53,13 +81,38 @@
<tr> <tr>
<td><span>Rows x Columns :</span></td> <td><span>Rows x Columns :</span></td>
<td> <td>
<input id="GridRows" type="number"> <input id="GridRows" type="number" min="1">
<input id="GridColumns" type="number"> <input id="GridColumns" type="number" min="1">
</td>
</tr>
<tr>
<td><span>Ratio (X/Y) :</span></td>
<td>
<input id="GridRatioX" type="number" min="1">
<input id="GridRatioY" type="number" min="1">
</td> </td>
</tr> </tr>
<tr> <tr>
<td><span>Margins :</span></td> <td><span>Margins :</span></td>
<td><input id="GridMargins" type="number"></td> <td><input id="GridMargins" type="number" min="0"></td>
</tr>
<tr>
<td><span>Open Bookmarks In :</span></td>
<td>
<select id="GridOpenBookmarksIn">
<option value="0">Default</option>
<option value="1">New Tab</option>
</select>
</td>
</tr>
<tr>
<td><span>Open Folders In :</span></td>
<td>
<select id="GridOpenFoldersIn">
<option value="0">Default</option>
<option value="1">New Tab</option>
</select>
</td>
</tr> </tr>
<tr> <tr>
<td><span>Back Button :</span></td> <td><span>Back Button :</span></td>
@@ -70,12 +123,28 @@
<tr> <tr>
<td> <td>
<div>Back :</div> <div>Back :</div>
<div>
<select id="GridBackMode">
<option value="0">Stretch</option>
<option value="1">Cover</option>
<option value="2">Contain</option>
<option value="3">Center</option>
</select>
</div>
<button id="GridBackImageReset">Reset</button> <button id="GridBackImageReset">Reset</button>
<input id="GridBackImageFile" type="file" style="width:220px;"> <input id="GridBackImageFile" type="file" style="width:220px;">
<div id="GridBackPreview" style="width: 220px; height: 150px; border: 1px solid #000000"></div> <div id="GridBackPreview" style="width: 220px; height: 150px; border: 1px solid #000000"></div>
</td> </td>
<td> <td>
<div>Folder :</div> <div>Folder :</div>
<div>
<select id="GridFolderMode">
<option value="0">Stretch</option>
<option value="1">Cover</option>
<option value="2">Contain</option>
<option value="3">Center</option>
</select>
</div>
<button id="GridFolderImageReset">Reset</button> <button id="GridFolderImageReset">Reset</button>
<input id="GridFolderImageFile" type="file" style="width:220px;"> <input id="GridFolderImageFile" type="file" style="width:220px;">
<div id="GridFolderPreview" style="width: 220px; height: 150px; border: 1px solid #000000"></div> <div id="GridFolderPreview" style="width: 220px; height: 150px; border: 1px solid #000000"></div>
@@ -98,13 +167,23 @@
</tr> </tr>
<tr> <tr>
<td><span>Margins :</span></td> <td><span>Margins :</span></td>
<td><input id="GridCellsMargins" type="number"></td> <td><input id="GridCellsMargins" type="number" min="0"></td>
<td><input id="GridCellsMarginsHover" type="number" style="display: none;"></td> <td><input id="GridCellsMarginsHover" type="number" min="0"></td>
</tr>
<tr>
<td><span>Opacity :</span></td>
<td><input id="GridCellsOpacity" type="number" min="0" max="100"></td>
<td><input id="GridCellsOpacityHover" type="number" min="0" max="100"></td>
</tr>
<tr>
<td><span>Border Size :</span></td>
<td><input id="GridCellsBorderSize" type="number" min="0"></td>
<td><input id="GridCellsBorderSizeHover" type="number" min="0"></td>
</tr> </tr>
<tr> <tr>
<td><span>Border Radius :</span></td> <td><span>Border Radius :</span></td>
<td><input id="GridCellsBorderRadius" type="number"></td> <td><input id="GridCellsBorderRadius" type="number" min="0"></td>
<td><input id="GridCellsBorderRadiusHover" type="number"></td> <td><input id="GridCellsBorderRadiusHover" type="number" min="0"></td>
</tr> </tr>
<tr> <tr>
<td><span>Background Transparent :</span></td> <td><span>Background Transparent :</span></td>
@@ -124,17 +203,22 @@
<tr> <tr>
<td><span>Title :</span></td> <td><span>Title :</span></td>
<td><input id="GridCellsTitle" type="checkbox"></td> <td><input id="GridCellsTitle" type="checkbox"></td>
<td></td> <td><input id="GridCellsTitleHover" type="checkbox"></td>
</tr> </tr>
<tr> <tr>
<td><span>Title Height :</span></td> <td><span>Title Height :</span></td>
<td><input id="GridCellsTitleHeight" type="number"></td> <td><input id="GridCellsTitleHeight" type="number" min="0"></td>
<td></td> <td><input id="GridCellsTitleHeightHover" type="number" min="0"></td>
</tr> </tr>
<tr> <tr>
<td><span>Title Font Size :</span></td> <td><span>Title Font Size :</span></td>
<td><input id="GridCellsTitleFontSize" type="number"></td> <td><input id="GridCellsTitleFontSize" type="number" min="0"></td>
<td></td> <td><input id="GridCellsTitleFontSizeHover" type="number" min="0"></td>
</tr>
<tr>
<td><span>Title Border Size :</span></td>
<td><input id="GridCellsTitleBorderSize" type="number" min="0"></td>
<td><input id="GridCellsTitleBorderSizeHover" type="number" min="0"></td>
</tr> </tr>
<tr> <tr>
<td><span>Title Text Color :</span></td> <td><span>Title Text Color :</span></td>
@@ -151,6 +235,10 @@
<td><input id="GridCellsTitleBackgroundColor" type="color"></td> <td><input id="GridCellsTitleBackgroundColor" type="color"></td>
<td><input id="GridCellsTitleBackgroundColorHover" type="color"></td> <td><input id="GridCellsTitleBackgroundColorHover" type="color"></td>
</tr> </tr>
<tr>
<td><span>Snapshot Delay :</span></td>
<td colspan="2"><input id="GridCellsSnapshotDelay" type="number" min="300" max="10000"></td>
</tr>
</table> </table>
</div> </div>
</div> </div>
+367 -90
View File
@@ -4,14 +4,31 @@ app.init = function(){ // Init module
app.Settings.init(function(){ app.Settings.init(function(){
app.Messages.init(); app.Messages.init();
browser.runtime.sendMessage({ cmd: app.Messages.Commands.settingsChanged }); browser.runtime.sendMessage({ cmd: app.Messages.Commands.settingsChanged });
browser.browserAction.onClicked.addListener(function(){ browser.browserAction.onClicked.addListener(function(e){
browser.tabs.create({}); if(app.settings.openQuickDialInNewPage) browser.tabs.create({});
}); else browser.tabs.update(e.id, {url: '/dial.html'}).then();
app.GridNodes.sync(app.node, app.settings.grid.root, function(){
browser.runtime.sendMessage({ cmd: app.Messages.Commands.gridNodesLoaded });
app.Bookmarks.initListener();
app.ContextMenus.initMenu();
}); });
browser.runtime.sendMessage({ cmd: app.Messages.Commands.gridNodesLoaded });
app.ContextMenus.initMenu();
window.setTimeout(function(){
app.GridNodes.sync(app.node, app.settings.grid.root, function(){
app.Bookmarks.initListener();
});
}, 500);
// Start page workaround :
if(app.settings.startpageTimeout>0){
setTimeout(function(){
browser.tabs.query({}).then( function(tabs) {
tabs.forEach(function(itm){
if(itm.url=='about:blank'){
browser.tabs.update(itm.id, {url: browser.runtime.getURL('dial.html')});
}
});
});
}, app.settings.startpageTimeout);
}
}); });
}; };
@@ -29,7 +46,15 @@ app.Messages.Commands = {
refreshNode: 9, refreshNode: 9,
capturePage: 10, capturePage: 10,
settingsChanged: 100, settingsChanged: 100,
gridNodesLoaded: 101 gridNodesLoaded: 101,
menuCreateBookmark: 200,
menuCreateFolder: 201,
menuEditSettings: 202,
menuEditProperties: 203,
menuRefreshNode: 204,
menuCaptureHere: 205,
menuCapturePage: 206,
menuDeleteNode: 207
}; };
app.Messages.init = function(){ // Init Messages Listeners app.Messages.init = function(){ // Init Messages Listeners
browser.runtime.onMessage.addListener(function(request, sender, sendResponse){ browser.runtime.onMessage.addListener(function(request, sender, sendResponse){
@@ -49,6 +74,7 @@ app.Messages.init = function(){ // Init Messages Listeners
} else { } else {
browser.runtime.sendMessage( { cmd: app.Messages.Commands.gridNodesLoaded } ); browser.runtime.sendMessage( { cmd: app.Messages.Commands.gridNodesLoaded } );
} }
app.ContextMenus.updateMenu();
break; break;
case app.Messages.Commands.getNodeByID: case app.Messages.Commands.getNodeByID:
var nodes = app.GridNodes.getNodeWithParents(request.id); var nodes = app.GridNodes.getNodeWithParents(request.id);
@@ -100,39 +126,58 @@ app.Messages.init = function(){ // Init Messages Listeners
app.Settings = {}; // Settings helper object app.Settings = {}; // Settings helper object
app.Settings.init = function(callback){ // Load settings and nodes app.Settings.init = function(callback){ // Load settings and nodes
browser.storage.local.get().then(function(data){ browser.storage.local.get().then(function(data){
if(Object.keys(data).length == 0) { if(Object.keys(data).length == 0 || ! data.settings) {
data = { data = {
version: 3, version: 3,
settings: { settings: {
backgroundColor: '#3c4048', backgroundColor: '#3c4048',
backgroundImage: null, backgroundImage: null,
backgroundMode: 0,
menuShowAdd: true,
openQuickDialInNewPage: true,
grid: { grid: {
margin: 10, margin: 10,
rows: 4, rows: 4,
columns: 5, columns: 5,
ratioX: 4,
ratioY: 3,
backNode: true, backNode: true,
backIcon: 'url(/img/back.png)', backIcon: 'url(/img/back.png)',
backIconMode: 3,
folderIcon: 'url(/img/folder.png)', folderIcon: 'url(/img/folder.png)',
folderIconMode: 0,
loadingIcon: 'url(/img/throbber.gif)', loadingIcon: 'url(/img/throbber.gif)',
openBookmarkMethod: 0,
openFolderMethod: 0,
cells: { cells: {
margin: 4, margin: 4,
marginHover: 4, marginHover: 4,
opacity: 1,
opacityHover: 1,
backgroundColor: null, backgroundColor: null,
backgroundColorHover: null, backgroundColorHover: null,
borderColor: '#333333', borderColor: '#333333',
borderColorHover: '#a9a9a9', borderColorHover: '#a9a9a9',
borderRadius: 4, borderRadius: 4,
borderRadiusHover: 4, borderRadiusHover: 4,
borderSize: 1,
borderSizeHover: 1,
title: true, title: true,
titleHover: true,
titleHeight: 16, titleHeight: 16,
titleHeightHover: 16,
titleFontSize: 10, titleFontSize: 10,
titleFontSizeHover: 10,
titleFont: 'Arial, Verdana, Sans-serif', titleFont: 'Arial, Verdana, Sans-serif',
titleColor: '#ffffff', titleColor: '#ffffff',
titleColorHover: '#33ccff', titleColorHover: '#33ccff',
titleBackgroundColor: null, titleBackgroundColor: null,
titleBackgroundColorHover: null, titleBackgroundColorHover: null,
titleBorderSize: 1,
titleBorderSizeHover: 1,
previewWidth: 1200, previewWidth: 1200,
previewHeight: 710 previewHeight: 710,
snapshotDelay: 2000
}, },
root: 'Quick Dial', root: 'Quick Dial',
} }
@@ -169,6 +214,48 @@ app.Settings.init = function(callback){ // Load settings and nodes
app.Settings.save(); app.Settings.save();
}); });
} }
if(data.version == 3){ // Upgrade Data Version
data.version = 4;
data.settings.backgroundMode = 0;
data.settings.grid.backIconMode = 3;
data.settings.grid.folderIconMode = 0;
data.settings.grid.cells.opacity = 1;
data.settings.grid.cells.opacityHover = 1;
data.settings.grid.cells.borderSize = 1;
data.settings.grid.cells.borderSizeHover = data.settings.grid.cells.borderSize;
data.settings.grid.cells.titleHover = data.settings.grid.cells.title;
data.settings.grid.cells.titleHeightHover = data.settings.grid.cells.titleHeight;
data.settings.grid.cells.titleFontSizeHover = data.settings.grid.cells.titleFontSize;
data.settings.grid.cells.titleBorderSize = 1;
data.settings.grid.cells.titleBorderSizeHover = data.settings.grid.cells.titleBorderSize;
app.Settings.save();
}
if(data.version == 4){ // Upgrade Data Version
if(!data.settings.grid.cells.snapshotDelay) data.settings.grid.cells.snapshotDelay = 2000;
if(data.settings.grid.ratioAuto == true || data.settings.grid.ratioAuto == false){
delete data.settings.grid.ratioAuto;
data.settings.grid.ratioX = 4;
data.settings.grid.ratioY = 3;
}
if(!data.settings.grid.ratioX){
data.settings.grid.ratioX = 4;
data.settings.grid.ratioY = 3;
}
if(!(data.settings.menuShowAdd == true) && !(data.settings.menuShowAdd == false)){
data.settings.menuShowAdd = true;
}
if(!data.settings.grid.openBookmarkMethod && data.settings.grid.openBookmarkMethod != 0){
data.settings.grid.openBookmarkMethod = 0;
data.settings.grid.openFolderMethod = 0;
}
if(!data.settings.openQuickDialInNewPage && data.settings.openQuickDialInNewPage != false){
data.settings.openQuickDialInNewPage = true;
}
if(!data.settings.startpageTimeout){
data.settings.startpageTimeout = 500;
}
//app.Settings.save();
}
app.settings = data.settings; app.settings = data.settings;
app.node = data.node; app.node = data.node;
if(callback) callback(); if(callback) callback();
@@ -179,40 +266,164 @@ app.Settings.update = function(settings, callback){ // Save new settings
app.Settings.save(callback); app.Settings.save(callback);
}; };
app.Settings.save = function(callback){ // Save settings app.Settings.save = function(callback){ // Save settings
var data = { version: 3 }; if(! app.settings) return;
var data = { version: 4 };
data.settings = app.settings; data.settings = app.settings;
data.node = app.node; data.node = app.node;
browser.storage.local.set(data).then(function(){ browser.storage.local.set(data).then(function(){
if(callback) callback(); if(callback) callback();
}, function(){ console.log('Error saving settings'); }); }, function(){ console.log('Error saving settings'); });
} };
app.init(); app.init();
app.ContextMenus = {} // ContextMenu helper Object app.ContextMenus = {} // ContextMenu helper Object
app.ContextMenus.initMenu = function(){ // (Called from app.init) Init context menu in all pages app.ContextMenus.menuItemClicked = function(info, tab){
browser.contextMenus.create({ // Create Context menu if (info.menuItemId == "AddToQuickDial") app.GridNodes.createBookmark(app.node, info.pageUrl, tab.title, function(){
id: 'AddToQuickDial', browser.runtime.sendMessage( { cmd: app.Messages.Commands.gridNodesLoaded } );
title: browser.i18n.getMessage("menuAddToQuickDial"),
contexts: ["all"],
documentUrlPatterns: [ 'http://*/*', 'https://*/*', 'file://*/*', 'ftp://*/*' ]
}, function(){});
browser.contextMenus.onClicked.addListener(function(info, tab) { // Context menu click event
if (info.menuItemId == "AddToQuickDial")
app.GridNodes.createBookmark(app.node, info.pageUrl, tab.title, function(){
browser.runtime.sendMessage( { cmd: app.Messages.Commands.gridNodesLoaded } );
});
}); });
} };
app.ContextMenus.initMenu = function(){ // (Called from app.init) Init context menu in all pages
// Create Add Context menu for all pages
if(app.settings.menuShowAdd){
browser.contextMenus.create({
id: 'AddToQuickDial',
title: browser.i18n.getMessage("menuAddToQuickDial"),
contexts: ["all"],
documentUrlPatterns: [ 'http://*/*', 'https://*/*', 'file://*/*', 'ftp://*/*' ],
onclick(info, tab) { app.ContextMenus.menuItemClicked(info, tab) }
});
}
// Create WebExt Page Context menu
browser.contextMenus.create({
id: "pagemenu",
title: "Quick Dial",
documentUrlPatterns: [ 'moz-extension://*/dial.html', 'moz-extension://*/dial.html?*' ],
contexts: ["page"]
});
browser.contextMenus.create({
id: "pagemenunew",
parentId: "pagemenu",
title: browser.i18n.getMessage("menuNew")
});
browser.contextMenus.create({
parentId: "pagemenunew",
title: browser.i18n.getMessage("menuNewBookmark"),
onclick(info, tab) {
browser.tabs.sendMessage(tab.id, { cmd: app.Messages.Commands.menuCreateBookmark });
}
});
browser.contextMenus.create({
parentId: "pagemenunew",
title: browser.i18n.getMessage("menuNewFolder"),
onclick(info, tab) {
browser.tabs.sendMessage(tab.id, { cmd: app.Messages.Commands.menuCreateFolder });
}
});
browser.contextMenus.create({ parentId: "pagemenu", type: "separator" });
browser.contextMenus.create({
parentId: "pagemenu",
title: browser.i18n.getMessage("menuSettings"),
onclick(info, tab) {
browser.tabs.sendMessage(tab.id, { cmd: app.Messages.Commands.menuEditSettings });
}
});
// Create WebExt Link Context menu
browser.contextMenus.create({
id: "itemmenu",
title: "Quick Dial",
documentUrlPatterns: [ 'moz-extension://*/dial.html', 'moz-extension://*/dial.html?*' ],
contexts: ["link"]
});
browser.contextMenus.create({
id: "itemmenunew",
parentId: "itemmenu",
title: browser.i18n.getMessage("menuNew")
});
browser.contextMenus.create({
parentId: "itemmenunew",
title: browser.i18n.getMessage("menuNewBookmark"),
onclick(info, tab) {
browser.tabs.sendMessage(tab.id, { cmd: app.Messages.Commands.menuCreateBookmark });
}
});
browser.contextMenus.create({
parentId: "itemmenunew",
title: browser.i18n.getMessage("menuNewFolder"),
onclick(info, tab) {
browser.tabs.sendMessage(tab.id, { cmd: app.Messages.Commands.menuCreateFolder });
}
});
browser.contextMenus.create({ parentId: "itemmenu", type: "separator" });
browser.contextMenus.create({
parentId: "itemmenu",
title: browser.i18n.getMessage("menuProperties"),
onclick(info, tab) {
browser.tabs.sendMessage(tab.id, { cmd: app.Messages.Commands.menuEditProperties });
}
});
browser.contextMenus.create({
parentId: "itemmenu",
title: browser.i18n.getMessage("menuRefreshItem"),
onclick(info, tab) {
browser.tabs.sendMessage(tab.id, { cmd: app.Messages.Commands.menuRefreshNode });
}
});
browser.contextMenus.create({
parentId: "itemmenu",
title: browser.i18n.getMessage("menuCaptureHere"),
visible: false,
onclick(info, tab) {
browser.tabs.sendMessage(tab.id, { cmd: app.Messages.Commands.menuCaptureHere });
}
});
browser.contextMenus.create({
parentId: "itemmenu",
title: browser.i18n.getMessage("menuCapturePage"),
onclick(info, tab) {
browser.tabs.sendMessage(tab.id, { cmd: app.Messages.Commands.menuCapturePage });
}
});
browser.contextMenus.create({
parentId: "itemmenu",
title: browser.i18n.getMessage("menuDeleteItem"),
onclick(info, tab) {
browser.tabs.sendMessage(tab.id, { cmd: app.Messages.Commands.menuDeleteNode });
}
});
browser.contextMenus.create({ parentId: "itemmenu", type: "separator" });
browser.contextMenus.create({
parentId: "itemmenu",
title: browser.i18n.getMessage("menuSettings"),
onclick(info, tab) {
browser.tabs.sendMessage(tab.id, { cmd: app.Messages.Commands.menuEditSettings });
}
});
};
app.ContextMenus.updateMenu = function(){
browser.contextMenus.onClicked.removeListener(app.ContextMenus.menuItemClicked);
browser.contextMenus.removeAll();
app.ContextMenus.initMenu();
};
app.Bookmarks = {} // Bookmarks helper object app.Bookmarks = {} // Bookmarks helper object
app.Bookmarks._onCreated = function(){ app.GridNodes.sync(app.node, app.settings.grid.root, function(){ browser.runtime.sendMessage({ cmd: app.Messages.Commands.gridNodesLoaded }); }); } app.Bookmarks._onCreated = function(){ app.GridNodes.sync(app.node, app.settings.grid.root, function(){ browser.runtime.sendMessage({ cmd: app.Messages.Commands.gridNodesLoaded }); }); }
app.Bookmarks._onChanged = function(){ app.GridNodes.sync(app.node, app.settings.grid.root, function(){ browser.runtime.sendMessage({ cmd: app.Messages.Commands.gridNodesLoaded }); }); } app.Bookmarks._onChanged = function(){ app.GridNodes.sync(app.node, app.settings.grid.root, function(){ browser.runtime.sendMessage({ cmd: app.Messages.Commands.gridNodesLoaded }); }); }
app.Bookmarks._onMoved = function(){ app.GridNodes.sync(app.node, app.settings.grid.root, function(){ browser.runtime.sendMessage({ cmd: app.Messages.Commands.gridNodesLoaded }); }); } app.Bookmarks._onMoved = function(){ app.GridNodes.sync(app.node, app.settings.grid.root, function(){ browser.runtime.sendMessage({ cmd: app.Messages.Commands.gridNodesLoaded }); }); }
app.Bookmarks._onRemoved = function(){ app.GridNodes.sync(app.node, app.settings.grid.root, function(){ browser.runtime.sendMessage({ cmd: app.Messages.Commands.gridNodesLoaded }); }); } app.Bookmarks._onRemoved = function(){ app.GridNodes.sync(app.node, app.settings.grid.root, function(){ browser.runtime.sendMessage({ cmd: app.Messages.Commands.gridNodesLoaded }); }); }
app.Bookmarks._onImportBegan = function(){
browser.bookmarks.onCreated.removeListener(app.Bookmarks._onCreated);
browser.bookmarks.onChanged.removeListener(app.Bookmarks._onChanged);
browser.bookmarks.onMoved.removeListener(app.Bookmarks._onMoved);
browser.bookmarks.onRemoved.removeListener(app.Bookmarks._onRemoved);
}
app.Bookmarks._onImportEnded = function(){
app.GridNodes.sync(app.node, app.settings.grid.root, function(){ browser.runtime.sendMessage({ cmd: app.Messages.Commands.gridNodesLoaded }); });
app.Bookmarks.initListener();
}
app.Bookmarks.initListener = function(){ // (Called from app.init) (/!\ Need filter to root tree only) Init listener of bookmarks app.Bookmarks.initListener = function(){ // (Called from app.init) (/!\ Need filter to root tree only) Init listener of bookmarks
browser.bookmarks.onCreated.addListener(app.Bookmarks._onCreated); browser.bookmarks.onCreated.addListener(app.Bookmarks._onCreated);
//browser.bookmarks.onChanged.addListener(app.Bookmarks._onChanged); browser.bookmarks.onChanged.addListener(app.Bookmarks._onChanged);
browser.bookmarks.onMoved.addListener(app.Bookmarks._onMoved); browser.bookmarks.onMoved.addListener(app.Bookmarks._onMoved);
browser.bookmarks.onRemoved.addListener(app.Bookmarks._onRemoved); browser.bookmarks.onRemoved.addListener(app.Bookmarks._onRemoved);
} }
@@ -258,7 +469,8 @@ app.SiteInfos.fromNewTab = function(url, callback){ // Retrieve infos from a ne
imgObj.src = img; imgObj.src = img;
var previewWidth = 1200; // Need to be linked to settings var previewWidth = 1200; // Need to be linked to settings
var previewHeight = 710; // Need to be linked to settings var previewHeight = previewWidth / app.settings.grid.ratioX * app.settings.grid.ratioY;
if(app.settings.grid.title == true) previewHeight -= app.settings.grid.titleHeight;
var canvas = document.createElement('canvas'); var canvas = document.createElement('canvas');
canvas.style.width = previewWidth.toString() + 'px'; canvas.style.width = previewWidth.toString() + 'px';
@@ -287,7 +499,7 @@ app.SiteInfos.fromNewTab = function(url, callback){ // Retrieve infos from a ne
browser.tabs.remove(tab.id); browser.tabs.remove(tab.id);
if(callback) callback(); if(callback) callback();
}); });
}, 500); }, app.settings.grid.cells.snapshotDelay);
}, function(){ if(callback) callback(); }); }, function(){ if(callback) callback(); });
} }
}, function(){ if(callback) callback(); }); }, function(){ if(callback) callback(); });
@@ -324,7 +536,8 @@ app.SiteInfos.fromFrame = function(url, callback){ // Retrieve infos from an ifr
} }
var previewWidth = 1200; // Need to be linked to settings var previewWidth = 1200; // Need to be linked to settings
var previewHeight = 710; // Need to be linked to settings var previewHeight = previewWidth / app.settings.grid.ratioX * app.settings.grid.ratioY;
if(app.settings.grid.title == true) previewHeight -= app.settings.grid.titleHeight;
var iframe; var iframe;
var xmlHttp = new XMLHttpRequest(); var xmlHttp = new XMLHttpRequest();
xmlHttp.timeout = 10000 xmlHttp.timeout = 10000
@@ -334,10 +547,10 @@ app.SiteInfos.fromFrame = function(url, callback){ // Retrieve infos from an ifr
iframe.width = previewWidth iframe.width = previewWidth
iframe.height = previewHeight iframe.height = previewHeight
iframe.style.position = 'absolute'; iframe.style.position = 'absolute';
//iframe.style.visibility = 'hidden'; iframe.scrolling = 'no';
var content = xmlHttp.responseText.replace('<head>', '<head><base href="' + url + '">'); var content = xmlHttp.responseText.replace('<head>', '<head><base href="' + url + '">');
iframe.onload = function(){ pageLoaded(); }
document.body.appendChild(iframe); document.body.appendChild(iframe);
iframe.onload = function(){ pageLoaded(); }
iframe.srcdoc = content; iframe.srcdoc = content;
setTimeout(function(){ pageLoaded(); }, 6000); setTimeout(function(){ pageLoaded(); }, 6000);
} }
@@ -345,8 +558,8 @@ app.SiteInfos.fromFrame = function(url, callback){ // Retrieve infos from an ifr
xmlHttp.onerror = function(){ if(callback) callback(); } xmlHttp.onerror = function(){ if(callback) callback(); }
xmlHttp.ontimeout = function(){ if(callback) callback(); } xmlHttp.ontimeout = function(){ if(callback) callback(); }
xmlHttp.send(); xmlHttp.send();
} }
app.SiteInfos.fromWS = function(url, callback){ // Retrieve infos from a Web Service. callback( { url, title, (/!\ Not handled now)icon, screenshot } || error: callback() ) app.SiteInfos.fromWS = function(url, callback){ // Retrieve infos from a Web Service. callback( { url, title, (/!\ Not handled now)icon, screenshot } || error: callback() )
console.log('Not implemented'); console.log('Not implemented');
return app.SiteInfos.fromFrame(url, callback); return app.SiteInfos.fromFrame(url, callback);
} }
@@ -359,63 +572,81 @@ app.GridNodes.GridNodeType = { // GridNodeType
bookmark: 2 bookmark: 2
} }
app.GridNodes.sync = function(gridNode, rootPath, callback){ // Sync GridNodes with Bookmarks app.GridNodes.sync = function(gridNode, rootPath, callback){ // Sync GridNodes with Bookmarks
if(app.GridNodes._syncing) {
app.GridNodes._needSync = true;
return;
}
app.GridNodes._syncing = true;
app.Bookmarks.load(rootPath, function(bookmarkItem){ app.Bookmarks.load(rootPath, function(bookmarkItem){
function syncNode(gridNode, bookmarkItem){ function syncNode(gridNode, bookmarkItem){
gridNode.id = bookmarkItem.id; gridNode.id = bookmarkItem.id;
if(!gridNode.title) gridNode.title = bookmarkItem.title; gridNode.title = bookmarkItem.title;
if(bookmarkItem.url){ switch(bookmarkItem.type){
gridNode.type = app.GridNodes.GridNodeType.bookmark; case 'bookmark':
if(!gridNode.url) gridNode.url = bookmarkItem.url; gridNode.type = app.GridNodes.GridNodeType.bookmark;
} else if(bookmarkItem.children){ if(gridNode.url != bookmarkItem.url){
gridNode.type = app.GridNodes.GridNodeType.folder; gridNode.url = bookmarkItem.url;
var EmptyNodes = []; delete gridNode.image;
if(! gridNode.children) gridNode.children = []; }
else { break;
for(var i=gridNode.children.length-1; i>=0; i--){ case 'folder':
if(!gridNode.children[i]) gridNode.children[i] = { type: app.GridNodes.GridNodeType.empty }; gridNode.type = app.GridNodes.GridNodeType.folder;
if(gridNode.children[i].type==app.GridNodes.GridNodeType.empty){ var EmptyNodes = [];
EmptyNodes.unshift(gridNode.children[i]); if(! gridNode.children) gridNode.children = [];
} else { else {
var found = false; for(var i=gridNode.children.length-1; i>=0; i--){
for(var child of bookmarkItem.children){ if(!gridNode.children[i]) gridNode.children[i] = { type: app.GridNodes.GridNodeType.empty };
if(child.id==gridNode.children[i].id){ if(gridNode.children[i].type==app.GridNodes.GridNodeType.empty){
found = true; EmptyNodes.unshift(gridNode.children[i]);
break; } else {
var found = false;
for(var child of bookmarkItem.children){
if(child.id==gridNode.children[i].id){
found = true;
break;
}
} }
} if(! found){
if(! found){ if(i<gridNode.children.length - 1){
if(i<gridNode.children.length - 1){ gridNode.children[i] = { type: app.GridNodes.GridNodeType.empty };
gridNode.children[i] = { type: app.GridNodes.GridNodeType.empty }; EmptyNodes.unshift(gridNode.children[i]);
EmptyNodes.unshift(gridNode.children[i]); } else {
} else { gridNode.children.pop();
gridNode.children.pop(); }
} }
} }
} }
} }
} for(var child of bookmarkItem.children){
for(var child of bookmarkItem.children){ var childGridNode = app.GridNodes.getChildNode(gridNode, child.id);
var childGridNode = app.GridNodes.getChildNode(gridNode, child.id); if(!childGridNode){
if(!childGridNode){ if(EmptyNodes.length>0){
if(EmptyNodes.length>0){ childGridNode = EmptyNodes[0];
childGridNode = EmptyNodes[0]; EmptyNodes.shift();
EmptyNodes.shift(); }else {
}else { childGridNode = {};
childGridNode = {}; gridNode.children.push(childGridNode)
gridNode.children.push(childGridNode) }
} }
syncNode(childGridNode, child);
} }
syncNode(childGridNode, child); EmptyNodes.length = 0;
} break;
EmptyNodes.length = 0; default:
} else { gridNode.type = app.GridNodes.GridNodeType.empty;
gridNode.type = app.GridNodes.GridNodeType.empty; break;
} }
} }
syncNode(gridNode, bookmarkItem); syncNode(gridNode, bookmarkItem);
app.GridNodes.save(); delete app.GridNodes._syncing;
if(callback) callback(); if(app.GridNodes._needSync == true) {
delete app.GridNodes._needSync;
app.GridNodes.sync(gridNode, rootPath, callback);
} else {
app.GridNodes.save();
if(callback) callback();
}
}); });
} }
app.GridNodes.save = function(callback){ // Save GridNodes app.GridNodes.save = function(callback){ // Save GridNodes
@@ -462,15 +693,42 @@ app.GridNodes.updateNode = function(gridNode, value, callback){
if(value){ if(value){
if(value.title) gridNode.title = value.title; if(value.title) gridNode.title = value.title;
if(value.titleLocked!=null) gridNode.titleLocked = value.titleLocked; if(value.titleLocked!=null) gridNode.titleLocked = value.titleLocked;
if(value.image) gridNode.image = value.image; if(value.imageLocked!=null){
else delete gridNode.image; gridNode.imageLocked = value.imageLocked;
if(value.image) gridNode.image = value.image;
else delete gridNode.image;
} else if(gridNode.imageLocked != true){
if(value.image) gridNode.image = value.image;
else delete gridNode.image;
}
if(value.imageMode || value.imageMode == 0) {
if(value.imageMode == -1) delete gridNode.imageMode;
else gridNode.imageMode = value.imageMode;
}
if(gridNode.type == app.GridNodes.GridNodeType.bookmark && value.url && gridNode.url != value.url){ if(gridNode.type == app.GridNodes.GridNodeType.bookmark && value.url && gridNode.url != value.url){
gridNode.url = value.url; gridNode.url = value.url;
app.GridNodes.refreshNode(gridNode, function(){ app.GridNodes.refreshNode(gridNode, function(){
browser.runtime.sendMessage({ cmd: app.Messages.Commands.gridNodesLoaded }); browser.runtime.sendMessage({ cmd: app.Messages.Commands.gridNodesLoaded });
app.GridNodes.saveNode(gridNode);
var data = { title: gridNode.title };
//if(gridNode.imageMode) data.imageMode = gridNode.imageMode;
//if(gridNode.type == app.GridNodes.GridNodeType.bookmark) data.url = gridNode.url;
data.url = gridNode.url;
browser.bookmarks.onChanged.removeListener(app.Bookmarks._onChanged);
browser.bookmarks.update(gridNode.id, data).then(function(){
browser.bookmarks.onChanged.addListener(app.Bookmarks._onChanged);
});
});
} else {
browser.runtime.sendMessage({ cmd: app.Messages.Commands.gridNodesLoaded });
app.GridNodes.saveNode(gridNode);
var data = { title: gridNode.title };
//if(gridNode.imageMode) data.imageMode = gridNode.imageMode;
browser.bookmarks.onChanged.removeListener(app.Bookmarks._onChanged);
browser.bookmarks.update(gridNode.id, data).then(function(){
browser.bookmarks.onChanged.addListener(app.Bookmarks._onChanged);
}); });
} }
app.GridNodes.saveNode(gridNode);
} }
if(callback) callback(gridNode); if(callback) callback(gridNode);
} }
@@ -576,18 +834,31 @@ app.GridNodes.refreshNode = function(gridNode, callback){ // Refresh content of
delete gridNode.__isLoading; delete gridNode.__isLoading;
app.GridNodes.saveNode(gridNode); app.GridNodes.saveNode(gridNode);
if(callback) callback({ title: gridNode.title, screenshot: gridNode.image }); if(callback) callback({ title: gridNode.title, screenshot: gridNode.image });
/*
browser.bookmarks.onChanged.removeListener(app.Bookmarks._onChanged);
browser.bookmarks.update(gridNode.id, { title: gridNode.title }).then(function(){
browser.bookmarks.onChanged.addListener(app.Bookmarks._onChanged);
});
*/
break; break;
case app.GridNodes.GridNodeType.bookmark: case app.GridNodes.GridNodeType.bookmark:
app.SiteInfos.fromFrame(gridNode.url, function(infos){ app.SiteInfos.fromFrame(gridNode.url, function(infos){
if(infos){ if(gridNode.imageLocked!=true){
if(gridNode.titleLocked!=true) gridNode.title = infos.title; if(infos){
gridNode.image = infos.screenshot; if(gridNode.titleLocked!=true) gridNode.title = infos.title;
} else { gridNode.image = infos.screenshot;
gridNode.image = '0'; } else {
gridNode.image = '0';
}
} }
delete gridNode.__isLoading; delete gridNode.__isLoading;
app.GridNodes.saveNode(gridNode); app.GridNodes.saveNode(gridNode);
if(callback) callback(infos); if(callback) callback(infos);
browser.bookmarks.onChanged.removeListener(app.Bookmarks._onChanged);
browser.bookmarks.update(gridNode.id, { title: gridNode.title, url: gridNode.url }).then(function(){
browser.bookmarks.onChanged.addListener(app.Bookmarks._onChanged);
});
}); });
break; break;
} }
@@ -601,7 +872,7 @@ app.GridNodes.capturePage = function(gridNode, callback){
if(nodes){ if(nodes){
var path = ''; var path = '';
for(var i=1; i<nodes.length; i++) path = path + '/' + nodes[i].title; for(var i=1; i<nodes.length; i++) path = path + '/' + nodes[i].title;
app.SiteInfos.fromNewTab('/dial?path=' + path, function(infos){ app.SiteInfos.fromNewTab('/dial.html?path=' + path, function(infos){
if(infos){ if(infos){
gridNode.image = infos.screenshot; gridNode.image = infos.screenshot;
} else { } else {
@@ -615,15 +886,21 @@ app.GridNodes.capturePage = function(gridNode, callback){
break; break;
case app.GridNodes.GridNodeType.bookmark: case app.GridNodes.GridNodeType.bookmark:
app.SiteInfos.fromNewTab(gridNode.url, function(infos){ app.SiteInfos.fromNewTab(gridNode.url, function(infos){
if(infos){ if(gridNode.imageLocked!=true){
if(gridNode.titleLocked!=true) gridNode.title = infos.title; if(infos){
gridNode.image = infos.screenshot; if(gridNode.titleLocked!=true) gridNode.title = infos.title;
} else { gridNode.image = infos.screenshot;
gridNode.image = '0'; } else {
gridNode.image = '0';
}
} }
delete gridNode.__isLoading; delete gridNode.__isLoading;
app.GridNodes.saveNode(gridNode); app.GridNodes.saveNode(gridNode);
if(callback) callback(infos); if(callback) callback(infos);
browser.bookmarks.onChanged.removeListener(app.Bookmarks._onChanged);
browser.bookmarks.update(gridNode.id, { title: gridNode.title, url: gridNode.url }).then(function(){
browser.bookmarks.onChanged.addListener(app.Bookmarks._onChanged);
});
}); });
break; break;
} }
+337 -40
View File
@@ -2,33 +2,53 @@ var utils = {};
var app = {}; var app = {};
var dial = { var dial = {
page: 1, page: 1,
maxpage: 1 maxpage: 1,
capture: 0
}; };
document.addEventListener("DOMContentLoaded", function(event) { document.addEventListener("DOMContentLoaded", function(event) {
document.body.style.backgroundColor = utils.getBackgroundColor(); document.body.style.backgroundColor = utils.getBackgroundColor();
app.init(); app.init();
dial.init(); dial.init();
window.setTimeout(function(){
if(! app.settings) app.init();
}, 500);
}); });
window.onresize = function(){ window.addEventListener('resize', function(){
if(app && app.settings) dial.updateGridLayout(); if(app && app.settings) dial.updateGridLayout();
} });
window.onwheel = function(ev){ window.addEventListener('wheel', function(e){
if(app && app.settings){ if(app && app.settings){
if(ev.deltaY > 0){ if(e.deltaY > 0){
if(dial.page < dial.maxpage){ if(dial.page < dial.maxpage){
dial.page += 1; dial.page += 1;
dial.populateGrid(); dial.populateGrid();
} }
} else if(ev.deltaY < 0){ } else if(e.deltaY < 0){
if(dial.page > 1){ if(dial.page > 1){
dial.page -= 1; dial.page -= 1;
dial.populateGrid(); dial.populateGrid();
} }
} }
} }
} });
window.addEventListener('keyup', function(e){
switch(e.key){
case 'PageDown':
if(dial.page < dial.maxpage){
dial.page += 1;
dial.populateGrid();
}
break;
case 'PageUp':
if(dial.page > 1){
dial.page -= 1;
dial.populateGrid();
}
break;
}
});
@@ -40,6 +60,11 @@ utils.getPath = function(){
if(path) return path + '/'; if(path) return path + '/';
else return '/'; else return '/';
}; };
utils.getDialUrl = function(path){
var url = '?bg=' + encodeURIComponent(app.settings.backgroundColor);
if(path) url += '&path=' + encodeURIComponent(path);
return url;
};
app.init = function(){ app.init = function(){
app.Messages.getSettings(function(settings){ app.Messages.getSettings(function(settings){
@@ -64,7 +89,15 @@ app.Messages.Commands = {
refreshNode: 9, refreshNode: 9,
capturePage: 10, capturePage: 10,
settingsChanged: 100, settingsChanged: 100,
gridNodesLoaded: 101 gridNodesLoaded: 101,
menuCreateBookmark: 200,
menuCreateFolder: 201,
menuEditSettings: 202,
menuEditProperties: 203,
menuRefreshNode: 204,
menuCaptureHere: 205,
menuCapturePage: 206,
menuDeleteNode: 207
}; };
app.Messages.init = function(){ app.Messages.init = function(){
browser.runtime.onMessage.addListener(function(request, sender, sendResponse){ browser.runtime.onMessage.addListener(function(request, sender, sendResponse){
@@ -73,7 +106,31 @@ app.Messages.init = function(){
app.Messages.getSettings(app.Settings._changed); app.Messages.getSettings(app.Settings._changed);
break; break;
case app.Messages.Commands.gridNodesLoaded: case app.Messages.Commands.gridNodesLoaded:
app.Messages.getNode(dial.path, app.GridNodes._changed); if(dial.skipUpdate!=true) app.Messages.getNode(dial.path, app.GridNodes._changed);
break;
case app.Messages.Commands.menuCreateBookmark:
dial.createBookmark();
break;
case app.Messages.Commands.menuCreateFolder:
dial.createFolder();
break;
case app.Messages.Commands.menuEditSettings:
dial.editSettings();
break;
case app.Messages.Commands.menuEditProperties:
dial.editProperties(dial._selectedItem);
break;
case app.Messages.Commands.menuRefreshNode:
dial.refreshNode(dial._selectedItem);
break;
case app.Messages.Commands.menuCaptureHere:
dial.captureHere(dial._selectedItem);
break;
case app.Messages.Commands.menuCapturePage:
dial.capturePage(dial._selectedItem);
break;
case app.Messages.Commands.menuDeleteNode:
dial.deleteNode();
break; break;
} }
}); });
@@ -85,7 +142,7 @@ app.Messages.getSettings = function(callback){
} else { } else {
browser.runtime.sendMessage({ cmd: app.Messages.Commands.getSettings }).then(callback, callback); browser.runtime.sendMessage({ cmd: app.Messages.Commands.getSettings }).then(callback, callback);
} }
}); }, callback);
}; };
app.Messages.getNode = function(path, callback){ app.Messages.getNode = function(path, callback){
browser.runtime.getBackgroundPage().then(function(page){ browser.runtime.getBackgroundPage().then(function(page){
@@ -96,6 +153,9 @@ app.Messages.getNode = function(path, callback){
} }
}); });
}; };
app.Messages.updateNode = function(id, value, callback){
browser.runtime.sendMessage({ cmd: app.Messages.Commands.updateNode, id: id, value: value }).then(callback);
};
app.Messages.setNodeIndex = function(index, newIndex, callback){ app.Messages.setNodeIndex = function(index, newIndex, callback){
browser.runtime.sendMessage({ cmd: app.Messages.Commands.setNodeIndex, path: dial.path, index: index, newIndex: newIndex }).then(callback); browser.runtime.sendMessage({ cmd: app.Messages.Commands.setNodeIndex, path: dial.path, index: index, newIndex: newIndex }).then(callback);
}; };
@@ -140,10 +200,11 @@ app.GridNodes._changed = function(node){
dial.init = function(){ dial.init = function(){
dial.initMenus(); //dial.initMenus();
dial.Title = document.createElement('title'); dial.Title = document.createElement('title');
document.head.appendChild(dial.Title); document.head.appendChild(dial.Title);
}; };
/*
dial.initMenus = function(){ dial.initMenus = function(){
document.body.setAttribute('contextmenu', 'page'); document.body.setAttribute('contextmenu', 'page');
dial.PageMenu = document.createElement('menu'); dial.PageMenu = document.createElement('menu');
@@ -194,6 +255,12 @@ dial.initMenus = function(){
dial.refreshNode(dial._selectedItem); dial.refreshNode(dial._selectedItem);
}; };
dial.ItemMenuCaptureHere = document.createElement('menuitem');
dial.ItemMenuCaptureHere.label = browser.i18n.getMessage("menuCaptureHere");
dial.ItemMenuCaptureHere.onclick = function(){
dial.captureHere(dial._selectedItem);
};
dial.ItemMenuCapture = document.createElement('menuitem'); dial.ItemMenuCapture = document.createElement('menuitem');
dial.ItemMenuCapture.label = browser.i18n.getMessage("menuCapturePage"); dial.ItemMenuCapture.label = browser.i18n.getMessage("menuCapturePage");
dial.ItemMenuCapture.onclick = function(){ dial.ItemMenuCapture.onclick = function(){
@@ -214,36 +281,67 @@ dial.initMenus = function(){
dial.ItemMenu.appendChild(document.createElement('hr')); dial.ItemMenu.appendChild(document.createElement('hr'));
dial.ItemMenu.appendChild(dial.ItemMenuProperties); dial.ItemMenu.appendChild(dial.ItemMenuProperties);
dial.ItemMenu.appendChild(dial.ItemMenuRefresh); dial.ItemMenu.appendChild(dial.ItemMenuRefresh);
dial.ItemMenu.appendChild(dial.ItemMenuCaptureHere);
dial.ItemMenu.appendChild(dial.ItemMenuCapture); dial.ItemMenu.appendChild(dial.ItemMenuCapture);
dial.ItemMenu.appendChild(dial.ItemMenuDelete); dial.ItemMenu.appendChild(dial.ItemMenuDelete);
dial.ItemMenu.appendChild(document.createElement('hr')); dial.ItemMenu.appendChild(document.createElement('hr'));
dial.ItemMenu.appendChild(dial.ItemMenuSettings); dial.ItemMenu.appendChild(dial.ItemMenuSettings);
document.body.appendChild(dial.ItemMenu); document.body.appendChild(dial.ItemMenu);
} }
*/
dial.initStyles = function(){ dial.initStyles = function(){
function applyImageMode(imageMode, target){
switch(imageMode){
case 0:
target.backgroundRepeat = 'no-repeat';
target.backgroundSize = '100% 100%';
break;
case 1:
target.backgroundRepeat = 'no-repeat';
target.backgroundSize = 'cover';
target.backgroundPosition = 'center';
break;
case 2:
target.backgroundRepeat = 'no-repeat';
target.backgroundSize = 'contain';
target.backgroundPosition = 'center';
break;
case 3:
target.backgroundRepeat = 'no-repeat';
target.backgroundPosition = 'center';
break;
}
}
var oldStyle = dial.Style; var oldStyle = dial.Style;
dial.Style = document.createElement('style'), StyleSheet; dial.Style = document.createElement('style'), StyleSheet;
document.head.appendChild(dial.Style); document.head.appendChild(dial.Style);
dial.styles = {}; dial.styles = {};
dial.styles.html = dial.Style.sheet.cssRules[dial.Style.sheet.insertRule('html { height: 100%; }')].style; dial.styles.html = dial.Style.sheet.cssRules[dial.Style.sheet.insertRule('html { height: 100%; }')].style;
dial.styles.body = dial.Style.sheet.cssRules[dial.Style.sheet.insertRule('body { user-select: none; -moz-user-select: none; display: flex; width: 100%; height: 100%; margin: 0px; padding: 0px; background-color: ' + app.settings.backgroundColor + '; background-image: ' + app.settings.backgroundImage + '; background-repeat: no-repeat; background-size: 100% 100%; }')].style; dial.styles.body = dial.Style.sheet.cssRules[dial.Style.sheet.insertRule('body { user-select: none; -moz-user-select: none; display: flex; width: 100%; height: 100%; margin: 0px; padding: 0px; background-color: ' + app.settings.backgroundColor + '; background-image: ' + app.settings.backgroundImage + '; }')].style;
applyImageMode(app.settings.backgroundMode, dial.styles.body);
dial.styles.grid = {}; 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.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.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; 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.cellHover = dial.Style.sheet.cssRules[dial.Style.sheet.insertRule('.Grid td:hover {}')].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.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; opacity: ' + app.settings.grid.cells.opacity + '; border: ' + app.settings.grid.cells.borderSize + 'px 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 + '; margin: ' + app.settings.grid.cells.marginHover + 'px; 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 + '; border-width: ' + app.settings.grid.cells.borderSizeHover + 'px; margin: ' + app.settings.grid.cells.marginHover + 'px; opacity: ' + app.settings.grid.cells.opacityHover + '; 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.linkPanel = dial.Style.sheet.cssRules[dial.Style.sheet.insertRule('.Grid td>a>div:first-child { background-repeat: no-repeat; }')].style;
if(app.settings.grid.cells.backgroundColor) dial.styles.grid.linkPanel.backgroundColor = app.settings.grid.cells.backgroundColor; if(app.settings.grid.cells.backgroundColor) dial.styles.grid.linkPanel.backgroundColor = app.settings.grid.cells.backgroundColor;
dial.styles.grid.linkPanelHover = dial.Style.sheet.cssRules[dial.Style.sheet.insertRule('.Grid td>a:hover>div:first-child { }')].style; dial.styles.grid.linkPanelHover = dial.Style.sheet.cssRules[dial.Style.sheet.insertRule('.Grid td>a:hover>div:first-child { }')].style;
if(app.settings.grid.cells.backgroundColorHover) dial.styles.grid.linkPanelHover.backgroundColor = app.settings.grid.cells.backgroundColorHover; if(app.settings.grid.cells.backgroundColorHover) dial.styles.grid.linkPanelHover.backgroundColor = app.settings.grid.cells.backgroundColorHover;
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; else dial.styles.grid.linkPanelHover.backgroundColor = 'transparent';
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 + '; text-align: center; overflow: hidden; color: ' + app.settings.grid.cells.titleColor + '; border-top: ' + app.settings.grid.cells.titleBorderSize + 'px solid ' + app.settings.grid.cells.borderColor + '; }')].style;
if(app.settings.grid.cells.titleBackgroundColor) dial.styles.grid.linkTitle.backgroundColor = app.settings.grid.cells.titleBackgroundColor; if(app.settings.grid.cells.titleBackgroundColor) dial.styles.grid.linkTitle.backgroundColor = app.settings.grid.cells.titleBackgroundColor;
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; else dial.styles.grid.linkTitle.backgroundColor = 'transparent';
dial.styles.grid.linkTitleHover = dial.Style.sheet.cssRules[dial.Style.sheet.insertRule('.Grid td>a:hover>div:last-child { font-size: ' + app.settings.grid.cells.titleFontSizeHover + 'pt; color: ' + app.settings.grid.cells.titleColorHover + '; border-top-width: ' + app.settings.grid.cells.titleBorderSizeHover + 'px; border-top-color: ' + app.settings.grid.cells.borderColorHover + ' }')].style;
if(app.settings.grid.cells.titleBackgroundColorHover) dial.styles.grid.linkTitleHover.backgroundColor = app.settings.grid.cells.titleBackgroundColorHover; if(app.settings.grid.cells.titleBackgroundColorHover) dial.styles.grid.linkTitleHover.backgroundColor = app.settings.grid.cells.titleBackgroundColorHover;
else dial.styles.grid.linkTitleHover.backgroundColor = 'transparent';
dial.styles.grid.linkEmpty = dial.Style.sheet.cssRules[dial.Style.sheet.insertRule('.Grid td>a.Empty { display: none; }')].style; dial.styles.grid.linkEmpty = dial.Style.sheet.cssRules[dial.Style.sheet.insertRule('.Grid td>a.Empty { display: none; }')].style;
dial.styles.grid.linkBack = dial.Style.sheet.cssRules[dial.Style.sheet.insertRule('.Grid td>a.Back :first-child { background-image: ' + app.settings.grid.backIcon + '; background-repeat: no-repeat; background-position: center center; }')].style; dial.styles.grid.linkBack = dial.Style.sheet.cssRules[dial.Style.sheet.insertRule('.Grid td>a.Back :first-child { background-image: ' + app.settings.grid.backIcon + '; }')].style;
applyImageMode(app.settings.grid.backIconMode, dial.styles.grid.linkBack);
dial.styles.grid.linkFolder = dial.Style.sheet.cssRules[dial.Style.sheet.insertRule('.Grid td>a.Folder :first-child { background-image: ' + app.settings.grid.folderIcon + '; background-repeat: no-repeat; background-size: 100% 100%; }')].style; dial.styles.grid.linkFolder = dial.Style.sheet.cssRules[dial.Style.sheet.insertRule('.Grid td>a.Folder :first-child { background-image: ' + app.settings.grid.folderIcon + '; background-repeat: no-repeat; background-size: 100% 100%; }')].style;
applyImageMode(app.settings.grid.folderIconMode, dial.styles.grid.linkFolder);
dial.styles.grid.linkBookmark = dial.Style.sheet.cssRules[dial.Style.sheet.insertRule('.Grid td>a.Bookmark :first-child { background-repeat: no-repeat; background-size: 100% 100%; }')].style; dial.styles.grid.linkBookmark = dial.Style.sheet.cssRules[dial.Style.sheet.insertRule('.Grid td>a.Bookmark :first-child { background-repeat: no-repeat; background-size: 100% 100%; }')].style;
dial.styles.grid.linkBookmarkLoading = dial.Style.sheet.cssRules[dial.Style.sheet.insertRule('.Grid td>a.BookmarkLoading :first-child { background-image: url("' + app.settings.grid.cells.loadingIcon + '"); background-repeat: no-repeat; background-position: center center; }')].style; dial.styles.grid.linkBookmarkLoading = dial.Style.sheet.cssRules[dial.Style.sheet.insertRule('.Grid td>a.BookmarkLoading :first-child { background-image: url("' + app.settings.grid.cells.loadingIcon + '"); background-repeat: no-repeat; background-position: center center; }')].style;
if(oldStyle) document.head.removeChild(oldStyle); if(oldStyle) document.head.removeChild(oldStyle);
@@ -267,19 +365,48 @@ dial.initGrid = function(){
link.className = 'Empty'; link.className = 'Empty';
link.appendChild(document.createElement('div')); link.appendChild(document.createElement('div'));
link.appendChild(document.createElement('div')); link.appendChild(document.createElement('div'));
link.onmousedown = function(){ dial._selectedItem = this; }; link.onmousedown = function(){
dial._selectedItem = this;
/*
if(dial._selectedItem.Node){
switch(dial._selectedItem.Node.type){
case app.GridNodes.GridNodeType.folder:
dial.ItemMenuCaptureHere.hidden = true;
break;
case app.GridNodes.GridNodeType.bookmark:
//dial.ItemMenuCaptureHere.hidden = false;
dial.ItemMenuCaptureHere.hidden = true;
break;
}
}
*/
};
function dragstart_handler(ev) { function dragstart_handler(ev) {
if(!ev.target.Node){ if(!ev.target.Node){
ev.preventDefault(); ev.preventDefault();
return; return;
} }
if(dial.page == 0) dial.page = 1;
var index = (dial.page - 1) * (app.settings.grid.rows * app.settings.grid.columns) + +(ev.target.parentElement.getAttribute('gridindex')); var index = (dial.page - 1) * (app.settings.grid.rows * app.settings.grid.columns) + +(ev.target.parentElement.getAttribute('gridindex'));
if(app.settings.grid.backNode && dial.path != '/') index -= dial.page; if(app.settings.grid.backNode && dial.path != '/') index -= dial.page;
ev.dataTransfer.setData("text/plain", index); ev.dataTransfer.setData("text/plain", JSON.stringify({parentId: app.node.id, index: index}));
} }
function dragover_handler(ev) { function dragover_handler(ev) {
ev.preventDefault(); ev.preventDefault();
var data = ev.dataTransfer.getData("text");
try {
data = JSON.parse(data);
} catch(e) {
data = null;
}
if(!data){
ev.dataTransfer.dropEffect = "none";
return;
} else if(data.parentId != app.node.id){
ev.dataTransfer.dropEffect = "none";
return;
}
if(app.settings.grid.backNode && dial.path != '/'){ if(app.settings.grid.backNode && dial.path != '/'){
var gridIndex = 0; var gridIndex = 0;
if(ev.target.tagName == 'DIV') gridIndex = +(ev.target.parentElement.parentElement.getAttribute('gridindex')); if(ev.target.tagName == 'DIV') gridIndex = +(ev.target.parentElement.parentElement.getAttribute('gridindex'));
@@ -293,7 +420,15 @@ dial.initGrid = function(){
function drop_handler(ev) { function drop_handler(ev) {
ev.preventDefault(); ev.preventDefault();
if(ev.buttons == 1) return; if(ev.buttons == 1) return;
var StartIndex = ev.dataTransfer.getData("text"); var data = ev.dataTransfer.getData("text");
try {
data = JSON.parse(data);
} catch(e) {
data = null;
}
if(!data) return;
else if(data.parentId != app.node.id) return;
var StartIndex = data.index;
var EndIndex = 0; var EndIndex = 0;
if(ev.target.tagName == 'DIV'){ if(ev.target.tagName == 'DIV'){
EndIndex = (dial.page - 1) * (app.settings.grid.rows * app.settings.grid.columns) + +(ev.target.parentElement.parentElement.getAttribute('gridindex')); EndIndex = (dial.page - 1) * (app.settings.grid.rows * app.settings.grid.columns) + +(ev.target.parentElement.parentElement.getAttribute('gridindex'));
@@ -315,29 +450,79 @@ dial.initGrid = function(){
return dial.Grid; return dial.Grid;
}; };
dial.updateGridLayout = function(){ dial.updateGridLayout = function(){
var fullWidth = dial.Grid.parentElement.offsetWidth - 2 * app.settings.grid.margin; var parentWidth = dial.Grid.parentElement.offsetWidth;
var fullHeight = dial.Grid.parentElement.offsetHeight - 2 * app.settings.grid.margin; var parentHeight = dial.Grid.parentElement.offsetHeight;
var linkWidth = fullWidth / app.settings.grid.columns;
var linkHeight = fullHeight / app.settings.grid.rows;
if(linkWidth <= linkHeight * 4 / 3) linkHeight = linkWidth / 4 * 3;
else linkWidth = linkHeight / 3 * 4;
dial.styles.grid.cell.width = linkWidth.toString() + 'px'; function calc(gridMargin, cellsMargin, borderSize, titleBorderSize){
dial.styles.grid.cell.height = linkHeight.toString() + 'px'; var fullWidth = parentWidth - 2 * gridMargin;
var fullHeight = parentHeight - 2 * gridMargin;
var cellWidth = fullWidth / app.settings.grid.columns;
var cellHeight = fullHeight / app.settings.grid.rows;
var linkWidth = 0;
var linkHeight = 0;
if(cellWidth <= cellHeight * app.settings.grid.ratioX / app.settings.grid.ratioY) cellHeight = cellWidth / app.settings.grid.ratioX * app.settings.grid.ratioY;
else cellWidth = cellHeight / app.settings.grid.ratioY * app.settings.grid.ratioX;
linkWidth = cellWidth - 2 * (cellsMargin + 1) - 2 * borderSize;
linkHeight = cellHeight - 2 * (cellsMargin + 1) - 2 * borderSize - titleBorderSize;
return {
cellWidth: cellWidth,
cellHeight: cellHeight,
linkWidth: linkWidth,
linkHeight: linkHeight
};
}
linkWidth = linkWidth - 2 * (app.settings.grid.cells.margin + 1); var values = calc(app.settings.grid.margin, app.settings.grid.cells.margin, app.settings.grid.cells.borderSize, app.settings.grid.cells.titleBorderSize);
linkHeight = linkHeight - 2 * (app.settings.grid.cells.margin + 1); dial.styles.grid.cell.width = values.cellWidth.toString() + 'px';
dial.styles.grid.cell.height = values.cellHeight.toString() + 'px';
dial.styles.grid.link.width = values.linkWidth.toString() + 'px';
dial.styles.grid.link.height = values.linkHeight.toString() + 'px';
if(app.settings.grid.cells.title) dial.styles.grid.linkPanel.height = (values.linkHeight - app.settings.grid.cells.titleHeight - 1 - app.settings.grid.cells.titleBorderSize).toString() + 'px';
else dial.styles.grid.linkPanel.height = values.linkHeight.toString() + 'px';
dial.styles.grid.link.width = linkWidth.toString() + 'px'; values = calc(app.settings.grid.margin, app.settings.grid.cells.marginHover, app.settings.grid.cells.borderSizeHover, app.settings.grid.cells.titleBorderSizeHover);
dial.styles.grid.link.height = linkHeight.toString() + 'px'; dial.styles.grid.cellHover.width = values.cellWidth.toString() + 'px';
if(app.settings.grid.cells.title) dial.styles.grid.linkPanel.height = (linkHeight - app.settings.grid.cells.titleHeight - 1).toString() + 'px'; dial.styles.grid.cellHover.height = values.cellHeight.toString() + 'px';
else dial.styles.grid.linkPanel.height = linkHeight.toString() + 'px'; dial.styles.grid.linkHover.width = values.linkWidth.toString() + 'px';
dial.styles.grid.linkHover.height = values.linkHeight.toString() + 'px';
if(app.settings.grid.cells.titleHover) dial.styles.grid.linkPanelHover.height = (values.linkHeight - app.settings.grid.cells.titleHeightHover - 1 - app.settings.grid.cells.titleBorderSizeHover).toString() + 'px';
else dial.styles.grid.linkPanelHover.height = values.linkHeight.toString() + 'px';
}; };
dial.populateGrid = function(){ dial.populateGrid = function(){
function applyImageMode(imageMode, target){
switch(imageMode){
case -1:
target.backgroundRepeat = '';
target.backgroundSize = '';
target.backgroundPosition = '';
break;
case 0:
target.backgroundRepeat = 'no-repeat';
target.backgroundSize = '100% 100%';
target.backgroundPosition = '';
break;
case 1:
target.backgroundRepeat = 'no-repeat';
target.backgroundSize = 'cover';
target.backgroundPosition = 'center';
break;
case 2:
target.backgroundRepeat = 'no-repeat';
target.backgroundSize = 'contain';
target.backgroundPosition = 'center';
break;
case 3:
target.backgroundRepeat = 'no-repeat';
target.backgroundSize = 'auto auto';
target.backgroundPosition = 'center';
break;
}
}
populateEmpty = function(link){ populateEmpty = function(link){
link.Node = null; link.Node = null;
link.className = 'Empty'; link.className = 'Empty';
link.childNodes[0].style.backgroundImage = ''; link.childNodes[0].style.backgroundImage = '';
link.removeAttribute('target');
link.href = null; link.href = null;
link.onclick = null; link.onclick = null;
link.removeAttribute('contextmenu'); link.removeAttribute('contextmenu');
@@ -347,25 +532,47 @@ dial.populateGrid = function(){
link.className = 'Back'; link.className = 'Back';
link.childNodes[0].style.backgroundImage = ''; link.childNodes[0].style.backgroundImage = '';
link.childNodes[1].innerText = 'Back'; link.childNodes[1].innerText = 'Back';
link.href = '#'; link.removeAttribute('target');
link.onclick = function(){ window.history.back(); } var parentPath = dial.path.substring(0, dial.path.lastIndexOf('/', dial.path.length - 2));
link.href = utils.getDialUrl(parentPath);
link.onclick = function(e){
if(e.ctrlKey || e.shiftKey || e.altKey || e.metaKey) return;
if(!window.navigation || !navigation.canGoBack) return;
var previousUrl = navigation.entries()[navigation.currentEntry.index - 1].url;
if(!previousUrl) return;
previousUrl = new URL(previousUrl);
if(previousUrl.pathname != location.pathname || (previousUrl.searchParams.get('path') || '') != parentPath) return;
e.preventDefault();
navigation.back().committed.catch(function(){ location.assign(link.href); });
};
link.removeAttribute('contextmenu'); link.removeAttribute('contextmenu');
} }
populateFolder = function(link, node){ populateFolder = function(link, node){
link.Node = node; link.Node = node;
link.className = 'Folder'; link.className = 'Folder';
if(node.imageMode || node.imageMode == 0) applyImageMode(node.imageMode, link.childNodes[0].style);
else applyImageMode(-1, link.childNodes[0].style);
if(node.image){ if(node.image){
if(node.image.indexOf('url(')>=0) link.childNodes[0].style.backgroundImage = node.image; if(node.image.indexOf('url(')>=0) link.childNodes[0].style.backgroundImage = node.image;
else link.childNodes[0].style.backgroundImage = 'url(' + node.image + ')'; else link.childNodes[0].style.backgroundImage = 'url(' + node.image + ')';
} else link.childNodes[0].style.backgroundImage = ''; } else link.childNodes[0].style.backgroundImage = '';
link.childNodes[1].innerText = node.title; link.childNodes[1].innerText = node.title;
if(dial.path) link.href = '?' + 'bg=' + encodeURIComponent(app.settings.backgroundColor) + '&path=' + encodeURIComponent(dial.path + node.title); switch(app.settings.grid.openFolderMethod){
else link.href = '?' + 'bg=' + encodeURIComponent(app.settings.backgroundColor) + '&path=' + encodeURIComponent(node.title); case 0:
link.removeAttribute('target');
break;
case 1:
link.target = '_blank';
break;
}
link.href = utils.getDialUrl(dial.path + node.title);
link.onclick = null; link.onclick = null;
link.setAttribute('contextmenu', 'item'); link.setAttribute('contextmenu', 'item');
} }
populateBookmark = function(link, node){ populateBookmark = function(link, node){
link.Node = node; link.Node = node;
if(node.imageMode || node.imageMode == 0) applyImageMode(node.imageMode, link.childNodes[0].style);
else applyImageMode(-1, link.childNodes[0].style);
if(node.image){ if(node.image){
link.className = 'Bookmark'; link.className = 'Bookmark';
if(node.image.indexOf('url(')>=0) link.childNodes[0].style.backgroundImage = node.image; if(node.image.indexOf('url(')>=0) link.childNodes[0].style.backgroundImage = node.image;
@@ -376,6 +583,14 @@ dial.populateGrid = function(){
dial.refreshNode(link); dial.refreshNode(link);
} }
link.childNodes[1].innerText = node.title; link.childNodes[1].innerText = node.title;
switch(app.settings.grid.openBookmarkMethod){
case 0:
link.removeAttribute('target');
break;
case 1:
link.target = '_blank';
break;
}
link.href = node.url; link.href = node.url;
link.onclick = null; link.onclick = null;
link.setAttribute('contextmenu', 'item'); link.setAttribute('contextmenu', 'item');
@@ -430,6 +645,88 @@ dial.refreshNode = function(selectedItem){
selectedItem.childNodes[0].style.backgroundImage = app.settings.grid.loadingIcon; selectedItem.childNodes[0].style.backgroundImage = app.settings.grid.loadingIcon;
app.Messages.refreshNode(selectedItem.Node.id); app.Messages.refreshNode(selectedItem.Node.id);
} }
dial.captureHere = function(selectedItem){
function headersReceived(e){
for (let i = e.responseHeaders.length - 1; i >= 0; i--) {
switch(e.responseHeaders[i].name.toLowerCase()){
case 'x-frame-options':
case 'frame-options':
case 'content-security-policy':
e.responseHeaders.splice(i, 1);
break;
}
}
return { responseHeaders: e.responseHeaders };
};
function pageLoaded(){
if(!iframe) return;
function clean(){
if(!iframe) return;
selectedItem.children[0].removeChild(iframe);
dial.capture -= 1;
if(dial.capture == 0){
browser.webRequest.onHeadersReceived.removeListener(headersReceived);
browser.tabs.update(tab.id, {muted: false}).then();
}
iframe = null;
}
setTimeout(function(){
browser.tabs.captureVisibleTab().then(function(img){
var imgObj = new Image;
imgObj.src = img;
var canvas = document.createElement('canvas');
canvas.style.width = rect.width.toString() + 'px';
canvas.style.height = rect.height.toString() + 'px';
canvas.width = rect.width;
canvas.height = rect.height;
var ctx = canvas.getContext('2d');
ctx.clearRect(0, 0, rect.width, rect.height);
ctx.save();
setTimeout(function(){
ctx.drawImage(imgObj, rect.left, rect.top, rect.width, rect.height, 0, 0, rect.width, rect.height);
ctx.restore();
img = canvas.toDataURL();
selectedItem.children[0].style.backgroundImage = 'url(' + img + ')';
clean();
app.Messages.updateNode(selectedItem.Node.id, { image: img }, function(){
setTimeout(function(){
if(dial.capture == 0) dial.skipUpdate = false;
}, 500);
});
}, 500);
}, clean);
}, 3000);
};
var tab = null;
var previewWidth = 1200; // Need to be linked to settings
var previewHeight = 710; // Need to be linked to settings
var iframe = document.createElement('iframe');
var rect = selectedItem.children[0].getBoundingClientRect();
browser.tabs.getCurrent().then(function(currentTab){
tab = currentTab;
var ratioX = previewWidth / selectedItem.children[0].offsetWidth;
var ratioY = previewHeight / selectedItem.children[0].offsetHeight;
iframe.style.width = ratioX * selectedItem.children[0].offsetWidth + 'px';
iframe.style.height = ratioY * selectedItem.children[0].offsetHeight + 'px';
iframe.style.position = 'absolute';
iframe.style.MozTransform = 'scale(' + (1/ratioX) + ', ' + (1/ratioY) + ')';
iframe.style.MozTransformOrigin = 'top left';
iframe.sandbox = 'allow-scripts allow-same-origin';
iframe.onload = function(){ pageLoaded(); }
dial.capture += 1;
if(dial.capture == 1){
dial.skipUpdate = true;
browser.webRequest.onHeadersReceived.addListener(headersReceived, { urls:['*://*/*'], types:['sub_frame'] }, ['blocking', 'responseHeaders']);
browser.tabs.update(tab.id, {muted: true}).then();
}
iframe.src = selectedItem.Node.url;
selectedItem.children[0].appendChild(iframe);
//setTimeout(function(){ pageLoaded(); }, 6000);
});
}
dial.capturePage = function(selectedItem){ dial.capturePage = function(selectedItem){
selectedItem.className = 'BookmarkLoading'; selectedItem.className = 'BookmarkLoading';
selectedItem.childNodes[0].style.backgroundImage = app.settings.grid.loadingIcon; selectedItem.childNodes[0].style.backgroundImage = app.settings.grid.loadingIcon;
+6 -2
View File
@@ -19,11 +19,14 @@ app.init = function(){
app.Messages.getNodeByID(new URL(window.location).searchParams.get('id'), function(node){ app.Messages.getNodeByID(new URL(window.location).searchParams.get('id'), function(node){
app.node = node; app.node = node;
Title.value = node.title; Title.value = node.title;
if(node.imageMode == 0) ImageMode.value = 0;
else if(node.imageMode) ImageMode.value = node.imageMode;
ImagePreview.style.backgroundRepeat = 'no-repeat'; ImagePreview.style.backgroundRepeat = 'no-repeat';
ImagePreview.style.backgroundSize = '100% 100%'; ImagePreview.style.backgroundSize = '100% 100%';
switch(node.type){ switch(node.type){
case app.GridNodes.GridNodeType.folder: case app.GridNodes.GridNodeType.folder:
TitleLocked.parentNode.style.display = 'none'; TitleLocked.parentNode.style.display = 'none';
ImageLocked.parentNode.style.display = 'none';
Url.parentNode.parentNode.style.display = 'none'; Url.parentNode.parentNode.style.display = 'none';
if(node.image){ if(node.image){
if(node.image.indexOf('url(')>=0) Image = node.image; if(node.image.indexOf('url(')>=0) Image = node.image;
@@ -34,6 +37,7 @@ app.init = function(){
break; break;
case app.GridNodes.GridNodeType.bookmark: case app.GridNodes.GridNodeType.bookmark:
TitleLocked.checked = (node.titleLocked==true); TitleLocked.checked = (node.titleLocked==true);
ImageLocked.checked = (node.imageLocked==true);
ImageDefault.style.display = 'none'; ImageDefault.style.display = 'none';
Url.value = node.url; Url.value = node.url;
if(node.image.indexOf('url(')>=0) Image = node.image; if(node.image.indexOf('url(')>=0) Image = node.image;
@@ -97,10 +101,10 @@ app.init = function(){
BtnApply.onclick = function(){ BtnApply.onclick = function(){
switch(app.node.type){ switch(app.node.type){
case app.GridNodes.GridNodeType.folder: case app.GridNodes.GridNodeType.folder:
app.Messages.updateNode(app.node.id, { title: Title.value, image: Image }) app.Messages.updateNode(app.node.id, { title: Title.value, image: Image, imageMode: +(ImageMode.value) })
break; break;
case app.GridNodes.GridNodeType.bookmark: case app.GridNodes.GridNodeType.bookmark:
app.Messages.updateNode(app.node.id, { title: Title.value, titleLocked: TitleLocked.checked, url: Url.value, image: Image }) app.Messages.updateNode(app.node.id, { title: Title.value, titleLocked: TitleLocked.checked, imageLocked: ImageLocked.checked, url: Url.value, image: Image, imageMode: +(ImageMode.value) })
break; break;
} }
} }
+54 -2
View File
@@ -19,27 +19,41 @@ app.init = function(){
}); });
app.Messages.getSettings(function(settings){ app.Messages.getSettings(function(settings){
app.settings = settings; app.settings = settings;
MenuShowAdd.checked = app.settings.menuShowAdd;
BackgroundColor.value = app.settings.backgroundColor; BackgroundColor.value = app.settings.backgroundColor;
BackgroundImage = app.settings.backgroundImage; BackgroundImage = app.settings.backgroundImage;
BackgroundMode.value = app.settings.backgroundMode;
BackgroundPreview.style.backgroundColor = app.settings.backgroundColor; BackgroundPreview.style.backgroundColor = app.settings.backgroundColor;
BackgroundPreview.style.backgroundImage = app.settings.backgroundImage; BackgroundPreview.style.backgroundImage = app.settings.backgroundImage;
BackgroundPreview.style.backgroundRepeat = 'no-repeat'; BackgroundPreview.style.backgroundRepeat = 'no-repeat';
BackgroundPreview.style.backgroundSize = '100% 100%'; BackgroundPreview.style.backgroundSize = '100% 100%';
ButtonOpenInNewPage.checked = app.settings.openQuickDialInNewPage;
StartupTimeout.value = app.settings.startpageTimeout;
GridRoot.value = app.settings.grid.root; GridRoot.value = app.settings.grid.root;
GridRows.value = app.settings.grid.rows; GridRows.value = app.settings.grid.rows;
GridRatioX.value = app.settings.grid.ratioX;
GridRatioY.value = app.settings.grid.ratioY;
GridMargins.value = app.settings.grid.margin; GridMargins.value = app.settings.grid.margin;
GridColumns.value = app.settings.grid.columns; GridColumns.value = app.settings.grid.columns;
GridOpenBookmarksIn.value = app.settings.grid.openBookmarkMethod;
GridOpenFoldersIn.value = app.settings.grid.openFolderMethod;
GridBackNode.checked = app.settings.grid.backNode; GridBackNode.checked = app.settings.grid.backNode;
GridBackMode.value = app.settings.grid.backIconMode;
GridBackImage = app.settings.grid.backIcon; GridBackImage = app.settings.grid.backIcon;
GridBackPreview.style.backgroundImage = app.settings.grid.backIcon; GridBackPreview.style.backgroundImage = app.settings.grid.backIcon;
GridBackPreview.style.backgroundRepeat = 'no-repeat'; GridBackPreview.style.backgroundRepeat = 'no-repeat';
GridBackPreview.style.backgroundPosition = '50% 50%'; GridBackPreview.style.backgroundPosition = '50% 50%';
GridFolderMode.value = app.settings.grid.folderIconMode;
GridFolderImage = app.settings.grid.folderIcon; GridFolderImage = app.settings.grid.folderIcon;
GridFolderPreview.style.backgroundImage = app.settings.grid.folderIcon; GridFolderPreview.style.backgroundImage = app.settings.grid.folderIcon;
GridFolderPreview.style.backgroundRepeat = 'no-repeat'; GridFolderPreview.style.backgroundRepeat = 'no-repeat';
GridFolderPreview.style.backgroundSize = '100% 100%'; GridFolderPreview.style.backgroundSize = '100% 100%';
GridCellsMargins.value = app.settings.grid.cells.margin; GridCellsMargins.value = app.settings.grid.cells.margin;
GridCellsMarginsHover.value = app.settings.grid.cells.marginHover; GridCellsMarginsHover.value = app.settings.grid.cells.marginHover;
GridCellsOpacity.value = app.settings.grid.cells.opacity * 100;
GridCellsOpacityHover.value = app.settings.grid.cells.opacityHover * 100;
GridCellsBorderSize.value = app.settings.grid.cells.borderSize;
GridCellsBorderSizeHover.value = app.settings.grid.cells.borderSizeHover;
GridCellsBackgroundTransparent.checked = (app.settings.grid.cells.backgroundColor == null); GridCellsBackgroundTransparent.checked = (app.settings.grid.cells.backgroundColor == null);
GridCellsBackgroundColor.value = app.settings.grid.cells.backgroundColor; GridCellsBackgroundColor.value = app.settings.grid.cells.backgroundColor;
GridCellsBackgroundTransparentHover.checked = (app.settings.grid.cells.backgroundColorHover == null); GridCellsBackgroundTransparentHover.checked = (app.settings.grid.cells.backgroundColorHover == null);
@@ -49,14 +63,20 @@ app.init = function(){
GridCellsBorderColor.value = app.settings.grid.cells.borderColor; GridCellsBorderColor.value = app.settings.grid.cells.borderColor;
GridCellsBorderColorHover.value = app.settings.grid.cells.borderColorHover; GridCellsBorderColorHover.value = app.settings.grid.cells.borderColorHover;
GridCellsTitle.checked = app.settings.grid.cells.title; GridCellsTitle.checked = app.settings.grid.cells.title;
GridCellsTitleHover.checked = app.settings.grid.cells.titleHover;
GridCellsTitleHeight.value = app.settings.grid.cells.titleHeight; GridCellsTitleHeight.value = app.settings.grid.cells.titleHeight;
GridCellsTitleHeightHover.value = app.settings.grid.cells.titleHeightHover;
GridCellsTitleFontSize.value = app.settings.grid.cells.titleFontSize; GridCellsTitleFontSize.value = app.settings.grid.cells.titleFontSize;
GridCellsTitleFontSizeHover.value = app.settings.grid.cells.titleFontSizeHover;
GridCellsTitleBorderSize.value = app.settings.grid.cells.titleBorderSize;
GridCellsTitleBorderSizeHover.value = app.settings.grid.cells.titleBorderSizeHover;
GridCellsTitleColor.value = app.settings.grid.cells.titleColor; GridCellsTitleColor.value = app.settings.grid.cells.titleColor;
GridCellsTitleColorHover.value = app.settings.grid.cells.titleColorHover; GridCellsTitleColorHover.value = app.settings.grid.cells.titleColorHover;
GridCellsTitleBackgroundTransparent.checked = (app.settings.grid.cells.titleBackgroundColor == null); GridCellsTitleBackgroundTransparent.checked = (app.settings.grid.cells.titleBackgroundColor == null);
GridCellsTitleBackgroundColor.value = app.settings.grid.cells.titleBackgroundColor; GridCellsTitleBackgroundColor.value = app.settings.grid.cells.titleBackgroundColor;
GridCellsTitleBackgroundColorHover.value = app.settings.grid.cells.titleBackgroundColorHover; GridCellsTitleBackgroundColorHover.value = app.settings.grid.cells.titleBackgroundColorHover;
GridCellsTitleBackgroundTransparentHover.checked = (app.settings.grid.cells.titleBackgroundColorHover == null); GridCellsTitleBackgroundTransparentHover.checked = (app.settings.grid.cells.titleBackgroundColorHover == null);
GridCellsSnapshotDelay.value = app.settings.grid.cells.snapshotDelay;
}); });
BtnOk.onclick = function(){ BtnOk.onclick = function(){
@@ -64,17 +84,30 @@ app.init = function(){
window.frameElement.popup.close(); window.frameElement.popup.close();
} }
BtnApply.onclick = function(){ BtnApply.onclick = function(){
app.settings.menuShowAdd = MenuShowAdd.checked;
app.settings.backgroundColor = BackgroundColor.value; app.settings.backgroundColor = BackgroundColor.value;
app.settings.backgroundImage = BackgroundImage; app.settings.backgroundImage = BackgroundImage;
app.settings.backgroundMode = +(BackgroundMode.value);
app.settings.openQuickDialInNewPage = ButtonOpenInNewPage.checked;
app.settings.startpageTimeout = StartupTimeout.value;
app.settings.grid.rows = +(GridRows.value); app.settings.grid.rows = +(GridRows.value);
app.settings.grid.margin = +(GridMargins.value); app.settings.grid.margin = +(GridMargins.value);
app.settings.grid.columns = +(GridColumns.value); app.settings.grid.columns = +(GridColumns.value);
app.settings.grid.ratioX = GridRatioX.value;
app.settings.grid.ratioY = GridRatioY.value;
app.settings.grid.openBookmarkMethod = +(GridOpenBookmarksIn.value);
app.settings.grid.openFolderMethod = +(GridOpenFoldersIn.value);
app.settings.grid.backNode = GridBackNode.checked; app.settings.grid.backNode = GridBackNode.checked;
app.settings.grid.backIconMode = +(GridBackMode.value);
app.settings.grid.backIcon = GridBackImage; app.settings.grid.backIcon = GridBackImage;
app.settings.grid.folderIconMode = +(GridFolderMode.value);
app.settings.grid.folderIcon = GridFolderImage; app.settings.grid.folderIcon = GridFolderImage;
app.settings.grid.cells.margin = +(GridCellsMargins.value); app.settings.grid.cells.margin = +(GridCellsMargins.value);
//app.settings.grid.cells.marginHover = +(GridCellsMarginsHover.value); app.settings.grid.cells.marginHover = +(GridCellsMarginsHover.value);
app.settings.grid.cells.marginHover = +(GridCellsMargins.value); app.settings.grid.cells.opacity = +(GridCellsOpacity.value) / 100;
app.settings.grid.cells.opacityHover = +(GridCellsOpacityHover.value) / 100;
app.settings.grid.cells.borderSize = +(GridCellsBorderSize.value);
app.settings.grid.cells.borderSizeHover = +(GridCellsBorderSizeHover.value);
if(GridCellsBackgroundTransparent.checked == true) app.settings.grid.cells.backgroundColor = null; if(GridCellsBackgroundTransparent.checked == true) app.settings.grid.cells.backgroundColor = null;
else app.settings.grid.cells.backgroundColor = GridCellsBackgroundColor.value; else app.settings.grid.cells.backgroundColor = GridCellsBackgroundColor.value;
if(GridCellsBackgroundTransparentHover.checked == true) app.settings.grid.cells.backgroundColorHover = null; if(GridCellsBackgroundTransparentHover.checked == true) app.settings.grid.cells.backgroundColorHover = null;
@@ -84,14 +117,20 @@ app.init = function(){
app.settings.grid.cells.borderColor = GridCellsBorderColor.value; app.settings.grid.cells.borderColor = GridCellsBorderColor.value;
app.settings.grid.cells.borderColorHover = GridCellsBorderColorHover.value; app.settings.grid.cells.borderColorHover = GridCellsBorderColorHover.value;
app.settings.grid.cells.title = GridCellsTitle.checked; app.settings.grid.cells.title = GridCellsTitle.checked;
app.settings.grid.cells.titleHover = GridCellsTitleHover.checked;
app.settings.grid.cells.titleHeight = GridCellsTitleHeight.value; app.settings.grid.cells.titleHeight = GridCellsTitleHeight.value;
app.settings.grid.cells.titleHeightHover = GridCellsTitleHeightHover.value;
app.settings.grid.cells.titleFontSize = GridCellsTitleFontSize.value; app.settings.grid.cells.titleFontSize = GridCellsTitleFontSize.value;
app.settings.grid.cells.titleFontSizeHover = GridCellsTitleFontSizeHover.value;
app.settings.grid.cells.titleBorderSize = GridCellsTitleBorderSize.value;
app.settings.grid.cells.titleBorderSizeHover = GridCellsTitleBorderSizeHover.value;
app.settings.grid.cells.titleColor = GridCellsTitleColor.value; app.settings.grid.cells.titleColor = GridCellsTitleColor.value;
app.settings.grid.cells.titleColorHover = GridCellsTitleColorHover.value; app.settings.grid.cells.titleColorHover = GridCellsTitleColorHover.value;
if(GridCellsTitleBackgroundTransparent.checked == true) app.settings.grid.cells.titleBackgroundColor = null; if(GridCellsTitleBackgroundTransparent.checked == true) app.settings.grid.cells.titleBackgroundColor = null;
else app.settings.grid.cells.titleBackgroundColor = GridCellsTitleBackgroundColor.value; else app.settings.grid.cells.titleBackgroundColor = GridCellsTitleBackgroundColor.value;
if(GridCellsTitleBackgroundTransparentHover.checked == true) app.settings.grid.cells.titleBackgroundColorHover = null; if(GridCellsTitleBackgroundTransparentHover.checked == true) app.settings.grid.cells.titleBackgroundColorHover = null;
else app.settings.grid.cells.titleBackgroundColorHover = GridCellsTitleBackgroundColorHover.value; else app.settings.grid.cells.titleBackgroundColorHover = GridCellsTitleBackgroundColorHover.value;
app.settings.grid.cells.snapshotDelay = GridCellsSnapshotDelay.value;
app.settings.grid.root = GridRoot.value; app.settings.grid.root = GridRoot.value;
browser.runtime.sendMessage( { cmd: app.Messages.Commands.setSettings, settings: app.settings } ); browser.runtime.sendMessage( { cmd: app.Messages.Commands.setSettings, settings: app.settings } );
} }
@@ -135,6 +174,19 @@ app.init = function(){
fileReader.readAsDataURL(BackgroundImageFile.files[0]); fileReader.readAsDataURL(BackgroundImageFile.files[0]);
} }
GridRows.onchange = function(){
if(GridRatioAuto.checked){
GridRatioX.value = GridColumns.value;
GridRatioY.value = GridRows.value;
}
}
GridColumns.onchange = function(){
if(GridRatioAuto.checked){
GridRatioX.value = GridColumns.value;
GridRatioY.value = GridRows.value;
}
}
GridBackImageReset.onclick = function(){ GridBackImageReset.onclick = function(){
GridBackImage = 'url(/img/back.png)'; GridBackImage = 'url(/img/back.png)';
GridBackPreview.style.backgroundImage = GridBackImage; GridBackPreview.style.backgroundImage = GridBackImage;
+9 -5
View File
@@ -2,14 +2,13 @@
"manifest_version": 2, "manifest_version": 2,
"name": "Quick Dial", "name": "Quick Dial",
"version": "0.1.5", "version": "0.1.25",
"author": "MatMoul", "author": "MatMoul",
"homepage_url": "https://github.com/MatMoul/quickdial-webext", "homepage_url": "https://github.com/MatMoul/quickdial-webext",
"developer": { "developer": {
"name": "MatMoul", "name": "MatMoul",
"url": "https://github.com/MatMoul/quickdial-webext" "url": "https://github.com/MatMoul/quickdial-webext"
}, },
"description": "__MSG_extensionDescription__",
"icons": { "icons": {
"24": "img/24.png", "24": "img/24.png",
@@ -21,6 +20,8 @@
"bookmarks", "bookmarks",
"contextMenus", "contextMenus",
"tabs", "tabs",
"webRequest",
"webRequestBlocking",
"<all_urls>" "<all_urls>"
], ],
@@ -36,13 +37,16 @@
}, },
"chrome_url_overrides" : { "chrome_url_overrides" : {
"newtab": "dial" "newtab": "dial.html"
}, },
"applications": { "browser_specific_settings": {
"gecko": { "gecko": {
"id": "quickdial@matmoul.com", "id": "quickdial@matmoul.com",
"strict_min_version": "52.0" "strict_min_version": "140.0",
"data_collection_permissions": {
"required": ["none"]
}
} }
}, },