<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=#BOTFONT#); 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 haveFocus = true; $(window).focus(function() { haveFocus = true; }); $(window).blur(function() { haveFocus = false; }); 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); } function htmldecode(s) { var parser = new DOMParser; var dom = parser.parseFromString('<!doctype html><body>' + s, 'text/html'); return dom.body.textContent; } function showNotification(title, text) { if (!window.Notification) return; if (Notification.permission === "granted") { var n = new Notification(title, { body: text }); } else if (Notification.permission !== "denied") Notification.requestPermission(function(status) { var n = new Notification(title, { body: text }); }); } 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) { // We have new messages! n = parseInt(match[1]); $(".direct-chat-messages").append(src); scrollDown(); showAction("Appended " + src.length); match = src.match(/<!-- TEXT -->(.*?)<!-- END TEXT -->/); if (match != null) { //if (document.hidden) //if (!haveFocus) if (!document.hasFocus()) showNotification("New chat message", htmldecode(match[1])); } else appendAction("Not notifying"); } 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> <!-- COMODO --> <script type="text/javascript"> //<![CDATA[ var tlJsHost = ((window.location.protocol == "https:") ? "https://secure.comodo.com/" : "http://www.trustlogo.com/"); document.write(unescape("%3Cscript src='" + tlJsHost + "trustlogo/javascript/trustlogo.js' type='text/javascript'%3E%3C/script%3E")); //]]> </script> <!-- END COMODO --> </head> <body onLoad='scrollDown(); start();'> <div id="actionMsg"></div> <form> <table><tr><td><!-- HEAD --> <a href="http://botcompany.de"><img style="display: block; margin-left: auto; margin-right: auto" src="http://eyeocr.sourceforge.net/filestore/filestore.php?cmd=serve&file=blob_1011942&contentType=image/png" width="128" height="128" title="Smart Bot"></a><!-- /HEAD --> <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 && !event.shiftKey && !event.ctrlKey) { 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>
Began life as a copy of #1009081
download render html show line numbers
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, gwrvuhgaqvyk, ishqpsrjomds, jtubtzbbkimh, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1011983 |
Snippet name: | Stefan's/Smart Bot's Chat Template (including JavaScript) |
Eternal ID of this version: | #1011983/28 |
Text MD5: | c718adc2be369244842314fc2e19dd14 |
Author: | stefan |
Category: | javax / web chat bots |
Type: | HTML |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2018-01-01 09:21:08 |
Source code size: | 7620 bytes / 230 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 449 / 17459 |
Version history: | 27 change(s) |
Referenced in: | #1011975 - Smart Bot's Chat [LIVE] #1012254 - Stefan's Chat / Smart Bot's Chat [Include] |