wok-6.x rev 10766

jstetris: Fixed jstetris to work with source dvd when offline. Added index.html to stuff so only JsTetris.js file is needed. Also there is no need for compile_rules with this one anymore.
author Christopher Rogers <slaxemulator@gmail.com>
date Tue May 31 08:08:28 2011 +0000 (2011-05-31)
parents d885e7a20459
children e76ce476e779
files jstetris/receipt jstetris/stuff/index.html
line diff
     1.1 --- a/jstetris/receipt	Tue May 31 07:09:26 2011 +0000
     1.2 +++ b/jstetris/receipt	Tue May 31 08:08:28 2011 +0000
     1.3 @@ -4,27 +4,17 @@
     1.4  VERSION="1.1.0"
     1.5  CATEGORY="games"
     1.6  SHORT_DESC="Tetris game in javascript"
     1.7 +TARBALL="JsTetris.js"
     1.8  MAINTAINER="pascal.bellard@slitaz.org"
     1.9  WEB_SITE="http://javascript.internet.com/games/Tetris.html"
    1.10 -
    1.11 -# Rules to configure and make the package.
    1.12 -compile_rules()
    1.13 -{
    1.14 -	mkdir -p $src
    1.15 -	cd $src
    1.16 -	_TARBALL=$PACKAGE-$VERSION.tar.gz
    1.17 -	if [ ! -s ${SOURCE_REPOSITORY:-$SRC}/$_TARBALL ]; then
    1.18 -		wget -O index.html $WEB_SITE
    1.19 -		wget $(dirname $WEB_SITE)/JsTetris.js
    1.20 -		tar cvzf ${SOURCE_REPOSITORY:-$SRC}/$_TARBALL index.html JsTetris.js
    1.21 -	fi
    1.22 -}
    1.23 +WGET_URL="http://javascript.internet.com/games/$TARBALL"
    1.24  
    1.25  # Rules to gen a SliTaz package suitable for Tazpkg.
    1.26  genpkg_rules()
    1.27  {
    1.28          mkdir -p $fs/var/www/tetris $fs/usr/share/applications
    1.29  	cp $src/* $fs/var/www/tetris
    1.30 +	cp $stuff/index.html $fs/var/www/tetris
    1.31  	chown -R 80.80 $fs/var/www/tetris
    1.32  	cat > $fs/usr/share/applications/tetris.desktop <<EOT
    1.33  [Desktop Entry]
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/jstetris/stuff/index.html	Tue May 31 08:08:28 2011 +0000
     2.3 @@ -0,0 +1,362 @@
     2.4 +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
     2.5 +<html xmlns="http://www.w3.org/1999/xhtml">
     2.6 +<head>
     2.7 +<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
     2.8 +<title>JsTetris - javascript tetris game</title>
     2.9 +<style type="text/css">
    2.10 +html, body { height: 100%; margin: 0; padding: 0; }
    2.11 +body {
    2.12 +    background: #E1D4C0;
    2.13 +}
    2.14 +body, table {
    2.15 +    font: 11px tahoma;
    2.16 +    color: #826C55;
    2.17 +}
    2.18 +
    2.19 +/*** tetris 168,308 ***/
    2.20 +
    2.21 +#tetris {
    2.22 +    position: relative;
    2.23 +    width: 300px;
    2.24 +    height: 310px;
    2.25 +    border: 1px solid #BAA68E;
    2.26 +    background: #ffffff;
    2.27 +    margin: 0 auto;
    2.28 +}
    2.29 +
    2.30 +/*** left ***/
    2.31 +
    2.32 +#tetris .left {
    2.33 +    background: #F5EDE3;
    2.34 +    position: absolute;
    2.35 +    width: 130px;
    2.36 +    height: 100%;
    2.37 +    left: 0px;
    2.38 +    top: 0px;
    2.39 +}
    2.40 +#tetris .left h1 {
    2.41 +    font-size: 11px;
    2.42 +    text-align: center;
    2.43 +    margin-top: 10px;
    2.44 +    margin-bottom: 10px;
    2.45 +}
    2.46 +#tetris .left h1 a {
    2.47 +    color: #3366CC;
    2.48 +    text-decoration: none;
    2.49 +}
    2.50 +#tetris .left h1 a:hover {
    2.51 +    color: #FF6600;
    2.52 +    text-decoration: none;
    2.53 +}
    2.54 +
    2.55 +/* menu */
    2.56 +
    2.57 +#tetris .left .menu {
    2.58 +    text-align: center;
    2.59 +}
    2.60 +#tetris .left input {
    2.61 +    font: 10px tahoma;
    2.62 +    color: #333333;
    2.63 +    text-transform: uppercase;
    2.64 +    background: #EAE0D1;
    2.65 +}
    2.66 +#tetris .left .menu input {
    2.67 +    width: 90px;
    2.68 +}
    2.69 +
    2.70 +/* keyboard */
    2.71 +
    2.72 +#tetris .left .keyboard {
    2.73 +    position: absolute;
    2.74 +    top: 163px;
    2.75 +    left: 32px;
    2.76 +    width: 85px;
    2.77 +    height: 55px;
    2.78 +    overflow: visible;
    2.79 +    display: none;
    2.80 +}
    2.81 +#tetris .left .keyboard input {
    2.82 +    font: 11px tahoma;
    2.83 +    width: 25px;
    2.84 +    height: 25px;
    2.85 +    padding-bottom: 2px;
    2.86 +    text-transform: none;
    2.87 +}
    2.88 +* html #tetris .left .keyboard input {
    2.89 +    padding-left: 1px;
    2.90 +}
    2.91 +#tetris .left .keyboard .up {
    2.92 +    position: absolute;
    2.93 +    left: 30px;
    2.94 +    top: 0px;
    2.95 +    width: 30px;
    2.96 +    height: 30px;
    2.97 +}
    2.98 +#tetris .left .keyboard .up input {
    2.99 +    font: 15px tahoma;
   2.100 +    padding-top: 3px;
   2.101 +}
   2.102 +#tetris .left .keyboard .down {
   2.103 +    position: absolute;
   2.104 +    left: 30px;
   2.105 +    top: 30px;
   2.106 +    width: 30px;
   2.107 +    height: 30px;
   2.108 +}
   2.109 +#tetris .left .keyboard .down input {
   2.110 +    font: 14px tahoma;
   2.111 +}
   2.112 +#tetris .left .keyboard .left {
   2.113 +    position: absolute;
   2.114 +    left: 0px;
   2.115 +    top: 30px;
   2.116 +    width: 30px;
   2.117 +    height: 30px;
   2.118 +}
   2.119 +#tetris .left .keyboard .right {
   2.120 +    position: absolute;
   2.121 +    left: 60px;
   2.122 +    top: 30px;
   2.123 +    width: 30px;
   2.124 +    height: 30px;
   2.125 +}
   2.126 +
   2.127 +/* game over */
   2.128 +
   2.129 +#tetris-gameover {
   2.130 +    position: absolute;
   2.131 +    width: 100%;
   2.132 +    top: 50%;
   2.133 +    text-align: center;
   2.134 +    font-weight: bold;
   2.135 +    display: none;
   2.136 +}
   2.137 +
   2.138 +/* next puzzle */
   2.139 +#tetris-nextpuzzle {
   2.140 +    position: absolute;
   2.141 +    top: 49%;
   2.142 +    left: 35%;
   2.143 +    background: #ffffff;
   2.144 +    overflow: visible;
   2.145 +    display: none;
   2.146 +}
   2.147 +
   2.148 +/* stats */
   2.149 +
   2.150 +#tetris .left .stats {
   2.151 +    position: absolute;
   2.152 +    left: 35px;
   2.153 +    bottom: 10px;
   2.154 +}
   2.155 +#tetris .stats td { padding-bottom: 1px; }
   2.156 +
   2.157 +#tetris .stats .level { text-align: right; padding-right: 10px; }
   2.158 +#tetris-stats-level { font-weight: bold; }
   2.159 +
   2.160 +#tetris .stats .time { text-align: right; padding-right: 10px; }
   2.161 +#tetris-stats-time { font-weight: bold; }
   2.162 +
   2.163 +#tetris .stats .apm { text-align: right; padding-right: 10px; }
   2.164 +#tetris-stats-apm { font-weight: bold; }
   2.165 +
   2.166 +#tetris .stats .lines { text-align: right; padding-right: 10px; }
   2.167 +#tetris-stats-lines { font-weight: bold; }
   2.168 +
   2.169 +#tetris .stats .score { text-align: right; padding-right: 10px; }
   2.170 +#tetris-stats-score { font-weight: bold; }
   2.171 +
   2.172 +/*** area ***/
   2.173 +
   2.174 +#tetris-area {
   2.175 +    background: #FFFFFF;
   2.176 +    position: absolute;
   2.177 +    width: 168px;
   2.178 +    height: 308px;
   2.179 +    left: 131px;
   2.180 +    top: 1px;
   2.181 +    overflow: hidden;
   2.182 +}
   2.183 +#tetris .block0,
   2.184 +#tetris .block1,
   2.185 +#tetris .block2,
   2.186 +#tetris .block3,
   2.187 +#tetris .block4,
   2.188 +#tetris .block5,
   2.189 +#tetris .block6 {
   2.190 +    position: absolute;
   2.191 +    width: 13px;
   2.192 +    height: 13px;
   2.193 +    border: 0.5px solid #ffffff;
   2.194 +    /* with margin 0.5px there were problems with offsetLeft and offsetTop */
   2.195 +}
   2.196 +#tetris .block0,
   2.197 +#tetris .block1 {
   2.198 +    background: #6699FF;
   2.199 +}
   2.200 +#tetris .block2,
   2.201 +#tetris .block3 {
   2.202 +    background: #FF6600;
   2.203 +}
   2.204 +#tetris .block4 {
   2.205 +    background: #FFAC1C;
   2.206 +}
   2.207 +#tetris .block5 {
   2.208 +    background: #BAA68E;
   2.209 +}
   2.210 +#tetris .block6 {
   2.211 +    background: #FF0000;
   2.212 +}
   2.213 +
   2.214 +/*** window ***/
   2.215 +
   2.216 +#tetris .window {
   2.217 +    background: #EFE8DE;
   2.218 +    position: absolute;
   2.219 +    width: 168px;
   2.220 +    height: 308px;
   2.221 +    left: 131px;
   2.222 +    top: 1px;
   2.223 +    z-index: 5;
   2.224 +    display: none;
   2.225 +}
   2.226 +#tetris .window .top {
   2.227 +    position: relative;
   2.228 +    background: #EAE0D1;
   2.229 +    color: #666666;
   2.230 +    font: 10px tahoma;
   2.231 +    letter-spacing: +1px;
   2.232 +    height: 20px;
   2.233 +    line-height: 20px;
   2.234 +    vertical-align: middle;
   2.235 +    border-bottom: 1px solid #ffffff;
   2.236 +    text-indent: 10px;
   2.237 +}
   2.238 +#tetris .window .top .close {
   2.239 +    position: absolute;
   2.240 +    background: #EAE0D1;
   2.241 +    font: 11px verdana;
   2.242 +    font-weight: bold;
   2.243 +    right: 0px;
   2.244 +    top: 0px;
   2.245 +    height: 20px;
   2.246 +    line-height: 19px;
   2.247 +    text-indent: 7px;
   2.248 +    width: 21px;
   2.249 +    border-left: 1px solid #ffffff;
   2.250 +    cursor: pointer;
   2.251 +}
   2.252 +#tetris .window .top .close:hover {
   2.253 +    background: #EFE8DE;
   2.254 +}
   2.255 +#tetris .window .content {
   2.256 +    font: 10px tahoma;
   2.257 +    margin: 10px;
   2.258 +}
   2.259 +#tetris .window .content table {
   2.260 +    font: 10px tahoma;
   2.261 +}
   2.262 +
   2.263 +</style>
   2.264 +<script type="text/javascript" src="JsTetris.js"></script>
   2.265 +</head>
   2.266 +<body>
   2.267 +
   2.268 +<table cellspacing="0" cellpadding="0" width="100%" height="100%"><tr><td valign="middle">
   2.269 +<div id="tetris">
   2.270 +  <div class="left">
   2.271 +    <h1>JsTetris 1.1.0</h1>
   2.272 +    <div class="menu">
   2.273 +      <div><input type="button" value="New Game" id="tetris-menu-start" /></div>
   2.274 +      <div><input type="button" value="Reset" id="tetris-menu-reset" /></div>
   2.275 +      <div><input type="button" value="Help" id="tetris-menu-help" /></div>
   2.276 +      <div><input type="button" value="Highscores" id="tetris-menu-highscores" /></div>
   2.277 +    </div>
   2.278 +    <div class="keyboard">
   2.279 +      <div class="up"><input type="button" value="^" id="tetris-keyboard-up" /></div>
   2.280 +      <div class="down"><input type="button" value="v" id="tetris-keyboard-down" /></div>
   2.281 +      <div class="left"><input type="button" value="&lt;" id="tetris-keyboard-left" /></div>
   2.282 +      <div class="right"><input type="button" value="&gt;" id="tetris-keyboard-right" /></div>
   2.283 +    </div>
   2.284 +    <div id="tetris-nextpuzzle"></div>
   2.285 +    <div id="tetris-gameover">Game Over</div>
   2.286 +    <div class="stats">
   2.287 +      <table cellspacing="0" cellpadding="0">
   2.288 +      <tr>
   2.289 +        <td class="level">Level:</td>
   2.290 +        <td><span id="tetris-stats-level">1</span></td>
   2.291 +      </tr>
   2.292 +      <tr>
   2.293 +        <td class="score">Score:</td>
   2.294 +        <td><span id="tetris-stats-score">0</span></td>
   2.295 +      </tr>
   2.296 +      <tr>
   2.297 +        <td class="lines">Lines:</td>
   2.298 +        <td><span id="tetris-stats-lines">0</span></td>
   2.299 +      </tr>
   2.300 +      <tr>
   2.301 +        <td class="apm">APM:</td>
   2.302 +        <td><span id="tetris-stats-apm">0</span></td>
   2.303 +      </tr>
   2.304 +      <tr>
   2.305 +        <td class="time">Time:</td>
   2.306 +        <td><span id="tetris-stats-time">0</span></td>
   2.307 +      </tr>
   2.308 +      </table>
   2.309 +    </div>
   2.310 +  </div>
   2.311 +  <div id="tetris-area"></div>
   2.312 +  <div id="tetris-help" class="window">
   2.313 +    <div class="top">
   2.314 +      Help <span id="tetris-help-close" class="close">x</span>
   2.315 +    </div>
   2.316 +    <div class="content">
   2.317 +      <b>Controllers:</b> <br />
   2.318 +      up - rotate <br />
   2.319 +      down - move down <br />
   2.320 +      left - move left <br />
   2.321 +      right - move right <br />
   2.322 +      space - fall to the bottom <br />
   2.323 +      n - new game <br />
   2.324 +      r - reset <br />
   2.325 +      <br />
   2.326 +      <b>Rules:</b> <br />
   2.327 +      1) Puzzle speed = 80+700/level miliseconds, the smaller value the faster puzzle falls <br />
   2.328 +      2) If puzzles created in current level >= 10+level*2 then increase level <br />
   2.329 +      3) After puzzle falling score is increased by 1000*level*linesRemoved <br />
   2.330 +      4) Each "down" action increases score by 5+level (pressing space counts as multiple down actions)
   2.331 +    </div>
   2.332 +  </div>
   2.333 +  <div id="tetris-highscores" class="window">
   2.334 +      <div class="top">
   2.335 +        Highscores <span id="tetris-highscores-close" class="close">x</span>
   2.336 +      </div>
   2.337 +      <div class="content">
   2.338 +        <div id="tetris-highscores-content"></div>
   2.339 +        <br />
   2.340 +        Note: these scores are kept in cookies, they are only visible to your computer, other players that visit this page see their own scores.
   2.341 +      </div>
   2.342 +  </div>
   2.343 +</div>
   2.344 +
   2.345 +</td></tr></table>
   2.346 +
   2.347 +<script type="text/javascript">
   2.348 +  var tetris = new Tetris();
   2.349 +  tetris.unit = 14;
   2.350 +  tetris.areaX = 12;
   2.351 +  tetris.areaY = 22;
   2.352 +</script>
   2.353 +
   2.354 +<!-- Default Insight Tag -->
   2.355 +<script type="text/javascript">
   2.356 +  var _bizo_data_partner_id = "131";
   2.357 +</script>
   2.358 +<script type="text/javascript">
   2.359 +  var _bizo_p = (("https:" == document.location.protocol) ? "https://sjs." : "http://js.");
   2.360 +  document.write(unescape("%3Cscript src='" + _bizo_p + "bizographics.com/convert_data.js?partner_id=" + _bizo_data_partner_id + "' type='text/javascript'%3E%3C/script%3E"));
   2.361 +</script>
   2.362 +
   2.363 +
   2.364 +</body>
   2.365 +</html>
   2.366 \ No newline at end of file