Use this one instead http://clicrdv-assets.s3.amazonaws.com/lib/clicrdv-widgets-v1/clicrdv-widgets-min.js
Created
March 30, 2012 08:58
-
-
Save ArnaudD/2250051 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (function(j){if(!j.CLICRDV){j.CLICRDV={} | |
| }var c=j.CLICRDV,h=1,e=400,k=250,i=j.location.protocol+"//clicrdv-assets.s3.amazonaws.com/lib/clicrdv-widgets-v"+h+"/",f=(navigator.appName=="Microsoft Internet Explorer"&&/MSIE 6/.test(navigator.userAgent)),b=(navigator.userAgent||navigator.vendor||window.opera),m=(/android.+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(b)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|e\-|e\/|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(di|rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|xda(\-|2|g)|yas\-|your|zeto|zte\-/i.test(b.substr(0,4))),g=1,d,n; | |
| c.defaults={base_url:"https://www.clicrdv.com/",button_bg_color:"#2A6BA5",target:"_new",size:[600,450]}; | |
| c.events={listeners:[],addListener:function(q,o,p){if("addEventListener" in q){q.addEventListener(o,p,true) | |
| }else{if("attachEvent" in q){q.attachEvent("on"+o,function(r){if(!r){r=j.event | |
| }if(!r.preventDefault){r.preventDefault=function(){this.returnValue=false | |
| } | |
| }p.call(q,r) | |
| }); | |
| c.events.listeners.push([q,o,p]) | |
| }}},getFrameTarget:function(q){var r=document.getElementsByTagName("iframe"),p=0,o=r.length; | |
| for(; | |
| p<o; | |
| p++){if(r[p].contentWindow===q.source){return r[p] | |
| }}return null | |
| },purgeElement:function(q){if(window.detachEvent){var r=c.events.listeners; | |
| for(var p=0,o=r.length; | |
| p<o; | |
| p++){if(r[p][0]===q){try{q.detachEvent("on"+r[p][1],r[p][2]); | |
| delete r[p][2]; | |
| r.splice(p,1); | |
| o-- | |
| }catch(s){}}}}}}; | |
| c.oop={extend:function(p,o){p.prototype=this.inherit(o.prototype); | |
| p.prototype.constructor=p; | |
| p.superclass=o.prototype | |
| },inherit:function(p){function o(){}o.prototype=p; | |
| return new o() | |
| },clone:function(r){if(null===r||"object"!=typeof r){return r | |
| }var s; | |
| if(r instanceof Date){s=new Date(); | |
| s.setTime(r.getTime()) | |
| }else{if(r instanceof Array){s=[]; | |
| for(var q=0,p=r.length; | |
| q<p; | |
| ++q){s[q]=this.clone(r[q]) | |
| }}else{if(r instanceof Object){s={}; | |
| for(var o in r){if(r.hasOwnProperty(o)){s[o]=this.clone(r[o]) | |
| }}}else{throw new Error("Unable to clone obj.") | |
| }}}return s | |
| },merge:function(q,p){for(var o in p){if(p.hasOwnProperty(o)){q[o]=p[o] | |
| }}return q | |
| }}; | |
| d=function(o,p){var q=(this.options=c.oop.clone(c.defaults)); | |
| if(typeof o!=="string"){throw"groupUrl option missing or not a string in widget constructor" | |
| }if(p===undefined||p===null){p={} | |
| }if(!p instanceof Object){throw'"options" parameters in widget constructor should be an object' | |
| }p.group_url=o; | |
| c.oop.merge(q,p); | |
| if(!q.params||typeof q.params!=="object"){q.params={} | |
| }q.params.clicrdv_widget=h; | |
| c.style.apply(); | |
| this.id=g++ | |
| }; | |
| d.prototype.render=function(){}; | |
| d.prototype.getTargetURL=function(){var p=this.options,q=c.url.stringifyQueryString(p.params),o=/[\\?&]clicrdv_params=([^&#]*)/.exec(j.location.href); | |
| if(o!==null){q+="&"+decodeURIComponent(o[1]) | |
| }return p.base_url+p.group_url+"?"+q | |
| }; | |
| d.prototype.getContainer=function(q){var r=document,p=null; | |
| if(!q){var o="clicrdv-widget-container-"+this.id; | |
| r.write('<div id="'+o+'"></div>'); | |
| p=r.getElementById(o) | |
| }else{if(typeof q==="string"){p=r.getElementById(q) | |
| }else{p=q | |
| }}if(!p.appendChild){throw'could not find widget container "'+q+'"' | |
| }return p | |
| }; | |
| d.prototype.show=function(){if(this.el){this.el.style.display="" | |
| }}; | |
| d.prototype.hide=function(){if(this.el){this.el.style.display="none" | |
| }}; | |
| d.prototype.destroy=function(){if(this.el){c.events.purgeElement(this.el); | |
| this.el.parent.removeChild(this.el) | |
| }}; | |
| d.prototype.createIframe=function(){var p=j.document.createElement("iframe"),o=this.getTargetURL()+"&popin=1"; | |
| p.setAttribute("id","clicrdv-widget-iframe-"+this.id); | |
| p.setAttribute("src",o); | |
| p.setAttribute("width",this.options.size[0]); | |
| p.setAttribute("height",this.options.size[1]); | |
| p.setAttribute("frameBorder",0); | |
| p.setAttribute("allowTransparency","allowTransparency"); | |
| p.setAttribute("data-autoresize",this.options.autoresize===true?1:0); | |
| p.setAttribute("style","border: 0;"); | |
| return p | |
| }; | |
| function a(o,p){a.superclass.constructor.call(this,o,p) | |
| }c.oop.extend(a,d); | |
| a.prototype.render=function(p){var t=document,q=this.options,s,u,o; | |
| this.container=this.getContainer(p); | |
| u=t.createElement("span"); | |
| u.className="clicrdv-link-text"; | |
| u.innerHTML=(q.text||"Prendre RDV"); | |
| o=t.createElement("span"); | |
| o.className="clicrdv-link-mask"; | |
| s=t.createElement("a"); | |
| s.href=this.getTargetURL(); | |
| s.target=(m?"_new":q.target); | |
| s.className="clicrdv-widget-link "+(q.style?q.style:""); | |
| s.appendChild(u); | |
| s.appendChild(o); | |
| if(q.button_bg_color&&/^clicrdv-button-style/.test(q.style)){u.style.backgroundColor=q.button_bg_color; | |
| s.className+=" clicrdv-button-styled" | |
| }this.el=s; | |
| this.container.appendChild(s); | |
| if(!m&&q.target==="popin"){var r=this; | |
| this.options.autoresize=false; | |
| if(!this.options.params){this.options.params={} | |
| }this.options.params.nofooter=true; | |
| this.el.setAttribute("class",this.el.className+" clicrdv-widget-popin"); | |
| c.events.addListener(this.el,"click",function(v){r.openPopin(); | |
| v.preventDefault(); | |
| return false | |
| }) | |
| }}; | |
| a.prototype.openPopin=function(){c.modal.show(this.createIframe(),this.options.size) | |
| }; | |
| function l(o,p){l.superclass.constructor.call(this,o,p); | |
| this.options.autoresize=true | |
| }c.oop.extend(l,d); | |
| l.prototype.render=function(o){var q=j.document,p; | |
| this.container=this.getContainer(o); | |
| p=this.createIframe(); | |
| p.setAttribute("class","clicrdv-widget-iframe"); | |
| this.el=p; | |
| this.container.appendChild(p) | |
| }; | |
| c.widgets={Link:a,Iframe:l}; | |
| c.renderWidget=function(r,q,p){if(typeof r.toLowerCase==="function"){r=r.toLowerCase() | |
| }if(r!=="link"&&r!=="iframe"){r="link" | |
| }var o=new (c.widgets[r.substring(0,1).toUpperCase()+r.substring(1)])(q,p); | |
| o.render() | |
| }; | |
| c.url={stringifyQueryString:function(u,t){var o=typeof u==="object",q=(o&&Object.prototype.toString.call(u)=="[object Array]"),p=encodeURIComponent,v,r,s; | |
| if(o||q){v=[]; | |
| for(s in u){r=t?(t+"["+(o&&!q?s:"")+"]"):s; | |
| v.push(c.url.stringifyQueryString(u[s],r)) | |
| }return v.join("&") | |
| }if(typeof u==="boolean"||Object.prototype.toString.call(u)==="[object Boolean]"){u=+u | |
| }if(u===null||u===undefined||typeof u==="function"){u="" | |
| }return t?t+"="+p(u):"" | |
| }}; | |
| c.modal={mask:null,dialog:null,dialogSize:null,dialogContent:null,hide:function(){if(!this.mask||this.mask.style.display==="none"){return | |
| }this.mask.style.display="none"; | |
| this.dialog.style.display="none" | |
| },show:function(r,q){if(this.dialogContent===null){this.render() | |
| }var p=this.dialog,o=this.mask; | |
| r.style.width="100%"; | |
| r.style.height="100%"; | |
| r.removeAttribute("width"); | |
| r.removeAttribute("height"); | |
| this.dialogContent.innerHTML=""; | |
| this.dialogContent.appendChild(r); | |
| this.dialogSize=q; | |
| this.resize(); | |
| o.style.display="block"; | |
| p.style.display="block" | |
| },render:function(){var u=j.document,o,q,t,s,p; | |
| s=u.createElement("div"); | |
| s.className="clicrdv-widget-modal-dialog-content"; | |
| s.setAttribute("style","height: 100%; width: 100%;"); | |
| p=u.createElement("div"); | |
| p.className="clicrdv-widget-modal-dialog-footer"; | |
| p.innerHTML='<a href="http://www.clicrdv.com/prise-de-rendez-vous" target="_blank">Prise de rendez-vous</a> par internet et <a href="http://www.clicrdv.com/logiciel-agenda-partage" target="_blank">agenda partagé</a> fournis par <a href="http://www.clicrdv.com" target="_blank">ClicRDV</a>.'; | |
| t=u.createElement("a"); | |
| t.alt="Close"; | |
| t.innerHTML="fermer"; | |
| t.className="clicrdv-widget-modal-dialog-close"; | |
| c.events.addListener(t,"click",function(v){c.modal.hide(); | |
| v.preventDefault() | |
| }); | |
| q=u.createElement("div"); | |
| q.appendChild(t); | |
| q.appendChild(s); | |
| q.appendChild(p); | |
| q.className="clicrdv-widget-modal-dialog"; | |
| o=u.createElement("div"); | |
| o.className="clicrdv-modal-mask"; | |
| this.dialog=q; | |
| this.dialogContent=s; | |
| this.mask=o; | |
| u.body.appendChild(o); | |
| u.body.appendChild(q); | |
| c.style.apply(); | |
| var r=this; | |
| c.events.addListener(j,"resize",function(){r.resize() | |
| }) | |
| },resize:function(){var q=this.getViewportSize(),s=this.dialogSize[0],p=this.dialogSize[1],r=this.dialog,o=this.mask; | |
| if(s>q[0]-60){s=q[0]-60 | |
| }if(p>q[1]-80){p=q[1]-80 | |
| }s=Math.max(s,e); | |
| p=Math.max(p,k); | |
| r.style.width=s+"px"; | |
| r.style.height=p+"px"; | |
| if(f){r.style.setExpression("left","("+Math.floor((q[0]-s)/2)+" + ( ignoreMe2 = document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft ) ) + 'px'"); | |
| r.style.setExpression("top","("+Math.floor((q[1]-p)/2)+" + ( ignoreMe = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop ) ) + 'px'") | |
| }else{r.style.left=((q[0]-s)/2)-10+"px"; | |
| r.style.top=((q[1]-p)/2)-10+"px" | |
| }o.style.width=q[0]+"px"; | |
| o.style.height=q[1]+"px" | |
| },getViewportSize:function(){var p=900,o=670; | |
| if(document.body&&document.body.offsetWidth){p=document.body.offsetWidth; | |
| o=document.body.offsetHeight | |
| }if(document.compatMode==="CSS1Compat"&&document.documentElement&&document.documentElement.offsetWidth){p=document.documentElement.offsetWidth; | |
| o=document.documentElement.offsetHeight | |
| }if(window.innerWidth&&window.innerHeight){p=window.innerWidth; | |
| o=window.innerHeight | |
| }return[p,o] | |
| }}; | |
| c.style={applied:false,apply:function(){if(c.style.applied===true){return | |
| }c.style.applied=true; | |
| var q=j.document,o=q.getElementsByTagName("head")[0],p=q.createElement("style"),r=q.createTextNode(".clicrdv-modal-mask {filter: alpha(opacity=50); opacity: .5;position: fixed; top: 0; left: 0; z-index: 998;background-color: #000;}* html .clicrdv-modal-mask {position: absolute;left: expression( ( 0 + ( ignoreMe3 = document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft ) ) + 'px' );top: expression( ( 0 + ( ignoreMe4 = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop ) ) + 'px' );}.clicrdv-widget-modal-dialog {border-radius: 7px;-o-border-radius: 7px;-ms-border-radius: 7px;-moz-border-radius: 7px;-webkit-border-radius: 7px;border: 10px solid #555;border-color: rgba(0,0,0,.2);z-index: 999;position: "+(f?"absolute":"fixed")+";}.clicrdv-widget-modal-dialog-content {background-color: #555;background-color: rgba(0,0,0,.2);}.clicrdv-widget-modal-dialog-footer {position: absolute; bottom: -28px; right: 0px; width: 100%;font-family: Arial; font-size: 12px; text-align: center;text-shadow: 1px 0px 5px #000;color: #DDD;}.clicrdv-widget-modal-dialog-footer a {font-weight: normal;color: #EEE;}.clicrdv-widget-modal-dialog-footer a:hover {color: #FFF;}.clicrdv-widget-modal-dialog-content iframe {margin: 0;border-radius: 7px;-o-border-radius: 7px;-ms-border-radius: 7px;-moz-border-radius: 7px;-webkit-border-radius: 7px;}.clicrdv-widget-modal-dialog-close {display: block; width: 55px; height: 24px;position: absolute; right: -10px; top: -30px; cursor: pointer;background: transparent url("+i+"panel_close_button.png) no-repeat right 1px;font-family: Arial; font-size: 12px;color: #bbb; text-shadow: 1px 1px 1px rgba(0,0,0,.3);text-decoration: none;}.clicrdv-widget-modal-dialog-close:hover {color: #eee; text-shadow: 1px 1px 1px rgba(0,0,0,.5);}.clicrdv-button-styled {position: relative; cursor: pointer; display: -moz-inline-box; display: inline-block;}.clicrdv-button-styled .clicrdv-link-mask ,.clicrdv-button-styled .clicrdv-link-text {position: absolute; display: -moz-inline-box; display: inline-block;overflow: hidden; text-indent: -2000px;}.clicrdv-button-style1,.clicrdv-button-style1 .clicrdv-link-mask ,.clicrdv-button-style1 .clicrdv-link-text {width: 175px; height: 54px;}.clicrdv-button-style2,.clicrdv-button-style2 .clicrdv-link-mask ,.clicrdv-button-style2 .clicrdv-link-text {width: 179px; height: 72px;}.clicrdv-button-style3,.clicrdv-button-style3 .clicrdv-link-mask ,.clicrdv-button-style3 .clicrdv-link-text {width: 103px; height: 61px;}.clicrdv-button-style4,.clicrdv-button-style4 .clicrdv-link-mask ,.clicrdv-button-style4 .clicrdv-link-text {width: 140px; height: 36px;}.clicrdv-button-style5,.clicrdv-button-style5 .clicrdv-link-mask ,.clicrdv-button-style5 .clicrdv-link-text {width: 173px; height: 36px;}.clicrdv-button-style6,.clicrdv-button-style6 .clicrdv-link-mask ,.clicrdv-button-style6 .clicrdv-link-text {width: 135px; height: 36px;}.clicrdv-button-styled .clicrdv-link-mask {top: 0; left: 0;background-color: transparent; background-position: top left; background-repeat: no-repeat;}.clicrdv-button-style1 .clicrdv-link-mask {background-image: url("+i+"buttontransp1.png);}.clicrdv-button-style2 .clicrdv-link-mask {background-image: url("+i+"buttontransp2.png);}.clicrdv-button-style3 .clicrdv-link-mask {background-image: url("+i+"buttontransp3.png);}.clicrdv-button-style4 .clicrdv-link-mask {background-image: url("+i+"buttontransp4.png);}.clicrdv-button-style5 .clicrdv-link-mask {background-image: url("+i+"buttontransp5.png);}.clicrdv-button-style6 .clicrdv-link-mask {background-image: url("+i+"buttontransp6.png);}.clicrdv-button-style1 .clicrdv-link-text {top: 12px; left: 24px; width: 139px; height: 29px;}.clicrdv-button-style2 .clicrdv-link-text {top: 22px; left: 25px; width: 138px; height: 26px;}.clicrdv-button-style3 .clicrdv-link-text {top: 23px; left: 10px; width: 85px; height: 12px;}.clicrdv-button-style4 .clicrdv-link-text {top: 3px; left: 3px; width: 135px; height: 25px;}.clicrdv-button-style5 .clicrdv-link-text {top: 3px; left: 3px; width: 162px; height: 25px;}.clicrdv-button-style6 .clicrdv-link-text {top: 3px; left: 3px; width: 125px; height: 25px;}"); | |
| p.type="text/css"; | |
| if(p.styleSheet){p.styleSheet.cssText=r.nodeValue | |
| }else{p.appendChild(r) | |
| }o.appendChild(p) | |
| }}; | |
| n={height:function(r){var q=c.events.getFrameTarget(this),o=j.document.body,p=q; | |
| if(q!==null&&+q.getAttribute("data-autoresize")){if(q.getAttribute("data-initialized")!==true){while(p!==o){if(!p||p.style.display==="none"||p.style.visibility==="hidden"){return | |
| }p=p.parentNode | |
| }}q.setAttribute("height",r); | |
| q.setAttribute("data-initialized",true) | |
| }}}; | |
| c.events.addListener(j,"message",function(q){if(/https?:\/\/([a-z0-9\-]+\.)?clicrdv\.com/.test(q.origin)){var p=JSON.parse(q.data),o; | |
| for(o in p){if(p.hasOwnProperty(o)&&n.hasOwnProperty(o)){n[o].call(q,p[o]) | |
| }}}}) | |
| }(this)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment