Skip to content

Instantly share code, notes, and snippets.

@sharunkumar
Last active February 26, 2023 03:21
Show Gist options
  • Save sharunkumar/d646978c59a5a9ba916c14fe93c4508f to your computer and use it in GitHub Desktop.
Save sharunkumar/d646978c59a5a9ba916c14fe93c4508f to your computer and use it in GitHub Desktop.
Tampermonkey Scripts
// ==UserScript==
// @name Copy Job Description
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Adds a "Copy Job Description" button to amazon.jobs listing
// @author sharunkumar
// @match https://www.amazon.jobs/en/jobs/*/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=amazon.jobs
// @grant none
// ==/UserScript==
(function() {
'use strict';
console.log("hello from tampermonkey")
let apply_button = document.querySelector("#apply-button")
let copy_button = apply_button.cloneNode(true)
function copyText(text) {
if(!text) {
return
}
let ta = document.createElement("textarea")
document.body.appendChild(ta)
ta.value = text;
ta.select();
document.execCommand("copy")
document.body.removeChild(ta)
}
copy_button.id = "copy-button"
copy_button.text = "Copy"
copy_button.href = "javascript:void(0)"
copy_button.classList.remove("btn-primary")
copy_button.classList.add("btn-secondary")
copy_button.addEventListener('click', () => {
let elements = [document.querySelector("#job-detail > div.apply-header > div > div > div > div.info-wrapper.col-12.col-md-7.col-xl-8 > div"), document.querySelector("#job-detail-body > div > div.col-12.col-md-7.col-lg-8.col-xl-9")]
copyText(elements.map(x => x.innerText).join("\n\n"))
})
apply_button.parentElement.appendChild(copy_button)
})();
// ==UserScript==
// @name Copy Job Description
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Adds a "Copy Job Description" button to greenhouse.io listing
// @author sharunkumar
// @match https://boards.greenhouse.io/*/jobs/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=greenhouse.io
// @grant none
// ==/UserScript==
(function() {
'use strict';
console.log("hello from tampermonkey");
let apply_button = document.querySelector('#apply_button');
apply_button.style.position = "unset"
let div = document.createElement("div")
div.style.display = "flex"
div.style.columnGap = "10px"
function copyText(html) {
if(!html) {
return
}
let ta = document.createElement("textarea")
div.appendChild(ta)
let element = html.innerText;
ta.value = element;
ta.select();
document.execCommand("copy")
div.removeChild(ta)
}
let copy_button = apply_button.cloneNode(false)
copy_button.innerText = "Copy"
copy_button.id = "copy-text"
copy_button.href = "javascript:void(0)"
copy_button.addEventListener("click",() => copyText(document.querySelector("#content")));
copy_button.style.backgroundColor = "#2975CA";
copy_button.style.fontWeight = "normal";
copy_button.style.padding = "12px 20px 14px 20px";
copy_button.style.fontSize = "14px";
copy_button.style.lineHeight = "17px";
copy_button.style.borderRadius = "3px";
apply_button.parentElement.appendChild(div)
div.appendChild(apply_button)
div.appendChild(copy_button)
})();
// ==UserScript==
// @name Copy Job Description
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Adds a "Copy Job Description" button to lever.co listing
// @author sharunkumar
// @match https://jobs.lever.co/*/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=lever.co
// @grant none
// ==/UserScript==
(function() {
'use strict';
console.log("hello from tampermonkey")
let apply_button = document.querySelector("body > div.content-wrapper.posting-page > div > div.section-wrapper.accent-section.page-full-width > div > div.postings-btn-wrapper > a")
let copy_button = apply_button.cloneNode(true)
function copyText(text) {
if(!text) {
return
}
let ta = document.createElement("textarea")
document.body.appendChild(ta)
ta.value = text;
ta.select();
document.execCommand("copy")
document.body.removeChild(ta)
}
copy_button.id = "copy-button"
copy_button.text = "Copy"
copy_button.href = "javascript:void(0)"
copy_button.classList.remove("template-btn-submit")
copy_button.classList.add("template-btn")
copy_button.addEventListener('click', () => {
let elements = [document.querySelector("body > div.content-wrapper.posting-page > div > div.section-wrapper.accent-section.page-full-width > div > div.posting-headline"), document.querySelector("body > div.content-wrapper.posting-page > div > div:nth-child(2) > div:nth-child(1)")]
copyText(elements.map(x => x.innerText).join("\n\n"))
})
apply_button.parentElement.appendChild(copy_button)
})();
// ==UserScript==
// @name Copy Job Description
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Adds a "Copy" button to ycombinator job listing
// @author sharunkumar
// @match https://www.ycombinator.com/companies/stackshine/jobs/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=ycombinator.com
// @grant none
// ==/UserScript==
(function() {
'use strict';
console.log("hello from tampermonkey")
let apply_button = document.evaluate("/html/body/div/div[2]/section/div/div[1]/div[2]/div[3]/div/div[1]/a", document).iterateNext()
let copy_button = apply_button.cloneNode(true)
function copyText(text) {
if(!text) {
return
}
let ta = document.createElement("textarea")
document.body.appendChild(ta)
ta.value = text;
ta.select();
document.execCommand("copy")
document.body.removeChild(ta)
}
copy_button.id = "copy-button"
copy_button.text = "Copy"
copy_button.href = "javascript:void(0)"
copy_button.classList.remove("ycdc-btn")
// copy_button.classList.add("apply-btn")
copy_button.addEventListener('click', () => {
let elements = [document.evaluate("/html/body/div[1]/div[2]/section/div/div[1]", document).iterateNext()]
copyText(elements.map(x => x.innerText).join("\n\n").replace("Apply to role ›Copy",""))
})
apply_button.parentElement.appendChild(copy_button)
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment