Plugin Directory

Changeset 2452249


Ignore:
Timestamp:
01/08/2021 02:31:38 AM (5 years ago)
Author:
marcospassos
Message:

Update to version 1.0.5 from GitHub

Location:
croct
Files:
10 edited
1 copied

Legend:

Unmodified
Added
Removed
  • croct/tags/1.0.5/croct.php

    r2452232 r2452249  
    66 * Plugin Name:       Croct
    77 * Plugin URI:        https://croct.com/wordpress
    8  * Version:           1.0.4
     8 * Version:           1.0.5
    99 * Description:       Content Personalization for WordPress.
    1010 * Requires at least: 4.0
  • croct/tags/1.0.5/src/Dependency/BootstrapScript.php

    r2452232 r2452249  
    1919    }
    2020
    21     if (typeof wpCroct === 'undefined') {
     21    if (typeof wpCroct === 'undefined' ) {
     22        const queue = [];
     23       
     24        window.wpCroct = {
     25            queue: queue,
     26            enqueue: (method, args) => queue.push([method, args]),
     27        };
     28       
    2229        const script = document.getElementById(%s);
    2330
  • croct/tags/1.0.5/src/Dependency/InterestTrackingScript.php

    r2384748 r2452249  
    5353    {
    5454        return \sprintf(
    55             'wpCroct.trackInterests(%s, %s);',
    56             \json_encode($this->trigger),
    57             \json_encode($this->interests)
     55            'wpCroct.enqueue("trackInterests", %s);',
     56            \json_encode([$this->trigger, $this->interests])
    5857        );
    5958    }
  • croct/tags/1.0.5/src/Plugin.php

    r2452232 r2452249  
    1313final class Plugin
    1414{
    15     const VERSION = '1.0.4';
     15    const VERSION = '1.0.5';
    1616
    1717    const OPTIONS_GROUP = 'croct';
  • croct/tags/1.0.5/static/js/wp-croct.js

    r2384748 r2452249  
    11(function (window, croct) {
     2    const queue = typeof window.wpCroct === 'undefined' ? [] : (window.wpCroct.queue || []);
     3
    24    const wpCroct = {
     5        enqueue: (method, args) => {
     6            if (typeof wpCroct[method] !== 'function') {
     7                console.warn('Croct: Invalid method "' + method + '" enqueued.');
     8
     9                return;
     10            }
     11
     12            wpCroct[method].apply(wpCroct, args);
     13        },
    314        init: (config) => {
    415            croct.plug(config);
    5             window.addEventListener('DOMContentLoaded', wpCroct.applyPersonalization);
     16
     17            window.addEventListener('DOMContentLoaded', () => {
     18                wpCroct.processQueue();
     19                wpCroct.applyPersonalization();
     20            });
     21        },
     22
     23        processQueue: () => {
     24            queue.forEach(call => wpCroct.enqueue(call[0], call[1]));
    625        },
    726
  • croct/trunk/croct.php

    r2452232 r2452249  
    66 * Plugin Name:       Croct
    77 * Plugin URI:        https://croct.com/wordpress
    8  * Version:           1.0.4
     8 * Version:           1.0.5
    99 * Description:       Content Personalization for WordPress.
    1010 * Requires at least: 4.0
  • croct/trunk/src/Dependency/BootstrapScript.php

    r2452232 r2452249  
    1919    }
    2020
    21     if (typeof wpCroct === 'undefined') {
     21    if (typeof wpCroct === 'undefined' ) {
     22        const queue = [];
     23       
     24        window.wpCroct = {
     25            queue: queue,
     26            enqueue: (method, args) => queue.push([method, args]),
     27        };
     28       
    2229        const script = document.getElementById(%s);
    2330
  • croct/trunk/src/Dependency/InterestTrackingScript.php

    r2384748 r2452249  
    5353    {
    5454        return \sprintf(
    55             'wpCroct.trackInterests(%s, %s);',
    56             \json_encode($this->trigger),
    57             \json_encode($this->interests)
     55            'wpCroct.enqueue("trackInterests", %s);',
     56            \json_encode([$this->trigger, $this->interests])
    5857        );
    5958    }
  • croct/trunk/src/Plugin.php

    r2452232 r2452249  
    1313final class Plugin
    1414{
    15     const VERSION = '1.0.4';
     15    const VERSION = '1.0.5';
    1616
    1717    const OPTIONS_GROUP = 'croct';
  • croct/trunk/static/js/wp-croct.js

    r2384748 r2452249  
    11(function (window, croct) {
     2    const queue = typeof window.wpCroct === 'undefined' ? [] : (window.wpCroct.queue || []);
     3
    24    const wpCroct = {
     5        enqueue: (method, args) => {
     6            if (typeof wpCroct[method] !== 'function') {
     7                console.warn('Croct: Invalid method "' + method + '" enqueued.');
     8
     9                return;
     10            }
     11
     12            wpCroct[method].apply(wpCroct, args);
     13        },
    314        init: (config) => {
    415            croct.plug(config);
    5             window.addEventListener('DOMContentLoaded', wpCroct.applyPersonalization);
     16
     17            window.addEventListener('DOMContentLoaded', () => {
     18                wpCroct.processQueue();
     19                wpCroct.applyPersonalization();
     20            });
     21        },
     22
     23        processQueue: () => {
     24            queue.forEach(call => wpCroct.enqueue(call[0], call[1]));
    625        },
    726
Note: See TracChangeset for help on using the changeset viewer.