SP4CEBAR 2025-06-28 16:26 (Edited)
You can open a program posted as a comment or forum post by:
player.php?p=
between the lowresnx.inutilis.com/
and uploads
Use my latest online NX editor instead: link
Before following the instructions, I can recommend to review the code as this does change the behavior of your local version of the site.
I managed to swap the program loaded by an NX program window with any program hosted on this site by:
F12
).Command that inserts the a menu to add nx files from any url under this domain
(() => {
const showCustomPlayer = () => {
var playerPreview = document.getElementById("player-preview");
var player = document.getElementById("player");
playerPreview.parentElement.removeChild(playerPreview);
player.style.display = "block";
const customValue = document.getElementById('custom-input').value;
player.setAttribute("src", "player.php?p=" + customValue);
player.focus();
countPlay(2822);
};
const container = document.querySelector('.container');
if (!container) {
console.error("No .container element found.");
return;
}
// Create the editor container div
const wrapper = document.createElement('div');
wrapper.id = 'editor-container';
wrapper.style.marginBottom = '1em';
wrapper.style.padding = '1em';
wrapper.style.border = '1px solid #ccc';
const input = document.createElement('input');
input.type = 'text';
input.id = 'custom-input';
input.placeholder = 'Enter custom value...';
input.value = 'uploads/vfu9MRt53E_Star_Scroller_1.2.nx';
input.style.marginRight = '1em';
wrapper.appendChild(input);
// Create button
const button = document.createElement('button');
button.textContent = 'Run NX File';
button.onclick = showCustomPlayer;
wrapper.appendChild(button);
// Insert wrapper before the container element
container.parentNode.insertBefore(wrapper, container);
})();
SP4CEBAR 2025-06-28 16:53 (Edited)
note: scroll down, a newer version is available
Follow the instructions from the previous code block but use the code below and write code in the text field instead of urls
player.php is more tolerant to what url it gets than I thought
(() => {
const runCustomCode = () => {
var playerPreview = document.getElementById("player-preview");
/** @type {HTMLIFrameElement} */
var player = document.getElementById("player");
playerPreview.parentElement.removeChild(playerPreview);
player.style.display = "block";
// Get code from textarea
var code = document.getElementById("basic-code").value;
var blob = new Blob([code], { type: "text/plain" });
var dataUrl = URL.createObjectURL(blob);
player.setAttribute("src", "player.php?p=" + dataUrl);
player.focus();
countPlay(2822);
};
const container = document.querySelector('.container');
if (!container) {
console.error("No .container element found.");
return;
}
// Create the editor container div
const wrapper = document.createElement('div');
wrapper.id = 'editor-container';
wrapper.style.marginBottom = '1em';
wrapper.style.padding = '1em';
wrapper.style.border = '1px solid #ccc';
// Create textarea
const textarea = document.createElement('textarea');
textarea.id = 'basic-code';
textarea.rows = 10;
textarea.cols = 60;
textarea.placeholder = 'Enter BASIC code here...';
textarea.textContent = 'PRINT "HELLO WORLD"';
// Create button
const button = document.createElement('button');
button.textContent = 'Run Custom Code';
button.onclick = runCustomCode;
// Append textarea and button to wrapper
wrapper.appendChild(textarea);
wrapper.appendChild(document.createElement('br'));
wrapper.appendChild(button);
// Insert wrapper before the container element
container.parentNode.insertBefore(wrapper, container);
})();
SP4CEBAR 2025-06-28 17:01
It actually works, for big programs too
wow I did not expect that
you just can't rerun it easily in the current version of this script I wrote
SP4CEBAR 2025-06-28 17:08 (Edited)
this can be turned into a browser extention
this version allows re-running code
Attention: Before following the instructions, I can recommend to review the code as this does change the behavior of your local version of the site.
F12
).(() => {
/**
This is a modification of the showPlayer function found in the DOM.
It encodes your written program as a blob and starts the embedded
player.php (the NX player window) with this blob as its loaded NX
program.
*/
const runCustomCode = () => {
var playerPreview = document.getElementById("player-preview");
/** @type {HTMLIFrameElement} The NX player window */
var player = document.getElementById("player");
if (playerPreview) {
playerPreview.parentElement.removeChild(playerPreview);
}
player.style.display = "block";
// Clear the iframe before using it
player.removeAttribute("src");
player.src = "about:blank";
// Get code from textarea
var code = document.getElementById("basic-code").value;
// Encode code as blob url
var blob = new Blob([code], { type: "text/plain" });
var dataUrl = URL.createObjectURL(blob);
// Loads the player.php with a program into the player window
player.setAttribute("src", "player.php?p=" + dataUrl);
player.focus();
};
// Gets the element above which the code block will be inserted
const gridElement = document.querySelector('.grid');
if (!gridElement) {
console.error("No .grid element found.");
return;
}
// Create the editor container div
const wrapper = document.createElement('div');
wrapper.id = 'editor-container';
wrapper.style.marginBottom = '1em';
wrapper.style.padding = '1em';
wrapper.style.border = '1px solid #ccc';
// Create textarea
const textarea = document.createElement('textarea');
textarea.id = 'basic-code';
textarea.rows = 10;
textarea.cols = 60;
textarea.placeholder = 'Enter BASIC code here...';
textarea.textContent = 'PRINT "HELLO WORLD"';
// Create button
const button = document.createElement('button');
button.textContent = 'Run NX Code';
button.onclick = runCustomCode;
// Append textarea and button to wrapper
wrapper.appendChild(textarea);
wrapper.appendChild(document.createElement('br'));
wrapper.appendChild(button);
// Insert wrapper before the grid element
gridElement.parentNode.insertBefore(wrapper, gridElement);
})();
SP4CEBAR 2025-06-28 17:45 (Edited)
You can see this editor site on sp4cebar.com/nx-editor But the embed of player.php does not work, probably because it blocks external domains like mine:
Error message on console:
Security Error: Content at https://lowresnx.inutilis.com/player.php?p=blob:https://sp4cebar.com/8f771b44-f573-4282-ad0e-504ff437764e may not load data from blob:https://sp4cebar.com/8f771b44-f573-4282-ad0e-504ff437764e.
SP4CEBAR 2025-06-28 21:31
I fixed the editor website by using the embedded NX web player with a small modification so it can import code through a URI parameter.
I started a new topic for this website here