[jQuery] Re: jquery-corner plugin not working anymore?

2009-03-16 Thread j0llyr0g3r

Hmm,

but then my chances are good of breaking the functionality of my other
jquery-plugins, right?

What a mess..

I also tried nifty-corners -> absolutely horrible, not to mention the
fact that it is uber-intrusive (like f**king up non-related CSS and so
on).

Any other good plugins you could recommend?

On Mar 15, 9:23 pm, donb  wrote:
> I would give jQuery 1.2.6 a try.  Some plugins have trouble with 1.3.x
>
> On Mar 15, 3:24 pm, j0llyr0g3r 
> wrote:
>
> > Hi Mike,
>
> > well, when i "corner" the div itself like this:
>
> > CODE:
>
> >  > "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
> > 
> >   
> >     
> >     
> >     
> >     //<![CDATA[
> >     jQuery(document).ready(function(){
> >       alert('doc ready!');
> >       jQuery("#home_start_register_button").corner('bevel');
> >     });
> >     //]]>
> >     
> >   
> >   
> > 
> >   
> >     
> >   
> > 
> > 
> > 
>
> > something funny happens:
>
> > The corners are NOT rounded at all, but instead, the left lower corner
> > is cut off / disappears.
>
> > Can somebody reproduce this behaviour?
>
> > And even better, can somebody tell me how to get this to work?
>
> > On Mar 14, 3:40 pm, Mike Alsup  wrote:
>
> > > >     jQuery("#home_start_register_button input").corner();
>
> > > Are you trying to corner an input element?  I would not expect that to
> > > work.


[jQuery] Re: jquery-corner plugin not working anymore?

2009-03-15 Thread j0llyr0g3r

Hi Mike,

well, when i "corner" the div itself like this:

CODE:



  



//

  
  

  

  




something funny happens:

The corners are NOT rounded at all, but instead, the left lower corner
is cut off / disappears.

Can somebody reproduce this behaviour?

And even better, can somebody tell me how to get this to work?

On Mar 14, 3:40 pm, Mike Alsup  wrote:
> >     jQuery("#home_start_register_button input").corner();
>
> Are you trying to corner an input element?  I would not expect that to
> work.


[jQuery] jquery-corner plugin not working anymore?

2009-03-14 Thread j0llyr0g3r

Hey guys,

i am having trouble with the jquery-corner plugin.

To narrow down my problem i created a really simple example page:

CODE:


  



//

  
  

  

  




What i would have expected:

-> Display of the button with rounded corners

What happens instead:

-> the alert-box is shown
-> i can see that the corners of the button are rounded while my alert-
box is not closed, but after closing the alert-box the corners return
to their old, not-rounded layout

Further information:

- No errors are shown in the javascript error console
- i also tried to put the js-call in the head-section within a
document.ready-block like this:


//

-> no effect, i.e. the corners of the button are rounded while my
alert-box is not closed, but after closing the alert-box they return
to their old, not-rounded layout
- i use FF3 and jquery v1.3.2 and jquery-corners 1.95 (so only the
latest versions)

Any ideas on this?

Any help would be greatly appreciated.


[jQuery] Re: Refactoring problem with jquery-selectors

2008-12-28 Thread j0llyr0g3r

Hui,

fast reply.:-)

I did as you proposed and it works fine now.

Special thanks for the explanation!

On 28 Dez., 22:26, "Michael Geary"  wrote:
> The problem is the first line in your clickOnTableRowResultSet() function:
>
>         var row = jQuery(this);
>
> When you were using that function directly as a click handler, 'this' was
> set to the element being clicked. But now you are calling the function
> through an ordinary function call, so 'this' is not the same any more. (It's
> now the global object, i.e. the window object.)
>
> To fix it:
>
> function addClickHandler(tableId, functionName, myUrl)  {
>         jQuery('#' + tableId + ' ' +
> 'tbody').children('tr').click(function()
> {
>                 functionName(this,myUrl);
>         });
>
> }
>
> And:
>
> function clickOnTableRowResultSet(element,url) {...}
>
> -Mike
>
> > From: j0llyr0g3r
>
> > Hey guys,
>
> > i am having problems with some refactoring:
>
> > I have some html-tables to which i add an onclick-handler like this:
>
> > CODE:
> > addClickHandler('myTableID',myFunction);
>
> > 'addClickHandler' looks like this:
>
> > CODE:
> > function addClickHandler(tableId, functionName)    {
> >    jQuery('#' + tableId + ' ' +
> > 'tbody').children('tr').click (functionName); }
>
> > Now, all the functions i pass to this onclick-Handler look
> > almost the same :
>
> > CODE:
> > function clickOnTableRowResultSet() {
> >    var row = jQuery(this);
> >    var songUrl = trimAll(row.find('td:last form input
> > [name=hidden_url_field]').val());
> >         var trackID = trimAll(row.find('td:last form input
> > [name=hidden_id_field]').val());
> >    var trackInfoUrl = "/tracks/track_info/" + trackID;
> >    sendPlayEventToPlayer(songUrl);
> >    jQuery.ajax({success:function(request){$('#track_info').html
> > (request);}, url:trackInfoUrl, async:false}); } CODE
>
> > with trimAll being:
>
> > CODE
> > /*
> >  * trimAll replaces all whitespace and newlines from a string
> >  */ function trimAll(str) {
> >    return str.replace(/\n+|\s+/g,"");
> > }
>
> > All of these functions basically do the same: they read out
> > hidden fields in the last column of the table row, send an
> > event to a flash- player and update a certain part of the website.
>
> > The only thing in which they differ, is this part:
>
> >    var trackInfoUrl = "/tracks/track_info/" + trackID;
>
> > So i wanted to summarize all my almost identical functions
> > into one by passing the above mentioned url to them.
>
> > I tried it like this:
>
> > Call to addClickHandler on the website:
>
> > CODE
>
> > addClickHandler('list_tracks_table',clickOnTableRowResultSet,
> > '/ tracks/track_info/' );
>
> > Then I changed my addClickHandler like this:
>
> > CODE
> > function addClickHandler(tableId, functionName, myUrl)     {
> >    jQuery('#' + tableId + ' ' +
> > 'tbody').children('tr').click(function()
> > {
> >            functionName(myUrl);
> >    });
> > }
>
> > And finally summarized my clickOnTable...-functions like this:
>
> > function clickOnTableRowResultSet(url) {
> >    var row = jQuery(this);
> >    var songUrl = trimAll(row.find('td:last form input
> > [name=hidden_url_field]').val());
> >         var trackID = trimAll(row.find('td:last form input
> > [name=hidden_id_field]').val());
> >    var trackInfoUrl = url + trackID;
> >    sendPlayEventToPlayer(songUrl);
> >    jQuery.ajax({success:function(request){$('#track_info').html
> > (request);}, url:trackInfoUrl, async:false}); }
>
> > So far, this looks good to me, but unfortunately it doesn't work.
> > Using debugging i see that 'clickOnTableRowResultSet' gets
> > passed the correct url, but then the line afterwards:
>
> > CODE
> >    var songUrl = trimAll(row.find('td:last form input
> > [name=hidden_url_field]').val());
>
> > gives me the JS-error:
> > Error: str is undefined
>
> > in function trimAll, which basically means that
>
> >       row.find('td:last form input[name=hidden_url_field]').val()
>
> > yields undef.
>
> > This is what i don't get, i didn't change any part of the
> > logic which deals with finding the fields, etc.
>
> > None of my changes affected these parts - at least in my
> > eyes. But somehow the jquery-selectors seem to be unable to
> > find my rows?
>
> > Does anybody see what's the problem here?


[jQuery] Refactoring problem with jquery-selectors

2008-12-28 Thread j0llyr0g3r

Hey guys,

i am having problems with some refactoring:

I have some html-tables to which i add an onclick-handler like this:

CODE:
addClickHandler('myTableID',myFunction);

'addClickHandler' looks like this:

CODE:
function addClickHandler(tableId, functionName) {
jQuery('#' + tableId + ' ' + 'tbody').children('tr').click
(functionName);
}

Now, all the functions i pass to this onclick-Handler look almost the
same :

CODE:
function clickOnTableRowResultSet() {
var row = jQuery(this);
var songUrl = trimAll(row.find('td:last form input
[name=hidden_url_field]').val());
var trackID = trimAll(row.find('td:last form input
[name=hidden_id_field]').val());
var trackInfoUrl = "/tracks/track_info/" + trackID;
sendPlayEventToPlayer(songUrl);
jQuery.ajax({success:function(request){$('#track_info').html
(request);}, url:trackInfoUrl, async:false});
}
CODE

with trimAll being:

CODE
/*
 * trimAll replaces all whitespace and newlines from a string
 */
function trimAll(str) {
return str.replace(/\n+|\s+/g,"");
}

All of these functions basically do the same: they read out hidden
fields in the last column of the table row, send an event to a flash-
player and update a certain part of the website.

The only thing in which they differ, is this part:

var trackInfoUrl = "/tracks/track_info/" + trackID;

So i wanted to summarize all my almost identical functions into one by
passing the above mentioned url to them.

I tried it like this:

Call to addClickHandler on the website:

CODE
   addClickHandler('list_tracks_table',clickOnTableRowResultSet, '/
tracks/track_info/' );

Then I changed my addClickHandler like this:

CODE
function addClickHandler(tableId, functionName, myUrl)  {
jQuery('#' + tableId + ' ' + 'tbody').children('tr').click(function()
{
functionName(myUrl);
});
}

And finally summarized my clickOnTable...-functions like this:


function clickOnTableRowResultSet(url) {
var row = jQuery(this);
var songUrl = trimAll(row.find('td:last form input
[name=hidden_url_field]').val());
var trackID = trimAll(row.find('td:last form input
[name=hidden_id_field]').val());
var trackInfoUrl = url + trackID;
sendPlayEventToPlayer(songUrl);
jQuery.ajax({success:function(request){$('#track_info').html
(request);}, url:trackInfoUrl, async:false});
}


So far, this looks good to me, but unfortunately it doesn't work.
Using debugging i see that 'clickOnTableRowResultSet' gets passed the
correct url, but then the line afterwards:

CODE
var songUrl = trimAll(row.find('td:last form input
[name=hidden_url_field]').val());

gives me the JS-error:
Error: str is undefined

in function trimAll, which basically means that

  row.find('td:last form input[name=hidden_url_field]').val()

yields undef.

This is what i don't get, i didn't change any part of the logic which
deals with finding the fields, etc.

None of my changes affected these parts - at least in my eyes. But
somehow the jquery-selectors seem to be unable to find my rows?

Does anybody see what's the problem here?



[jQuery] Re: how to select the content of the current table row?

2008-12-22 Thread j0llyr0g3r

Cam Spiers,

thank you very much,

i adapted your really helpfull example and solved it like this:

function clickOnTableRow() {
var row = jQuery(this);
var songUrl = 
row.children("td.hidden_url_field_for_track_list").text
();
   // do other stuff with songUrl
}

Again, thanks very much, i lost hours trying to figure this out by
myself.

On Dec 23, 12:22 am, "Cam Spiers"  wrote:
> var rows = jQuery("tbody tr");
>
> rows.each(function(){
> var row = jQuery(this);
> row.click(function(event){
> alert(row.children("td.hidden_url_field_for_track_list").text());
>
> });
> });
>
> Sorry I missed a semicolon..
>
> On Tue, Dec 23, 2008 at 12:21 PM, Cam Spiers  wrote:
> > var rows = jQuery("tbody tr");
>
> > rows.each(function(){
> > var row = jQuery(this)
> > row.click(function(event){
> > alert(row.children("td.hidden_url_field_for_track_list").text());
> > });
> > });
>
> > Haven't tested but you could try something like this maybe.
>
> > On Tue, Dec 23, 2008 at 11:40 AM, j0llyr0g3r <
> > th3.gr31t.j0lly.r0...@googlemail.com> wrote:
>
> >> Hey guys,
>
> >> i'm having a hard time with jquery right now.
>
> >> Imagine the following simple table:
>
> >> CODE:
>
> >>         
> >>            
> >>              
> >>              
> >>              
> >>              
> >>              
> >>            
>
> >>            
> >>              
> >>                Title
> >>                
> >>                  Genre
> >>                
> >>                
> >>                  Speed
> >>                
> >>                
> >>                  Length
> >>                
> >>              
> >>            
> >>            
> >>              
>
> >>                
> >>                  Cocktail Lounge
> >>                
> >>                
> >>                  Chill
> >>                
> >>                
> >>                  126
> >>                
> >>                
>
> >>                  03:03
> >>                
> >>                
> >>                  /mp3/stream/MM-MB-0030-COCKTAIL-LOUNGE-126BPM.mp3
> >> 
>
> >> As you can see, the last field of the row gets hidden via CSS.
> >> Now i have defined an onclick-Handler for every row of the table like
> >> this:
>
> >> CODE:
>
> >>        function addClickHandler(tableId)       {
>
> >>                var tableObj = document.getElementById(tableId);
> >>                var tBody = tableObj.getElementsByTagName('TBODY');
> >>                if(tBody){
> >>                        var rows = tBody[0].getElementsByTagName('TR');
> >>                }else{
> >>                        var rows = tableObj.getElementsByTagName('TR');
> >>                }
> >>                for(var no=0;no >>                        rows[no].onclick = clickOnTableRow
> >>                }
> >>        }
>
> >> 'clickOnTableRow' looks like this:
>
> >> CODE:
>
> >>        function clickOnTableRow()
> >>        {
> >>          alert ("working!")
> >>       }
>
> >> Now, clickOnTableRow() is working when i click on a table row (i can
> >> see that because of the alert-box), but how can i now select the
> >> contents of the last hidden field of this exact row?
>
> >> I tried it like this:
>
> >> CODE:
> >>        function clickOnTableRow()
> >>        {
> >>                var foo =
> >> jQuery(this).('hidden_url_field_for_track_list').text();
> >>                console.info("content: " + foo);
> >>        }
>
> >> but this gives me:
>
> >> "content: undefined"
>
> >> Then i tried:
>
> >>        function clickOnTableRow()
> >>        {
> >>                var foo = jQuery('hidden_url_field_for_track_list').text();
> >>                console.info("content: " + foo);
> >>        }
>
> >> but this gives me just:
>
> >> "content:"
>
> >> What am i doing wrong here?
>
> >> But no


[jQuery] how to select the content of the current table row?

2008-12-22 Thread j0llyr0g3r

Hey guys,

i'm having a hard time with jquery right now.

Imagine the following simple table:

CODE:

 

  
  
  
  
  



  
Title

  Genre


  Speed


  Length

  


  


  Cocktail Lounge


  Chill


  126



  03:03


  /mp3/stream/MM-MB-0030-COCKTAIL-LOUNGE-126BPM.mp3


As you can see, the last field of the row gets hidden via CSS.
Now i have defined an onclick-Handler for every row of the table like
this:

CODE:

function addClickHandler(tableId)   {

var tableObj = document.getElementById(tableId);
var tBody = tableObj.getElementsByTagName('TBODY');
if(tBody){
var rows = tBody[0].getElementsByTagName('TR');
}else{
var rows = tableObj.getElementsByTagName('TR');
}
for(var no=0;no

[jQuery] Strange AJAX + jquery refresh problem

2008-10-29 Thread j0llyr0g3r

Hey folks,

i am really getting desperate here. I use jquery (current version)
with RoR 2.0.

Now i have a problem with a login-mask for users.

I fetch and submit typed in username and password like this:

 CODE --
jQuery("#index_login_submit").click(function(event){
  jQuery.ajax(
{success:function(request){$('#login').html(request);},
url:"/authentication/login",
data:"user_name="+jQuery('[EMAIL PROTECTED]').val()
+"&password="+jQuery('[EMAIL PROTECTED]').val(),
async:false});

-

As you can see, when the AJAX-call suceeds, the returned html is
injected into the login-div.
Among that injected html is a logout-button.

I "ajaxified" this logout-button like this:

 CODE --

jQuery("#index_logout_submit").click(function(event){
  jQuery.ajax({success:function(request){$
('#login').html(request);}, url:"/authentication/logout",
async:false});
  event.preventDefault();
});
-

THE PROBLEM:

This login works fine and the logout-button is shown on successful
login, but now i have a weird problem:

- When i click on the logout-button directly after i logged in, the
click-event is not captured via javascript.
- A quick look into the generated page source tells me why: The logout-
button is _NOT_ existent in the page source-code although i can SEE
that logout-button when i look at the website in my browser.
- Only when i hit the browsers refresh-button page-view and page-
source are synchronous

What is happening here and how can i get this to work _without_ having
to hit the refresh-button?