<commit_before>/**
 * Created by andreas on 02.05.14.
 */
avnav.provide('avnav.gui.Aispage');




/**
 *
 * @constructor
 */
avnav.gui.Aispage=function(){
    avnav.gui.Page.call(this,'aispage');
    /**
     * @private
     * @type {avnav.nav.AisData}
     */
    this.aishandler=null;
    var self=this;
    $(document).on(avnav.nav.NavEvent.EVENT_TYPE, function(ev,evdata){
        self.navEvent(evdata);
    });
};
avnav.inherits(avnav.gui.Aispage,avnav.gui.Page);

avnav.gui.Aispage.prototype.localInit=function(){
    this.aishandler=this.navobject.getAisData();
};
avnav.gui.Aispage.prototype.showPage=function(options) {
    if (!this.gui) return;
    this.fillData(true);
};

avnav.gui.Aispage.prototype.fillData=function(initial){
    var domid="#avi_ais_page_inner";
    var formatter=this.aishandler.getAisFormatter();
    var aisList=this.aishandler.getAisData();
    var html='<div class="avn_ais_infotable">';
    html+='<div class="avn_ais avn_ais_headline">';
    for (var p in formatter){
        html+='<div class="avn_aisparam">'+formatter[p].headline+'</div>';
    }
    html+='</div>';
    var hasTracking=this.aishandler.getTrackedTarget();
    for( var aisidx in aisList){
        var ais=aisList[aisidx];
        var addClass='';
        if (ais.warning) addClass='avn_ais_warning';
        else {
            if ((ais.tracking)|| (ais.nearest && ! hasTracking)) addClass='avn_ais_selected';
        }
        html+='<div class="avn_ais '+addClass+' avn_ais_selector" mmsi="'+ais['mmsi']+'">';
        for (var p in formatter){
            html+='<div class="avn_aisparam">'+formatter[p].format(ais)+'</div>';
        }
        html+='</div>';
    }
    html+='</div>';
    $(domid).html(html);
    $(domid+' .avn_ais_selector').click({self:this},function(ev){
        var mmsi=$(this).attr('mmsi');
        ev.data.self.aishandler.setTrackedTarget(mmsi);
        var pos=ev.data.self.aishandler.getAisPositionByMmsi(mmsi);
        if (pos)ev.data.self.gui.map.setCenter(pos);
        ev.data.self.gui.showPageOrReturn(ev.data.self.returnpage,'navpage');
    });
    if (initial){
        var topElement=$(domid+' .avn_ais_selected').position();
        if (! topElement)topElement=$(domid+' .avn_ais_warning').position();
        if (topElement){<commit_msg>reset gps lock when tapping an AIS target in the list, fixes #8<commit_after>/**
 * Created by andreas on 02.05.14.
 */
avnav.provide('avnav.gui.Aispage');




/**
 *
 * @constructor
 */
avnav.gui.Aispage=function(){
    avnav.gui.Page.call(this,'aispage');
    /**
     * @private
     * @type {avnav.nav.AisData}
     */
    this.aishandler=null;
    var self=this;
    $(document).on(avnav.nav.NavEvent.EVENT_TYPE, function(ev,evdata){
        self.navEvent(evdata);
    });
};
avnav.inherits(avnav.gui.Aispage,avnav.gui.Page);

avnav.gui.Aispage.prototype.localInit=function(){
    this.aishandler=this.navobject.getAisData();
};
avnav.gui.Aispage.prototype.showPage=function(options) {
    if (!this.gui) return;
    this.fillData(true);
};

avnav.gui.Aispage.prototype.fillData=function(initial){
    var domid="#avi_ais_page_inner";
    var formatter=this.aishandler.getAisFormatter();
    var aisList=this.aishandler.getAisData();
    var html='<div class="avn_ais_infotable">';
    html+='<div class="avn_ais avn_ais_headline">';
    for (var p in formatter){
        html+='<div class="avn_aisparam">'+formatter[p].headline+'</div>';
    }
    html+='</div>';
    var hasTracking=this.aishandler.getTrackedTarget();
    for( var aisidx in aisList){
        var ais=aisList[aisidx];
        var addClass='';
        if (ais.warning) addClass='avn_ais_warning';
        else {
            if ((ais.tracking)|| (ais.nearest && ! hasTracking)) addClass='avn_ais_selected';
        }
        html+='<div class="avn_ais '+addClass+' avn_ais_selector" mmsi="'+ais['mmsi']+'">';
        for (var p in formatter){
            html+='<div class="avn_aisparam">'+formatter[p].format(ais)+'</div>';
        }
        html+='</div>';
    }
    html+='</div>';
    $(domid).html(html);
    $(domid+' .avn_ais_selector').click({self:this},function(ev){
        var mmsi=$(this).attr('mmsi');
        ev.data.self.aishandler.setTrackedTarget(mmsi);
        var pos=ev.data.self.aishandler.getAisPositionByMmsi(mmsi);
        if (pos)ev.data.self.gui.map.setCenter(pos);
        ev.data.self.gui.map.setGpsLock(false);
        ev.data.self.gui.showPageOrReturn(ev.data.self.returnpage,'navpage');
    });
    if (initial){
        var topElement=$(domid+' .avn_ais_selected').position();
        if (! topElement)topElement=$(domid+' .avn_ais_warning').position();
        if (topElement){
{'fraction_non_alphanumeric': 0.18302614659237035, 'fraction_numerical': 0.002786112301757394, 'mean_word_length': 3.3821596244131453, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7448738', 'n_tokens_mistral': 1732, 'n_tokens_neox': 1715, 'n_words': 218}