<commit_before>define([
    "./core"
], function( Cinematic ) {

//TODO re-indent
Cinematic.extend( "query", function( name, reset) {
    // We do two requests each first search
    // since omdbAPI limit each request to 10
    // movies per page.
    var
        reset = reset || false;

    if ( reset ) {
        // Reset
        Cinematic.lastPage = 1;
        Cinematic.clearResults();
        Cinematic.newRequest( name );
        Cinematic.newRequest( name );
    } else {
        Cinematic.newRequest( name );
    }
}, true);

Cinematic.extend( "newRequest", function( name ) {
        var msg = new Message( "loading...", "bottom");
        const URI = "http://www.omdbapi.com/?s=" + name + "&page=" + Cinematic.lastPage++;
        $.ajax({
            url: URI,
            "success": function( data ){
                if ( data.Response == 'True' ) {
                    Cinematic.lastResults = data;<commit_msg>Ajax: improved loading msg to be shown on timeout<commit_after>define([
    "./core"
], function( Cinematic ) {

var msg;

function connTimeout() {
    msg = new Message( "loading...", "bottom");
}

//TODO re-indent
Cinematic.extend( "query", function( name, reset) {
    // We do two requests each first search
    // since omdbAPI limit each request to 10
    // movies per page.
    var
        reset = reset || false;

    if ( reset ) {
        // Reset
        Cinematic.lastPage = 1;
        Cinematic.clearResults();
        Cinematic.newRequest( name );
        Cinematic.newRequest( name );
    } else {
        Cinematic.newRequest( name );
    }
}, true);

Cinematic.extend( "newRequest", function( name ) {
        var timeout = setTimeout( connTimeout, 1000),
            URI = "http://www.omdbapi.com/?s=" + name + "&page=" + Cinematic.lastPage++;
        $.ajax({
            url: URI,
            "success": function( data ){
                clearTimeout( timeout );
                if ( data.Response == 'True' ) {
                    Cinematic.lastResults = data;
{'fraction_non_alphanumeric': 0.1396508728179551, 'fraction_numerical': 0.004987531172069825, 'mean_word_length': 1.967455621301775, 'pattern_counts': {'":': 2, '<': 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': '2524207', 'n_tokens_mistral': 615, 'n_tokens_neox': 587, 'n_words': 162}