Created
May 3, 2023 14:00
-
-
Save thuycom205/05722fd70a87135adcf6c1431a7cefdb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function bookmark(element) { | |
var myParam = location.search.split('vid=')[1] | |
var note = jQuery('textarea[name="bookmark_note"]').val(); | |
var data = {action: 'masr_ajax_submit_bookmark','vid_id': myParam, 'note' :note, 'start' : window.l_start, 'end' : window.l_end }; | |
var ajaxurl = "https://thuysaas.com/blog/wp-admin/admin-ajax.php"; | |
jQuery.post(ajaxurl, data).done(function (response) { | |
console.log(json); | |
} | |
).fail(function (xhr, status, error) { | |
// show_notification('Get status of filters failed.', true); | |
}); | |
} | |
function playNext() { | |
var next = jQuery(window.activeBtn).next(); | |
next.trigger('click'); | |
} | |
function playPrev() { | |
var next = jQuery(window.activeBtn).prev(); | |
next.trigger('click'); | |
} | |
jQuery( document ).ready(function() { | |
show_bookmark(); | |
}); | |
function show_bookmark() { | |
var data = {action: 'masr_get_bookmark'}; | |
var ajaxurl = "https://thuysaas.com/blog/wp-admin/admin-ajax.php"; | |
jQuery.get(ajaxurl, data).done(function (response) { | |
console.log(response); | |
var html = ''; | |
for (var i = 0; i < response.length; i++) { | |
var item = response[i]; | |
html += '<button ' + 'data-start="' + item.start + '"' + ' data-stop=' + '"' + item.end + '"' + ' onclick="playMin(this)">' + item.start + '</button>' | |
} | |
jQuery('#render_bm').html(html); | |
} | |
).fail(function (xhr, status, error) { | |
// show_notification('Get status of filters failed.', true); | |
}); | |
} | |
function playMin(element) { | |
window.activeBtn = element; | |
var startStr = jQuery(element).attr('data-start'); | |
window.l_start = startStr; | |
var endStr = jQuery(element).attr('data-stop'); | |
window.l_end = endStr; | |
jQuery(element).css('color', 'blue'); | |
var parent = jQuery(element).parent(); | |
var ies = parent.find('button').each(function (index, e) { | |
jQuery(e).css('color', 'black'); | |
}); | |
jQuery(element).css('color', 'blue'); | |
var startInt = parseInt(startStr); | |
var endInt = parseInt(endStr); | |
jQuery('#video').html(''); | |
var myParam = location.search.split('v=')[1] | |
var html = '<iframe width="1200" height="675" src="https://www.youtube.com/embed/' + myParam + '?start={start}&end={end}" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe><!--<iframe width="1280" height="720" src=”https://www.youtube-nocookie.com/embed/gyMwXuJrbJQ?start=225&end=268rel=0&showinfo=0″ frameborder=”0″ allowfullscreen></iframe-->'; | |
html = html.replace('{start}', startStr).replace('{end}', endStr); | |
jQuery('#video').html(html); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment