%PDF- %PDF-
Direktori : /home1/lightco1/www/media/sigplus/engines/hoverplus/js/ |
Current File : //home1/lightco1/www/media/sigplus/engines/hoverplus/js/hoverplus.min.js |
/* hoverplus lightweight pop-up window on mouse-over @author Levente Hunyadi @version 1.5.0 @remarks Copyright (C) 2011 Levente Hunyadi @see http://hunyadi.info.hu/projects/hoverplus */ 'use strict';(function(v){function c(a){return"hoverplus-"+a}function r(a){a.addClass(c("hidden"))}function t(a){a.removeClass(c("hidden"))}var w=new Class({initialize:function(){this._dialog=(new Element("div",{id:"hoverplus"})).adopt(this._viewer=new Element("div",{"class":c("viewer")}),this._caption=(new Element("div",{"class":c("caption")})).adopt(this._title=new Element("p",{"class":c("title")}),this._text=new Element("p",{"class":c("text")}))).inject(document.body);r($$([this._dialog,this._viewer, this.caption]))},show:function(a,n,d,g){function l(b,g){var f=a.getCoordinates(),l=window.getScroll(),d=f.left-l.x,e=f.top-l.y,n=f.width;f=f.height;for(var m=window.getSize(),k=[d+n+b-m.x,e+f+g-m.y,b-d,g-e],c=-1,h=Infinity,p=0;p<k.length;p++)k[p]<h&&(c=p,h=k[p]);k=d+(n-b)/2;h=m.x-b-20;k>h&&(k=h);20>k&&(k=20);h=e+(f-g)/2;m=m.y-g-20;h>m&&(h=m);20>h&&(h=20);return{left:l.x+[d+n+20,k,d-b-20,k][c],top:l.y+[h,e+f+20,h,e-g-20][c]}}var b=this;(new Fx.Morph(b._dialog)).set({width:100,height:100});b._dialog.setStyles(l(0, 0));t(b._dialog);r($$([b._viewer,b._caption]));var e=v(new Image).addEvents({load:function(){var a=e.width,c=e.height,f={width:a,height:c};b._viewer.setStyles(Object.append({"background-image":'url("'+n+'")'},f));b._caption.setStyle("width",a);a=Object.append(l(a,c),f);(new Fx.Morph(b._dialog,{duration:200,onComplete:function(){t(b._viewer);b._title.empty().set("html",d);b._text.empty().set("html",g);if(d||g)f.height+=b._caption.getSize().y,(new Fx.Morph(b._dialog,{duration:100,onComplete:function(){t(b._caption)}})).start(f)}})).start(a)}, error:function(){b.hide()}}).setProperty("src",n)},hide:function(){r(this._dialog)}}),u;window.addEvent("domready",function(){u=new w});var q=new Class({Implements:Options,options:{getTitle:function(a){return(a=a.getElement("img"))?a.getProperty("alt"):""},getText:function(a){return a.getProperty("title")}},initialize:function(a,c,d){function g(){e&&clearTimeout(e);e=l.delay(100,b)}function l(){e&&clearTimeout(e);a.removeEvent("mousemove",g);u.show(a,c,d.getTitle(a),d.getText(a))}var b=this;b.setOptions(d); d=b.options;var e;a.addEvents({mouseenter:function(){a.addEvent("mousemove",g);g()},mouseleave:function(){a.removeEvent("mousemove",g);e&&clearTimeout(e);u.hide()}})}});q.bind=function(a,c){function d(a){a.each(function(a){/\.(jpe?g|png|gif)$/i.test(a.getProperty("href"))&&new q(a,a.getProperty("href"),c)})}if(a.length&&a.get("tag").every(function(a){return"a"==a}))d(a);else switch(a.get("tag")){case "ol":case "ul":a.getChildren("li").each(function(a){d(a.getChildren("a[href]"));a.getChildren("img").each(function(a){new q(a, a.getProperty("src"),c)})})}};window.hoverplus=q})(document.id);