Skip to content

Instantly share code, notes, and snippets.

@thatkookooguy
Last active October 2, 2018 15:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thatkookooguy/0352b6415191312d91ccd8608857e99a to your computer and use it in GitHub Desktop.
Save thatkookooguy/0352b6415191312d91ccd8608857e99a to your computer and use it in GitHub Desktop.
Will add game names to the launchbox database. See comment for instructions.
javascript:(function() { $('.box-item').each(function(){ let qElm = $(this); let boxWidth = this.clientWidth; let imgWidth = qElm.find('img')[0].clientWidth; let boxHeight = this.clientHeight; let imgHeight = qElm.find('img')[0].clientHeight; let hSpace = (boxHeight - imgHeight) / 2; let wSpace = (boxWidth - imgWidth) / 2; let name = $.trim(qElm.next().find('h3').text()); qElm.append(`<div style="position: absolute;bottom: ${hSpace + 5}px;left: ${wSpace}px;right: ${wSpace}px;color: white;display: flex;align-items: center;text-align: center;justify-content: center;background: rgba(0, 0, 0, 0.5)">${name}</div>`); });})()
javascript:(function() {
$('.box-item').each(function(){
let qElm = $(this);
let boxWidth = this.clientWidth;
let imgWidth = qElm.find('img')[0].clientWidth;
let boxHeight = this.clientHeight;
let imgHeight = qElm.find('img')[0].clientHeight;
let hSpace = (boxHeight - imgHeight) / 2;
let wSpace = (boxWidth - imgWidth) / 2;
let name = $.trim(qElm.next().find('h3').text());
qElm.append(
`<div style="position: absolute;bottom: ${hSpace + 5}px;left: ${wSpace}px;right: ${wSpace}px;color: white;display: flex;align-items: center;text-align: center;justify-content: center;background: rgba(0, 0, 0, 0.5)">${name}</div>`
);
});
})()
@thatkookooguy
Copy link
Author

HOW TO USE

  1. create a new bookmark in your favorite browser.
  2. give it the following parameters:
    name: Launchbox - Inject game names
    URL: the content of the add-game-names.js snippet
  3. go to any launchbox database page
  4. click on the bookmark to add game names

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment