{"size": 1833, "ext": "js", "max_stars_repo_path": "ingress-opr-helper/scripts/popup.js", "max_stars_repo_name": "zsrkmyn/ingress-opr-helper", "max_stars_repo_stars_event_min_datetime": "2017-08-21T15:11:11.000Z", "max_stars_repo_stars_event_max_datetime": "2018-06-01T09:41:10.000Z", "max_issues_repo_path": "ingress-opr-helper/scripts/popup.js", "max_issues_repo_name": "zsrkmyn/ingress-opr-helper", "max_issues_repo_issues_event_min_datetime": "2017-08-21T15:13:30.000Z", "max_issues_repo_issues_event_max_datetime": "2017-08-21T15:15:31.000Z", "max_forks_repo_path": "ingress-opr-helper/scripts/popup.js", "max_forks_repo_name": "zsrkmyn/ingress-opr-helper", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 4, "max_issues_count": 1, "max_forks_count": null, "avg_line_length": 25.8169014085, "max_line_length": 71, "alphanum_fraction": 0.6453900709}
new Promise(
	(resolve, reject) => {
		chrome.runtime.sendMessage({action: 'load_settings'},
			(settings) => {
				if (settings === undefined) {
					reject(chrome.runtime.lastError.message);
				} else {
					resolve(settings);
				}
			});
	}
).then(
	(settings) => {
		var doInit = () => {
			if (document.readyState != 'complete')
				return;

			var satelliteChecker = document.getElementById('satellite');
			var roadChecker = document.getElementById('road');
			var providerSelector = document.getElementById('provider');
			var fixChinaChecker = document.getElementById('fixchina');

			roadChecker.checked = settings.road;
			roadChecker.addEventListener('change', (e) => {
				chrome.runtime.sendMessage({
					action: 'set',
					params: {road: e.target.checked}
				});
			}, false);

			satelliteChecker.checked = settings.satellite;
			satelliteChecker.addEventListener('change', (e) => {
				chrome.runtime.sendMessage({
					action: 'set',
					params: {satellite: e.target.checked}
				});
			}, false);

			fixChinaChecker.checked = settings.fixChina;
			fixChinaChecker.addEventListener('change', (e) => {
				chrome.runtime.sendMessage({
					action: 'set',
					params: {fixChina: e.target.checked}
				});
			}, false);

			OPRHelperProviders.forEach((p, i) => {
				var opt = document.createElement('option');
				opt.value = opt.innerHTML = p;
				providerSelector.appendChild(opt);
				if (p == settings.provider)
					providerSelector.selectedIndex = i;
			});
			providerSelector.addEventListener('change', (e) => {
				chrome.runtime.sendMessage({
					action: 'set',
					params: {provider: e.target.options[e.target.selectedIndex].value}
				});
			}, false);
		}

		if (document.readyState == 'complete')
			doInit();
		else
			document.onreadystatechange = doInit;
	}
).then(
	null,
	console.error
)
