This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// imported from https://github.com/heygrady/Units | |
let preCalculated = false; | |
let computedValueBug = false; | |
const defaultView = document.defaultView; | |
const getComputedStyle = defaultView && defaultView.getComputedStyle; | |
const runit = /^(-?[\d+\.\-]+)([a-z]+|%)$/i; | |
const convert:Record<string, number|undefined> = { | |
mm2px: 1/25.4, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { DOMParser, Element, HTMLDocument } from "https://deno.land/x/deno_dom/deno-dom-wasm.ts"; | |
/** | |
* Extracts the jpg url from a LightShot page | |
* lightshot_image('http://prntscr.com/dki21q') | |
* http://image.prntscr.com/image/1aaf571d0adf4aa098eb565bbb196af6.png | |
*/ | |
export default async function lightshotImageExtractor(url:URL):URL { | |
const connection = await fetch(url.href); | |
if (!connection.ok) throw Error("Connection not OK"); |