From 606297e453ebb108ac8272ecea50ba6d6d0983b0 Mon Sep 17 00:00:00 2001 From: mike Date: Tue, 8 Jul 2008 07:20:16 -0400 Subject: [PATCH] replybutton.darc Add a simple reply button to notices darcs-hash:20080708112016-f7d30-321142883159fa91338754140ac4ea37e54bb746.gz --- js/util.js | 9 +++++++++ lib/jabber.php | 2 +- lib/stream.php | 1 + theme/default/display.css | 5 ++++- theme/stoica/display.css | 4 ++++ 5 files changed, 19 insertions(+), 2 deletions(-) diff --git a/js/util.js b/js/util.js index 4f2e7c724d..50c311f993 100644 --- a/js/util.js +++ b/js/util.js @@ -19,5 +19,14 @@ $(document).ready(function(){ // run once in case there's something in there counter(); } + }); + function doreply(nick) { + rgx_username = /^[0-9a-zA-Z\-_.]*$/; + if (nick.match(rgx_username)) { + replyto = "@" + nick + " "; + document.getElementById("status_textarea").value=replyto; + document.getElementById("status_textarea").focus(); + } + } diff --git a/lib/jabber.php b/lib/jabber.php index 66ff24e63a..8890f6456d 100644 --- a/lib/jabber.php +++ b/lib/jabber.php @@ -19,7 +19,7 @@ if (!defined('LACONICA')) { exit(1); } -require_once('XMPPHP/XMPP.php'); +require_once('xmpp.php'); function jabber_valid_base_jid($jid) { # Cheap but effective diff --git a/lib/stream.php b/lib/stream.php index 8da07c3160..bef3abff01 100644 --- a/lib/stream.php +++ b/lib/stream.php @@ -86,6 +86,7 @@ class StreamAction extends Action { 'href' => $noticeurl, 'title' => common_exact_date($notice->created)), common_date_string($notice->created)); + common_element('a', array('href' => "#", 'onclick' => 'javascript: doreply("'.$profile->nickname.'")', 'class' => 'replybutton'), 'reply'); if ($replied_id) { $replyurl = common_local_url('shownotice', array('notice' => $replied_id)); common_text('('); diff --git a/theme/default/display.css b/theme/default/display.css index 98dad5d02a..0e681b909a 100644 --- a/theme/default/display.css +++ b/theme/default/display.css @@ -568,4 +568,7 @@ input#openid_url { } /* ===== End Forms Styling ===== */ - + +.replybutton { + margin-left: 55%; +} diff --git a/theme/stoica/display.css b/theme/stoica/display.css index fb300326a1..6a706dc6a3 100644 --- a/theme/stoica/display.css +++ b/theme/stoica/display.css @@ -595,3 +595,7 @@ input#openid_url { } /* ===== End Forms Styling ===== */ + +.replybutton { + margin-left: 55%; +} -- 2.39.5