Skip to content

Commit

Permalink
add 2 new settings: mouseReachable and notifyUpdate
Browse files Browse the repository at this point in the history
notifyUpdate is for #116 .
  • Loading branch information
gdh1995 committed Feb 9, 2020
1 parent 103d701 commit 8f4c183
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 5 deletions.
7 changes: 5 additions & 2 deletions _locales/zh/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -599,10 +599,13 @@
"message": "帮助"
},
"o44_4": {
"message": "在文字筛选模式下必须按下“回车”来确认"
"message": "在文字筛选状态下必须按下“回车”来确认"
},
"o44_5": {
"message": "提示模式的文字筛选模式下,总是需要按下“回车”才会点击链接或按钮,来避免意外触发 Vimium C 的命令。"
"message": "提示模式的文字筛选状态下,总是需要按下“回车”才会点击链接或按钮,来避免意外触发 Vimium C 的命令。"
},
"o44_6": {
"message": "检测链接和按钮是否被完全遮挡"
},
"o45": {
"message": "在新网页上阻止文本框自动获取键盘焦点"
Expand Down
1 change: 1 addition & 0 deletions background/bg.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,7 @@ declare namespace SettingsNS {
showActionIcon: boolean;
showAdvancedOptions: boolean;
showInIncognito: boolean;
showNotification: boolean;
userDefinedCss: string;
vimSync: boolean | null;
vomnibarPage: string;
Expand Down
2 changes: 2 additions & 0 deletions background/others.ts
Original file line number Diff line number Diff line change
Expand Up @@ -996,6 +996,8 @@ function (details: chrome.runtime.InstalledDetails): void {
ref1.backupSettingsToLocal_ = true;
}

if (!Settings_.get_("showNotification")) { return; }

reason = "vimium_c-upgrade-notification";
const args: chrome.notifications.NotificationOptions = {
type: "basic",
Expand Down
5 changes: 4 additions & 1 deletion background/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -465,13 +465,14 @@ shortcut-forwarding-tool@gdh1995.cn`
hideHud: false,
ignoreCapsLock: 0,
ignoreKeyboardLayout: false,
mapModifier: 0,
innerCSS: "",
keyboard: [560, 33],
keyMappings: "",
linkHintCharacters: "sadjklewcmpgh",
linkHintNumbers: "0123456789",
localeEncoding: "gbk",
mapModifier: 0,
mouseReachable: true,
newTabUrl: "",
newTabUrl_f: "",
nextPatterns: "\u4e0b\u4e00\u5c01,\u4e0b\u9875,\u4e0b\u4e00\u9875,\u4e0b\u4e00\u7ae0,\u540e\u4e00\u9875\
Expand Down Expand Up @@ -507,6 +508,7 @@ v.m|v\\:math: vimium://math\\ $S re= Calculate
showAdvancedCommands: false,
showAdvancedOptions: false,
showInIncognito: false,
showNotification: true,
smoothScroll: true,
vomnibarOptions: {
maxMatches: 10,
Expand Down Expand Up @@ -546,6 +548,7 @@ v.m|v\\:math: vimium://math\\ $S re= Calculate
filterLinkHints: "f",
ignoreKeyboardLayout: "l",
mapModifier: "a",
mouseReachable: "e",
keyboard: "k", linkHintCharacters: "c", linkHintNumbers: "n",
regexFindMode: "r", smoothScroll: "s", scrollStepSize: "t", waitForEnter: "w"
}),
Expand Down
5 changes: 4 additions & 1 deletion content/link_hints.ts
Original file line number Diff line number Diff line change
Expand Up @@ -944,6 +944,7 @@ var VHints = {
filterOutNonReachable_ (list: Hint[]): void {
if (!(Build.BTypes & ~BrowserType.Edge) || Build.BTypes & BrowserType.Edge && VOther & BrowserType.Edge) { return; }
const D = VDom;
if (!D.cache_.e) { return; }
if (Build.BTypes & BrowserType.Chrome && (Build.MinCVer < BrowserVer.Min$Node$$getRootNode
|| Build.MinCVer < BrowserVer.Min$DocumentOrShadowRoot$$elementsFromPoint)
&& D.cache_.v < (BrowserVer.Min$Node$$getRootNode > BrowserVer.Min$DocumentOrShadowRoot$$elementsFromPoint
Expand Down Expand Up @@ -1133,7 +1134,9 @@ var VHints = {
}
return HandlerResult.Prevent;
}
if (key[0] === "a") {
if (key.includes("-s")) {
VDom.cache_.e = !VDom.cache_.e;
} else if (key[0] === "a") {
a.wantDialogMode_ = !a.wantDialogMode_;
} else if ("cm".includes(key[0])) {
a.options_.useFilter = VDom.cache_.f = !a.useFilter_;
Expand Down
13 changes: 12 additions & 1 deletion pages/options.html
Original file line number Diff line number Diff line change
Expand Up @@ -205,9 +205,20 @@
</label>
</td>
<td class="help"><div class="help-inner line-help" data-i="o44_5">
You activate the link with "Enter", always; so you never accidentally type Vimium commands.
You activate the link with "Enter", always; so you never accidentally type Vimium C commands.
</div></td>
</tr>
<tr>
<td class="caption"></td>
<td>
<label class="booleanOption" tabindex="-1" aria-hidden="true">
<input id="mouseReachable" type="checkbox" tabindex="-1" aria-hidden="true" data-model="Boolean" />
<span data-i="o44_6" class="checkboxHint" role="checkbox" tabindex="0" aria-hidden="false"
>Detect whether links are completely covered or not</span>
</label>
</td>
<td colspan="2"></td>
</tr>
<tr>
<td class="caption"></td>
<td>
Expand Down
1 change: 1 addition & 0 deletions types/vimium_c.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,7 @@ declare namespace SettingsNS {
/** linkHintNumbers */ n: ["linkHintNumbers", string];
/** filterLinkHints */ f: ["filterLinkHints", boolean];
/** waitForEnter */ w: ["waitForEnter", boolean];
/** mouseReachable */ e: ["mouseReachable", boolean];
/** regexFindMode */ r: ["regexFindMode", boolean];
/** scrollStepSize */ t: ["scrollStepSize", number];
/** smoothScroll */ s: ["smoothScroll", boolean];
Expand Down

0 comments on commit 8f4c183

Please sign in to comment.