echo "Run $0"
-if which minify > /dev/null; then
- MINIFY=""
- [ -z "$MINIFY" ] && minify --help 2>&1 | grep -q '\-\-css ' && MINIFY="ext"
- [ -z "$MINIFY" ] && minify --help 2>&1 | grep -q '\-\-output ' && MINIFY="out"
- [ -z "$MINIFY" ] || git diff --name-only | while read file; do
- ext=""
- case "$file" in
- *.min.*) continue ;;
- *.css) ext=css ;;
- *.js) ext=js ;;
- *) continue;
- esac
- min="$(echo "$file" | sed -E 's/\.([^\.]+)$/.min.\1/')"
- [ -w "$min" ] || continue
-
- echo " Minify $file"
-
- if [ "$MINIFY" = "ext" ]; then
- #echo "minify --$ext < "$file" > "$min.tmp""
- minify --$ext < "$file" > "$min.tmp"
- elif [ "$MINIFY" = "out" ]; then
- #echo "minify "$file" --output "$min.tmp""
- minify "$file" --output "$min.tmp" > /dev/null
- fi
-
- if [ "$?" = "0" ]; then
- echo "cat "$min.tmp" > "$min""
- cat "$min.tmp" > "$min"
- else
- echo "minify FAILED!"
- fi
-
- rm "$min.tmp"
-
- done
-fi
+which minify > /dev/null || exit
+MINIFY=""
+[ -z "$MINIFY" ] && minify --help 2>&1 | grep -q '\-\-css ' && MINIFY="ext"
+[ -z "$MINIFY" ] && minify --help 2>&1 | grep -q '\-\-output ' && MINIFY="out"
+[ -z "$MINIFY" ] || git diff --name-only | while read file; do
+ ext=""
+ case "$file" in
+ *.min.*) continue ;;
+ *.css) ext=css ;;
+ *.js) ext=js ;;
+ *) continue;
+ esac
+ min="$(echo "$file" | sed -E 's/\.([^\.]+)$/.min.\1/')"
+ [ -w "$min" ] || continue
+
+ echo " Minify $file"
+
+ if [ "$MINIFY" = "ext" ]; then
+ #echo "minify --$ext < "$file" > "$min.tmp""
+ minify --$ext < "$file" > "$min.tmp"
+ elif [ "$MINIFY" = "out" ]; then
+ #echo "minify "$file" --output "$min.tmp""
+ minify "$file" --output "$min.tmp" > /dev/null
+ fi
+
+ if [ "$?" = "0" ]; then
+ echo "cat "$min.tmp" > "$min""
+ else
+ echo " minify FAILED!"
+ fi
+
+ rm "$min.tmp"
+
+done
true
-function dbqLoad(e){window._dbq=e,$(".db-rows form.rm").each(function(){}),NodeList.prototype.forEach=Array.prototype.forEach;var t,n=window._dbq["param.format"]?"."+window._dbq["param.format"]:"";n=="."+window._dbq["default.format"]&&(n=""),document.querySelectorAll("form").forEach(function(e){e.onsubmit=function(){if(this.elements.limit){var e=this.elements.limit;window._dbq.default_limit!="undefined"&&e.value==window._dbq.default_limit&&e.removeAttribute("value")}return form_submit_clean(this)}}),document.querySelectorAll("form.menu").forEach(function(e){e.setAttribute("action",window.location.toString().replace(/\?.*$/,"")),e.querySelectorAll("form.menu select[name=format]").forEach(function(e){e.removeAttribute("name"),e.onchange=function(){var e="";return e!=window._dbq["default.format"]&&e!="html"&&(e="."+this.value),this.form.setAttribute("action",window._dbq["table.base"]+e),this.form.onsubmit()}}),e.querySelectorAll("form.menu select[name=table]").forEach(function(e){e.removeAttribute("name"),e.onchange=function(){return this.form.setAttribute("action",window._dbq["db.base"]+"/"+this.value+n),form_clean(this.form),this.form.onsubmit()}}),e.querySelectorAll("form.menu select.limit").forEach(function(e){e.onchange=function(){return this.form.onsubmit()}})}),document.querySelector(".bottom")&&document.querySelector(".insert-bottom")&&document.querySelector(".insert-bottom").insertAdjacentHTML("beforebegin",""+document.querySelector(".bottom").outerHTML.replace("bottom","top")),document.querySelectorAll("table").forEach(function(e){parseInt(e.offsetWidth)>parseInt(window.innerWidth)&&(e.className=e.className.replace(/(^| +)fixed($| )/,"")+" fixed",e.className=e.className.trim())}),window._dbq.perm<window._dbq.perms.write&&(document.querySelectorAll("form.edit").forEach(function(e){e.setAttribute("onsubmit","return false")}),document.querySelectorAll("form.edit input[type=submit],form.edit input[type=reset]").forEach(function(e){e.setAttribute("style","display:none")})),document.querySelectorAll("form.menu input[type=submit]").forEach(function(e){e.insertAdjacentHTML("afterend",'<input type="button" class="btn btn-secondary button '+e.className+'" onclick="form_clean(this.form)" value="'+window._dbq["text.clear"]+'" />'+(window._dbq.perm>=window._dbq.perms.write?'<input type="button" class="btn btn-warning add '+e.className+`" onclick="window.location='`+window._dbq["table.base"]+`/add/'" value="`+window._dbq["text.add"]+'" />':""))}),document.querySelector("th.delete")&&(t=document.createElement("a"),t.setAttribute("href","#"),t.innerHTML=document.querySelector("th.delete").innerHTML,document.querySelector("th.delete").innerHTML="",t.onclick=function(){var e,n,s,o,a,r,t=document.querySelectorAll("form.rm"),c=document.querySelector(".db-rows")?document.querySelector(".db-rows"):"";c.className="loader";for(j=0;j<t.length;++j){n=t[j],r=n.getAttribute("action"),s=[],o=n.getElementsByTagName("input");for(i=0;i<o.length;++i)a=o[i],s.push(a.name+"="+encodeURI(a.value));e=new XMLHttpRequest,e.open("POST",r,!0),e.setRequestHeader("Content-type","application/x-www-form-urlencoded"),e.onload=function(){if(e.readyState===4){if(j!=t.length)return;location.reload()}},e.send(s.join("&"))}return!1},document.querySelector("th.delete").appendChild(t)),document.querySelectorAll("body > h1 a.title-nav-db, body > h1 a.title-nav-table").forEach(function(e){var t=e.className.replace("title-nav-",""),s=window._dbq[t+".base"].replace(/\/[^/]+$/,""),i=s+"/ls.json",o=t=="db"?["id","id"]:["name","name"];dbqGet(i,function(i){var r,a=i.select(o[0],o[1],window._dbq["param."+t]);a.onchange=function(){window.location=s+"/"+this.value+n},r=document.getElementById(t),r&&(r.parentNode.style.display="none"),a.className=e.className,e.parentNode.replaceChild(a,e)})})}function form_clean(e){var t;for(i=0;i<e.length;i++){if(t=e.elements[i],t.style.display=="none")continue;t.type=="text"?t.value="":t.type.match(/^select/)&&(0||t.name=="limit"||t.name=="format")&&(t.selectedIndex=0)}}function form_submit_clean(e){var t,s=0,n="",o=e.getAttribute("action"),i=e.getAttribute("method");if(i!="get")return!0;for(s=0;s<e.length;s++){if(t=e[s],!t.name)continue;if(t.value=="")continue;if(t.value=="undefined")continue;n+=(n?"&":"?")+encodeURI(t.name)+"="+encodeURI(t.value)}return n=(o=="?"?"":o)+n,e.reset(),window.location=n,!1}function dbqGet(e,t){var n=new XMLHttpRequest;delete window._dbq.dbqGet,n.open("GET",e,!0),n.onload=function(){if(n.readyState===4&&n.status>=300&&console.log("dbqGet: Url not found: "+e),n.readyState===4&&n.status<300){var o={rows:JSON.parse(n.responseText),debug:function(){console.log(o.rows)},select:function(e,t,n="undefined"){var s=document.createElement("select");return o.rows.forEach(function(n){var i=Object.keys(n),o=document.createElement("option");o.value=n[e],o.innerHTML=dbqPrettyText(n[t]),s.appendChild(o)}),n!="undefined"&&(s.value=n),s}};if(!t)return window._dbq.dbqGet=o;if(typeof t=="function")return t(o);if(typeof t=="string"&&t in o)return typeof o[t]=="function"?o[t](o):o[t]}},n.send()}function dbqPrettyText(e){return e=e.replace(/(\b\w)/g,function(e){return e.toUpperCase()}),e=e.replace(/[^a-zA-Z0-9]+/g," "),e}function iframe_embed(e){return console.log(e),!1}
\ No newline at end of file
+function dbqLoad(e){window._dbq=e,$(".db-rows form.rm").each(function(){}),NodeList.prototype.forEach=Array.prototype.forEach;var t,n=window._dbq["param.format"]?"."+window._dbq["param.format"]:"";n=="."+window._dbq["default.format"]&&(n=""),document.querySelectorAll("form").forEach(function(e){e.onsubmit=function(){if(this.elements.limit){var e=this.elements.limit;window._dbq.default_limit!="undefined"&&e.value==window._dbq.default_limit&&e.removeAttribute("value")}return form_submit_clean(this)}}),document.querySelectorAll("form.menu").forEach(function(e){e.setAttribute("action",window.location.toString().replace(/\?.*$/,"")),e.querySelectorAll("form.menu select[name=format]").forEach(function(e){e.removeAttribute("name"),e.onchange=function(){var e="";return e!=window._dbq["default.format"]&&e!="html"&&(e="."+this.value),this.form.setAttribute("action",window._dbq["table.base"]+e),this.form.onsubmit()}}),e.querySelectorAll("form.menu select[name=table]").forEach(function(e){e.removeAttribute("name"),e.onchange=function(){return this.form.setAttribute("action",window._dbq["db.base"]+"/"+this.value+n),form_clean(this.form),this.form.onsubmit()}}),e.querySelectorAll("form.menu select.limit").forEach(function(e){e.onchange=function(){return this.form.onsubmit()}})}),document.querySelector(".bottom")&&document.querySelector(".insert-bottom")&&document.querySelector(".insert-bottom").insertAdjacentHTML("beforebegin",""+document.querySelector(".bottom").outerHTML.replace("bottom","top")),document.querySelectorAll("table").forEach(function(e){parseInt(e.offsetWidth)>parseInt(window.innerWidth)&&(e.className=e.className.replace(/(^| +)fixed($| )/,"")+" fixed",e.className=e.className.trim())}),window._dbq.perm<window._dbq.perms.write&&(document.querySelectorAll("form.edit").forEach(function(e){e.setAttribute("onsubmit","return false")}),document.querySelectorAll("form.edit input[type=submit],form.edit input[type=reset]").forEach(function(e){e.setAttribute("style","display:none")})),document.querySelectorAll("form.menu input[type=submit]").forEach(function(e){e.insertAdjacentHTML("afterend",'<input type="button" class="btn btn-secondary button '+e.className+'" onclick="form_clean(this.form)" value="'+window._dbq["text.clear"]+'" />'+(window._dbq.perm>=window._dbq.perms.write?'<input type="button" class="btn btn-warning add '+e.className+`" onclick="window.location='`+window._dbq["table.base"]+`/add/'" value="`+window._dbq["text.add"]+'" />':""))}),document.querySelector("th.delete")&&(t=document.createElement("a"),t.setAttribute("href","#"),t.innerHTML=document.querySelector("th.delete").innerHTML,document.querySelector("th.delete").innerHTML="",t.onclick=function(){var e,n,s,o,a,r,t=document.querySelectorAll("form.rm"),c=document.querySelector(".db-rows")?document.querySelector(".db-rows"):"";c.className="loader";for(j=0;j<t.length;++j){n=t[j],r=n.getAttribute("action"),s=[],o=n.getElementsByTagName("input");for(i=0;i<o.length;++i)a=o[i],s.push(a.name+"="+encodeURI(a.value));e=new XMLHttpRequest,e.open("POST",r,!0),e.setRequestHeader("Content-type","application/x-www-form-urlencoded"),e.onload=function(){if(e.readyState===4){if(j!=t.length)return;location.reload()}},e.send(s.join("&"))}return!1},document.querySelector("th.delete").appendChild(t)),document.querySelectorAll("body > h1 a.title-nav-db, body > h1 a.title-nav-table").forEach(function(e){var t=e.innerHTML,s=e.className.replace("title-nav-",""),o=window._dbq[s+".base"].replace(/\/[^/]+$/,""),a=o+"/ls.json",i=s=="db"?["id","id"]:["name","name"];dbqGet(a,function(a){var c,l,r=a.select(i[0],i[1],window._dbq["param."+s]),d=0;for(const e of r.options){if(console.log(t+" <> "+e.value),e.value!=t&&e.innerHTML!=t)continue;d=1;break}d||(c=document.createElement("option"),c.value=t,c.innerHTML=dbqPrettyText(t)),r.prepend(c),r.onchange=function(){window.location=o+"/"+this.value+n},l=document.getElementById(s),l&&(l.parentNode.style.display="none"),r.className=e.className,e.parentNode.replaceChild(r,e)})})}function form_clean(e){var t;for(i=0;i<e.length;i++){if(t=e.elements[i],t.style.display=="none")continue;t.type=="text"?t.value="":t.type.match(/^select/)&&(0||t.name=="limit"||t.name=="format")&&(t.selectedIndex=0)}}function form_submit_clean(e){var t,s=0,n="",o=e.getAttribute("action"),i=e.getAttribute("method");if(i!="get")return!0;for(s=0;s<e.length;s++){if(t=e[s],!t.name)continue;if(t.value=="")continue;if(t.value=="undefined")continue;n+=(n?"&":"?")+encodeURI(t.name)+"="+encodeURI(t.value)}return n=(o=="?"?"":o)+n,e.reset(),window.location=n,!1}function dbqGet(e,t){var n=new XMLHttpRequest;delete window._dbq.dbqGet,n.open("GET",e,!0),n.onload=function(){if(n.readyState===4&&n.status>=300&&console.log("dbqGet: Url not found: "+e),n.readyState===4&&n.status<300){var o={rows:JSON.parse(n.responseText),debug:function(){console.log(o.rows)},select:function(e,t,n="undefined"){var s=document.createElement("select");return o.rows.forEach(function(n){var i=Object.keys(n),o=document.createElement("option");o.value=n[e],o.innerHTML=dbqPrettyText(n[t]),s.appendChild(o)}),n!="undefined"&&(s.value=n),s}};if(!t)return window._dbq.dbqGet=o;if(typeof t=="function")return t(o);if(typeof t=="string"&&t in o)return typeof o[t]=="function"?o[t](o):o[t]}},n.send()}function dbqPrettyText(e){return e=e.replace(/(\b\w)/g,function(e){return e.toUpperCase()}),e=e.replace(/[^a-zA-Z0-9]+/g," "),e}function iframe_embed(e){return console.log(e),!1}
\ No newline at end of file