123456789101112131415161718192021222324252627282930 |
- /// <reference path="../../Elements/Modules/CurrentTurnHandler.ts" />
- interface CustomLinkOptions {
- mouseover? : () => void;
- mouseout? : () => void;
- click? : (e : MouseEvent) => void;
- }
- module Controls.Links {
- export function makeCustomLink (element : Element, options : CustomLinkOptions) {
- if (options.mouseover != undefined && options.mouseout != undefined) {
- element.addEventListener("mouseover", options.mouseover);
- element.addEventListener("mouseout", options.mouseout);
- }
- element.addEventListener("click", options.click);
- }
- export function makeLink (element : Element, action : Action) {
- makeCustomLink(element, {
- mouseover : () => { Elements.HyperlinkHandler.hoverAction(action); },
- mouseout : () => { Elements.HyperlinkHandler.unhoverAction(); },
- click : (e) => {
- TurnSequence.execute(action);
- Elements.HyperlinkHandler.unhoverAction();
- e.stopPropagation();
- e.preventDefault();
- }
- });
- }
- }
|