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.

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Userscripts.

You will need to install an extension such as Tampermonkey to install this script.

K instalaci tohoto skriptu si budete muset nainstalovat manažer uživatelských skriptů.

(Už mám manažer uživatelských skriptů, nechte mě ho nainstalovat!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Už mám manažer uživatelských stylů, nechte mě ho nainstalovat!)

// ==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"));
  }
}