Index: trunk/extensions/Cite/modules/ext.reference-tooltips/ext.reference-tooltips.js |
— | — | @@ -0,0 +1,12 @@ |
| 2 | +( function($) { |
| 3 | + $( function() { |
| 4 | + $j('.biblio-cite-link,sup.reference a').tooltip({ |
| 5 | + bodyHandler: function() { |
| 6 | + return $j( document.getElementById( this.hash.substr(1) ) ) |
| 7 | + .html(); |
| 8 | + }, |
| 9 | + showURL : false |
| 10 | + } ); |
| 11 | + } ); |
| 12 | + |
| 13 | +} )(jQuery); |
Property changes on: trunk/extensions/Cite/modules/ext.reference-tooltips/ext.reference-tooltips.js |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 14 | + native |
Index: trunk/extensions/Cite/modules/jquery.tooltip/jquery.tooltip.css |
— | — | @@ -0,0 +1,9 @@ |
| 2 | +#tooltip { |
| 3 | + position: absolute; |
| 4 | + z-index: 3000; |
| 5 | + border: 1px solid #111; |
| 6 | + background-color: #eee; |
| 7 | + padding: 5px; |
| 8 | + opacity: 0.85; |
| 9 | +} |
| 10 | +#tooltip h3, #tooltip div { margin: 0; } |
Property changes on: trunk/extensions/Cite/modules/jquery.tooltip/jquery.tooltip.css |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 11 | + native |
Index: trunk/extensions/Cite/modules/jquery.tooltip/jquery.tooltip.js |
— | — | @@ -0,0 +1,294 @@ |
| 2 | +/* |
| 3 | + * jQuery Tooltip plugin 1.3 |
| 4 | + * |
| 5 | + * http://bassistance.de/jquery-plugins/jquery-plugin-tooltip/ |
| 6 | + * http://docs.jquery.com/Plugins/Tooltip |
| 7 | + * |
| 8 | + * Copyright (c) 2006 - 2008 Jörn Zaefferer |
| 9 | + * |
| 10 | + * $Id: jquery.tooltip.js 5741 2008-06-21 15:22:16Z joern.zaefferer $ |
| 11 | + * |
| 12 | + * Dual licensed under the MIT and GPL licenses: |
| 13 | + * http://www.opensource.org/licenses/mit-license.php |
| 14 | + * http://www.gnu.org/licenses/gpl.html |
| 15 | + */ |
| 16 | + |
| 17 | +;(function($) { |
| 18 | + |
| 19 | + // the tooltip element |
| 20 | + var helper = {}, |
| 21 | + // the current tooltipped element |
| 22 | + current, |
| 23 | + // the title of the current element, used for restoring |
| 24 | + title, |
| 25 | + // timeout id for delayed tooltips |
| 26 | + tID, |
| 27 | + // IE 5.5 or 6 |
| 28 | + IE = $.browser.msie && /MSIE\s(5\.5|6\.)/.test(navigator.userAgent), |
| 29 | + // flag for mouse tracking |
| 30 | + track = false; |
| 31 | + |
| 32 | + $.tooltip = { |
| 33 | + blocked: false, |
| 34 | + defaults: { |
| 35 | + delay: 200, |
| 36 | + fade: false, |
| 37 | + showURL: true, |
| 38 | + extraClass: "", |
| 39 | + top: 15, |
| 40 | + left: 15, |
| 41 | + id: "tooltip" |
| 42 | + }, |
| 43 | + block: function() { |
| 44 | + $.tooltip.blocked = !$.tooltip.blocked; |
| 45 | + } |
| 46 | + }; |
| 47 | + |
| 48 | + $.fn.extend({ |
| 49 | + tooltip: function(settings) { |
| 50 | + settings = $.extend({}, $.tooltip.defaults, settings); |
| 51 | + createHelper(settings); |
| 52 | + return this.each(function() { |
| 53 | + $.data(this, "tooltip", settings); |
| 54 | + this.tOpacity = helper.parent.css("opacity"); |
| 55 | + // copy tooltip into its own expando and remove the title |
| 56 | + this.tooltipText = this.title; |
| 57 | + $(this).removeAttr("title"); |
| 58 | + // also remove alt attribute to prevent default tooltip in IE |
| 59 | + this.alt = ""; |
| 60 | + }) |
| 61 | + .mouseover(save) |
| 62 | + .mouseout(hide) |
| 63 | + .click(hide); |
| 64 | + }, |
| 65 | + fixPNG: IE ? function() { |
| 66 | + return this.each(function () { |
| 67 | + var image = $(this).css('backgroundImage'); |
| 68 | + if (image.match(/^url\(["']?(.*\.png)["']?\)$/i)) { |
| 69 | + image = RegExp.$1; |
| 70 | + $(this).css({ |
| 71 | + 'backgroundImage': 'none', |
| 72 | + 'filter': "progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod=crop, src='" + image + "')" |
| 73 | + }).each(function () { |
| 74 | + var position = $(this).css('position'); |
| 75 | + if (position != 'absolute' && position != 'relative') |
| 76 | + $(this).css('position', 'relative'); |
| 77 | + }); |
| 78 | + } |
| 79 | + }); |
| 80 | + } : function() { return this; }, |
| 81 | + unfixPNG: IE ? function() { |
| 82 | + return this.each(function () { |
| 83 | + $(this).css({'filter': '', backgroundImage: ''}); |
| 84 | + }); |
| 85 | + } : function() { return this; }, |
| 86 | + hideWhenEmpty: function() { |
| 87 | + return this.each(function() { |
| 88 | + $(this)[ $(this).html() ? "show" : "hide" ](); |
| 89 | + }); |
| 90 | + }, |
| 91 | + url: function() { |
| 92 | + return this.attr('href') || this.attr('src'); |
| 93 | + } |
| 94 | + }); |
| 95 | + |
| 96 | + function createHelper(settings) { |
| 97 | + // there can be only one tooltip helper |
| 98 | + if( helper.parent ) |
| 99 | + return; |
| 100 | + // create the helper, h3 for title, div for url |
| 101 | + helper.parent = $('<div id="' + settings.id + '"><h3></h3><div class="body"></div><div class="url"></div></div>') |
| 102 | + // add to document |
| 103 | + .appendTo(document.body) |
| 104 | + // hide it at first |
| 105 | + .hide(); |
| 106 | + |
| 107 | + // apply bgiframe if available |
| 108 | + if ( $.fn.bgiframe ) |
| 109 | + helper.parent.bgiframe(); |
| 110 | + |
| 111 | + // save references to title and url elements |
| 112 | + helper.title = $('h3', helper.parent); |
| 113 | + helper.body = $('div.body', helper.parent); |
| 114 | + helper.url = $('div.url', helper.parent); |
| 115 | + } |
| 116 | + |
| 117 | + function settings(element) { |
| 118 | + return $.data(element, "tooltip"); |
| 119 | + } |
| 120 | + |
| 121 | + // main event handler to start showing tooltips |
| 122 | + function handle(event) { |
| 123 | + // show helper, either with timeout or on instant |
| 124 | + if( settings(this).delay ) |
| 125 | + tID = setTimeout(show, settings(this).delay); |
| 126 | + else |
| 127 | + show(); |
| 128 | + |
| 129 | + // if selected, update the helper position when the mouse moves |
| 130 | + track = !!settings(this).track; |
| 131 | + $(document.body).bind('mousemove', update); |
| 132 | + |
| 133 | + // update at least once |
| 134 | + update(event); |
| 135 | + } |
| 136 | + |
| 137 | + // save elements title before the tooltip is displayed |
| 138 | + function save() { |
| 139 | + // if this is the current source, or it has no title (occurs with click event), stop |
| 140 | + if ( $.tooltip.blocked || this == current || (!this.tooltipText && !settings(this).bodyHandler) ) |
| 141 | + return; |
| 142 | + |
| 143 | + // save current |
| 144 | + current = this; |
| 145 | + title = this.tooltipText; |
| 146 | + |
| 147 | + if ( settings(this).bodyHandler ) { |
| 148 | + helper.title.hide(); |
| 149 | + var bodyContent = settings(this).bodyHandler.call(this); |
| 150 | + if (bodyContent.nodeType || bodyContent.jquery) { |
| 151 | + helper.body.empty().append(bodyContent) |
| 152 | + } else { |
| 153 | + helper.body.html( bodyContent ); |
| 154 | + } |
| 155 | + helper.body.show(); |
| 156 | + } else if ( settings(this).showBody ) { |
| 157 | + var parts = title.split(settings(this).showBody); |
| 158 | + helper.title.html(parts.shift()).show(); |
| 159 | + helper.body.empty(); |
| 160 | + for(var i = 0, part; (part = parts[i]); i++) { |
| 161 | + if(i > 0) |
| 162 | + helper.body.append("<br/>"); |
| 163 | + helper.body.append(part); |
| 164 | + } |
| 165 | + helper.body.hideWhenEmpty(); |
| 166 | + } else { |
| 167 | + helper.title.html(title).show(); |
| 168 | + helper.body.hide(); |
| 169 | + } |
| 170 | + |
| 171 | + // if element has href or src, add and show it, otherwise hide it |
| 172 | + if( settings(this).showURL && $(this).url() ) |
| 173 | + helper.url.html( $(this).url().replace('http://', '') ).show(); |
| 174 | + else |
| 175 | + helper.url.hide(); |
| 176 | + |
| 177 | + // add an optional class for this tip |
| 178 | + helper.parent.addClass(settings(this).extraClass); |
| 179 | + |
| 180 | + // fix PNG background for IE |
| 181 | + if (settings(this).fixPNG ) |
| 182 | + helper.parent.fixPNG(); |
| 183 | + |
| 184 | + handle.apply(this, arguments); |
| 185 | + } |
| 186 | + |
| 187 | + // delete timeout and show helper |
| 188 | + function show() { |
| 189 | + tID = null; |
| 190 | + if ((!IE || !$.fn.bgiframe) && settings(current).fade) { |
| 191 | + if (helper.parent.is(":animated")) |
| 192 | + helper.parent.stop().show().fadeTo(settings(current).fade, current.tOpacity); |
| 193 | + else |
| 194 | + helper.parent.is(':visible') ? helper.parent.fadeTo(settings(current).fade, current.tOpacity) : helper.parent.fadeIn(settings(current).fade); |
| 195 | + } else { |
| 196 | + helper.parent.show(); |
| 197 | + } |
| 198 | + update(); |
| 199 | + } |
| 200 | + |
| 201 | + /** |
| 202 | + * callback for mousemove |
| 203 | + * updates the helper position |
| 204 | + * removes itself when no current element |
| 205 | + */ |
| 206 | + function update(event) { |
| 207 | + if($.tooltip.blocked) |
| 208 | + return; |
| 209 | + |
| 210 | + if (event && event.target.tagName == "OPTION") { |
| 211 | + return; |
| 212 | + } |
| 213 | + |
| 214 | + // stop updating when tracking is disabled and the tooltip is visible |
| 215 | + if ( !track && helper.parent.is(":visible")) { |
| 216 | + $(document.body).unbind('mousemove', update) |
| 217 | + } |
| 218 | + |
| 219 | + // if no current element is available, remove this listener |
| 220 | + if( current == null ) { |
| 221 | + $(document.body).unbind('mousemove', update); |
| 222 | + return; |
| 223 | + } |
| 224 | + |
| 225 | + // remove position helper classes |
| 226 | + helper.parent.removeClass("viewport-right").removeClass("viewport-bottom"); |
| 227 | + |
| 228 | + var left = helper.parent[0].offsetLeft; |
| 229 | + var top = helper.parent[0].offsetTop; |
| 230 | + if (event) { |
| 231 | + // position the helper 15 pixel to bottom right, starting from mouse position |
| 232 | + left = event.pageX + settings(current).left; |
| 233 | + top = event.pageY + settings(current).top; |
| 234 | + var right='auto'; |
| 235 | + if (settings(current).positionLeft) { |
| 236 | + right = $(window).width() - left; |
| 237 | + left = 'auto'; |
| 238 | + } |
| 239 | + helper.parent.css({ |
| 240 | + left: left, |
| 241 | + right: right, |
| 242 | + top: top |
| 243 | + }); |
| 244 | + } |
| 245 | + |
| 246 | + var v = viewport(), |
| 247 | + h = helper.parent[0]; |
| 248 | + // check horizontal position |
| 249 | + if (v.x + v.cx < h.offsetLeft + h.offsetWidth) { |
| 250 | + left -= h.offsetWidth + 20 + settings(current).left; |
| 251 | + helper.parent.css({left: left + 'px'}).addClass("viewport-right"); |
| 252 | + } |
| 253 | + // check vertical position |
| 254 | + if (v.y + v.cy < h.offsetTop + h.offsetHeight) { |
| 255 | + top -= h.offsetHeight + 20 + settings(current).top; |
| 256 | + helper.parent.css({top: top + 'px'}).addClass("viewport-bottom"); |
| 257 | + } |
| 258 | + } |
| 259 | + |
| 260 | + function viewport() { |
| 261 | + return { |
| 262 | + x: $(window).scrollLeft(), |
| 263 | + y: $(window).scrollTop(), |
| 264 | + cx: $(window).width(), |
| 265 | + cy: $(window).height() |
| 266 | + }; |
| 267 | + } |
| 268 | + |
| 269 | + // hide helper and restore added classes and the title |
| 270 | + function hide(event) { |
| 271 | + if($.tooltip.blocked) |
| 272 | + return; |
| 273 | + // clear timeout if possible |
| 274 | + if(tID) |
| 275 | + clearTimeout(tID); |
| 276 | + // no more current element |
| 277 | + current = null; |
| 278 | + |
| 279 | + var tsettings = settings(this); |
| 280 | + function complete() { |
| 281 | + helper.parent.removeClass( tsettings.extraClass ).hide().css("opacity", ""); |
| 282 | + } |
| 283 | + if ((!IE || !$.fn.bgiframe) && tsettings.fade) { |
| 284 | + if (helper.parent.is(':animated')) |
| 285 | + helper.parent.stop().fadeTo(tsettings.fade, 0, complete); |
| 286 | + else |
| 287 | + helper.parent.stop().fadeOut(tsettings.fade, complete); |
| 288 | + } else |
| 289 | + complete(); |
| 290 | + |
| 291 | + if( settings(this).fixPNG ) |
| 292 | + helper.parent.unfixPNG(); |
| 293 | + } |
| 294 | + |
| 295 | +})(jQuery); |
Property changes on: trunk/extensions/Cite/modules/jquery.tooltip/jquery.tooltip.js |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 296 | + native |