GameFAQs - Print Version FAQ links

Adds the string '?print=1' to all of the FAQ links on a game's FAQ page, making them point to the lightweight print version.

Dovrai installare un'estensione come Tampermonkey, Greasemonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Userscripts per installare questo script.

Dovrai installare un'estensione come ad esempio Tampermonkey per installare questo script.

Dovrai installare un gestore di script utente per installare questo script.

(Ho già un gestore di script utente, lasciamelo installare!)

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

(Ho già un gestore di stile utente, lasciamelo installare!)

// ==UserScript==
// @name        GameFAQs - Print Version FAQ links
// @namespace   rudicron
// @description Adds the string '?print=1' to all of the FAQ links on a game's FAQ page, making them point to the lightweight print version.
// @include     http://www.gamefaqs.com/*/*/faqs
// @include     https://www.gamefaqs.com/*/*/faqs
// @include     http://gamefaqs.gamespot.com/*/*/faqs
// @include     https://gamefaqs.gamespot.com/*/*/faqs
// @version     1.1
// @grant       none
// ==/UserScript==

var aList = document.body.querySelectorAll("td.ctitle > a");

for (var a of aList) {
  var link = a.getAttribute("href");
  if (link.includes("?")) {
    if (! link.toLowerCase().includes("print=1") ) {
      a.setAttribute("href", link.concat("&print=1"));
    }
  } else {
    a.setAttribute("href", link.concat("?print=1"));
  }
}