function urlify(text) {
var regexp = /(https?:\/\/[^\s\"]+)/g;
res = text.match(regexp);
return res ? res[0] : '';
return text.replace(urlRegex, function(url) {
console.log(url);
return url;
})
// or alternatively
// return text.replace(urlRegex, '<a href="$1">$1</a>')
}
https://codepen.io/zerospree/pen/aCjAz
<body>
<div class="loader" style="display: none;">
<div class="loader__wrapper">
<div class="load">
<hr/><hr/><hr/><hr/>
</div>
</div>
</div>
<script>
var $loader = $('.loader')
//$loader.hide()
$(document)
.ajaxStart(function () {
$loader.show()
})
.ajaxStop(function () {
setTimeout(function () {
$loader.hide()
}, 100)
});
// $.ajaxSetup({
// beforeSend: function (xhr) {
// $loader.show()
// },
// complete: function (xhr) {
// setTimeout(function () {
// $loader.hide()
// }, 100)
// }
// })
</script>
NodeJS Casino server:
const PORT = 5000;
var io = require('socket.io')(PORT),
redis = require('redis');
io.on('connection', function (socket) {
var redisClient = redis.createClient();
console.log('User connect!');
redisClient.subscribe('redis_channel1');
redisClient.on('message', function(channel, data) {
data = JSON.parse(data);
socket.emit('events', data);
});
socket.on('disconnect', function () {
redisClient.quit();
console.log('User disconnect');
})
});