Skip to content

Instantly share code, notes, and snippets.

@camjocotem
camjocotem / ALL_THE_CATS.js
Created April 14, 2020 17:54
Replaces all images on websites with cat pictures NOTE: Not very efficient, always replaces all pictures on scroll
function getCatPicture(){
return fetch('https://api.thecatapi.com/v1/images/search?size=full')
.then(res => {
return res.json();
});
}
function replacePicsWithCatPics(){
var imageCollection = [].slice.call(document.getElementsByTagName('img'));
@camjocotem
camjocotem / GetQuestions.js
Created March 23, 2020 20:23
GetQuestions.js
[].slice.call(document.getElementsByTagName('span')).filter(el => el.id === "message" && el.innerText.match(/\?/)).map(el => el.innerText)
@camjocotem
camjocotem / ScanUkCalcHardDriveCost.js
Last active March 2, 2020 09:40
WIP Finding the Per-Gigabyte cost of each hard drive
function getProducts(){
let productList = [];
removeSmallStuff();
let products = [].slice.call(document.getElementsByTagName('li')).filter(el => el.getAttribute('class') === 'product');
products.forEach(getProductInfo);
products.forEach(applyDiscount);
function getProductInfo(product){
let productInfo = product.querySelectorAll('a')[1].innerText;
let price = product.getAttribute('data-price') * 1;
@camjocotem
camjocotem / shader-gen.js
Created September 14, 2019 19:06
Generate shading based on current selected colour
(
/**
* @param {Application} app
*/
function (app) {
var HUE_MAX = 359;
var RGB_MAX = 255;
var HSV_MAX = 100;
var jps = new JPS();
if (BridgeTalk.appName !== "photoshop") {
@camjocotem
camjocotem / layerGen.js
Last active June 15, 2021 10:53
Photoshop Shader generation
var app = new Application();
var { hue, saturation, light } = rgbToHsl(app.foregroundColor.rgb.red, app.foregroundColor.rgb.green, app.foregroundColor.rgb.blue)
var stepsToTake = prompt("How many steps should be generated?", 2);
var tempBased = prompt("'y' For do temperature based shading, 'n' for light based shading", 'y');
var stepAmount = prompt("What increment should each step take?", 20)
/**
@camjocotem
camjocotem / fb_unfollow.js
Created July 5, 2019 12:18
fb_unfollow.js
function unfollow() {
[].slice.call(document.getElementsByTagName('*')).filter((el) => {
return el.getAttribute('aria-label') === "Story options"
}).forEach((el) => {
el.click();
});
[].slice.call(document.getElementsByTagName('*')).filter((el) => {
if (el.getAttribute("title")) {
return el.getAttribute("title").match(/Unfollow.+/g)
@camjocotem
camjocotem / FBShowText.js
Last active June 15, 2021 10:53
FB_AltText
javascript: if (!document.getElementById("thatAltTextThar")) {
var image = document.getElementsByClassName("spotlight")[0];
if (image) {
var altText = image.getAttribute("alt");
if (altText) {
var styleElement = document.createElement("span");
styleElement.setAttribute("style", "font-size: 2rem; position: absolute; color: white; left: 0; bottom: 0; line-height: 2rem; background: black; padding: .5rem;"),;
styleElement.innerText = altText;
styleElement.id = "thatAltTextThar";
image.parentElement.appendChild(styleElement);
@camjocotem
camjocotem / fb-antisocial.js
Created May 30, 2019 19:41
Get rid of all Facebook friend suggestions (shouldn't be filter but meh whatever)
[].slice.call(document.getElementsByTagName('*')).filter((e)=>{
if(e.getAttribute("data-tooltip-content") === "Remove"){
e.click();
}
});
@camjocotem
camjocotem / amazon_discounts_v2.js
Last active July 13, 2021 15:30
amazon_discounts_v2.js
if (!('remove' in Element.prototype)) {
Element.prototype.remove = function () {
if (this.parentNode) {
this.parentNode.removeChild(this)
}
}
};
function showDiscounts() {
var minDiscount = 100;
javascript:if(!('remove'in Element.prototype)){Element.prototype.remove=function(){if(this.parentNode){this.parentNode.removeChild(this)}}}function showDiscounts(){minDiscount=10;function getProducts(){return[].slice.call(document.getElementsByTagName('*')).filter(function(e){if(e.getAttribute("data-asin")!==null&&e.className!=="asinImage"){return true}return false})}function productHasDiscount(product){if(product.getAttribute("data-a-strike")!==null){return true}else if(product.children&&product.children.length){var prodHasDisc=false;[].slice.call(product.children).forEach(function(c){var discExists=productHasDiscount(c);if(discExists){prodHasDisc=true}});return prodHasDisc}return false}function showDiscount(){var discElements=[].slice.call(document.getElementsByTagName('*')).map(function(e){if(e.getAttribute("data-a-strike")!==null){return e.parentElement}return null}).filter(function(d){return d!==null});discElements.forEach(function(e){calcDiscount(e)});reorderItems(getProducts());function calcDiscount(pa