'use strict';

let nextCue;
let cue;
let currentTime;
const mixDuration = Util.stringToSeconds($('.mediaTabItem:first span').text().split('[')[1].trim().slice(0, -1));

Connector.playerSelector = '.playerWidgetMessage';

Connector.trackArtSelector = '#artworkLeft';

Connector.albumSelector = '#pageTitle';

Connector.getUniqueID = () => $('.cPlay:first').attr('id');

Connector.getArtistTrack = () => {
	const text = $('.cPlay:first meta[itemprop="name"]').attr('content');
	return Util.splitArtistTrack(text);
};

Connector.getCurrentTime = () => {
	return currentTime - cue;
};

Connector.getDuration = () => {
	switch (true) {
		case cue && nextCue > 0:
			0 > currentTime - cue && (nextCue += Math.abs(currentTime - cue));
			return nextCue - cue;
		case nextCue > 0:
			return nextCue;
		case cue > 0:
			return mixDuration - cue;
	}
};

Connector.isPlaying = () => {
	return $('#playerWidgetPause').hasClass('fa-pause');
};

Connector.isScrobblingAllowed = () => {
	nextCue = Util.stringToSeconds($('.cPlay:first').nextAll('.topBorder').find('.cueValueField:contains(":")').eq(0).text());
	cue = Util.stringToSeconds($('.cPlay:first').find('.cueValueField').text());
	currentTime = Util.stringToSeconds($('#playerWidgetCurrentTime').text());
	const noIDs = $('.cPlay:first').find('.trackFormat .redTxt').length;

	return noIDs <= 0 && (cue > 0 || nextCue > 0);
};

@@ -104,22 +104,16 @@
 aTabItem
-:first
  span').
@@ -137,27 +137,21 @@
 %5B1%5D.
-trim().slice(0, -1)
+split('%5D')%5B0%5D
 );%0A%0A
@@ -178,17 +178,17 @@
 ctor = '
-.
+#
 playerWi
@@ -195,15 +195,14 @@
 dget
-Message
+Fields
 ';%0A%0A
@@ -963,37 +963,17 @@
 xtCue = 
-Util.stringToSeconds(
++
 $('.cPla
@@ -1014,36 +1014,13 @@
 nd('
-.cueValueField:contains(%22:%22)
+input
 ').e
@@ -1024,22 +1024,20 @@
 ).eq(0).
-text()
+val(
 );%0A%09cue 
@@ -1042,76 +1042,37 @@
 e = 
-Util.stringToSeconds($('.cPlay:first').find('.cueValueField').text()
++$('.cPlay:first input').val(
 );%0A%09

Fix 1001tracklists (#2409)