ninegitea/templates/Include/javascript.js.twig

54 lines
1.4 KiB
Twig

$(document).ready(function() {
$(".pick-a-color").spectrum(
{
type: "text",
showAlpha: false
}
);
$(".pick-a-color").attr("autocomplete","off");
var doit = true;
$("a[data-method]").on('click',function(){
if($(this).data('confirm')){
doit = confirm($(this).data('confirm'));
if(!doit) return false;
}
});
$("button[data-method]").on('click',function(){
if($(this).data('confirm')){
doit = confirm($(this).data('confirm'));
if(!doit) return false;
}
});
});
function ModalLoad(idmodal,title,path) {
$("#"+idmodal+" .modal-header h4").text(title);
$("#"+idmodal+" iframe").attr("src",path);
$("#"+idmodal).modal("show");
}
{% if wssuse %}
function subscribe(channeltype,channelkey,userkey) {
console.log("== SUBSCRIBE "+channeltype+"-"+channelkey+" with userkey "+userkey);
conn.send(JSON.stringify({
command: "subscribe",
log: "",
channel: channeltype+"-"+channelkey,
channeltype: channeltype,
channelkey: channelkey,
userkey: userkey
}));
}
function sendMessage(msg) {
json=JSON.stringify(msg);
console.log("== SEND MSG = "+json);
conn.send(json);
}
{% endif %}