<commit_before>/*!
 * jQuery Notify Plugin
 *
 * Copyright (c) 2012, 2013 <NAME>
 *
 * Licensed under the MIT license.
 * http://www.opensource.org/licenses/mit-license.php
 */
(function($) {
  var queue = $({});
  var queuedTexts = [];

  var render = function(html, level, sticky, timeout, complete) {
    var m = $('<div>').attr('class', 'message');

    if (level) {
      m.addClass(level);
    }
    if (sticky) {
      m.addClass('sticky');
    }
    m.hide();

    m.html(html);
    $('#messages').append(m);
    m.show();

    if (sticky) {
      m.click(function(ev) {
        $(this).remove();
        complete();
      });

      // Do not continue and probably show next message.
      return;
    }

    // Multiply the timeout for complex messages,
    // giving comprehension time. Give 1s per 30chars over the first 25 chars.
    timeout += 1000 * (($($.parseHTML(html)).text().length - 25) / 30);

    setTimeout(function(){
      m.fadeOut('fast', function() {
        $(this).remove();
        complete(); // Show next message in queue.
      });
    }, timeout);
  };

  $.notify = function(html, level, sticky, timeout) {
    // Prevent flooding; no more than 2 pending messages. We start at
    // zero as this is called before the first item is queued.
    if (queue.queue().length >= 2) {
      return;
    }
    // Currently only one message at the time. Allowing showing multiple
    // message here will might need a more sophisticated method of managment.
    queue.queue(function(next) {
      render(html, level, sticky || false, timeout || 2100, next);
    });
  };
})(jQuery);<commit_msg>Use options for more flexibility.<commit_after>/*!
 * jQuery Notify Plugin
 *
 * Copyright (c) 2012, 2013 <NAME>
 *
 * Licensed under the MIT license.
 * http://www.opensource.org/licenses/mit-license.php
 */
(function($) {
  var queue = $({});
  var queuedTexts = [];

  var render = function(html, options, complete) {
    var m = $('<div>').attr('class', 'message');

    if (options.level) {
      m.addClass(level);
    }
    if (options.sticky) {
      m.addClass('sticky');
    }
    m.hide();

    m.html(html);
    $('#messages').append(m);
    m.show();

    if (options.sticky) {
      m.click(function(ev) {
        $(this).remove();
        complete();
      });

      // Do not continue and probably show next message.
      return;
    }

    // Multiply the timeout for complex messages,
    // giving comprehension time. Give 1s per 30chars over the first 25 chars.
    options.timeout = 1000 * (($($.parseHTML(html)).text().length - 25) / 30);

    setTimeout(function() {
      $container.trigger('notify:remove', [m]);
      m.fadeOut('fast', function() {
        $(this).remove();
        complete(); // Show next message in queue.
      });
    }, options.timeout);
  };

  $.notify = function(html, options) {
    options = $.extend(options || {}, {
      level: null,
      sticky: false,
      timeout: 2100
    });

    // Prevent flooding; no more than 2 pending messages. We start at
    // zero as this is called before the first item is queued.
    if (queue.queue().length >= 2) {
      return;
    }
    // Currently only one message at the time. Allowing showing multiple
    // message here will might need a more sophisticated method of managment.
    queue.queue(function(next) {
      render(html, options, next);
    });
  };
})(jQuery);
{'fraction_non_alphanumeric': 0.158375036797174, 'fraction_numerical': 0.01589637915808066, 'mean_word_length': 2.4392712550607287, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '1935110', 'n_tokens_mistral': 1086, 'n_tokens_neox': 1001, 'n_words': 305}