Last active
August 29, 2015 14:02
-
-
Save gmazzap/6d7442da66a6306dde59 to your computer and use it in GitHub Desktop.
Muschiatini
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html lang=""> | |
<head> | |
<meta charset="utf-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
<title>Muschiatini Dixit</title> | |
<meta name="description" content="Muschiatini Dixit"> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" /> | |
</head> | |
<body> | |
<div class="container"> | |
<div class="row"> | |
<h1>Muschiatini dixit</h1> | |
<p>Piccolo omaggio a l'<a href="http://www.einaudi.it/libri/libro/wu-ming/l-armata-dei-sonnambuli/978880621413" target="_blank">Armata dei Sonnambuli</a> di <a href="http://www.wumingfoundation.com/index.htm" target="_blank">Wu Ming Foundation</a></p> | |
</div> | |
<div class="row"> | |
<div class="col-md-12"> | |
<form role="form" id="muschiatini_in"> | |
<div class="form-group"> | |
<label>Sc'ivi (o incolla) qui sotto il testo da "t'adurre" in muschiatino</label> | |
<textarea class="form-control" rows="8"></textarea> | |
</div> | |
<button type="submit" class="btn btn-primary">T'aduci</button> | |
</form> | |
</div> | |
</div> | |
<div class="row"> | |
<div class="col-md-12" id="muschiatini_out"></div> | |
</div> | |
</div> | |
<script src="//code.jquery.com/jquery-1.11.1.min.js"></script> | |
<script> | |
(function($) { | |
$(document).on( 'submit', '#muschiatini_in', function(e) { | |
e.preventDefault(); | |
var $textarea = $(this).find('textarea').eq(0); | |
$('#muschiatini_out').empty().prepend('<h1>Muschiatini Dixit:</h1>').append( '<blockquote>' + $textarea.val().replace(/(<([^>]+)>)/ig, "").replace(/r/ig, "'").replace(/[\']{2,}/ig, "'") + '<p><em>Pa\'ola mia.</em></p></blockquote>' ); | |
$textarea.val(''); | |
}); | |
})(jQuery); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment