From 1fd03b8b68cd887f9408262dfe0515b7ccbe5332 2013-06-11 19:09:57 From: MinRK Date: 2013-06-11 19:09:57 Subject: [PATCH] fix tab hash / url behavior clicking tabs sets hash, loading hash url implies tabs --- diff --git a/IPython/frontend/html/notebook/static/tree/js/main.js b/IPython/frontend/html/notebook/static/tree/js/main.js index 47b0553..86ae68c 100644 --- a/IPython/frontend/html/notebook/static/tree/js/main.js +++ b/IPython/frontend/html/notebook/static/tree/js/main.js @@ -16,7 +16,7 @@ $(document).ready(function () { $('#new_notebook').click(function (e) { window.open($('body').data('baseProjectUrl')+'new'); }); - + IPython.read_only = $('body').data('readOnly') === 'True'; IPython.notebook_list = new IPython.NotebookList('#notebook_list'); IPython.cluster_list = new IPython.ClusterList('#cluster_list'); @@ -69,6 +69,17 @@ $(document).ready(function () { $("#alternate_upload").change(function (event){ IPython.notebook_list.handelFilesUpload(event,'form'); }); + + // set hash on tab click + $("#tabs").find("a").click(function() { + window.location.hash = $(this).attr("href"); + }) + + // load tab if url hash + if (window.location.hash) { + $("#tabs").find("a[href=" + window.location.hash + "]").click(); + } + });