Examples
date
// SPDX-FileCopyrightText: 2009 Matthias Fuchs <mat69 AT YOU KNOW DELETE THAT gmx.net>
// SPDX-License-Identifier: LGPL-2.0-or-later
let findNewDate = new Boolean();
const mainPage = "https://www.jesusandmo.net";
function init() {
comic.comicAuthor = "\"Mohammed Jones\"";
comic.firstIdentifier = "2005-11-24";
comic.shopUrl = "https://www.jesusandmo.net/the-shop/";
var today = date.currentDate();
findNewDate = (comic.identifier.date >= today.date);
var url = mainPage;
if (!findNewDate) {
url += comic.identifier.toString("yyyy/MM/dd/");
}
comic.requestPage(url, comic.User);
}
function pageRetrieved(id, data) {
// find the url to the comic website
if (id === comic.User) {
// find the most recent date
if (findNewDate) {
const re = new RegExp("(http://www.jesusandmo.net/(\\d{4}/\\d{2}/\\d{2}/)[^/]+/)#comments\"");
const match = re.exec(data);
if (match !== null) {
comic.identifier = date.fromString(match[2], "yyyy/MM/dd");
comic.websiteUrl = match[1];
} else {
comic.error();
return;
}
} else {
const re = new RegExp("<a href=\"(" + mainPage + comic.identifier.toString("yyyy/MM/dd/") + "[^\"]+)\"><img");
const match = re.exec(data);
if (match !== null) {
comic.websiteUrl = match[1];
} else {
comic.error();
return;
}
}
comic.requestPage(comic.websiteUrl, comic.Page);
}
if (id === comic.Page) {
const url = `${mainPage}strips/`;
let re = new RegExp(`<img src="(${url + comic.identifier.toString(date.ISODate)}[^"]+)" alt="([^"]+)"`);
let match = re.exec(data);
if (match !== null) {
url = match[1];
comic.title = match[2];
comic.requestPage(url, comic.Image);
} else {
comic.error();
}
re = new RegExp("<a href=\"" + mainPage + "(\\d{4}/\\d{2}/\\d{2}/)[^\"]+\"><span class=\"prev\">");
match = re.exec(data);
if (match !== null) {
comic.previousIdentifier = date.fromString(match[1], "yyyy/MM/dd/");
}
re = new RegExp("<a href=\"" + mainPage + "(\\d{4}/\\d{2}/\\d{2}/)[^\"]+\"><span class=\"next\">");
match = re.exec(data);
if (match !== null) {
comic.nextIdentifier = date.fromString(match[1], "yyyy/MM/dd/");
}
}
}number
string
Last updated