<commit_before>/*!
* Copyright 2002 - 2014 Webdetails, a Pentaho company.  All rights reserved.
* 
* This software was developed by Webdetails and is provided under the terms
* of the Mozilla Public License, Version 2.0, or any later version. You may not use
* this file except in compliance with the license. If you need a copy of the license,
* please go to  http://mozilla.org/MPL/2.0/. The Initial Developer is Webdetails.
*
* Software distributed under the Mozilla Public License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or  implied. Please refer to
* the license for the specific language governing your rights and limitations.
*/

/*
 * Function: fnLengthChange
 * Purpose:  Change the number of records on display
 * Returns:  array:
 * Inputs:   object:oSettings - DataTables settings object
 *           int:iDisplay - New display length
 */

 // Ensure we load dataTables before this line. If not, just keep going
if($.fn.dataTableExt != undefined){
  $.fn.dataTableExt.oApi.fnLengthChange = function ( oSettings, iDisplay )
  {
    oSettings._iDisplayLength = iDisplay;
    oSettings.oApi._fnCalculateEnd( oSettings );

    // If we have space to show extra rows backing up from the end point - then do so
    if ( oSettings._iDisplayEnd == oSettings.aiDisplay.length )
    {
      oSettings._iDisplayStart = oSettings._iDisplayEnd - oSettings._iDisplayLength;
      if ( oSettings._iDisplayStart < 0 )
      {
        oSettings._iDisplayStart = 0;
      }
    }

    if ( oSettings._iDisplayLength == -1 )
    {
      oSettings._iDisplayStart = 0;
    }

    oSettings.oApi._fnDraw( oSettings );

    $('select', oSettings.oFeatures.l).val( iDisplay );
  };
/* Example
 * $(document).ready(function() {
 *    var oTable = $('#example').dataTable();
 *    oTable.fnLengthChange( 100 );
 * } );
 */

  /* If table elements have class 'numeric' and values are represented as strings (e.g. "234456.5675")
   let's try and convert them to numeric values for sorting. Source based on version 1.7.5 of dataTables.js */
  $.extend( $.fn.dataTableExt.oSort, {
    "numeric-asc": function ( a, b ) {
      a = (a=="-"||a=="") ? 0 : ($.isNumeric(a) ? a*1 : 0);
      b = (b=="-"||b=="") ? 0 : ($.isNumeric(b) ? b*1 : 0);
      return ((a < b) ? -1 : ((a > b) ? 1 : 0));
    },

    "numeric-desc": function ( a, b ) {
      a = (a=="-"||a=="") ? 0 : ($.isNumeric(a) ? a*1 :0);
      b = (b=="-"||b=="") ? 0 : ($.isNumeric(b) ? b*1 :0);
      return ((a < b) ? 1 : ((a > b) ? -1 : 0));
    }
  });
}

/*
 * DataTables 1.10 `two_button` pagination control compatibility file
 */
if(jQuery.fn.DataTable != undefined && jQuery.fn.DataTable.ext != undefined) {
  jQuery.extend(jQuery.fn.DataTable.ext.classes, {
    "sPagePrevEnabled": "paginate_enabled_previous",
    "sPagePrevDisabled": "paginate_disabled_previous",
    "sPageNextEnabled": "paginate_enabled_next",
    "sPageNextDisabled": "paginate_disabled_next"
  });

  jQuery.extend(jQuery.fn.DataTable.ext.oJUIClasses, {
    "sPagePrevEnabled": "fg-button ui-button ui-state-default ui-corner-left",
    "sPagePrevDisabled": "fg-button ui-button ui-state-default ui-corner-left ui-state-disabled",
    "sPageNextEnabled": "fg-button ui-button ui-state-default ui-corner-right",
    "sPageNextDisabled": "fg-button ui-button ui-state-default ui-corner-right ui-state-disabled",
    "sPageJUINext": "ui-icon ui-icon-circle-arrow-e",
    "sPageJUIPrev": "ui-icon ui-icon-circle-arrow-w"
  });

  jQuery.extend(jQuery.fn.DataTable.ext.pager, {
    "two_button": {
      "fnInit": function (oSettings, nPaging, fnCallbackDraw) {
        var oLang = oSettings.oLanguage.oPaginate;<commit_msg>[CDE-285]: Fixed 'New' style for table component<commit_after>/*!
* Copyright 2002 - 2014 Webdetails, a Pentaho company.  All rights reserved.
* 
* This software was developed by Webdetails and is provided under the terms
* of the Mozilla Public License, Version 2.0, or any later version. You may not use
* this file except in compliance with the license. If you need a copy of the license,
* please go to  http://mozilla.org/MPL/2.0/. The Initial Developer is Webdetails.
*
* Software distributed under the Mozilla Public License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or  implied. Please refer to
* the license for the specific language governing your rights and limitations.
*/

/*
 * Function: fnLengthChange
 * Purpose:  Change the number of records on display
 * Returns:  array:
 * Inputs:   object:oSettings - DataTables settings object
 *           int:iDisplay - New display length
 */

 // Ensure we load dataTables before this line. If not, just keep going
if($.fn.dataTableExt != undefined){
  $.fn.dataTableExt.oApi.fnLengthChange = function ( oSettings, iDisplay )
  {
    oSettings._iDisplayLength = iDisplay;
    oSettings.oApi._fnCalculateEnd( oSettings );

    // If we have space to show extra rows backing up from the end point - then do so
    if ( oSettings._iDisplayEnd == oSettings.aiDisplay.length )
    {
      oSettings._iDisplayStart = oSettings._iDisplayEnd - oSettings._iDisplayLength;
      if ( oSettings._iDisplayStart < 0 )
      {
        oSettings._iDisplayStart = 0;
      }
    }

    if ( oSettings._iDisplayLength == -1 )
    {
      oSettings._iDisplayStart = 0;
    }

    oSettings.oApi._fnDraw( oSettings );

    $('select', oSettings.oFeatures.l).val( iDisplay );
  };
/* Example
 * $(document).ready(function() {
 *    var oTable = $('#example').dataTable();
 *    oTable.fnLengthChange( 100 );
 * } );
 */

  /* If table elements have class 'numeric' and values are represented as strings (e.g. "234456.5675")
   let's try and convert them to numeric values for sorting. Source based on version 1.7.5 of dataTables.js */
  $.extend( $.fn.dataTableExt.oSort, {
    "numeric-asc": function ( a, b ) {
      a = (a=="-"||a=="") ? 0 : ($.isNumeric(a) ? a*1 : 0);
      b = (b=="-"||b=="") ? 0 : ($.isNumeric(b) ? b*1 : 0);
      return ((a < b) ? -1 : ((a > b) ? 1 : 0));
    },

    "numeric-desc": function ( a, b ) {
      a = (a=="-"||a=="") ? 0 : ($.isNumeric(a) ? a*1 :0);
      b = (b=="-"||b=="") ? 0 : ($.isNumeric(b) ? b*1 :0);
      return ((a < b) ? 1 : ((a > b) ? -1 : 0));
    }
  });
}

/*
 * DataTables 1.10 `two_button` pagination control compatibility file
 */
if(jQuery.fn.DataTable != undefined && jQuery.fn.DataTable.ext != undefined) {
  jQuery.extend(jQuery.fn.DataTable.ext.classes, {
    "sNoFooter" : "",
    "sPagePrevEnabled": "paginate_enabled_previous",
    "sPagePrevDisabled": "paginate_disabled_previous",
    "sPageNextEnabled": "paginate_enabled_next",
    "sPageNextDisabled": "paginate_disabled_next"
  });

  jQuery.extend(jQuery.fn.DataTable.ext.oJUIClasses, {
    "sNoFooter" : "",
    "sSortable" : "",
    "sSortAsc" : "",
    "sSortDesc" : "",
    "sSortColumn" : "",
    "sPagePrevEnabled": "fg-button ui-button ui-state-default ui-corner-left",
    "sPagePrevDisabled": "fg-button ui-button ui-state-default ui-corner-left ui-state-disabled",
    "sPageNextEnabled": "fg-button ui-button ui-state-default ui-corner-right",
    "sPageNextDisabled": "fg-button ui-button ui-state-default ui-corner-right ui-state-disabled",
    "sPageJUINext": "ui-icon ui-icon-circle-arrow-e",
    "sPageJUIPrev": "ui-icon ui-icon-circle-arrow-w"
  });

  jQuery.extend(jQuery.fn.DataTable.ext.pager, {
    "two_button": {
      "fnInit": function (oSettings, nPaging, fnCallbackDraw) {
        var oLang = oSettings.oLanguage.oPaginate;
{'fraction_non_alphanumeric': 0.14698859113823295, 'fraction_numerical': 0.014460068983815336, 'mean_word_length': 3.2449324324324325, 'pattern_counts': {'":': 28, '<': 9, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2878986', 'n_tokens_mistral': 2560, 'n_tokens_neox': 2437, 'n_words': 667}