<commit_before>/* globals bufferpm, chrome, safari */

// Put together a query string for the iframe
var buildSrc = function(data, config) {

  var src = data.local ?
    config.overlay.localendpoint :
    config.overlay.endpoint;

  var qs = '';

  config.attributes.forEach(function(attr, i){
    if ( !data[ attr.name ] ) return;
    if ( qs.length ) qs += '&';
    qs += attr.name + '=' + attr.encode( data[attr.name] );
  });

  if (qs.length) src += '?' + qs;

  return src;
};

var openPopUp = function(src, port, doneCallback, isSmallPopup) {

  // Open popups from privileged code
  port.emit('buffer_open_popup', { src: src, isSmallPopup: isSmallPopup });

  // Bind close listener
  // Listen for when the overlay has closed itself
  bufferpm.bind("buffermessage", function(overlaydata) {
    bufferpm.unbind("buffermessage");
    setTimeout(function () {
      doneCallback(overlaydata);
    }, 0);
    window.focus();
  });
};

/**
 * This is a list of domains that have a strict Content Security Policy
 * This is a temporary work around while we figure out a long term solution
 * to this issue: https://github.com/bufferapp/buffer-chrome/issues/12
 */
var CSPWhitelist = [
  'twitter.com',
  'github.com',
  'gist.github.com',
  'education.github.com',
  'medium.com',
  'www.npmjs.org',
  'www.npmjs.com',
  'www.flickr.com',
  'www.oculus.com',
  'letsecure.me',
  'rework.withgoogle.com',
  'threatpost.com',
  'www.websec.be',
  'adblockplus.org',
  'www.change.org',
  'www.paypal.com',
];

var shouldOpenSmallPopupForUrl = function(url) {
  var hostname = window.location.hostname;
  var pathname = window.location.pathname;

  var isTwitterIntent = /twitter.com$/.test(hostname) && /^\/intent/.test(pathname);

  if (isTwitterIntent) return true;
  else return false;
}

// Build that overlay!<commit_msg>Add securelist.com to CSP whitelist<commit_after>/* globals bufferpm, chrome, safari */

// Put together a query string for the iframe
var buildSrc = function(data, config) {

  var src = data.local ?
    config.overlay.localendpoint :
    config.overlay.endpoint;

  var qs = '';

  config.attributes.forEach(function(attr, i){
    if ( !data[ attr.name ] ) return;
    if ( qs.length ) qs += '&';
    qs += attr.name + '=' + attr.encode( data[attr.name] );
  });

  if (qs.length) src += '?' + qs;

  return src;
};

var openPopUp = function(src, port, doneCallback, isSmallPopup) {

  // Open popups from privileged code
  port.emit('buffer_open_popup', { src: src, isSmallPopup: isSmallPopup });

  // Bind close listener
  // Listen for when the overlay has closed itself
  bufferpm.bind("buffermessage", function(overlaydata) {
    bufferpm.unbind("buffermessage");
    setTimeout(function () {
      doneCallback(overlaydata);
    }, 0);
    window.focus();
  });
};

/**
 * This is a list of domains that have a strict Content Security Policy
 * This is a temporary work around while we figure out a long term solution
 * to this issue: https://github.com/bufferapp/buffer-chrome/issues/12
 */
var CSPWhitelist = [
  'twitter.com',
  'github.com',
  'gist.github.com',
  'education.github.com',
  'medium.com',
  'www.npmjs.org',
  'www.npmjs.com',
  'www.flickr.com',
  'www.oculus.com',
  'letsecure.me',
  'rework.withgoogle.com',
  'threatpost.com',
  'www.websec.be',
  'adblockplus.org',
  'www.change.org',
  'www.paypal.com',
  'securelist.com'
];

var shouldOpenSmallPopupForUrl = function(url) {
  var hostname = window.location.hostname;
  var pathname = window.location.pathname;

  var isTwitterIntent = /twitter.com$/.test(hostname) && /^\/intent/.test(pathname);

  if (isTwitterIntent) return true;
  else return false;
}

// Build that overlay!
{'fraction_non_alphanumeric': 0.15093318907222072, 'fraction_numerical': 0.0016229375169055991, 'mean_word_length': 3.487864077669903, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 14, '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': '1255668', 'n_tokens_mistral': 1283, 'n_tokens_neox': 1246, 'n_words': 302}