Rhaedas,
Rhaedas avatar

New request - currently when there's an update I redo a minor change I've been making for the size and location of the window. Maybe that can be added in as a preference? I've been changing the translateX percent number and adding in a width percentage at the end of the iframe CSS line. A huge change would be to make it resizable with the mouse and remember, but I don't know how hard that is.

blobcat,
blobcat avatar

The userscript is going to be a part of KES with the release of 2.0.0, definitely going to keep it in mind for the future (you can probably as well create an issue with adding the preference)

Ori,

@blobcat
I love this - definitely something that should be in native kbin, albeit supported natively without a frame. I do have a couple notes.

The first is that I noticed you match multiple instances - which is great! However, you've hard-coded the notification path for kbin.social. To fix this, I've change the following:

// Line 60 in the original script. Change the following:
iframe.src = 'https://kbin.social/settings/notifications';
// To this:
iframe.src = 'https://' + window.location.hostname + '/settings/notifications';

The second is more a note for any instance admins who would like to support this...
The default config for kbin, at least the bare metal (I haven't dug into the docker setup at all), is to set add_header X-Frame-Options DENY; in nginx. First is that X-Frame-Options is obsolete anyway, and the second is that the frame won't work with DENY being the setting.
More reading: X-Frame-Options | MDN
More reading: Content-Security-Policy | MDN

Below are the steps you should take to enable functionality for this and to update away from X-Frame-Options:

# I'm assuming you followed either the current or the soon-to-be bare-metal configuration.
# First, login to your instance as a user with sudo.
sudo nano /etc/nginx/sites-available/kbin.conf

# Locate the following line near the bottom: add_header X-Frame-Options DENY;
# Comment it out by adding a # in front. Create a new line under it and enter the following (replace domain.tld with your domain):
add_header Content-Security-Policy "from-ancestors 'self' https://domain.tld https://www.domain.tld";
# Save and exit, <CTRL>+x, y, <ENTER>

# Restart nginx
sudo systemctl restart nginx

blobcat,
blobcat avatar

Oh, embarrassing, I completely missed it! Fixed it now, thank you!

Rhaedas,
Rhaedas avatar

Just had to come back after a few days and say that once I got this working and added the other script that highlights the reply in the thread, it made reading notifications so much easier.

blobcat,
blobcat avatar

I'm glad! I just released a small update that automatically closes the panel if you click outside of it, so it's also easier to close now (ノ´ヮ´)ノ

Rhaedas,
Rhaedas avatar

Seems it broke for me. Inspection shows an error "DOMException: Document.querySelector: '.dropdown:has(.login)' is not a valid selector"

blobcat,
blobcat avatar

Are you possibly on Firefox? The userscript now requires the :has() selector which is disabled behind a flag on Firefox. you can enable it by opening about:config in a new tab, searching for layout.css.has-selector.enabled and setting it to true

Rhaedas,
Rhaedas avatar

That did it. Weird that the first refresh had both the old indicator and the bell showing, but now it's back to normal again. I guess there's no way to indicate to FF users what needs to be toggled, is there?

blobcat,
blobcat avatar

It's on the greasyfork page, but I will probably add a warning that shows up if the userscript detects you don't have it enabled in a future update

Rhaedas,
Rhaedas avatar

Definitely if you can detect it, have it break gracefully and let the user know. Wasn't sure if that was possible or not. I can't fault FF for locking some things down a bit.

blobcat,
blobcat avatar

Yeah, I will definitely do it the first thing in the morning! It's too late for me to do that now

minnieo,
minnieo avatar

Very nice! looks great

artillect,
artillect avatar

This is great, I never knew I needed something like this! One problem I noticed though is that if you have the top bar enabled (the one that shows the list of random magazines), it shows up in the top of the notifications panel.

blobcat,
blobcat avatar

Completely missed me because I never used it, it's now hidden in 0.2.4 (releasing 5 updates in an hour lmao)

artillect,
artillect avatar

Sweet, thanks for the quick fix!

releasing 5 updates in an hour lmao

Just say you're doing Agile development lmao

Alexmitter,
Alexmitter avatar

It seems it does not fully fit yet. Generally the menu could be styled more like the other drop down menus.

blobcat,
blobcat avatar

Yeah, while styling it I had my Kbin-it theme enabled, which is why it didn't fit unless you had my userstyle on, I fixed it with 0.2.1.
I will try to make it more like the other drop downs!

blobcat,
blobcat avatar

0.2.2 now looks closer to other drop downs and the iframe uses kbin's variables so it's more compatible with custom themes!

Alexmitter,
Alexmitter avatar

Ah yes that looks good. The one last issue I immediately saw was that it does not close when you clock outside of it. You have to click the button again to make it close. And I wonder if you can prevent it from showing the full kbin interface for a moment in the frame, that may make the interface quicker in general.

blobcat,
blobcat avatar

I didn't make it display when you hover out and in because it's a separate website displayed in a frame unlike other drop downs, it would be like opening and closing a new tab the entire time. I don't think I can stop it from showing the kbin interface for a second, it's a delay limit in userscripts.

Alexmitter,
Alexmitter avatar

I suspected that. I wonder if it would make more sense to not just display the notifications page in the frame and modify its appearance to fit the form but to build a completely new UI and connect it to the same server interface the notification page uses to fetch the notifications from the backend. But I suspect this would be A LOT more work and I am honestly completely happy with how it is now, considering its just a little patch.

blobcat,
blobcat avatar

Thank you! I'll just say that it takes less time if there's less notifications to load so purging them frequently is probably the best option if you don't want to see the full UI as often.

Alexmitter,
Alexmitter avatar

Oh there is one last thing I noticed, sometimes the button just redirects me to notifications instead of opening the pop up.

blobcat,
blobcat avatar

It's because you are clicking the notifications counter which still has a redirect to the page. I'll work on a fix, it's a bit tricky and not as quick to fix since a part of code depends on the redirect (css to make the counter display correctly).

Alexmitter,
Alexmitter avatar

Oh I did not notice that. Guess I have to aim better for now then :)

blobcat,
blobcat avatar

Spent some time working on it, 0.2.5 now fixes the redirect issue!

Alexmitter,
Alexmitter avatar

I can confirm that it works, thank you.

Rhaedas,
Rhaedas avatar

I can't seem to get it to work. Using Greasemonkey on Firefox/Windows. I've tried disabling all other scripts and styles to make sure there's not something conflicting. I don't see anything coming up like the demo picture. I've got one message currently unread to test it with.

blobcat,
blobcat avatar

Fixed with 0.2.1, please update!

blobcat,
blobcat avatar

Oh, I have no clue why that's happening, it works completely fine on my end

blobcat,
blobcat avatar

I found the culprit, I somehow messed up and the userscript won't work if you also don't have the subscriptions panel userscript on, i will find a fix and release an update asap

Rhaedas,
Rhaedas avatar

The culprit in my case was Greasemonkey. It's the second issue I've had with it and a Kbin script, and this one didn't seem fixable based on some Googling*, so I went ahead and moved all the scripts to Violentmonkey instead. Works now.

*the problem was the GM_addstyle, seems to be a depreciated/broken thing with Greasemonkey, and what hacks I found didn't seem to be worth pursuing.

Alexmitter,
Alexmitter avatar

This is just what I needed.

  • All
  • Subscribed
  • Moderated
  • Favorites
  • kbinStyles
  • kavyap
  • InstantRegret
  • tacticalgear
  • DreamBathrooms
  • mdbf
  • magazineikmin
  • thenastyranch
  • Youngstown
  • everett
  • slotface
  • khanakhh
  • osvaldo12
  • rosin
  • Durango
  • provamag3
  • vwfavf
  • cubers
  • modclub
  • ngwrru68w68
  • GTA5RPClips
  • cisconetworking
  • Leos
  • ethstaker
  • normalnudes
  • tester
  • anitta
  • megavids
  • JUstTest
  • All magazines