Просмотр исходного кода

remove whitespace between the last word and help icon

Gildas 5 лет назад
Родитель
Сommit
858d34c6ef
2 измененных файлов с 13 добавлено и 1 удалено
  1. 9 1
      extension/ui/bg/ui-options.js
  2. 4 0
      extension/ui/pages/options.css

+ 9 - 1
extension/ui/bg/ui-options.js

@@ -962,9 +962,16 @@
 		const items = doc.querySelectorAll("[data-options-label]");
 		items.forEach(itemElement => {
 			const optionLabel = document.getElementById(itemElement.dataset.optionsLabel);
+			const helpIconWrapper = document.createElement("span");
 			const helpIconContainer = document.createElement("span");
 			const helpIcon = document.createElement("img");
 			helpIcon.src = HELP_ICON_URL;
+			helpIconWrapper.className = "help-icon-wrapper";
+			const labelWords = optionLabel.textContent.split(/\s+/);
+			if (labelWords.length > 1) {
+				helpIconWrapper.textContent = labelWords.pop();
+				optionLabel.textContent = labelWords.join(" ") + " ";
+			}
 			helpIconContainer.className = "help-icon";
 			helpIconContainer.onclick = () => {
 				helpContent.hidden = !helpContent.hidden;
@@ -978,7 +985,8 @@
 				}
 			};
 			helpIconContainer.appendChild(helpIcon);
-			optionLabel.appendChild(helpIconContainer);
+			helpIconWrapper.appendChild(helpIconContainer);
+			optionLabel.appendChild(helpIconWrapper);
 			const helpContent = document.createElement("div");
 			helpContent.hidden = true;
 			helpContent.className = "help-content";

+ 4 - 0
extension/ui/pages/options.css

@@ -120,6 +120,10 @@ h3 a {
     white-space: nowrap;
 }
 
+.help-icon-wrapper {
+    white-space: nowrap;
+}
+
 .help-icon {
     vertical-align: middle;
     display: inline-block;