Преглед изворни кода

moved auto-save menu items in a submenu

Gildas пре 7 година
родитељ
комит
f477630405
3 измењених фајлова са 20 додато и 10 уклоњено
  1. 2 2
      README.MD
  2. 16 6
      extension/ui/bg/ui.js
  3. 2 2
      extension/ui/pages/help.html

+ 2 - 2
README.MD

@@ -23,8 +23,8 @@ https://www.youtube.com/watch?v=RdV8DBW5b0g
    - or all tabs.
  - The context menu also allows you to activate the auto-save of:
    - the current tab,
-   - or unpinned tabs (only in the context menu of the webpage),
-   - or all tabs (only in the context menu of the webpage).
+   - or unpinned tabs,
+   - or all tabs.
  - With auto-save active, pages are automatically saved every time after being loaded (or before being unloaded if not). The period of time to wait before saving the page can be configured in the options page.
  - The options page allows you to auto-save the page after after being loaded or before being unloading only.
  - Right-click on the SingleFile button and select "Options" to open the options page.

+ 16 - 6
extension/ui/bg/ui.js

@@ -35,6 +35,7 @@ singlefile.ui = (() => {
 	const MENU_ID_SAVE_SELECTED_TABS = "save-selected-tabs";
 	const MENU_ID_SAVE_UNPINNED_TABS = "save-unpinned-tabs";
 	const MENU_ID_SAVE_ALL_TABS = "save-tabs";
+	const MENU_ID_AUTO_SAVE = "auto-save";
 	const MENU_ID_AUTO_SAVE_DISABLED = "auto-save-disabled";
 	const MENU_ID_AUTO_SAVE_TAB = "auto-save-tab";
 	const MENU_ID_AUTO_SAVE_UNPINNED = "auto-save-unpinned";
@@ -150,33 +151,42 @@ singlefile.ui = (() => {
 					type: "separator"
 				});
 			}
+			browser.menus.create({
+				id: MENU_ID_AUTO_SAVE,
+				contexts: defaultContexts,
+				title: "Auto-save"
+			});
 			browser.menus.create({
 				id: MENU_ID_AUTO_SAVE_DISABLED,
 				type: "radio",
-				title: "Disable Auto-save",
+				title: "Disabled",
 				contexts: defaultContexts,
-				checked: true
+				checked: true,
+				parentId: MENU_ID_AUTO_SAVE
 			});
 			browser.menus.create({
 				id: MENU_ID_AUTO_SAVE_TAB,
 				type: "radio",
 				title: "Auto-save this tab",
 				contexts: defaultContexts,
-				checked: false
+				checked: false,
+				parentId: MENU_ID_AUTO_SAVE
 			});
 			browser.menus.create({
 				id: MENU_ID_AUTO_SAVE_UNPINNED,
 				type: "radio",
 				title: "Auto-save unpinned tabs",
 				contexts: defaultContexts,
-				checked: false
+				checked: false,
+				parentId: MENU_ID_AUTO_SAVE
 			});
 			browser.menus.create({
 				id: MENU_ID_AUTO_SAVE_ALL,
 				type: "radio",
 				title: "Auto-save all tabs",
 				contexts: defaultContexts,
-				checked: false
+				checked: false,
+				parentId: MENU_ID_AUTO_SAVE
 			});
 		}
 	}
@@ -337,7 +347,7 @@ singlefile.ui = (() => {
 		return {
 			text: options.autoSave ? "[A]" : (text || ""),
 			color: options.autoSave ? autoColor : color,
-			title: options.autoSave ? "Autosave in progress" : title,
+			title: options.autoSave ? "Autosave active" : title,
 			path: options.autoSave ? DEFAULT_ICON_PATH : path,
 			progress: options.autoSave ? - 1 : progress,
 			barProgress: options.autoSave ? - 1 : barProgress

+ 2 - 2
extension/ui/pages/help.html

@@ -51,8 +51,8 @@
 						The context menu also allows you to activate the auto-save of:
 						<ul>
 							<li>the current tab,</li>
-							<li>or unpinned tabs (only in the context menu of the webpage),</li>
-							<li>or all tabs (only in the context menu of the webpage).</li>
+							<li>or unpinned tabs,</li>
+							<li>or all tabs.</li>
 						</ul>
 					</li>
 					<li>With auto-save active, pages are automatically saved every time after being loaded (or before being unloaded if not).