<commit_before>var app={
    debug:true,
    //debugInBrowser:true,
    //debugInDiv:true,

    /* This code below, combined with the touch module of zepto helps in resolving issues
       with fastclick on android devices : some devices receive "tap" event before "click" and
       some don't. ensure only one event is fired in all cases.
    */
    touchTimer:null,
    touch:function(selector, touchHandler, allowDefault){
        var preventDefault = allowDefault ? false : true;

        $(selector).each(function(i,elem){
            var elem= $(elem);
            var touchup=function(){
                elem.removeClass('touched');
            };
            var touching=function(e){
                if (!elem.hasClass('touched')){
                    elem.addClass('touched');
                    clearTimeout(app.touchTimer);
                    app.touchTimer = setTimeout(touchup,1000);
                    touchHandler.apply([this, e ]);

                }
                if (preventDefault)
                    return false;
            }
            elem.unbind('tap').on('tap',touching);
            elem.unbind('click').on('click',touching);
        });
    },

    /*
        initPage binds some common links like push and pop and send the page title to the native side
     */
    initPage:function(title){

        app.touch('a.push',function(){
            if ( ! $(this).hasClass('disabled') ){
                cobalt.navigate.push({
                    page : $(this).attr('data-href'),
                    controller : $(this).attr('data-classid')
                });
            }
        });
        app.touch('a.pop',function(){
            cobalt.navigate.pop();
        });
        app.touch('a.popTo',function(){
            cobalt.navigate.popTo({
                page : $(this).attr('data-href'),
                controller : $(this).attr('data-classid')
            });
        });
        app.touch('a.dismiss',function(){
            cobalt.navigate.dismiss();
        });
        app.touch('a.modal',function(){
            cobalt.navigate.modal({
                page : $(this).attr('data-href'),
                controller : $(this).attr('data-classid')
            });
        });

        if (title){
            cobalt.sendEvent('setTexts',{
                title : title
            });
        }

    },


    /* change font size on body. used in events demo page */
    setZoom : function(zoomLevel){
        try{
            document.querySelectorAll('body')[0].style.fontSize=zoomLevel+"px"

        }catch(e){
            cobalt.log(e);
        }
    },

    /* a small assert function used in localStorage and callbacks pages */
    assertEqual : function(testID,func_or_result,expectedResult){
        try{
            var result= ( typeof func_or_result == "function") ? func_or_result() : func_or_result;
            cobalt.log('testing', result, 'vs', expectedResult);
            if (result === expectedResult){<commit_msg>added a small time tracking function<commit_after>var app={
    debug:true,
    //debugInBrowser:true,
    //debugInDiv:true,

    /* This code below, combined with the touch module of zepto helps in resolving issues
       with fastclick on android devices : some devices receive "tap" event before "click" and
       some don't. ensure only one event is fired in all cases.
    */
    touchTimer:null,
    touch:function(selector, touchHandler, allowDefault){
        var preventDefault = allowDefault ? false : true;

        $(selector).each(function(i,elem){
            var elem= $(elem);
            var touchup=function(){
                elem.removeClass('touched');
            };
            var touching=function(e){
                if (!elem.hasClass('touched')){
                    elem.addClass('touched');
                    clearTimeout(app.touchTimer);
                    app.touchTimer = setTimeout(touchup,1000);
                    touchHandler.apply([this, e ]);

                }
                if (preventDefault)
                    return false;
            }
            elem.unbind('tap').on('tap',touching);
            elem.unbind('click').on('click',touching);
        });
    },

    /*
        initPage binds some common links like push and pop and send the page title to the native side
     */
    initPage:function(title){

        app.touch('a.push',function(){
            if ( ! $(this).hasClass('disabled') ){
                cobalt.navigate.push({
                    page : $(this).attr('data-href'),
                    controller : $(this).attr('data-classid')
                });
            }
        });
        app.touch('a.pop',function(){
            cobalt.navigate.pop();
        });
        app.touch('a.popTo',function(){
            cobalt.navigate.popTo({
                page : $(this).attr('data-href'),
                controller : $(this).attr('data-classid')
            });
        });
        app.touch('a.dismiss',function(){
            cobalt.navigate.dismiss();
        });
        app.touch('a.modal',function(){
            cobalt.navigate.modal({
                page : $(this).attr('data-href'),
                controller : $(this).attr('data-classid')
            });
        });

        if (title){
            cobalt.sendEvent('setTexts',{
                title : title
            });
        }
        app.trackPageLoad();

    },
    /* this function can help you tracking page loads */
    trackPageLoad : function () {
        var timeout = 5000;
        var onDomModified = function() {
            var log = window.cobalt && cobalt.log || window.console && console.log;
            window.DOMLastModification = new Date();
            clearTimeout(window.DOMTrackerTimer);
            window.DOMTrackerTimer = setTimeout(function(){
                log('PAGE LOADED AT', window.DOMLastModification)
            },timeout)
        };
        $(document).bind("DOMSubtreeModified", onDomModified);
        onDomModified();
    },
    /* change font size on body. used in events demo page */
    setZoom : function(zoomLevel){
        try{
            document.querySelectorAll('body')[0].style.fontSize=zoomLevel+"px"

        }catch(e){
            cobalt.log(e);
        }
    },

    /* a small assert function used in localStorage and callbacks pages */
    assertEqual : function(testID,func_or_result,expectedResult){
        try{
            var result= ( typeof func_or_result == "function") ? func_or_result() : func_or_result;
            cobalt.log('testing', result, 'vs', expectedResult);
            if (result === expectedResult){
{'fraction_non_alphanumeric': 0.13207261724659608, 'fraction_numerical': 0.002118003025718608, 'mean_word_length': 1.7172215371968762, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '6378432', 'n_tokens_mistral': 1792, 'n_tokens_neox': 1708, 'n_words': 373}