<commit_before>const {classes: Cc, interfaces: Ci, utils: Cu} = Components;

Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/AddonManager.jsm");

var self = this, icon;

function include(path) {
  Services.scriptloader.loadSubScript(addon.getResourceURI(path).spec, self);
}

var addon = {
  getResourceURI: function(filePath) ({
    spec: __SCRIPT_URI_SPEC__ + "/../" + filePath
  })
};

function $(node, childId) {
  if (node.getElementById) {
    return node.getElementById(childId);
  } else {
    return node.querySelector("#" + childId);
  }
}

function modify(window) {
  if (!window) return;
  
  let doc = window.document,
      win = doc.querySelector("window");
  
  // add button
  let button = doc.createElement("toolbarbutton");
  button.setAttribute("id", BUTTON_ID);
  button.setAttribute("label", _("label"));
  button.setAttribute("class", "toolbarbutton-1 chromeclass-toolbar-additional");
  button.setAttribute("tooltiptext", _("tooltip"));
  button.style.listStyleImage = "url(" + icon + ")";
  button.addEventListener("command", main.action, false);
  restorePosition(doc, button);
  
  // add hotkey
  let keyset = doc.createElement("keyset");
  keyset.setAttribute("id", KEYSET_ID);
  let replaceKey = doc.createElement("key");
  replaceKey.setAttribute("key", "D");
  replaceKey.setAttribute("modifiers", "accel,alt");
  replaceKey.setAttribute("oncommand", "void(0);");
  replaceKey.addEventListener("command", main.action, true);
  keyset.appendChild(replaceKey);
  win.appendChild(keyset);
  
  unload(function() {
    button.parentNode.removeChild(button);
    keyset.parentNode.removeChild(keyset);
  }, window);<commit_msg>Change the hotkey to Alt-Shift-D<commit_after>const {classes: Cc, interfaces: Ci, utils: Cu} = Components;

Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/AddonManager.jsm");

var self = this, icon;

function include(path) {
  Services.scriptloader.loadSubScript(addon.getResourceURI(path).spec, self);
}

var addon = {
  getResourceURI: function(filePath) ({
    spec: __SCRIPT_URI_SPEC__ + "/../" + filePath
  })
};

function $(node, childId) {
  if (node.getElementById) {
    return node.getElementById(childId);
  } else {
    return node.querySelector("#" + childId);
  }
}

function modify(window) {
  if (!window) return;
  
  let doc = window.document,
      win = doc.querySelector("window");
  
  // add button
  let button = doc.createElement("toolbarbutton");
  button.setAttribute("id", BUTTON_ID);
  button.setAttribute("label", _("label"));
  button.setAttribute("class", "toolbarbutton-1 chromeclass-toolbar-additional");
  button.setAttribute("tooltiptext", _("tooltip"));
  button.style.listStyleImage = "url(" + icon + ")";
  button.addEventListener("command", main.action, false);
  restorePosition(doc, button);
  
  // add hotkey
  let keyset = doc.createElement("keyset");
  keyset.setAttribute("id", KEYSET_ID);
  let replaceKey = doc.createElement("key");
  replaceKey.setAttribute("key", "D");
  replaceKey.setAttribute("modifiers", "shift,alt");
  replaceKey.setAttribute("oncommand", "void(0);");
  replaceKey.addEventListener("command", main.action, true);
  keyset.appendChild(replaceKey);
  win.appendChild(keyset);
  
  unload(function() {
    button.parentNode.removeChild(button);
    keyset.parentNode.removeChild(keyset);
  }, window);
{'fraction_non_alphanumeric': 0.16475433951162108, 'fraction_numerical': 0.0011768167107972932, 'mean_word_length': 4.954465849387041, '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': '1487612', 'n_tokens_mistral': 1059, 'n_tokens_neox': 1076, 'n_words': 189}