Action

URL Encode Links

Posted by ericalinhu, Last update 10 months ago

Replace the selected text with a URL encoded version.

Steps

  • script

    var s = draft.content;
    
    s = s.replace(/ /gm, "\+");
    s = s.replace(/\t/gm, "%09");
    s = s.replace(/\!/gm, "%21");
    s = s.replace(/\"/gm, "%22");
    s = s.replace(/\#/gm, "%23");
    s = s.replace(/\$/gm, "%24");
    s = s.replace(/\%/gm, "%25");
    s = s.replace(/\&/gm, "%26");
    s = s.replace(/\'/gm, "%27");
    s = s.replace(/\(/gm, "%28");
    s = s.replace(/\)/gm, "%29");
    s = s.replace(/\,/gm, "%2C");
    s = s.replace(/\-/gm, "%2D");
    s = s.replace(/\;/gm, "%3B");
    s = s.replace(/\</gm, "%3C");
    s = s.replace(/\=/gm, "%3D");
    s = s.replace(/\>/gm, "%3E");
    s = s.replace(/\?/gm, "%3F");
    s = s.replace(/\*/gm, "%2A");
    s = s.replace(/\|/gm, "%7B");
    s = s.replace(/\`/gm, "%60");
    s = s.replace(/\_/gm, "%5F");
    s = s.replace(/http%3A/gm, "http\:");
    s = s.replace(/https%3A/gm, "https\:");
    s = s.replace(/%0A/gm, "\n");
    s = s.replace(/\%2525/gm, "\%25");
    s = s.replace(/\%25/gm, "\%");
    draft.content = s;
    draft.update();

Options

  • After Success Default
    Notification Error
    Log Level Error
Items available in the Drafts Directory are uploaded by community members. Use appropriate caution reviewing downloaded items before use.