Changeset 32773

Show
Ignore:
Timestamp:
13.02.2019 17:48:56 (11 days ago)
Author:
ak19
Message:

Minor change: optional parameter encode_percentages also introduced for makeSafeForURL, where it defaults to true this time

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone3/web/interfaces/default/js/document_scripts.js

    r32772 r32773  
    4242*/ 
    4343/* URL encode RESERVED characters in a non-URL context of a URL, such as the inline template (ilt) parameter value of a URL */ 
    44 function makeSafeForURL(url_part) { 
     44function makeSafeForURL(url_part, encode_percentages) { 
    4545    // https://stackoverflow.com/questions/7368407/javascript-replace-a-set-of-characters-with-another-one 
    4646    var reserved_mappings = { 
     
    5353    '&': '%26' 
    5454    }; 
    55      
    56     encode_percentages = 1; // to force the URL-encoding of any % in url_part, do this for inline-templates that haven't ever been encoded 
     55    // https://stackoverflow.com/questions/12797118/how-can-i-declare-optional-function-parameters-in-javascript 
     56    encode_percentages = encode_percentages || 1; // this method forces the URL-encoding of any % in url_part, e.g. do this for inline-templates that haven't ever been encoded 
    5757    url_part = makeURLSafe(url_part, encode_percentages); 
    5858