function orderMovieBy(orderby, cat_id){ $('.tabSearch').css('background', 'url(/templates/_default_/images/video/ajax-loader_dealer.gif) no-repeat scroll right center'); $.post('/video', {'of_ajax': 1, orderby: orderby, cat_id: cat_id}, function(data){ $('div.component').html(data); }); } function orderMovieTo(period, cat_id){ $('.tabSearch').css('background', 'url(/templates/_default_/images/video/ajax-loader_dealer.gif) no-repeat scroll right 5px transparent'); $.post('/video', {'of_ajax': 1, period: period, cat_id: cat_id}, function(data){ $('div.component').html(data); }); } function searchTitle(){ var title = $('#movie_search_form').val(); if (title.length >= 3){ $('form.search_form').submit(); } else { core.alert('Ошибка! Запрос должен быть не менее 3-х символов.', 'Ошибка!'); } $('#movie_search_form').focus(); } function clearSearch(cat_id){ $('.tabSearch').css('background', 'url(/templates/_default_/images/video/ajax-loader_dealer.gif) no-repeat scroll right 5px transparent'); $.post('/video', {'of_ajax': 1, title: 'all', cat_id: cat_id}, function(data){ $('div.component').html(data); }); } function sortHome(orderby, page){ if (page == undefined || typeof page == "undefined" || typeof page == "object") { page = 1; } var menu_id = $('input[name=menu_id]').val(); ajaxIndicatorStart(); $.post('/video', {'of_ajax': 1, orderby: orderby, menu_id: menu_id, page: page}, function(data){ $('div.component').html(data); ajaxIndicatorStop(); }); } function viewChannel(view, login){ ajaxIndicatorStart(); $.post('/video/channel/'+login+'.html', {'of_ajax': 1, ch_view: view}, function(data){ $('div.component').html(data); ajaxIndicatorStop(); }); } function viewChannelActions(login){ ajaxIndicatorStart(); $.post('/components/video/ajax/get_channel_actions.php', {'of_ajax': 1, login: login}, function(data){ $('#tabs_recommended li').removeClass("act"); $('#tabs_recommended li.last').addClass("act"); $('#field_for_movie_content').html(data); ajaxIndicatorStop(); }); } function viewChannelCat(cat_id, login){ ajaxIndicatorStart(); $.post('/video/channel/'+login+'.html', {'of_ajax': 1, cat_id: cat_id}, function(data){ $('div.component').html(data); ajaxIndicatorStop(); }); } function viewChannelType(login){ ajaxIndicatorStart(); channel_view = $('select[name=channel_view]').val(); album_id = $('input[name=p_album_id]').val(); cat_id = $('input[name=p_cat_id]').val(); $.post('/video/channel/'+login+'.html', {'of_ajax': 1, channel_view: channel_view, album_id: album_id, cat_id: cat_id}, function(data){ $('div.component').html(data); ajaxIndicatorStop(); }); } function channelSearch(login){ query_channel = $('input[name=query_channel]').val(); channel_view = $('select[name=channel_view]').val(); album_id = $('input[name=p_album_id]').val(); cat_id = $('input[name=p_cat_id]').val(); if (query_channel.length >= 3){ ajaxIndicatorStart(); $('#p_query_channel').html(''); $.post('/video/channel/'+login+'.html', {'of_ajax': 1, query_channel: query_channel, album_id: album_id, cat_id: cat_id}, function(data){ $('div.component').html(data); ajaxIndicatorStop(); }); } else { core.alert('Запрос должен быть не менее 3-х символов.', 'Ошибка'); } $('.text-input').focus().val(''); } function clearChannelSearch(login){ ajaxIndicatorStart(); $('#p_query_channel').html(''); $.post('/video/channel/'+login+'.html', {'of_ajax': 1, query_channel: 'all'}, function(data){ $('div.component').html(data); ajaxIndicatorStop(); }); } function viewChannelAlbum(album_id, login){ ajaxIndicatorStart(); $.post('/video/channel/'+login+'.html', {'of_ajax': 1, album_id: album_id}, function(data){ $('div.component').html(data); ajaxIndicatorStop(); }); } function plusKarma(item_id){ $('p#karma_mov').html('Вам нравится этот ролик!'); $("#movie_rating").load("/components/video/ajax/karma.php", {cd: "1", opt: "plus", item_id: item_id}); } function minusKarma(item_id){ $('p#karma_mov').html('Вам не нравится этот ролик!'); $("#movie_rating").load("/components/video/ajax/karma.php", {cd: "1", opt: "minus", item_id: item_id}); } function favorites(movie_id, act){ $.post('/video/favorites', {id: movie_id, act: act}, function(data){ $('#favorites button').hide(); if(data == 1){ $('#favorites_add').show(); } else { $('#favorites_delete').show(); } }); } function paginations(page, login, ch_view, movie_id, callback){ if (movie_id == undefined || typeof movie_id == "undefined" || typeof movie_id == "object") { movie_id = false; } album_id = $('input[name=p_album_id]').val(); cat_id = $('input[name=p_cat_id]').val(); ajaxIndicatorStart(); $.post('/video/channel/'+login+'.html', {'of_ajax': 1, page: page, ch_view: ch_view, album_id: album_id, cat_id: cat_id, movie_id: movie_id}, function(data){ $('div.component').html(data); ajaxIndicatorStop(); }).done(callback); } function getSubscribe(page, user_id){ ajaxIndicatorStart('chan_subscr'); $.post('/components/video/ajax/subscribe.php', {page: page, user_id: user_id}, function(data){ $('#chan_subscr').html(data); ajaxIndicatorStop('chan_subscr'); }); } function subscribe(target_id, only_subscribe){ ajaxIndicatorStart('subscription_link'); $.post('/components/video/ajax/subscribe.php', {user_id: target_id, target_id: target_id, only_subscribe: only_subscribe}, function(data){ if(isNaN(data)){ $('#chan_subscr').html(data); data_count = $('#real_count_subscribe').html(); } else { data_count = data; } $('#subscription_link a').toggle(); $('#subscription_link').toggleClass('icn-unsubskr').toggleClass('icn-subskr'); $('#count_subscribe').html(' · '+spellCount(data_count, 'подписчик', 'подписчика', 'подписчиков')); ajaxIndicatorStop('subscription_link'); }); } function perpage(login, ch_view){ var album_id = $('input[name=p_album_id]').val(); var cat_id = $('input[name=p_cat_id]').val(); var perpage = $('select[name=perpage]').val(); ajaxIndicatorStart(); $.post('/video/channel/'+login+'.html', {'of_ajax': 1, perpage: perpage, ch_view: ch_view, album_id: album_id, cat_id: cat_id}, function(data){ $('div.component').html(data); ajaxIndicatorStop(); }); } function publishMovie(movie_id, pubdate){ $.post('/components/video/ajax/publish.php', {movie_id: movie_id}, function(data){ $('#published_yes').remove(); $('span.icn-date').html(pubdate); }); } function addAlbum(){ $('#add_album_link').hide(); $('#view_albums').hide(); $('#add_album').show(); $.post('/video/operations_album.html', {}, function(data){ $('#add_album').html(data); $('#title_album').focus(); }); } function toggleButtons(movie_id){ is_sel = $('#'+movie_id+':checked').length; if (is_sel > 0) { $('.movie_id:checked').closest('li').addClass("mov_selected"); } else { $('#'+movie_id).closest('li').removeClass("mov_selected"); } countChecked(); } function countChecked() { n = $("input.movie_id:checked").length; if(n>0){ $('#edit_btn').attr('disabled', ''); $('#delete_btn').attr('disabled', ''); $('#mov_btn').attr('disabled', ''); $("#selected_items").text(' '+spellCount(n, 'ролик', 'ролика', 'роликов')); } else { $('#edit_btn').attr('disabled', 'disabled'); $('#delete_btn').attr('disabled', 'disabled'); $('#mov_btn').attr('disabled', 'disabled'); $("#selected_items").text(''); } } function spellCount(num, one, two, many) { if (num%10==1 && num%100!=11){ str = one; } else if(num%10>=2 && num%10<=4 && (num%100<10 || num%100>=20)){ str = two; } else { str = many; } return num+' '+str; } function operationMovie(movie_id, opt){ $('body').append('
'); $('form#sform').submit(); } function getUserMovie(user_id, opt, movie_id){ ajaxIndicatorStart('plugin_p_similarmovie'); $.post('/plugins/p_similarmovie/other_movie_user.php', {user_id: user_id, opt: opt, movie_id: movie_id}, function(data){ $('#plugin_p_similarmovie').html(data); ajaxIndicatorStop('plugin_p_similarmovie'); }); } function selectForm(from, cat_id, rubric_id){ ajaxIndicatorStart('upload_movie_form'); $.post('/video/add.html', {'of_ajax': 1, cat_id: cat_id, rubric_id: rubric_id, from_type: from}, function(data){ $('div.component').html(data); ajaxIndicatorStop('upload_movie_form'); }); } function ajaxIndicatorStart(selector){ if (selector == undefined || typeof selector == "undefined" || typeof selector == "object") { selector = 'movie_view'; } $('#'+selector).css({opacity:0.4, filter:'alpha(opacity=40)'}); } function ajaxIndicatorStop(selector){ if (selector == undefined || typeof selector == "undefined" || typeof selector == "object") { selector = 'movie_view'; } $('#'+selector).css({opacity:1.0, filter:'alpha(opacity=100)'}); } function checkHeightDescr(){ var h = $('div.photo_descr').height(); if (h>100) { $('div.photo_descr').append(''); $('div.photo_descr').css('height', '100px'); $('div.photo_descr').css('overflow', 'hidden'); } return false; } function toggleDescr(){ text=$('#more_link a').html(); if(text=='развернуть'){ $('#more_link a').html('свернуть'); $('div.photo_descr').css('height', 'auto'); $('div.photo_descr').css('padding-bottom', '20px'); }else{ $('#more_link a').html('развернуть'); $('div.photo_descr').css('height', '100px'); $('div.photo_descr').css('padding-bottom', ''); } return false; } function getMovieLightbox(movie_id){ album_id = $('input[name=p_album_id]').val(); cat_id = $('input[name=p_cat_id]').val(); user_id = $('input[name=p_user_id]').val(); jQuery.lightbox('/components/video/ajax/get_movie_code.php?id='+movie_id+'&autopay=1&extended=1&album_id='+album_id+'&cat_id='+cat_id+'&user_id='+user_id, { 'width' : 610, 'height' : 380, 'autoresize' : false }); } function getMovieLightboxNoNav(link){ movie_id = $(link).attr('id'); core.message($(link).attr('title').slice(0, 75)); $.post('/components/video/ajax/get_movie_code.php?id='+movie_id+'&autopay=1', { }, function(data) { $('#popup_message').html('