Heimdall/resources/views/items/scripts.blade.php
2018-02-05 23:08:37 +00:00

34 lines
No EOL
1.3 KiB
PHP

<script>
$( function() {
var elem = $('.color-picker')[0];
var hueb = new Huebee( elem, {
// options
});
var availableTags = [
<?php
$supported = App\Item::supportedOptions();
foreach($supported as $sapp) {
echo '"'.$sapp.'",';
}
?>
];
$( "#appname" ).autocomplete({
source: availableTags,
select: function( event, ui ) {
$.post('/appload', { app: ui.item.value }, function(data) {
$('#appimage').html("<img src='/storage/"+data.icon+"' /><input type='hidden' name='icon' value='"+data.icon+"' />");
$('input[name=colour]').val(data.colour);
hueb.setColor( data.colour );
$('input[name=pinned]').prop('checked', true);
if(data.config != null) {
$.get('/view/'+data.config, function(getdata) {
$('#sapconfig').html(getdata).show();
});
}
}, "json");
}
});
});
</script>