{"version":3,"file":"../../js/llms-admin-forms.min.js","sources":["llms-admin-forms.js"],"sourcesContent":["/**\n * Show an upgrade to custom fields notice when viewing the forms post type table\n *\n * @since 5.0.0\n * @version 5.0.0\n */\n\n( function() {\n\n\tvar __ = window.wp.i18n.__,\n\t\tBTN_CLASS = 'page-title-action',\n\t\tHELP_CLASS = 'llms-forms-help-text',\n\t\taddNewBtn = document.querySelector( '.' + BTN_CLASS );\n\n\t// Don't do anything if the button already exists.\n\tif ( addNewBtn ) {\n\t\treturn;\n\t}\n\n\t/**\n\t * Create the disabled \"Add New Form\" button\n\t *\n\t * @since 5.0.0\n\t *\n\t * @return {Element} Button DOM node.\n\t */\n\tfunction createNewButton() {\n\n\t\tvar btn = document.createElement( 'button' );\n\n\t\tbtn.className = BTN_CLASS + ' button';\n\t\tbtn.innerHTML = __( 'Add New Form', 'lifterlms' );\n\t\tbtn.disabled = 'disabled';\n\t\tbtn.style = 'vertical-align: inherit';\n\n\t\treturn btn;\n\n\t}\n\n\t/**\n\t * Create the toggle \"Help\" icon button\n\t *\n\t * @since 5.0.0\n\t *\n\t * @return {Element} Button DOM node.\n\t */\n\tfunction createHelpIcon() {\n\n\t\tvar btn = document.createElement( 'button' ),\n\t\t\ttxt = __( 'Help', 'lifterlms' );\n\n\t\tbtn.className = 'button dashicons dashicons-editor-help';\n\t\tbtn.style = [\n\t\t\t'border-radius: 50%;',\n\t\t\t'border-color: #50575e',\n\t\t\t'color: #50575e',\n\t\t\t'font-size: 23px;',\n\t\t\t'height: 30px;',\n\t\t\t'line-height: 1;',\n\t\t\t'margin-left: 5px;',\n\t\t\t'padding: 0;',\n\t\t\t'position: relative;',\n\t\t\t'top: 3px',\n\t\t\t'vertical-align: baseline;',\n\t\t\t'width: 30px;',\n\t\t].join( ';' );\n\n\t\tbtn.innerHTML = '<span class=\"screen-reader-text>' + txt + '</span>';\n\t\tbtn.title = __( 'Help', 'lifterlms' );\n\n\t\tbtn.addEventListener( 'click', toggleHelpNode );\n\n\t\treturn btn;\n\n\t}\n\n\t/**\n\t * Create the help notice node\n\t *\n\t * @since 5.0.0\n\t *\n\t * @return {Element} Notice div DOM node.\n\t */\n\tfunction createHelpNode() {\n\n\t\tvar div = document.createElement( 'div' );\n\n\t\tdiv.className = HELP_CLASS;\n\t\tdiv.style = 'display:none';\n\n\t\tdiv.innerHTML = '<p><b>Want to create custom forms and custom fields for your forms?</b></p>';\n\t\tdiv.innerHTML += '<p>Create unique student information forms for specific courses and memberships. Also unlock the power of custom fields so you can collect and display any form field data you can imagine.</p>';\n\t\tdiv.innerHTML += '<p><a class=\"button-primary\" target=\"_blank\" rel=\"noopener\" href=\"https://lifterlms.com/product/custom-fields/?utm_source=LifterLMS%20Plugin&utm_medium=Add%20Form%20Notice&utm_campaign=Add%20Form%20In%20App%20Upgrade%20Flow\">Learn More</a></p>';\n\n\t\treturn div;\n\n\t}\n\n\t/**\n\t * Callback function for toggling the help notice dispaly\n\t *\n\t * @since 5.0.0\n\t *\n\t * @return {void}\n\t */\n\tfunction toggleHelpNode() {\n\n\t\tvar el = document.querySelector( '.' + HELP_CLASS );\n\n\t\tif ( 'none' === el.style.display ) {\n\t\t\tel.style.display = 'block';\n\t\t\tel.className += ' notice notice-info';\n\t\t} else {\n\t\t\tel.style.display = 'none';\n\t\t}\n\n\t}\n\n\t/**\n\t * Initialize\n\t *\n\t * Creates and add elements to the dom and binds UI events.\n\t *\n\t * @since 5.0.0\n\t *\n\t * @return {void}\n\t */\n\tfunction init() {\n\n\t\tvar title = document.querySelector( '.wp-heading-inline' ),\n\t\t\tbtn = createNewButton();\n\n\t\ttitle.after( btn );\n\t\tbtn.after( createHelpIcon() );\n\n\t\tdocument.querySelector( '.wrap' ).insertBefore( createHelpNode(), document.querySelector( '.wp-header-end' ) );\n\n\t}\n\n\t// Go.\n\tinit();\n\n} )();\n\n\n"],"names":["btn","title","__","window","wp","i18n","BTN_CLASS","HELP_CLASS","toggleHelpNode","el","document","querySelector","style","display","className","createElement","innerHTML","disabled","after","txt","join","addEventListener","insertBefore","div"],"mappings":"CAOA,WAEC,IAyHEA,EADGC,EAxHDC,EAAaC,OAAOC,GAAGC,KAAKH,GAC/BI,EAAa,oBACbC,EAAa,uBA8Fd,SAASC,IAER,IAAIC,EAAKC,SAASC,cAAe,IAAMJ,GAElC,SAAWE,EAAGG,MAAMC,SACxBJ,EAAGG,MAAMC,QAAU,QACnBJ,EAAGK,WAAa,uBAEhBL,EAAGG,MAAMC,QAAU,OArGRH,SAASC,cAAe,IAAML,KAqHtCL,EAAQS,SAASC,cAAe,uBArGhCX,EAAMU,SAASK,cAAe,WAE9BD,UAAYR,EAAY,UAC5BN,EAAIgB,UAAYd,EAAI,eAAgB,aACpCF,EAAIiB,SAAY,WAChBjB,EAAIY,MAAY,0BAmGhBX,EAAMiB,MAAOlB,GACbA,EAAIkB,OArFAlB,EAAMU,SAASK,cAAe,UACjCI,EAAMjB,EAAI,OAAQ,aAEnBF,EAAIc,UAAY,yCAChBd,EAAIY,MAAY,CACf,sBACA,wBACA,iBACA,mBACA,gBACA,kBACA,oBACA,cACA,sBACA,WACA,4BACA,gBACCQ,KAAM,KAERpB,EAAIgB,UAAY,mCAAqCG,EAAM,UAC3DnB,EAAIC,MAAYC,EAAI,OAAQ,aAE5BF,EAAIqB,iBAAkB,QAASb,GAExBR,IA+DPU,SAASC,cAAe,SAAUW,eAlD9BC,EAAMb,SAASK,cAAe,QAE9BD,UAAYP,EAChBgB,EAAIX,MAAY,eAEhBW,EAAIP,UAAa,8EACjBO,EAAIP,WAAa,kMACjBO,EAAIP,WAAa,sPAEVO,GAyC2Db,SAASC,cAAe,oBAhI5F","sourceRoot":"../../js"}