]> git.openstreetmap.org Git - rails.git/blob - app/views/site/_resize.html.erb
Combine the address and netmask for an ACL in one column
[rails.git] / app / views / site / _resize.html.erb
1 <script type="text/javascript">
2   var brokenContentSize = $("#content").prop("offsetWidth") == 0;
3
4   function resizeContent() {
5     var content = $("#content");
6     var leftMargin = parseInt(content.css("left"));
7     var rightMargin = parseInt(content.css("right"));
8     var bottomMargin = parseInt(content.css("bottom"));
9
10     <% if t('html.dir') == "ltr" -%>
11     content.width($(window).width() - content.prop("offsetLeft") - rightMargin);
12     <% else -%>
13     content.width($(window).width() - content.prop("offsetRight") - leftMargin);
14     <% end -%>
15     content.height($(window).height() - content.prop("offsetTop") - bottomMargin);
16   }
17
18   function resizeMap() {
19     var sidebar_width = 0 + $("#sidebar:visible").outerWidth(true);
20     var left_border = parseFloat($("#map").css("border-left-width"));
21     var right_border = parseFloat($("#map").css("border-right-width"));
22     var top_border = parseFloat($("#map").css("border-top-width"));
23     var bottom_border = parseFloat($("#map").css("border-bottom-width"));
24
25     <% if t('html.dir') == "ltr" -%>
26     $("#map").css("left", (sidebar_width) + "px");
27     <% else -%>
28     $("#map").css("right", (sidebar_width) + "px");
29     <% end -%>
30     $("#map").width($("#content").width() - sidebar_width - left_border - right_border);
31     $("#map").height($("#content").height() - top_border - bottom_border);
32
33     <% if params[:controller] == "site" and params[:action] == "index" -%>
34     map.updateSize();
35     <% end -%>
36   }
37
38   function handleResize() {
39     if (brokenContentSize) {
40       resizeContent();
41     }
42
43     resizeMap();
44   }
45 </script>