mirror of
https://github.com/jupyter/notebook.git
synced 2025-02-05 12:19:58 +08:00
convention, jQuery variable start with $
all this.xxxx = $(...) change to this.$xxxx I'm thinking of potentially doing it also in parameters that are expected to be jQuery enabled.
This commit is contained in:
parent
1c97a7232f
commit
3cc81dbb8f
@ -61,7 +61,7 @@ var IPython = (function (IPython) {
|
||||
this.metaui = new IPython.MetaUI(this);
|
||||
|
||||
var cell = $('<div></div>').addClass('cell border-box-sizing code_cell vbox');
|
||||
cell.append(this.metaui.element);
|
||||
cell.append(this.metaui.$element);
|
||||
cell.attr('tabindex','2');
|
||||
var input = $('<div></div>').addClass('input hbox');
|
||||
input.append($('<div/>').addClass('prompt input_prompt'));
|
||||
|
@ -19,7 +19,7 @@ var IPython = (function (IPython) {
|
||||
this.bind_events();
|
||||
$(this.selector)
|
||||
.append($('<label/>').text('MetaUI'))
|
||||
.append(IPython.MetaUI.dropdown_preset_selector)
|
||||
.append(IPython.MetaUI.$dropdown_preset_selector)
|
||||
};
|
||||
|
||||
MainToolBar.prototype = new IPython.ToolBar();
|
||||
|
@ -27,20 +27,20 @@ var IPython = (function (IPython) {
|
||||
*/
|
||||
var MetaUI = function (cell) {
|
||||
MetaUI._instances.push(this);
|
||||
this.metainner = $('<div/>');
|
||||
this.$metainner = $('<div/>');
|
||||
this.cell = cell;
|
||||
this.element = $('<div/>').addClass('metaedit')
|
||||
.append(this.metainner)
|
||||
this.$element = $('<div/>').addClass('metaedit')
|
||||
.append(this.$metainner)
|
||||
this.rebuild();
|
||||
return this;
|
||||
};
|
||||
|
||||
MetaUI.dropdown_preset_selector = $('<select/>')
|
||||
MetaUI.$dropdown_preset_selector = $('<select/>')
|
||||
.attr('id','metaui_selector')
|
||||
.append($('<option/>').attr('value','').text('-'))
|
||||
|
||||
MetaUI.dropdown_preset_selector.change(function(){
|
||||
var val = MetaUI.dropdown_preset_selector.val()
|
||||
MetaUI.$dropdown_preset_selector.change(function(){
|
||||
var val = MetaUI.$dropdown_preset_selector.val()
|
||||
if(val ==''){
|
||||
$('body').removeClass('editmetaon')
|
||||
} else {
|
||||
@ -155,7 +155,7 @@ var IPython = (function (IPython) {
|
||||
*/
|
||||
MetaUI.register_preset = function(name, preset_list){
|
||||
MetaUI._presets[name] = preset_list
|
||||
MetaUI.dropdown_preset_selector.append(
|
||||
MetaUI.$dropdown_preset_selector.append(
|
||||
$('<option/>').attr('value',name).text(name)
|
||||
)
|
||||
}
|
||||
@ -201,8 +201,8 @@ var IPython = (function (IPython) {
|
||||
MetaUI.prototype.rebuild = function(){
|
||||
// strip evrything from the div
|
||||
// which is probabli metainner.
|
||||
// or this.element.
|
||||
this.metainner.empty();
|
||||
// or this.$element.
|
||||
this.$metainner.empty();
|
||||
//this.add_raw_edit_button()
|
||||
|
||||
|
||||
@ -213,7 +213,7 @@ var IPython = (function (IPython) {
|
||||
var local_div = $('<div/>').addClass('button_container');
|
||||
// Note,
|
||||
// do this the other way, wrap in try/catch and don't append if any errors.
|
||||
this.metainner.append(local_div)
|
||||
this.$metainner.append(local_div)
|
||||
cdict[preset[index]](local_div,this.cell)
|
||||
}
|
||||
|
||||
|
@ -44,7 +44,7 @@ var IPython = (function (IPython) {
|
||||
TextCell.prototype.create_element = function () {
|
||||
var cell = $("<div>").addClass('cell text_cell border-box-sizing vbox');
|
||||
this.metaui = new IPython.MetaUI(this);
|
||||
cell.append(this.metaui.element);
|
||||
cell.append(this.metaui.$element);
|
||||
cell.attr('tabindex','2');
|
||||
var input_area = $('<div/>').addClass('text_cell_input border-box-sizing');
|
||||
this.code_mirror = CodeMirror(input_area.get(0), {
|
||||
|
Loading…
Reference in New Issue
Block a user