<commit_before>/*
 * immoral
 * https://github.com/aniketpant/immoral
 *
 * Copyright (c) 2013 <NAME>
 * Licensed under the MIT license.
 */

(function($) {

  // Collection method.
  $.fn.awesome = function() {
    return this.each(function(i) {
      // Do something awesome to each selected element.
      $(this).html('awesome' + i);
    });
  };

  // Static method.
  $.awesome = function(options) {
    // Override default options with passed-in options.
    options = $.extend({}, $.awesome.options, options);
    // Return something awesome.
    return 'awesome' + options.punctuation;
  };

  // Static method default options.
  $.awesome.options = {
    punctuation: '.'
  };

  // Custom selector.
  $.expr[':'].awesome = function(elem) {
    // Is this element awesome?
    return $(elem).text().indexOf('awesome') !== -1;
  };

}(jQuery));<commit_msg>Update code for using as a jQuery plugin<commit_after>/*
 * immoral
 * https://github.com/aniketpant/immoral
 *
 * Copyright (c) 2013 <NAME>
 * Licensed under the MIT license.
 */

(function($) {

  // Collection method.
  $.fn.immoral = function() {
    return this.each(function() {
      // Do something immoral to each selected element.
      init($(this).attr('href'));

      $('.modal').on('click', 'a[rel="modal:close"]', function(e) {
        e.preventDefault();
        var parentModal = '#' + $(this).closest('.modal').attr('id');
        modalClose(parentModal);
      });
    });
  };

  // Static method.
  $.immoral = function(options) {
    // Override default options with passed-in options.
    $.immoral.options = $.extend({}, $.immoral.options, options);
    // Return something immoral.
    return 'immoralized';
  };

  function modalShadowInit() {
    var modalShadow = $.immoral.options.modalShadow;
    if(!modalShadow) {
      $('body').append($.immoral.options.modalShadowDiv);
      $.immoral.options.modalShadow = $('#modal_shadow');
    }
  }

  function init(element) {
    var modalObj = $(element);
    var modalObjName = modalObj.attr('id');
    modalObj.wrap($.immoral.options.modalWrapper);
    var modalWhole = modalObj.parent('.modal-wrapper');

    // Hide the whole thing.
    modalWhole.hide().attr('id', modalObjName + '-wrapper');

    // apply styles
    modalObj.css($.immoral.options.modalStyle).show();

    // Add close Button
    $($.immoral.options.modalCloseButton).attr('id', modalObjName + '_close');
    modalObj.prepend($.immoral.options.modalCloseButton);

    // Initialize Modal Shadow
    modalShadowInit();
    modalOn(element);
  }

  function modalOn(element) {
    var modalWhole = $(element).parent();
    var modalShadow = $.immoral.options.modalShadow;
    modalShadow.fadeIn();
    modalWhole.fadeIn();
  }

  function modalClose(element) {
    if(element) {
      var modalWhole = $(element).parent('.modal-wrapper');
      modalWhole.fadeOut();
    } else {
      $('.modal').parent().fadeOut();
    }
    var modalShadow = $.immoral.options.modalShadow;
    modalShadow.fadeOut();
  }

  // Static method default options.
  $.immoral.options = {
    modalShadowDiv: '<div id="modal_shadow" style="display:none;"></div>',
    modalWrapper: '<div class="modal-wrapper" />',
    modalCloseButton: '<a href="#" rel="modal:close">Close</a>',
    modalShadow: false,
    modalStyle: {
      width: '50%',
      height: '50%',
      margin: '0 auto'
    }
  };

  // Custom element.
  $.expr[':'].immoral = function(elem) {
    // Is this element immoral?
    return $(elem).text().indexOf('immoral') !== -1;
  };

}(jQuery));
{'fraction_non_alphanumeric': 0.1775464265616207, 'fraction_numerical': 0.004220596510973551, 'mean_word_length': 2.945615982241953, 'pattern_counts': {'":': 0, '<': 10, '<?xml version=': 0, '>': 10, 'https://': 2, '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': '5850522', 'n_tokens_mistral': 1131, 'n_tokens_neox': 1090, 'n_words': 230}