clean up A, An, and The before sorting
This commit is contained in:
		
							
								
								
									
										10
									
								
								index.html
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								index.html
									
									
									
									
									
								
							@@ -34,6 +34,7 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
      $.each(data, function(key, value) {
 | 
					      $.each(data, function(key, value) {
 | 
				
			||||||
        value.rowNumber = key; // re-key for new sort
 | 
					        value.rowNumber = key; // re-key for new sort
 | 
				
			||||||
 | 
					        value.sortTitle = titleCleaner(value.title);
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      var template = $('#Table').html();
 | 
					      var template = $('#Table').html();
 | 
				
			||||||
@@ -53,6 +54,13 @@
 | 
				
			|||||||
      $('#current').html(rendered);
 | 
					      $('#current').html(rendered);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    function titleCleaner(title) {
 | 
				
			||||||
 | 
					      return title
 | 
				
			||||||
 | 
					        .replace('"', '')
 | 
				
			||||||
 | 
					        .replace(':', '')
 | 
				
			||||||
 | 
					        .replace(/^(An?|The)\s/i, '');
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    window.addEventListener('DOMContentLoaded', init);
 | 
					    window.addEventListener('DOMContentLoaded', init);
 | 
				
			||||||
  </script>
 | 
					  </script>
 | 
				
			||||||
</head>
 | 
					</head>
 | 
				
			||||||
@@ -71,7 +79,7 @@
 | 
				
			|||||||
  <script id="Table" type="text/html">
 | 
					  <script id="Table" type="text/html">
 | 
				
			||||||
    <table class="bookTable">
 | 
					    <table class="bookTable">
 | 
				
			||||||
      <tr>
 | 
					      <tr>
 | 
				
			||||||
        <th data-sort-by="title" class="tHeader title">Title</th>
 | 
					        <th data-sort-by="sortTitle" class="tHeader title">Title</th>
 | 
				
			||||||
        <th data-sort-by="authorLast" class="tHeader author">Author</th>
 | 
					        <th data-sort-by="authorLast" class="tHeader author">Author</th>
 | 
				
			||||||
        <th data-sort-by="publisher" class="tHeader publisher">Publisher</th>
 | 
					        <th data-sort-by="publisher" class="tHeader publisher">Publisher</th>
 | 
				
			||||||
        <th data-sort-by="year" class="tHeader year">Year</th>
 | 
					        <th data-sort-by="year" class="tHeader year">Year</th>
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user