<commit_before>// register service worker

if ('serviceWorker' in navigator) {
  navigator.serviceWorker.register('/sw-test/sw.js', {
    scope: '/*'
  }).then(function() {
    // registration worked
    console.log('Registration succeeded.');
  }).catch(function() {
    // registration failed
    console.log('Registration failed.');
  });
}

// function for loading each image via XHR

function imgLoad(imgJSON) {
// return a promise for an image loading
return new Promise(function(resolve, reject) {	  
  var request = new XMLHttpRequest();
  request.open('GET', imgJSON.url);
  request.responseType = 'blob';
  
  request.onload = function() {
	    if (request.status == 200) {
	      var arrayResponse = [];
	      arrayResponse[0] = request.response;
	      arrayResponse[1] = imgJSON;
	      resolve(arrayResponse);
	    } else {
	      reject(Error('Image didn\'t load successfully; error code:' + request.statusText));
	    }
  };

    request.onerror = function() {
      reject(Error('There was a network error.'));
  };
  
  // Send the request
  request.send();
  });
};

// Function to call random star wars quote

function quoteLoad() {
// return a promise for a random quote loading
return new Promise(function(resolve, reject) {	  
  var request = new XMLHttpRequest();
  request.open('GET', 'https://iheartquotes.com/api/v1/random?source=starwars&max_lines=4&max_characters=320');
  request.responseType = 'text';
  
  request.onload = function() {
	    if (request.status == 200) {
	      resolve(request.response);
	    } else {
	      reject(Error('Quote didn\'t load successfully; error code:' + request.statusText));
	    }
  };

    request.onerror = function() {
      reject(Error('There was a network error.'));
  };
  
  // Send the request
  request.send();
  });
};

var imgSection = document.querySelector('section');
var quotePara = document.querySelector('section p');

window.onload = function() {

  // load each set of image, alt text, name and caption
  for(i = 0; i<=Gallery.images.length-1; i++) {
    imgLoad(Gallery.images[i]).then(function(arrayResponse) {
<commit_msg>debugging cross domain request<commit_after>// register service worker

if ('serviceWorker' in navigator) {
  navigator.serviceWorker.register('/sw-test/sw.js', {
    scope: '/*'
  }).then(function() {
    // registration worked
    console.log('Registration succeeded.');
  }).catch(function() {
    // registration failed
    console.log('Registration failed.');
  });
}

// function for loading each image via XHR

function imgLoad(imgJSON) {
// return a promise for an image loading
return new Promise(function(resolve, reject) {	  
  var request = new XMLHttpRequest();
  request.open('GET', imgJSON.url);
  request.responseType = 'blob';
  
  request.onload = function() {
	    if (request.status == 200) {
	      var arrayResponse = [];
	      arrayResponse[0] = request.response;
	      arrayResponse[1] = imgJSON;
	      resolve(arrayResponse);
	    } else {
	      reject(Error('Image didn\'t load successfully; error code:' + request.statusText));
	    }
  };

    request.onerror = function() {
      reject(Error('There was a network error.'));
  };
  
  // Send the request
  request.send();
  });
};

// Function to call random star wars quote

function quoteLoad() {
// return a promise for a random quote loading
return new Promise(function(resolve, reject) {	  
  var request = new XMLHttpRequest();
  request.open('GET', 'https://iheartquotes.com/api/v1/random?source=starwars&max_lines=4&max_characters=320', true);
  request.responseType = 'text';
  
  request.onload = function() {
	    if (request.status == 200) {
	      resolve(request.response);
	    } else {
	      reject(Error('Quote didn\'t load successfully; error code:' + request.statusText));
	    }
  };

    request.onerror = function() {
      reject(Error('There was a network error.'));
  };
  
  // Send the request
  request.send();
  });
};

var imgSection = document.querySelector('section');
var quotePara = document.querySelector('section p');

window.onload = function() {

  // load each set of image, alt text, name and caption
  for(i = 0; i<=Gallery.images.length-1; i++) {
    imgLoad(Gallery.images[i]).then(function(arrayResponse) {

{'fraction_non_alphanumeric': 0.14615203577312308, 'fraction_numerical': 0.007060484819957637, 'mean_word_length': 3.341164453524004, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 2, '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': '24706', 'n_tokens_mistral': 1303, 'n_tokens_neox': 1254, 'n_words': 318}