Commit 8c450317 authored by nextime's avatar nextime

Minified and unified css and js

parent 3cd0cc84
This source diff could not be displayed because it is too large. You can view the blob instead.
<?
$GUIDEBUG=TRUE;
$GUIDEBUG=FALSE;
$BASEGUIPATH=str_replace("/index.php","",$_SERVER['PHP_SELF']);
$FSPATH=realpath(dirname(__FILE__)."/..");
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -4,7 +4,7 @@
var ttsEnabled=<?=$_DOMOTIKA['tts']?>;
var slideEnabled=<?=$_DOMOTIKA['slide']?>;
var speechEnabled='<?=$_DOMOTIKA['webspeech']?>';
var speechEnabled='<?=$_DOMOTIKA["webspeech"]?>';
//var scroller = new AppScroll({
// toolbar: $('#topbar')[0],
......
#!/bin/bash
mydir=`dirname $0`
cd $mydir
# java -jar ../compiler.jar --js $i --js_output_file $i.compressed
YUI="/usr/bin/yui-compressor"
CSS="../../resources/bootstrap/css/bootstrap.min.css
../../resources/glyphicons/css/bootstrap-glyphicons.css
../../resources/full-glyphicons/css/glyphicons.css
../../resources/bootstrap-switch/static/stylesheets/bootstrap-switch.css
css/style.css"
JS="
../../resources/js/jquery-1.10.2.min.js
../../resources/jquery-color/jquery.color.js
../../resources/hammer.js/hammer.js
../../resources/hammer.js/plugins/hammer.fakemultitouch.js
js/starthammer.js
../../resources/hammer.js/plugins/jquery.hammer.js/jquery.hammer.js
../../resources/bootstrap/js/bootstrap.min.js
../../resources/js/respond.min.js
../../resources/bootstrap-switch/static/js/bootstrap-switch.min.js
../../resources/Snap.js/snap.min.js
../../resources/AppScroll.js/AppScroll.min.js
../../resources/EventSource/eventsource.js
../../resources/js/jquery.easing.1.3.min.js
../../resources/js/jquery.alterclass.js
js/fastclick.js
js/speech.js
js/domotika.js
"
echo -n > css/combined.min.css
echo -n > js/combined.min.js
export IFS="
"
for c in $CSS
do
o=`basename $c`
echo compressing $c ...
rm -f /tmp/$o.compressed
if [[ "$c" != *min.css ]] ; then
$YUI --type css -o /tmp/$o.compressed $c >/dev/null 2>&1
else
echo "already minified..."
cp $c /tmp/$o.compressed
fi
cat /tmp/$o.compressed >> css/combined.min.css
done
for j in $JS
do
echo compressing $j
o=`basename $j`
rm -f /tmp/$o.compressed
if [[ "$j" != *min.js ]] ; then
#java -jar ../../../tools/compiler.jar --js $mydir/$j --js_output_file /tmp/$o.compressed >/dev/null 2>&1
$YUI --type js --nomunge -o /tmp/$o.compressed $j >/dev/null 2>&1
if [ -f /tmp/$o.compressed ] ; then
cat /tmp/$o.compressed >> js/combined.min.js
else
echo "cannot use closure, use htmlcompressor..."
#sed -e 's/ \/\/.*$//' $mydir/$j > /tmp/$o.pass1
#java -jar ../../../tools/htmlcompressor-1.5.3.jar --nomunge -o /tmp/$o.compressed /tmp/$o.pass1
cp $mydir/$j /tmp/$o.compressed
cat /tmp/$o.compressed >> js/combined.min.js
fi
else
echo "already minified..."
cat $j >> js/combined.min.js
fi
done
......@@ -23,5 +23,4 @@
<link href="<?=$BASEGUIPATH;?>/css/style.css" rel="stylesheet" media="screen" />
<? } else { ?>
<link href="<?=$BASEGUIPATH;?>/css/combined.min.css" rel="stylesheet" media="screen" />
<link href="<?=$BASEGUIPATH;?>/css/style.css" rel="stylesheet" media="screen" />
<? } ?>
......@@ -11,5 +11,4 @@
* Licensed under the Apache License, Version 2.0
* http://www.apache.org/licenses/LICENSE-2.0
* ============================================================ */
!function($){"use strict";$.fn['bootstrapSwitch']=function(method){var inputSelector='input[type!="hidden"]';var methods={init:function(){return this.each(function(){var $element=$(this),$div,$switchLeft,$switchRight,$label,$form=$element.closest('form'),myClasses="",classes=$element.attr('class'),color,moving,onLabel="ON",offLabel="OFF",icon=false;$.each(['switch-mini','switch-small','switch-large'],function(i,el){if(classes.indexOf(el)>=0)myClasses=el});$element.addClass('has-switch');if($element.data('on')!==undefined)color="switch-"+$element.data('on');if($element.data('on-label')!==undefined)onLabel=$element.data('on-label');if($element.data('off-label')!==undefined)offLabel=$element.data('off-label');if($element.data('icon')!==undefined)icon=$element.data('icon');$switchLeft=$('<span>').addClass("switch-left").addClass(myClasses).addClass(color).html(onLabel);color='';if($element.data('off')!==undefined)color="switch-"+$element.data('off');$switchRight=$('<span>').addClass("switch-right").addClass(myClasses).addClass(color).html(offLabel);$label=$('<label>').html("&nbsp;").addClass(myClasses).attr('for',$element.find(inputSelector).attr('id'));if(icon){$label.html('<i class="icon icon-'+icon+'"></i>')}$div=$element.find(inputSelector).wrap($('<div>')).parent().data('animated',false);if($element.data('animated')!==false)$div.addClass('switch-animate').data('animated',true);$div.append($switchLeft).append($label).append($switchRight);$element.find('>div').addClass($element.find(inputSelector).is(':checked')?'switch-on':'switch-off');if($element.find(inputSelector).is(':disabled'))$(this).addClass('deactivate');var changeStatus=function($this){$this.siblings('label').trigger('mousedown').trigger('mouseup').trigger('click')};$element.on('keydown',function(e){if(e.keyCode===32){e.stopImmediatePropagation();e.preventDefault();changeStatus($(e.target).find('span:first'))}});$switchLeft.on('click',function(e){changeStatus($(this))});$switchRight.on('click',function(e){changeStatus($(this))});$element.find(inputSelector).on('change',function(e,skipOnChange){var $this=$(this),$element=$this.parent(),thisState=$this.is(':checked'),state=$element.is('.switch-off');e.preventDefault();$element.css('left','');if(state===thisState){if(thisState)$element.removeClass('switch-off').addClass('switch-on');else $element.removeClass('switch-on').addClass('switch-off');if($element.data('animated')!==false)$element.addClass("switch-animate");if(typeof skipOnChange==='boolean'&&skipOnChange)return;$element.parent().trigger('switch-change',{'el':$this,'value':thisState})}});$element.find('label').on('mousedown touchstart',function(e){var $this=$(this);moving=false;e.preventDefault();e.stopImmediatePropagation();$this.closest('div').removeClass('switch-animate');if($this.closest('.has-switch').is('.deactivate')){$this.unbind('click')}else if($this.closest('.switch-on').parent().is('.radio-no-uncheck')){$this.unbind('click')}else{$this.on('mousemove touchmove',function(e){var $element=$(this).closest('.make-switch'),relativeX=(e.pageX||e.originalEvent.targetTouches[0].pageX)-$element.offset().left,percent=(relativeX/$element.width())*100,left=25,right=75;moving=true;if(percent<left)percent=left;else if(percent>right)percent=right;$element.find('>div').css('left',(percent-right)+"%")});$this.on('click touchend',function(e){var $this=$(this),$target=$(e.target),$myRadioCheckBox=$target.siblings('input');e.stopImmediatePropagation();e.preventDefault();$this.unbind('mouseleave');if(moving)$myRadioCheckBox.prop('checked',!(parseInt($this.parent().css('left'))<-25));else $myRadioCheckBox.prop("checked",!$myRadioCheckBox.is(":checked"));moving=false;$myRadioCheckBox.trigger('change')});$this.on('mouseleave',function(e){var $this=$(this),$myInputBox=$this.siblings('input');e.preventDefault();e.stopImmediatePropagation();$this.unbind('mouseleave');$this.trigger('mouseup');$myInputBox.prop('checked',!(parseInt($this.parent().css('left'))<-25)).trigger('change')});$this.on('mouseup',function(e){e.stopImmediatePropagation();e.preventDefault();$(this).unbind('mousemove')})}});if($form.data('bootstrapSwitch')!=='injected'){$form.bind('reset',function(){setTimeout(function(){$form.find('.make-switch').each(function(){var $input=$(this).find(inputSelector);$input.prop('checked',$input.is(':checked')).trigger('change')})},1)});$form.data('bootstrapSwitch','injected')}})},toggleActivation:function(){var $this=$(this);$this.toggleClass('deactivate');$this.find(inputSelector).prop('disabled',$this.is('.deactivate'))},isActive:function(){return!$(this).hasClass('deactivate')},setActive:function(active){var $this=$(this);if(active){$this.removeClass('deactivate');$this.find(inputSelector).removeAttr('disabled')}else{$this.addClass('deactivate');$this.find(inputSelector).attr('disabled','disabled')}},toggleState:function(skipOnChange){var $input=$(this).find(':checkbox');$input.prop('checked',!$input.is(':checked')).trigger('change',skipOnChange)},toggleRadioState:function(skipOnChange){var $radioinput=$(this).find(':radio');$radioinput.not(':checked').prop('checked',!$radioinput.is(':checked')).trigger('change',skipOnChange)},toggleRadioStateAllowUncheck:function(uncheck,skipOnChange){var $radioinput=$(this).find(':radio');if(uncheck){$radioinput.not(':checked').trigger('change',skipOnChange)}else{$radioinput.not(':checked').prop('checked',!$radioinput.is(':checked')).trigger('change',skipOnChange)}},setState:function(value,skipOnChange){$(this).find(inputSelector).prop('checked',value).trigger('change',skipOnChange)},setOnLabel:function(value){var $switchLeft=$(this).find(".switch-left");$switchLeft.html(value)},setOffLabel:function(value){var $switchRight=$(this).find(".switch-right");$switchRight.html(value)},setOnClass:function(value){var $switchLeft=$(this).find(".switch-left");var color='';if(value!==undefined){if($(this).attr('data-on')!==undefined){color="switch-"+$(this).attr('data-on')}$switchLeft.removeClass(color);color="switch-"+value;$switchLeft.addClass(color)}},setOffClass:function(value){var $switchRight=$(this).find(".switch-right");var color='';if(value!==undefined){if($(this).attr('data-off')!==undefined){color="switch-"+$(this).attr('data-off')}$switchRight.removeClass(color);color="switch-"+value;$switchRight.addClass(color)}},setAnimated:function(value){var $element=$(this).find('input[type!="hidden"]').parent();if(value===undefined)value=false;$element.data('animated',value);$element.attr('data-animated',value);if($element.data('animated')!==false){$element.addClass("switch-animate")}else{$element.removeClass("switch-animate")}},setSizeClass:function(value){var $element=$(this);var $switchLeft=$element.find(".switch-left");var $switchRight=$element.find(".switch-right");var $label=$element.find("label");$.each(['switch-mini','switch-small','switch-large'],function(i,el){if(el!==value){$switchLeft.removeClass(el)$switchRight.removeClass(el);$label.removeClass(el)}else{$switchLeft.addClass(el);$switchRight.addClass(el);$label.addClass(el)}})},status:function(){return $(this).find(inputSelector).is(':checked')},destroy:function(){var $element=$(this),$div=$element.find('div'),$form=$element.closest('form'),$inputbox;$div.find(':not(inputSelector)').remove();$inputbox=$div.children();$inputbox.unwrap().unwrap();$inputbox.unbind('change');if($form){$form.unbind('reset');$form.removeData('bootstrapSwitch')}return $inputbox}};if(methods[method])return methods[method].apply(this,Array.prototype.slice.call(arguments,1));else if(typeof method==='object'||!method)return methods.init.apply(this,arguments);else $.error('Method '+method+' does not exist!')}}(jQuery);(function($){$(function(){$('.make-switch')['bootstrapSwitch']()})})(jQuery);
\ No newline at end of file
;!function(a){a.fn.bootstrapSwitch=function(d){var c='input[type!="hidden"]';var b={init:function(){return this.each(function(){var q=a(this),n,g,m,p,r=q.closest("form"),i="",h=q.attr("class"),j,e,k="ON",f="OFF",o=false;a.each(["switch-mini","switch-small","switch-large"],function(s,t){if(h.indexOf(t)>=0){i=t}});q.addClass("has-switch");if(q.data("on")!==undefined){j="switch-"+q.data("on")}if(q.data("on-label")!==undefined){k=q.data("on-label")}if(q.data("off-label")!==undefined){f=q.data("off-label")}if(q.data("icon")!==undefined){o=q.data("icon")}g=a("<span>").addClass("switch-left").addClass(i).addClass(j).html(k);j="";if(q.data("off")!==undefined){j="switch-"+q.data("off")}m=a("<span>").addClass("switch-right").addClass(i).addClass(j).html(f);p=a("<label>").html("&nbsp;").addClass(i).attr("for",q.find(c).attr("id"));if(o){p.html('<i class="icon icon-'+o+'"></i>')}n=q.find(c).wrap(a("<div>")).parent().data("animated",false);if(q.data("animated")!==false){n.addClass("switch-animate").data("animated",true)}n.append(g).append(p).append(m);q.find(">div").addClass(q.find(c).is(":checked")?"switch-on":"switch-off");if(q.find(c).is(":disabled")){a(this).addClass("deactivate")}var l=function(s){s.siblings("label").trigger("mousedown").trigger("mouseup").trigger("click")};q.on("keydown",function(s){if(s.keyCode===32){s.stopImmediatePropagation();s.preventDefault();l(a(s.target).find("span:first"))}});g.on("click",function(s){l(a(this))});m.on("click",function(s){l(a(this))});q.find(c).on("change",function(x,v){var w=a(this),t=w.parent(),s=w.is(":checked"),u=t.is(".switch-off");x.preventDefault();t.css("left","");if(u===s){if(s){t.removeClass("switch-off").addClass("switch-on")}else{t.removeClass("switch-on").addClass("switch-off")}if(t.data("animated")!==false){t.addClass("switch-animate")}if(typeof v==="boolean"&&v){return}t.parent().trigger("switch-change",{el:w,value:s})}});q.find("label").on("mousedown touchstart",function(t){var s=a(this);e=false;t.preventDefault();t.stopImmediatePropagation();s.closest("div").removeClass("switch-animate");if(s.closest(".has-switch").is(".deactivate")){s.unbind("click")}else{if(s.closest(".switch-on").parent().is(".radio-no-uncheck")){s.unbind("click")}else{s.on("mousemove touchmove",function(z){var u=a(this).closest(".make-switch"),w=(z.pageX||z.originalEvent.targetTouches[0].pageX)-u.offset().left,x=(w/u.width())*100,y=25,v=75;e=true;if(x<y){x=y}else{if(x>v){x=v}}u.find(">div").css("left",(x-v)+"%")});s.on("click touchend",function(x){var w=a(this),u=a(x.target),v=u.siblings("input");x.stopImmediatePropagation();x.preventDefault();w.unbind("mouseleave");if(e){v.prop("checked",!(parseInt(w.parent().css("left"))<-25))}else{v.prop("checked",!v.is(":checked"))}e=false;v.trigger("change")});s.on("mouseleave",function(w){var v=a(this),u=v.siblings("input");w.preventDefault();w.stopImmediatePropagation();v.unbind("mouseleave");v.trigger("mouseup");u.prop("checked",!(parseInt(v.parent().css("left"))<-25)).trigger("change")});s.on("mouseup",function(u){u.stopImmediatePropagation();u.preventDefault();a(this).unbind("mousemove")})}}});if(r.data("bootstrapSwitch")!=="injected"){r.bind("reset",function(){setTimeout(function(){r.find(".make-switch").each(function(){var s=a(this).find(c);s.prop("checked",s.is(":checked")).trigger("change")})},1)});r.data("bootstrapSwitch","injected")}})},toggleActivation:function(){var e=a(this);e.toggleClass("deactivate");e.find(c).prop("disabled",e.is(".deactivate"))},isActive:function(){return !a(this).hasClass("deactivate")},setActive:function(f){var e=a(this);if(f){e.removeClass("deactivate");e.find(c).removeAttr("disabled")}else{e.addClass("deactivate");e.find(c).attr("disabled","disabled")}},toggleState:function(e){var f=a(this).find(":checkbox");f.prop("checked",!f.is(":checked")).trigger("change",e)},toggleRadioState:function(f){var e=a(this).find(":radio");e.not(":checked").prop("checked",!e.is(":checked")).trigger("change",f)},toggleRadioStateAllowUncheck:function(f,g){var e=a(this).find(":radio");if(f){e.not(":checked").trigger("change",g)}else{e.not(":checked").prop("checked",!e.is(":checked")).trigger("change",g)}},setState:function(f,e){a(this).find(c).prop("checked",f).trigger("change",e)},setOnLabel:function(f){var e=a(this).find(".switch-left");e.html(f)},setOffLabel:function(e){var f=a(this).find(".switch-right");f.html(e)},setOnClass:function(g){var f=a(this).find(".switch-left");var e="";if(g!==undefined){if(a(this).attr("data-on")!==undefined){e="switch-"+a(this).attr("data-on")}f.removeClass(e);e="switch-"+g;f.addClass(e)}},setOffClass:function(f){var g=a(this).find(".switch-right");var e="";if(f!==undefined){if(a(this).attr("data-off")!==undefined){e="switch-"+a(this).attr("data-off")}g.removeClass(e);e="switch-"+f;g.addClass(e)}},setAnimated:function(f){var e=a(this).find('input[type!="hidden"]').parent();if(f===undefined){f=false}e.data("animated",f);e.attr("data-animated",f);if(e.data("animated")!==false){e.addClass("switch-animate")}else{e.removeClass("switch-animate")}},setSizeClass:function(h){var f=a(this);var g=f.find(".switch-left");var i=f.find(".switch-right");var e=f.find("label");a.each(["switch-mini","switch-small","switch-large"],function(j,k){if(k!==h){g.removeClass(k);i.removeClass(k);e.removeClass(k)}else{g.addClass(k);i.addClass(k);e.addClass(k)}})},status:function(){return a(this).find(c).is(":checked")},destroy:function(){var g=a(this),f=g.find("div"),h=g.closest("form"),e;f.find(":not(inputSelector)").remove();e=f.children();e.unwrap().unwrap();e.unbind("change");if(h){h.unbind("reset");h.removeData("bootstrapSwitch")}return e}};if(b[d]){return b[d].apply(this,Array.prototype.slice.call(arguments,1))}else{if(typeof d==="object"||!d){return b.init.apply(this,arguments)}else{a.error("Method "+d+" does not exist!")}}}}(jQuery);(function(a){a(function(){a(".make-switch")["bootstrapSwitch"]()})})(jQuery);
/*! Hammer.JS - v1.0.6 - 2014-01-02
/* Hammer.JS - v1.0.6 - 2014-01-02
* http://eightmedia.github.com/hammer.js
*
* Copyright (c) 2014 Jorik Tangelder <j.tangelder@gmail.com>;
......
......@@ -6,9 +6,11 @@
*/
Hammer.plugins.fakeMultitouch = function() {
// keeps the start position to keep it centered
var start_pos = false;
// test for msMaxTouchPoints to enable this for IE10 with only one pointer (a mouse in all/most cases)
Hammer.HAS_POINTEREVENTS = navigator.msPointerEnabled &&
navigator.msMaxTouchPoints && navigator.msMaxTouchPoints >= 1;
......@@ -20,6 +22,7 @@
*/
Hammer.event.getTouchList = function(ev, eventType) {
// get the fake pointerEvent touchlist
if(Hammer.HAS_POINTEREVENTS) {
return Hammer.PointerEvent.getTouchList();
}
......@@ -29,14 +32,17 @@
}
// reset on start of a new touch
if(eventType == Hammer.EVENT_START) {
start_pos = false;
}
// when the shift key is pressed, multitouch is possible on desktop
// why shift? because ctrl and alt are taken by osx and linux
if(ev.shiftKey) {
// on touchstart we store the position of the mouse for multitouch
if(!start_pos) {
start_pos = {
pageX: ev.pageX,
......@@ -48,6 +54,7 @@
var distance_y = start_pos.pageY - ev.pageY;
// fake second touch in the opposite direction
return [
{
identifier: 1,
......@@ -64,6 +71,7 @@
];
}
// normal single touch
else {
start_pos = false;
return [
......
No preview for this file type
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment