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('
'+data+'
').css({'position': 'relative', 'padding': '0','background':'#000'}); $('#popup_panel').hide(); $('#popup_progress').hide(); $('#popup_container .body').css({'width': 'auto'}); $('#player_container').css({'width': '640px','height':'420px'}); }); } function getMovieCode(movie_id, selector, callback){ if (selector == undefined || typeof selector == "undefined" || typeof selector == "object") { selector = '#view_movie_div'; } album_id = $('input[name=p_album_id]').val(); cat_id = $('input[name=p_cat_id]').val(); user_id = $('input[name=p_user_id]').val(); $.get('/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, function(data){ $(selector).html(data); }).done(callback); } function getCategory(rubric_id){ cat_id = $('select[name=cat_id]').val(); if(cat_id != 0){ $('#title_cat_id').css('background', 'url(/templates/_default_/images/video/ajax-loader_dealer.gif) no-repeat scroll right center'); $.post("/components/video/ajax/get_form.php", {value: cat_id, rubric_id: rubric_id}, function(dataform) { if(dataform!=1){ $('.cat_form').remove(); $("#before_form").after(dataform); }else{ $('.cat_form').remove(); } $('#title_cat_id').css('background', 'none'); }); } else { $('.cat_form').remove(); } } function getViewRubrics(rub_view){ $.post('/video/rubrics', {'of_ajax': 1, 'rub_view': rub_view}, function(data){ $('.component').html(data); }); } function getViewCats(cat_view_type, link){ $.post(link, {'of_ajax': 1, 'cat_view_type': cat_view_type}, function(data){ $('.component').html(data); }); } function lightsoff() { $('#lightsoff-background').remove(); $("#lightsoff").click( function() { $('#player_code') .css({ 'visibility' : 'visible', 'position' : 'relative', 'z-index' : 1999 }); $('body').prepend('
'); $('#lightsoff-background').css({ height: $(document).height() }).fadeIn(); if($.browser.msie){ $('#lightsoff-background').show(); } else { $('#lightsoff-background').fadeIn('slow'); } $('#lightsoff-background').click(function() { $('#lightsoff-background') .fadeOut(function() { $('#lightsoff-background').remove(); $('#player_code').css({'z-index' : 0 }); }); return false; }); return false; }); } function getFileLink(str) { var b64chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefg'+ 'hijklmnopqrstuvwxyz0123456789+/='; var b64decoded = ''; var chr1, chr2, chr3; var enc1, enc2, enc3, enc4; str = str.replace(/[^a-z0-9+/=]/gi, ''); for (var i=0; i> 4); chr2 = ((enc2 & 15) << 4) | (enc3 >> 2); chr3 = ((enc3 & 3) << 6) | enc4; b64decoded = b64decoded + String.fromCharCode(chr1); if (enc3 < 64) { b64decoded += String.fromCharCode(chr2); } if (enc4 < 64) { b64decoded += String.fromCharCode(chr3); } } return b64decoded; } function getFlash(){ $('body').append(''); version = swfobject.getFlashPlayerVersion(); if (version.major > 0) { $('#flashversion').html('У вас установлен Flash player версии '+version.major+'.'+version.minor+''); return true; } else { return false; } } function playMovie(movie_id){ $('#player_container').html('
'); $.get('/components/video/ajax/get_movie_code.php?id='+movie_id+'&autopay=1', function(data){ $('#player_container').append(data); setTimeout(function (){ $('.player_play_loading').remove(); },1000); }); } function showShare(){ if(!$('div.share_info').html()){ $('#player_code').append('
'+share_html+'
'); } $('.player_play').hide(); $('.player_share').hide(); $('#player_container').fadeTo('slow', 0.15); $('.share_info').fadeIn(); $('.player_share_close').fadeIn(); $(".share_code input, .share_code textarea").select(); } function hideShare(){ $('.share_info').hide(); $('.player_share_close').hide(); $('.player_play').fadeIn(); $('.player_share').fadeIn(); $('#player_container').fadeTo('fast', 1.0); }