aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--firefox/.config/tridactyl/tridactylrc50
-rw-r--r--firefox/.config/userscipts/rustdoc-condensed.js (renamed from firefox/.config/firefox/.config/userscipts/rustdoc-condensed.js)4
2 files changed, 16 insertions, 38 deletions
diff --git a/firefox/.config/tridactyl/tridactylrc b/firefox/.config/tridactyl/tridactylrc
index c429e3e..3c61c4e 100644
--- a/firefox/.config/tridactyl/tridactylrc
+++ b/firefox/.config/tridactyl/tridactylrc
@@ -7,49 +7,26 @@
sanitize tridactyllocal tridactylsync
colourscheme gruvbox-dark-hard
-modeindicatormodes normal false
alias save_rss jsb -p tri.native.run("r2e add '" + JS_ARG + "'") set rsscmd save_rss %u
alias gitclone jsb -p tri.native.run("git clone --depth=1 '" + JS_ARG + "' /home/tobyv/src/" + JS_ARG.split("/").slice(-1))
alias jse js 'use strict'; function $all(q, root=document) { return Array.from(root.querySelectorAll(q)) }; function $(q, root=document) { return root.querySelector(q) }; let $ex = (s) => tri.controller.acceptExCmd(s) ; let $set = (...args) => tri.config.set(...args);
alias jsep js -p 'use strict'; function $all(q, root=document) { return Array.from(root.querySelectorAll(q)) }; function $(q, root=document) { return root.querySelector(q) }; let $ex = (s) => tri.controller.acceptExCmd(s) ; let $set = (...args) => tri.config.set(...args);
-alias video_goby js -d@ let time = JS_ARGS.filter(Boolean); let sign = '+'; if (time[0].match(/^[-+]/)) { sign = time[0].charAt(0); time[0] = time[0].slice(1) } time = time.filter(Boolean).map(Number); const second = time.reduce((s, n) => s*60+n, 0); tri.controller.acceptExCmd(`video_with video.currentTime ${sign}= ${second}`) @
-alias video_goto js -d@ let time = JS_ARGS.filter(Boolean); let sign = '+'; if (time[0].match(/^[-+]/)) { sign = time[0].charAt(0); time[0] = time[0].slice(1) } time = time.filter(Boolean).map(Number); let second = time.reduce((s, n) => s*60+n, 0); if (sign == '-') second = `video.duration - ${second}`; tri.controller.acceptExCmd(`video_with video.currentTime = ${second}`) @
-alias video_with jse let video; if (document.activeElement.name == 'VIDEO') video = document.activeElement; else video = $all('video').find(v => !v.paused); if (!video) video = $('video'); video;
-alias video_mark_add jsep void $ex('video_with').then(video => { const mark = JS_ARG; tri.videoMark.addMark(mark, video.currentTime); $ex('video_mode') })
-alias video_mark_empty js const vm = tri.videoMark; vm.historyStore = Object.values(vm.mark).sort((a,b) => a-b);
-alias video_mark_goby jsep void $ex('video_with').then(video => { const current = video.currentTime; const n = Number(JS_ARG); const time = tri.videoMark.goby(current, n); video.currentTime = time; $ex('video_mode'); })
-alias video_mark_goto jsep void $ex('video_with').then(video => { const mark = JS_ARG; tri.videoMark.addBlur(video.currentTime); const time = tri.videoMark.mark[mark]; if (typeof time == 'number') video.currentTime = time; $ex('video_mode') })
-alias video_mark_init jse if(!tri.videoMark){tri.videoMark={historyStore:[],mark:{},goby(current,n){const index=this.historyStore.findIndex(t=>{if(t>current)return true});const move=n<0?n:n-1;let time;if(~index)time=this.historyStore.at(index+move);else time=this.historyStore.at(move);if(Math.abs(time-current)>this.tollorance)return time;else return this.goby(current,n>0?n+1:n-1)},add(time){this.historyStore.push(time);this.historyStore.sort((a,b)=>a-b)},addBlur(time){const exist=this.historyStore.some(t=>Math.abs(t-time)<this.tollorance);if(!exist)this.add(time);return!exist},addMark(mark,time){this.mark[mark]=time;const index=this.historyStore.findIndex(t=>Math.abs(t-time)<this.tollorance);if(~index)this.historyStore[index]=time;else this.add(time)},tollorance:Number(get('video_mark_tollorance')) || 1,markEventHandler(videoEvent){const video=videoEvent.target;const time=video.currentTime;this.addBlur(time);const previousTime=this.getTimerTime();this.addBlur(previousTime)},timerEventHandler(event){const video=event.target;this.videoTimer={epoch:Date.now(),video:video.currentTime,rate:video.playbackRate}},videoTimer:null,getTimerTime(){const now=Date.now();const t=this.videoTimer;if(t)return(now-t.epoch)/1e3*t.rate+t.video}};void async function(){const vm=tri.videoMark;while(true){await sleep(800);const video=await $ex("video_with");if(video){const handler=tri.videoMark.markEventHandler.bind(tri.videoMark);video.addEventListener("seeked",handler);video.addEventListener("pause",handler);const timer=vm.timerEventHandler.bind(vm);video.addEventListener("playing",timer);video.addEventListener("ratechange",timer);timer({target:video});break}}}()}
-alias video_mode composite mode video ; video_mark_init
-alias exit_video mode normal
+alias video_with jse let video; if (document.activeElement.name == 'VIDEO') video = document.activeElement; else video = $all('video').find(v => !v.paused); if (!video) video = $('video');
-set modeindicatormodes {"normal":"false"}
+set modeindicatormodes {"normal":"false","video":"false"}
set findcase smart
set smoothscroll true
set editorcmd alacritty -e tmux new -As tridactylrc nvim -S $XDG_DATA_HOME/nvim/session/tridactylrc.vim
set video_seek 5
-set videomaps.w jsep $ex('video_with').then(video => {const count = Number(JS_ARG) || 1; const tic = Number(get('video_seek')); video.currentTime += tic * count }); 1;
-set videomaps.b jsep $ex('video_with').then(video => {const count = Number(JS_ARG) || 1; const tic = Number(get('video_seek')); video.currentTime -= tic * count }); 1;
-set video_seek_op 120
-set videomaps.C video_with video.currentTime = Number(get('video_seek_op'))
-set videomaps.a video_with video.currentTime = 0
-set videomaps.A video_with video.currentTime = video.duration
-set videomaps.gt fillcmdline video_goto
-set videomaps.i fillcmdline video_goto
-set videomaps.I fillcmdline video_goby
-set videomaps.m gobble 1 video_mark_add
-set videomaps.' gobble 1 video_mark_goto
-set videomaps.ge video_mark_empty
-set videomaps.E video_mark_goby +1
-set videomaps.e video_mark_goby -1
-set video_mark_tollorance 1
-set videomaps.V exit_video
+set video_volume 0.05
+set videomaps.h video_with video.currentTime -= Number(get('video_seek'))
+set videomaps.j video_with video.volume -= Number(get('video_volume'))
+set videomaps.k video_with video.volume += Number(get('video_volume'))
+set videomaps.l video_with video.currentTime += Number(get('video_seek'))
+set videomaps.l video_with video.currentTime += Number(get('video_seek'))
set videomaps.z mode normal
-set videomaps.gf fullscreen
-set videomaps.q fullscreen
set videomaps.🕷🕷INHERITS🕷🕷 nmaps
-seturl ^https://www.youtube.com/watch\?v=116OjLa1DwY video_seek_op 42
unbind <C-f>
unbind s
@@ -68,15 +45,16 @@ bind K tabnext
bind x tabclose
bind gs fillcmdline open duckduckgo
bind zv composite js document.location.href | exclaim_quiet mpv --loop
-bind zz composite jsb tri.native.run('cat /home/tobyv/.config/firefox/userscripts/rustdoc-condensed.js') | js -p eval(JS_ARG.content)
-bind gv video_mode
-bindurl ^https://www.youtube.com/watch\? v video_mode
+bind gv mode video
+
+bindurl ^https://docs.rs/[^/]+/\d+.\d+.\d+/[^/]+/ zz composite jsb tri.native.run('cat /home/tobyv/.config/firefox/userscripts/rustdoc-condensed.js') | js -p eval(JS_ARG.content)
+bindurl ^https://www.youtube.com/watch\? v mode video
autocmd DocStart mail.google.com mode ignore
autocmd DocStart discordapp.com mode ignore
autocmd DocStart play.rust-lang.org mode ignore
-autocmd DocStart jellyfin.tobyvin.dev mode ignore
-autocmd DocLoad ^https://www.youtube.com/watch\? video_mode
+autocmd DocLoad ^https://www.youtube.com/watch\? mode video
+autocmd HistoryState https://jellyfin.tobyvin.dev/web/#!/video mode video
fixamo_quiet
diff --git a/firefox/.config/firefox/.config/userscipts/rustdoc-condensed.js b/firefox/.config/userscipts/rustdoc-condensed.js
index 40d6a5a..9136445 100644
--- a/firefox/.config/firefox/.config/userscipts/rustdoc-condensed.js
+++ b/firefox/.config/userscipts/rustdoc-condensed.js
@@ -22,7 +22,7 @@
// get the currently selected doc item from URL's hash fragment
// e.g., in `struct.BStr.html#method.words`, this returns `method.words`.
function getPageId() {
- var id = document.location.href.split("#")[1];
+ const id = document.location.href.split("#")[1];
if (id) {
return id.split("?")[0].split("&")[0];
}
@@ -50,7 +50,7 @@
// If it's already expanded, then let it be. In newer versions of
// rustdoc, collapsing everything doesn't collapse the methods, so we
// don't need to do anything.
- if (toggles[j].innerText == "[−]") {
+ if (toggles[j].innerText === "[−]") {
continue;
}
toggles[j].click();