Skip to content

Commit

Permalink
Fixed some PopupWindow bugs.
Browse files Browse the repository at this point in the history
  • Loading branch information
tburry committed Sep 15, 2011
1 parent bb2d269 commit cea6491
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions js/global.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ jQuery(document).ready(function($) {
else
return false;
}

gdn.querySep = function(url) {
return url.indexOf('?') == -1 ? '?' : '&';
}

// Go to notifications if clicking on a user's notification count
$('li.UserNotifications a span').click(function() {
Expand All @@ -89,8 +93,8 @@ jQuery(document).ready(function($) {
$(".PopupWindow").live('click', function() {
var $this = $(this);

var width = $this.attr('popupWidth');
var height = $this.attr('popupHeight');
var width = $this.attr('popupWidth'); width = width ? width : 960;
var height = $this.attr('popupHeight'); height = height ? height : 600;
var left = (screen.width - width) / 2;
var top = (screen.height - height) / 2;

Expand All @@ -99,7 +103,7 @@ jQuery(document).ready(function($) {
if ($this.attr('popupHref'))
href = $this.attr('popupHref');
else
href += '&display=popup';
href += gdn.querySep(href)+'display=popup';

var win = window.open(href, 'Window_' + id, "left="+left+",top="+top+",width="+width+",height="+height+",status=0,scrollbars=0");
if (win)
Expand Down

0 comments on commit cea6491

Please sign in to comment.