Permalink
Browse files

Resize based on outer window size. Fixes issue #58

  • Loading branch information...
1 parent 40a739c commit 04610c55109e76e23e5f6b6c9d515596e297074a @ozten ozten committed Nov 7, 2012
Showing with 15 additions and 2 deletions.
  1. +3 −0 server/views/authentication.ejs
  2. +12 −2 server/views/signin.ejs
View
3 server/views/authentication.ejs
@@ -32,6 +32,9 @@
<script type="text/javascript" src="<%= browserid_server %>/authentication_api.js"></script>
<% } %>
<script type="text/javascript">
+localStorage.height = window.outerHeight;
+localStorage.width = window.outerWidth;
+
navigator.id.beginAuthentication(function(email) {
if (email) {
window.location.pathname = '/proxy/' + encodeURIComponent(email);
View
14 server/views/signin.ejs
@@ -11,9 +11,19 @@
<script type="text/javascript" src="<%= browserid_server %>/authentication_api.js"></script>
<% } %>
<script>
+if (!! localStorage.width && !! localStorage.height) {
+ var w = parseInt(localStorage.getItem('width'), 10);
+ var h = parseInt(localStorage.getItem('height'), 10);
+ if (! isNaN(w) && w > 100 && ! isNaN(h) && h > 100) {
+ window.resizeTo(w, h);
+ if (localStorage.removeItem) {
+ localStorage.removeItem('width');
+ localStorage.removeItem('height');
+ }
+ }
+}
+
navigator.id.beginAuthentication(function(email) {
- // From mozilla/browserid resources/static/pages/page_helpers.js
- window.resizeTo(700, 375);
if (email === "<%= current_user %>") {
navigator.id.completeAuthentication();
} else {

0 comments on commit 04610c5

Please sign in to comment.