<commit_before>%html
  %head
    %link{ :href => "/stylesheets/screen.css", :rel => "stylesheet", :media => "screen", :type => "text/css", :charset => "utf-8" }/
    %script{ :src => "/javascripts/jquery-1.3.2.min.js",    :type => "text/javascript" }
    :javascript
      $(function() {
      

        function insertLink(url) {
          // Append &nbsp;, otherwise when the link is at the end and
          // the user clicks into the wysiwyg div, the cursor is inside
          // the link
          self.parent.$('#wysiwyg').focus();
          self.parent.document.execCommand('insertHTML', 
                                           false,
                                           '\n<a href="'+ url + '">' + url + '</a> &nbsp; ');
          self.parent.$tw.activateLinkEvents();
          self.parent.$tw.checkIfDirty();
          self.parent.tb_remove();
        }

        $('#insertLink form').submit(function() {
          var url;
          if ($('#insertLinkURL', this).size() > 0) {
            url = $('#insertLinkURL').val();
            insertLink(url);
          } else {
            $.ajax({ async    : false, 
                     url      : '/',
                     type     : 'POST',
                     dataType : 'json',
                     data     : {},
                     success  : function(data, textStatus) {
                                 insertLink(data['location']);<commit_msg>Fix inserting links on chrome<commit_after>%html
  %head
    %link{ :href => "/stylesheets/screen.css", :rel => "stylesheet", :media => "screen", :type => "text/css", :charset => "utf-8" }/
    %script{ :src => "/javascripts/jquery-1.3.2.min.js",    :type => "text/javascript" }
    :javascript
      $(function() {
      

        function insertLink(url) {
          // Append &nbsp;, otherwise when the link is at the end and
          // the user clicks into the wysiwyg div, the cursor is inside
          // the link
          self.parent.document.execCommand('insertHTML', 
                                           false,
                                           '\n<a href="'+ url + '">' + url + '</a> &nbsp; ');
          self.parent.$tw.activateLinkEvents();
          self.parent.$tw.checkIfDirty();
          self.parent.tb_remove();
        }

        $('#insertLink form').submit(function() {
          var url;
          if ($('#insertLinkURL', this).size() > 0) {
            url = $('#insertLinkURL').val();
            insertLink(url);
          } else {
            $.ajax({ async    : false, 
                     url      : '/',
                     type     : 'POST',
                     dataType : 'json',
                     data     : {},
                     success  : function(data, textStatus) {
                                 insertLink(data['location']);
{'fraction_non_alphanumeric': 0.15488454706927177, 'fraction_numerical': 0.003552397868561279, 'mean_word_length': 1.3525480367585632, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 10, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '394014', 'n_tokens_mistral': 751, 'n_tokens_neox': 726, 'n_words': 168}