[jQuery] superfish multiple menu

2009-04-06 Thread Viktor Iwan

Hello,
i think this one is pretty simple to do.. i would like to have
multiple superfish menu with different style.. any clue how to do
this ? i'm new to jquery


[jQuery] [autocomplete] Calling decodeURIComponent

2009-02-02 Thread Viktor Rutberg

Hello!

I've recently become involved with a project where we use the jQuery
Autocomplete plugin, and It's been working like a charm except for one
thing.

On our backend code we output data in an url encoded format (space
becomes %20 and so on), and in our jQuery code we want to decode this
to be more readable. To fix this in the autocomplete list we can
specify the formatItem option to a callback function which decodes the
data, but when the users selects a value from the list the data being
put into the input field is still not decoded.

I've tried specifying the formatResult, like so:

formatResult: function(data) { return decodeURIComponent(data[0]); }

That doesn't seem to work properly though, and perhaps I've
misunderstood exactly what formatResult does. I've tried looking at
what is being passed to the formatResult callback by specifying it to
alert or console.log, but that just gives me errors.

If there would be a way of specifying like a global formatting
function for the entire autocomplete plugin that would be great, since
all data needs to be decoded before display. Any help on this is
greatly appreciated.

/Viktor Rutberg


[jQuery] Jeditable, async value

2008-11-27 Thread Viktor

I'm using the fantastic Jeditable plugin, everything is great, but
there is one problem that I can't solve.

I submit the edited value to a function called setTitle
(successHandler, errorHandler, value)
which sends the data to the server
and if everything goes well (the server responses) it calls the
successHandler

If the server responses I wanna set the title to the new value
else
I'd like to use the old value

$(.title).editable(function(value, settings)
{
setTitle(function()
{
// return value
}, function()
{
  // return old_value
},
value);

 }, {
submit  : 'OK'
});


how can I solve it?

regards,
 Viktor


[jQuery] Re: best techniques to optimize loading of multiple libraries?

2008-09-03 Thread viktor

How do you minify a .js file?

On Aug 29, 11:04 pm, Bil Corry [EMAIL PROTECTED] wrote:
 Alex Weber wrote on 8/29/2008 10:15 AM:

  i'd rather use packed then minified though :)

 Use minified, not packed.  Although a packed file is smaller, it's overall 
 performance is worse when compared to minified:

 -
 This means, in the end, that using a minifed version of the code is much 
 faster than the packed one - even though its file size is quite larger.

 http://ejohn.org/blog/library-loading-speed/
 -

 - Bil


[jQuery] Re: How to make the first word bold.

2007-11-13 Thread Viktor Tarm

Thanks Wizzud... that's what I was looking for.

I had to wrap window.onload = (function(){try{ ... }catch(e){}});
around the script... not sure why, but it seems to work


On Nov 12, 5:48 pm, Wizzud [EMAIL PROTECTED] wrote:
 eg.

 $('#links a').each(function(){
 var me = $(this);
 me.html( me.text().replace(/(^\w+)/,'strong$1/strong') );
   });

 or

 $('#links a').each(function(){
 var me = $(this)
, t = me.text().split(' ');
 me.html( 'strong'+t.shift()+'/strong '+t.join(' ') );
   });

 etc

 On Nov 12, 9:17 pm, Andy Matthews [EMAIL PROTECTED] wrote:

  Viktor...

  You'd probably need an $.each() on there then.

  -Original Message-
  From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On

  Behalf Of Viktor Tarm
  Sent: Monday, November 12, 2007 2:35 PM
  To: jQuery (English)
  Subject: [jQuery] Re: How to make the first word bold.

  Thank you all for your help.

  Andy, I'm looking to bold the first WORD, of all the links, not the first
  link.

  Karl, I made a simple page to test your code. It looks like this:

  script type=text/javascript src=./src/jquery-1.2.1.pack.js/
  script
  script type=text/javascript
  $(document).ready(function() {
  var mystring = $('#links a').html();
  var firstword =
  mystring.replace(/(^\w+)/,'strong$1/strong');
  $('#links a').html(firstword);
  });
  /script

  /head
  body

  div id=links
  p class=titlea href=a.htmlone two three four five/a/p
  p class=titlea href=b.htmlsix seven eight/a/p
  p class=titlea href=c.htmlnine ten eleven/a/p
  p class=titlea href=d.htmltwelve thirteen fourteen/a/p
  /div

  This results in changing the content to = the first link's content, like so:

  div id=links
  p class=titlea href=a.htmlstrongOne/strong two three
  four five/a/p
  p class=titlea href=b.htmlstrongOne/strong two three
  four five/a/p
  p class=titlea href=c.htmlstrongOne/strong two three
  four five/a/p
  p class=titlea href=d.htmlstrongOne/strong two three
  four five/a/p /div

  I'm looking to just make the first word of the link bold (without changing
  the content), like this:

  div id=links
  p class=titlea href=a.htmlstrongOne/strong two three
  four five/a/p
  p class=titlea href=b.htmlstrongsix/strong seven eight/
  a/p
  p class=titlea href=c.htmlstrongnine/strong ten elevan/
  a/p
  p class=titlea href=d.htmlstrongtwelve/strong thirteen
  fourteen/a/p /div

  Any ideas?

  Thanks again.

  On Nov 12, 12:24 pm, Karl Swedberg [EMAIL PROTECTED] wrote:
   You could also do this with a regular expression. Maybe something like
   this:

   var mystring = $('#title a:first').html(); var firstword =
   mystring.replace(/(^\w+)/,'strong$1/strong');
   $('#title a:first').html(firstword);

   --Karl
   _
   Karl Swedbergwww.englishrules.comwww.learningjquery.com

   On Nov 12, 2007, at 11:52 AM, [EMAIL PROTECTED] wrote:

