[a / b / c / d / e / f / g / gif / h / hr / k / m / o / p / r / s / t / u / v / vg / vm / vmg / vr / vrpg / vst / w / wg] [i / ic] [r9k / s4s / vip / qa] [cm / hm / lgbt / y] [3 / aco / adv / an / bant / biz / cgl / ck / co / diy / fa / fit / gd / hc / his / int / jp / lit / mlp / mu / n / news / out / po / pol / pw / qst / sci / soc / sp / tg / toy / trv / tv / vp / vt / wsg / wsr / x / xs] [Settings] [Search] [Mobile] [Home]
Board
Settings Mobile Home
/j/ - Janitor & Moderator Discussion

Name
Options
Comment
File
  • Please read the Rules and FAQ before posting.



This thread is for the unofficial extension Hotpocket Helper. Whether you're a janitor of 1 board, a global, or a mod, this extension adds a plethora of features to streamline keeping the site clean!
It's also compatible with 4chanX! If you can load your janitor/mod tools, it just werks™.

Instructions for installing HPH scripts and the most recent version of HPH can be found in the first few replies. Please use this thread for feedback, suggestions, and any questions.
>>
File: installing HPH.webm (1.44 MB, 1728x1080)
1.44 MB
1.44 MB WEBM
These scripts require a userscript manager like Tampermonkey. Hotpocket Helper is tested with Tampermonkey and the only userscript manager we officially support but you can try others like Violentmonkey or Greasemonkey.
Note: Greasemonkey has not worked reliably with Hotpocket Helper. Violentmonkey appears to work with Hotpocket Helpers on Chrome browsers, but not Firefox.

Chrome & Chrome-like browsers: https://chrome.google.com/webstore/detail/tampermonkey/dhdgffkkebhmkfjojejmpbldmpobfkfo
Firefox: https://addons.mozilla.org/en-US/firefox/addon/tampermonkey/
Opera: https://addons.opera.com/en/extensions/details/tampermonkey-beta/

Once you've installed one of these managers, get the most recent version of HPH. If your browser wasn't listed above or if you need help figuring out parts of this process, just pm fission on Discord. OR google "tampermonkey [your browser]"
>>
Thank you very much
>>
I just want to say that I really appreciate the time and effort spent on this tool.

Also, can confirm that these scripts are non-functional on Violentmonkey on Firefox Nightly. Run on Tampermonkey as intended.
>>
>>7198
That's strange, I have them working fine with violentmonkey on firefox developer
>>
So i got assigned a new board, but some of these functions aren't showing up. Must I re-install?
>>
>>7210
Did you add your new board in 4chan's Janitor settings?
>>
File: 2zo1ki.jpg (279 KB, 750x511)
279 KB
279 KB JPG
>>7211
heh heh......
>>
>>7198
Update:
On Firefox Nightly, the report page userscript was not loading correctly with Tampermonkey, although it was enabled.
It turns out some change in Firefox resulted in Tampermonkey's script injection being blocked by CSP. Enabling "Add Tampermonkey to the site's content CSP" under the experimental settings resolved this issue.

I'm still not sure if this particular to my profile (errant setting/addon conflict) or due to a change in nightly itself, but something to keep in mind. I'll try to get around to testing a fresh profile in the future.
>>
>>7300
After performing a switch from nightly to stable with a fresh profile, all issues were fixed, and the HPH scripts work without issue.
>>
>>7309
>HPH scripts work without issue
das ryte
>>
I just installed HPH the other day so I might be doing something wrong, but the 'I' (info?) button to see how many replies there are only seems to show the first time you hover it.
>>
>>7348
4chan tooltips are a bit wonky. This is something that is resolved in the next version which will be coming out soon™
>>
>>7349
I see now it'll allow another popup once the background refresh has happened. Had a poke at the code and it's too tied into the tooltip functionality to fix easily for me so I'll leave it with you. Thanks again for the add-in, it's great.
>>
>>7349
>soon™
got it, December 23 2022 at eleventeen past 7 in the evening.
>>
>>7351
post this at them https://www.youtube.com/watch?v=qYodWEKCuGg
it makes them work faster
>>
4chan X did a thing and now the ! box to clear reported posts went poof

pls fix
>>
>>7366
>she uses 4chanX
>>
>>7366
From my fucking around with it I've come to the conclusion that by merely installing 4chanX you forgo quite a lot of the features that HPH gives you.
You either go with 4chanX and accept that you might have to clear from the reports page or you clear all your cookies and go back to only HPH.

>>7367
Official team 4chan 4chanX clone extension when?
>>
>>7368
>Official team 4chan 4chanX clone extension when?
nobody told you?
>>
>>7369
W-Why y-yes, I have been told, fellow anon in the know! Just give me the sauce down below, I seem to have misplaced my official team 4chan 4chanX clone extension.
>>
>>7366
did you try refreshing the page lol?

>>7368
From what I can tell most HPH features are compatible with 4chanX, except for the catalog ones. If you unselect 'Use 4chanX catalog' in the settings everything works although you do miss out on some of the 4chanX features then.
>>
>>7371
>except for the catalog ones
It'll force you to use buttons regardless of your settings and you won't be able to use the see reply chain feature (albeit 4chanX has a similar feature).
>you do miss out on some of the 4chanX features then
Personally the HPH catalog features aren't that useful (it's basically just making you not have to open the queue). On the other hand, 4chanX's ability to look up filenames, redirect to 404 posts on the archive, flagging new IPs, see deleted posts, etc. is extremely useful for performing janitorial duties.
>>
Updating to firefox 77 breaks the report queue extension. This is a tampermonkey issue for once, we cant do nuffin about it until tampermonkey updates.
>>
>>7381
JUST
>>
>>7381
this has actually been an issue for me for more than a few days, more like months. Sure its just tampermonkey being dogshit?
>>
File: 1570088881814.png (318 KB, 625x495)
318 KB
318 KB PNG
>>7395
The tampermonkey a couple weeks ago fixed the issues in the reports queue for me, but there is still another kind of intermittent glitch with boards/catalog, in that they'll sometimes catalog will not load and threads (particularly larger ones) generally load only partway through if HPH is enabled.

At the moment I've simply turned off HPH for boards/catalog and can live with that, but, it'd still be nice to have it all fixed.
>>
>>7395
The issue was specifically with tampermonkey on firefox. I believe tampermonkey fixed the issue in one of their updates.
>>7396
Do you have more specific information? What specifically doesn't load? When you open the console in your browser is there any relevant errors coming from HPH?
>>
no updates because there's no features we think are worth adding. if you have ideas, post them here
>>
File: tamper.png (300 KB, 1412x936)
300 KB
300 KB PNG
>>7491
My report queue now has a radio button to highlight all posts in the queue that are in the same thread, I don't remember seeing that before and I haven't update HPH recently. It might have only started showing after a Brave update.

I have my own tampermonkey script that's still a WIP that lets you see how many posts a user has in a thread with IDs. It pops out a list of their posts in a side panel if you click the post count number. I find it useful for easily checking if a user is spamming and finding their other shitposts.
>>
>>7492
Yeah I got that too, changed nothing on my end. Could just be the report queue itself getting an update.
>>
>>7492
>>7494
Yeah, 4chan's report queue has little buttons on reports now which will put outlines around all reports from the same thread. Usually once a feature from HPH is adopted into 4chan, we will remove it from HPH, but in this case we're going to go ahead and leave it since the functionality is still quite a bit different.
>>
>>7499
HPH does it a lot better. pls never remove it.
>>
>>7491
What about BRs from the catalog? Unless I'm missing something you always have to open the thread first right now
>>
>>7511
this isn't something that'll make it in, sorry bro
>>
I'm heading out, here's the script I was working on from >>7492 maybe it's useful for someone. It's not pretty, and there are a bunch of TODOs, but it isn't terrible.
https://ghostbin.co/paste/tshtueky
pass: o1UeCtGGBuo
>>
File: RSW.jpg (10 KB, 220x229)
10 KB
10 KB JPG
For a while now, I have been having my 4chan settings, including Janitor settings, get reset. This hasn't been occurring as often for me in the past as it has now for the past few months. I use the Vanilla extension and it works for me to keep cookies for other websites just fine. Would it be possible to put together a script that either maintains the settings or makes it easier to load them from a settings file on the user's machine? Like maybe if settings cookies are lost one could just press a refresh button some place to repopulate settings from a preset file path. Using the built-in option to save and reload 4chan settings has never worked for me, and even if it did, the process could be improved.
>>
>>7592
>Would it be possible to put together a script that either maintains the settings or makes it easier to load them from a settings file on the user's machine?
Yes.
>>
bumping because A: i had to reinstall and B: this should be pinned.
>>
>>7774
wow, it's been quite some time since there was an update
i guess the time has come for me to post this video once again
https://www.youtube.com/watch?v=qYodWEKCuGg
>>
>>7775
The next update will be coming soon™
>>
File: Luvia Ohohohohoh.gif (965 KB, 300x297)
965 KB
965 KB GIF
>>7778
Finally adding 4chan X compatibility?
>>
>>7775
why fix what aint broke
>>
>>7784
fuck 4chanx
all my homies hate 4chanx
>>
>>7786
mustn't have a lot of homies
>>
File: CRY.jpg (1.07 MB, 1141x1141)
1.07 MB
1.07 MB JPG
>>7786
>all my homies hate 4chanx
Nigga, I thought we were homies?!???
P-P-Please take it back... :(
>>
>>7791
he's just mad his extension will never be as popular as 4chanX
>>
>>7792
>installing malware to browse 4chan
thanks but no thanks. i don't think i'll be using 4chanx
>>
File: translation links.png (3 KB, 151x148)
3 KB
3 KB PNG
Another small script that won't really make it into the HPH or anywhere else but made my life as an /int/ janitor a bit easier, translation links for the 4chan post menu.
This only opens a link to a translator with the post's text in it. The dream would be to have a script for in-line translation on 4chan itself, but that would need using these translation APIs and their access prices are a bit above our salary. Nevertheless, these buttons did me a great service for the time I've been using them, so I thought I might as well share them.

Script: https://cryptobin.co/o4e5g5y9
Key: 9KaEOuX1oMamhKyVOYsdYOj4SRLNIz7OCIZTynIa/aNKE2Bxmgg8UGJGlGvxT2YR

Known issues:
- Not compatible with 4chanX
- Yandex has no way to set autodetect-to-english in its URL, so it will always autotranslate to russian and you have to readjust it to english manually
>>
>>7835
I use a browser extension for that.
>>
Hotpocket Helper Features

REPORT QUEUE
>Sorting
-Thread sorting. Reports are sorted and grouped together if they are from the same thread.
-OP sorting. Only show reported OPs.
-Reply sorting. Only show reported replies, no OPs.
-Sync button, updates the report queue without having to refresh.

>RQ General additions
-Colored board indicators to visually show how many reports a board has. (Ranges from green to red)
-Info button added to all reports. Displays stats about the thread the reported post is in. (Thread age, # of replies, page #, etc.)
-Click the info button on reported replies to bring up a preview of the OP of the thread.
-Functional quote links! Click the >>123456789 links to actually go to the post being linked. Click it again to hide the post!
-Quote linkes that are 404 are properly colored red.
-Opening a reports context menu (View button) allows you click the quote links to follow a reply chain without hiding/unhiding posts.

>In Settings Menu
-Pin toolbar to top of page option
-Sort by thread on page load option
>>
BOARDS
>Toolbox
-Link to boards RQ
-Displays number of reports for the board you're on
-Displays number of reports on the page
-Report jumper allows you to click to jump to reported posts on the page

>Posts
-Reported posts are marked as [Reported]
-Reported posts have a "Clear button". Clear reports without even going to the RQ!
-Reply Chain: Post menu (▶ button) has "Reply Chain" feature. View all a post and all of the replies to it, and replies to the replies!
--Reply chain has a delete button to delete posts you select within the reply chain. (The "!" button on reply chain header)

CATALOG
>Sorting
-Show Reported sorting option. Only show threads that have reports.
-Show New sorting option. Only show threads that have been created since the last time you've visited the catalog.

>Toolbox
-Link to boards RQ
-Displays number of reports for the board you're on

>Threads
-Threads with reports are marked as [Reported] with details of how many reported posts.
>>
reminder to make feature requests here or via PM or else there's no way to tell that you want new features
>>
>>7921
something i've wanted is some sort of discreet push notification whenever reports reach a configurable threshold globally or on a specific board
not sure how difficult it would be though
>>
>>7927
Push notifications wouldn't be something would be reasonable to set up. Regular desktop notifications could probably work but if you're already at your computer I don't know how much good it would do.

Plus you should be enjoying the time away from janitoring without worrying about janitoring :)
>>
>>7928
true! :)

