HusKy Posted September 6, 2019 Author Share Posted September 6, 2019 Hey everyone, thanks for all the positive feedback. I will be pushing first small feature update which will add ability to order your backlog and filter by platform - similar to how it works in your games list. @DaivRules There are several guides available which you can use to get you up and running, for example this one. All in all, it requires some knowledge of JavaScript, HTML and CSS. I have written my first browser script maybe 10 years ago and I write code for a living so PSNP+ only took me couple hours to make overall. 2 Link to comment Share on other sites More sharing options...
MMDE Posted September 6, 2019 Share Posted September 6, 2019 (edited) 21 hours ago, Danny_Johansen said: @HusKy Psnp loads up the first 100 games so all the games after aren't loaded and they start loading when I open the backlog. If I first load the next batch of games in my profile it starts lower down the list and when I load them all, it won't load any. This is true, even though personally I auto load all. I doubt it would make a difference to the script though, as it has to run after that. Why is this script over 12 000 lines? And why is one of the lines over half a million in length? I won't be using this as I can't even really read what it does, and there's some strange stuff in it. The functionality it seems to provide doesn't seem all that complicated to create with some few simple classes and functions. I'm also questing why this was hosted on drobox, and no auto updates (guess that's actually a good thing in this case). Edited September 6, 2019 by MMDE Link to comment Share on other sites More sharing options...
HusKy Posted September 6, 2019 Author Share Posted September 6, 2019 20 minutes ago, MMDE said: Why is this script over 12 000 lines? And why is one of the lines over half a million in length? I won't be using this as I can't even really read what it does, and there's some strange stuff in it. The functionality it seems to provide doesn't seem all that complicated to create with some few simple classes and functions. I'm also questing why this was hosted on drobox, and no auto updates (guess that's actually a good thing in this case). The script is less than 12k lines, most of it is just bundled jQuery (10.5k). I needed something to quickly create UI elements and for creating backlog items. I will reduce the size in the next release and remove source maps (the long line you asked about). It's useful for getting error reports from users but I guess it can also cause confusion so I will just get rid of it. Actually, my code is just a bunch of classes that run according to which page is loaded. The code itself is harmless, it doesn't make any HTTP requests. The codebase is written in TypeScript and bundled with webpack if this technical info interests you. It's hosted on Dropbox because it's free and auto updates do work. The git repo I work in is hosted on GitHub and it's currently private. Link to comment Share on other sites More sharing options...
MMDE Posted September 6, 2019 Share Posted September 6, 2019 (edited) If this dude really want to continue making this stuff, he should make the code readable above all else. Here's some tips: Use external libraries, don't put that shit into the script. For example, if you want jquery, you can just do this at the start of the file: // @require https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js The site markup changes from time to time, and you may want to add more updates, so be ready for it and use the // @updateURL and // @downloadURL parameters. Where updateURL shouldn't be to the same URL, but rather one with only the first part of the script, as it's just checking the version. I see you include the script to run on all pages, perhaps you should limit the scope a bit more. Here's some examples: // @match https://psnprofiles.com/100-club/* // @match https://psnprofiles.com/trophies/* // @match https://psnprofiles.com/trophy/* // @match https://psnprofiles.com/*/log* // @match https://psnprofiles.com/game-leaderboard/* // @match https://psnprofiles.com/leaderboard* // @include /^https://psnprofiles\.com/[^/]+$/ If you want to add some more functionality, here's some more to fix: Direct link to someone's trophy list for that game when seeing them on a game leaderboard (not just to their profile). Fix sorting of trophy lists with missing timestamps. Fix the order of the trophy log, some of it goes missing from the pagination when you add enough "filter settings". Example, ugly as it may be: function logFix() { if (location.pathname.match(/\/.+?\/log.*/) !== null && location.pathname.match(/^\/trophies\//) === null) { var a, imgs = document.getElementsByClassName("game"); for (var i = 0; i < imgs.length; i++) { a = imgs[i].parentElement; a.setAttribute("href", a.getAttribute("href") + "?order=date"); } return true; } } Add an option to auto load all games, this is the code I use for this, which is mostly based on what Sly does. Don't mind how ugly it looks: function loadAllGames() { var gamesTable = $("#gamesTable > tbody"), page = 2, gp = location.search.substr(1); gp += (gp.length > 0 ? "&" : "") + "ajax=1&page="; function loadNextPage() { if ($("#load-more").length === 0) { addProfileButtons(); return; } $("#load-more").remove(); gamesTable.append("<tr id=\"table-loading\"><td colspan=\"6\"><div style=\"height: 100px;\"></div></td></tr>"); var opts = { method: "GET", url: location.pathname, data: gp+page, holder: "#table-loading div", success: function(data) { $("#table-loading").remove(); gamesTable.append(data.html); page = data.html.match(/nextPage = (\d+)/)[1]; if (page === "0") { addProfileButtons(); return; } loadNextPage(); } }; XHR(opts); } loadNextPage(); } 36 minutes ago, HusKy said: The script is less than 12k lines, most of it is just bundled jQuery (10.5k). I needed something to quickly create UI elements and for creating backlog items. I will reduce the size in the next release and remove source maps (the long line you asked about). It's useful for getting error reports from users but I guess it can also cause confusion so I will just get rid of it. Actually, my code is just a bunch of classes that run according to which page is loaded. The code itself is harmless, it doesn't make any HTTP requests. The codebase is written in TypeScript and bundled with webpack if this technical info interests you. It's hosted on Dropbox because it's free and auto updates do work. The git repo I work in is hosted on GitHub and it's currently private. Just require/include the jquery library as a link to google's hosting of it or something. I got no idea what it does or if it makes any HTTP requests as it's unreadable to me. And as far as I can see, the auto update stuff doesn't work, as you haven't added the correct parameters for this. Edited September 6, 2019 by MMDE should look better now 3 Link to comment Share on other sites More sharing options...
TheDarkBlade9 Posted September 6, 2019 Share Posted September 6, 2019 WOW. Great job, man! I will use it for sure. Link to comment Share on other sites More sharing options...
HusKy Posted September 6, 2019 Author Share Posted September 6, 2019 (edited) 1 hour ago, MMDE said: - snip - I'm not going to argue with you. If you want to discuss technical details, feel free to send me a PM or message via Discord. Edited September 6, 2019 by HusKy 1 Link to comment Share on other sites More sharing options...
Popular Post MMDE Posted September 6, 2019 Popular Post Share Posted September 6, 2019 1 minute ago, HusKy said: I'm not going to argue with you. If you want to discuss technical details, feel free to send me a PM or message via Discord. Argue? Dude, I just gave you shit ton of help improving your code... I recommend nobody touch the script until you've made it readable. 5 Link to comment Share on other sites More sharing options...
TheLakota Posted September 6, 2019 Share Posted September 6, 2019 15 minutes ago, MMDE said: Argue? Dude, I just gave you shit ton of help improving your code... I recommend nobody touch the script until you've made it readable. You helped, though you came off a bit passive aggressive with your "readable" comment. @HusKy I'll be adding this as soon as I return home. 3 Link to comment Share on other sites More sharing options...
Popular Post MMDE Posted September 6, 2019 Popular Post Share Posted September 6, 2019 (edited) 2 hours ago, TheLakota said: You helped, though you came off a bit passive aggressive with your "readable" comment. @HusKy I'll be adding this as soon as I return home. It's not readable, and can be written in some few lines... It's 12 000 lines... And you should beware these scripts can easily be malicious, and with so many lines and totally unreadable code, you never know. https://peterlaird.blogspot.com/2007/08/enterprise-greasemonkey-beware-of.html 2 hours ago, TheLakota said: I guess you don't understand why that's a problem... When it's promoted on the site, it should be safe, which we don't know if it is when it's not readable. One can easily argue it should be removed, which I haven't asked for, I told him how to make it more readable. Edited September 6, 2019 by MMDE 6 Link to comment Share on other sites More sharing options...
mackenzie129 Posted September 6, 2019 Share Posted September 6, 2019 (edited) 6 minutes ago, MMDE said: I guess you don't understand why that's a problem... I thought it was taught in basic grade school by this point, but I mean some people like to install malicious programs and you can't change that, I know I'm going to comb through it before I install it lol Good work and we'll appreciated @HusKy Edited September 6, 2019 by mackenzie129 Link to comment Share on other sites More sharing options...
BlackJudas Posted September 6, 2019 Share Posted September 6, 2019 I can appreciate the work you put into this, and thank you for propping up this community by investing your time and expertise in creating something everyone can benefit from. Hopefully you don't regret doing this by taking the negative responses to heart. 1 Link to comment Share on other sites More sharing options...
MMDE Posted September 6, 2019 Share Posted September 6, 2019 1 minute ago, mackenzie129 said: I thought it was taught in basic grade school by this point, but I mean some people like to install malicious programs and you can't change that, I know I'm going to comb through it before I install it lol Yeah, and one of the issues is he has been adding a lot of well known libraries into the code, which there is support to add properly by just linking to a trusted source. Just now, BlackJudas said: I can appreciate the work you put into this, and thank you for propping up this community by investing your time and expertise in creating something everyone can benefit from. Hopefully you don't regret doing this by taking the negative responses to heart. If he works with this stuff, he should be used to code review IMO, so I don't know why he'd take it personal. And as he says, it only took him a couple of hours... Link to comment Share on other sites More sharing options...
Popular Post panikooooos Posted September 6, 2019 Popular Post Share Posted September 6, 2019 3 minutes ago, MMDE said: Yeah, and one of the issues is he has been adding a lot of well known libraries into the code, which there is support to add properly by just linking to a trusted source. How likely do you find it that a guy with 66 plats, 700 rep and many guides would just wake up one day and write 12k lines of code with "malicious content" in it? There's being careful and there's being paranoid. Has the guy ever given you any reason to suspect he has malicious intent? You have all these suggestions for his project, but in the end it's his code after all, if you know all about coding why don't you make an extension instead of critiquing? 5 Link to comment Share on other sites More sharing options...
TheLakota Posted September 6, 2019 Share Posted September 6, 2019 15 minutes ago, MMDE said: I guess you don't understand why that's a problem... When it's promoted on the site, it should be safe, which we don't know if it is when it's not readable. One can easily argue it should be removed, which I haven't asked for, I told him how to make it more readable. I guess you still don't understand your language could be perceived as dickheaded. I'm going to remove myself from this public conversation, though if you'd like to continue this via PM, feel welcome to (please don't). 4 Link to comment Share on other sites More sharing options...
Popular Post MMDE Posted September 6, 2019 Popular Post Share Posted September 6, 2019 (edited) 22 minutes ago, panikooooos said: How likely do you find it that a guy with 66 plats, 700 rep and many guides would just wake up one day and write 12k lines of code with "malicious content" in it? There's being careful and there's being paranoid. Has the guy ever given you any reason to suspect he has malicious intent? You have all these suggestions for his project, but in the end it's his code after all, if you know all about coding why don't you make an extension instead of critiquing? Which is why I haven't asked for it to be deleted... The worst part of your argument, which I disagree with you about is the part about the 12k lines of code. That's the problem. Obviously he didn't write it, but you don't know if he tempered with it, and you can hide shit in those lines. And there's absolutely no good reason to do it like that. Also, one of the lines is over a half million characters... it's about 900 000 characters in that file. Nobody is gonna read that. Like 500 000 of those characters or something could be removed if he just did this at the start of the file: // @require https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js That's it, that's all it takes. My guess is, his actual code is like a couple of hundred lines. There's no excuse for it being 12 000, and I'm going lightly on him for this I think. Edited September 6, 2019 by MMDE 9 Link to comment Share on other sites More sharing options...
Popular Post freddie1989 Posted September 6, 2019 Popular Post Share Posted September 6, 2019 Perhaps if the site was doing the updates people request then users wouldn't have to. So instead of being a negative dick about it try a short well done..... Great work pal, much appreciated! 16 Link to comment Share on other sites More sharing options...
panikooooos Posted September 6, 2019 Share Posted September 6, 2019 4 minutes ago, MMDE said: Which is why I haven't asked for it to be deleted... The worst part of your argument, which I disagree with you about is the part about the 12k lines of code. That's the problem. Obviously he didn't write it, but you don't know if he tempered with it, and you can hide shit in those lines. And there's absolutely no good reason to do it like that. Also, one of the lines is over a half million characters... it's about 900 000 characters in that file. Nobody is gonna read that. I mean come on, do you really expect me to believe you only install open source software in your pc and meticulously check every line? Sometimes you trust your instincts, what's the most probable scenario here? The guy wanted to help the psnp community and as most coders do, left in some complicated non readable code, which could have been improved, but it worked so he left it there. Presumption of innocence, is all I'm saying Link to comment Share on other sites More sharing options...
MMDE Posted September 6, 2019 Share Posted September 6, 2019 (edited) 4 minutes ago, panikooooos said: I mean come on, do you really expect me to believe you only install open source software in your pc and meticulously check every line? Sometimes you trust your instincts, what's the most probable scenario here? The guy wanted to help the psnp community and as most coders do, left in some complicated non readable code, which could have been improved, but it worked so he left it there. Presumption of innocence, is all I'm saying I install software from companies I trust too, and I usually want to know the bad sides of them like the business model etc. But as I told you, this can so easily be avoided. It's less work avoiding it than keeping it. Edited September 6, 2019 by MMDE 2 Link to comment Share on other sites More sharing options...
Abysm_Nucleus Posted September 6, 2019 Share Posted September 6, 2019 I haven't clicked a link that fast before. Thanks for all your effort. Oh by the way PSNP crew are working on useless implementations, right? LOL. 2 Link to comment Share on other sites More sharing options...
MMDE Posted September 6, 2019 Share Posted September 6, 2019 (edited) 2 minutes ago, Abysm_Nucleus said: I haven't clicked a link that fast before. Thanks for all your effort. Oh by the way PSNP crew are working on useless implementations, right? LOL. Crew? Useless implementations? Sly made this web site. Edited September 6, 2019 by MMDE 1 Link to comment Share on other sites More sharing options...
Popular Post HusKy Posted September 6, 2019 Author Popular Post Share Posted September 6, 2019 I really didn't think things would turn out this way, but I will provide some info about this script and it's internals. Before I start, I will just say that if you don't trust this script, you don't need to use it and that's fine. The script is written in TypeScript and bundled with a tool (webpack) which allows it to run in a web browser. Actual source code without libraries is 1023 lines of code - includes typescript code, html and css. jQuery This library is part of the bundle and comes from https://www.npmjs.com/package/jquery which is an official distribution channel. For what it's worth, I'm planning to remove it as it's not suitable for what I need, but I will continue bundling all of the source code in. I won't be using remote URL for it for the time being. 6 Link to comment Share on other sites More sharing options...
Abysm_Nucleus Posted September 6, 2019 Share Posted September 6, 2019 Just now, HusKy said: I really didn't think things would turn out this way, but I will provide some info about this script and it's internals. Before I start, I will just say that if you don't trust this script, you don't need to use it and that's fine. The script is written in TypeScript and bundled with a tool (webpack) which allows it to run in a web browser. Actual source code without libraries is 1023 lines of code - includes typescript code, html and css. jQuery This library is part of the bundle and comes from https://www.npmjs.com/package/jquery which is an official distribution channel. For what it's worth, I'm planning to remove it as it's not suitable for what I need, but I will continue bundling all of the source code in. I won't be using remote URL for it for the time being. Don't worry. I have used it already. You can milk bitcoin from my PC which has 1080Ti. No worries. 2 Link to comment Share on other sites More sharing options...
Popular Post BlindMango Posted September 6, 2019 Popular Post Share Posted September 6, 2019 7 minutes ago, MMDE said: Sly made this web site. True, but there hasn't been any major features added to the site for two years. I understand your desire to make sure the code is safe and all, but I mean this is nice for people that don't want to wait around for features to be officially implement that they've been requesting for years. Plus it's optional, it's up to people if they want to use it or not. If malicious code is found, we can take this post down - easy peasy 29 Link to comment Share on other sites More sharing options...
Popular Post WatertownsFinest Posted September 6, 2019 Popular Post Share Posted September 6, 2019 LOL, we've gotten to the point where the users of the site are the only ones making useful updates/additions to the site. Big ups to @HusKy for the awesome addition, its just sad to see this kind of commitment from someone who doesnt even work on the site. Meanwhile its taken god knows how long for the badges. Idk, just food for thought. 18 Link to comment Share on other sites More sharing options...
Popular Post HusKy Posted September 6, 2019 Author Popular Post Share Posted September 6, 2019 Thank you @WatertownsFinest @BlindMango @Abysm_Nucleus and others for your positive words. I can assure that I'm not planning to hack anyone with this. ? I will release the ordering/filtering update this weekend. 22 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now