You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

112 lines
3.6 KiB

<html>
<head>
<meta charset="utf-8">
<script src="assets/js/jquery.min.3.2.1.js"></script>
<script src="assets/bootstrap/js/bootstrap.bundle.min.js"></script>
<!-- Bootstrap core CSS -->
<link href="assets/bootstrap/css/bootstrap.min.css" rel="stylesheet">
<!-- Custom styles for this template -->
<link href="assets/css/wordcloud_admin.css" rel="stylesheet">
<title>Wordcloud</title>
<style type="text/css">
canvas {
font-family: monospace;
white-space: nowrap;
}
.container {
margin: 0;
padding: 0;
height: 100%;
}
#resultCanvas {
display: block;
padding: 0;
margin: 0 auto;
}
@media(max-width:1200px) {
.container {
margin: 0 50px;
}
#resultCanvas {
width: 100%;
height: auto;
}
}
</style>
</head>
<body>
<div class="container">
<canvas id="resultCanvas" width="600" height="480"></canvas>
</div>
<script type="text/javascript" src="assets/js/jquery.wordcloud.js"></script>
<br>
<div id="show_insert_response">
</div>
<label>Word</label>
<input type="text" id="word">
<button type="submit" id="add">Add Words</button>
<br>
<ul>
<li><label>Excluded Words <input type="text" id="excludedWords" value="" /></label></li>
<li><label>Size of Biggest Word <input type="text" id="biggestWord" value="100" /></label></li>
<li><label>fillBox <input type="checkbox" name="fillBox" id="fillBox" value="fillBox" checked="checked"/></label></li>
</ul>
<input type="button" id="db" value="Reload" />
<script>
$(document).ready(function(){
var $r = $('#resultCanvas');
$('#biggestWord').val(80);
function dbload(){
try {
$r.wordCloud({
database: {
where: "",
maxWords: "",
excludedWords: $('#excludedWords').val()
},
wordCountUrl: 'assets/php/wordcounter.php',
biggestWord: $('#biggestWord').val(),
fillBox: $('#fillBox').val()
});
} catch (e) { alert(e); }
};
dbload();
$("#db").click(function(){
dbload();
});
$("#add").click(function(){
var word=$("#word").val().trim();
if (word == ""){
return;
}
$.ajax({
url:'assets/php/insert.php',
method:'POST',
data:{
word:word
},
success:function(data){
//alert(data);
//$("#db").click();
dbload();
$("#word").val("");
$("#show_insert_response").html(data);
}
});
});
});
</script>
<div>
<a href="https://codeberg.org/cExplorer/wordcloud">cExplorer's Wordcloud</a>,
based on <a href="https://github.com/mattdodge/MySQL-Word-Cloud">Matt Dodge's MySQL-Word-Cloud</a>
and <a href="http://timc.idv.tw/wordcloud/">timdream's wordcloud</a>.
</div>
</body>
</html>