--- a/web/client_new.php Mon Feb 13 12:47:01 2012 +0100
+++ b/web/client_new.php Tue Feb 14 14:17:43 2012 +0100
@@ -58,9 +58,32 @@
document.location.href="<?php echo(URL_ROOT.$rep); ?>/client.php?CONNECT=true";
});
+ function updateCounter() {
+ var _v = $("#status").val();
+ if (_v.length > 140) {
+ _v = _v.substr(0,140);
+ $("#status").val(_v);
+ }
+ $('#tweetCounter').html(140-_v.length);
+ if(140-_v.length < 0) {
+ $('#tweetCounter').addClass("tweetCounterNegative");
+ }
+ else {
+ $('#tweetCounter').removeClass("tweetCounterNegative");
+ }
+ $(".tweetButton").each(function(_i, _e) {
+ if (_v.search($(_e).find('span.twbSyntax').text().replace(/(\W)/g, '\\$1')) > -1) {
+ $(_e).addClass('selected');
+ } else {
+ $(_e).removeClass('selected');
+ }
+ });
+ }
+
// BUTTONS
$(".tweetButton").click(function() {
- add_grammar($(this).text());
+ add_grammar($(this).find('span.twbSyntax').text());
+ updateCounter();
})
// SEND TWEETS
@@ -83,17 +106,9 @@
});
});
+
- $("#status").bind("change keyup paste blur focus",function() {
- newval = 140-$("#status").val().length;
- $('#tweetCounter').val(newval);
- if(newval < 0) {
- $('#tweetCounter').addClass("tweetCounterNegative");
- }
- else {
- $('#tweetCounter').removeClass("tweetCounterNegative");
- }
- });
+ $("#status").bind("change keyup paste blur focus",updateCounter);
$("#Program").fancybox({
@@ -123,9 +138,6 @@
});
//<!-- LIMIT TEXTAREA:
- function imposemax(obj) {
- obj.value = obj.value.substr(0,140);
- };
// End -->
</script>
@@ -288,12 +300,15 @@
</div>
<div id="twwWrap">
<div id="tweetWriter">
+ <?php if (isset($_SESSION['TWITTER_ACCESS_TOKEN'])): ?>
+ <div id="tweetCounter"><?php echo(140-strlen($config['hashtag']));?></div>
+ <?php endif;?>
<h3 class="tweetWriterTitle"><?php print $translate->_("ClientTitle1 :"); ?></h3>
<form action="tweet.php" method="post" id="statusform" >
<?php if (!isset($_SESSION['TWITTER_ACCESS_TOKEN'])){
echo("<div class='loginbutton'><a href='".URL_ROOT."$rep/client.php?CONNECT=true' class='loginlink'>".$translate->_("Vous n'ĂȘtes pas connectĂ©.")."</a></div>");
} else {
- echo("<textarea name='status' id='status' rows='3' cols='50' onkeypress='imposemax(this);'>$config[hashtag]</textarea>");
+ echo("<textarea name='status' id='status' rows='3' cols='50'>$config[hashtag]</textarea>");
}
?>
<div id="messageSuccess" style="background-color:lightgreen; display: none;">
@@ -305,13 +320,26 @@
<a href="#" id="sendTweet" >
<span><?php print $translate->_("Envoyer"); ?></span>
</a>
- <?php if (isset($_SESSION['TWITTER_ACCESS_TOKEN'])): ?>
- <input id="tweetCounter" value="<?php echo(140-strlen($config['hashtag']));?>" disabled="disabled" size="3"/>
- <?php endif;?>
- <a id="positive" title="<?php echo $translate->_('Agree'); ?>" class="tweetButton">++</a>
- <a id="negative" title="<?php echo $translate->_('Disagree'); ?>" class="tweetButton">--</a>
- <a id="reference" title="<?php echo $translate->_('Reference'); ?>" class="tweetButton">==</a>
- <a id="question" title="<?php echo $translate->_('Question'); ?>" class="tweetButton"> ??</a>
+ <a id="positive" title="++ | <?php echo $translate->_('Agree'); ?>" class="tweetButton twbGreen">
+ <span class="twbSyntax">++</span>
+ <span class="twbSeparator">|</span>
+ <span class="twbLabel"><?php echo $translate->_('Agree'); ?></span>
+ </a>
+ <a id="negative" title="-- | <?php echo $translate->_('Disagree'); ?>" class="tweetButton twbRed">
+ <span class="twbSyntax">--</span>
+ <span class="twbSeparator">|</span>
+ <span class="twbLabel"><?php echo $translate->_('Disagree'); ?></span>
+ </a>
+ <a id="reference" title="== | <?php echo $translate->_('Reference'); ?>" class="tweetButton twbYellow">
+ <span class="twbSyntax">==</span>
+ <span class="twbSeparator">|</span>
+ <span class="twbLabel"><?php echo $translate->_('Reference'); ?></span>
+ </a>
+ <a id="question" title="?? | <?php echo $translate->_('Question'); ?>" class="tweetButton twbBlue">
+ <span class="twbSyntax">??</span>
+ <span class="twbSeparator">|</span>
+ <span class="twbLabel"><?php echo $translate->_('Question'); ?></span>
+ </a>
<div style="clear: both;"></div>
</form>