Created
June 15, 2018 16:24
-
-
Save barvian/1cb6e32e0a69f8e32bdd2653a0ab9dc2 to your computer and use it in GitHub Desktop.
Add Likes menu item to Dribbble profile dropdown.
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
// ==UserScript== | |
// @name Dribbble Likes | |
// @namespace http://barvian.me/ | |
// @version 1.0.0 | |
// @description Add Likes to Dribbble profile dropdown | |
// @author Maxwell Barvian | |
// @match *://dribbble.com/* | |
// ==/UserScript== | |
(function (window, document, undefined) { | |
// Duplicate the buckets item | |
let bucketsItem = document.querySelector('#t-profile .tabs a[href*="buckets"]').parentNode | |
while (!bucketsItem.webkitMatchesSelector('li')) { | |
bucketsItem = bucketsItem.parentNode | |
} | |
const likesItem = bucketsItem.cloneNode(true) | |
const likesItemLink = likesItem.querySelector('a') | |
likesItemLink.setAttribute('href', | |
likesItemLink.getAttribute('href').replace('buckets', 'likes') | |
) | |
likesItemLink.innerHTML = likesItemLink.innerHTML.replace('Buckets', 'Likes') | |
// Insert Likes item before Buckets item | |
bucketsItem.parentNode.insertBefore(likesItem, bucketsItem) | |
})(window, document) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment