Skip to main content
Un-broke the script from the latest change to user profiles.
Source Link
Little Nuts
  • 751
  • 1
  • 4
  • 11
// ==UserScript==
// @name         Stack Collectives Off
// @namespace    scratte-fiddlings
// @version      0.68
// @description  Pretending Collectives don't exist
// @author       Scratte (stackoverflow.com/users/12695027)
// @include      https://stackoverflow.com/*
// @exclude      https://stackoverflow.com/collectives*
// @grant        none
// ==/UserScript==

// NOTE: The script does not remove the "Explore Collectives" on the left sidebar.
//       It's still possible to go to a collectives site and check them out.

(function() {
    'use strict';

    // Start with user profiles (since Stack removed the defining class on the links).
    document.querySelector("a[href*='\/collectives\/']")
           // Another optimization suggested by Oleg Valter
           // https://chat.stackoverflow.com/transcript/message/52657512#52657512
           ?.closest("div.grid--item")
           ?.remove();

    // Suggested by Oleg Valter (https://stackoverflow.com/users/11407695)
    // https://chat.stackoverflow.com/transcript/message/52657173#52657173
    const mostCollectivesStuff =
              [
                  // the collective on the home page right sidebar
                  ".js-join-leave-container",
                  // both 1: the collective icons from posts on the home page
                  //      2: the award icons from user cards on posts
                  "a[href*='\/collectives\/']:not(#nav-collective-discover):not(.s-card)",
                  // the particular collective in the sidebar on posts
                  ".sidebar-subcommunity",
              ];

    const postCollectivesStuff =
              [
                  // orange affiliation banner from user profiles on posts
                  ".affiliate-badge",
                  // "Answer recommended by ..."
                  ".js-endorsements",
                  // recognized member icon in comments.
                  "div.comment-body span[title='Recognized Member']"
              ];

    document.querySelectorAll(mostCollectivesStuff.concat(postCollectivesStuff).join()) // "," is default
            .forEach(e => e.remove());

    const removePostCollectives = () => document.querySelectorAll(postCollectivesStuff.join()) // "," is default
            .forEach(e => e.remove());

    // Additionally remove the entire collective box from user profiles
    document.querySelector("a[href*=collectives].s-card")
           // Another optimization suggested by Oleg Valter
           // https://chat.stackoverflow.com/transcript/message/52657512#52657512
           ?.closest("div.flex--item")
           ?.remove();

    // And the list item saying "X user groups" from user profiles
    document.querySelector("ul div[aria-describedby=groups-popover]")
           ?.closest("li.flex--item")
           ?.remove();

    $(document) // needed for it to work with updates as in reviews
        .ajaxComplete((event, request, settings) => {
            removePostCollectives();
         });

})();
// ==UserScript==
// @name         Stack Collectives Off
// @namespace    scratte-fiddlings
// @version      0.6
// @description  Pretending Collectives don't exist
// @author       Scratte (stackoverflow.com/users/12695027)
// @include      https://stackoverflow.com/*
// @exclude      https://stackoverflow.com/collectives*
// @grant        none
// ==/UserScript==

// NOTE: The script does not remove the "Explore Collectives" on the left sidebar.
//       It's still possible to go to a collectives site and check them out.

(function() {
    'use strict';

    // Suggested by Oleg Valter (https://stackoverflow.com/users/11407695)
    // https://chat.stackoverflow.com/transcript/message/52657173#52657173
    const mostCollectivesStuff =
              [
                  // the collective on the home page right sidebar
                  ".js-join-leave-container",
                  // both 1: the collective icons from posts on the home page
                  //      2: the award icons from user cards on posts
                  "a[href*='\/collectives\/']:not(#nav-collective-discover):not(.s-card)",
                  // the particular collective in the sidebar on posts
                  ".sidebar-subcommunity",
              ];

    const postCollectivesStuff =
              [
                  // orange affiliation banner from user profiles on posts
                  ".affiliate-badge",
                  // "Answer recommended by ..."
                  ".js-endorsements",
                  // recognized member icon in comments.
                  "div.comment-body span[title='Recognized Member']"
              ];

    document.querySelectorAll(mostCollectivesStuff.concat(postCollectivesStuff).join()) // "," is default
            .forEach(e => e.remove());

    const removePostCollectives = () => document.querySelectorAll(postCollectivesStuff.join()) // "," is default
            .forEach(e => e.remove());

    // Additionally remove the entire collective box from user profiles
    document.querySelector("a[href*=collectives].s-card")
           // Another optimization suggested by Oleg Valter
           // https://chat.stackoverflow.com/transcript/message/52657512#52657512
           ?.closest("div.flex--item")
           ?.remove();

    // And the list item saying "X user groups" from user profiles
    document.querySelector("ul div[aria-describedby=groups-popover]")
           ?.closest("li.flex--item")
           ?.remove();

    $(document) // needed for it to work with updates as in reviews
        .ajaxComplete((event, request, settings) => {
            removePostCollectives();
         });

})();
// ==UserScript==
// @name         Stack Collectives Off
// @namespace    scratte-fiddlings
// @version      0.8
// @description  Pretending Collectives don't exist
// @author       Scratte (stackoverflow.com/users/12695027)
// @include      https://stackoverflow.com/*
// @exclude      https://stackoverflow.com/collectives*
// @grant        none
// ==/UserScript==

