BeamerReveal

 view release on metacpan or  search on metacpan

share/templates/html/main.html  view on Meta::CPAN

		  arrow: false,
		  appendTo: function(el) {
                      return el.closest('section.slide') || el.parentElement;
		  },
		  interactive: true,
		  interactiveBorder: 10,
		  theme: 'light-border',
		  placement: 'bottom-start',
              };
              if (contentFn) {
		  config.content = contentFn;
              }
              if (onTriggerFn) {
		  config.onTrigger = onTriggerFn;
              }
              if (onUntriggerFn) {
		  config.onUntrigger = onUntriggerFn;
              }
              config['offset'] = [0,0];
              config['maxWidth'] = 700;
              window.tippy(el, config); 
          }
          const noterefs = window.document.querySelectorAll('a[role="doc-noteref"]');
          for (var i=0; i<noterefs.length; i++) {
              const ref = noterefs[i];
              tippyHover(ref, function() {
		  // use id or data attribute instead here
		  let href = ref.getAttribute('data-footnote-href') || ref.getAttribute('href');
		  try { href = new URL(href).hash; } catch {}
		  const id = href.replace(/^#\/?/, "");
		  const note = window.document.getElementById(id);
		  if (note) {
		      return note.innerHTML;
		  } else {
		      return "";
		  }
              });
          }
          const findCites = (el) => {
              const parentEl = el.parentElement;
              if (parentEl) {
		  const cites = parentEl.dataset.cites;
		  if (cites) {
		      return {
			  el,
			  cites: cites.split(' ')
		      };
		  } else {
		      return findCites(el.parentElement)
		  }
              } else {
		  return undefined;
              }
          };
          var bibliorefs = window.document.querySelectorAll('a[role="doc-biblioref"]');
          for (var i=0; i<bibliorefs.length; i++) {
              const ref = bibliorefs[i];
              const citeInfo = findCites(ref);
              if (citeInfo) {
		  tippyHover(citeInfo.el, function() {
		      var popup = window.document.createElement('div');
		      citeInfo.cites.forEach(function(cite) {
			  var citeDiv = window.document.createElement('div');
			  citeDiv.classList.add('hanging-indent');
			  citeDiv.classList.add('csl-entry');
			  var biblioDiv = window.document.getElementById('ref-' + cite);
			  if (biblioDiv) {
			      citeDiv.innerHTML = biblioDiv.innerHTML;
			  }
			  popup.appendChild(citeDiv);
		      });
		      return popup.innerHTML;
		  });
              }
          }
      });
    </script>
    
    <script>
      // added by DMW
      /*
      function log(msg) {
	  let el = document.getElementById("keylog");
	  if (!el) {
	      el = document.createElement("pre");
	      el.id = "keylog";
	      el.style.position = "fixed";
	      el.style.bottom = "0";
	      el.style.left = "0";
	      el.style.maxHeight = "40vh";
	      el.style.overflow = "auto";
	      el.style.background = "rgba(0,0,0,0.7)";
	      el.style.color = "white";
	      el.style.padding = "8px";
	      el.style.zIndex = "99999";
	      document.body.appendChild(el);
	  }
	  el.textContent += msg + "\n";
	  }
      */

      document.addEventListener("keydown", (e) => {
	  const k = e.key.toLowerCase();
	  if ( k !== "v" && k !== "a" && k !== "i" ) return;

	  // Don't let Reveal handle this key
	  e.preventDefault();
	  e.stopImmediatePropagation();

	  const slide = Reveal.getCurrentSlide();
	  if (!slide) return;

	  let item;
	  if( k == "v" ) {
	      item = slide.querySelector("video");
	  }
	  if( k == "a" ) {
	      item = slide.querySelector( "audio" );
	  }
	  
	  if (item) {
	      if (item.paused || item.ended) {
		  item.play().catch(()=>{});
	      } else {
		  item.pause();
	      }
	  }

	  if( k == "i" ) {
	      document.querySelectorAll("video").forEach(v => {
		  v.pause();
		  v.currentTime = 0;



( run in 1.479 second using v1.01-cache-2.11-cpan-364913b4093 )