/* _________________________________________________________________________________________________ pz.zapbutton _________________________________________________________________________________________________ */ jQuery.fn.zapbutton = function(oSettings) { return this.each( function() { if(oSettings==undefined) oSettings={}; var _this = jQuery(this); if(!_this.hasClass("pz-zapbutton-complete")) { var _dispatch; var _directConnect = oSettings._directConnect || false; var _keyholeConnect = oSettings._keyholeConnect || false; //random var _broadcastButton = oSettings._broadcastButton || false; var _screenheight = 450; //(screen.height * 0.75); var _screenwidth = 848; //(_screenheight * 16 / 9); var _externalID = undefined; if(_directConnect) { _externalID = _this.attr("id"); } _this.mouseenter(function(){ oLogic.currentZapButton = undefined; oLogic.currentBroadcastButton = undefined; if(_broadcastButton) { if(oLogic.broadcastwindow != null && oLogic.broadcastwindow.closed == false) { //default behaviour without dispatcher oLogic.openNewBroadcast = false; oLogic.currentBroadcastButton = _this; oLogic.currentBroadcastButton.css({'cursor' : 'pointer'}); oLogic.broadcastDetection = true; } else { _dispatch = getFlexApplicationReference("PZWEBDISPATCHERSWF"); _this.css({'cursor' : 'default'}); oLogic.broadcastDetection = false; oLogic.clientDetectionWrongBrowser = false; if(_dispatch != undefined && (typeof _dispatch.dispatchJSToClientSite == 'function')) { oLogic.currentBroadcastButton = _this; _dispatch.dispatchJSToClientSite("isClientThere" + navigator.userAgent); } } } else { if(oLogic.clientwindow != null && oLogic.clientwindow.closed == false) { //default behaviour without dispatcher oLogic.openNewClient = false; oLogic.currentZapButton = _this; oLogic.currentZapButton.children('img:first').attr("src", oLogic.currentZapButton.children('img:first').attr("src").replace('_up.gif', '_over.gif')); oLogic.currentZapButton.css({'cursor' : 'pointer'}); oLogic.clientDetection = true; } else { _dispatch = getFlexApplicationReference("PZWEBDISPATCHERSWF"); _this.css({'cursor' : 'default'}); oLogic.clientDetection = false; oLogic.clientDetectionWrongBrowser = false; if(_dispatch != undefined && (typeof _dispatch.dispatchJSToClientSite == 'function')) { oLogic.currentZapButton = _this; _dispatch.dispatchJSToClientSite("isClientThere" + navigator.userAgent); } } } }); _this.mouseleave(function(){ if(_broadcastButton) { oLogic.currentBroadcastButton = undefined; oLogic.broadcastDetection = false; oLogic.clientDetectionWrongBrowser = false; } else { oLogic.currentZapButton = undefined; oLogic.clientDetection = false; oLogic.clientDetectionWrongBrowser = false; _this.children('img:first').attr("src", _this.children('img:first').attr("src").replace('_over.gif','_up.gif')); } }); _this.click(function() { if(_broadcastButton && oLogic.broadcastDetection) { if(oLogic.openNewBroadcast) { oLogic.broadcastwindow = window.open("http://www.peoplezapping.com/indexBroadcast.php", "pzBroadcastPopUp", "resizable=no, width=" + _screenwidth + ", height=" + _screenheight + ", left=5, top=5, scrollbars=no"); oLogic.openNewBroadcast = false; oLogic.broadcastDetection = false; } else { oLogic.broadcastwindow = window.open("javascript:nothing()", "pzBroadcastPopUp"); } oLogic.broadcastwindow.focus(); } else if(oLogic.clientDetectionWrongBrowser) { //showModalAlert("Du hast unsere Broadcast Applikation in einem anderen Browser geöffnet! Bitte benutze diesen.. oder schließe die Applikation, um unsere Applikation mit Deinem \"Lieblings\"- Browser zu öffnen."); //TODO i18n alert("Du hast unsere Broadcast Applikation in einem anderen Browser geöffnet! Bitte benutze diesen.. oder schließe die Applikation, um unsere Applikation mit Deinem \"Lieblings\"- Browser zu öffnen."); //TODO i18n } else if(oLogic.clientDetection) { if(oLogic.openNewClient) { //alert("open new"); //_this.children('img').//.src = this.src.replace('_up.gif','_over.gif'); oLogic.clientwindow = window.open("http://www.peoplezapping.com/indexApp.php", "pzClientPopUp", "width=" + _screenwidth + ", height=" + _screenheight + ", left=5, top=5, scrollbars=no, resizable=yes"); } else { //alert("open old"); oLogic.clientwindow = window.open("javascript:nothing()", "pzClientPopUp"); } oLogic.clientwindow.focus(); /* * use this syntax if 'var = externalConID;' is not always set */ if(typeof externalConID != 'undefined') { _externalID = externalConID; _directConnect = true; } if(_directConnect && _externalID != undefined) { $.ajax({ url: 'http://www.peoplezapping.com/index.php?act=directConnect&placeid=' + _externalID + '&rid=1', type: 'GET', dataType: 'html', error: function(){ //; }, success: function(html){ //true / full / false; } }); } else if(_keyholeConnect) { $.ajax({ url: 'http://www.peoplezapping.com/index.php?act=directConnectKeyhole&rid=1', type: 'GET', dataType: 'html', error: function(){ //; }, success: function(html){ //true / full / false; } }); } } return false; }); //-- complete _this.addClass("pz-zapbutton-complete"); } } ) };