hi
my code is :
function sofGetVideoId($el) {
var $menu = $el.closest('.menu-3dot-container');
return parseInt($menu.data('video-id')) || 0;
}
function sofUpdateSaveButton(videoId, saved) {
sofSavedStatus[videoId] = saved;
var $btn = $('.menu-3dot-container[data-video-id="' + videoId + '"] .sof-save-video');
if (saved) {
$btn.text('saved').addClass('sof-already-saved');
} else {
$btn.text('save to list').removeClass('sof-already-saved');
}
}
function sofShowListSelector(videoId, $btn) {
$('.sof-list-dropdown').remove();
$.ajax({
url: sofAjaxUrl,
data: { action: 'get_lists' },
dataType: 'json',
success: function(lists) {
if (!lists || lists.error) return;
var html = '<div class="sof-list-dropdown" data-video-id="' + videoId + '">';
html += '<div class="sof-list-dropdown-header"><span class="sof-list-dropdown-title">Save to:</span><span class="sof-list-dropdown-close">×</span></div>';
$.each(lists, function(i, list) {
var listName = $('<span>').text(list.list_name).html();
html += '<div class="sof-list-option" data-list-id="' + list.id + '" data-video-id="' + videoId + '">';
html += listName;
html += '</div>';
});
html += '<div class="sof-list-new">';
html += '<input type="text" class="sof-new-list-input" placeholder="New list name..." maxlength="100" />';
html += '<span class="sof-new-list-add" data-video-id="' + videoId + '">+</span>';
html += '</div>';
html += '</div>';
$('body').append(html);
var rect = $btn[0].getBoundingClientRect();
var $dd = $('.sof-list-dropdown');
var ddH = $dd.outerHeight();
var top = rect.top - ddH - 4;
if (top < 5) {
top = rect.bottom + 4;
}
$dd.css({
top: top + 'px',
left: rect.left + 'px',
width: '200px'
});
}
});
}
i want to change this code inside the a bove code :
$btn.text(‘saved’).addClass(‘sof-already-saved’);
to has the list name after the word saved .
how to add the list name after “saved” ?
to be like this : saved in “the list name”
thanks