Coder Social home page Coder Social logo

sheeptester / words-go-here Goto Github PK

View Code? Open in Web Editor NEW
24.0 3.0 17.0 1.96 MB

Now a miscellaneous repository that houses various projects

Home Page: https://sheeptester.github.io/words-go-here/

License: MIT License

HTML 69.38% JavaScript 23.25% CSS 1.73% Elm 1.64% TeX 1.88% Shell 0.03% TypeScript 1.61% WGSL 0.48%
social-media miscellaneous

words-go-here's Introduction

words-go-here

An attempt to allow people to put their text on a screen even when better alternatives exist

words-go-here's People

Contributors

martysvk avatar sheeptester avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

words-go-here's Issues

Project not loading

Hi, I have and issue with a Scratch project.
When I upload the file of the game and I open the preview it only appears a white screen, it doesn't even loads, it's just a white screen.

Handle mouse and keyboard clicks in iframe

There is a problem when using HTMLifier-generated site from iframes. Example of this is when you want to publish the project on Itch.io.

The problem is that the mouse and keyboard are not focused on the iframe, so it is impossible to control the game in it. Based on itchio/itch.io#58, this is a problem with software that generates game, in this case HTMLifier.

Based on comments in that issue, the generated file needs to be modified to handle mouse and keyboard clicks and focus iframe's window on load and mouse click.

To do this, I created a simple SH script which modifies generated file and adds required handlers:

if [[ $# -ne 1 ]]; then
    echo "Illegal number of parameters"
    echo ""
    echo "The first and only parameter has to"
    echo "be the path to a file to be patched"
    exit 2
fi

SET_WINDOW_FOCUS="function setWindowFocus() { window.focus() }"
PREVENT_USE_OF_DEFAULT_KEYS="function preventUseOfDefaultKeys(event) { if (event.keyCode == 32) { event.preventDefault() } }"

SCRIPT_START="<script>"
SCRIPT_END="</script>"

ORIGINAL_BODY="<body>"
PATCHED_BODY="<body onload=\"setWindowFocus()\" onclick=\"setWindowFocus()\" onkeydown=\"preventUseOfDefaultKeys(event)\">"

ADDITION="${SCRIPT_START} ${SET_WINDOW_FOCUS} ${PREVENT_USE_OF_DEFAULT_KEYS} ${SCRIPT_END}"

grep -qxF "${ADDITION}" "${1}" || echo "${ADDITION}" >> "${1}"
sed -i "s/${ORIGINAL_BODY}/${PATCHED_BODY}/g" "${1}"

Example of the game which uses this is this game (by me).

However, there are still some problems. When the iframe loads, it will not be focused. this means that when you click "Run game" button on Itch, you will still need to click again to actually focus the iframe and control the game. Another problem is that when you click a fullscreen button (in the bottom-right corner), the focus will be lost again so you will need to re-click the iframe to focus it again. Also, in PREVENT_USE_OF_DEFAULT_KEYS, I only handled space-bar press, as this is the only key which I use in my game. However, I don't know if other keys also need to be handled for other games, or this keypress handler is not needed at all.

The final result should be that when you load iframe, it will be automatically focused. Also, when you press the fullscreen button, the focus shouldn't be lost. And in case you lose focus because you want, you should be able to restore it with a mouse click on iframe.

@SheepTester Do you know how to fix these issues? If so, can you please release that mouse and key handlers directly into default HTMLifier file, so my script won't be needed anymore and everything will work.

acm bug

checkbox for turning off black text doesn't work :(
image

Custom server for username detection and cloud variables

Can you add support to detect username and store cloud variables on the custom server? For this, HTMLifier website should be modified with additional field which would specify API URL of the cloud server. That server should be hosted by the developer of the game. And when the game will be used, HTMLifier will use that API to get the player's username and get/set cloud variables.

For best compatibility, HTMLifier should support two types of APIs. First is simple HTTP GET/POST, where HTMLifier will first GET username and GET current state of cloud variables on the game start, and POST new data on every change. The other should be with WebScokets, where the same thing should be done, but via WebScokets.

HTTP API for HTMLifier

Can you do some HTTP API for HTMLifier? With this, I mean API where you can send HTTP request and it will automatically convert and download project.

For example, if you would want to download the converted project, you would do this:

wget https://example.com/htmlifier?project=345675439&title=Example&username=&compatibility=1&turbo=0

Which will download the converted file automatically.

However, this probably won't be possible with GitHub Pages as they don't support backend, but you may found some other free hosting for that.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.