Changeset 2265


Ignore:
Timestamp:
2001-04-03T12:57:00+12:00 (23 years ago)
Author:
sjboddie
Message:

Played about with some regular expressions in the preferences page
javascript code to prevent URLs from growing huge if the user repeatedly
changes various options.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl/macros/pref.dm

    r2114 r2265  
    227227function updatel () \{
    228228  value = document.PrefForm.l.options[document.PrefForm.l.selectedIndex].value;
    229   location.href = location.href + "&nl=1&l=" + value + getargs();
     229  href = location.href;
     230  if (href.match(/&l=\\w\\w/)) href = href.replace(/&l=\\w\\w/, "&l=" + value);
     231  else href += "&l=" + value;
     232  if (!location.href.match(/&nl=1$/)) href += "&nl=1";
     233  location.href = href + getargs();
    230234\}
    231235
    232236function updatev () \{
    233237  value = document.PrefForm.v.options[document.PrefForm.v.selectedIndex].value;
    234   location.href = location.href + "&v=" + value + getargs();
     238  href = location.href;
     239  if (href.match(/&v=\\d/)) href = href.replace(/&v=\\d/, "&v=" + value);
     240  else href += "&v=" + value;
     241  location.href = href + getargs();
    235242\}
    236243
    237244function updatew () \{
    238245  value = document.PrefForm.w.options[document.PrefForm.w.selectedIndex].value;
    239   location.href = location.href + "&nl=0&nw=" + value + getargs();
     246  href = location.href;
     247  if (href.match(/&nw=[^&]+/)) href = href.replace(/&nw=[^&]+/, "&nw=" + value);
     248  else href += "&nw=" + value;
     249  if (!location.href.match(/&nl=0$/)) href += "&nl=0";
     250  location.href = href + getargs();
    240251\}
    241252
Note: See TracChangeset for help on using the changeset viewer.