Changeset 32773


Ignore:
Timestamp:
2019-02-13T17:48:56+13:00 (5 years ago)
Author:
ak19
Message:

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

File:
1 edited

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
Note: See TracChangeset for help on using the changeset viewer.