Favorites

Store and reuse URLs (useful for dashboards, admin pages, or common workflows).
Docs updated: 2025-12-17

Favorites API

Load RTO_favoritesList.js to get window.RTOFavorites:

  • RTOFavorites.list()
  • RTOFavorites.add(url, label?)
  • RTOFavorites.has(url)
  • RTOFavorites.remove(url)
<script src="../RTO_helpers/RTO_favoritesList.js"></script>
<script>
(async function(){
  const url = "https://example.com/dashboard";

  // List favorites
  const list = await RTOFavorites.list();
  console.log("favorites:", list);

  // Add a favorite
  await RTOFavorites.add(url, "Example dashboard");

  // Check
  const exists = await RTOFavorites.has(url);
  console.log("exists?", exists);

  // Remove
  await RTOFavorites.remove(url);
})();
</script>

UI helper

Use RTO_addRemovefavorite.js to bind buttons + list rendering:

<!-- Markup -->
<input id="favUrl" value="https://example.com" />
<input id="favLabel" value="Example" />
<button id="favAdd">Add</button>
<button id="favCheck">Check</button>
<button id="favRemove">Remove</button>
<div id="favMsg" style="display:none"></div>

<div id="favListWrap" style="display:none">
  <h3>Favorites</h3>
  <ul id="favList"></ul>
</div>

<script src="../RTO_helpers/RTO_favoritesList.js"></script>
<script src="../RTO_helpers/RTO_addRemovefavorite.js"></script>
<script>
  RTOFavoritesUI.bind({
    url: document.getElementById("favUrl").value,
    label: document.getElementById("favLabel").value,
    addBtn: "#favAdd",
    checkBtn: "#favCheck",
    removeBtn: "#favRemove",
    msgEl: "#favMsg",
    listWrap: "#favListWrap",
    listEl: "#favList"
  });
</script>

Next