Plugin Directory

Changeset 2281782


Ignore:
Timestamp:
04/12/2020 09:00:23 AM (6 years ago)
Author:
rahulbhangale
Message:

Allow front end users to use wp assistance.

Location:
wp-assistance
Files:
8 added
4 edited

Legend:

Unmodified
Added
Removed
  • wp-assistance/trunk/css/wp-assistance-main.css

    r2280676 r2281782  
    6262  }
    6363}
     64
     65#fe-wpa-id {
     66    width: 350px;
     67    height: 160px;
     68    padding: 20px;
     69    position:fixed;
     70    bottom:10px;
     71    right: 10px;
     72}
     73
     74#fe-wpa-id .fe-wpa-mic {
     75    width: 50px;
     76    height: 50px;
     77    font-size: 50px;
     78}
     79
     80#fe-wpa-text {
     81
     82    width: 180px;
     83    float: left;
     84    border-radius: 33px;
     85    height: 95px;
     86    float: left;
     87}
     88
     89
     90#speech.btn {
     91    float:right;
     92    border: none;
     93  padding: 0;
     94  border-radius: 100%;
     95  width: 100px;
     96  height: 100px;
     97  font-size: 1.5em;
     98  color: #fff;
     99  padding: 0;
     100  margin: 0;
     101  background: #FF3D7F;
     102    position: relative;
     103  display: inline-block;
     104    line-height: 50px;
     105    text-align: center;
     106    white-space: nowrap;
     107    vertical-align: middle;
     108    -ms-touch-action: manipulation;
     109    touch-action: manipulation;
     110    cursor: pointer;
     111    -webkit-user-select: none;
     112    -moz-user-select: none;
     113    -ms-user-select: none;
     114    user-select: none;
     115    background-image: none;
     116}
     117
     118.pulse-ring {
     119      content: '';
     120  width: 100px;
     121  height: 100px;
     122  border: 5px solid #FF3D7F;
     123  border-radius: 50%;
     124  position: absolute;
     125  top: -5px;
     126  left: -5px;
     127  animation: pulsate infinite 2s;
     128}
     129
     130
     131#fe-wpa-id .pulse-ring  {
     132    top: 0px;
     133    left: 0px;
     134
     135
     136@-webkit-keyframes pulsate {
     137  0% {
     138    -webkit-transform: scale(1, 1);
     139    opacity: 1;
     140  }
     141  100% {
     142    -webkit-transform: scale(1.2, 1.2);
     143    opacity: 0;
     144  }
     145}
  • wp-assistance/trunk/index.php

    r2281497 r2281782  
    1111
    1212define( 'WP_ASISTANCE_URL', plugins_url( '/', __FILE__ ) );
     13define( 'WP_ASISTANCE_PATH', plugin_dir_path( __FILE__ ) );
    1314
    1415function WpAssistanceMicIcon( \WP_Admin_Bar $bar ) {
     
    4546    wp_enqueue_style('dashicons');
    4647    wp_enqueue_script('wp-assistance-essential');
    47 
    4848}
    4949
     50add_action( 'wp_enqueue_scripts', function() {
     51    wp_enqueue_style( 'dashicons' );
     52} );
     53
     54function loadWpAssistance() {
     55    $objSettings = get_option( 'WP_ASSISTANCE_SETTINGS' );
     56
     57    if( true == $objSettings->is_front_end_enable )
     58        echo '<div class="fe-wpa" id="fe-wpa-id"></div><script> var search_url = \'' . home_url() . '\'</script>';
     59}
     60
     61wp_enqueue_script( 'jquery' );
    5062wp_enqueue_script('wp-assistance-essential', WP_ASISTANCE_URL . 'js/wp-assistance-essential.js' );
    5163wp_enqueue_style( 'wp-assistance-main', WP_ASISTANCE_URL . 'css/wp-assistance-main.css' );
     
    5365add_action('wp_enqueue_scripts', 'WpAssistanceDashIcons');
    5466
     67add_action( 'wp_footer', 'loadWpAssistance' );
     68
     69if( true == is_admin() ) {
     70    include_once( WP_ASISTANCE_PATH . 'admin/CWAAdmin.class.php');
     71}
     72
    5573?>
  • wp-assistance/trunk/js/wp-assistance-essential.js

    r2280676 r2281782  
    5353    if ( interim_transcript) {
    5454        jQuery('#wp-assistance-text').text( interim_transcript )
     55            if( jQuery('#fe-wpa-text').length > 0 ) {
     56                jQuery('#fe-wpa-text').val( interim_transcript );
     57            }
    5558    }
    5659    if ( final_transcript) {
    5760        jQuery('#wp-assistance-text').text( final_transcript )
     61        if( jQuery('#fe-wpa-text').length > 0 ) {
     62            jQuery('#fe-wpa-text').val( final_transcript );
     63        }
    5864    }
    5965  };
     
    9197});
    9298
     99jQuery(function() {
     100   
     101    if ( !('webkitSpeechRecognition' in window) ) {
     102        return false;
     103    }
     104   
     105    if( jQuery('#fe-wpa-id').length <= 0 ) {
     106        return false;
     107    }
     108   
     109    jQuery('#fe-wpa-id').html( '<form id="fe-wpa-search" action="' + search_url + '"><input id="fe-wpa-text" type="text" name="s" value="" placeholder="Search" style="display: none" /> <button id="speech" class="btn"><span class="dashicons dashicons-microphone fe-wpa-mic"></span><div class="pulse-ring" style="display:none;"></div></form>' );
     110   
     111    jQuery('#fe-wpa-id').click( function( e ) {
     112        e.preventDefault();
     113        if( true == jQuery( '.fe-wpa-mic ').hasClass( 'dashicons-microphone' ) ) {
     114            jQuery( '#fe-wpa-id .pulse-ring').show();
     115            jQuery( '#fe-wpa-text' ).show();
     116            jQuery( '.fe-wpa-mic' ).removeClass( 'dashicons-microphone' );
     117            jQuery( '.fe-wpa-mic' ).addClass( 'dashicons-search' );
     118            recognition.start();
     119   
     120        } else {
     121            jQuery( '#fe-wpa-id .pulse-ring').hide();
     122            jQuery( '#fe-wpa-text' ).hide();
     123            jQuery( '.fe-wpa-mic' ).addClass( 'dashicons-microphone' );
     124            jQuery( '.fe-wpa-mic' ).removeClass( 'dashicons-search' );
     125            jQuery( '#fe-wpa-search').submit();
     126            recognition.stop();
     127        }
     128    });
     129});
     130
  • wp-assistance/trunk/readme.txt

    r2281497 r2281782  
    1818Improve your speed of typing posts and pages by using your voice or speech. The plugin is usefull for you to automatically type into your WordPress using your voice.
    1919
     20Do you want to give a voice based user interface for your customer or users. then just configure the plugin and your users can search through your website using this plugin.
     21
    2022Releases:
    21 0.0.2 - PHP 5.6 and 7.4 compatibility.
     230.0.3 - Allow users to configure front end search.
     240.0.2 - PHP 5.6 or greater version compatibility.
    22250.0.1 - Allow wordpress user to convert speech into text by talking with wordpress.
     26
     27Upcomming features:
     281. A bot which talks with users.
     292. A customizable commands.
    2330
    2431== Installation ==
Note: See TracChangeset for help on using the changeset viewer.