Plugin Directory

Changeset 2545236


Ignore:
Timestamp:
06/09/2021 06:22:21 PM (5 years ago)
Author:
liamtools
Message:

added dropdown option, new pictures

Location:
refyn-search
Files:
16 added
12 edited

Legend:

Unmodified
Added
Removed
  • refyn-search/trunk/assets/js/refyn-search.js

    r2541576 r2545236  
    55let ai_settings = settings["settings"]["ai"];
    66let css_trigger = settings["settings"]["trigger"];
     7let popup = settings["settings"]["popup"];
    78let wp_call = null; //admin-ajax.php ajax call
    89let refyn_call = null; //api.refyn.org ajax call
     10let input_focus = "#refyn-input";
     11let overlay = "#Refyn-Overlay";
     12
     13if (no_found == '')
     14    no_found = "Sorry, couldn't find anything.";
     15
     16if (popup == 0){
     17    css_trigger = "[type='search']";
     18    input_focus = css_trigger;
     19    overlay = "#Refyn-Dropdown";
     20}
    921
    1022(function($){
     
    1325
    1426        function new_results(results){
    15             if (results.length == 1 && results[0]["category"] == "Products") $("#refyn-form").attr("action",web_url + "/shop/");
     27            if (results.length == 1 && results[0]["category"] == "Products" && popup == 1) $("#refyn-form").attr("action",web_url + "/shop/");
    1628            results.forEach(function(result){
    1729                let htmlResult = '<div class="refyn-catagory panel panel-default border-bottom pb-3 pt-1">';
     
    5062       
    5163        try { $(".site-dialog-search").remove(); } catch (e) {} //remove old search from demo.refyn.org
    52 
     64       
    5365        $(css_trigger).on("click", function(){
    54             $("#Refyn-Overlay").slideDown("fast");
    55             $("#refyn-input").focus();
     66            $(overlay).slideDown("fast");
     67            if (popup == 0){
     68                $(overlay).detach().appendTo($(this).parent());
     69            } else {
     70                $(input_focus).focus();
     71            }
    5672        });
    5773       
    58         $("#blur").on("click", function(){ $("#Refyn-Overlay").slideUp("fast"); });
    59        
    60         $("#refyn-input").keyup( _.debounce(function(e){ //we use debounce just so we can wait for the user to finish typing
    61 
    62             $("#s").val($("#refyn-input").val()); //update hidden search value
    63             $("#refyn-form").attr("action",web_url);
     74        $(input_focus).on("focusout", function(){
     75            $("#refyn-results").empty();
     76            $(overlay).slideUp("fast");
     77        });
     78       
     79        $(input_focus).keyup( _.debounce(function(e){ //we use debounce just so we can wait for the user to finish typing
     80           
     81            if (popup == 1){
     82                $("#s").val($(input_focus).val()); //update hidden search value
     83                $("#refyn-form").attr("action",web_url);
     84            }
    6485           
    6586            if (e.keyCode == 27){ // Esc
    66                 $("#Refyn-Overlay").slideUp("fast");
     87                $("#refyn-results").empty();
     88                $(overlay).slideUp("fast");
    6789                return;
    6890            }
     
    7698            //must be [0-9 || a-z || A-Z] or backspace
    7799           
    78             if ( ($("#refyn-input").val().length >= 3) && (
     100            if ( ($(input_focus).val().length >= 3) && (
    79101                (e.keyCode>=48 && e.keyCode<=57) ||
    80102                (e.keyCode>=65 && e.keyCode<=90) ||
     
    92114                    show_loading();
    93115                },
    94                 data: { action : 'refyn_search', search : $("#refyn-input").val() },
     116                data: { action : 'refyn_search', search : $(input_focus).val() },
    95117                }).done(function(results){
    96118                   
     
    112134                            show_loading();
    113135                        },
    114                         data: { url : web_url, key : unlock, settings : ai_settings, q : $("#refyn-input").val() },
     136                        data: { url : web_url, key : unlock, settings : ai_settings, q : $(input_focus).val() },
    115137                        }).done(function(out){
    116138                           
     
    149171                                }).done(function(results){
    150172                                    if (!$("#refyn-results").is(':empty')) return;
     173                                   
    151174                                    if (results.length > 0) {
    152175                                        new_results(results);
     176                                    } else {
     177                                        //no results message
     178                                        $("#refyn-results").html(
     179                                            '<div class="refyn-catagory panel panel-default border-bottom pb-3 pt-1">' + add_row(add_catagory(no_found)) + '</div>'
     180                                        );
    153181                                    }
    154182                                }).fail(function(error){
     
    209237                            </div>\
    210238                            <div class="col product-info">\
    211                                 <span class="row">' + title + '</span>\
     239                                <span class="row font-weight-bold">' + title + '</span>\
    212240                                <span class="row pt-2 pb-2">' + display["content"] + '</span>\
    213241                                <span class="row text-primary">' + value +'</span>' + display["html"] +'\
  • refyn-search/trunk/includes/admin/class-refyn-search-settings.php

    r2541608 r2545236  
    109109                </tr>
    110110                <tr>
     111                    <th scope="row"><label for="use_popup">Display As A Pop-Up</label></th>
     112                    <td><input name="use_popup" type="checkbox" id="use_popup" value="1" <?php checked(get_option('use_popup')); ?>></td>
     113                </tr>
     114                <tr>
    111115                    <th scope="row"><label for="refyn_page">Install Refyn Page</label></th>
    112116                    <td><input name="refyn_page" type="checkbox" id="refyn_page" value="1" <?php checked(get_option('refyn_page')); ?>></td>
     
    212216                    <td>
    213217                        <input  <?php if (!$member) { echo "disabled = true"; } ?> name="use_scraping" type="checkbox" id="use_scraping" value="1" <?php if ($member) { checked(get_option('use_scraping')); } ?>>
    214                         <p>Enabling Google Scrap will allow the AI to find solutions from Google. <b> This feature is only unlocked for premium users only. </b></p>
     218                        <p>Enabling Google Scrap will allow the AI to find solutions from Google. <b> This feature is only unlocked for premire users only. </b></p>
    215219                    </td>
    216220                </tr>
  • refyn-search/trunk/includes/class-refyn-search.php

    r2541576 r2545236  
    7979                "trigger" => strval(get_option( 'trigger' )),
    8080                "no_found" => strval(get_option( 'no_found' )),
     81                "popup" => strval(get_option( 'use_popup' )),
    8182                "ai" => json_encode(array(
    8283                                "max"       => get_option( 'num_suggestions' ),
     
    105106        function load_footer() {
    106107            $home = esc_url( home_url( '/' ) );
    107             echo
    108                 '<div id="Refyn-Overlay" style="display:none">
    109                     <style>
    110                         .refyn-row:hover{
    111                             background-color: '.get_option('highlight_color').' !important;
    112                         }
    113                         .form-control,.bg-white{
    114                               background-color: '.get_option('background_color').' !important;
    115                         }
    116                         select.form-control:focus::-ms-value {
    117                           background-color: '.get_option('background_color').' !important;
    118                         }
    119                         .text-dark {
    120                           color: '.get_option('primary_color').' !important;
    121                         }
    122                         .text-primary {
    123                           color: '.get_option('second_color').' !important;
    124                         }
    125                     </style>
    126                     <div class="row justify-content-center align-items-middle">
    127                         <div id="Refyn-Search">
    128                             <form id="refyn-form" method="post" role="search" action="'.$home.'">
     108            $form = '<form id="refyn-form" method="post" role="search" action="'.$home.'">
    129109                                <div class="input-group" >
    130110                                    <div class="form-outline">
     
    134114                                    <input type="submit" style="display:none">
    135115                                </div>
    136                             </form>
     116                            </form>';
     117            $style = '';
     118            $blur = '<div id="blur"></div>';
     119            $overlay = 'Refyn-Overlay';
     120            if (get_option('use_popup')==0){
     121                $form='';
     122                $overlay = 'Refyn-Dropdown';
     123                $style='style="width:96%;margin-top:1%;position:relative;"';
     124                $blur='';
     125            }
     126            echo
     127                '<div id="'.$overlay.'" style="display:none">
     128                    <style>
     129                        .refyn-row:hover{
     130                            background-color: '.get_option('highlight_color').' !important;
     131                        }
     132                        .form-control,.bg-white{
     133                              background-color: '.get_option('background_color').' !important;
     134                        }
     135                        select.form-control:focus::-ms-value {
     136                          background-color: '.get_option('background_color').' !important;
     137                        }
     138                        .text-dark {
     139                          color: '.get_option('primary_color').' !important;
     140                        }
     141                        .text-primary {
     142                          color: '.get_option('second_color').' !important;
     143                        }
     144                    </style>
     145                    <div class="row justify-content-center align-items-middle">
     146                        <div id="Refyn-Search" '.$style.'>
     147                            '.$form.'
    137148                            <div class="panel panel-default border rounded mt-1">
    138149                                <div class="panel-body bg-white text-dark pt-2 pb-2">
     
    148159                        </div>
    149160                    </div>
    150                     <div id="blur"></div>
     161                    '.$blur.'
    151162                </div>';
    152163        }
     
    157168            register_setting('refyn_settings','trigger', array('default'=>"[type='search'], #example-id, .example-class"));
    158169            register_setting('refyn_settings','use_refyn', array('default'=>1));
     170            register_setting('refyn_settings','use_popup', array('default'=>1));
    159171            register_setting('refyn_settings','refyn_page', array('default'=>1));
    160172            register_setting('refyn_settings','page_title', array('default'=>'Refyn Search'));
  • refyn-search/trunk/readme.txt

    r2542066 r2545236  
    44Tags: Refyn Search, Refyn, Refyn Search, Live Search, e-commerce,  wordpress e-commerce
    55Requires at least: 4.1
    6 Tested up to: 5.7.2
    7 Stable tag: 2.0.0
     6Tested up to: 5.5
     7Stable tag: 2.1.0
    88License: GPLv3
    99License URI: https://www.gnu.org/licenses/gpl-3.0.html
     
    1414
    1515REFYN - New Artificial Intelligence (AI) algorithm that can search a site using only features. No keywords, no training, and no index are required! E.g. Query of "4x4" will fetch jeep and SUV even if "4x4" is not in DB at all. It will fetch all images with a certain shape, color, and so on without scanning pixels - Just by cognitively understanding that toilet paper has a shape of a cylinder.
     16
     17For a deme test, please visit https://demo.refyn.org !
    1618
    1719== Installation ==
     
    3335* Change Log - Please Visit https://refyn.org/changelog/
    3436
     37= 2.1.0 - 2021/06/09 =
     38
     39* Option to use the plugin as a popup or a dropdown list.
     40
    3541= 2.0.0 - 2021/06/02 =
    3642
    3743* The plugin was redesigned from scratch, plugin size decreased by 98%, and increased overall speed.
    3844
    39 * New Refyn SaaS page, login at dash.refyn.org
     45* New Refyn SaaS page, login at https://dash.refyn.org
    4046
    4147= 1.2.2 - 2020/08/05 =
  • refyn-search/trunk/refyn-search.php

    r2541602 r2545236  
    77 * Author:            REFYN
    88 * Author URI:        http://www.refyn.org
    9  * WP tested up to: 5.7.2
     9 * WP tested up to: 5.7
    1010 * Requires PHP: 7.1
    1111 * License: GPLv2 or later
  • refyn-search/trunk/uninstall.php

    r2541576 r2545236  
    22wp_delete_post( get_option('page_id'), true);
    33delete_option('page_id');
     4delete_option('use_popup');
    45delete_option('api_key');
    56delete_option('trigger');
Note: See TracChangeset for help on using the changeset viewer.