opengrok-tooltip.js revision 1384
1072N/A * Copyright 2012 Yahoo! Inc. All rights reserved. 1072N/A * Licensed under the BSD License. 946N/A * Portions Copyright 2012 Jens Elkner. 761N/A// The tooltip in the YUI gallery makes nice effects but is not flexible enough. 761N/A// So we use a slightly modified version of the YUI examples. 761N/A * Required NAME static field, used to identify the Widget class and used 351N/A * as an event prefix, to generate class names etc. (set to the class name 761N/A /* Default Tooltip Attributes */ 1072N/A * The tooltip content. This can either be a String, Node, or a simple 761N/A * map of id-to-values, designed to be used when a single tooltip is 761N/A * mapped to multiple trigger elements. 761N/A * The set of nodes to bind to the tooltip instance. Can be a string, 1072N/A * The delegate node to which event listeners should be attached. This 351N/A * node should be an ancestor of all trigger nodes bound to the 351N/A * instance. By default the document is used. 351N/A * The time to wait, after the mouse enters the trigger node, to display 351N/A * The time to wait, after the mouse leaves the trigger node, to hide 351N/A * The time to wait, after the tooltip is first displayed for a trigger 351N/A * node, to hide it, if the mouse has not left the trigger node 351N/A * Override the default visibility set by the widget base class 351N/A * Override the default XY value set by the widget base class, to 351N/A * position the tooltip offscreen 351N/A /* Extend the base Widget class */ 351N/A * Initialization Code: Sets up privately used state properties, and 351N/A * publishes the events Tooltip introduces 351N/A // Currently bound trigger node information 351N/A // Event handles - mouse over is set on the delegate element, 351N/A // mousemove and mouseout are set on the trigger node 351N/A // Publish events introduced by Tooltip. Note the triggerEnter event 351N/A // is preventable, with the default behavior defined in the 351N/A // _defTriggerEnterFn method 351N/A // we assume, horizontal scrollbar has ~ same height as vert. and 351N/A * Destruction Code: Clears event handles, timers, and current trigger 351N/A * bindUI is used to bind attribute change and dom event listeners 351N/A * syncUI is used to update the rendered DOM, based on the current 351N/A * Helper method to extract the content for the tooltip of the given 351N/A * node, based on (in order of precedence): 351N/A * a). The given node's 'content' attribute value, if set: 351N/A * 0) If its value denotes a function, the result of executing as 351N/A * function(node, this), whereby this is the Tooltip instance 1072N/A * 1) If the value is a map, the maps value for the key equal to 351N/A * 2) If the value is a String or Node, the value itself. 351N/A * 3) otherwise, fallback to b) 351N/A * b) The value of the node's 'title' attribute. 351N/A * @return either an innerHTML acceptable String or a Node 351N/A * Public method, which can be used by triggerEvent event listeners to 351N/A * set the content of the tooltip for the current trigger node. This 351N/A * implementation uses {#getTooltipContent} to extract the content to 351N/A * Gets the closest ancestor of the given node, which is a tooltip 351N/A * Default attribute change listener for the triggerNodes attribute 351N/A * Default attribute change listener for the delegate attribute 351N/A * Updates the rendered DOM to reflect the set of trigger nodes passed in 351N/A * Attaches the default mouseover DOM listener to the current delegate node 351N/A * Default mouse over DOM event listener. 351N/A * Delegates to the _enterTrigger method, if the mouseover enters a 351N/A * Default mouse out DOM event listener 351N/A * Delegates to _leaveTrigger if the mouseout leaves the current trigger 351N/A * Default mouse move DOM event listener 351N/A * Default handler invoked when the mouse enters a trigger node. Set the 351N/A * content of the tooltip box and fires the triggerEnter event, which 351N/A * inturn notifies all listeners. Listeners may prevent the tooltip 351N/A * from being displayed. 1072N/A * Default handler for the triggerEvent event, which will setup the 351N/A * timer to display the tooltip, if the default handler has not been 351N/A * Default handler invoked when the mouse leaves the current trigger 351N/A * node. Fires the triggerLeave event and sets up the hide timer 351N/A * Default handler invoked for mousemove events on the trigger node. 351N/A * Stores the current mouse x, y positions 351N/A * Shows the tooltip, after moving it to the current mouse position. 351N/A * Hides the tooltip, after clearing existing timers. 351N/A * Set the currently bound trigger node information, clearing out the 351N/A * Clear out the current trigger state, restoring the title attribute 351N/A * on the trigger node, if it was originally set. 351N/A * Detach any stored event handles 351N/A // dynamic:false = Modify the existing Tooltip class 351N/A},
'1.0', {
requires: [
'widget',
'widget-position',
'widget-stack']});
351N/A// vim: set filetype=javascript ts=4