diff --git a/js/main.js b/js/main.js index babbdbd..cf166b4 100644 --- a/js/main.js +++ b/js/main.js @@ -1448,6 +1448,30 @@ define(['jquery', 'handlebars', 'fastclick', 'proposal_app', 'handlebars_helpers } }); + var popupCenter = function(url, title, w, h) { + var dualScreenLeft = window.screenLeft !== undefined ? window.screenLeft : screen.left; + var dualScreenTop = window.screenTop !== undefined ? window.screenTop : screen.top; + + var width = window.innerWidth ? window.innerWidth : document.documentElement.clientWidth ? document.documentElement.clientWidth : screen.width; + var height = window.innerHeight ? window.innerHeight : document.documentElement.clientHeight ? document.documentElement.clientHeight : screen.height; + + var left = ((width / 2) - (w / 2)) + dualScreenLeft; + var top = ((height / 3) - (h / 3)) + dualScreenTop; + + var newWindow = window.open(url, title, 'scrollbars=yes, width=' + w + ', height=' + h + ', top=' + top + ', left=' + left); + + // Puts focus on the newWindow + if (window.focus) { + newWindow.focus(); + } + }; + + $(document).on('click', '.social a.popup', {}, function popUp(e) { + var self = $(this); + popupCenter(self.attr('href'), self.find('.rrssb-text').html(), 580, 470); + e.preventDefault(); + }); + $(document).on('click', '#logout-button', function (e){ $.removeCookie('_dialoga_session'); $.removeCookie('votedProposals'); -- libgit2 0.21.2