<commit_before>/**
 * General page cards switcher control
 *
 * @author <NAME>
 */

require! {
	jquery: $
	prelude: {each, map, Obj, obj-to-pairs, pairs-to-obj, reject, Str, camelize}
	\Snap.svg
}

const $w = $ window

const s-class     = \cards-switcher
const bind-suffix = \.cards-switcher

const h        = 50px
const offset-x = 25px
const center-y = h / 2 |> Math.round
const circle-r = 22px
const point-r  = 5px

# !!! side effects
set-jq-props = -> it |> each (-> it.$node = $ it.node)

get-line-x1 = (line-w, links, idx)-->
	links.length
	|> (- 1)
	|> (-> line-w / it)
	|> (* idx)
	|> (+ offset-x)

# visual navigation
repos = ({s, elems, links})!->

	total-w = s.$node.width!
	line-w = total-w |> (- offset-x * 2)

	s.active-idx
	|> get-line-x1 line-w, links
	|> (x)->
		elems.line.attr x1: x
		elems.dark-line.attr x2: x
		[..attr cx: x for elems.all-big-circles]

	for _, idx in links
		class-name = elems.points[idx].attr \class
		if idx <= s.active-idx
			if (class-name.index-of \dark) is (-1)<commit_msg>added animation for cards switcher<commit_after>/**
 * General page cards switcher control
 *
 * @author <NAME>
 */

require! {
	jquery: $
	prelude: {each, map, Obj, obj-to-pairs, pairs-to-obj, reject, Str, camelize}
	\Snap.svg
	\../../../basics : {get-val}
}

const $w = $ window

const s-class     = \cards-switcher
const bind-suffix = \.cards-switcher

const h        = 50px
const offset-x = 25px
const center-y = h / 2 |> Math.round
const circle-r = 22px
const point-r  = 5px

const anim-speed = get-val \animation-speed

# !!! side effects
set-jq-props = -> it |> each (-> it.$node = $ it.node)

get-line-x1 = (line-w, links, idx)-->
	links.length
	|> (- 1)
	|> (-> line-w / it)
	|> (* idx)
	|> (+ offset-x)

# visual navigation
repos = ({s, elems, links})!->

	total-w = s.$node.width!
	line-w = total-w |> (- offset-x * 2)

	s.active-idx
	|> get-line-x1 line-w, links
	|> (x)->
		elems.line.stop!.animate x1: x, anim-speed
		elems.dark-line.stop!.animate x2: x, anim-speed
		[..stop!.animate cx: x, anim-speed for elems.all-big-circles]

	for _, idx in links
		class-name = elems.points[idx].attr \class
		if idx <= s.active-idx
			if (class-name.index-of \dark) is (-1)
{'fraction_non_alphanumeric': 0.18997722095671982, 'fraction_numerical': 0.01366742596810934, 'mean_word_length': 2.678391959798995, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 35, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1681915', 'n_tokens_mistral': 951, 'n_tokens_neox': 887, 'n_words': 224}