<commit_before>// buffer-install-check.js
// (c) 2013 Buffer
// Adds an element to our app page that we can use to check if the browser has our extension installed.

var bufferMarkOurSite = function (version) {
	if (window.top !== window) return;

	if(document.location.host.match(/bufferapp.com/i)) {
		var extensionInformation = document.createElement('div');

		extensionInformation.setAttribute('id', 'browser-extension-check');
		extensionInformation.setAttribute('data-version', version);

		document.body.appendChild(extensionInformation);
	}
};
<commit_msg>Allow install check script to work in chrome.<commit_after>// buffer-install-check.js
// (c) 2013 Buffer
// Adds an element to our app page that we can use to check if the browser has our extension installed.

var bufferMarkOurSite = function (version) {
	if (window.top !== window) return;

	if(document.location.host.match(/bufferapp.com/i)) {
		var extensionInformation = document.createElement('div');

		extensionInformation.setAttribute('id', 'browser-extension-check');
		extensionInformation.setAttribute('data-version', version);

		document.body.appendChild(extensionInformation);
	}
};

// Chrome doesn't expose the version so easily with the permissions 
// we currently require, so we xhr for the manifest file to get the version.
if (typeof chrome !== 'undefined') {

  function getVersion(callback) {
    var xhr = new XMLHttpRequest();
    xhr.open('GET', chrome.extension.getURL('/manifest.json'));
    xhr.onload = function (e) {
      var manifest = JSON.parse(xhr.responseText);
      callback(manifest.version);
    }
    xhr.send(null);
  }
 
  getVersion(bufferMarkOurSite);

}

{'fraction_non_alphanumeric': 0.12304921968787515, 'fraction_numerical': 0.004801920768307323, 'mean_word_length': 4.429967426710098, '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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7521590', 'n_tokens_mistral': 487, 'n_tokens_neox': 459, 'n_words': 136}