Skip to content

Instantly share code, notes, and snippets.

@mikemanger
Last active December 6, 2016 03:15
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save mikemanger/b057f444cd2d5205bdfc to your computer and use it in GitHub Desktop.
Save mikemanger/b057f444cd2d5205bdfc to your computer and use it in GitHub Desktop.
Displays titles on your Desura collection page
// ==UserScript==
// @name Desura Game Labeler
// @include http://www.desura.com/collection
// @updateURL https://gist.githubusercontent.com/ohmanger/b057f444cd2d5205bdfc/raw
// @downloadURL https://gist.githubusercontent.com/ohmanger/b057f444cd2d5205bdfc/raw
// @require https://gist.githubusercontent.com/BrockA/2625891/raw
// @grant none
// @version 1.2.2
// ==/UserScript==
function us_add_global_styles() {
var head, style;
head = document.getElementsByTagName( 'head' )[0];
if ( ! head ) {
return;
}
style = document.createElement( 'style' );
style.type = 'text/css';
style.innerHTML = '.img h3 { background-color: rgba(0,0,0,0.5); color: white; padding: 0 5px; }' +
'.boxart:hover .img h3 { display:none; }';
head.appendChild( style );
}
us_add_global_styles();
function us_add_titles( jNode ) {
var games = jNode.find( '.img' ), header, title;
games.each( function( index ) {
title = $( this ).attr( 'alt' );
header = document.createElement( 'h3' );
header.innerHTML = title;
$( this ).prepend( header );
} );
}
waitForKeyElements( '#browsecollection', us_add_titles );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment