From 42a5e44d176869053db5bc451f4cd0c4a11b8a74 Mon Sep 17 00:00:00 2001 From: Aaron Parecki Date: Thu, 7 Apr 2016 16:37:56 -0700 Subject: [PATCH] autofill the note content with the username being replied to --- controllers/controllers.php | 1 - views/new-post.php | 10 ++++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/controllers/controllers.php b/controllers/controllers.php index b27c73e..4373fcf 100644 --- a/controllers/controllers.php +++ b/controllers/controllers.php @@ -56,7 +56,6 @@ $app->get('/new', function() use($app) { $params = $app->request()->params(); $entry = false; - $photo_url = false; $in_reply_to = ''; if(array_key_exists('reply', $params)) diff --git a/views/new-post.php b/views/new-post.php index 6c76f51..53cb01e 100644 --- a/views/new-post.php +++ b/views/new-post.php @@ -143,6 +143,16 @@ $(function(){ $("#note_content_remaining").addClass("pcheck"+tweet_check); }); + $("#note_in_reply_to").on('change', function(){ + if(match=$("#note_in_reply_to").val().match(/twitter\.com\/([^\/]+)\/status/)) { + $("#note_content").val( "@"+match[1]+" "+$("#note_content").val() ); + } + }); + + if($("#note_in_reply_to").val() != "") { + $("#note_in_reply_to").change(); + } + // ctrl-s to save $(window).on('keydown', function(e){ if(e.keyCode == 83 && e.ctrlKey){