Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name Add links to old lemmy world community bar
- // @namespace http://tampermonkey.net/
- // @version 0.1
- // @description Allows you to customise the community bar at the top of the old lemmy desktop client.
- // @author You
- // @match https://old.lemmy.world/*
- // @icon https://www.google.com/s2/favicons?sz=64&domain=lemmy.world
- // @grant none
- // ==/UserScript==
- (function() {
- 'use strict';
- const communitiesToAdd = [
- 'gunners',
- 'football',
- 'ukcasual',
- 'unitedkingdom@feddit.uk',
- 'uk_politics@feddit.uk',
- 'android@lemdro.id',
- ];
- const addCommunityToBar = (name) => {
- const shortName = name.split('@')[0];
- const a = document.createElement('a');
- const link = document.createTextNode(shortName);
- const separator = document.createTextNode(" - ");
- a.appendChild(link);
- a.href = `/c/${name}`;
- a.title = `Go to /c/${shortName}`;
- const communities = document.querySelector('.communities')
- const firstLink = document.querySelector('.communities a:nth-child(5)')
- communities.insertBefore(separator, firstLink);
- communities.insertBefore(a, separator);
- }
- communitiesToAdd.reverse().map(addCommunityToBar)
- })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement