<commit_before>/*
    Document   : Downloads
    Created on : 12.07.2011, 11:26:16
    Author     : Affect
*/
(function(){
    /* Downloads */
    function downloads_constructor(){
        this.layer_name = 'downloads';
        this.row_blocks = ['number', 'd_name','d_progress','d_status'];
        this.superclass = ListLayer.prototype;
        this.dialog = new downloads_dialog_constructor();
        this.dialog.hide();
        this.hide = function(do_not_reset){
            //_debug('downloads.hide');
            this.exit();
            this.superclass.hide.call(this, do_not_reset);
        };
        this.show=function(){
            this.superclass.show.call(this);
            var self = this;
            this.interval = setInterval(function(){self.every_interval.call(self);}, 3500);
            this.every_interval(false);
        }
        this.every_interval = function(do_load_data){
            var obj = [];
            if(stbDownloadManager) {
                //stb.Debug(stbDownloadManager.GetQueueInfo());
                obj = eval(stbDownloadManager.GetQueueInfo());//jsonparce
            }
            this.forFill = null;
            this.forFill = [];
            for(var i=0;i<obj.length;i++) {
                this.forFill.push({
                    'number':(i+1).toString(),
                    'd_name': obj[i].filePath.split('/')[obj[i].filePath.split('/').length-1],
                    'd_progress':(obj[i].progressPct != '-1') ?
                        '<span class="pb"><span style="width:'+(obj[i].progressPct * 110 / 100)+'px;"></span></span><span class="txt">'+obj[i].progressPct.substr(0, 4)+'%</span>':
                        '<span class="pb"><span style="width:0px;"></span></span><span class="txt">0%</span>',
                    'd_status':obj[i].stateStr,
                    'state':obj[i].state,
                    'id':obj[i].id
                });
            }
            if(!do_load_data || do_load_data!=false) {
                this.load_data(true);
            }


        };
        this.load_data = function(true_arg){
            //this.reset();
            //_debug(' * * * * * * * *\nthis.load_data || this.forFill.length: '+this.forFill.length+'\n* * * * * * * *');

            this.total_pages = Math.ceil(this.forFill.length /14);
            this.set_total_items(this.forFill.length);

            var begin = (this.cur_page - 1) * 14;
            var end   = this.cur_page * 14;<commit_msg>Changed states indication<commit_after>/*
    Document   : Downloads
    Created on : 12.07.2011, 11:26:16
    Author     : Affect
*/
(function(){
    /* Downloads */
    function downloads_constructor(){
        this.layer_name = 'downloads';
        this.row_blocks = ['number', 'd_name','d_progress','d_status'];
        this.superclass = ListLayer.prototype;
        this.dialog = new downloads_dialog_constructor();
        this.dialog.hide();

        //this.states = ["Stopped", "WaitingQueue", "Running", "Completed", "TemporaryError", "PermanentError"];
        this.states = [
            get_word("download_stopped"),
            get_word("download_waiting_queue"),
            get_word("download_running"),
            get_word("download_completed"),
            get_word("download_temporary_error"),
            get_word("download_permanent_error")
        ];

        this.hide = function(do_not_reset){
            //_debug('downloads.hide');
            this.exit();
            this.superclass.hide.call(this, do_not_reset);
        };
        this.show=function(){
            this.superclass.show.call(this);
            var self = this;
            this.interval = setInterval(function(){self.every_interval.call(self);}, 3500);
            this.every_interval(false);
        };
        this.every_interval = function(do_load_data){
            var obj = [];
            if(stbDownloadManager) {
                //stb.Debug(stbDownloadManager.GetQueueInfo());
                obj = eval(stbDownloadManager.GetQueueInfo());//jsonparce
            }
            this.forFill = null;
            this.forFill = [];
            for(var i=0;i<obj.length;i++) {
                this.forFill.push({
                    'number':(i+1).toString(),
                    'd_name': obj[i].filePath.split('/')[obj[i].filePath.split('/').length-1],
                    'd_progress':(obj[i].progressPct != '-1') ?
                        '<span class="pb"><span style="width:'+(obj[i].progressPct * 110 / 100)+'px;"></span></span><span class="txt">'+obj[i].progressPct.substr(0, 4)+'%</span>':
                        '<span class="pb"><span style="width:0;"></span></span><span class="txt">0%</span>',
                    //'d_status':obj[i].stateStr,
                    'd_status': this.states[parseInt(obj[i].state)],
                    'state': obj[i].state,
                    'id': obj[i].id
                });
            }
            if(!do_load_data || do_load_data!=false) {
                this.load_data(true);
            }


        };
        this.load_data = function(true_arg){
            //this.reset();
            //_debug(' * * * * * * * *\nthis.load_data || this.forFill.length: '+this.forFill.length+'\n* * * * * * * *');

            this.total_pages = Math.ceil(this.forFill.length /14);
            this.set_total_items(this.forFill.length);

            var begin = (this.cur_page - 1) * 14;
            var end   = this.cur_page * 14;
{'fraction_non_alphanumeric': 0.16718778738274784, 'fraction_numerical': 0.014346146772116977, 'mean_word_length': 1.839686684073107, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 27, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 24, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2075268', 'n_tokens_mistral': 1693, 'n_tokens_neox': 1596, 'n_words': 209}