Skip to content

Commit 4cad4b6

Browse files
committed
Add some remove slug code from load letter version
1 parent 1e05c5d commit 4cad4b6

File tree

1 file changed

+32
-1
lines changed

1 file changed

+32
-1
lines changed

Chan/FCX/4chan_x.user.js

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@
7575
*/
7676

7777
(function() {
78-
var $, $$, Anonymize, ArchiveLink, AutoGif, Build, CatalogLinks, Conf, Config, DeleteLink, DownloadLink, ExpandComment, ExpandThread, Favicon, FileInfo, Filter, Get, ImageExpand, ImageHover, Keybinds, Main, Menu, Nav, Options, PngFix, QR, QuoteBacklink, QuoteCT, QuoteInline, QuoteOP, QuotePreview, Quotify, Redirect, RelativeDates, ReplyHiding, ReportLink, RevealSpoilers, Sauce, StrikethroughQuotes, ThreadHiding, ThreadStats, Time, TitlePost, UI, Unread, Updater, Watcher, d, g;
78+
var $, $$, Anonymize, ArchiveLink, AutoGif, Build, CatalogLinks, Conf, Config, DeleteLink, DownloadLink, ExpandComment, ExpandThread, Favicon, FileInfo, Filter, Get, ImageExpand, ImageHover, Keybinds, Main, Menu, Nav, Options, PngFix, QR, QuoteBacklink, QuoteCT, QuoteInline, QuoteOP, QuotePreview, Quotify, Redirect, RelativeDates, RemoveSlug, ReplyHiding, ReportLink, RevealSpoilers, Sauce, StrikethroughQuotes, ThreadHiding, ThreadStats, Time, TitlePost, UI, Unread, Updater, Watcher, d, g;
7979

8080
Config = {
8181
main: {
@@ -5472,6 +5472,35 @@
54725472
}
54735473
};
54745474

5475+
5476+
RemoveSlug = {
5477+
init: function() {
5478+
var catalogdiv;
5479+
var threads = [];
5480+
if (g.CATALOG) {
5481+
catalogdiv = document.getElementsByClassName('thread');
5482+
for (var i = 0; i < catalogdiv.length; i++) {
5483+
threads.push(catalogdiv[i].firstElementChild);
5484+
}
5485+
} else {
5486+
threads = document.getElementsByClassName('replylink');
5487+
}
5488+
return RemoveSlug.deslug(threads);
5489+
},
5490+
deslug: function(els) {
5491+
var el;
5492+
for (var i = 0; i < els.length; i++) {
5493+
el = els[i];
5494+
path = el.pathname;
5495+
if (path.slice(1).split('/').length > 3) {
5496+
el.pathname = path.substring(0, path.lastIndexOf('/'));
5497+
}
5498+
}
5499+
return;
5500+
}
5501+
};
5502+
5503+
54755504
CatalogLinks = {
54765505
init: function() {
54775506
var clone, el, nav, _i, _len, _ref;
@@ -5606,6 +5635,7 @@
56065635
}
56075636
},
56085637
catalog: function() {
5638+
$.ready(RemoveSlug.init);
56095639
if (Conf['Catalog Links']) {
56105640
CatalogLinks.init();
56115641
}
@@ -5790,6 +5820,7 @@
57905820
Unread.init();
57915821
}
57925822
} else {
5823+
RemoveSlug.init();
57935824
if (Conf['Thread Hiding']) {
57945825
ThreadHiding.init();
57955826
}

0 commit comments

Comments
 (0)