/[drupal]/contributions/modules/urlify/urlify.js
ViewVC logotype

Diff of /contributions/modules/urlify/urlify.js

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.1, Sat Sep 29 06:23:39 2007 UTC revision 1.1.2.1, Sat Sep 29 06:23:39 2007 UTC
# Line 0  Line 1 
1    function URLify(s, num_chars) {
2      // changes, e.g., "Petty theft" to "petty_theft"
3      // remove all these words from the string before urlifying
4      var removelist = [Drupal.settings.urlify.remove_list];
5      r = new RegExp('\\\b(' + removelist.join('|') + ')\\\b', 'gi');
6      s = s.replace(r, '');
7      s = s.replace(/[^-A-Z0-9\s]/gi, '');  // remove unneeded chars
8      s = s.replace(/^\s+|\s+$/g, '');      // trim leading/trailing spaces
9      s = s.replace(/[-\s]+/g, '-');        // convert spaces to hyphens
10      s = s.toLowerCase();                  // convert to lowercase
11      return s.substring(0, num_chars);     // trim to first num_chars chars
12    }
13    

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.1.2.1

  ViewVC Help
Powered by ViewVC 1.1.2