Hi,

I tried to answer directly but your e-mail rejected it as spam.

We should move this topic to the jquery-en group or continue it
privately, as this group is about development of jQuery itself.

$('[class*='+options.cssprefix+'-]').each(function(){

       //parse the object string, faster than eval
       function getOptions(str){
                var options = {},
                      str = str.replace(/[{}"'\s]/g, '').split(',');
                $.each(opt, function(i, val){
                       val = val.split(':');
                       options[val[0]] = val[1];
                });
                return options;
       };

       var sx = this.className.replace(/,\s+/, ',').match(/sx-\w+(\s+)?
{\S*}/
g);
       var effects;

       $.each(sx, function(index, val){
               val = val.split(/\s+/);
               effects[ val[0] ] = getOptions( val[1] );
       });

       console.log( effects );

});

It should log in the firebug console an object which contains all the
effects
for a certain element, each with it's options object. It allows either
the "sx-shake {option:'something'}" or "sx-shake{option:something}"
format in the class attribute.

cheers,
- ricardo

On 11 abr, 16:20, Gilles <[email protected]> wrote:
> I am getting closer, changing the selector from:
>
> [class^='+options.cssprefix+'-]
>
> to
>
> [class*='+options.cssprefix+'-]
>
> solved the problem of not retrievingclassattribute with multipleclassname.
>
> After I use a regex to extract eachclassthat is related to the
> plugin only:
>
> sx-[^\s]+ ?{.*}|sx-[^\s]+
>
> that works fine in The Regex Coach for the follwoing example:
>
> red sx-dialog {var: 'val'} sx-draggable  black
>
> But it doesn't work (or I dont use it properly) somehow in the code:
>
>                // sxclassdetector regex ( sx-[^\s]+ ?{.*}|sx-[^\s]
> + )
>                 var sx_reg = new RegExp(options.cssprefix+'-[^\\s]+ ?\{.*
> \}|'+options.cssprefix+'-[^\s]+ \g');
>
>                 // scriptless elements?
>                 $('[class*='+options.cssprefix+'-]').each(function(i)
>                 {
>                         //classstring
>                         var clstr = $(this).attr('class');
>
>                         // get all classes
>                         var classes = sx_reg.exec(clstr);
>
>                         if (classes) $.each(classes, function(i){ 
> alert(classes[i]); });
>                         else alert(clstr);
>                 });
>
> That would only return this format sx-foo {var:val} also the first
> match is always this format. I need to do more reading and testing,
> but it think it is the way to go. or well i will see.
>
> On Apr 10, 4:59 pm, Ricardo <[email protected]> wrote:
>
> > I don't have Firebug here so can't test anything and didn't bother to
> > read the whole source, but from what I see you're using a simple regex
> > that extracts each word in the className and then you *assume* your
> > requiredclassis the firstone, right?
>
> > You could try eliminating the whitespace between the mainclassand
> > it's options, that way you know they are related and don't need to
> > guess classes:
>
> > <div id="greenbox"class="green sx-shake{event: 'dblclick'}
> > someotherclass"></div>
>
> > $('[className*="sx-shake"]').each(function(){
> >   //here you know it's a 'shake' element, so use a special regex to
> > get the options:
> >  /sx\-shake\{(.*)\}/.exec( this.className) // something like that
>
> > });
>
> > Thisclass-gathering process could certainly be streamlined into a
> > single function.
>
> > On Apr 9, 10:05 am, Gilles <[email protected]> wrote:
>
> > > Hi,
>
> > > I am still working on my plugin that this group helped me debug in the
> > > past and I have an other issue, which can probably ressolve quickly
> > > but i don't know how to attack the problem.
>
> > > Basically my script uses the HTMLclassattribute in order to set
> > > widgets, effects and plugins as well as passing through options (if
> > > any) for the set widgets, effects and plugins.
>
> > > I got it all working now, added event support, delay support, effects
> > > support ect... Anyway the issue is not there, everything works ok,
> > > also it can probably be optimized and cleaned up.
>
> > > The issue I have is if I want to have multipleclass, some that might
> > > not be related to my plugin and therefor need to be left behind like:
>
> > > <divclass="foobox sx-fold { sxFxSpeed: 500; }"> // where foobox need
> > > to be left behind and the rest extracted
>
> > > And some I want to be able to have more thanonespecialclassand set
> > > of options, like:
>
> > > <divclass="foobox sx-draggable { options} sx-resizable {options}"> //
> > > here foobox is left behind but the rest need to be recorded
>
> > > To be honest I have no idea on how to go and do that, I think the
> > > option I can use the same code and just check for m[0], m[1], m[2]
> > > ect...
>
> > > But the problem is as soon as I introduce an otherclassthe plugin
> > > just doesn't pick up anything anymore.
>
> > > The plugin in action:http://codeserenity.com/jquery/scriptless/demoX4.html
> > > The plugin 
> > > code:http://codeserenity.com/jquery/scriptless/js/jquery.scriptlessX4.js
>
> > > If anyone could point me in the right direction that would be lovely
> > > and make sure to point out again everything I do wrong or that could
> > > be done better in the code as I always learn a lot from you guys and
> > > still have TONNES to learn as some of my attempt to help other often
> > > show :p
>
> > > Thanks in advance.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"jQuery Development" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/jquery-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to