Results 1 to 3 of 3

Thread: Navigate TA threads with arrow keys (+ last unread shortcut) script

  1. #1
    خايف من اللغة العربية؟ sacha's Avatar
    Join Date
    Dec 2023
    Last Online
    Yesterday @ 06:26 PM
    Location
    Freedomland
    Ethnicity
    Coastal Syrian
    Ancestry
    Tartous
    Country
    United States
    mtDNA
    H4a1-T152C!
    Religion
    Catholic (Maronite Rite)
    Age
    28
    Gender
    Posts
    820
    Thumbs Up
    Received: 1,831
    Given: 998

    4 Not allowed!

    Default Navigate TA threads with arrow keys (+ last unread shortcut) script

    I'm a very lazy lady and I made a 'copy codeblock button' script a few months ago because I hate copying calculators manually. Now I have made another script and I am sharing it with you all in case you are lazy like me. What does it do?

    ~ You can go through TA threads with multiple pages using the left and right arrow keys
    ~ You can jump to the latest unread post in a thread using Alt+U

    Note: going through pages will have some lag, not because of the script but because of TA. They will load at the same speed that they normally do. No magic for that.

    But Sacha, how do I install the script?

    It's very easy, all you must do is install TamperMonkey and click "Create new userscript", then paste this code in. You will need to refresh TA for it to start working.

    Are you stealing my information?

    Yes, I will seize your bank account and spend 500€ on model airplanes after you install this.

    The script:
    Code:
    // ==UserScript==
    // @name         TA thread navi
    // @namespace    http://tampermonkey.net/
    // @version      0.2
    // @description  Navigate TA threads with left and right arrow keys, see latest unread using alt + U
    // @author       sacha
    // @match        https://www.theapricity.com/forum/showthread.php*
    // @grant        none
    // @run-at       document-end
    // ==/UserScript==
    
    (function() {
        'use strict';
    
        document.addEventListener('keydown', function(e) {
            if (e.key === "ArrowRight") {
                const nextButton = document.querySelector('span.prev_next a[rel="next"]');
                if (nextButton && nextButton.href) {
                    window.location.href = nextButton.href;
                }
            }
    
            else if (e.key === "ArrowLeft") {
                const prevButton = document.querySelector('span.prev_next a[rel="prev"]');
                if (prevButton && prevButton.href) {
                    window.location.href = prevButton.href;
                }
            }
    
            else if (e.key === "u" && e.altKey) {
                const firstUnreadButton = document.querySelector('a.firstunread');
                if (firstUnreadButton && firstUnreadButton.href) {
                    window.location.href = firstUnreadButton.href;
                }
            }
        });
    })();
    23andMe: 100% Levantine
    AncestryDNA: 100% Levant (North Lebanon & Mount Lebanon)
    ܫܘܒܚܐ ܠܡܪܢ ܝܫܘܥ ܡܫܝܚܐ ♰
    My mtFull

  2. #2
    خايف من اللغة العربية؟ sacha's Avatar
    Join Date
    Dec 2023
    Last Online
    Yesterday @ 06:26 PM
    Location
    Freedomland
    Ethnicity
    Coastal Syrian
    Ancestry
    Tartous
    Country
    United States
    mtDNA
    H4a1-T152C!
    Religion
    Catholic (Maronite Rite)
    Age
    28
    Gender
    Posts
    820
    Thumbs Up
    Received: 1,831
    Given: 998

    2 Not allowed!

    Default

    Also I just made this:

    Code:
    // ==UserScript==
    // @name         TA thumbs up hotkey
    // @namespace    http://tampermonkey.net/
    // @version      0.1
    // @description  If you press "ctrl+alt+t" while hovering over a post, it will like/unlike that post
    // @author       sacha
    // @match        https://www.theapricity.com/forum/showthread.php*
    // @grant        none
    // @run-at       document-end
    // ==/UserScript==
    
    (function() {
        'use strict';
    
        let hoveredPostId = null;
    
        document.querySelectorAll('#posts > li').forEach(post => {
            post.addEventListener('mouseover', function() {
                hoveredPostId = this.id;
            });
            post.addEventListener('mouseout', function() {
                hoveredPostId = null;
            });
        });
    
        document.addEventListener('keydown', function(e) {
            if (e.ctrlKey && e.altKey && e.key === 't') {
                if (hoveredPostId) {
                    const postIdNumber = hoveredPostId.replace('post_', '');
                    const thumbsUpButton = document.querySelector(`a#sc_thumbs_button_${postIdNumber}`);
                    if (thumbsUpButton) {
                        thumbsUpButton.click();
                    } else {
                        alert('No thumbs up button found :(');
                    }
                } else {
                    alert("You're not hovering over a post :(.");
                }
            }
        });
    })();
    Self-explanatory, the lag is again just normal TA lag but you can like posts by hovering over them and pressing "CTRL+ALT+T". Disliking works the same way, just do it again.

    Don't spam the hotkeys please
    23andMe: 100% Levantine
    AncestryDNA: 100% Levant (North Lebanon & Mount Lebanon)
    ܫܘܒܚܐ ܠܡܪܢ ܝܫܘܥ ܡܫܝܚܐ ♰
    My mtFull

  3. #3
    Veteran Member Annihilus's Avatar
    Join Date
    Jul 2012
    Last Online
    05-11-2024 @ 11:17 PM
    Location
    Lake TĎtĎcaca
    Ethnicity
    turkĎc
    Country
    Ukraine
    Gender
    Posts
    6,279
    Thumbs Up
    Received: 4,009
    Given: 3,749

    0 Not allowed!

    Default

    nerd

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 2
    Last Post: 05-03-2019, 01:01 AM
  2. Replies: 0
    Last Post: 01-04-2019, 04:20 AM
  3. Replies: 0
    Last Post: 09-19-2010, 11:49 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •