Browse Source

add fillElemWithTxt() to fill elements with formatted text with bind actions on it

readme-update
Simon Grim 9 years ago
parent
commit
d33f77a44e
  1. 21
      js/interface_common.js

21
js/interface_common.js

@ -801,6 +801,27 @@ function openConversationModal(peerAlias, resource) {
}); });
} }
function fillElemWithTxt(elem, txt, htmlFormatMsgOpt) {
var formatted = htmlFormatMsg(txt, htmlFormatMsgOpt);
elem.html(formatted.html);
elem.find('a')
.on('mouseup',
function (event) {
var href = event.target.getAttribute('href');
if (href[0] === '#') {
event.data = {route: href};
routeOnClick(event);
} else
muteEvent(event);
}
)
.on('click', {preventDefault: true}, muteEvent)
;
return formatted;
}
function routeOnClick(event) { function routeOnClick(event) {
function routeNewTab(event) { function routeNewTab(event) {

Loading…
Cancel
Save