Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

191
LINES

< > TinyBrain | #1009081 - Stefan's Chat Template (including JavaScript)

HTML

<html>
<head>
<title>Chat Popup Test</title>
 <link href='//maxcdn.bootstrapcdn.com/bootstrap/3.3.0/css/bootstrap.min.css' rel='stylesheet'>
                                <style>@import url(https://fonts.googleapis.com/css?family=Oswald:400,300);
@import url(https://fonts.googleapis.com/css?family=Open+Sans);
@import url(https://fonts.googleapis.com/css?family=Pacifico);
body
{
    font-family: 'Open Sans', sans-serif;
}

.morebox {
  float: left;
  width: 722px;
  border: 1px solid #b0b0b0;
  padding: 10px;
  margin-left: 30px;
}

.popup-box {
   background-color: #ffffff;
    border: 1px solid #b0b0b0;
    /* XXX bottom: 0;*/
    top: 0;
    /*display: none;*/
    height: 415px;
    /*position: fixed;
    right: 70px;*/
    width: 600px; /* actual chat width, was 300 */
    float: left; /* XX */
    margin: 0 auto auto auto;
    font-family: 'Open Sans', sans-serif;
}

#RELATIVESTYLES#

#actionMsg {
    position: absolute;
    z-index: 9999;
    left: 0;
    top: 0; // bottom 
    height: 20px;
    /*width: 300px;*/
    width: auto;
    
    background-color: white;
    display: none;
}
</style>
<script type='text/javascript' src='//code.jquery.com/jquery-1.10.2.min.js'></script>
                                <script type='text/javascript' src='//maxcdn.bootstrapcdn.com/bootstrap/3.3.0/js/bootstrap.min.js'></script>
                                <script type='text/javascript'>  $(function(){
$("#addClass").click(function () {
          $('#qnimate').addClass('popup-box-on');
            });
          
            $("#removeClass").click(function () {
          $('#qnimate').removeClass('popup-box-on');
            });
  });
  
var showActions = false;
  
function showAction(action) {
  if (showActions) {
    $("#actionMsg").html(action);
    $("#actionMsg").show();
  }
}
  
function appendAction(action) {
  if (showActions) {
    $("#actionMsg").append(" | " + action);
    $("#actionMsg").show();
  }
}

function hideAction() {
  $("#actionMsg").hide();
  $("#actionMsg").html("");
}

function scrollDown() {
  //document.body.scrollTop = document.body.scrollHeight;
  $("#scrollme").scrollTop(1E10);
}

var n = #N#;
var vis = #VISITORS#;
var interval = 1000;
nInitial = n;

function start() {
  url = "#INCREMENTALURL#";
  if (url != '' && url != ("#INC" + "REMENTALURL#")) {
    var fullURL = url + "?v=" + vis + "&a=" + n;
    showAction("Loading " + fullURL);
    $.get(fullURL, function(src) {
      showAction("Loaded");
      
      var match = src.match(/<!-- vis (\d+) --/);
      if (match != null) {
        var vn = $("#visnum");
        if (vn != null) {
          vis = match[1];
          vn.html(match[1]);
        }
      }
      
      var match = src.match(/<!-- (\d+)/);
      if (match != null) {
        n = parseInt(match[1]);
        $(".direct-chat-messages").append(src);
        scrollDown();
        showAction("Appended " + src.length);
      } else
        showAction("n=" + n + " (initial=" + nInitial + ")");
      appendAction("Rescheduling");
      setTimeout(start, interval);
      appendAction("Rescheduled");
    }, 'text')
      .error(function(jqXHR, textStatus, errorThrown) {
        showAction("Rescheduling after fail: " + errorThrown + " / " + textStatus);
        setTimeout(start, interval);
      })
      /*.fail(function() {
        showAction("Rescheduling after fail");
        setTimeout(start, interval);
      })*/;
  }
}
</script>
</head>
<body onLoad='scrollDown(); start();'>
<div id="actionMsg"></div>

<form>

<table><tr><td>
<a href="http://botcompany.de"><img src="http://eyeocr.sourceforge.net/filestore/filestore.php?cmd=serve&file=blob_1009214&contentType=image/png" width="389" height="68" title="BotCompany.de"></a><br>
<div class="popup-box popup-box-on chat-popup" id="qnimate">
    		  <div class="popup-head">
				<div class="popup-head-left pull-left"><img src="http://eyeocr.sourceforge.net/filestore/filestore.php?cmd=serve&file=blob_1008323&contentType=image/png" alt="Bot Image"> $HEADING | <a href="http://ai1.lol/wiki/" target="_blank">More</a></div>
					  <div class="popup-head-right pull-right">
					  <!--
						<div class="btn-group">
    								  <button class="chat-header-button" data-toggle="dropdown" type="button" aria-expanded="false">
									   <i class="glyphicon glyphicon-cog"></i> </button>
									  <ul role="menu" class="dropdown-menu pull-right">
										<li><a href="#">Media</a></li>
										<li><a href="#">Block</a></li>
										<li><a href="#">Clear Chat</a></li>
										<li><a href="#">Email Chat</a></li>
									  </ul>
						</div>
						
						<button data-widget="remove" id="removeClass" class="chat-header-button pull-right" type="button"><i class="glyphicon glyphicon-off"></i></button>
						-->
                      </div>
			  </div>
			  
			<div id="scrollme" class="popup-messages">

			<div class="direct-chat-messages">
			<!-- MSGS HERE -->
			</div>
			<div class="popup-messages-footer">
			<textarea autofocus id="status_message" placeholder="Type a message..." rows="10" cols="30" name="message" onkeydown="if (event.keyCode == 13) { if (status_message.value.toUpperCase() == 'CLEAR') form.submit(); else { url = '#MSGURL#' + encodeURIComponent(status_message.value); showAction('Submitting ' + url); $.get(url); } this.select(); return false; }"></textarea>
			<div class="btn-footer">
			<!--
			<button class="bg_none"><i class="glyphicon glyphicon-film"></i> </button>
			<button class="bg_none"><i class="glyphicon glyphicon-camera"></i> </button>
            <button class="bg_none"><i class="glyphicon glyphicon-paperclip"></i> </button>
      -->
      <!--
			<button class="bg_none pull-right"><i class="glyphicon glyphicon-thumbs-up"></i> </button>
		  -->
			</div>
			</div>
	  </div>
	  
	  </td><td valign="top">
	  
	  <div class="morebox">
	    <!--MORE STUFF HERE-->
	  </div>
	  
</td></tr></table>
</form>
</body></html>

Author comment

Began life as a copy of #1009000

download  render html  show line numbers   

Travelled to 2 computer(s): jtubtzbbkimh, tvejysmllsmz

No comments. add comment

Snippet ID: #1009081
Snippet name: Stefan's Chat Template (including JavaScript)
Eternal ID of this version: #1009081/32
Text MD5: f4bd198b505966ceeff90d8936c3a17f
Author: stefan
Category: javax / web chat bots
Type: HTML
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-11-01 00:55:37
Source code size: 6114 bytes / 191 lines
Pitched / IR pitched: No / No
Views / Downloads: 79 / 4302816
Version history: 31 change(s)
Referenced in: [show]