Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function player(track, track_name) {
- var src = track.getAttribute('about');
- $('#player-main').attr('src', src);
- document.getElementById('player-main').play();
- toastr.success(track_name, 'Сейчас играет', {timeOut: 1000})
- }
- function remove_playlist(obj, playlist_name) {
- if ($('#playlist_ajax_button').attr('value') == 'remove'){
- $.ajax({
- url: '/playlist_remove',
- method: 'GET',
- data: {'type': 'playlist_remove', 'name': playlist_name},
- success: function(data){
- if (data == 'remove ok'){
- var button_playlist = $('#playlist_ajax_button');
- toastr.warning(playlist_name, 'Удалено');
- button_playlist.removeClass( );
- button_playlist.addClass('btn');
- button_playlist.addClass('btn-primary');
- button_playlist.text('Добавить');
- button_playlist.attr('value', 'add');
- }
- }
- });
- }else if($('#playlist_ajax_button').attr('value') == 'add'){
- $.ajax({
- url: '/playlist_remove',
- method: 'GET',
- data: {'type': 'playlist_add', 'name': playlist_name},
- success: function(data){
- if (data == 'add ok'){
- var button_playlist = $('#playlist_ajax_button');
- toastr.success(playlist_name, 'Добавлено');
- button_playlist.removeClass( );
- button_playlist.addClass('btn');
- button_playlist.addClass('btn-danger');
- button_playlist.text('Удалить');
- button_playlist.attr('value', 'remove');
- }
- }
- });
- }
- }
- function setLocation(curLoc){
- try {
- history.pushState(null, null, curLoc);
- return;
- } catch(e) {}
- location.hash = '#' + curLoc;
- }
- function ajax_url(url_obj) {
- event.preventDefault();
- var href = url_obj.getAttribute('href');
- console.log(href);
- setLocation(href);
- $(".base-main-content").load(href + ' .for-ajax-load');
- $.ajax({
- url: href,
- success: function(data){
- var newTitle = $(data).filter('title').text();
- document.title = newTitle;
- }
- });
- }
Add Comment
Please, Sign In to add comment