Plugin Directory

Changeset 3055573


Ignore:
Timestamp:
03/20/2024 07:00:42 PM (2 years ago)
Author:
ShopSite
Message:

Bug fixes and Mac Support

Location:
shopsite-plugin/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • shopsite-plugin/trunk/search_products.js

    r3054878 r3055573  
    22jQuery(function ($) {
    33    function search_products(string, rems) {
    4         $('#search_results').html('<div id=please_wait>Loading products... please wait</div>');
     4        $('#search_results').html('<div id="please_wait">Loading products... please wait</div>');
    55        var data = 'ss_action=search_products&search_string=' + string + '&remember_search=' + rems;
    66        $.ajax({
     
    1515    }
    1616
    17     var ctrl = false;
    18     var shift = false;
     17    let ctrl = 0, shift = false, mac = navigator.platform.indexOf('Mac')===0;
    1918    $(document).keydown(function(event){
    20         if(event.which=='17')
    21             ctrl = true;
    22         if(event.which=='16')
    23             shift = true;
    24 
    25         if (event.which=='13' && $('#search_input').length && $('#search_input').is(':focus')) {
    26             $('#search_button').trigger('click');
     19    //console.log('which:',event.which);
     20        switch(event.which){
     21            case 17:
     22                ctrl = true;break;
     23            case 91:
     24      case 93:
     25                if(mac){ctrl++;}break;
     26            case 16:
     27                shift = true;
     28            case 13:
     29                if ($('#search_input').length && $('#search_input').is(':focus')) {
     30                    $('#search_button').trigger('click');
     31                }break;
    2732        }
    2833    });
    2934
    3035    $(document).keyup(function(event){
    31         if(event.which=='17')
    32             ctrl = false;
    33         if(event.which=='16')
    34             shift = false;
     36    //console.log('which:',event.which);
     37        switch(event.which){
     38            case 17:
     39                ctrl = false;break;
     40            case 91:
     41      case 93:
     42                if(mac){ctrl--;}break;
     43            case 16:
     44                shift = false;
     45        }
    3546    });
    3647
     
    7788
    7889        if ($(this).attr('id') == 'search') {
    79             $(this).html('<input type=text id=search_input name=search_input value='+last_search_string+'><div id=search_button>Search</div>');
     90            $(this).html('').append($('<input type="text" id="search_input" name="search_input">').val(last_search_string)).append($('<div id="search_button">Search</div>'));
    8091            $('#search_input').focus();
    8192        } else {
  • shopsite-plugin/trunk/shopsite.php

    r3054878 r3055573  
    22/**
    33 * @package ShopSite
    4  * @version 1.5.9
     4 * @version 1.5.10
    55 */
    66/*
     
    99 * Description: ShopSite plugin to put products into your WordPress blog
    1010 * Author: ShopSite
    11  * Version: 1.5.9
     11 * Version: 1.5.10
    1212 * Author URI: http://shopsite.com/
    1313 */
    1414
    15 /*
    16 function debug_print($text) {
    17     file_put_contents("log.txt", $text."\n", FILE_APPEND);
    18 }
    19  */
     15/*function debug_print($text){file_put_contents("log.txt", $text."\n", FILE_APPEND);}*/
    2016
    2117$product_list = array();
     
    5854
    5955function load_plugin() {
    60     $version = "1.5.9";
     56    $version = "1.5.10";
    6157    if ( is_admin() ) { 
    6258        $running_version = get_option('ss_version');
     
    289285function show_search_form() {
    290286  //debug_print("show_search_form");
     287  $user_agent = getenv("HTTP_USER_AGENT");
     288  if(strpos($user_agent, "Mac") !== FALSE){
     289    $ctrl = 'COMMAND (&#x2318;)';
     290  }
     291  else
     292  {
     293    $ctrl = 'CTRL';
     294  }
    291295    $tinymce_url = includes_url()."js/tinymce/tiny_mce_popup.js";
    292296    $jquery_url = includes_url()."js/jquery/jquery.js";
     
    317321    <body>
    318322    <div id="top_bar">
    319     <div id="message">You can use CTRL and SHIFT keys to select multiple products.</div> 
     323  <div id="message">Use <?= $ctrl ?> and SHIFT keys to select multiple products.</div> 
    320324    <div id="tabs">
    321325    <div class="tab selected_tab" id="list_all">List all products</div><div class="tab" id="search">Search</div>
     
    411415    //$products = simplexml_load_string($products_xml['data']);
    412416    $products = simplexml_load_string($products_xml['data'], 'SimpleXMLElement', LIBXML_NOENT);
    413     if (count($products->Products->Product) > 0) {
     417    if (isset($products)&&isset($products->Products)&&count($products->Products->Product) > 0) {
    414418        foreach ($products->Products->Product as $product) {
    415419            $products_ar[addslashes($product->Name)] = array($product->ProductGUID, $product->SKU, $product->Graphic);
Note: See TracChangeset for help on using the changeset viewer.