<commit_before>/*
 * Copyright (C) 2014-2014 52°North Initiative for Geospatial Open Source
 * Software GmbH
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
var TimeController = {
    currentTimespan: {},
    timeRangeData: {
        presets: [
            {label: _('timeSelection.presets.today'), value: 'today'},
            {label: _('timeSelection.presets.yesterday'), value: 'yesterday'},
            {label: _('timeSelection.presets.todayYesterday'), value: 'today_yesterday'},
            {label: _('timeSelection.presets.thisWeek'), value: 'thisWeek'},
            {label: _('timeSelection.presets.lastWeek'), value: 'lastWeek'},
            {label: _('timeSelection.presets.thisMonth'), value: 'thisMonth'},
            {label: _('timeSelection.presets.lastMonth'), value: 'lastMonth'},
            {label: _('timeSelection.presets.thisYear'), value: 'thisYear'},
            {label: _('timeSelection.presets.lastYear'), value: 'lastYear'}
        ]
    },
    init: function() {
        // get last save timespan
        this.currentTimespan = Status.get('timespan');
        $(document).ready(function() {
            $('[data-action=before]').click($.proxy(function() {
                TimeController.prevPeriode();
            }, this));
            $('[data-action=after]').click($.proxy(function() {
                TimeController.nextPeriode();
            }, this));
            $('[data-action=timeextent]').click($.proxy(function() {
                Modal.show("time-range-settings", TimeController.timeRangeData);
                var from = moment(TimeController.currentTimespan.from);
                var till = moment(TimeController.currentTimespan.till);
                $('#startPicker').text(from.format(Settings.dateformat));
                $('#endPicker').text(till.format(Settings.dateformat));
                $('#startPicker').data('date', from.format("YYYY-MM-DD"));
                $('#endPicker').data('date', till.format("YYYY-MM-DD"));
                $('#alertTimeExtent').hide();

                $('#startPicker').datepicker({position: 'above'}).on('changeDate', TimeController.evaluateDate);
                $('#endPicker').datepicker({position: 'above'}).on('changeDate', TimeController.evaluateDate);

                $('#confirmTimeExtent').click(function(event) {
                    var from = moment($('#startPicker').data('date')).startOf('day');
                    var till = moment($('#endPicker').data('date')).endOf('day');
                    TimeController.currentTimespan = {
                        from: from,<commit_msg>fire event for time span loaded from local storage<commit_after>/*
 * Copyright (C) 2014-2014 52°North Initiative for Geospatial Open Source
 * Software GmbH
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
var TimeController = {
    currentTimespan: {},
    timeRangeData: {
        presets: [
            {label: _('timeSelection.presets.today'), value: 'today'},
            {label: _('timeSelection.presets.yesterday'), value: 'yesterday'},
            {label: _('timeSelection.presets.todayYesterday'), value: 'today_yesterday'},
            {label: _('timeSelection.presets.thisWeek'), value: 'thisWeek'},
            {label: _('timeSelection.presets.lastWeek'), value: 'lastWeek'},
            {label: _('timeSelection.presets.thisMonth'), value: 'thisMonth'},
            {label: _('timeSelection.presets.lastMonth'), value: 'lastMonth'},
            {label: _('timeSelection.presets.thisYear'), value: 'thisYear'},
            {label: _('timeSelection.presets.lastYear'), value: 'lastYear'}
        ]
    },
    init: function() {
        // get last save timespan
        this.currentTimespan = Status.get('timespan');
        this.updateTimeExtent();
        $(document).ready(function() {
            $('[data-action=before]').click($.proxy(function() {
                TimeController.prevPeriode();
            }, this));
            $('[data-action=after]').click($.proxy(function() {
                TimeController.nextPeriode();
            }, this));
            $('[data-action=timeextent]').click($.proxy(function() {
                Modal.show("time-range-settings", TimeController.timeRangeData);
                var from = moment(TimeController.currentTimespan.from);
                var till = moment(TimeController.currentTimespan.till);
                $('#startPicker').text(from.format(Settings.dateformat));
                $('#endPicker').text(till.format(Settings.dateformat));
                $('#startPicker').data('date', from.format("YYYY-MM-DD"));
                $('#endPicker').data('date', till.format("YYYY-MM-DD"));
                $('#alertTimeExtent').hide();

                $('#startPicker').datepicker({position: 'above'}).on('changeDate', TimeController.evaluateDate);
                $('#endPicker').datepicker({position: 'above'}).on('changeDate', TimeController.evaluateDate);

                $('#confirmTimeExtent').click(function(event) {
                    var from = moment($('#startPicker').data('date')).startOf('day');
                    var till = moment($('#endPicker').data('date')).endOf('day');
                    TimeController.currentTimespan = {
                        from: from,
{'fraction_non_alphanumeric': 0.15350175887432044, 'fraction_numerical': 0.004477134633834346, 'mean_word_length': 2.7033747779751334, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, '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': '5513424', 'n_tokens_mistral': 1690, 'n_tokens_neox': 1617, 'n_words': 364}