hook into tiddlywiki onclick handler

57 views
Skip to first unread message

Dominik P.

unread,
Nov 19, 2016, 1:31:27 PM11/19/16
to TiddlyWiki
hello :)

i would like to hook into the onclick event handler of the tiddlywiki and access the parent container (wiki is loaded in one of its iframes)
so the parent container scrolls/tabs to the url related iframe and loads the url in the target iframe instead of opening a new tab

is it possible? 
where would i place the code? somewhere in boot.js?
e.g.:
 
$(function(){
    //parent.$(parent.document).trigger('eventhandler');  
document.onclick = function (e) {
 e = e ||  window.event;
 var element = e.target || e.srcElement;

 if (element.tagName == 'A') {
//someFunction(element.href);
if(element.href.includes("http://somelinkiwantinsideotherframe"))
{
parent.loadIframe("otherframe", element.href);
return false; // prevent default action and stop event propagation
}
 }
};
});

thanks for your help!
Reply all
Reply to author
Forward
0 new messages