projects
/
pixel-calc.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
87ba012
)
Colour highlighting
author
Cameron Ball
<cameron@getapproved.com.au>
Fri, 10 Jul 2015 07:26:12 +0000
(15:26 +0800)
committer
Cameron Ball
<cameron@getapproved.com.au>
Fri, 10 Jul 2015 07:26:12 +0000
(15:26 +0800)
public_html/upload.php
patch
|
blob
|
history
diff --git
a/public_html/upload.php
b/public_html/upload.php
index
45b39ad
..
22321d6
100644
(file)
--- a/
public_html/upload.php
+++ b/
public_html/upload.php
@@
-1,3
+1,17
@@
+<html>
+ <head>
+ <script src="https://code.jquery.com/jquery-2.1.4.min.js"></script>
+
+ <style>
+ .highlighted {
+ background-color: blue;
+ }
+ </style>
+
+ </head>
+
+ <body>
+
<?php
// Check if image file is a actual image or fake image
<?php
// Check if image file is a actual image or fake image
@@
-18,15
+32,18
@@
if(isset($_POST["submit"])) {
$g = $rgb['green'];
$b = $rgb['blue'];
$a = $rgb['alpha'];
$g = $rgb['green'];
$b = $rgb['blue'];
$a = $rgb['alpha'];
- $hex =
'#' .
+ $hex =
str_pad(dechex($rgb['red']), 2, '0', STR_PAD_LEFT) .
str_pad(dechex($rgb['green']), 2, '0', STR_PAD_LEFT) .
str_pad(dechex($rgb['blue']), 2, '0', STR_PAD_LEFT);
str_pad(dechex($rgb['red']), 2, '0', STR_PAD_LEFT) .
str_pad(dechex($rgb['green']), 2, '0', STR_PAD_LEFT) .
str_pad(dechex($rgb['blue']), 2, '0', STR_PAD_LEFT);
- if($a == 127) $hex = "#ffffff";
- echo "<td width='4' height='4' bgcolor='$hex' r='$r' g='$g' b='$b' a='$a'></td>";
+ if($a == 127) $hex = "ffffff";
- if($a == 0)
+ if($a == 0) {
+ echo "<td width='4' height='4' class='$hex' bgcolor='#$hex' r='$r' g='$g' b='$b' a='$a'></td>";
$colour_count[$hex] = isset($colour_count[$hex]) ? $colour_count[$hex]+1 : 1;
$colour_count[$hex] = isset($colour_count[$hex]) ? $colour_count[$hex]+1 : 1;
+ } else {
+ echo "<td width='4' height='4' bgcolor='#$hex' r='$r' g='$g' b='$b' a='$a'></td>";
+ }
}
echo '</tr>';
}
}
echo '</tr>';
}
@@
-67,10
+84,21
@@
if(isset($_POST["submit"])) {
<td>Quantity</td>
</tr>';
foreach($colour_count as $colour => $qty) {
<td>Quantity</td>
</tr>';
foreach($colour_count as $colour => $qty) {
- echo "<tr><td bgcolor='$colour'></td><td>$colour</td><td>$qty</td></tr>";
+ echo "<tr
class='colour-row' id='$colour'
><td bgcolor='$colour'></td><td>$colour</td><td>$qty</td></tr>";
}
echo '</table>';
}
}
?>
}
echo '</table>';
}
}
?>
+
+ <script>
+ $( ".colour-row" ).hover(function() {
+ var colour = $(this).attr('id');
+ console.log(colour);
+ $("." + colour).toggleClass("highlighted");
+ });
+ </script>
+
+ </body>
+</html>
\ No newline at end of file