Skip to content

Commit fe19dd5

Browse files
committed
1.17.9
Fixed #2271 Configuration option to set separator of tab indices
1 parent c6eb0ca commit fe19dd5

File tree

7 files changed

+30
-7
lines changed

7 files changed

+30
-7
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -587,6 +587,8 @@ Some functionalities are also available when you're using original pdf viewer, b
587587
| settings.caretViewport | null | Set it in format `[top, left, bottom, right]` to limit hints generation on `v` for entering visual mode, such as `[window.innerHeight / 2 - 10, 0, window.innerHeight / 2 + 10, window.innerWidth]` will make Surfingkeys generate Hints only for text that display on vertically middle of window. |
588588
| settings.mouseSelectToQuery | [] | All hosts that have enable feature -- mouse selection to query. |
589589
| settings.autoSpeakOnInlineQuery | false | Whether to automatically speak the query string with TTS on inline query. |
590+
| settings.showTabIndices | false | Whether to show tab numbers (indices) in the tab titles. |
591+
| settings.tabIndicesSeparator | "\|" | The separator between index and original title of a tab. |
590592

591593
### Example of settings.theme, below is to set font size of status bar
592594

README_CN.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -572,6 +572,8 @@ Surfingkeys默认使用[这个markdown分析器](https://github.com/chjj/marked)
572572
| settings.caretViewport | null |`[top, left, bottom, right]`格式设置,可以限制按`v`进入可视模式时的选择范围。比如`[window.innerHeight / 2 - 10, 0, window.innerHeight / 2 + 10, window.innerWidth]`会使Surfingkeys只会为显示在窗口中间的文字生成拨号盘字符。|
573573
| settings.mouseSelectToQuery | [] | 所有启用鼠标选择查询功能的网站列表。 |
574574
| settings.autoSpeakOnInlineQuery | false | 是否在使用inline query时自动发声。 |
575+
| settings.showTabIndices | false | 是否在标签页标题上显示当前标签页的编号。 |
576+
| settings.tabIndicesSeparator | "\|" | 标签页编号与标签页原始标题之间的分隔符。 |
575577

576578
### settings.theme示例,修改状态栏字体
577579

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "Surfingkeys",
3-
"version": "1.17.8",
3+
"version": "1.17.9",
44
"description": "Map your keys for web surfing, expand your browser with javascript and keyboard.",
55
"main": "background.js",
66
"directories": {

src/content_scripts/common/hints.js

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -354,10 +354,20 @@ div.hint-scrollable {
354354
mouseEventModifiers[modKey] = true;
355355
}
356356
flashPressedLink(element,() => {
357-
self.mouseoutLastElement();
358-
dispatchMouseEvent(element, behaviours.mouseEvents, mouseEventModifiers);
359-
dispatchSKEvent("observer", ['turnOn']);
360-
lastMouseTarget = element;
357+
if (tabbed && getBrowserName().startsWith("Safari")) {
358+
RUNTIME("openLink", {
359+
tab: {
360+
tabbed: tabbed,
361+
active: mouseEventModifiers.shiftKey
362+
},
363+
url: getHref(element)
364+
});
365+
} else {
366+
self.mouseoutLastElement();
367+
dispatchMouseEvent(element, behaviours.mouseEvents, mouseEventModifiers);
368+
dispatchSKEvent("observer", ['turnOn']);
369+
lastMouseTarget = element;
370+
}
361371

362372
if (behaviours.multipleHits) {
363373
setTimeout(resetHints, 300);

src/content_scripts/common/runtime.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ const runtime = (function() {
8686
smoothScroll: true,
8787
startToShowEmoji: 2,
8888
stealFocusOnLoad: true,
89+
tabIndicesSeparator: "|",
8990
tabsThreshold: 100,
9091
verticalTabs: true,
9192
textAnchorPat: /(^[\n\r\s]*\S{3,}|\b\S{4,})/g,

src/content_scripts/content.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,12 @@ function applyRuntimeConf(normal) {
9999
});
100100
}
101101

102+
const userConfPromise = new Promise(function (resolve, reject) {
103+
document.addEventListener("surfingkeys:settingsFromSnippetsLoaded", () => {
104+
resolve(runtime.conf);
105+
}, {once: true});
106+
});
107+
102108
function applySettings(api, normal, rs) {
103109
for (var k in rs) {
104110
if (runtime.conf.hasOwnProperty(k)) {
@@ -265,7 +271,9 @@ function start(browser) {
265271
if (resp.index > 0) {
266272
var showTabIndexInTitle = function () {
267273
skipObserver = true;
268-
document.title = myTabIndex + " " + originalTitle;
274+
userConfPromise.then(function(conf) {
275+
document.title = myTabIndex + conf.tabIndicesSeparator + originalTitle;
276+
});
269277
};
270278

271279
var myTabIndex = resp.index,

src/content_scripts/ui/llmchat.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ export default function (omnibar, front) {
228228
messages[0].content = opts && opts.system || "";
229229
omnibar.resultsDiv.className = "llmChat";
230230
if (!provider) {
231-
provider = opts.provider || runtime.conf.defaultLLMProvider;
231+
provider = opts && opts.provider || runtime.conf.defaultLLMProvider;
232232
}
233233
omnibar.resultsDiv.append(createElementWithContent('h4', provider));
234234
renderMessages();

0 commit comments

Comments
 (0)