<commit_before>/*global Workflows, Logger, Storage, $, Utils, JSONF, Rules, loadRules, currentTabId, loadTabsSettings, updateTabStats, fillAvailableRules, loadWorkflows*/
/*eslint no-unused-vars: 0*/

// Export rules as a newline seperated list of strings
var exportRulesAsJs = function() {
  var code = "";
  Rules.exportDataJson().then(function(rules) {
    var jsExport = rules.rules.map(function (codeAndTabId, index) {
      return "//\n// Tab: " + rules.tabSettings[index].name + "\n//\n" + codeAndTabId.code.replace(/\\n/g, "\n") + "\n";
    });
    jsExport = jsExport.join("\n").replace(/\\\"/g, '"');

    var now = new Date();
    var fileName = "fof-rules-js-export-" + now.toISOString() + ".js";

    Utils.infoMsg("Completed export as '" + fileName + "'");
    Utils.download(jsExport, fileName, "application/json");
  });
};

// Export rules and workflows
var exportAll = function() {
  Promise.all([Workflows.exportDataJson(), Rules.exportDataJson()]).then(function(workflowsAndRules) {
    var exportJson = {
      workflows: workflowsAndRules[0],
      rules: workflowsAndRules[1]
    };

    var now = new Date();
    var fileName = "fof-complete-export-" + now.toISOString() + ".js";

    Utils.infoMsg("Completed export as '" + fileName + "'");
    Utils.download(JSONF.stringify(exportJson), fileName, "application/json");
  });
};

// Show import all modal dialog
var showImportAllModal = function() {
  $("#modalimportall").show();
};

// Import all rules and workflows from disc
var importAll = function() {
  var $warning = $("#modalimportrules .only-json");
  $warning.hide();
  var fileToImport = document.getElementById("importall").files[0];

  if (typeof fileToImport === "undefined" || (fileToImport.type !== "application/json" && fileToImport.type !== "text/javascript")) {<commit_msg>add another mime type for import<commit_after>/*global Workflows, Logger, Storage, $, Utils, JSONF, Rules, loadRules, currentTabId, loadTabsSettings, updateTabStats, fillAvailableRules, loadWorkflows*/
/*eslint no-unused-vars: 0*/

// Export rules as a newline seperated list of strings
var exportRulesAsJs = function() {
  var code = "";
  Rules.exportDataJson().then(function(rules) {
    var jsExport = rules.rules.map(function (codeAndTabId, index) {
      return "//\n// Tab: " + rules.tabSettings[index].name + "\n//\n" + codeAndTabId.code.replace(/\\n/g, "\n") + "\n";
    });
    jsExport = jsExport.join("\n").replace(/\\\"/g, '"');

    var now = new Date();
    var fileName = "fof-rules-js-export-" + now.toISOString() + ".js";

    Utils.infoMsg("Completed export as '" + fileName + "'");
    Utils.download(jsExport, fileName, "application/json");
  });
};

// Export rules and workflows
var exportAll = function() {
  Promise.all([Workflows.exportDataJson(), Rules.exportDataJson()]).then(function(workflowsAndRules) {
    var exportJson = {
      workflows: workflowsAndRules[0],
      rules: workflowsAndRules[1]
    };

    var now = new Date();
    var fileName = "fof-complete-export-" + now.toISOString() + ".js";

    Utils.infoMsg("Completed export as '" + fileName + "'");
    Utils.download(JSONF.stringify(exportJson), fileName, "application/json");
  });
};

// Show import all modal dialog
var showImportAllModal = function() {
  $("#modalimportall").show();
};

// Import all rules and workflows from disc
var importAll = function() {
  var $warning = $("#modalimportrules .only-json");
  $warning.hide();
  var fileToImport = document.getElementById("importall").files[0];

  if (typeof fileToImport === "undefined" || (fileToImport.type !== "application/json" && fileToImport.type !== "text/javascript" && fileToImport.type !== "application/javascript")) {
{'fraction_non_alphanumeric': 0.1757085020242915, 'fraction_numerical': 0.0021592442645074223, 'mean_word_length': 4.0353260869565215, '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': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6415584', 'n_tokens_mistral': 1171, 'n_tokens_neox': 1150, 'n_words': 263}