Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Basthon
Basthon Notebook
Commits
84f18a97
Commit
84f18a97
authored
Nov 01, 2020
by
Romain Casati
Browse files
Support for the file= loading feature.
parent
0c761f3b
Changes
1
Hide whitespace changes
Inline
Side-by-side
notebook/basthon/gui.js
View file @
84f18a97
...
...
@@ -75,7 +75,7 @@ window.basthonGUI = (function () {
};
/**
* Loading the notebook from query string (ipynb=).
* Loading the notebook from query string (ipynb=
or file=
).
*/
that
.
loadFromQS
=
async
function
()
{
const
url
=
new
URL
(
window
.
location
.
href
);
...
...
@@ -85,6 +85,17 @@ window.basthonGUI = (function () {
if
(
url
.
searchParams
.
has
(
ipynb_key
)
)
{
ipynb
=
url
.
searchParams
.
get
(
ipynb_key
);
ipynb
=
decodeURIComponent
(
ipynb
);
}
else
if
(
url
.
searchParams
.
has
(
file_key
)
)
{
var
fileURL
=
url
.
searchParams
.
get
(
file_key
);
fileURL
=
decodeURIComponent
(
fileURL
);
try
{
ipynb
=
await
Basthon
.
xhr
({
url
:
fileURL
,
method
:
'
GET
'
});
}
catch
{
throw
{
message
:
"
Le chargement du notebook
"
+
fileURL
+
"
a échoué.
"
,
name
:
'
LoadingException
'
};
}
}
if
(
ipynb
)
{
that
.
notebook
.
load
(
JSON
.
parse
(
ipynb
));
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment