summaryrefslogtreecommitdiff
path: root/static/userscripts/localjump.user.js
blob: 8c6274e2396946e6f3160d983ef37676bb577840 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// ==UserScript==
// @name        localjump
// @author      Anon
// @namespace   http://textboard.org
// @description Change single post quote links inside full thread views from separate single post views to local scroll jumps within the thread
// @version     1
// @match       *://textboard.org/*
// @grant       none
// ==/UserScript==
(function() {
  'use strict';
  Array.from (document.getElementsByTagName ("a")).filter (e => e.hasAttribute ("href")).forEach (e => {
  var h = e.getAttribute ("href")
  var s = h.replace (/^\/([^\/]+)\/(\d+)\/(\d+)$/, "/$1/$2#t$2p$3")
  if (h != s) { e.setAttribute ("href", s); }
})
})();