wok-current rev 24131
lxsession, lxsession-lxpolkit, lxappearance: misc fixes (thanks Saipul)
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Sat Oct 23 10:55:42 2021 +0000 (2021-10-23) |
parents | 787a1807d2bb |
children | c01e114d2800 |
files | lxappearance/receipt lxsession-lxpolkit/receipt lxsession/receipt slitaz-configs-base/receipt slitaz-configs/receipt slitaz-tools-boxes/receipt slitaz-tools/receipt sokojs/receipt sokojs/stuff/htm2slc.sh sokojs/stuff/multiset.sh sokojs/stuff/slc2htm.sh sokojs/stuff/undo.u |
line diff
1.1 --- a/lxappearance/receipt Mon Oct 18 14:47:15 2021 +0000 1.2 +++ b/lxappearance/receipt Sat Oct 23 10:55:42 2021 +0000 1.3 @@ -12,8 +12,8 @@ 1.4 TAGS="LXDE" 1.5 HOST_ARCH="i486 arm" 1.6 1.7 -DEPENDS="gtk+" 1.8 -BUILD_DEPENDS="xorg-libX11-dev gtk+-dev" 1.9 +DEPENDS="gtk+ dbus-glib" 1.10 +BUILD_DEPENDS="xorg-libX11-dev gtk+-dev dbus-glib-dev" 1.11 1.12 current_version() 1.13 { 1.14 @@ -26,6 +26,7 @@ 1.15 { 1.16 ./configure \ 1.17 --sysconfdir=/etc \ 1.18 + --enable-dbus \ 1.19 $CONFIGURE_ARGS && 1.20 make && make install 1.21 }
2.1 --- a/lxsession-lxpolkit/receipt Mon Oct 18 14:47:15 2021 +0000 2.2 +++ b/lxsession-lxpolkit/receipt Sat Oct 23 10:55:42 2021 +0000 2.3 @@ -9,7 +9,7 @@ 2.4 WEB_SITE="https://wiki.lxde.org/en/LXSession" 2.5 WANTED="lxsession" 2.6 2.7 -DEPENDS="dbus gtk+" 2.8 +DEPENDS="dbus gtk+ consolekit2" 2.9 2.10 HOST_ARCH="i486 arm" 2.11 2.12 @@ -17,6 +17,8 @@ 2.13 genpkg_rules() 2.14 { 2.15 mkdir -p $fs/usr/bin 2.16 + mkdir -p $fs/usr/share/lxsession/ui 2.17 2.18 cp -a $install/usr/bin/lxpolkit $fs/usr/bin 2.19 + cp -a $install/usr/share/lxsession/ui/lxpolkit*.ui $fs/usr/share/lxsession/ui 2.20 }
3.1 --- a/lxsession/receipt Mon Oct 18 14:47:15 2021 +0000 3.2 +++ b/lxsession/receipt Sat Oct 23 10:55:42 2021 +0000 3.3 @@ -37,12 +37,15 @@ 3.4 # Rules to gen a SliTaz package suitable for Tazpkg. 3.5 genpkg_rules() 3.6 { 3.7 - mkdir -p $fs/usr/share 3.8 + mkdir -p $fs/usr/share/lxsession/ui 3.9 mkdir -p $fs/etc/xdg/lxsession/LXDE 3.10 3.11 cp -a $install/usr/bin $fs/usr 3.12 + cp -a $install/usr/libexec $fs/usr 3.13 + cp -a $install/usr/share/lxsession/ui/lxsession*.ui $fs/usr/share/lxsession/ui 3.14 rm -f $fs/usr/bin/lxpolkit 3.15 # Use SliTaz Icon theme for lxsession-logout 3.16 cp -a $stuff/desktop.conf $fs/etc/xdg/lxsession/LXDE 3.17 + touch $fs/etc/xdg/lxsession/LXDE/autostart 3.18 chown -R 0.0 $fs 3.19 }
4.1 --- a/slitaz-configs-base/receipt Mon Oct 18 14:47:15 2021 +0000 4.2 +++ b/slitaz-configs-base/receipt Sat Oct 23 10:55:42 2021 +0000 4.3 @@ -1,7 +1,7 @@ 4.4 # SliTaz package receipt. 4.5 4.6 PACKAGE="slitaz-configs-base" 4.7 -VERSION="317" 4.8 +VERSION="320" 4.9 CATEGORY="base-system" 4.10 SHORT_DESC="SliTaz config files for text based systems." 4.11 MAINTAINER="pankso@slitaz.org"
5.1 --- a/slitaz-configs/receipt Mon Oct 18 14:47:15 2021 +0000 5.2 +++ b/slitaz-configs/receipt Sat Oct 23 10:55:42 2021 +0000 5.3 @@ -1,7 +1,7 @@ 5.4 # SliTaz package receipt. 5.5 5.6 PACKAGE="slitaz-configs" 5.7 -VERSION="318" 5.8 +VERSION="320" 5.9 CATEGORY="base-system" 5.10 SHORT_DESC="SliTaz config files and artwork." 5.11 MAINTAINER="pankso@slitaz.org"
6.1 --- a/slitaz-tools-boxes/receipt Mon Oct 18 14:47:15 2021 +0000 6.2 +++ b/slitaz-tools-boxes/receipt Sat Oct 23 10:55:42 2021 +0000 6.3 @@ -1,7 +1,7 @@ 6.4 # SliTaz package receipt. 6.5 6.6 PACKAGE="slitaz-tools-boxes" 6.7 -VERSION="1036" 6.8 +VERSION="1037" 6.9 CATEGORY="system-tools" 6.10 SHORT_DESC="All SliTaz GTK/Yad boxes to command line tools." 6.11 MAINTAINER="pankso@slitaz.org"
7.1 --- a/slitaz-tools/receipt Mon Oct 18 14:47:15 2021 +0000 7.2 +++ b/slitaz-tools/receipt Sat Oct 23 10:55:42 2021 +0000 7.3 @@ -1,7 +1,7 @@ 7.4 # SliTaz package receipt. 7.5 7.6 PACKAGE="slitaz-tools" 7.7 -VERSION="1036" 7.8 +VERSION="1037" 7.9 CATEGORY="system-tools" 7.10 SHORT_DESC="SliTaz tools provide installer and utils usable on terminal." 7.11 MAINTAINER="pankso@slitaz.org"
8.1 --- a/sokojs/receipt Mon Oct 18 14:47:15 2021 +0000 8.2 +++ b/sokojs/receipt Sat Oct 23 10:55:42 2021 +0000 8.3 @@ -17,6 +17,7 @@ 8.4 sed -i '/sokojs.zip/d;/src.htm/d' level.htm 8.5 sed -i 's|Online.* ) ||' sokojs.htm 8.6 patch -p0 < $stuff/sokojs.u 8.7 + patch -p0 < $stuff/undo.u 8.8 } 8.9 8.10 # Rules to gen a SliTaz package suitable for Tazpkg.
9.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 9.2 +++ b/sokojs/stuff/htm2slc.sh Sat Oct 23 10:55:42 2021 +0000 9.3 @@ -0,0 +1,56 @@ 9.4 +#!/bin/sh 9.5 + 9.6 +case "$0" in 9.7 +*2txt*) 9.8 + [ -z "$1" ] && echo "$0 file" && exit 1 9.9 + sed '/^"\|<L>\|<Level/!d;s|.*<Level Id="|; |;s| *<L>||;s|</L>||;s| *"[,)].*||;s|^"||;s|".*||;s|_| |g;/^$/d' "$1" | awk 'BEGIN {n=1000;h=0} 9.10 +{ s[h++]=$0 9.11 + if (/^;/) next 9.12 + for (i=1;i<n && substr($0,i,1) == " ";i++); 9.13 + if (i<n) n=i 9.14 +} END { for (i=0;i<h;i++) if (substr(s[i],1,1) == ";") print s[i]; else print substr(s[i],n) }' 9.15 + exit;; 9.16 +esac 9.17 + 9.18 +[ -z "$1" ] && echo "$0 set/" && exit 1 9.19 +[ ! -s "$1/level0.htm" ] && echo "$1/level0.htm not found" && exit 2 9.20 + 9.21 +cat <<EOT 9.22 +<?xml version="1.0" encoding="utf-8"?> 9.23 +<SokobanLevels xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="SokobanLev.xsd"> 9.24 +EOT 9.25 +[ -s $1/description.txt ] && awk 'BEGIN { state=0 } 9.26 +{ 9.27 + if (state == 0) { state++; print " <Title>" $0 "</Title>"; print " <Description>" } 9.28 + else { 9.29 + if (/[A-Za-z0-9]@[A-Za-z0-9]/) s=" <Email>" $0 "</Email>" 9.30 + else if (/^http/) s=" <Url>" $0 "</Url>" 9.31 + else if (!/^copyright/) { print; next } 9.32 + else next 9.33 + if (state++ == 1) print " </Description>" 9.34 + print s 9.35 + } 9.36 +} END { if (state == 1) print " </Description>" }' $1/description.txt 9.37 +copyright="$(grep -s ^copyright $1/description.txt | sed 's|^copyright |Copyright="|;s|$|" |')" 9.38 +maxwidth="$(sed '/^"/!d;s| *"[,)].*||;s|^" *||' $1/level*.htm | awk 'BEGIN{w=0}{if(w<length($0)) w=length($0)}END{print w}')" 9.39 +maxheight="$(for i in $1/level*.htm; do sed '/^"/!d;s| *"[,)].*||;s|^" *||;/^$/d' $i | wc -l; done | awk 'BEGIN{h=0}{if(h<$0) h=$0}END{print h}')" 9.40 +echo " <LevelCollection ${copyright}MaxWidth=\"$maxwidth\" MaxHeight=\"$maxheight\">" 9.41 +n=0 9.42 +while [ -s "$1/level$n.htm" ]; do 9.43 + i="$1/level$((n++)).htm" 9.44 + id="$(sed '/^\/\/ /!d;/[0-9]x[0-9]*\+[0-9]*\+[0-9]/!d;s|^// ||;s| [0-9]*x[0-9]*.*||' $i)" 9.45 + sed '/^"/!d;s| *"[,)].*||;s|^"||;s|_| |g;/^$/d' $i | awk -vx="${id:-$(basename $i .htm)}" ' 9.46 +BEGIN {n=1000;w=0;h=0} { 9.47 + s[h]=$0 9.48 + for (i=1;i<n && substr($0,i,1) == " ";i++); 9.49 + if (i<n) n=i 9.50 + if (w<length($0)) w=length($0) 9.51 + h++ 9.52 +} END { print " <Level Id=\"" x "\" Width=\"" w-n+1 "\" Height=\"" h "\">" 9.53 + for (i=0;i<h;i++) print " <L>" substr(s[i],n) "</L>" 9.54 + print " </Level>" }' 9.55 +done 9.56 +cat <<EOT 9.57 + </LevelCollection> 9.58 +</SokobanLevels> 9.59 +EOT
10.1 --- a/sokojs/stuff/multiset.sh Mon Oct 18 14:47:15 2021 +0000 10.2 +++ b/sokojs/stuff/multiset.sh Sat Oct 23 10:55:42 2021 +0000 10.3 @@ -3,18 +3,20 @@ 10.4 [ -s level.htm ] && rm level.htm && patch -p0 <<EOT 10.5 --- main.htm 10.6 +++ main.htm 10.7 -@@ -11,8 +11,9 @@ Voir : http://www.gnu.org/licenses/gpl.h 10.8 - --> 10.9 - <html> 10.10 - <head> 10.11 -+<META HTTP-EQUIV="Content Type" CONTENT="text/html;charset=utf-8"> 10.12 - <meta name="viewport" content="width=device-width, initial-scale=1"> 10.13 --<style> 10.14 -+<style type="text/css"> 10.15 - <!-- 10.16 +@@ -19,7 +19,11 @@ 10.17 + width:30px; 10.18 + height:30px; 10.19 + } 10.20 +- 10.21 ++a{ 10.22 ++color:red; 10.23 ++text-decoration:none; 10.24 ++display:block; 10.25 ++} 10.26 + @media screen and (max-width: 450px) { 10.27 img.r{ 10.28 - width:30px; 10.29 -@@ -76,19 +77,19 @@ if (parent.frames[0] == null) { document 10.30 + width:29px; 10.31 +@@ -77,8 +81,11 @@ 10.32 var ie4= (navigator.appName == "Microsoft Internet Explorer")?1:0; 10.33 var ns4= (navigator.appName=="Netscape")?1:0; 10.34 10.35 @@ -22,93 +24,115 @@ 10.36 -Col = 16 10.37 +Row = eval(parent.frames[0].document.forms[1].elements[0].value) 10.38 +Col = eval(parent.frames[0].document.forms[1].elements[1].value) 10.39 ++CurSet = parent.frames[0].document.forms[1].elements[2].value 10.40 ++maxLevel = eval(parent.frames[0].document.forms[1].elements[3].value) 10.41 ++nbLevel = eval(parent.frames[0].document.forms[0].elements[(Row*Col)+1].value) 10.42 10.43 function Nmajevent(evenement) 10.44 { 10.45 - if (evenement.which == 52 || evenement.which == 37) { 10.46 - Move(eval(manpos) - 1) 10.47 - } else if (evenement.which == 56 || evenement.which == 38) { 10.48 -- Move(eval(manpos) - Row) 10.49 -+ Move(eval(manpos) - Col) 10.50 - } else if (evenement.which == 54 || evenement.which == 39) { 10.51 - Move(eval(manpos) + 1) 10.52 - } else if (evenement.which == 50 || evenement.which == 40) { 10.53 -- Move(eval(manpos) + Row) 10.54 -+ Move(eval(manpos) + Col) 10.55 - } 10.56 - } 10.57 +@@ -124,6 +131,10 @@ 10.58 10.59 -@@ -108,7 +109,7 @@ function Imajevent(){ 10.60 - if (window.event.keyCode == 37) { 10.61 - Move(eval(manpos) - 1) 10.62 - } else if (window.event.keyCode == 38) { 10.63 -- Move(eval(manpos) - Row) 10.64 -+ Move(eval(manpos) - Col) 10.65 - } else if (window.event.keyCode == 39) { 10.66 - Move(eval(manpos) + 1) 10.67 - } else if (window.event.keyCode == 40) { 10.68 -@@ -150,7 +151,7 @@ manU = new Image(30, 30); manU.src = "8 10.69 + <script type="text/javascript"> 10.70 + <!-- 10.71 ++if (parent.window.location.search.length > 1 && parent.frames[0].location.hash.length == 0 && 10.72 ++ parent.frames[0].location.href.indexOf(parent.window.location.search.substring(1)) < 0) 10.73 ++ parent.frames[0].location = parent.window.location.search.substring(1) 10.74 ++ 10.75 + if (document.all) { 10.76 + top.window.resizeTo(800, 600); 10.77 + } else if (document.layers || document.getElementById) { 10.78 +@@ -151,13 +162,26 @@ 10.79 manD = new Image(30, 30); manD.src = "9.gif"; // down 10.80 10.81 level = new Array() 10.82 -maxLevel = 97 10.83 -+maxLevel = eval(parent.frames[0].document.forms[1].elements[3].value) 10.84 moves = 0 10.85 + saved = "" 10.86 10.87 ++function urlself() 10.88 ++{ 10.89 ++ var l = parent.window.location 10.90 ++ return l.href.substring(0, l.href.length - l.search.length - l.hash.length)+ 10.91 ++ "?"+CurSet+"/level"+nbLevel+".htm#"+saved 10.92 ++} 10.93 ++ 10.94 ++function seturl() 10.95 ++{ 10.96 ++ var e = document.getElementById("urlsave") 10.97 ++ e.setAttribute("href", urlself()); 10.98 ++} 10.99 ++ 10.100 function ReloadLevel() { 10.101 -@@ -168,14 +169,18 @@ function ReloadLevel() { 10.102 + manpos = parent.frames[0].document.forms[0].elements[Row*Col].value 10.103 + moves = 0 10.104 ++ saved = "" 10.105 + window.status = "" 10.106 + nbBoxin = 0 10.107 + for (i = 0 ; i < Row * Col; i++) { 10.108 +@@ -168,9 +192,18 @@ 10.109 + document.images[manpos].src = eval("manD.src") 10.110 + } 10.111 10.112 ++function Go(d,n) { 10.113 ++ parent.frames[0].document.location = d + "/level" + n + ".htm#" + d 10.114 ++ seturl() 10.115 ++} 10.116 ++ 10.117 function GoLevel(n) { 10.118 if (n == nbLevel) ReloadLevel() 10.119 - parent.frames[0].document.location = "level" + n + ".htm" 10.120 -+ parent.frames[0].document.location = parent.frames[0].document.forms[1].elements[2].value + "/level" + n + ".htm" 10.121 ++ Go(CurSet, n) 10.122 +} 10.123 + 10.124 +function GoSet() { 10.125 -+ parent.frames[0].document.location = document.getElementById('set').value + "/level0.htm" 10.126 ++ Go(document.getElementById('set').value, 0) 10.127 } 10.128 10.129 function dir(d) { 10.130 - if (d == -1) return "L"; 10.131 - if (d == 1) return "R"; 10.132 -- if (d == Row) return "D"; 10.133 -- if (d == -Row) return "U"; 10.134 -+ if (d == Col) return "D"; 10.135 -+ if (d == -Col) return "U"; 10.136 +@@ -214,6 +247,7 @@ 10.137 + m = eval("man"+c.toUpperCase()+".src") 10.138 + } while (c == c.toLowerCase()) 10.139 + document.images[manpos].src = m 10.140 ++ seturl() 10.141 + } 10.142 } 10.143 10.144 - function print_moves(m) { 10.145 -@@ -226,7 +231,7 @@ function Move(a) { 10.146 +@@ -224,9 +258,9 @@ 10.147 + var m = dir(d).toLowerCase() 10.148 + if (level[a] == boxin || level[a] == boxout) { 10.149 + b = a + d 10.150 +- ++moves 10.151 + m = dir(d) 10.152 + if (level[b] == floor || level[b] == dest) { 10.153 ++ ++moves 10.154 + level[a] == boxin ? (level[a] = dest, nbBoxin++) : level[a] = floor 10.155 + level[b] == dest ? (level[b] = boxin, nbBoxin--) : level[b] = boxout 10.156 + document.images[b].src = eval("img" + level[b] + ".src") 10.157 +@@ -243,7 +277,7 @@ 10.158 if (nbBoxin == 0) { 10.159 if (nbLevel < maxLevel) { 10.160 alert("You have done a good job !") 10.161 - parent.frames[0].location = "level" + (++nbLevel) + ".htm" 10.162 -+ parent.frames[0].document.location = parent.frames[0].document.forms[1].elements[2].value + "/level" + (++nbLevel) + ".htm" 10.163 ++ parent.frames[0].document.location = CurSet + "/level" + (++nbLevel) + ".htm" 10.164 GoLevel(nbLevel) 10.165 } else { 10.166 alert("Congratulations !") 10.167 -@@ -246,14 +251,14 @@ function Move(a) { 10.168 - for (y = 0 ; y < Row; y++) { 10.169 - document.write ("<TR>") 10.170 - for (x = 0; x < Col; x++) { 10.171 -- level[x + Row * y] = parent.frames[0].document.forms[0].elements[x + Row * y].value 10.172 -- if (level[x + Row * y] == dest) nbBoxin++ 10.173 -- if (level[x + Row * y] == land || level[x + Row * y] == wall) 10.174 -+ level[x + Col * y] = parent.frames[0].document.forms[0].elements[x + Col * y].value 10.175 -+ if (level[x + Col * y] == dest) nbBoxin++ 10.176 -+ if (level[x + Col * y] == land || level[x + Col * y] == wall) 10.177 - document.write("<TD VALIGN=TOP>", 10.178 -- "<IMG align=middle class=r border=0 src=\"", level[x + Row * y], ".gif\"<\/TD>") 10.179 -+ "<IMG align=middle class=r border=0 src=\"", level[x + Col * y], ".gif\"<\/TD>") 10.180 - else 10.181 -- document.write("<TD VALIGN=TOP><A HREF=\"JavaScript:Move(", x + Row * y, ")\">", 10.182 -- "<IMG align=middle class=r border=0 src=\"", level[x + Row * y], ".gif\"</A><\/TD>") 10.183 -+ document.write("<TD VALIGN=TOP><A HREF=\"JavaScript:Move(", x + Col * y, ")\">", 10.184 -+ "<IMG align=middle class=r border=0 src=\"", level[x + Col * y], ".gif\"</A><\/TD>") 10.185 +@@ -251,6 +285,7 @@ 10.186 + } 10.187 } 10.188 - document.write("<\/TR>") 10.189 } 10.190 -@@ -266,8 +271,16 @@ function Move(a) { 10.191 ++ seturl() 10.192 + } 10.193 + window.focus() 10.194 + window.status = "" 10.195 +@@ -277,21 +312,32 @@ 10.196 + } 10.197 + document.write("<\/TABLE>") 10.198 + manpos = parent.frames[0].document.forms[0].elements[Row*Col].value 10.199 +- nbLevel = parent.frames[0].document.forms[0].elements[(Row*Col)+1].value 10.200 + 10.201 + document.write("</table><TABLE cellspacing=0 cellpadding=0 style='max-width:300px'><TD>") 10.202 + 10.203 document.write("<FORM>", 10.204 "<INPUT TYPE=button onClick=\"Javascript:ReloadLevel();\" value=\"Restart\">", 10.205 "<INPUT TYPE=button onClick=\"Javascript:UndoMove();\" value=\"Undo\"><p id=\"moves\" style=\"color:white\">0 moves</p></center>") 10.206 @@ -118,14 +142,26 @@ 10.207 + document.write("<option>sokojs</option>"); 10.208 + document.write("</select><br />") 10.209 + document.write("<body style=\"margin:0\" bgcolor=\"black\"> <b><FONT FACE=\"Comic Sans MS\" SIZE=4 COLOR=\"red\">", 10.210 -+ parent.frames[0].document.forms[1].elements[2].value," LEVEL ", 10.211 -+ eval(parent.frames[0].document.forms[0].elements[(Row*Col)+1].value) + 1,"<br/>") 10.212 ++ "<a id=\"urlsave\" href=\"",urlself(),"\">",CurSet," LEVEL ",nbLevel + 1,"</a><br/>") 10.213 for (i = 0; i <= maxLevel; i++) { 10.214 - document.write("<INPUT style='font-family:Courier New;font-size:14px;font-weight:bold;border:1;border-color:0;padding:0;margin:0px;background-color:#c0c0c0;color:#404040รน' TYPE=\"button\" onClick=\"Javascript:GoLevel(", i, ");\" value=\"", (i<9?" ":"")+(i+1), "\">") 10.215 + document.write("<INPUT "+style+" TYPE=\"button\" onClick=\"Javascript:GoLevel(", i, ");\" value=\"", (i<9?" ":"")+(i+1), "\">") 10.216 } 10.217 document.write("<\/FORM></table>") 10.218 10.219 + document.images[manpos].src = eval("manD.src") 10.220 ++ 10.221 ++ if (parent.window.location.hash.length > 1 && parent.frames[0].location.hash.length == 0) { 10.222 ++ for (i = 2; i <= parent.window.location.hash.length; i++) 10.223 ++ Move(manpos-undoDir(parent.window.location.hash.substring(i-1,i))) 10.224 ++ } 10.225 + //--> 10.226 + </script> 10.227 + 10.228 + </body> 10.229 +-</html> 10.230 +\ No newline at end of file 10.231 ++</html> 10.232 --- sokojs.htm 10.233 +++ sokojs.htm 10.234 @@ -22,14 +22,13 @@ Foundation, Inc., 59 Temple Place - Suit 10.235 @@ -161,4 +197,10 @@ 10.236 "<INPUT TYPE=\\"button\\" value=\\"97\\"><\\/FORM>")' > sokojs/$l 10.237 rm -f $l 10.238 done 10.239 - 10.240 +[ -s sokojs/description.txt ] || cat > sokojs/description.txt <<EOT 10.241 +SokoJS 10.242 +Sokoban Game for Javascript 10.243 +michel.buze@gmail.com 10.244 +http://buze.michel.chez.com 10.245 +copyright Michel BUZE 10.246 +EOT
11.1 --- a/sokojs/stuff/slc2htm.sh Mon Oct 18 14:47:15 2021 +0000 11.2 +++ b/sokojs/stuff/slc2htm.sh Sat Oct 23 10:55:42 2021 +0000 11.3 @@ -31,6 +31,7 @@ 11.4 while read line; do 11.5 case "$line" in 11.6 *\<Url\>*) echo "$line" | sed 's|.*<Url>||;s|</Url>.*||' >> "$set/description.txt" ;; 11.7 + *\<Email\>*) echo "$line" | sed 's|.*<Email>||;s|</Email>.*||' >> "$set/description.txt" ;; 11.8 *\<Title\>*) echo "$line" | sed 's|.*<Title>||;s|</Title>.*||' >> "$set/description.txt" ;; 11.9 *\<Description\>) state="Description"; continue ;; 11.10 *\</Description\>) state="" ;;
12.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 12.2 +++ b/sokojs/stuff/undo.u Sat Oct 23 10:55:42 2021 +0000 12.3 @@ -0,0 +1,157 @@ 12.4 +--- main.htm 12.5 ++++ main.htm 12.6 +@@ -11,8 +11,9 @@ 12.7 + --> 12.8 + <html> 12.9 + <head> 12.10 ++<meta http-equiv="Content Type" content="text/html;charset=utf-8"> 12.11 + <meta name="viewport" content="width=device-width, initial-scale=1"> 12.12 +-<style> 12.13 ++<style type="text/css"> 12.14 + <!-- 12.15 + img.r{ 12.16 + width:30px; 12.17 +@@ -84,11 +85,11 @@ 12.18 + if (evenement.which == 52 || evenement.which == 37) { 12.19 + Move(eval(manpos) - 1) 12.20 + } else if (evenement.which == 56 || evenement.which == 38) { 12.21 +- Move(eval(manpos) - Row) 12.22 ++ Move(eval(manpos) - Col) 12.23 + } else if (evenement.which == 54 || evenement.which == 39) { 12.24 + Move(eval(manpos) + 1) 12.25 + } else if (evenement.which == 50 || evenement.which == 40) { 12.26 +- Move(eval(manpos) + Row) 12.27 ++ Move(eval(manpos) + Col) 12.28 + } 12.29 + } 12.30 + 12.31 +@@ -108,7 +109,7 @@ 12.32 + if (window.event.keyCode == 37) { 12.33 + Move(eval(manpos) - 1) 12.34 + } else if (window.event.keyCode == 38) { 12.35 +- Move(eval(manpos) - Row) 12.36 ++ Move(eval(manpos) - Col) 12.37 + } else if (window.event.keyCode == 39) { 12.38 + Move(eval(manpos) + 1) 12.39 + } else if (window.event.keyCode == 40) { 12.40 +@@ -152,6 +153,7 @@ 12.41 + level = new Array() 12.42 + maxLevel = 97 12.43 + moves = 0 12.44 ++saved = "" 12.45 + 12.46 + function ReloadLevel() { 12.47 + manpos = parent.frames[0].document.forms[0].elements[Row*Col].value 12.48 +@@ -174,44 +176,57 @@ 12.49 + function dir(d) { 12.50 + if (d == -1) return "L"; 12.51 + if (d == 1) return "R"; 12.52 +- if (d == Row) return "D"; 12.53 +- if (d == -Row) return "U"; 12.54 ++ if (d == Col) return "D"; 12.55 ++ if (d == -Col) return "U"; 12.56 ++} 12.57 ++ 12.58 ++function undoDir(c) { 12.59 ++ if (c.toLowerCase() == 'u') return Col; 12.60 ++ if (c.toLowerCase() == 'd') return -Col; 12.61 ++ if (c.toLowerCase() == 'r') return -1; 12.62 ++ if (c.toLowerCase() == 'l') return 1; 12.63 + } 12.64 + 12.65 + function print_moves(m) { 12.66 + document.getElementById('moves').firstChild.nodeValue=m + " moves" 12.67 + } 12.68 ++ 12.69 + function UndoMove() { 12.70 +- if (ua != -1) { 12.71 +- document.images[manpos].src = eval("img" + level[manpos] + ".src") 12.72 +- document.images[ua].src = eval("img" + lua + ".src") 12.73 +- document.images[ub].src = eval("img" + lub + ".src") 12.74 +- level[ua] = lua 12.75 +- level[ub] = lub 12.76 +- level[um] = lum 12.77 +- document.images[manpos = um].src = usrc 12.78 +- nbBoxin = unb 12.79 +- print_moves(--moves) 12.80 +- ua = -1 12.81 +- } 12.82 ++ if (saved.length > 0) { 12.83 ++ var c = saved.charAt(saved.length-1) 12.84 ++ var m = eval("manD.src") 12.85 ++ do { 12.86 ++ saved = saved.substring(0,saved.length-1) 12.87 ++ d = undoDir(c) 12.88 ++ a = manpos - d 12.89 ++ if (c != c.toLowerCase()) { 12.90 ++ if (level[a] == boxin && level[manpos] != boxin) nbBoxin++ 12.91 ++ if (level[a] != boxin && level[manpos] == boxin) nbBoxin-- 12.92 ++ print_moves(--moves) 12.93 ++ level[a] = (level[a] == boxin) ? dest : floor 12.94 ++ level[manpos] = (level[manpos] == dest) ? boxin : boxout 12.95 ++ document.images[a].src = eval("img" + level[a] + ".src") 12.96 ++ } 12.97 ++ document.images[manpos].src = eval("img" + level[manpos] + ".src") 12.98 ++ manpos += d 12.99 ++ if (saved.length == 0) break 12.100 ++ c = saved.charAt(saved.length-1) 12.101 ++ m = eval("man"+c.toUpperCase()+".src") 12.102 ++ } while (c == c.toLowerCase()) 12.103 ++ document.images[manpos].src = m 12.104 ++ } 12.105 + } 12.106 + 12.107 + function Move(a) { 12.108 + d = a - manpos 12.109 + 12.110 + if (d == 1 || d == -1 || d == Col || d == -Col) { 12.111 ++ var m = dir(d).toLowerCase() 12.112 + if (level[a] == boxin || level[a] == boxout) { 12.113 + b = a + d 12.114 +- um = manpos 12.115 +- ua = a 12.116 +- ub = b 12.117 +- lum = level[manpos] 12.118 +- lua = level[a] 12.119 +- lub = level[b] 12.120 +- usrc = document.images[manpos].src 12.121 +- unb = nbBoxin 12.122 +- print_moves(++moves) 12.123 ++ m = dir(d) 12.124 + if (level[b] == floor || level[b] == dest) { 12.125 ++ ++moves 12.126 + level[a] == boxin ? (level[a] = dest, nbBoxin++) : level[a] = floor 12.127 + level[b] == dest ? (level[b] = boxin, nbBoxin--) : level[b] = boxout 12.128 + document.images[b].src = eval("img" + level[b] + ".src") 12.129 +@@ -221,7 +236,9 @@ 12.130 + if (level[a] == floor || level[a] == dest) { 12.131 + document.images[manpos].src = eval("img" + level[manpos] + ".src") 12.132 + document.images[manpos = a].src = eval("man" + dir(d) + ".src") 12.133 ++ saved+=m 12.134 + } 12.135 ++ print_moves(moves) 12.136 + 12.137 + if (nbBoxin == 0) { 12.138 + if (nbLevel < maxLevel) { 12.139 +@@ -246,14 +263,15 @@ 12.140 + for (y = 0 ; y < Row; y++) { 12.141 + document.write ("<TR>") 12.142 + for (x = 0; x < Col; x++) { 12.143 +- level[x + Row * y] = parent.frames[0].document.forms[0].elements[x + Row * y].value 12.144 +- if (level[x + Row * y] == dest) nbBoxin++ 12.145 +- if (level[x + Row * y] == land || level[x + Row * y] == wall) 12.146 ++ var i = x + Col * y 12.147 ++ level[i] = parent.frames[0].document.forms[0].elements[i].value 12.148 ++ if (level[i] == dest) nbBoxin++ 12.149 ++ if (level[i] == land || level[i] == wall) 12.150 + document.write("<TD VALIGN=TOP>", 12.151 +- "<IMG align=middle class=r border=0 src=\"", level[x + Row * y], ".gif\"<\/TD>") 12.152 ++ "<IMG align=middle class=r border=0 src=\"", level[i], ".gif\"<\/TD>") 12.153 + else 12.154 +- document.write("<TD VALIGN=TOP><A HREF=\"JavaScript:Move(", x + Row * y, ")\">", 12.155 +- "<IMG align=middle class=r border=0 src=\"", level[x + Row * y], ".gif\"</A><\/TD>") 12.156 ++ document.write("<TD VALIGN=TOP><A HREF=\"JavaScript:Move(", i, ")\">", 12.157 ++ "<IMG align=middle class=r border=0 src=\"", level[i], ".gif\"</A><\/TD>") 12.158 + } 12.159 + document.write("<\/TR>") 12.160 + }