Browse Source

fix wrong bindings for hyperlinks in fillElemWithTxt()

readme-update
Simon Grim 9 years ago
parent
commit
3d68b90ef9
  1. 23
      js/interface_common.js

23
js/interface_common.js

@ -805,19 +805,16 @@ function fillElemWithTxt(elem, txt, htmlFormatMsgOpt) {
var formatted = htmlFormatMsg(txt, htmlFormatMsgOpt); var formatted = htmlFormatMsg(txt, htmlFormatMsgOpt);
elem.html(formatted.html); elem.html(formatted.html);
elem.find('a') elem.find('a').each(function (i, elem) {
.on('mouseup', var href = elem.getAttribute('href');
function (event) { if (href && href[0] === '#')
var href = event.target.getAttribute('href'); $(elem)
if (href[0] === '#') { .on('click', {preventDefault: true}, muteEvent)
event.data = {route: href}; .on('mouseup', {route: href}, routeOnClick)
routeOnClick(event); ;
} else else
muteEvent(event); $(elem).on('click mouseup', muteEvent);
} });
)
.on('click', {preventDefault: true}, muteEvent)
;
return formatted; return formatted;
} }

Loading…
Cancel
Save