Created
October 2, 2018 19:28
-
-
Save orenyomtov/9cc844604132189f755b4c3237e441f1 to your computer and use it in GitHub Desktop.
For educational purposes only
This file contains 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
//Follow all the users in the current Medium page | |
function filterNodeListByAttribute(nodeList, attributeName) { | |
let foundAttributeValues = [] | |
return Array.prototype.slice.call(nodeList).filter(function(node) { | |
let attributeValue = node.getAttribute(attributeName) | |
return foundAttributeValues.indexOf(attributeValue) == -1 && foundAttributeValues.push(attributeValue) | |
}) | |
} | |
filterNodeListByAttribute(document.querySelectorAll('*[data-action="toggle-subscribe-user"]:not(.is-active)'), 'data-action-value').forEach(subscribeButton => subscribeButton.click()) | |
//Unfollow all the users in the current Medium page | |
function filterNodeListByAttribute(nodeList, attributeName) { | |
let foundAttributeValues = [] | |
return Array.prototype.slice.call(nodeList).filter(function(node) { | |
let attributeValue = node.getAttribute(attributeName) | |
return foundAttributeValues.indexOf(attributeValue) == -1 && foundAttributeValues.push(attributeValue) | |
}) | |
} | |
filterNodeListByAttribute(document.querySelectorAll('*[data-action="toggle-subscribe-user"].is-active'), 'data-action-value').forEach(subscribeButton => subscribeButton.click()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment