Changeset 2770271
- Timestamp:
- 08/14/2022 09:38:18 AM (4 years ago)
- Location:
- widgets-for-amazon/trunk
- Files:
-
- 3 edited
-
README.txt (modified) (2 diffs)
-
js/amazon-search.js (modified) (4 diffs)
-
widgets-for-amazon.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
widgets-for-amazon/trunk/README.txt
r2770195 r2770271 3 3 Contributors: eggnstone 4 4 Donate link: https://paypal.me/eggnstone/ 5 Tags: search, search widget, search widgets, amazon, affiliate, amazon affiliate, widget, widgets5 Tags: affiliate, amazon, search, widget, search widget, amazon affiliate, widgets, search widgets, amazon affiliates 6 6 Requires at least: 5.0 7 7 Requires PHP: 7.0 8 8 Tested up to: 6.0 9 Stable tag: 1.0.2 69 Stable tag: 1.0.27 10 10 License: GPLv3 or later 11 11 License URI: http://www.gnu.org/licenses/gpl-3.0.html … … 52 52 == Changelog == 53 53 54 #### 1.0.27 - 2022-08-14 55 56 - Added messages (Please check the console to see errors and warnings e.g. when the category is not correct.) 57 54 58 #### 1.0.26 - 2022-08-13 55 59 -
widgets-for-amazon/trunk/js/amazon-search.js
r2770195 r2770271 33 33 function eggnstone_widgets_fill_amazon_search_box(index, url, keywords, footerMessage) 34 34 { 35 //console.log("eggnstone_widgets_fill_amazon_search_box");36 37 35 const elementName = "amazon-search-" + index; 38 36 39 37 const req = new XMLHttpRequest(); 40 38 const full_url = url + "&Keywords=" + keywords; 41 //console.log("full_url: " + full_url); 39 42 40 req.open("GET", full_url); 43 41 req.addEventListener("load", function () 44 42 { 45 //console.log("eggnstone_widgets_fill_amazon_search_box: request was answered: " + req.status);46 47 43 const element = document.getElementById(elementName); 48 44 if (!element) … … 54 50 if (req.status === 200) 55 51 { 56 const maxTitleWidth = element.clientWidth - (100 + 4 * 8 + 2 * 1); // 100px image column, 8px padding,1px border52 const maxTitleWidth = element.clientWidth - (100 + 4 * 8 + 2); // 100px image column, 4 * 8px padding, 2 * 1px border 57 53 const parsedJson = JSON.parse(req.responseText); 58 54 const items = parsedJson["Items"]; 55 const messages = parsedJson["Messages"]; 56 59 57 if (!items || items.length === 0) 60 58 element.innerHTML = eggnstone_widgets_create_search_box_table_with_message(index, url, keywords, "Nothing found.", footerMessage); 61 59 else 62 60 element.innerHTML = eggnstone_widgets_create_search_box_table_with_result(index, url, keywords, items, maxTitleWidth, footerMessage); 61 62 if (messages) 63 { 64 for (const message of messages) 65 { 66 if (message.type === "Error") 67 console.error("Widgets for Amazon: " + message.text); 68 if (message.type === "Warning") 69 console.error("Widgets for Amazon: Warning: " + message.text); 70 else 71 console.log("Widgets for Amazon: " + message.text); 72 } 73 } 63 74 } 64 75 else … … 72 83 console.log("Widgets for Amazon: Could not find element '" + elementName + "'. (1)"); 73 84 74 //console.log("eggnstone_widgets_fill_amazon_search_box: sending request ...");75 85 req.send(null); 76 86 } … … 198 208 function eggnstone_widgets_has_some_parent_the_class(element, classname) 199 209 { 200 //console.log("D: " + element.className);201 202 210 if (element.className && element.className.split(" ").indexOf(classname) >= 0) 203 211 return true; -
widgets-for-amazon/trunk/widgets-for-amazon.php
r2770195 r2770271 5 5 * Plugin URI: https://blog.eggnstone.com/blog/widgets-for-amazon-for-wordpress 6 6 * Description: Widgets for Amazon by eggnstone 7 * Version: 1.0.2 67 * Version: 1.0.27 8 8 * Author: eggnstone 9 9 * Author URI: https://eggnstone.com
Note: See TracChangeset
for help on using the changeset viewer.