") .text("A trusted IPython notebook may execute hidden malicious code ") .append($("") @@ -1853,30 +1837,23 @@ var IPython = (function (IPython) { Trust : { class : "btn-danger", click : function () { - $([IPython.events]).trigger('notebook_trusting.Notebook'); - var url = utils.url_join_encode( - nb.base_url, - 'api/notebooks', - nb.notebook_path, - nb.notebook_name, - 'trust' - ); - $.ajax(url, settings); + var cells = nb.get_cells(); + for (var i = 0; i < cells.length; i++) { + var cell = cells[i]; + if (cell.cell_type == 'code') { + cell.output_area.trusted = true; + } + } + $([IPython.events]).on('notebook_saved.Notebook', function () { + window.location.reload(); + }); + nb.save_notebook(); } } } }); }; - Notebook.prototype._trust_notebook_success = function (data, status, xhr) { - $([IPython.events]).trigger('notebook_trusted.Notebook'); - window.location.reload(); - }; - - Notebook.prototype._trust_notebook_error = function (xhr, status, error) { - $([IPython.events]).trigger('notebook_trust_failed.Notebook', [xhr, status, error]); - }; - Notebook.prototype.new_notebook = function(){ var path = this.notebook_path; var base_url = this.base_url;