Commit 1771480d408a0cd53fc7dbc300ca545f29dbd2d0
1 parent
e12fd68e
Exists in
master
and in
5 other branches
Rollback popupCenter
Showing
1 changed file
with
24 additions
and
0 deletions
Show diff stats
js/main.js
... | ... | @@ -1448,6 +1448,30 @@ define(['jquery', 'handlebars', 'fastclick', 'proposal_app', 'handlebars_helpers |
1448 | 1448 | } |
1449 | 1449 | }); |
1450 | 1450 | |
1451 | + var popupCenter = function(url, title, w, h) { | |
1452 | + var dualScreenLeft = window.screenLeft !== undefined ? window.screenLeft : screen.left; | |
1453 | + var dualScreenTop = window.screenTop !== undefined ? window.screenTop : screen.top; | |
1454 | + | |
1455 | + var width = window.innerWidth ? window.innerWidth : document.documentElement.clientWidth ? document.documentElement.clientWidth : screen.width; | |
1456 | + var height = window.innerHeight ? window.innerHeight : document.documentElement.clientHeight ? document.documentElement.clientHeight : screen.height; | |
1457 | + | |
1458 | + var left = ((width / 2) - (w / 2)) + dualScreenLeft; | |
1459 | + var top = ((height / 3) - (h / 3)) + dualScreenTop; | |
1460 | + | |
1461 | + var newWindow = window.open(url, title, 'scrollbars=yes, width=' + w + ', height=' + h + ', top=' + top + ', left=' + left); | |
1462 | + | |
1463 | + // Puts focus on the newWindow | |
1464 | + if (window.focus) { | |
1465 | + newWindow.focus(); | |
1466 | + } | |
1467 | + }; | |
1468 | + | |
1469 | + $(document).on('click', '.social a.popup', {}, function popUp(e) { | |
1470 | + var self = $(this); | |
1471 | + popupCenter(self.attr('href'), self.find('.rrssb-text').html(), 580, 470); | |
1472 | + e.preventDefault(); | |
1473 | + }); | |
1474 | + | |
1451 | 1475 | $(document).on('click', '#logout-button', function (e){ |
1452 | 1476 | $.removeCookie('_dialoga_session'); |
1453 | 1477 | $.removeCookie('votedProposals'); | ... | ... |