@Christian, first thanks for the prompt response.
I see you gave me a snippet that assumes form input, which is fine, I get the point. I'm using this to supply vals to js for a video player. I 'think' this method you supplied MAY get a bit hairy for me because the js I'm using is just a bit different for every single video. For example, each video (which there are hundreds), I have cue points that get put into the js. Like so
<script>
window.onload = function () {
var onPlayergo = {
cuepoints: [10, 26, 43, 65],
qualities: ["240p", "360p", "480p", "720p", "1080p"],
defaultQuality: "360p",
sources: [
{ type: "video/mp4", src: "/v-assets/video/test.mp4" }
]
},
container = document.getElementById("player");
sidecarLeft = document.getElementById("sidecar-left");
sidecarRight = document.getElementById("sidecar-right");
msgOne = document.getElementById("msg-01");
msgTwo = document.getElementById("msg-02");
Player(container, {
clip: onPlayergo,
autoplay: false
}).on("cuepoint", function (e, api, cuepoint) {
if (cuepoint.time === onPlayergo.cuepoints[0]) {
jQuery(sidecarLeft).removeClass('sidecar-left-one').addClass('sidecar-left-two');
jQuery(sidecarRight).removeClass('sidecar-right-one').addClass('sidecar-right-two');
}
else if (cuepoint.time === onPlayergo.cuepoints[1]) {
jQuery(sidecarLeft).removeClass('sidecar-left-two').addClass('sidecar-left-three');
jQuery(sidecarRight).removeClass('sidecar-right-two').addClass('sidecar-right-three');
}
else if (cuepoint.time === onPlayergo.cuepoints[2]) {
jQuery(sidecarLeft).removeClass('sidecar-left-three').addClass('sidecar-left-four');
jQuery(sidecarRight).removeClass('sidecar-right-three').addClass('sidecar-right-four');
}
==== REMOVED ====
}).on("beforeseek", function (e, api, pos) {
onPlayergo.cuepoints.forEach(function (cue) {
if (pos > cue) {
if (!isNaN(cue)) {
cue = {time: cue};
}
api.trigger("cuepoint", [api, cue]);
}
});
});
};
</script>
I need to get custom fields to js values (from code above): cuepoints, qualities, etc.
And also get custom fields for css values (from code above): removeClass('sidecar-left-one').addClass('sidecar-left-two')
I think what may help me to wrap my head around not only the solution but 'how' and 'when' the js vars is read from WP during the page render would help also. Meaning, I'm assuming that when the page is loaded, what gets read first?
values are read from custom fields, page head scripts are loaded, html and inline js is rendered, footer js is rendered.
Is that the correct order?