Skip to content

Instantly share code, notes, and snippets.

@thicknrich
Last active June 9, 2020 10:21
Show Gist options
  • Save thicknrich/e4cc2871462a6850fe8c to your computer and use it in GitHub Desktop.
Save thicknrich/e4cc2871462a6850fe8c to your computer and use it in GitHub Desktop.
Yammer Remove Join Notifications
// ==UserScript==
// @name Yammer Remove Join Notifications
// @namespace https://www.yammer.com/
// @include https://www.yammer.com/stonybrook.edu/*
// @include https://www.yammer.com/stonybrook.edu#/Threads/index?type=algo
// @include https://www.yammer.com/stonybrook.edu#/*
// @version 1
// ==/UserScript==
//load jQuery based on this SO Post:
//http://stackoverflow.com/questions/2246901/how-can-i-use-jquery-in-greasemonkey-scripts-in-google-chrome
// a function that loads jQuery and calls a callback function when jQuery has finished loading
function addJQuery(callback) {
var script = document.createElement("script");
script.setAttribute("src", "//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js");
script.addEventListener('load', function() {
var script = document.createElement("script");
script.textContent = "window.jQ=jQuery.noConflict(true);(" + callback.toString() + ")();";
document.body.appendChild(script);
}, false);
document.body.appendChild(script);
}
// the guts of this userscript
function main() {
// Note, jQ replaces $ to avoid conflicts.
setInterval(function() {
//if a item thread contains #joined, hide it
//check every 5 seconds.
jQ('.yj-thread-list-item:contains("#joined")').css("display", "none");
}, 5000);
}
// load jQuery and execute the main function
addJQuery(main);
@thicknrich
Copy link
Author

Copy and Paste This Script into text file.
Save as yammer.user.js
Open Chrome and navigate to (chrome://extensions)
Drag and Drop File to enable.

@kutekrish
Copy link

This is amazing. I spent a couple of hours to develop a Chrome plugin and this simple script does the job ! Hope I'd have seen this earlier

@jankais3r
Copy link

Wow, I had no idea that Chrome has integrated support for user scripts! Thanks buddy!

@James-UK
Copy link

James-UK commented May 4, 2016

Hi ThicknRich,

Really appreciate you sharing this script as I find it incredibly useful in our environment. A new manager has seen our Yammer membership jump exponentially, and each day the ratio of "#joined" posts to "real" posts sees the former outnumber the latter by 15 to 1 sometimes.

One tip I do have; in Chrome Version 50.0.2661.94 m (Windows), having added the extension I've found that the next time the browser is opened (next day in my case) Chrome throws a warning about the extension being added and hard-disables it, preventing it's re-activation.

Rather than having to keep deleting and re-installing it each day, I did some research and found that if you use "Tampermonkey", which is a user script management extension for Chrome, to execute your script, it is not blocked by Chrome, as Tampermonkey is a recognised Google Chrome Web Store extension.

You'd think by now you'd be able to tell Chrome what extension(s) you wanted to keep, if they were non-web store ones, like "self-signing" them or something, but hey... sigh

Would you be happy for me to submit your script to Tampermonkey to help spread it around (I'll ensure you are credited and provide a link back to your blog where possible etc).

Tampermonkey can be found at https://tampermonkey.net/ and https://chrome.google.com/webstore/detail/tampermonkey/ [string]

Thanks again and regards.

James Watson

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