Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
// ==UserScript==
// @name StackExchange hide new user's questions
// @description Hides questions from 1 rep users
// @version 1.2.5
// @author Paul Pinterits
// @include /^https?://(meta\.)?(stackoverflow|serverfault|superuser|(.*\.)?stackexchange)\.com(/questions(/tagged/.*)?)?/?$/
// @namespace Aran-Fey
// @require https://github.com/Aran-Fey/userscript-lib/raw/60f9b285091e93d3879c7e94233192b7ab370821/userscript_lib.js
// @require https://github.com/Aran-Fey/SE-userscript-lib/raw/763c94661583ca88491ab6c0616d1a5665224129/SE_userscript_lib.js
// @grant none
// @updateURL https://gist.github.com/Aran-Fey/421b9c3de872000101e79b5ec771898d/raw/SE_hide_new_users_questions.user.js
// @downloadURL https://gist.github.com/Aran-Fey/421b9c3de872000101e79b5ec771898d/raw/SE_hide_new_users_questions.user.js
// ==/UserScript==
(function() {
'use strict';
const MIN_REP = 2;
const MIN_SCORE = 0;
function hide_questions(){
for (const question of page.list_questions()){
if (question.author.reputation < MIN_REP || question.score < MIN_SCORE){
question.element.remove();
}
}
}
hide_questions();
page.on_new_questions_loaded.register(hide_questions);
})();
@wimglenn
Copy link

@Aran-Fey it stopped working recently with the UI changes :( can you revisit the selectors?

@Aran-Fey
Copy link
Author

@wimglenn Sorry, I can't reproduce your problem. The script still works perfectly fine as far as I can tell; the only thing I noticed is that it only runs on pages like this and not on the homepage.

I'm not active on SO anymore, but I heard something about reputation no longer being displayed. Is that the UI change you're referring to? The thing is, I can still see the users' reputation.

@wimglenn
Copy link

wimglenn commented Jan 27, 2022

Right, I'm sure it used to work on the homepage? Revision 1.2.3 specifically added the @include *://stackoverflow.com/ for this.

Yes, the reputation is still displayed, but the selector to identify those posts is no longer accurate. And it will likely break on all the other pages soon too once the UI change rolls out everywhere.

@Aran-Fey
Copy link
Author

You're right, it did work on the homepage. It seems the homepage has undergone a redesign, which caused the script to crash.

To clarify, do you only have this problem on the homepage, or everywhere? Other pages like this still work fine for me.

For now, I've made the script work on the homepage. If there's more that needs to be done, let me know.

@wimglenn
Copy link

wimglenn commented Jan 28, 2022

The problem was only on the homepage, but once the "eventually" in New post summary designs on site home pages and greatest hits now; everywhere else eventually comes around it would have broken on the questions/tagged pages too.

Looks like the revision 1.2.5 fixes it 👍

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