Skip to content

Commit 31f277c

Browse files
committed
legacy_browser_workarounds/stackexchange_legacy_comments_expander.user.js
* Support expanding comments on the question itself, in addition to the answers. minecraft_curseforge_title_tweaks.user.js * Support (and I greatly prefer) the now-legacy curseforge site *and* the "modern" (🤮) curseforge. simple_url_tracker_cleaner.user.js * Remove Google's "amp" clutter. Now that I think aboout it, didn't the whole premise of that turn out to be a lie, or something?
1 parent 1a9fd43 commit 31f277c

File tree

3 files changed

+28
-8
lines changed

3 files changed

+28
-8
lines changed

legacy_browser_workarounds/stackexchange_legacy_comments_expander.user.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// @match https://stackexchange.com/*
99
// @match https://*.stackoverflow.com/*
1010
// @match https://*.stackexchange.com/*
11-
// @version 1.0
11+
// @version 1.1
1212
// @createdAt 11/6/2022, 1:17:14 AM
1313
// @author StaticPH
1414
// @description Replace 'Show X more comments' handler for StackExchange sites to better support older browsers; in particular, this enables showing all comments when using Chromium 72.
@@ -45,11 +45,11 @@
4545
}
4646

4747
function onExpandComments(evnt){
48-
if (evnt.target.matches('.answer a.js-show-link')){
48+
if (evnt.target.matches('.answer a.js-show-link, .question a.js-show-link')){
4949
evnt.stopImmediatePropagation();
5050
evnt.preventDefault();
51-
const answer = evnt.target.closest('.answer');
52-
const postID = answer.getAttribute('data-answerid');
51+
const answer = evnt.target.closest('.answer, .question');
52+
const postID = answer.getAttribute('data-answerid') || answer.getAttribute('data-questionid');
5353
const insertInto = answer.querySelector('ul.comments-list');
5454
fetch(document.location.origin + '/posts/' + postID + '/comments', {
5555
'headers': {

minecraft_curseforge_title_tweaks.user.js

+21-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
// @name Minecraft CurseForge Title Tweaks
33
// @namespace https://github.com/StaticPH
44
// @match https://www.curseforge.com/minecraft/mc-mods/*
5-
// @version 1.0
5+
// @match https://legacy.curseforge.com/minecraft/mc-mods/*
6+
// @version 1.1
67
// @createdAt 4/20/2022, 5:46:34 PM
78
// @author StaticPH
89
// @description Modifies the format of the page title for some of CurseForge's Minecraft pages.
@@ -28,6 +29,25 @@
2829
}
2930
}
3031
else {
32+
if (document.location.pathname.startsWith('/minecraft/mc-mods/')){
33+
const findModTitle = document.querySelector('header > .container > div > div > div > h2, .project-header > h1');
34+
const modTitle = !findModTitle ? 'ERROR NO TITLE FOUND' : findModTitle.textContent.replace(/[[{(]\s*F(orge|abric)\s?[&/]\s?F(orge|abric)\s*[\])}]/i, '');
35+
document.title = modTitle;
36+
if (document.location.pathname.includes('/files')){
37+
// if (document.location.pathname.endsWith('/')){ }
38+
document.title += ' - Downloads';
39+
}
40+
else if (document.location.pathname.endsWith('/screenshots')){
41+
document.title += ' - Images' ;
42+
}
43+
else if (document.location.pathname.endsWith('/relations/dependencies')){
44+
document.title += ' - Dependencies';
45+
}
46+
else if (document.location.pathname.endsWith('/relations/dependents')){
47+
document.title += ' - Dependents';
48+
}
49+
document.title += ' - CurseForge Minecraft Mods';
50+
}
3151
if (document.title.match('Mods - Projects - CurseForge')){
3252
document.title = document.title.replace('Mods - Projects - CurseForge', '') + 'CurseForge Minecraft Projects';
3353
}

simple_url_tracker_cleaner.user.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// @name Simple URL Tracker Cleaner
33
// @namespace https://github.com/StaticPH
44
// @match *://*/*
5-
// @version 1.3
5+
// @version 1.4
66
// @createdAt 8/10/2021
77
// @author StaticPH
88
// @description Scrub various common tracker parameters from URLs.
@@ -37,8 +37,8 @@
3737
console.warn('Could not find expected "url" parameter for link: ' + link.href);
3838
}
3939
}
40-
if (link.href.match(/(?:[?&])(utm_(source|medium|campaign|term|content)|(fb|g)clid)=[^&?#]*[&?#]?/)){
41-
fixed = link.href.replace(/(?:[?&])(utm_(source|medium|campaign|term|content)|(fb|g)clid)=[^&?#]*/g, '').replace(/[?&]*#/, '#').replace(/[?&]*$/, '');
40+
if (link.href.match(/(?:[?&])(amp;)?(utm_(source|medium|campaign|term|content)|(fb|g)clid)=[^&?#]*[&?#]?/)){
41+
fixed = link.href.replace(/(?:[?&])(amp;)?(utm_(source|medium|campaign|term|content)|(fb|g)clid)=[^&?#]*/g, '').replace(/[?&]*#/, '#').replace(/[?&]*$/, '');
4242
console.log( link.href + ' --> ' + fixed );
4343
link.href = fixed;
4444
}

0 commit comments

Comments
 (0)