<commit_before>var getSelectedHTML = function() {
  chrome.tabs.query({active: true}, function(tabs) {
    var tab = tabs[0]

    chrome.tabs.executeScript(
      {
        file: './serializeSelectedHTML.js',
        runAt: 'document_end'
      },
      renderSelectedHTML
    )
  })
}

var renderSelectedHTML = function(selection) {
  const parsedSelection = JSON.parse(selection)  
  
  var modify = []

  const selectedBox = document.getElementById('capsule-selected-content')
  
  if (parsedSelection.html) {
    selectedBox.innerHTML = parsedSelection.html
  }
}

var sendHTML = function(htmlString) {
  chrome.tabs.getSelected(function(selectedTab) {
    let serialisedURI = encodeURI('ssb-capsule://transmit?body='
                                    .concat(htmlString)
                                    .concat('&src=').concat(selectedTab.url))
      
    const serialiserTabProps = {
      url: serialisedURI,
      active: true
    }

    console.log('launching a capsule...')
    chrome.tabs.create(serialiserTabProps, function(URITab) {<commit_msg>switched to base64 for encoding data in URI<commit_after>var getSelectedHTML = function() {
  chrome.tabs.query({active: true}, function(tabs) {
    var tab = tabs[0]

    chrome.tabs.executeScript(
      {
        file: './serializeSelectedHTML.js',
        runAt: 'document_end'
      },
      renderSelectedHTML
    )
  })
}

var renderSelectedHTML = function(selection) {
  const parsedSelection = JSON.parse(selection)  
  
  var modify = []

  const selectedBox = document.getElementById('capsule-selected-content')
  
  if (parsedSelection.html) {
    selectedBox.innerHTML = parsedSelection.html
  }
}

var encodeHTMLString = function(htmlString) {
  // see:
  // https://specifications.freedesktop.org/desktop-entry-spec/latest/ar01s06.html
  // for how terrible this can get

  // anyway we're just going to base64 it
  return btoa(encodeURIComponent(htmlString))
}

var sendHTML = function(htmlString) {
  chrome.tabs.getSelected(function(selectedTab) {
    let serialisedURI = encodeURI('ssb-capsule://transmit?body='
                                    .concat(htmlString)
                                    .concat('&src=').concat(selectedTab.url))
      
    const serialiserTabProps = {
      url: serialisedURI,
      active: true
    }

    console.log('launching a capsule...')
    chrome.tabs.create(serialiserTabProps, function(URITab) {
{'fraction_non_alphanumeric': 0.1147811725846408, 'fraction_numerical': 0.004128819157720892, 'mean_word_length': 2.699236641221374, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5788645', 'n_tokens_mistral': 729, 'n_tokens_neox': 700, 'n_words': 127}