From: Charles Kerr Date: Sun, 8 Aug 2010 20:58:58 +0000 (+0000) Subject: (trunk web) use the preference dialog's "compact" mode based on browser window size... X-Git-Tag: 2.10~129 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ead0ea9800b5cad96dc4d23bbca5849a87db8953;p=transmission (trunk web) use the preference dialog's "compact" mode based on browser window size, rather than whether or not it's an iPhone -- that way it should work for other mobile devices too. --- diff --git a/web/javascript/transmission.js b/web/javascript/transmission.js index c74aa8dd4..ac93103a7 100644 --- a/web/javascript/transmission.js +++ b/web/javascript/transmission.js @@ -892,36 +892,33 @@ Transmission.prototype = * *--------------------------------------------*/ - showPrefsDialog: function( ) { + showPrefsDialog: function( ) + { var tr = this; - $("#update_blocklist_button").button(); - $("#prefs_tabs").tabs(); - var args = { }; - if( iPhone ) { // tailor the dialog geometry for iPhone - $.extend( args, { - width: 320, - height: 360, - resizable: false, - draggable: false, - position: [ 0, 0 ] - } ); - } else { - $.extend( args, { - width: 450, - height: 400 - } ); - } - $.extend( args, { + + var preferredWidth = 450; + var preferredHeight = 400; + var windowWidth = $(window).width(); + var windowHeight = $(window).height(); + var fullscreen = (windowWidth<=preferredWidth) || (windowHeight<=preferredHeight); + + var args = { + close: function(event, ui) { tr.togglePeriodicSessionRefresh( true ); }, + width: fullscreen ? windowWidth : preferredWidth, + height: fullscreen ? windowHeight : preferredHeight, + resizable: !fullscreen, + draggable: !fullscreen, title: 'Preferences', show: 'blind', hide: 'blind', - buttons: { - 'Close': function() { - $(this).dialog('close'); - tr.togglePeriodicSessionRefresh( true ); - } - } - } ); + buttons: { } + }; + + if( fullscreen ) + args.position = [ 0, 0 ]; + else + args.buttons = { 'Close': function() { $(this).dialog('close'); } }; + $("#prefs_dialog" ).dialog( args ); tr.togglePeriodicSessionRefresh( false ); }, @@ -963,6 +960,9 @@ Transmission.prototype = { var tr = this; + $("#update_blocklist_button").button(); + $("#prefs_tabs").tabs(); + $.each( this.prefsKeys, function( index, key ) { $(':input#'+key).change( function( e ) { var control = e.target;