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.4
// @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/4369a5f1208fc0dddc37e43435913e1d9c2cb365/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 REP_LIMIT = 1;
const MIN_SCORE = 1;
function hide_questions(){
const posts = document.getElementsByClassName('question-summary');
for(const post of [...posts]){
// check the poster's reputation
const rep = parseInt(post.querySelector('.reputation-score').textContent);
if (rep > REP_LIMIT){
continue;
}
// check the question's score
const score = parseInt(post.querySelector('.votes span').textContent);
if (score >= MIN_SCORE){
continue;
}
post.remove();
}
}
hide_questions();
page.on_new_questions_loaded.register(hide_questions);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment