Skip to content

Commit

Permalink
Maybe going in circles with Jupyter parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
mdda committed Feb 13, 2018
1 parent 59d549f commit 0fe03d2
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions notebooks/2-CNN/8-Speech/SpeechAnalysis_Annotation.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,12 @@
"function get_textbox_ele(id) {\n",
" return get_next_display_ele(id, 'textbox');\n",
"}\n",
"function add_to_textbox(selector, txt) {\n",
" var tb = $(selector);\n",
" var caretPos = tb[0].selectionStart;\n",
" var textAreaTxt = tb.val();\n",
" tb.val(textAreaTxt.substring(0, caretPos) + txt + textAreaTxt.substring(caretPos) );\n",
"}\n",
"</script>\"\"\")"
]
},
Expand Down Expand Up @@ -161,13 +167,23 @@
"metadata": {},
"outputs": [],
"source": [
"# https://stackoverflow.com/questions/1064089/inserting-a-text-where-cursor-is-using-javascript-jquery\n",
"\n",
"notebook_html(\"\"\"<script type=\"text/Javascript\">\n",
"var audio_ele=get_audio_ele('{id}');\n",
"var textbox_ele=get_textbox_ele('{id}_tb');\n",
"//alert( ele.currentTime ); // YES!\n",
"$('{id}_tb').keypress(function(ev){ alert(ev);});\n",
"</script>\"\"\".format(id=audio_id))"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"audio_id"
]
},
{
"cell_type": "code",
"execution_count": null,
Expand Down

0 comments on commit 0fe03d2

Please sign in to comment.