Skip to content

Instantly share code, notes, and snippets.

View apricot13's full-sized avatar

Han apricot13

View GitHub Profile
@apricot13
apricot13 / sortByActualPrice-bookmarklet.js
Last active January 4, 2022 15:11
Amazon wishlist Sort by Price Dropped By Bookmark (copy paste this entire thing into the URL part of a bookmark in chrome)
javascript:const allItems=document.getElementById("g-items");allItems.style.display="flex",allItems.style.flexDirection="column",allItems.style.flexFlow="column-reverse";const items=allItems.querySelectorAll("li"),prices=[];[...items].forEach(e=>{let t=e.getAttribute("data-price");e=e.getAttribute("data-itemid");t=isFinite(t)&&!isNaN(t)?t:0,prices.push([e,t])}),prices.sort((e,t)=>t[1]-e[1]),prices.forEach((e,t)=>{if(""!==e[0]){e='[data-itemid="'+e[0]+'"]';console.log(e);const l=document.querySelector(e);console.log(e,l),l&&(l.style.order=t)}});
@apricot13
apricot13 / highlight shorts + premiers + lives.js
Last active March 18, 2022 12:56
Highlight short videos on youtube (bookmarklet)
javascript:const milliseconds=(e,t,r)=>1e3*(60*e*60+60*t+r),times=document.querySelectorAll("ytd-thumbnail-overlay-time-status-renderer");[...times].forEach(e=>{const t=e.querySelector("#text").innerHTML.trim().split(":");2===t.length&&t.unshift("0");const r=milliseconds(t[0],t[1],t[2]);r<=6e4&&(e.closest("ytd-grid-video-renderer").style.backgroundColor="#a57070"),isNaN(r)&&(e.closest("ytd-grid-video-renderer").style.backgroundColor="#6e6ebb")});