Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#37 2008-01-07 02:29:10

rsilletti
Moderator
From: Spokane WA
Registered: 2004-04-28
Posts: 707

Re: Converting a plugin to jQuery

First issue would be the inappropriate usage of the alt attribute, that is internal to the plugin and I have a fix available here: plugin 4.0.5.3
This variation changes the alt usage to a name attribute which is used with an anchor tag. The migration of the alt attribute had to do with the original image use for this as a replacement for the title attribute which duplicated the visual aspect. It is a simple change and it works as it should for me – testing is however thin for the change.

HTML ids are intended to be discreet in a page, each source tag should be applied with its own id.

I don’t think I can help you with the validator errors on the inserted h4 tags.

Last edited by rsilletti (2008-01-07 02:30:08)

Offline

#38 2008-01-07 06:52:16

jstubbs
Moderator
From: Hong Kong
Registered: 2004-12-13
Posts: 2,395
Website

Re: Converting a plugin to jQuery

Hi Rick, is the updated plugin compatible with Mootools? Second question – does your plugin have to use the JQuery library? Or can the code stand alone?

Offline

#39 2008-01-07 15:20:40

rsilletti
Moderator
From: Spokane WA
Registered: 2004-04-28
Posts: 707

Re: Converting a plugin to jQuery

It should be independent of any clashes with mootools, I don’t know about compatabilty because I have never used mootools..
Yes, it does require jQuery.

Offline

#40 2008-01-07 20:56:55

jstubbs
Moderator
From: Hong Kong
Registered: 2004-12-13
Posts: 2,395
Website

Re: Converting a plugin to jQuery

Thanks. Question: Is it possible to get your images to link to a lightbox? (Slimbox actually)

Offline

#41 2008-01-07 23:28:55

rsilletti
Moderator
From: Spokane WA
Registered: 2004-04-28
Posts: 707

Re: Converting a plugin to jQuery

I don’t know how Slimbox works or what it does. The anchor link around the images takes an href attributes if that will accomplish what you are looking for?

Offline

#42 2008-01-07 23:41:38

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,280
Website GitHub

Re: Converting a plugin to jQuery

rsilletti wrote:

I don’t know how Slimbox works or what it does.

It needs rel="lightbox-somevalue" added to each anchor. Then mootools/slimbox does the rest.

‘somevalue’ should be user-defined if possible to allow for multiple separate galleries per page.

Last edited by Bloke (2008-01-07 23:42:27)


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#43 2008-01-07 23:54:18

rsilletti
Moderator
From: Spokane WA
Registered: 2004-04-28
Posts: 707

Re: Converting a plugin to jQuery

Manually coding your source links would make that workable. Creating the choice for user input would be more complex and might be best done with php unless your choice would be inputing as part of the template from the admin side, the source tag could be tailored to do that.

Offline

#44 2008-01-08 00:15:53

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,280
Website GitHub

Re: Converting a plugin to jQuery

rsilletti wrote:

Creating the choice for user input would be more complex and might be best done with php unless your choice would be inputing as part of the template from the admin side, the source tag could be tailored to do that.

Oops, sorry I wasn’t clear. I meant the 2nd one; the site author should have control via an option in the plugin if at all possible to supply “somevalue”.

But hard-coding it or having the author supply their own anchor tags + rel attributes works equally well; they just have to be aware that if there are multiple rollovers on a page, when lightbox is launched the Next/Prev links will cycle through all rollover pics on that page. Using a unique ‘somevalue’ for each “group” of pictures allows the Next/Prev to only iterate within the selected group.

In essence, as long as the “lightbox-” bit appears in the rel tag, it works. Oh, and if a class can be supplied to the anchors too, then if it’s set to class="Thickbox", that lightbox system can be used instead.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#45 2008-01-08 02:32:51

rsilletti
Moderator
From: Spokane WA
Registered: 2004-04-28
Posts: 707

Re: Converting a plugin to jQuery

Hmmm… too many classes. Having a common class for the source tags is intregal to the operation of the script.

Offline

#46 2008-10-26 07:31:24

jstubbs
Moderator
From: Hong Kong
Registered: 2004-12-13
Posts: 2,395
Website

Re: Converting a plugin to jQuery

Hi Rick, its me again :-)

I am updating the site where I use ras_rollover_text. Currently I have mootools and aro_slideshow. I am removing those two elements to use only jQuery and a slideshow which contains the following code:

<script src="<txp:site_url/>javascript/jquery.cycle.all.js" type="text/javascript"></script>
<script type="text/javascript">
//<![CDATA[
$(document).ready(function() {
// redefine Cycle's updateActivePagerLink function 
$.fn.cycle.updateActivePagerLink = function(pager, currSlideIndex) { 
$(pager).find('li').removeClass('activeLI') 
.filter('li:eq('+currSlideIndex+')').addClass('activeLI');
};
$('#left').cycle({ 
fx:     'fade', 
speed:  'slow', 
timeout: 2000,  
pagerAnchorBuilder: function(idx, slide) { 
// return selector string for existing anchor 
return '.thumbs li:eq(' + idx + ') a';
return false; 
} 
});
});
//]]>
</script>

The slideshow works fine, using jQuery 1.26 included just before the above code. For some reason, it clashes with your plugin (4.0.5.2), which produces the following code:

<script  type="text/javascript">
//<![CDATA[
jQuery.noConflict();
jQuery(document).ready(function() {
jQuery(".rollover_src").hover(function(){
jQuery("#rollover_dest").html(jQuery(this).attr("name"));
},function(){
jQuery("#rollover_dest").html("Some text here");
});
});
//]]>
</script>

In Safari Inspector, I get this error:

“Undefined value – line 44”. The corresponding line is this, in the slideshow JS:

$.fn.cycle.updateActivePagerLink = function(pager, currSlideIndex) {

I have two questions – what could be causing the error, and secondly, do you have a recommendation for another script that will validate? Your plugin is perfect for one rollover, but in this case, the client has 6 image rollovers and the text they add causes masses of validation errors. I’d like to see if there is a better solution.

Thanks!

Last edited by jstubbs (2008-10-26 07:36:41)

Offline

#47 2008-10-26 18:38:51

Gocom
Developer Emeritus
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

Re: Converting a plugin to jQuery

jstubbs wrote:

what could be causing the error

A variable that doesn’t have value or a variable that isn’t registered.

It just doesn’t have value, but it must have something to set if you wanna use it. Undefined is kinda same like false but it really isn’t. It is an error, a really common mistake usually made by guys that write Java/C#/PHP (with out error reporting: work as it returns false), and is read as a false in some browsers, but same time it causes error and might even crash browser.

In Fx/Safari it outputs simple undefined value error, but it works. In IE5.5/6 it causes runtime error (doesn’t work), and some browsers don’t even care (they just load it, untill with out warning they crash).

Fixing is somewhat simple. Just define the variable if it is undefined.

Last edited by Gocom (2008-10-26 18:42:34)

Offline

#48 2008-10-26 18:51:01

MattD
Plugin Author
From: Monterey, California
Registered: 2008-03-21
Posts: 1,254
Website

Re: Converting a plugin to jQuery

I think if you’re using jQuery in No Conflict mode you can’t use $ and have to use jQuery instead. So try changing your $ to jQuery


My Plugins

Piwik Dashboard, Google Analytics Dashboard, Minibar, Article Image Colorpicker, Admin Datepicker, Admin Google Map, Admin Colorpicker

Offline

Board footer

Powered by FluxBB