30 changed files with 15649 additions and 3178 deletions
@ -1,29 +0,0 @@ |
|||
<!doctype html> |
|||
<html lang="en"> |
|||
<head> |
|||
<meta charset="UTF-8"> |
|||
<title>COZe</title> |
|||
<link rel="stylesheet" href="style.css"> |
|||
</head> |
|||
<body style="text-align: center"> |
|||
|
|||
<div id="controls"> |
|||
<select id="gotoCloud"> |
|||
<option value="0">0</option> |
|||
<option value="1">1</option> |
|||
<option value="2">2</option> |
|||
<option value="3">3</option> |
|||
<option value="4">4</option> |
|||
<option value="5">5</option> |
|||
</select> |
|||
|
|||
<button id="reset">Reset</button> |
|||
|
|||
<input id="message" type="text" > |
|||
</div> |
|||
|
|||
<script src="https://code.jquery.com/jquery-latest.min.js"></script> |
|||
<script src="/socket.io/socket.io.js"></script> |
|||
<script src="/control.js"></script> |
|||
</body> |
|||
</html> |
@ -1,63 +0,0 @@ |
|||
$(document).ready(()=>{ |
|||
|
|||
const socket = io(); |
|||
|
|||
|
|||
// socket.emit('cloudIndex', getURLParameter('cloud'));
|
|||
if(getURLParameter('cloud')){ |
|||
socket.emit('cloudIndex', getURLParameter('cloud')); |
|||
} |
|||
|
|||
if(getURLParameter('message')){ |
|||
socket.emit('message', getURLParameter('message')); |
|||
} |
|||
|
|||
if(getURLParameter('response')){ |
|||
socket.emit('response', getURLParameter('response')); |
|||
} |
|||
|
|||
if(getURLParameter('actions')){ |
|||
socket.emit('actions', getURLParameter('actions')); |
|||
} |
|||
|
|||
if(getURLParameter('display')){ |
|||
socket.emit('display', getURLParameter('display')); |
|||
} |
|||
|
|||
if(getURLParameter('reset')){ |
|||
socket.emit('reset', 1); |
|||
} |
|||
|
|||
$('#gotoCloud').on('change', function(){ |
|||
current = $(this).val(); |
|||
socket.emit('cloudIndex', current); |
|||
}); |
|||
|
|||
$('#reset').on('click', function(){ |
|||
socket.emit('reset', 1); |
|||
console.log('RESET'); |
|||
}); |
|||
|
|||
$('#message').on('keypress', function(event){ |
|||
if(event.which == 13){ |
|||
socket.emit('message', $(this).val()); |
|||
console.log('message', $(this).val()); |
|||
} |
|||
}); |
|||
|
|||
}); |
|||
|
|||
|
|||
|
|||
|
|||
function getURLParameter(sParam){ |
|||
const sPageURL = window.location.search.substring(1); |
|||
const sURLVariables = sPageURL.split('&'); |
|||
|
|||
for (let i = 0; i < sURLVariables.length; i++){ |
|||
const sParameterName = sURLVariables[i].split('='); |
|||
if (sParameterName[0] == sParam){ |
|||
return sParameterName[1]; |
|||
} |
|||
} |
|||
} |
File diff suppressed because it is too large
@ -0,0 +1,28 @@ |
|||
|
|||
<!doctype html> |
|||
<html lang="en"> |
|||
<head> |
|||
<title>COZe Training</title> |
|||
<meta charset="UTF-8"> |
|||
<meta content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no' name='viewport'> |
|||
<link rel="stylesheet" href="/css/styles.css"> |
|||
</head> |
|||
<body> |
|||
<div class="header"> |
|||
<img class="menu" src="/images/menu.png"> |
|||
<img class="logo" src="/images/logo.png"> |
|||
</div> |
|||
|
|||
<div class="content"> |
|||
</div> |
|||
|
|||
<audio id="notify1"> |
|||
<source src="/sounds/message.ogg" type="audio/ogg"> |
|||
</audio> |
|||
|
|||
<script src="https://code.jquery.com/jquery-latest.min.js"></script> |
|||
<script src="/socket.io/socket.io.js"></script> |
|||
<script src="/device.js"></script> |
|||
<script src="/getMessage.js"></script> |
|||
</body> |
|||
</html> |
@ -0,0 +1,134 @@ |
|||
$(document).ready( function(){ |
|||
|
|||
var socket = io(); |
|||
socket.on('message', getMessage); |
|||
|
|||
var baseUrl = 'http://' + window.location.hostname; |
|||
var content = $('.content'); |
|||
var urlString = window.location.href; |
|||
var url = new URL(urlString); |
|||
var sid = getParameterByName("sid", urlString); |
|||
|
|||
console.log('a<szdhxfg'); |
|||
console.log(baseUrl); |
|||
$.getJSON( baseUrl + '/apis/getMessages.php', { |
|||
sid: sid |
|||
}).done( function(session){ |
|||
console.log(session); |
|||
|
|||
if(session.enabled){ |
|||
$.each(session.messages, function(index,item){ |
|||
if(item.timer != session.start){ |
|||
|
|||
var now = new Date().getTime(); |
|||
|
|||
var timerValue = item.timer.split(' '); |
|||
var timerDate = timerValue[0].split('-'); |
|||
var timerHours = timerValue[1].split(':'); |
|||
var timer = new Date(timerDate[0], timerDate[1] - 1, timerDate[2], timerHours[0], timerHours[1], timerHours[2]).getTime(); |
|||
|
|||
var startValue = session.start.split(' '); |
|||
var startDate = startValue[0].split('-'); |
|||
var startHours = startValue[1].split(':'); |
|||
var start = new Date(startDate[0], startDate[1] - 1, startDate[2], startHours[0], startHours[1], startHours[2]).getTime(); |
|||
|
|||
console.log(now, start, timer, timer-now); |
|||
if(now > timer){ |
|||
showCloud(item.title, [item.short_text, item.long_text], item.image, item.actions, session.messages); |
|||
notify(true); |
|||
} else { |
|||
var delay = (timer - now); |
|||
setTimeout( function(){ |
|||
showCloud(item.title, [item.short_text, item.long_text], item.image, item.actions, session.messages); |
|||
notify(true); |
|||
},delay); |
|||
} |
|||
} |
|||
}); |
|||
} |
|||
}); |
|||
|
|||
|
|||
function showCloud(title, text, img, actions, messages){ |
|||
|
|||
var image = img ? '<img src="' + img : ''; |
|||
var long_text = text[1] ? '<div class="long-text"> <button class="toggle button confirm">More...</button> <div class="text-content">' + text[1] + '</div> </div>' : ''; |
|||
|
|||
var cloud = $('<div class="cloud left"> <div class="title">' + title + '</div> <div class="short-text">' + text[0] + '</div>' + long_text + image + '</div>'); |
|||
|
|||
cloud.find('.toggle').on('click', function(e){ |
|||
var button = $(e.currentTarget); |
|||
var text = button.siblings('.text-content'); |
|||
if(text.is(':visible')){ |
|||
button.text('More...'); |
|||
text.slideUp(); |
|||
}else{ |
|||
button.text('Less...'); |
|||
text.slideDown(); |
|||
} |
|||
}); |
|||
content.append(cloud); |
|||
|
|||
if(actions.length){ |
|||
|
|||
var actionsContainer = $('<div class="actions"></div>'); |
|||
$.each(actions, function(index, value){ |
|||
var button = $('<button class="goto button dotted" data-goto="' + value.mid + '">' + value.label + '</button>'); |
|||
|
|||
button.on('click', function(e){ |
|||
var goto = $(e.currentTarget); |
|||
var messageId = goto.data('goto'); |
|||
var fullMessage = messages.filter( function(m){m.id == messageId}); |
|||
showCloud(fullMessage[0].title, [fullMessage[0].short_text, fullMessage[0].long_text], fullMessage[0].image, fullMessage[0].actions, messages); |
|||
notify(false); |
|||
}); |
|||
|
|||
actionsContainer.append(button); |
|||
}); |
|||
|
|||
content.append(actionsContainer); |
|||
} |
|||
|
|||
scrollBottom(); |
|||
} |
|||
|
|||
function scrollBottom(){ |
|||
$('html, body').stop().animate({ |
|||
scrollTop: $('.cloud').last().offset().top |
|||
}, 1000); |
|||
} |
|||
|
|||
function notify(vibrate){ |
|||
if(vibrate){ |
|||
var canVibrate = (navigator.vibrate || |
|||
navigator.webkitVibrate || |
|||
navigator.mozVibrate || |
|||
navigator.msVibrate); |
|||
if(canVibrate){ |
|||
navigator.vibrate(500); |
|||
} |
|||
} |
|||
$('#notify1')[0].play(); |
|||
} |
|||
|
|||
|
|||
function getMessage(message){ |
|||
showCloud(message.title, [message.short_text, message.long_text], message.image, '', ''); |
|||
notify(true); |
|||
} |
|||
|
|||
|
|||
function getParameterByName(name, url) { |
|||
if (!url) url = window.location.href; |
|||
name = name.replace(/[\[\]]/g, "\\$&"); |
|||
var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"), |
|||
results = regex.exec(url); |
|||
if (!results) return null; |
|||
if (!results[2]) return ''; |
|||
return decodeURIComponent(results[2].replace(/\+/g, " ")); |
|||
} |
|||
|
|||
}); |
|||
|
|||
|
|||
|
Binary file not shown.
Binary file not shown.
Before Width: | Height: | Size: 434 KiB |
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,4 +0,0 @@ |
|||
[Dolphin] |
|||
PreviewsShown=true |
|||
Timestamp=2017,10,21,18,38,1 |
|||
Version=4 |
Before Width: | Height: | Size: 893 KiB |
Before Width: | Height: | Size: 247 KiB |
@ -0,0 +1,34 @@ |
|||
<!doctype html> |
|||
<html lang="en"> |
|||
<head> |
|||
<meta charset="UTF-8"> |
|||
<title>COZe</title> |
|||
<link href="/css/styles.css" rel="stylesheet" type="text/css"/> |
|||
<link href="/css/stylesGlobal.css" rel="stylesheet" type="text/css"/> |
|||
</head> |
|||
<body> |
|||
|
|||
<div id="MainContent" class="container"> |
|||
<form method="post" enctype="multipart/form-data" class="send_message_form"> |
|||
<div class="row"> |
|||
<div class="col-12"> |
|||
<span class="font-12 text-grey">Message title</span> |
|||
<input type="text" name="title" class="title"> |
|||
</div> |
|||
<div class="col-12"> |
|||
<span class="font-12 text-grey">Message text</span> |
|||
<textarea class="mce text" name="text"></textarea> |
|||
</div> |
|||
<div class="col-12 text-center p4 px-0"> |
|||
<button type="submit" class="button big full confirm mx-0">Send message</button> |
|||
</div> |
|||
</div> |
|||
</form> |
|||
</div> |
|||
|
|||
<script type="text/javascript" src="https://code.jquery.com/jquery-3.3.1.slim.min.js"></script> |
|||
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/tinymce/4.7.11/tinymce.min.js"></script> |
|||
<script type="text/javascript" src="/socket.io/socket.io.js"></script> |
|||
<script type="text/javascript" src="/setMessage.js"></script> |
|||
</body> |
|||
</html> |
@ -0,0 +1,45 @@ |
|||
$(document).ready(()=>{ |
|||
|
|||
const socket = io(); |
|||
const baseUrl = 'http://' + window.location.hostname; |
|||
|
|||
tinymce.init({ |
|||
selector: '.mce', |
|||
height: 200, |
|||
theme: 'modern', |
|||
menubar: false, |
|||
forced_root_block : '', |
|||
force_br_newlines : true, |
|||
pagebreak_separator: '%break%', |
|||
plugins: [ |
|||
'advlist autolink pagebreak lists paste' |
|||
], |
|||
toolbar: 'bold italic underline | bullist numlist pagebreak | removeformat', |
|||
image_advtab: false, |
|||
content_css: [ |
|||
'//fonts.googleapis.com/css?family=Montserrat:300,300i,400,400i', |
|||
] |
|||
}); |
|||
|
|||
const form = $('.send_message_form'); |
|||
|
|||
form.on('submit', function(e){ |
|||
e.preventDefault(); |
|||
|
|||
const title = form.find('.title').val(); |
|||
const text = form.find('.text').val().split('%break%'); |
|||
|
|||
const fullMessage = { |
|||
'title': title, |
|||
'short_text': text[0], |
|||
'long_text': text[1], |
|||
'image': '', |
|||
}; |
|||
|
|||
socket.emit('message', fullMessage); |
|||
parent.postMessage("cbClose", baseUrl); |
|||
|
|||
}); |
|||
|
|||
}); |
|||
|
@ -1,33 +0,0 @@ |
|||
<!doctype html> |
|||
<html lang="en"> |
|||
<head> |
|||
<title>COZe</title> |
|||
<meta charset="UTF-8"> |
|||
<meta content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no' name='viewport'> |
|||
<link rel="stylesheet" href="/css/styles.css"> |
|||
</head> |
|||
<body> |
|||
<div class="header"> |
|||
<img class="menu" src="/images/menu.png"> |
|||
<img class="logo" src="/images/logo.png"> |
|||
</div> |
|||
|
|||
<div class="content client"> |
|||
</div> |
|||
|
|||
|
|||
<audio id="notify1"> |
|||
<source src="../sounds/message.ogg" type="audio/ogg"> |
|||
</audio> |
|||
|
|||
<script src="https://code.jquery.com/jquery-latest.min.js"></script> |
|||
<script src="/socket.io/socket.io.js"></script> |
|||
<script src="/smartphone.js"></script> |
|||
|
|||
<iframe class="iframeGET" src=""></iframe> |
|||
<!-- |
|||
<div class="footer"> |
|||
<input type="text"> |
|||
</div>--> |
|||
</body> |
|||
</html> |
@ -1,192 +0,0 @@ |
|||
$(document).ready(()=>{ |
|||
|
|||
const socket = io(); |
|||
const baseUrl = "http://coze-training.local"; |
|||
const serverPath = "http://" + window.location.hostname + ":" + window.location.port + "/";// "http://coze.dev:3000/";
|
|||
const canVibrate = "vibrate" in navigator || "mozVibrate" in navigator; |
|||
if (canVibrate && !("vibrate" in navigator)){navigator.vibrate = navigator.mozVibrate;} |
|||
|
|||
const content = $('.content') |
|||
|
|||
const urlString = window.location.href |
|||
const url = new URL(urlString); |
|||
const sid = url.searchParams.get("sid"); |
|||
|
|||
$.getJSON( baseUrl + "/apis/getMessages.php", { |
|||
sid: sid |
|||
}).done( (data)=> { |
|||
console.log(data); |
|||
|
|||
|
|||
|
|||
|
|||
}); |
|||
|
|||
/* |
|||
|
|||
socket.on('cloudIndex', showCloud); |
|||
socket.on('reset', reset); |
|||
socket.on('message', showMessage); |
|||
socket.on('response', showResponse); |
|||
socket.on('actions', showActions); |
|||
socket.on('display', showHtml); |
|||
|
|||
|
|||
|
|||
function reset(index){ |
|||
cloudCount = 0 |
|||
console.log('RESET:', index) |
|||
content.empty() |
|||
parent.postMessage(cloudCount, "*") |
|||
} |
|||
|
|||
function showCloud(index){ |
|||
console.log('RECEIVE:', index); |
|||
|
|||
const thisCloud = $(clouds.get(index)); |
|||
let offset = 0; |
|||
|
|||
if(!thisCloud.hasClass('empty')){ |
|||
notify(true); |
|||
} |
|||
thisCloud.fadeIn(400,()=>{ |
|||
if(thisCloud.hasClass('scroll')){ |
|||
offset = thisCloud.offset().top |
|||
|
|||
content.animate({ |
|||
scrollTop: offset |
|||
}, 400); |
|||
} |
|||
}) |
|||
|
|||
} |
|||
|
|||
function showMessage(message){ |
|||
let newCloud = $('<div class="cloud right">' + decodeURIComponent(message) + '</div>'); |
|||
content.append(newCloud); |
|||
newCloud.fadeIn(); |
|||
content.animate({ |
|||
scrollTop: newCloud.offset().top |
|||
}, 400); |
|||
notify(false); |
|||
|
|||
cloudCount++ |
|||
parent.postMessage(cloudCount, "*") |
|||
} |
|||
|
|||
function showResponse(message){ |
|||
let newCloud = $('<div class="cloud left">' + decodeURIComponent(message) + '</div>'); |
|||
content.append(newCloud); |
|||
newCloud.fadeIn(); |
|||
content.animate({ |
|||
scrollTop: newCloud.offset().top |
|||
}, 400); |
|||
notify(true); |
|||
} |
|||
|
|||
function showActions(actions){ |
|||
|
|||
const actionsArray = decodeURIComponent(actions).split("|"); |
|||
let token = ""; |
|||
let buttons = ""; |
|||
let text = ""; |
|||
let side = ""; |
|||
|
|||
$.each(actionsArray, (index, val)=>{ |
|||
if(index==0){ |
|||
token = val; |
|||
}else{ |
|||
buttons += "<button class= \"button dotted\">"+val+"</button>"; |
|||
} |
|||
}); |
|||
|
|||
let newCloud = $('<div class="cloud empty">' + buttons + '</div>'); |
|||
content.append(newCloud); |
|||
newCloud.fadeIn(); |
|||
content.animate({ |
|||
scrollTop: newCloud.offset().top |
|||
}, 400); |
|||
|
|||
newCloud.find('button').on('click', ()=>{ |
|||
$('.iframeGET').attr('src', serverPath + 'control.html?display='+token); |
|||
}); |
|||
} |
|||
|
|||
|
|||
function showHtml(token){ |
|||
|
|||
switch(token){ |
|||
case "plans_1": |
|||
side = "empty"; |
|||
text = "<img src=\""+serverPath.replace(":3000", "")+"images/video.png\" class=\"video-opener\">"; |
|||
break; |
|||
case "pull_1": |
|||
side = "left"; |
|||
text = "Ricordati di non avvicinarti eccessivamente."; |
|||
break; |
|||
case "monit_1": |
|||
side = "left"; |
|||
text = "<b>TEMA 3 COMPETENZE DI VENDITA - REGOLA#1<br><br>"+ |
|||
"Non rispondere a domande non fatte</b><br><br>"+ |
|||
"Il cliente chiede di un prodotto. È meglio limitarsi a domandare cosa il cliente voglia sapere del prodotto.<br>"+ |
|||
"<b>Ad esempio, colore, materiale, taglia.</b>"+ |
|||
"<img src=\""+serverPath.replace(":3000", "")+"images/photo-compare2.jpg\" width=\"100%\">"; |
|||
break; |
|||
} |
|||
|
|||
if(tokenOnce.indexOf(token) < 0){ |
|||
|
|||
let newCloud = $('<div class="cloud '+side+'">' + text + '</div>'); |
|||
setTimeout( ()=>{ |
|||
content.append(newCloud); |
|||
newCloud.fadeIn(); |
|||
content.animate({ |
|||
scrollTop: newCloud.offset().top |
|||
}, 400); |
|||
|
|||
content.find('.video-opener').on('click', (e)=>{ |
|||
|
|||
const show = $('#video') |
|||
const video = show.find('video') |
|||
const close = show.find('.video-close') |
|||
|
|||
show.fadeIn() |
|||
video.get(0).play() |
|||
|
|||
close.on('click', (e)=>{ |
|||
const elem = $(e.currentTarget) |
|||
const video = elem.siblings('video') |
|||
|
|||
video.get(0).pause() |
|||
elem.parent().fadeOut() |
|||
|
|||
}) |
|||
|
|||
}); |
|||
|
|||
notify(true);; |
|||
},1000); |
|||
|
|||
tokenOnce.push(token); |
|||
} |
|||
|
|||
} |
|||
|
|||
|
|||
function notify(vibrate){ |
|||
|
|||
if(vibrate){ |
|||
navigator.vibrate(500); |
|||
} |
|||
|
|||
$('#notify1')[0].play(); |
|||
} |
|||
*/ |
|||
|
|||
|
|||
}); |
|||
|
|||
|
|||
|
|||
|
|||
|
Loading…
Reference in new issue