mirror of
				https://github.com/Kareadita/Kavita.git
				synced 2025-11-04 03:27:05 -05:00 
			
		
		
		
	* Refactored manga reader to use a regular image element for all cases except for split page rendering * Fixed a weird issue where ordering of routes broke redireciton in one case. * Added comments to a lot of the enums and refactored READER_MODE to be ReaderMode and much more clearer on function. * Added bookmark effect on image renderer * Implemented keyboard shortcut modal * Introduced the new layout mode into the manga reader, updated preferences, and updated bookmark to work for said functionality. Need to implement renderer now * Hooked in ability to show double pages but all the css is broken. Committing for help from Robbie. * Fixed an issue where Language tag in metadata edit wasn't being updated * Fixed up some styling on mobile for edit series detail * Some css fixes * Hooked in ability to set background color on reader (not implemented in reader). Optimized some code in ArchiveService to avoid extra memory allocations. * Hooked in background color, generated the migration * Fixed a bug when paging to cover images, full height would be used instead of full-width for cover images * New option in reader to show screen hints (on by default). You can disable in user preferences which will stop showing pagination overlay hints * Lots of fixes for double rendering mode * Bumped the amount of cached pages to 8 * Fixed an issue where dropdowns weren't being locked on form manipulation
		
			
				
	
	
		
			32 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
			
		
		
	
	
			32 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
using System;
 | 
						|
using System.Collections.Generic;
 | 
						|
using System.Linq;
 | 
						|
using System.Text.RegularExpressions;
 | 
						|
 | 
						|
namespace API.Extensions
 | 
						|
{
 | 
						|
    public static class EnumerableExtensions
 | 
						|
    {
 | 
						|
        private static readonly Regex Regex = new Regex(@"\d+", RegexOptions.Compiled, TimeSpan.FromMilliseconds(500));
 | 
						|
 | 
						|
        /// <summary>
 | 
						|
        /// A natural sort implementation
 | 
						|
        /// </summary>
 | 
						|
        /// <param name="items">IEnumerable to process</param>
 | 
						|
        /// <param name="selector">Function that produces a string. Does not support null values</param>
 | 
						|
        /// <param name="stringComparer">Defaults to CurrentCulture</param>
 | 
						|
        /// <typeparam name="T"></typeparam>
 | 
						|
        /// <returns>Sorted Enumerable</returns>
 | 
						|
        public static IEnumerable<T> OrderByNatural<T>(this IEnumerable<T> items, Func<T, string> selector, StringComparer stringComparer = null)
 | 
						|
        {
 | 
						|
            var list = items.ToList();
 | 
						|
            var maxDigits = list
 | 
						|
                .SelectMany(i => Regex.Matches(selector(i))
 | 
						|
                    .Select(digitChunk => (int?)digitChunk.Value.Length))
 | 
						|
                .Max() ?? 0;
 | 
						|
 | 
						|
            return list.OrderBy(i => Regex.Replace(selector(i), match => match.Value.PadLeft(maxDigits, '0')), stringComparer ?? StringComparer.CurrentCulture);
 | 
						|
        }
 | 
						|
    }
 | 
						|
}
 |