diff --git a/r2/r2/lib/template_helpers.py b/r2/r2/lib/template_helpers.py index ffb47d7b0..f6fb47ac2 100755 --- a/r2/r2/lib/template_helpers.py +++ b/r2/r2/lib/template_helpers.py @@ -488,10 +488,6 @@ def choose_width(link, width): else: return 110 -def panel_size(state): - "the frame.cols of the reddit-toolbar's inner frame" - return '400px, 100%' if state =='expanded' else '0px, 100%x' - # Appends to the list "attrs" a tuple of: # diff --git a/r2/r2/public/static/css/reddit.less b/r2/r2/public/static/css/reddit.less index 13c7e70f1..8da06c7ed 100755 --- a/r2/r2/public/static/css/reddit.less +++ b/r2/r2/public/static/css/reddit.less @@ -3354,6 +3354,33 @@ button.button[disabled] { margin: 5px 10px 10px 3px; } +#inner_toolbar { + #reddit_panel, #reddit_link { + position: absolute; + height: 100%; + border: none; + } + + #reddit_panel { + width: 0; + } + + #reddit_link { + width: 100%; + } + + &.expanded { + #reddit_panel { + width: 400px; + } + + #reddit_link { + left: 400px; + right: 0; + } + } +} + .min-body { height: 100%; } diff --git a/r2/r2/public/static/js/reddit.js b/r2/r2/public/static/js/reddit.js index 8f2bd59b9..813bbd85a 100644 --- a/r2/r2/public/static/js/reddit.js +++ b/r2/r2/public/static/js/reddit.js @@ -973,11 +973,11 @@ var toolbar_p = function(expanded_size, collapsed_size) { }; this.show_panel = function() { - parent.inner_toolbar.document.body.cols = expanded_size; + $('body', parent.inner_toolbar.document).addClass('expanded') }; this.hide_panel = function() { - parent.inner_toolbar.document.body.cols = collapsed_size; + $('body', parent.inner_toolbar.document).removeClass('expanded') }; this.resize_toolbar = function() { diff --git a/r2/r2/templates/frametoolbar.html b/r2/r2/templates/frametoolbar.html index e4dbcfa07..3fb1f55c4 100644 --- a/r2/r2/templates/frametoolbar.html +++ b/r2/r2/templates/frametoolbar.html @@ -21,7 +21,7 @@ ############################################################################### <%! - from r2.lib.template_helpers import static, get_domain, add_sr, panel_size + from r2.lib.template_helpers import static, get_domain, add_sr from r2.lib.strings import Score %> @@ -33,7 +33,7 @@ <%def name="javascript_run()"> ${parent.javascript_run()} reddit.external_frame = true; - toolbar = new toolbar_p("${panel_size('expanded')}", "${panel_size('collapsed')}"); + toolbar = new toolbar_p(); <%def name="sr_stylesheets()"> diff --git a/r2/r2/templates/innertoolbarframe.html b/r2/r2/templates/innertoolbarframe.html index 9fdffb2f6..a39a42ece 100644 --- a/r2/r2/templates/innertoolbarframe.html +++ b/r2/r2/templates/innertoolbarframe.html @@ -20,19 +20,23 @@ ## reddit Inc. All Rights Reserved. ############################################################################### +<%namespace file="less.html" import="less_js, less_stylesheet"/> + <%! - from r2.lib.template_helpers import add_sr, panel_size + from r2.lib.template_helpers import add_sr %> - - - - - + + + ${less_stylesheet(g.stylesheet)} + ${less_js()} + + + + +