// NOTE: The script does not remove the "Explore Collectives" on the left sidebar.
//       It's still possible to go to a collectives site and check them out.

(function() {
    'use strict';

    // Start with user profiles (since Stack removed the defining class on the links).
    document.querySelector("a[href*='\/collectives\/']")
           // Another optimization suggested by Oleg Valter
           // https://chat.stackoverflow.com/transcript/message/52657512#52657512
           ?.closest("div.grid--item")
           ?.remove();

    // Suggested by Oleg Valter (https://stackoverflow.com/users/11407695)
    // https://chat.stackoverflow.com/transcript/message/52657173#52657173
    const mostCollectivesStuff =
              [
                  // the collective on the home page right sidebar
                  ".js-join-leave-container",
                  // both 1: the collective icons from posts on the home page
                  //      2: the award icons from user cards on posts
                  "a[href*='\/collectives\/']:not(#nav-collective-discover)",
                  // the particular collective in the sidebar on posts
                  ".sidebar-subcommunity",
              ];

    const postCollectivesStuff =
              [
                  // orange affiliation banner from user profiles on posts
                  ".affiliate-badge",
                  // "Answer recommended by ..."
                  ".js-endorsements",
                  // recognized member icon in comments.
                  "div.comment-body span[title='Recognized Member']"
              ];

    document.querySelectorAll(mostCollectivesStuff.concat(postCollectivesStuff).join()) // "," is default
            .forEach(e => e.remove());

    const removePostCollectives = () => document.querySelectorAll(postCollectivesStuff.join()) // "," is default
            .forEach(e => e.remove());

    // And the list item saying "X user groups" from user profiles
    document.querySelector("ul div[aria-describedby=groups-popover]")
           ?.closest("li.flex--item")
           ?.remove();

    $(document) // needed for it to work with updates as in reviews
        .ajaxComplete((event, request, settings) => {
            removePostCollectives();
         });

})();
Added recognized member icon in comments
Source Link
Little Nuts
  • 751
  • 1
  • 4
  • 11
// ==UserScript==
// @name         Stack Collectives Off
// @namespace    scratte-fiddlings
// @version      0.56
// @description  Pretending Collectives don't exist
// @author       Scratte (stackoverflow.com/users/12695027)
// @include      https://stackoverflow.com/*
// @exclude      https://stackoverflow.com/collectives*
// @grant        none
// ==/UserScript==

// NOTE: The script does not remove the "Explore Collectives" on the left sidebar.
//       It's still possible to go to a collectives site and check them out.

(function() {
    'use strict';

    // Suggested by Oleg Valter (https://stackoverflow.com/users/11407695)
    // https://chat.stackoverflow.com/transcript/message/52657173#52657173
    const mostCollectivesStuff =
              [
                  // the collective on the home page right sidebar
                  ".js-join-leave-container",
                  // both 1: the collective icons from posts on the home page
                  //      2: the award icons from user cards on posts
                  "a[href*='\/collectives\/']:not(#nav-collective-discover):not(.s-card)",
                  // the particular collective in the sidebar on posts
                  ".sidebar-subcommunity",
              ];

    const postCollectivesStuff =
              [
                  //  orange affiliation banner from user profiles on posts
                  ".affiliate-badge",
                  // "Answer recommended by ..."
                  ".js-endorsements",
                  // recognized member icon in comments.
                  "div.comment-body span[title='Recognized Member']"
              ];

    document.querySelectorAll(mostCollectivesStuff.concat(postCollectivesStuff).join()) // "," is default
            .forEach(e => e.remove());

    const removePostCollectives = () => document.querySelectorAll(postCollectivesStuff.join()) // "," is default
            .forEach(e => e.remove());

    // Additionally remove the entire collective box from user profiles
    document.querySelector("a[href*=collectives].s-card")
           // Another optimization suggested by Oleg Valter
           // https://chat.stackoverflow.com/transcript/message/52657512#52657512
           ?.closest("div.flex--item")
           ?.remove();

    // And the list item saying "X user groups" from user profiles
    document.querySelector("ul div[aria-describedby=groups-popover]")
           ?.closest("li.flex--item")
           ?.remove();

    $(document) // needed for it to work with updates as in reviews
        .ajaxComplete((event, request, settings) => {
            removePostCollectives();
         });

})();
// ==UserScript==
// @name         Stack Collectives Off
// @namespace    scratte-fiddlings
// @version      0.5
// @description  Pretending Collectives don't exist
// @author       Scratte (stackoverflow.com/users/12695027)
// @include      https://stackoverflow.com/*
// @exclude      https://stackoverflow.com/collectives*
// @grant        none
// ==/UserScript==

// NOTE: The script does not remove the "Explore Collectives" on the left sidebar.
//       It's still possible to go to a collectives site and check them out.

(function() {
    'use strict';

    // Suggested by Oleg Valter (https://stackoverflow.com/users/11407695)
    // https://chat.stackoverflow.com/transcript/message/52657173#52657173
    const mostCollectivesStuff =
              [
                  // the collective on the home page right sidebar
                  ".js-join-leave-container",
                  // both 1: the collective icons from posts on the home page
                  //      2: the award icons from user cards on posts
                  "a[href*='\/collectives\/']:not(#nav-collective-discover):not(.s-card)",
                  // the particular collective in the sidebar on posts
                  ".sidebar-subcommunity",
              ];

    const postCollectivesStuff =
              [
                  //  orange affiliation banner from user profiles on posts
                  ".affiliate-badge",
                  // "Answer recommended by ..."
                  ".js-endorsements"
              ];

    document.querySelectorAll(mostCollectivesStuff.concat(postCollectivesStuff).join()) // "," is default
            .forEach(e => e.remove());

    const removePostCollectives = () => document.querySelectorAll(postCollectivesStuff.join()) // "," is default
            .forEach(e => e.remove());

    // Additionally remove the entire collective box from user profiles
    document.querySelector("a[href*=collectives].s-card")
           // Another optimization suggested by Oleg Valter
           // https://chat.stackoverflow.com/transcript/message/52657512#52657512
           ?.closest("div.flex--item")
           ?.remove();

    // And the list item saying "X user groups" from user profiles
    document.querySelector("ul div[aria-describedby=groups-popover]")
           ?.closest("li.flex--item")
           ?.remove();

    $(document) // needed for it to work with updates as in reviews
        .ajaxComplete((event, request, settings) => {
            removePostCollectives();
         });

})();
// ==UserScript==
// @name         Stack Collectives Off
// @namespace    scratte-fiddlings
// @version      0.6
// @description  Pretending Collectives don't exist
// @author       Scratte (stackoverflow.com/users/12695027)
// @include      https://stackoverflow.com/*
// @exclude      https://stackoverflow.com/collectives*
// @grant        none
// ==/UserScript==

// NOTE: The script does not remove the "Explore Collectives" on the left sidebar.
//       It's still possible to go to a collectives site and check them out.

(function() {
    'use strict';

    // Suggested by Oleg Valter (https://stackoverflow.com/users/11407695)
    // https://chat.stackoverflow.com/transcript/message/52657173#52657173
    const mostCollectivesStuff =
              [
                  // the collective on the home page right sidebar
                  ".js-join-leave-container",
                  // both 1: the collective icons from posts on the home page
                  //      2: the award icons from user cards on posts
                  "a[href*='\/collectives\/']:not(#nav-collective-discover):not(.s-card)",
                  // the particular collective in the sidebar on posts
                  ".sidebar-subcommunity",
              ];

    const postCollectivesStuff =
              [
                  // orange affiliation banner from user profiles on posts
                  ".affiliate-badge",
                  // "Answer recommended by ..."
                  ".js-endorsements",
                  // recognized member icon in comments.
                  "div.comment-body span[title='Recognized Member']"
              ];

    document.querySelectorAll(mostCollectivesStuff.concat(postCollectivesStuff).join()) // "," is default
            .forEach(e => e.remove());

    const removePostCollectives = () => document.querySelectorAll(postCollectivesStuff.join()) // "," is default
            .forEach(e => e.remove());

    // Additionally remove the entire collective box from user profiles
    document.querySelector("a[href*=collectives].s-card")
           // Another optimization suggested by Oleg Valter
           // https://chat.stackoverflow.com/transcript/message/52657512#52657512
           ?.closest("div.flex--item")
           ?.remove();

    // And the list item saying "X user groups" from user profiles
    document.querySelector("ul div[aria-describedby=groups-popover]")
           ?.closest("li.flex--item")
           ?.remove();

    $(document) // needed for it to work with updates as in reviews
        .ajaxComplete((event, request, settings) => {
            removePostCollectives();
         });

})();
Added link to repository
Source Link
Little Nuts
  • 751
  • 1
  • 4
  • 11

Download

GitHub | Install

Download

GitHub | Install

Account for "X user groups" on user profiles
Source Link
Little Nuts
  • 751
  • 1
  • 4
  • 11
Loading
Making it work in reviews too.
Source Link
Little Nuts
  • 751
  • 1
  • 4
  • 11
Loading
Fixed bug as per https://stackapps.com/a/9045/66653
Source Link
Little Nuts
  • 751
  • 1
  • 4
  • 11
Loading
edited body; edited tags
Source Link
Glorfindel
  • 6.9k
  • 3
  • 22
  • 49
Loading
added 13 characters in body
Source Link
Little Nuts
  • 751
  • 1
  • 4
  • 11
Loading
Added tested environments.
Source Link
Little Nuts
  • 751
  • 1
  • 4
  • 11
Loading
edited title
Link
Little Nuts
  • 751
  • 1
  • 4
  • 11
Loading
Remove duplicate header
Source Link
Little Nuts
  • 751
  • 1
  • 4
  • 11
Loading
Source Link
Little Nuts
  • 751
  • 1
  • 4
  • 11
Loading