diff --git a/blinder.js b/blinder.js index 4fd4dbb..1821c78 100644 --- a/blinder.js +++ b/blinder.js @@ -27,6 +27,8 @@ Blinder.params = [ 'anonymousName', // Placeholder text to blind candidate names with 'anonymousNameForText', // Placeholder text for replacing a candidate name in a paragraph of text 'anonymousEmail', // Placeholder text to blind candidate emails with + 'anonymousLocation', // Placeholder text to blind candidate location with + 'anonymousWebsite', // Placeholder text to blind candidate location with 'anonymousImgSrc', // Source URL of a placeholder image. This is typically a per-site setting ]; @@ -34,6 +36,8 @@ Blinder.defaults = { anonymousName: 'A Candidate', anonymousNameForText: 'Candidate', anonymousEmail: 'hidden@example.com', + anonymousLocation: 'Anytown, Earth', + anonymousWebsite: 'https://www.google.com', } /////////////////////////////////////////////////////////////////////////////////////////////////// @@ -132,7 +136,7 @@ Blinder.prototype.blind = function (selectorOrElement, fn) { self.blindElement(element, fn); } -// Invokes the given function on the given element (or the element matching the given seletor). +// Invokes the given function on the given element (or the element matching the given selector). // Used to drill one level into the DOM tree. Blinder.prototype.blindElement = function (selectorOrElement, fn) { var element = this.lookupElementIfNeeded(selectorOrElement); @@ -167,6 +171,18 @@ Blinder.prototype.blindEmail = function (selectorOrElement) { if (element) element.textContent = this.options.anonymousEmail; } +// Replaces the text of the given element with the configured anonymous location. +Blinder.prototype.blindLocation = function (selectorOrElement) { + var element = this.lookupElementIfNeeded(selectorOrElement); + if (element) element.textContent = this.options.anonymousLocation; +} + +// Replaces the text of the given element with the configured anonymous Website. +Blinder.prototype.blindWebsite = function (selectorOrElement) { + var element = this.lookupElementIfNeeded(selectorOrElement); + if (element) element.textContent = this.options.anonymousWebsite; +} + // Replaces the src property of the given image element with the configured anonymous image src // property. The element must be an IMG element. Blinder.prototype.blindPic = function (selectorOrElement) { diff --git a/manifest.json b/manifest.json index 784b0ea..8909e52 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "manifest_version": 2, "name": "Blind Audition", - "version": "0.5", + "version": "0.6", "description": "Anonymizes candidates on recruiting sites", "author": "Jason Crawford ", @@ -35,6 +35,10 @@ { "matches": ["*://app.greenhouse.io/people/*"], "js": ["blinder.js", "sites/greenhouse.js"] + }, + { + "matches": ["*://github.com/*"], + "js": ["blinder.js", "sites/github.js"] } ] } diff --git a/sites/github.js b/sites/github.js new file mode 100644 index 0000000..b1b05df --- /dev/null +++ b/sites/github.js @@ -0,0 +1,66 @@ +var blinder = new Blinder({anonymousImgSrc: 'https://github.com/identicons/anyone.png'}); + +var fullNameElement = document.querySelector('.vcard-fullname'); +var fullName = fullNameElement ? fullNameElement.innerText : false; + +var userNameElement = document.querySelector('.p-nickname'); +var username = userNameElement ? userNameElement.innerText : false; + +blinder.blind('body', function () { + // Remove name from tab title + document.title = "Candidate Github Profile"; + this.blindPic('.avatar'); + + this.blindElements('.h-card', function () { + this.blindPic('.avatar'); + this.blindName('.vcard-fullname'); + + this.blindEmail('.vcard-details [itemprop="email"]'); + this.blindLocation('.vcard-details [itemprop="homeLocation"]'); + this.blindWebsite('.vcard-details [itemprop="url"]'); + }) + + // Blind elements in sticky bar + this.blindElements('.user-profile-sticky-bar', function () { + this.blindName('.user-profile-mini-vcard span strong'); + this.blindPic('.avatar-user'); + }) + + // Blind avatar in PRs + this.blindElements('.pull-discussion-timeline', function () { + this.blindPic('.avatar-user img'); + this.blindPic('.avatar-user'); + }) + + this.blindElements( '.participant-avatar', function() { + this.blindPic('.avatar-user'); + }) + + // Hide avatar in commits & Issues + this.blindElements('.TimelineItem-body', function () { + this.blindPic('.avatar-user'); + this.blindPic('.avatar-user img'); + }) + + this.blindElements('.AvatarStack-body', function () { + this.blindPic('.avatar-user img'); + }) + + this.blindElements('.TimelineItem-avatar', function () { + this.blindPic('.avatar'); + this.blindPic('img'); + }) + + // PR sidebar + this.blindElements('.d-flex', function () { + this.blindPic('.avatar'); + }) + + + // Blind avatars in popups from hover actions + this.blindElements('.Popover', function () { + this.blindPic('.avatar-user'); + this.blindName('.Link--primary'); + this.blindName('.Link--secondary'); + }) +}); \ No newline at end of file