--- /dev/null
+
+
+function onload() {
+ //imgtag = document.getElementById("image")
+ //imgtag.src = "negative.png"
+ //imgtag.src = "https://qwantz.com/comics/comic2-3900.png"
+
+
+ drawcomic("https://qwantz.com/comics/comic2-675.png")
+
+
+ num = window.location.search.substring(window.location.search.indexOf('=')+1)
+ getimageurl(num)
+}
+
+function getimageurl(number) {
+ // takes the comic no (from the ?comic=<>) and gets the url we want
+ // returns a promise?
+ console.log(number)
+ fetch("https://qwantz.com/index.php?comic=" + number, {mode: "cors"})
+}
+
+
+function drawcomic(imgurl) {
+ canvas = document.getElementById("canvas")
+ ctx = canvas.getContext('2d')
+ img = new Image()
+ mask = new Image()
+ mask.onload = function() {
+ ctx.drawImage(img,0,0)
+ ctx.drawImage(mask,0,0)
+ }
+ img.onload = function() {
+ mask.src = "negative.png"
+ }
+ img.src = imgurl
+ //img.src = "https://qwantz.com/comics/comic2-675.png"
+}
--- /dev/null
+<!doctype html>
+<meta charset="utf-8">
+<html>
+ <head>
+ <title>Comics</title>
+ <script type="text/javascript" src="comics.js"></script>
+ </head>
+ <body style="background-color: #f8f8ff;" onload="onload()">
+ <canvas id="canvas" width="735" height="500"></canvas>
+ </body>
+</html>
+
--- /dev/null
+
+const express = require('express')
+const fetch = require('node-fetch')
+const jsdom = require('jsdom')
+const { JSDOM } = jsdom
+const app = express()
+const port = 4453
+
+
+app.get('/id/:num', (req, res) => {
+ fetch("https://qwantz.com/index.php?comic=" + req.params["num"])
+ .then(response => {
+ return response.text()
+ }).then(s => {
+ var { document } = (new JSDOM(s)).window
+ res.send(document.getElementsByClassName('comic')[0].src)
+ })
+ .catch(() => {
+ res.send("error!")
+ })
+})
+
+app.listen(port, () => {
+ console.log("listening")
+})