sort_funcs_for_table.js

来自「proe5.0野火版下载(中文版免费下载)」· JavaScript 代码 · 共 193 行

JS
193
字号
/*---------------------------------------------------------------------------*\||  Module Details:||  Name:    sort_funcs_for_table.js||  Purpose: file contains sorting function that are used by the reports||  History:||  Date      Release Name  Ver.  Comments|  --------- ------- ----- ----- ----------------------------------------------|  14-Jun-04 K-03-04 Moti   $$1   Created.|  08-Aug-04 K-03-08 Moti   $$2   Added bendRadiusCmpFunc.|  25-Aug-04 K-03-09 Moti   $$3   Added linkNumCmpFun.|  28-Oct-04 K-03-13 Moti   $$4   Added removePrefixImagesCmpFunc.|  17-Apr-05 K-03-22+Moti   $$5   Fixed getContentFromLink.||  INSERT COMMENT ABOVE THIS LINE|\*---------------------------------------------------------------------------*//*--------------------------------------------------------------------------*\| Function: getContentFromLink| Purpose:  function gets string which represent link|           the links are from the form <A HREF= .......>content_to_find</A>| Input:    link    - link to parse| Output:   | Return:   content\*--------------------------------------------------------------------------*/function getContentFromLink ( link ){  var begin = link.indexOf ( ">" ) + 1 ;  if ( begin == 0 )    return link ;  var end = link.indexOf ( "<" , begin ) ;  if ( end == -1 )    return link ;  var content = link.substring ( begin , end ) ;  return content ;}/*--------------------------------------------------------------------------*\| Function: getBendRadiusFromLink| Purpose:  function gets string which represent link|           the links are from the form <A HREF= ...>XXX=radius_value</A>| Input:    link   - link with content XXX=radius| Output:   | Return:   num\*--------------------------------------------------------------------------*/function getBendRadiusFromLink ( link ){  var value = getContentFromLink ( link ) ;  var begin = value.indexOf ( "=" ) + 1 ;  var radius = value.substring ( begin ) ;  return radius ;}/*--------------------------------------------------------------------------*\| Function: removePrefixTagsFromString| Purpose:  function gets string which contains some html tags , |           and returns the text which is after the last tag| Input:    string   - string to parse| Output:   | Return:   num\*--------------------------------------------------------------------------*/function removePrefixTagsFromString ( string ){  var begin = string.lastIndexOf ( ">" ) + 1 ;  var text = string.substring ( begin ) ;  return text ;}/*==========================================================================*//*==========================================================================*//*==========================================================================*//*==========================================================================*//*==========================================================================*//*==========================================================================*//*==========================================================================*//*==========================================================================*//*--------------------------------------------------------------------------*\| Function: stringCmpFunc| Purpose:  function compare two strings| Input:    a,b    - strings to compare| Output:   | Return:   -1 , 0 , 1\*--------------------------------------------------------------------------*/function stringCmpFunc ( a , b ){  var result ;  if ( a == b )    result = 0 ;  else if ( a < b )    result = -1 ;  else    result = 1 ;  return result ;}/*--------------------------------------------------------------------------*\| Function: numCmpFunc| Purpose:  function compare two strings which represent nums| Input:    a,b    - strings to compare| Output:   | Return:   -1 , 0 , 1\*--------------------------------------------------------------------------*/function numCmpFunc ( a , b ){  var num_a = a * 1 ;  var num_b = b * 1 ;  return num_a - num_b ;}/*--------------------------------------------------------------------------*\| Function: linkCmpFunc| Purpose:  function compare two strings which represent links|           the links are from the form <A HREF= .......>string to compare</A>| Input:    a,b    - links to compare| Output:   | Return:   -1 , 0 , 1\*--------------------------------------------------------------------------*/function linkCmpFunc ( a , b ){  var name_a = getContentFromLink ( a ) ;  var name_b = getContentFromLink ( b ) ;  return stringCmpFunc ( name_a , name_b ) ;}/*--------------------------------------------------------------------------*\| Function: linkNumCmpFunc| Purpose:  function compare two strings which represent links of number|           the links are from the form <A HREF= .......>num to compare</A>| Input:    a,b    - links to compare| Output:   | Return:   -1 , 0 , 1\*--------------------------------------------------------------------------*/function linkNumCmpFunc ( a , b ){  var value_a = getContentFromLink ( a ) ;  var value_b = getContentFromLink ( b ) ;  return numCmpFunc ( value_a , value_b ) ;}/*--------------------------------------------------------------------------*\| Function: linkBendRadiusCmpFunc| Purpose:  function compare two strings which represent br_name=radius| Input:    a,b    - links to compare| Output:   | Return:   -1 , 0 , 1\*--------------------------------------------------------------------------*/function linkBendRadiusCmpFunc ( a , b ){  var radius_a = getBendRadiusFromLink ( a ) ;  var radius_b = getBendRadiusFromLink ( b ) ;  return numCmpFunc ( radius_a , radius_b ) ;}/*--------------------------------------------------------------------------*\| Function: removePrefixImagesCmpFunc| Purpose:  function compare two strings which represent |             <img></img><img></img>text| Input:    a,b    - strings to compare| Output:   | Return:   -1 , 0 , 1\*--------------------------------------------------------------------------*/function removePrefixImagesCmpFunc ( a , b ){  var text_a = removePrefixTagsFromString ( a ) ;  var text_b = removePrefixTagsFromString ( b ) ;  return stringCmpFunc ( text_a , text_b ) ;}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?