Automatic activation of the integrated sage cell

I am trying to embed a small cell / sage program in my webpage. However, the cell is activated only when the user clicks the activation button. I would like the cell to automatically appear on the page, so the user does not need to click the activation button and then enter values ​​for the program. I do not know how to do that. Is their way to automatically click a button created by a script? Is their way to show only the cell?

Here is the source code:

<!DOCTYPE HTML> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width"> <title>Sage Cell Server</title> <script src="https://sagecell.sagemath.org/static/jquery.min.js"></script> <script src="https://sagecell.sagemath.org/static/embedded_sagecell.js"></script> <script>$(function () { // Make the div with id 'mycell' a Sage cell sagecell.makeSagecell({inputLocation: '#mycell', template: sagecell.templates.minimal, evalButtonText: 'Activate'}); hide: ['evalButton'] // Make *any* div with class 'compute' a Sage cell }); </script> </head> <body> <h2>Factorial</h2> Click the "Activate" button below to calculate factorials. <div id="mycell"> @interact def _(a=(1, 10)): print factorial(a) </script> </div> </body> </html> 

Here is the html for the generated button:

 <button type="button" class="sagecell_evalButton ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" role="button" aria-disabled="false"><span class="ui-button-text">Activate</span></button> 

Here is the page after clicking the button (with cell): enter image description here

+4
source share
1 answer

Hide editor and evalButton. The text evalButton is not needed. Set autoeval to true. The default value is false.

 sagecell.makeSagecell({inputLocation: '#mycell', template: sagecell.templates.minimal, hide: ["editor","evalButton"], autoeval: true}); 
+2
source

All Articles