~azzar1/unity/add-show-desktop-key

« back to all changes in this revision

Viewing changes to www/media/common/util.js

  • Committer: mattgiuca
  • Date: 2008-01-17 04:58:07 UTC
  • Revision ID: svn-v3-trunk0:2b9c9e99-6f39-0410-b283-7f802c844ae2:trunk:241
util.js: dom_make_link_elem: Added argument dontencode, necessary to sometimes
    not encode the href.
listing.js: When creating a download link for multiple files (which includes a
    query string), do manual URL encoding and set dontencode.

Show diffs side-by-side

added added

removed removed

Lines of Context:
69
69
 *  it will automatically be URL-encoded.
70
70
 * \param onclick Optional string. Will be set as the "onclick" attribute
71
71
 *  of the "a" element.
 
72
 * \param dontencode Optional boolean. If true, will not encode the href.
 
73
 *  if including query strings, you must set this to true and use build_url
 
74
 *  to escape the URI correctly.
72
75
 * \return DOM Element object.
73
76
 */
74
 
function dom_make_link_elem(tagname, text, title, href, onclick)
 
77
function dom_make_link_elem(tagname, text, title, href, onclick, dontencode)
75
78
{
76
79
    if (text == null) text = "";
77
80
    if (href == null) href = "";
78
81
    var elem = document.createElement(tagname);
79
82
    var link = document.createElement("a");
80
 
    link.setAttribute("href", urlencode_path(href));
 
83
    if (dontencode != true)
 
84
        href = urlencode_path(href);
 
85
    link.setAttribute("href", href);
81
86
    if (title != null)
82
87
        link.setAttribute("title", title);
83
88
    if (onclick != null)