Skip to content

Instantly share code, notes, and snippets.

@markstinson
Forked from mikemanger/desura-game-labeler.user.js
Last active December 6, 2016 03:18
Show Gist options
  • Save markstinson/60fc05a31360e177283253237fa4c59a to your computer and use it in GitHub Desktop.
Save markstinson/60fc05a31360e177283253237fa4c59a 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/markstinson/60fc05a31360e177283253237fa4c59a/raw
// @downloadURL https://gist.githubusercontent.com/markstinson/60fc05a31360e177283253237fa4c59a/raw
// @require https://gist.githubusercontent.com/markstinson/cbe66b990811db3346caab8eb2b39ef8/raw
// @grant none
// @version 1.2.2
// ==/UserScript==
// update with your username/checksum
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