<commit_before>var tabs = require("sdk/tabs");
var data = require("sdk/self").data;


var panel = require("sdk/panel").Panel({
  contentURL: data.url("panel.html"),
  contentScriptFile: [
	data.url("panel.js"),
	data.url("jquery.min.js")
	],
  onHide: handleHide
});

var button = require('sdk/ui/button/toggle').ToggleButton({
  id: "reddit-submission-finder-panel",
  label: "Reddit Submission Finder",
  icon: {
    "16": "./icon-16.png",
    "32": "./icon-32.png",
    "64": "./icon-64.png"
  },
  onChange: handleChange
});

panel.on("show", function() {
  panel.port.emit("show", tabs.activeTab.url);
});

panel.on("hide", function() {
  panel.port.emit("hide");
});

panel.port.on("open-link", function (url) {
  console.log(url);
  tabs.open(url);
});

function handleChange(state) {
  if (state.checked) {
    panel.show({
      position: button,
	  width: 400,
	  height: 400
    });
  }
}

function handleHide() {
  button.state('window', {checked: false});
}<commit_msg>close panel when submission is clicked<commit_after>var tabs = require("sdk/tabs");
var data = require("sdk/self").data;


var panel = require("sdk/panel").Panel({
  contentURL: data.url("panel.html"),
  contentScriptFile: [
	data.url("panel.js"),
	data.url("jquery.min.js")
	],
  onHide: handleHide
});

var button = require('sdk/ui/button/toggle').ToggleButton({
  id: "reddit-submission-finder-panel",
  label: "Reddit Submission Finder",
  icon: {
    "16": "./icon-16.png",
    "32": "./icon-32.png",
    "64": "./icon-64.png"
  },
  onChange: handleChange
});

panel.on("show", function() {
  panel.port.emit("show", tabs.activeTab.url);
});

panel.on("hide", function() {
  panel.port.emit("hide");
});

panel.port.on("open-link", function (url) {
  console.log(url);
  tabs.open(url);
  panel.hide();
});

function handleChange(state) {
  if (state.checked) {
    panel.show({
      position: button,
	  width: 400,
	  height: 400
    });
  }
}

function handleHide() {
  button.state('window', {checked: false});
}
{'fraction_non_alphanumeric': 0.2114713216957606, 'fraction_numerical': 0.017955112219451373, 'mean_word_length': 3.799043062200957, 'pattern_counts': {'":': 6, '<': 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': '1006326', 'n_tokens_mistral': 750, 'n_tokens_neox': 716, 'n_words': 130}