Last active
December 6, 2016 03:15
-
-
Save mikemanger/b057f444cd2d5205bdfc to your computer and use it in GitHub Desktop.
Displays titles on your Desura collection page
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==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