What.CD : Album Art Display

View album art.

질문, 리뷰하거나, 이 스크립트를 신고하세요.
// ==UserScript==
// @id             what-album-art-display
// @name           What.CD : Album Art Display
// @namespace      hateradio)))
// @author         hateradio
// @version        4.9.5
// @description    View album art.
// @homepage       https://userscripts.org/scripts/show/114153
// @icon           data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QAAAAAAAD5Q7t/AAAACXBIWXMAAABIAAAASABGyWs+AAAACXZwQWcAAAAgAAAAIACH+pydAAAGO0lEQVRYw8WWXWwcVxXHf/fO7MzsrHd2s9mEbEzdWIlCikmwg1NIUicmLbRpVEWV+tAKyBOKBK0UCfWBUgmEFB7gAQnRvvSlQhHho2kBuYCg5UNJsRw5dYjjxImx81E7rpuNvbZ3PTM7OzOXBxtHgcSsHST+0mhGc+ee87vnnDv3wP9ZYiWTWlpajFwut0MI8SlgG/BpIcQ6pZSjlEoB9qlTp+qyrS/HcUdHx24hxMtCiM8bhlGVUiaEEHahUODWrVu0tbUxMDBAsVis26asN1J79ux51TCMP9q2/URzc7MlhMgcOXLEllJy9OhRhBDs3LkTIZYX1LoA9u7d+6JlWYdyuZytaZro6OgAYHR0FIDjx48DcOzYsWU5hzpqoLOzM6tp2jUgs337dvr7+ykUCoyPjyOlXLwAwjCMgyAo12q1zH3XQEtLi+F53heKxeKjjY2N0vd9BgcHmZqaYnx8nCAI5lcgBHEcAyhN00aBtyzL+tH/IgJy06ZNUVNTE77vq0qlIoIgIJ/P09raiq7r1Gq1RQjP8xgYGKBcLld835fAK1LKbw8PD1dXnIJNGz+ucqvXI6VE13VM02TLli10dXVhWRbZbJZMJoPjOGQyGUzTZHh4GNd1KZVKbrVavVStVh8ZGxvz7rnKpQCk8OIgCEin0+i6jq7rRFGE7/v/8a1SikQigVIKx3FYt26dbdv2Q4ZhfGdJH0sN6loQBkFAEAQYhoEQgmQyyf79+8nn82iatvjOsiwuXryI67oEQYBpmmSz2SSoF5b0sdSgJquxW60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J0RVh0TGljZW5zZQBodHRwOi8vZW4ud2lraXBlZGlhLm9yZy93aWtpL1B1YmxpY19kb21haW4//erPAAAAJXRFWHRtb2RpZnktZGF0ZQAyMDA5LTEyLTA4VDEzOjE2OjA0LTA3OjAwQr/lWgAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAAZdEVYdFNvdXJjZQBUYW5nbyBJY29uIExpYnJhcnlUz+2CAAAAOnRFWHRTb3VyY2VfVVJMAGh0dHA6Ly90YW5nby5mcmVlZGVza3RvcC5vcmcvVGFuZ29fSWNvbl9MaWJyYXJ5vMit1gAAAABJRU5ErkJggg==
// @screenshot     
// @include        http*://*what.cd/artist.php?*
// @include        http*://*what.cd/user.php?*
// @include        http*://*what.cd/torrents.php*
// @include        http*://*what.cd/top10.php*
// @updated        2012-11-05
// @since          2011-09-27
// @grant          GM_xmlhttpRequest
// (c) 2011+, hateradio
// Icon from http://openiconlibrary.sourceforge.net/
// ==/UserScript==

// @match          *://*.what.cd/artist.php?*
// @match          *://*.what.cd/user.php?*
// @match          *://*.what.cd/torrents.php*
// @match          *://*.what.cd/top10.php*

