qutebrowser: Improve ads block and update some key mappings

This commit is contained in:
Sanchayan Maity 2022-11-30 12:44:11 +05:30
parent d06e32511f
commit 509c0d3206
2 changed files with 42 additions and 6 deletions

View file

@ -161,10 +161,27 @@ c.content.javascript.enabled = True
# Do not display PDFs in browser. pdfjs does not work. # Do not display PDFs in browser. pdfjs does not work.
c.content.pdfjs = False c.content.pdfjs = False
c.content.blocking.adblock.lists = [
"https://easylist.to/easylist/easylist.txt",
"https://easylist.to/easylist/easyprivacy.txt",
"https://easylist-downloads.adblockplus.org/indianlist.txt",
"https://easylist-downloads.adblockplus.org/abp-filters-anti-cv.txt",
"https://www.i-dont-care-about-cookies.eu/abp/",
"https://easylist.to/easylist/fanboy-social.txt",
"https://secure.fanboy.co.nz/fanboy-cookiemonster.txt",
"https://secure.fanboy.co.nz/fanboy-annoyance.txt",
"https://secure.fanboy.co.nz/fanboy-cookiemonster.txt",
]
# * Key Bindings # * Key Bindings
# ** Reload Configuration # ** Reload Configuration
nmap("ts", "config-source") nmap("ts", "config-source")
# Reload page
nunmap("r")
nunmap("R")
nmap("<Ctrl-r>", "reload")
# lose scroll left # lose scroll left
nmap("h", "back") nmap("h", "back")
nmap("H", "forward") nmap("H", "forward")
@ -318,16 +335,10 @@ nmap("'y", ":open --tab https://youtube.com/")
nmap('"', "enter-mode jump_mark") nmap('"', "enter-mode jump_mark")
nmap("tl", 'jump-mark "\'"') nmap("tl", 'jump-mark "\'"')
# ** Spawn/Shell
# *** Bookmarking with Buku
# can add tags after
nmap("m", 'set-cmd-text -s :spawn --detach buku --add "{url}"')
# *** Playing Videos with MPV # *** Playing Videos with MPV
nmap(",m", "spawn mpv {url}") nmap(",m", "spawn mpv {url}")
nmap(",M", "hint links spawn mpv {hint-url}") nmap(",M", "hint links spawn mpv {hint-url}")
# ** Downloads # ** Downloads
# TODO download video and audio # TODO download video and audio
# nmap -ex <leader>Y execute "silent !youtube-dl --restrict-filenames -o '~/move/%(title)s_%(width)sx%(height)s_%(upload_date)s.%(ext)s' " + buffer.URL + " &" # nmap -ex <leader>Y execute "silent !youtube-dl --restrict-filenames -o '~/move/%(title)s_%(width)sx%(height)s_%(upload_date)s.%(ext)s' " + buffer.URL + " &"
@ -344,3 +355,8 @@ nmap("zo", "zoom-out")
# ** Inspector # ** Inspector
nmap("ti", "inspector") nmap("ti", "inspector")
nunmap('gb')
nunmap('gB')
nmap('gb', 'set-cmd-text -s :bookmark-load -t')
nmap('gB', 'spawn --detach alacritty -e fish -c bo')

View file

@ -0,0 +1,20 @@
// ==UserScript==
// https://www.reddit.com/r/qutebrowser/comments/u05nix/skipping_youtube_ads/
// https://www.reddit.com/r/qutebrowser/comments/tue1gs/blocking_youtube_ads/
// u/name Auto Skip YouTube Ads
// u/version 1.0.0
// u/description Speed up and skip YouTube ads automatically
// u/author jso8910
// u/match *://*.youtube.com/*
// u/exclude *://*.youtube.com/subscribe_embed?*
// ==/UserScript==
const btn = document.querySelector('.videoAdUiSkipButton,.ytp-ad-skip-button')
if (btn) {
btn.click()
}
const ad = [...document.querySelectorAll('.ad-showing')][0];
if (ad) {
const vid = document.querySelector('video');
vid.currentTime = vid.duration;
}