Plugin Directory

Changeset 2770271


Ignore:
Timestamp:
08/14/2022 09:38:18 AM (4 years ago)
Author:
eggnstone
Message:

v1.0.27: Added messages (Please check the console to see errors and warnings e.g. when the category is not correct.)

Location:
widgets-for-amazon/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • widgets-for-amazon/trunk/README.txt

    r2770195 r2770271  
    33Contributors: eggnstone
    44Donate link: https://paypal.me/eggnstone/ 
    5 Tags: search, search widget, search widgets, amazon, affiliate, amazon affiliate, widget, widgets
     5Tags: affiliate, amazon, search, widget, search widget, amazon affiliate, widgets, search widgets, amazon affiliates
    66Requires at least: 5.0 
    77Requires PHP: 7.0 
    88Tested up to: 6.0
    9 Stable tag: 1.0.26
     9Stable tag: 1.0.27
    1010License: GPLv3 or later 
    1111License URI: http://www.gnu.org/licenses/gpl-3.0.html
     
    5252== Changelog ==
    5353
     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
    5458#### 1.0.26 - 2022-08-13
    5559
  • widgets-for-amazon/trunk/js/amazon-search.js

    r2770195 r2770271  
    3333function eggnstone_widgets_fill_amazon_search_box(index, url, keywords, footerMessage)
    3434{
    35     //console.log("eggnstone_widgets_fill_amazon_search_box");
    36 
    3735    const elementName = "amazon-search-" + index;
    3836
    3937    const req = new XMLHttpRequest();
    4038    const full_url = url + "&Keywords=" + keywords;
    41     //console.log("full_url: " + full_url);
     39
    4240    req.open("GET", full_url);
    4341    req.addEventListener("load", function ()
    4442    {
    45         //console.log("eggnstone_widgets_fill_amazon_search_box: request was answered: " + req.status);
    46 
    4743        const element = document.getElementById(elementName);
    4844        if (!element)
     
    5450        if (req.status === 200)
    5551        {
    56             const maxTitleWidth = element.clientWidth - (100 + 4 * 8 + 2 * 1); // 100px image column, 8px padding, 1px border
     52            const maxTitleWidth = element.clientWidth - (100 + 4 * 8 + 2); // 100px image column, 4 * 8px padding, 2 * 1px border
    5753            const parsedJson = JSON.parse(req.responseText);
    5854            const items = parsedJson["Items"];
     55            const messages = parsedJson["Messages"];
     56
    5957            if (!items || items.length === 0)
    6058                element.innerHTML = eggnstone_widgets_create_search_box_table_with_message(index, url, keywords, "Nothing found.", footerMessage);
    6159            else
    6260                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            }
    6374        }
    6475        else
     
    7283        console.log("Widgets for Amazon: Could not find element '" + elementName + "'. (1)");
    7384
    74     //console.log("eggnstone_widgets_fill_amazon_search_box: sending request ...");
    7585    req.send(null);
    7686}
     
    198208function eggnstone_widgets_has_some_parent_the_class(element, classname)
    199209{
    200     //console.log("D: " + element.className);
    201 
    202210    if (element.className && element.className.split(" ").indexOf(classname) >= 0)
    203211        return true;
  • widgets-for-amazon/trunk/widgets-for-amazon.php

    r2770195 r2770271  
    55 * Plugin URI: https://blog.eggnstone.com/blog/widgets-for-amazon-for-wordpress
    66 * Description: Widgets for Amazon by eggnstone
    7  * Version: 1.0.26
     7 * Version: 1.0.27
    88 * Author: eggnstone
    99 * Author URI: https://eggnstone.com
Note: See TracChangeset for help on using the changeset viewer.