Eza's Gallery Smoothener

Removes unimportant links below thumbnails, so select -> right-click -> open-links-in-new-tabs works cleanly.

20.08.2015 itibariyledir. En son verisyonu görün.

// ==UserScript==
// @name        Eza's Gallery Smoothener
// @namespace    https://inkbunny.net/ezalias
// @author			Ezalias
// @description     Removes unimportant links below thumbnails, so select -> right-click -> open-links-in-new-tabs works cleanly. 
// @license     MIT
// @include     http://www.furaffinity.net/msg/submissions/*
// @include     http://www.furaffinity.net/favorites/*
// @include     https://inkbunny.net/submissionsviewall.php*mode=unreadsubs*
// @include     https://inkbunny.net/submissionsviewall.php*mode=userfavs*
// @include     http://www.hentai-foundry.com/users/FaveUsersRecentPictures?username=*
// @include     http://www.hentai-foundry.com/pictures/*
// @exclude    /^http://www\.hentai-foundry\.com/pictures/.*/.*/[0-9]*/.*/
// @include     https://www.weasyl.com/messages/submissions*
// @include     https://www.weasyl.com/submissions*
// @include     https://www.weasyl.com/favorites*
// @include     http://www.y-gallery.net/gallery/*
// @include     http://www.y-gallery.net/favourites/*
// @include     http://www.y-gallery.net/browse/
// @include     http://www.y-gallery.net/browsetops/ 
// @include     http://www.y-gallery.net/clubgallery/*
// @include     http://rule34.paheal.net/post/list/*
// @include     http://www.pixiv.net/bookmark_new_illust.php?*
// @version     1.7.1 
// @grant       none
// ==/UserScript==

// This removes user-profile links and other extraneous junk from supported image galleries so that users can select many images and open them all in tabs.
// Firefox-only, because only Firefox has right-click -> "Open links in tabs." 

// Todo: support relevant sites from Eza's Image Glutton - mostly "watching" pages and "favorites" galleries. 
// Linked images seem to disappear, even though they ought to be handled by innerHTML. 
// SoFurry requires additional handling thanks to their dynamic page shenanigans. (Be restful, you stupid document!) 
// Consider removing rule34.paheal direct-image links. 
// Maybe Derpibooru? They have comment / vote links above every thumbnail. 



var links = document.getElementsByTagName( 'a' ); 		// Grab all links.
// Iterate backwards over the list, because JS "helpfully" updates links[] as each link is removed. 
for( var n = links.length-1; n >= 0; n-- ) { 		// For each link, 
	if( username_link_in( links[n] ) ) { 		// If it points to a user's profile,
			// Replace it with unlinked text. 
		var dud = document.createElement("span"); 		// I.e. - create blank span,
		for( var x in links[n] ) { dud[x] = links[n][x]; } 		 		// Copy all elements of this link onto this span, 
		links[n].parentNode.replaceChild( dud, links[n] ); 		// Replace this link with this span. 
	}
}		// Done.



// -------------------------



function username_link_in( anchor ) { 		// True / False: does this link element look like a userpage link? 
	switch( document.domain ) { 
		case "www.furaffinity.net": 
			return anchor.href.indexOf( "/user/" ) > 0 || anchor.href.indexOf( "/favorites/" ) >= 0; break; 		// FA: yes, if it contains "/user/username". (Also for "deleted by the owner" fake-links.)
		case "inkbunny.net":
			return anchor.className.indexOf( "userName" ) > 0; break; 		// IB: yes, if the messy class string includes a userName designation. 
		case "www.hentai-foundry.com":
			return anchor.href.indexOf( "/profile" ) > 0; break; 		// HF: yes, if it contains "/user/username/profile". (Every HF link has /user/ in it. Grr.) 
		case "www.weasyl.com":
			return anchor.href.indexOf( "~" ) > 0; break; 		// HF: yes, if it contains "~username". 
		case "www.y-gallery.net":
			return anchor.href.indexOf( "/user/" ) > 0 || anchor.href.indexOf( "/club/" ) > 0; break; 		// YG: yes, if it contains "/user/username" or "/club/clubname". 
		case "rule34.paheal.net":
			return anchor.href.indexOf( "_images" ) > 0 || anchor.href[ anchor.href.length - 1 ] == "#"; break; 		// Paheal: yes, if it's a bare image link. (Or a weird invisible same-page anchor.) 
		case "www.pixiv.net":
			return anchor.href.indexOf( "member_illust.php?id" ) > 0; break; 		// HF: yes, if it contains "/user/username/profile". (Every HF link has /user/ in it. Grr.) 
	}
}