1
0
Эх сурвалжийг харах

add opt. `Annotation editor > display the infobar`
(fix #1169)

Gildas 2 жил өмнө
parent
commit
a50cb711a8

+ 4 - 0
_locales/de/messages.json

@@ -511,6 +511,10 @@
 		"message": "Warnen beim Verlassen der Seite mit ungespeicherten Änderungen",
 		"description": "Title of the button 'warn if leaving page with unsaved changes'"
 	},
+	"optionDisplayInfobarInEditor": {
+		"message": "Anzeige der Infoknopf",
+		"description": "Title of the button 'display the infobar'"
+	},
 	"optionsMiscSubTitle": {
 		"message": "Sonstiges",
 		"description": "Options sub-title: 'Misc.'"

+ 5 - 1
_locales/en/messages.json

@@ -511,6 +511,10 @@
 		"message": "warn if leaving page with unsaved changes",
 		"description": "Title of the button 'warn if leaving page with unsaved changes'"
 	},
+	"optionDisplayInfobarInEditor": {
+		"message": "display the infobar",
+		"description": "Title of the button 'display the infobar'"
+	},
 	"optionsMiscSubTitle": {
 		"message": "Misc.",
 		"description": "Options sub-title: 'Misc.'"
@@ -883,4 +887,4 @@
 		"message": "URL",
 		"description": "Title of the column in the table of the URLs"
 	}
-}
+}

+ 4 - 0
_locales/es/messages.json

@@ -511,6 +511,10 @@
 		"message": "warn if leaving page with unsaved changes",
 		"description": "Title of the button 'warn if leaving page with unsaved changes'"
 	},
+	"optionDisplayInfobarInEditor": {
+		"message": "mostrar la barra de información",
+		"description": "Title of the button 'display the infobar'"
+	},
 	"optionsMiscSubTitle": {
 		"message": "Miscelánea",
 		"description": "Options sub-title: 'Misc.'"

+ 4 - 0
_locales/fr/messages.json

@@ -511,6 +511,10 @@
 		"message": "avertir si l'on quitte la page avec des modifications non sauvegardées",
 		"description": "Title of the button 'warn if leaving page with unsaved changes'"
 	},
+	"optionDisplayInfobarInEditor": {
+		"message": "afficher la barre d'information",
+		"description": "Title of the button 'display the infobar'"
+	},
 	"optionsMiscSubTitle": {
 		"message": "Divers",
 		"description": "Options sub-title: 'Misc.'"

+ 4 - 0
_locales/it/messages.json

@@ -511,6 +511,10 @@
 		"message": "avvisa se si lascia una pagina con cambiamenti non salvati",
 		"description": "Title of the button 'warn if leaving page with unsaved changes'"
 	},
+	"optionDisplayInfobarInEditor": {
+		"message": "visualizzare la barra informativa",
+		"description": "Title of the button 'display the infobar'"
+	},
 	"optionsMiscSubTitle": {
 		"message": "Varie",
 		"description": "Options sub-title: 'Misc.'"

+ 4 - 0
_locales/ja/messages.json

@@ -511,6 +511,10 @@
 		"message": "warn if leaving page with unsaved changes",
 		"description": "Title of the button 'warn if leaving page with unsaved changes'"
 	},
+	"optionDisplayInfobarInEditor": {
+		"message": "インフォバーを表示する",
+		"description": "Title of the button 'display the infobar'"
+	},
 	"optionsMiscSubTitle": {
 		"message": "その他",
 		"description": "Options sub-title: 'Misc.'"

+ 4 - 0
_locales/pl/messages.json

@@ -511,6 +511,10 @@
 		"message": "ostrzegaj, jeśli opuszczasz stronę z niezapisanymi zmianami",
 		"description": "Title of the button 'warn if leaving page with unsaved changes'"
 	},
+	"optionDisplayInfobarInEditor": {
+		"message": "wyświetlanie paska informacyjnego",
+		"description": "Title of the button 'display the infobar'"
+	},
 	"optionsMiscSubTitle": {
 		"message": "Różne",
 		"description": "Options sub-title: 'Misc.'"

+ 4 - 0
_locales/pt_br/messages.json

@@ -511,6 +511,10 @@
 		"message": "dar aviso ao sair do site sem previamente salvar as mudanças ",
 		"description": "Title of the button 'warn if leaving page with unsaved changes'"
 	},
+	"optionDisplayInfobarInEditor": {
+		"message": "exibir o infobar",
+		"description": "Title of the button 'display the infobar'"
+	},
 	"optionsMiscSubTitle": {
 		"message": "Diversos",
 		"description": "Options sub-title: 'Misc.'"

+ 4 - 0
_locales/ru/messages.json

@@ -511,6 +511,10 @@
 		"message": "предупреждать при закрытии страницы с несохранёнными изменениями",
 		"description": "Title of the button 'warn if leaving page with unsaved changes'"
 	},
+	"optionDisplayInfobarInEditor": {
+		"message": "display the infobar",
+		"description": "Title of the button 'display the infobar'"
+	},
 	"optionsMiscSubTitle": {
 		"message": "Разное",
 		"description": "Options sub-title: 'Misc.'"

+ 4 - 0
_locales/tr/messages.json

@@ -511,6 +511,10 @@
 		"message": "kaydedilmemiş değişiklikle sayfadan ayrılırsa uyar",
 		"description": "Title of the button 'warn if leaving page with unsaved changes'"
 	},
+	"optionDisplayInfobarInEditor": {
+		"message": "bilgi çubuğunu görüntüleme",
+		"description": "Title of the button 'display the infobar'"
+	},
 	"optionsMiscSubTitle": {
 		"message": "Çeşitli.",
 		"description": "Options sub-title: 'Misc.'"

+ 4 - 0
_locales/uk/messages.json

@@ -511,6 +511,10 @@
 		"message": "попереджати при виході зі сторінки з незбереженими змінами",
 		"description": "Title of the button 'warn if leaving page with unsaved changes'"
 	},
+	"optionDisplayInfobarInEditor": {
+		"message": "display the infobar",
+		"description": "Title of the button 'display the infobar'"
+	},
 	"optionsMiscSubTitle": {
 		"message": "Різне",
 		"description": "Options sub-title: 'Misc.'"

+ 4 - 0
_locales/zh_CN/messages.json

@@ -511,6 +511,10 @@
 		"message": "离开标注编辑器时提醒保存已修改的内容",
 		"description": "Title of the button 'warn if leaving page with unsaved changes'"
 	},
+	"optionDisplayInfobarInEditor": {
+		"message": "显示信息栏",
+		"description": "Title of the button 'display the infobar'"
+	},
 	"optionsMiscSubTitle": {
 		"message": "杂项",
 		"description": "Options sub-title: 'Misc.'"

+ 4 - 0
_locales/zh_TW/messages.json

@@ -511,6 +511,10 @@
 		"message": "離開標註編輯器時提醒保存已修改的內容",
 		"description": "Title of the button 'warn if leaving page with unsaved changes'"
 	},
+	"optionDisplayInfobarInEditor": {
+		"message": "顯示信息欄",
+		"description": "Title of the button 'display the infobar'"
+	},
 	"optionsMiscSubTitle": {
 		"message": "雜項",
 		"description": "Options sub-title: 'Misc.'"

+ 1 - 0
src/core/bg/config.js

@@ -124,6 +124,7 @@ const DEFAULT_CONFIG = {
 	saveFavicon: true,
 	includeBOM: false,
 	warnUnsavedPage: true,
+	displayInfobarInEditor: false,
 	autoSaveExternalSave: false,
 	insertMetaNoIndex: false,
 	insertMetaCSP: true,

+ 1 - 1
src/lib/woleet/woleet.js

@@ -22,7 +22,7 @@
  */
 /* global fetch */
 const urlService = "https://api.woleet.io/v1/anchor";
-const apiKey = "";
+const apiKey = "eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJhYzZmZTMzMi0wODNjLTRjZmMtYmYxNC0xNWU5MTJmMWY4OWIiLCJpYXQiOjE1NzYxNzQzNDV9.n31j9ctJj7R1Vjwyc5yd1d6Cmg0NDnpwSaLWsqtZJQA";
 export {
 	anchor
 };

+ 9 - 0
src/ui/bg/ui-editor.js

@@ -291,6 +291,9 @@ addEventListener("message", event => {
 			linkElement.href = message.icon;
 			document.head.appendChild(linkElement);
 		}
+		if (tabData.options.displayInfobarInEditor) {
+			displayInfobar();
+		}
 		tabData.docSaved = true;
 		if (!message.reset) {
 			const defaultEditorMode = tabData.options.defaultEditorMode;
@@ -440,6 +443,12 @@ function savePage() {
 	}), "*");
 }
 
+function displayInfobar() {
+	editorElement.contentWindow.postMessage(JSON.stringify({
+		method: "displayInfobar"
+	}), "*");
+}
+
 function getPosition(event) {
 	if (event.touches && event.touches.length) {
 		const touch = event.touches[0];

+ 6 - 1
src/ui/bg/ui-options.js

@@ -169,6 +169,7 @@ const infobarTemplateLabel = document.getElementById("infobarTemplateLabel");
 const blockMixedContentLabel = document.getElementById("blockMixedContentLabel");
 const saveOriginalURLsLabel = document.getElementById("saveOriginalURLsLabel");
 const includeInfobarLabel = document.getElementById("includeInfobarLabel");
+const displayInfobarInEditorLabel = document.getElementById("displayInfobarInEditorLabel");
 const removeInfobarSavedDateLabel = document.getElementById("removeInfobarSavedDateLabel");
 const miscLabel = document.getElementById("miscLabel");
 const helpLabel = document.getElementById("helpLabel");
@@ -274,6 +275,7 @@ const defaultEditorModeCutLabel = document.getElementById("defaultEditorModeCutL
 const defaultEditorModeCutExternalLabel = document.getElementById("defaultEditorModeCutExternalLabel");
 const applySystemThemeInput = document.getElementById("applySystemThemeInput");
 const warnUnsavedPageInput = document.getElementById("warnUnsavedPageInput");
+const displayInfobarInEditorInput = document.getElementById("displayInfobarInEditorInput");
 const expandAllButton = document.getElementById("expandAllButton");
 const rulesDeleteAllButton = document.getElementById("rulesDeleteAllButton");
 const ruleUrlInput = document.getElementById("ruleUrlInput");
@@ -671,6 +673,7 @@ defaultEditorModeCutLabel.textContent = browser.i18n.getMessage("optionDefaultEd
 defaultEditorModeCutExternalLabel.textContent = browser.i18n.getMessage("optionDefaultEditorModeCutExternal");
 applySystemThemeLabel.textContent = browser.i18n.getMessage("optionApplySystemTheme");
 warnUnsavedPageLabel.textContent = browser.i18n.getMessage("optionWarnUnsavedPage");
+displayInfobarInEditorLabel.textContent = browser.i18n.getMessage("optiondisplayInfobarInEditor");
 resetButton.textContent = browser.i18n.getMessage("optionsResetButton");
 exportButton.textContent = browser.i18n.getMessage("optionsExportButton");
 importButton.textContent = browser.i18n.getMessage("optionsImportButton");
@@ -940,6 +943,7 @@ async function refresh(profileName) {
 	defaultEditorModeInput.value = profileOptions.defaultEditorMode;
 	applySystemThemeInput.checked = profileOptions.applySystemTheme;
 	warnUnsavedPageInput.checked = profileOptions.warnUnsavedPage;
+	displayInfobarInEditorInput.checked = profileOptions.displayInfobarInEditor;
 }
 
 function getProfileText(profileName) {
@@ -1043,7 +1047,8 @@ async function update() {
 			autoOpenEditor: autoOpenEditorInput.checked,
 			defaultEditorMode: defaultEditorModeInput.value,
 			applySystemTheme: applySystemThemeInput.checked,
-			warnUnsavedPage: warnUnsavedPageInput.checked
+			warnUnsavedPage: warnUnsavedPageInput.checked,
+			displayInfobarInEditor: displayInfobarInEditorInput.checked
 		}
 	});
 	try {

+ 3 - 0
src/ui/content/content-ui-editor-web.js

@@ -1086,6 +1086,9 @@ pre code {
 		if (message.method == "printPage") {
 			printPage();
 		}
+		if (message.method == "displayInfobar") {
+			singlefile.infobar.displayIcon();
+		}
 	};
 	window.onresize = reflowNotes;
 	document.ondragover = event => event.preventDefault();

+ 1 - 1
src/ui/pages/editor.html

@@ -68,7 +68,7 @@
 		</div>
 	</div>
 	<iframe class="editor"
-		srcdoc="&lt;!DOCTYPE html&gt;&lt;body&gt;&lt;script src=/lib/single-file-extension-editor-helper.js&gt;&lt;/script&gt;&lt;script src=/lib/single-file-extension-editor.js&gt;&lt;/script&gt;&lt;script src=/src/lib/readability/Readability.js&gt;&lt;/script&gt;&lt;/script&gt;&lt;script src=/src/lib/readability/Readability-readerable.js&gt;&lt;/script&gt;&lt;/body&gt;"
+		srcdoc="&lt;!DOCTYPE html&gt;&lt;body&gt;&lt;script src=/lib/single-file-extension-editor-helper.js&gt;&lt;/script&gt;&lt;script src=/lib/single-file-extension-editor.js&gt;&lt;/script&gt;&lt;script src=/lib/single-file-infobar.js&gt;&lt;/script&gt;&lt;script src=/src/lib/readability/Readability.js&gt;&lt;/script&gt;&lt;/script&gt;&lt;script src=/src/lib/readability/Readability-readerable.js&gt;&lt;/script&gt;&lt;/script&gt;&lt;/script&gt;&lt;/body&gt;"
 		sandbox="allow-scripts allow-modals"></iframe>
 	<script src="/lib/chrome-browser-polyfill.js"></script>
 	<script src="/lib/single-file.js"></script>

+ 7 - 2
src/ui/pages/help.html

@@ -522,12 +522,17 @@
 						<p class="notice">It is recommended to <u>uncheck</u> this option</p>
 					</li>
 					<li data-options-label="autoOpenEditorLabel" id="autoOpenEditorOption"> <span class="option">Option:
-							open the annotation
-							editor when viewing a page saved with SingleFile </span>
+							open the annotation editor when viewing a page saved with SingleFile</span>
 						<p>Check this option to open the annotation editor when displaying a page saved by SingleFile.
 						</p>
 						<p class="notice">It is recommended to <u>uncheck</u> this option</p>
 					</li>
+					<li data-options-label="displayInfobarInEditorLabel"> <span class="option">Option:
+						display the infobar</span>
+						<p>Check this option to display the infobar when displaying a page in the annotation editor.</p>
+						<p class="notice">It is recommended to <u>uncheck</u> this option</p>
+					</p>
+				</li>
 				</ul>
 				<p id="bookmarksSection">Bookmarks</p>
 				<ul id="bookmarksOptions">

+ 4 - 0
src/ui/pages/options.html

@@ -359,6 +359,10 @@
 				<label for="autoOpenEditorInput" id="autoOpenEditorLabel"></label>
 				<input type="checkbox" id="autoOpenEditorInput">
 			</div>
+			<div class="option">
+				<label for="displayInfobarInEditorInput" id="displayInfobarInEditorLabel"></label>
+				<input type="checkbox" id="displayInfobarInEditorInput">
+			</div>
 		</details>
 		<details id="bookmarksOptions">
 			<summary id="bookmarksLabel"></summary>