<commit_before>/*
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you 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.
 */
 
 function initPushwoosh()
{
    //get pushwoosh plugin
    var pushNotification = window.plugins.pushNotification;
    //notify plugin that device is ready, this is VERY important as it will dispatch on start push notification
    pushNotification.onDeviceReady();
 
    //register for push notifications
    pushNotification.registerDevice({ projectid: "103551733757", appid : "5370F-D83D1" },
        function(status) {
            //this is push token
            var pushToken = status;
            console.warn('push token: ' + pushToken);
        },
        function(status) {
            console.warn(JSON.stringify(['failed to register ', status]));
            
        navigator.notification.alert(
          'Al momento non puoi ricevere alcuna notifiche',  // message
           alertDismissed,         // callback
           'Notifica',            // title
           'Done'                  // buttonName
       );

        }
    );
 
    //this function gets called when push notifications has been received
    document.addEventListener('push-notification', function(event) {
        var title = event.notification.title;
        var userData = event.notification.userdata;
        var msg = event.notification.message;
                                 
        if(typeof(msg) != "undefined") {
            console.warn('user data: ' + JSON.stringify(userData));
        }
        
        navigator.notification.alert(
           msg,  		  	   // message
           alertDismissed,    // callback
           'Notifica',             // title
           'Done'            // buttonName
        );
        
       //var notification = event.notification;
       //navigator.notification.alert(
          //'News: ' + notification.aps.alert,  // message
         //alertDismissed,         // callback
         //'Notifica',            // title
         //  'Done'                  // buttonName
        //);
        
        //Next Test
    });
}

function init() {
    document.addEventListener("deviceready", initPushwoosh, true);

}
 
 
var app = {
    // Application Constructor
    initialize: function() {
        this.bindEvents();
    },
    // Bind Event Listeners
    //
    // Bind any events that are required on startup. Common events are:
    // 'load', 'deviceready', 'offline', and 'online'.
    bindEvents: function() {
        document.addEventListener('deviceready', this.onDeviceReady, false);
    },
    // deviceready Event Handler
    //
    // The scope of 'this' is the event. In order to call the 'receivedEvent'
    // function, we must explicity call 'app.receivedEvent(...);'
    onDeviceReady: function() {
		document.addEventListener("resume", onResume, false);
		var orario1;
        app.receivedEvent('deviceready');
    },
    // Update DOM on a Received Event
    receivedEvent: function(id) {
        
        var hoverDelay = $.mobile.buttonMarkup.hoverDelay = 0;
        var ciao;
        var ciao1;
        var dataoggi;
        var storedata;
        var chip;
        var giorni;
        var NomeNews;
        var NomeStrat;
        
        $.mobile.defaultPageTransition = 'none';
        $.mobile.defaultDialogTransition = 'none';
        
        $('body').on('touchmove', function (e) {
            e.preventDefault();
        });
        
        var connectionStatus = false;
        connectionStatus = navigator.onLine ? 'online' : 'offline';
        
        if(connectionStatus=='online'){
        	var connessione = checkConnection();

            checkData();
            
            $('#noconn').hide();
            
            $(".spinner").show();
            
            var landmark = '<table align="center" border="0" width="310px" height="100px">';
            
            $.ajax({
                   type:"GET",
                   url:"http://www.pokeranswer.it/www/Check_News.asp",
                   contentType: "application/json",
                   //data: {ID: "1", ID2: "4"},
                   jsonp: 'callback',<commit_msg>v.3.9.1<commit_after>/*
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you 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.
 */
 
 function initPushwoosh()
{
    //get pushwoosh plugin
    var pushNotification = window.plugins.pushNotification;
    //notify plugin that device is ready, this is VERY important as it will dispatch on start push notification
    pushNotification.onDeviceReady();
 
    //register for push notifications
    pushNotification.registerDevice({ projectid: "103551733757", appid : "5370F-D83D1" },
        function(status) {
            //this is push token
            var pushToken = status;
            console.warn('push token: ' + pushToken);
        },
        function(status) {
            console.warn(JSON.stringify(['failed to register ', status]));
            
        navigator.notification.alert(
          'Al momento non puoi ricevere alcuna notifiche',  // message
           alertDismissed,         // callback
           'Notifica',            // title
           'Done'                  // buttonName
       );

        }
    );
 
    //this function gets called when push notifications has been received
    document.addEventListener('push-notification', function(event) {
        var title = event.notification.title;
        var userData = event.notification.userdata;
        var msg = event.notification.message;
                                 
        if(typeof(msg) != "undefined") {
            console.warn('user data: ' + JSON.stringify(userData));
        }
        
        navigator.notification.alert(
           msg,  		  	   // message
           alertDismissed,    // callback
           'Notifica',             // title
           'Done'            // buttonName
        );
        
       //var notification = event.notification;
       //navigator.notification.alert(
          //'News: ' + notification.aps.alert,  // message
         //alertDismissed,         // callback
         //'Notifica',            // title
         //  'Done'                  // buttonName
        //);
        
        //Next Test
    });
}

function init() {
    document.addEventListener("deviceready", initPushwoosh, true);

}
 
 
var app = {
    // Application Constructor
    initialize: function() {
        this.bindEvents();
    },
    // Bind Event Listeners
    //
    // Bind any events that are required on startup. Common events are:
    // 'load', 'deviceready', 'offline', and 'online'.
    bindEvents: function() {
        document.addEventListener('deviceready', this.onDeviceReady, false);
    },
    // deviceready Event Handler
    //
    // The scope of 'this' is the event. In order to call the 'receivedEvent'
    // function, we must explicity call 'app.receivedEvent(...);'
    onDeviceReady: function() {
		//document.addEventListener("resume", onResume, false);
        app.receivedEvent('deviceready');
    },
    // Update DOM on a Received Event
    receivedEvent: function(id) {
        
        var ciao;
        var ciao1;
        var dataoggi;
        var storedata;
        var chip;
        var giorni;
        var NomeNews;
        var NomeStrat;
		var orario1="00:00";
        
        $('body').on('touchmove', function (e) {
            e.preventDefault();
        });
        
        var connectionStatus = false;
        connectionStatus = navigator.onLine ? 'online' : 'offline';
        
        if(connectionStatus=='online'){
        	var connessione = checkConnection();

            checkData();
            
            $('#noconn').hide();
            
            $(".spinner").show();
            
            var landmark = '<table align="center" border="0" width="310px" height="100px">';
            
            $.ajax({
                   type:"GET",
                   url:"http://www.pokeranswer.it/www/Check_News.asp",
                   contentType: "application/json",
                   //data: {ID: "1", ID2: "4"},
                   jsonp: 'callback',
{'fraction_non_alphanumeric': 0.1080227416298168, 'fraction_numerical': 0.0082122552116235, 'mean_word_length': 1.8577015643802648, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 6, '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': '3343071', 'n_tokens_mistral': 2495, 'n_tokens_neox': 2393, 'n_words': 721}