I have an issue adding this code to webflow can anyone please assist me?
(function() {
// Localize jQuery variable
var jQuery;
/******** Load jQuery if not present *********/
if (window.jQuery === undefined || window.jQuery.fn.jquery !== '3.1.0') {
var script_tag = document.createElement('script');
script_tag.setAttribute("type","text/javascript");
script_tag.setAttribute("src",
"https://code.jquery.com/jquery-3.1.0.min.js");
if (script_tag.readyState) {
script_tag.onreadystatechange = function () { // For old versions of IE
if (this.readyState == 'complete' || this.readyState == 'loaded') {
scriptLoadHandler();
}
};
} else {
script_tag.onload = scriptLoadHandler;
}
// Try to find the head, otherwise default to the documentElement
(document.getElementsByTagName("head")[0] || document.documentElement).appendChild(script_tag);
} else {
// The jQuery version on the window is the one we want to use
jQuery = window.jQuery;
main();
}
/******** Called once jQuery has loaded ******/
function scriptLoadHandler() {
// Restore $ and window.jQuery to their previous values and store the
// new jQuery in our local jQuery variable
jQuery = window.jQuery.noConflict(true);
// Call our main function
main();
}
/******** Our main function ********/
function main() {
jQuery(document).ready(function($) {
/****** Load EQ.js ******/
var eq_script = document.createElement('script');
eq_script.setAttribute("type","text/javascript");
eq_script.setAttribute("src",
"https://widget.resourcesforclients.com/common/eq.min.js");
// Try to find the head, otherwise default to the documentElement
(document.getElementsByTagName("head")[0] || document.documentElement).appendChild(eq_script);
/******* Load HTML *******/
var $script = $('script[src*="tips.js"]');
var scriptSrc = $script.attr('src');
var u = gup( 'u', scriptSrc );
var taxtip = gup('taxtip', window.location.href);
//If in an iframe, catch referrer to get requested tip
var taxtipReferrer = document.referrer;
var referrerSplit = taxtipReferrer.lastIndexOf('/');
var taxtipRefId = taxtipReferrer.substring(referrerSplit + 1);
/******* Get CCCID from script url *******/
function gup(n,s){
n = n.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");
var p = (new RegExp("[\\?&]"+n+"=([^&#]*)")).exec(s);
return (p===null) ? "" : p[1];
}
/******* Load CSS *******/
var css_link = $("<link>", {
rel: "stylesheet",
type: "text/css",
href: "https://widget.resourcesforclients.com/wtt/style/index.php?u="+u
});
css_link.appendTo('head');
/******* Load CSS *******/
var css_link_wtt = $("<link>", {
rel: "stylesheet",
type: "text/css",
href: "https://tips.resourcesforclients.com/assets/themes/style-widget.css"
});
css_link_wtt.appendTo('head');
/******* Insert div after script on subscriber page *******/
var $container = $('<div id="weekly-tax-tips-container"></div>');
$script.after($container);
/******* Display data *******/
var jsonp_url = "https://widget.resourcesforclients.com/wtt/content.php?u="+u;
if (taxtip.length > 0) {
jsonp_url += "&taxtip="+taxtip;
}
if (taxtip === '' && taxtipRefId.length > 0) {
jsonp_url += "&taxtip="+taxtipRefId;
}
jsonp_url += "&callback=?";
$.getJSON(jsonp_url, function(data) {
var originalContent = data.html;
$container.html(originalContent).hide().fadeIn(750);
$('.weekly-tax-tip-link-button').on('click', function(event){
event.preventDefault();
var $link = $(this);
var $wrapper = $link.parents('.weekly-tax-tip-wrapper');
var $fullContent;
var $themeImage = $('.icon-wtt');
var $contentWrapper = $('.weekly-tax-tip-content-wrapper');
if (($fullContent = $wrapper.find('.weekly-tax-tip-full')).length !== 1) {
$fullContent = $('<div class="weekly-tax-tip-full"></div>');
$wrapper.append($fullContent);
$fullContent.load($link.attr('href'), {'widget': true}, function(){
$(this).prepend('<a href="#" class="weekly-tax-tip-back-button"><i class="fa fa-arrow-left"></i>Back</a>');
$fullContent.removeClass('hide').siblings().addClass('hide');
$wrapper.siblings().addClass('hide');
$themeImage.addClass('hide');
$contentWrapper.addClass('full-width');
});
} else {
$fullContent.removeClass('hide').siblings().addClass('hide');
$wrapper.siblings().addClass('hide');
$themeImage.addClass('hide');
$contentWrapper.addClass('full-width');
}
});
$('.weekly-tax-tip-wrapper').on('click', '.weekly-tax-tip-back-button', function(event){
event.preventDefault();
var $link = $(this);
var $wrapper = $link.parents('.weekly-tax-tip-wrapper');
var $fullContent = $link.parent();
var $themeImage = $('.icon-wtt');
var $contentWrapper = $('.weekly-tax-tip-content-wrapper');
$fullContent.addClass('hide').siblings().removeClass('hide');
$wrapper.siblings().removeClass('hide');
$themeImage.removeClass('hide');
$contentWrapper.removeClass('full-width');
});
$('.weekly-tax-tip-linked .weekly-tax-tip-back-button').on('click', function(event){
event.preventDefault();
$('.weekly-tax-tip-linked').remove();
$('.weekly-tax-tip-wrapper').removeClass('hide');
});
});
});
window.onload = function(){
setTimeout(function() {
eqjs.refreshNodes();
eqjs.query();
}, 300);
};
}
})();
Here is my site Read-Only: LINK
(how to share your site Read-Only link)