summaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
Diffstat (limited to 'js')
-rw-r--r--js/userdesign.go.js11
-rw-r--r--js/util.js15
2 files changed, 16 insertions, 10 deletions
diff --git a/js/userdesign.go.js b/js/userdesign.go.js
index 70dd9c7de..c53569bea 100644
--- a/js/userdesign.go.js
+++ b/js/userdesign.go.js
@@ -27,13 +27,14 @@ $(document).ready(function() {
}
}
+ /* rgb2hex written by R0bb13 <robertorebollo@gmail.com> */
function rgb2hex(rgb) {
rgb = rgb.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);
- function hex(x) {
- hexDigits = new Array("0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F");
- return isNaN(x) ? "00" : hexDigits[(x - x % 16) / 16] + hexDigits[x % 16];
- }
- return "#" + hex(rgb[1]) + hex(rgb[2]) + hex(rgb[3]);
+ return '#' + dec2hex(rgb[1]) + dec2hex(rgb[2]) + dec2hex(rgb[3]);
+ }
+ function dec2hex(x) {
+ hexDigits = new Array('0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F');
+ return isNaN(x) ? '00' : hexDigits[(x - x % 16) / 16] + hexDigits[x % 16];
}
function UpdateColors(S) {
diff --git a/js/util.js b/js/util.js
index f3ed918cf..ef147bef4 100644
--- a/js/util.js
+++ b/js/util.js
@@ -25,7 +25,7 @@ $(document).ready(function(){
var counter = $("#notice_text-count");
counter.text(remaining);
- if (remaining <= 0) {
+ if (remaining < 0) {
$("#form_notice").addClass("warning");
} else {
$("#form_notice").removeClass("warning");
@@ -244,7 +244,7 @@ function NoticeReply() {
$('#content .notice').each(function() {
var notice = $(this)[0];
$($('.notice_reply', notice)[0]).click(function() {
- var nickname = ($('.author .nickname', notice).length > 0) ? $($('.author .nickname', notice)[0]) : $('.author .nickname');
+ var nickname = ($('.author .nickname', notice).length > 0) ? $($('.author .nickname', notice)[0]) : $('.author .nickname.uid');
NoticeReplySet(nickname.text(), $($('.notice_id', notice)[0]).text());
return false;
});
@@ -256,10 +256,15 @@ function NoticeReplySet(nick,id) {
rgx_username = /^[0-9a-zA-Z\-_.]*$/;
if (nick.match(rgx_username)) {
replyto = "@" + nick + " ";
- if ($("#notice_data-text").length) {
- $("#notice_data-text").val(replyto);
+ var text = $("#notice_data-text");
+ if (text.length) {
+ text.val(replyto + text.val());
$("#form_notice input#notice_in-reply-to").val(id);
- $("#notice_data-text").focus();
+ if (text.get(0).setSelectionRange) {
+ var len = text.val().length;
+ text.get(0).setSelectionRange(len,len);
+ text.get(0).focus();
+ }
return false;
}
}