RTO_addRemovefavorite.js
Helper file documentation for
RTO_addRemovefavorite.js.Docs updated: 2026-03-24
Summary
Favorites UI binder.
- Exports:
RTOFavoritesUI - Depends on:
RTO_favoritesList.js
What it is
UI binder for favorites management. It wires your Add / Check / Remove buttons and renders the favorites list.
Best practice: pass urlInput / labelInput so the UI reads the current input values on each click.
In 7.13.0, the helper only shows Added or Removed after the real extension call succeeds.
It no longer documents any fake optimistic success state.
Download
Download RTO_addRemovefavorite.jsExample
This binder is useful when you want a tiny favorites UI without writing the click handlers yourself.
<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"><div id="favList"></div></div>
<script src="../RTO_helpers/RTO_favoritesList.js"></script>
<script src="../RTO_helpers/RTO_addRemovefavorite.js"></script>
<script>
RTOFavoritesUI.bind({
urlInput: "#favUrl",
labelInput: "#favLabel",
addBtn: "#favAdd",
checkBtn: "#favCheck",
removeBtn: "#favRemove",
msgEl: "#favMsg",
listWrap: "#favListWrap",
listEl: "#favList"
});
</script>
Current message behavior
If the add request fails, the helper shows
Not added to favorites.
If the remove request fails, it shows Not removed from favorites.
Success messages appear only after a real success response.
Config fields
urlInput(selector or element): reads the URL at click timelabelInput(selector or element): reads the label at click time (optional)url,label: fixed values (fallback if no inputs are provided)addBtn,checkBtn,removeBtnmsgEllistWrap,listEl