From 5d60df5607834fd03de9eff24c3b16f7dd01f28c Mon Sep 17 00:00:00 2001 From: turtlebasket Date: Fri, 10 Feb 2023 11:04:30 -0800 Subject: [PATCH] restructure + GH userscript --- README.md | 5 +- github-distractionless/README.md | 3 + github-distractionless/distractionless.js | 74 +++++++++++++++++++ linkedin-profile-views/README.md | 9 +++ .../profileViews.js | 0 5 files changed, 88 insertions(+), 3 deletions(-) create mode 100644 github-distractionless/README.md create mode 100644 github-distractionless/distractionless.js create mode 100644 linkedin-profile-views/README.md rename profileViews.js => linkedin-profile-views/profileViews.js (100%) diff --git a/README.md b/README.md index fbb5044..8c0ad14 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,4 @@ -# LinkedIn Profile Viewers Viewer +# Userscript Collection + -Userscript that allows you to see who recently viewed your profile without buying premium - tested and used on [ViolentMonkey](https://violentmonkey.github.io/), but should work with any userscript manager -Side note, if nothing shows up then try reloading the `/me/profile-views` page until it works lol diff --git a/github-distractionless/README.md b/github-distractionless/README.md new file mode 100644 index 0000000..9d55a83 --- /dev/null +++ b/github-distractionless/README.md @@ -0,0 +1,3 @@ +# GitHub Distractionless + +Userscript that makes sure that GitHub stays a work tool and doesn't turn into a social media website. diff --git a/github-distractionless/distractionless.js b/github-distractionless/distractionless.js new file mode 100644 index 0000000..58b4482 --- /dev/null +++ b/github-distractionless/distractionless.js @@ -0,0 +1,74 @@ +// ==UserScript== +// @name GitHub Distractionless +// @namespace Violentmonkey Scripts +// @match https://github.com/ +// @grant none +// @version 0.1 +// @author turtlebasket +// @website https://github.com/turtlebasket/userscripts/tree/master/github-distractionless +// @description 2/9/2023, 4:24:34 PM +// @run-at document-start +// ==/UserScript== + +let hideEls = []; +let focusing = false; + +// title bar links - custom behavior for now +const titleBarExclude = ["Explore", "Marketplace", "Codespaces"]; +let titleBarEls = document.getElementsByClassName("js-selected-navigation-item") +for (let i = 0; i < titleBarEls.length; i++) { + let el = titleBarEls[i]; + if (titleBarExclude.includes(el.innerHTML.trim())) { + console.log(el.innerHTML); + hideEls.push(el); + } +} + +// general exclusion list + +[ + ["mail-status unread", [0], /.*/], + ["UnderlineNav-item", [1], /^\/$/], +] +.forEach(([className, hideIndices, pageRegex]) => { + hideIndices.forEach(i => { + let el = document.getElementsByClassName(className)[i]; + if (typeof el === 'undefined') { + console.log(`focus mode: unable to find element ${className} [ ${i} ]`) + } + else { + hideEls.push(el); + } + }); +}) + +// hide all els in els +function toggleFocus() { + focusing = !focusing; + for (let el of hideEls) { + el.setAttribute( + "style", + focusing ? "display: none;" : "display: auto;"); + } +} + +// initial state +toggleFocus(); + +// toggle switch +// NOTE: WIP, currently bugged due to github content policy. add later + +// const btnStyle = ` +// background-color: black; +// foreground-color: white; +// borde-color: white; +// border-width: 1px; +// margin-left: 4px; +// padding: 2px 4px; +// font-size: 12pt;`; +// const focusModeSwitch = document.createElement("button"); +// focusModeSwitch.setAttribute("innerText", `Focus: ${focusing ? "on" : "off"}`); +// focusModeSwitch.setAttribute("style", btnStyle); +// focusModeSwitch.setAttribute("onclick", toggleFocus) +// document.getElementsByClassName("Header js-details-container Details")[0] +// .appendChild(focusModeSwitch); diff --git a/linkedin-profile-views/README.md b/linkedin-profile-views/README.md new file mode 100644 index 0000000..e0fdf92 --- /dev/null +++ b/linkedin-profile-views/README.md @@ -0,0 +1,9 @@ +# LinkedIn Profile Viewers Viewer + +Userscript that allows you to see who recently viewed your profile without buying premium - tested and used on [ViolentMonkey](https://violentmonkey.github.io/), but should work with any userscript manager + +Side note, if nothing shows up then try reloading the `/me/profile-views` page until it works lol + +## ⚠️ NOTE: CURRENTLY BROKEN + +As of a few months ago, it seems that LinkedIn no longer accidentally leaks info about blurred viewers in the profile view. There doesn't seem to be any other workaround I'm aware of :( diff --git a/profileViews.js b/linkedin-profile-views/profileViews.js similarity index 100% rename from profileViews.js rename to linkedin-profile-views/profileViews.js