Plugin Directory

Changeset 2347271


Ignore:
Timestamp:
07/27/2020 03:13:19 PM (6 years ago)
Author:
oometrics
Message:
  • Fixed - RTL Support
  • Dev - cookie lifetime reduced to 20 minutes
Location:
oometrics/trunk
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • oometrics/trunk/assets/css/admin.css

    r2347103 r2347271  
    300300
    301301.oo-profile-info{position: relative;margin: 0;border-bottom: 1px solid rgba(0,0,0,0.05);padding: 11px 15px 12px 15px;}
    302 .oo-profile-info > i{ position: absolute;left: 15px;top:15px;width: 35px; border-radius: 50%;}
    303 .rtl .profile-info > i{right: 15px;left: auto;}
     302.oo-profile-info > i,.oo-profile-info > img{ position: absolute;left: 15px;top:15px;width: 35px; border-radius: 50%;}
     303.rtl .oo-profile-info > i,.rtl .oo-profile-info > img{right: 15px;left: auto;}
    304304.oo-profile-info .location .city{padding-left: 10px;display: inline-block;}
    305305
  • oometrics/trunk/assets/css/oometrics.css

    r2347103 r2347271  
    5858#oometrics-chat.opened.top-right .oo-chat-wrapper{transform: translateX(0);}
    5959
    60 .rtl #oometrics-chat{right:15px;bottom:15px;left:auto;}
     60/* .rtl #oometrics-chat{right:15px;bottom:15px;left:auto;} */
    6161#oometrics-chat li{line-height: inherit;}
    6262#oometrics-chat header{position: relative;}
     
    6767#oo-chat-trigger.top-right{right: 15px;bottom: calc( 100% - 70px );top: 15px;}
    6868#oo-chat-trigger.bottom-right{right: 15px;top: calc( 100% - 70px );bottom: 15px;}
    69 .rtl #oo-chat-trigger{left:auto;right:15px;}
     69/* .rtl #oo-chat-trigger{left:auto;right:15px;} */
    7070#oo-chat-trigger.opened.bottom-left{left: calc( 40vw - 70px ) !important;top: 2rem !important;}
    7171#oo-chat-trigger.opened.top-left{left: calc( 40vw - 70px ) !important;top: 2rem !important;}
    7272#oo-chat-trigger.opened.bottom-right{right: 15px !important;top: 2rem !important;left: auto !important;}
    7373#oo-chat-trigger.opened.top-right{right: 15px !important  ;top: 2rem !important;left: auto !important;}
    74 .rtl #oo-chat-trigger.opened{right:calc( 40vw + 15px );left:auto}
     74/* .rtl #oo-chat-trigger.opened{right:calc( 40vw + 15px );left:auto} */
    7575#oometrics-chat #oo-message-text{width: 100%;border: 0;box-shadow: inset 0 0 3px -1px rgba(0,0,0,0.4);border-radius: 4px;height: 80px;background: #ebeced;}
    7676#oo-send-message{position: absolute;left:14px;bottom: 12px;z-index: 100;border: 0;border-radius: 3px;padding: 0px 13px;font-size: 10px;background: #ebeced;color: #137daf;height: 25px;}
  • oometrics/trunk/assets/images/oometrics-dashicon.svg

    r2347103 r2347271  
    22<!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0)  -->
    33<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
    4      viewBox="8 0.9 100 100" style="enable-background:new 8 0.9 100 100;" xml:space="preserve">
    5 <path id="XMLID_14_" d="M78.8,32.3H39.3c-10.3,0-18.6,8.3-18.6,18.6v16.8c0,1,0.8,1.8,1.8,1.8h56.4c10.3,0,18.6-8.3,18.6-18.6l0,0
    6     C97.3,40.7,89.1,32.3,78.8,32.3z M77.8,35.4c8.4,0,15.3,6.9,15.3,15.3s-6.9,15.3-15.3,15.3s-15.3-6.8-15.3-15.3S69.3,35.4,77.8,35.4
    7     z M39.6,35.4c8.4,0,15.3,6.9,15.3,15.3S48,65.9,39.6,65.9s-15.3-6.8-15.3-15.3S31.1,35.4,39.6,35.4z M39.6,48.3
    8     c1.4,0,2.6,1.2,2.6,2.6s-1.2,2.6-2.6,2.6S37,52.2,37,50.8S38.1,48.3,39.6,48.3z M77.8,48.1c1.4,0,2.6,1.2,2.6,2.6s-1.2,2.6-2.6,2.6
    9     s-2.6-1.2-2.6-2.6S76.3,48.1,77.8,48.1z"/>
     4     viewBox="12.1 16.7 108.1 52.3" style="enable-background:new 12.1 16.7 108.1 52.3;" xml:space="preserve">
     5<style type="text/css">
     6    .st0{fill:#FFFFFF;}
     7</style>
     8<path id="XMLID_14_" class="st0" d="M86.1,24.1H46.6C36.3,24.1,28,32.4,28,42.7v16.8c0,1,0.8,1.8,1.8,1.8h56.4
     9    c10.3,0,18.6-8.3,18.6-18.6l0,0C104.7,32.5,96.4,24.1,86.1,24.1z M85.1,27.2c8.4,0,15.3,6.9,15.3,15.3s-6.9,15.3-15.3,15.3
     10    S69.8,51,69.8,42.5S76.6,27.2,85.1,27.2z M46.9,27.2c8.4,0,15.3,6.9,15.3,15.3s-6.9,15.3-15.3,15.3S31.6,51,31.6,42.5
     11    S38.4,27.2,46.9,27.2z M46.9,40.1c1.4,0,2.6,1.2,2.6,2.6s-1.2,2.6-2.6,2.6s-2.6-1.2-2.6-2.6S45.4,40.1,46.9,40.1z M85.1,39.9
     12    c1.4,0,2.6,1.2,2.6,2.6s-1.2,2.6-2.6,2.6s-2.6-1.2-2.6-2.6S83.6,39.9,85.1,39.9z"/>
    1013</svg>
  • oometrics/trunk/assets/js/admin-chats.js

    r2347103 r2347271  
    258258    $(this).remove();
    259259  });
    260 
    261   // chat_interval = setInterval(function(){
    262   //       chat_update();
    263   // }, 5000);
    264   //frontend - end
    265 
    266 
    267 
    268260} );
  • oometrics/trunk/assets/js/admin.js

    r2347103 r2347271  
    1919function oo_set_cookie(cname, cvalue, exdays) {
    2020  var d = new Date();
    21   d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000));
     21  d.setTime(d.getTime() + (exdays * 60 * 1000));
    2222  var expires = "expires="+d.toUTCString();
    2323  document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/";
     
    6666})();
    6767
    68 // function session_update()
    69 // {
    70 //   jQuery.ajax({
    71 //     url: oometrics.ajaxurl,
    72 //     type:'post',
    73 //     data:{
    74 //       action:'oo_update_session',
    75 //       session : session,
    76 //       _wpnonce: oometrics._nonce
    77 //     }
    78 //   });
    79 // }
    80 
    81 // check for tab change
    82 // active_tab(function(){
    83 // if(active_tab())
    84 // {
    85 //   if (!interval)
    86 //   {
    87 //     interval = setInterval(function(){
    88 //           session_update();
    89 //           //chat_update();
    90 //     }, oometrics.interval);
    91 //   }
    92 // }
    93 // else
    94 // {
    95 //   clearInterval(interval);
    96 //   interval = 0;
    97 // }
    98 // });
    99 
    100 // check for window change
    101 // jQuery(window).focus(function(){
    102 //   if (!interval)
    103 //   {
    104 //     interval = setInterval(function(){
    105 //           session_update();
    106 //           //chat_update();
    107 //     }, oometrics.interval);
    108 //   }
    109 // });
    110 // jQuery(window).blur(function(){
    111 //   clearInterval(interval);
    112 //   interval = 0;
    113 // });
    114 
    11568function oo_create_session(){
    11669  jQuery.ajax({
     
    12477      if(typeof data.id !== 'undefined' && (data.id != 0 || data.id != '')){
    12578        session = data;
    126         oo_set_cookie('oometrics_admin_session',JSON.stringify(data),2);
     79        oo_set_cookie('oometrics_admin_session',JSON.stringify(data),20);
    12780        session_update();
    12881      }
     
    14295    }
    14396  }
    144   // // update admin_session
    145   // jQuery.ajax({
    146   //   url: oometrics.ajaxurl,
    147   //   type:'post',
    148   //   data:{
    149   //     action:'admin_update_session',
    150   //     session : session,
    151   //     _wpnonce: oometrics._nonce
    152   //   }
    153   // });
    15497
    15598}
    15699function chat_update()
    157100{
    158   // var if_sessions = jQuery('.oo-chat-list .oo-session-profile').length;
    159101  if(oo_rel_id != -1){
    160102    chat_xhr = jQuery.ajax({
     
    186128          session.last_updated = data.last_updated;
    187129          jQuery('.tmp-bubble').remove();
    188           // var v = jQuery('.oo-chat-list').height();
    189           // jQuery('.oo-chat-conversations').scrollTop(v);
    190130          chat_s_height = jQuery('.oo-chat-list').height();
    191131          chat_height = jQuery('.oo-chat-conversations').height();
     
    231171                }
    232172              });
    233          
     173
    234174          });
    235175        }
    236         // if(new_count > current_count){
    237         //   jQuery('.oo-dashboard-left-left-body').append('<button id="go-to-new"></button>');
    238         // }
    239176      }
    240177    });
     
    243180
    244181
    245   // wait for 3 seconds to start
    246182  function get_sessions()
    247183  {
     
    413349      jQuery('.oo-cart-changed-badge').html('').hide();
    414350    }
    415     // if(cart_html != ''){
    416     //   var current_items_count = oometrics_cart_content;
    417     //   var current_items_count_keys = '';
    418     //   var customer_items_count = (jQuery.parseHTML(cart_html));
    419     //   var customer_items_count_keys = '';
    420     //   jQuery(current_items_count).each(function(i,v){
    421     //     current_items_count_keys += jQuery(this).attr('data-key') +':'+jQuery(this).attr('data-qty');
    422     //   });
    423     //
    424     //   jQuery(customer_items_count).each(function(i,v){
    425     //     customer_items_count_keys += jQuery(this).attr('data-key')+':'+jQuery(this).attr('data-qty');
    426     //   });
    427     //
    428     //   if(current_items_count_keys == customer_items_count_keys){
    429     //     jQuery('.oo-cart-overlay').addClass('lock loading');
    430     //     oometrics_cart_active = false;
    431     //     // session_update();
    432     //     get_session(current_ses_id);
    433     //     jQuery('.oo-cart-changed-badge').html('');
    434     //     jQuery('.oo-cart-overlay').removeClass('lock loading');
    435     //   } else {
    436     //     jQuery('.oo-cart-changed-badge').html('Changed!');
    437     //     jQuery('.oo-cart-overlay').addClass('lock loading');
    438     //     jQuery('.oo-cart-overlay').removeClass('lock loading');
    439     //     oometrics_cart_active = true;
    440     //   }
    441     // }
    442351    jQuery('.oo-purchased-items').html(data.cart.purchased_items);
    443352    jQuery('.oo-purchased-total').html(data.cart.purchased_total);
    444353
    445354
    446     // jQuery('.oo-tab-content').html(info_html);
     355
    447356    if(!chat_interval){
    448357      jQuery('.oo-chat-list').html(chat_html);
    449       // oo_on_rel = true;
    450       // jQuery('.oo-chat-conversations').scrollTop(jQuery('.oo-chat-list').height());
    451358    }
    452359    if(oo_get_cookie('oo_tracking_consent') == 'disagreed'){
     
    1073980    var ses_id = t.attr('data-sesid');
    1074981    oo_rel_id = -1;
    1075     // if(typeof chat_xhr !== 'undefined') chat_xhr.abort();
    1076     // if(typeof session_xhr !== 'undefined')  session_xhr.abort();
    1077     // clearInterval(interval);
    1078     // $('.oo-dashboard-reply').addClass('block');
    1079982    get_session(ses_id);
    1080983    jQuery('.oo-tab').removeClass('active');
  • oometrics/trunk/assets/js/chats.js

    r2347103 r2347271  
    3434function chat_update(force = false)
    3535{
    36   // if(oo_rel_id != -1 || !force){
    3736  if(oo_rel_id != -1 || force){
    3837    chat_xhr = jQuery.ajax({
     
    6564          session.last_updated = data.last_updated;
    6665          jQuery('.tmp-bubble').remove();
    67           // var v = jQuery('.oo-chat-list').height();
    68           // jQuery('.oo-chat-conversations').scrollTop(v);
    69 
    7066        }
    7167
     
    7571        jQuery('.oo-chat-list').append(data.chats);
    7672
    77         // if(new_count > current_count){
    78           // jQuery('.oo-chat-conversations').append('<button id="go-to-new"></button>');
    7973          if(jQuery('.oo-chat-conversations').length>0){
    8074            chat_s_height = jQuery('.oo-chat-list').height();
    8175            chat_height = jQuery('.oo-chat-conversations').height();
    8276          }
    83         // }
    84         // console.log(chat_s_height);
    85         // console.log(chat_height);
     77
    8678        if((chat_s_height <= chat_height) || (jQuery('.oo-chat-conversations').scrollTop() > chat_s_height - chat_height) && jQuery('#oometrics-chat').hasClass('opened')){
    8779          jQuery('.oo-chat-conversations .oo-chat-list li:not(.seen):not(.oo-two):not(.oo-session-profile)').each(function(i,v){
     
    170162  $(document).delegate('#oo-chat-trigger','click',function(e){
    171163    e.preventDefault();
    172     // var keep_open = false;
    173     // if($(this).hasClass('opened')){
    174     //   if($(this).find('.oo-new-chat-badge:not(.off)').length > 0){
    175     //     console.log('yes');
    176     //     keep_open = true;
    177     //     oo_rel_id = session.rel_id;
    178     //     session.last_updated = 0;
    179     //     // if(!chat_interval){
    180     //     clearInterval(chat_interval);
    181     //       chat_interval = setInterval(function(){
    182     //             chat_update();
    183     //       }, oometrics.chat_interval);
    184     //     // }
    185     //   } else {
    186     //     console.log('no');
    187     //   }
    188     //   console.log('both');
    189     // }
    190     // if(!keep_open){
    191     //   $(this).toggleClass('opened');
    192     //   $('#oometrics-chat').toggleClass('opened');
    193     // }
    194164    $(this).toggleClass('opened');
    195165    $('#oometrics-chat').toggleClass('opened');
     
    233203          t.removeAttr('data-chatid');
    234204          $('.oo-chat-list li[data-chatid="'+chat_id+'"]').html($(data.bubble).html());
    235           // $('.oo-chat-conversations').scrollTop(jQuery('.oo-chat-list').height());
    236205        }
    237206      });
     
    261230          oo_rel_id = session.rel_id;
    262231          if(!chat_interval){
    263             // clearInterval(chat_interval);
    264232            chat_interval = setInterval(function(){
    265233                  chat_update();
     
    301269    console.log(chat_interval);
    302270
    303     // $('#oo_chat_rel_id').val(oo_rel_id);
    304271    jQuery.ajax({
    305272      url: oometrics.ajaxurl,
     
    340307    e.preventDefault();
    341308    var t = $(this);
    342     // oo_rel_id = t.attr('data-relid');
    343309    clearInterval(chat_interval);
    344310    chat_interval = 0;
    345     // $('.oo-chat-list').html('');
    346311    jQuery.ajax({
    347312      url: oometrics.ajaxurl,
     
    363328      }
    364329    });
    365     // chat_update(true);
    366     // chat_interval = setInterval(function(){
    367     //       chat_update();
    368     // }, oometrics.chat_interval);
    369330    t.remove();
    370331  });
     
    474435  });
    475436
    476   // chat_interval = setInterval(function(){
    477   //       chat_update();
    478   // }, 5000);
    479   //frontend - end
    480 
    481 
    482 
    483437} );
  • oometrics/trunk/assets/js/oometrics.js

    r2347103 r2347271  
    1 // var session = {};
    21var session = {'id':0,'screen':'','rel_id':-1,'admin_ses_id':0,'last_updated':0};
    32var interval = 0;
    4 // var chat_interval = 0;
    53var chat_badge = '';
    64var session_xhr;
     
    86function oo_set_cookie(cname, cvalue, exdays) {
    97  var d = new Date();
    10   d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000));
     8  d.setTime(d.getTime() + (exdays * 60 * 1000));
    119  var expires = "expires="+d.toUTCString();
    1210  document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/";
     
    5452function oo_session_update()
    5553{
    56   // console.log(session);
     54
    5755  session_xhr = jQuery.ajax({
    5856    url: oometrics.ajaxurl,
     
    6462    },
    6563    beforeSend:function(){
    66       // if(session.rel_id != -1){
    67       //   oo_rel_id = session.rel_id;
    68       // }
    6964      if(session_xhr != null) {
    7065          session_xhr.abort();
     
    9691          }, oometrics.chat_interval);
    9792        }
    98         // chat_update();
    99         // session.last_updated = data.last_updated;
    10093
    10194      } else{
     
    121114  });
    122115}
    123 
    124 // // check for tab change
    125 // active_tab(function(){
    126 // if(active_tab())
    127 // {
    128 //   if (!interval)
    129 //   {
    130 //     interval = setInterval(function(){
    131 //           oo_session_update();
    132 //     }, oometrics.session_interval);
    133 //   }
    134 //   if (!chat_interval)
    135 //   {
    136 //     chat_interval = setInterval(function(){
    137 //           chat_update();
    138 //     }, oometrics.chat_interval);
    139 //   }
    140 // }
    141 // else
    142 // {
    143 //   clearInterval(interval);
    144 //   clearInterval(chat_interval);
    145 //   interval = 0;
    146 //   chat_interval = 0;
    147 // }
    148 // });
    149 
    150 // check for window change
    151 // jQuery(window).focus(function(){
    152 //   if (!interval)
    153 //   {
    154 //     interval = setInterval(function(){
    155 //           oo_session_update();
    156 //     }, oometrics.session_interval);
    157 //   }
    158 //   if (!chat_interval)
    159 //   {
    160 //     chat_interval = setInterval(function(){
    161 //           chat_update();
    162 //     }, oometrics.chat_interval);
    163 //   }
    164 // });
    165 // jQuery(window).blur(function(){
    166 //   clearInterval(interval);
    167 //   interval = 0;
    168 //   clearInterval(chat_interval);
    169 //   chat_interval = 0;
    170 // });
    171116
    172117function oo_create_session(){
     
    183128      if(typeof data.id !== 'undefined' && (data.id != 0 || data.id != '')){
    184129        session = data;
    185         oo_set_cookie('oometrics_session',JSON.stringify(data),2);
     130        oo_set_cookie('oometrics_session',JSON.stringify(data),20);
    186131        oo_session_update();
    187132      }
     
    205150    oo_create_session();
    206151  }
    207   // session.rel_id = $('#oo_chat_rel_id').val();
    208   // session.admin_ses_id = $('#oo_admin_ses_id').val();
    209   //
     152
    210153var current_chat_id_attachment = 0;
    211154  $(document).delegate('.oo-upload-media','click', function( event ) {
     
    217160
    218161  $(document).delegate('#oo-chat-upload','change', function( event ) {
    219     // var t = $(this);
    220     // var chat_id = t.attr('data-chatid');
     162
    221163    var chat_id = current_chat_id_attachment;
    222164    var input_id = $('#oo-chat-upload')[0];
    223165    var data = new FormData();
    224166    var file = event.target.files;
    225         // var parent = $("#" + event.target.id).parent();
     167
    226168        $.each(file, function(key, value)
    227169            {
     
    258200  });
    259201
    260   // session.id = $('#oo_ses_id').val();
    261   // wait for 3 seconds to start
    262 
    263202    // run interval
    264203    if (!interval)
     
    290229      };
    291230    });
    292   // $(document).delegate('#oo-popup-wrapper .oo-overlay','click',function(){
    293   //   $('#oo-popup-wrapper').removeClass('show');
    294   // });
    295231
    296232  $(document).delegate('#oo-popup-wrapper .oo-inner a,#oo-popup-wrapper .oo-inner button','click',function(){
     
    307243
    308244  });
    309 
    310   // $(document).delegate('#oo-chat-trigger .oo-new-chat-badge:not(.off)','click',function(){
    311   //   oo_rel_id = session.rel_id;
    312   //   if(!chat_interval){
    313   //     chat_interval = setInterval(function(){
    314   //           chat_update();
    315   //     }, oometrics.chat_interval);
    316   //   }
    317   // });
    318 
    319245} );
  • oometrics/trunk/inc/oometrics-class.php

    r2347103 r2347271  
    319319            'oometrics',
    320320            array($this, 'dashboard_layout'),
    321             OOMETRICS_URL.'/assets/images/oometrics-dashicon.svg',
     321            OOMETRICS_URL.'/assets/images/oometrics-dashicon.svg?v='.OOMETRICS_PLUGIN_VERSION,
    322322            2
    323323        );
     
    328328            'manage_options',
    329329            'oometrics-reports',
    330             array($this, 'reports_layout'),
    331             'dashicons-analytics'
     330            array($this, 'reports_layout')
    332331        );
    333332        add_submenu_page(
     
    337336            'manage_options',
    338337            'oometrics-settings',
    339             array($this, 'settings_layout'),
    340             'dashicons-analytics'
     338            array($this, 'settings_layout')
    341339        );
    342340        // add_submenu_page(
  • oometrics/trunk/inc/session-class.php

    r2347103 r2347271  
    5656
    5757    public function get($session = 0){
    58 
    5958
    6059
     
    547546                $oo_session_value_content['key_hash'] = $woo_session_id;
    548547                $session_value = $this->get_woo_session_value($woo_session_id);
    549                 $session_value_content = unserialize($session_value->session_value);
    550                 if(!empty($session_value_content))
    551                 {
    552                     $oo_session_value_content['session'] = $session_value_content;
    553                 } else {
    554                     $oo_session_value_content['session'] = '0:{}';
     548                if(isset($session_value->session_value) && !empty($session_value->session_value) && !empty(unserialize($session_value->session_value)   )){
     549                    $session_value_content = unserialize($session_value->session_value);
     550                    if(!empty($session_value_content))
     551                    {
     552                        $oo_session_value_content['session'] = $session_value_content;
     553                    } else {
     554                        $oo_session_value_content['session'] = '0:{}';
     555                    }
     556                    $oo_cart_ses = serialize($oo_session_value_content);
    555557                }
    556                 $oo_cart_ses = serialize($oo_session_value_content);
     558
    557559            }
    558560
  • oometrics/trunk/oometrics.php

    r2347222 r2347271  
    2121
    2222if(!defined('OOMETRICS_PLUGIN_VERSION'))
    23     define('OOMETRICS_PLUGIN_VERSION', '1.1.0');
     23    define('OOMETRICS_PLUGIN_VERSION', '1.1.1');
    2424if(!defined('OOMETRICS_URL'))
    2525    define('OOMETRICS_URL', plugin_dir_url( __FILE__ ));
     
    152152        ) $charset_collate;
    153153        ";
    154         // update_option('oodebug',$sql);
    155 
    156 
    157     // $wpdb->query($sql);
     154
    158155        dbDelta($sql);
    159156
     
    179176            );
    180177            $wpdb->insert($session_table_name,$admin_session_data);
    181             // $wpdb->get_var(
    182             //  $wpdb->prepare("INSERT INTO $session_table_name
    183             //  (ses_id,ses_hash,ses_uid,ses_value,ses_expired,ses_last_act,ses_date)
    184             //  VALUES (NULL,%s,%d,%s,%s,%d,%d)",
    185             //  array('MainUser',get_current_user_id(),1,0,time(),time()))
    186             // );
    187178        }
    188         // add_option('oometrics_debug_table','created');
    189179    }
    190180
Note: See TracChangeset for help on using the changeset viewer.