Greasy Fork is available in English.

Pocket - open all saves in new tab

Adds a button to open all saves in new tab, also removes all `?utm_source=*` from url

// ==UserScript==
// @name         Pocket - open all saves in new tab
// @namespace    http://tampermonkey.net/
// @version      0.3
// @description  Adds a button to open all saves in new tab, also removes all `?utm_source=*` from url
// @author       FallenMax
// @match        https://getpocket.com/saves
// @match        https://getpocket.com/*/saves
// @icon         data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
// @grant        none
// @license MIT
// ==/UserScript==

(async function() {
    'use strict';

    await new Promise(resolve => setTimeout(resolve, 3000))

    const openAllLinks = () =>{
        const links = document.querySelectorAll('.publisher')
        for (let i = 0; i < links.length; i++) {
            const link = links[i]
            const url = new URL(link.href)
            url.searchParams.delete('utm_source')
            link.href = url.href
            link.click()
        }
    }

    const $sort = document.querySelector('button[data-testid="sort-options"]')
    const $openAll = document.createElement('button')
    $openAll.textContent = 'Open All'
    $openAll.className = 'tiny'

    $sort.insertAdjacentElement('afterend', $openAll)

    $openAll.onclick = openAllLinks


})();