Skip to content

Instantly share code, notes, and snippets.

@barvian
Created June 15, 2018 16:24
Show Gist options
  • Save barvian/1cb6e32e0a69f8e32bdd2653a0ab9dc2 to your computer and use it in GitHub Desktop.
Save barvian/1cb6e32e0a69f8e32bdd2653a0ab9dc2 to your computer and use it in GitHub Desktop.
Add Likes menu item to Dribbble profile dropdown.
// ==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