d10 theme for Island Newspapers
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

108 lines
2.7 KiB

// (function (Drupal, once) {
// Drupal.behaviors.removeTrailingZeros = {
// attach: function (context) {
// function processField(id) {
// var el = document.getElementById(id);
// if (!el) return;
//
// // If value isn't populated yet, wait and retry once
// if (el.value === "") {
// setTimeout(function () {
// processField(id);
// }, 100);
// return;
// }
//
// var str = el.value.toString().slice(0, -3);
// el.value = parseInt(str, 10);
// }
//
// once("from-slider", "#nouislider-input-from", context).forEach(
// function () {
// processField("nouislider-input-from");
// }
// );
//
// once("to-slider", "#nouislider-input-to", context).forEach(function () {
// processField("nouislider-input-to");
// });
// },
// };
// })(Drupal, once);
// (function (Drupal) {
// window.onload = function () {
// var inputField = document.getElementById("nouislider-input-from");
// var str = inputField.value.toString();
// str = str.slice(0, -3);
// str = parseInt(str);
// inputField.value = str;
//
// var inputField = document.getElementById("nouislider-input-to");
// var str = inputField.value.toString();
// str = str.slice(0, -3);
// str = parseInt(str);
// inputField.value = str;
// };
// })(Drupal);
//(function (Drupal, once) {
//async function getAudioSourceFromNode(url) {
//const res = await fetch(url, {
//headers: { 'X-Requested-With': 'XMLHttpRequest' }
//});
//const html = await res.text();
//const doc = new DOMParser().parseFromString(html, 'text/html');
//// EXACT match for your markup
//const source = doc.querySelector(
//'audio[data-able-player] source[type="audio/mpeg"]'
//);
//return source?.src;
//}
//function playAbleAudio(src) {
//const audio = document.getElementById('global-able-player');
//if (!audio) return;
//const source = audio.querySelector('source');
//source.src = src;
//audio.load();
//// Access Able Player instance safely
//if (audio.ablePlayer) {
//audio.ablePlayer.refreshControls();
//audio.ablePlayer.playMedia();
//} else {
//audio.play();
//}
//document.getElementById('global-audio-wrapper')
//?.classList.remove('is-hidden');
//}
//Drupal.behaviors.ablePlayerRemoteLoad = {
//attach(context) {
//once('able-player-fetch', '.js-play-audio-from-node', context)
//.forEach(link => {
//link.addEventListener('click', async e => {
//e.preventDefault();
//const src = await getAudioSourceFromNode(link.href);
//if (!src) {
//console.warn('No Able Player audio found on page');
//return;
//}
//playAbleAudio(src);
//});
//});
//}
//};
//})(Drupal, once);