<commit_before>function AndroidBackend() {
    this._token = "";
    this._httpBuilder = new SimpleHtmlBuilder();
}

AndroidBackend.prototype.getToken = function (_callback, that) {
    if (this._token !== "") {
        return this._token;
    }

    this._token = Android.getToken();
    //console.log("Token is : " + this._token);
    if (that !== null) {
        _callback(this._token, that)
    } else {
        _callback(this._token);
    }

    return this._token;
};


// TODO: Create getters and setters / "interface" for feature(s)
ComputerBackend.prototype.showBottmsheet = function (feature) {
    var body = $("#bottom_sheet_container");
    body.text("");
    body.append(this._httpBuilder.getSelfContainedHeading(4, feature._name));
    this._httpBuilder.clear();
    if (feature._type === BarentswatchApiObjectTypes.AIS) {
        body.append("<h6 class='grey-text grey lighten-5 align-material-c-to-title'>" + feature.getShipTypeString() + "</h6>");
    } else {
        body.append("<h6 class='grey-text grey lighten-5 align-material-c-to-title'>" + feature._norwegianTitle + "</h6>");
    }
    body.append("<br>");
    body.append("<div class='divider'></div>");
    var content = "";

    switch (feature._type) {
        case BarentswatchApiObjectTypes.TOOL:
            content = this._showToolBottomsheet(feature);
            break;
        case BarentswatchApiObjectTypes.SEABOTTOM_INSTALLATION:
            content = this._showSubsurfaceFacilityBottomsheet(feature);
            break;
        case BarentswatchApiObjectTypes.JMESSAGE:
            content = this._createJMessageBottomsheetContent(feature);
            break;
        case BarentswatchApiObjectTypes.CORAL_REEF:
            content = this._createCoralReefBottomsheet(feature);
            break;
        case BarentswatchApiObjectTypes.COASTLINES_COD:
            return new CoastlinesCod();
        case BarentswatchApiObjectTypes.ICE_CONSENTRATION:
            return new IceConsentration();
        case BarentswatchApiObjectTypes.ONGOING_SEISMIC:
        case BarentswatchApiObjectTypes.PLANNED_SEISMIC:
            content = this._buildSeismicBottomsheetText(feature);
            break;
        case BarentswatchApiObjectTypes.AIS:
            content = this._createAisBottomsheet(feature);
            break;
        default:
            return null;
    }

    body.append(content);
    var bottomSheet = document.querySelector("#bottom_sheet");
    $('.collapsible').collapsible();
    var instance = M.Modal.getInstance(bottomSheet);
    instance.open();
};

ComputerBackend.prototype._createIceChartConsentrationContent = function (feature) {

};

ComputerBackend.prototype._showToolBottomsheet = function (feature) {
    var retval = "";
    retval += this._httpBuilder.createModalIconLine("date_range", "Tid i havet", feature.getTimePlacedInOcean());
    retval += this._httpBuilder.createModalIconLine("date_range", "Satt", feature.getFormattedTimeSetInOcean());
    retval += this._httpBuilder.createModalIconLine("place", "Posisjon", feature.getCoordinates());
    retval += this._httpBuilder.createModalIconLine("link", "Se Marinogram", "<a target='_blank' href='https://www.yr.no/sted/hav/" + feature._position[1] + "_" + feature._position[0] + "'" + ">Marinogram</a>");<commit_msg>Reset bottomsheets to always start at top<commit_after>function AndroidBackend() {
    this._token = "";
    this._httpBuilder = new SimpleHtmlBuilder();
}

AndroidBackend.prototype.getToken = function (_callback, that) {
    if (this._token !== "") {
        return this._token;
    }

    this._token = Android.getToken();
    //console.log("Token is : " + this._token);
    if (that !== null) {
        _callback(this._token, that)
    } else {
        _callback(this._token);
    }

    return this._token;
};


// TODO: Create getters and setters / "interface" for feature(s)
ComputerBackend.prototype.showBottmsheet = function (feature) {
    var body = $("#bottom_sheet_container");
    body.text("");
    body.append(this._httpBuilder.getSelfContainedHeading(4, feature._name));
    this._httpBuilder.clear();
    if (feature._type === BarentswatchApiObjectTypes.AIS) {
        body.append("<h6 class='grey-text grey lighten-5 align-material-c-to-title'>" + feature.getShipTypeString() + "</h6>");
    } else {
        body.append("<h6 class='grey-text grey lighten-5 align-material-c-to-title'>" + feature._norwegianTitle + "</h6>");
    }
    body.append("<br>");
    body.append("<div class='divider'></div>");
    var content = "";

    switch (feature._type) {
        case BarentswatchApiObjectTypes.TOOL:
            content = this._showToolBottomsheet(feature);
            break;
        case BarentswatchApiObjectTypes.SEABOTTOM_INSTALLATION:
            content = this._showSubsurfaceFacilityBottomsheet(feature);
            break;
        case BarentswatchApiObjectTypes.JMESSAGE:
            content = this._createJMessageBottomsheetContent(feature);
            break;
        case BarentswatchApiObjectTypes.CORAL_REEF:
            content = this._createCoralReefBottomsheet(feature);
            break;
        case BarentswatchApiObjectTypes.COASTLINES_COD:
            return new CoastlinesCod();
        case BarentswatchApiObjectTypes.ICE_CONSENTRATION:
            return new IceConsentration();
        case BarentswatchApiObjectTypes.ONGOING_SEISMIC:
        case BarentswatchApiObjectTypes.PLANNED_SEISMIC:
            content = this._buildSeismicBottomsheetText(feature);
            break;
        case BarentswatchApiObjectTypes.AIS:
            content = this._createAisBottomsheet(feature);
            break;
        default:
            return null;
    }

    body.append(content);
    var bottomSheet = document.querySelector("#bottom_sheet");
    $('.collapsible').collapsible();
    var instance = M.Modal.getInstance(bottomSheet);
        instance.options.onCloseStart = function() {
        $("#bottom_sheet").scrollTop(0);
    };
    instance.open();
};

ComputerBackend.prototype._createIceChartConsentrationContent = function (feature) {

};

ComputerBackend.prototype._showToolBottomsheet = function (feature) {
    var retval = "";
    retval += this._httpBuilder.createModalIconLine("date_range", "Tid i havet", feature.getTimePlacedInOcean());
    retval += this._httpBuilder.createModalIconLine("date_range", "Satt", feature.getFormattedTimeSetInOcean());
    retval += this._httpBuilder.createModalIconLine("place", "Posisjon", feature.getCoordinates());
    retval += this._httpBuilder.createModalIconLine("link", "Se Marinogram", "<a target='_blank' href='https://www.yr.no/sted/hav/" + feature._position[1] + "_" + feature._position[0] + "'" + ">Marinogram</a>");
{'fraction_non_alphanumeric': 0.12900342618799346, 'fraction_numerical': 0.0028303292119767616, 'mean_word_length': 3.3260309278350517, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 21, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, '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': '668194', 'n_tokens_mistral': 1977, 'n_tokens_neox': 1979, 'n_words': 322}