Parchment Add‐On to Use JS from ZIL - KVonGit/zil-stuff GitHub Wiki

<script id="parchmentYonk.js">var parchmentYonkCss = `.show {  display:block;}`;

$('head').append('<style>' + parchmentYonkCss + '</style>');

function sendCmd(cmd) {
  $('.dropdown-content').hide();
  $('.Input').val(cmd);
  $('.LineInput').focus();
  $('.Input').trigger(jQuery.Event('keypress', {
    key: 'Enter',
    keyCode: 13,
    which: 13
  }));
}

function processNewLines() {
  $('.Style_normal:not(.processed)').each(function () {
    $(this).html($(this).text()).addClass('processed');
  });
}


window.onload = function(){
  setTimeout(function(){
  // Set up a MutationObserver to watch the output area
  window.port = document.getElementById('gameport');
  window.observer = new MutationObserver(mutations => {
    processNewLines(); // Run whenever something changes in #gameport
  });
  observer.observe(port, { childList: true, subtree: true });

  // Optionally run it once on page load
  processNewLines();
  },500)
};

function removeLastCommandEcho(){
  $('.Style_input').last().parent().remove();
}
</script>
⚠️ **GitHub.com Fallback** ⚠️