diff --git a/src/uncategorized/slaveSummary.tw b/src/uncategorized/slaveSummary.tw index ce45c9f2193cc14fa9b3264031c7e27741895b73..f4bb708a615c6e9301d066de33da62e9f4ede835 100644 --- a/src/uncategorized/slaveSummary.tw +++ b/src/uncategorized/slaveSummary.tw @@ -119,7 +119,7 @@ <<for !_.isUndefined(_ssii = _indexSlavesIdxs.shift())>> <<set _IndexSlave = $slaves[_ssii]>> <<if $surnameOrder != 1>> - <<if ["Cambodian", "Chinese", "Hungarian", "Japanese", "Korean", "Mongolian", "Taiwanese", "Vietnamese"].includes(_Slave.nationality)>> + <<if ["Cambodian", "Chinese", "Hungarian", "Japanese", "Korean", "Mongolian", "Taiwanese", "Vietnamese"].includes(_IndexSlave.nationality)>> <<set _indexSlaveName = [_IndexSlave.slaveSurname || "", _IndexSlave.slaveName].join(" ").trim()>> <<else>> <<set _indexSlaveName = [_IndexSlave.slaveName, _IndexSlave.slaveSurname || ""].join(" ").trim()>> @@ -150,16 +150,23 @@ /* * Use javascript scrollTop animation for in page navigation. */ - $("[data-quick-index]").click(function() { - var $quick = $('div#list_index'); - $quick.toggleClass("hidden"); - }); - $("[data-scroll-to]").click(function() { - var $this = $(this); - var $toElement = $this.attr('data-scroll-to'), $offset = $this.attr('data-scroll-offset') || 0, $speed = $this.attr('data-scroll-speed') || 900, moveto = $($toElement).offset().top; - $('html, body').animate( { - scrollTop: (moveto + $offset) + 'px' - }, $speed); + $("[data-quick-index]").click(function () { + var $quick = $('div#list_index'); + $quick.toggleClass("hidden"); + }); + $("[data-scroll-to]").click(function() { + var $this = $(this), $toElement = $this.attr('data-scroll-to'), + $focusElement = $this.attr('data-scroll-focus'), + /* + * note the *1 enforces $offset to be an integer, without + * it we scroll to True, which goes nowhere fast. + */ + $offset = $this.attr('data-scroll-offset') * 1 || 0, + $speed = $this.attr('data-scroll-speed') * 1 || 500; + $('html, body').animate({ + scrollTop: $($toElement).offset().top + $offset + }, $speed); + }); </script> <</if>>