This file contains hidden or 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
// This is a minimal JavaFX web browser written in JavaScript | |
// for Nashorn. Requires Java 1.8+ and I recommend JJS[.exe] | |
// | |
// Usage: | |
// jjs browse.js -- [URL or File.html] | |
// Declare class references from Java packages | |
var Application = Java.type("javafx.application.Application"); | |
var Scene = Java.type("javafx.scene.Scene"); |
This file contains hidden or 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
// Trick QUnit into exporting QUnit reference since 1.19+ no | |
// longer export a global reference to QUnit. (or just revert | |
// back to using QUnit 1.18.0) Don't actually know if this is | |
// a good idea or not but it works. | |
var exports = this; | |
load("https://code.jquery.com/qunit/qunit-2.4.0.js"); | |
with(QUnit) { | |
log(function(d) { |
This file contains hidden or 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
// This is a minimal Base64 encode/decode utility for Nashorn -> JavaScript | |
// Add error checking for data types as needed within encode or decode | |
var Base64 = { | |
decode: function (str) { | |
return new java.lang.String(java.util.Base64.decoder.decode(str)); | |
}, | |
encode: function (str) { | |
return java.util.Base64.encoder.encodeToString(str.bytes); | |
} | |
}; |
This file contains hidden or 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
var Base64 = Java.type("java.util.Base64"); | |
var encoder = Base64.encoder; | |
var decoder = { | |
decode : function (str) { | |
return new java.lang.String(Base64.decoder.decode(str)); | |
} | |
} | |
var message = "Hello, World!"; |