[vlc-commits] luahttp: sprite buttons

Francois Cartegnie git at videolan.org
Fri Sep 9 13:41:45 CEST 2011


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Fri Sep  9 13:37:47 2011 +0200| [b852af557db7631708ccb1ebd34ff87d9e16f715] | committer: Francois Cartegnie

luahttp: sprite buttons

Make them share a common palette and save 41K (78%)

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=b852af557db7631708ccb1ebd34ff87d9e16f715
---

 share/Makefile.am                             |   15 +--------------
 share/lua/http/css/main.css                   |   24 +++++++++++++-----------
 share/lua/http/images/button-equalizer-48.png |  Bin 2040 -> 0 bytes
 share/lua/http/images/button_eject-48.png     |  Bin 1713 -> 0 bytes
 share/lua/http/images/button_ffw-48.png       |  Bin 1936 -> 0 bytes
 share/lua/http/images/button_first-48.png     |  Bin 1845 -> 0 bytes
 share/lua/http/images/button_full-48.png      |  Bin 2496 -> 0 bytes
 share/lua/http/images/button_help-48.png      |  Bin 1962 -> 0 bytes
 share/lua/http/images/button_last-48.png      |  Bin 1831 -> 0 bytes
 share/lua/http/images/button_pause-48.png     |  Bin 1785 -> 0 bytes
 share/lua/http/images/button_play-48.png      |  Bin 1821 -> 0 bytes
 share/lua/http/images/button_rec-48.png       |  Bin 1760 -> 0 bytes
 share/lua/http/images/button_repeat-48.png    |  Bin 2079 -> 0 bytes
 share/lua/http/images/button_rew-48.png       |  Bin 1943 -> 0 bytes
 share/lua/http/images/button_stop-48.png      |  Bin 1593 -> 0 bytes
 share/lua/http/images/button_stream-48.png    |  Bin 2040 -> 0 bytes
 share/lua/http/images/buttons.png             |  Bin 0 -> 11954 bytes
 share/lua/http/index.html                     |    2 +-
 share/lua/http/js/controlers.js               |   20 ++++++++------------
 share/lua/http/mobile.html                    |    4 ++--
 20 files changed, 25 insertions(+), 40 deletions(-)

diff --git a/share/Makefile.am b/share/Makefile.am
index 9886b5f..dc28a9e 100644
--- a/share/Makefile.am
+++ b/share/Makefile.am
@@ -266,7 +266,7 @@ DIST_http_lua = \
 	lua/http/flash.html \
 	lua/http/vlm.html \
 	lua/http/images/loop.png \
-	lua/http/images/button_pause-48.png \
+	lua/http/images/buttons.png \
 	lua/http/images/speaker-32.png \
 	lua/http/images/fullscreen.png \
 	lua/http/images/vlc-48.png \
@@ -285,17 +285,10 @@ DIST_http_lua = \
 	lua/http/images/info.png \
 	lua/http/images/refresh.png \
 	lua/http/images/sout.png \
-	lua/http/images/button_stop-48.png \
-	lua/http/images/button_help-48.png \
-	lua/http/images/button-equalizer-48.png \
-	lua/http/images/button_ffw-48.png \
 	lua/http/images/sort.png \
-	lua/http/images/button_play-48.png \
 	lua/http/images/white_cross_small.png \
-	lua/http/images/button_full-48.png \
 	lua/http/images/shuffle.png \
 	lua/http/images/Other-48.png \
-	lua/http/images/button_repeat-48.png \
 	lua/http/images/repeat.png \
 	lua/http/images/slow.png \
 	lua/http/images/slider_left.png \
@@ -303,20 +296,14 @@ DIST_http_lua = \
 	lua/http/images/stop.png \
 	lua/http/images/sd.png \
 	lua/http/images/speaker.png \
-	lua/http/images/button_first-48.png \
-	lua/http/images/button_stream-48.png \
-	lua/http/images/button_rew-48.png \
-	lua/http/images/button_rec-48.png \
 	lua/http/images/delete.png \
 	lua/http/images/Back-48.png \
-	lua/http/images/button_eject-48.png \
 	lua/http/images/Video-48.png \
 	lua/http/images/playlist_small.png \
 	lua/http/images/eject.png \
 	lua/http/images/playlist.png \
 	lua/http/images/volume_up.png \
 	lua/http/images/next.png \
-	lua/http/images/button_last-48.png \
 	lua/http/images/volume_down.png \
 	lua/http/images/slider_bar.png \
 	lua/http/images/vlc16x16.png \
