Changeset 3055573
- Timestamp:
- 03/20/2024 07:00:42 PM (2 years ago)
- Location:
- shopsite-plugin/trunk
- Files:
-
- 2 edited
-
search_products.js (modified) (3 diffs)
-
shopsite.php (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
shopsite-plugin/trunk/search_products.js
r3054878 r3055573 2 2 jQuery(function ($) { 3 3 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>'); 5 5 var data = 'ss_action=search_products&search_string=' + string + '&remember_search=' + rems; 6 6 $.ajax({ … … 15 15 } 16 16 17 var ctrl = false; 18 var shift = false; 17 let ctrl = 0, shift = false, mac = navigator.platform.indexOf('Mac')===0; 19 18 $(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; 27 32 } 28 33 }); 29 34 30 35 $(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 } 35 46 }); 36 47 … … 77 88 78 89 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>')); 80 91 $('#search_input').focus(); 81 92 } else { -
shopsite-plugin/trunk/shopsite.php
r3054878 r3055573 2 2 /** 3 3 * @package ShopSite 4 * @version 1.5. 94 * @version 1.5.10 5 5 */ 6 6 /* … … 9 9 * Description: ShopSite plugin to put products into your WordPress blog 10 10 * Author: ShopSite 11 * Version: 1.5. 911 * Version: 1.5.10 12 12 * Author URI: http://shopsite.com/ 13 13 */ 14 14 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);}*/ 20 16 21 17 $product_list = array(); … … 58 54 59 55 function load_plugin() { 60 $version = "1.5. 9";56 $version = "1.5.10"; 61 57 if ( is_admin() ) { 62 58 $running_version = get_option('ss_version'); … … 289 285 function show_search_form() { 290 286 //debug_print("show_search_form"); 287 $user_agent = getenv("HTTP_USER_AGENT"); 288 if(strpos($user_agent, "Mac") !== FALSE){ 289 $ctrl = 'COMMAND (⌘)'; 290 } 291 else 292 { 293 $ctrl = 'CTRL'; 294 } 291 295 $tinymce_url = includes_url()."js/tinymce/tiny_mce_popup.js"; 292 296 $jquery_url = includes_url()."js/jquery/jquery.js"; … … 317 321 <body> 318 322 <div id="top_bar"> 319 <div id="message">You can use CTRLand SHIFT keys to select multiple products.</div>323 <div id="message">Use <?= $ctrl ?> and SHIFT keys to select multiple products.</div> 320 324 <div id="tabs"> 321 325 <div class="tab selected_tab" id="list_all">List all products</div><div class="tab" id="search">Search</div> … … 411 415 //$products = simplexml_load_string($products_xml['data']); 412 416 $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) { 414 418 foreach ($products->Products->Product as $product) { 415 419 $products_ar[addslashes($product->Name)] = array($product->ProductGUID, $product->SKU, $product->Graphic);
Note: See TracChangeset
for help on using the changeset viewer.