Heimdall/resources/views/items/scripts.blade.php

34 lines
1.3 KiB
PHP
Raw Normal View History

2018-02-05 19:43:24 +00:00
<script>
$( function() {
2018-02-05 23:08:37 +00:00
var elem = $('.color-picker')[0];
var hueb = new Huebee( elem, {
// options
});
2018-02-05 19:43:24 +00:00
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) {
2018-02-05 20:59:38 +00:00
$('#appimage').html("<img src='/storage/"+data.icon+"' /><input type='hidden' name='icon' value='"+data.icon+"' />");
$('input[name=colour]').val(data.colour);
2018-02-05 23:08:37 +00:00
hueb.setColor( data.colour );
$('input[name=pinned]').prop('checked', true);
if(data.config != null) {
$.get('/view/'+data.config, function(getdata) {
$('#sapconfig').html(getdata).show();
});
}
2018-02-05 20:59:38 +00:00
}, "json");
2018-02-05 19:43:24 +00:00
}
});
});
</script>