// assume jquery is already loaded console.log("loading 1"); // workaround to get $ from wordpress version of jQuery jQuery(document).ready(function ($) { console.log("loading 2"); // bot styles (#1025978) $('head').append(''); // bootstrap function dynamicallyLoadScript(url) { var script = document.createElement("script"); script.src = url; document.head.appendChild(script); } // bootstrap js dynamicallyLoadScript('https://botcompany.de/1014036/raw/1025981?contentType=text/javascript'); // scripts for bot $(function(){ $("#addClass").click(function () { console.log("Opening chat bot"); $('#qnimate').addClass('popup-box-on'); $("#scrollme").scrollTop(1E10); }); $("#removeClass").click(function () { $('#qnimate').removeClass('popup-box-on'); }); }); var chatBot_showActions = false; function chatBot_showAction(action) { if (chatBot_showActions) { $("#actionMsg").html(action); $("#actionMsg").show(); } } function chatBot_appendAction(action) { if (chatBot_showActions) { $("#actionMsg").append(" | " + action); $("#actionMsg").show(); } } function chatBot_hideAction() { $("#actionMsg").hide(); $("#actionMsg").html(""); } var chatBot_n = #N#; var chatBot_interval = 1000; chatBot_nInitial = chatBot_n; function chatBot_start() { url = "#INCREMENTALURL#"; if (url != '' && url != ("#INC" + "REMENTALURL#")) { chatBot_showAction("Loading " + url + chatBot_n); $.get(url + chatBot_n, function(src) { chatBot_showAction("Loaded"); var match = src.match(/\d+/); if (match != null) { chatBot_n = parseInt(match[0]); $(".direct-chat-messages").append(src); $("#scrollme").scrollTop(1E10); chatBot_showAction("Appended " + src.length); } else chatBot_showAction("chatBot_n=" + chatBot_n + " (initial=" + chatBot_nInitial + ")"); chatBot_appendAction("Rescheduling"); setTimeout(chatBot_start, chatBot_interval); chatBot_appendAction("Rescheduled"); }, 'text') .fail(function() { chatBot_showAction("Rescheduling after fail"); setTimeout(chatBot_start, chatBot_interval); }); } } function submitMsg() { if (status_message.value == 'new dialog') document.forms['msgform'].submit(); else { url = '#MSGURL#' + encodeURIComponent(status_message.value); chatBot_showAction('Submitting ' + url); $.get(url); status_message.value = ''; } } // onLoad window.addEventListener('DOMContentLoaded', chatBot_start, false); // end of bot scripts });