<commit_before>/**
 * @fileOverview Privly Application specific code.
 * This file modifies the privly-web adapter found
 * in the shared directory.
 **/

/**
 * Display rendered markdown as a preview of the post.
 */
function previewMarkdown() {
  preview.innerHTML = markdown.toHTML(document.getElementById("content").value);
}

/**
 * Add the decryption key to the anchor of the URL.
 *
 * @param {jqxhr} response The response from the server containing the
 * URL that needs to be modified.
 * @param {string} randomkey The decryption key for the content held at the
 * server.
 * @param {string} The URL with the link key appended.
 */
function processURL(response, randomkey) {
  if( response.jqXHR.status !== 201 ) {
    return "";
  }
  var url = response.jqXHR.getResponseHeader("X-Privly-Url");
  if( url.indexOf("#") > 0 ) {
    url = url.replace("#", "#privlyLinkKey="+randomkey);
  } else {
    url = url + "#privlyLinkKey=" + randomkey;
  }

  // Save the URL to localStorage
  var urls = ls.getItem("ZeroBin:URLs");
  if ( urls !== undefined ) {
    ls.setItem("ZeroBin:URLs", urls + "|" + url);
  } else {
    ls.setItem("ZeroBin:URLs", url);
  }
  return url;
}<commit_msg>limited remembering ZeroBin URLs to non-hosted code<commit_after>/**
 * @fileOverview Privly Application specific code.
 * This file modifies the privly-web adapter found
 * in the shared directory.
 **/

/**
 * Display rendered markdown as a preview of the post.
 */
function previewMarkdown() {
  preview.innerHTML = markdown.toHTML(document.getElementById("content").value);
}

/**
 * Add the decryption key to the anchor of the URL.
 *
 * @param {jqxhr} response The response from the server containing the
 * URL that needs to be modified.
 * @param {string} randomkey The decryption key for the content held at the
 * server.
 * @param {string} The URL with the link key appended.
 */
function processURL(response, randomkey) {
  if( response.jqXHR.status !== 201 ) {
    return "";
  }
  var url = response.jqXHR.getResponseHeader("X-Privly-Url");
  if( url.indexOf("#") > 0 ) {
    url = url.replace("#", "#privlyLinkKey="+randomkey);
  } else {
    url = url + "#privlyLinkKey=" + randomkey;
  }

  // Save the URL to localStorage if we are not in the HOSTED platform
  if ( privlyNetworkService.platformName() !== "HOSTED" ) {
    var urls = ls.getItem("ZeroBin:URLs");
    if ( urls !== undefined ) {
      ls.setItem("ZeroBin:URLs", urls + "|" + url);
    } else {
      ls.setItem("ZeroBin:URLs", url);
    }
  }

  return url;
}
{'fraction_non_alphanumeric': 0.13704581358609794, 'fraction_numerical': 0.00315955766192733, 'mean_word_length': 3.50711743772242, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4846463', 'n_tokens_mistral': 815, 'n_tokens_neox': 789, 'n_words': 253}