<commit_before><!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>
<link href='http://fonts.googleapis.com/css?family=Volkhov:400,400italic,700,700italic' rel='stylesheet' type='text/css'/>
<style type="text/css">
</style>

<title>Hystoria</title>
<link rel="stylesheet" type="text/css" src="style.css"/>
<!-- The following (socket.io.js) is only required when using the node_server -->
<!--<script src="../../socket.io/socket.io.js"></script>-->
<script src="libs/Breakout.min.js"></script>
<script src="libs/fastclick.min.js"></script>
<script src="libs/jquery.min.js"></script>
<script type="text/javascript">

$(document).ready(function() {
    // Declare these variables so you don't have
    // to type the full namespace
    var IOBoard = BO.IOBoard;
    var IOBoardEvent = BO.IOBoardEvent;
    var LED = BO.io.LED;
    var Button = BO.io.Button;
    var ButtonEvent = BO.io.ButtonEvent;

    // Set to true to print debug messages to console
    BO.enableDebugging = true; 
    
    // If you are not serving this file from the same computer
    // that the Arduino board is connected to, replace
    // window.location.hostname with the IP address or hostname
    // of the computer that the Arduino board is connected to.
    var host = window.location.hostname;
    // if the file is opened locally, set the host to "localhost"
    if (window.location.protocol.indexOf("file:") === 0) {
        host = "localhost";
    }

    // attach fastclick to avoid 300ms click delay on mobile devices
    FastClick.attach(document.body);

    var arduino = new IOBoard(host, 8887);
    
    // Variables
    var led;
    var button;
    var $state = $('#state');
    var $schematic = $('#schematic');

/*
    // Handle showing and hiding the schematic
    $('#schematicBtn').on('click', toggleSchematicView); 
*/   

    // Listen for the IOBoard READY event which indicates the IOBoard
    // is ready to send and receive data
    arduino.addEventListener(IOBoardEvent.READY, onReady);

    function onReady(event) {
        // Remove the event listener because it is no longer needed
        arduino.removeEventListener(IOBoardEvent.READY, onReady);

        // Create an LED object to interface with the LED wired
        // to the I/O board
        led = new LED(arduino, arduino.getDigitalPin(11));

        // Create a new Button object to interface with the physical
        // button wired to the I/O board
        button = new Button(arduino, arduino.getDigitalPin(2));
        
        // Listen for button press and release events
		button.addEventListener(ButtonEvent.PRESS, onPress);
		//FUNZIONE COMBINAZIONE DI TASTI
		
        button.addEventListener(ButtonEvent.RELEASE, onRelease);
        
/*
        // Use jQuery to get a reference to the buttons
        // and listen for click events 
        $('#btnLeft').on('click', turnLedOff);
        $('#btnRight').on('click', turnLedOn);
*/      
    }

    function onPress(evt) {
        // Get a reference to the target which is the button that 
        // triggered the event
        var btn = evt.target;
        // Display the state on the page
        $state.html("Button " + btn.pinNumber + " state: Pressed");myPress();
		
        
    }

    function onRelease(evt) {
        // Get a reference to the target which is the button that 
        // triggered the event      
        var btn = evt.target;
        // Display the state on the page
        $state.html("Button " + btn.pinNumber + " state: Released");
    }

/*
    function turnLedOn(evt) {
        // Turn the LED on
        led.on();
    }

    function turnLedOff(evt) {
        // Turn the LED off
        led.off();  
    }
*/

/*
    // Show or hide the schematic
    function toggleSchematicView(evt) {
        var schematicBtn = $(this);
        if (schematicBtn.data('state') === "hidden") {
            schematicBtn.text("Hide Schematic");
            schematicBtn.data('state', "visible");
            $schematic.css('display', 'block');
        } else {
            schematicBtn.text("Show Schematic");
            schematicBtn.data('state', "hidden");
            $schematic.css('display', 'none');
        }   
    }
*/
});
</script>
</head>
<body>
        <div class="container">
            <p><strong>Input:</strong> Press the button on the breadboard to display the state below.</p>
            <p id="state">Display Button State</p>
        </div>
        <img id="schematic" src="">
        <button id="schematicBtn" data-state="hidden">Show Schematic</button>

<div id="topCont">Historia: esperimento di scrittura collettiva</div>
		<textarea wrap="off" onchange="checkWordLen(this);" onfocus="clearContents(this);" id="newCont" maxlength="140" rows="3" cols="40" autofocus></textarea>
		<!--<button onclick="renderStory()" id="addCont">Aggiungi!</button>--></br>
		<div id="baseCont">Premi il pulsante </br></br></br></br></br></br>/*VERSIONE TEST - PULSANTE: ENTER - QUI SOTTO VIENE VISUALIZZATO IL CONTENUTO DEL SECONDO SCHERMO*/</div></br></br></br></br></br></br>
	<div id="storyContainer"></div>	
</body>
<script>
// MEMORIA, FUNCTION CALLS E PULSANTE //
function myPress(){checkWord(gidd('newCont'));
						if(iniziato==0){myInit()}
						else if(iniziato==1){checkWordLen(document.getElementById('newCont'));}
						else if(iniziato==3){checkWordLen(document.getElementById('newCont'));}
						if(check==1){renderStory();check=0;iniziato=2;myInit()}}
						
window.iniziato=0;window.check=0;

//MOTORE//
function myInit(){
	//INIZIO STORIA//
if(iniziato == 0){
gidd('topCont').innerHTML='L\'incipit della storia deve essere di almeno 8 parole';
gidd('newCont').innerHTML='...';
gidd('baseCont').innerHTML='Come inizia?';iniziato=1;}
   //LOADING PERSONA SUCCESSIVA//
else if(iniziato == 2){
gidd('baseCont').innerHTML='Loading..';
gidd('topCont').innerHTML='Perfetto! Ora lascia libera la tastiera per far continuare qualcun’altro!';
clearContents(gidd('newCont'));gidd('newCont').setAttribute('opacity','0');
setTimeout('iniziato=3;myInit()',4000)
}
   //INSERIMENTO NUOVO CONTENUTO//
else if(iniziato == 3){gidd('newCont').setAttribute('opacity','1');
gidd('topCont').innerHTML=newCont+'...';
gidd('newCont').innerHTML='[...]';gidd('newCont').setAttribute('onfocus','');
gidd('baseCont').innerHTML='Continua la storia digitando altre 8 parole';
}
}
window.gidd=function(s){return document.getElementById(s)};
//RENDER STORY//
function renderStory(){window.newCont=gidd('newCont').value;
if(newCont!='prosegui la storia..'||newCont!=''){gidd('storyContainer').innerHTML+=' '+newCont;
gidd('newCont').value='';
}else{alert('Inserisci un nuovo pezzo della storia!')}}
function clearContents(element) {element.value = '';}
// CONTROLLA IL LIMITE DELLE PAROLE //
    var wordLen = 8;  // NUMERO DI PAROLE MINIMO //
	function checkWord(obj){var len = obj.value.split(/[\s]+/);if(len.length>=wordLen){gidd('baseCont').innerHTML='Premi il pulsante';}
	else{gidd('baseCont').innerHTML='Inserisci almeno 8 parole';}}
     function checkWordLen(obj){
      var len = obj.value.split(/[\s]+/);
       if(len.length < wordLen){<commit_msg>rimo inut<commit_after><!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>
<link href='http://fonts.googleapis.com/css?family=Volkhov:400,400italic,700,700italic' rel='stylesheet' type='text/css'/>
<style type="text/css">
</style>

<title>Hystoria</title>
<link rel="stylesheet" type="text/css" src="style.css"/>
<!-- The following (socket.io.js) is only required when using the node_server -->
<!--<script src="../../socket.io/socket.io.js"></script>-->
<script src="libs/Breakout.min.js"></script>
<script src="libs/fastclick.min.js"></script>
<script src="libs/jquery.min.js"></script>
<script type="text/javascript">

$(document).ready(function() {
    // Declare these variables so you don't have
    // to type the full namespace
    var IOBoard = BO.IOBoard;
    var IOBoardEvent = BO.IOBoardEvent;
    var LED = BO.io.LED;
    var Button = BO.io.Button;
    var ButtonEvent = BO.io.ButtonEvent;

    // Set to true to print debug messages to console
    BO.enableDebugging = true; 
    
    // If you are not serving this file from the same computer
    // that the Arduino board is connected to, replace
    // window.location.hostname with the IP address or hostname
    // of the computer that the Arduino board is connected to.
    var host = window.location.hostname;
    // if the file is opened locally, set the host to "localhost"
    if (window.location.protocol.indexOf("file:") === 0) {
        host = "localhost";
    }

    // attach fastclick to avoid 300ms click delay on mobile devices
    FastClick.attach(document.body);

    var arduino = new IOBoard(host, 8887);
    
    // Variables
    var led;
    var button;
    var $state = $('#state');
    var $schematic = $('#schematic');

/*
    // Handle showing and hiding the schematic
    $('#schematicBtn').on('click', toggleSchematicView); 
*/   

    // Listen for the IOBoard READY event which indicates the IOBoard
    // is ready to send and receive data
    arduino.addEventListener(IOBoardEvent.READY, onReady);

    function onReady(event) {
        // Remove the event listener because it is no longer needed
        arduino.removeEventListener(IOBoardEvent.READY, onReady);

        // Create an LED object to interface with the LED wired
        // to the I/O board
        led = new LED(arduino, arduino.getDigitalPin(11));

        // Create a new Button object to interface with the physical
        // button wired to the I/O board
        button = new Button(arduino, arduino.getDigitalPin(2));
        
        // Listen for button press and release events
		button.addEventListener(ButtonEvent.PRESS, onPress);
		//FUNZIONE COMBINAZIONE DI TASTI
		
        button.addEventListener(ButtonEvent.RELEASE, onRelease);
        
/*
        // Use jQuery to get a reference to the buttons
        // and listen for click events 
        $('#btnLeft').on('click', turnLedOff);
        $('#btnRight').on('click', turnLedOn);
*/      
    }

    function onPress(evt) {
        // Get a reference to the target which is the button that 
        // triggered the event
        var btn = evt.target;
        // Display the state on the page
        $state.html("Button " + btn.pinNumber + " state: Pressed");myPress();
		
        
    }

    function onRelease(evt) {
        // Get a reference to the target which is the button that 
        // triggered the event      
        var btn = evt.target;
        // Display the state on the page
        $state.html("Button " + btn.pinNumber + " state: Released");
    }

/*
    function turnLedOn(evt) {
        // Turn the LED on
        led.on();
    }

    function turnLedOff(evt) {
        // Turn the LED off
        led.off();  
    }
*/

/*
    // Show or hide the schematic
    function toggleSchematicView(evt) {
        var schematicBtn = $(this);
        if (schematicBtn.data('state') === "hidden") {
            schematicBtn.text("Hide Schematic");
            schematicBtn.data('state', "visible");
            $schematic.css('display', 'block');
        } else {
            schematicBtn.text("Show Schematic");
            schematicBtn.data('state', "hidden");
            $schematic.css('display', 'none');
        }   
    }
*/
});
</script>
</head>
<body>
        <div style="display:none" class="container">
            <p><strong>Input:</strong> Press the button on the breadboard to display the state below.</p>
            <p id="state">Display Button State</p>
        </div>
        <img style="display:none" id="schematic" src="">
        <button style="display:none" id="schematicBtn" data-state="hidden">Show Schematic</button>

<div id="topCont"></div>
		<textarea wrap="off" onchange="checkWordLen(this);" onfocus="clearContents(this);" id="newCont" maxlength="140" rows="3" cols="40" autofocus></textarea>
		<button onclick="myPress()" id="addCont">button</button></br>
		<div id="baseCont"><img src=""/></div></br></br></br></br></br></br>
	<div id="storyContainer"></div>	
</body>
<script>
// MEMORIA, FUNCTION CALLS E PULSANTE //
function myPress(){checkWord(gidd('newCont'));
						if(iniziato==0){myInit()}
						else if(iniziato==1){checkWordLen(document.getElementById('newCont'));}
						else if(iniziato==3){checkWordLen(document.getElementById('newCont'));}
						if(check==1){renderStory();check=0;iniziato=2;myInit()}}
						
window.iniziato=0;window.check=0;

//MOTORE//
function myInit(){
	//INIZIO STORIA//
if(iniziato == 0){
gidd('topCont').innerHTML='';
gidd('newCont').innerHTML='...';
gidd('baseCont').innerHTML='<h3>Inizi la storia, scrivi almeno 7 parole</h3>';iniziato=1;}
   //LOADING PERSONA SUCCESSIVA//
else if(iniziato == 2){
gidd('baseCont').innerHTML='Loading..';
gidd('topCont').innerHTML='Perfetto! Ora lascia libera la tastiera per far continuare qualcun’altro!';
clearContents(gidd('newCont'));gidd('newCont').setAttribute('opacity','0');
setTimeout('iniziato=3;myInit()',4000)
}
   //INSERIMENTO NUOVO CONTENUTO//
else if(iniziato == 3){gidd('newCont').setAttribute('opacity','1');
gidd('topCont').innerHTML=newCont+'...';
gidd('newCont').innerHTML='[...]';gidd('newCont').setAttribute('onfocus','');
gidd('baseCont').innerHTML='Continua la storia digitando altre 8 parole';
}
}
window.gidd=function(s){return document.getElementById(s)};
//RENDER STORY//
function renderStory(){window.newCont=gidd('newCont').value;
if(newCont!='prosegui la storia..'||newCont!=''){gidd('storyContainer').innerHTML+=' '+newCont;
gidd('newCont').value='';
}else{alert('Inserisci un nuovo pezzo della storia!')}}
function clearContents(element) {element.value = '';}
// CONTROLLA IL LIMITE DELLE PAROLE //
    var wordLen = 8;  // NUMERO DI PAROLE MINIMO //
	function checkWord(obj){var len = obj.value.split(/[\s]+/);if(len.length>=wordLen){gidd('baseCont').innerHTML='<img src=""/>';}
	else{gidd('baseCont').innerHTML='Inserisci almeno 8 parole';}}
     function checkWordLen(obj){
      var len = obj.value.split(/[\s]+/);
       if(len.length < wordLen){
{'fraction_non_alphanumeric': 0.1608475292130086, 'fraction_numerical': 0.007883992679149654, 'mean_word_length': 3.2702134054703937, 'pattern_counts': {'":': 0, '<': 126, '<?xml version=': 0, '>': 126, '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': '1418755', 'n_tokens_mistral': 4619, 'n_tokens_neox': 4410, 'n_words': 1097}