<commit_before>// This file is the friendlycode half of a proxy layer between Thimble functionality
// (like publishing) and bramble's codemirror instance. It was designed to map to existing
// friendlycode use of codemirror, with the exception of duplicate functionality
// between bramble and friendlycode that bramble already provides (or will)
/*global define */
define(["backbone-events", "fc/prefs", "fc/bramble-ui-bridge"],
  function(BackboneEvents, Preferences, BrambleUIBridge) {
  "use strict";

  var eventCBs = {
    "change": [],
    "reparse": [],
    "loaded": [],
    "viewlink": []
  };
  var telegraph;
  var iframe;

  function BrambleProxy(place, options) {
    iframe = document.createElement("iframe");
    var latestSource = "(none)";
    var prefSize = Preferences.get("textSize");
    var that = this;
    var lastLine = 0;
    var scrollInfo;

    var editorHost = this.editorHost = options.editorHost;

    function communicateEditMessage(fn) {
      var argLen = arguments.length;
      var callback = typeof arguments[argLen - 1] === "function" ? arguments[argLen - 1] : undefined;
      var params = Array.prototype.slice.call(arguments, 1, callback ? argLen - 1 : argLen);

      if(callback) {
        window.addEventListener("message", function editReceiver(e) {
          var message = JSON.parse(e.data);

          // Make sure we only take postMessages seriously
          // when they come from our editor
          if (e.origin !== editorHost) {
            return;
          }

          if(message.type !== "bramble:edit" || message.fn !== fn) {
            return;
          }

          window.removeEventListener("message", editReceiver);

          callback(message.value);
        });<commit_msg>Get initial HTML loading to work again, don't pass (none)<commit_after>// This file is the friendlycode half of a proxy layer between Thimble functionality
// (like publishing) and bramble's codemirror instance. It was designed to map to existing
// friendlycode use of codemirror, with the exception of duplicate functionality
// between bramble and friendlycode that bramble already provides (or will)
/*global define */
define(["backbone-events", "fc/prefs", "fc/bramble-ui-bridge"],
  function(BackboneEvents, Preferences, BrambleUIBridge) {
  "use strict";

  var eventCBs = {
    "change": [],
    "reparse": [],
    "loaded": [],
    "viewlink": []
  };
  var telegraph;
  var iframe;

  function BrambleProxy(place, options) {
    var latestSource;
    var prefSize = Preferences.get("textSize");
    var that = this;
    var lastLine = 0;
    var scrollInfo;

    var editorHost = this.editorHost = options.editorHost;

    function communicateEditMessage(fn) {
      var argLen = arguments.length;
      var callback = typeof arguments[argLen - 1] === "function" ? arguments[argLen - 1] : undefined;
      var params = Array.prototype.slice.call(arguments, 1, callback ? argLen - 1 : argLen);

      if(callback) {
        window.addEventListener("message", function editReceiver(e) {
          var message = JSON.parse(e.data);

          // Make sure we only take postMessages seriously
          // when they come from our editor
          if (e.origin !== editorHost) {
            return;
          }

          if(message.type !== "bramble:edit" || message.fn !== fn) {
            return;
          }

          window.removeEventListener("message", editReceiver);

          callback(message.value);
        });
{'fraction_non_alphanumeric': 0.11578341013824885, 'fraction_numerical': 0.002880184331797235, 'mean_word_length': 2.8333333333333335, 'pattern_counts': {'":': 8, '<': 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': '6637736', 'n_tokens_mistral': 988, 'n_tokens_neox': 938, 'n_words': 294}