(function () {
	'use strict';
	var greaseWindow, strg, update, art;

	// Obj+
	Object.LEN = function (a) { var i = 0, j; for (j in a) { if (a.hasOwnProperty(j)) { ++i; } } return i; };
	Object.SFT = function (a) { var i; for (i in a) { if (a.hasOwnProperty(i)) { delete a[i]; break; } } };

	greaseWindow = (function (a) {
		try {
			a = unsafeWindow === window ? a : unsafeWindow;
		} finally {
			return a || (function () {
				a = document.createElement('p');
				a.setAttribute('onclick', 'return window;');
				return a.onclick();
			}());
		}
	}());

	strg = {
		on: (function () { try { var s = window.localStorage; if (s.getItem && s.setItem && s.removeItem) { return true; } } catch (e) { return false; } }()),
		read: function (key) { return this.on ? JSON.parse(window.localStorage.getItem(key)) : false; },
		save: function (key, dat) { return this.on ? !window.localStorage.setItem(key, JSON.stringify(dat)) : false; },
		wipe: function (key) { return this.on ? !window.localStorage.removeItem(key) : false; },
		zero: function (o) { var k; for (k in o) { if (o.hasOwnProperty(k)) { return false; } } return true; }
	};

	update = {
		name: 'What.CD : Album Art Display',
		version: 4950,
		key: 'ujs_WhatAlbumArtDisplay',
		callback: 'wcdaadudpt',
		page: 'https://userscripts.org/scripts/show/114153',
		urij: 'https://dl.dropbox.com/u/14626536/userscripts/updt/wcdaad/wcdaadudpt.json',
		uric: 'https://dl.dropbox.com/u/14626536/userscripts/updt/wcdaad/wcdaadudpt.js', // Allow dropbox.com to run scripts.
		checkchrome : true,
		interval: 5,
		day: +new Date(),
		top: document.head || document.getElementsByTagName('head')[0],
		time: function () { return +new Date(this.day + (1000 * 60 * 60 * 24 * this.interval)); },
		css: function (t) {
			if (!this.style) { this.style = document.createElement('style'); this.style.type = 'text/css'; this.top.appendChild(this.style); }
			this.style.appendChild(document.createTextNode(t + '\n'));
		},
		js: function (t) {
			var j = document.createElement('script');
			j.type = 'text/javascript';
			j[(/^https?\:\/\//i.test(t) ? 'src' : 'textContent')] = t;
			this.top.appendChild(j);
			return j;
		},
		notification: function (j) {
			try {
				if (this.version < j.version) {
					localStorage.setItem(this.key, JSON.stringify({date: this.time(), version: j.version}));
					this.link();
				}
			} catch (e) {}
		},
		link: function () {
			var a = document.createElement('a');
			a.href = this.page;
			a.className = 'userscriptupdater';
			a.title = 'Update now.';
			a.textContent = 'An update for ' + this.name + ' is available.';
			document.body.appendChild(a);
		},
		check: function (opt) {
			if (this.gmu === true || !strg.on) { return; }
			var stored = strg.read(this.key);
			this.csstxt();
			if (opt || strg.zero(stored) || stored.date < this.day) {
				this.page = this.page || (stored && stored.page ? stored.page : false);
				strg.save(this.key, {date: this.time(), version: this.version, page: this.page});
				if (!opt && this.gmxhr()) {
					return GM_xmlhttpRequest({method: 'GET', url: update.urij, onload: function (r) { update.notification(JSON.parse(r.responseText)); }, onerror: function () { update.check(1); }});
				}
				greaseWindow[this.callback] = function (json) { update.notification(json); };
			} else if (this.version < stored.version) { this.link(); }
		},
		gmu: (function () { try { return GM_updatingEnabled; } catch (e) {} }()),
		gmxhr: function () { if (!(this.checkchrome === true && typeof (chrome) === 'object') && typeof (GM_xmlhttpRequest) === 'function') { return true; } },
		csstxt: function () {
			if (!this.pop) { this.pop = true; this.css('.userscriptupdater,.userscriptupdater:visited{-moz-box-shadow:0 0 6px #787878;-webkit-box-shadow:0 0 6px #787878;box-shadow:0 0 6px #787878;border:1px solid #777;-moz-border-radius:4px;border-radius:4px;cursor:pointer;color:#555;font-family:Arial, Verdana, sans-serif;font-size:11px;font-weight:700;text-align:justify;min-height:45px;position:fixed;z-index:999999;right:10px;top:10px;width:170px;background:#ebebeb url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACsAAACLCAYAAAD4QWAuAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA2RpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMC1jMDYwIDYxLjEzNDc3NywgMjAxMC8wMi8xMi0xNzozMjowMCAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0UmVmPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VSZWYjIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtcE1NOk9yaWdpbmFsRG9j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iw0lhK1SA6GzI8ppxKouCjTNaOWC7qWzKFrYaNw/SQOKwNVtYk4KjyAQ7RpnHCHaeCg7ugZQon7sBj3RYM62mHdmTVAaGxbiRNVmqRM3/bUvgDQCX/CcLvZsceEOF1v82dgPTrkdVVp2iXU8Q4e9ob0IHu59gUecxdwdlMwBunusGAJ1NuPr0KLoFdYQ3GGBXAiMLWC9gBRDX2gTa9g3Wp7Rbk8TqaPfjWWRp9I0kaLARVCbiXMO/xLGwdfCd7Oa4eDGQdD0fYYcJ7z/bzXHpxbWEDRaddO1FF3aSobE6pazAawztX0H7465mXWVqB2hwqWdwFeFfGaM+Wlh4V/rkMO2fpmy3VWTf5AD0NzLLkYsfn53T7fUs21k2UPmw5jBs9qZgx/AH4Ns+VxvQwJg0rGXTMPUfnhYgj0MLmayb6+TIBFZgBVZgBVZgBVZgBVZgBVZgBVZgBVZgBVZgBVZgBVZgBVZgBVZgBVZgBVZgBVZgBVZgBVZgBVZgBTZzVrg3U+Nsz1iTo7m7c+GRFU2ONGBFkyMNWNHkSANWNDl0xqbJAZ+j1/nR5HBOv6zm/8JaPjQ5KKqiyRFVpORfk8PRf3NZq8lRrd3PhiaHc6pvcLk0ORDdfGlyAFg0OdKAPUlliG76mhyGUNaDLXOaHIjuJdXkoKVKXzU5wlJZZjU5AFyKKhErFkuVbjcoUo3Apcmhnu6Ebkcmc5oczd2dZlA3YNHkUAFwUtLkcJlWnm1a1ng94AvkbKnM1SxVTKwRMphYNDkAPNiFFU0OZuPV5NDMYiyaHOgKvJoc8CVftFk1ORRsi/FxvYR3yH9qZjYba+VGkwOTw5GCzZcmByzTmhyI6ra/kNkiz4wmByD/0+T4J8AAyDkZArebBxMAAAAASUVORK5CYII=) no-repeat 13px 15px;padding:12px 20px 10px 65px}.userscriptupdater:hover,.userscriptupdater:visited:hover{color:#55698c!important;background-position:13px -85px;border-color:#8f8d96}'); }
		}
	};
	update.check();

	art = {
		jkey: greaseWindow.authkey,
		uri: document.location.href,
		div: document.getElementById('discog_table'),
		uli: document.createElement('ul'),
		cvr: document.createElement('div'),
		act: document.location.pathname.substring(1).replace('.php', ''),
		img: [], // detected ids
		mem: strg.read('AlbArtDispCache'),
		usr: strg.read('whatartdisplaysettings'),
		map: false, // setting to show collage
		showMap: false, // on only for artists pages
		ren: false,
		top: true,
		siz: 96, // img size
		max: 50,
		lag: 500,
		reg: /(?:\/torrents\.php\?id\=(\d+))/,
		exc: ['remix', 'remixed', 'mixtape', 'unknown', 'bootleg', 'interview'], // not for these
		box: {
			td: function (i, location) {
				return location.parentNode.insertBefore(art.elm('td', {className: i >= art.max ? 'gm_albumartdisplay' : 'gm_albumartdisplay gm_albumartdisplay_loading'}), location);
			},
			map: function () {
				art.cvr.id = 'coverhead';
				art.cvr.className = 'box';
				art.div.parentNode.insertBefore(art.cvr, art.div);
				art.cvr.innerHTML = '<div id="coverhead" class="head"><strong>Cover Art</strong></div>';
				art.uli.className = 'collage_images';
				art.cvr.appendChild(art.uli);
			},
			mapAdd: function (uri, id, text) {
				return art.elm('img', {className: '_albumartdisplay' + id, title: text, width: 117, src: uri},
					art.elm('a', {className: uri ? 'gm_albumartdisplay' : 'gm_albumartdisplay_loading', href: '/torrents.php?id=' + id, title: 'Loading . . .'},
						art.elm('li', false, art.uli)));
			},
			shiftCol: function (col) {
				// col.colSpan = col.colSpan ? col.colSpan + 1 : 1;
				col.colSpan += 1;
			}
		},
		mod: function (node, selectors) {
			// console.log('n: ' + node, 'm: ' + this.map, 's: ' + selectors);
			var A,
				C,
				a,
				b = document.querySelectorAll(selectors[0]),
				c = b.length,
				d = document.querySelectorAll(selectors[1]),
				e = d.length,
				tt,
				id,
				j = -1; //console.log(c, e);
			if (this.showMap && this.map) { this.box.map(); }
			while (e--) { this.box.shiftCol(d[e]); }
			while (++j < c) {
				A = b[j];
				C = this.box.td(j, node === 1 ? A.parentNode.parentNode : A.parentNode);
				id = A.href.match(this.reg)[1];
				tt = A.textContent;
				if (j < this.max) {
					a = this.mem[id] || '';
					if (a) {
						this.max++;
						C.className = 'gm_albumartdisplay';
					} else if (this.img[id]) {
						// Depending on the page, there might be several links/images
						// of the same group ID. Ignore duplicates and add one to the max.
						this.max++;
					} else {
						this.img.push(id);
						C.title = 'Loading . . .';
					}
					if (this.showMap && this.map) {
						this.box.mapAdd.call(this, a, id, tt);
					}
				}
				this.elm('img', {className: '_albumartdisplay' + id, title: tt, width: this.siz, height: this.siz, $onclick: 'lightbox.init(this,' + this.siz + ');', src: a, _display: a ? '' : 'none'}, C);
			}
			this.max--;
			this.run();
		},
		opt: function () {
			var A = document.getElementById('collagecovers') || document.getElementById('hidecollage'), B, C, D;
			if (A) {
				C = this.elm('tr', {innerHTML: '<td class="label"><strong>Album Art Display</strong></label></td><td><p><strong class="important_text" id="_albumartdisplaym"></strong></p><div id="_albumartdisplaysettings"></div></td>'});
				A.parentNode.parentNode.parentNode.insertBefore(C, A.parentNode.parentNode);
				D = document.getElementById('_albumartdisplaysettings');
				this.pm = document.getElementById('_albumartdisplaym');
				B = this.elm('input', {id: 'albumdisplaymap', type: 'checkbox', checked: this.map}, D);
				B.addEventListener('click', this.set, false);
				A = this.elm('label', {$for: 'albumdisplaymap', textContent: ' Show collage in artist pages. '}, D);
				B = this.elm('input', {id: 'albumdisplayren', type: 'checkbox', checked: this.ren}, D);
				B.addEventListener('click', this.set, false);
				A = this.elm('label', {$for: 'albumdisplayren', textContent: ' Show album art in torrent/notification pages. '}, D);
				B = this.elm('input', {id: 'albumdisplaytop', type: 'checkbox', checked: this.top}, D);
				B.addEventListener('click', this.set, false);
				A = this.elm('label', {$for: 'albumdisplaytop', textContent: ' Show album art on the Top10.'}, D);
			}
		},
		init: function () { //console.log('N'+Object.LEN(this.mem));
			update.css('a.gm_albumartdisplay_loading{display:block;height:117px}.gm_albumartdisplay_loading{background:transparent url(http://whatimg.com/i/97804798653144081223.gif) no-repeat center center;cursor:progress}.gm_albumartdisplay_loading img{opacity:0 !important}.gm_albumartdisplay img{cursor:pointer}td.gm_albumartdisplay{min-width:' + this.siz + 'px !important;height:' + this.siz + 'px;padding:0;margin:0}td.gm_albumartdisplay img{opacity:.9}td.gm_albumartdisplay img:hover{opacity:1}');
			this.mem = strg.zero(this.mem) ? {} : this.mem;
			if (!strg.zero(this.usr)) {
				this.map = this.usr.map;
				this.ren = this.usr.ren;
				this.top = this.usr.top; // console.log(this.map,this.ren);
			}
			this.page();
		},
		page: function () {
			var img = document.querySelector('.sidebar .box_albumart img[onclick]');
			if (/(?:\/user\.php)/.test(this.uri)) {
				this.opt();
			} else if (this.reg.test(this.uri)) { //console.log('album page');
				if (img) { // console.log(img.src);
					this.img = this.elm('img', {src: img.src, id: RegExp.lastParen});
					this.img.addEventListener('load', art.mix, false);
					this.img.addEventListener('error', art.mix, false);
				}
			} else if (/(?:\/artist\.php)/.test(this.uri)) {
				this.showMap = true;
				this.sel(0, 0, 1);
			} else if (this.ren && /(?:\/torrents\.php)/.test(this.uri)) {
				if (this.uri.indexOf('action=notify') !== -1) {
					this.sel(0, 2, 1);
				} else if (this.uri.indexOf('userid') !== -1) {
					this.sel(1, 4, 2);
				} else {
					this.sel(2, 1, 2);
				}
			} else if (this.top && this.act === 'top10') {
				if (this.uri.indexOf('type=users') === -1 && this.uri.indexOf('type=tags') === -1) {
					this.sel(0, 3, 1);
				}
			} // console.log('m: '+RegExp.lastMatch);
		},
		sel: function (a, b, c) { //console.log(a, b, c);
			var x = [];
			switch (a) {
			case 0:
				x[0] = '.torrent a[href^="torrents.php?id"], table:not(#torrents_' + this.exc.join('):not(#torrents_') + ') .group a[href^="torrents.php?id"], .group_torrent strong a[href^="torrents.php?id"]';
				break;
			case 1:
				x[0] = 'table td a[href^="torrents.php?id"]';
				break;
			case 2:
				x[0] = 'table .cats_col+td a[href^="torrents.php?id"]';
				break;
			default:
				return;
			}
			switch (b) {
			case 0:
				x[1] = ['table.torrent_table:not(#torrents_', this.exc.join('):not(#torrents_'), ') .group_torrent td:first-child, table:not(#torrents_', this.exc.join('):not(#torrents_'), ') td.small:nth-child(', c, ')'].join('');
				break;
			case 1:
				x[1] = '.small.cats_col, tr.group_torrent td[colspan]';
				break;
			case 2:
				x[1] = 'form[id^="notificationform"] .small.cats_col';
				break;
			case 3:
				x[1] = '#top10 .colhead td:nth-child(2), #top10 .colhead_dark td:nth-child(2), .group_torrent td[colspan]';
				break;
			case 4:
				x[1] = '.colhead td:nth-child(2), tr.group_torrent td[colspan]';
				break;
			default:
				return;
			}
			this.mod(c, x);
		},
		run: function () { //console.log('this.img: ' + this.img);
			setTimeout(art.exe, art.lag);
		},
		exe: function () {
			var id = art.img.shift();
			if (id) {
				art.xhr(id);
				art.run();
			}
		},
		xhr: function (id) {
			var req = new XMLHttpRequest();
			req.id = id;
			req.pic = document.getElementsByClassName('_albumartdisplay' + req.id);
			req.pln = req.pic.length; // console.log('p ln: '+req.id, req.pln);
			req.pix = function (e) { art.mix.call(req, e); };
			req.open('get', ['ajax.php?action=torrentgroupalbumart&id=', req.id, '&auth=', this.jkey].join(''), true);
			req.onload = this.dat;
			req.onerror = this.bad;
			req.send(null);
		},
		bad: function () { //console.log('not found!'+this.id);
			art.mux.call(this, 'error');
		},
		dat: function () {
			var j;
			try {
				j = JSON.parse(this.responseText); //console.log(j);
				this.pic[0].onerror = this.pix;
				this.pic[0].onload = this.pix;
				this.pic[0].src = j.response.wikiImage;
			} catch (e) {
				art.bad.call(this);
			}
		},
		mix: function (evt) { // evt - load or error - is attached to an image or xhr
			var a = evt.type, b = evt.target; // console.log('mix: ', this, a, b.src, this.id);

			switch (a) {
			case 'load':
				art.mem[this.id] = b.src;
				break;
			case 'error':
				delete art.mem[this.id];
				break;
			default:
				return;
			}

			if (this.responseText) {
				this.pic[0].onerror = null;
				if (a === 'error') {
					this.pic[0].src = 'static/common/noartwork/music.png';
					return;
				}
				this.pic[0].onload = null;
				art.mux.call(this, a);
			} else {
				this.removeEventListener('error', art.mix, false);
			}
			art.put();
		},
		mux: function (a) {
			var i = this.pln, p, q;
			while (i--) {
				p = this.pic[i];
				q = p.parentNode;
				q.className = 'gm_albumartdisplay';
				p.src = this.pic[0].src;
				p.alt = a === 'load' ? 'Loaded' : 'No artwork';
				p.removeAttribute('style');
				q.removeAttribute('title');
			}
		},
		put: function () {
			if (strg.on) {
				if (Object.LEN(this.mem) > 1500) { Object.SFT(this.mem); }
				strg.save('AlbArtDispCache', this.mem);
			}
		},
		set: function () {
			switch (this.id) {
			case 'albumdisplaymap':
				art.map = this.checked;
				break;
			case 'albumdisplayren':
				art.ren = this.checked;
				break;
			case 'albumdisplaytop':
				art.top = this.checked;
				break;
			default:
				return false;
			}
			art.pm.textContent = strg.save('whatartdisplaysettings', {map: art.map, ren: art.ren, top: art.top}) ? 'Saved.' : 'The setting could not be saved.'; // console.log('saved: '+strg.read('whatartdisplaysettings'));
			window.setTimeout(function () { art.pm.textContent = ''; }, 2500);
		},
		elm: function (t, o, e, p) {
			var a, b, c = document.createElement(t);
			if (typeof (o) === 'object') { for (a in o) { if (o.hasOwnProperty(a)) { b = a.charAt(0); switch (b) { case '_': c.style[a.substring(1)] = o[a]; break; case '$': c.setAttribute(a.substring(1), o[a]); break; default: c[a] = o[a]; break; } } } }
			if (e) { p ? c.appendChild(e) : e.appendChild(c); }
			return c;
		}
	};
	art.init();
}());