- Reusable functions calcDisableClasses/calcCurrentPage/calcPages - less duplicated code means less errors.
- Reused code for calculating `disabled` classes from main jQuery.dataTables source code to be consistent.
- Moved duplicated strings to constant variables.
- Reworked approach with buttons disabling.
- Totally removed all if-else branches for buttons disabling. Less conditional branching means less errors again :).
- Fixed bug when restoring state in the middle of pages had disabled first/prev buttons.
- It seems it's not required to assign disabled classes to buttons on init, cause they will be assigned on update anyway.
- Reworked on-update loop over each instance of the pager to jQuery.children selector, which already executes for each matched descendant.
- Wrapped all plugin code to IIFE pattern to have private static functions easily, and not expose them to global scope.
Redid the logic for disabling the buttons, again, since it would display incorrectly when there were only 2 pages total.
Also added some logic to hide the paging controls when you only have 0 or 1 pages, since you can't page anyway.
Using the value of the input field was giving inconsistent results. It would flip between the page you are going to and the page your on. Changed it to use the calculated current page instead.