summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorluxagraf <sng@luxagraf.net>2023-07-19 16:03:26 -0500
committerluxagraf <sng@luxagraf.net>2023-07-19 16:03:26 -0500
commita768d2e6698aa57813f69ab1bfb39405483bd0e1 (patch)
treee89daddeafcf401de6aafd8471da3d30aad19d40
parenta22d349573d60564e582b9a314c9463385d03dac (diff)
posts: added js to prepopulate form fields
-rw-r--r--app/posts/templates/posts/note_form.html18
1 files changed, 18 insertions, 0 deletions
diff --git a/app/posts/templates/posts/note_form.html b/app/posts/templates/posts/note_form.html
index c3de7be..2f3ac15 100644
--- a/app/posts/templates/posts/note_form.html
+++ b/app/posts/templates/posts/note_form.html
@@ -15,4 +15,22 @@
</main>
{% endblock %}
{% block js %}
+<script type="text/javascript">
+function GetURLParameter(sParam){
+ var sPageURL = window.location.search.substring(1);
+ var sURLVariables = sPageURL.split('&');
+ for (var i = 0; i < sURLVariables.length; i++) {
+ var sParameterName = sURLVariables[i].split('=');
+ if (sParameterName[0] == sParam) {
+ return sParameterName[1];
+ }
+ }
+};
+var title = GetURLParameter('title');
+var description = GetURLParameter('description');
+var url = GetURLParameter('url');
+document.getElementById('id_title').value = title;
+document.getElementById('id_url').value = url;
+document.getElementById('id_body_markdown').value = description;
+</script>
{% endblock%}