1(function(){if(typeof $==='undefined')$=jQuery;$(function(){sfmc.init()})})(jQuery);var sfmc=new function(){this.init=function(){if($(".sfmc_preferences").length===0)return;this.getPreferences();$("form.preference_form").on("reset",function(e,response){sfmc.handleResponse($(this),response)})} 2this.getPreferences=function(){var sk=$(".sfmc_preferences").data("sk");var locale=$(".sfmc_preferences").data("locale");$.post(ajax.url,{'action':ajax.action,'_ajax_nonce':ajax.nonce,'data':{'sk':sk,'locale':locale}},function(response){if(response.indexOf('success::')>-1){var parsedData;var rawData=response.split('success::')[1];try{parsedData=JSON.parse(rawData)}catch(e){console.error(e);sfmc.setState("error");return} 3var options=parsedData.userdata??null;var subscriberKey=parsedData.subscriberKey??"";if(subscriberKey&&subscriberKey.length){$(".preference_form").find("input[name='subscriberKeyRetrieved']").val("true");$(".preference_form").find(".input-outer-wrapper, .input-wrapper").filter(function(index){return $(this).find(".sendbutton, .submitbutton").length===0}).remove()} 4var result=sfmc.setOptions(options);sfmc.setState(result?"success":"error")}else{console.warn(response);sfmc.setState("error")}})} 5this.setState=function(state){$(".preference_form").each(function(){$(this).removeClass("is_loading is_error is_success");$(this).addClass("is_"+state)});if(state==="error"){$(".preference_form").find(".input-outer-wrapper, .input-wrapper").remove()}} 6this.setOptions=function(options){if(!options||!Array.isArray(options))return!1;$(".sfmc_preferences").each(function(){var multiradio=$(this).find(".greyd_multiradio");var option=multiradio.find("input + .option");var valueInput=multiradio.find("input[name='affinityValues']");var keysInput=multiradio.siblings("input[name='affinityKeys']");var values=[];var keys=[];multiradio.find("input + .option ~ .option").remove();options.forEach(function(item){var clone=option.clone();clone.attr("data-value",item.key);clone.children(".txt").children(".short").html(item.title);clone.children(".txt").children(".long").html(item.descr);keys.push(item.key);if(item.state==="active"){values.push(item.key);clone.addClass("selected")} 7if(item.order){clone.css("order",item.order)} 8clone.appendTo(multiradio)});valueInput.val(values.join(","));keysInput.val(keys.join(","))});return!0} 9this.handleResponse=function(form,response){if(Array.isArray(response.userdata)){response.userdata.forEach(function(item){if(typeof item.affinityKey!=="undefined"&&typeof item.state!=="undefined"){if(item.state==="active"){setTimeout(function(){form.find(".option[data-value='"+item.affinityKey+"']").trigger("click")},0)}}})}}}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.