<commit_before>window.quickUser = 'http://dev.bridgeit.io/authadmin/bridgeit.u/quickuser';
window.ticketFlow = 'http://dev.bridgeit.io/code/bridgeit.u/ticket';
window.locationsService = 'http://dev.bridgeit.io/locate/bridgeit.u/locations';
window.regionsService = 'http://dev.bridgeit.io/locate/bridgeit.u/regions';
window.userRecord = {};
// gmap location
window.map = null;
window.studentMapStyles = [
    {
        featureType: "poi",
        elementType: "labels",
        stylers: [{ visibility: "off" }]
    }
 ];
window.mapOptions = {
    zoom: 15,
    maxZoom: 16,
    center: new google.maps.LatLng(30.2852191,-97.7324101),
    mapTypeId: google.maps.MapTypeId.ROADMAP,
    styles: window.studentMapStyles
};
window.markers = [];

function initIndexPage() {
    bridgeit.useServices({
            realm:"bridgeit.u",
            serviceBase:"http://dev.bridgeit.io"});

    $('#purchaseBttn').prop('disabled', true);
    $('#purchaseTcktFrm').submit(purchaseTicketSubmit);
    $('#loginModalForm').submit(loginSubmit());
    $('#logoutNavbar').click(logoutClick());
    $('#registerModalContent').hide();
    $('#register').click(toggleLoginRegister);
    $('#registerModalForm').submit(registerSubmit);
    // Anonymous token for viewing events
    if(tokenValid(localStorage.bridgeitUAnonymousToken, localStorage.bridgeitUAnonymousTokenExpires)){
        retrieveEvents();
        registerPushUsernameGroup('anonymous',localStorage.bridgeitUAnonymousToken);
    }else{
        anonymousLogin();
    }
    // No Student token
    if(localStorage.bridgeitUToken === undefined){
        showLoginNavbar();
        $('#purchasePanel').hide();
        $('#ticketsPanel').hide();
        $('#locationPanel').hide();
    // Valid Student token - logged in
    } else if(tokenValid(localStorage.bridgeitUToken, localStorage.bridgeitUTokenExpires)){
        studentLoggedIn();
        registerPushUsernameGroup(localStorage.bridgeitUUsername,localStorage.bridgeitUToken);
    // Invalid Student token - log out
    }else{
        studentLogout('expired');
    }
}

function anonymousLogin(){
    // Automatic auth service login with anonymous user that only has bridgeit.doc.getDocument permission
    var postData = {'username' : 'anonymous',
                    'password' : '<PASSWORD>'};
    $.ajax({
        url : window.authService,
        type: 'POST',
        dataType : 'json',
        contentType: 'application/json; charset=utf-8',
        data : JSON.stringify(postData)
    })
    .fail(requestServiceFail('auth service'))
    .done(anonymousLoginDone);
}

function anonymousLoginDone(data, textStatus, jqxhr){
    if( jqxhr.status === 200){
        localStorage.bridgeitUAnonymousToken = data.access_token;
        localStorage.bridgeitUAnonymousTokenExpires = data.expires_in;
        retrieveEvents();
        registerPushUsernameGroup('anonymous',localStorage.bridgeitUAnonymousToken);
    }else{
        serviceRequestUnexpectedStatusAlert('Anonymous Login', jqxhr.status);
    }
}

function studentLoginDone(data, textStatus, jqxhr){<commit_msg>fake push at page reload #1<commit_after>window.quickUser = 'http://dev.bridgeit.io/authadmin/bridgeit.u/quickuser';
window.ticketFlow = 'http://dev.bridgeit.io/code/bridgeit.u/ticket';
window.locationsService = 'http://dev.bridgeit.io/locate/bridgeit.u/locations';
window.regionsService = 'http://dev.bridgeit.io/locate/bridgeit.u/regions';
window.userRecord = {};
// gmap location
window.map = null;
window.studentMapStyles = [
    {
        featureType: "poi",
        elementType: "labels",
        stylers: [{ visibility: "off" }]
    }
 ];
window.mapOptions = {
    zoom: 15,
    maxZoom: 16,
    center: new google.maps.LatLng(30.2852191,-97.7324101),
    mapTypeId: google.maps.MapTypeId.ROADMAP,
    styles: window.studentMapStyles
};
window.markers = [];

function initIndexPage() {
    bridgeit.useServices({
            realm:"bridgeit.u",
            serviceBase:"http://dev.bridgeit.io"});

    $('#purchaseBttn').prop('disabled', true);
    $('#purchaseTcktFrm').submit(purchaseTicketSubmit);
    $('#loginModalForm').submit(loginSubmit());
    $('#logoutNavbar').click(logoutClick());
    $('#registerModalContent').hide();
    $('#register').click(toggleLoginRegister);
    $('#registerModalForm').submit(registerSubmit);
    // Anonymous token for viewing events
    if(tokenValid(localStorage.bridgeitUAnonymousToken, localStorage.bridgeitUAnonymousTokenExpires)){
        retrieveEvents();
        registerPushUsernameGroup('anonymous',localStorage.bridgeitUAnonymousToken);
    }else{
        anonymousLogin();
    }
    // No Student token
    if(localStorage.bridgeitUToken === undefined){
        showLoginNavbar();
        $('#purchasePanel').hide();
        $('#ticketsPanel').hide();
        $('#locationPanel').hide();
    // Valid Student token - logged in
    } else if(tokenValid(localStorage.bridgeitUToken, localStorage.bridgeitUTokenExpires)){
        studentLoggedIn();
        registerPushUsernameGroup(localStorage.bridgeitUUsername,localStorage.bridgeitUToken);
    // Invalid Student token - log out
    }else{
        studentLogout('expired');
    }

    handlePush();
}

function anonymousLogin(){
    // Automatic auth service login with anonymous user that only has bridgeit.doc.getDocument permission
    var postData = {'username' : 'anonymous',
                    'password' : '<PASSWORD>'};
    $.ajax({
        url : window.authService,
        type: 'POST',
        dataType : 'json',
        contentType: 'application/json; charset=utf-8',
        data : JSON.stringify(postData)
    })
    .fail(requestServiceFail('auth service'))
    .done(anonymousLoginDone);
}

function anonymousLoginDone(data, textStatus, jqxhr){
    if( jqxhr.status === 200){
        localStorage.bridgeitUAnonymousToken = data.access_token;
        localStorage.bridgeitUAnonymousTokenExpires = data.expires_in;
        retrieveEvents();
        registerPushUsernameGroup('anonymous',localStorage.bridgeitUAnonymousToken);
    }else{
        serviceRequestUnexpectedStatusAlert('Anonymous Login', jqxhr.status);
    }
}

function studentLoginDone(data, textStatus, jqxhr){
{'fraction_non_alphanumeric': 0.14139776228311984, 'fraction_numerical': 0.008594130047024485, 'mean_word_length': 3.609865470852018, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '6793091', 'n_tokens_mistral': 1844, 'n_tokens_neox': 1803, 'n_words': 285}