1var NfContentUpgradeShortcodeUI; 2 3( function (NfContentUpgradeShortcodeUI, $) { 4 5 $(document).ready(function () { 6 7 /** 8 * Listen for the main button click action 9 */ 10 $(document).on('click', '.nfcontentupgrade_shortcode_link', function () { 11 12 tb_show("Insert Content Upgrade", "#TB_inline?inlineId=select-contentupgrade&width=453&height=386", ""); 13 14 }); 15 16 /** 17 * Listen for the form submit action 18 */ 19 $(document).on('click', '#select-contentupgrade-submit', function () { 20 21 id_string = $('#add_contentupgrade_id').val(); 22 23 if (id_string) { 24 25 var contentupgrade_customtitle = $("#add_contentupgrade_customtitle").val(); 26 var contentupgrade_customtext = $("#add_contentupgrade_customtext").val(); 27 var contentupgrade_customresponse = $("#add_contentupgrade_customresponse").val(); 28 29 var contentupgrade_disabletitle = $("#add_contentupgrade_disabletitle")[0].checked; 30 var contentupgrade_disabletext = $("#add_contentupgrade_disabletext")[0].checked; 31 var contentupgrade_disableresponse = $("#add_contentupgrade_disableresponse")[0].checked; 32 33 var shortcode = "[gatedcontent-widget id=\"" + id_string + "\""; 34 35 if (contentupgrade_disabletitle) { 36 shortcode += " title=\"none\""; 37 } 38 39 else if (contentupgrade_customtitle) { 40 contentupgrade_customtitle = contentupgrade_customtitle.replace(/["]+/g, '') 41 contentupgrade_customtitle = JSON.stringify(String(contentupgrade_customtitle)); 42 contentupgrade_customtitle = contentupgrade_customtitle.substring(1, contentupgrade_customtitle.length-1); 43 shortcode += " title=\"" + contentupgrade_customtitle + "\""; 44 } 45 46 if (contentupgrade_disabletext) { 47 shortcode += " text=\"none\""; 48 } 49 50 else if (contentupgrade_customtext) { 51 contentupgrade_customtext = contentupgrade_customtext.replace(/["]+/g, '') 52 contentupgrade_customtext = JSON.stringify(String(contentupgrade_customtext)); 53 contentupgrade_customtext = contentupgrade_customtext.substring(1, contentupgrade_customtext.length-1); 54 shortcode += " text=\"" + contentupgrade_customtext + "\""; 55 } 56 57 if (contentupgrade_disableresponse) { 58 shortcode += " response=\"none\""; 59 } 60 61 else if (contentupgrade_customresponse) { 62 contentupgrade_customresponse = contentupgrade_customresponse.replace(/["]+/g, '') 63 contentupgrade_customresponse = JSON.stringify(String(contentupgrade_customresponse)); 64 contentupgrade_customresponse = contentupgrade_customresponse.substring(1, contentupgrade_customresponse.length-1); 65 shortcode += " response=\"" + contentupgrade_customresponse + "\""; 66 } 67 68 shortcode += "]"; 69 70 console.log( shortcode ); 71 72 wp.media.editor.insert( shortcode ); 73 } 74 75 }); 76 77 /** 78 * Listen for the form cancel action 79 */ 80 $(document).on('click', '#nfcontentupgrade-cancel-shortcode', function () { 81 tb_remove(); 82 }); 83 84 }); 85}(window.NfContentUpgradeShortcodeUI = window.NfContentUpgradeShortcodeUI || {}, jQuery));
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.