a desktop notification would still be useful to me
sometimes i have janitor tools tucked away in another tab while working and when i tab back in my boards are melting
>>
>>7928
I'd prefer a nice little ping on my screen when reports pile over 50 on my boards
>>
File: 1565920954488.jpg (230 KB, 1080x941)
230 KB
230 KB JPG
I know this is a bit of a dead thread, but things are changing slowly in the web extension world that may inevitably impact Hotpocket Helper.

https://github.com/Tampermonkey/tampermonkey/issues/644
https://adguard.com/en/blog/manifestv3-timeline.html

The long and the short of it is that, with Manifest V3 being implemented on all Chromium based browsers by Janurary 2023, Tampermonkey cannot function as Manifest V3 exists right now. A fair amount of complaining is currently ongoing behind the scenes that do not concern us, but I think that the maintainers of Hotpocket Helper should begin to accept the fact that extension may not function for much longer than a year and a few months. I am not saying that all is lost, Tampermonkey has a representative in the official "bitch at Google over this" group, but the future is forever growing smaller as always. Eyes should begin to watch progress on Manifest V3 carefully and decide what to do next.
>>
>>8180
>she doesn't use firefox
>>
>>8181
Firefox is dying, brah.
>>
>>8180
use firefox :earfreg:
>>
>>8180
What she >>8181 said.
>>
File: i.jpg (15 KB, 590x332)
15 KB
15 KB JPG
>>8180
i might just port it to a full browser extension at that point. funny that it'll end up as a browser extension just like the og version was.

also am messing around with a janny phone app right now. i got the RQ working, thats pretty much it so far. i dont know if i would be able to distribute this easily. itoddlers especially would have to go out of their way to sideload it
>>
>>8195
make it a PWA :earfreg:
>>
>>7189
How do I install a script with tampermonkey?
>>
>>8197
You create a new script, copy paste the stuff you want into it and then save it.
Most other scripts for it can just be installed automatically though.
>>
>>8196
This unironically, or alternatively tell itoddlers to buy a samsung a20 or some shit.
>>
>>7835
>Known issues:
> - Not compatible with 4chanx
i think you mean known features
>>
>>8195
>also am messing around with a janny phone app right now.
>itoddlers unable to easily install
dare i say it
BTFO

by the way, besides mobile phone support, which i'm looking forward to, i'm wondering if HPH could receive a feature wherein [Reported] threads show up as GR#1 reports where applicable in the board/catalogue view so you don't have to double check with the queue to see whether or not a post is a false illegal?

just a thought desu
>>
>>8195
itoddler here. I'm semi-familiar with sideloading stuff, so long as I don't have to jailbreak the phone.
>>
>>8195
>itoddlers especially would have to go out of their way to sideload it

would go more than out of my way to have an alternative to the iphone browser 4chan experience
>>
>get phone stolen
>password gets cracked
>thieves open mysterious official 4chan brand app
>get treated to the /lgbt/ queue

successful anti-theft app
>>
I'd like to suggest adding a button outside of the Post Menu for viewing a reply chain. The button could be in a similar position to the Delete, Spoiler and Ban Request buttons. I think it should be relatively simple to introduce, since it wouldn't require changing the core functionality of the reply chain feature itself, just a different means of accessing it.
>>
>>8279
what do you do if the thief is gay tho
>>
>>8195
FLOEEEEEEEEENS
>>
>>8319
no normal gay person is strong enough to withstand the /lgbt/ report queue
>>
>>8353
>ywnbaj
(you will never be a janny)
>>
I started a new version with just a few changes here. Over a year has passed since I was last working on that, and I can't really remember exactly what I had done, but I added some new stuff recently and will post that here for anyone interested.

This version brings back the settings menu for those who remember versions 1-3 from many years ago.
There is a few things you can toggle on and off to customize if you want.

Open the settings in the report queue (the gear in the top right) to toggle settings there. (Pin toolbar, auto sort reports)
Open the settings in a thread/board (NOT IN THE CATALOG) with the settings button on the top right of the page. You'll see "HotPocketHelper" below your Janitor/Moderator settings.

Version 6.5:
Reports: https://cryptobin.co/p8b4n7z1
Boards: https://cryptobin.co/y2o0a7h1
Catalog: https://cryptobin.co/20o3k711

Key:
VZdD/q+ZHlkQRBVGL83UwK6vVBvLMj47xAkvzNTkx4fQUPUF4zVibhDvqHqUOROd

There might be other small things... and maybe even bugs. But I haven't run into any buggy or strange behavior. If you run into anything or have suggestions, let me know in here or on Discord or on IRC and I'll update it.
>>
>>8419
based devfag
>>
>>8419
I installed these scripts and it was my first time ever using HPH. I wasn't able to see the settings at all, even though some (most?) of the other features worked. I'm using Firefox on Linucks, any ideas?
>>
>>8433
Didn't see this earlier. After you've added the scripts, you should be able to open the settings on 4chan like normal and see an additional section for HPH at the bottom. However, this needs to be done either in a thread or on the regular board index (ie NOT in the catalog!)
There is also some additional settings in the report queue. They are located in the regular settings menu in the report queue, however they aren't labeled in their own section for HPH, they're just below the other settings.

If you haven't already found it on your own, or this doesn't help you, PM me on Discord pls and I can look into it there.
>>
File: clearing.png (5 KB, 214x81)
5 KB
5 KB PNG
Am i the only one who can't see the green [Cleared] text after trying to clear a report ever since the recent update?
It gets stuck with dots like this for me. At first it was a minor nuisance but it now is annoying enough to make me post this. Plz fix if it's not too hard to do so

I use 4chanX by the way
>>
>>8516
4chanX isn't compatible to begin with. I'm more surprised that you could before since I've never gotten to get that ! to show up with it.
>>
any news on a phone app? that way i can janoom properly at work and will no longer be doing it for free
>>
>>8541
no i havent done anything with it yet
>>
>>8546
thats ok
i'll draw the logo
>>
>>8546
whenever you do start working on it again please just fork kuroba and add janny tools to it

>>8517
>I've never gotten to get that ! to show up with it
works on my machine but I haven't updated the script in a while
>>
>>8557
FLOEEEEEEENS
>>
>>7036
Reminder to remind new janitors that HPH is a thing desu
>>
I did some tinkering and to make HPH's clear report from a thread feature work with 4chanX the CFBS.buildPostIcons function needs to add a button that can trigger the clear report portion of the code which is currently not its own function. This shouldn't be too hard since neither 4chanX nor Onee-chan interfere with the function that detects that 4chanX is being used (native extension is disabled) and therefore adds the missing delete and BR buttons.
>>
>>8656
Disregard this post, there's a work around that works better than if the issue was fixed via HPH.
>>
>>8419
Is anyone able to access these links right now? I'm getting some kind of error and not sure if it's on my end or the site.
>>
>>8658
It is on the end of the site. The certificate the site uses expired a few days ago.
>>
>>8658
If anyone needs the scripts but cryptobin is down, I can send them to you on Discord. Just pm fission
>>
File: mybestattempt.png (11 KB, 887x282)
11 KB
11 KB PNG
Just like having a board report on top of the overall report queue can we also add a "keyword" queue? Like whenever a post is reported and has Samus in it or is from a thread with Samus in the name/description it also appear in the "Samus" queue. I'm probably explaining it really bad so here's a totally photoshopped image of what I'm thinking of
>>
>>8913
CTRL+F.
>>
>>8913
Top left in the RQ, there is a text box where you can filter by word. Type the word you want to filter by and press enter.
>>
>>8913
9001 hours in ms paint
>>
>>7036
bumping for new janitors
>>
>>8419
oo, thanks for these
>>
General question, why does HPH reverse the order of the queue?
>>
>>9158
The order should only ever change if you do sorting by thread. Only changes for that because of how it was implemented at the time and has never been changed. There is no real reason it can't maintain their order if I remember correctly.
>>
>>9158
BECAUSE IT WAS WRITTEN BY A MORON!!!!!!
>>
>>9175
now THIS is the answer I was looking for
>>
>>9175
lol
>>
File: moron.jpg (154 KB, 514x492)
154 KB
154 KB JPG
>>9175
>>
File: DELETE-ME-AFTER-POSTING.png (337 KB, 1898x978)
337 KB
337 KB PNG
For a mod on discord: This is me seeing reported posts have the report highlight and a clear button on 4chan but not on 4channelwhile using HPH and 4chanX.
>>
File: 5zfhmw.jpg (69 KB, 802x500)
69 KB
69 KB JPG
Firefox seems to break Hotpocket Helper from the 118 version onwards. I only have blue boards for now so I wouldn't really know if the janitor above me had the same problem I had.
https://ftp.mozilla.org/pub/firefox/releases/117.0b9/
This is a link to download the 117 beta 9 version which still doesn't break HPH.
>>
File: 1234123412341234.png (1.47 MB, 3520x1316)
1.47 MB
1.47 MB PNG
>>9508
After literally two seconds of testing it, which I should have done prior to posting this, while HPH is fixed the boards report are still shown as ? but everything else, reply chain, clearing from the thread and the jump to reported post function work they are just visually. The Catalog for some reason has no such problems and I can't honestly understand why
>>
File: 1234123412341234.png (1.42 MB, 3716x1316)
1.42 MB
1.42 MB PNG
>>9509
>Why yes I never double check how did you guess
fixed screenshot showing the broken report number
>>
File: 1590935593562.png (310 KB, 497x461)
310 KB
310 KB PNG
>>9510
>>9509
So. If you actually set up HPH in its own section isn the 4chan settings it just works.
TL;DR
118 onwards fucks HPH on Firefox, downgrade.
>>
works on my machine. stop using 4chanx
>>
>>9512
cope. not uninstalling botnetx.
>>
For me it's not totally broken and works as usual within the reports page itself. However when looking at blue boards live it no longer highlights reported posts and shows "? (?)" for the local board reports, as said earlier. I can live with it but just going to revert FF for now.
>>
>>9514
sadly also the case for me
>>
>>9514
>>9515
had to tinker a lot to resolve this by clearing cookies and logging in on the 4channel login page
might be a different issue for mods though
>>
>>9519
FWIW these steps did not fix anything for me
>>
I bet reddit doesn't have this many issues with moderation tools.
>>
>>9534
the majority of competent reddit mods used to use third party addons to interact with the mod tools because the default mod interface was absolute trash, it's part of why you saw longtime powermods getting pissed at the API changes.
>I am not and have never been a reddit mod, I just love partaking of third party drama.
>>
>>9535
Yes and HPH is a third party (unofficial) tool as well.
It was genuinely very useful when it still worked so I don't understand why there's no effort to merge the features in the native janny extension.
>>
>>9531
Yeah now it has stopped working for me at all as well lol
None of the extensions are working
>>
File: 1492629338898.png (458 KB, 600x600)
458 KB
458 KB PNG
how do u download it link not work
>>
>>9541
links are kill, see >>8660
>>
>>9542
who's fission
>>
>>9543
It's a server nick, which means you can @fission on discord to ping, or you can look down the user list on the server until you see fission and PM from there.
>>
>>9541
>>9543
the absolute state of our moderation team...
>>
>>9544
who's server nick?
>>
>>9546
who are you?
>>
holy fuck I suck at this without my HPH tricks and cantrips
>>
118.0.2 looks for have fixed it for me.
>>
>>9552
updating to this version has fixed it for me as well.
>>
i have released an update for firefox that resolves this issue. please update firefox to use hotpocket helper. thanks
>>
>>9554
we have mr.firefox here?
>>
>>9554
thank you mr. firefox, I missed the helpful red outlines
>>
since cryptobin is still down, a possible solution would be to encrypt/decrypt using this tool:
https://www.devglan.com/online-tools/aes-encryption-decryption
and then use an unlisted pastebin link with the encrypted scripts? Just a thought for the self-service aspect so we don't have to keep PMing a mod
>>
>>9554
thank god we have a mod who is CEO of Firefox

