Jump to content

Add possibility to hide earned trophies in guides (with userscript)


Recommended Posts

Been waiting for this for a while, it was probably suggested already but good work man, looks pretty good, I also think this should be in guides, espeacially those that have long guides

thank you!

haven't found any suggestion for this, sorry if there was already something suggested for this

Link to comment
Share on other sites

I remember I did similar for Puppeteer. :P

 

http://psnprofiles.com/forums/topic/16200-collectible-guide/#entry652120

 

There it was just to get a "checklist" on the tons of collectibles in the game, where many wasn't possible to track in-game, and if you forgot one it could take forever to figure out which that was. Allowed you to save the checklist! :)

Edited by MMDE
Link to comment
Share on other sites

It will be in the next site update.

:awesome:

 

 

 

really?  :blink:

 

 

Update to version 0.75:

1. I've added the possibility to hide trophies from the guide (even if unearned) - you just have to click the box in the overview with the trophies type - see screenshot for example, it's hard to explain, i normally speak german.

post-133631-0-93754700-1457277679_thumb.png

for example, click on "Difficulty specific" to hide/show corresponding trophies.

Note that if you've already hidden some trophies, it can happen that some are displayed again, for example: Trophy X is earned, you hide trophy X with clicking on "Toggle earned", but Trophy X is also part of "Difficulty specific" trophies - click "Difficulty specific" - all trophies with this type are hidden, but Trophy X is displayed again (as the buttons only toggle the visibility).

2. When you've toggled the visibility, an asterisk (*) is added to the clicked button.

3. Added "update" button to navigation bar, I was tired of clicking the profile first to update it 

 

Tampermonkey/Greasemonkey should update the script automatically, if you haven't installed it yet, click here: https://github.com/Barokai/psnprofiles-enhanced/raw/master/psnprofiles-enhanced.user.js

 

 

Improvement suggestions and ideas are still greatly welcomed.

 

// edit: changed userscript url to github-repo

Edited by K--Force
Link to comment
Share on other sites

nice. i also once started to add some features i would like to see on the page to a custom userscript.

the first thing i did was showing/marking games i also own, including my progression, on the general games list and on other peoples profiles:

 

eB93GdY.png

 

another idea, that i never actually implemented, was to have an ability to flag games as owned or even add to different categories like "digitally", "my whateverregion alt account" and so on.

and/or some kind of wishlist feature.

 

i guess there are a ton of cool features one could do entirely on the client-side as userscript. i mean that's what they're for, basically ;)

 

*edit*: oh and i just remembered, i also did a small fix for the site's game search feature: http://psnprofiles.com/forums/topic/32107-bugsoddities-in-the-games-search-feature/?view=findpost&p=777278

 

dernop

Edited by dernop
Link to comment
Share on other sites

nice. i also once started to add some features i would like to see on the page to a custom userscript.

the first thing i did was showing/marking games i also own, including my progression, on the general games list and on other peoples profiles:

 

...

 

*edit*: oh and i just remembered, i also did a small fix for the site's game search feature: http://psnprofiles.com/forums/topic/32107-bugsoddities-in-the-games-search-feature/?view=findpost&p=777278

 

dernop

nice one with the search script, may i add this feature in my script? I'll add credit in the comments and on github (btw, feel free to fork the script and work on it: https://github.com/Barokai/psnprofiles-enhanced)

 

do you still have the script to mark your owned games?

 

If anybody finds any bugs or has ideas for it, post the here or directly on github (https://github.com/Barokai/psnprofiles-enhanced/issues), i'll work on it.

 

// edit: added question (script to mark owned games)

Edited by K--Force
Link to comment
Share on other sites

nice one with the search script, may i add this feature in my script? I'll add credit in the comments and on github (btw, feel free to fork the script and work on it: https://github.com/Barokai/psnprofiles-enhanced)

 

do you still have the script to mark your owned games?

 

sure, feel free to add it ;)

 

i should have the script still somewhere. thought i put it on my google drive, but can't find it there right now. 

gotta check my pc this evening at home, should be still installed as userscript there.

 

will reply here later today or tomorrow when i found it! :)

Link to comment
Share on other sites

Holy shit, this is awesome. Thanks a lot for making this. 

 

Is it technically possible to allow us to move the trophies' position? Like, dragging them into a certain order to help us stay organized?

Not a big deal, but it would be a cool addition if it's possible (and feasible).

 

Also, perhaps a button to load all of our games on our profile, rather than having to scroll through them to the bottom?

Edited by GIONAScm2
Link to comment
Share on other sites

do you still have the script to mark your owned games?

 

found it, here you go:

$(function() {

    // initialize psnp page/DOM information
    var psnp = {
        id: $('div.user-menu a.dropdown-toggle span').text(),
        _gamesTable: $('table#gamesTable'),  // game table on user profile
        _gameList: $('table#game_list'),
        _profileBar: $('div.profile-bar')
    };

    // psnp properties
    $.extend(psnp, {
        isProfile: psnp._gamesTable[0]!==undefined && psnp._profileBar[0]!==undefined,
        isOwnProfile: $(psnp._profileBar).find('div.info').text().indexOf(psnp.id) > -1,
        isGameList: psnp._gameList.length == 1,
        myGames: JSON.parse(localStorage.getItem('_mygames')) || {}
    });

    psnp.updateMyGames = function(games) {
        var count = 0;
        $.each(games, function(i, e) {
            psnp.myGames[e.id] = e;
            count++;
        });
        localStorage.setItem('_mygames', JSON.stringify(psnp.myGames));
        console.log(count + " games added/updated to localstorage.");
    };

    /*
        PROFILE / GAME LIST
    */
    psnp.gameList = (function(){
        if(!psnp.isProfile)
            return undefined;
        var _games = [];
        // register mutationobserver for gameList to handle 'load-on-scroll'
        var obs = new MutationObserver(function(mutations) {
            parseGames(); // just re-parse all games if list has changed.
        });
        obs.observe(psnp._gamesTable[0], { childList: true, subtree: true });

        // parse PSNP games table (id, name, completion, # of trophies)
        function parseGames()
        {
            _games = [];
            psnp._gamesTable.find('tr:has(a.bold)').each(function(i,row) {
                var title = $(row).find('a.bold')[0];
                var game = {
                    id: title.href.match(/\/trophies\/([^\/]+)/)[1],
                    name: title.innerText,
                    progress: $(row).find('div.progress_outer span').text(),
                    completed: $(row).hasClass('completed'),
                    platinum: $(row).hasClass('platinum'),
                    gold: $(row).find('li.gold').text(),
                    silver: $(row).find('li.silver').text(),
                    bronze: $(row).find('li.bronze').text(),
                };

                if(!psnp.isOwnProfile && psnp.myGames[game.id])
                {
                    var img = $(row).find('img.trophy_image');
                    img.removeClass('no-border').addClass('earned'); // mark owned games
                }

                _games.push(game);
            });

            // if this is our own profile, save the games list.
            if(psnp.isOwnProfile)
            {
                psnp.updateMyGames(_games);            
            }

        }

        // parse game list initially
        parseGames();

        return {
            games: _games
        };
    })();



    /*
        #GAMELIST#
        global list of games (psnprofiles.com/games)
    */

    // Mark owned game in "Games" list
    if(psnp.isGameList)
    {
        psnp._gameList.find('tr:has(a.bold)').each(function(i,row) {
            var title = $(row).find('a.bold')[0];    
            var id = title.href.match(/\/trophies\/([^\/"]+)/)[1];
            var img = $(row).find('img.trophy_image');

            // mark owned games
            if(psnp.myGames[id])
            {
                if(psnp.myGames[id].platinum)
                    $(row).addClass('platinum'); // add platinum row style
                if(psnp.myGames[id].completed)
                    $(row).addClass('completed'); // add completed row style

                img.removeClass('no-border').addClass('earned');
                if(psnp.myGames[id].progress != '100%')
                    img.css('border-color','yellow'); // 

                // add completion percentage
                var avgProgress = $(row).children('td:eq(4)').find('span.typo-top');
                console.log(avgProgress);
                avgProgress.text(psnp.myGames[id].progress + " / " + avgProgress.text());

            }            
        });
    }




});

it simply gathers the games you have from your own profile page (you have to be logged in for that to work). if you have more than 100 games you have to simply scroll down your list until you see every game. i added a mutation observer for that, _no extra calls_ are made to the psnp page/backend to keep the admin happy (that should basically be rule #1 if you're doing userscripts for a page) ;)

once it gathered all games and stored them to localstorage, it will mark your games (including your progress) on the general games' list and on other peoples profiles, so you can easily compare.

personally i use this feature to sort the games list by difficulty and check off easy platinums :P

Link to comment
Share on other sites

Holy shit, this is awesome. Thanks a lot for making this. 

 

Is it technically possible to allow us to move the trophies' position? Like, dragging them into a certain order to help us stay organized?

Not a big deal, but it would be a cool addition if it's possible (and feasible).

 

Also, perhaps a button to load all of our games on our profile, rather than having to scroll through them to the bottom?

 

What you ask for is possible, but the first is hard to do and takes a lot of time, must be stored as session data, and the second is not exactly along the lines of what Sly wants.

Link to comment
Share on other sites

What you ask for is possible, but the first is hard to do and takes a lot of time, must be stored as session data, and the second is not exactly along the lines of what Sly wants.

1. Ah that's fine then; It's not worth the effort, especially since the site's getting updated soon and we don't know all the new features it'll bring.

 

2. Why wouldn't Sly want that? Does it strain the entire website when you view hundreds of games or something? I don't see how it could be an issue, especially with only a minority of people using the extension & feature.

Link to comment
Share on other sites

Why wouldn't Sly want that? Does it strain the entire website when you view hundreds of games or something? I don't see how it could be an issue, especially with only a minority of people using the extension & feature.

 

I'm pretty sure it used to show all the games on a load, and Sly has implemented it so not all loads at the same time on purpose. This feature took a lot of extra effort, I'm sure. In other words, it's intentional and exists for a reason.

Link to comment
Share on other sites

  • 4 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...