initial commit
This commit is contained in:
commit
db878efa58
2 changed files with 71 additions and 0 deletions
BIN
colorpicker.zip
Normal file
BIN
colorpicker.zip
Normal file
Binary file not shown.
71
test.pl
Normal file
71
test.pl
Normal file
|
@ -0,0 +1,71 @@
|
||||||
|
#!/usr/bin/env perl
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
use autodie;
|
||||||
|
|
||||||
|
use POE::Component::Server::HTTP;
|
||||||
|
|
||||||
|
use JSON;
|
||||||
|
|
||||||
|
my $aliases = POE::Component::Server::HTTP->new(
|
||||||
|
Port => 8000,
|
||||||
|
ContentHandler => {
|
||||||
|
'/' => \&give_page,
|
||||||
|
'/ajax' => \&do_ajax,
|
||||||
|
'/js/' => \&give_file,
|
||||||
|
'/css/' => \&give_file,
|
||||||
|
},
|
||||||
|
Headers => { Server => 'My Server' },
|
||||||
|
);
|
||||||
|
|
||||||
|
sub find_tty {
|
||||||
|
for my $i (0..10) {
|
||||||
|
if (-e "/dev/ttyACM$i") {
|
||||||
|
return "/dev/ttyACM$i";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
open(my $fh, ">", find_tty());
|
||||||
|
|
||||||
|
sub give_page {
|
||||||
|
my ($request, $response) = @_;
|
||||||
|
|
||||||
|
local $/;
|
||||||
|
|
||||||
|
my $pos = tell(DATA);
|
||||||
|
|
||||||
|
$response->code(RC_OK);
|
||||||
|
$response->content(<DATA>);
|
||||||
|
|
||||||
|
seek DATA, $pos, 0;
|
||||||
|
|
||||||
|
return RC_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
sub do_ajax {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
POE::Kernel->run();
|
||||||
|
|
||||||
|
__END__
|
||||||
|
|
||||||
|
<head>
|
||||||
|
|
||||||
|
<link rel="stylesheet" href="http://www.eyecon.ro/colorpicker/css/colorpicker.css" type="text/css" />
|
||||||
|
<script src="http://code.jquery.com/jquery-1.10.2.min.js" />
|
||||||
|
<script src="http://www.simcop2387.info/js/colorpicker.js" />
|
||||||
|
|
||||||
|
<script>
|
||||||
|
$(function () {
|
||||||
|
$('#colorpickerHolder').ColorPicker({flat: true});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<p id="colorpickerHolder">
|
||||||
|
</p>
|
||||||
|
</body>
|
Loading…
Add table
Reference in a new issue