i refuse to believe that the people who sweep without HPH are of sound body and mind
>>
>>9558
>i refuse to believe that the people who sweep without HPH are of sound body and mind
i raw dog it on Edge, fren.
>>
>>9559
>edging
Dumb gooner.
>>
what is that little vertical line button on the right???

???
>>
>>9606
I for Info, it shows info about the thread and you can click it to preview the OP of the thread.
>>
File: info box.png (55 KB, 431x331)
55 KB
55 KB PNG
>>9606
>>9607
would've helped if I'd attached the image I meant to attach.
>>
File: 1675972844258131.jpg (6 KB, 225x225)
6 KB
6 KB JPG
>>9607
>>9608
huh...

Well it doesn't do that for me. it does nothing. maybe a bug.
I use Violentmonkey on the latest version of firefox
>>
>>9609
use tampermonkey.
>>
>>9610
>using nonfree software
>>
>>9608
This never worked for me either. I honestly didn't know that was supposed to do anything
>>
>>9608
wow so that is what it looks like
>>
>>9608
That only does that once for me. Literally useless because of that.
>>
>>9608
i did nut realize there were stats on hover, i only clicked in another browser and ignored it being broken in mine since the broken features didn't seem that useful on slower boards

>>9609
One fix for violentmonkey is to use a wrappedJSObject, so
var wrappedWindow = window.wrappedJSObject;
in place of window
and
var Tip = wrappedWindow.Tip;
var RQ = wrappedWindow.RQ;

Seems like some issue with CSP, and different implementations between userscript extensions.
Mustard gas experts can search wrappedJSObject on the violentmonkey github, I guess.
>>
>>9609
violentmonkey and greasemonkey stopped working with HPH years ago. take the tampermonkey pill
>>
>>9621
>Seems like some issue with CSP
brb deleting 4channel
>>
>>9623
Finally
>>
// ==UserScript==
// @name Reports - Hotpocket Helper
// @version 6.5
// @description My report queue is augmented
// @author (cyg && fsn) == bffs 5ever
// @match https://reports.4chan.org/*
// @exclude https://reports.4chan.org/?action*
// @grant none
// ==/UserScript==

