aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/styles/prosilver/template/ajax.js
diff options
context:
space:
mode:
authorCesar G <prototech91@gmail.com>2013-10-07 17:55:04 -0700
committerCesar G <prototech91@gmail.com>2013-10-07 17:55:04 -0700
commit98a1694c7c1022d50c30b7dcd46f9f0fc9f5f7b4 (patch)
treebbff2c273535d598a99bdc32dd24eeeb4a1a5217 /phpBB/styles/prosilver/template/ajax.js
parent7f312772699c10339a8c50ef7952179da40ef7e7 (diff)
downloadforums-98a1694c7c1022d50c30b7dcd46f9f0fc9f5f7b4.tar
forums-98a1694c7c1022d50c30b7dcd46f9f0fc9f5f7b4.tar.gz
forums-98a1694c7c1022d50c30b7dcd46f9f0fc9f5f7b4.tar.bz2
forums-98a1694c7c1022d50c30b7dcd46f9f0fc9f5f7b4.tar.xz
forums-98a1694c7c1022d50c30b7dcd46f9f0fc9f5f7b4.zip
[ticket/10383] Update the results without the overlay popup.
PHPBB3-10383
Diffstat (limited to 'phpBB/styles/prosilver/template/ajax.js')
-rw-r--r--phpBB/styles/prosilver/template/ajax.js33
1 files changed, 30 insertions, 3 deletions
diff --git a/phpBB/styles/prosilver/template/ajax.js b/phpBB/styles/prosilver/template/ajax.js
index 39beab4f16..28656d47d3 100644
--- a/phpBB/styles/prosilver/template/ajax.js
+++ b/phpBB/styles/prosilver/template/ajax.js
@@ -166,8 +166,12 @@ phpbb.addAjaxCallback('vote_poll', function(res) {
var panel = poll.find('.panel');
var results_visible = poll.find('dl:first-child .resultbar').is(':visible');
- // Force the current height to prevent the page from jumping when the content changes
- panel.height(panel.find('.inner').outerHeight());
+ // Set min-height to prevent the page from jumping when the content changes
+ var update_panel_height = function (height) {
+ var height = (typeof height === 'undefined') ? panel.find('.inner').outerHeight() : height;
+ panel.css('min-height', height);
+ };
+ update_panel_height();
// Remove the View results link
if (!results_visible) {
@@ -213,10 +217,33 @@ phpbb.addAjaxCallback('vote_poll', function(res) {
poll.find('.polls').delay(400).fadeIn(500);
}
+ // Display "Your vote has been cast." message. Disappears after 5 seconds.
+ var confirmation_delay = (res.can_vote) ? 300 : 900;
+ poll.find('.vote-submitted').delay(confirmation_delay).slideDown(200, function() {
+ if (results_visible) {
+ update_panel_height();
+ }
+
+ $(this).delay(5000).fadeOut(500, function() {
+ resize_panel(300);
+ });
+ });
+
// Remove the gap resulting from removing options
setTimeout(function() {
- panel.animate({height: panel.find('.inner').height()}, 500);
+ resize_panel(500);
}, 1500);
+
+ var resize_panel = function (time) {
+ var panel_height = panel.height();
+ var inner_height = panel.find('.inner').outerHeight();
+
+ if (panel_height != inner_height) {
+ panel.css({'min-height': '', 'height': panel_height}).animate({height: inner_height}, time, function () {
+ panel.css({'min-height': inner_height, 'height': ''});
+ });
+ }
+ };
}
});