How to open Arbor.js node link in a new window?

311 views Asked by At

I'm new to Arbor.js and js in general. I have a page set up with nodes and edges - bottom level nodes are clickable and open links in the same window. I'd like links to open in new windows. Could anyone offer any advice?

I believe the relevant code is as follows:

 moved:function(e){
        var pos = $(canvas).offset();
        _mouseP = arbor.Point(e.pageX-pos.left, e.pageY-pos.top)
        nearest = sys.nearest(_mouseP);

        if (!nearest.node) return false

        if (nearest.node.data.shape!='dot'){
          selected = (nearest.distance < 80) ? nearest : null
          if (selected){
             dom.addClass('linkable')
             window.status = selected.node.data.link.replace(/^\//,"http://"+window.location.host+"/").replace(/^#/,'')
          }
          else{
             dom.removeClass('linkable')
             window.status = ''
          }
        }else if ($.inArray(nearest.node.name, ['Library','Materials','Documentation','Literature']) >=0 ){
          if (nearest.node.name!=_section){
            _section = nearest.node.name
            that.switchSection(_section)
          }
          dom.removeClass('linkable')
          window.status = ''
        }

        return false

I'm focusing around window.status but I don't know enough about this.

Any help will be much appreciated, thanks.

1

There are 1 answers

0
smck1 On

I'm using:

window.open(selected.node.data.link);