Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create disable #70

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
43 changes: 43 additions & 0 deletions disable
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
(function(){
var ownerProfileId = ''; //SET THIS TO YOUR PROFILE ID
var wrapperId = '[id^="pagelet_timeline_app_collection_' + ownerProfileId + '"]';
var profileIdRegex = /.+\?id=(\d+).+/g;

var friendsBoxesWrapper = document.querySelector(wrapperId);
var friendsBoxesLists = friendsBoxesWrapper.getElementsByTagName('ul');

for (var i = 0; i < friendsBoxesLists.length; i++) {
var friendsBoxes = friendsBoxesLists[i].getElementsByTagName('li');

for (var j = 0; j < friendsBoxes.length; j++) {
var profileLink = friendsBoxes[j].getElementsByTagName('a')[0];
var profileHoverCard = profileLink.getAttribute('data-hovercard');

var matches, profileId;
while ((matches = profileIdRegex.exec(profileHoverCard)) !== null) {
// This is necessary to avoid infinite loops with zero-width matches
if (matches.index === profileIdRegex.lastIndex) {
profileIdRegex.lastIndex++;
}

profileId = matches[1] || null;
}

if (profileId) {
var deleteLink = document.createElement('a');
deleteLink.className = 'itemAnchor';
deleteLink.setAttribute('role', 'menuitem');
deleteLink.setAttribute('tabindex', '-1');
deleteLink.setAttribute('ajaxify', '/ajax/profile/removefriendconfirm.php?uid=' + profileId + '&unref=bd_friends_tab&floc=friends_tab');
deleteLink.setAttribute('href', '#');
deleteLink.setAttribute('rel', 'async-post');
deleteLink.innerHTML = '<span class="itemLabel fsm">Unfriend</span>';

document.getElementById('globalContainer').appendChild(deleteLink);
deleteLink.click();
}
}
}
})();
$ git branch -m add-readme.md
$ git push origin add-montes120792