JavaScript minifiziert

This commit is contained in:
Carsten Götzinger 2015-04-02 08:24:26 +02:00
parent a6f5648fbd
commit 3ce491f16c
15 changed files with 41 additions and 30 deletions

View File

@ -92,13 +92,13 @@ class RateItArticle extends RateItFrontend {
$GLOBALS['TL_JAVASCRIPT'][] = 'system/modules/rateit/public/js/onReadyRateIt.js|static';
$GLOBALS['TL_JAVASCRIPT'][] = 'system/modules/rateit/public/js/rateit.js|static';
$GLOBALS['TL_CSS'][] = 'system/modules/rateit/public/css/rateit.css||static';
$GLOBALS['TL_CSS'][] = 'system/modules/rateit/public/css/rateit.min.css||static';
switch ($GLOBALS['TL_CONFIG']['rating_type']) {
case 'hearts' :
$GLOBALS['TL_CSS'][] = 'system/modules/rateit/public/css/heart.css||static';
$GLOBALS['TL_CSS'][] = 'system/modules/rateit/public/css/heart.min.css||static';
break;
default:
$GLOBALS['TL_CSS'][] = 'system/modules/rateit/public/css/star.css||static';
$GLOBALS['TL_CSS'][] = 'system/modules/rateit/public/css/star.min.css||static';
}
}
@ -150,13 +150,13 @@ class RateItArticle extends RateItFrontend {
$GLOBALS['TL_JAVASCRIPT'][] = 'system/modules/rateit/public/js/onReadyRateIt.js|static';
$GLOBALS['TL_JAVASCRIPT'][] = 'system/modules/rateit/public/js/rateit.js|static';
$GLOBALS['TL_CSS'][] = 'system/modules/rateit/public/css/rateit.css||static';
$GLOBALS['TL_CSS'][] = 'system/modules/rateit/public/css/rateit.min.css||static';
switch ($GLOBALS['TL_CONFIG']['rating_type']) {
case 'hearts' :
$GLOBALS['TL_CSS'][] = 'system/modules/rateit/public/css/heart.css||static';
$GLOBALS['TL_CSS'][] = 'system/modules/rateit/public/css/heart.min.css||static';
break;
default:
$GLOBALS['TL_CSS'][] = 'system/modules/rateit/public/css/star.css||static';
$GLOBALS['TL_CSS'][] = 'system/modules/rateit/public/css/star.min.css||static';
}
}
@ -234,13 +234,13 @@ class RateItArticle extends RateItFrontend {
$GLOBALS['TL_JAVASCRIPT'][] = 'system/modules/rateit/public/js/onReadyRateIt.js|static';
$GLOBALS['TL_JAVASCRIPT'][] = 'system/modules/rateit/public/js/rateit.js|static';
$GLOBALS['TL_CSS'][] = 'system/modules/rateit/public/css/rateit.css||static';
$GLOBALS['TL_CSS'][] = 'system/modules/rateit/public/css/rateit.min.css||static';
switch ($GLOBALS['TL_CONFIG']['rating_type']) {
case 'hearts' :
$GLOBALS['TL_CSS'][] = 'system/modules/rateit/public/css/heart.css||static';
$GLOBALS['TL_CSS'][] = 'system/modules/rateit/public/css/heart.min.css||static';
break;
default:
$GLOBALS['TL_CSS'][] = 'system/modules/rateit/public/css/star.css||static';
$GLOBALS['TL_CSS'][] = 'system/modules/rateit/public/css/star.min.css||static';
}
}

View File

@ -56,13 +56,13 @@ class RateItFaq extends RateItFrontend {
$GLOBALS['TL_JAVASCRIPT'][] = 'system/modules/rateit/public/js/onReadyRateIt.js|static';
$GLOBALS['TL_JAVASCRIPT'][] = 'system/modules/rateit/public/js/rateit.js|static';
$GLOBALS['TL_CSS'][] = 'system/modules/rateit/public/css/rateit.css||static';
$GLOBALS['TL_CSS'][] = 'system/modules/rateit/public/css/rateit.min.css||static';
switch ($GLOBALS['TL_CONFIG']['rating_type']) {
case 'hearts' :
$GLOBALS['TL_CSS'][] = 'system/modules/rateit/public/css/heart.css||static';
$GLOBALS['TL_CSS'][] = 'system/modules/rateit/public/css/heart.min.css||static';
break;
default:
$GLOBALS['TL_CSS'][] = 'system/modules/rateit/public/css/star.css||static';
$GLOBALS['TL_CSS'][] = 'system/modules/rateit/public/css/star.min.css||static';
}
}
}

View File

@ -68,13 +68,13 @@ abstract class RateItHybrid extends RateItFrontend
$GLOBALS['TL_JAVASCRIPT'][] = 'system/modules/rateit/public/js/onReadyRateIt.js|static';
$GLOBALS['TL_JAVASCRIPT'][] = 'system/modules/rateit/public/js/rateit.js|static';
$GLOBALS['TL_CSS'][] = 'system/modules/rateit/public/css/rateit.css||static';
$GLOBALS['TL_CSS'][] = 'system/modules/rateit/public/css/rateit.min.css||static';
switch ($this->strType) {
case 'hearts' :
$GLOBALS['TL_CSS'][] = 'system/modules/rateit/public/css/heart.css||static';
$GLOBALS['TL_CSS'][] = 'system/modules/rateit/public/css/heart.min.css||static';
break;
default:
$GLOBALS['TL_CSS'][] = 'system/modules/rateit/public/css/star.css||static';
$GLOBALS['TL_CSS'][] = 'system/modules/rateit/public/css/star.min.css||static';
}
return parent::generate();

View File

@ -71,13 +71,13 @@ class RateItNews extends RateItFrontend {
$GLOBALS['TL_JAVASCRIPT'][] = 'system/modules/rateit/public/js/onReadyRateIt.js|static';
$GLOBALS['TL_JAVASCRIPT'][] = 'system/modules/rateit/public/js/rateit.js|static';
$GLOBALS['TL_CSS'][] = 'system/modules/rateit/public/css/rateit.css||static';
$GLOBALS['TL_CSS'][] = 'system/modules/rateit/public/css/rateit.min.css||static';
switch ($GLOBALS['TL_CONFIG']['rating_type']) {
case 'hearts' :
$GLOBALS['TL_CSS'][] = 'system/modules/rateit/public/css/heart.css||static';
$GLOBALS['TL_CSS'][] = 'system/modules/rateit/public/css/heart.min.css||static';
break;
default:
$GLOBALS['TL_CSS'][] = 'system/modules/rateit/public/css/star.css||static';
$GLOBALS['TL_CSS'][] = 'system/modules/rateit/public/css/star.min.css||static';
}
}
}

View File

@ -69,13 +69,13 @@ class RateItTopRatingsModule extends RateItFrontend
$GLOBALS['TL_JAVASCRIPT'][] = 'system/modules/rateit/public/js/onReadyRateIt.js|static';
$GLOBALS['TL_JAVASCRIPT'][] = 'system/modules/rateit/public/js/rateit.js|static';
$GLOBALS['TL_CSS'][] = 'system/modules/rateit/public/css/rateit.css||static';
$GLOBALS['TL_CSS'][] = 'system/modules/rateit/public/css/rateit.min.css||static';
switch ($GLOBALS['TL_CONFIG']['rating_type']) {
case 'hearts' :
$GLOBALS['TL_CSS'][] = 'system/modules/rateit/public/css/heart.css||static';
$GLOBALS['TL_CSS'][] = 'system/modules/rateit/public/css/heart.min.css||static';
break;
default:
$GLOBALS['TL_CSS'][] = 'system/modules/rateit/public/css/star.css||static';
$GLOBALS['TL_CSS'][] = 'system/modules/rateit/public/css/star.min.css||static';
}
return parent::generate();

1
public/css/heart.min.css vendored Normal file
View File

@ -0,0 +1 @@
.mbrateItRating .wrapper,.rateItRating .wrapper{background:url(../images/heart.gif)}div.mbrateItRating div.rateItRating-hover,div.mbrateItRating div.rateItRating-selected,div.rateItRating div.rateItRating-hover,div.rateItRating div.rateItRating-selected{background:url(../images/heart.gif) left}

1
public/css/rateit.min.css vendored Normal file
View File

@ -0,0 +1 @@
.rateItRating{position:relative;display:inline-block}.mbrateItRating{position:relative;opacity:1}.mbrateItRating .wrapper,.rateItRating .wrapper{cursor:pointer;position:relative;diplay:inline-block;height:16px}.rateItRating[rel=not-rateable]{float:right}.rateItRating[rel=not-rateable] .wrapper{cursor:default}div.mod_rateit_top_ratings ul{padding:0}div.mod_rateit_top_ratings li{list-style-type:none}div.mod_rateit_top_ratings div.rateItTitle{display:inline-block;max-width:40%;min-height:30px}div.mbrateItRating div.rateItRating-hover,div.mbrateItRating div.rateItRating-selected,div.rateItRating div.rateItRating-hover,div.rateItRating div.rateItRating-selected{position:absolute}.rateItRating .ratingText{color:#000}.mbrateItRating .mbratingText{display:inline-block;color:#ccc}.ratingText.ratingError{color:red}.mbrateItRating .mbratingText.loading,.rateItRating .ratingText.loading{background:url(../images/ajax-loading.gif) no-repeat}span.rating-microdata{display:none}

1
public/css/star.min.css vendored Normal file
View File

@ -0,0 +1 @@
.mbrateItRating .wrapper,.rateItRating .wrapper{background:url(../images/star.gif)}div.mbrateItRating div.rateItRating-hover,div.mbrateItRating div.rateItRating-selected,div.rateItRating div.rateItRating-hover,div.rateItRating div.rateItRating-selected{background:url(../images/star.gif) left}

8
public/js/helper.min.js vendored Normal file
View File

@ -0,0 +1,8 @@
if(typeof Object.create!=='function'){Object.create=function(o){function F(){}
F.prototype=o;return new F();};}
function $tryCatch(){for(var i=0,l=arguments.length;i<l;i++){try{return arguments[i]();}catch(e){}}
return null;};var Browser={Engine:{name:'unknown',version:0},Platform:{name:(window.orientation!=undefined)?'ipod':(navigator.platform.match(/mac|win|linux/i)||['other'])[0].toLowerCase()},Features:{xpath:!!(document.evaluate),air:!!(window.runtime),query:!!(document.querySelector)},Plugins:{},Engines:{presto:function(){return(!window.opera)?false:((arguments.callee.caller)?960:((document.getElementsByClassName)?950:925));},trident:function(){return(!window.ActiveXObject)?false:((window.XMLHttpRequest)?((document.querySelectorAll)?6:5):4);},webkit:function(){return(navigator.taintEnabled)?false:((Browser.Features.xpath)?((Browser.Features.query)?525:420):419);},gecko:function(){return(!document.getBoxObjectFor&&window.mozInnerScreenX==null)?false:((document.getElementsByClassName)?19:18);}}};Browser.Platform[Browser.Platform.name]=true;Browser.detect=function(){for(var engine in this.Engines){var version=this.Engines[engine]();if(version){this.Engine={name:engine,version:version};this.Engine[engine]=this.Engine[engine+version]=true;break;}}
return{name:engine,version:version};};Browser.detect();Browser.Request=function(){return $tryCatch(function(){return new XMLHttpRequest();},function(){return new ActiveXObject('MSXML2.XMLHTTP');},function(){return new ActiveXObject('Microsoft.XMLHTTP');});};Browser.Features.xhr=!!(Browser.Request());Browser.Plugins.Flash=(function(){var version=($tryCatch(function(){return navigator.plugins['Shockwave Flash'].description;},function(){return new ActiveXObject('ShockwaveFlash.ShockwaveFlash').GetVariable('$version');})||'0 r0').match(/\d+/g);return{version:parseInt(version[0]||0+'.'+version[1],10)||0,build:parseInt(version[2],10)||0};})();function $exec(text){if(!text)return text;if(window.execScript){window.execScript(text);}else{var script=document.createElement('script');script.setAttribute('type','text/javascript');script[(Browser.Engine.webkit&&Browser.Engine.version<420)?'innerText':'text']=text;document.head.appendChild(script);document.head.removeChild(script);}
return text;};function getPosition(element){var xPosition=0;var yPosition=0;while(element){xPosition+=(element.offsetLeft-element.scrollLeft+element.clientLeft);yPosition+=(element.offsetTop-element.scrollTop+element.clientTop);element=element.offsetParent;}
return{x:xPosition,y:yPosition};}

View File

@ -574,7 +574,7 @@ function doRateIt() {
});
jQuery.ajax({
type: "GET",
url: "system/modules/rateit/public/js/helper.js",
url: "system/modules/rateit/public/js/helper.min.js",
dataType: "script",
async: false,
cache: true

View File

@ -20,5 +20,5 @@ el.data('selected').css('width',el.data('newFill'));},mouseCrap:function(event){
var fillPercent=self.getVotePercent(fill);var nextStep=Math.ceil((fillPercent/100)*self.options.max);var w=nextStep*self.options.starwidth;if(parseInt(el.data('hover').css('width'))!=w){el.data('selected').css('display','none');el.data('hover').css('width',Math.min(w,self.options.starwidth*self.options.max));el.data('hover').css('display','block');}
var newFill=nextStep/self.options.max*100;self.fillVote(newFill,el);},getStarPercent:function(id){var stars=id.match(/(\d*\|?\d*)-(page|article|ce|module|news|faq|galpic|news4ward)-(\d*\.?\d+)_(\d*\.?\d+)$/);if(stars!=null){var score=parseFloat(stars[3]);var scale=parseFloat(stars[4]);var percent=(score/scale)*100;return percent;}else{return 0;}},getFillPercent:function(starPercent){return(starPercent/100)*(this.options.starwidth*this.options.max);},getVotePercent:function(actVote){var starsWidth=this.options.starwidth*this.options.max;var percent=(actVote/starsWidth*100).toFixed(2);return percent;},getRatableId:function(id){var stars=id.match(/(\d*\|?\d*)-(page|article|ce|module|news|faq|galpic|news4ward)-(\d*\.?\d+)_(\d*\.?\d+)$/);return stars!=null?stars[1]:'';},getRatableType:function(id){var stars=id.match(/(\d*\|?\d*)-(page|article|ce|module|news|faq|galpic|news4ward)-(\d*\.?\d+)_(\d*\.?\d+)$/);return stars!=null?stars[2]:'';},getRatableMaxValue:function(id){var stars=id.match(/(\d*\|?\d*)-(page|article|ce|module|news|faq|galpic|news4ward)-(\d*\.?\d+)_(\d*\.?\d+)$/);return stars!=null?parseInt(stars[4]):0;},setBackgroundPosition:function(el,pos){el.css('background-position','0% '+pos+'px');},getBackgroundImagePath:function(el){return el.css("background-image");},getBackgroundImage:function(el){var dfd=jQuery.Deferred();var backgroundImageSize=new Array();var reg_imgFile=/url\s*\(["']?(.*)["']?\)/i;var string=this.getBackgroundImagePath(el);string=string.match(reg_imgFile)[1];string=string.replace('\"','');jQuery('<img/>').attr('src',string).load(function(){backgroundImageSize.push(this.width);backgroundImageSize.push(this.height);dfd.resolve(backgroundImageSize);});return dfd.promise();},updateText:function(el,text){error=text.split('ERROR:')[1];el.data('textEl').removeClass('loading');if(error){this.RateItRating.showError(el,error);return false;}
el.data('textEl').text(text);if(typeof(jQuery('.mbrateItRating'))!='undefined'&&el.data('id').indexOf('mb')==0){var mbid=el.attr('id');mbid=mbid.replace('mb','');if(typeof(arrRatings)=='object'){for(var ri=0;ri<arrRatings.length;ri++){if(arrRatings[ri].rateItID==mbid){arrRatings[ri].description=text;break;}}}
if(typeof(jQuery('#'+jEscape(mbid)))!='undefined'){jQuery('#'+jEscape(mbid)).find('.ratingText').text(text);}}else{if(typeof(arrRatings)=='object'){for(var ri=0;ri<arrRatings.length;ri++){if(arrRatings[ri].rateItID==el.data('id')){arrRatings[ri].description=text;break;}}}}},showError:function(el,error){el.data('textEl').addClass('ratingError');el.data('textEl').text(error);setTimeout(function(){el.data('textEl').text(el.data('oldTxt'));el.data('textEl').removeClass('ratingError');},2000);}};})(jQuery);jQuery(document).ready(function(){jQuery.ajax({type:"GET",url:"system/modules/rateit/public/js/jquery-ui-effects.custom.min.js",dataType:"script",async:false,cache:true});jQuery.ajax({type:"GET",url:"system/modules/rateit/public/js/helper.js",dataType:"script",async:false,cache:true});RateItRating=Object.create(RateItRatings).initialize({url:'SimpleAjax.php'});});var jEscape=function(jquery){jquery=jquery.replace(new RegExp("\\$","g"),"\\$");jquery=jquery.replace(new RegExp("\~","g"),"\\~");jquery=jquery.replace(new RegExp("\\[","g"),"\\[");jquery=jquery.replace(new RegExp("\\]","g"),"\\]");jquery=jquery.replace(new RegExp("\\|","g"),"\\|");jquery=jquery.replace(new RegExp("\\.","g"),"\\.");jquery=jquery.replace(new RegExp("#","g"),"\\#");return jquery;};}}
if(typeof(jQuery('#'+jEscape(mbid)))!='undefined'){jQuery('#'+jEscape(mbid)).find('.ratingText').text(text);}}else{if(typeof(arrRatings)=='object'){for(var ri=0;ri<arrRatings.length;ri++){if(arrRatings[ri].rateItID==el.data('id')){arrRatings[ri].description=text;break;}}}}},showError:function(el,error){el.data('textEl').addClass('ratingError');el.data('textEl').text(error);setTimeout(function(){el.data('textEl').text(el.data('oldTxt'));el.data('textEl').removeClass('ratingError');},2000);}};})(jQuery);jQuery(document).ready(function(){jQuery.ajax({type:"GET",url:"system/modules/rateit/public/js/jquery-ui-effects.custom.min.js",dataType:"script",async:false,cache:true});jQuery.ajax({type:"GET",url:"system/modules/rateit/public/js/helper.min.js",dataType:"script",async:false,cache:true});RateItRating=Object.create(RateItRatings).initialize({url:'SimpleAjax.php'});});var jEscape=function(jquery){jquery=jquery.replace(new RegExp("\\$","g"),"\\$");jquery=jquery.replace(new RegExp("\~","g"),"\\~");jquery=jquery.replace(new RegExp("\\[","g"),"\\[");jquery=jquery.replace(new RegExp("\\]","g"),"\\]");jquery=jquery.replace(new RegExp("\\|","g"),"\\|");jquery=jquery.replace(new RegExp("\\.","g"),"\\.");jquery=jquery.replace(new RegExp("#","g"),"\\#");return jquery;};}}
onReadyRateIt(function(){doRateIt();});

View File

@ -1,11 +1,11 @@
<?php
// Add the colorbox style sheet
// Add the colorbox style sheet and javascript
$GLOBALS['TL_CSS'][] = 'assets/jquery/colorbox/'. COLORBOX .'/css/colorbox.min.css||static';
$GLOBALS['TL_JAVASCRIPT'][] = 'system/modules/rateit/public/js/jquery/colorbox/colorbox-rateit.min.js|static';
?>
<script src="system/modules/rateit/public/js/jquery/colorbox/colorbox-rateit.min.js"></script>
<script>
(function($) {
$(document).ready(function() {

View File

@ -1,11 +1,11 @@
<?php
// Add the colorbox style sheet
// Add the colorbox style sheet and javascript
$GLOBALS['TL_CSS'][] = 'assets/jquery/colorbox/'. COLORBOX .'/css/colorbox.min.css||static';
$GLOBALS['TL_JAVASCRIPT'][] = 'system/modules/rateit/public/js/jquery/colorbox/colorbox-rateit.min.js|static';
?>
<script type="text/javascript" src="system/modules/rateit/public/js/jquery/colorbox/colorbox-rateit.min.js"></script>
<script type="text/javascript">
/* <![CDATA[ */
(function($) {

View File

@ -1,11 +1,11 @@
<?php
// Add the mediabox style sheet
// Add the mediabox style sheet and javascript
$GLOBALS['TL_CSS'][] = 'assets/mootools/mediabox/'. MEDIABOX .'/css/mediaboxAdvBlack21.css||static';
$GLOBALS['TL_JAVASCRIPT'][] = 'system/modules/rateit/public/js/mootools/mediabox/mediabox-rateit.js|static';
?>
<script src="system/modules/rateit/public/js/mootools/mediabox/mediabox-rateit.js"></script>
<script>
(function($) {
window.addEvent('domready', function() {

View File

@ -2,10 +2,10 @@
// Add the mediabox style sheet
$GLOBALS['TL_CSS'][] = 'assets/mootools/mediabox/'. MEDIABOX .'/css/mediaboxAdvBlack21.css||static';
$GLOBALS['TL_JAVASCRIPT'][] = 'system/modules/rateit/public/js/mootools/mediabox/mediabox-rateit.js|static';
?>
<script type="text/javascript" src="system/modules/rateit/public/js/mootools/mediabox/mediabox-rateit.js"></script>
<script type="text/javascript">
/* <![CDATA[ */
(function($) {