tazpanel rev 525
Add "noheader" flag to get page without header/footer/panel "wrappers" (for pop-ups); strip, minify and gzip scripts and styles.
author | Aleksej Bobylev <al.bobylev@gmail.com> |
---|---|
date | Thu Aug 20 17:00:19 2015 +0300 (2015-08-20) |
parents | f8e0ae0ac1d9 |
children | 4f619f973b88 |
files | Makefile lib/libtazpanel lib/qr.js lib/qr.js.include lib/tazpanel.js network.cgi stripall.sh styles/default/base.css styles/default/footer.html styles/default/header.html tazpanel |
line diff
1.1 --- a/Makefile Tue Aug 18 19:09:02 2015 +0300 1.2 +++ b/Makefile Thu Aug 20 17:00:19 2015 +0300 1.3 @@ -8,9 +8,15 @@ 1.4 BASECGI?=boot.cgi hardware.cgi help.cgi index.cgi network.cgi settings.cgi 1.5 EXTRACGI?=floppy.cgi powersaving.cgi 1.6 1.7 -VERSION:=$(shell grep ^VERSION tazpanel | cut -d '=' -f 2) 1.8 +VERSION:=$(shell grep ^VERSION tazpanel | cut -d= -f2) 1.9 1.10 all: msgfmt 1.11 + mkdir build 1.12 + cp -a *.cgi bootloader tazpanel \ 1.13 + lib/libtazpanel lib/*.js \ 1.14 + styles/default/*.html styles/default/*.css \ 1.15 + build 1.16 + ./stripall.sh 1.17 1.18 # i18n 1.19 1.20 @@ -45,24 +51,30 @@ 1.21 $(DESTDIR)$(PREFIX)/share/applications \ 1.22 $(DESTDIR)$(SYSCONFDIR) \ 1.23 $(DESTDIR)$(PANEL)/menu.d \ 1.24 - $(DESTDIR)/var/log 1.25 - cp -a tazpanel $(DESTDIR)$(PREFIX)/bin 1.26 + $(DESTDIR)/var/log \ 1.27 + $(DESTDIR)$(PANEL)/lib \ 1.28 + $(DESTDIR)$(PANEL)/styles/default 1.29 + 1.30 + cp -a build/tazpanel $(DESTDIR)$(PREFIX)/bin 1.31 -[ "$(VERSION)" ] && sed -i 's/^VERSION=[0-9].*/VERSION=$(VERSION)/' $(DESTDIR)$(PREFIX)/bin/tazpanel 1.32 - cp -a lib/ styles/ doc/ README* $(DESTDIR)$(PANEL) 1.33 + 1.34 + cp -a doc/ README README.html $(DESTDIR)$(PANEL) 1.35 + cp -a build/libtazpanel build/gz/*.js.gz $(DESTDIR)$(PANEL)/lib 1.36 + cp -a build/gz/*.css.gz build/*.html styles/default/*.ico styles/default/*.ttf $(DESTDIR)$(PANEL)/styles/default 1.37 + 1.38 @for c in $(BASECGI); do \ 1.39 - cp -a $$c $(DESTDIR)$(PANEL); \ 1.40 + cp -a build/$$c $(DESTDIR)$(PANEL); \ 1.41 done; 1.42 + 1.43 if [ -e $(DESTDIR)$(PANEL)/user ] ; then rm -rf $(DESTDIR)$(PANEL)/user; fi 1.44 ln -s . $(DESTDIR)$(PANEL)/user 1.45 + 1.46 cp -a po/mo/* $(DESTDIR)$(PREFIX)/share/locale 1.47 cp -a data/*.conf $(DESTDIR)$(SYSCONFDIR) 1.48 cp -a data/*.desktop $(DESTDIR)$(PREFIX)/share/applications 1.49 cp -a data/icons $(DESTDIR)$(PREFIX)/share 1.50 touch $(DESTDIR)/var/log/tazpanel.log 1.51 1.52 - @# Clean comments in production release 1.53 - sed -i '/^\t*\/\//d' $(DESTDIR)$(PANEL)/lib/tazpanel.js 1.54 - 1.55 @# Remove this when TazWeb will support OpenType ligatures for web-fonts (maybe, after Webkit upgrade?) 1.56 mkdir -p $(DESTDIR)/usr/share/fonts/TTF 1.57 ln -fs $(PANEL)/styles/default/tazpanel.ttf $(DESTDIR)/usr/share/fonts/TTF/tazpanel.ttf 1.58 @@ -73,15 +85,16 @@ 1.59 $(DESTDIR)$(PANEL)/menu.d/hardware \ 1.60 $(DESTDIR)/usr/bin 1.61 @for c in $(EXTRACGI); do \ 1.62 - cp -a $$c $(DESTDIR)$(PANEL); \ 1.63 + cp -a build/$$c $(DESTDIR)$(PANEL); \ 1.64 done; 1.65 - cp -a bootloader $(DESTDIR)/usr/bin 1.66 + cp -a build/bootloader $(DESTDIR)/usr/bin 1.67 ln -s ../../floppy.cgi $(DESTDIR)$(PANEL)/menu.d/boot/floppy 1.68 ln -s ../../powersaving.cgi $(DESTDIR)$(PANEL)/menu.d/hardware/powersaving 1.69 1.70 # Clean source 1.71 1.72 clean: 1.73 + rm -rf build 1.74 rm -rf po/mo 1.75 rm -f po/*.mo 1.76 rm -f po/*.*~
2.1 --- a/lib/libtazpanel Tue Aug 18 19:09:02 2015 +0300 2.2 +++ b/lib/libtazpanel Thu Aug 20 17:00:19 2015 +0300 2.3 @@ -12,18 +12,15 @@ 2.4 2.5 _() { local T="$1"; shift; printf "$(gettext "$T")" "$@"; echo; } 2.6 _n() { local T="$1"; shift; printf "$(gettext "$T")" "$@"; } 2.7 -_p() { 2.8 - local S="$1" P="$2" N="$3"; shift 3; 2.9 - printf "$(ngettext "$S" "$P" "$N")" "$@"; } 2.10 2.11 2.12 GUI_USER=nobody 2.13 [ "$HTTP_HOST" == "127.0.0.1:82" ] && 2.14 for i in "$HTTP_COOKIE" "$QUERY_STRING" ; do 2.15 - v="$(echo "$i" | sed '/guiuser=/!d;s/.*guiuser=\([A-Za-z0-9_]*\).*/\1/')" 2.16 - [ "$v" ] || continue 2.17 - busybox ps | sed '/d;/d;/127\.0\.0\.1:82/!d' | grep -q " $v " || continue 2.18 - GUI_USER="$v" 2.19 + v="$(echo "$i" | sed '/guiuser=/!d;s/.*guiuser=\([A-Za-z0-9_]*\).*/\1/')" 2.20 + [ "$v" ] || continue 2.21 + busybox ps | sed '/d;/d;/127\.0\.0\.1:82/!d' | grep -q " $v " || continue 2.22 + GUI_USER="$v" 2.23 done 2.24 [ "$(id -un)" == "${REMOTE_USER:=$GUI_USER}" ] || exec su -s /bin/sh -c "$(realpath $0) $@" $REMOTE_USER 2.25 2.26 @@ -36,9 +33,7 @@ 2.27 # I18n 2.28 2.29 . /etc/locale.conf 2.30 -. /usr/bin/gettext.sh 2.31 -TEXTDOMAIN='tazpanel' 2.32 -export TEXTDOMAIN LANG LC_ALL 2.33 +export TEXTDOMAIN='tazpanel' LANG LC_ALL 2.34 2.35 2.36 # We need a config file first 2.37 @@ -155,7 +150,7 @@ 2.38 if ifconfig | grep -A1 $1 | grep -q inet; then 2.39 ip=$(ifconfig | grep -A1 $1 | grep inet | awk '{ print $2 }' | cut -d: -f2) 2.40 [ "$(cat /sys/class/net/$1/carrier)" == "1" ] && 2.41 - scan="<a data-icon=\"scan\" href='network.cgi?scan=$ip&back=network.cgi'>$(_ 'Scan')</a>" 2.42 + scan='<a data-icon="scan" href="network.cgi?scan='$ip'&back=network.cgi">'$(_ 'Scan')'</a>' 2.43 fi 2.44 [ "$(cat /sys/class/net/$1/carrier)" == "1" ] && 2.45 status="$(_ 'connected')" && 2.46 @@ -184,20 +179,20 @@ 2.47 for i in $(ls /sys/class/net); do 2.48 case $i in 2.49 eth*) 2.50 - echo " <tr><td><a data-icon='eth' href='network.cgi?eth'>$i</a></td> 2.51 - <td>Ethernet</td> $(interface_status $i)</tr>" ;; 2.52 + echo '<tr><td><a data-icon="eth" href="network.cgi?eth">'$i'</a></td> 2.53 + <td>Ethernet</td> '$(interface_status $i)'</tr>';; 2.54 wlan*|ath*|ra*) 2.55 - echo " <tr><td><a data-icon='wifi' href='network.cgi?wifi'>$i</a></td> 2.56 - <td>Wireless</td> $(interface_status $i)</tr>" ;; 2.57 + echo '<tr><td><a data-icon="wifi" href="network.cgi?wifi">'$i'</a></td> 2.58 + <td>Wireless</td> '$(interface_status $i)'</tr>';; 2.59 ppp*) 2.60 - echo " <tr><td><a data-icon='removable' href='ppp.cgi'>$i</a></td> 2.61 - <td>Point to point</td> $(interface_status $i)</tr>" ;; 2.62 + echo '<tr><td><a data-icon="removable" href="ppp.cgi">'$i'</a></td> 2.63 + <td>Point to point</td> '$(interface_status $i)'</tr>';; 2.64 tap[0-9]*|tun[0-9]*) 2.65 - echo " <tr><td><span data-icon='removable'>$i</span></td> 2.66 - <td>User space</td> $(interface_status $i)</tr>" ;; 2.67 + echo '<tr><td><span data-icon="removable">'$i'</span></td> 2.68 + <td>User space</td> '$(interface_status $i)'</tr>';; 2.69 lo) 2.70 - echo " <tr><td><span data-icon='loopback'>$i</span></td> 2.71 - <td>Loopback</td> $(interface_status $i)</tr>" ;; 2.72 + echo '<tr><td><span data-icon="loopback">'$i'</span></td> 2.73 + <td>Loopback</td> '$(interface_status $i)'</tr>';; 2.74 *) 2.75 continue ;; 2.76 esac 2.77 @@ -224,7 +219,7 @@ 2.78 list_locales() { 2.79 for locale in $(find /usr/share/i18n/locales -type f -name "[a-z][a-z]_[A-Z][A-Z]") 2.80 do 2.81 - echo "<option value='$locale'>$locale</option>" 2.82 + echo "<option value=\"$locale\">$locale</option>" 2.83 done 2.84 } 2.85 2.86 @@ -232,10 +227,12 @@ 2.87 # Get the list of console keymaps 2.88 2.89 list_keymaps() { 2.90 - if [ -d /usr/share/kbd ]; then # kbd-base 2.91 + if [ -d /usr/share/kbd ]; then 2.92 + # kbd-base 2.93 find /usr/share/kbd/keymaps/i386 -type f -name '*.map*' ! -path '*include*' | \ 2.94 awk -F/ '{gsub(/.map.gz/, ""); printf "<option value=\"%s\">%s (%s)\n", $8, $8, $7}' 2.95 - else # kbd-busybox 2.96 + else 2.97 + # kbd-busybox 2.98 ls /usr/share/kmap/*.kmap | \ 2.99 sed 's|.*kmap/\(.*\).kmap|<option value="\1">\1|' 2.100 fi | sort 2.101 @@ -247,6 +244,7 @@ 2.102 # 2.103 2.104 loading_msg() { 2.105 + [ -n "$(GET noheader)" ] && return 2.106 local MSG=${1:-$LOADING_MSG} 2.107 [ -z "$MSG" ] && MSG="$(_ 'Please wait')" 2.108 cat <<EOT 2.109 @@ -256,6 +254,7 @@ 2.110 2.111 2.112 xhtml_header() { 2.113 + [ -n "$(GET noheader)" ] && return 2.114 SUBTITLE="$1" 2.115 . ${PANEL}$HEADER 2.116 cat <<EOT 2.117 @@ -293,6 +292,7 @@ 2.118 2.119 2.120 xhtml_footer() { 2.121 + [ -n "$(GET noheader)" ] && return 2.122 export TEXTDOMAIN='tazpkg' 2.123 . ${PANEL}$FOOTER 2.124 } 2.125 @@ -323,15 +323,13 @@ 2.126 msg() { 2.127 msgtype="$1"; shift 2.128 case "$msgtype" in 2.129 - tip) MSG_ICON='msgtip';; 2.130 - warn|warning) MSG_ICON='msgwarn';; 2.131 - err|error) MSG_ICON='msgerr';; 2.132 - up) MSG_ICON='msgup';; 2.133 - *) MSG_ICON='msg';; 2.134 + tip) I='data-icon="msgtip"';; 2.135 + warn|warning) I='data-icon="msgwarn"';; 2.136 + err|error) I='data-icon="msgerr"';; 2.137 + up) I='data-icon="msgup"';; 2.138 + *) I='data-icon="msg"';; 2.139 esac 2.140 - cat <<EOT 2.141 - <section class="box"><span data-icon="$MSG_ICON"></span>$@</section> 2.142 -EOT 2.143 + echo "<section class=\"box\"><span $I></span>$@</section>" 2.144 } 2.145 2.146 2.147 @@ -361,6 +359,7 @@ 2.148 2.149 back_button() { 2.150 local URL="$1" default_caption="$(_ 'Back')" 2.151 + #FIXME: can't encode data-icon 2.152 local caption="${2:-$default_caption}" icon="${3:-back}" 2.153 2.154 if [ -n "$1" ]; then
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 3.2 +++ b/lib/qr.js Thu Aug 20 17:00:19 2015 +0300 3.3 @@ -0,0 +1,4 @@ 3.4 +/*! qr-js v1.1.3 | (c) 2014 Alasdair Mercer | GPL v3 License 3.5 +jsqrencode | (c) 2010 tz@execpc.com | GPL v3 License 3.6 +*/ 3.7 +!function(a){"use strict";function b(){return T?new r:a.document.createElement("canvas")}function c(){return T?new x:a.document.createElement("img")}function d(b,c,d){var e=c.mime||B;a.location.href=b.toDataURL(e).replace(e,C),"function"==typeof d&&d()}function e(a){return"string"==typeof a&&(a={value:a}),a||{}}function f(a){function b(b){a[b]=function(){throw new Error(b+" requires HTML5 canvas element support")}}var c,d=["canvas","image","save","saveSync","toDataURL"];for(c=0;c<d.length;c++)b(d[c])}function g(a,b,c){function d(){w.write(e,f,0,f.length,0,function(a){w.close(e),c(a)})}if("string"!=typeof b.path)return c(new TypeError("Invalid path type: "+typeof b.path));var e,f;a.toBuffer(function(a,b){return a?c(a):(f=b,void(e&&d()))}),w.open(b.path,"w",N,function(a,b){return a?c(a):(e=b,void(f&&d()))})}function h(a,b){if("string"!=typeof b.path)throw new TypeError("Invalid path type: "+typeof b.path);var c=a.toBuffer(),d=w.openSync(b.path,"w",N);try{w.writeSync(d,c,0,c.length,0)}finally{w.closeSync(d)}}function i(a,b){var c;a>b&&(c=a,a=b,b=c),c=b,c*=b,c+=b,c>>=1,c+=a,S[c]=1}function j(a,b){var c;for(R[a+z*b]=1,c=-2;2>c;c++)R[a+c+z*(b-2)]=1,R[a-2+z*(b+c+1)]=1,R[a+2+z*(b+c)]=1,R[a+c+1+z*(b+2)]=1;for(c=0;2>c;c++)i(a-1,b+c),i(a+1,b-c),i(a-c,b-1),i(a+c,b+1)}function k(a){for(;a>=255;)a-=255,a=(a>>8)+(255&a);return a}function l(a,b,c,d){var e,f,g;for(f=0;d>f;f++)W[c+f]=0;for(f=0;b>f;f++){if(e=H[W[a+f]^W[c]],255!==e)for(g=1;d>g;g++)W[c+g-1]=W[c+g]^G[k(e+U[d-g])];else for(g=c;c+d>g;g++)W[g]=W[g+1];W[c+d-1]=255===e?0:G[k(e+U[0])]}}function m(a,b){var c;return a>b&&(c=a,a=b,b=c),c=b,c+=b*b,c>>=1,c+=a,1===S[c]}function n(a){var b,c,d,e;switch(a){case 0:for(c=0;z>c;c++)for(b=0;z>b;b++)b+c&1||m(b,c)||(R[b+c*z]^=1);break;case 1:for(c=0;z>c;c++)for(b=0;z>b;b++)1&c||m(b,c)||(R[b+c*z]^=1);break;case 2:for(c=0;z>c;c++)for(d=0,b=0;z>b;b++,d++)3===d&&(d=0),d||m(b,c)||(R[b+c*z]^=1);break;case 3:for(e=0,c=0;z>c;c++,e++)for(3===e&&(e=0),d=e,b=0;z>b;b++,d++)3===d&&(d=0),d||m(b,c)||(R[b+c*z]^=1);break;case 4:for(c=0;z>c;c++)for(d=0,e=c>>1&1,b=0;z>b;b++,d++)3===d&&(d=0,e=!e),e||m(b,c)||(R[b+c*z]^=1);break;case 5:for(e=0,c=0;z>c;c++,e++)for(3===e&&(e=0),d=0,b=0;z>b;b++,d++)3===d&&(d=0),(b&c&1)+!(!d|!e)||m(b,c)||(R[b+c*z]^=1);break;case 6:for(e=0,c=0;z>c;c++,e++)for(3===e&&(e=0),d=0,b=0;z>b;b++,d++)3===d&&(d=0),(b&c&1)+(d&&d===e)&1||m(b,c)||(R[b+c*z]^=1);break;case 7:for(e=0,c=0;z>c;c++,e++)for(3===e&&(e=0),d=0,b=0;z>b;b++,d++)3===d&&(d=0),(d&&d===e)+(b+c&1)&1||m(b,c)||(R[b+c*z]^=1)}}function o(a){var b,c=0;for(b=0;a>=b;b++)O[b]>=5&&(c+=I+O[b]-5);for(b=3;a-1>b;b+=2)O[b-2]===O[b+2]&&O[b+2]===O[b-1]&&O[b-1]===O[b+1]&&3*O[b-1]===O[b]&&(0===O[b-3]||b+3>a||3*O[b-3]>=4*O[b]||3*O[b+3]>=4*O[b])&&(c+=K);return c}function p(){var a,b,c,d,e,f,g,h,i;for(c=e=f=0,i=0;z-1>i;i++)for(h=0;z-1>h;h++)(R[h+z*i]&&R[h+1+z*i]&&R[h+z*(i+1)]&&R[h+1+z*(i+1)]||!(R[h+z*i]||R[h+1+z*i]||R[h+z*(i+1)]||R[h+1+z*(i+1)]))&&(c+=J);for(i=0;z>i;i++){for(O[0]=0,g=a=h=0;z>h;h++)(b=R[h+z*i])===a?O[g]++:O[++g]=1,a=b,e+=a?1:-1;c+=o(g)}for(0>e&&(e=-e),d=e,d+=d<<2,d<<=1;d>z*z;)d-=z*z,f++;for(c+=f*L,h=0;z>h;h++){for(O[0]=0,g=a=i=0;z>i;i++)(b=R[h+z*i])===a?O[g]++:O[++g]=1,a=b;c+=o(g)}return c}function q(a){var b,c,d,e,f,g,h,o;f=a.length,y=0;do if(y++,d=4*(Q-1)+16*(y-1),u=D[d++],v=D[d++],s=D[d++],t=D[d],d=s*(u+v)+v-3+(9>=y),d>=f)break;while(40>y);for(z=17+4*y,g=s+(s+t)*(u+v)+v,f=0;g>f;f++)P[f]=0;for(W=a.slice(0),f=0;z*z>f;f++)R[f]=0;for(f=0;(z*(z+1)+1)/2>f;f++)S[f]=0;for(f=0;3>f;f++){for(d=o=0,1===f&&(d=z-7),2===f&&(o=z-7),R[o+3+z*(d+3)]=1,h=0;6>h;h++)R[o+h+z*d]=1,R[o+z*(d+h+1)]=1,R[o+6+z*(d+h)]=1,R[o+h+1+z*(d+6)]=1;for(h=1;5>h;h++)i(o+h,d+1),i(o+1,d+h+1),i(o+5,d+h),i(o+h+1,d+5);for(h=2;4>h;h++)R[o+h+z*(d+2)]=1,R[o+2+z*(d+h+1)]=1,R[o+4+z*(d+h)]=1,R[o+h+1+z*(d+4)]=1}if(y>1)for(f=A[y],o=z-7;;){for(h=z-7;h>f-3&&(j(h,o),!(f>h));)h-=f;if(f+9>=o)break;o-=f,j(6,o),j(o,6)}for(R[8+z*(z-8)]=1,o=0;7>o;o++)i(7,o),i(z-8,o),i(7,o+z-7);for(h=0;8>h;h++)i(h,7),i(h+z-8,7),i(h,z-8);for(h=0;9>h;h++)i(h,8);for(h=0;8>h;h++)i(h+z-8,8),i(8,h);for(o=0;7>o;o++)i(8,o+z-7);for(h=0;z-14>h;h++)1&h?(i(8+h,6),i(6,8+h)):(R[8+h+6*z]=1,R[6+z*(8+h)]=1);if(y>6)for(f=M[y-7],d=17,h=0;6>h;h++)for(o=0;3>o;o++,d--)1&(d>11?y>>d-12:f>>d)?(R[5-h+z*(2-o+z-11)]=1,R[2-o+z-11+z*(5-h)]=1):(i(5-h,2-o+z-11),i(2-o+z-11,5-h));for(o=0;z>o;o++)for(h=0;o>=h;h++)R[h+z*o]&&i(h,o);for(g=W.length,b=0;g>b;b++)P[b]=W.charCodeAt(b);if(W=P.slice(0),h=s*(u+v)+v,g>=h-2&&(g=h-2,y>9&&g--),b=g,y>9){for(W[b+2]=0,W[b+3]=0;b--;)f=W[b],W[b+3]|=255&f<<4,W[b+2]=f>>4;W[2]|=255&g<<4,W[1]=g>>4,W[0]=64|g>>12}else{for(W[b+1]=0,W[b+2]=0;b--;)f=W[b],W[b+2]|=255&f<<4,W[b+1]=f>>4;W[1]|=255&g<<4,W[0]=64|g>>4}for(b=g+3-(10>y);h>b;)W[b++]=236,W[b++]=17;for(U[0]=1,b=0;t>b;b++){for(U[b+1]=1,c=b;c>0;c--)U[c]=U[c]?U[c-1]^G[k(H[U[c]]+b)]:U[c-1];U[0]=G[k(H[U[0]]+b)]}for(b=0;t>=b;b++)U[b]=H[U[b]];for(d=h,o=0,b=0;u>b;b++)l(o,s,d,t),o+=s,d+=t;for(b=0;v>b;b++)l(o,s+1,d,t),o+=s+1,d+=t;for(o=0,b=0;s>b;b++){for(c=0;u>c;c++)P[o++]=W[b+c*s];for(c=0;v>c;c++)P[o++]=W[u*s+b+c*(s+1)]}for(c=0;v>c;c++)P[o++]=W[u*s+b+c*(s+1)];for(b=0;t>b;b++)for(c=0;u+v>c;c++)P[o++]=W[h+b+c*t];for(W=P,h=o=z-1,d=g=1,e=(s+t)*(u+v)+v,b=0;e>b;b++)for(f=W[b],c=0;8>c;c++,f<<=1){128&f&&(R[h+z*o]=1);do g?h--:(h++,d?0!==o?o--:(h-=2,d=!d,6===h&&(h--,o=9)):o!==z-1?o++:(h-=2,d=!d,6===h&&(h--,o-=8))),g=!g;while(m(h,o))}for(W=R.slice(0),f=0,o=3e4,d=0;8>d&&(n(d),h=p(),o>h&&(o=h,f=d),7!==f);d++)R=W.slice(0);for(f!==d&&n(f),o=F[f+(Q-1<<3)],d=0;8>d;d++,o>>=1)1&o&&(R[z-1-d+8*z]=1,6>d?R[8+z*d]=1:R[8+z*(d+1)]=1);for(d=0;7>d;d++,o>>=1)1&o&&(R[8+z*(z-7+d)]=1,d?R[6-d+8*z]=1:R[7+8*z]=1);return R}var r,s,t,u,v,w,x,y,z,A=[0,11,15,19,23,27,31,16,18,20,22,24,26,28,20,22,24,24,26,28,28,22,24,24,26,26,28,28,24,24,26,26,26,28,28,24,26,26,26,28,28],B="image/png",C="image/octet-stream",D=[1,0,19,7,1,0,16,10,1,0,13,13,1,0,9,17,1,0,34,10,1,0,28,16,1,0,22,22,1,0,16,28,1,0,55,15,1,0,44,26,2,0,17,18,2,0,13,22,1,0,80,20,2,0,32,18,2,0,24,26,4,0,9,16,1,0,108,26,2,0,43,24,2,2,15,18,2,2,11,22,2,0,68,18,4,0,27,16,4,0,19,24,4,0,15,28,2,0,78,20,4,0,31,18,2,4,14,18,4,1,13,26,2,0,97,24,2,2,38,22,4,2,18,22,4,2,14,26,2,0,116,30,3,2,36,22,4,4,16,20,4,4,12,24,2,2,68,18,4,1,43,26,6,2,19,24,6,2,15,28,4,0,81,20,1,4,50,30,4,4,22,28,3,8,12,24,2,2,92,24,6,2,36,22,4,6,20,26,7,4,14,28,4,0,107,26,8,1,37,22,8,4,20,24,12,4,11,22,3,1,115,30,4,5,40,24,11,5,16,20,11,5,12,24,5,1,87,22,5,5,41,24,5,7,24,30,11,7,12,24,5,1,98,24,7,3,45,28,15,2,19,24,3,13,15,30,1,5,107,28,10,1,46,28,1,15,22,28,2,17,14,28,5,1,120,30,9,4,43,26,17,1,22,28,2,19,14,28,3,4,113,28,3,11,44,26,17,4,21,26,9,16,13,26,3,5,107,28,3,13,41,26,15,5,24,30,15,10,15,28,4,4,116,28,17,0,42,26,17,6,22,28,19,6,16,30,2,7,111,28,17,0,46,28,7,16,24,30,34,0,13,24,4,5,121,30,4,14,47,28,11,14,24,30,16,14,15,30,6,4,117,30,6,14,45,28,11,16,24,30,30,2,16,30,8,4,106,26,8,13,47,28,7,22,24,30,22,13,15,30,10,2,114,28,19,4,46,28,28,6,22,28,33,4,16,30,8,4,122,30,22,3,45,28,8,26,23,30,12,28,15,30,3,10,117,30,3,23,45,28,4,31,24,30,11,31,15,30,7,7,116,30,21,7,45,28,1,37,23,30,19,26,15,30,5,10,115,30,19,10,47,28,15,25,24,30,23,25,15,30,13,3,115,30,2,29,46,28,42,1,24,30,23,28,15,30,17,0,115,30,10,23,46,28,10,35,24,30,19,35,15,30,17,1,115,30,14,21,46,28,29,19,24,30,11,46,15,30,13,6,115,30,14,23,46,28,44,7,24,30,59,1,16,30,12,7,121,30,12,26,47,28,39,14,24,30,22,41,15,30,6,14,121,30,6,34,47,28,46,10,24,30,2,64,15,30,17,4,122,30,29,14,46,28,49,10,24,30,24,46,15,30,4,18,122,30,13,32,46,28,48,14,24,30,42,32,15,30,20,4,117,30,40,7,47,28,43,22,24,30,10,67,15,30,19,6,118,30,18,31,47,28,34,34,24,30,20,61,15,30],E={L:1,M:2,Q:3,H:4},F=[30660,29427,32170,30877,26159,25368,27713,26998,21522,20773,24188,23371,17913,16590,20375,19104,13663,12392,16177,14854,9396,8579,11994,11245,5769,5054,7399,6608,1890,597,3340,2107],G=[1,2,4,8,16,32,64,128,29,58,116,232,205,135,19,38,76,152,45,90,180,117,234,201,143,3,6,12,24,48,96,192,157,39,78,156,37,74,148,53,106,212,181,119,238,193,159,35,70,140,5,10,20,40,80,160,93,186,105,210,185,111,222,161,95,190,97,194,153,47,94,188,101,202,137,15,30,60,120,240,253,231,211,187,107,214,177,127,254,225,223,163,91,182,113,226,217,175,67,134,17,34,68,136,13,26,52,104,208,189,103,206,129,31,62,124,248,237,199,147,59,118,236,197,151,51,102,204,133,23,46,92,184,109,218,169,79,158,33,66,132,21,42,84,168,77,154,41,82,164,85,170,73,146,57,114,228,213,183,115,230,209,191,99,198,145,63,126,252,229,215,179,123,246,241,255,227,219,171,75,150,49,98,196,149,55,110,220,165,87,174,65,130,25,50,100,200,141,7,14,28,56,112,224,221,167,83,166,81,162,89,178,121,242,249,239,195,155,43,86,172,69,138,9,18,36,72,144,61,122,244,245,247,243,251,235,203,139,11,22,44,88,176,125,250,233,207,131,27,54,108,216,173,71,142,0],H=[255,0,1,25,2,50,26,198,3,223,51,238,27,104,199,75,4,100,224,14,52,141,239,129,28,193,105,248,200,8,76,113,5,138,101,47,225,36,15,33,53,147,142,218,240,18,130,69,29,181,194,125,106,39,249,185,201,154,9,120,77,228,114,166,6,191,139,98,102,221,48,253,226,152,37,179,16,145,34,136,54,208,148,206,143,150,219,189,241,210,19,92,131,56,70,64,30,66,182,163,195,72,126,110,107,58,40,84,250,133,186,61,202,94,155,159,10,21,121,43,78,212,229,172,115,243,167,87,7,112,192,247,140,128,99,13,103,74,222,237,49,197,254,24,227,165,153,119,38,184,180,124,17,68,146,217,35,32,137,46,55,63,209,91,149,188,207,205,144,135,151,178,220,252,190,97,242,86,211,171,20,42,93,158,132,60,57,83,71,109,65,162,31,45,67,216,183,123,164,118,196,23,73,236,127,12,111,246,108,161,59,82,41,157,85,170,251,96,134,177,187,204,62,90,203,89,95,176,156,169,160,81,11,245,22,235,122,117,44,215,79,174,213,233,230,231,173,232,116,214,244,234,168,80,88,175],I=3,J=3,K=40,L=10,M=[3220,1468,2713,1235,3062,1890,2119,1549,2344,2936,1117,2583,1330,2470,1667,2249,2028,3780,481,4011,142,3098,831,3445,592,2517,1776,2234,1951,2827,1070,2660,1345,3177],N=parseInt("0666",8),O=[],P=[],Q=1,R=[],S=[],T=!1,U=[],V=a.qr,W=[],X={VERSION:"1.1.3",canvas:function(a){a=e(a);var c=a.size>=1&&a.size<=10?a.size:4;c*=25;var d=a.canvas||b(),f=d.getContext("2d");f.canvas.width=c,f.canvas.height=c,f.fillStyle=a.background||"#fff",f.fillRect(0,0,c,c),Q=E[a.level&&a.level.toUpperCase()||"L"];var g=q(a.value||"");f.lineWidth=1;var h=c;h/=z,h=Math.floor(h),f.clearRect(0,0,c,c),f.fillStyle=a.background||"#fff",f.fillRect(0,0,h*(z+8),h*(z+8)),f.fillStyle=a.foreground||"#000";var i,j;for(i=0;z>i;i++)for(j=0;z>j;j++)g[j*z+i]&&f.fillRect(h*i,h*j,h,h);return d},image:function(a){a=e(a);var b=this.canvas(a),d=a.image||c();return d.src=b.toDataURL(a.mime||B),d.height=b.height,d.width=b.width,d},save:function(a,b,c){function f(a){h||(h=!0,c(a))}switch(a=e(a),typeof b){case"function":c=b,b=null;break;case"string":a.path=b}if("function"!=typeof c)throw new TypeError("Invalid callback type: "+typeof c);var h=!1,i=this.canvas(a);T?g(i,a,f):d(i,a,f)},saveSync:function(a,b){a=e(a),"string"==typeof b&&(a.path=b);var c=this.canvas(a);T?h(c,a):d(c,a)},toDataURL:function(a){return a=e(a),this.canvas(a).toDataURL(a.mime||B)},noConflict:function(){return a.qr=V,this}};"undefined"!=typeof exports?(T=!0,"undefined"!=typeof module&&module.exports&&(exports=module.exports=X),exports.qr=X,r=require("canvas"),x=r.Image,w=require("fs")):"function"==typeof define&&define.amd?define(function(){return X}):(a.HTMLCanvasElement||f(X),a.qr=X)}(this);
4.1 --- a/lib/qr.js.include Tue Aug 18 19:09:02 2015 +0300 4.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 4.3 @@ -1,4 +0,0 @@ 4.4 -/*! qr-js v1.1.3 | (c) 2014 Alasdair Mercer | GPL v3 License 4.5 -jsqrencode | (c) 2010 tz@execpc.com | GPL v3 License 4.6 -*/ 4.7 -!function(a){"use strict";function b(){return T?new r:a.document.createElement("canvas")}function c(){return T?new x:a.document.createElement("img")}function d(b,c,d){var e=c.mime||B;a.location.href=b.toDataURL(e).replace(e,C),"function"==typeof d&&d()}function e(a){return"string"==typeof a&&(a={value:a}),a||{}}function f(a){function b(b){a[b]=function(){throw new Error(b+" requires HTML5 canvas element support")}}var c,d=["canvas","image","save","saveSync","toDataURL"];for(c=0;c<d.length;c++)b(d[c])}function g(a,b,c){function d(){w.write(e,f,0,f.length,0,function(a){w.close(e),c(a)})}if("string"!=typeof b.path)return c(new TypeError("Invalid path type: "+typeof b.path));var e,f;a.toBuffer(function(a,b){return a?c(a):(f=b,void(e&&d()))}),w.open(b.path,"w",N,function(a,b){return a?c(a):(e=b,void(f&&d()))})}function h(a,b){if("string"!=typeof b.path)throw new TypeError("Invalid path type: "+typeof b.path);var c=a.toBuffer(),d=w.openSync(b.path,"w",N);try{w.writeSync(d,c,0,c.length,0)}finally{w.closeSync(d)}}function i(a,b){var c;a>b&&(c=a,a=b,b=c),c=b,c*=b,c+=b,c>>=1,c+=a,S[c]=1}function j(a,b){var c;for(R[a+z*b]=1,c=-2;2>c;c++)R[a+c+z*(b-2)]=1,R[a-2+z*(b+c+1)]=1,R[a+2+z*(b+c)]=1,R[a+c+1+z*(b+2)]=1;for(c=0;2>c;c++)i(a-1,b+c),i(a+1,b-c),i(a-c,b-1),i(a+c,b+1)}function k(a){for(;a>=255;)a-=255,a=(a>>8)+(255&a);return a}function l(a,b,c,d){var e,f,g;for(f=0;d>f;f++)W[c+f]=0;for(f=0;b>f;f++){if(e=H[W[a+f]^W[c]],255!==e)for(g=1;d>g;g++)W[c+g-1]=W[c+g]^G[k(e+U[d-g])];else for(g=c;c+d>g;g++)W[g]=W[g+1];W[c+d-1]=255===e?0:G[k(e+U[0])]}}function m(a,b){var c;return a>b&&(c=a,a=b,b=c),c=b,c+=b*b,c>>=1,c+=a,1===S[c]}function n(a){var b,c,d,e;switch(a){case 0:for(c=0;z>c;c++)for(b=0;z>b;b++)b+c&1||m(b,c)||(R[b+c*z]^=1);break;case 1:for(c=0;z>c;c++)for(b=0;z>b;b++)1&c||m(b,c)||(R[b+c*z]^=1);break;case 2:for(c=0;z>c;c++)for(d=0,b=0;z>b;b++,d++)3===d&&(d=0),d||m(b,c)||(R[b+c*z]^=1);break;case 3:for(e=0,c=0;z>c;c++,e++)for(3===e&&(e=0),d=e,b=0;z>b;b++,d++)3===d&&(d=0),d||m(b,c)||(R[b+c*z]^=1);break;case 4:for(c=0;z>c;c++)for(d=0,e=c>>1&1,b=0;z>b;b++,d++)3===d&&(d=0,e=!e),e||m(b,c)||(R[b+c*z]^=1);break;case 5:for(e=0,c=0;z>c;c++,e++)for(3===e&&(e=0),d=0,b=0;z>b;b++,d++)3===d&&(d=0),(b&c&1)+!(!d|!e)||m(b,c)||(R[b+c*z]^=1);break;case 6:for(e=0,c=0;z>c;c++,e++)for(3===e&&(e=0),d=0,b=0;z>b;b++,d++)3===d&&(d=0),(b&c&1)+(d&&d===e)&1||m(b,c)||(R[b+c*z]^=1);break;case 7:for(e=0,c=0;z>c;c++,e++)for(3===e&&(e=0),d=0,b=0;z>b;b++,d++)3===d&&(d=0),(d&&d===e)+(b+c&1)&1||m(b,c)||(R[b+c*z]^=1)}}function o(a){var b,c=0;for(b=0;a>=b;b++)O[b]>=5&&(c+=I+O[b]-5);for(b=3;a-1>b;b+=2)O[b-2]===O[b+2]&&O[b+2]===O[b-1]&&O[b-1]===O[b+1]&&3*O[b-1]===O[b]&&(0===O[b-3]||b+3>a||3*O[b-3]>=4*O[b]||3*O[b+3]>=4*O[b])&&(c+=K);return c}function p(){var a,b,c,d,e,f,g,h,i;for(c=e=f=0,i=0;z-1>i;i++)for(h=0;z-1>h;h++)(R[h+z*i]&&R[h+1+z*i]&&R[h+z*(i+1)]&&R[h+1+z*(i+1)]||!(R[h+z*i]||R[h+1+z*i]||R[h+z*(i+1)]||R[h+1+z*(i+1)]))&&(c+=J);for(i=0;z>i;i++){for(O[0]=0,g=a=h=0;z>h;h++)(b=R[h+z*i])===a?O[g]++:O[++g]=1,a=b,e+=a?1:-1;c+=o(g)}for(0>e&&(e=-e),d=e,d+=d<<2,d<<=1;d>z*z;)d-=z*z,f++;for(c+=f*L,h=0;z>h;h++){for(O[0]=0,g=a=i=0;z>i;i++)(b=R[h+z*i])===a?O[g]++:O[++g]=1,a=b;c+=o(g)}return c}function q(a){var b,c,d,e,f,g,h,o;f=a.length,y=0;do if(y++,d=4*(Q-1)+16*(y-1),u=D[d++],v=D[d++],s=D[d++],t=D[d],d=s*(u+v)+v-3+(9>=y),d>=f)break;while(40>y);for(z=17+4*y,g=s+(s+t)*(u+v)+v,f=0;g>f;f++)P[f]=0;for(W=a.slice(0),f=0;z*z>f;f++)R[f]=0;for(f=0;(z*(z+1)+1)/2>f;f++)S[f]=0;for(f=0;3>f;f++){for(d=o=0,1===f&&(d=z-7),2===f&&(o=z-7),R[o+3+z*(d+3)]=1,h=0;6>h;h++)R[o+h+z*d]=1,R[o+z*(d+h+1)]=1,R[o+6+z*(d+h)]=1,R[o+h+1+z*(d+6)]=1;for(h=1;5>h;h++)i(o+h,d+1),i(o+1,d+h+1),i(o+5,d+h),i(o+h+1,d+5);for(h=2;4>h;h++)R[o+h+z*(d+2)]=1,R[o+2+z*(d+h+1)]=1,R[o+4+z*(d+h)]=1,R[o+h+1+z*(d+4)]=1}if(y>1)for(f=A[y],o=z-7;;){for(h=z-7;h>f-3&&(j(h,o),!(f>h));)h-=f;if(f+9>=o)break;o-=f,j(6,o),j(o,6)}for(R[8+z*(z-8)]=1,o=0;7>o;o++)i(7,o),i(z-8,o),i(7,o+z-7);for(h=0;8>h;h++)i(h,7),i(h+z-8,7),i(h,z-8);for(h=0;9>h;h++)i(h,8);for(h=0;8>h;h++)i(h+z-8,8),i(8,h);for(o=0;7>o;o++)i(8,o+z-7);for(h=0;z-14>h;h++)1&h?(i(8+h,6),i(6,8+h)):(R[8+h+6*z]=1,R[6+z*(8+h)]=1);if(y>6)for(f=M[y-7],d=17,h=0;6>h;h++)for(o=0;3>o;o++,d--)1&(d>11?y>>d-12:f>>d)?(R[5-h+z*(2-o+z-11)]=1,R[2-o+z-11+z*(5-h)]=1):(i(5-h,2-o+z-11),i(2-o+z-11,5-h));for(o=0;z>o;o++)for(h=0;o>=h;h++)R[h+z*o]&&i(h,o);for(g=W.length,b=0;g>b;b++)P[b]=W.charCodeAt(b);if(W=P.slice(0),h=s*(u+v)+v,g>=h-2&&(g=h-2,y>9&&g--),b=g,y>9){for(W[b+2]=0,W[b+3]=0;b--;)f=W[b],W[b+3]|=255&f<<4,W[b+2]=f>>4;W[2]|=255&g<<4,W[1]=g>>4,W[0]=64|g>>12}else{for(W[b+1]=0,W[b+2]=0;b--;)f=W[b],W[b+2]|=255&f<<4,W[b+1]=f>>4;W[1]|=255&g<<4,W[0]=64|g>>4}for(b=g+3-(10>y);h>b;)W[b++]=236,W[b++]=17;for(U[0]=1,b=0;t>b;b++){for(U[b+1]=1,c=b;c>0;c--)U[c]=U[c]?U[c-1]^G[k(H[U[c]]+b)]:U[c-1];U[0]=G[k(H[U[0]]+b)]}for(b=0;t>=b;b++)U[b]=H[U[b]];for(d=h,o=0,b=0;u>b;b++)l(o,s,d,t),o+=s,d+=t;for(b=0;v>b;b++)l(o,s+1,d,t),o+=s+1,d+=t;for(o=0,b=0;s>b;b++){for(c=0;u>c;c++)P[o++]=W[b+c*s];for(c=0;v>c;c++)P[o++]=W[u*s+b+c*(s+1)]}for(c=0;v>c;c++)P[o++]=W[u*s+b+c*(s+1)];for(b=0;t>b;b++)for(c=0;u+v>c;c++)P[o++]=W[h+b+c*t];for(W=P,h=o=z-1,d=g=1,e=(s+t)*(u+v)+v,b=0;e>b;b++)for(f=W[b],c=0;8>c;c++,f<<=1){128&f&&(R[h+z*o]=1);do g?h--:(h++,d?0!==o?o--:(h-=2,d=!d,6===h&&(h--,o=9)):o!==z-1?o++:(h-=2,d=!d,6===h&&(h--,o-=8))),g=!g;while(m(h,o))}for(W=R.slice(0),f=0,o=3e4,d=0;8>d&&(n(d),h=p(),o>h&&(o=h,f=d),7!==f);d++)R=W.slice(0);for(f!==d&&n(f),o=F[f+(Q-1<<3)],d=0;8>d;d++,o>>=1)1&o&&(R[z-1-d+8*z]=1,6>d?R[8+z*d]=1:R[8+z*(d+1)]=1);for(d=0;7>d;d++,o>>=1)1&o&&(R[8+z*(z-7+d)]=1,d?R[6-d+8*z]=1:R[7+8*z]=1);return R}var r,s,t,u,v,w,x,y,z,A=[0,11,15,19,23,27,31,16,18,20,22,24,26,28,20,22,24,24,26,28,28,22,24,24,26,26,28,28,24,24,26,26,26,28,28,24,26,26,26,28,28],B="image/png",C="image/octet-stream",D=[1,0,19,7,1,0,16,10,1,0,13,13,1,0,9,17,1,0,34,10,1,0,28,16,1,0,22,22,1,0,16,28,1,0,55,15,1,0,44,26,2,0,17,18,2,0,13,22,1,0,80,20,2,0,32,18,2,0,24,26,4,0,9,16,1,0,108,26,2,0,43,24,2,2,15,18,2,2,11,22,2,0,68,18,4,0,27,16,4,0,19,24,4,0,15,28,2,0,78,20,4,0,31,18,2,4,14,18,4,1,13,26,2,0,97,24,2,2,38,22,4,2,18,22,4,2,14,26,2,0,116,30,3,2,36,22,4,4,16,20,4,4,12,24,2,2,68,18,4,1,43,26,6,2,19,24,6,2,15,28,4,0,81,20,1,4,50,30,4,4,22,28,3,8,12,24,2,2,92,24,6,2,36,22,4,6,20,26,7,4,14,28,4,0,107,26,8,1,37,22,8,4,20,24,12,4,11,22,3,1,115,30,4,5,40,24,11,5,16,20,11,5,12,24,5,1,87,22,5,5,41,24,5,7,24,30,11,7,12,24,5,1,98,24,7,3,45,28,15,2,19,24,3,13,15,30,1,5,107,28,10,1,46,28,1,15,22,28,2,17,14,28,5,1,120,30,9,4,43,26,17,1,22,28,2,19,14,28,3,4,113,28,3,11,44,26,17,4,21,26,9,16,13,26,3,5,107,28,3,13,41,26,15,5,24,30,15,10,15,28,4,4,116,28,17,0,42,26,17,6,22,28,19,6,16,30,2,7,111,28,17,0,46,28,7,16,24,30,34,0,13,24,4,5,121,30,4,14,47,28,11,14,24,30,16,14,15,30,6,4,117,30,6,14,45,28,11,16,24,30,30,2,16,30,8,4,106,26,8,13,47,28,7,22,24,30,22,13,15,30,10,2,114,28,19,4,46,28,28,6,22,28,33,4,16,30,8,4,122,30,22,3,45,28,8,26,23,30,12,28,15,30,3,10,117,30,3,23,45,28,4,31,24,30,11,31,15,30,7,7,116,30,21,7,45,28,1,37,23,30,19,26,15,30,5,10,115,30,19,10,47,28,15,25,24,30,23,25,15,30,13,3,115,30,2,29,46,28,42,1,24,30,23,28,15,30,17,0,115,30,10,23,46,28,10,35,24,30,19,35,15,30,17,1,115,30,14,21,46,28,29,19,24,30,11,46,15,30,13,6,115,30,14,23,46,28,44,7,24,30,59,1,16,30,12,7,121,30,12,26,47,28,39,14,24,30,22,41,15,30,6,14,121,30,6,34,47,28,46,10,24,30,2,64,15,30,17,4,122,30,29,14,46,28,49,10,24,30,24,46,15,30,4,18,122,30,13,32,46,28,48,14,24,30,42,32,15,30,20,4,117,30,40,7,47,28,43,22,24,30,10,67,15,30,19,6,118,30,18,31,47,28,34,34,24,30,20,61,15,30],E={L:1,M:2,Q:3,H:4},F=[30660,29427,32170,30877,26159,25368,27713,26998,21522,20773,24188,23371,17913,16590,20375,19104,13663,12392,16177,14854,9396,8579,11994,11245,5769,5054,7399,6608,1890,597,3340,2107],G=[1,2,4,8,16,32,64,128,29,58,116,232,205,135,19,38,76,152,45,90,180,117,234,201,143,3,6,12,24,48,96,192,157,39,78,156,37,74,148,53,106,212,181,119,238,193,159,35,70,140,5,10,20,40,80,160,93,186,105,210,185,111,222,161,95,190,97,194,153,47,94,188,101,202,137,15,30,60,120,240,253,231,211,187,107,214,177,127,254,225,223,163,91,182,113,226,217,175,67,134,17,34,68,136,13,26,52,104,208,189,103,206,129,31,62,124,248,237,199,147,59,118,236,197,151,51,102,204,133,23,46,92,184,109,218,169,79,158,33,66,132,21,42,84,168,77,154,41,82,164,85,170,73,146,57,114,228,213,183,115,230,209,191,99,198,145,63,126,252,229,215,179,123,246,241,255,227,219,171,75,150,49,98,196,149,55,110,220,165,87,174,65,130,25,50,100,200,141,7,14,28,56,112,224,221,167,83,166,81,162,89,178,121,242,249,239,195,155,43,86,172,69,138,9,18,36,72,144,61,122,244,245,247,243,251,235,203,139,11,22,44,88,176,125,250,233,207,131,27,54,108,216,173,71,142,0],H=[255,0,1,25,2,50,26,198,3,223,51,238,27,104,199,75,4,100,224,14,52,141,239,129,28,193,105,248,200,8,76,113,5,138,101,47,225,36,15,33,53,147,142,218,240,18,130,69,29,181,194,125,106,39,249,185,201,154,9,120,77,228,114,166,6,191,139,98,102,221,48,253,226,152,37,179,16,145,34,136,54,208,148,206,143,150,219,189,241,210,19,92,131,56,70,64,30,66,182,163,195,72,126,110,107,58,40,84,250,133,186,61,202,94,155,159,10,21,121,43,78,212,229,172,115,243,167,87,7,112,192,247,140,128,99,13,103,74,222,237,49,197,254,24,227,165,153,119,38,184,180,124,17,68,146,217,35,32,137,46,55,63,209,91,149,188,207,205,144,135,151,178,220,252,190,97,242,86,211,171,20,42,93,158,132,60,57,83,71,109,65,162,31,45,67,216,183,123,164,118,196,23,73,236,127,12,111,246,108,161,59,82,41,157,85,170,251,96,134,177,187,204,62,90,203,89,95,176,156,169,160,81,11,245,22,235,122,117,44,215,79,174,213,233,230,231,173,232,116,214,244,234,168,80,88,175],I=3,J=3,K=40,L=10,M=[3220,1468,2713,1235,3062,1890,2119,1549,2344,2936,1117,2583,1330,2470,1667,2249,2028,3780,481,4011,142,3098,831,3445,592,2517,1776,2234,1951,2827,1070,2660,1345,3177],N=parseInt("0666",8),O=[],P=[],Q=1,R=[],S=[],T=!1,U=[],V=a.qr,W=[],X={VERSION:"1.1.3",canvas:function(a){a=e(a);var c=a.size>=1&&a.size<=10?a.size:4;c*=25;var d=a.canvas||b(),f=d.getContext("2d");f.canvas.width=c,f.canvas.height=c,f.fillStyle=a.background||"#fff",f.fillRect(0,0,c,c),Q=E[a.level&&a.level.toUpperCase()||"L"];var g=q(a.value||"");f.lineWidth=1;var h=c;h/=z,h=Math.floor(h),f.clearRect(0,0,c,c),f.fillStyle=a.background||"#fff",f.fillRect(0,0,h*(z+8),h*(z+8)),f.fillStyle=a.foreground||"#000";var i,j;for(i=0;z>i;i++)for(j=0;z>j;j++)g[j*z+i]&&f.fillRect(h*i,h*j,h,h);return d},image:function(a){a=e(a);var b=this.canvas(a),d=a.image||c();return d.src=b.toDataURL(a.mime||B),d.height=b.height,d.width=b.width,d},save:function(a,b,c){function f(a){h||(h=!0,c(a))}switch(a=e(a),typeof b){case"function":c=b,b=null;break;case"string":a.path=b}if("function"!=typeof c)throw new TypeError("Invalid callback type: "+typeof c);var h=!1,i=this.canvas(a);T?g(i,a,f):d(i,a,f)},saveSync:function(a,b){a=e(a),"string"==typeof b&&(a.path=b);var c=this.canvas(a);T?h(c,a):d(c,a)},toDataURL:function(a){return a=e(a),this.canvas(a).toDataURL(a.mime||B)},noConflict:function(){return a.qr=V,this}};"undefined"!=typeof exports?(T=!0,"undefined"!=typeof module&&module.exports&&(exports=module.exports=X),exports.qr=X,r=require("canvas"),x=r.Image,w=require("fs")):"function"==typeof define&&define.amd?define(function(){return X}):(a.HTMLCanvasElement||f(X),a.qr=X)}(this);
5.1 --- a/lib/tazpanel.js Tue Aug 18 19:09:02 2015 +0300 5.2 +++ b/lib/tazpanel.js Thu Aug 20 17:00:19 2015 +0300 5.3 @@ -122,10 +122,10 @@ 5.4 5.5 // 5.6 function dupTableHead() { 5.7 - if (! document.getElementById('head2')) return 5.8 + if (! document.getElementById('head2')) return; 5.9 var tableHead = document.createElement("TABLE"); 5.10 with (tableHead) { 5.11 - innerHTML = '<thead>' + document.getElementById('head2').innerHTML + '</thead>' 5.12 + innerHTML = '<thead>' + document.getElementById('head2').innerHTML + '</thead>'; 5.13 setAttribute("id", "head1h"); 5.14 setAttribute("class", "zebra pkglist"); 5.15 } 5.16 @@ -280,7 +280,7 @@ 5.17 if (thisMenu.className == 'opened') { 5.18 thisMenu.className = 'closed'; 5.19 el.blur(); 5.20 - itemOpened = '' 5.21 + itemOpened = ''; 5.22 //console.log('Closed %s', el.tabIndex); 5.23 } 5.24 } 5.25 @@ -326,7 +326,8 @@ 5.26 } 5.27 } 5.28 function menuItemBlur(el) { 5.29 - elem = el; //.parentElement; 5.30 + elem = el; 5.31 + //.parentElement; 5.32 //console.log('Blurred %s', elem.tabIndex); 5.33 //closeItem(elem); 5.34 //menuIsClosed = true; 5.35 @@ -346,7 +347,7 @@ 5.36 5.37 function ajax(cgiUrl, command, ajaxOut) { 5.38 // (0) show AJAX loader 5.39 - ajaxLoader++ 5.40 + ajaxLoader++; 5.41 5.42 // (1) create object for server request 5.43 var req = new XMLHttpRequest(); 5.44 @@ -359,19 +360,20 @@ 5.45 5.46 if (req.readyState == XMLHttpRequest.DONE) { 5.47 // if request done 5.48 - ajaxLoader-- 5.49 + ajaxLoader--; 5.50 if (ajaxLoader == 0) { 5.51 5.52 - statusbar('') 5.53 + statusbar(''); 5.54 5.55 if (req.statusText == 'OK') { 5.56 - statusElem.innerHTML = '<span data-img="ok"></span>' 5.57 + statusElem.innerHTML = '<span data-img="ok"></span>'; 5.58 } else { 5.59 + // show status (Not Found, ...) 5.60 statusElem.innerHTML = '<span data-img="delete">' + 5.61 - req.statusText + '</span>' // show status (Not Found, ...) 5.62 + req.statusText + '</span>'; 5.63 } 5.64 } else { 5.65 - statusElem.innerHTML = '<span data-img="clock"></span>' 5.66 + statusElem.innerHTML = '<span data-img="clock"></span>'; 5.67 } 5.68 5.69 // if status 200 (ОК) - show answer to user 5.70 @@ -385,10 +387,11 @@ 5.71 req.open('POST', cgiUrl, true); 5.72 5.73 // (4) request object is ready 5.74 - req.send(command); // send request 5.75 + // send request 5.76 + req.send(command); 5.77 5.78 // (5) 5.79 - statusElem.innerHTML = '<span data-img="clock"></span>' 5.80 + statusElem.innerHTML = '<span data-img="clock"></span>'; 5.81 } 5.82 5.83 5.84 @@ -573,9 +576,9 @@ 5.85 5.86 5.87 5.88 -/** 5.89 - * Class manipulation from http://www.openjs.com/scripts/dom/class_manipulation.php 5.90 - */ 5.91 +// 5.92 +// Class manipulation from http://www.openjs.com/scripts/dom/class_manipulation.php 5.93 +// 5.94 5.95 function hasClass(ele,cls) { 5.96 return document.getElementById(ele).className.match(new RegExp('(\\s|^)' + cls + '(\\s|$)')); 5.97 @@ -638,9 +641,9 @@ 5.98 5.99 5.100 5.101 -/** 5.102 - * Show/hide popups 5.103 - */ 5.104 +// 5.105 +// Show/hide popups 5.106 +// 5.107 5.108 function popup(name, action) { 5.109 if (action == 'show') {
6.1 --- a/network.cgi Tue Aug 18 19:09:02 2015 +0300 6.2 +++ b/network.cgi Thu Aug 20 17:00:19 2015 +0300 6.3 @@ -431,59 +431,6 @@ 6.4 # Wireless connections settings 6.5 xhtml_header "$(_ 'Wireless connection')" 6.6 6.7 - cat <<EOT 6.8 -<style type="text/css"> 6.9 -#connection input[type="text"], #connection input[type="password"] { width: 14rem; } 6.10 -#connection select { width: 14.4rem; } 6.11 - 6.12 -#connection td { padding: 0; margin: 0; } 6.13 -#connection [class] div { 6.14 - max-height: 0; overflow: hidden; padding: 0; margin: 0; 6.15 - -webkit-transition: all 0.5s ease-in-out; 6.16 - -moz-transition: all 0.5s ease-in-out; 6.17 - transition: all 0.5s ease-in-out; 6.18 -} 6.19 -.wep .wep div, .wpa .wpa div, .eap .eap div, 6.20 -.eap.peap .eap1 div, .eap.tls .eap1 div, .eap.ttls .eap1 div { 6.21 - max-height: 2em !important; 6.22 -} 6.23 - 6.24 -#shader { 6.25 - z-index: 100; 6.26 - position: fixed; top: 0; left: 0; width: 100%; height: 100%; 6.27 - background-color: #000; 6.28 - opacity: 0.6; 6.29 -} 6.30 -#shader.hidden { 6.31 - display: none; 6.32 - opacity: 0; 6.33 -} 6.34 - 6.35 -#popup_qr { 6.36 - z-index: 101; 6.37 - position: fixed; 6.38 - width: 100%; 6.39 - bottom: 2em; 6.40 - transition: all 0.5s; 6.41 - -webkit-transition: all 0.5s; 6.42 - -webkit-transition-delay: 0.3s; 6.43 -} 6.44 -#popup_qr_inner { 6.45 - display: inline-block; 6.46 - text-align: center; 6.47 - margin: 0.5em; 6.48 - background: #fff; color: #222; 6.49 - border: 0.16em solid ; border-radius: 0.5em; 6.50 - 6.51 - padding: 0.5em; 6.52 -} 6.53 -#popup_qr.hidden {bottom: -100em; } 6.54 - 6.55 -#qrimg { margin: 3em 1.5em 2em 3em; } 6.56 -</style> 6.57 -EOT 6.58 - 6.59 - 6.60 . /etc/network.conf 6.61 6.62 start_disabled=''; stop_disabled='' 6.63 @@ -615,8 +562,6 @@ 6.64 6.65 document.getElementById('keyType').value = "$WIFI_KEY_TYPE"; wifiSettingsChange(); 6.66 6.67 -$(cat $PANEL/lib/qr.js.include) 6.68 - 6.69 function shareWiFi() { 6.70 // S=<SSID>; T={WPA|WEP|nopass}; P=<password>; H=<hidden?> 6.71 // Escape ":" and ";" -> "\:" and "\;" 6.72 @@ -642,7 +587,7 @@ 6.73 <tr> 6.74 <td style="text-align: center;"> 6.75 <div id="popup_qr_inner"> 6.76 - <img id="qrimg" src="#" /><br/> 6.77 + <img id="qrimg"/><br/> 6.78 $(_ 'Share Wi-Fi network with your friends') 6.79 </div> 6.80 </td> 6.81 @@ -722,15 +667,8 @@ 6.82 6.83 6.84 <section> 6.85 - <header id="hosts"> 6.86 - $(_ 'Hosts') 6.87 -EOT 6.88 - edit_button /etc/hosts 6.89 - cat <<EOT 6.90 - </header> 6.91 - <footer> 6.92 - <pre>$(getdb hosts)</pre> 6.93 - </footer> 6.94 + <header id="hosts">$(_ 'Hosts'; edit_button /etc/hosts)</header> 6.95 + <pre class="scroll">$(getdb hosts)</pre> 6.96 </section> 6.97 6.98 6.99 @@ -756,30 +694,24 @@ 6.100 6.101 <section> 6.102 <header id="ifconfig">$(_ 'Output of ifconfig')</header> 6.103 - <footer><pre>$(ifconfig)</pre></footer> 6.104 + <pre>$(ifconfig)</pre> 6.105 </section> 6.106 6.107 6.108 <section> 6.109 <header id="routing">$(_ 'Routing table')</header> 6.110 - <footer><pre>$(route -n)</pre></footer> 6.111 + <pre>$(route -n)</pre> 6.112 </section> 6.113 6.114 6.115 <section> 6.116 - <header id="dns"> 6.117 - $(_ 'Domain name resolution') 6.118 -EOT 6.119 - edit_button /etc/resolv.conf 6.120 - cat <<EOT 6.121 - </header> 6.122 - <footer><pre>$(cat /etc/resolv.conf)</pre></footer> 6.123 + <header id="dns">$(_ 'Domain name resolution'; edit_button /etc/resolv.conf)</header> 6.124 + <pre>$(cat /etc/resolv.conf)</pre> 6.125 </section> 6.126 6.127 6.128 <section> 6.129 <header id="arp">$(_ 'ARP table')</header> 6.130 - <footer> 6.131 EOT 6.132 if [ "$REMOTE_USER" == "root" ]; then 6.133 echo "<table>" 6.134 @@ -795,7 +727,8 @@ 6.135 EOT 6.136 done 6.137 cat <<EOT 6.138 - </table> 6.139 + </table> 6.140 + <footer> 6.141 <form> 6.142 IP <input type="text" name="ip" value="10.20.30.40" size="12" /> on $(select_if)<!-- 6.143 --><button type="submit" data-icon="upgrade" name="proxyarp">$(_ 'Proxy')</button> 6.144 @@ -813,10 +746,8 @@ 6.145 6.146 <section> 6.147 <header id="connections">$(_ 'IP Connections')</header> 6.148 - <footer> 6.149 <pre>$(netstat -anp 2>/dev/null | sed -e '/UNIX domain sockets/,$d' \ 6.150 -e 's#\([0-9]*\)/#<a href="boot.cgi?daemons=pid=\1">\1</a>/#')</pre> 6.151 - </footer> 6.152 </section> 6.153 6.154 EOT 6.155 @@ -825,9 +756,7 @@ 6.156 <header id="iptables">$(_ 'Firewall') 6.157 $(edit_button /etc/knockd.conf "$(_ 'Port knocker')") 6.158 </header> 6.159 - <footer> 6.160 <pre>$(iptables-save)</pre> 6.161 - </footer> 6.162 </section> 6.163 EOT 6.164
7.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 7.2 +++ b/stripall.sh Thu Aug 20 17:00:19 2015 +0300 7.3 @@ -0,0 +1,100 @@ 7.4 +#!/bin/sh 7.5 +# TazPanel - SliTaz Control Panel, hg.slitaz.org/tazpanel 7.6 +# stripall.sh - strip and compact resources in build process 7.7 +# Copyright (C) 2015 SliTaz GNU/Linux - BSD License 7.8 + 7.9 + 7.10 +substitute_icons() { 7.11 + grep -q 'data-icon="\|data-img"' $1 || return 7.12 + 7.13 + echo -e "\ 7.14 + add \n admin \n back \n battery 7.15 + brightness \n cancel \n cd \n check 7.16 + clock \n conf \n daemons \n delete 7.17 + detect \n diff \n download \n edit 7.18 + eth \n group \n grub \n hdd 7.19 + help \n history \n info \n install 7.20 + link \n list \n locale \n lock 7.21 + logs \n loopback \n modules \n ok 7.22 + proc \n refresh \n removable \n remove 7.23 + repack \n report \n restart \n run 7.24 + save \n scan \n settings \n start 7.25 + stop \n sync \n tag \n tags 7.26 + tazx \n temperature \n terminal \n text 7.27 + unlink \n unlock \n upgrade \n user 7.28 + view \n wifi \n man \n off 7.29 + on \n opt \n web \n slitaz 7.30 + lvl0 \n lvl1 \n lvl2 \n lvl3 7.31 + lvl4 \n lvl5 \n online \n offline 7.32 + sechi \n secmi \n seclo \n pkg 7.33 + pkgi \n pkgib \n toggle \n chlock 7.34 + calendar \n modem \n cpu \n display 7.35 + msg \n msgerr \n msgwarn \n msgup 7.36 + msgtip \n vpn " | \ 7.37 + while read icon symbol; do 7.38 + echo -n "." 7.39 + sed -i "s|data-icon=\"$icon\"|data-icon=\"$symbol\"|g" $1 7.40 + sed -i "s|data-img=\"$icon\"|data-img=\"$symbol\"|g" $1 7.41 + done 7.42 +} 7.43 + 7.44 + 7.45 +cd build 7.46 + 7.47 +echo -e "\nStrip shell scripts" 7.48 +for CGI in *.cgi tazpanel libtazpanel bootloader *.html; do 7.49 + echo -en "\nProcessing $CGI" 7.50 + 7.51 + mv $CGI $CGI.old 7.52 + # Copy initial comment (down to empty line) 7.53 + sed '1,/^$/!d' $CGI.old > $CGI 7.54 + # Remove initial tabs, other comments and empty lines 7.55 + sed 's|^[\t ]*||;/^#/d;/^$/d' $CGI.old >> $CGI 7.56 + rm $CGI.old 7.57 + 7.58 + substitute_icons $CGI 7.59 + 7.60 + sed -i 's|" *>|">|g' $CGI 7.61 + sed -i "s|' *)|')|g" $CGI 7.62 + sed -i 's| *;;|;;|g' $CGI 7.63 + 7.64 + chmod a+x $CGI 7.65 + 7.66 +done 7.67 + 7.68 + 7.69 +echo -e "\n\nStrip CSS stylesheets" 7.70 +for CSS in *.css; do 7.71 + echo -en "\nProcessing $CSS" 7.72 + 7.73 + mv $CSS $CSS.old 7.74 + tr '\n' ' ' < $CSS.old > $CSS 7.75 + rm $CSS.old 7.76 + 7.77 + substitute_icons $CSS 7.78 + 7.79 + sed -i 's|\t| |g; s| *| |g; s|/\*|‹|g; s|\*/|›|g; s|‹[^›][^›]*›||g; s| *| |g; s|^ ||; s| {|{|g; s|{ |{|g; s| *: *|:|g; s| *; *|;|g; s|;}|}|g; s|} |}|g; s| *> *|>|g; s| *, *|,|g; s|000000|000|g; s|CC0000|C00|g; s|00FFFF|0FF|g' $CSS 7.80 +done 7.81 + 7.82 +mkdir gz 7.83 +cat *.css > gz/tazpanel.css 7.84 +gzip -9 gz/tazpanel.css 7.85 + 7.86 + 7.87 +echo -e "\n\nStrip JS scripts" 7.88 +for JS in *.js; do 7.89 + echo -en "\nProcessing $JS" 7.90 + 7.91 + sed -i 's|^[\t ]*||; /^$/d; /^\/\//d; /console\./d' $JS 7.92 + 7.93 + # Try "jsmin" 7.94 + if [ -n "$(which jsmin)" ]; then 7.95 + jsmin < $JS > $JS.new 7.96 + mv -f $JS.new $JS 7.97 + fi 7.98 +done 7.99 + 7.100 +cat *.js > gz/tazpanel.js 7.101 +gzip -9 gz/tazpanel.js 7.102 + 7.103 +echo
8.1 --- a/styles/default/base.css Tue Aug 18 19:09:02 2015 +0300 8.2 +++ b/styles/default/base.css Thu Aug 20 17:00:19 2015 +0300 8.3 @@ -780,3 +780,57 @@ 8.4 #fileContent.bigScrollable { margin: 0.2rem; top: 2.5rem; } 8.5 8.6 section section { margin: 0.2rem; } 8.7 + 8.8 + 8.9 +/* Styles for network.cgi: Wi-Fi sub-page */ 8.10 + 8.11 +#connection input[type="text"], #connection input[type="password"] { width: 14rem; } 8.12 +#connection select { width: 14.4rem; } 8.13 + 8.14 +#connection td { padding: 0; margin: 0; } 8.15 +#connection [class] div { 8.16 + max-height: 0; overflow: hidden; padding: 0; margin: 0; 8.17 + -webkit-transition: all 0.5s ease-in-out; 8.18 + -moz-transition: all 0.5s ease-in-out; 8.19 + transition: all 0.5s ease-in-out; 8.20 +} 8.21 +.wep .wep div, .wpa .wpa div, .eap .eap div, 8.22 +.eap.peap .eap1 div, .eap.tls .eap1 div, .eap.ttls .eap1 div { 8.23 + max-height: 2em !important; 8.24 +} 8.25 + 8.26 +#shader { 8.27 + z-index: 100; 8.28 + position: fixed; top: 0; left: 0; width: 100%; height: 100%; 8.29 + background-color: #000; 8.30 + opacity: 0.6; 8.31 +} 8.32 +#shader.hidden { 8.33 + display: none; 8.34 + opacity: 0; 8.35 +} 8.36 + 8.37 +#popup_qr { 8.38 + z-index: 101; 8.39 + position: fixed; 8.40 + width: 100%; 8.41 + bottom: 2em; 8.42 + transition: all 0.5s; 8.43 + -webkit-transition: all 0.5s; 8.44 + -webkit-transition-delay: 0.3s; 8.45 +} 8.46 +#popup_qr_inner { 8.47 + display: inline-block; 8.48 + text-align: center; 8.49 + margin: 0.5em; 8.50 + background: #fff; color: #222; 8.51 + border: 0.16em solid ; border-radius: 0.5em; 8.52 + 8.53 + padding: 0.5em; 8.54 +} 8.55 +#popup_qr.hidden {bottom: -30em; } 8.56 + 8.57 +#qrimg { margin: 3em 1.5em 2em 3em; } 8.58 + 8.59 +/* END: Styles for network.cgi: Wi-Fi sub-page */ 8.60 +
9.1 --- a/styles/default/footer.html Tue Aug 18 19:09:02 2015 +0300 9.2 +++ b/styles/default/footer.html Thu Aug 20 17:00:19 2015 +0300 9.3 @@ -1,3 +1,5 @@ 9.4 +# Footer of TazPanel html page 9.5 + 9.6 export TEXTDOMAIN='tazpanel' 9.7 cat <<EOT 9.8 <!-- End of content-->
10.1 --- a/styles/default/header.html Tue Aug 18 19:09:02 2015 +0300 10.2 +++ b/styles/default/header.html Thu Aug 20 17:00:19 2015 +0300 10.3 @@ -1,3 +1,5 @@ 10.4 +# Header of TazPanel html page 10.5 + 10.6 rootclass='user'; [ $(id -u) == '0' ] && rootclass='root' 10.7 TEXTDOMAIN_original="${TEXTDOMAIN:-tazpanel}" 10.8 export TEXTDOMAIN='tazpanel' 10.9 @@ -25,8 +27,8 @@ 10.10 <title>TazPanel</title> 10.11 <link rel="shortcut icon" href="/styles/$STYLE/favicon.ico"/> 10.12 <meta name="viewport" content="width=device-width,initial-scale=1"/> 10.13 -$(printf '\t<link rel="stylesheet" type="text/css" href="/%s"/>\n' $(cd /var/www/tazpanel; ls styles/$STYLE/*.css)) 10.14 -$(printf '\t<script type="text/javascript" src="/%s"></script>\n' $(cd /var/www/tazpanel; ls lib/*.js)) 10.15 +$(printf '\t<link rel="stylesheet" type="text/css" href="/%s"/>\n' $(cd /var/www/tazpanel; ls styles/$STYLE/*.css* | sed 's|.gz||')) 10.16 +$(printf '\t<script type="text/javascript" src="/%s"></script>\n' $(cd /var/www/tazpanel; ls lib/*.js* | sed 's|.gz||')) 10.17 </head> 10.18 <body class="$rootclass"> 10.19 <script type="text/javascript">setColorTheme(); setBaseFont();</script> 10.20 @@ -115,14 +117,14 @@ 10.21 10.22 username="${REMOTE_USER:-root}" 10.23 case "$username" in 10.24 - root) icon='slitaz'; warn='' 10.25 + root) icon='data-img="slitaz"'; warn='' 10.26 toggle_url="http://$HTTP_HOST/";; 10.27 - *) icon='user'; warn="$(_ 'Some features are disabled.')"$'\n' 10.28 - toggle_url="http://$RANDOM:*@$HTTP_HOST/user/";; 10.29 + *) icon='data-img="user"'; warn="$(_ 'Some features are disabled.')"$'\n' 10.30 + toggle_url="http://$HTTP_HOST/user/";; 10.31 esac 10.32 10.33 cat <<EOT 10.34 - <a data-img="$icon" title="$(_ 'You are logged in to the TazPanel as user %s.' $username) 10.35 + <a $icon title="$(_ 'You are logged in to the TazPanel as user %s.' $username) 10.36 $warn$(_ 'Click to re-login.')" href="$toggle_url$(basename $REQUEST_URI)"></a> 10.37 <a data-img="help" href="help.cgi"></a> 10.38 </span>
11.1 --- a/tazpanel Tue Aug 18 19:09:02 2015 +0300 11.2 +++ b/tazpanel Thu Aug 20 17:00:19 2015 +0300 11.3 @@ -4,7 +4,8 @@ 11.4 # 11.5 # Copyright (C) 2012-2015 SliTaz GNU/Linux - BSD License 11.6 # 11.7 -VERSION=1.8.2 11.8 + 11.9 +VERSION=522 11.10 11.11 11.12 # Get the configuration file and functions