object HandshakeCalculator {
fun calculateHandshake(number: Int): List {
val binaryToSignal = Signal.values().asList()
val binaryString = number.toString(2)
var result = mutableListOf()
binaryString.reversed().forEachIndexed { index, item →
if (item == ‘1’) {
if (index < binaryToSignal.size) {
result.add(binaryToSignal[index])
}
}
}
return if (binaryString.reversed().getOrNull(4) == ‘1’) result.reversed() else result
}
}
→ The <Signal> String is removed. How can I teach Grav that it handles the code as it is and does NOT filter anything in it?
Inserting Javascript code in the page content is not allowed by Grav.
The easiest way is to use the Assets Plugin. You’ll find it in the Grav Plugins Download section of the Grav website. Or if you are using the Admin Plugin you can add that plugin by clicking the Add button under Plugins in the Admin panel.
Once installed you can add the external Javascript file like this:
If you want to understand how to use assets like Javascript code and CSS stylesheets in theme templates and without using the Assets Plugin, you’ll want to read the docs about Themes and specifically about Adding Assets.