NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript==
// @name LinkedIn Profile Print
// @namespace Compendium
// @copyright Copyright (c) 2023 Richard Bolhofer
// @version 1.1.2
// @description Prepares a LinkedIn profile for printing by removing extraneous sections.
// @grant none
// @author SignalRichard
// @homepage https://github.com/SignalRichard/userscript-compendium-linkedin-profile-print
// @source https://github.com/SignalRichard/userscript-compendium-linkedin-profile-print
// @match https://www.linkedin.com/in/*
// @run-at context-menu
// @license MIT
// ==/UserScript==
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
(function () {
'use strict';
return __awaiter(this, void 0, void 0, function* () {
let height = window.innerHeight / 2;
const scrollHeight = height;
do {
window.scrollTo(0, height);
height += scrollHeight;
yield new Promise(r => setTimeout(r, 1000));
} while (height < document.body.scrollHeight);
[...document.getElementsByClassName("scaffold-layout__aside"),
...document.getElementsByTagName("header"),
...document.getElementsByTagName("footer")].forEach((item) => { if (item) {
item.remove();
} });
let iterator = 0;
[...document.querySelectorAll("section.artdeco-card h2.pvs-header__title>span[aria-hidden=true]")].forEach((item) => {
var _a, _b;
iterator++;
if (item instanceof HTMLElement) {
switch (item.innerText) {
case "Highlights":
case "Featured":
case "Activity":
case "Licenses & certifications":
case "Skills":
case "Recommendations":
case "Courses":
case "Languages":
case "Organizations":
case "Causes":
case "Interests":
case "People also viewed":
case "People you may know":
case "You might like":
item.setAttribute("id", `tamper-${iterator}`);
(_b = (_a = document.querySelector(`#tamper-${iterator}`)) === null || _a === void 0 ? void 0 : _a.closest(".artdeco-card")) === null || _b === void 0 ? void 0 : _b.remove();
break;
default:
break;
}
}
});
[...document.getElementsByClassName("inline-show-more-text__button")].forEach((item) => { if (item instanceof HTMLElement) {
item.click();
} });
yield new Promise(r => setTimeout(r, 1000));
window.scrollTo(0, 0);
window.print();
});
})();