Files
WebImageViewer/scratch/test_hitomi.js
T

26 lines
998 B
JavaScript

const fs = require('fs');
let commonJs = fs.readFileSync('scratch/common.js', 'utf8');
let ggJs = fs.readFileSync('scratch/gg.js', 'utf8');
let galleryJs = fs.readFileSync('scratch/gallery_4159707.js', 'utf8');
global.document = { location: { hostname: 'hitomi.la' } };
global.window = global;
global.navigator = { platform: 'Win32', userAgent: 'Chrome' };
global.gg = {};
global.$ = function() { return { ready: function() {}, on: function() {}, remove: function() {} }; };
global.$.ajax = function() {};
eval(commonJs);
eval(ggJs);
eval(galleryJs);
console.log("Gallery Title:", galleryinfo.title);
const imgUrlWebp = url_from_url_from_hash(galleryinfo.id, galleryinfo.files[0], 'webp');
const imgUrlAvif = url_from_url_from_hash(galleryinfo.id, galleryinfo.files[0], 'avif');
const thumbUrl = url_from_url_from_hash(galleryinfo.id, galleryinfo.files[0], 'webp', 'webp', 'tn');
console.log("WebP URL:", imgUrlWebp);
console.log("Avif URL:", imgUrlAvif);
console.log("Thumb URL:", thumbUrl);