$(document).ready(function(){ Leopoly.WebSocket.init(); }); /** * ZSpace-hez valo kapcsolodashoz hasznalatos websocket kezelo object. */ Leopoly.WebSocket = { /* @var string ZSpace, Sprout. */ type: '', /* @var int Csatlakozashoz port. */ port: 40000, /* @var object Websocket object. */ wsObject: null, /* @var string Csatlakozashoz url. */ wsUrl: '', /** @var string Protokol. */ protocol: 'ws://', /** @var string Logo. */ logo: '', /** * Inicializalas. */ init: function () { //this.protocol = Leopoly.protocol === 'https://' ? 'wss://' : this.protocol; this.wsUrl = this.protocol + '127.0.0.1:' + this.port + '/' + this.type; this.create(); }, /** * Elkeszitjuk a websocket object-et. */ create: function () { this.wsObject = new WebSocket(Leopoly.WebSocket.wsUrl); this.wsObject.onerror = function(e){}; this.wsObject.onopen = function() { Leopoly.WebSocket.onConnectionSuccess(Leopoly.WebSocket.type); }; this.wsObject.onmessage = function(e) { //e.data }; this.wsObject.onclose = function() { //window.close(); console.log('Close window: ' + Leopoly.WebSocket.wsUrl); }; }, /** * Ha sikerul kapcsolodni a websocket-hez, akkor ezt a fuggvenyt hivjuk. * Megvaltoztatja az edit gomb mukodeset, hogy tudjunk kommunikalni a zspace app-al. */ onConnectionSuccess: function(type) { var className = 'openIn' + type; $('.editButton[data-is-cube-model!="true"]').each(function(i, v){ var id = $(this).data('modelid'); $(v).parent().parent().append( '