Merge pull request #6145 from Carreau/style-cleanup

JS/CSS Style cleanup
Min RK 12 years ago
commit a2a70b40e2

@ -14,14 +14,10 @@ define([
this.selector = selector;
if (this.selector !== undefined) {
this.element = $(selector);
this.style();
this.bind_events();
}
};
LoginWidget.prototype.style = function () {
this.element.find("button").addClass("btn btn-default btn-sm");
};
LoginWidget.prototype.bind_events = function () {
@ -44,4 +40,4 @@ define([
IPython.LoginWidget = LoginWidget;
return {'LoginWidget': LoginWidget};
});
});

@ -4,7 +4,6 @@
var ipython = ipython || {};
require(['base/js/page'], function(page) {
var page_instance = new page.Page();
$('#ipython-main-app').addClass('border-box-sizing');
page_instance.show();
ipython.page = page_instance;

@ -8,15 +8,9 @@ define([
"use strict";
var Page = function () {
this.style();
this.bind_events();
};
Page.prototype.style = function () {
$('div#header').addClass('border-box-sizing');
$('div#site').addClass('border-box-sizing');
};
Page.prototype.bind_events = function () {
};
@ -30,12 +24,14 @@ define([
Page.prototype.show_header = function () {
// The header and site divs start out hidden to prevent FLOUC.
// Main scripts should call this method after styling everything.
// TODO: selector are hardcoded, pass as constructor argument
$('div#header').css('display','block');
};
Page.prototype.show_site = function () {
// The header and site divs start out hidden to prevent FLOUC.
// Main scripts should call this method after styling everything.
// TODO: selector are hardcoded, pass as constructor argument
$('div#site').css('display','block');
};

@ -24,6 +24,7 @@ div#header {
padding-left: 30px;
padding-bottom: 5px;
border-bottom: 1px solid @navbar-default-border;
.border-box-sizing();
}
#ipython_notebook {
@ -50,6 +51,7 @@ div#header {
#site {
width: 100%;
display: none;
.border-box-sizing();
}
/* Smaller buttons */
@ -69,6 +71,12 @@ span#login_widget {
float: right;
}
span#login_widget > .button {
.btn();
.btn-default();
.btn-sm();
}
.nav-header {
text-transform: none;
}

@ -6,6 +6,7 @@ define([
'jquery',
'base/js/utils',
], function(IPython, $, utils) {
// TODO: remove IPython dependency here
"use strict";
// monkey patch CM to be able to syntax highlight cell magics
@ -177,7 +178,6 @@ define([
* @return {Boolean} `true` if CodeMirror should ignore the event, `false` Otherwise
*/
Cell.prototype.handle_codemirror_keyevent = function (editor, event) {
var that = this;
var shortcuts = this.keyboard_manager.edit_shortcuts;
// if this is an edit_shortcuts shortcut, the global keyboard/shortcut
@ -556,7 +556,7 @@ define([
this.code_mirror.setOption('mode', default_mode);
};
// Backwards compatability.
// Backwards compatibility.
IPython.Cell = Cell;
return {'Cell': Cell};

@ -17,6 +17,9 @@ define([
// events: $(Events) instance
// cell: Cell instance
// notebook: Notebook instance
//
// TODO: This leaks, when cell are deleted
// There is still a reference to each celltoolbars.
CellToolbar._instances.push(this);
this.notebook = options.notebook;
this.cell = options.cell;

@ -123,7 +123,7 @@ define([
CodeCell.prototype.create_element = function () {
Cell.prototype.create_element.apply(this, arguments);
var cell = $('<div></div>').addClass('cell border-box-sizing code_cell');
var cell = $('<div></div>').addClass('cell code_cell');
cell.attr('tabindex','2');
var input = $('<div></div>').addClass('input');

@ -42,9 +42,6 @@ require([
) {
"use strict";
$('#ipython-main-app').addClass('border-box-sizing');
$('div#notebook_panel').addClass('border-box-sizing');
var common_options = {
base_url : utils.get_body_data("baseUrl"),
ws_url : IPython.utils.get_body_data("wsUrl"),

@ -50,9 +50,9 @@ define([
}
};
// TODO: This has definitively nothing to do with style ...
MenuBar.prototype.style = function () {
var that = this;
this.element.addClass('border-box-sizing');
this.element.find("li").click(function (event, ui) {
// The selected cell loses focus when the menu is entered, so we
// re-select it upon selection.

@ -121,8 +121,7 @@ define([
this.notebook_name_blacklist_re = /[\/\\:]/;
this.nbformat = 3; // Increment this when changing the nbformat
this.nbformat_minor = 0; // Increment this when changing the nbformat
this.codemirror_mode = 'ipython'
this.style();
this.codemirror_mode = 'ipython';
this.create_elements();
this.bind_events();
this.save_notebook = function() { // don't allow save until notebook_loaded
@ -135,14 +134,6 @@ define([
slideshow_celltoolbar.register(this);
};
/**
* Tweak the notebook's CSS style.
*
* @method style
*/
Notebook.prototype.style = function () {
$('div#notebook').addClass('border-box-sizing');
};
/**
* Create an HTML and CSS representation of the notebook.
@ -2140,8 +2131,7 @@ define([
Notebook.prototype.rename_error = function (xhr, status, error) {
var that = this;
var dialog_body = $('<div/>').append(
$("<p/>").addClass("rename-message")
.text('This notebook name already exists.')
$("<p/>").text('This notebook name already exists.')
);
this.events.trigger('notebook_rename_failed.Notebook', [xhr, status, error]);
dialog.modal({

@ -32,13 +32,10 @@ define([
};
NotificationArea.prototype.temp_message = function (msg, timeout, css_class) {
var uuid = utils.uuid();
if( css_class == 'danger') {css_class = 'ui-state-error';}
if( css_class == 'warning') {css_class = 'ui-state-highlight';}
var tdiv = $('<div>')
.attr('id',uuid)
.addClass('notification_widget ui-widget ui-widget-content ui-corner-all')
.addClass('border-box-sizing')
.addClass('notification_widget')
.addClass(css_class)
.hide()
.text(msg);
@ -94,7 +91,7 @@ define([
});
// Implicitly start off in Command mode, switching to Edit mode will trigger event
$modal_ind_icon.attr('class','command-mode_icon').attr('title','Command Mode');
$modal_ind_icon.attr('class','command_mode_icon').attr('title','Command Mode');
// Kernel events
this.events.on('status_idle.Kernel',function () {

@ -75,9 +75,7 @@ define([
};
Pager.prototype.style = function () {
this.pager_splitter_element.addClass('border-box-sizing ui-widget ui-state-default');
this.pager_element.addClass('border-box-sizing');
this.pager_element.find(".container").addClass('border-box-sizing');
this.pager_splitter_element.addClass('ui-widget ui-state-default');
this.pager_splitter_element.attr('title', 'Click to Show/Hide pager area, drag to Resize');
};

@ -8,25 +8,21 @@ define([
'base/js/dialog',
'base/js/keyboard',
'dateformat',
], function(IPython, $, utils, dialog, keyboard) {
], function(IPython, $, utils, dialog, keyboard, dateformat) {
"use strict";
var SaveWidget = function (selector, options) {
// TODO: Remove circulat ref.
// TODO: Remove circular ref.
this.notebook = undefined;
this.selector = selector;
this.events = options.events;
this.keyboard_manager = options.keyboard_manager;
if (this.selector !== undefined) {
this.element = $(selector);
this.style();
this.bind_events();
}
};
SaveWidget.prototype.style = function () {
};
SaveWidget.prototype.bind_events = function () {
var that = this;
@ -157,7 +153,7 @@ define([
}
var d = new Date(checkpoint.last_modified);
this.set_checkpoint_status(
"Last Checkpoint: " + d.format('mmm dd HH:MM')
"Last Checkpoint: " + dateformat(d,'mmm dd HH:MM')
);
};
@ -169,7 +165,7 @@ define([
}
};
// Backwards compatability.
// Backwards compatibility.
IPython.SaveWidget = SaveWidget;
return {'SaveWidget': SaveWidget};

@ -70,7 +70,7 @@ define([
TextCell.prototype.create_element = function () {
Cell.prototype.create_element.apply(this, arguments);
var cell = $("<div>").addClass('cell text_cell border-box-sizing');
var cell = $("<div>").addClass('cell text_cell');
cell.attr('tabindex','2');
var prompt = $('<div/>').addClass('prompt input_prompt');
@ -83,8 +83,8 @@ define([
var input_area = $('<div/>').addClass('input_area');
this.code_mirror = new CodeMirror(input_area.get(0), this.cm_config);
// The tabindex=-1 makes this div focusable.
var render_area = $('<div/>').addClass('text_cell_render border-box-sizing').
addClass('rendered_html').attr('tabindex','-1');
var render_area = $('<div/>').addClass('text_cell_render rendered_html')
.attr('tabindex','-1');
inner_cell.append(input_area).append(render_area);
cell.append(inner_cell);
this.element = cell;

@ -79,8 +79,7 @@ define([
};
ToolBar.prototype.style = function () {
this.element.addClass('border-box-sizing')
.addClass('toolbar');
this.element.addClass('toolbar');
};
/**
@ -94,7 +93,7 @@ define([
}
};
// Backwards compatability.
// Backwards compatibility.
IPython.ToolBar = ToolBar;
return {'ToolBar': ToolBar};

@ -2,19 +2,18 @@ div.cell {
border: 1px solid transparent;
.vbox();
.corner-all();
.border-box-sizing();
border-width: thin;
border-style: solid;
&.selected {
border-color: @border_color;
}
&.edit_mode {
border-color: green;
}
}
div.cell {
width: 100%;
padding: 5px 5px 5px 0px;
/* This acts as a spacer between cells, that is outside the border */

@ -2,6 +2,7 @@
margin-top: 0px;
margin-bottom: -19px;
position: relative;
.border-box-sizing();
.navbar {
border-top: 1px;

@ -15,6 +15,10 @@ body.notebook_app {
}
}
#ipython-main-app {
.border-box-sizing();
}
span#notebook_name {
height: 1em;
line-height: 1em;
@ -27,6 +31,7 @@ div#notebook_panel {
margin: 0px 0px 0px 0px;
padding: 0px;
.box-shadow(@notebook-shadow);
.border-box-sizing();
}
div#notebook {
font-size: @notebook_font_size;

@ -1,10 +1,12 @@
div#pager_splitter {
height: 8px;
.border-box-sizing();
}
#pager-container {
position: relative;
padding: 15px 0px;
.border-box-sizing();
}
div#pager {
@ -19,4 +21,5 @@ div#pager {
background-color: @cell_background;
padding: @code_padding;
}
.border-box-sizing();
}

@ -17,6 +17,7 @@ div.text_cell_render {
border-style: none;
padding: 0.5em 0.5em 0.5em @code_padding;
color: @text-color;
.border-box-sizing();
}
a.anchor-link:link {

@ -18,6 +18,8 @@
.btn {
padding: 2px 8px;
}
.border-box-sizing();
}
.toolbar .btn-group {
@ -40,7 +42,7 @@
text-align: right;
margin-left: 5px;
margin-right: 0px;
margin-top: 0px
margin-top: 0px;
}
.toolbar {

@ -316,8 +316,16 @@ div.cell {
/* Modern browsers */
flex: none;
border-radius: 4px;
box-sizing: border-box;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
border-width: thin;
border-style: solid;
width: 100%;
padding: 5px 5px 5px 0px;
/* This acts as a spacer between cells, that is outside the border */
margin: 0px;
outline: none;
}
div.cell.selected {
border-color: #ababab;
@ -325,13 +333,6 @@ div.cell.selected {
div.cell.edit_mode {
border-color: green;
}
div.cell {
width: 100%;
padding: 5px 5px 5px 0px;
/* This acts as a spacer between cells, that is outside the border */
margin: 0px;
outline: none;
}
div.prompt {
/* This needs to be wide enough for 3 digit prompt numbers: In[100]: */
min-width: 15ex;
@ -1109,6 +1110,9 @@ div.text_cell_render {
border-style: none;
padding: 0.5em 0.5em 0.5em 0.4em;
color: #000000;
box-sizing: border-box;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
}
a.anchor-link:link {
text-decoration: none;

@ -7609,6 +7609,9 @@ div#header {
padding-left: 30px;
padding-bottom: 5px;
border-bottom: 1px solid #e7e7e7;
box-sizing: border-box;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
}
#ipython_notebook {
padding-left: 0px;
@ -7631,6 +7634,9 @@ div#header {
#site {
width: 100%;
display: none;
box-sizing: border-box;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
}
/* Smaller buttons */
.ui-button .ui-button-text {
@ -7646,6 +7652,97 @@ input.ui-button {
span#login_widget {
float: right;
}
span#login_widget > .button {
display: inline-block;
margin-bottom: 0;
font-weight: normal;
text-align: center;
vertical-align: middle;
cursor: pointer;
background-image: none;
border: 1px solid transparent;
white-space: nowrap;
padding: 6px 12px;
font-size: 13px;
line-height: 1.42857143;
border-radius: 4px;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
color: #333333;
background-color: #ffffff;
border-color: #cccccc;
padding: 5px 10px;
font-size: 12px;
line-height: 1.5;
border-radius: 3px;
}
span#login_widget > .button:focus,
span#login_widget > .button:active:focus,
span#login_widget > .button.active:focus {
outline: thin dotted;
outline: 5px auto -webkit-focus-ring-color;
outline-offset: -2px;
}
span#login_widget > .button:hover,
span#login_widget > .button:focus {
color: #333333;
text-decoration: none;
}
span#login_widget > .button:active,
span#login_widget > .button.active {
outline: 0;
background-image: none;
-webkit-box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);
box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);
}
span#login_widget > .button.disabled,
span#login_widget > .button[disabled],
fieldset[disabled] span#login_widget > .button {
cursor: not-allowed;
pointer-events: none;
opacity: 0.65;
filter: alpha(opacity=65);
-webkit-box-shadow: none;
box-shadow: none;
}
span#login_widget > .button:hover,
span#login_widget > .button:focus,
span#login_widget > .button:active,
span#login_widget > .button.active,
.open .dropdown-togglespan#login_widget > .button {
color: #333333;
background-color: #ebebeb;
border-color: #adadad;
}
span#login_widget > .button:active,
span#login_widget > .button.active,
.open .dropdown-togglespan#login_widget > .button {
background-image: none;
}
span#login_widget > .button.disabled,
span#login_widget > .button[disabled],
fieldset[disabled] span#login_widget > .button,
span#login_widget > .button.disabled:hover,
span#login_widget > .button[disabled]:hover,
fieldset[disabled] span#login_widget > .button:hover,
span#login_widget > .button.disabled:focus,
span#login_widget > .button[disabled]:focus,
fieldset[disabled] span#login_widget > .button:focus,
span#login_widget > .button.disabled:active,
span#login_widget > .button[disabled]:active,
fieldset[disabled] span#login_widget > .button:active,
span#login_widget > .button.disabled.active,
span#login_widget > .button[disabled].active,
fieldset[disabled] span#login_widget > .button.active {
background-color: #ffffff;
border-color: #cccccc;
}
span#login_widget > .button .badge {
color: #ffffff;
background-color: #333333;
}
.nav-header {
text-transform: none;
}
@ -7940,8 +8037,16 @@ div.cell {
/* Modern browsers */
flex: none;
border-radius: 4px;
box-sizing: border-box;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
border-width: thin;
border-style: solid;
width: 100%;
padding: 5px 5px 5px 0px;
/* This acts as a spacer between cells, that is outside the border */
margin: 0px;
outline: none;
}
div.cell.selected {
border-color: #ababab;
@ -7949,13 +8054,6 @@ div.cell.selected {
div.cell.edit_mode {
border-color: green;
}
div.cell {
width: 100%;
padding: 5px 5px 5px 0px;
/* This acts as a spacer between cells, that is outside the border */
margin: 0px;
outline: none;
}
div.prompt {
/* This needs to be wide enough for 3 digit prompt numbers: In[100]: */
min-width: 15ex;
@ -8733,6 +8831,9 @@ div.text_cell_render {
border-style: none;
padding: 0.5em 0.5em 0.5em 0.4em;
color: #000000;
box-sizing: border-box;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
}
a.anchor-link:link {
text-decoration: none;
@ -9385,6 +9486,11 @@ body.notebook_app {
padding-right: 0px;
}
}
#ipython-main-app {
box-sizing: border-box;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
}
span#notebook_name {
height: 1em;
line-height: 1em;
@ -9397,6 +9503,9 @@ div#notebook_panel {
padding: 0px;
-webkit-box-shadow: inset 1px 4px 9px -6px rgba(0, 0, 0, 0.25);
box-shadow: inset 1px 4px 9px -6px rgba(0, 0, 0, 0.25);
box-sizing: border-box;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
}
div#notebook {
font-size: 14px;
@ -9592,24 +9701,6 @@ fieldset[disabled] #kernel_selector_widget > button {
-webkit-box-shadow: none;
box-shadow: none;
}
#kernel_selector_widget > button [class^="icon-"].icon-large,
#kernel_selector_widget > button [class*=" icon-"].icon-large {
line-height: .9em;
}
#kernel_selector_widget > button [class^="icon-"].icon-spin,
#kernel_selector_widget > button [class*=" icon-"].icon-spin {
display: inline-block;
}
#kernel_selector_widget > button [class^="icon-"].pull-left.icon-2x,
#kernel_selector_widget > button [class*=" icon-"].pull-left.icon-2x,
#kernel_selector_widget > button [class^="icon-"].pull-right.icon-2x,
#kernel_selector_widget > button [class*=" icon-"].pull-right.icon-2x {
margin-top: .18em;
}
#kernel_selector_widget > button [class^="icon-"].icon-spin.icon-large,
#kernel_selector_widget > button [class*=" icon-"].icon-spin.icon-large {
line-height: .8em;
}
#kernel_selector_widget > button:hover,
#kernel_selector_widget > button:focus,
#kernel_selector_widget > button:active,
@ -9653,6 +9744,9 @@ fieldset[disabled] #kernel_selector_widget > button.active {
margin-top: 0px;
margin-bottom: -19px;
position: relative;
box-sizing: border-box;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
}
#menubar .navbar {
border-top: 1px;
@ -10094,16 +10188,25 @@ fieldset[disabled] .notification_widget.danger.active {
}
div#pager_splitter {
height: 8px;
box-sizing: border-box;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
}
#pager-container {
position: relative;
padding: 15px 0px;
box-sizing: border-box;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
}
div#pager {
font-size: 14px;
line-height: 20px;
overflow: auto;
display: none;
box-sizing: border-box;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
}
div#pager pre {
line-height: 1.21429em;
@ -10183,6 +10286,9 @@ span#autosave_status {
padding: 0px;
margin-left: -5px;
margin-top: -5px;
box-sizing: border-box;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
}
.toolbar select,
.toolbar label {

@ -46,7 +46,7 @@ require([
common_options));
login_widget = new loginwidget.LoginWidget('#login_widget', common_options);
$('#new_notebook').button().click(function (e) {
$('#new_notebook').click(function (e) {
notebook_list.new_notebook();
});

Loading…
Cancel
Save