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

202
LINES

< > BotCompany Repo | #1009081 // Stefan's Chat Template (including JavaScript) - not used anymore

HTML

1  
<html>
2  
<head>
3  
<title>Chat Popup Test</title>
4  
 <link href='//maxcdn.bootstrapcdn.com/bootstrap/3.3.0/css/bootstrap.min.css' rel='stylesheet'>
5  
                                <style>@import url(https://fonts.googleapis.com/css?family=Oswald:400,300);
6  
@import url(https://fonts.googleapis.com/css?family=Open+Sans);
7  
@import url(https://fonts.googleapis.com/css?family=Pacifico);
8  
body
9  
{
10  
    font-family: 'Open Sans', sans-serif;
11  
}
12  
13  
.morebox {
14  
  float: left;
15  
  width: 722px;
16  
  border: 1px solid #b0b0b0;
17  
  padding: 10px;
18  
  margin-left: 30px;
19  
}
20  
21  
.popup-box {
22  
   background-color: #ffffff;
23  
    border: 1px solid #b0b0b0;
24  
    /* XXX bottom: 0;*/
25  
    top: 0;
26  
    /*display: none;*/
27  
    height: 415px;
28  
    /*position: fixed;
29  
    right: 70px;*/
30  
    width: 600px; /* actual chat width, was 300 */
31  
    float: left; /* XX */
32  
    margin: 0 auto auto auto;
33  
    font-family: 'Open Sans', sans-serif;
34  
}
35  
36  
#RELATIVESTYLES#
37  
38  
#actionMsg {
39  
    position: absolute;
40  
    z-index: 9999;
41  
    left: 0;
42  
    top: 0; // bottom 
43  
    height: 20px;
44  
    /*width: 300px;*/
45  
    width: auto;
46  
    
47  
    background-color: white;
48  
    display: none;
49  
}
50  
</style>
51  
<script type='text/javascript' src='//code.jquery.com/jquery-1.10.2.min.js'></script>
52  
                                <script type='text/javascript' src='//maxcdn.bootstrapcdn.com/bootstrap/3.3.0/js/bootstrap.min.js'></script>
53  
                                <script type='text/javascript'>  $(function(){
54  
$("#addClass").click(function () {
55  
          $('#qnimate').addClass('popup-box-on');
56  
            });
57  
          
58  
            $("#removeClass").click(function () {
59  
          $('#qnimate').removeClass('popup-box-on');
60  
            });
61  
  });
62  
  
63  
var showActions = false;
64  
  
65  
function showAction(action) {
66  
  if (showActions) {
67  
    $("#actionMsg").html(action);
68  
    $("#actionMsg").show();
69  
  }
70  
}
71  
  
72  
function appendAction(action) {
73  
  if (showActions) {
74  
    $("#actionMsg").append(" | " + action);
75  
    $("#actionMsg").show();
76  
  }
77  
}
78  
79  
function hideAction() {
80  
  $("#actionMsg").hide();
81  
  $("#actionMsg").html("");
82  
}
83  
84  
function scrollDown() {
85  
  //document.body.scrollTop = document.body.scrollHeight;
86  
  $("#scrollme").scrollTop(1E10);
87  
}
88  
89  
function showNotification(title, text) {
90  
  if (window.Notification && Notification.permission !== "denied")
91  
    Notification.requestPermission(function(status) {
92  
      var n = new Notification(title, { body: text });
93  
    });
94  
}
95  
96  
var n = #N#;
97  
var vis = #VISITORS#;
98  
var interval = 1000;
99  
nInitial = n;
100  
101  
function start() {
102  
  url = "#INCREMENTALURL#";
103  
  if (url != '' && url != ("#INC" + "REMENTALURL#")) {
104  
    var fullURL = url + "?v=" + vis + "&a=" + n;
105  
    showAction("Loading " + fullURL);
106  
    $.get(fullURL, function(src) {
107  
      showAction("Loaded");
108  
      
109  
      var match = src.match(/<!-- vis (\d+) --/);
110  
      if (match != null) {
111  
        var vn = $("#visnum");
112  
        if (vn != null) {
113  
          vis = match[1];
114  
          vn.html(match[1]);
115  
        }
116  
      }
117  
      
118  
      var match = src.match(/<!-- (\d+)/);
119  
      if (match != null) {
120  
        // We have new messages!
121  
        n = parseInt(match[1]);
122  
        $(".direct-chat-messages").append(src);
123  
        scrollDown();
124  
        showAction("Appended " + src.length);
125  
        match = src.match(/<!-- TEXT -->(.*?)<!-- END TEXT -->/);
126  
        if (match != null)
127  
          showNotification("New messages!", match[1]);
128  
      } else
129  
        showAction("n=" + n + " (initial=" + nInitial + ")");
130  
      appendAction("Rescheduling");
131  
      setTimeout(start, interval);
132  
      appendAction("Rescheduled");
133  
    }, 'text')
134  
      .error(function(jqXHR, textStatus, errorThrown) {
135  
        showAction("Rescheduling after fail: " + errorThrown + " / " + textStatus);
136  
        setTimeout(start, interval);
137  
      })
138  
      /*.fail(function() {
139  
        showAction("Rescheduling after fail");
140  
        setTimeout(start, interval);
141  
      })*/;
142  
  }
143  
}
144  
</script>
145  
</head>
146  
<body onLoad='scrollDown(); start();'>
147  
<div id="actionMsg"></div>
148  
149  
<form>
150  
151  
<table><tr><td>
152  
<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>
153  
<div class="popup-box popup-box-on chat-popup" id="qnimate">
154  
    		  <div class="popup-head">
155  
				<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>
156  
					  <div class="popup-head-right pull-right">
157  
					  <!--
158  
						<div class="btn-group">
159  
    								  <button class="chat-header-button" data-toggle="dropdown" type="button" aria-expanded="false">
160  
									   <i class="glyphicon glyphicon-cog"></i> </button>
161  
									  <ul role="menu" class="dropdown-menu pull-right">
162  
										<li><a href="#">Media</a></li>
163  
										<li><a href="#">Block</a></li>
164  
										<li><a href="#">Clear Chat</a></li>
165  
										<li><a href="#">Email Chat</a></li>
166  
									  </ul>
167  
						</div>
168  
						
169  
						<button data-widget="remove" id="removeClass" class="chat-header-button pull-right" type="button"><i class="glyphicon glyphicon-off"></i></button>
170  
						-->
171  
                      </div>
172  
			  </div>
173  
			  
174  
			<div id="scrollme" class="popup-messages">
175  
176  
			<div class="direct-chat-messages">
177  
			<!-- MSGS HERE -->
178  
			</div>
179  
			<div class="popup-messages-footer">
180  
			<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>
181  
			<div class="btn-footer">
182  
			<!--
183  
			<button class="bg_none"><i class="glyphicon glyphicon-film"></i> </button>
184  
			<button class="bg_none"><i class="glyphicon glyphicon-camera"></i> </button>
185  
            <button class="bg_none"><i class="glyphicon glyphicon-paperclip"></i> </button>
186  
      -->
187  
      <!--
188  
			<button class="bg_none pull-right"><i class="glyphicon glyphicon-thumbs-up"></i> </button>
189  
		  -->
190  
			</div>
191  
			</div>
192  
	  </div>
193  
	  
194  
	  </td><td valign="top">
195  
	  
196  
	  <div class="morebox">
197  
	    <!--MORE STUFF HERE-->
198  
	  </div>
199  
	  
200  
</td></tr></table>
201  
</form>
202  
</body></html>

Author comment

Began life as a copy of #1009000

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: #1009081
Snippet name: Stefan's Chat Template (including JavaScript) - not used anymore
Eternal ID of this version: #1009081/35
Text MD5: f1ed2de34fb73730ab83ae46956e2959
Author: stefan
Category: javax / web chat bots
Type: HTML
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-11-26 19:18:13
Source code size: 6534 bytes / 202 lines
Pitched / IR pitched: No / No
Views / Downloads: 463 / 4304287
Version history: 34 change(s)
Referenced in: [show references]