123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435 |
-
- (function($) {
- $.fn.SMFtooltip = function(oInstanceSettings) {
- $.fn.SMFtooltip.oDefaultsSettings = {
- followMouse: 1,
- hoverIntent: {sensitivity: 10, interval: 300, timeout: 50},
- positionTop: 12,
- positionLeft: 12,
- tooltipID: 'smf_tooltip',
- tooltipTextID: 'smf_tooltipText',
- tooltipClass: 'tooltip',
- tooltipSwapClass: 'smf_swaptip',
- tooltipContent: 'html'
- };
-
-
- var oSettings = $.extend({}, $.fn.SMFtooltip.oDefaultsSettings , oInstanceSettings || {});
-
- $(this).each(function()
- {
- var sTitle = $('<span class="' + oSettings.tooltipSwapClass + '">' + this.title + '</span>').hide();
- $(this).append(sTitle).attr('title', '');
- });
-
-
- var positionTooltip = function(event)
- {
- var iPosx = 0;
- var iPosy = 0;
-
- if (!event)
- var event = window.event;
-
- if (event.pageX || event.pageY)
- {
- iPosx = event.pageX;
- iPosy = event.pageY;
- }
- else if (event.clientX || event.clientY)
- {
- iPosx = event.clientX + document.body.scrollLeft + document.documentElement.scrollLeft;
- iPosy = event.clientY + document.body.scrollTop + document.documentElement.scrollTop;
- }
-
-
- var oPosition = {
- x: iPosx + oSettings.positionLeft,
- y: iPosy + oSettings.positionTop,
- w: $('#' + oSettings.tooltipID).width(),
- h: $('#' + oSettings.tooltipID).height()
- }
-
- var oLimits = {
- x: $(window).scrollLeft(),
- y: $(window).scrollTop(),
- w: $(window).width() - 24,
- h: $(window).height() - 24
- };
-
- if ((oPosition.y + oPosition.h > oLimits.y + oLimits.h) && (oPosition.x + oPosition.w > oLimits.x + oLimits.w))
- {
- oPosition.x = (oPosition.x - oPosition.w) - 45;
- oPosition.y = (oPosition.y - oPosition.h) - 45;
- }
- else if ((oPosition.x + oPosition.w) > (oLimits.x + oLimits.w))
- {
- oPosition.x = oPosition.x - (((oPosition.x + oPosition.w) - (oLimits.x + oLimits.w)) + 24);
- }
- else if (oPosition.y + oPosition.h > oLimits.y + oLimits.h)
- {
- oPosition.y = oPosition.y - (((oPosition.y + oPosition.h) - (oLimits.y + oLimits.h)) + 24);
- }
-
-
- $('#' + oSettings.tooltipID).css({'left': oPosition.x + 'px', 'top': oPosition.y + 'px'});
- }
-
-
- var showTooltip = function(){
- $('#' + oSettings.tooltipID + ' #' + oSettings.tooltipTextID).show();
- }
-
-
- var hideTooltip = function(valueOfThis){
- $('#' + oSettings.tooltipID).fadeOut('slow').trigger("unload").remove();
- }
-
-
- return this.each(function(index)
- {
-
- if ($.fn.hoverIntent)
- {
- $(this).hoverIntent({
- sensitivity: oSettings.hoverIntent.sensitivity,
- interval: oSettings.hoverIntent.interval,
- over: smf_tooltip_on,
- timeout: oSettings.hoverIntent.timeout,
- out: smf_tooltip_off
- });
- }
- else
- {
-
- $(this).hover(smf_tooltip_on, smf_tooltip_off);
- }
-
-
- function smf_tooltip_on(event)
- {
-
- if ($(this).children('.' + oSettings.tooltipSwapClass).text())
- {
-
- $('body').append('<div id="' + oSettings.tooltipID + '" class="' + oSettings.tooltipClass + '"><div id="' + oSettings.tooltipTextID + '" style="display:none;"></div></div>');
-
-
- var $tt = $('#' + oSettings.tooltipID);
- var $ttContent = $('#' + oSettings.tooltipID + ' #' + oSettings.tooltipTextID);
-
- if (oSettings.tooltipContent == 'html')
- $ttContent.html($(this).children('.' + oSettings.tooltipSwapClass).html());
- else
- $ttContent.text($(this).children('.' + oSettings.tooltipSwapClass).text());
-
- oSettings.tooltipContent
-
-
- $tt.show();
- showTooltip();
- positionTooltip(event);
- }
-
- return false;
- };
-
-
- function smf_tooltip_off(event)
- {
- hideTooltip(this);
- return false;
- };
-
-
- if (oSettings.followMouse)
- {
- $(this).bind("mousemove", function(event){
- positionTooltip(event);
- return false;
- });
- }
- });
- };
-
- })(jQuery);
-
-
- (function($) {
- $.fn.hoverIntent = function(f,g) {
-
- var cfg = {
- sensitivity: 7,
- interval: 100,
- timeout: 0
- };
-
- cfg = $.extend(cfg, g ? { over: f, out: g } : f );
-
-
-
- var cX, cY, pX, pY;
-
- var track = function(ev) {
- cX = ev.pageX;
- cY = ev.pageY;
- };
-
- var compare = function(ev,ob) {
- ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t);
-
- if ( ( Math.abs(pX-cX) + Math.abs(pY-cY) ) < cfg.sensitivity ) {
- $(ob).unbind("mousemove",track);
-
- ob.hoverIntent_s = 1;
- return cfg.over.apply(ob,[ev]);
- } else {
-
- pX = cX; pY = cY;
-
- ob.hoverIntent_t = setTimeout( function(){compare(ev, ob);} , cfg.interval );
- }
- };
-
- var delay = function(ev,ob) {
- ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t);
- ob.hoverIntent_s = 0;
- return cfg.out.apply(ob,[ev]);
- };
-
- var handleHover = function(e) {
-
- var p = (e.type == "mouseenter" ? e.fromElement : e.toElement) || e.relatedTarget;
- while ( p && p != this ) { try { p = p.parentNode; } catch(e) { p = this; } }
- if ( p == this ) { return false; }
-
- var ev = jQuery.extend({},e);
- var ob = this;
-
- if (ob.hoverIntent_t) { ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t); }
-
- if (e.type == "mouseenter") {
-
- pX = ev.pageX; pY = ev.pageY;
-
- $(ob).bind("mousemove",track);
-
- if (ob.hoverIntent_s != 1) { ob.hoverIntent_t = setTimeout( function(){compare(ev,ob);} , cfg.interval );}
-
- } else {
-
- $(ob).unbind("mousemove",track);
-
- if (ob.hoverIntent_s == 1) { ob.hoverIntent_t = setTimeout( function(){delay(ev,ob);} , cfg.timeout );}
- }
- };
-
- return this.bind('mouseenter',handleHover).bind('mouseleave',handleHover);
- };
- })(jQuery);
-
-
- ;(function($){
- $.fn.superfish = function(op){
- var sf = $.fn.superfish,
- c = sf.c,
- over = function(){
- var $$ = $(this), menu = getMenu($$);
- clearTimeout(menu.sfTimer);
- $$.showSuperfishUl().siblings().hideSuperfishUl();
- },
- out = function(){
- var $$ = $(this), menu = getMenu($$), o = sf.op;
- clearTimeout(menu.sfTimer);
- menu.sfTimer=setTimeout(function(){
- o.retainPath=($.inArray($$[0],o.$path)>-1);
- $$.hideSuperfishUl();
- if (o.$path.length && $$.parents(['li.',o.hoverClass].join('')).length<1){over.call(o.$path);}
- },o.delay);
- },
- getMenu = function($menu){
- var menu = $menu.parents(['ul.',c.menuClass,':first'].join(''))[0];
- sf.op = sf.o[menu.serial];
- return menu;
- },
-
-
- addArrow = function($a){$a.addClass(c.anchorClass)};
- return this.each(function() {
- var s = this.serial = sf.o.length;
- var o = $.extend({},sf.defaults,op);
- var h = $.extend({},sf.hoverdefaults,{over: over, out: out},op);
-
- o.$path = $('li.'+o.pathClass,this).slice(0,o.pathLevels).each(function(){
- $(this).addClass([o.hoverClass,c.bcClass].join(' '))
- .filter('li:has(ul)').removeClass(o.pathClass);
- });
- sf.o[s] = sf.op = o;
- $('li:has(ul)',this)[($.fn.hoverIntent && !o.disableHI) ? 'hoverIntent' : 'hover'](($.fn.hoverIntent && !o.disableHI) ? (h) : (over,out)).each(function() {})
- .not('.'+c.bcClass)
- .hideSuperfishUl();
- var $a = $('a',this);
- $a.each(function(i){
- var $li = $a.eq(i).parents('li');
- $a.eq(i).focus(function(){over.call($li);}).blur(function(){out.call($li);});
- });
- o.onInit.call(this);
-
- }).each(function() {
- var menuClasses = [c.menuClass];
- $(this).addClass(menuClasses.join(' '));
- });
- };
- var sf = $.fn.superfish;
- sf.o = [];
- sf.op = {};
- sf.c = {
- bcClass : 'sf-breadcrumb',
- menuClass : 'sf-js-enabled',
- anchorClass : 'sf-with-ul',
- };
- sf.defaults = {
- hoverClass : 'sfhover',
- pathClass : 'current',
- pathLevels : 1,
- delay : 700,
- animation : {opacity:'show', height:'show'},
- speed : 300,
- disableHI : false,
- onInit : function(){},
- onBeforeShow: function(){},
- onShow : function(){},
- onHide : function(){}
- };
- sf.hoverdefaults = {
- sensitivity : 10,
- interval : 40,
- timeout : 1
- };
- $.fn.extend({
- hideSuperfishUl : function(){
- var o = sf.op,
- not = (o.retainPath===true) ? o.$path : '';
- o.retainPath = false;
- var $ul = $(['li.',o.hoverClass].join(''),this).add(this).not(not).removeClass(o.hoverClass)
- .find('>ul').hide().css('opacity','0');
- o.onHide.call($ul);
- return this;
- },
- showSuperfishUl : function(){
- var o = sf.op,
- sh = sf.c,
- $ul = this.addClass(o.hoverClass)
- .find('>ul:hidden').css('opacity','1');
- o.onBeforeShow.call($ul);
- $ul.animate(o.animation,o.speed,function(){o.onShow.call($ul);});
- return this;
- }
- });
- })(jQuery);
|