Skip to content

Instantly share code, notes, and snippets.

@LapisOnTheMoon
Last active May 25, 2024 16:50
Show Gist options
  • Save LapisOnTheMoon/13b63d0a504c126f43c4acc449770233 to your computer and use it in GitHub Desktop.
Save LapisOnTheMoon/13b63d0a504c126f43c4acc449770233 to your computer and use it in GitHub Desktop.
FPuzzles export to Sudokupad
// ==UserScript==
// @name F-Puzzles to CtC/Sudokupad
// @namespace http://tampermonkey.net/
// @version 0.5
// @description Replaces screenshot button on f-puzzles export popup to export to Sven's Sudokupad/CtC web app.
// @author LapisOnTheMoon
// @match https://*.f-puzzles.com/*
// @match https://f-puzzles.com/*
// @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
// @grant none
// @run-at document-end
// ==/UserScript==
(function() {
'use strict';
const formatLink = puzzleId => `https://sudokupad.app/?puzzleid=fpuzzles${puzzleId}`;
function init() {
const screenshotBtn = buttons.find(b => b.id === 'Screenshot');
if (!screenshotBtn) return setTimeout(init, 1);
screenshotBtn.title = 'Export to Sudokupad';
screenshotBtn.click = function(override = false) {
if (!(this.hovering() || override)) return;
const exported = formatLink(encodeURIComponent(exportPuzzle()));
window.open(exported);
}
}
init();
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment