Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*--------- BUTTON EVENT ------------*/
- var dial_button = ['.icon-mute', '.i-acw', '.i-pause', '.i-hold', '.i-trans', '.i-hangup', '.i-hangout'];
- var txtInput = $('#i-dial-number');
- // click on digit number
- $('.i-btn-digit').click(function() {
- //!-- prevent add number whene use ENTER , after numpad opened
- $(document.body).keydown(function(e) {
- if (e.keyCode == 13) {
- return false;
- }
- });
- txtInput.val((txtInput.val()) + "" + $(this).text());
- });
- //-------------------------------------------
- /**
- * A Call handle function
- * @className i-hangout: start to call
- * @className i-hangup: stop ti call
- */
- $('.i-hangout').click(function() {
- ActiveCall = Zoiper.Dial($('#i-dial-number').val());
- });
- $('.i-hangup').click(function() {
- if (ActiveCall.IsHold == "true") {
- ActiveCall.UnHold();
- $('.i-hold').removeClass('i-btn_active');
- }
- if (Zoiper.MuteMicrophone == "true") {
- Zoiper.MuteMicrophone = "false";
- $('.icon-mute').removeClass('i-btn_active');
- }
- Zoiper.Hang();
- ActiveCall = null;
- txtInput.val("");
- });
- //!-- Use ENTER key to call
- $(document.body).keydown(function(e) {
- if (e.keyCode == 13) {
- ActiveCall = Zoiper.Dial($('#i-dial-number').val());
- }
- });
- //-------------------------------------------
- /**
- * A Incomming call handle function
- * @className i-accept: accept incomming call
- * @className i-denied: reject incomming call
- */
- $('.i-accept').click(function() {
- ActiveCall.Accept();
- popup.close();
- $('.i-popup-content p').remove();
- });
- $('.i-denied ').click(function() {
- ActiveCall.Reject();
- popup.close();
- $('.i-popup-content p').remove();
- });
- //-------------------------------------------
- /**
- * A Hold handle function
- * @className i-hold: to hold call
- */
- $('.i-hold').click(function() {
- hold_btn($(this));
- });
- //-------------------------------------------
- /**
- * A Mute
- * @className icon-mute: to mute microphone
- */
- $('.icon-mute').click(function() {
- if (Zoiper.MuteMicrophone == "true") {
- Zoiper.MuteMicrophone = "false";
- $(this).removeClass('i-btn_active');
- } else {
- Zoiper.MuteMicrophone = "true";
- $(this).addClass('i-btn_active');
- }
- });
- //-------------------------------------------
- /**
- * A Transfer
- * @className i-trans: to transfer call
- */
- $('.i-trans').click(function() {
- ActiveCall.Transfer(1001998);
- console.log(ActiveCall.IsTransferring);
- });
- //-------------------------------------------
- /**
- * A Keyborad
- * Ues to open numpad windows
- */
- $('span.i-keyboard').click(function() {
- numpad.center().open();
- });
- $('.i-cog-setting').click(function() {
- open_setting();
- });
- //-------------------------------------------
- /**
- * A disable/enable button
- * @param {booble} b is true/false
- */
- function diable_enable_btn(b) {
- $(".icon-mute, .i-acw, .i-pause, .i-hold, .i-trans , .i-hangup").kendoButton().data("kendoButton");
- //!-- disable
- if (b === false) {
- $(dial_button[6]).kendoButton().data("kendoButton").enable(false);
- $('.i-dial-pad button').each(function(index) {
- if (index === 6) {
- return false;
- }
- $(dial_button[index]).kendoButton().data("kendoButton").enable(true);
- });
- //!-- enable
- } else {
- $(dial_button[6]).kendoButton().data("kendoButton").enable(true);
- $('.i-dial-pad button').each(function(index) {
- if (index === 6) {
- return false;
- }
- $(dial_button[index]).kendoButton().data("kendoButton").enable(false);
- });
- }
- }
- /**
- * A Open tab
- * Use to open new tab on call incomming
- * @param {Actviecall} call
- * @param {String} seachParam use to store phone number
- * @param {Date} today
- */
- function open_new_tab(call, seachParam, today) {
- tabStrip.append({
- text: call.Phone + ' - Time: ' + today.toLocaleTimeString(),
- content: '<iframe class ="i-sugar-crm" scrolling="auto" src=\"' + seachParam + '\" onload=\'javascript:resizeIframe(this);\'></iframe>'
- });
- var li = $('#i-tab ul li .k-link').last();
- li.append('<span role="presentation" class="k-icon k-i-close close-tab-icon" onclick=\'tabStrip.remove($(this).closest(\"li\"))\'>close</span>');
- }
- /**
- * A Popup windows
- * Here is popup windows when call incomming
- *
- * @param {Zoiper} call: zoiper object ActiveCall
- * @param {time} today: data time today
- */
- var popup;
- var setting;
- function open_popup(call, today) {
- popup = $(".i-popup").kendoWindow({
- width: "400px",
- height: "150px",
- modal: true,
- title: 'Incomming form: ' + call + ' - Time: ' + today,
- visible: false,
- resizable: false,
- actions: [
- ],
- animation: {
- close: {
- effects: "fade:out"
- }
- }
- }).data("kendoWindow");
- // open popup and center position on screen
- $('.i-popup-content').append('<p>Incomming call form: ' + call + '</p>');
- popup.center().open();
- }
- function open_setting() {
- setting = $(".i-setting").kendoWindow({
- width: "800px",
- height: "550px",
- modal: true,
- title: '',
- visible: true,
- resizable: false,
- actions: [
- 'Close'
- ],
- animation: {
- open: {
- effects: "fade:in"
- },
- close: {
- effects: "fade:out"
- }
- }
- }).data("kendoWindow");
- $('.k-window-title').html('<i class="fa fa-wrench"></i> Setting');
- setting.center().open();
- }
- function hold_btn(obj) {
- if (ActiveCall.IsHold == "true") {
- ActiveCall.UnHold();
- $(obj).removeClass('i-btn_active');
- } else {
- ActiveCall.Hold();
- $(obj).addClass('i-btn_active');
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement