Browse Source

Add hint for injection modes

Gerald 10 years ago
parent
commit
1b6b43ef8a

+ 6 - 3
README.md

@@ -6,7 +6,10 @@ Violentmonkey for Opera Presto: <https://github.com/Violentmonkey/Violentmonkey-
 
 Multiple language
 ---
-There are two ways to help with the translations:
+* You may download `src/_locales/en/messages.json` and translate it into your
+  own language, and then make a pull request.
 
-1. *(Recommended)* Go to <http://cotrans.geraldl.net>, and translate the desired language.
-1. You may also download `src/_locales/en/messages.json` and translate it into your own language, and then make a pull request.
+* If you are working with an existed language file, the newly added items will
+  have empty `message`s.
+  You may then check out `src/_locales/en/messages.json` for the English version
+  and translate it.

+ 9 - 1
src/_locales/cs/messages.json

@@ -144,7 +144,7 @@
     "message": "Suppress no @grant warnings"
   },
   "labelInjectMode": {
-    "description": "Label to a combo box to choose script injection modes.",
+    "description": "Label for a combo box to choose script injection modes.",
     "message": "Script injection mode:"
   },
   "injectModeNormal": {
@@ -406,5 +406,13 @@
   "labelAutoReloadCurrentTab": {
     "description": "Option to reload current tab after a script is switched on or off from the popup menu.",
     "message": "Znovu načíst současný list po zapnutí či vypnutí skriptu z nabídky."
+  },
+  "hintInjectModeNormal": {
+    "description": "Hint to explain the normal injection mode.",
+    "message": ""
+  },
+  "hintInjectModeAdvanced": {
+    "description": "Hint to explain the advanced injection mode.",
+    "message": ""
   }
 }

+ 10 - 2
src/_locales/de/messages.json

@@ -144,7 +144,7 @@
     "message": "Unterdrücke @grant Warnungen"
   },
   "labelInjectMode": {
-    "description": "Label to a combo box to choose script injection modes.",
+    "description": "Label for a combo box to choose script injection modes.",
     "message": "Script injection mode:"
   },
   "injectModeNormal": {
@@ -404,7 +404,15 @@
     "message": "Alle"
   },
   "labelAutoReloadCurrentTab": {
-    "description": "Option to reload current tab after a script is switched on or off from the popup menu.",
+    "description": "Option to reload current tab after a script is switched on or off from menu.",
+    "message": "Neustart der momentanen Tabelle vom Menue nachdem an und aus schalten"
+  },
+  "hintInjectModeNormal": {
+    "description": "Hint to explain the normal injection mode.",
+    "message": ""
+  },
+  "hintInjectModeAdvanced": {
+    "description": "Hint to explain the advanced injection mode.",
     "message": ""
   }
 }

+ 9 - 1
src/_locales/en/messages.json

@@ -144,7 +144,7 @@
     "message": "Suppress no @grant warnings"
   },
   "labelInjectMode": {
-    "description": "Label to a combo box to choose script injection modes.",
+    "description": "Label for a combo box to choose script injection modes.",
     "message": "Script injection mode:"
   },
   "injectModeNormal": {
@@ -406,5 +406,13 @@
   "labelAutoReloadCurrentTab": {
     "description": "Option to reload current tab after a script is switched on or off from menu.",
     "message": "Reload current tab after switching on/off a script from menu"
+  },
+  "hintInjectModeNormal": {
+    "description": "Hint to explain the normal injection mode.",
+    "message": "Efficient but fails in some high security pages, e.g. https://github.com"
+  },
+  "hintInjectModeAdvanced": {
+    "description": "Hint to explain the advanced injection mode.",
+    "message": "Works in most pages, actually a hack"
   }
 }

+ 10 - 2
src/_locales/pl/messages.json

@@ -144,7 +144,7 @@
     "message": "Suppress no @grant warnings"
   },
   "labelInjectMode": {
-    "description": "Label to a combo box to choose script injection modes.",
+    "description": "Label for a combo box to choose script injection modes.",
     "message": "Script injection mode:"
   },
   "injectModeNormal": {
@@ -404,7 +404,15 @@
     "message": "Wszystko"
   },
   "labelAutoReloadCurrentTab": {
-    "description": "Option to reload current tab after a script is switched on or off from the popup menu.",
+    "description": "Option to reload current tab after a script is switched on or off from menu.",
+    "message": ""
+  },
+  "hintInjectModeNormal": {
+    "description": "Hint to explain the normal injection mode.",
+    "message": ""
+  },
+  "hintInjectModeAdvanced": {
+    "description": "Hint to explain the advanced injection mode.",
     "message": ""
   }
 }

+ 10 - 2
src/_locales/ru/messages.json

@@ -144,7 +144,7 @@
     "message": "Suppress no @grant warnings"
   },
   "labelInjectMode": {
-    "description": "Label to a combo box to choose script injection modes.",
+    "description": "Label for a combo box to choose script injection modes.",
     "message": "Script injection mode:"
   },
   "injectModeNormal": {
@@ -404,7 +404,15 @@
     "message": "Заменить всё"
   },
   "labelAutoReloadCurrentTab": {
-    "description": "Option to reload current tab after a script is switched on or off from the popup menu.",
+    "description": "Option to reload current tab after a script is switched on or off from menu.",
+    "message": ""
+  },
+  "hintInjectModeNormal": {
+    "description": "Hint to explain the normal injection mode.",
+    "message": ""
+  },
+  "hintInjectModeAdvanced": {
+    "description": "Hint to explain the advanced injection mode.",
     "message": ""
   }
 }

+ 10 - 2
src/_locales/zh/messages.json

@@ -144,7 +144,7 @@
     "message": "不显示缺少@grant的警告"
   },
   "labelInjectMode": {
-    "description": "Label to a combo box to choose script injection modes.",
+    "description": "Label for a combo box to choose script injection modes.",
     "message": "脚本注入模式:"
   },
   "injectModeNormal": {
@@ -404,7 +404,15 @@
     "message": "所有"
   },
   "labelAutoReloadCurrentTab": {
-    "description": "Option to reload current tab after a script is switched on or off from the popup menu.",
+    "description": "Option to reload current tab after a script is switched on or off from menu.",
     "message": "从菜单开启或关闭脚本后自动刷新当前页面"
+  },
+  "hintInjectModeNormal": {
+    "description": "Hint to explain the normal injection mode.",
+    "message": "简单粗暴,但是在某些安全性高的页面会注入失败,如https://github.com"
+  },
+  "hintInjectModeAdvanced": {
+    "description": "Hint to explain the advanced injection mode.",
+    "message": "不走寻常路,可以在大部分页面成功注入"
   }
 }

+ 1 - 0
src/options/templates/tab-settings.html

@@ -18,6 +18,7 @@
       <option value=0 data-i18n=injectModeNormal></option>
       <option value=1 data-i18n=injectModeAdvanced></option>
     </select>
+    <span></span>
   </label>
   <fieldset class=title>
     <legend data-i18n=labelDataImport></legend>

+ 8 - 0
src/options/view.js

@@ -354,6 +354,7 @@ var SettingsTab = BaseView.extend({
     var options = _.options.getAll();
     this.$el.html(this.templateFn(options));
     this.$('#sInjectMode').val(options.injectMode);
+    this.updateInjectHint();
     this.exportList = new ExportList;
     return this;
   },
@@ -361,8 +362,15 @@ var SettingsTab = BaseView.extend({
   updateAutoUpdate: function (e) {
     _.sendMessage({cmd: 'AutoUpdate'});
   },
+  updateInjectHint: function () {
+    this.$('#sInjectMode+span').text([
+      _.i18n('hintInjectModeNormal'),
+      _.i18n('hintInjectModeAdvanced'),
+    ][this.$('#sInjectMode').val()]);
+  },
   updateInjectMode: function (e) {
     _.options.set('injectMode', e.target.value);
+    this.updateInjectHint();
   },
   toggleSelection: function () {
     this.exportList.toggleAll();