project Websites / videos.bentasker.co.uk avatar

Websites / videos.bentasker.co.uk: 475a508b




Automatically call embedBensPlayerDivs() when the DOM is ready, so that embedded videos are automatically picked up on. See websites/videos.bentasker.co.uk#3

Automatically call embedBensPlayerDivs() when the DOM is ready, so that embedded videos are automatically picked up on. See websites/videos.bentasker.co.uk#3

Commit 475a508b.

Authored 2022-03-11T16:23:04.000+00:00 by B Tasker in project Websites / videos.bentasker.co.uk

+15 lines -0 lines

Commit Signature

Changes

diff --git a/resources/embed/embed.js b/resources/embed/embed.js
--- a/resources/embed/embed.js
+++ b/resources/embed/embed.js
# @@ -31,6 +31,18 @@ document.write=function(s){
# lastScript.insertAdjacentHTML("beforebegin", s);
# }
#
# +// https://snippets.bentasker.co.uk/page-2112301800-Run-javascript-on-document-ready-Javascript.html
# +function doDocumentReady(fn){
# + /* $(document).ready() without javascript
# + */
# + if (document.readyState === "complete" ||
# + (document.readyState !== "loading" && !document.documentElement.doScroll)
# + ) {
# + fn();
# + } else {
# + document.addEventListener("DOMContentLoaded", fn);
# + }
# +}
#
#
# function guessMimeFromUrl(vidurl){
# @@ -510,3 +522,6 @@ window.analytics_gen_psuedoid = true;
# window.analytics_endpoint = 'https://pfanalytics.bentasker.co.uk/write';
# window.analytics_endpoint_onion = 'http://wftlf4ke7xwqkjrrju4aok57pkr7kfks5t5uqmipxlyjucwjycdql7id.onion';
#
# +
# +// When we hit DOM ready, check for any divs that embed video
# +doDocumentReady(embedBensPlayerDivs);
#