Hi Bene*,
thanks for your effort so far.
First of all,
https://commons.wikimedia.org/wiki/Category:Wikidata_storyboards_-_Badges
is pretty outdated since, as you noted, it does not reflect managing
multiple badges.
However, I am not sure whether using an adaption of the aliases tool
is the most suitable method for adding badges. How about a list of all
badges being able to tick badges on/off by clicking? Having to trigger
a search for badges seems a bit over the edge. Instead of a
"placeholder" badge symbol, all "activated" badges would be displayed
next to each other.
Adding the HTML of the "badge selector" "anchor" right into the
static
table seems reasonable since the the badge(s) should be displayed
without JavaScript as well while not having to maintain two different
implementations.
The "badge selector" should be a jQuery widget of its own. That would
allow having all the functionality and css in the widget's scope
without pasting specific styles in wikibase.css. In addition, the
"badge selector" would be independent as much as possible from the
legacy code of PropertyEditTool and EditableValue derivatives.
Rank selector and snak type selector may be an orientation on how to
proceed. Similar to those, you may use a single pop-up box as well -
you just need to adjust the content / activation state of the badges
according to the corresponding site link. Toggling would be managed by
the widget as well. You will need a mechanism (probably an event) to
notify the SitelinkEditTool when the status of a site link's badges
has changed - most of the logic should actually be pretty similar to
the rank selector.
Regarding the triangle: You could try putting the pop-up contents into
a jQuery.wikibase.wbtooltip or directly into a jQuery.Tipsy instance.