kumaraj's Profile User Rating: -----

Reputation: 3 Apprentice
Group:
Contributors
Active Posts:
78 (0.04 per day)
Joined:
12-February 09
Profile Views:
6,627
Last Active:
User is offline Aug 27 2012 03:24 AM
Currently:
Offline

Previous Fields

Country:
GB
OS Preference:
Windows
Favorite Browser:
Chrome
Favorite Processor:
Intel
Favorite Gaming Platform:
Playstation
Your Car:
Who Cares
Dream Kudos:
50

Latest Visitors

Icon   kumaraj has not set their status

Posts I've Made

  1. In Topic: jQuery separate words

    Posted 24 Aug 2012

    Just tested it, both work just as well ;)
  2. In Topic: jQuery separate words

    Posted 24 Aug 2012

    Thanks for all your help, really did help, I have plus one'd all of your posts - thanks. For anyone reading this in the future, here is the code I used. I decided to spend a couple of hours and learn RegEx, it's quite confusing but very useful! Here's my final code:

    				$('p').each(function() {
    					var tagRE = /([^<]*)(<(?:\"[^\"]*\"|'[^']*'|[^>'\"]*)*>)([^<]*)/g,
    						match,
    						result = [],
    						i = 0;
    
    					while(match = tagRE.exec($(this).html())) 
    					{
    						var text1 = match[1].split(/(\w+)/g),
    							len1 = text1.length;
    
    						var text2 = match[3].split(/(\w+)/g),
    							len2 = text2.length;
    							
    						for(var tIdx = 0; tIdx < len1; tIdx++ ) 
    							result[i++] = '<span class="word">' + text1[tIdx] + '</span>';            
    
    						result[i++] = match[2];
    
    						for(var tIdx = 0; tIdx < len2; tIdx++ ) 
    							result[i++] = '<span class="word">' + text2[tIdx] + '</span>';           
    							
    						console.log(text1);
    						console.log(text2);
    					}
    
    					$(this).html(result.join(''));
    				});
    
    


    Note, this also sorts out any HTML tags and so on and so forth :)

    PM me if you have any questions :)
  3. In Topic: jQuery separate words

    Posted 23 Aug 2012

    Aah, I'm really sorry, I'm still a little confused, I understand RegEx a bit more now, I don't know how I can execute this so that every word in the text is covered. And another question, is this the best way to do it because if the document is rather large, it could take a long time. Either way, this is what I've concucted, but how can I loop it so the whole text is covered?

    					var output;
    					var text = $(this).html();
    					// the RegExp
    					var re = /(\w+)/g;
    					// dump the resulting array 
    					var re.exec(text) );
    					
    					output += "<span class='word'>";
    					output += re.exec(text);
    					output += "</span>";
    
    


    Again - how do I loop it through?
  4. In Topic: jQuery separate words

    Posted 23 Aug 2012

    Ok, I think I understand but I'm not entirely sure, RegExp has always befuddled me. Would you be willing to give me a helping hand? I know it's a lot to ask but it would really help.

    Thank You once again.
  5. In Topic: Changing Filename in Download Link

    Posted 10 Aug 2012

    All the authentication is done, users have to be logged in in order to have access to the download link. What I'm trying to do is mask the filename with a random string of numbers so that the path to the file is not given away.

My Information

Member Title:
D.I.C Head
Age:
Age Unknown
Birthday:
Birthday Unknown
Gender:
Years Programming:
3
Programming Languages:
HTML, CSS, PHP, Javascript, VBScript, VB.NET, C#, AJAX, XHTML, Ruby, Python, Perl

Contact Information

E-mail:
Private

Friends

Comments

kumaraj has no profile comments yet. Why not say hello?