diff --git a/ngallery-example.yaml b/ngallery-example.yaml index e80dfac..f728c2e 100644 --- a/ngallery-example.yaml +++ b/ngallery-example.yaml @@ -68,3 +68,5 @@ ngallery: allowgif: true comments: premoderation: false + contests: + enabled: true diff --git a/static/css/style.css b/static/css/style.css index a20d656..219ac73 100644 --- a/static/css/style.css +++ b/static/css/style.css @@ -371,10 +371,10 @@ table.nospaces > tbody > tr > td.lcol { padding:2px 6px 0; } .flag-left { padding-left:26px !important; } .input-flag { margin:-2px -26px 0 5px; position:relative; z-index:11; } -.contestBtn { display:block; cursor:pointer; width:56px; height:28px; margin:10px; background:url('/img/vote_contest.gif') no-repeat; opacity:0.7; } +.contestBtn { display:block; cursor:pointer; width:56px; height:28px; margin:10px; background:url('/static/img/vote_contest.gif') no-repeat; opacity:0.7; } .contestBtn:hover { opacity:1; } -.contestBtn.voted { opacity:1; background:url('/img/vote_contest_pressed.gif') no-repeat; } -.contestBtn.loading { opacity:1; background:url('/img/vote_contest_loading.gif') no-repeat; } +.contestBtn.voted { opacity:1; background:url('/static/img/vote_contest_pressed.gif') no-repeat; } +.contestBtn.loading { opacity:1; background:url('/static/img/vote_contest_loading.gif') no-repeat; } .died { border:solid 1px black; padding:0 2px; } diff --git a/static/img/logocube.png b/static/img/logocube.png index 3fcaf12..710bf10 100644 Binary files a/static/img/logocube.png and b/static/img/logocube.png differ diff --git a/static/img/vote_contest.gif b/static/img/vote_contest.gif new file mode 100644 index 0000000..975b04f Binary files /dev/null and b/static/img/vote_contest.gif differ diff --git a/static/img/vote_contest_loading.gif b/static/img/vote_contest_loading.gif new file mode 100644 index 0000000..d92d4a4 Binary files /dev/null and b/static/img/vote_contest_loading.gif differ diff --git a/static/img/vote_contest_pressed.gif b/static/img/vote_contest_pressed.gif new file mode 100644 index 0000000..c9821b1 Binary files /dev/null and b/static/img/vote_contest_pressed.gif differ diff --git a/static/js/changeTab.js b/static/js/changeTab.js index 6fb7883..b8fcebf 100644 --- a/static/js/changeTab.js +++ b/static/js/changeTab.js @@ -1,21 +1,22 @@ function changeTab(id) { const $activeTabs = $('.v-tab-b.v-tab--active'); const $activeBlocks = $('.active__block'); + const $newTab = $('#' + id); if ($activeTabs.length) { $activeTabs.removeClass('v-tab--active'); } - $('#' + id).addClass('v-tab--active'); + $newTab.addClass('v-tab--active'); if ($activeBlocks.length) { - $activeBlocks.animate({ + $activeBlocks.stop(true, true).animate({ opacity: 0, }, 200, function () { $(this).css('display', 'none').removeClass('active__block'); - - // Вторая анимация - $('#' + id + '__block').css({ + + const $newBlock = $('#' + id + '__block'); + $newBlock.css({ display: 'block', opacity: 0 }).animate({ @@ -24,5 +25,15 @@ function changeTab(id) { $(this).addClass('active__block'); }); }); + } else { + // Если нет активных блоков, сразу показываем новый блок + $('#' + id + '__block').css({ + display: 'block', + opacity: 0 + }).animate({ + opacity: 1 + }, 150, function () { + $(this).addClass('active__block'); + }); } -} \ No newline at end of file +} diff --git a/static/js/photo.js b/static/js/photo.js index f1697d3..f38a81c 100644 --- a/static/js/photo.js +++ b/static/js/photo.js @@ -87,9 +87,8 @@ $(document).ready(function() } $('#votes').html(html)[html == '' ? 'hide' : 'show'](); - - $('.vote_btn[vote="1"]')[data.buttons[1] ? 'addClass' : 'removeClass']('voted'); - $('.vote_btn[vote="0"]')[data.buttons[0] ? 'addClass' : 'removeClass']('voted'); + $('.vote[pid="' + pid + '"][vote="1"]')[data.buttons.posbtn ? 'addClass' : 'removeClass']('voted'); + $('.vote[pid="' + pid + '"][vote="0"]')[data.buttons.negbtn ? 'addClass' : 'removeClass']('voted') var rating = parseInt(data.rating); if (rating > 0) $('#rating').html('+' + rating); else @@ -127,19 +126,19 @@ $(document).ready(function() $(this).toggleClass('voted'); if ($(this).is('.voted')) $('.vote[pid="' + pid + '"] .konk_btn[vote="' + Number(!Number(vote)) + '"]').removeClass('voted'); - + var self_p = 0; if (!self_p) // Чужие фото { $(this).closest('.p20p').removeAttr('class').css('padding', '6px 6px 5px'); - $.getJSON('/api.php', { action: 'vote-konk', pid: pid, vote: vote }, function (data) + $.getJSON('/api/photo/vote', { action: 'vote-konk', pid: pid, vote: vote }, function (data) { if (data && !data.errors) { $('.star[pid="' + pid + '"]').html(data.star ? '' : ''); + $('.vote[pid="' + pid + '"] .konk_btn[vote="1"]')[data.buttons.posbtn_contest ? 'addClass' : 'removeClass']('voted'); + $('.vote[pid="' + pid + '"] .konk_btn[vote="0"]')[data.buttons.negbtn_contest ? 'addClass' : 'removeClass']('voted'); - $('.vote[pid="' + pid + '"] .konk_btn[vote="1"]')[data.buttons[1] ? 'addClass' : 'removeClass']('voted'); - $('.vote[pid="' + pid + '"] .konk_btn[vote="0"]')[data.buttons[0] ? 'addClass' : 'removeClass']('voted'); var rat = $('.s_rating[pid="' + pid + '"]'); if (rat.length) @@ -164,14 +163,14 @@ $(document).ready(function() } else // Свои фото { - $.getJSON('/api.php', { action: 'vote-author', pid: pid, vote: vote }, function (data) + $.getJSON('/api/photo/vote', { action: 'vote-author', pid: pid, vote: vote }, function (data) { if (data && !data.errors) { $('#star[pid="' + pid + '"]').html(data.star ? '' : ''); - $('.konk_btn[vote="1"]')[data.buttons[1] ? 'addClass' : 'removeClass']('voted'); - $('.konk_btn[vote="0"]')[data.buttons[0] ? 'addClass' : 'removeClass']('voted'); + $('.vote[pid="' + pid + '"] .konk_btn[vote="1"]')[data.buttons.posbtn_contest ? 'addClass' : 'removeClass']('voted'); + $('.vote[pid="' + pid + '"] .konk_btn[vote="0"]')[data.buttons.negbtn_contest ? 'addClass' : 'removeClass']('voted'); } else {