Last active
June 9, 2020 10:21
-
-
Save thicknrich/e4cc2871462a6850fe8c to your computer and use it in GitHub Desktop.
Yammer Remove Join Notifications
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==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); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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