import { tooltipContainer } from "../inversify.config" ; import type { Card , CardService } from "@yugioh-deck-tool/core" ; import { TYPES } from "@yugioh-deck-tool/core" ; import { browserSupportsTouch } from "@yugioh-deck-tool/browser-common" ; const cardService = tooltipContainer . get < CardService > ( TYPES . CardService ) ; const isHrefBlank = ( target ) : boolean => { const href = target . attributes . getNamedItem ( "href" ) ?. value ; return href == null || href === "" ; } ; export const bindReferenceLink = ( target , card ) : void => { if ( ! browserSupportsTouch ( ) && isHrefBlank ( target ) ) { target . href = cardService . getReferenceLink ( card ) . toString ( ) ; target . target = "_blank" ; } } ;