Danbooru

[Userscript] EventListener

Posted under General

Pushed Version of 15 which primarily adds wikis and pools as an event type. Like the post edits event type, pool events are limited to 200 items per page load due to the slowness of that endpoint.

The wiki event type has the ability to show the diff with the previous wiki version. It also adds paragraph markings to the diff to show when carriage returns are being added and where.

The pool event type has the ability to show the diff of the pool description if the pool description changes. It is formatted much like the wiki diff.

Finally, it adds the capability to mark all items as read in the event notice. This facilitates being able to open new tabs from the event notice without triggering the event notice popping up again in those pages.

Pushed Version 16 which primarily adds post thumbnail support on the pool event. A "Show pool" link is now shown to the left of the post IDs in the Changes column. Clicking this opens up the thumbnail display. Added posts are shown in the green section, and removed posts are shown in the red section.

There was also an issue fixed for pool description changes where they were overflowing outside the notice for long portions of continuous text. Now when this occurs it becomes a scrollable section.

Pushed Version 17 which has several additions, fixes, and changes. It also includes one-way transitory code, meaning that upgrading to this version should preserve the current settings for enabled events, whereas downgrading will lose those settings and revert to default enabled events.

  • Additions:
    • New event types
    • Newly separated event operations
      • Post query events
        • These events can be give a post query string for checking new events
        • For example, to subscribe to events for posts you upload, you would use user:USERNAME where USERNAME is your username.
        • A blank query line will return all events of that type
        • Available events - comments, notes, commentaries, approvals, flags, appeals
      • Subscribe events
        • These work the same as before
        • Post approvals have been added as a new type
          • These can also be auto-subscribed, i.e. they will automatically be subscribed to when visiting the post page for your own uploads
          • These can also be subscribed to using a post query with the available controls on the settings page
        • Available events - comments, notes, commentaries, post edits, approvals, forums, wikis, pools
      • Other events
        • With a few exceptions, these will generally return all occurring events
        • Bans can be filtered to remove all autobans
        • Feedback can be filtered to remove all autofeedback
        • Mod actions have 36 categories of events to subscribe to
        • Available events - dmails, spam, bans, user feedbacks, mod actions
  • Changes:
    • The event notice is now saved so that it loads faster on page reloads
      • Closing the notice or marking it as read will delete the saved notice
    • The script will only process if the tab is active on page load
    • The color scheme has been adjusted to adapt to using the different themes light/dark (from the settings page)
    • Increased the width of radio buttons on the settings page to fit all items
    • Clear the autocomplete values for the cache editor on the settings page when doing a factory reset
    • Several code changes and refactors
  • Fixes:
    • Comment subscription links were not rendering in some cases
    • Pool subscription links were doubling up in some cases
    • Showing the posts on pool events was not working in some cases
    • Only the first 100 items of any particular event type were being displayed
    • Only the first 100 thumbnails for notes/edits were being displayed

Pushed Version 18 which primarily includes an update to the library code plus a few additions and fixes:

  • Additions
    • Add new menu library elements/functions for cache editor
      • The raw program data can be extracted using the cache editor, which facilitates transferring program data to another browser/domain
  • Changes
    • Settings menu now adapts to the color changes of the chosen theme (light/dark)
  • Other
    • Removed transition code from 17.0
      • Some settings will be reset if upgrading from below 16.X- to 18.0+
    • Multiple internal code changes and refactors

This seems to have mostly stopped functioning:

  • There are no reports of any event
  • The bar with subscribe actions at the top of each post is missing
  • The subscribe link only appears for comments and forum topics. It does nothing, of course. (I usually have these disabled but it doesn't work on factory defaults anyway)

Firefox, btw.

DreamFromTheLayer said:

This seems to have mostly stopped functioning:

  • There are no reports of any event
  • The bar with subscribe actions at the top of each post is missing
  • The subscribe link only appears for comments and forum topics. It does nothing, of course. (I usually have these disabled but it doesn't work on factory defaults anyway)

Firefox, btw.

Which version of EventListener are you using? The latest version is 18.4.

DreamFromTheLayer said:

Yes, the latest version. The forum/comment event seems to work now, incidentally, but nothing else.

Chrome/Firefox are both working okay for me with the latest version. You can try opening the dev console (F12) to see if any errors are appearing, which might help me fix the bug. Also, you can try doing a factory reset from the settings page. That has worked for other members in the past.

BrokenEagle98 said:

Chrome/Firefox are both working okay for me with the latest version. You can try opening the dev console (F12) to see if any errors are appearing, which might help me fix the bug. Also, you can try doing a factory reset from the settings page. That has worked for other members in the past.

This is the error that appears when the userscript is active:

Source map error: Error: NetworkError when attempting to fetch resource.
Resource URL: moz-extension://d7154607-b7d8-4934-ad3b-f215732e8901/userscripts/EventListener.user.js?id=a5d7e4eb-f7f4-4a99-b593-c57505392740
Source Map URL: minified.js.map

I did try factory reset before, didn't help, but I'll try again.

DreamFromTheLayer said:

This is the error that appears when the userscript is active:

Source map error: Error: NetworkError when attempting to fetch resource.
Resource URL: moz-extension://d7154607-b7d8-4934-ad3b-f215732e8901/userscripts/EventListener.user.js?id=a5d7e4eb-f7f4-4a99-b593-c57505392740
Source Map URL: minified.js.map

I did try factory reset before, didn't help, but I'll try again.

That error sounds like it's coming from TamperMonkey and not from my script. The URL looks like what the extension uses to address the script when it loads it onto the page.

Try restarting TamperMonkey or doing a factory reset on it. Also try uninstalling and then reinstalling the script. If necessary, uninstall and reinstall Tampermonkey.

BrokenEagle98 said:

That error sounds like it's coming from TamperMonkey and not from my script. The URL looks like what the extension uses to address the script when it loads it onto the page.

Try restarting TamperMonkey or doing a factory reset on it. Also try uninstalling and then reinstalling the script. If necessary, uninstall and reinstall Tampermonkey.

Didn't work.

In the meantime, I have more errors from the console after looking harder and reloading pages:

Syntax error @ "EventListener"!
##########################
JSHINT output:
##########################

r</<@eval:2:491
c@eval:2:54
E_u@eval:3:150
ja@eval line 1 > Function:59:374
create@eval line 1 > Function:70:416
d@eval line 1 > Function:13:89
runListeners@eval line 1 > Function:13:52
anonymous/</</<@eval line 1 > Function:71:472
H@eval:10:70
eval line 1 > Function:60:340
ERROR: Execution of script 'EventListener' failed! matchAll must be called with a global RegExp EventListener.user.js:1:274
    <anonymous> moz-extension://5d9aef69-505d-4d02-a46c-b2acef05a81f/userscripts/EventListener.user.js?id=4ad8cf2d-d92a-4b6c-886b-8de63afcbbf1:1
    <anonymous> moz-extension://5d9aef69-505d-4d02-a46c-b2acef05a81f/userscripts/EventListener.user.js?id=4ad8cf2d-d92a-4b6c-886b-8de63afcbbf1:1
    <anonymous> moz-extension://5d9aef69-505d-4d02-a46c-b2acef05a81f/userscripts/EventListener.user.js?id=4ad8cf2d-d92a-4b6c-886b-8de63afcbbf1:11891
    <anonymous> moz-extension://5d9aef69-505d-4d02-a46c-b2acef05a81f/userscripts/EventListener.user.js?id=4ad8cf2d-d92a-4b6c-886b-8de63afcbbf1:11893
    r eval:2
    c eval:2
    E_u eval:3
    ja eval line 1 > Function:59
    create eval line 1 > Function:70
    d eval line 1 > Function:13
    runListeners eval line 1 > Function:13
    anonymous eval line 1 > Function:71
    H eval:10
ERROR: Execution of script 'EventListener' failed! matchAll must be called with a global RegExp EventListener.user.js:1:274
JSPLib.utility.findAll@moz-extension://5d9aef69-505d-4d02-a46c-b2acef05a81f/userscripts/EventListener.user.js?id=4ad8cf2d-d92a-4b6c-886b-8de63afcbbf1:6306:20
JSPLib.danbooru.getShowID@moz-extension://5d9aef69-505d-4d02-a46c-b2acef05a81f/userscripts/EventListener.user.js?id=4ad8cf2d-d92a-4b6c-886b-8de63afcbbf1:8223:80
Main@moz-extension://5d9aef69-505d-4d02-a46c-b2acef05a81f/userscripts/EventListener.user.js?id=4ad8cf2d-d92a-4b6c-886b-8de63afcbbf1:11722:33
JSPLib.load.programLoad@moz-extension://5d9aef69-505d-4d02-a46c-b2acef05a81f/userscripts/EventListener.user.js?id=4ad8cf2d-d92a-4b6c-886b-8de63afcbbf1:6124:5
JSPLib.load.programInitialize@moz-extension://5d9aef69-505d-4d02-a46c-b2acef05a81f/userscripts/EventListener.user.js?id=4ad8cf2d-d92a-4b6c-886b-8de63afcbbf1:6133:21
@moz-extension://5d9aef69-505d-4d02-a46c-b2acef05a81f/userscripts/EventListener.user.js?id=4ad8cf2d-d92a-4b6c-886b-8de63afcbbf1:11889:13
r</<@eval:2:491
@moz-extension://5d9aef69-505d-4d02-a46c-b2acef05a81f/userscripts/EventListener.user.js?id=4ad8cf2d-d92a-4b6c-886b-8de63afcbbf1:1:101
@moz-extension://5d9aef69-505d-4d02-a46c-b2acef05a81f/userscripts/EventListener.user.js?id=4ad8cf2d-d92a-4b6c-886b-8de63afcbbf1:1:476
@moz-extension://5d9aef69-505d-4d02-a46c-b2acef05a81f/userscripts/EventListener.user.js?id=4ad8cf2d-d92a-4b6c-886b-8de63afcbbf1:11891:6
@moz-extension://5d9aef69-505d-4d02-a46c-b2acef05a81f/userscripts/EventListener.user.js?id=4ad8cf2d-d92a-4b6c-886b-8de63afcbbf1:11893:3
r</<@eval:2:491
c@eval:2:54
E_u@eval:3:150
ja@eval line 1 > Function:59:374
create@eval line 1 > Function:70:416
d@eval line 1 > Function:13:89
runListeners@eval line 1 > Function:13:52
anonymous/</</<@eval line 1 > Function:71:472
H@eval:10:70

There was also an illegal character error that I didn't copy when I saw it.

DreamFromTheLayer said:

Didn't work.

In the meantime, I have more errors from the console after looking harder and reloading pages:

...

There was also an illegal character error that I didn't copy when I saw it.

I wasn't able to reproduce that error, even after updating to the latest version of Firefox (Ver. 72.02). Are you using a development branch version of Firefox or something? I recall that error being an issue with the Canary version of Chrome as well.

Anyways, I pushed a potential fix of version 18.5 onto the master branch.

https://raw.githubusercontent.com/BrokenEagle/JavaScripts/master/eventlistener.user.js

It fixes that matchAll error by removing the code that requires it.

Let me know if that works, or if there are still bugs after updating it.

BrokenEagle98 said:

I wasn't able to reproduce that error, even after updating to the latest version of Firefox (Ver. 72.02). Are you using a development branch version of Firefox or something? I recall that error being an issue with the Canary version of Chrome as well.

Anyways, I pushed a potential fix of version 18.5 onto the master branch.

https://raw.githubusercontent.com/BrokenEagle/JavaScripts/master/eventlistener.user.js

It fixes that matchAll error by removing the code that requires it.

Let me know if that works, or if there are still bugs after updating it.

I was in fact using dev edition, but normal Firefox gave similar errors.

Anyway, it seems to be working for now? The subscription links and such are back and the event notification box shows up, even though the same error still shows up in the console. (the map error, which might be a Firefox bug: https://developer.mozilla.org/en-US/docs/Tools/Debugger/Source_map_errors)

I'm not sure if it was the update or not, but thanks.

Forum topic subscription seems to be glitching out. I subscribed to this topic 15 days ago but didn't receive any notification about the responses that were made to it, only realizing that anything had happened when the bot posted a notice about the request being rejected.

nonamethanks said:

After the latest site update, the edits table appears extremely small for post edits notifications. That's because of the following rule:

table.autofit .col-expand {
    width: 100%;
}

Removing it fixes the width.

Thanks for the suggestion. I pushed a fix using something similar with Version 18.13

MarqFJA87 said:

Forum topic subscription seems to be glitching out. I subscribed to this topic 15 days ago but didn't receive any notification about the responses that were made to it, only realizing that anything had happened when the bot posted a notice about the request being rejected.

Well, considering I didn't get your notice in this topic either, that seems to be the case. This will take a while longer to track down though as it doesn't seem to happen consistently. I'll start working on adding a lot more logging code to see if I hone in on the cause.

BrokenEagle98 said:

Well, considering I didn't get your notice in this topic either, that seems to be the case. This will take a while longer to track down though as it doesn't seem to happen consistently. I'll start working on adding a lot more logging code to see if I hone in on the cause.

FWIW, ever since I received the notification from a couple of days ago, the plugin seemed to work fine again in this regard.

Pushed Version 19 which has several additions and fixes:

  • Additions
    • Post-query type events
      • Post edits (some limitations apply)
    • Subscription type events
      • Flags
      • Appeals
    • Events on uploads/topics created by user can be subscribed to
    • Post edits can be filtered by added/removed tags
    • List/refresh functions added to cache editor
  • Changes
    • Double the amount of post edits retrieved on every page load
    • Remove upload records from post edits retrieved
  • Fixes
    • Prevent duplicate events from being rendered in the event notice
    • Prevent disabled events on multi-subscription links from being processed
    • Several CSS fixes in the event notice and settings menu
  • Other
    • Multiple internal code changes and refactors

Pushed Version 20 which has several additions and fixes:

  • Additions
    • Post edits done by BURs can be filtered
    • Added overflow controls
      • This allows the user to query for some more or all events
      • There is a countdown counter that notifies the user of the current position
  • Changes
    • Remove notice controls until all events have finished loading
      • During this time, it displays "Loading..." instead
    • Changed the post events limit back to 200, since they were too slow in loading
    • Disable the reload control if the read control is activated
  • Fixes
    • Fix column spacing when multiple tables of the same type get inserted
      • Beforehand, a secondary tables loaded would have messed up spacing
      • This is because the header for a second table is hidden, which the spacing relies on
    • Fix commentary events not being shown unless translated filtering was turned off
    • Fixes the events sometimes not appearing in the right order
  • Other
    • Multiple internal code changes and refactors
1 2 3 4