From cf8404056ffbaf69b89e14cc010c50a4e6259bb5 Mon Sep 17 00:00:00 2001 From: BlueRaja Date: Sun, 2 Jun 2013 18:13:06 -0500 Subject: Fixing up spoilers - they now use the 'pointer' cursor, and hide correctly for links. --- css/chat.css | 17 +++++++++++++++++ pages/chat.php | 31 ++++++++++++++++++++++--------- 2 files changed, 39 insertions(+), 9 deletions(-) diff --git a/css/chat.css b/css/chat.css index 5279cf8..5973b4d 100644 --- a/css/chat.css +++ b/css/chat.css @@ -143,7 +143,24 @@ .chatText.spoiler { color:transparent; + + /* Change cursor to pointer - http://stackoverflow.com/a/2076480/238419 */ + cursor: pointer; + cursor: hand; + + /* Don't allow selection - http://stackoverflow.com/a/4407335/238419 */ + -webkit-touch-callout: none; + -webkit-user-select: none; + -khtml-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; +} + +.chatText.spoiler a { + color:transparent; } + .chatText.spoiler:before { content: " Click to reveal Spoiler "; color:#7AF; diff --git a/pages/chat.php b/pages/chat.php index 0bc1cb5..0c88990 100644 --- a/pages/chat.php +++ b/pages/chat.php @@ -161,7 +161,7 @@ function addChatMessage(displayName, message, postDate, isSelf, isServer, wallCo var isAtBottom = (chatContainer.length == 1 && chatContainer.scrollTop() >= chatContainer[0].scrollHeight - chatContainer.outerHeight() - 1); chatContainer.append('
' + p + '
'); - + if (isAtBottom || firstGetChat) { chatContainer.scrollTop(chatContainer[0].scrollHeight); } @@ -177,13 +177,13 @@ function chatReplaceAndEncode(chat) { //Surround all URLs with a link var URLexp = /(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig; - chat = chat.replace(URLexp, "$1"); + chat = chat.replace(URLexp, "$1"); //Replace # in the URL with %23 - chat = chat.replace(//ig, ""); - chat = chat.replace(//ig, ""); + chat = chat.replace(//ig, ""); + chat = chat.replace(/ a', function() + { + addChatMessage("Debug", "Child called"); + }); }); function htmlEncode(value){ @@ -277,6 +284,12 @@ function htmlEncode(value){ } } +function doNothingWhenClickingLinks() +{ + return false; +} + + //Code for checking if the window is currently visible or not //Adapted from http://stackoverflow.com/a/1060034/238419 $(function() { -- cgit v1.2.3