Somebody else probably has a more consice method but you could try
something like this

var mystring = One Two Three; //replace with your string var
stringarray = mystring.split( ); var firstword = mystring.split(
)[0]; myarray = jQuery.grep(stringarray, function(n, i){
  return (i  0);
});
$(div#title a).append(strong + firstword + /strong
).append(myarray.join( ));

On Nov 11, 8:56 pm, Viktor Tarm [EMAIL PROTECTED] wrote:
I am trying to make the first word of a sentence (a title from a
generated feed) bold.

TURN THIS:

div id=title
a href=123.htmlOne Two Three/a /div

INTO THIS:

div id=title
a href=123.htmlstrongOne/strong Two Three/a
/div

I sure there is a way to do with jQuery, but I can't quite figure
it out. I have tried something like this, with no luck:

$(#title.a).contents(0).wrap(strong/strong);

 
 
 Any help would be greatly appreciated.



[jQuery] Re: How to make the first word bold.

2007-11-13 Thread Viktor Tarm

Thanks a lot Wizzud... works perfectly.

On Nov 12, 5:48 pm, Wizzud [EMAIL PROTECTED] wrote:
 eg.

 $('#links a').each(function(){
 var me = $(this);
 me.html( me.text().replace(/(^\w+)/,'strong$1/strong') );
   });

 or

 $('#links a').each(function(){
 var me = $(this)
, t = me.text().split(' ');
 me.html( 'strong'+t.shift()+'/strong '+t.join(' ') );
   });

 etc

 On Nov 12, 9:17 pm, Andy Matthews [EMAIL PROTECTED] wrote:

  Viktor...

  You'd probably need an $.each() on there then.

  -Original Message-
  From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On

  Behalf Of Viktor Tarm
  Sent: Monday, November 12, 2007 2:35 PM
  To: jQuery (English)
  Subject: [jQuery] Re: How to make the first word bold.

  Thank you all for your help.

  Andy, I'm looking to bold the first WORD, of all the links, not the first
  link.

  Karl, I made a simple page to test your code. It looks like this:

  script type=text/javascript src=./src/jquery-1.2.1.pack.js/
  script
  script type=text/javascript
  $(document).ready(function() {
  var mystring = $('#links a').html();
  var firstword =
  mystring.replace(/(^\w+)/,'strong$1/strong');
  $('#links a').html(firstword);
  });
  /script

  /head
  body

  div id=links
  p class=titlea href=a.htmlone two three four five/a/p
  p class=titlea href=b.htmlsix seven eight/a/p
  p class=titlea href=c.htmlnine ten eleven/a/p
  p class=titlea href=d.htmltwelve thirteen fourteen/a/p
  /div

  This results in changing the content to = the first link's content, like so:

  div id=links
  p class=titlea href=a.htmlstrongOne/strong two three
  four five/a/p
  p class=titlea href=b.htmlstrongOne/strong two three
  four five/a/p
  p class=titlea href=c.htmlstrongOne/strong two three
  four five/a/p
  p class=titlea href=d.htmlstrongOne/strong two three
  four five/a/p /div

  I'm looking to just make the first word of the link bold (without changing
  the content), like this:

  div id=links
  p class=titlea href=a.htmlstrongOne/strong two three
  four five/a/p
  p class=titlea href=b.htmlstrongsix/strong seven eight/
  a/p
  p class=titlea href=c.htmlstrongnine/strong ten elevan/
  a/p
  p class=titlea href=d.htmlstrongtwelve/strong thirteen
  fourteen/a/p /div

  Any ideas?

  Thanks again.

  On Nov 12, 12:24 pm, Karl Swedberg [EMAIL PROTECTED] wrote:
   You could also do this with a regular expression. Maybe something like
   this:

   var mystring = $('#title a:first').html(); var firstword =
   mystring.replace(/(^\w+)/,'strong$1/strong');
   $('#title a:first').html(firstword);

   --Karl
   _
   Karl Swedbergwww.englishrules.comwww.learningjquery.com

   On Nov 12, 2007, at 11:52 AM, [EMAIL PROTECTED] wrote:

Somebody else probably has a more consice method but you could try
something like this

var mystring = One Two Three; //replace with your string var
stringarray = mystring.split( ); var firstword = mystring.split(
)[0]; myarray = jQuery.grep(stringarray, function(n, i){
  return (i  0);
});
$(div#title a).append(strong + firstword + /strong
).append(myarray.join( ));

On Nov 11, 8:56 pm, Viktor Tarm [EMAIL PROTECTED] wrote:
I am trying to make the first word of a sentence (a title from a
generated feed) bold.

TURN THIS:

div id=title
a href=123.htmlOne Two Three/a /div

INTO THIS:

div id=title
a href=123.htmlstrongOne/strong Two Three/a
/div

I sure there is a way to do with jQuery, but I can't quite figure
it out. I have tried something like this, with no luck:

$(#title.a).contents(0).wrap(strong/strong);

Any help would be greatly appreciated.



[jQuery] How to make the first word bold.

2007-11-12 Thread Viktor Tarm

I am trying to make the first word of a sentence (a title from a
generated feed) bold.

TURN THIS:

div id=title
a href=123.htmlOne Two Three/a
/div

INTO THIS:

div id=title
a href=123.htmlstrongOne/strong Two Three/a
/div

I sure there is a way to do with jQuery, but I can't quite figure it
out. I have tried something like this, with no luck:

$(#title.a).contents(0).wrap(strong/strong);

Any help would be greatly appreciated.