Added "Abandon Check Queue" feature, to catch dropped Call Menu calls that are tagged with a Lead ID. For more information, see the bottom of the INBOUND_CALLBACK_QUEUE.txt document. Added "Asterisk Restart URL" to the Modify Servers page, this can send a URL request any time Asterisk is auto-restarted on that server. Added display of inbound Call Menu calls to the Admin Modify Lead page if CallerID display option is used on page. git-svn-id: svn://192.168.202.10@3699 3d104415-ff17-0410-8863-d5cf3c621b8a
165 lines
5.4 KiB
PHP
165 lines
5.4 KiB
PHP
<?php
|
|
header('Content-Type: application/javascript');
|
|
require_once("dbconnect_mysqli.php");
|
|
require_once("functions.php");
|
|
|
|
$duration="2"; # seconds
|
|
$maxParticleCount="2350";
|
|
$particleSpeed="2";
|
|
|
|
$confetti_stmt="select * from vicidial_settings_containers where container_id='CONFETTI_SETTINGS'";
|
|
$confetti_rslt=mysql_to_mysqli($confetti_stmt, $link);
|
|
|
|
if (mysqli_num_rows($confetti_rslt)>0)
|
|
{
|
|
$confetti_row=mysqli_fetch_array($confetti_rslt);
|
|
$container_entry=explode("\n", $confetti_row['container_entry']);
|
|
|
|
for ($q=0; $q<count($container_entry); $q++)
|
|
{
|
|
if (!preg_match('/^\;/', $container_entry[$q]) && preg_match('/\s\=\>\s/', $container_entry[$q]))
|
|
{
|
|
$container_setting=explode(" => ", trim($container_entry[$q]));
|
|
$setting_name=$container_setting[0];
|
|
$setting_value=$container_setting[1];
|
|
if ($setting_name=="duration" || $setting_name=="maxParticleCount" || $setting_name=="particleSpeed")
|
|
{
|
|
$$setting_name=$setting_value;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
?>
|
|
// confetti.js - https://github.com/mathusummut/confetti.js - MIT License
|
|
var confettiDuration = <?php echo $duration; ?>; //set max confetti count
|
|
var maxParticleCount = <?php echo $maxParticleCount; ?>; //set max confetti count
|
|
var particleSpeed = <?php echo $particleSpeed; ?>; //set the particle animation speed
|
|
var startConfetti; //call to start confetti animation
|
|
var stopConfetti; //call to stop adding confetti
|
|
var toggleConfetti; //call to start or stop the confetti animation depending on whether it's already running
|
|
var removeConfetti; //call to stop the confetti animation and remove all confetti immediately
|
|
|
|
(function() {
|
|
startConfetti = startConfettiInner;
|
|
stopConfetti = stopConfettiInner;
|
|
toggleConfetti = toggleConfettiInner;
|
|
removeConfetti = removeConfettiInner;
|
|
var colors = ["DodgerBlue", "OliveDrab", "Gold", "Pink", "SlateBlue", "LightBlue", "Violet", "PaleGreen", "SteelBlue", "SandyBrown", "Chocolate", "Crimson"]
|
|
var streamingConfetti = false;
|
|
var animationTimer = null;
|
|
var particles = [];
|
|
var waveAngle = 0;
|
|
|
|
function resetParticle(particle, width, height) {
|
|
particle.color = colors[(Math.random() * colors.length) | 0];
|
|
particle.x = Math.random() * width;
|
|
particle.y = Math.random() * height - height;
|
|
particle.diameter = Math.random() * 10 + 5;
|
|
particle.tilt = Math.random() * 10 - 10;
|
|
particle.tiltAngleIncrement = Math.random() * 0.07 + 0.05;
|
|
particle.tiltAngle = 0;
|
|
return particle;
|
|
}
|
|
|
|
function startConfettiInner() {
|
|
var width = window.innerWidth;
|
|
var height = window.innerHeight;
|
|
window.requestAnimFrame = (function() {
|
|
return window.requestAnimationFrame ||
|
|
window.webkitRequestAnimationFrame ||
|
|
window.mozRequestAnimationFrame ||
|
|
window.oRequestAnimationFrame ||
|
|
window.msRequestAnimationFrame ||
|
|
function (callback) {
|
|
return window.setTimeout(callback, 16.6666667);
|
|
};
|
|
})();
|
|
var canvas = document.getElementById("confetti-canvas");
|
|
if (canvas === null) {
|
|
canvas = document.createElement("canvas");
|
|
canvas.setAttribute("id", "confetti-canvas");
|
|
canvas.setAttribute("style", "display:block;z-index:999999;pointer-events:none;position: absolute");
|
|
document.body.appendChild(canvas);
|
|
canvas.width = width;
|
|
canvas.height = height;
|
|
window.addEventListener("resize", function() {
|
|
canvas.width = window.innerWidth;
|
|
canvas.height = window.innerHeight;
|
|
}, true);
|
|
}
|
|
var context = canvas.getContext("2d");
|
|
while (particles.length < maxParticleCount)
|
|
particles.push(resetParticle({}, width, height));
|
|
streamingConfetti = true;
|
|
if (animationTimer === null) {
|
|
(function runAnimation() {
|
|
context.clearRect(0, 0, window.innerWidth, window.innerHeight);
|
|
if (particles.length === 0)
|
|
animationTimer = null;
|
|
else {
|
|
updateParticles();
|
|
drawParticles(context);
|
|
animationTimer = requestAnimFrame(runAnimation);
|
|
}
|
|
})();
|
|
}
|
|
}
|
|
|
|
function stopConfettiInner() {
|
|
streamingConfetti = false;
|
|
}
|
|
|
|
function removeConfettiInner() {
|
|
stopConfetti();
|
|
particles = [];
|
|
}
|
|
|
|
function toggleConfettiInner() {
|
|
if (streamingConfetti)
|
|
stopConfettiInner();
|
|
else
|
|
startConfettiInner();
|
|
}
|
|
|
|
function drawParticles(context) {
|
|
var particle;
|
|
var x;
|
|
for (var i = 0; i < particles.length; i++) {
|
|
particle = particles[i];
|
|
context.beginPath();
|
|
context.lineWidth = particle.diameter;
|
|
context.strokeStyle = particle.color;
|
|
x = particle.x + particle.tilt;
|
|
context.moveTo(x + particle.diameter / 2, particle.y);
|
|
context.lineTo(x, particle.y + particle.tilt + particle.diameter / 2);
|
|
context.stroke();
|
|
}
|
|
}
|
|
|
|
function updateParticles() {
|
|
var width = window.innerWidth;
|
|
var height = window.innerHeight;
|
|
var particle;
|
|
waveAngle += 0.01;
|
|
for (var i = 0; i < particles.length; i++) {
|
|
particle = particles[i];
|
|
if (!streamingConfetti && particle.y < -15)
|
|
particle.y = height + 100;
|
|
else {
|
|
particle.tiltAngle += particle.tiltAngleIncrement;
|
|
particle.x += Math.sin(waveAngle);
|
|
particle.y += (Math.cos(waveAngle) + particle.diameter + particleSpeed) * 0.5;
|
|
particle.tilt = Math.sin(particle.tiltAngle) * 15;
|
|
}
|
|
if (particle.x > width + 20 || particle.x < -20 || particle.y > height) {
|
|
if (streamingConfetti && particles.length <= maxParticleCount)
|
|
resetParticle(particle, width, height);
|
|
else {
|
|
particles.splice(i, 1);
|
|
i--;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
})();
|