<commit_before>function maximize (query) {
  var svg = d3.select(query + ' svg')
  var svgParent = d3.select(svg.node().parentNode)

  // create full screen container
  var container = d3.select('body')
    .append('div')
    .attr('id', 'full-screen-container')
    .style('position', 'fixed')
    .style('top', 0)
    .style('left', 0)
    .style('width', '100%')
    .style('height', '100%')

  // create full screen overlay
  var overlay = container
    .append('div')
    .attr('id', 'full-screen-overlay')
    .style('position', 'absolute')
    .style('top', 0)
    .style('left', 0)
    .style('width', '100%')
    .style('height', '100%')
    .style('background-color', 'white')
    .style('opacity', 0.8)
    .style('pointer-events', 'none')

  var closeBtn = container
    .append('button')
    .attr('onclick', 'd3.maximize.close()')
    .style('position', 'absolute')
    .style('top', 0)
    .style('right', 0)
    .style('padding', '1em')
    .style('z-index', 1000)
    .html('X')

  var w = parseInt(svg.style('width'), 10)
  var h = parseInt(svg.style('height'), 10)
  var aspect = w / h

  svg.attr('data-container-query', query)
  svg.attr('data-position-style', svg.style('position'))
  if (!svg.attr('viewBox')) svg.attr('viewBox', '0 0 ' + w + ' ' + h)

  // full screen CSS
  svg.style('position', 'absolute')

  reparent(svg, d3.select('#full-screen-container'))

  var targetW = parseInt(container.style('width'), 10)
  var targetH = parseInt(container.style('height'), 10)

  svg
    .attr('width', targetW)
    .attr('height', Math.min(targetW / aspect, targetH))
}

function reparent (child, parent) {
  parent.append(function () {
    return child.remove()[0][0]
  })
}

function closeFS () {
  var svg = d3.select('#full-screen-container svg')
  var query = svg.attr('data-maximize-query')
  var vb = svg.attr('viewBox').split(' ')
  reparent(svg, d3.select(query))
  d3.select(query + ' svg')
    .attr('width', vb[2])<commit_msg>More opaque overlay and vertical centering<commit_after>function maximize (query) {
  var svg = d3.select(query + ' svg')
  var svgParent = d3.select(svg.node().parentNode)

  // create full screen container
  var container = d3.select('body')
    .append('div')
    .attr('id', 'full-screen-container')
    .style('position', 'fixed')
    .style('top', 0)
    .style('left', 0)
    .style('width', '100%')
    .style('height', '100%')

  // create full screen overlay
  var overlay = container
    .append('div')
    .attr('id', 'full-screen-overlay')
    .style('position', 'absolute')
    .style('top', 0)
    .style('left', 0)
    .style('width', '100%')
    .style('height', '100%')
    .style('background-color', 'white')
    .style('opacity', 0.97)
    .style('pointer-events', 'none')

  var closeBtn = container
    .append('button')
    .attr('onclick', 'd3.maximize.close()')
    .style('position', 'absolute')
    .style('top', 0)
    .style('right', 0)
    .style('padding', '1em')
    .style('z-index', 1000)
    .html('X')

  var w = parseInt(svg.style('width'), 10)
  var h = parseInt(svg.style('height'), 10)
  var aspect = w / h

  svg.attr('data-container-query', query)
  svg.attr('data-position-style', svg.style('position'))
  if (!svg.attr('viewBox')) svg.attr('viewBox', '0 0 ' + w + ' ' + h)
  if (!svg.attr('preserveAspectRatio')) svg.attr('preserveAspectRatio', 'xMidYMid')

  // full screen CSS
  svg.style('position', 'absolute')

  reparent(svg, d3.select('#full-screen-container'))

  var targetW = parseInt(container.style('width'), 10)
  var targetH = parseInt(container.style('height'), 10)

  svg
    .attr('width', targetW)
    .attr('height', targetH)
}

function reparent (child, parent) {
  parent.append(function () {
    return child.remove()[0][0]
  })
}

function closeFS () {
  var svg = d3.select('#full-screen-container svg')
  var query = svg.attr('data-maximize-query')
  var vb = svg.attr('viewBox').split(' ')
  reparent(svg, d3.select(query))
  d3.select(query + ' svg')
    .attr('width', vb[2])
{'fraction_non_alphanumeric': 0.20733532934131738, 'fraction_numerical': 0.023203592814371257, 'mean_word_length': 3.5095613048368954, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6761162', 'n_tokens_mistral': 1496, 'n_tokens_neox': 1410, 'n_words': 292}