您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Adds a button to add your boot.dev certificate to linkedin
当前为
// ==UserScript== // @name Button to add boot.dev certificate to linkedin // @namespace https://github.com/luigiMinardi // @match https://www.boot.dev/certificate/* // @grant none // @version 0.6.12 // @author luigiMinardi // @license MIT // @description Adds a button to add your boot.dev certificate to linkedin // @homepageURL https://gist.github.com/luigiMinardi/62b0492d187e39e495272b10d40f6aee // @supportURL https://gist.github.com/luigiMinardi/62b0492d187e39e495272b10d40f6aee // ==/UserScript== var mybutt = document.createElement("button"); // Copying boot.dev button style mybutt.className = "active-scale-103 group relative block origin-bottom overflow-hidden rounded px-4 py-2 text-white shadow-md focus:outline-none disabled:scale-100 disabled:cursor-not-allowed bg-gradient-gray min-h-41 mt-8"; mybutt.style.cursor = "pointer"; // Button text mybutt.textContent = 'Add to LinkedIn'; mybutt.onclick = async function () { // Current boot.dev url info let currUrl = location.href; let currUrlArray = currUrl.split("/"); let username = currUrlArray.at(-2); let course = currUrlArray.at(-1); // Getting data from the course you did let getCoursesData = await fetch(`https://api.boot.dev/v1/users/public/${username}/tracks_and_courses`, { method: "GET", }).then((value) => { return value; }); let coursesJson = await getCoursesData.json(); let currCourse; for (const c of coursesJson["Courses"]) { if (c["UUID"] == course) { currCourse = c; } } // Creating variables with your course data let completionDate = currCourse["CompletedAt"].split("-"); let comp_yr = completionDate[0]; let comp_mth = completionDate[1]; let title = currCourse["Title"]; let bootdev = "40661112"; // Open linkedin with the data pre-written window.open(`https://www.linkedin.com/profile/add?startTask=CERTIFICATION_NAME&name=${title}&organizationId=${bootdev}&issueYear=${comp_yr}&issueMonth=${comp_mth}&certUrl=${currUrl}&certId=${course}`, '_blank'); }; // create a new instance of `MutationObserver` named `observer`, // passing it a callback function const observer = new MutationObserver(() => { // selecting where the download button is var el = document.getElementsByClassName("flex h-full flex-col items-center bg-gray-900")[0].children[0] // adding a little of css el.className = "flex flex-row gap-2" // adding by button to it el.appendChild(mybutt) // stoping the observer so I dont get a while true problem observer.disconnect(); }); // call `observe()`, passing it the element to observe, and the options object observer.observe(document.getElementsByClassName("flex h-full flex-col items-center bg-gray-900")[0].children[0], { subtree: true, childList: true, });