Simon-Tesla / RaccoonyWebEx

A WebExtension that adds shiny features to art sites
MIT License
45 stars 4 forks source link

Open journals in tabs #10

Open Simon-Tesla opened 6 years ago

Simon-Tesla commented 6 years ago

From Eupeptic: Make Raccoony detect pages that have a list of journals, and offer to open the journal entries in tabs.

I don't think this should operate when you're looking at the journal list for one artist. It should only happen when you're looking at the "all new journals since I last logged in / cleared notifications" page.

Motivation: I follow enough critters on FA that some days I log in and there are 6 or 7 journal entries. I usually right-click each one and open it in a new tab. It Would Be Nice [tm] to automate that function. (First world problems! :) )

Some notes on implementation:

FA: I think the journal list always appears at https://www.furaffinity.net/msg/others/#journals . Each individual journal appears in an <li>. It might be possible to key off of the <input> tag, or possibly the "/journal/[nnnn]" in the <a> tag. Example:

<li>
  <input type="checkbox" name="journals[]" value="8706878">
    "<a href="/journal/8706878/">Windows 10 key ? </a>",
    posted by <a href="/user/taluthus/">Taluthus</a>
    <span title="on Apr 23rd, 2018 11:15 PM" class="popup_date">3 hours ago</span>
</li>

Weasyl: I think the journal list always appears at https://www.weasyl.com/messages/notifications . I don't have any current journals from my watched artists, though, so take this with a grain of salt.

I do have a streaming notification, which I think uses a similar format. It lives in a <label> tag. The <a> tags are probably where you would scrape the journal from, but I probably need to have an actual journal entry, instead of a stream, to tell for sure. Example:

<label class="input-checkbox">
  <input type="checkbox" class="remove" name="remove" value="240374757" />
  <a href="/~pac" class="username">pac</a> is now streaming artwork live.
  <a href="https://live.tacorat.com">[View Stream]</a>
  <span class="date color-lighter">23 April 2018 <em>at</em> 15:58:59 CDT</span>
</label>

Eka's Portal: The journal list (labeled "New Blogs") appears at the bottom of your "submissions by watched artists" page, which is https://aryion.com/g4/messagepage.php. Each blog entry notification lives inside an <li>, with a couple of <a>s in it. One of the <a>s will have a path incluing "//aryion.com/forum/blog.php?b=" in it, which might be a way to detect it. Example:

<li>
  <input type='checkbox' value='221211753' name='msg[]' />
    <a class='user-link' href='/g4/user/jaggedjagd'>jaggedjagd</a>
    has posted a blog titled
    &quot;<a class='title' href='//aryion.com/forum/blog.php?b=38882'>If you're wondering where I am...</a>&quot;
    <span class='pretty-date' title='Apr 21st, 2018 04:47 AM'>2 days ago</span>
</li>

The interesting thing here is that Raccoony might have to get called twice on the same page - once to run the "parse new art submissions" function, and again for the "parse new journals" function. On at least FA and Weasyl, you probably only need to run one function per page.

Eupeptic1 commented 5 years ago

Here is a diff for open-journals-in-tabs support. It is against the released 1.1.5 code; I haven't updated it for the current release.

(I also sent this via email in June 2018, but I figured I'd add it here, since I now have a Github account.)

What's in this diff:

FurAffinity and Weasyl plugins modifed to open journals (only) in tabs, when user is on the main notification page.

Eka's Portal plugin modified to open journals in tabs along with new submission, if enabled in the UI.

GFX and Shorpy plugins changed to note that they do not support journals.

Base plugin changed with stub for new getPageJournalList() function.

UI for new openJournalsMixed setting added - defaults to false (don't open journals on sites with mixed submissions and journals).

FIXME: app/plugins.base.ts and app/ui/siteActions.ts need to be changed to read the new setting and use it when calling getPageLinkList().

Testing done:

Tested with Firefox ESR 52.8.1 (64-bit), on Linux.

FurAffinity and Weasyl: Opening submissions in tabs works as before. Opening journals in tabs now works. Notification types other than new journals are ignored.

Eka's Portal: Opening submissions in tabs works as before. Opening journals along with submissions works, if the option is hard-coded on (see FIXME above).

GFX and Shorpy: Opening submissions in tabs works as before. No journal functionality.

diff-open-journals-in-tabs.txt

Simon-Tesla commented 5 years ago

Please feel free to submit this as a pull request when you feel it's ready.