<commit_before>"use strict";

var { ToggleButton } = require("sdk/ui/button/toggle");
var simplePrefs = require("sdk/simple-prefs");
var prefsService = require("sdk/preferences/service");
var scalingPrefName = "layout.css.devPixelsPerPx";


var button = ToggleButton({
	id: "fxdpi-button",
	label: "HiDPI mode",
	icon: {
		"16": "./icon-16.png",
		"32": "./icon-32.png",
		"64": "./icon-64.png",
	},
	onChange: function(state) {
		// ToggleButton supports global, window and tab state. It
		// automatically sets the window state on click.
		// What we do here is copy the checked property from the given
		// (probably window) state to the global state and delete the
		// window state.
		button.checked = state.checked;
		button.state("window", null);

		simplePrefs.prefs["hidpi"] = state.checked;
	}
});

function updateHiDPI() {
	var enabled = simplePrefs.prefs["hidpi"];

	if (enabled) {
		//console.log("enable HiDPI");
		var factor = simplePrefs.prefs["factor"];
		prefsService.set(scalingPrefName, factor);
		button.label = "Disable HiDPI mode";
	} else {
		//console.log("disable HiDPI");
		prefsService.reset(scalingPrefName);
		button.label = "Enable HiDPI mode";
	}
	button.checked = enabled;
}<commit_msg>Replace PNG icon by SVG to make it scale nicely<commit_after>"use strict";

var { ToggleButton } = require("sdk/ui/button/toggle");
var simplePrefs = require("sdk/simple-prefs");
var prefsService = require("sdk/preferences/service");
var scalingPrefName = "layout.css.devPixelsPerPx";


var button = ToggleButton({
	id: "fxdpi-button",
	label: "HiDPI mode",
	icon: "./icon.svg",
	onChange: function(state) {
		// ToggleButton supports global, window and tab state. It
		// automatically sets the window state on click.
		// What we do here is copy the checked property from the given
		// (probably window) state to the global state and delete the
		// window state.
		button.checked = state.checked;
		button.state("window", null);

		simplePrefs.prefs["hidpi"] = state.checked;
	}
});

function updateHiDPI() {
	var enabled = simplePrefs.prefs["hidpi"];

	if (enabled) {
		//console.log("enable HiDPI");
		var factor = simplePrefs.prefs["factor"];
		prefsService.set(scalingPrefName, factor);
		button.label = "Disable HiDPI mode";
	} else {
		//console.log("disable HiDPI");
		prefsService.reset(scalingPrefName);
		button.label = "Enable HiDPI mode";
	}
	button.checked = enabled;
}
{'fraction_non_alphanumeric': 0.14677754677754679, 'fraction_numerical': 0.00498960498960499, 'mean_word_length': 4.174193548387096, 'pattern_counts': {'":': 3, '<': 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': '4061859', 'n_tokens_mistral': 838, 'n_tokens_neox': 788, 'n_words': 212}