PMBD PMBD
Welcome, Guest. Please login or register.
2020 July 08, 05:41:28

Login with username, password and session length
Search:     Advanced search
136987 Posts in 1573 Topics by 4054 Members
Latest Member: sharkwhaleeee
* Home Help Search Calendar Login Register
+  PMBD
|-+  The Pirate Ship
| |-+  ARR!
| | |-+  Graphical script for the booty site.
0 Members and 1 Guest are viewing this topic. « previous next »
Pages: [1] THANKS THIS IS GREAT Print
Author Topic: Graphical script for the booty site.  (Read 475 times)
NcProductions
Landlubber

Posts: 1


View Profile
Graphical script for the booty site.
« on: 2020 June 12, 13:22:22 »
THANKS THIS IS GREAT

Hi fellas.

I made a script using JavaScript to make a graphical UI for http://paysites.mustbedestroyed.org/booty/ page. It improves the user experience when browsing the long list of mods. When you want to preview an image of an mod, you have to click the individual image link to see it. I personally think it can be tedious, especially in the long run. With this script, it will automatically render the image for you. It will also render the download button.

I also want to apologize if a script like this already exists. I just joined and I wanted to share this script with everyone.

Preview image:

Before:


After:


Installation

This script is only compatible with Chrome browsers. The source code will be released, so someone else can make a greasemonkey script for firefox.

First, you will need to download Tampermonkey extension for chrome - https://chrome.google.com/webstore/detail/tampermonkey/dhdgffkkebhmkfjojejmpbldmpobfkfo

Once installed, click the Tampermonkey extension and select create new script. Then replace the code that comes by default with mine here:
Code:
// ==UserScript==
// @name         Sims Paysites Must Be Destroyed View Images
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  try to take over the world!
// @author       You
// @match        http://paysites.mustbedestroyed.org/booty/*/
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    const anchorClass = "position: relative;";

    const imageClass = "max-width:600px; height: auto;";

    const textClass = "position: absolute; bottom: 10px; left: 50%; transform:translateX(-50%); background-color: black; color: white; padding: 10px 25px;";

    const buttonClass = " background-color: tomato; color: black; padding: 10px 25px; display: inline-block; text-decoration: none; margin: 10px auto 50px auto";

    const anchors = document.querySelectorAll('a');
    for(let i = 0; i < anchors.length; i++){

        let type = anchors[i].href.split('.').pop();
        if(['jpeg','png','jpg'].includes(type)){

            let text = anchors[i].href.split('/').pop();


            const src = anchors[i].href;
            anchors[i].outerHTML = `<a style="${anchorClass}" target="_blank" href="${src}"><img style="${imageClass}" src="${src}" alt="Preview"><span style="${textClass}">${text}</span></a>`;
        } else {
            if(type == 'zip' || type == 'rar'){
               let link = anchors[i].href;
               let file = anchors[i].href.split('/').pop();
               anchors[i].outerHTML = `<a style="${buttonClass}" href="${link}">Download ${file}</a>`;
            }
        }

    }
})();

And last, press CTRL + S to save the script and the images and buttons should now render.
Logged
savvysims
Landlubber

Posts: 3


View Profile
Re: Graphical script for the booty site.
« Reply #1 on: 2020 July 06, 17:14:40 »
THANKS THIS IS GREAT

This is great, thanks! I've just installed it and it makes things much quicker. Smiley
« Last Edit: 2020 July 06, 17:43:47 by savvysims » Logged
simjunkie
Landlubber

Posts: 1


View Profile
Re: Graphical script for the booty site.
« Reply #2 on: 2020 July 07, 08:35:58 »
THANKS THIS IS GREAT

Well, that's pretty nifty. Thanks!
Logged
sharkwhaleeee
Landlubber

Posts: 1


View Profile
Re: Graphical script for the booty site.
« Reply #3 on: Today at 01:12:02 »
THANKS THIS IS GREAT

This script is awesome!!!
Logged
Pages: [1] Print 
« previous next »
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!
Page created in 0.088 seconds with 19 queries.