From the readme:

	TOOLTIP CONTENT
	--------------------------------
	In this field you can provide the HTML attribute of the desired content of Tipsy tooltip, or 
	any jQuery/JavaScript function that returns any value you wish.
	
	Examples:
	  1) Use the following to return the ID of the HTML element: id
	  
	  2) Use the following to return the anchor of an a tag: href
	
	  3) You can write the below function inside the Tooltip content textarea to make the content 
	     of the "title" attribute formatted uupercase.
	       
	       function() { return $(this).attr('original-title').toUpperCase(); }
	     
	  4) You can write the below function inside the Tooltip content textarea to return a custom 
	     content of your choice.
	      
	       function() { return 'My custom tooltip content'; }

This can't work in D7. The passed in function gets converted to a string. This was grey territory in D6 as well, so I'm not surprised.

My idea is to allow the user to pass in either an attribute name or a selector to an element underneath the main one,
so specifying ".contents" would match:

<div class="$my_trigger_class">
 <div class="contents">Tooltip HTML that can't really fit into an attribute</div>
 Ordinary text that the user sees
</div>

because our code would do "function() return $(options.title, this).html()"; (html or text depending on options.html)

There is a loss of functionality, but I don't see any other way.

Thoughts?

CommentFileSizeAuthor
#1 hack.patch470 bytesbojanz
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

bojanz’s picture

FileSize
470 bytes

My primary use case for Views tooltip is using a selector, so I had to do a quick hack attached in the patch.
Of course, that breaks all other uses of tipsy (like the core form descriptions). Will proceed with the fix described in #0 after I get feedback.

good_man’s picture

+++ b/javascripts/tipsy.js
@@ -34,7 +34,7 @@
+						title: function() { return $('.' + options.title, this).html() },

Why tabs instead of spaces?

And I can understand from #0 description, that passing JS code in HTML text area won't work in D7?

The proposed solution is good IMO to get a quick start, later we can do something else to extend it (maybe).

Powered by Dreditor.

bojanz’s picture

Why tabs instead of spaces?

Trying out new editors sometimes does that...

And I can understand from #0 description, that passing JS code in HTML text area won't work in D7?

Yup.

I'll try and hack up the proposed solution in the near future.

good_man’s picture

cool, and can we open an issue to clean out the module's code from tabs? it's annoying when you want to patch and you got several lines just for replacing spaces instead of tabs.

bojanz’s picture

Sure, go ahead.

bojanz’s picture

Status: Active » Fixed

Done.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.