Custom javascript

Hi there, I’m trying to make the “edit” tab the default when opening a scene, and to move tags and performers to the top of their parent menu. Nothing seems to be working, though I can see my code is there when I open up the script src.


(() => {
  function moveByLabel(forValue, name) {
    const label = document.querySelector(`label[for="${forValue}"]`);
    const block = label.closest('.form-group.row, .form-group, .row');
    const parent = block.parentElement;
    parent.insertBefore(block, parent.firstElementChild);
  }
  document.querySelector('[data-rb-event-key="scene-edit-panel"]').click();
  moveByLabel("performer_ids", "Performers");
  moveByLabel("tag_ids", "Tags");
})();

it works as a snippet, so guessing it’s a timing thing. any suggestions?

There is a community plugin for the edit tab. You can also look at the code for implementation.