Difference between revisions of "MediaWiki:Common.js"

From MadaCamp
Jump to: navigation, search
Line 112: Line 112:
  
 
/* end rotaing banner */
 
/* end rotaing banner */
 
/* (c) 2008, 2009, 2010 Add This, LLC */
 
if(!window._ate){var _atd="www.addthis.com/",_atr="//s7.addthis.com/",_atn="//l.addthiscdn.com/",_euc=encodeURIComponent,_duc=decodeURIComponent,_atc={dr:0,ver:250,loc:0,enote:"",cwait:500,tamp:0.5,xamp:0,camp:1,vamp:1,famp:0.02,pamp:0.2,damp:1,abf:!!window.addthis_do_ab,unt:1};(function(){var F;try{F=window.location;if(F.protocol.indexOf("file")===0||F.protocol.indexOf("safari-extension")===0||F.protocol.indexOf("chrome-extension")===0){_atr="http:"+_atr}if(F.hostname.indexOf("localhost")!=-1){_atc.loc=1}}catch(L){}var J=navigator.userAgent.toLowerCase(),M=document,t=window,H=M.location,O={win:/windows/.test(J),xp:/windows nt 5.1/.test(J)||/windows nt 5.2/.test(J),osx:/os x/.test(J),chr:/chrome/.test(J),iph:/iphone/.test(J),ipa:/ipad/.test(J),saf:/safari/.test(J),web:/webkit/.test(J),opr:/opera/.test(J),msi:(/msie/.test(J))&&!(/opera/.test(J)),ffx:/firefox/.test(J),ff2:/firefox\/2/.test(J),ie6:/msie 6.0/.test(J),ie7:/msie 7.0/.test(J),mod:-1},f={vst:[],rev:"80002",bro:O,wlp:(F||{}).protocol,show:1,dl:H,upm:!!t.postMessage&&(""+t.postMessage).toLowerCase().indexOf("[native code]")!==-1,camp:_atc.camp-Math.random(),xamp:_atc.xamp-Math.random(),vamp:_atc.vamp-Math.random(),tamp:_atc.tamp-Math.random(),pamp:_atc.pamp-Math.random(),ab:"-",seq:1,inst:1,wait:500,tmo:null,cvt:[],avt:null,sttm:new Date().getTime(),max:4294967295,sid:0,sub:!!window.at_sub,dbm:0,uid:null,spt:"static/r07/widget22.png",api:{},imgz:[],hash:window.location.hash};M.ce=M.createElement;M.gn=M.getElementsByTagName;window._ate=f;var u=function(r,p,q,d){if(!r){return q}if(r instanceof Array||(r.length&&(typeof r!=="function"))){for(var l=0,a=r.length,b=r[0];l<a;b=r[++l]){q=p.call(d||r,q,b,l,r)}}else{for(var e in r){q=p.call(d||r,q,r[e],e,r)}}return q},A=Array.prototype.slice,C=function(b){return A.apply(b,A.call(arguments,1))},B=function(a){return(""+a).replace(/(^\s+|\s+$)/g,"")},K=function(a,b){return u(C(arguments,1),function(e,d){return u(d,function(p,l,i){if(p){p[i]=l}return p},e)},a)},m=function(b,a){return u(b,function(i,e,d){d=B(d);if(d){i.push(_euc(d)+"="+_euc(B(e)))}return i},[]).join(a||"&")},j=function(b,a){return u((b||"").split(a||"&"),function(p,r){try{var l=r.split("="),i=B(_duc(l[0])),d=B(_duc(l.slice(1).join("=")));if(i){p[i]=d}}catch(q){}return p},{})},Q=function(){var a=C(arguments,0),d=a.shift(),b=a.shift();return function(){return d.apply(b,a.concat(C(arguments,0)))}},G=function(b,e,a,d){if(!e){return}if(we){e[(b?"detach":"attach")+"Event"]("on"+a,d)}else{e[(b?"remove":"add")+"EventListener"](a,d,false)}},k=function(d,a,b){G(0,d,a,b)},g=function(d,a,b){G(1,d,a,b)},c={reduce:u,slice:C,strip:B,extend:K,toKV:m,fromKV:j,bind:Q,listen:k,unlisten:g};f.util=c;K(f,c);(function(r,w,R){var p,T=r.util;function s(W,V,Y,U,X){this.type=W;this.triggerType=V||W;this.target=Y||U;this.triggerTarget=U||Y;this.data=X||{}}T.extend(s.prototype,{constructor:s,bubbles:false,preventDefault:T.noop,stopPropagation:T.noop,clone:function(){return new this.constructor(this.type,this.triggerType,this.target,this.triggerTarget,T.extend({},this.data))}});function i(U,V){this.target=U;this.queues={};this.defaultEventType=V||s}function a(U){var V=this.queues;if(!V[U]){V[U]=[]}return V[U]}function q(U,V){this.getQueue(U).push(V)}function e(V,W){var X=this.getQueue(V),U=X.indexOf(W);if(U!==-1){X.splice(U,1)}}function b(U,Y,X,W){var V=this;if(!W){setTimeout(function(){V.dispatchEvent(new V.defaultEventType(U,U,Y,V.target,X))},10)}else{V.dispatchEvent(new V.defaultEventType(U,U,Y,V.target,X))}}function S(V){for(var W=0,Y=V.target,X=this.getQueue(V.type),U=X.length;W<U;W++){X[W].call(Y,V.clone())}}function d(V){if(!V){return}for(var U in l){V[U]=T.bind(l[U],this)}return V}var l={constructor:i,getQueue:a,addEventListener:q,removeEventListener:e,dispatchEvent:S,fire:b,decorate:d};T.extend(i.prototype,l);r.event={PolyEvent:s,EventDispatcher:i}})(f,f.api,f);f.ed=new f.event.EventDispatcher(f);var n={isBound:0,isReady:0,readyList:[],onReady:function(){if(!n.isReady){n.isReady=1;var a=n.readyList.concat(window.addthis_onload||[]);for(var b=
 

Revision as of 14:32, 28 August 2010

/* Any JavaScript here will be loaded for all users on every page load. */

var RecaptchaOptions = {
    theme : 'white'
 };


/* start rotating banner */
/* Banner 147x85 */
/* Add image and URL in array and upload/protect image and preload
   (first letter or image name must be capitalised) */

/* define the images directory including trailing slash */
var madacamp_banner_dir = '/images/madagascar/';

/* The arrays with images and their corresponding URLs */

var madacamp_banners = new Array("Anakao_banner.jpg",
                        "Baobab_Avenue_banner.png",
                        "Sakalava_Bay_banner.jpg",
                        "Morondava_banner.jpg");
 
var madacamp_links = new Array("/Anakao",
                             "/Baobab_Avenue",
                             "/Sakalava_Bay",
                             "/Morondava");

function start_animation(){
setTimeout('madacamp_blender()',15000); /* 15 second */
}

madacamp_banner0 = new Image(147,85);
madacamp_banner0.src = madacamp_banner_dir + "Anakao_banner.jpg";

madacamp_banner1 = new Image(147,85);
madacamp_banner1.src = madacamp_banner_dir + "Baobab_Avenue_banner.png";

madacamp_banner2 = new Image(147,85);
madacamp_banner2.src = madacamp_banner_dir +"Sakalava_Bay_banner.jpg";

madacamp_banner3 = new Image(147,85);
madacamp_banner3.src = madacamp_banner_dir +"Morondava_banner.jpg";


function madacamp_swap(){
opacity = 0;
IE_opacity = 0;

if (navigator.appVersion.indexOf("MSIE") != -1){
document.getElementById("blendinger").style.filter = "alpha(opacity=0)";
interval = setInterval("blendinger_IE()",50)

}
else {
document.getElementById("blendinger").style.opacity=0;
interval = setInterval("blendinger_opacity()",50)
}
}

function blendinger_IE(){
if (IE_opacity < 100){
IE_opacity = IE_opacity +4;
document.getElementById("blendinger").style.filter = "alpha(opacity="+IE_opacity+")";

}

else{
clearInterval(interval);
IE_count = 0;
}
}

function blendinger_opacity(){
 
if (opacity < 1){
opacity = (Math.floor(opacity * 100) +4) / 100;
document.getElementById("blendinger").style.opacity=opacity;

}
else{
clearInterval(interval);

}
}

var madacamp_array_index = madacamp_links.length -1;
var first_madacamp_index = Math.round(madacamp_array_index * Math.random())

var madacamp_cycle = first_madacamp_index;
var madacamp_total = madacamp_banners.length -1;
var madacamp_link = madacamp_links[madacamp_cycle]; /* initially the first */

function madacamp_blender(){

/* first set current image as background */

document.getElementById('background_image').style.backgroundImage='url('+madacamp_banner_dir+madacamp_banners[madacamp_cycle]+')';

madacamp_cycle++;

if (madacamp_cycle == madacamp_banners.length){
madacamp_cycle = 0;
}
 
madacamp_swap();

setTimeout("document.images.madacamp_animation.src=madacamp_banner_dir + madacamp_banners[madacamp_cycle];",10)
               
madacamp_link = madacamp_links[madacamp_cycle] /* update link values */
 
}

/* end rotaing banner */