// Copyright (c) IPython Development Team.1// Distributed under the terms of the Modified BSD License.23define([4'base/js/namespace',5'jquery',6'base/js/events',7], function(IPython, $, events){8"use strict";910var Page = function () {11this.bind_events();12};1314Page.prototype.bind_events = function () {15// resize site on:16// - window resize17// - header change18// - page load19var _handle_resize = $.proxy(this._resize_site, this);2021$(window).resize(_handle_resize);2223// On document ready, resize codemirror.24$(document).ready(_handle_resize);25events.on('resize-header.Page', _handle_resize);26};2728Page.prototype.show = function () {29/**30* The header and site divs start out hidden to prevent FLOUC.31* Main scripts should call this method after styling everything.32*/33this.show_header();34this.show_site();35};3637Page.prototype.show_header = function () {38/**39* The header and site divs start out hidden to prevent FLOUC.40* Main scripts should call this method after styling everything.41* TODO: selector are hardcoded, pass as constructor argument42*/43$('div#header').css('display','block');44};4546Page.prototype.show_site = function () {47/**48* The header and site divs start out hidden to prevent FLOUC.49* Main scripts should call this method after styling everything.50* TODO: selector are hardcoded, pass as constructor argument51*/52$('div#site').css('display', 'block');53this._resize_site();54};5556Page.prototype._resize_site = function() {57// Update the site's size.58$('div#site').height($(window).height() - $('#header').height());59};6061// Register self in the global namespace for convenience.62IPython.Page = Page;63return {'Page': Page};64});656667