Skip to content

Commit

Permalink
added some javascript for input forms
Browse files Browse the repository at this point in the history
  • Loading branch information
peterstadler committed Jun 2, 2015
1 parent d023661 commit f46a1ce
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 35 deletions.
47 changes: 28 additions & 19 deletions resources/js/smufl-scripts.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,31 @@
/*
* Some Javscript functions for SMuFL-Browser
* Some Javascript functions for SMuFL-Browser
*/

function gotoPage(page) {
/* var data = $("#fun-query-form").serialize();*/
/*$.ajax({
type: "POST",
url: "ajax.html",
data: data + "&action=search",
success: function (data) {
$("#results").fadeOut(100, function() {
$(this).html(data);
$(this).fadeIn(100, function() {
$(".signature").highlight();
});
timeout = null;
});
}
});*/
console.log(page);
}
$.fn.facets = function ()
{
this.selectize({
plugins: ['remove_button'],
hideSelected: true,
onDropdownClose: function(e){
var params = [];
/* Set filters */
$('option:selected').each(function() {
var facet = $(this).parent().attr('name');
var value = $(this).attr('value');
/*console.log(facet + '=' + value);*/
params.push(facet + '=' + encodeURI(value))
})

/* Refresh page */
self.location='?'+params.join('&')
}
})
};

/* Initialize selectize plugin for the input forms */
$(document).ready(function() {
$("#ranges-list").facets();
$("#glyphnames-list").facets();
$("#classes-list").facets();
});
17 changes: 1 addition & 16 deletions templates/page.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,22 +26,7 @@
<script src="resources/js/jquery.min.js" type="text/javascript"/>
<script src="resources/js/bootstrap.min.js" type="text/javascript"/>
<script src="resources/js/selectize.min.js" type="text/javascript"/>
<script src="resources/js/smufl-scripts.js" type="text/javascript"/>

<script type="text/javascript">
$(document).ready(function() {
$("#ranges-list").selectize({
plugins: ['remove_button'],
hideSelected: true,
});
$("#glyphnames-list").selectize({
plugins: ['remove_button'],
hideSelected: true
});
$("#classes-list").selectize({
plugins: ['remove_button'],
hideSelected: true
});
});
</script>
</body>
</html>

0 comments on commit f46a1ce

Please sign in to comment.