Permalink
Browse files

Village: Add linkify functionality and linkify submodule.

  • Loading branch information...
1 parent cfc1365 commit 181ae2644ce16d92a4e5a956e63a16d7f242511b @tchalvak tchalvak committed Jan 1, 2014
Showing with 20 additions and 10 deletions.
  1. +3 −0 .gitmodules
  2. +1 −0 deploy/lib/third-party/jquery-linkify
  3. +11 −8 deploy/templates/village.tpl
  4. +5 −2 deploy/www/village.php
View
@@ -0,0 +1,3 @@
+[submodule "deploy/lib/third-party/jquery-linkify"]
+ path = deploy/lib/third-party/jquery-linkify
+ url = git@github.com:BitLucid/jquery-linkify.git
@@ -1,15 +1,18 @@
-<h1>Chat Board</h1>
+<!-- Linkify and autofocus js happen at the bottom -->
+<h1>Chat Board</h1>
+<script src="/js/jquery-linkify.min.js" type="text/javascript"></script>
<script type="text/javascript">
{literal}
function refreshpagechat() {
- parent.main.location = "village.php";
+ if(false == $('#message').val()){ // Refresh only if text not being written.
+ parent.main.location = "village.php";
+ }
}
-setInterval(refreshpagechat, 300*1000); // Periodically refresh the page.
-
-window.onload = function(){
- $(document.getElementById('message')).focus();
-};
+$(function(){
+ $(".chat-messages").linkify();
+ setInterval(refreshpagechat, 300*1000); // Periodically refresh the page.
+});
{/literal}
</script>
{literal}
@@ -24,7 +27,7 @@ window.onload = function(){
{if is_logged_in()}
<form class='chat-submit' id="post_msg" action="{$target|escape}" method="post" name="post_msg">
<div>
- <input id="message" type="text" size="{$field_size}" maxlength="250" name="message" class="textField">
+ <input id="message" type="text" size="{$field_size}" maxlength="250" name="message" autofocus class="textField">
<input id="command" type="hidden" value="postnow" name="command">
<input name='chat_submit' type='hidden' value='1'>
<input type="submit" value="Chat" class="formButton" style='padding:.2em .4em;font-size:1.3em;font-weight:bolder'>
View
@@ -24,6 +24,7 @@
if ($user_id) {
if ($command == "postnow" && $message) {
send_chat($user_id, $message);
+ redirect('/village.php');
}
}
@@ -58,5 +59,7 @@ function get_time_ago($p_params, &$tpl) {
$template->fullDisplay();
-}
-?>
+
+
+} // End of player-is-live so no error block
+

0 comments on commit 181ae26

Please sign in to comment.