Created
February 16, 2015 20:32
-
-
Save lamchau/806135a06552f0f587f8 to your computer and use it in GitHub Desktop.
Clearing notifications on Quora
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
var clickElement = function(element) { | |
if (!element) { | |
return; | |
} | |
var event = document.createEvent('HTMLEvents'); | |
event.initEvent('click', true, true); | |
event.eventName = 'click'; | |
element.dispatchEvent(event); | |
}; | |
// TODO: create a bookmarklet | |
var selector = '[href^="/What-do-people-in-Silicon-Valley-plan-to-do-once-they-are-over-35/answer"]'; | |
Array.prototype.forEach.call(document.querySelectorAll(selector), function(element) { | |
var mark = element.parentNode.querySelector('a.mark_icon_wrapper'); | |
clickElement(mark); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment