Comments/Ratings for a Single Item
What alternative do we have for recognizing a monochrome display?
In showpiece.php, I am using this code:
$ua = getenv("HTTP_USER_AGENT");
$eink = preg_match("/(kindle|likebook|meebook|boox|onyx|pocketbook|inkpad)/i", $ua);
I know "kindle" and "likebook" work, and the others are just guesses based on brand and product names.
On my desktop, I clicked on Reload Skip Cache, and when I inspected the Javascript-produced HTML with Web Developer Tools, I couldn't find any IMG tags for the pieces. I changed graphSuffix to graphicsType in a preview, but it didn't change the result.
Two things that could play a role here:
- The Diagram below also uses the wrong key for graphicsDir. So by default it uses /membergraphics/MSinteractive-diagrams/ instead of your rendering script, and there are no .svg files there.
- The pieces in the Diagram are drawn as background. To know what is actually used as image URL, I always use the images in the piece table (rightclicking those in FireFox, and select 'inspect' from the context menu that appears).
When I corrected the graphicsDir and graphicsType keys in that comment, the pieces did show up in the table. But still not on the board. Perhaps SVG rendering is not supported for background images, in FireFox?
In showpiece.php, I am using this code:
$ua = getenv("HTTP_USER_AGENT"); $eink = preg_match("/(kindle|likebook|meebook|boox|onyx|pocketbook|inkpad)/i", $ua);
I know "kindle" and "likebook" work, and the others are just guesses based on brand and product names.
Nice, but that is server side in PHP. The client machine (from the TCP/IP request header) there apparently is stored in an environment variable before Apache invokes the PHP interpreter, so the PHP program can fetch it with getenv().
But the JavaScript is running client side, and does not have access to the server environment variables. If there was a JavaScript method for identifying the machine it runs on, that would be usable.
Well, not really, because it relies on images from an external website, which is something we want to discourage. Especially since this is a http website: most people won't be able to see those images at all, since CVP became a https site. It requires a non-default setting of the browser to see them.
Well, I'll wait until you/I/we can get the new system to behave, then.
I only could find very round-about ways for determining whether a display is greyscale. Like drawing something colored in a HTML canvas element on the page, and then reading back the pixels to see if they are all grey (i.e. have R=G=B).
Getting to know which device you are running on seems to be impossible for security reasons. It is possible to get the userAgent string that the browser sends to the server in the request headers, though. Which is the thing your PHP script retrieves. Normally the computer type is not specified in that string (just OS and browser), but apparently the e-readers are an exception to this. So perhaps I can get this to work in JavaScript as well.
[Edit] I now put in the code
var ua = navigator.userAgent; ua = ua.search(/(kindle|likebook|meebook|boox|onyx|pocketbook|inkpad)/i); if(ua >= 0) useMarkers = 2, realColor = startColor = '#E0E0E0', light = '#FFFFFF', hicol = '#808080'; // assume grey-scale display
For my desktop things still look normal. Please try what it does on the Kindle.
I tested window.navigator.userAgent, and it gave useful values on my Kindle and in Chrome on my Likebook Mars, but the value it gave in Firefox on my Likebook Mars did not mention the device by name. I cleared the cache in Chrome on my Likebook Mars, but I still saw a black bar over the board.
Please try what it does on the Kindle.
It is only the Likebook Mars that displays red as black. The Kindle displays red as white, which leaves the text legible. However, I now see the text in a grey bar on the Kindle, and I think that previously I just saw the text against the same white background as the rest of the comment.
This ID's still having issues:
- I don't remember what I changed to get the images to show up on the board in Hundred Acres when they were only showing up in the overview.
- Compound graphics aren't rendering.
I made some changes to get my copy of your diagram to work. I replaced graphDir with graphicsDir, graphSuffix with graphicsType, and & with %26. Are any pieces missing from it?
Compound graphics aren't rendering.
It looks like you are expecting to be able to combine two images into a single image. The showpiece.php script does not do this. Is this something another tool did? Why not just make the compound pieces you want as separate images?
I got the %26 in there (the other changes were already in place), and the pieces are now on the board, except for the compounds (Bowman, Spy, and Helepolis). I'm assuming that compounds (as seen with H.G.'s fen2 program) aren't implemented with showpiece at this time.
Why not just make the compound pieces you want as separate images?
I could do that, though part of the point of some of the images is to minimize having to do that no matter how many different ideas come up. I mentioned earlier having some outliers to add much later (like Anteater, Bharal, and Inquisitor) along with some that are mainly used in Shogi (dog, monkey, etc.), but on the whole these rely somewhat on fen2's ability to compound to make these rarer pieces.
The Spy arguably does deserve an image of its own; for now, I'll start getting some ready for this game and the others I'm trying to get loaded (including full Camel and Zebra QBRM sets, or at least some images usable for such).
The showpiece.php script is not based on fen.cgi, and it would be a lot of work to try to duplicate its ability to edit and combine images. Maybe I could take a crack at compiling fen.cgi over here.
OK, then. I'll whip up what I need for these four games, but anything that's actually a composite I (probably) won't include in the index when I pull it together.
14 comments displayed
Permalink to the exact comments currently displayed.
My desktop also gives colorDepth = 24. I recall that the 16 was inspired by the browser on my Kobo e-reader. (Which seems to have magically disappeared?!)
OK, so using colorDepth for this won't work. What alternative do we have for recognizing a monochrome display?