Last active
November 27, 2022 06:01
-
-
Save jcouyang/87091ac6220491079448a2e2bd11dcab to your computer and use it in GitHub Desktop.
Firefox Surfingkeys Settings
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
settings.startToShowEmoji = 3; | |
settings.tabsMRUOrder = false; | |
settings.tabsThreshold = 4; | |
api.mapkey(';oc', 'Org Capture', function() { | |
location.href='org-protocol://capture?' + | |
new URLSearchParams({ | |
template: 'x', | |
url: window.location.href, | |
title: document.title, | |
body: window.getSelection(), | |
}); | |
api.Front.showBanner('Org Captured!') | |
}); | |
api.mapkey(';gh', 'Github Merge With PR Title', function() { | |
var prNumber = document.querySelector('h1 .f1-light').innerText ; | |
var msgbox = document.querySelector('#merge_title_field'); | |
var title = document.querySelector('#merge_message_field'); | |
msgbox.value = `${title.value} (${prNumber})`; | |
title.value = ""; | |
api.Front.showBanner('Populating Merge message...'); | |
}); | |
api.mapkey(';hp', 'Hypothesis', function() { | |
api.insertJS(function(){ | |
window.hypothesisConfig=function(){return{showHighlights:true,appType:'bookmarklet'};}; | |
var d=document,s=d.createElement('script');s.setAttribute('src','https://hypothes.is/embed.js');d.body.appendChild(s) | |
}, function(){ | |
api.Front.showBanner('Loaded hypothes.is!'); | |
}); | |
}); | |
api.mapkey(';oh', 'Jump to section', function() { | |
var h = Array.from(top.document.querySelectorAll('h1,h2,h3')).map(function(h) { | |
return { | |
title: h.textContent, | |
url: `javascript:(function(){location.hash = "${h.querySelector('a').getAttribute('href')}"})()` | |
}; | |
}); | |
api.Front.openOmnibar({type: "UserURLs", extra: h}); | |
}); | |
// set theme | |
settings.theme = ` | |
.sk_theme { | |
font-family: Input Sans Condensed, Charcoal, sans-serif; | |
font-size: 10pt; | |
background: #24272e; | |
color: #abb2bf; | |
} | |
.sk_theme tbody { | |
color: #fff; | |
} | |
.sk_theme input { | |
color: #d0d0d0; | |
} | |
.sk_theme .url { | |
color: #61afef; | |
} | |
.sk_theme .annotation { | |
color: #56b6c2; | |
} | |
.sk_theme .omnibar_highlight { | |
color: #528bff; | |
} | |
.sk_theme .omnibar_timestamp { | |
color: #e5c07b; | |
} | |
.sk_theme .omnibar_visitcount { | |
color: #98c379; | |
} | |
.sk_theme #sk_omnibarSearchResult ul li:nth-child(odd) { | |
background: #303030; | |
} | |
.sk_theme #sk_omnibarSearchResult ul li.focused { | |
background: #3e4452; | |
} | |
#sk_status, #sk_find { | |
font-size: 20pt; | |
}`; | |
api.Front.registerInlineQuery({ | |
url: function(q) { | |
return `http://dict.youdao.com/w/eng/${q}/#keyfrom=dict2.index`; | |
}, | |
parseResult: function(res) { | |
var parser = new DOMParser(); | |
var doc = parser.parseFromString(res.text, "text/html"); | |
var collinsResult = doc.querySelector("#collinsResult"); | |
var authTransToggle = doc.querySelector("#authTransToggle"); | |
var examplesToggle = doc.querySelector("#examplesToggle"); | |
if (collinsResult) { | |
collinsResult.querySelectorAll("div>span.collinsOrder").forEach(function(span) { | |
span.nextElementSibling.prepend(span); | |
}); | |
collinsResult.querySelectorAll("div.examples").forEach(function(div) { | |
div.innerHTML = div.innerHTML.replace(/<p/gi, "<span").replace(/<\/p>/gi, "</span>"); | |
}); | |
var exp = collinsResult.innerHTML; | |
return exp; | |
} else if (authTransToggle) { | |
authTransToggle.querySelector("div.via.ar").remove(); | |
return authTransToggle.innerHTML; | |
} else if (examplesToggle) { | |
return examplesToggle.innerHTML; | |
} | |
} | |
}); | |
var d=document,s=d.createElement('script');s.setAttribute('src','https://hypothes.is/embed.js');d.body.appendChild(s) | |
}, function(){ | |
api.Front.showBanner('Loaded hypothes.is!'); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment