Umzug zu gitlab

This commit is contained in:
2017-01-27 13:01:29 +01:00
commit a832e33012
119 changed files with 15109 additions and 0 deletions

View File

@ -0,0 +1,22 @@
var RateItBackend =
{
/**
* Add the interactive help
*/
addInteractiveHelp: function() {
// Links and input elements
['div.statisticsbar[title]'].each(function(el) {
new Tips.Contao($$(el).filter(function(i) {
return i.title != '';
}), {
offset: {x:0, y:26}
});
});
}
};
//Initialize the back end script
window.addEvent('domready', function() {
RateItBackend.addInteractiveHelp();
});

114
public/js/helper.js Normal file
View File

@ -0,0 +1,114 @@
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 };
}

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};}

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,80 @@
(function($,document,window){var
defaults={html:false,photo:false,iframe:false,inline:false,transition:"elastic",speed:300,fadeOut:300,width:false,initialWidth:"600",innerWidth:false,maxWidth:false,height:false,initialHeight:"450",innerHeight:false,maxHeight:false,scalePhotos:true,scrolling:true,opacity:0.9,preloading:true,className:false,overlayClose:true,escKey:true,arrowKey:true,top:false,bottom:false,left:false,right:false,fixed:false,data:undefined,closeButton:true,fastIframe:true,open:false,reposition:true,loop:true,slideshow:false,slideshowAuto:true,slideshowSpeed:2500,slideshowStart:"start slideshow",slideshowStop:"stop slideshow",photoRegex:/\.(gif|png|jp(e|g|eg)|bmp|ico|webp|jxr|svg)((#|\?).*)?$/i,retinaImage:false,retinaUrl:false,retinaSuffix:'@2x.$1',current:"image {current} of {total}",previous:"previous",next:"next",close:"close",xhrError:"This content failed to load.",imgError:"This image failed to load.",returnFocus:true,trapFocus:true,onOpen:false,onLoad:false,onComplete:false,onCleanup:false,onClosed:false,rel:function(){return this.rel;},href:function(){return $(this).attr('href');},title:function(){return this.title;},createImg:function(){var img=new Image();var attrs=$(this).data('cbox-img-attrs');if(typeof attrs==='object'){$.each(attrs,function(key,val){img[key]=val;});}
return img;},createIframe:function(){var iframe=document.createElement('iframe');var attrs=$(this).data('cbox-iframe-attrs');if(typeof attrs==='object'){$.each(attrs,function(key,val){iframe[key]=val;});}
if('frameBorder'in iframe){iframe.frameBorder=0;}
if('allowTransparency'in iframe){iframe.allowTransparency="true";}
iframe.name=(new Date()).getTime();iframe.allowFullScreen=true;return iframe;}},colorbox='colorbox',prefix='cbox',boxElement=prefix+'Element',event_open=prefix+'_open',event_load=prefix+'_load',event_complete=prefix+'_complete',event_cleanup=prefix+'_cleanup',event_closed=prefix+'_closed',event_purge=prefix+'_purge',$overlay,$box,$wrap,$content,$topBorder,$leftBorder,$rightBorder,$bottomBorder,$related,$window,$loaded,$loadingBay,$loadingOverlay,$title,$current,$slideshow,$next,$prev,$close,$rating,$ratingWrapper,$ratingSelected,$ratingHover,$ratingDescription,$groupControls,$events=$('<a/>'),settings,interfaceHeight,interfaceWidth,loadedHeight,loadedWidth,index,photo,open,active,closing,loadingTimer,publicMethod,div="div",requests=0,previousCSS={},init;function $tag(tag,id,css){var element=document.createElement(tag);if(id){element.id=prefix+id;}
if(css){element.style.cssText=css;}
return $(element);}
function winheight(){return window.innerHeight?window.innerHeight:$(window).height();}
function Settings(element,options){if(options!==Object(options)){options={};}
this.cache={};this.el=element;this.value=function(key){var dataAttr;if(this.cache[key]===undefined){dataAttr=$(this.el).attr('data-cbox-'+key);if(dataAttr!==undefined){this.cache[key]=dataAttr;}else if(options[key]!==undefined){this.cache[key]=options[key];}else if(defaults[key]!==undefined){this.cache[key]=defaults[key];}}
return this.cache[key];};this.get=function(key){var value=this.value(key);return $.isFunction(value)?value.call(this.el,this):value;};}
function getIndex(increment){var
max=$related.length,newIndex=(index+increment)%max;return(newIndex<0)?max+newIndex:newIndex;}
function setSize(size,dimension){return Math.round((/%/.test(size)?((dimension==='x'?$window.width():winheight())/100):1)*parseInt(size,10));}
function isImage(settings,url){return settings.get('photo')||settings.get('photoRegex').test(url);}
function retinaUrl(settings,url){return settings.get('retinaUrl')&&window.devicePixelRatio>1?url.replace(settings.get('photoRegex'),settings.get('retinaSuffix')):url;}
function trapFocus(e){if('contains'in $box[0]&&!$box[0].contains(e.target)&&e.target!==$overlay[0]){e.stopPropagation();$box.focus();}}
function setClass(str){if(setClass.str!==str){$box.add($overlay).removeClass(setClass.str).addClass(str);setClass.str=str;}}
function getRelated(rel){index=0;if(rel&&rel!==false&&rel!=='nofollow'){$related=$('.'+boxElement).filter(function(){var options=$.data(this,colorbox);var settings=new Settings(this,options);return(settings.get('rel')===rel);});index=$related.index(settings.el);if(index===-1){$related=$related.add(settings.el);index=$related.length-1;}}else{$related=$(settings.el);}}
function trigger(event){$(document).trigger(event);$events.triggerHandler(event);}
var slideshow=(function(){var active,className=prefix+"Slideshow_",click="click."+prefix,timeOut;function clear(){clearTimeout(timeOut);}
function set(){if(settings.get('loop')||$related[index+1]){clear();timeOut=setTimeout(publicMethod.next,settings.get('slideshowSpeed'));}}
function start(){$slideshow.html(settings.get('slideshowStop')).unbind(click).one(click,stop);$events.bind(event_complete,set).bind(event_load,clear);$box.removeClass(className+"off").addClass(className+"on");}
function stop(){clear();$events.unbind(event_complete,set).unbind(event_load,clear);$slideshow.html(settings.get('slideshowStart')).unbind(click).one(click,function(){publicMethod.next();start();});$box.removeClass(className+"on").addClass(className+"off");}
function reset(){active=false;$slideshow.hide();clear();$events.unbind(event_complete,set).unbind(event_load,clear);$box.removeClass(className+"off "+className+"on");}
return function(){if(active){if(!settings.get('slideshow')){$events.unbind(event_cleanup,reset);reset();}}else{if(settings.get('slideshow')&&$related[1]){active=true;$events.one(event_cleanup,reset);if(settings.get('slideshowAuto')){start();}else{stop();}
$slideshow.show();}}};}());function launch(element){var options;if(!closing){options=$(element).data(colorbox);settings=new Settings(element,options);getRelated(settings.get('rel'));if(!open){open=active=true;setClass(settings.get('className'));$box.css({visibility:'hidden',display:'block',opacity:''});$loaded=$tag(div,'LoadedContent','width:0; height:0; overflow:hidden; visibility:hidden');$content.css({width:'',height:''}).append($loaded);interfaceHeight=$topBorder.height()+$bottomBorder.height()+$content.outerHeight(true)-$content.height();interfaceWidth=$leftBorder.width()+$rightBorder.width()+$content.outerWidth(true)-$content.width();loadedHeight=$loaded.outerHeight(true);loadedWidth=$loaded.outerWidth(true);var initialWidth=setSize(settings.get('initialWidth'),'x');var initialHeight=setSize(settings.get('initialHeight'),'y');var maxWidth=settings.get('maxWidth');var maxHeight=settings.get('maxHeight');settings.w=(maxWidth!==false?Math.min(initialWidth,setSize(maxWidth,'x')):initialWidth)-loadedWidth-interfaceWidth;settings.h=(maxHeight!==false?Math.min(initialHeight,setSize(maxHeight,'y')):initialHeight)-loadedHeight-interfaceHeight;$loaded.css({width:'',height:settings.h});publicMethod.position();trigger(event_open);settings.get('onOpen');$groupControls.add($title).hide();$box.focus();if(settings.get('trapFocus')){if(document.addEventListener){document.addEventListener('focus',trapFocus,true);$events.one(event_closed,function(){document.removeEventListener('focus',trapFocus,true);});}}
if(settings.get('returnFocus')){$events.one(event_closed,function(){$(settings.el).focus();});}}
var opacity=parseFloat(settings.get('opacity'));$overlay.css({opacity:opacity===opacity?opacity:'',cursor:settings.get('overlayClose')?'pointer':'',visibility:'visible'}).show();if(settings.get('closeButton')){$close.html(settings.get('close')).appendTo($content);}else{$close.appendTo('<div/>');}
load();}}
function appendHTML(){if(!$box){init=false;$window=$(window);$box=$tag(div).attr({id:colorbox,'class':$.support.opacity===false?prefix+'IE':'',role:'dialog',tabindex:'-1'}).hide();$overlay=$tag(div,"Overlay").hide();$loadingOverlay=$([$tag(div,"LoadingOverlay")[0],$tag(div,"LoadingGraphic")[0]]);$wrap=$tag(div,"Wrapper");$content=$tag(div,"Content").append($title=$tag(div,"Title"),$rating=$tag(div,"mbRating").attr({"class":"mbrateItRating"}).css({'bottom':'-20px','position':'absolute'}).append($ratingWrapper=$tag(div,"mbrateItRating").attr({"class":"wrapper"}).append($ratingSelected=$tag(div).attr({"class":"rateItRating-selected","display":"block"}),$ratingHover=$tag(div).attr({"class":"rateItRating-hover"})),$ratingDescription=$tag(div,"mbRatingDescription").attr({"class":"mbratingText ratingText"}).css({'margin-left':'10px'})),$current=$tag(div,"Current"),$prev=$('<button type="button"/>').attr({id:prefix+'Previous'}),$next=$('<button type="button"/>').attr({id:prefix+'Next'}),$slideshow=$tag('button',"Slideshow"),$loadingOverlay);$close=$('<button type="button"/>').attr({id:prefix+'Close'});$wrap.append($tag(div).append($tag(div,"TopLeft"),$topBorder=$tag(div,"TopCenter"),$tag(div,"TopRight")),$tag(div,false,'clear:left').append($leftBorder=$tag(div,"MiddleLeft"),$content,$rightBorder=$tag(div,"MiddleRight")),$tag(div,false,'clear:left').append($tag(div,"BottomLeft"),$bottomBorder=$tag(div,"BottomCenter"),$tag(div,"BottomRight"))).find('div div').css({'float':'left'});$loadingBay=$tag(div,false,'position:absolute; width:9999px; visibility:hidden; display:none; max-width:none;');$groupControls=$next.add($prev).add($current).add($slideshow);}
if(document.body&&!$box.parent().length){$(document.body).append($overlay,$box.append($wrap,$loadingBay));}}
function addBindings(){function clickHandler(e){if(!(e.which>1||e.shiftKey||e.altKey||e.metaKey||e.ctrlKey)){e.preventDefault();launch(this);}}
if($box){if(!init){init=true;$next.click(function(){publicMethod.next();});$prev.click(function(){publicMethod.prev();});$close.click(function(){publicMethod.close();});$overlay.click(function(){if(settings.get('overlayClose')){publicMethod.close();}});$(document).bind('keydown.'+prefix,function(e){var key=e.keyCode;if(open&&settings.get('escKey')&&key===27){e.preventDefault();publicMethod.close();}
if(open&&settings.get('arrowKey')&&$related[1]&&!e.altKey){if(key===37){e.preventDefault();$prev.click();}else if(key===39){e.preventDefault();$next.click();}}});if($.isFunction($.fn.on)){$(document).on('click.'+prefix,'.'+boxElement,clickHandler);}else{$('.'+boxElement).live('click.'+prefix,clickHandler);}}
return true;}
return false;}
if($[colorbox]){return;}
$(appendHTML);publicMethod=$.fn[colorbox]=$[colorbox]=function(options,callback){var settings;var $obj=this;options=options||{};if($.isFunction($obj)){$obj=$('<a/>');options.open=true;}
if(!$obj[0]){return $obj;}
appendHTML();if(addBindings()){if(callback){options.onComplete=callback;}
$obj.each(function(){var old=$.data(this,colorbox)||{};$.data(this,colorbox,$.extend(old,options));}).addClass(boxElement);settings=new Settings($obj[0],options);if(settings.get('open')){launch($obj[0]);}}
return $obj;};publicMethod.position=function(speed,loadedCallback){var
css,top=0,left=0,offset=$box.offset(),scrollTop,scrollLeft;$window.unbind('resize.'+prefix);$box.css({top:-9e4,left:-9e4});scrollTop=$window.scrollTop();scrollLeft=$window.scrollLeft();if(settings.get('fixed')){offset.top-=scrollTop;offset.left-=scrollLeft;$box.css({position:'fixed'});}else{top=scrollTop;left=scrollLeft;$box.css({position:'absolute'});}
if(settings.get('right')!==false){left+=Math.max($window.width()-settings.w-loadedWidth-interfaceWidth-setSize(settings.get('right'),'x'),0);}else if(settings.get('left')!==false){left+=setSize(settings.get('left'),'x');}else{left+=Math.round(Math.max($window.width()-settings.w-loadedWidth-interfaceWidth,0)/2);}
if(settings.get('bottom')!==false){top+=Math.max(winheight()-settings.h-loadedHeight-interfaceHeight-setSize(settings.get('bottom'),'y'),0);}else if(settings.get('top')!==false){top+=setSize(settings.get('top'),'y');}else{top+=Math.round(Math.max(winheight()-settings.h-loadedHeight-interfaceHeight,0)/2);}
$box.css({top:offset.top,left:offset.left,visibility:'visible'});$wrap[0].style.width=$wrap[0].style.height="9999px";function modalDimensions(){$topBorder[0].style.width=$bottomBorder[0].style.width=$content[0].style.width=(parseInt($box[0].style.width,10)-interfaceWidth)+'px';$content[0].style.height=$leftBorder[0].style.height=$rightBorder[0].style.height=(parseInt($box[0].style.height,10)-interfaceHeight)+'px';}
css={width:settings.w+loadedWidth+interfaceWidth,height:settings.h+loadedHeight+interfaceHeight,top:top,left:left};if(speed){var tempSpeed=0;$.each(css,function(i){if(css[i]!==previousCSS[i]){tempSpeed=speed;return;}});speed=tempSpeed;}
previousCSS=css;if(!speed){$box.css(css);}
$box.dequeue().animate(css,{duration:speed||0,complete:function(){modalDimensions();active=false;$wrap[0].style.width=(settings.w+loadedWidth+interfaceWidth)+"px";$wrap[0].style.height=(settings.h+loadedHeight+interfaceHeight)+"px";if(settings.get('reposition')){setTimeout(function(){$window.bind('resize.'+prefix,publicMethod.position);},1);}
if($.isFunction(loadedCallback)){loadedCallback();}},step:modalDimensions});};publicMethod.resize=function(options){var scrolltop;if(open){options=options||{};if(options.width){settings.w=setSize(options.width,'x')-loadedWidth-interfaceWidth;}
if(options.innerWidth){settings.w=setSize(options.innerWidth,'x');}
$loaded.css({width:settings.w});if(options.height){settings.h=setSize(options.height,'y')-loadedHeight-interfaceHeight;}
if(options.innerHeight){settings.h=setSize(options.innerHeight,'y');}
if(!options.innerHeight&&!options.height){scrolltop=$loaded.scrollTop();$loaded.css({height:"auto"});settings.h=$loaded.height();}
$loaded.css({height:settings.h});if(scrolltop){$loaded.scrollTop(scrolltop);}
publicMethod.position(settings.get('transition')==="none"?0:settings.get('speed'));}};publicMethod.prep=function(object){if(!open){return;}
var callback,speed=settings.get('transition')==="none"?0:settings.get('speed');$loaded.remove();$loaded=$tag(div,'LoadedContent').append(object);$rating.css('display','none');if(typeof arrRatings=='object'){for(var ri=0;ri<arrRatings.length;ri++){if(decodeURIComponent(object.src).endsWith(arrRatings[ri].URL)){$rating.css('display','block');if(arrRatings[ri].rated){$rating.attr('id','mb'+arrRatings[ri].rateItID);RateItRating.initMe($rating);$ratingWrapper.unbind();$ratingSelected.css('display','none');$ratingHover.css('width',arrRatings[ri].width);$ratingHover.css('display','block');$ratingDescription.text(arrRatings[ri].description);}else{$rating.attr('id','mb'+arrRatings[ri].rateItID);$ratingSelected.css('display','block');$ratingHover.css('display','none');$ratingDescription.text(arrRatings[ri].description);RateItRating.initMe($rating);}
break;}}}
function getWidth(){settings.w=settings.w||$loaded.width();settings.w=settings.mw&&settings.mw<settings.w?settings.mw:settings.w;return settings.w;}
function getHeight(){settings.h=settings.h||$loaded.height();settings.h=settings.mh&&settings.mh<settings.h?settings.mh:settings.h;return settings.h;}
$loaded.hide().appendTo($loadingBay.show()).css({width:getWidth(),overflow:settings.get('scrolling')?'auto':'hidden'}).css({height:getHeight()}).prependTo($content);$loadingBay.hide();$(photo).css({'float':'none'});setClass(settings.get('className'));callback=function(){var total=$related.length,iframe,complete;if(!open){return;}
function removeFilter(){if($.support.opacity===false){$box[0].style.removeAttribute('filter');}}
complete=function(){clearTimeout(loadingTimer);$loadingOverlay.hide();trigger(event_complete);settings.get('onComplete');};$title.html(settings.get('title')).show();$loaded.show();if(total>1){if(typeof settings.get('current')==="string"){$current.html(settings.get('current').replace('{current}',index+1).replace('{total}',total)).show();}
$next[(settings.get('loop')||index<total-1)?"show":"hide"]().html(settings.get('next'));$prev[(settings.get('loop')||index)?"show":"hide"]().html(settings.get('previous'));slideshow();if(settings.get('preloading')){$.each([getIndex(-1),getIndex(1)],function(){var img,i=$related[this],settings=new Settings(i,$.data(i,colorbox)),src=settings.get('href');if(src&&isImage(settings,src)){src=retinaUrl(settings,src);img=document.createElement('img');img.src=src;}});}}else{$groupControls.hide();}
if(settings.get('iframe')){iframe=settings.get('createIframe');if(!settings.get('scrolling')){iframe.scrolling="no";}
$(iframe).attr({src:settings.get('href'),'class':prefix+'Iframe'}).one('load',complete).appendTo($loaded);$events.one(event_purge,function(){iframe.src="//about:blank";});if(settings.get('fastIframe')){$(iframe).trigger('load');}}else{complete();}
if(settings.get('transition')==='fade'){$box.fadeTo(speed,1,removeFilter);}else{removeFilter();}};if(settings.get('transition')==='fade'){$box.fadeTo(speed,0,function(){publicMethod.position(0,callback);});}else{publicMethod.position(speed,callback);}};function load(){var href,setResize,prep=publicMethod.prep,$inline,request=++requests;active=true;photo=false;trigger(event_purge);trigger(event_load);settings.get('onLoad');settings.h=settings.get('height')?setSize(settings.get('height'),'y')-loadedHeight-interfaceHeight:settings.get('innerHeight')&&setSize(settings.get('innerHeight'),'y');settings.w=settings.get('width')?setSize(settings.get('width'),'x')-loadedWidth-interfaceWidth:settings.get('innerWidth')&&setSize(settings.get('innerWidth'),'x');settings.mw=settings.w;settings.mh=settings.h;if(settings.get('maxWidth')){settings.mw=setSize(settings.get('maxWidth'),'x')-loadedWidth-interfaceWidth;settings.mw=settings.w&&settings.w<settings.mw?settings.w:settings.mw;}
if(settings.get('maxHeight')){settings.mh=setSize(settings.get('maxHeight'),'y')-loadedHeight-interfaceHeight;settings.mh=settings.h&&settings.h<settings.mh?settings.h:settings.mh;}
href=settings.get('href');loadingTimer=setTimeout(function(){$loadingOverlay.show();},100);if(settings.get('inline')){var $target=$(href);$inline=$('<div>').hide().insertBefore($target);$events.one(event_purge,function(){$inline.replaceWith($target);});prep($target);}else if(settings.get('iframe')){prep(" ");}else if(settings.get('html')){prep(settings.get('html'));}else if(isImage(settings,href)){href=retinaUrl(settings,href);photo=settings.get('createImg');$(photo).addClass(prefix+'Photo').bind('error.'+prefix,function(){prep($tag(div,'Error').html(settings.get('imgError')));}).one('load',function(){if(request!==requests){return;}
setTimeout(function(){var percent;if(settings.get('retinaImage')&&window.devicePixelRatio>1){photo.height=photo.height/window.devicePixelRatio;photo.width=photo.width/window.devicePixelRatio;}
if(settings.get('scalePhotos')){setResize=function(){photo.height-=photo.height*percent;photo.width-=photo.width*percent;};if(settings.mw&&photo.width>settings.mw){percent=(photo.width-settings.mw)/photo.width;setResize();}
if(settings.mh&&photo.height>settings.mh){percent=(photo.height-settings.mh)/photo.height;setResize();}}
if(settings.h){photo.style.marginTop=Math.max(settings.mh-photo.height,0)/2+'px';}
if($related[1]&&(settings.get('loop')||$related[index+1])){photo.style.cursor='pointer';$(photo).bind('click.'+prefix,function(){publicMethod.next();});}
photo.style.width=photo.width+'px';photo.style.height=photo.height+'px';prep(photo);},1);});photo.src=href;}else if(href){$loadingBay.load(href,settings.get('data'),function(data,status){if(request===requests){prep(status==='error'?$tag(div,'Error').html(settings.get('xhrError')):$(this).contents());}});}}
publicMethod.next=function(){if(!active&&$related[1]&&(settings.get('loop')||$related[index+1])){index=getIndex(1);launch($related[index]);}};publicMethod.prev=function(){if(!active&&$related[1]&&(settings.get('loop')||index)){index=getIndex(-1);launch($related[index]);}};publicMethod.close=function(){if(open&&!closing){closing=true;open=false;trigger(event_cleanup);settings.get('onCleanup');$window.unbind('.'+prefix);$overlay.fadeTo(settings.get('fadeOut')||0,0);$box.stop().fadeTo(settings.get('fadeOut')||0,0,function(){$box.hide();$overlay.hide();trigger(event_purge);$loaded.remove();setTimeout(function(){closing=false;trigger(event_closed);settings.get('onClosed');},1);});}};publicMethod.remove=function(){if(!$box){return;}
$box.stop();$[colorbox].close();$box.stop(false,true).remove();$overlay.remove();closing=false;$box=null;$('.'+boxElement).removeData(colorbox).removeClass(boxElement);$(document).unbind('click.'+prefix).unbind('keydown.'+prefix);};publicMethod.element=function(){return $(settings.el);};publicMethod.settings=defaults;}(jQuery,document,window));

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,75 @@
var readyListRateIt = [];
function onReadyRateIt(handler) {
function executeHandlers() {
for ( var i = 0; i < readyListRateIt.length; i++) {
readyListRateIt[i]();
}
}
if (!readyListRateIt.length) { // set handler on first run
bindReady(executeHandlers);
}
readyListRateIt.push(handler);
}
function bindReady(handler) {
var called = false;
function ready() {
if (called)
return
called = true;
handler();
}
if (document.addEventListener) { // native event
document.addEventListener("DOMContentLoaded", ready, false);
} else if (document.attachEvent) { // IE
try {
var isFrame = window.frameElement != null;
} catch (e) {
}
// IE, the document is not inside a frame
if (document.documentElement.doScroll && !isFrame) {
function tryScroll() {
if (called)
return;
try {
document.documentElement.doScroll("left");
ready();
} catch (e) {
setTimeout(tryScroll, 10);
}
}
tryScroll();
}
// IE, the document is inside a frame
document.attachEvent("onreadystatechange", function() {
if (document.readyState === "complete") {
ready();
}
});
}
// Old browsers
if (window.addEventListener)
window.addEventListener('load', ready, false);
else if (window.attachEvent)
window.attachEvent('onload', ready);
else {
var fn = window.onload; // very old browser, copy old onload
window.onload = function() { // replace by new onload and call the
// old one
fn && fn();
ready();
};
}
}

View File

@ -0,0 +1 @@
function onReadyRateIt(e){function t(){for(var e=0;e<readyListRateIt.length;e++){readyListRateIt[e]()}}if(!readyListRateIt.length){bindReady(t)}readyListRateIt.push(e)}function bindReady(e){function n(){if(t)return;t=true;e()}var t=false;if(document.addEventListener){document.addEventListener("DOMContentLoaded",n,false)}else if(document.attachEvent){try{var r=window.frameElement!=null}catch(i){}if(document.documentElement.doScroll&&!r){function s(){if(t)return;try{document.documentElement.doScroll("left");n()}catch(e){setTimeout(s,10)}}s()}document.attachEvent("onreadystatechange",function(){if(document.readyState==="complete"){n()}})}if(window.addEventListener)window.addEventListener("load",n,false);else if(window.attachEvent)window.attachEvent("onload",n);else{var o=window.onload;window.onload=function(){o&&o();n()}}}var readyListRateIt=[]

View File

@ -0,0 +1,600 @@
var RateItRating;
function doRateIt() {
if (window.MooTools) {
var RateItRatings = new Class({
Implements: Options,
options: {
step: 0.1, /* Schrittweite */
readonly: false, /* Bewertungen zulassen */
resetable: false /* Nicht zurücksetzbar */
},
initialize: function(options) {
this.setOptions(options);
$$('.rateItRating').each(function(el) {
this.initMe(el);
}.bind(this));
},
initMe: function(el) {
//Does this if the browser is NOT IE6. IE6 users don't deserve fancy ratings. >:(
if (!Browser.ie || Browser.version > 6) {
el.id = el.getAttribute('id');
el.rateable = el.getAttribute('rel') == 'not-rateable' ? false : true;
el.wrapper = el.getElement('.wrapper');
el.textEl = el.getElement('.ratingText');
el.selected = el.wrapper.getElement('.rateItRating-selected');
el.hover = el.wrapper.getElement('.rateItRating-hover');
el.widthFx = new Fx.Tween(el.selected, {property:'width', link:'chain'});
var backgroundImage = this.getBackgroundImage(el.wrapper);
this.options.starwidth = backgroundImage.width;
this.options.starheight = backgroundImage.height / 3; // da immer drei Sterne "übereinander" gebraucht werden
if (this.options.starwidth === undefined || this.options.starwidth < 16) {
this.options.starwidth = 16;
}
if (this.options.starheight === undefined || this.options.starheight < 16) {
this.options.starheight = 16;
}
this.setBackgroundPosition(el.selected, -1 * this.options.starheight);
this.setBackgroundPosition(el.hover, -1 * 2 * this.options.starheight);
el.starPercent = this.getStarPercent(el.id);
el.ratableId = this.getRatableId(el.id);
el.ratableType = this.getRatableType(el.id);
// Maximalwert (=Anzahl Sterne) ermitteln
this.options.max = this.getRatableMaxValue(el.id);
// Höhe für selected und hover einstellen
el.selected.setStyle('height', this.options.starheight);
el.hover.setStyle('height', this.options.starheight);
// Wrapper-Größe so anpassen, dass alle Sterne angezeigt werden
el.wrapper.setStyle('width', this.options.starwidth * this.options.max);
el.wrapper.setStyle('height', this.options.starheight);
// Breite des rateItRating-selected divs setzen
this.fillVote(el.starPercent, el);
// Breite f<>r rateItRating-selected div ermitteln
el.currentFill = this.getFillPercent(el.starPercent);
if (el.rateable) {
el.mouseCrap = function(e) {
var fill = e.event.layerX;
if (!fill) {
fill = e.event.offsetX;
}
var fillPercent = this.getVotePercent(fill);
var nextStep = Math.ceil((fillPercent / 100) * this.options.max);
var w = nextStep * this.options.starwidth;
if (el.hover.getStyle('width').toInt() != w) {
el.selected.setStyle('display', 'none');
el.hover.setStyle('width', Math.min(w, this.options.starwidth * this.options.max));
el.hover.setStyle('display', 'block');
}
var newFill = nextStep / this.options.max * 100;
this.fillVote(newFill, el);
}.bind(this);
el.wrapper.addEvent('mouseenter', function(e) {
el.wrapper.addEvent('mousemove', el.mouseCrap);
});
el.wrapper.addEvent('mouseleave', function(e) {
el.removeEvent('mousemove');
el.hover.setStyle('width', 0);
el.hover.setStyle('display', 'none');
el.selected.setStyle('display', 'block');
el.widthFx.start(el.currentFill);
});
el.wrapper.addEvent('click', function(e) {
el.currentFill = el.newFill;
el.wrapper.removeEvents();
el.textEl.oldTxt = el.textEl.get('text');
el.textEl.set('html', '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;');
el.textEl.addClass('loading');
// falls aus LightBox, entsprechendes ursprüngliches Rating aktualisieren
if (typeof($('.mbrateItRating')) != 'undefined' && el.id.indexOf('mb') == 0) {
var mbid = el.id;
mbid = mbid.replace('mb', '');
if (typeof(arrRatings) == 'object') {
for (var ri = 0; ri < arrRatings.length; ri++) {
if (arrRatings[ri].rateItID == mbid) {
arrRatings[ri].rated = true;
arrRatings[ri].width = el.hover.getStyle('width');
break;
}
}
}
if (typeof($(mbid)) != 'undefined') {
var origWrapper = $(mbid).getElement('.wrapper');
origWrapper.removeEvents();
origWrapper.getElement('.rateItRating-selected').setStyle('display', 'none');
origWrapper.getElement('.rateItRating-hover').setStyle('width', el.hover.getStyle('width'));
origWrapper.getElement('.rateItRating-hover').setStyle('display', 'block');
}
} else {
if (typeof(arrRatings) == 'object') {
for (var ri = 0; ri < arrRatings.length; ri++) {
if (arrRatings[ri].rateItID == el.id) {
arrRatings[ri].rated = true;
arrRatings[ri].width = el.hover.getStyle('width');
break;
}
}
}
}
var votePercent = this.getVotePercent(el.newFill);
if (this.options.url != null) {
new Request({
url:this.options.url,
onComplete:el.updateText
})
.post({vote:votePercent,id:el.ratableId,type:el.ratableType});
}
}.bind(this));
el.updateText = function(text) {
error = text.split('ERROR:')[1];
el.textEl.removeClass('loading');
if (error) { el.showError(error); return false; }
el.textEl.set('text', text);
// falls aus LightBox, entsprechendes ursprüngliches Rating aktualisieren
if (typeof($('.mbrateItRating')) != 'undefined' && el.id.indexOf('mb') == 0) {
var mbid = el.getAttribute('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($(mbid)) != 'undefined') {
$(mbid).getElement('.ratingText').set('text', text);
}
} else {
if (typeof(arrRatings) == 'object') {
for (var ri = 0; ri < arrRatings.length; ri++) {
if (arrRatings[ri].rateItID == el.id) {
arrRatings[ri].description = text;
break;
}
}
}
}
};
}
el.showError = function(error) {
el.textEl.addClass('ratingError');
el.textEl.set('text', error);
(function() {
el.textEl.set('text', el.textEl.oldTxt);
el.textEl.removeClass('ratingError');
}).delay(2000);
};
} else {
//Replaces all the fancy with a text description of the votes for IE6.
//If you want IE6 users to have something fancier to look at, add it here.
el.getElement('.ratingText').inject(el, 'before');
el.remove();
}
},
fillVote: function(percent, el) {
el.newFill = this.getFillPercent(percent);
if (this.getVotePercent(el.newFill) > 100) { el.newFill = this.getFillPercent(100); }
el.selected.setStyle('width', el.newFill);
},
getStarPercent: function(id) {
/* Format = anyStringHere-<id>-<float(currentStars)>_(scale);
* Example: RateItRatings-5-3_5 //Primary key id = 5, 3/5 stars. */
var stars = id.match(/(\d*\|?\d*)-(page|article|ce|module|news|faq|galpic|news4ward)-(\d*\.?\d+)_(\d*\.?\d+)$/);
if (stars != null) {
var score = stars[3].toFloat();
var scale = stars[4].toFloat();
var percent = (score / scale) * 100;
return percent;
} else {
return 0;
}
},
// Ermittelt die Breite des rateItRating-selected divs
getFillPercent: function (starPercent) {
return (starPercent / 100) * (this.options.starwidth * this.options.max);
},
// Aus der Breite des rateItRating-selected divs die Prozentzahl ermitteln
getVotePercent: function(actVote) {
var starsWidth = this.options.starwidth * this.options.max;
var percent = (actVote / starsWidth * 100).round(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 ? stars[4].toInt() : 0;
},
setBackgroundPosition: function(el, pos) {
el.setStyle('background-position', '0% ' + pos + 'px');
},
getBackgroundImagePath: function(el) {
return el.getStyle('background-image');
},
getBackgroundImage: function(el) {
var reg_imgFile = /url\s*\(["']?(.*)["']?\)/i;
var dummy = document.createElement('img');
var string = this.getBackgroundImagePath(el);
string = string.match(reg_imgFile)[1];
string = string.replace('\"', '');
dummy.src = string;
return dummy;
}
});
window.addEvent('domready', function(e) {
RateItRating = new RateItRatings({url:'SimpleAjax.php?do=rateit'});
});
} else if (window.jQuery) {
// the rateit plugin as an Object
(function() {
RateItRatings = {
options: {
step: 0.1, /* Schrittweite */
readonly: false, /* Bewertungen zulassen */
resetable: false /* Nicht zurücksetzbar */
},
// this should be called first before doing anything else
initialize: function(options) {
if (typeof options == 'object' && typeof options['url'] != 'undefined')
this.options.url = options['url'];
var self = this;
jQuery('.rateItRating').each(function(i, element) {
self.initMe(element);
});
return this;
},
initMe: function(element) {
var self = this;
//Does this if the browser is NOT IE6. IE6 users don't deserve fancy ratings. >:(
if (!Browser.Engine.trident4) {
var el = jQuery(element);
el.data('id', el.attr('id'));
el.data('rateable', el.attr('rel') == 'not-rateable' ? false : true);
el.data('wrapper', el.find('.wrapper'));
el.data('textEl', el.find('.ratingText'));
// el.data('offset', getPosition(element).x);
el.data('selected', el.find('.rateItRating-selected'));
el.data('hover', el.find('.rateItRating-hover'));
jQuery.when(self.getBackgroundImage(el.data('wrapper'))).done(function(backgroundImageSize) {
self.options.starwidth = backgroundImageSize[0];
self.options.starheight = backgroundImageSize[1] / 3; // da immer drei Sterne "übereinander" gebraucht werden
});
if (self.options.starwidth === undefined || self.options.starwidth < 16) {
self.options.starwidth = 16;
}
if (self.options.starheight === undefined || self.options.starheight < 16) {
self.options.starheight = 16;
}
self.setBackgroundPosition(el.data('selected'), -1 * self.options.starheight);
self.setBackgroundPosition(el.data('hover'), -1 * 2 * self.options.starheight);
el.data('starPercent', self.getStarPercent(el.data('id')));
el.data('ratableId', self.getRatableId(el.data('id')));
el.data('ratableType', self.getRatableType(el.data('id')));
// Maximalwert (=Anzahl Sterne) ermitteln
self.options.max = self.getRatableMaxValue(el.data('id'));
// Höhe für selected und hover einstellen
el.data('selected').css('height', self.options.starheight);
el.data('hover').css('height', self.options.starheight);
// Wrapper-Größe so anpassen, dass alle Sterne angezeigt werden
el.data('wrapper').css('width', self.options.starwidth * self.options.max);
el.data('wrapper').css('height', self.options.starheight);
// Breite des rateItRating-selected divs setzen
self.fillVote(el.data('starPercent'), el);
// Breite für rateItRating-selected div ermitteln
el.data('currentFill', self.getFillPercent(el.data('starPercent')));
if (el.data('rateable')) {
el.data('wrapper').mouseenter(function(event) {
el.data('selected').hide(500, "easeInOutQuad");
el.data('hover').show();
el.data('wrapper').mousemove({'el': el, 'self': self}, self.mouseCrap);
});
el.data('wrapper').mouseleave(function(event) {
el.data('wrapper').unbind('mousemove');
el.data('hover').hide();
el.data('selected').show();
el.data('selected').animate({width: el.data('currentFill')}, 500);
});
el.data('wrapper').click(function(event) {
el.data('currentFill', el.data('newFill'));
el.data('wrapper').unbind();
el.data('oldTxt', el.data('textEl').text());
el.data('textEl').html('&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;');
el.data('textEl').addClass('loading');
// falls aus LightBox, entsprechendes ursprüngliches Rating aktualisieren
if (typeof(jQuery('.mbrateItRating')) != 'undefined' && el.data('id').indexOf('mb') == 0) {
var mbid = el.data('id');
mbid = mbid.replace('mb', '');
if (typeof(arrRatings) == 'object') {
for (var ri = 0; ri < arrRatings.length; ri++) {
if (arrRatings[ri].rateItID == mbid) {
arrRatings[ri].rated = true;
arrRatings[ri].width = el.data('hover').css('width');
break;
}
}
}
if (typeof(jQuery('#' + jEscape(mbid))) != 'undefined') {
var origWrapper = jQuery('#' + jEscape(mbid)).find('.wrapper');
origWrapper.unbind();
origWrapper.find('.rateItRating-selected').css('display', 'none');
origWrapper.find('.rateItRating-hover').css('width', el.data('hover').css('width'));
origWrapper.find('.rateItRating-hover').css('display', 'block');
}
} else {
if (typeof(arrRatings) == 'object') {
for (var ri = 0; ri < arrRatings.length; ri++) {
if (arrRatings[ri].rateItID == el.data('id')) {
arrRatings[ri].rated = true;
arrRatings[ri].width = el.data('hover').css('width');
break;
}
}
}
}
var votePercent = self.getVotePercent(el.data('newFill'));
if (self.options.url != null) {
jQuery.ajax({
url: self.options.url,
type: 'post',
data: {'vote': votePercent, 'id': el.data('ratableId'), 'type': el.data('ratableType')}
}).done(function(data) {
el.data('updateText')(el, data);
});
}
});
}
el.data('updateText', self.updateText);
} else {
alert("Ich bin ein IE6");
}
},
fillVote: function(percent, el) {
el.data('newFill', this.getFillPercent(percent));
if (this.getVotePercent(el.data('newFill')) > 100) { el.data('newFill', this.getFillPercent(100)); }
el.data('selected').css('width', el.data('newFill'));
},
mouseCrap: function(event) {
var el = event.data['el'];
var self = event.data['self'];
var fill = event.originalEvent.layerX;
if (!fill) {
fill = event.originalEvent.offsetX;
}
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) {
/* Format = anyStringHere-<id>-<float(currentStars)>_(scale);
* Example: RateItRatings-5-3_5 //Primary key id = 5, 3/5 stars. */
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;
}
},
// Ermittelt die Breite des rateItRating-selected divs
getFillPercent: function (starPercent) {
return (starPercent / 100) * (this.options.starwidth * this.options.max);
},
// Aus der Breite des rateItRating-selected divs die Prozentzahl ermitteln
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);
// falls aus LightBox, entsprechendes ursprüngliches Rating aktualisieren
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');
//oldTxt = el.data('textEl').text();
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?do=rateit'});
});
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();
});

24
public/js/rateit.js Normal file
View File

@ -0,0 +1,24 @@
var RateItRating;function doRateIt(){if(window.MooTools){var RateItRatings=new Class({Implements:Options,options:{step:0.1,readonly:false,resetable:false},initialize:function(options){this.setOptions(options);$$('.rateItRating').each(function(el){this.initMe(el);}.bind(this));},initMe:function(el){if(!Browser.ie||Browser.version>6){el.id=el.getAttribute('id');el.rateable=el.getAttribute('rel')=='not-rateable'?false:true;el.wrapper=el.getElement('.wrapper');el.textEl=el.getElement('.ratingText');el.selected=el.wrapper.getElement('.rateItRating-selected');el.hover=el.wrapper.getElement('.rateItRating-hover');el.widthFx=new Fx.Tween(el.selected,{property:'width',link:'chain'});var backgroundImage=this.getBackgroundImage(el.wrapper);this.options.starwidth=backgroundImage.width;this.options.starheight=backgroundImage.height/3;if(this.options.starwidth===undefined||this.options.starwidth<16){this.options.starwidth=16;}
if(this.options.starheight===undefined||this.options.starheight<16){this.options.starheight=16;}
this.setBackgroundPosition(el.selected,-1*this.options.starheight);this.setBackgroundPosition(el.hover,-1*2*this.options.starheight);el.starPercent=this.getStarPercent(el.id);el.ratableId=this.getRatableId(el.id);el.ratableType=this.getRatableType(el.id);this.options.max=this.getRatableMaxValue(el.id);el.selected.setStyle('height',this.options.starheight);el.hover.setStyle('height',this.options.starheight);el.wrapper.setStyle('width',this.options.starwidth*this.options.max);el.wrapper.setStyle('height',this.options.starheight);this.fillVote(el.starPercent,el);el.currentFill=this.getFillPercent(el.starPercent);if(el.rateable){el.mouseCrap=function(e){var fill=e.event.layerX;if(!fill){fill=e.event.offsetX;}
var fillPercent=this.getVotePercent(fill);var nextStep=Math.ceil((fillPercent/100)*this.options.max);var w=nextStep*this.options.starwidth;if(el.hover.getStyle('width').toInt()!=w){el.selected.setStyle('display','none');el.hover.setStyle('width',Math.min(w,this.options.starwidth*this.options.max));el.hover.setStyle('display','block');}
var newFill=nextStep/this.options.max*100;this.fillVote(newFill,el);}.bind(this);el.wrapper.addEvent('mouseenter',function(e){el.wrapper.addEvent('mousemove',el.mouseCrap);});el.wrapper.addEvent('mouseleave',function(e){el.removeEvent('mousemove');el.hover.setStyle('width',0);el.hover.setStyle('display','none');el.selected.setStyle('display','block');el.widthFx.start(el.currentFill);});el.wrapper.addEvent('click',function(e){el.currentFill=el.newFill;el.wrapper.removeEvents();el.textEl.oldTxt=el.textEl.get('text');el.textEl.set('html','&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;');el.textEl.addClass('loading');if(typeof($('.mbrateItRating'))!='undefined'&&el.id.indexOf('mb')==0){var mbid=el.id;mbid=mbid.replace('mb','');if(typeof(arrRatings)=='object'){for(var ri=0;ri<arrRatings.length;ri++){if(arrRatings[ri].rateItID==mbid){arrRatings[ri].rated=true;arrRatings[ri].width=el.hover.getStyle('width');break;}}}
if(typeof($(mbid))!='undefined'){var origWrapper=$(mbid).getElement('.wrapper');origWrapper.removeEvents();origWrapper.getElement('.rateItRating-selected').setStyle('display','none');origWrapper.getElement('.rateItRating-hover').setStyle('width',el.hover.getStyle('width'));origWrapper.getElement('.rateItRating-hover').setStyle('display','block');}}else{if(typeof(arrRatings)=='object'){for(var ri=0;ri<arrRatings.length;ri++){if(arrRatings[ri].rateItID==el.id){arrRatings[ri].rated=true;arrRatings[ri].width=el.hover.getStyle('width');break;}}}}
var votePercent=this.getVotePercent(el.newFill);if(this.options.url!=null){new Request({url:this.options.url,onComplete:el.updateText}).post({vote:votePercent,id:el.ratableId,type:el.ratableType});}}.bind(this));el.updateText=function(text){error=text.split('ERROR:')[1];el.textEl.removeClass('loading');if(error){el.showError(error);return false;}
el.textEl.set('text',text);if(typeof($('.mbrateItRating'))!='undefined'&&el.id.indexOf('mb')==0){var mbid=el.getAttribute('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($(mbid))!='undefined'){$(mbid).getElement('.ratingText').set('text',text);}}else{if(typeof(arrRatings)=='object'){for(var ri=0;ri<arrRatings.length;ri++){if(arrRatings[ri].rateItID==el.id){arrRatings[ri].description=text;break;}}}}};}
el.showError=function(error){el.textEl.addClass('ratingError');el.textEl.set('text',error);(function(){el.textEl.set('text',el.textEl.oldTxt);el.textEl.removeClass('ratingError');}).delay(2000);};}else{el.getElement('.ratingText').inject(el,'before');el.remove();}},fillVote:function(percent,el){el.newFill=this.getFillPercent(percent);if(this.getVotePercent(el.newFill)>100){el.newFill=this.getFillPercent(100);}
el.selected.setStyle('width',el.newFill);},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=stars[3].toFloat();var scale=stars[4].toFloat();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).round(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?stars[4].toInt():0;},setBackgroundPosition:function(el,pos){el.setStyle('background-position','0% '+pos+'px');},getBackgroundImagePath:function(el){return el.getStyle('background-image');},getBackgroundImage:function(el){var reg_imgFile=/url\s*\(["']?(.*)["']?\)/i;var dummy=document.createElement('img');var string=this.getBackgroundImagePath(el);string=string.match(reg_imgFile)[1];string=string.replace('\"','');dummy.src=string;return dummy;}});window.addEvent('domready',function(e){RateItRating=new RateItRatings({url:'SimpleAjax.php?do=rateit'});});}else if(window.jQuery){(function(){RateItRatings={options:{step:0.1,readonly:false,resetable:false},initialize:function(options){if(typeof options=='object'&&typeof options['url']!='undefined')
this.options.url=options['url'];var self=this;jQuery('.rateItRating').each(function(i,element){self.initMe(element);});return this;},initMe:function(element){var self=this;if(!Browser.Engine.trident4){var el=jQuery(element);el.data('id',el.attr('id'));el.data('rateable',el.attr('rel')=='not-rateable'?false:true);el.data('wrapper',el.find('.wrapper'));el.data('textEl',el.find('.ratingText'));el.data('selected',el.find('.rateItRating-selected'));el.data('hover',el.find('.rateItRating-hover'));jQuery.when(self.getBackgroundImage(el.data('wrapper'))).done(function(backgroundImageSize){self.options.starwidth=backgroundImageSize[0];self.options.starheight=backgroundImageSize[1]/3;});if(self.options.starwidth===undefined||self.options.starwidth<16){self.options.starwidth=16;}
if(self.options.starheight===undefined||self.options.starheight<16){self.options.starheight=16;}
self.setBackgroundPosition(el.data('selected'),-1*self.options.starheight);self.setBackgroundPosition(el.data('hover'),-1*2*self.options.starheight);el.data('starPercent',self.getStarPercent(el.data('id')));el.data('ratableId',self.getRatableId(el.data('id')));el.data('ratableType',self.getRatableType(el.data('id')));self.options.max=self.getRatableMaxValue(el.data('id'));el.data('selected').css('height',self.options.starheight);el.data('hover').css('height',self.options.starheight);el.data('wrapper').css('width',self.options.starwidth*self.options.max);el.data('wrapper').css('height',self.options.starheight);self.fillVote(el.data('starPercent'),el);el.data('currentFill',self.getFillPercent(el.data('starPercent')));if(el.data('rateable')){el.data('wrapper').mouseenter(function(event){el.data('selected').hide(500,"easeInOutQuad");el.data('hover').show();el.data('wrapper').mousemove({'el':el,'self':self},self.mouseCrap);});el.data('wrapper').mouseleave(function(event){el.data('wrapper').unbind('mousemove');el.data('hover').hide();el.data('selected').show();el.data('selected').animate({width:el.data('currentFill')},500);});el.data('wrapper').click(function(event){el.data('currentFill',el.data('newFill'));el.data('wrapper').unbind();el.data('oldTxt',el.data('textEl').text());el.data('textEl').html('&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;');el.data('textEl').addClass('loading');if(typeof(jQuery('.mbrateItRating'))!='undefined'&&el.data('id').indexOf('mb')==0){var mbid=el.data('id');mbid=mbid.replace('mb','');if(typeof(arrRatings)=='object'){for(var ri=0;ri<arrRatings.length;ri++){if(arrRatings[ri].rateItID==mbid){arrRatings[ri].rated=true;arrRatings[ri].width=el.data('hover').css('width');break;}}}
if(typeof(jQuery('#'+jEscape(mbid)))!='undefined'){var origWrapper=jQuery('#'+jEscape(mbid)).find('.wrapper');origWrapper.unbind();origWrapper.find('.rateItRating-selected').css('display','none');origWrapper.find('.rateItRating-hover').css('width',el.data('hover').css('width'));origWrapper.find('.rateItRating-hover').css('display','block');}}else{if(typeof(arrRatings)=='object'){for(var ri=0;ri<arrRatings.length;ri++){if(arrRatings[ri].rateItID==el.data('id')){arrRatings[ri].rated=true;arrRatings[ri].width=el.data('hover').css('width');break;}}}}
var votePercent=self.getVotePercent(el.data('newFill'));if(self.options.url!=null){jQuery.ajax({url:self.options.url,type:'post',data:{'vote':votePercent,'id':el.data('ratableId'),'type':el.data('ratableType')}}).done(function(data){el.data('updateText')(el,data);});}});}
el.data('updateText',self.updateText);}else{alert("Ich bin ein IE6");}},fillVote:function(percent,el){el.data('newFill',this.getFillPercent(percent));if(this.getVotePercent(el.data('newFill'))>100){el.data('newFill',this.getFillPercent(100));}
el.data('selected').css('width',el.data('newFill'));},mouseCrap:function(event){var el=event.data['el'];var self=event.data['self'];var fill=event.originalEvent.layerX;if(!fill){fill=event.originalEvent.offsetX;}
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.min.js",dataType:"script",async:false,cache:true});RateItRating=Object.create(RateItRatings).initialize({url:'SimpleAjax.php?do=rateit'});});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();});