Wikipedia / What.CD Search

Adds a what.cd search link to the Wikipedia pages of Albums or Artists.

คุณจะต้องติดตั้งส่วนขยาย เช่น Tampermonkey, Greasemonkey หรือ Violentmonkey เพื่อติดตั้งสคริปต์นี้

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

คุณจะต้องติดตั้งส่วนขยาย เช่น Tampermonkey หรือ Violentmonkey เพื่อติดตั้งสคริปต์นี้

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

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

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

(I already have a user script manager, let me install it!)

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.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name         Wikipedia / What.CD Search
// @version      1.4
// @description  Adds a what.cd search link to the Wikipedia pages of Albums or Artists.
// @match        http*://*wikipedia.org/*
// @namespace    https://greasyfork.org/users/2201
// @grant        none
// ==/UserScript==

if(!document.getElementsByClassName('album').length){
  var summary = document.getElementsByClassName('fn')[0];
  var wcdlink="https://what.cd/torrents.php?action=basic&artistname=";
  var s = summary.textContent;
  wcdlink += encodeURI(s) + "&tags_type=1&order_by=time&order_way=desc&group_results=1&action=advanced&searchsubmit=1";
  var a = document.createElement('a');
  a.href = wcdlink;
  a.innerHTML = "<img style='margin-left:5px' src='https://what.cd/favicon.ico'>";
  summary.appendChild(a);
} else {
  var summary = document.getElementsByClassName('summary')[0];
  var wcdlink="https://what.cd/torrents.php?action=advanced&groupname="
  var s = summary.textContent;
  wcdlink += s;
  wcdlink += "&artistname=" + document.getElementsByClassName('contributor')[0].textContent;
  wcdlink = encodeURIComponent(wcdlink);
  wcdlink += "&recordlabel=&cataloguenumber=&year=&remastertitle=&remasteryear=&remasterrecordlabel=&remastercataloguenumber=&filelist=&encoding=&format=&media=&releasetype=&haslog=&hascue=&scene=&vanityhouse=&freetorrent=&searchstr=&taglist=&tags_type=1&order_by=time&order_way=desc&group_results=1&action=advanced&searchsubmit=1&setdefault=Make+default"
  var a = document.createElement('a');
  a.href = wcdlink;
  a.innerHTML = "<img style='margin-left:5px' src='https://what.cd/favicon.ico'>";
  summary.appendChild(a);
}