diff --git a/share/lua/http/css/main.css b/share/lua/http/css/main.css
index b89c46f..fa72e0f 100644
--- a/share/lua/http/css/main.css
+++ b/share/lua/http/css/main.css
@@ -85,37 +85,39 @@ body{
 	border: none;
 	display: inline-block;
 	cursor: pointer;
+	background-image: url("../images/buttons.png");
+	background-repeat: no-repeat;
 }
 .button{
 	cursor: pointer;
 	display: inline-block;
 }
 #buttonOpen{
-	background-image: url("../images/button_eject-48.png");
+	background-position: 0px 0px;
 }
 #buttonStop{
-	background-image: url("../images/button_stop-48.png");
+	background-position: -576px 0px;
 }
-#buttonPlay{
-	background-image: url("../images/button_play-48.png") ;
+.playing {
+	background-position: -336px 0px;
 }
-#buttonPause{
-	background-image: url("../images/button_pause-48.png") ;
+.paused {
+	background-position: -384px 0px;
 }
 #buttonPrev{
-	background-image: url("../images/button_first-48.png") ;
+	background-position: -144px 0px;
 }
 #buttonNext{
-	background-image: url("../images/button_last-48.png") ;
+	background-position: -288px 0px;
 }
 #buttonFull{
-	background-image: url("../images/button_full-48.png") ;
+	background-position: -192px 0px;
 }
 #buttonSout{
-	background-image: url("../images/button_stream-48.png") ;
+	background-position: -624px 0px;
 }
 #buttonEQ{
-	background-image: url("../images/button-equalizer-48.png") ;
+	background-position: -48px 0px;
 }
 #window_browse ol{
 	list-style-type: none;
diff --git a/share/lua/http/images/button-equalizer-48.png b/share/lua/http/images/button-equalizer-48.png
deleted file mode 100644
index 1574cd6..0000000
Binary files a/share/lua/http/images/button-equalizer-48.png and /dev/null differ
diff --git a/share/lua/http/images/button_eject-48.png b/share/lua/http/images/button_eject-48.png
deleted file mode 100644
index 32391f4..0000000
Binary files a/share/lua/http/images/button_eject-48.png and /dev/null differ
diff --git a/share/lua/http/images/button_ffw-48.png b/share/lua/http/images/button_ffw-48.png
deleted file mode 100644
index 52b7081..0000000
Binary files a/share/lua/http/images/button_ffw-48.png and /dev/null differ
diff --git a/share/lua/http/images/button_first-48.png b/share/lua/http/images/button_first-48.png
deleted file mode 100644
index 8b4e0f5..0000000
Binary files a/share/lua/http/images/button_first-48.png and /dev/null differ
diff --git a/share/lua/http/images/button_full-48.png b/share/lua/http/images/button_full-48.png
deleted file mode 100644
index fcd2483..0000000
Binary files a/share/lua/http/images/button_full-48.png and /dev/null differ
diff --git a/share/lua/http/images/button_help-48.png b/share/lua/http/images/button_help-48.png
deleted file mode 100644
index 1cef07c..0000000
Binary files a/share/lua/http/images/button_help-48.png and /dev/null differ
diff --git a/share/lua/http/images/button_last-48.png b/share/lua/http/images/button_last-48.png
deleted file mode 100644
index d7d367d..0000000
Binary files a/share/lua/http/images/button_last-48.png and /dev/null differ
diff --git a/share/lua/http/images/button_pause-48.png b/share/lua/http/images/button_pause-48.png
deleted file mode 100644
index beccbca..0000000
Binary files a/share/lua/http/images/button_pause-48.png and /dev/null differ
diff --git a/share/lua/http/images/button_play-48.png b/share/lua/http/images/button_play-48.png
deleted file mode 100644
index e6fec04..0000000
Binary files a/share/lua/http/images/button_play-48.png and /dev/null differ
diff --git a/share/lua/http/images/button_rec-48.png b/share/lua/http/images/button_rec-48.png
deleted file mode 100644
index c104120..0000000
Binary files a/share/lua/http/images/button_rec-48.png and /dev/null differ
diff --git a/share/lua/http/images/button_repeat-48.png b/share/lua/http/images/button_repeat-48.png
deleted file mode 100644
index a1a8ecf..0000000
Binary files a/share/lua/http/images/button_repeat-48.png and /dev/null differ
diff --git a/share/lua/http/images/button_rew-48.png b/share/lua/http/images/button_rew-48.png
deleted file mode 100644
index 2bb63f6..0000000
Binary files a/share/lua/http/images/button_rew-48.png and /dev/null differ
diff --git a/share/lua/http/images/button_stop-48.png b/share/lua/http/images/button_stop-48.png
deleted file mode 100644
index 987cc1a..0000000
Binary files a/share/lua/http/images/button_stop-48.png and /dev/null differ
diff --git a/share/lua/http/images/button_stream-48.png b/share/lua/http/images/button_stream-48.png
deleted file mode 100644
index 8c3dc5b..0000000
Binary files a/share/lua/http/images/button_stream-48.png and /dev/null differ
diff --git a/share/lua/http/images/buttons.png b/share/lua/http/images/buttons.png
new file mode 100644
index 0000000..7dee3a5
Binary files /dev/null and b/share/lua/http/images/buttons.png differ
diff --git a/share/lua/http/index.html b/share/lua/http/index.html
index 8b4d273..0da414a 100644
--- a/share/lua/http/index.html
+++ b/share/lua/http/index.html
@@ -202,7 +202,7 @@
 					<tr>
 						<td id="controlButtons">
 							<div id="buttonPrev" class="button48  ui-corner-all" title="Previous"></div>
