Plugin Directory

Changeset 2308886


Ignore:
Timestamp:
05/20/2020 03:14:07 PM (6 years ago)
Author:
snatchbot
Message:

fix: jquery to native js

Location:
snatchbot-webchat/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • snatchbot-webchat/trunk/assets/js/embedCode.js

    r2287525 r2308886  
    1 (function($) {
    2     if (typeof snatchBot !== 'undefined') {
    3         const footer = $("footer")
    4         const body = $("body")
     1(function() {
     2    if (typeof snatchBot !== 'undefined') { 
     3        const footer = document.getElementsByTagName("footer")
     4        const body = document.getElementsByTagName("body")
    55        if(footer.length) {
    6             footer.append('<script>window.sntchChat.Init('+ snatchBot.botID +')</script>')
     6            footer[0].append('<script>window.sntchChat.Init('+ snatchBot.botID +')</script>')
    77        } else {
    8             body.append('<script>window.sntchChat.Init('+ snatchBot.botID +')</script>')
     8            body[0].append('<script>window.sntchChat.Init('+ snatchBot.botID +')</script>')
    99        }
    1010    } else {
    1111        console.log("ERROR: doesn't given SnatchBot ID")
    1212    }
    13 })(jQuery);
     13})();
  • snatchbot-webchat/trunk/assets/js/embedCode.min.js

    r2287525 r2308886  
    1 !function(t){if("undefined"!=typeof snatchBot){const n=t("footer"),o=t("body");n.length?n.append("<script>window.sntchChat.Init("+snatchBot.botID+")<\/script>"):o.append("<script>window.sntchChat.Init("+snatchBot.botID+")<\/script>")}else console.log("ERROR: doesn't given SnatchBot ID")}(jQuery);
     1(function()
     2{
     3    if("undefined"!=typeof snatchBot) {
     4        const   n = document.getElementsByTagName('footer'),
     5                o = document.getElementsByTagName('body');
     6        n.length ? n[0].append("<script>window.sntchChat.Init("+snatchBot.botID+")<\/script>") : o[0].append("<script>window.sntchChat.Init("+snatchBot.botID+")<\/script>")
     7    } else console.log("ERROR: doesn't given SnatchBot ID")
     8})();
  • snatchbot-webchat/trunk/client/client.php

    r2253009 r2308886  
    5050        if (!empty($bot_id)) {
    5151            wp_register_script('EmbedCode', 'https://account.snatchbot.me/script.js', '', '', false );
     52            wp_register_script('jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js', false, '1.8.3');
    5253            wp_enqueue_script('SnatchEmbedCodeDeploy', $assetsPath['files']['embedCodeJS'], array('EmbedCode'), '', true );
    5354            wp_localize_script( 'SnatchEmbedCodeDeploy' , 'snatchBot',
Note: See TracChangeset for help on using the changeset viewer.