(function() {
'use strict';

var CFRQ = {
//don't touch anything below this line
firstRun: true,
buttons: {
"Threads":"cfrq-threads",
"OP":"cfrq-opsfilt",
"Reply":"cfrq-replyfilt"
}
};

CFRQ.refresh = function() {
CFRQ.stats = {};
CFRQ.threads = {};
CFRQ.xhr = {};
CFRQ.parsePage();
window.RQ.settingsList.autoSortThreads = ["Sort by thread on page load", false];
window.RQ.settingsList.autoScrollNav = ["Pin toolbar to top of page", true];
if (window.RQ.board) CFRQ.fetchThreadlist(window.RQ.board);
};

//Loop through each report, add buttons, link checkboxes, gather stats for thread sorting
CFRQ.parsePage = function() {
var report, reports = $.qsa("article");
for (var b in CFRQ.buttons) { //Reset all button states
if ($.hasClass($.id(CFRQ.buttons[b]), "disabled")) {
$.removeClass($.id(CFRQ.buttons[b]), "disabled");
}
}

for (var i = 0; (report = reports[i]); ++i) CFRQ.parseReport(report);

CFRQ.parseSlugs();

CFRQ.sortThreadsByReply();
CFRQ.firstRun = false;

if (window.RQ.settings.autoSortThreads) CFRQ.filterThreads();
};

CFRQ.parseSlugs = function() {
CFRQ.boardList = [];
var slug, slugs = $.cls("board-slug");
for (var i = 0; (slug = slugs[i]); ++i) {
CFRQ.boardList.push(slug.textContent);
CFRQ.stats[slug.textContent] = slug.getAttribute("data-tip");
slug.id = "board-slug-" + slug.innerHTML;
CFRQ.updateSlug(slug);
}
};

CFRQ.updateSlug = function(slug) {
var level, board = slug.id.split("board-slug-")[1];
var count = parseInt(CFRQ.stats[board]);

if (!count) {
slug.style.color = "#777";
return;
}

slug.style = { fontWeight: "", fontStyle: "", color: "" };

slug.style.color = ["hsl(", ((1-(((count += (count - (count * .4))) > 160 ? count = 160 : count)/160))*160).toString(10),",100%,50%)"].join("");
};

CFRQ.parseReport = function(report) {
if (report.getAttribute("cfrq-parent")) return;

var board = report.id.split("-")[1];
var resto_no = report.getAttribute("data-tid") || report.id.split("-")[2];
var resto = board + "-" + resto_no;
var controls = $.qs(".report-controls", report);

controls.appendChild(CFRQ.createInfoButton(board, resto_no));//Add info button to each report control pane

report.setAttribute("cfrq-parent", resto);

/* If it's an illegal report, add 1000 reports for this thread so it always appears at the top of thread sorting */
if (CFRQ.threads[resto]) CFRQ.threads[resto] += ($.hasClass(report, "report-cat-prio") ? 1000 : 1);
else CFRQ.threads[resto] = ($.hasClass(report, "report-cat-prio") ? 1000 : 1);

CFRQ.parseQuotelinks(report, resto_no, board);
};

CFRQ.createInfoButton = function(board, resto_no) {
var button = $.el("span");
button.textContent = "I";
button.className = "button";
var attr = {'data-board':board, 'data-cmd':"show-preview", 'data-resto':resto_no};
for (var k in attr) button.setAttribute(k, attr[k]);
$.on(button, "mouseover", CFRQ.threadStatsMouseover);

return button;
};

CFRQ.threadStatsMouseover = function(t) {
t = t.target;
var board = t.getAttribute("data-board");
var pid = t.getAttribute("data-resto");
//if (t.getAttribute("data-last-retrieved") > ($.now() - 30)) Tip.timeout = setTimeout(Tip.show, Tip.delay, t, CFRQ.xhr[board+pid]);
if (t.getAttribute("data-last-retrieved") > ($.now() - 30)) Tip.show(t, CFRQ.xhr[board+pid]);

$.xhr("GET", `https://a.4cdn.org/${board}/thread/${pid}.json`, {
onreadystatechange: function() {
if (this.status == 200 && this.readyState == 4) {
t.setAttribute("data-last-retrieved", $.now());
CFRQ.xhr[board+pid] = CFRQ.parseThreadStats(this.responseText, board, pid);
Tip.timeout = setTimeout(Tip.show, Tip.delay, t, CFRQ.xhr[board+pid]);
}
},
onerror: function() {
window.RQ.notify("That post doesn't exist anymore.");
}
});
};

CFRQ.parseThreadStats = function(responseText, board, pid) {
var ret = JSON.parse(responseText);

var posts = ret.posts;
var op = ret.posts[0];

var replies = (op.replies >= 1 ? `Replies: ${op.replies}` : `No replies`);
var images = (op.images >= 1 ? `Images: ${op.images}` : `No images`);
var opAge = `Thread Age: ${$.ago(op.time)}`;
var lastReply = `Last reply: ${$.ago(posts[posts.length -1].time)} ago`;
var info = `${replies}\n${images}\n${opAge}\n${lastReply}\n\nClick to preview OP`;

return info;
};

CFRQ.parseQuotelinks = function(report, resto, board) {
//Post links
var i, qlink, tmp, qlinks = $.cls("quotelink", report), tmptxt = "";
for (i = 0; (qlink = qlinks[i]); ++i) {
qlink.style = "pointer-events:all;cursor:pointer;";
var href = qlink.getAttribute("href");
qlink.target = "_blank";
if (!href) return;

if (qlink.textContent.match(/^>>>/)) {
board = qlink.textContent.split("/")[1];
tmp = href.split("/");
if (tmp.length < 6) {
return;
} else {
resto = tmp[5].split("#")[0];
tmptxt = " (Cross-board)";;
}
} else if (href.includes("thread") && !qlink.getAttribute("data-resto")) {
resto = href.split("/")[3].split("#")[0];
tmptxt = " (Cross-thread)";
}

var linkParts = href.split("/");
var targetPost = linkParts[linkParts.length - 1].split("#p")[1];
var attr = {'data-cmd': 'cfrq-quotelink', 'data-board':board, 'data-resto':resto, 'data-target': targetPost, 'href': "https://boards.4chan.org/" + board + "/thread/" + resto + "#p" + targetPost};
for (var k in attr) qlink.setAttribute(k, attr[k]);
qlink.textContent += tmptxt;
}

qlinks = $.cls("deadlink", report);
if (qlinks.length != 0) {
for (i = 0; (qlink = qlinks[i]); ++i) {
qlink.style = "color:red;";
qlink.setAttribute("href", "#p404");
}
}
};

CFRQ.fetchThreadlist = function(board) {
if (CFRQ.xhr[board]) return;

$.xhr("GET", `https://a.4cdn.org/${board}/threads.json`, {
onreadystatechange: function() {
if (this.status == 200 && this.readyState == 4) {
CFRQ.xhr[board] = JSON.parse(this.responseText);
}
},
onerror: function() {
window.RQ.notify("Connection error");
}
});
};

CFRQ.fetchBoardList = function() {
if ($.getItem("cfrq-boardlist")) { //Have it already breh
CFRQ.boardlist = JSON.parse($.getItem("cfrq-boardlist"));
return;
}
$.xhr("GET", `https://a.4cdn.org/boards.json`, {
onreadystatechange: function() {
if (this.status == 200 && this.readyState == 4) {
CFRQ.boardlist = JSON.parse(this.responseText);
$.setItem("cfrq-boardlist", this.responseText);
}
},
onerror: function() {
window.RQ.notify("Connection error");
}
});
};

CFRQ.incrementStats = function(board, amount) {
return (CFRQ.stats[board] ? CFRQ.stats[board] += amount : CFRQ.stats[board] = amount);
};

CFRQ.decrementStats = function(board, amount) {
return (CFRQ.stats[board] && CFRQ.stats[board] >= 1 ? CFRQ.stats[board] += amount : null);
};

//Add filter buttons to the toolbar at the top /* delete if added natively */
CFRQ.addFilters = function() {
var btntxt,
buttoncbks = {"OP": CFRQ.filterReport, "Reply": CFRQ.filterReport, "Threads": CFRQ.filterThreads},
buttontips = {"OP": "Show OPs only", "Reply": "Show Replies only", "Threads": "Group all by thread"};
for (btntxt in CFRQ.buttons) {
var el = $.el("span");
el.className = "button button-light left";
el.innerHTML = btntxt;
el.id = CFRQ.buttons[btntxt];
el.setAttribute("data-tip", buttontips[btntxt]);
$.id('refresh-btn').parentNode.insertBefore(el, $.id('refresh-btn').nextSibling);
$.on($.id(CFRQ.buttons[btntxt]), "click", buttoncbks[btntxt]);
}
};

CFRQ.filterReport = function(el) {
var btn = el.target;
CFRQ.resetFilter();
if ($.hasClass(btn, "disabled")) {
$.removeClass(btn, "disabled");
return;
}
var report, reports = $.cls("report"), showRepliesOnly = (btn.id == "cfrq-replyfilt");
for (var i = 0; (report = reports[i]); ++i) {
if (showRepliesOnly && !report.hasAttribute("data-tid")) {
$.addClass(report, "hidden-i");
} else if (!showRepliesOnly && report.hasAttribute("data-tid")) {
$.addClass(report, "hidden-i");
}
}
$.addClass(btn, "disabled");
};

CFRQ.sortThreadsByReply = function() {
//Thread sorting by report count
var tempCounts = [];
var tempThreads = [];
for (var thread in CFRQ.threads) {
tempCounts.push(CFRQ.threads[thread]);
}
tempCounts.sort(function(a, b) {
return b - a;
});

for (var i = 0; (thread = tempCounts[i]); ++i) {
for (var x in CFRQ.threads) {
if (CFRQ.threads[x] == thread ) {
tempThreads.push(x);
delete CFRQ.threads[x];
}
}
}

CFRQ.sortedThreads = tempThreads;
return;
};

CFRQ.filterThreads = function() {
if (!CFRQ.createThreadHeaders()) return;

var thread, report;
for (let i = 0; (thread = CFRQ.sortedThreads[i]); i++) { //fix me
var reports = $.qsa('article[cfrq-parent="' + thread + '"]');
for (var j = reports.length - 1; (report = reports[j]); j--) { //Add thread reports under header
$.id('items').removeChild(report);
var th_id = $.id("cfrq-th-" + thread);
if (th_id) {
$.id("items").insertBefore(report, th_id.nextSibling);
} else {
$.id("items").insertBefore(report, $.id("cfrq-th-remainder").nextSibling);
}
}
}
};

CFRQ.createThreadHeaders = function() {
var header, headers = $.cls("cfrq-thread-header");
if (headers.length) {
$.toggleXls($.id("cfrq-threads"), "disabled");
for (let i = 0; (header = headers[i]); ++i) {
//header.parentNode.removeChild(header);
$.toggleXls(header, "hidden-i");
}

return false; //stop
}

$.toggleXls($.id("cfrq-threads"), "disabled");

var thread, reports, report;
for (let i = 0; (thread = CFRQ.sortedThreads[i]); i++) {
reports = $.qsa('article[cfrq-parent="' + thread + '"]');
if (reports.length > 1 || $.hasClass(reports[0], "report-cat-prio")) {
header = $.el("header");
let board = thread.split("-")[0];
let tid = thread.split("-")[1];
let boardLink = `<a href="${window.RQ.linkToPost(board, tid, 0)}" target="_blank">&gt;&gt;/${board}/${tid}</a>`;
header.innerHTML = `${reports.length} ${$.pluralise(reports.length, " report", " reports")} for ${boardLink}`;
header.className = "cfrq-thread-header";
header.id = "cfrq-th-" + thread;
$.id("items").insertBefore(header, $.id('items').childNodes[i]);
}
}

reports = $.qsa('article[cfrq-parent="' + thread + '"]');
header = $.el("header");
header.innerHTML = `Other Reports`;
header.className = "cfrq-thread-header";
header.id = "cfrq-th-remainder";
$.id("items").insertBefore(header, $.id('items').childNodes[CFRQ.sortedThreads.length]);
return true;
};

CFRQ.resetFilter = function() {
var report, reports = $.cls("report");
for (var i = 0; (report = reports[i]); ++i) {
if ($.hasClass(report, "hidden-i")) $.removeClass(report, "hidden-i");
}
};

CFRQ.clearTooltips = function() {
$.qsa(".tip-top").forEach(function(top) {
try {
top.parentNode.removeChild(top);
} catch (e) {
//shut up
}
});
};

CFRQ.onScroll = function() {
var st = window.pageYOffset || document.documentElement.scrollTop;
if (st > 20 && window.RQ.settings.autoScrollNav){
$.id('menu').style = 'position:fixed;top:0;right:0;left:0;z-index:99;';
} else {
if (window.pageYOffset < 20 || !window.RQ.settings.autoScrollNav) $.id('menu').style = '';
}
};

CFRQ.parseContext = function() {
var i;
var content = $.id("context-preview");
if (!CFRQ.viewThread) {
for (i = 0; i < content.childNodes.length; i++) {
if (!content.childNodes[i].classList.contains("focused")) {
content.childNodes[i].classList.add("hidden");
} else {
CFRQ.parseQuotelinks(content.childNodes[i], content.childNodes[0].id.split("-")[2], CFRQ.contextStart[0]);
}
}
var post = $.id("context-" + CFRQ.contextStart[0] + "-" + CFRQ.contextStart[2]);
//if post is null, it's because we've opened the context for a different thread than the original post
if (post) {
CFRQ.contextShow(post, CFRQ.contextStart[1], CFRQ.contextStart[0]);
}
} else {
for (i = 0; i < content.childNodes.length; i++) {
CFRQ.parseQuotelinks(content.childNodes[i], content.childNodes[0].id.split("-")[2], content.childNodes[i].id.split("-")[1]);
}
}
};

CFRQ.contextHide = function(post, resto, board) {
$.addClass(post, "hidden");
$.removeClass(post, "focused");
var quotelinks = $.cls("quotelink", post);
for (var i = 0; i < quotelinks.length; i++) {
if (quotelinks[i].getAttribute("data-target")) {
var npost = $.id("context-" + board + "-" + quotelinks[i].getAttribute("data-target"));
if (npost.classList && !npost.classList.contains("hidden")) {
CFRQ.contextHide(npost, resto, board);
}
}
}
};

CFRQ.contextShow = function(post, resto, board) {
$.removeClass(post, "hidden");
CFRQ.parseQuotelinks(post, resto, board);
};

CFRQ.toggleContextPost = function(board, resto, no) {
var post = $.id("context-" + board + "-" + no);

if (!post) {
window.RQ.showContext(board, resto, no);
return;
}

if ($.hasClass(post, "hidden")) {
CFRQ.contextShow(post, resto, board);
$.addClass(post, "focused");
return true;
} else {
CFRQ.contextHide(post, resto, board);
return false;
}
};

CFRQ.toggleContextFocus = function(board, resto, no) {
$.id("context-" + board + "-" + no).classList.add("focused");
};

CFRQ.contextStartup = function(el, board, resto, no) {
CFRQ.viewThread = false;
CFRQ.contextStart = [];
CFRQ.contextStart.push(board);//start post board
CFRQ.contextStart.push(resto);//start post resto
CFRQ.contextStart.push((el.parentNode.parentNode.id.split("-")[2] ? el.parentNode.parentNode.id.split("-")[2] : el.parentNode.parentNode.parentNode.id.split("-")[2]));//start post no
window.RQ.showContext(board, resto, no);
};

CFRQ.manageExistingContext = function(el, board, resto, no) {
if (CFRQ.viewThread) {
var focus = $.cls("focused", el.parentNode.parentNode.parentNode.parentNode);
for (var i = 0; i < focus.length; i++) focus[i].classList.remove("focused");

var nf = $.id("context-" + el.getAttribute('data-board') + "-" + el.getAttribute('data-target'));
if (nf) {
nf.classList.add("focused");
nf.scrollIntoView();
} else {
window.RQ.showContext(board, resto, no);
}
} else {
if (CFRQ.toggleContextPost(board, resto, no)) {
el.parentNode.parentNode.classList.remove("focused");
} else {
el.parentNode.parentNode.classList.add("focused");
}
}
};

CFRQ.openPostInContext = function(el, target) {
if (el.ctrlKey) return;
el.preventDefault();
el = el.target;
var board = el.getAttribute('data-board');
var resto = el.getAttribute('data-resto');
var no = (target) ? target : el.getAttribute('data-target');

if (RQ.mode != RQ.MODE_CONTEXT) CFRQ.contextStartup(el, board, resto, no);
else CFRQ.manageExistingContext(el, board, resto, no);
};

CFRQ.rqContextStartup = function(panel) {
for (let i = 0; i < panel.childNodes.length; i++) {
panel.childNodes[i].classList.remove("hidden");
}
};

CFRQ.onClick = function(el) {
var t = el.target;
switch(t.getAttribute("data-cmd")) {
case "show-preview":
CFRQ.openPostInContext(el, t.getAttribute('data-resto'));
break;
case "show-context":
CFRQ.viewThread = true;
CFRQ.rqContextStartup($.id("context-preview"));
break;
case "cfrq-quotelink":
CFRQ.openPostInContext(el, null);
break;
default: break;
}
};

//modified helpers.js
if($)$.remByID=function(e){var n=$.id(e);n&&n.parentNode.removeChild(n)};else{var $={id:function(e){return document.getElementById(e)},remByID:function(e){var n=$.id(e);n&&n.parentNode.removeChild(n)},cls:function(e,n){return(n||document).getElementsByClassName(e)},byName:function(e){return document.getElementsByName(e)},tag:function(e,n){return(n||document).getElementsByTagName(e)},el:function(e){return document.createElement(e)},el2:function(e,n,t,i){var o,r;for(r in o=$.el(e),t)o.setAttribute(r,t[r]);return i&&(o.innerHTML=i),n.appendChild(o)},frag:function(){return document.createDocumentFragment()},qs:function(e,n){return(n||document).querySelector(e)},qsa:function(e,n){return(n||document).querySelectorAll(e)},extend:function(e,n){for(var t in n)e[t]=n[t]}};document.documentElement.classList?($.hasClass=function(e,n){return e.classList.contains(n)},$.addClass=function(e,n){e.classList.add(n)},$.removeClass=function(e,n){e.classList.remove(n)}):($.hasClass=function(e,n){return-1!=(" "+e.className+" ").indexOf(" "+n+" ")},$.addClass=function(e,n){e.className=""===e.className?n:e.className+" "+n},$.removeClass=function(e,n){e.className=(" "+e.className+" ").replace(" "+n+" ","")}),$.on=function(e,n,t){e.addEventListener(n,t,!1)},$.dispatch=function(e,n){var t=document.createEvent("Event");t.initEvent(e,!1,!1),document.dispatchEvent(t)},$.off=function(e,n,t){e.removeEventListener(n,t,!1)},$.xhr=function(e,n,t,i,o,r){var s,c,a;if(o=!!o||0,(c=new XMLHttpRequest).open(e,n,!0),t)for(s in t)c[s]=t[s];if(i)if("string"==typeof i)c.setRequestHeader("Content-type","application/x-www-form-urlencoded");else{for(s in a=new FormData,i)a.append(s,i[s]);i=a}else i=null;return o&&(c.withCredentials=!0),c.send(i),c},$.getItem=function(e){return localStorage.getItem(e)},$.setItem=function(e,n){return localStorage.setItem(e,n)},$.removeItem=function(e){return localStorage.removeItem(e)},$.getCookie=function(e){var n,t,i,o;for(o=e+"=",i=document.cookie.split(";"),n=0;t=i[n];++n){for(;" "==t.charAt(0);)t=t.substring(1,t.length);if(0===t.indexOf(o))return decodeURIComponent(t.substring(o.length,t.length))}return null},$.toggleXls=function(e,n){$.hasClass(e,n)?$.removeClass(e,n):$.addClass(e,n)},$.getToken=function(){return document.body.getAttribute("data-tkn")},$.capitalise=function(e){return e.charAt(0).toUpperCase()+e.slice(1)},$.pluralise=function(e,n,t){return 1===e?n||"":t||"s"},$.prettyBytes=function(e){return e>=1048576?(0|e/1048576*100+.5)/100+" MB":e>1024?(0|e/1024+.5)+" KB":e+" B"},$.ago=function(e){var n,t,i,o;return(n=Date.now()/1e3-e)<1?"1 sec":60>n?(0|n)+" secs":3600>n?(t=0|n/60)>1?t+" mins":"1 min":86400>n?(i=(t=0|n/3600)>1?t+"":"1",i+="."+(o=0|n/60-60*t)+" hrs"):(i=(t=0|n/86400)>1?t+"":"1",(o=0|n/3600-24*t)>=1&&(i+="."+o+" days"),i+"")},$.now=function(){return Math.round((new Date).getTime()/1e3)},$.length=function(e){return Object.keys(e).length},$.hidden="hidden",$.visibilitychange="visibilitychange",void 0===document.hidden&&("mozHidden"in document?($.hidden="mozHidden",$.visibilitychange="mozvisibilitychange"):"webkitHidden"in document?($.hidden="webkitHidden",$.visibilitychange="webkitvisibilitychange"):"msHidden"in document&&($.hidden="msHidden",$.visibilitychange="msvisibilitychange")),$.docEl=document.documentElement}
var states = ["complete", "loaded", "interactive"];
if (states.indexOf(document.readyState) != -1) CFRQ.addFilters();
$.on(document, "4chanReportsReady", CFRQ.refresh);
$.on(document, "4chanReportContextReady", CFRQ.parseContext);
$.on(document, "scroll", CFRQ.onScroll);
$.on(document, "click", CFRQ.onClick);
CFRQ.fetchBoardList();
})();
>>
// ==UserScript==
// @name Boards - Hotpocket Helper
// @version 6.5
// @author (cyg && fsn) == bffs 5 evr
// @include https://boards.4chan.org/*
// @include https://boards.4channel.org/*
// @exclude https://boards.4chan.org/*/catalog
// @exclude https://boards.4channel.org/*/catalog
// @grant none
// @run-at document-start
// ==/UserScript==

(function() {
'use strict';

var CFBS = {};

CFBS.refresh = function() {
CFBS.jumperIndex = 0;
CFBS.jumperArray = [];
CFBS.fetchReports();
CFBS.init4chX();
};

CFBS.createHelperSettings = function() {
SettingsMenu.options.HotPocketHelper = {
boardReportQueue: ["Board queue", "Show board specific report stats in the admin panel."],
markReportedPosts: ["Tag reported posts", "Posts that have been reported will be tagged with a [Reported] indicator."],
useReportBorders: ["Border reported posts", "Posts that have been reported will have a red border."]

}
};

CFBS.parsePage = function() {
CFBS.createHelperSettings();
var prevParse = [].slice.call($.cls("cfbs-parsed"));
var reported, post;

for (var i = 0; (reported = CFBS.xhrReports[i]); ++i) {
if (!(post = $.id("p" + reported.no))) continue; //Report isn't on page.
CFBS.jumperArray.push(reported.no);

for (var j = 0; j < prevParse.length; j++) if (prevParse[j].id === "p" + reported.no) prevParse.splice(j, 1);

if (!$.hasClass(post, "cfbs-parsed")) {
$.addClass(post, "cfbs-parsed");
if (window.Config.useReportBorders || typeof(window.Config.useReportBorders) === "undefined") CFBS.createReportBorder(post);
var el = CFBS.createReportTag(reported.no);
if (window.Config.useIconButtons) CFBS.createClearButton(el, reported.no);
}
}

CFBS.jumperArray.sort(function(a, b) {
return a - b;
});

CFBS.reportsTotal = CFBS.xhrReports.length;

for (j = 0; j < prevParse.length; j++) {
CFBS.removeReportTag(prevParse[j].id.split("p")[1]);
if (window.Config.useIconButtons) CFBS.removeClearButton(prevParse[j].id.split("p")[1]);
$.removeClass(prevParse[j], "cfbs-parsed");
}
};

CFBS.createReportBorder = function(post) {
if ($.hasClass(post, "op")) post.parentNode.parentNode.style = "border: 1px solid red !important";
else post.style = "border: 1px solid red !important";
};

CFBS.removeReportBorder = function(no) {
let post = $.id("p" + no);
post.style = "";
post.parentNode.parentNode.style = "";
}

CFBS.createReportTag = function(no) {
var el = $.el("span");
el.id = `cfbs-reported-${no}`;
if (window.Config.markReportedPosts || typeof(window.Config.markReportedPosts) === "undefined") el.innerHTML = ` [<font id='cfbs-reported-${no}-txt' style='color:red; font-weight:700;'>Reported</font>]`;
$.id("pi" + no).insertBefore(el, $.qs("[class='postNum desktop']", $.id("pi" + no)).nextSibling);
return el;
};

CFBS.createClearButton = function(el, no) {
var btn = $.el("img");
btn.alt = "CLR";
btn.className = "extButton";
btn.id = `cfbs-reported-button-${no}`;
btn.src = `https://s.4cdn.org/image/buttons/${CFBS.style}/report.png`;
var attr = {'Title':'Clear this report', 'data-id':no, 'data-cmd':'cfbs-clear-report'};
for (var k in attr) btn.setAttribute(k, attr[k]);

el.parentNode.insertBefore(btn, el.nextSibling);
};

CFBS.removeReportTag = function(no) {
$.id("cfbs-reported-" + no).remove();
};

CFBS.removeClearButton = function(no) {
$.id("cfbs-reported-button-" + no).remove();
};

//Toolbox loaded, add the stuff
CFBS.setupToolbox = function() {
if (window.Config.boardReportQueue == false) return;
var toolbox = $.id("adminToolbox");
var tmp, h4 = $.el("h4");
toolbox.insertBefore(h4, toolbox.childNodes[2]);

var el = $.el("a");
el.href = `http://reports.4chan.org/#/${CFBS.board}`;
el.target = "_blank";
el.setAttribute("Title", `Open /${CFBS.board}/ queue`);
el.textContent = `/${CFBS.board}/ Reports`;
h4.appendChild(el);

el = $.el("span");
el.textContent = ": ";
tmp = $.el("span");
tmp.setAttribute("Title", "Reports in queue");
tmp.id = "cfbs-queue-count";
tmp.textContent = "?";
el.appendChild(tmp);
el.appendChild(document.createTextNode(" ("));
tmp = $.el("a");
tmp.setAttribute("data-cmd", "cfbs-jumper");
tmp.setAttribute("Title", "Current report / Reports on page");
tmp.id = "cfbs-jumper-txt";
tmp.textContent = "0 / ?";
el.appendChild(tmp);
el.appendChild(document.createTextNode(")"));
h4.appendChild(el);

$.id("cfbs-jumper-txt").style.cursor = "pointer";
};

CFBS.updateToolbox = function() {
if (!window.Config.boardReportQueue) return;
var scan = setInterval(function() {
if ($.id("cfbs-queue-count") && $.id("cfbs-jumper-txt")) {
clearInterval(scan);
$.id("cfbs-queue-count").textContent = CFBS.reportsTotal;
$.id("cfbs-jumper-txt").textContent = `${CFBS.jumperIndex} / ${CFBS.jumperArray.length}`;
}
}, 10);
};

CFBS.updateListeners = function() {
$.on(document, "4chanThreadUpdated", CFBS.refresh);
$.on(document, "4chanATUpdated", CFBS.refresh);
};

CFBS.updatePostMenu = function() {
var menu = $.id("post-menu"), repNode, rcNode, aNode;
if (!menu) return;
var pid = menu.firstChild.firstChild.getAttribute("data-id"); //loving every laugh
var post = $.id(`p${pid}`);
var reported = $.hasClass(post, "cfbs-parsed");

if (reported) {
//clear report option
repNode = $.el("LI");
$.addClass(repNode, "dd-admin");
aNode = $.el("a");
aNode.setAttribute("data-cmd", "cfbs-clear-report");
aNode.setAttribute("data-id", pid);
aNode.textContent = "Clear Report";
repNode.appendChild(aNode);
menu.firstChild.insertBefore(repNode, $.cls("dd-admin")[1]);
}

if ($.cls("backlink", post).length) {
rcNode = $.el("LI");
$.addClass(rcNode, "dd-admin");
aNode = $.el("a");
aNode.setAttribute("data-cmd", "cfbs-reply-chain");
aNode.setAttribute("data-id", pid);
aNode.textContent = "Reply Chain";
rcNode.appendChild(aNode);

if (reported) {
menu.firstChild.insertBefore(rcNode, $.cls("dd-admin")[3]);
} else {
menu.firstChild.insertBefore(rcNode, $.cls("dd-admin")[1]);
}
}

menu.style.zIndex = "10001";
};

CFBS.runReportJumper = function() {
if (CFBS.jumperIndex >= CFBS.jumperArray.length) CFBS.jumperIndex = 0;
var el = $.id(`p${CFBS.jumperArray[CFBS.jumperIndex]}`);
if (el) {
el.scrollIntoView();
window.scrollBy(0, -50); //pad top of page
++CFBS.jumperIndex;
}
CFBS.updateToolbox();
};

CFBS.removeFromJumper = function(no) {
var index = CFBS.jumperArray.indexOf(no);
if (index > -1) {
CFBS.jumperArray.splice(index, 1);
if (CFBS.jumperIndex > 0) CFBS.jumperIndex--;
CFBS.reportsTotal--;
}

CFBS.updateToolbox();
};

CFBS.openReplyChain = function(pid) {

CFBS.replyChainSeen = [];
var bod = document.body;

//Panel for posts
var el = $.el("div");
el.id = "settingsMenu";
el.className = "UIPanel";
el.setAttribute("data-cmd", "cfbs-close-replychain");
el.innerHTML = `<div style="overflow-y: scroll;"><div class="extPanel reply" style="width: 98%;"><div class="panelHeader" id="cfbs-panelHeader">Viewing reply chain<span id="cfbs-panelCtrl" class="panelCtrl"></span></div></div></div>`;
bod.appendChild(el);
el.style.overflowY = "scroll";
el.style.zIndex = "10000";

//Close panel button
var btn = $.el("img");
btn.src = `https://s.4cdn.org/image/buttons/${CFBS.style}/cross.png`;
btn.setAttribute("data-cmd", "cfbs-close-replychain");
btn.setAttribute("Title", "Close chain");
btn.className = "pointer";
$.id("cfbs-panelCtrl").appendChild(btn);

//Submit deletions button
btn = $.el("img");
btn.src = `https://s.4cdn.org/image/buttons/${CFBS.style}/report.png`;
btn.setAttribute("data-cmd", "cfbs-delete-chain");
btn.setAttribute("Title", "Delete selected from chain");
btn.className = "pointer";
$.id("cfbs-panelHeader").appendChild(btn);

CFBS.addToChain(pid, el.firstChild); //recursive

$.on(el, 'mouseover', window.Main.onThreadMouseOver);
$.on(el, 'mouseover', CFBS.replyChainMouseover);
$.on(el, 'mouseout', window.Main.onThreadMouseOut);

$.dispatch("CFBSReplyChainDone");
};

CFBS.replyChainMouseover = function(el) {
var t = el.target;
if ($.hasClass(t, 'quotelink')) {
var scan = setInterval(function() {
if ($.id("quote-preview")) {
clearInterval(scan);
$.id("quote-preview").style.zIndex = "9009";//pro
}
}, 10);
}
};

CFBS.closeReplyChain = function() {
$.off($.id("settingsMenu"), 'mouseover', window.Main.onThreadMouseOver);
$.off($.id("settingsMenu"), 'mouseover', CFBS.replyChainMouseover);
$.off($.id("settingsMenu"), 'mouseout', window.Main.onThreadMouseOut);
$.id("settingsMenu").parentNode.removeChild($.id("settingsMenu"));
};

CFBS.addToChain = function(postID, panel) {
var link, links, post = $.id(`p${postID}`);
var posts = [];

if ($.id(`bl_${postID}`)) {
links = $.id(`bl_${postID}`).childNodes;
for (var i = 0; (link = links[i]); ++i) {
link = link.firstChild.innerHTML.replace("&gt;&gt;", "");

if (CFBS.replyChainSeen.includes(link)) continue;
posts.push(link);
CFBS.replyChainSeen.push(link);
}
}

var clone = post.cloneNode(true);
if (!$.hasClass(clone, "reply")) {
$.addClass(clone, "reply"); //For OPs
}

clone.style.display = "block";
clone.style.zIndex = "10000";
if (!$.qs('[class="extControls"]', clone)) { //add buttons here
var cnt = CFBS.buildPostIcons(postID);
$.cls("postInfo desktop", clone)[0].insertBefore(cnt, $.cls("postNum desktop", clone)[0].nextSibling);
}

panel.appendChild(clone);

for (i = 0; (post = posts[i]); ++i) {
CFBS.addToChain(post, panel);
}
};

CFBS.deleteFromChain = function() {
var confirmed = confirm("Delete selected posts?");
if (!confirmed) return;
var marked = $.qsa("input[value='delete']:checked");

var post;
for (var i = 0; (post = marked[i]); ++i) {
var id = post.name;
CFBS.deleteChainRequest(id);
}
};

CFBS.buildPostIcons = function(postID) {

if (CFBS.style == undefined) CFBS = (window.style_group == "ws_style") ? "burichan" : "futaba"; //shrug

var html = `<img class="extButton" alt="X" data-cmd="open-delete-prompt" data-id="${postID}" `
+ `src="https://s.4cdn.org/image/buttons/${CFBS.style}/cross.png" title="Delete">`;

if (window.spoilers && ($.id('fT' + postID))) {
html += `<img class="extButton" alt="S" data-cmd="prompt-spoiler" `
+ `data-id="${postID}" src="https://s.4cdn.org/image/buttons/${CFBS.style}/s.png" title="Toggle Spoiler">`;
}
if (!window.thread_archived) {
var mode = ($.id("adminToolbox").childNodes.length > 4) ? "ban" : "open-banreq-prompt"; //hackerman
html += `<img class="extButton" alt="B" data-cmd="${mode}" `
+ `data-id="${postID}" src="https://s.4cdn.org/image/buttons/${CFBS.style}/ban.png" title="Ban Request">`;
}
var cnt = document.createElement('div');
cnt.className = 'extControls';
cnt.innerHTML = html;

return cnt;
};

CFBS.init4chX = function() {
if (!$.hasClass($.tag("html")[0], "fourchan-x")) return;
var post, posts = $.cls("post");
for (var i = 0; (post = posts[i]); ++i) {
if ($.cls("extControls", post).length > 0) continue; //saw this post
var postID = post.id.replace("p","");
var cnt = CFBS.buildPostIcons(postID);
$.id(`pi${postID}`).insertBefore(cnt, $.cls("postNum desktop", $.id(`pi${postID}`))[0].nextSibling);
}

if (!$.id("cfbs-j-link")) {
var clone = $.id("j-link").cloneNode(true);
clone.id = "cfbs-j-link";
$.id("board-list").appendChild(clone);
}
};

CFBS.deleteChainRequest = function(id) {
var data = {"mode":"usrdel", "pwd":"janitorise"};
data[id] = "delete";
$.xhr("POST", `https://sys.${CFBS.domain}.org/${CFBS.board}/post`, {
onreadystatechange: function() {
if (this.readyState == 4 && this.status == 200) {
CFBS.removeFromJumper(id);
if (/Updating index/.test(this.responseText)) {
var deleted = $.qsa(`[id="p${id}"]`);
for (var k = 0; k < deleted.length; ++k) {
deleted[k].style.opacity = "0.3";
}
} else {
console.log(this.responseText);
$.id("cfbs-panelHeader").innerHTML += "<font style='color:red;font-weight:700'>Error</font>";
}
}
},
onerror: function(e) {
console.log("error deleting post " + id);
$.id("cfbs-panelHeader").innerHTML += "<font style='color:red;font-weight:700'>Error</font>";
console.log(e);

}
}, data, true);
};

CFBS.fetchReports = function() {
$.xhr("GET", `https://reports.4chan.org/?action=get_reports&board=${CFBS.board}`, {
onreadystatechange: function() {
if (this.status == 200 && this.readyState == 4) {
try {
var dat = JSON.parse(this.responseText);
} catch (e) {
console.log("Error parsing reports");
console.log(e);
}

if (dat.status != "success") {
console.log("error parsing reports or you don't have this board.");
return;
}

CFBS.updateToolbox();

$.on(document, "click", CFBS.onClick);
$.dispatch("CFBSFetchQueueData"); //Should only run once

CFBS.xhrReports = dat.data.reports;

$.dispatch("CFBSReportsRetrieved");
}
},
onerror: function() {
console.log("error fetching reports or you don't have this board.");
}
}, null, true);
};

CFBS.fetchQueueData = function() {
$.off(document, "CFBSFetchQueueData", CFBS.fetchQueueData);
$.xhr("GET", "https://reports.4chan.org/", {
onreadystatechange: function() {
if (this.status == 200 && this.readyState == 4) {
var a = $.el('html'); a.innerHTML = this.responseText; var b = $.tag('body', a);
CFBS.page = b[0].getAttribute('data-tkn'); //cs_grad.png
}
},
onerror: function() {
console.log("error fetching rqd");
}
}, null, true);
};

CFBS.clearReport = function(pid) {
var scan = setInterval(function() {
$.id(`cfbs-reported-${pid}-txt`).innerHTML += ".";
if ($.id(`cfbs-reported-${pid}-txt`).innerHTML.length > 4) {
$.id(`cfbs-reported-${pid}-txt`).innerHTML = "";
}
}, 150);

$.xhr("POST", `https://reports.4chan.org?action=clear_report`, {
onreadystatechange: function() {
if (this.status == 200 && this.readyState == 4) {
clearInterval(scan);
try {
var res = JSON.parse(this.responseText);
} catch(e) {
console.log("error" + e);
}
if (res.status == "success") {
if (window.Config.markReportedPosts) {
$.id(`cfbs-reported-${pid}-txt`).innerHTML = "Cleared";
$.id(`cfbs-reported-${pid}-txt`).style.color = "green";
$.id(`cfbs-reported-button-${pid}`).parentNode.removeChild($.id(`cfbs-reported-button-${pid}`));
}
} else {
$.id(`cfbs-reported-${pid}-txt`).innerHTML = (res.message || "Unknown error");
console.log(this.responseText);
}
}
},
onerror: function() {
clearInterval(scan);
$.id(`cfbs-reported-${pid}-txt`).innerHTML = "Clear failed";
}
}, {
"_tkn": CFBS.page,
"board": CFBS.board,
"no": pid
}, true);
};

CFBS.getStyle = function() { //this looks familiar hmmmm :thinking:
var i, a, link, sheet;

for (i = 0;
(a = document.getElementsByTagName("link")[i]); i++) {
if (a.getAttribute("title") == "switch") {
link = a;
} else if (a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title") && a.href == link.href) {
sheet = a.getAttribute("title");
}
}

switch(sheet) {
case "Tomorrow": sheet = "tomorrow"; break;
case "Photon": sheet = "photon"; break;
case "Yotsuba B New": //pass through
case "Burichan New": sheet = "burichan"; break;
case "Yotsuba New": //pass through
case "Futaba New": sheet = "futaba"; break;
default: sheet = (window.style_group == "ws_style") ? "burichan" : "futaba"; break;
}
CFBS.style = sheet;
};

CFBS.onClick = function(e) {
var t = e.target;
switch(t.getAttribute("data-cmd")) {
case "post-menu":
CFBS.updatePostMenu();
break;
case "cfbs-clear-report":
CFBS.clearReport(t.getAttribute("data-id"));
CFBS.removeReportBorder(t.getAttribute("data-id"));
CFBS.removeFromJumper(t.getAttribute("data-id"));
break;
case "cfbs-reply-chain":
CFBS.openReplyChain(t.getAttribute("data-id"));
break;
case "cfbs-close-replychain":
CFBS.closeReplyChain();
break;
case "cfbs-delete-chain":
CFBS.deleteFromChain();
break;
case "cfbs-jumper":
CFBS.runReportJumper();
break;
case "open-banreq-prompt":
case "ban":
$.id("banReq").style.zIndex = "10001";
break;
case "delete-post":
case "delete-image":
CFBS.removeFromJumper(t.getAttribute("data-id"));
break;
default: break;
}
};

var $={id:function(e){return document.getElementById(e)},cls:function(e,n){return(n||document).getElementsByClassName(e)},byName:function(e){return document.getElementsByName(e)},tag:function(e,n){return(n||document).getElementsByTagName(e)},el:function(e){return document.createElement(e)},qs:function(e,n){return(n||document).querySelector(e)},qsa:function(e,n){return(n||document).querySelectorAll(e)},extend:function(e,n){for(var t in n)e[t]=n[t]},parentByCls:function(e,n){for(var t=$.docEl,o=e;e!==t&&!$.hasClass(e,n);)e=e.parentNode;return o!==e?e:null}};document.documentElement.classList?($.hasClass=function(e,n){return e.classList.contains(n)},$.addClass=function(e,n){e.classList.add(n)},$.removeClass=function(e,n){e.classList.remove(n)}):($.hasClass=function(e,n){return-1!=(" "+e.className+" ").indexOf(" "+n+" ")},$.addClass=function(e,n){e.className=""===e.className?n:e.className+" "+n},$.removeClass=function(e,n){e.className=(" "+e.className+" ").replace(" "+n+" ","")}),$.on=function(e,n,t){e.addEventListener(n,t,!1)},$.off=function(e,n,t){e.removeEventListener(n,t,!1)},$.xhr=function(e,n,t,o,r){var a,u,s;if((u=new XMLHttpRequest).open(e,n,!0),t)for(a in t)u[a]=t[a];if(o)if("string"==typeof o)u.setRequestHeader("Content-type","application/x-www-form-urlencoded");else{for(a in s=new FormData,o)s.append(a,o[a]);o=s}else o=null;return u.withCredentials=r||0,u.send(o),u},$.getItem=function(e){return localStorage.getItem(e)},$.setItem=function(e,n){return localStorage.setItem(e,n)},$.removeItem=function(e){return localStorage.removeItem(e)},$.getCookie=function(e){var n,t,o,r;for(r=e+"=",o=document.cookie.split(";"),n=0;t=o[n];++n){for(;" "==t.charAt(0);)t=t.substring(1,t.length);if(0===t.indexOf(r))return decodeURIComponent(t.substring(r.length,t.length))}return null},$.getToken=function(){return document.body.getAttribute("data-tkn")},$.ago=function(e){var n,t,o,r;return(n=Date.now()/1e3-e)<1?"moments ago":n<60?(0|n)+" seconds ago":n<3600?(t=0|n/60)>1?t+" minutes ago":"one minute ago":n<86400?(o=(t=0|n/3600)>1?t+" hours":"one hour",(r=0|n/60-60*t)>1&&(o+=" and "+r+" minutes"),o+" ago"):(o=(t=0|n/86400)>1?t+" days":"one day",(r=0|n/3600-24*t)>1&&(o+=" and "+r+" hours"),o+" ago")},$.pluralise=function(e,n,t){return 1===e?n||"":t||"s"},$.now=function(){return Math.round((new Date).getTime()/1e3)},$.dispatch=function(e,n){var t=document.createEvent("Event");t.initEvent(e,!1,!1),document.dispatchEvent(t)},$.docEl=document.documentElement;

if (/catalog/.test(window.location.href)) {
return; //Don't run on the catalog
}

CFBS.board = window.location.href.split("/")[3];
CFBS.domain = (/4channel/.test(window.location.href)) ? "4channel" : "4chan";
CFBS.jumperIndex = 0;
CFBS.jumperArray = [];

CFBS.getStyle(); //twice on purpose

/*run dispatch for toolbox setup as soon was the admin toolbox loads*/
var scan = setInterval(function() {
if ($.id("adminToolbox")) {
clearInterval(scan);
$.dispatch("CFBSRunToolbox");
}
}, 50);

$.on(document, "DOMContentLoaded", function() {
CFBS.fetchReports();
CFBS.getStyle();
});

$.on(document, "CFBSRunToolbox", CFBS.setupToolbox);
$.on(document, "CFBSReportsRetrieved", CFBS.parsePage);
$.on(document, "CFBSFetchQueueData", CFBS.fetchQueueData);
$.on(document, "PostsInserted", CFBS.init4chX);
$.on(document, "ThreadUpdate", CFBS.init4chX);
setTimeout(CFBS.updateListeners, 5000);
setTimeout(CFBS.init4chX, 300);
})();
>>
// ==UserScript==
// @name Catalog - Hotpocket Helper
// @version 6.5
// @author (cyg && fsn) == bffs 5 evr
// @match https://boards.4chan.org/*/catalog
// @match https://boards.4channel.org/*/catalog
// @grant none
// @run-at document-start
// ==/UserScript==

(function() {
'use strict';

var CFCT = {};

CFCT.refresh = function() {
CFCT.fetchReports();
};

//Toolbox loaded, add the stuff
CFCT.setupToolbox = function() {
var toolbox = $.id("adminToolbox");
var h4 = $.el("h4");
toolbox.insertBefore(h4, toolbox.childNodes[2]);

var el = $.el("a");
el.href = `http://reports.4chan.org/#/${CFCT.board}`;
el.target = "_blank";
el.setAttribute("data-tip", `Open /${CFCT.board}/ queue`);
el.innerHTML = `/${CFCT.board}/ Reports`;
h4.appendChild(el);

el = $.el("span");
el.innerHTML = `: <span data-tip="Reports in queue" id="cfct-queue-count">?</span>`;
el.innerHTML += ` (<a data-cmd="cfct-repfilter" data-tip="Threads with reported posts" id="cfct-thread-count">?</a>)`;
h4.appendChild(el);
};

//Use stats stored in CFCT to update toolbox
CFCT.updateToolbox = function() {
var scan = setInterval(function() {
if ($.id("cfct-queue-count") && $.id("cfct-thread-count")) {
clearInterval(scan);
if (CFCT.reportCount) $.id("cfct-queue-count").innerHTML = CFCT.reportCount;
else $.id("cfct-queue-count").innerHTML = 0;
$.id("cfct-thread-count").innerHTML = CFCT.threadCount;
}
}, 50);
};

CFCT.updateListeners = function() {
$.on(document, "4chanATUpdated", CFCT.refresh);
};

//Add HPH filter buttons to the catalog tools
CFCT.setupFilters = function() {
var spn = $.el("span");
spn.innerHTML = "[<a href='javascript:void(0);' data-cmd='cfct-repfilter' id='cfct-repfilter' >Show Reported</a>] ";
$.id("info").appendChild(spn);

spn = $.el("span");
spn.innerHTML = "[<a href='javascript:void(0);' data-cmd='cfct-newfilter' id='cfct-newfilter' >Show New</a>]";
$.id("info").appendChild(spn);
};

//Add the report indicators based on stats generated in CFCT.buildStats
CFCT.parsePage = function() {
$.id("cfct-repfilter").style = "";
$.id("cfct-newfilter").style = "";

var tmp = $.cls("cfct-parsed");//get all the previous parsed threads
var prevParse = [];
if (tmp[0]) {
for (var i = 0; i < tmp.length; i++) {
//push the post no of all the previous parsed threads into array
//used to check if the thread still has reports or not
prevParse.push(tmp[i].id.split("-")[1]);
}
}

for (var op in CFCT.threadCounts) {
tmp = prevParse.indexOf(op);//if op exists in prevParse, remove it.
if (tmp > -1) prevParse.splice(tmp, 1);//after we will only have post no's with no reports

if (!$.id(`meta-${op}`) || $.hasClass($.id(`thread-${op}`), "cfct-parsed")) {
tmp = $.id("alert-id-" + op);
if (tmp) {
tmp.innerHTML = "[" + CFCT.threadCounts[op] + $.pluralise(CFCT.threadCounts[op], " Report", " Reports");
if (CFCT.reportedOPs[op]) {
tmp.innerHTML += " / OP Reported";
}
tmp.innerHTML += "]";
}
continue;
}

$.addClass($.id(`thread-${op}`), "cfct-parsed")

var alert = $.el("div");
alert.id = "alert-id-" + op;
alert.className = "meta";
alert.style.color = "red";
alert.style.fontWeight = "700";
alert.innerHTML = "[";
alert.innerHTML += CFCT.threadCounts[op] + $.pluralise(CFCT.threadCounts[op], " Report", " Reports");
if (CFCT.reportedOPs[op]) {
alert.innerHTML += " / OP Reported";
}
alert.innerHTML += "]";
$.id(`thread-${op}`).insertBefore(alert, $.id(`meta-${op}`).nextSibling);
}

//loop through remaining post no's and remove the cfct-parsed
//and remove the red alert indicator
for (i = 0; i < prevParse.length; i++) {
tmp = $.id("thread-" + prevParse[i]);
if (tmp && $.hasClass(tmp, "cfct-parsed")) {
$.removeClass(tmp, "cfct-parsed");
tmp = $.id("alert-id-" + prevParse[i]);
tmp.parentNode.removeChild(tmp);
}
}
};

//Parse the report queue xhr response and generate thread report statistics
CFCT.buildStats = function() {
var report, reports = CFCT.xhr.data.reports;
var threadCounts = {};
var reportedOPs = {};
CFCT.threadCount = 0;
CFCT.reportCount = CFCT.xhr.data.counts[CFCT.board];

for (var i = 0; (report = reports[i]); ++i) {
try {
var post = JSON.parse(report.post);
} catch(e) {
console.log(`error parsing post ${report.no}`);
console.log(e);
}

var parent = (post.resto == 0) ? post.no : post.resto;
if (post.resto == 0) {
reportedOPs[post.no] = 1;
}
if (!threadCounts[parent]) {
threadCounts[parent] = 1;
CFCT.threadCount++;
} else {
threadCounts[parent]++;
}
}

CFCT.threadCounts = threadCounts;
CFCT.reportedOPs = reportedOPs;

var scan = setInterval(function() {
if ($.cls("thread").length > 0) {
clearInterval(scan);
$.dispatch("CFTCReportsParsed");
CFCT.updateToolbox();
CFCT.monitor = new MutationObserver(CFCT.parsePage);
CFCT.monitor.observe($.id("threads"), {childList:true});
}
}, 50);
};

//XHR request retrieves list of reports.
CFCT.fetchReports = function() {
$.xhr("GET", `https://reports.4chan.org/?action=get_reports&board=${CFCT.board}`, {
onreadystatechange: function() {
if (this.status == 200 && this.readyState == 4) {
try {
var dat = JSON.parse(this.responseText);
} catch (e) {
console.log("error parsing reports");
console.log(e);
}
if (dat.status != "success") {
console.log("error parsing reports or you don't have this board.");
return;
}
CFCT.xhr = dat;
CFCT.buildStats(); //Sort out everything....
}
},
onerror: function() {
console.log("error fetching reports or you don't have this board.");
}
}, null, true);
};

//Toggle filter threads with reports
CFCT.filterReported = function() {
var bfw, op, ops = $.cls("thread"), button = $.id("cfct-repfilter");
//hold on to yuor butts
button.style.fontWeight = (button.style.fontWeight == 700) ? 500 : 700;
bfw = button.style.fontWeight;

for (var i = 0; (op = ops[i]); ++i) {
if (bfw == 700) { //filter turn on
button.style.color = "red";
if (!$.hasClass(op, "cfct-parsed")) {
op.style.display = "none";
}
} else { //filter turn off
op.style.display = "";
button.style.color = "";
}
}
};

//Toggle displaying threads made since timestamp CFCT.prevTime
CFCT.filterNew = function() {
if (!CFCT.prevTime) return;
var bfw, button = $.id("cfct-newfilter");
//hold on to yuor butts pt 2
button.style.fontWeight = (button.style.fontWeight == 700) ? 500 : 700;
bfw = button.style.fontWeight;

if (bfw == 700) {
button.style.color = "red";
for (var no in window.catalog.threads) {
var thread = window.catalog.threads[no];
if (thread.date < CFCT.prevTime) {
if ($.id(`thread-${no}`)) {
$.id(`thread-${no}`).style.display = "none";
}
}
}
} else {
button.style.color = "";
var op, ops = $.cls("thread");
for (var i = 0; (op = ops[i]); ++i) {
op.style.display = "";
}
}
};

CFCT.onClick = function(e) {
var t = e.target;
switch(t.getAttribute("data-cmd")) {
case "cfct-repfilter":
CFCT.filterReported();
break;
case "cfct-newfilter":
CFCT.filterNew();
break;
default: break;
}
};

CFCT.getStyle = function() { //this looks familiar hmmmm :thinking:
var i, a, link, sheet;

for (i = 0;
(a = document.getElementsByTagName("link")[i]); i++) {
if (a.getAttribute("title") == "switch") {
link = a;
} else if (a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title") && a.href == link.href) {
sheet = a.getAttribute("title");
}
}

switch(sheet) {
case "Tomorrow": sheet = "tomorrow"; break;
case "Photon": sheet = "photon"; break;
case "Yotsuba B New": //pass through
case "Burichan New": sheet = "burichan"; break;
case "Yotsuba New": //pass through
case "Futaba New": sheet = "futaba"; break;
default: sheet = (window.style_group == "ws_style") ? "burichan" : "futaba"; break;
}
CFCT.style = sheet;
};

if($)$.remByID=function(e){var n=$.id(e);n&&n.parentNode.removeChild(n)};else{var $={id:function(e){return document.getElementById(e)},remByID:function(e){var n=$.id(e);n&&n.parentNode.removeChild(n)},cls:function(e,n){return(n||document).getElementsByClassName(e)},byName:function(e){return document.getElementsByName(e)},tag:function(e,n){return(n||document).getElementsByTagName(e)},el:function(e){return document.createElement(e)},el2:function(e,n,t,i){var o,r;o=$.el(e);for(r in t)o.setAttribute(r,t[r]);return i&&(o.innerHTML=i),n.appendChild(o)},frag:function(){return document.createDocumentFragment()},qs:function(e,n){return(n||document).querySelector(e)},qsa:function(e,n){return(n||document).querySelectorAll(e)},extend:function(e,n){for(var t in n)e[t]=n[t]}};document.documentElement.classList?($.hasClass=function(e,n){return e.classList.contains(n)},$.addClass=function(e,n){e.classList.add(n)},$.removeClass=function(e,n){e.classList.remove(n)}):($.hasClass=function(e,n){return-1!=(" "+e.className+" ").indexOf(" "+n+" ")},$.addClass=function(e,n){e.className=""===e.className?n:e.className+" "+n},$.removeClass=function(e,n){e.className=(" "+e.className+" ").replace(" "+n+" ","")}),$.on=function(e,n,t){e.addEventListener(n,t,!1)},$.dispatch=function(e,n){var t=document.createEvent("Event");t.initEvent(e,!1,!1),document.dispatchEvent(t)},$.off=function(e,n,t){e.removeEventListener(n,t,!1)},$.xhr=function(e,n,t,i,o,r){var s,c,a;if(o=!!o||0,(c=new XMLHttpRequest).open(e,n,!0),t)for(s in t)c[s]=t[s];if(i)if("string"==typeof i)c.setRequestHeader("Content-type","application/x-www-form-urlencoded");else{a=new FormData;for(s in i)a.append(s,i[s]);console.log(r),console.log(a),i=a}else i=null;return o&&(c.withCredentials=!0),c.send(i),c},$.getItem=function(e){return localStorage.getItem(e)},$.setItem=function(e,n){return localStorage.setItem(e,n)},$.removeItem=function(e){return localStorage.removeItem(e)},$.getCookie=function(e){var n,t,i,o;for(o=e+"=",i=document.cookie.split(";"),n=0;t=i[n];++n){for(;" "==t.charAt(0);)t=t.substring(1,t.length);if(0===t.indexOf(o))return decodeURIComponent(t.substring(o.length,t.length))}return null},$.toggleXls=function(e,n){$.hasClass(e,n)?$.removeClass(e,n):$.addClass(e,n)},$.getToken=function(){return document.body.getAttribute("data-tkn")},$.capitalise=function(e){return e.charAt(0).toUpperCase()+e.slice(1)},$.pluralise=function(e,n,t){return 1===e?n||"":t||"s"},$.prettyBytes=function(e){return e>=1048576?(0|e/1048576*100+.5)/100+" MB":e>1024?(0|e/1024+.5)+" KB":e+" B"},$.ago=function(e){var n,t,i,o;return(n=Date.now()/1e3-e)<1?"recent":60>n?(0|n)+" secs":3600>n?(t=0|n/60)>1?t+" mins":"1 min":86400>n?(i=(t=0|n/3600)>1?t+"":"1",i+="."+(o=0|n/60-60*t)+" hrs"):(i=(t=0|n/86400)>1?t+"":"1",(o=0|n/3600-24*t)>=1&&(i+="."+o+" days"),i+"")},$.now=function(){return Math.round((new Date).getTime()/1e3)},$.length=function(e){return Object.keys(e).length},$.hidden="hidden",$.visibilitychange="visibilitychange",void 0===document.hidden&&("mozHidden"in document?($.hidden="mozHidden",$.visibilitychange="mozvisibilitychange"):"webkitHidden"in document?($.hidden="webkitHidden",$.visibilitychange="webkitvisibilitychange"):"msHidden"in document&&($.hidden="msHidden",$.visibilitychange="msvisibilitychange")),$.docEl=document.documentElement}

CFCT.board = window.location.href.split("/")[3];
CFCT.domain = (/4channel/.test(window.location.href)) ? "4channel" : "4chan";
CFCT.prevTime = $.getItem(`cfct-refresh-time-${CFCT.board}`);
$.setItem(`cfct-refresh-time-${CFCT.board}`, $.now());

CFCT.fetchReports();
CFCT.getStyle(); //twice on purpose

//$.on(document, "DOMContentLoaded", CFCT.setupFilters);
$.on(document, "CFTCReportsParsed", CFCT.parsePage);
setTimeout(CFCT.updateListeners, 5000);
$.on(document, "click", CFCT.onClick);

var filterscan = setInterval(function() {
if ($.id("info")) {
clearInterval(filterscan);
CFCT.setupFilters();
}
}, 50);

var toolscan = setInterval(function() {
if ($.id("adminToolbox")) {
clearInterval(toolscan);
CFCT.setupToolbox();
}
}, 50);
})();
>>
Hi, here is version 6.5

This is not an update to HPH, just placing it in the thread so you guys don't have to message me and wait days or weeks for me to respond

For those who are new or are updating from an older version of HPH, download Tampermonkey
See: >>7110

Once you have installed Tampermonkey, click the icon and select "Dashboard". Then click the "+" icon in the top left to create a new userscript, and copy paste ONE of the three scripts into it and save. Repeat for each of the three scripts.

The three scripts:
>>9683 Reports
>>9684 Boards
>>9685 Catalog

After you have successfully installed Tampermonkey and the three HPH scripts, you're ready to go.
Do note that some options of HPH are configurable on or off. So after you've installed, open up the 4chan settings panel. eg visit >>>/b/ (NOT the catalog) and click "Settings" and then expand the "HotPocketHelper" section to enable or disable features.
>>
>>7919
>>7920

And lastly, here again is the HPH feature list.
>>
ok but where are my hotpockets
>>
no pic no click
>>
File: i kneel.png (36 KB, 475x502)
36 KB
36 KB PNG
>>9623
>the madman actually did it
I fucking kneel.
>>
>>9700
about time
caused more problems than solved
>>
sometimes the group by thread button doesnt work and i have to reopen firefox or something
FIX IT
>>
>>9718
oh it's broken for me all the time.
firefox, 4chanX, not running any adblock stuff on 4chan domains.
>>
Is there a reason this shit isn't just built in? I feel bad for all the jannies that don't know about these scripts
>>
>>9725
thread grouping is kinda antithetical to how the queue was designed. the code also isn't very polished so it'd take a bit of effort to slam into the native systems... perchance.
>>
>>9726
I like thread grouping because I'll see an obviously off-topic thread and go to BR it and then a bunch of other posts in the queue go gray because oops those were replies that may have needed attention too. it makes it easier to go through the replies first and then the thread
>>
bump so i don't have to leave the first page to find this again
>>
>>10046
pin it. i dare you.
>>
>>9837
on the other hand it introduces an unintentional bias where threads getting 9001 reports (that aren't all necessarily high priority) draw attention away from singular reports that might have worse content that could use a quicker response. I mean, if you're someone who can sweep dozens of reports in one fell swoop then it might be fine but I'm not quite there yet.
>>
>>10048
thread grouping does undermine the weighting system, but then the weighting system isn't always fullproof either since stuff like bare titties on a blue board regularly can fall below a rule abiding thread slapfight
>>
>>9688
have you tried looking... UP UR BUM?!?!? lol
>>
File: IMG_0039.jpg (58 KB, 976x850)
58 KB
58 KB JPG
>>10053
It wasn't there.
>>
File: images(1).jpg (4 KB, 225x225)
4 KB
4 KB JPG
>>10058
>>
has anyone had experience using the more recent versions of hotpockethelper with greasemonkey rather than tampermonkey? i've switched from firefox to pale moon, which i think only really supports greasemonkey.
>>
>>10108
I've tried using greasemonkey and it didn't work for me. I think some minor adjustments might fix it >though
>>
File: Bomb Squad Prank.jpg (57 KB, 751x600)
57 KB
57 KB JPG
>>10109
fuck it, i just went back to firefox in the end.
>>
>>10108
>Male Poon
literally why?
>>
>>10111
a bit sick of mozilla pushing their agenda, was looking at librefox, palemoon, etc as an alternative
>>
>>10123
lol
>>
File: 1728942926171367.jpg (503 KB, 750x742)
503 KB
503 KB JPG
Did the Reports Hotpockethelper suddenly break on Chrome / Tapermonkey for someone else as well? Other scripts are working fine.
>>
>>10256
>Chrome
when will you people learn?
>>
>>10256
>not using male poon
ngmi bros
>>
>>10256
nvm turns out i was totally wrong and hph is perfect in every way and now im a mod
>>
>>10269
congrats!
>>
>>10269
I'm sorry for your loss.
>>
HPH has been broken in Firefox on the report queue for some time now. I get these errors:
> TypeError: window.Config is undefined
> TypeError: window.RQ is undefined
looks like it's getting run before the page is fully loaded? any fix for this?
>>
>>10272
There was a change on the 4chan side that causes something to load later than it use to. I can add a fix sometime tomorrow probably.
>>
>>10272
works on my machine
you using standard branch of FF?
>>
>>10275
yes
>>
This is not a HPH issue (I have disabled HPH and checked, it still happens) but this is a thread that the webdevs might see. I'll DM the devmods as well and link to this.

Since the downtime yesterday, if I open a thread view in the queue and then mouse over a quote reply link, the quote reply appears behind the thread view popup, instead of in front of it. Here's an example where you can see the quoted post sticking out to the side.

on firefox, in case it matters
>>
>>10274
is it tomorrow yet
>>
>>10290
soon....
>>
>>10269
>this is the quality of mods we're getting now
baka
>>
>>10301
soft mods make hard times/
hard times make hard mods
hard mods bang ur mum often
>>
>>10303
lol
>>
>>10304
Don't pity laugh at that, it wasn't funny and he probably spent all day thinking of that """joke"""
>>
File: ochsterminate.jpg (53 KB, 400x317)
53 KB
53 KB JPG
>>10305
what do you mean "pity laugh" it's funny
dad jokes and ur mum jokes are the pinnacle of humor and you will not convince me otherwise
>>
File: 1722406598061150.gif (400 KB, 480x238)
400 KB
400 KB GIF
>>10311
This. If you can't laugh at that or at poop jokes, you have no soul and we cannot be friends.
>>
File: Untitled-1.png (3 KB, 661x33)
3 KB
3 KB PNG
i'm curious, would it be possible to have/make something where it tells you on the post if there's a pending BR on the poster? something like picrel mockup. it would make me accidentally stack BRs in a problematic thread less. i know nothing about javascript so i have no idea if this is something that would even work.
>>
>>10327
I'm guessing it's not possible because when you go to BR a post *that's* when it checks if the user has a pending BR
I think it is done the current way to prevent janitor abuse
for example, it would be possible for a janitor to "mark" a poster with a WR and have every post of that anon show up on their board, it would be a form of IP tracking which is a power janitors aren't really meant to have
>>
>>10327
>>10328
Yeah, I think as much as it might be nice/convenient to have such a feature it's not like it's that difficult to see on actual problematic posts when opening the BR window anyway. If anything rather than in threads I think it might be a better compromise to just do this for the report queue where it's more of a possibility someone accidentally stacks a ton of BRs if they use the quick BR function without checking.
>>
>>10329
if it shows up in the report queue, it could be made to show up in threads as well, via a Dark Side HPH.

Quick BRs will lead to some amount of BR stacking by their existence, and I assume that was known and accounted for when they were added, or that they'd have been removed if they wasted more time than they save.
>>
>>10329
honestly i'd think it'd be nice to have when one dude tries to astroturf 300 posts and troll a thread, but mods can usually handle those on their own
>>
File: 1723015874415314.jpg (43 KB, 675x676)
43 KB
43 KB JPG
>>10256
Managed to fix this. Turns out I needed to turn on "Developed Mode" from Chrome's "Extensions -> Manage Extensions" to enable "script injection" or some shit.
>>
>>10375
congratulations on enabling developer mode! you've started your journey on programming and software development. a complimentary pair of programmer socks will be sent to the address on file for you.
>>
>>10375
>opened up developer mode
put on the socks. NOW.
>>
>>10376
>>10377
He said Developed Mode not developer mode, that's something else
>>
>>10379
No I'm just retarded, it's Developer Mode. It was a typo on my end
>>
>>10380
SOCKS. NOW
>>
>>10274
>>10291
please mod-sama, I had grouped reports for a few refreshes and then it went away. imagine seeing in black and white all your life and then you get three glorious minutes of in-color viewing and you're back to black-and-white. would you ever be able live your life the same way again? I wouldn't. I wouldn't......
>>
>>10386
I did go to do it back then, but after looking into it, the reason it broke was related to browsers changing, or maybe tampermonkey itself. I'm unsure. An actual webdev could probably answer that.

I could probably do it with some alternative approach, but I have just not yet got around to it.



Delete Post: [File Only]
[Disable Mobile View / Use Desktop Site]

[Enable Mobile View / Use Mobile Site]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.