-							<div id="buttonPlay" class="button48  ui-corner-all" title="Play"></div>
+							<div id="buttonPlay" class="button48  ui-corner-all paused" title="Play"></div>
 							<div id="buttonNext" class="button48  ui-corner-all" title="Next"></div>
 							<div id="buttonOpen" class="button48  ui-corner-all" title="Open Media"></div>
 							<div id="buttonStop" class="button48  ui-corner-all" title="Stop"></div>
diff --git a/share/lua/http/js/controlers.js b/share/lua/http/js/controlers.js
index 6a7dd78..bc969b7 100644
--- a/share/lua/http/js/controlers.js
+++ b/share/lua/http/js/controlers.js
@@ -23,13 +23,11 @@ function updateStatus(){
 				$('#buttonPlay').attr('state',$('state',data).text());
 				$('#buttonPlay').attr('mrl',$('[name="filename"]',data).text());
 				if($('state',data).text()=='playing'){
-					$('#buttonPlay').css({
-						'background-image':'url("images/button_pause-48.png")'
-					});
+					$('#buttonPlay').removeClass('paused');
+					$('#buttonPlay').addClass('playing');
 				}else{
-					$('#buttonPlay').css({
-						'background-image':'url("images/button_play-48.png")'
-					});
+					$('#buttonPlay').removeClass('playing');
+					$('#buttonPlay').addClass('paused');
 				}
 				if($('random',data).text()=='true'){
 					$('#buttonShuffle').removeClass('ui-state-default');
@@ -313,13 +311,11 @@ function updateStreams(){
 				$('#seekSlider').attr('totalLength',$('[name="Current"] instance',data).attr('length')/1000000);
 				$('#buttonPlay').attr('state',$('[name="Current"] instance',data).length>0 ? $('[name="Current"] instance',data).attr('state') : 'stopped');
 				if($('[name="Current"] instance',data).attr('state')=='playing'){
-					$('#buttonPlay').css({
-						'background-image':'url("images/button_pause-48.png'
-					});
+					$('#buttonPlay').removeClass('paused');
+					$('#buttonPlay').addClass('playing');
 				}else{
-					$('#buttonPlay').css({
-						'background-image':'url("images/button_play-48.png'
-					});
+					$('#buttonPlay').removeClass('playing');
+					$('#buttonPlay').addClass('paused');
 				}
 				setTimeout( updateStreams, 1000 );
 			}
diff --git a/share/lua/http/mobile.html b/share/lua/http/mobile.html
index 885c85c..d70a4af 100644
--- a/share/lua/http/mobile.html
+++ b/share/lua/http/mobile.html
@@ -95,7 +95,7 @@
 					<td id="controlButtons" colspan="2" valign="bottom" height="108px;" class="ui-widget-content">
 						<div align="center">
 							<div id="buttonPrev" class="button48  ui-corner-all" title="Previous"></div>
-							<div id="buttonPlay" class="button48  ui-corner-all" title="Play"></div>
+							<div id="buttonPlay" class="button48  ui-corner-all paused" title="Play"></div>
 							<div id="buttonNext" class="button48  ui-corner-all" title="Next"></div>
 							<div id="buttonStop" class="button48  ui-corner-all" title="Stop"></div>
 						</div>
@@ -119,4 +119,4 @@
 	dialogs("stream_config_window.html");
 	?>
 	</body>
-</html>
\ No newline at end of file
+</html>



More information about the vlc-commits mailing list