" Comment toggler for Reddit and Hacker News
bind ;c hint -c [class*="expand"],[class="togg"]

" GitHub pull request checkout command to clipboard (only works if you're a collaborator or above)
bind yp composite js document.getElementById("clone-help-step-1").textContent.replace("git checkout -b", "git checkout -B").replace("git pull ", "git fetch ") + "git reset --hard " + document.getElementById("clone-help-step-1").textContent.split(" ")[3].replace("-","/") | yank

" Git{Hub,Lab} git clone via SSH yank
bind yg composite js "git clone " + document.location.href.replace(/https?:\/\//,"git@").replace("/",":").replace(/$/,".git") | clipboard yank

" I like wikiwand but I don't like the way it changes URLs
bindurl wikiwand.com yy composite js document.location.href.replace("wikiwand.com/en","wikipedia.org/wiki") | clipboard yank

" Make gu take you back to subreddit from comments
bindurl reddit.com gu urlparent 4

" Handy multiwindow/multitasking binds
bind gd tabdetach
bind gD composite tabduplicate | tabdetach

" Add helper commands that Mozillians think make Firefox irredeemably insecure
command fixamo_quiet jsb tri.excmds.setpref("privacy.resistFingerprinting.block_mozAddonManager", "true").then(tri.excmds.setpref("extensions.webextensions.restrictedDomains", '""'))
command fixamo js tri.excmds.setpref("privacy.resistFingerprinting.block_mozAddonManager", "true").then(tri.excmds.setpref("extensions.webextensions.restrictedDomains", '""').then(tri.excmds.fillcmdline_tmp(3000, "Permissions added to user.js. Please restart Firefox to make them take affect.")))

" Make Tridactyl work on more sites at the expense of some security
set csp clobber
fixamo_quiet

" New reddit is bad
autocmd DocStart ^http(s?)://www.reddit.com js tri.excmds.urlmodify("-t", "www", "old")
" Mosquito nets won't make themselves
" autocmd DocStart ^http(s?)://www.amazon.co.uk js tri.excmds.urlmodify("-t", "www", "smile")

" FIXME Really painful because it starts typing before the url
" set newtab kagi.com

" Only hint search results on kagi
bindurl ^https://kagi.com f hint -Jc [class=__sri_title_link]
bindurl ^https://kagi.com F hint -Jbc [class=__sri_title_link]

" Allow Ctrl-a to select all in the commandline
unbind --mode=ex <C-a>

" Allow Ctrl-c to copy in the commandline
unbind --mode=ex <C-c>

" Sane hinting mode
set hintfiltermode vimperator-reflow
" set hintnames numeric

set theme dark

" Defaults to 300ms but I'm a 'move fast and close the wrong tabs' kinda chap
set hintdelay 100

" Make Tridactyl work on more sites at the expense of some security. For
" details, read the comment at the top of this file.
fixamo_quiet
