Last active
January 3, 2022 04:52
-
-
Save dclamage/9a40dc9433d903feeee78a085377e81e to your computer and use it in GitHub Desktop.
Changes non-given values to be blue.
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
// ==UserScript== | |
// @name Fpuzzles-BlueValues | |
// @namespace http://tampermonkey.net/ | |
// @version 1.7 | |
// @description Changes non-given values to be blue. | |
// @author Rangsk | |
// @match https://*.f-puzzles.com/* | |
// @match https://f-puzzles.com/* | |
// @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw== | |
// @grant none | |
// @run-at document-end | |
// ==/UserScript== | |
(function() { | |
const blueValueColor = '#1D6AE5'; | |
const blueValueDarkColor = '#5F95EC'; | |
const doShim = function() { | |
'use strict'; | |
// Replace cell rendering to support colors | |
const origCell = cell; | |
cell = function(i, j, outside) { | |
const c = new origCell(i, j, outside); | |
c.origShowTopBV = c.showTop; | |
c.showTop = function() { | |
this.origShowTopBV(); | |
if (currentTool !== 'Regions' && this.value && !this.given && !previewMode && | |
(!boolSettings['Highlight Conflicts'] || candidatePossibleInCell(this.value, this, { bruteForce: true }))) { | |
ctx.fillStyle = boolSettings['Dark Mode'] ? blueValueDarkColor : blueValueColor; | |
ctx.font = (cellSL * 0.8) + 'px Arial'; | |
ctx.fillText(this.value, this.x + cellSL / 2, this.y + (cellSL * 0.8)); | |
} | |
} | |
return c; | |
} | |
if (window.boolConstraints) { | |
let prevButtons = buttons.splice(0, buttons.length); | |
window.onload(); | |
buttons.splice(0, buttons.length); | |
for (let i = 0; i < prevButtons.length; i++) { | |
buttons.push(prevButtons[i]); | |
} | |
} | |
} | |
let intervalId = setInterval(() => { | |
if (typeof cell === 'undefined') { | |
return; | |
} | |
clearInterval(intervalId); | |
doShim(); | |
}, 16); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment