Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion blinder.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,17 @@ 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
];

Blinder.defaults = {
anonymousName: 'A Candidate',
anonymousNameForText: 'Candidate',
anonymousEmail: 'hidden@example.com',
anonymousLocation: 'Anytown, Earth',
anonymousWebsite: 'https://www.google.com',
}

///////////////////////////////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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) {
Expand Down
6 changes: 5 additions & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -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 <jason@fieldbook.com>",

Expand Down Expand Up @@ -35,6 +35,10 @@
{
"matches": ["*://app.greenhouse.io/people/*"],
"js": ["blinder.js", "sites/greenhouse.js"]
},
{
"matches": ["*://github.com/*"],
"js": ["blinder.js", "sites/github.js"]
}
]
}
66 changes: 66 additions & 0 deletions sites/github.js
Original file line number Diff line number Diff line change
@@ -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');
})
});