Sin descripción

site.js 186KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797
  1. /**
  2. * Adds needed backward compatibility for older versions of jQuery
  3. */
  4. ( function( $ ) {
  5. 'use strict';
  6. if ( $.fn.on === undefined ) {
  7. $.fn.on = function( types, sel, fn ) {
  8. return this.delegate( sel, types, fn );
  9. };
  10. }
  11. if ( $.fn.off === undefined ) {
  12. $.fn.off = function( types, sel, fn ) {
  13. return this.undelegate( sel, types, fn );
  14. };
  15. }
  16. if ( $.fn.bindFirst === undefined ) {
  17. $.fn.bindFirst = function( which, handler ) {
  18. var $el = $( this ),
  19. events,
  20. registered;
  21. $el.unbind( which, handler );
  22. $el.bind( which, handler );
  23. events = $._data( $el[ 0 ] ).events;
  24. registered = events[ which ];
  25. registered.unshift( registered.pop() );
  26. events[ which ] = registered;
  27. };
  28. }
  29. if ( $.fn.outerHtml === undefined ) {
  30. $.fn.outerHtml = function() {
  31. var $el = $( this ).clone(),
  32. $temp = $( '<div/>' ).append( $el );
  33. return $temp.html();
  34. };
  35. }
  36. if ( $.fn.isInViewport === undefined ) {
  37. $.fn.isInViewport = function() {
  38. var elementTop = $( this ).offset().top;
  39. var elementBottom = elementTop + $( this ).outerHeight();
  40. var viewportTop = $( window ).scrollTop();
  41. var viewportBottom = viewportTop + $( window ).height();
  42. return elementBottom > viewportTop && elementTop < viewportBottom;
  43. };
  44. }
  45. if ( Date.now === undefined ) {
  46. Date.now = function() {
  47. return new Date().getTime();
  48. };
  49. }
  50. } )( jQuery );
  51. /**
  52. * Defines the core $.popmake function which will load the proper methods.
  53. * Version 1.4
  54. */
  55. var PUM;
  56. (function ($, document, undefined) {
  57. "use strict";
  58. window.pum_vars = window.pum_vars || {
  59. // TODO Add defaults.
  60. default_theme: '0',
  61. home_url: '/',
  62. version: 1.7,
  63. pm_dir_url: '',
  64. ajaxurl: '',
  65. restapi: false,
  66. analytics_api: false,
  67. rest_nonce: null,
  68. debug_mode: false,
  69. disable_tracking: true,
  70. message_position: 'top',
  71. core_sub_forms_enabled: true,
  72. popups: {}
  73. };
  74. window.pum_popups = window.pum_popups || {};
  75. // Backward compatibility fill.
  76. window.pum_vars.popups = window.pum_popups;
  77. function isInt(value) {
  78. return !isNaN(value) && parseInt(Number(value)) === parseInt(value) && !isNaN(parseInt(value, 10));
  79. }
  80. function Selector_Cache() {
  81. var elementCache = {};
  82. var get_from_cache = function (selector, $ctxt, reset) {
  83. if ('boolean' === typeof $ctxt) {
  84. reset = $ctxt;
  85. $ctxt = false;
  86. }
  87. var cacheKey = $ctxt ? $ctxt.selector + ' ' + selector : selector;
  88. if (undefined === elementCache[cacheKey] || reset) {
  89. elementCache[cacheKey] = $ctxt ? $ctxt.find(selector) : jQuery(selector);
  90. }
  91. return elementCache[cacheKey];
  92. };
  93. get_from_cache.elementCache = elementCache;
  94. return get_from_cache;
  95. }
  96. function string_to_ref(object, reference) {
  97. function arr_deref(o, ref, i) {
  98. return !ref ? o : (o[ref.slice(0, i ? -1 : ref.length)]);
  99. }
  100. function dot_deref(o, ref) {
  101. return !ref ? o : ref.split('[').reduce(arr_deref, o);
  102. }
  103. return reference.split('.').reduce(dot_deref, object);
  104. }
  105. PUM = {
  106. get: new Selector_Cache(),
  107. getPopup: function (el) {
  108. var $this;
  109. // Quick Shortcuts
  110. if (isInt(el)) {
  111. $this = PUM.get('#pum-' + el);
  112. } else if (el === 'current') {
  113. $this = PUM.get('.pum-overlay.pum-active:eq(0)', true);
  114. } else if (el === 'open') {
  115. $this = PUM.get('.pum-overlay.pum-active', true);
  116. } else if (el === 'closed') {
  117. $this = PUM.get('.pum-overlay:not(.pum-active)', true);
  118. } else if (el instanceof jQuery) {
  119. $this = el;
  120. } else {
  121. $this = $(el);
  122. }
  123. if ($this.hasClass('pum-overlay')) {
  124. return $this;
  125. }
  126. if ($this.hasClass('popmake')) {
  127. return $this.parents('.pum-overlay');
  128. }
  129. return $this.parents('.pum-overlay').length ? $this.parents('.pum-overlay') : $();
  130. },
  131. open: function (el, callback) {
  132. PUM.getPopup(el).popmake('open', callback);
  133. },
  134. close: function (el, callback) {
  135. PUM.getPopup(el).popmake('close', callback);
  136. },
  137. preventOpen: function (el) {
  138. PUM.getPopup(el).addClass('preventOpen');
  139. },
  140. getSettings: function (el) {
  141. var $popup = PUM.getPopup(el);
  142. return $popup.popmake('getSettings');
  143. },
  144. getSetting: function (el, key, _default) {
  145. var settings = PUM.getSettings(el),
  146. value = string_to_ref(settings, key);
  147. return typeof value !== 'undefined' ? value : (_default !== undefined ? _default : null);
  148. },
  149. checkConditions: function (el) {
  150. return PUM.getPopup(el).popmake('checkConditions');
  151. },
  152. getCookie: function (cookie_name) {
  153. return $.pm_cookie(cookie_name);
  154. },
  155. getJSONCookie: function (cookie_name) {
  156. return $.pm_cookie_json(cookie_name);
  157. },
  158. setCookie: function (el, settings) {
  159. var $popup = PUM.getPopup(el);
  160. $popup.popmake('setCookie', jQuery.extend({
  161. name: 'pum-' + PUM.getSetting(el, 'id'),
  162. expires: '+30 days'
  163. }, settings));
  164. },
  165. clearCookie: function (cookie_name, callback) {
  166. $.pm_remove_cookie(cookie_name);
  167. if (typeof callback === 'function') {
  168. callback();
  169. }
  170. },
  171. clearCookies: function (el, callback) {
  172. var $popup = PUM.getPopup(el),
  173. settings = $popup.popmake('getSettings'),
  174. cookies = settings.cookies,
  175. cookie = null,
  176. i;
  177. if (cookies !== undefined && cookies.length) {
  178. for (i = 0; cookies.length > i; i += 1) {
  179. $.pm_remove_cookie(cookies[i].settings.name);
  180. }
  181. }
  182. if (typeof callback === 'function') {
  183. callback();
  184. }
  185. },
  186. getClickTriggerSelector: function (el, trigger_settings) {
  187. var $popup = PUM.getPopup(el),
  188. settings = PUM.getSettings(el),
  189. trigger_selectors = [
  190. '.popmake-' + settings.id,
  191. '.popmake-' + decodeURIComponent(settings.slug),
  192. 'a[href$="#popmake-' + settings.id + '"]'
  193. ];
  194. if (trigger_settings.extra_selectors && trigger_settings.extra_selectors !== '') {
  195. trigger_selectors.push(trigger_settings.extra_selectors);
  196. }
  197. trigger_selectors = pum.hooks.applyFilters('pum.trigger.click_open.selectors', trigger_selectors, trigger_settings, $popup);
  198. return trigger_selectors.join(', ');
  199. },
  200. disableClickTriggers: function (el, trigger_settings) {
  201. if (el === undefined) {
  202. // disable all triggers. Not available yet.
  203. return;
  204. }
  205. if (trigger_settings !== undefined) {
  206. var selector = PUM.getClickTriggerSelector(el, trigger_settings);
  207. $(selector).removeClass('pum-trigger');
  208. $(document).off('click.pumTrigger click.popmakeOpen', selector)
  209. } else {
  210. var triggers = PUM.getSetting(el, 'triggers', []);
  211. if (triggers.length) {
  212. for (var i = 0; triggers.length > i; i++) {
  213. // If this isn't an explicitly allowed click trigger type skip it.
  214. if (pum.hooks.applyFilters('pum.disableClickTriggers.clickTriggerTypes', ['click_open']).indexOf(triggers[i].type) === -1) {
  215. continue;
  216. }
  217. var selector = PUM.getClickTriggerSelector(el, triggers[i].settings);
  218. $(selector).removeClass('pum-trigger');
  219. $(document).off('click.pumTrigger click.popmakeOpen', selector)
  220. }
  221. }
  222. }
  223. },
  224. actions: {
  225. stopIframeVideosPlaying: function() {
  226. var $popup = PUM.getPopup( this ),
  227. $container = $popup.popmake( 'getContainer' );
  228. if ( ! $popup.hasClass( 'pum-has-videos' ) ) {
  229. // TODO: Move this to its own event binding to keep this method clean and simple.
  230. $container
  231. .find( 'iframe' )
  232. .filter( '[src*="youtube"],[src*="vimeo"]' )
  233. .each( function() {
  234. var $iframe = $( this ),
  235. src = $iframe.attr( 'src' ),
  236. // Remove autoplay so video doesn't start playing again.
  237. new_src = src.replace( 'autoplay=1', '1=1' );
  238. if ( new_src !== src ) {
  239. src = new_src;
  240. }
  241. $iframe.prop( 'src', src );
  242. } );
  243. // TODO: Move this to its own event binding to keep this method clean and simple.
  244. $container.find( 'video' ).each( function() {
  245. this.pause();
  246. } );
  247. }
  248. },
  249. }
  250. };
  251. $.fn.popmake = function (method) {
  252. // Method calling logic
  253. if ($.fn.popmake.methods[method]) {
  254. $(document).trigger('pumMethodCall', arguments);
  255. return $.fn.popmake.methods[method].apply(this, Array.prototype.slice.call(arguments, 1));
  256. }
  257. if (typeof method === 'object' || !method) {
  258. return $.fn.popmake.methods.init.apply(this, arguments);
  259. }
  260. if (window.console) {
  261. console.warn('Method ' + method + ' does not exist on $.fn.popmake');
  262. }
  263. };
  264. // Defines the core $.popmake methods.
  265. $.fn.popmake.methods = {
  266. init: function () {
  267. return this.each(function () {
  268. var $popup = PUM.getPopup(this),
  269. settings = $popup.popmake('getSettings');
  270. if (settings.theme_id <= 0) {
  271. settings.theme_id = pum_vars.default_theme;
  272. }
  273. // TODO Move this to be a single global $(window) function that looks at any open popup.
  274. if (settings.disable_reposition === undefined || !settings.disable_reposition) {
  275. $(window).on('resize', function () {
  276. if ($popup.hasClass('pum-active') || $popup.find('.popmake.active').length) {
  277. $.fn.popmake.utilities.throttle(setTimeout(function () {
  278. $popup.popmake('reposition');
  279. }, 25), 500, false);
  280. }
  281. });
  282. }
  283. // Added popmake settings to the container for temporary backward compatibility with extensions.
  284. // TODO Once extensions updated remove this.
  285. $popup.find('.pum-container').data('popmake', settings);
  286. $popup
  287. .data('popmake', settings)
  288. .trigger('pumInit');
  289. // If our opening sound setting is not set to None...
  290. if ( settings.open_sound && 'none' !== settings.open_sound ) {
  291. // ... then set up our audio. Once loaded, add to popup data.
  292. var audio = 'custom' !== settings.open_sound ? new Audio( pum_vars.pm_dir_url + '/assets/sounds/' + settings.open_sound ) : new Audio( settings.custom_sound );
  293. audio.addEventListener('canplaythrough', function() {
  294. $popup.data('popAudio', audio);
  295. });
  296. audio.addEventListener('error', function() {
  297. console.warn( 'Error occurred when trying to load Popup opening sound.' );
  298. });
  299. // In case our audio loaded faster than us attaching the event listener.
  300. audio.load();
  301. }
  302. return this;
  303. });
  304. },
  305. getOverlay: function () {
  306. return PUM.getPopup(this);
  307. },
  308. getContainer: function () {
  309. return PUM.getPopup(this).find('.pum-container');
  310. },
  311. getTitle: function () {
  312. return PUM.getPopup(this).find('.pum-title') || null;
  313. },
  314. getContent: function () {
  315. return PUM.getPopup(this).find('.pum-content') || null;
  316. },
  317. getClose: function () {
  318. return PUM.getPopup(this).find('.pum-content + .pum-close') || null;
  319. },
  320. getSettings: function () {
  321. var $popup = PUM.getPopup(this);
  322. return $.extend(true, {}, $.fn.popmake.defaults, $popup.data('popmake') || {}, typeof pum_popups === 'object' && typeof pum_popups[$popup.attr('id')] !== 'undefined' ? pum_popups[$popup.attr('id')] : {});
  323. },
  324. state: function (test) {
  325. var $popup = PUM.getPopup(this);
  326. if (undefined !== test) {
  327. switch (test) {
  328. case 'isOpen':
  329. return $popup.hasClass('pum-open') || $popup.popmake('getContainer').hasClass('active');
  330. case 'isClosed':
  331. return !$popup.hasClass('pum-open') && !$popup.popmake('getContainer').hasClass('active');
  332. }
  333. }
  334. },
  335. open: function (callback) {
  336. var $popup = PUM.getPopup(this),
  337. $container = $popup.popmake('getContainer'),
  338. $close = $popup.popmake('getClose'),
  339. settings = $popup.popmake('getSettings'),
  340. $html = $('html');
  341. $popup.trigger('pumBeforeOpen');
  342. /**
  343. * Allow for preventing popups from opening.
  344. */
  345. if ($popup.hasClass('preventOpen') || $container.hasClass('preventOpen')) {
  346. console.log('prevented');
  347. $popup
  348. .removeClass('preventOpen')
  349. .removeClass('pum-active')
  350. .trigger('pumOpenPrevented');
  351. return this;
  352. }
  353. /**
  354. * If popup isn't stackable close all others.
  355. */
  356. if (!settings.stackable) {
  357. $popup.popmake('close_all');
  358. }
  359. $popup.addClass('pum-active');
  360. /**
  361. * Hide the close button if delay is active.
  362. */
  363. if (settings.close_button_delay > 0) {
  364. $close.fadeOut(0);
  365. }
  366. $html.addClass('pum-open');
  367. /**
  368. * Check for and disable the overlay.
  369. */
  370. if (settings.overlay_disabled) {
  371. $html.addClass('pum-open-overlay-disabled');
  372. } else {
  373. $html.addClass('pum-open-overlay');
  374. }
  375. /**
  376. * Set position fixed when active.
  377. */
  378. if (settings.position_fixed) {
  379. $html.addClass('pum-open-fixed');
  380. } else {
  381. $html.addClass('pum-open-scrollable');
  382. }
  383. $popup
  384. .popmake('setup_close')
  385. .popmake('reposition')
  386. .popmake('animate', settings.animation_type, function () {
  387. /**
  388. * Fade the close button in after specified delay.
  389. */
  390. if (settings.close_button_delay > 0) {
  391. setTimeout(function () {
  392. $close.fadeIn();
  393. }, settings.close_button_delay);
  394. }
  395. $popup.trigger('pumAfterOpen');
  396. $(window).trigger('resize');
  397. $.fn.popmake.last_open_popup = $popup;
  398. // Fire user passed callback.
  399. if (callback !== undefined) {
  400. callback();
  401. // TODO Test this new method. Then remove the above.
  402. //callback.apply(this);
  403. }
  404. });
  405. // If the audio hasn't loaded yet, it wouldn't have been added to the popup.
  406. if ( 'undefined' !== typeof $popup.data('popAudio') ) {
  407. $popup.data('popAudio').play()
  408. .catch(function(reason) {
  409. console.warn('Sound was not able to play when popup opened. Reason: ' + reason);
  410. });
  411. }
  412. return this;
  413. },
  414. setup_close: function () {
  415. var $popup = PUM.getPopup(this),
  416. $close = $popup.popmake('getClose'),
  417. settings = $popup.popmake('getSettings');
  418. // Add For non built in close buttons and backward compatibility.
  419. $close = $close.add($('.popmake-close, .pum-close', $popup).not($close));
  420. // TODO: Move to a global $(document).on type bind. Possibly look for an inactive class to fail on.
  421. $close
  422. .off('click.pum')
  423. .on("click.pum", function (event) {
  424. var $this = $(this),
  425. do_default = $this.hasClass('pum-do-default') || ($this.data('do-default') !== undefined && $this.data('do-default'));
  426. if (!do_default) {
  427. event.preventDefault();
  428. }
  429. $.fn.popmake.last_close_trigger = 'Close Button';
  430. $popup.popmake('close');
  431. });
  432. if (settings.close_on_esc_press || settings.close_on_f4_press) {
  433. // TODO: Move to a global $(document).on type bind. Possibly look for a class to succeed on.
  434. $(window)
  435. .off('keyup.popmake')
  436. .on('keyup.popmake', function (e) {
  437. if (e.keyCode === 27 && settings.close_on_esc_press) {
  438. $.fn.popmake.last_close_trigger = 'ESC Key';
  439. $popup.popmake('close');
  440. }
  441. if (e.keyCode === 115 && settings.close_on_f4_press) {
  442. $.fn.popmake.last_close_trigger = 'F4 Key';
  443. $popup.popmake('close');
  444. }
  445. });
  446. }
  447. if (settings.close_on_overlay_click) {
  448. $popup.on('pumAfterOpen', function () {
  449. $(document).on('click.pumCloseOverlay', function (e) {
  450. var $target = $(e.target),
  451. $container = $target.closest('.pum-container');
  452. if (!$container.length) {
  453. $.fn.popmake.last_close_trigger = 'Overlay Click';
  454. $popup.popmake('close');
  455. }
  456. });
  457. });
  458. $popup.on('pumAfterClose', function () {
  459. $(document).off('click.pumCloseOverlay');
  460. });
  461. }
  462. if (settings.close_on_form_submission) {
  463. PUM.hooks.addAction('pum.integration.form.success', function (form, args) {
  464. // If this is the same popup the form was submitted in.
  465. // Alternatively we can compare their IDs
  466. if (args.popup && args.popup[0] === $popup[0]) {
  467. setTimeout(function () {
  468. $.fn.popmake.last_close_trigger = 'Form Submission';
  469. $popup.popmake('close');
  470. }, settings.close_on_form_submission_delay || 0);
  471. }
  472. });
  473. }
  474. $popup.trigger('pumSetupClose');
  475. return this;
  476. },
  477. close: function (callback) {
  478. return this.each(function () {
  479. var $popup = PUM.getPopup(this),
  480. $container = $popup.popmake('getContainer'),
  481. $close = $popup.popmake('getClose');
  482. $close = $close.add($('.popmake-close, .pum-close', $popup).not($close));
  483. $popup.trigger('pumBeforeClose');
  484. if ($popup.hasClass('preventClose') || $container.hasClass('preventClose')) {
  485. $popup
  486. .removeClass('preventClose')
  487. .trigger('pumClosePrevented');
  488. return this;
  489. }
  490. $container
  491. .fadeOut('fast', function () {
  492. if ($popup.is(":visible")) {
  493. $popup.fadeOut('fast');
  494. }
  495. /**
  496. * Clear global event spaces.
  497. */
  498. $(window).off('keyup.popmake');
  499. $popup.off('click.popmake');
  500. $close.off('click.popmake');
  501. // Only re-enable scrolling for the document when the last popup has closed.
  502. if ($('.pum-active').length === 1) {
  503. $('html')
  504. .removeClass('pum-open')
  505. .removeClass('pum-open-scrollable')
  506. .removeClass('pum-open-overlay')
  507. .removeClass('pum-open-overlay-disabled')
  508. .removeClass('pum-open-fixed');
  509. }
  510. $popup
  511. .removeClass('pum-active')
  512. .trigger('pumAfterClose');
  513. // Fire user passed callback.
  514. if (callback !== undefined) {
  515. callback();
  516. // TODO Test this new method. Then remove the above.
  517. //callback.apply(this);
  518. }
  519. });
  520. return this;
  521. });
  522. },
  523. close_all: function () {
  524. $('.pum-active').popmake('close');
  525. return this;
  526. },
  527. reposition: function (callback) {
  528. var $popup = PUM.getPopup(this).trigger('pumBeforeReposition'),
  529. $container = $popup.popmake('getContainer'),
  530. settings = $popup.popmake('getSettings'),
  531. location = settings.location,
  532. reposition = {
  533. my: "",
  534. at: "",
  535. of: window,
  536. collision: 'none',
  537. using: typeof callback === "function" ? callback : $.fn.popmake.callbacks.reposition_using
  538. },
  539. opacity = {overlay: null, container: null},
  540. $last_trigger = null;
  541. try {
  542. $last_trigger = $($.fn.popmake.last_open_trigger);
  543. } catch (error) {
  544. $last_trigger = $();
  545. }
  546. if (settings.position_from_trigger && $last_trigger.length) {
  547. reposition.of = $last_trigger;
  548. if (location.indexOf('left') >= 0) {
  549. reposition.my += " right";
  550. reposition.at += " left" + (settings.position_left !== 0 ? "-" + settings.position_left : "");
  551. }
  552. if (location.indexOf('right') >= 0) {
  553. reposition.my += " left";
  554. reposition.at += " right" + (settings.position_right !== 0 ? "+" + settings.position_right : "");
  555. }
  556. if (location.indexOf('center') >= 0) {
  557. reposition.my = location === 'center' ? "center" : reposition.my + " center";
  558. reposition.at = location === 'center' ? "center" : reposition.at + " center";
  559. }
  560. if (location.indexOf('top') >= 0) {
  561. reposition.my += " bottom";
  562. reposition.at += " top" + (settings.position_top !== 0 ? "-" + settings.position_top : "");
  563. }
  564. if (location.indexOf('bottom') >= 0) {
  565. reposition.my += " top";
  566. reposition.at += " bottom" + (settings.position_bottom !== 0 ? "+" + settings.position_bottom : "");
  567. }
  568. } else {
  569. if (location.indexOf('left') >= 0) {
  570. reposition.my += " left" + (settings.position_left !== 0 ? "+" + settings.position_left : "");
  571. reposition.at += " left";
  572. }
  573. if (location.indexOf('right') >= 0) {
  574. reposition.my += " right" + (settings.position_right !== 0 ? "-" + settings.position_right : "");
  575. reposition.at += " right";
  576. }
  577. if (location.indexOf('center') >= 0) {
  578. reposition.my = location === 'center' ? "center" : reposition.my + " center";
  579. reposition.at = location === 'center' ? "center" : reposition.at + " center";
  580. }
  581. if (location.indexOf('top') >= 0) {
  582. reposition.my += " top" + (settings.position_top !== 0 ? "+" + ($('body').hasClass('admin-bar') ? parseInt(settings.position_top, 10) + 32 : settings.position_top) : "");
  583. reposition.at += " top";
  584. }
  585. if (location.indexOf('bottom') >= 0) {
  586. reposition.my += " bottom" + (settings.position_bottom !== 0 ? "-" + settings.position_bottom : "");
  587. reposition.at += " bottom";
  588. }
  589. }
  590. reposition.my = $.trim(reposition.my);
  591. reposition.at = $.trim(reposition.at);
  592. if ($popup.is(':hidden')) {
  593. opacity.overlay = $popup.css("opacity");
  594. $popup.css({opacity: 0}).show(0);
  595. }
  596. if ($container.is(':hidden')) {
  597. opacity.container = $container.css("opacity");
  598. $container.css({opacity: 0}).show(0);
  599. }
  600. if (settings.position_fixed) {
  601. $container.addClass('fixed');
  602. }
  603. if (settings.size === 'custom') {
  604. $container.css({
  605. width: settings.custom_width,
  606. height: settings.custom_height_auto ? 'auto' : settings.custom_height
  607. });
  608. } else {
  609. if (settings.size !== 'auto') {
  610. $container
  611. .addClass('responsive')
  612. .css({
  613. minWidth: settings.responsive_min_width !== '' ? settings.responsive_min_width : 'auto',
  614. maxWidth: settings.responsive_max_width !== '' ? settings.responsive_max_width : 'auto'
  615. });
  616. }
  617. }
  618. $popup.trigger('pumAfterReposition');
  619. // TODO: Remove the add class and migrate the trigger to the $popup with pum prefix.
  620. $container
  621. .addClass('custom-position')
  622. .position(reposition)
  623. .trigger('popmakeAfterReposition');
  624. if (location === 'center' && $container[0].offsetTop < 0) {
  625. // Admin bar is 32px high, with a 10px margin that is 42
  626. $container.css({top: $('body').hasClass('admin-bar') ? 42 : 10});
  627. }
  628. if (opacity.overlay) {
  629. $popup.css({opacity: opacity.overlay}).hide(0);
  630. }
  631. if (opacity.container) {
  632. $container.css({opacity: opacity.container}).hide(0);
  633. }
  634. return this;
  635. },
  636. animation_origin: function (origin) {
  637. var $popup = PUM.getPopup(this),
  638. $container = $popup.popmake('getContainer'),
  639. start = {
  640. my: "",
  641. at: ""
  642. };
  643. switch (origin) {
  644. case 'top':
  645. start = {
  646. my: "left+" + $container.offset().left + " bottom-100",
  647. at: "left top"
  648. };
  649. break;
  650. case 'bottom':
  651. start = {
  652. my: "left+" + $container.offset().left + " top+100",
  653. at: "left bottom"
  654. };
  655. break;
  656. case 'left':
  657. start = {
  658. my: "right top+" + $container.offset().top,
  659. at: "left top"
  660. };
  661. break;
  662. case 'right':
  663. start = {
  664. my: "left top+" + $container.offset().top,
  665. at: "right top"
  666. };
  667. break;
  668. default:
  669. if (origin.indexOf('left') >= 0) {
  670. start = {
  671. my: start.my + " right",
  672. at: start.at + " left"
  673. };
  674. }
  675. if (origin.indexOf('right') >= 0) {
  676. start = {
  677. my: start.my + " left",
  678. at: start.at + " right"
  679. };
  680. }
  681. if (origin.indexOf('center') >= 0) {
  682. start = {
  683. my: start.my + " center",
  684. at: start.at + " center"
  685. };
  686. }
  687. if (origin.indexOf('top') >= 0) {
  688. start = {
  689. my: start.my + " bottom-100",
  690. at: start.at + " top"
  691. };
  692. }
  693. if (origin.indexOf('bottom') >= 0) {
  694. start = {
  695. my: start.my + " top+100",
  696. at: start.at + " bottom"
  697. };
  698. }
  699. start.my = $.trim(start.my);
  700. start.at = $.trim(start.at);
  701. break;
  702. }
  703. start.of = window;
  704. start.collision = 'none';
  705. return start;
  706. }
  707. };
  708. }(jQuery, document));
  709. /**
  710. * Initialize Popup Maker.
  711. * Version 1.8
  712. */
  713. (function ($, document, undefined) {
  714. "use strict";
  715. // Defines the current version.
  716. $.fn.popmake.version = 1.8;
  717. // Stores the last open popup.
  718. $.fn.popmake.last_open_popup = null;
  719. // Here for backward compatibility.
  720. window.ajaxurl = window.pum_vars.ajaxurl;
  721. window.PUM.init = function () {
  722. console.log('init popups ✔');
  723. $(document).trigger('pumBeforeInit');
  724. $('.pum').popmake();
  725. $(document).trigger('pumInitialized');
  726. /**
  727. * Process php based form submissions when the form_success args are passed.
  728. */
  729. if (typeof pum_vars.form_success === 'object') {
  730. pum_vars.form_success = $.extend({
  731. popup_id: null,
  732. settings: {}
  733. });
  734. PUM.forms.success(pum_vars.form_success.popup_id, pum_vars.form_success.settings);
  735. }
  736. // Initiate integrations.
  737. PUM.integrations.init();
  738. };
  739. // Initiate when ready.
  740. $(function () {
  741. // TODO can this be moved outside doc.ready since we are awaiting our own promises first?
  742. var initHandler = PUM.hooks.applyFilters('pum.initHandler', PUM.init);
  743. var initPromises = PUM.hooks.applyFilters('pum.initPromises', []);
  744. Promise.all(initPromises).then(initHandler);
  745. });
  746. /**
  747. * Add hidden field to all popup forms.
  748. */
  749. $('.pum').on('pumInit', function () {
  750. var $popup = PUM.getPopup(this),
  751. popupID = PUM.getSetting($popup, 'id'),
  752. $forms = $popup.find('form');
  753. /**
  754. * If there are forms in the popup add a hidden field for use in retriggering the popup on reload.
  755. */
  756. if ($forms.length) {
  757. $forms.append('<input type="hidden" name="pum_form_popup_id" value="' + popupID + '" />');
  758. }
  759. })
  760. .on( 'pumAfterClose', window.PUM.actions.stopIframeVideosPlaying );
  761. }(jQuery));
  762. /**
  763. * Defines the core $.popmake binds.
  764. * Version 1.4
  765. */
  766. var PUM_Accessibility;
  767. ( function( $, document, undefined ) {
  768. 'use strict';
  769. var $top_level_elements,
  770. focusableElementsString =
  771. 'a[href], area[href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), iframe, object, embed, *[tabindex], *[contenteditable]',
  772. previouslyFocused,
  773. currentModal,
  774. selector = '.pum:not(.pum-accessibility-disabled)';
  775. PUM_Accessibility = {
  776. // Accessibility: Checks focus events to ensure they stay inside the modal.
  777. forceFocus: function( e ) {
  778. if (
  779. currentModal &&
  780. currentModal.length &&
  781. ! currentModal[ 0 ].contains( e.target )
  782. ) {
  783. e.stopPropagation();
  784. PUM_Accessibility.setFocusToFirstItem();
  785. }
  786. },
  787. trapTabKey: function( e ) {
  788. // if tab or shift-tab pressed
  789. if ( e.keyCode === 9 ) {
  790. // get list of focusable items
  791. var focusableItems = currentModal
  792. .find( '.pum-container *' )
  793. .filter( focusableElementsString )
  794. .filter( ':visible' ),
  795. // get currently focused item
  796. focusedItem = $( ':focus' ),
  797. // get the number of focusable items
  798. numberOfFocusableItems = focusableItems.length,
  799. // get the index of the currently focused item
  800. focusedItemIndex = focusableItems.index( focusedItem );
  801. if ( e.shiftKey ) {
  802. //back tab
  803. // if focused on first item and user preses back-tab, go to the last focusable item
  804. if ( focusedItemIndex === 0 ) {
  805. focusableItems
  806. .get( numberOfFocusableItems - 1 )
  807. .focus();
  808. e.preventDefault();
  809. }
  810. } else {
  811. //forward tab
  812. // if focused on the last item and user preses tab, go to the first focusable item
  813. if ( focusedItemIndex === numberOfFocusableItems - 1 ) {
  814. focusableItems.get( 0 ).focus();
  815. e.preventDefault();
  816. }
  817. }
  818. }
  819. },
  820. setFocusToFirstItem: function() {
  821. var $firstEl = currentModal
  822. .find( '.pum-container *' )
  823. .filter( focusableElementsString )
  824. .filter( ':visible' )
  825. //.filter( ':not(.pum-close)' )
  826. .first();
  827. // set focus to first focusable item
  828. $firstEl.focus();
  829. },
  830. initiateFocusLock: function() {
  831. var $popup = PUM.getPopup( this ),
  832. $focused = $( ':focus' );
  833. // Accessibility: Sets the previous focus element.
  834. if ( ! $popup.has( $focused ).length ) {
  835. previouslyFocused = $focused;
  836. }
  837. // Accessibility: Sets the current modal for focus checks.
  838. currentModal = $popup
  839. // Accessibility: Trap tab key.
  840. .on( 'keydown.pum_accessibility', PUM_Accessibility.trapTabKey )
  841. .attr( 'aria-hidden', 'false' );
  842. $top_level_elements = $( 'body > *:not([aria-hidden="true"])' )
  843. .filter( ':visible' )
  844. .not( currentModal );
  845. $top_level_elements.attr( 'aria-hidden', 'true' );
  846. // Accessibility: Add focus check first time focus changes after popup opens that prevents tabbing outside of modal.
  847. $( document ).one(
  848. 'focusin.pum_accessibility',
  849. PUM_Accessibility.forceFocus
  850. );
  851. // Accessibility: Focus on the modal.
  852. PUM_Accessibility.setFocusToFirstItem();
  853. },
  854. };
  855. $( document )
  856. .on( 'pumInit', selector, function() {
  857. PUM.getPopup( this )
  858. .find( '[tabindex]' )
  859. .each( function() {
  860. var $this = $( this );
  861. $this
  862. .data( 'tabindex', $this.attr( 'tabindex' ) )
  863. .prop( 'tabindex', '0' );
  864. } );
  865. } )
  866. .on( 'pumBeforeOpen', selector, function() {} )
  867. .on( 'pumAfterOpen', selector, PUM_Accessibility.initiateFocusLock )
  868. .on( 'pumBeforeClose', selector, function() {} )
  869. .on( 'pumAfterClose', selector, function() {
  870. var $popup = PUM.getPopup( this );
  871. $popup
  872. .off( 'keydown.pum_accessibility' )
  873. .attr( 'aria-hidden', 'true' );
  874. if ( $top_level_elements ) {
  875. $top_level_elements.attr( 'aria-hidden', 'false' );
  876. $top_level_elements = null;
  877. }
  878. // Accessibility: Focus back on the previously focused element.
  879. if ( previouslyFocused !== undefined && previouslyFocused.length ) {
  880. previouslyFocused.focus();
  881. }
  882. // Accessibility: Clears the currentModal var.
  883. currentModal = null;
  884. // Accessibility: Removes the force focus check.
  885. $( document ).off( 'focusin.pum_accessibility' );
  886. } )
  887. .on( 'pumSetupClose', selector, function() {} )
  888. .on( 'pumOpenPrevented', selector, function() {} )
  889. .on( 'pumClosePrevented', selector, function() {} )
  890. .on( 'pumBeforeReposition', selector, function() {} );
  891. } )( jQuery, document );
  892. /**
  893. * Defines the core pum analytics methods.
  894. * Version 1.4
  895. */
  896. var PUM_Analytics;
  897. ( function ( $ ) {
  898. 'use strict';
  899. $.fn.popmake.last_open_trigger = null;
  900. $.fn.popmake.last_close_trigger = null;
  901. $.fn.popmake.conversion_trigger = null;
  902. var rest_enabled = !! (
  903. typeof pum_vars.analytics_api !== 'undefined' && pum_vars.analytics_api
  904. );
  905. PUM_Analytics = {
  906. beacon: function ( data, callback ) {
  907. var beacon = new Image(),
  908. url = rest_enabled ? pum_vars.analytics_api : pum_vars.ajaxurl,
  909. opts = {
  910. route: pum.hooks.applyFilters(
  911. 'pum.analyticsBeaconRoute',
  912. '/' + pum_vars.analytics_route + '/'
  913. ),
  914. data: pum.hooks.applyFilters(
  915. 'pum.AnalyticsBeaconData',
  916. $.extend(
  917. true,
  918. {
  919. event: 'open',
  920. pid: null,
  921. _cache: +new Date(),
  922. },
  923. data
  924. )
  925. ),
  926. callback:
  927. typeof callback === 'function'
  928. ? callback
  929. : function () {},
  930. };
  931. if ( ! rest_enabled ) {
  932. opts.data.action = 'pum_analytics';
  933. } else {
  934. url += opts.route;
  935. }
  936. // Create a beacon if a url is provided
  937. if ( url ) {
  938. // Attach the event handlers to the image object
  939. $( beacon ).on( 'error success load done', opts.callback );
  940. // Attach the src for the script call
  941. beacon.src = url + '?' + $.param( opts.data );
  942. }
  943. },
  944. };
  945. if (
  946. ( typeof pum_vars.disable_tracking === 'undefined' ||
  947. ! pum_vars.disable_tracking ) &&
  948. // Check for extensions disabling core tracking events.
  949. ( typeof pum_vars.disable_core_tracking === 'undefined' ||
  950. ! pum_vars.disable_core_tracking )
  951. ) {
  952. // Only popups from the editor should fire analytics events.
  953. $( document )
  954. /**
  955. * Track opens for popups.
  956. */
  957. .on( 'pumAfterOpen.core_analytics', '.pum', function () {
  958. var $popup = PUM.getPopup( this ),
  959. data = {
  960. pid:
  961. parseInt(
  962. $popup.popmake( 'getSettings' ).id,
  963. 10
  964. ) || null,
  965. };
  966. // Shortcode popups use negative numbers, and single-popup (preview mode) shouldn't be tracked.
  967. if (
  968. data.pid > 0 &&
  969. ! $( 'body' ).hasClass( 'single-popup' )
  970. ) {
  971. PUM_Analytics.beacon( data );
  972. }
  973. } );
  974. /**
  975. * Track form submission conversions
  976. */
  977. $( function () {
  978. PUM.hooks.addAction(
  979. 'pum.integration.form.success',
  980. function ( form, args ) {
  981. // If the submission has already been counted in the backend, we can bail early.
  982. if ( args.ajax === false ) {
  983. return;
  984. }
  985. // If no popup is included in the args, we can bail early since we only record conversions within popups.
  986. if ( args.popup.length === 0 ) {
  987. return;
  988. }
  989. var data = {
  990. pid:
  991. parseInt(
  992. args.popup.popmake( 'getSettings' ).id,
  993. 10
  994. ) || null,
  995. event: 'conversion',
  996. };
  997. // Shortcode popups use negative numbers, and single-popup (preview mode) shouldn't be tracked.
  998. if (
  999. data.pid > 0 &&
  1000. ! $( 'body' ).hasClass( 'single-popup' )
  1001. ) {
  1002. PUM_Analytics.beacon( data );
  1003. }
  1004. }
  1005. );
  1006. } );
  1007. }
  1008. } )( jQuery );
  1009. /**
  1010. * Defines the core $.popmake animations.
  1011. * Version 1.4
  1012. */
  1013. ( function( $, document, undefined ) {
  1014. 'use strict';
  1015. $.fn.popmake.methods.animate_overlay = function(
  1016. style,
  1017. duration,
  1018. callback
  1019. ) {
  1020. // Method calling logic
  1021. var settings = PUM.getPopup( this ).popmake( 'getSettings' );
  1022. if ( settings.overlay_disabled ) {
  1023. return $.fn.popmake.overlay_animations.none.apply( this, [
  1024. duration,
  1025. callback,
  1026. ] );
  1027. }
  1028. if ( $.fn.popmake.overlay_animations[ style ] ) {
  1029. return $.fn.popmake.overlay_animations[ style ].apply( this, [
  1030. duration,
  1031. callback,
  1032. ] );
  1033. }
  1034. if ( window.console ) {
  1035. console.warn( 'Animation style ' + style + ' does not exist.' );
  1036. }
  1037. return this;
  1038. };
  1039. $.fn.popmake.methods.animate = function( style ) {
  1040. // Method calling logic
  1041. if ( $.fn.popmake.animations[ style ] ) {
  1042. return $.fn.popmake.animations[ style ].apply(
  1043. this,
  1044. Array.prototype.slice.call( arguments, 1 )
  1045. );
  1046. }
  1047. if ( window.console ) {
  1048. console.warn( 'Animation style ' + style + ' does not exist.' );
  1049. }
  1050. return this;
  1051. };
  1052. /**
  1053. * Resets animation & position properties prior to opening/reopening the popup.
  1054. *
  1055. * @param $popup
  1056. */
  1057. function popupCssReset( $popup ) {
  1058. var $container = $popup.popmake( 'getContainer' ),
  1059. cssResets = { display: '', opacity: '' };
  1060. $popup.css( cssResets );
  1061. $container.css( cssResets );
  1062. }
  1063. function overlayAnimationSpeed( settings ) {
  1064. if ( settings.overlay_disabled ) {
  1065. return 0;
  1066. }
  1067. return settings.animation_speed / 2;
  1068. }
  1069. function containerAnimationSpeed( settings ) {
  1070. if ( settings.overlay_disabled ) {
  1071. return parseInt( settings.animation_speed );
  1072. }
  1073. return settings.animation_speed / 2;
  1074. }
  1075. /**
  1076. * All animations should.
  1077. *
  1078. * 1. Reset Popup CSS styles. Defaults are as follows:
  1079. * - opacity: 1
  1080. * - display: "none"
  1081. * - left, top, right, bottom: set to final position (where animation ends).
  1082. *
  1083. * 2. Prepare the popup for animation. Examples include:
  1084. * - a. Static positioned animations like fade might set display: "block" & opacity: 0.
  1085. * - b. Moving animations such as slide might set display: "block" & opacity: 0 so that
  1086. * positioning can be accurately calculated, then set opacity: 1 before the animation begins.
  1087. *
  1088. * 3. Animate the overlay using `$popup.popmake( 'animate_overlay', type, speed, callback);`
  1089. *
  1090. * 4. Animate the container.
  1091. * - a. Moving animations can use $container.popmake( 'reposition', callback ); The callback
  1092. * accepts a position argument for where you should animate to.
  1093. * - b. This usually takes place inside the callback for the overlay callback or after it.
  1094. */
  1095. $.fn.popmake.animations = {
  1096. none: function( callback ) {
  1097. var $popup = PUM.getPopup( this );
  1098. // Ensure the container is visible immediately.
  1099. $popup
  1100. .popmake( 'getContainer' )
  1101. .css( { opacity: 1, display: 'block' } );
  1102. $popup.popmake( 'animate_overlay', 'none', 0, function() {
  1103. // Fire user passed callback.
  1104. if ( callback !== undefined ) {
  1105. callback();
  1106. // TODO Test this new method. Then remove the above.
  1107. //callback.apply(this);
  1108. }
  1109. } );
  1110. return this;
  1111. },
  1112. slide: function( callback ) {
  1113. var $popup = PUM.getPopup( this ),
  1114. $container = $popup.popmake( 'getContainer' ),
  1115. settings = $popup.popmake( 'getSettings' ),
  1116. start = $popup.popmake(
  1117. 'animation_origin',
  1118. settings.animation_origin
  1119. );
  1120. // Step 1. Reset popup styles.
  1121. popupCssReset( $popup );
  1122. // Step 2. Position the container offscreen.
  1123. $container.position( start );
  1124. // Step 3. Animate the popup.
  1125. $popup.popmake(
  1126. 'animate_overlay',
  1127. 'fade',
  1128. overlayAnimationSpeed( settings ),
  1129. function() {
  1130. $container.popmake( 'reposition', function( position ) {
  1131. $container.animate(
  1132. position,
  1133. containerAnimationSpeed( settings ),
  1134. 'swing',
  1135. function() {
  1136. // Fire user passed callback.
  1137. if ( callback !== undefined ) {
  1138. callback();
  1139. // TODO Test this new method. Then remove the above.
  1140. //allback.apply(this);
  1141. }
  1142. }
  1143. );
  1144. } );
  1145. }
  1146. );
  1147. return this;
  1148. },
  1149. fade: function( callback ) {
  1150. var $popup = PUM.getPopup( this ),
  1151. $container = $popup.popmake( 'getContainer' ),
  1152. settings = $popup.popmake( 'getSettings' );
  1153. // Step 1. Reset popup styles.
  1154. popupCssReset( $popup );
  1155. // Step 2. Hide each element to be faded in.
  1156. $popup.css( { opacity: 0, display: 'block' } );
  1157. $container.css( { opacity: 0, display: 'block' } );
  1158. // Step 3. Animate the popup.
  1159. $popup.popmake(
  1160. 'animate_overlay',
  1161. 'fade',
  1162. overlayAnimationSpeed( settings ),
  1163. function() {
  1164. $container.animate(
  1165. { opacity: 1 },
  1166. containerAnimationSpeed( settings ),
  1167. 'swing',
  1168. function() {
  1169. // Fire user passed callback.
  1170. if ( callback !== undefined ) {
  1171. callback();
  1172. // TODO Test this new method. Then remove the above.
  1173. //callback.apply(this);
  1174. }
  1175. }
  1176. );
  1177. }
  1178. );
  1179. return this;
  1180. },
  1181. fadeAndSlide: function( callback ) {
  1182. var $popup = PUM.getPopup( this ),
  1183. $container = $popup.popmake( 'getContainer' ),
  1184. settings = $popup.popmake( 'getSettings' ),
  1185. start = $popup.popmake(
  1186. 'animation_origin',
  1187. settings.animation_origin
  1188. );
  1189. // Step 1. Reset popup styles.
  1190. popupCssReset( $popup );
  1191. // Step 2. Hide each element to be faded in. display: "block" is neccessary for accurate positioning based on popup size.
  1192. $popup.css( { display: 'block', opacity: 0 } );
  1193. $container.css( { display: 'block', opacity: 0 } );
  1194. // Step 3. Position the container offscreen.
  1195. $container.position( start );
  1196. // Step 4. Animate the popup.
  1197. $popup.popmake(
  1198. 'animate_overlay',
  1199. 'fade',
  1200. overlayAnimationSpeed( settings ),
  1201. function() {
  1202. $container.popmake( 'reposition', function( position ) {
  1203. // Add opacity to the animation properties.
  1204. position.opacity = 1;
  1205. // Animate the fade & slide.
  1206. $container.animate(
  1207. position,
  1208. containerAnimationSpeed( settings ),
  1209. 'swing',
  1210. function() {
  1211. // Fire user passed callback.
  1212. if ( callback !== undefined ) {
  1213. callback();
  1214. // TODO Test this new method. Then remove the above.
  1215. //callback.apply(this);
  1216. }
  1217. }
  1218. );
  1219. } );
  1220. }
  1221. );
  1222. return this;
  1223. },
  1224. /**
  1225. * TODO: Remove these and let import script replace them.
  1226. * @deprecated
  1227. * @returns {$.fn.popmake.animations}
  1228. */
  1229. grow: function( callback ) {
  1230. return $.fn.popmake.animations.fade.apply( this, arguments );
  1231. },
  1232. /**
  1233. * @deprecated
  1234. * @returns {$.fn.popmake.animations}
  1235. */
  1236. growAndSlide: function( callback ) {
  1237. return $.fn.popmake.animations.fadeAndSlide.apply(
  1238. this,
  1239. arguments
  1240. );
  1241. },
  1242. };
  1243. $.fn.popmake.overlay_animations = {
  1244. none: function( duration, callback ) {
  1245. PUM.getPopup( this ).css( { opacity: 1, display: 'block' } );
  1246. if ( typeof callback === 'function' ) {
  1247. callback();
  1248. }
  1249. },
  1250. fade: function( duration, callback ) {
  1251. PUM.getPopup( this )
  1252. .css( { opacity: 0, display: 'block' } )
  1253. .animate( { opacity: 1 }, duration, 'swing', callback );
  1254. },
  1255. slide: function( duration, callback ) {
  1256. PUM.getPopup( this ).slideDown( duration, callback );
  1257. },
  1258. };
  1259. } )( jQuery, document );
  1260. /**
  1261. * Defines the core $.popmake binds.
  1262. * Version 1.4
  1263. */
  1264. ( function( $, document, undefined ) {
  1265. 'use strict';
  1266. $( document )
  1267. // Backward Compatibility
  1268. // TODO: Add check for compatibility mode once available.
  1269. .on( 'pumInit', '.pum', function() {
  1270. $( this )
  1271. .popmake( 'getContainer' )
  1272. .trigger( 'popmakeInit' );
  1273. } )
  1274. /**
  1275. * Fires the deprecated popmakeBeforeOpen event
  1276. */
  1277. .on( 'pumBeforeOpen', '.pum', function() {
  1278. $( this )
  1279. .popmake( 'getContainer' )
  1280. .addClass( 'active' )
  1281. .trigger( 'popmakeBeforeOpen' );
  1282. } )
  1283. /**
  1284. * Fires the deprecated popmakeAfterOpen event
  1285. */
  1286. .on( 'pumAfterOpen', '.pum', function() {
  1287. $( this )
  1288. .popmake( 'getContainer' )
  1289. .trigger( 'popmakeAfterOpen' );
  1290. } )
  1291. /**
  1292. * Fires the deprecated popmakeBeforeClose event
  1293. */
  1294. .on( 'pumBeforeClose', '.pum', function() {
  1295. $( this )
  1296. .popmake( 'getContainer' )
  1297. .trigger( 'popmakeBeforeClose' );
  1298. } )
  1299. /**
  1300. * Fires the deprecated popmakeAfterClose event
  1301. */
  1302. .on( 'pumAfterClose', '.pum', function() {
  1303. $( this )
  1304. .popmake( 'getContainer' )
  1305. .removeClass( 'active' )
  1306. .trigger( 'popmakeAfterClose' );
  1307. } )
  1308. /**
  1309. * Fires the deprecated popmakeSetupClose event
  1310. */
  1311. .on( 'pumSetupClose', '.pum', function() {
  1312. $( this )
  1313. .popmake( 'getContainer' )
  1314. .trigger( 'popmakeSetupClose' );
  1315. } )
  1316. /**
  1317. * Removes the prevent open classes if they exist.
  1318. */
  1319. .on( 'pumOpenPrevented', '.pum', function() {
  1320. $( this )
  1321. .popmake( 'getContainer' )
  1322. .removeClass( 'preventOpen' )
  1323. .removeClass( 'active' );
  1324. } )
  1325. /**
  1326. * Removes the prevent close classes if they exist.
  1327. */
  1328. .on( 'pumClosePrevented', '.pum', function() {
  1329. $( this )
  1330. .popmake( 'getContainer' )
  1331. .removeClass( 'preventClose' );
  1332. } )
  1333. /**
  1334. * Fires the deprecated popmakeBeforeReposition event
  1335. */
  1336. .on( 'pumBeforeReposition', '.pum', function() {
  1337. $( this )
  1338. .popmake( 'getContainer' )
  1339. .trigger( 'popmakeBeforeReposition' );
  1340. } );
  1341. } )( jQuery, document );
  1342. /**
  1343. * Defines the core $.popmake callbacks.
  1344. * Version 1.4
  1345. */
  1346. ( function( $, document, undefined ) {
  1347. 'use strict';
  1348. $.fn.popmake.callbacks = {
  1349. reposition_using: function( position ) {
  1350. $( this ).css( position );
  1351. },
  1352. };
  1353. } )( jQuery, document );
  1354. ( function( $, document, undefined ) {
  1355. 'use strict';
  1356. // Used for Mobile Detect when needed.
  1357. var _md,
  1358. md = function() {
  1359. if ( _md === undefined ) {
  1360. _md =
  1361. typeof MobileDetect !== 'undefined'
  1362. ? new MobileDetect( window.navigator.userAgent )
  1363. : {
  1364. phone: function() {
  1365. return false;
  1366. },
  1367. tablet: function() {
  1368. return false;
  1369. },
  1370. };
  1371. }
  1372. return _md;
  1373. };
  1374. $.extend( $.fn.popmake.methods, {
  1375. checkConditions: function() {
  1376. var $popup = PUM.getPopup( this ),
  1377. settings = $popup.popmake( 'getSettings' ),
  1378. // Loadable defaults to true if no conditions. Making the popup available everywhere.
  1379. loadable = true,
  1380. group_check,
  1381. g,
  1382. c,
  1383. group,
  1384. condition;
  1385. if ( settings.disable_on_mobile ) {
  1386. if ( md().phone() ) {
  1387. return false;
  1388. }
  1389. }
  1390. if ( settings.disable_on_tablet ) {
  1391. if ( md().tablet() ) {
  1392. return false;
  1393. }
  1394. }
  1395. if ( settings.conditions.length ) {
  1396. // All Groups Must Return True. Break if any is false and set loadable to false.
  1397. for ( g = 0; settings.conditions.length > g; g++ ) {
  1398. group = settings.conditions[ g ];
  1399. // Groups are false until a condition proves true.
  1400. group_check = false;
  1401. // At least one group condition must be true. Break this loop if any condition is true.
  1402. for ( c = 0; group.length > c; c++ ) {
  1403. condition = $.extend(
  1404. {},
  1405. {
  1406. not_operand: false,
  1407. },
  1408. group[ c ]
  1409. );
  1410. // If any condition passes, set group_check true and break.
  1411. if (
  1412. ! condition.not_operand &&
  1413. $popup.popmake( 'checkCondition', condition )
  1414. ) {
  1415. group_check = true;
  1416. } else if (
  1417. condition.not_operand &&
  1418. ! $popup.popmake( 'checkCondition', condition )
  1419. ) {
  1420. group_check = true;
  1421. }
  1422. $( this ).trigger( 'pumCheckingCondition', [
  1423. group_check,
  1424. condition,
  1425. ] );
  1426. if ( group_check ) {
  1427. break;
  1428. }
  1429. }
  1430. // If any group of conditions doesn't pass, popup is not loadable.
  1431. if ( ! group_check ) {
  1432. loadable = false;
  1433. }
  1434. }
  1435. }
  1436. return loadable;
  1437. },
  1438. checkCondition: function( condition ) {
  1439. var target = condition.target || null,
  1440. settings = condition.settings || condition,
  1441. check;
  1442. if ( ! target ) {
  1443. console.warn( 'Condition type not set.' );
  1444. return false;
  1445. }
  1446. // TODO once all extensions updated and in circulation for v1.7, change the below to pass settings, not condition.
  1447. // Method calling logic
  1448. if ( $.fn.popmake.conditions[ target ] ) {
  1449. return $.fn.popmake.conditions[ target ].apply( this, [
  1450. condition,
  1451. ] );
  1452. }
  1453. if ( window.console ) {
  1454. console.warn( 'Condition ' + target + ' does not exist.' );
  1455. return true;
  1456. }
  1457. },
  1458. } );
  1459. $.fn.popmake.conditions = $.fn.popmake.conditions || {};
  1460. } )( jQuery, document );
  1461. /**
  1462. * Defines the core $.popmake.cookie functions.
  1463. * Version 1.4
  1464. *
  1465. * Defines the pm_cookie & pm_remove_cookie global functions.
  1466. */
  1467. var pm_cookie, pm_cookie_json, pm_remove_cookie;
  1468. ( function( $ ) {
  1469. 'use strict';
  1470. function cookie( converter ) {
  1471. if ( converter === undefined ) {
  1472. converter = function() {};
  1473. }
  1474. function api( key, value, attributes ) {
  1475. var result,
  1476. expires = new Date();
  1477. if ( typeof document === 'undefined' ) {
  1478. return;
  1479. }
  1480. // Write
  1481. if ( arguments.length > 1 ) {
  1482. attributes = $.extend(
  1483. {
  1484. path: pum_vars.home_url,
  1485. },
  1486. api.defaults,
  1487. attributes
  1488. );
  1489. switch ( typeof attributes.expires ) {
  1490. case 'number':
  1491. expires.setMilliseconds(
  1492. expires.getMilliseconds() +
  1493. attributes.expires * 864e5
  1494. );
  1495. attributes.expires = expires;
  1496. break;
  1497. case 'string':
  1498. expires.setTime(
  1499. $.fn.popmake.utilities.strtotime(
  1500. '+' + attributes.expires
  1501. ) * 1000
  1502. );
  1503. attributes.expires = expires;
  1504. break;
  1505. }
  1506. try {
  1507. result = JSON.stringify( value );
  1508. if ( /^[\{\[]/.test( result ) ) {
  1509. value = result;
  1510. }
  1511. } catch ( e ) {}
  1512. if ( ! converter.write ) {
  1513. value = encodeURIComponent( String( value ) ).replace(
  1514. /%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,
  1515. decodeURIComponent
  1516. );
  1517. } else {
  1518. value = converter.write( value, key );
  1519. }
  1520. key = encodeURIComponent( String( key ) );
  1521. key = key.replace(
  1522. /%(23|24|26|2B|5E|60|7C)/g,
  1523. decodeURIComponent
  1524. );
  1525. key = key.replace( /[\(\)]/g, escape );
  1526. return ( document.cookie = [
  1527. key,
  1528. '=',
  1529. value,
  1530. attributes.expires
  1531. ? '; expires=' + attributes.expires.toUTCString()
  1532. : '', // use expires attribute, max-age is not supported by IE
  1533. attributes.path ? '; path=' + attributes.path : '',
  1534. attributes.domain ? '; domain=' + attributes.domain : '',
  1535. attributes.secure ? '; secure' : '',
  1536. ].join( '' ) );
  1537. }
  1538. // Read
  1539. if ( ! key ) {
  1540. result = {};
  1541. }
  1542. // To prevent the for loop in the first place assign an empty array
  1543. // in case there are no cookies at all. Also prevents odd result when
  1544. // calling "get()"
  1545. var cookies = document.cookie ? document.cookie.split( '; ' ) : [];
  1546. var rdecode = /(%[0-9A-Z]{2})+/g;
  1547. var i = 0;
  1548. for ( ; i < cookies.length; i++ ) {
  1549. var parts = cookies[ i ].split( '=' );
  1550. var cookie = parts.slice( 1 ).join( '=' );
  1551. if ( cookie.charAt( 0 ) === '"' ) {
  1552. cookie = cookie.slice( 1, -1 );
  1553. }
  1554. try {
  1555. var name = parts[ 0 ].replace(
  1556. rdecode,
  1557. decodeURIComponent
  1558. );
  1559. cookie = converter.read
  1560. ? converter.read( cookie, name )
  1561. : converter( cookie, name ) ||
  1562. cookie.replace( rdecode, decodeURIComponent );
  1563. if ( this.json ) {
  1564. try {
  1565. cookie = JSON.parse( cookie );
  1566. } catch ( e ) {}
  1567. }
  1568. if ( key === name ) {
  1569. result = cookie;
  1570. break;
  1571. }
  1572. if ( ! key ) {
  1573. result[ name ] = cookie;
  1574. }
  1575. } catch ( e ) {}
  1576. }
  1577. return result;
  1578. }
  1579. api.set = api;
  1580. api.get = function( key ) {
  1581. return api.call( api, key );
  1582. };
  1583. api.getJSON = function() {
  1584. return api.apply(
  1585. {
  1586. json: true,
  1587. },
  1588. [].slice.call( arguments )
  1589. );
  1590. };
  1591. api.defaults = {};
  1592. api.remove = function( key, attributes ) {
  1593. // Clears keys with current path.
  1594. api(
  1595. key,
  1596. '',
  1597. $.extend( {}, attributes, {
  1598. expires: -1,
  1599. path: '',
  1600. } )
  1601. );
  1602. // Clears sitewide keys.
  1603. api(
  1604. key,
  1605. '',
  1606. $.extend( {}, attributes, {
  1607. expires: -1,
  1608. } )
  1609. );
  1610. };
  1611. /**
  1612. * Polyfill for jQuery Cookie argument arrangement.
  1613. *
  1614. * @param key
  1615. * @param value
  1616. * @param attributes || expires (deprecated)
  1617. * @param path (deprecated)
  1618. * @return {*}
  1619. */
  1620. api.process = function( key, value, attributes, path ) {
  1621. if (
  1622. arguments.length > 3 &&
  1623. typeof arguments[ 2 ] !== 'object' &&
  1624. value !== undefined
  1625. ) {
  1626. return api.apply( api, [
  1627. key,
  1628. value,
  1629. {
  1630. expires: attributes,
  1631. path: path,
  1632. },
  1633. ] );
  1634. }
  1635. return api.apply( api, [].slice.call( arguments, [ 0, 2 ] ) );
  1636. };
  1637. api.withConverter = $.fn.popmake.cookie;
  1638. return api;
  1639. }
  1640. $.extend( $.fn.popmake, {
  1641. cookie: cookie(),
  1642. } );
  1643. pm_cookie = $.pm_cookie = $.fn.popmake.cookie.process;
  1644. pm_cookie_json = $.pm_cookie_json = $.fn.popmake.cookie.getJSON;
  1645. pm_remove_cookie = $.pm_remove_cookie = $.fn.popmake.cookie.remove;
  1646. } )( jQuery );
  1647. ( function( $, document, undefined ) {
  1648. 'use strict';
  1649. var setCookie = function( settings ) {
  1650. $.pm_cookie(
  1651. settings.name,
  1652. true,
  1653. settings.session ? null : settings.time,
  1654. settings.path ? pum_vars.home_url || '/' : null
  1655. );
  1656. pum.hooks.doAction( 'popmake.setCookie', settings );
  1657. };
  1658. $.extend( $.fn.popmake.methods, {
  1659. addCookie: function( type ) {
  1660. // Method calling logic
  1661. pum.hooks.doAction( 'popmake.addCookie', arguments );
  1662. if ( $.fn.popmake.cookies[ type ] ) {
  1663. return $.fn.popmake.cookies[ type ].apply(
  1664. this,
  1665. Array.prototype.slice.call( arguments, 1 )
  1666. );
  1667. }
  1668. if ( window.console ) {
  1669. console.warn( 'Cookie type ' + type + ' does not exist.' );
  1670. }
  1671. return this;
  1672. },
  1673. setCookie: setCookie,
  1674. checkCookies: function( settings ) {
  1675. var i,
  1676. ret = false;
  1677. if (
  1678. settings.cookie_name === undefined ||
  1679. settings.cookie_name === null ||
  1680. settings.cookie_name === ''
  1681. ) {
  1682. return false;
  1683. }
  1684. switch ( typeof settings.cookie_name ) {
  1685. case 'object':
  1686. case 'array':
  1687. for ( i = 0; settings.cookie_name.length > i; i += 1 ) {
  1688. if (
  1689. $.pm_cookie( settings.cookie_name[ i ] ) !==
  1690. undefined
  1691. ) {
  1692. ret = true;
  1693. }
  1694. }
  1695. break;
  1696. case 'string':
  1697. if ( $.pm_cookie( settings.cookie_name ) !== undefined ) {
  1698. ret = true;
  1699. }
  1700. break;
  1701. }
  1702. pum.hooks.doAction( 'popmake.checkCookies', settings, ret );
  1703. return ret;
  1704. },
  1705. } );
  1706. $.fn.popmake.cookies = $.fn.popmake.cookies || {};
  1707. $.extend( $.fn.popmake.cookies, {
  1708. on_popup_open: function( settings ) {
  1709. var $popup = PUM.getPopup( this );
  1710. $popup.on( 'pumAfterOpen', function() {
  1711. $popup.popmake( 'setCookie', settings );
  1712. } );
  1713. },
  1714. on_popup_close: function( settings ) {
  1715. var $popup = PUM.getPopup( this );
  1716. $popup.on( 'pumBeforeClose', function() {
  1717. $popup.popmake( 'setCookie', settings );
  1718. } );
  1719. },
  1720. form_submission: function( settings ) {
  1721. var $popup = PUM.getPopup( this );
  1722. settings = $.extend(
  1723. {
  1724. form: '',
  1725. formInstanceId: '',
  1726. only_in_popup: false,
  1727. },
  1728. settings
  1729. );
  1730. PUM.hooks.addAction( 'pum.integration.form.success', function(
  1731. form,
  1732. args
  1733. ) {
  1734. if ( ! settings.form.length ) {
  1735. return;
  1736. }
  1737. if (
  1738. PUM.integrations.checkFormKeyMatches(
  1739. settings.form,
  1740. settings.formInstanceId,
  1741. args
  1742. )
  1743. ) {
  1744. if (
  1745. ( settings.only_in_popup &&
  1746. args.popup.length &&
  1747. args.popup.is( $popup ) ) ||
  1748. ! settings.only_in_popup
  1749. ) {
  1750. $popup.popmake( 'setCookie', settings );
  1751. }
  1752. }
  1753. } );
  1754. },
  1755. manual: function( settings ) {
  1756. var $popup = PUM.getPopup( this );
  1757. $popup.on( 'pumSetCookie', function() {
  1758. $popup.popmake( 'setCookie', settings );
  1759. } );
  1760. },
  1761. form_success: function( settings ) {
  1762. var $popup = PUM.getPopup( this );
  1763. $popup.on( 'pumFormSuccess', function() {
  1764. $popup.popmake( 'setCookie', settings );
  1765. } );
  1766. },
  1767. pum_sub_form_success: function( settings ) {
  1768. var $popup = PUM.getPopup( this );
  1769. $popup.find( 'form.pum-sub-form' ).on( 'success', function() {
  1770. $popup.popmake( 'setCookie', settings );
  1771. } );
  1772. },
  1773. /**
  1774. * @deprecated 1.7.0
  1775. *
  1776. * @param settings
  1777. */
  1778. pum_sub_form_already_subscribed: function( settings ) {
  1779. var $popup = PUM.getPopup( this );
  1780. $popup.find( 'form.pum-sub-form' ).on( 'success', function() {
  1781. $popup.popmake( 'setCookie', settings );
  1782. } );
  1783. },
  1784. ninja_form_success: function( settings ) {
  1785. return $.fn.popmake.cookies.form_success.apply( this, arguments );
  1786. },
  1787. cf7_form_success: function( settings ) {
  1788. return $.fn.popmake.cookies.form_success.apply( this, arguments );
  1789. },
  1790. gforms_form_success: function( settings ) {
  1791. return $.fn.popmake.cookies.form_success.apply( this, arguments );
  1792. },
  1793. } );
  1794. // Register All Cookies for a Popup
  1795. $( document )
  1796. .on( 'pumInit', '.pum', function() {
  1797. var $popup = PUM.getPopup( this ),
  1798. settings = $popup.popmake( 'getSettings' ),
  1799. cookies = settings.cookies || [],
  1800. cookie = null,
  1801. i;
  1802. if ( cookies.length ) {
  1803. for ( i = 0; cookies.length > i; i += 1 ) {
  1804. cookie = cookies[ i ];
  1805. $popup.popmake(
  1806. 'addCookie',
  1807. cookie.event,
  1808. cookie.settings
  1809. );
  1810. }
  1811. }
  1812. } );
  1813. // Initiate when ready.
  1814. $( function() {
  1815. var $cookies = $( '.pum-cookie' );
  1816. $cookies.each( function() {
  1817. var $cookie = $( this ),
  1818. index = $cookies.index( $cookie ),
  1819. args = $cookie.data( 'cookie-args' );
  1820. // If only-onscreen not set or false, set the cookie immediately.
  1821. if ( ! $cookie.data( 'only-onscreen' ) ) {
  1822. setCookie( args );
  1823. } else {
  1824. // If the element is visible on page load, set the cookie.
  1825. if ( $cookie.isInViewport() && $cookie.is( ':visible' ) ) {
  1826. setCookie( args );
  1827. } else {
  1828. // Add a throttled scroll listener, when its in view, set the cookie.
  1829. $( window ).on(
  1830. 'scroll.pum-cookie-' + index,
  1831. $.fn.popmake.utilities.throttle( function( event ) {
  1832. if (
  1833. $cookie.isInViewport() &&
  1834. $cookie.is( ':visible' )
  1835. ) {
  1836. setCookie( args );
  1837. $( window ).off(
  1838. 'scroll.pum-cookie-' + index
  1839. );
  1840. }
  1841. }, 100 )
  1842. );
  1843. }
  1844. }
  1845. } );
  1846. } )
  1847. } )( jQuery, document );
  1848. var pum_debug_mode = false,
  1849. pum_debug;
  1850. (function($, pum_vars) {
  1851. pum_vars = window.pum_vars || {
  1852. debug_mode: false
  1853. };
  1854. pum_debug_mode = pum_vars.debug_mode !== undefined && pum_vars.debug_mode;
  1855. // Force Debug Mode when the ?pum_debug query arg is present.
  1856. if (!pum_debug_mode && window.location.href.indexOf("pum_debug") !== -1) {
  1857. pum_debug_mode = true;
  1858. }
  1859. if (pum_debug_mode) {
  1860. var inited = false,
  1861. current_popup_event = false,
  1862. vars = window.pum_debug_vars || {
  1863. debug_mode_enabled: "Popup Maker: Debug Mode Enabled",
  1864. debug_started_at: "Debug started at:",
  1865. debug_more_info:
  1866. "For more information on how to use this information visit https://docs.wppopupmaker.com/?utm_medium=js-debug-info&utm_campaign=contextual-help&utm_source=browser-console&utm_content=more-info",
  1867. global_info: "Global Information",
  1868. localized_vars: "Localized variables",
  1869. popups_initializing: "Popups Initializing",
  1870. popups_initialized: "Popups Initialized",
  1871. single_popup_label: "Popup: #",
  1872. theme_id: "Theme ID: ",
  1873. label_method_call: "Method Call:",
  1874. label_method_args: "Method Arguments:",
  1875. label_popup_settings: "Settings",
  1876. label_triggers: "Triggers",
  1877. label_cookies: "Cookies",
  1878. label_delay: "Delay:",
  1879. label_conditions: "Conditions",
  1880. label_cookie: "Cookie:",
  1881. label_settings: "Settings:",
  1882. label_selector: "Selector:",
  1883. label_mobile_disabled: "Mobile Disabled:",
  1884. label_tablet_disabled: "Tablet Disabled:",
  1885. label_event: "Event: %s",
  1886. triggers: [],
  1887. cookies: []
  1888. };
  1889. pum_debug = {
  1890. odump: function(o) {
  1891. return $.extend({}, o);
  1892. },
  1893. logo: function() {
  1894. console.log(
  1895. "" +
  1896. " -------------------------------------------------------------" +
  1897. "\n" +
  1898. "| ____ __ __ _ |" +
  1899. "\n" +
  1900. "| | _ \\ ___ _ __ _ _ _ __ | \\/ | __ _| | _____ _ __ |" +
  1901. "\n" +
  1902. "| | |_) / _ \\| '_ \\| | | | '_ \\ | |\\/| |/ _` | |/ / _ \\ '__| |" +
  1903. "\n" +
  1904. "| | __/ (_) | |_) | |_| | |_) | | | | | (_| | < __/ | |" +
  1905. "\n" +
  1906. "| |_| \\___/| .__/ \\__,_| .__/ |_| |_|\\__,_|_|\\_\\___|_| |" +
  1907. "\n" +
  1908. "| |_| |_| |" +
  1909. "\n" +
  1910. " -------------------------------------------------------------"
  1911. );
  1912. },
  1913. initialize: function() {
  1914. inited = true;
  1915. // Clear Console
  1916. //console.clear();
  1917. // Render Logo
  1918. pum_debug.logo();
  1919. console.debug(vars.debug_mode_enabled);
  1920. console.log(vars.debug_started_at, new Date());
  1921. console.info(vars.debug_more_info);
  1922. // Global Info Divider
  1923. pum_debug.divider(vars.global_info);
  1924. // Localized Variables
  1925. console.groupCollapsed(vars.localized_vars);
  1926. console.log("pum_vars:", pum_debug.odump(pum_vars));
  1927. $(document).trigger("pum_debug_initialize_localized_vars");
  1928. console.groupEnd();
  1929. // Trigger to add more debug info from extensions.
  1930. $(document).trigger("pum_debug_initialize");
  1931. },
  1932. popup_event_header: function($popup) {
  1933. var settings = $popup.popmake("getSettings");
  1934. if (current_popup_event === settings.id) {
  1935. return;
  1936. }
  1937. current_popup_event = settings.id;
  1938. pum_debug.divider(
  1939. vars.single_popup_label +
  1940. settings.id +
  1941. " - " +
  1942. settings.slug
  1943. );
  1944. },
  1945. divider: function(heading) {
  1946. var totalWidth = 62,
  1947. extraSpace = 62,
  1948. padding = 0,
  1949. line = " " + new Array(totalWidth + 1).join("-") + " ";
  1950. if (typeof heading === "string") {
  1951. extraSpace = totalWidth - heading.length;
  1952. padding = {
  1953. left: Math.floor(extraSpace / 2),
  1954. right: Math.floor(extraSpace / 2)
  1955. };
  1956. if (padding.left + padding.right === extraSpace - 1) {
  1957. padding.right++;
  1958. }
  1959. padding.left = new Array(padding.left + 1).join(" ");
  1960. padding.right = new Array(padding.right + 1).join(" ");
  1961. console.log(
  1962. "" +
  1963. line +
  1964. "\n" +
  1965. "|" +
  1966. padding.left +
  1967. heading +
  1968. padding.right +
  1969. "|" +
  1970. "\n" +
  1971. line
  1972. );
  1973. } else {
  1974. console.log(line);
  1975. }
  1976. },
  1977. click_trigger: function($popup, trigger_settings) {
  1978. var settings = $popup.popmake("getSettings"),
  1979. trigger_selectors = [
  1980. ".popmake-" + settings.id,
  1981. ".popmake-" + decodeURIComponent(settings.slug),
  1982. 'a[href$="#popmake-' + settings.id + '"]'
  1983. ],
  1984. trigger_selector;
  1985. if (
  1986. trigger_settings.extra_selectors &&
  1987. trigger_settings.extra_selectors !== ""
  1988. ) {
  1989. trigger_selectors.push(trigger_settings.extra_selectors);
  1990. }
  1991. trigger_selectors = pum.hooks.applyFilters(
  1992. "pum.trigger.click_open.selectors",
  1993. trigger_selectors,
  1994. trigger_settings,
  1995. $popup
  1996. );
  1997. trigger_selector = trigger_selectors.join(", ");
  1998. console.log(vars.label_selector, trigger_selector);
  1999. },
  2000. trigger: function($popup, trigger) {
  2001. if (typeof vars.triggers[trigger.type] === "string") {
  2002. console.groupCollapsed(vars.triggers[trigger.type]);
  2003. switch (trigger.type) {
  2004. case "auto_open":
  2005. console.log(
  2006. vars.label_delay,
  2007. trigger.settings.delay
  2008. );
  2009. console.log(
  2010. vars.label_cookie,
  2011. trigger.settings.cookie_name
  2012. );
  2013. break;
  2014. case "click_open":
  2015. pum_debug.click_trigger($popup, trigger.settings);
  2016. console.log(
  2017. vars.label_cookie,
  2018. trigger.settings.cookie_name
  2019. );
  2020. break;
  2021. }
  2022. $(document).trigger(
  2023. "pum_debug_render_trigger",
  2024. $popup,
  2025. trigger
  2026. );
  2027. console.groupEnd();
  2028. }
  2029. },
  2030. cookie: function($popup, cookie) {
  2031. if (typeof vars.cookies[cookie.event] === "string") {
  2032. console.groupCollapsed(vars.cookies[cookie.event]);
  2033. switch (cookie.event) {
  2034. case "on_popup_open":
  2035. case "on_popup_close":
  2036. case "manual":
  2037. case "ninja_form_success":
  2038. console.log(
  2039. vars.label_cookie,
  2040. pum_debug.odump(cookie.settings)
  2041. );
  2042. break;
  2043. }
  2044. $(document).trigger(
  2045. "pum_debug_render_trigger",
  2046. $popup,
  2047. cookie
  2048. );
  2049. console.groupEnd();
  2050. }
  2051. }
  2052. };
  2053. $(document)
  2054. .on("pumInit", ".pum", function() {
  2055. var $popup = PUM.getPopup($(this)),
  2056. settings = $popup.popmake("getSettings"),
  2057. triggers = settings.triggers || [],
  2058. cookies = settings.cookies || [],
  2059. conditions = settings.conditions || [],
  2060. i = 0;
  2061. if (!inited) {
  2062. pum_debug.initialize();
  2063. pum_debug.divider(vars.popups_initializing);
  2064. }
  2065. console.groupCollapsed(
  2066. vars.single_popup_label +
  2067. settings.id +
  2068. " - " +
  2069. settings.slug
  2070. );
  2071. // Popup Theme ID
  2072. console.log(vars.theme_id, settings.theme_id);
  2073. // Triggers
  2074. if (triggers.length) {
  2075. console.groupCollapsed(vars.label_triggers);
  2076. for (i = 0; triggers.length > i; i++) {
  2077. pum_debug.trigger($popup, triggers[i]);
  2078. }
  2079. console.groupEnd();
  2080. }
  2081. // Cookies
  2082. if (cookies.length) {
  2083. console.groupCollapsed(vars.label_cookies);
  2084. for (i = 0; cookies.length > i; i += 1) {
  2085. pum_debug.cookie($popup, cookies[i]);
  2086. }
  2087. console.groupEnd();
  2088. }
  2089. // Conditions
  2090. if (conditions.length) {
  2091. console.groupCollapsed(vars.label_conditions);
  2092. console.log(conditions);
  2093. console.groupEnd();
  2094. }
  2095. console.groupCollapsed(vars.label_popup_settings);
  2096. // Mobile Disabled.
  2097. console.log(
  2098. vars.label_mobile_disabled,
  2099. settings.disable_on_mobile !== false
  2100. );
  2101. // Tablet Disabled.
  2102. console.log(
  2103. vars.label_tablet_disabled,
  2104. settings.disable_on_tablet !== false
  2105. );
  2106. // Settings.
  2107. console.log(
  2108. vars.label_display_settings,
  2109. pum_debug.odump(settings)
  2110. );
  2111. // Trigger to add more debug info from extensions.
  2112. $popup.trigger("pum_debug_popup_settings");
  2113. console.groupEnd();
  2114. console.groupEnd();
  2115. })
  2116. .on("pumBeforeOpen", ".pum", function() {
  2117. var $popup = PUM.getPopup($(this)),
  2118. $last_trigger = $.fn.popmake.last_open_trigger;
  2119. pum_debug.popup_event_header($popup);
  2120. console.groupCollapsed(
  2121. vars.label_event.replace("%s", "pumBeforeOpen")
  2122. );
  2123. try {
  2124. $last_trigger = $($.fn.popmake.last_open_trigger);
  2125. $last_trigger = $last_trigger.length
  2126. ? $last_trigger
  2127. : $.fn.popmake.last_open_trigger.toString();
  2128. } catch (error) {
  2129. $last_trigger = "";
  2130. } finally {
  2131. console.log(vars.label_triggers, [$last_trigger]);
  2132. }
  2133. console.groupEnd();
  2134. })
  2135. .on("pumOpenPrevented", ".pum", function() {
  2136. var $popup = PUM.getPopup($(this));
  2137. pum_debug.popup_event_header($popup);
  2138. console.groupCollapsed(
  2139. vars.label_event.replace("%s", "pumOpenPrevented")
  2140. );
  2141. console.groupEnd();
  2142. })
  2143. .on("pumAfterOpen", ".pum", function() {
  2144. var $popup = PUM.getPopup($(this));
  2145. pum_debug.popup_event_header($popup);
  2146. console.groupCollapsed(
  2147. vars.label_event.replace("%s", "pumAfterOpen")
  2148. );
  2149. console.groupEnd();
  2150. })
  2151. .on("pumSetupClose", ".pum", function() {
  2152. var $popup = PUM.getPopup($(this));
  2153. pum_debug.popup_event_header($popup);
  2154. console.groupCollapsed(
  2155. vars.label_event.replace("%s", "pumSetupClose")
  2156. );
  2157. console.groupEnd();
  2158. })
  2159. .on("pumClosePrevented", ".pum", function() {
  2160. var $popup = PUM.getPopup($(this));
  2161. pum_debug.popup_event_header($popup);
  2162. console.groupCollapsed(
  2163. vars.label_event.replace("%s", "pumClosePrevented")
  2164. );
  2165. console.groupEnd();
  2166. })
  2167. .on("pumBeforeClose", ".pum", function() {
  2168. var $popup = PUM.getPopup($(this));
  2169. pum_debug.popup_event_header($popup);
  2170. console.groupCollapsed(
  2171. vars.label_event.replace("%s", "pumBeforeClose")
  2172. );
  2173. console.groupEnd();
  2174. })
  2175. .on("pumAfterClose", ".pum", function() {
  2176. var $popup = PUM.getPopup($(this));
  2177. pum_debug.popup_event_header($popup);
  2178. console.groupCollapsed(
  2179. vars.label_event.replace("%s", "pumAfterClose")
  2180. );
  2181. console.groupEnd();
  2182. })
  2183. .on("pumBeforeReposition", ".pum", function() {
  2184. var $popup = PUM.getPopup($(this));
  2185. pum_debug.popup_event_header($popup);
  2186. console.groupCollapsed(
  2187. vars.label_event.replace("%s", "pumBeforeReposition")
  2188. );
  2189. console.groupEnd();
  2190. })
  2191. .on("pumAfterReposition", ".pum", function() {
  2192. var $popup = PUM.getPopup($(this));
  2193. pum_debug.popup_event_header($popup);
  2194. console.groupCollapsed(
  2195. vars.label_event.replace("%s", "pumAfterReposition")
  2196. );
  2197. console.groupEnd();
  2198. })
  2199. .on("pumCheckingCondition", ".pum", function(
  2200. event,
  2201. result,
  2202. condition
  2203. ) {
  2204. var $popup = PUM.getPopup($(this));
  2205. pum_debug.popup_event_header($popup);
  2206. console.groupCollapsed(
  2207. vars.label_event.replace("%s", "pumCheckingCondition")
  2208. );
  2209. console.log(
  2210. (condition.not_operand ? "(!) " : "") +
  2211. condition.target +
  2212. ": " +
  2213. result,
  2214. condition
  2215. );
  2216. console.groupEnd();
  2217. });
  2218. }
  2219. })(jQuery);
  2220. /**
  2221. * Defines the core $.popmake defaults.
  2222. * Version 1.4
  2223. */
  2224. (function ($, document, undefined) {
  2225. "use strict";
  2226. $.fn.popmake.defaults = {
  2227. id: null,
  2228. slug: "",
  2229. theme_id: null,
  2230. cookies: [],
  2231. triggers: [],
  2232. conditions: [],
  2233. mobile_disabled: null,
  2234. tablet_disabled: null,
  2235. custom_height_auto: false,
  2236. scrollable_content: false,
  2237. position_from_trigger: false,
  2238. position_fixed: false,
  2239. overlay_disabled: false,
  2240. stackable: false,
  2241. disable_reposition: false,
  2242. close_on_overlay_click: false,
  2243. close_on_form_submission: false,
  2244. close_on_form_submission_delay: 0,
  2245. close_on_esc_press: false,
  2246. close_on_f4_press: false,
  2247. disable_on_mobile: false,
  2248. disable_on_tablet: false,
  2249. size: "medium",
  2250. responsive_min_width: "0%",
  2251. responsive_max_width: "100%",
  2252. custom_width: "640px",
  2253. custom_height: "380px",
  2254. animation_type: "fade",
  2255. animation_speed: "350",
  2256. animation_origin: "center top",
  2257. location: "center top",
  2258. position_top: "100",
  2259. position_bottom: "0",
  2260. position_left: "0",
  2261. position_right: "0",
  2262. zindex: "1999999999",
  2263. close_button_delay: "0",
  2264. // TODO Remove these once extensions have all been updated.
  2265. meta: {
  2266. display: {
  2267. stackable: false,
  2268. overlay_disabled: false,
  2269. size: "medium",
  2270. responsive_max_width: "100",
  2271. responsive_max_width_unit: '%',
  2272. responsive_min_width: "0",
  2273. responsive_min_width_unit: '%',
  2274. custom_width: "640",
  2275. custom_width_unit: 'px',
  2276. custom_height: "380",
  2277. custom_height_unit: 'px',
  2278. custom_height_auto: false,
  2279. location: "center top",
  2280. position_top: 100,
  2281. position_left: 0,
  2282. position_bottom: 0,
  2283. position_right: 0,
  2284. position_fixed: false,
  2285. animation_type: 'fade',
  2286. animation_speed: 350,
  2287. animation_origin: 'center top',
  2288. scrollable_content: false,
  2289. disable_reposition: false,
  2290. position_from_trigger: false,
  2291. overlay_zindex: false,
  2292. zindex: "1999999999"
  2293. },
  2294. close: {
  2295. overlay_click: false,
  2296. esc_press: false,
  2297. f4_press: false,
  2298. text: "",
  2299. button_delay: 0
  2300. },
  2301. click_open: []
  2302. },
  2303. container: {
  2304. active_class: 'active',
  2305. attr: {
  2306. class: "popmake"
  2307. }
  2308. },
  2309. title: {
  2310. attr: {
  2311. class: "popmake-title"
  2312. }
  2313. },
  2314. content: {
  2315. attr: {
  2316. class: "popmake-content"
  2317. }
  2318. },
  2319. close: {
  2320. close_speed: 0,
  2321. attr: {
  2322. class: "popmake-close"
  2323. }
  2324. },
  2325. overlay: {
  2326. attr: {
  2327. id: "popmake-overlay",
  2328. class: "popmake-overlay"
  2329. }
  2330. }
  2331. };
  2332. }(jQuery, document));
  2333. /*******************************************************************************
  2334. * Copyright (c) 2019, Code Atlantic LLC
  2335. ******************************************************************************/
  2336. (function ($) {
  2337. "use strict";
  2338. var defaults = {
  2339. openpopup: false,
  2340. openpopup_id: 0,
  2341. closepopup: false,
  2342. closedelay: 0,
  2343. redirect_enabled: false,
  2344. redirect: '',
  2345. cookie: false
  2346. };
  2347. window.PUM = window.PUM || {};
  2348. window.PUM.forms = window.PUM.forms || {};
  2349. $.extend(window.PUM.forms, {
  2350. form: {
  2351. validation: {
  2352. errors: []
  2353. },
  2354. responseHandler: function ($form, response) {
  2355. var data = response.data;
  2356. if (response.success) {
  2357. /**
  2358. * If there are no errors process the successful submission.
  2359. */
  2360. window.PUM.forms.form.success($form, data);
  2361. } else {
  2362. /**
  2363. * Process any errors
  2364. */
  2365. window.PUM.forms.form.errors($form, data);
  2366. }
  2367. },
  2368. display_errors: function ($form, errors) {
  2369. window.PUM.forms.messages.add($form, errors || this.validation.errors, 'error');
  2370. },
  2371. beforeAjax: function ($form) {
  2372. var $btn = $form.find('[type="submit"]'),
  2373. $loading = $btn.find('.pum-form__loader');
  2374. window.PUM.forms.messages.clear_all($form);
  2375. if (!$loading.length) {
  2376. $loading = $('<span class="pum-form__loader"></span>');
  2377. if ($btn.attr('value') !== '') {
  2378. $loading.insertAfter($btn);
  2379. } else {
  2380. $btn.append($loading);
  2381. }
  2382. }
  2383. $btn.prop('disabled', true);
  2384. $loading.show();
  2385. $form
  2386. .addClass('pum-form--loading')
  2387. .removeClass('pum-form--errors');
  2388. },
  2389. afterAjax: function ($form) {
  2390. var $btn = $form.find('[type="submit"]'),
  2391. $loading = $btn.find('.pum-form__loader');
  2392. $btn.prop('disabled', false);
  2393. $loading.hide();
  2394. $form.removeClass('pum-form--loading');
  2395. },
  2396. success: function ($form, data) {
  2397. if (data.message !== undefined && data.message !== '') {
  2398. window.PUM.forms.messages.add($form, [{message: data.message}]);
  2399. }
  2400. $form.trigger('success', [data]);
  2401. if (!$form.data('noredirect') && $form.data('redirect_enabled') !== undefined && data.redirect) {
  2402. if (data.redirect !== '') {
  2403. window.location = data.redirect;
  2404. } else {
  2405. window.location.reload(true);
  2406. }
  2407. }
  2408. },
  2409. errors: function ($form, data) {
  2410. if (data.errors !== undefined && data.errors.length) {
  2411. console.log(data.errors);
  2412. window.PUM.forms.form.display_errors($form, data.errors);
  2413. window.PUM.forms.messages.scroll_to_first($form);
  2414. $form
  2415. .addClass('pum-form--errors')
  2416. .trigger('errors', [data]);
  2417. }
  2418. },
  2419. submit: function (event) {
  2420. var $form = $(this),
  2421. values = $form.pumSerializeObject();
  2422. event.preventDefault();
  2423. event.stopPropagation();
  2424. window.PUM.forms.form.beforeAjax($form);
  2425. $.ajax({
  2426. type: 'POST',
  2427. dataType: 'json',
  2428. url: pum_vars.ajaxurl,
  2429. data: {
  2430. action: 'pum_form',
  2431. values: values
  2432. }
  2433. })
  2434. .always(function () {
  2435. window.PUM.forms.form.afterAjax($form);
  2436. })
  2437. .done(function (response) {
  2438. window.PUM.forms.form.responseHandler($form, response);
  2439. })
  2440. .error(function (jqXHR, textStatus, errorThrown) {
  2441. console.log('Error: type of ' + textStatus + ' with message of ' + errorThrown);
  2442. });
  2443. }
  2444. },
  2445. /**
  2446. * Functions to manage form messages.
  2447. */
  2448. messages: {
  2449. /**
  2450. * Process & add messages to a form.
  2451. *
  2452. * @param $form
  2453. * @param messages
  2454. * @param type
  2455. */
  2456. add: function ($form, messages, type) {
  2457. var $messages = $form.find('.pum-form__messages'),
  2458. i = 0;
  2459. type = type || 'success';
  2460. messages = messages || [];
  2461. if (!$messages.length) {
  2462. $messages = $('<div class="pum-form__messages">').hide();
  2463. switch (pum_vars.message_position) {
  2464. case 'bottom':
  2465. $form.append($messages.addClass('pum-form__messages--bottom'));
  2466. break;
  2467. case 'top':
  2468. $form.prepend($messages.addClass('pum-form__messages--top'));
  2469. break;
  2470. }
  2471. }
  2472. if (['bottom', 'top'].indexOf(pum_vars.message_position) >= 0) {
  2473. for (; messages.length > i; i++) {
  2474. this.add_message($messages, messages[i].message, type);
  2475. }
  2476. } else {
  2477. /**
  2478. * Per Field Messaging
  2479. */
  2480. for (; messages.length > i; i++) {
  2481. if (messages[i].field !== undefined) {
  2482. this.add_field_error($form, messages[i]);
  2483. } else {
  2484. this.add_message($messages, messages[i].message, type);
  2485. }
  2486. }
  2487. }
  2488. if ($messages.is(':hidden') && $('.pum-form__message', $messages).length) {
  2489. $messages.slideDown();
  2490. }
  2491. },
  2492. add_message: function ($container, message, type) {
  2493. var $message = $('<p class="pum-form__message">').html(message);
  2494. type = type || 'success';
  2495. $message.addClass('pum-form__message--' + type);
  2496. $container.append($message);
  2497. if ($container.is(':visible')) {
  2498. $message.hide().slideDown();
  2499. }
  2500. },
  2501. add_field_error: function ($form, error) {
  2502. var $field = $('[name="' + error.field + '"]', $form),
  2503. $wrapper = $field.parents('.pum-form__field').addClass('pum-form__field--error');
  2504. this.add_message($wrapper, error.message, 'error');
  2505. },
  2506. clear_all: function ($form, hide) {
  2507. var $messages = $form.find('.pum-form__messages'),
  2508. messages = $messages.find('.pum-form__message'),
  2509. $errors = $form.find('.pum-form__field.pum-form__field--error');
  2510. hide = hide || false;
  2511. // Remove forms main messages container.
  2512. if ($messages.length) {
  2513. messages.slideUp('fast', function () {
  2514. $(this).remove();
  2515. if (hide) {
  2516. $messages.hide();
  2517. }
  2518. });
  2519. }
  2520. // Remove per field messages.
  2521. if ($errors.length) {
  2522. $errors.removeClass('pum-form__field--error').find('p.pum-form__message').remove();
  2523. }
  2524. },
  2525. scroll_to_first: function ($form) {
  2526. window.PUM.utilities.scrollTo($('.pum-form__field.pum-form__field--error', $form).eq(0));
  2527. }
  2528. },
  2529. /**
  2530. * Used to process success actions for forms inside popups.
  2531. *
  2532. * @param $form
  2533. * @param settings
  2534. */
  2535. success: function ($form, settings) {
  2536. settings = $.extend({}, defaults, settings);
  2537. if (!settings) {
  2538. return;
  2539. }
  2540. var $parentPopup = PUM.getPopup($form),
  2541. cookie = {},
  2542. redirect = function () {
  2543. if (settings.redirect_enabled) {
  2544. if (settings.redirect !== '') {
  2545. // Redirect to the destination url.
  2546. window.location = settings.redirect;
  2547. } else {
  2548. // Refresh with force true.
  2549. window.location.reload(true);
  2550. }
  2551. }
  2552. },
  2553. callback = function () {
  2554. if (settings.openpopup && PUM.getPopup(settings.openpopup_id).length) {
  2555. PUM.open(settings.openpopup_id);
  2556. } else {
  2557. redirect();
  2558. }
  2559. };
  2560. if ($parentPopup.length) {
  2561. $parentPopup.trigger('pumFormSuccess');
  2562. if (settings.cookie) {
  2563. cookie = $.extend({
  2564. name: 'pum-' + PUM.getSetting($parentPopup, 'id'),
  2565. expires: '+1 year'
  2566. }, typeof settings.cookie === 'object' ? settings.cookie : {});
  2567. // Set a cookie
  2568. PUM.setCookie($parentPopup, cookie);
  2569. }
  2570. }
  2571. if ($parentPopup.length && settings.closepopup) {
  2572. setTimeout(function () {
  2573. $parentPopup.popmake('close', callback);
  2574. }, parseInt(settings.closedelay) * 1000);
  2575. } else {
  2576. callback();
  2577. }
  2578. }
  2579. });
  2580. }(jQuery));
  2581. (function (window, undefined) {
  2582. 'use strict';
  2583. /**
  2584. * Handles managing all events for whatever you plug it into. Priorities for hooks are based on lowest to highest in
  2585. * that, lowest priority hooks are fired first.
  2586. */
  2587. var EventManager = function () {
  2588. var slice = Array.prototype.slice;
  2589. /**
  2590. * Maintain a reference to the object scope so our public methods never get confusing.
  2591. */
  2592. var MethodsAvailable = {
  2593. removeFilter: removeFilter,
  2594. applyFilters: applyFilters,
  2595. addFilter: addFilter,
  2596. removeAction: removeAction,
  2597. doAction: doAction,
  2598. addAction: addAction
  2599. };
  2600. /**
  2601. * Contains the hooks that get registered with this EventManager. The array for storage utilizes a "flat"
  2602. * object literal such that looking up the hook utilizes the native object literal hash.
  2603. */
  2604. var STORAGE = {
  2605. actions: {},
  2606. filters: {}
  2607. };
  2608. /**
  2609. * Adds an action to the event manager.
  2610. *
  2611. * @param action Must contain namespace.identifier
  2612. * @param callback Must be a valid callback function before this action is added
  2613. * @param [priority=10] Used to control when the function is executed in relation to other callbacks bound to the same hook
  2614. * @param [context] Supply a value to be used for this
  2615. */
  2616. function addAction(action, callback, priority, context) {
  2617. if (typeof action === 'string' && typeof callback === 'function') {
  2618. priority = parseInt((priority || 10), 10);
  2619. _addHook('actions', action, callback, priority, context);
  2620. }
  2621. return MethodsAvailable;
  2622. }
  2623. /**
  2624. * Performs an action if it exists. You can pass as many arguments as you want to this function; the only rule is
  2625. * that the first argument must always be the action.
  2626. */
  2627. function doAction(/* action, arg1, arg2, ... */) {
  2628. var args = slice.call(arguments);
  2629. var action = args.shift();
  2630. if (typeof action === 'string') {
  2631. _runHook('actions', action, args);
  2632. }
  2633. return MethodsAvailable;
  2634. }
  2635. /**
  2636. * Removes the specified action if it contains a namespace.identifier & exists.
  2637. *
  2638. * @param action The action to remove
  2639. * @param [callback] Callback function to remove
  2640. */
  2641. function removeAction(action, callback) {
  2642. if (typeof action === 'string') {
  2643. _removeHook('actions', action, callback);
  2644. }
  2645. return MethodsAvailable;
  2646. }
  2647. /**
  2648. * Adds a filter to the event manager.
  2649. *
  2650. * @param filter Must contain namespace.identifier
  2651. * @param callback Must be a valid callback function before this action is added
  2652. * @param [priority=10] Used to control when the function is executed in relation to other callbacks bound to the same hook
  2653. * @param [context] Supply a value to be used for this
  2654. */
  2655. function addFilter(filter, callback, priority, context) {
  2656. if (typeof filter === 'string' && typeof callback === 'function') {
  2657. priority = parseInt((priority || 10), 10);
  2658. _addHook('filters', filter, callback, priority, context);
  2659. }
  2660. return MethodsAvailable;
  2661. }
  2662. /**
  2663. * Performs a filter if it exists. You should only ever pass 1 argument to be filtered. The only rule is that
  2664. * the first argument must always be the filter.
  2665. */
  2666. function applyFilters(/* filter, filtered arg, arg2, ... */) {
  2667. var args = slice.call(arguments);
  2668. var filter = args.shift();
  2669. if (typeof filter === 'string') {
  2670. return _runHook('filters', filter, args);
  2671. }
  2672. return MethodsAvailable;
  2673. }
  2674. /**
  2675. * Removes the specified filter if it contains a namespace.identifier & exists.
  2676. *
  2677. * @param filter The action to remove
  2678. * @param [callback] Callback function to remove
  2679. */
  2680. function removeFilter(filter, callback) {
  2681. if (typeof filter === 'string') {
  2682. _removeHook('filters', filter, callback);
  2683. }
  2684. return MethodsAvailable;
  2685. }
  2686. /**
  2687. * Removes the specified hook by resetting the value of it.
  2688. *
  2689. * @param type Type of hook, either 'actions' or 'filters'
  2690. * @param hook The hook (namespace.identifier) to remove
  2691. * @private
  2692. */
  2693. function _removeHook(type, hook, callback, context) {
  2694. var handlers, handler, i;
  2695. if (!STORAGE[type][hook]) {
  2696. return;
  2697. }
  2698. if (!callback) {
  2699. STORAGE[type][hook] = [];
  2700. } else {
  2701. handlers = STORAGE[type][hook];
  2702. if (!context) {
  2703. for (i = handlers.length; i--;) {
  2704. if (handlers[i].callback === callback) {
  2705. handlers.splice(i, 1);
  2706. }
  2707. }
  2708. }
  2709. else {
  2710. for (i = handlers.length; i--;) {
  2711. handler = handlers[i];
  2712. if (handler.callback === callback && handler.context === context) {
  2713. handlers.splice(i, 1);
  2714. }
  2715. }
  2716. }
  2717. }
  2718. }
  2719. /**
  2720. * Adds the hook to the appropriate storage container
  2721. *
  2722. * @param type 'actions' or 'filters'
  2723. * @param hook The hook (namespace.identifier) to add to our event manager
  2724. * @param callback The function that will be called when the hook is executed.
  2725. * @param priority The priority of this hook. Must be an integer.
  2726. * @param [context] A value to be used for this
  2727. * @private
  2728. */
  2729. function _addHook(type, hook, callback, priority, context) {
  2730. var hookObject = {
  2731. callback: callback,
  2732. priority: priority,
  2733. context: context
  2734. };
  2735. // Utilize 'prop itself' : http://jsperf.com/hasownproperty-vs-in-vs-undefined/19
  2736. var hooks = STORAGE[type][hook];
  2737. if (hooks) {
  2738. hooks.push(hookObject);
  2739. hooks = _hookInsertSort(hooks);
  2740. }
  2741. else {
  2742. hooks = [hookObject];
  2743. }
  2744. STORAGE[type][hook] = hooks;
  2745. }
  2746. /**
  2747. * Use an insert sort for keeping our hooks organized based on priority. This function is ridiculously faster
  2748. * than bubble sort, etc: http://jsperf.com/javascript-sort
  2749. *
  2750. * @param hooks The custom array containing all of the appropriate hooks to perform an insert sort on.
  2751. * @private
  2752. */
  2753. function _hookInsertSort(hooks) {
  2754. var tmpHook, j, prevHook;
  2755. for (var i = 1, len = hooks.length; i < len; i++) {
  2756. tmpHook = hooks[i];
  2757. j = i;
  2758. while ((prevHook = hooks[j - 1]) && prevHook.priority > tmpHook.priority) {
  2759. hooks[j] = hooks[j - 1];
  2760. --j;
  2761. }
  2762. hooks[j] = tmpHook;
  2763. }
  2764. return hooks;
  2765. }
  2766. /**
  2767. * Runs the specified hook. If it is an action, the value is not modified but if it is a filter, it is.
  2768. *
  2769. * @param type 'actions' or 'filters'
  2770. * @param hook The hook ( namespace.identifier ) to be ran.
  2771. * @param args Arguments to pass to the action/filter. If it's a filter, args is actually a single parameter.
  2772. * @private
  2773. */
  2774. function _runHook(type, hook, args) {
  2775. var handlers = STORAGE[type][hook], i, len;
  2776. if (!handlers) {
  2777. return (type === 'filters') ? args[0] : false;
  2778. }
  2779. len = handlers.length;
  2780. if (type === 'filters') {
  2781. for (i = 0; i < len; i++) {
  2782. args[0] = handlers[i].callback.apply(handlers[i].context, args);
  2783. }
  2784. } else {
  2785. for (i = 0; i < len; i++) {
  2786. handlers[i].callback.apply(handlers[i].context, args);
  2787. }
  2788. }
  2789. return (type === 'filters') ? args[0] : true;
  2790. }
  2791. // return all of the publicly available methods
  2792. return MethodsAvailable;
  2793. };
  2794. window.pum = window.pum || {};
  2795. window.pum.hooks = window.pum.hooks || new EventManager();
  2796. window.PUM = window.PUM || {};
  2797. window.PUM.hooks = window.pum.hooks;
  2798. })(window);
  2799. /*******************************************************************************
  2800. * Copyright (c) 2019, Code Atlantic LLC
  2801. ******************************************************************************/
  2802. (function ($) {
  2803. "use strict";
  2804. window.PUM = window.PUM || {};
  2805. window.PUM.integrations = window.PUM.integrations || {};
  2806. function filterNull(x) {
  2807. return x;
  2808. }
  2809. $.extend(window.PUM.integrations, {
  2810. init: function () {
  2811. if ("undefined" !== typeof pum_vars.form_submission) {
  2812. var submission = pum_vars.form_submission;
  2813. // Declare these are not AJAX submissions.
  2814. submission.ajax = false;
  2815. // Initialize the popup var based on passed popup ID.
  2816. submission.popup = submission.popupId > 0 ? PUM.getPopup(submission.popupId) : null;
  2817. PUM.integrations.formSubmission(null, submission);
  2818. }
  2819. },
  2820. /**
  2821. * This hook fires after any integrated form is submitted successfully.
  2822. *
  2823. * It does not matter if the form is in a popup or not.
  2824. *
  2825. * @since 1.9.0
  2826. *
  2827. * @param {Object} form JavaScript DOM node or jQuery object for the form submitted
  2828. * @param {Object} args {
  2829. * @type {string} formProvider Such as gravityforms or ninjaforms
  2830. * @type {string|int} formId Usually an integer ID number such as 1
  2831. * @type {int} formInstanceId Not all form plugins support this.
  2832. * }
  2833. */
  2834. formSubmission: function (form, args) {
  2835. args = $.extend({
  2836. popup: PUM.getPopup(form),
  2837. formProvider: null,
  2838. formId: null,
  2839. formInstanceId: null,
  2840. formKey: null,
  2841. ajax: true, // Allows detecting submissions that may have already been counted.
  2842. tracked: false
  2843. }, args);
  2844. // Generate unique formKey identifier.
  2845. args.formKey = args.formKey || [args.formProvider, args.formId, args.formInstanceId].filter(filterNull).join('_');
  2846. if (args.popup && args.popup.length) {
  2847. args.popupId = PUM.getSetting(args.popup, 'id');
  2848. // Should this be here. It is the only thing not replicated by a new form trigger & cookie.
  2849. // $popup.trigger('pumFormSuccess');
  2850. }
  2851. /**
  2852. * This hook fires after any integrated form is submitted successfully.
  2853. *
  2854. * It does not matter if the form is in a popup or not.
  2855. *
  2856. * @since 1.9.0
  2857. *
  2858. * @param {Object} form JavaScript DOM node or jQuery object for the form submitted
  2859. * @param {Object} args {
  2860. * @type {string} formProvider Such as gravityforms or ninjaforms
  2861. * @type {string|int} formId Usually an integer ID number such as 1
  2862. * @type {int} formInstanceId Not all form plugins support this.
  2863. * @type {string} formKey Concatenation of provider, ID & Instance ID.
  2864. * @type {int} popupId The ID of the popup the form was in.
  2865. * @type {Object} popup Usable jQuery object for the popup.
  2866. * }
  2867. */
  2868. window.PUM.hooks.doAction('pum.integration.form.success', form, args);
  2869. },
  2870. checkFormKeyMatches: function (formIdentifier, formInstanceId, submittedFormArgs) {
  2871. formInstanceId = '' === formInstanceId ? formInstanceId : false;
  2872. // Check if the submitted form matches trigger requirements.
  2873. var checks = [
  2874. // Any supported form.
  2875. formIdentifier === 'any',
  2876. // Checks for PM core sub form submissions.
  2877. 'pumsubform' === formIdentifier && 'pumsubform' === submittedFormArgs.formProvider,
  2878. // Any provider form. ex. `ninjaforms_any`
  2879. formIdentifier === submittedFormArgs.formProvider + '_any',
  2880. // Specific provider form with or without instance ID. ex. `ninjaforms_1` or `ninjaforms_1_*`
  2881. // Only run this test if not checking for a specific instanceId.
  2882. !formInstanceId && new RegExp('^' + formIdentifier + '(_[\d]*)?').test(submittedFormArgs.formKey),
  2883. // Specific provider form with specific instance ID. ex `ninjaforms_1_1` or `calderaforms_jbakrhwkhg_1`
  2884. // Only run this test if we are checking for specific instanceId.
  2885. !!formInstanceId && formIdentifier + '_' + formInstanceId === submittedFormArgs.formKey
  2886. ],
  2887. // If any check is true, set the cookie.
  2888. matchFound = -1 !== checks.indexOf(true);
  2889. /**
  2890. * This filter is applied when checking if a form match was found.
  2891. *
  2892. * It is used for comparing user selected form identifiers with submitted forms.
  2893. *
  2894. * @since 1.9.0
  2895. *
  2896. * @param {boolean} matchFound A boolean determining whether a match was found.
  2897. * @param {Object} args {
  2898. * @type {string} formIdentifier gravityforms_any or ninjaforms_1
  2899. * @type {int} formInstanceId Not all form plugins support this.
  2900. * @type {Object} submittedFormArgs{
  2901. * @type {string} formProvider Such as gravityforms or ninjaforms
  2902. * @type {string|int} formId Usually an integer ID number such as 1
  2903. * @type {int} formInstanceId Not all form plugins support this.
  2904. * @type {string} formKey Concatenation of provider, ID & Instance ID.
  2905. * @type {int} popupId The ID of the popup the form was in.
  2906. * @type {Object} popup Usable jQuery object for the popup.
  2907. * }
  2908. * }
  2909. *
  2910. * @returns {boolean}
  2911. */
  2912. return window.PUM.hooks.applyFilters('pum.integration.checkFormKeyMatches', matchFound, {
  2913. formIdentifier: formIdentifier,
  2914. formInstanceId: formInstanceId,
  2915. submittedFormArgs: submittedFormArgs
  2916. } );
  2917. }
  2918. });
  2919. }(window.jQuery));
  2920. /*******************************************************************************
  2921. * Copyright (c) 2019, Code Atlantic LLC
  2922. ******************************************************************************/
  2923. (function ($) {
  2924. 'use strict';
  2925. if (pum_vars && pum_vars.core_sub_forms_enabled !== undefined && !pum_vars.core_sub_forms_enabled) {
  2926. return;
  2927. }
  2928. window.PUM = window.PUM || {};
  2929. window.PUM.newsletter = window.PUM.newsletter || {};
  2930. $.extend(window.PUM.newsletter, {
  2931. form: $.extend({}, window.PUM.forms.form, {
  2932. submit: function (event) {
  2933. var $form = $(this),
  2934. values = $form.pumSerializeObject();
  2935. event.preventDefault();
  2936. event.stopPropagation();
  2937. window.PUM.newsletter.form.beforeAjax($form);
  2938. $.ajax({
  2939. type: 'POST',
  2940. dataType: 'json',
  2941. url: pum_vars.ajaxurl,
  2942. data: {
  2943. action: 'pum_sub_form',
  2944. values: values
  2945. }
  2946. })
  2947. .always(function () {
  2948. window.PUM.newsletter.form.afterAjax($form);
  2949. })
  2950. .done(function (response) {
  2951. window.PUM.newsletter.form.responseHandler($form, response);
  2952. })
  2953. .error(function (jqXHR, textStatus, errorThrown) {
  2954. console.log('Error: type of ' + textStatus + ' with message of ' + errorThrown);
  2955. });
  2956. }
  2957. })
  2958. });
  2959. $(document)
  2960. .on('submit', 'form.pum-sub-form', window.PUM.newsletter.form.submit)
  2961. .on('success', 'form.pum-sub-form', function (event, data) {
  2962. var $form = $( event.target ),
  2963. settings = $form.data( 'settings' ) || {},
  2964. values = $form.pumSerializeObject(),
  2965. popup = PUM.getPopup($form),
  2966. formId = PUM.getSetting(popup, 'id'),
  2967. formInstanceId = $( 'form.pum-sub-form', popup).index( $form ) + 1;
  2968. // All the magic happens here.
  2969. window.PUM.integrations.formSubmission( $form, {
  2970. formProvider: 'pumsubform',
  2971. formId: formId,
  2972. formInstanceId: formInstanceId,
  2973. extras: {
  2974. data: data,
  2975. values: values,
  2976. settings: settings
  2977. }
  2978. } );
  2979. $form
  2980. .trigger('pumNewsletterSuccess', [data])
  2981. .addClass('pum-newsletter-success');
  2982. $form[0].reset();
  2983. window.pum.hooks.doAction('pum-sub-form.success', data, $form);
  2984. if (typeof settings.redirect === 'string') {
  2985. if (settings.redirect !== '') {
  2986. settings.redirect = atob(settings.redirect);
  2987. }
  2988. }
  2989. window.PUM.forms.success($form, settings);
  2990. })
  2991. .on('error', 'form.pum-sub-form', function (event, data) {
  2992. var $form = $(event.target);
  2993. $form.trigger('pumNewsletterError', [data]);
  2994. window.pum.hooks.doAction('pum-sub-form.errors', data, $form);
  2995. });
  2996. }(jQuery));
  2997. (function ($, document, undefined) {
  2998. "use strict";
  2999. $.extend($.fn.popmake.methods, {
  3000. addTrigger: function (type) {
  3001. // Method calling logic
  3002. if ($.fn.popmake.triggers[type]) {
  3003. return $.fn.popmake.triggers[type].apply(this, Array.prototype.slice.call(arguments, 1));
  3004. }
  3005. if (window.console) {
  3006. console.warn('Trigger type ' + type + ' does not exist.');
  3007. }
  3008. return this;
  3009. }
  3010. });
  3011. $.fn.popmake.triggers = {
  3012. auto_open: function (settings) {
  3013. var $popup = PUM.getPopup(this);
  3014. // Set a delayed open.
  3015. setTimeout(function () {
  3016. // If the popup is already open return.
  3017. if ($popup.popmake('state', 'isOpen')) {
  3018. return;
  3019. }
  3020. // If cookie exists or conditions fail return.
  3021. if ($popup.popmake('checkCookies', settings) || !$popup.popmake('checkConditions')) {
  3022. return;
  3023. }
  3024. // Set the global last open trigger to the a text description of the trigger.
  3025. $.fn.popmake.last_open_trigger = 'Auto Open - Delay: ' + settings.delay;
  3026. // Open the popup.
  3027. $popup.popmake('open');
  3028. }, settings.delay);
  3029. },
  3030. click_open: function (settings) {
  3031. var $popup = PUM.getPopup(this),
  3032. popup_settings = $popup.popmake('getSettings'),
  3033. trigger_selectors = [
  3034. '.popmake-' + popup_settings.id,
  3035. '.popmake-' + decodeURIComponent(popup_settings.slug),
  3036. 'a[href$="#popmake-' + popup_settings.id + '"]'
  3037. ],
  3038. trigger_selector;
  3039. if (settings.extra_selectors && settings.extra_selectors !== '') {
  3040. trigger_selectors.push(settings.extra_selectors);
  3041. }
  3042. trigger_selectors = pum.hooks.applyFilters('pum.trigger.click_open.selectors', trigger_selectors, settings, $popup);
  3043. trigger_selector = trigger_selectors.join(', ');
  3044. $(trigger_selector)
  3045. .addClass('pum-trigger')
  3046. .css({cursor: "pointer"});
  3047. $(document).on('click.pumTrigger', trigger_selector, function (event) {
  3048. var $trigger = $(this),
  3049. do_default = settings.do_default || false;
  3050. // If trigger is inside of the popup that it opens, do nothing.
  3051. if ($popup.has($trigger).length > 0) {
  3052. return;
  3053. }
  3054. // If the popup is already open return.
  3055. if ($popup.popmake('state', 'isOpen')) {
  3056. return;
  3057. }
  3058. // If cookie exists or conditions fail return.
  3059. if ($popup.popmake('checkCookies', settings) || !$popup.popmake('checkConditions')) {
  3060. return;
  3061. }
  3062. if ($trigger.data('do-default')) {
  3063. do_default = $trigger.data('do-default');
  3064. } else if ($trigger.hasClass('do-default') || $trigger.hasClass('popmake-do-default') || $trigger.hasClass('pum-do-default')) {
  3065. do_default = true;
  3066. }
  3067. // If trigger has the class do-default we don't prevent default actions.
  3068. if (!event.ctrlKey && !pum.hooks.applyFilters('pum.trigger.click_open.do_default', do_default, $popup, $trigger)) {
  3069. event.preventDefault();
  3070. event.stopPropagation();
  3071. }
  3072. // Set the global last open trigger to the clicked element.
  3073. $.fn.popmake.last_open_trigger = $trigger;
  3074. // Open the popup.
  3075. $popup.popmake('open');
  3076. });
  3077. },
  3078. form_submission: function (settings) {
  3079. var $popup = PUM.getPopup(this);
  3080. settings = $.extend({
  3081. form: '',
  3082. formInstanceId: '',
  3083. delay: 0
  3084. }, settings);
  3085. var onSuccess = function () {
  3086. setTimeout(function () {
  3087. // If the popup is already open return.
  3088. if ($popup.popmake('state', 'isOpen')) {
  3089. return;
  3090. }
  3091. // If cookie exists or conditions fail return.
  3092. if ($popup.popmake('checkCookies', settings) || !$popup.popmake('checkConditions')) {
  3093. return;
  3094. }
  3095. // Set the global last open trigger to the a text description of the trigger.
  3096. $.fn.popmake.last_open_trigger = 'Form Submission';
  3097. // Open the popup.
  3098. $popup.popmake('open');
  3099. }, settings.delay);
  3100. };
  3101. // Listen for integrated form submissions.
  3102. PUM.hooks.addAction('pum.integration.form.success', function (form, args) {
  3103. if (!settings.form.length) {
  3104. return;
  3105. }
  3106. if (PUM.integrations.checkFormKeyMatches(settings.form, settings.formInstanceId, args)) {
  3107. onSuccess();
  3108. }
  3109. });
  3110. },
  3111. admin_debug: function () {
  3112. PUM.getPopup(this).popmake('open');
  3113. }
  3114. };
  3115. // Register All Triggers for a Popup
  3116. $(document)
  3117. .on('pumInit', '.pum', function () {
  3118. var $popup = PUM.getPopup(this),
  3119. settings = $popup.popmake('getSettings'),
  3120. triggers = settings.triggers || [],
  3121. trigger = null,
  3122. i;
  3123. if (triggers.length) {
  3124. for (i = 0; triggers.length > i; i += 1) {
  3125. trigger = triggers[i];
  3126. $popup.popmake('addTrigger', trigger.type, trigger.settings);
  3127. }
  3128. }
  3129. });
  3130. }(jQuery, document));
  3131. /**
  3132. * Defines the core $.popmake.utilites methods.
  3133. * Version 1.4
  3134. */
  3135. (function ($, document, undefined) {
  3136. "use strict";
  3137. var inputTypes = 'color,date,datetime,datetime-local,email,hidden,month,number,password,range,search,tel,text,time,url,week'.split(','),
  3138. inputNodes = 'select,textarea'.split(','),
  3139. rName = /\[([^\]]*)\]/g;
  3140. /**
  3141. * Polyfill for IE < 9
  3142. */
  3143. if (!Array.prototype.indexOf) {
  3144. Array.prototype.indexOf = function (searchElement /*, fromIndex */) {
  3145. "use strict";
  3146. if (this === void 0 || this === null)
  3147. throw new TypeError();
  3148. var t = Object(this);
  3149. var len = t.length >>> 0;
  3150. if (len === 0)
  3151. return -1;
  3152. var n = 0;
  3153. if (arguments.length > 0) {
  3154. n = Number(arguments[1]);
  3155. if (n !== n) // shortcut for verifying if it's NaN
  3156. n = 0;
  3157. else if (n !== 0 && n !== (1 / 0) && n !== -(1 / 0))
  3158. n = (n > 0 || -1) * Math.floor(Math.abs(n));
  3159. }
  3160. if (n >= len)
  3161. return -1;
  3162. var k = n >= 0
  3163. ? n
  3164. : Math.max(len - Math.abs(n), 0);
  3165. for (; k < len; k++) {
  3166. if (k in t && t[k] === searchElement)
  3167. return k;
  3168. }
  3169. return -1;
  3170. };
  3171. }
  3172. function storeValue(container, parsedName, value) {
  3173. var part = parsedName[0];
  3174. if (parsedName.length > 1) {
  3175. if (!container[part]) {
  3176. // If the next part is eq to '' it means we are processing complex name (i.e. `some[]`)
  3177. // for this case we need to use Array instead of an Object for the index increment purpose
  3178. container[part] = parsedName[1] ? {} : [];
  3179. }
  3180. storeValue(container[part], parsedName.slice(1), value);
  3181. } else {
  3182. // Increment Array index for `some[]` case
  3183. if (!part) {
  3184. part = container.length;
  3185. }
  3186. container[part] = value;
  3187. }
  3188. }
  3189. $.fn.popmake.utilities = {
  3190. scrollTo: function (target, callback) {
  3191. var $target = $(target) || $();
  3192. if (!$target.length) {
  3193. return;
  3194. }
  3195. $('html, body').animate({
  3196. scrollTop: $target.offset().top - 100
  3197. }, 1000, 'swing', function () {
  3198. // Find the first :input that isn't a button or hidden type.
  3199. var $input = $target.find(':input:not([type="button"]):not([type="hidden"]):not(button)').eq(0);
  3200. if ($input.hasClass('wp-editor-area')) {
  3201. tinyMCE.execCommand('mceFocus', false, $input.attr('id'));
  3202. } else {
  3203. $input.focus();
  3204. }
  3205. if (typeof callback === 'function') {
  3206. callback();
  3207. }
  3208. });
  3209. },
  3210. /**
  3211. * In Array tester function. Similar to PHP's in_array()
  3212. * @param needle
  3213. * @param array
  3214. * @returns {boolean}
  3215. */
  3216. inArray: function (needle, array) {
  3217. return !!~array.indexOf(needle);
  3218. },
  3219. convert_hex: function (hex, opacity) {
  3220. hex = hex.replace('#', '');
  3221. var r = parseInt(hex.substring(0, 2), 16),
  3222. g = parseInt(hex.substring(2, 4), 16),
  3223. b = parseInt(hex.substring(4, 6), 16);
  3224. return 'rgba(' + r + ',' + g + ',' + b + ',' + opacity / 100 + ')';
  3225. },
  3226. debounce: function (callback, threshold) {
  3227. var timeout;
  3228. return function () {
  3229. var context = this, params = arguments;
  3230. window.clearTimeout(timeout);
  3231. timeout = window.setTimeout(function () {
  3232. callback.apply(context, params);
  3233. }, threshold);
  3234. };
  3235. },
  3236. throttle: function (callback, threshold) {
  3237. var suppress = false,
  3238. clear = function () {
  3239. suppress = false;
  3240. };
  3241. return function () {
  3242. if (!suppress) {
  3243. callback.apply(this, arguments);
  3244. window.setTimeout(clear, threshold);
  3245. suppress = true;
  3246. }
  3247. };
  3248. },
  3249. getXPath: function (element) {
  3250. var path = [],
  3251. current,
  3252. id,
  3253. classes,
  3254. tag,
  3255. eq;
  3256. $.each($(element).parents(), function (index, value) {
  3257. current = $(value);
  3258. id = current.attr("id") || '';
  3259. classes = current.attr("class") || '';
  3260. tag = current.get(0).tagName.toLowerCase();
  3261. eq = current.parent().children(tag).index(current);
  3262. if (tag === 'body') {
  3263. return false;
  3264. }
  3265. if (classes.length > 0) {
  3266. classes = classes.split(' ');
  3267. classes = classes[0];
  3268. }
  3269. path.push(tag + (id.length > 0 ? "#" + id : (classes.length > 0 ? "." + classes.split(' ').join('.') : ':eq(' + eq + ')')));
  3270. });
  3271. return path.reverse().join(' > ');
  3272. },
  3273. strtotime: function (text, now) {
  3274. // discuss at: http://phpjs.org/functions/strtotime/
  3275. // version: 1109.2016
  3276. // original by: Caio Ariede (http://caioariede.com)
  3277. // improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
  3278. // improved by: Caio Ariede (http://caioariede.com)
  3279. // improved by: A. Matas Quezada (http://amatiasq.com)
  3280. // improved by: preuter
  3281. // improved by: Brett Zamir (http://brett-zamir.me)
  3282. // improved by: Mirko Faber
  3283. // input by: David
  3284. // bugfixed by: Wagner B. Soares
  3285. // bugfixed by: Artur Tchernychev
  3286. // note: Examples all have a fixed timestamp to prevent tests to fail because of variable time(zones)
  3287. // example 1: strtotime('+1 day', 1129633200);
  3288. // returns 1: 1129719600
  3289. // example 2: strtotime('+1 week 2 days 4 hours 2 seconds', 1129633200);
  3290. // returns 2: 1130425202
  3291. // example 3: strtotime('last month', 1129633200);
  3292. // returns 3: 1127041200
  3293. // example 4: strtotime('2009-05-04 08:30:00 GMT');
  3294. // returns 4: 1241425800
  3295. var parsed, match, today, year, date, days, ranges, len, times, regex, i, fail = false;
  3296. if (!text) {
  3297. return fail;
  3298. }
  3299. // Unecessary spaces
  3300. text = text.replace(/^\s+|\s+$/g, '')
  3301. .replace(/\s{2,}/g, ' ')
  3302. .replace(/[\t\r\n]/g, '')
  3303. .toLowerCase();
  3304. // in contrast to php, js Date.parse function interprets:
  3305. // dates given as yyyy-mm-dd as in timezone: UTC,
  3306. // dates with "." or "-" as MDY instead of DMY
  3307. // dates with two-digit years differently
  3308. // etc...etc...
  3309. // ...therefore we manually parse lots of common date formats
  3310. match = text.match(/^(\d{1,4})([\-\.\/\:])(\d{1,2})([\-\.\/\:])(\d{1,4})(?:\s(\d{1,2}):(\d{2})?:?(\d{2})?)?(?:\s([A-Z]+)?)?$/);
  3311. if (match && match[2] === match[4]) {
  3312. if (match[1] > 1901) {
  3313. switch (match[2]) {
  3314. case '-':
  3315. // YYYY-M-D
  3316. if (match[3] > 12 || match[5] > 31) {
  3317. return fail;
  3318. }
  3319. return new Date(match[1], parseInt(match[3], 10) - 1, match[5],
  3320. match[6] || 0, match[7] || 0, match[8] || 0, match[9] || 0) / 1000;
  3321. case '.':
  3322. // YYYY.M.D is not parsed by strtotime()
  3323. return fail;
  3324. case '/':
  3325. // YYYY/M/D
  3326. if (match[3] > 12 || match[5] > 31) {
  3327. return fail;
  3328. }
  3329. return new Date(match[1], parseInt(match[3], 10) - 1, match[5],
  3330. match[6] || 0, match[7] || 0, match[8] || 0, match[9] || 0) / 1000;
  3331. }
  3332. } else if (match[5] > 1901) {
  3333. switch (match[2]) {
  3334. case '-':
  3335. // D-M-YYYY
  3336. if (match[3] > 12 || match[1] > 31) {
  3337. return fail;
  3338. }
  3339. return new Date(match[5], parseInt(match[3], 10) - 1, match[1],
  3340. match[6] || 0, match[7] || 0, match[8] || 0, match[9] || 0) / 1000;
  3341. case '.':
  3342. // D.M.YYYY
  3343. if (match[3] > 12 || match[1] > 31) {
  3344. return fail;
  3345. }
  3346. return new Date(match[5], parseInt(match[3], 10) - 1, match[1],
  3347. match[6] || 0, match[7] || 0, match[8] || 0, match[9] || 0) / 1000;
  3348. case '/':
  3349. // M/D/YYYY
  3350. if (match[1] > 12 || match[3] > 31) {
  3351. return fail;
  3352. }
  3353. return new Date(match[5], parseInt(match[1], 10) - 1, match[3],
  3354. match[6] || 0, match[7] || 0, match[8] || 0, match[9] || 0) / 1000;
  3355. }
  3356. } else {
  3357. switch (match[2]) {
  3358. case '-':
  3359. // YY-M-D
  3360. if (match[3] > 12 || match[5] > 31 || (match[1] < 70 && match[1] > 38)) {
  3361. return fail;
  3362. }
  3363. year = match[1] >= 0 && match[1] <= 38 ? +match[1] + 2000 : match[1];
  3364. return new Date(year, parseInt(match[3], 10) - 1, match[5],
  3365. match[6] || 0, match[7] || 0, match[8] || 0, match[9] || 0) / 1000;
  3366. case '.':
  3367. // D.M.YY or H.MM.SS
  3368. if (match[5] >= 70) { // D.M.YY
  3369. if (match[3] > 12 || match[1] > 31) {
  3370. return fail;
  3371. }
  3372. return new Date(match[5], parseInt(match[3], 10) - 1, match[1],
  3373. match[6] || 0, match[7] || 0, match[8] || 0, match[9] || 0) / 1000;
  3374. }
  3375. if (match[5] < 60 && !match[6]) { // H.MM.SS
  3376. if (match[1] > 23 || match[3] > 59) {
  3377. return fail;
  3378. }
  3379. today = new Date();
  3380. return new Date(today.getFullYear(), today.getMonth(), today.getDate(),
  3381. match[1] || 0, match[3] || 0, match[5] || 0, match[9] || 0) / 1000;
  3382. }
  3383. return fail; // invalid format, cannot be parsed
  3384. case '/':
  3385. // M/D/YY
  3386. if (match[1] > 12 || match[3] > 31 || (match[5] < 70 && match[5] > 38)) {
  3387. return fail;
  3388. }
  3389. year = match[5] >= 0 && match[5] <= 38 ? +match[5] + 2000 : match[5];
  3390. return new Date(year, parseInt(match[1], 10) - 1, match[3],
  3391. match[6] || 0, match[7] || 0, match[8] || 0, match[9] || 0) / 1000;
  3392. case ':':
  3393. // HH:MM:SS
  3394. if (match[1] > 23 || match[3] > 59 || match[5] > 59) {
  3395. return fail;
  3396. }
  3397. today = new Date();
  3398. return new Date(today.getFullYear(), today.getMonth(), today.getDate(),
  3399. match[1] || 0, match[3] || 0, match[5] || 0) / 1000;
  3400. }
  3401. }
  3402. }
  3403. // other formats and "now" should be parsed by Date.parse()
  3404. if (text === 'now') {
  3405. return now === null || isNaN(now) ? new Date()
  3406. .getTime() / 1000 || 0 : now || 0;
  3407. }
  3408. parsed = Date.parse(text);
  3409. if (!isNaN(parsed)) {
  3410. return parsed / 1000 || 0;
  3411. }
  3412. date = now ? new Date(now * 1000) : new Date();
  3413. days = {
  3414. 'sun': 0,
  3415. 'mon': 1,
  3416. 'tue': 2,
  3417. 'wed': 3,
  3418. 'thu': 4,
  3419. 'fri': 5,
  3420. 'sat': 6
  3421. };
  3422. ranges = {
  3423. 'yea': 'FullYear',
  3424. 'mon': 'Month',
  3425. 'day': 'Date',
  3426. 'hou': 'Hours',
  3427. 'min': 'Minutes',
  3428. 'sec': 'Seconds'
  3429. };
  3430. function lastNext(type, range, modifier) {
  3431. var diff, day = days[range];
  3432. if (day !== undefined) {
  3433. diff = day - date.getDay();
  3434. if (diff === 0) {
  3435. diff = 7 * modifier;
  3436. } else if (diff > 0 && type === 'last') {
  3437. diff -= 7;
  3438. } else if (diff < 0 && type === 'next') {
  3439. diff += 7;
  3440. }
  3441. date.setDate(date.getDate() + diff);
  3442. }
  3443. }
  3444. function process(val) {
  3445. var splt = val.split(' '),
  3446. type = splt[0],
  3447. range = splt[1].substring(0, 3),
  3448. typeIsNumber = /\d+/.test(type),
  3449. ago = splt[2] === 'ago',
  3450. num = (type === 'last' ? -1 : 1) * (ago ? -1 : 1);
  3451. if (typeIsNumber) {
  3452. num *= parseInt(type, 10);
  3453. }
  3454. if (ranges.hasOwnProperty(range) && !splt[1].match(/^mon(day|\.)?$/i)) {
  3455. return date['set' + ranges[range]](date['get' + ranges[range]]() + num);
  3456. }
  3457. if (range === 'wee') {
  3458. return date.setDate(date.getDate() + (num * 7));
  3459. }
  3460. if (type === 'next' || type === 'last') {
  3461. lastNext(type, range, num);
  3462. } else if (!typeIsNumber) {
  3463. return false;
  3464. }
  3465. return true;
  3466. }
  3467. times = '(years?|months?|weeks?|days?|hours?|minutes?|min|seconds?|sec' +
  3468. '|sunday|sun\\.?|monday|mon\\.?|tuesday|tue\\.?|wednesday|wed\\.?' +
  3469. '|thursday|thu\\.?|friday|fri\\.?|saturday|sat\\.?)';
  3470. regex = '([+-]?\\d+\\s' + times + '|' + '(last|next)\\s' + times + ')(\\sago)?';
  3471. match = text.match(new RegExp(regex, 'gi'));
  3472. if (!match) {
  3473. return fail;
  3474. }
  3475. for (i = 0, len = match.length; i < len; i += 1) {
  3476. if (!process(match[i])) {
  3477. return fail;
  3478. }
  3479. }
  3480. // ECMAScript 5 only
  3481. // if (!match.every(process))
  3482. // return false;
  3483. return (date.getTime() / 1000);
  3484. },
  3485. serializeObject: function (options) {
  3486. $.extend({}, options);
  3487. var values = {},
  3488. settings = $.extend(true, {
  3489. include: [],
  3490. exclude: [],
  3491. includeByClass: ''
  3492. }, options);
  3493. this.find(':input').each(function () {
  3494. var parsedName;
  3495. // Apply simple checks and filters
  3496. if (!this.name || this.disabled ||
  3497. window.PUM.utilities.inArray(this.name, settings.exclude) ||
  3498. (settings.include.length && !window.PUM.utilities.inArray(this.name, settings.include)) ||
  3499. this.className.indexOf(settings.includeByClass) === -1) {
  3500. return;
  3501. }
  3502. // Parse complex names
  3503. // JS RegExp doesn't support "positive look behind" :( that's why so weird parsing is used
  3504. parsedName = this.name.replace(rName, '[$1').split('[');
  3505. if (!parsedName[0]) {
  3506. return;
  3507. }
  3508. if (this.checked ||
  3509. window.PUM.utilities.inArray(this.type, inputTypes) ||
  3510. window.PUM.utilities.inArray(this.nodeName.toLowerCase(), inputNodes)) {
  3511. // Simulate control with a complex name (i.e. `some[]`)
  3512. // as it handled in the same way as Checkboxes should
  3513. if (this.type === 'checkbox') {
  3514. parsedName.push('');
  3515. }
  3516. // jQuery.val() is used to simplify of getting values
  3517. // from the custom controls (which follow jQuery .val() API) and Multiple Select
  3518. storeValue(values, parsedName, $(this).val());
  3519. }
  3520. });
  3521. return values;
  3522. }
  3523. };
  3524. //$.fn.pumSerializeObject = $.fn.popmake.utilities.serializeObject;
  3525. // Deprecated fix. utilies was renamed because of typo.
  3526. $.fn.popmake.utilies = $.fn.popmake.utilities;
  3527. window.PUM = window.PUM || {};
  3528. window.PUM.utilities = window.PUM.utilities || {};
  3529. window.PUM.utilities = $.extend(window.PUM.utilities, $.fn.popmake.utilities);
  3530. }(jQuery, document));
  3531. /*******************************************************************************
  3532. * Copyright (c) 2019, Code Atlantic LLC
  3533. ******************************************************************************/
  3534. (function (root, factory) {
  3535. // Browser
  3536. factory(root, (root.jQuery || root.Zepto || root.ender || root.$));
  3537. }(this, function (exports, $) {
  3538. var patterns = {
  3539. validate: /^[a-z_][a-z0-9_]*(?:\[(?:\d*|[a-z0-9_]+)\])*$/i,
  3540. key: /[a-z0-9_]+|(?=\[\])/gi,
  3541. push: /^$/,
  3542. fixed: /^\d+$/,
  3543. named: /^[a-z0-9_]+$/i
  3544. };
  3545. function FormSerializer(helper, $form) {
  3546. // private variables
  3547. var data = {},
  3548. pushes = {};
  3549. // private API
  3550. function build(base, key, value) {
  3551. base[key] = value;
  3552. return base;
  3553. }
  3554. function makeObject(root, value) {
  3555. var keys = root.match(patterns.key), k;
  3556. try {
  3557. value = JSON.parse(value);
  3558. } catch (Error) {
  3559. }
  3560. // nest, nest, ..., nest
  3561. while ((k = keys.pop()) !== undefined) {
  3562. // foo[]
  3563. if (patterns.push.test(k)) {
  3564. var idx = incrementPush(root.replace(/\[\]$/, ''));
  3565. value = build([], idx, value);
  3566. }
  3567. // foo[n]
  3568. else if (patterns.fixed.test(k)) {
  3569. value = build([], k, value);
  3570. }
  3571. // foo; foo[bar]
  3572. else if (patterns.named.test(k)) {
  3573. value = build({}, k, value);
  3574. }
  3575. }
  3576. return value;
  3577. }
  3578. function incrementPush(key) {
  3579. if (pushes[key] === undefined) {
  3580. pushes[key] = 0;
  3581. }
  3582. return pushes[key]++;
  3583. }
  3584. function encode(pair) {
  3585. switch ($('[name="' + pair.name + '"]', $form).attr("type")) {
  3586. case "checkbox":
  3587. return pair.value === "1" ? true : pair.value;
  3588. default:
  3589. return pair.value;
  3590. }
  3591. }
  3592. function addPair(pair) {
  3593. if (!patterns.validate.test(pair.name)) return this;
  3594. var obj = makeObject(pair.name, encode(pair));
  3595. data = helper.extend(true, data, obj);
  3596. return this;
  3597. }
  3598. function addPairs(pairs) {
  3599. if (!helper.isArray(pairs)) {
  3600. throw new Error("formSerializer.addPairs expects an Array");
  3601. }
  3602. for (var i = 0, len = pairs.length; i < len; i++) {
  3603. this.addPair(pairs[i]);
  3604. }
  3605. return this;
  3606. }
  3607. function serialize() {
  3608. return data;
  3609. }
  3610. function serializeJSON() {
  3611. return JSON.stringify(serialize());
  3612. }
  3613. // public API
  3614. this.addPair = addPair;
  3615. this.addPairs = addPairs;
  3616. this.serialize = serialize;
  3617. this.serializeJSON = serializeJSON;
  3618. }
  3619. FormSerializer.patterns = patterns;
  3620. FormSerializer.serializeObject = function serializeObject() {
  3621. var serialized;
  3622. if (this.is('form')) {
  3623. serialized = this.serializeArray();
  3624. } else {
  3625. serialized = this.find(':input').serializeArray();
  3626. }
  3627. return new FormSerializer($, this)
  3628. .addPairs(serialized)
  3629. .serialize();
  3630. };
  3631. FormSerializer.serializeJSON = function serializeJSON() {
  3632. var serialized;
  3633. if (this.is('form')) {
  3634. serialized = this.serializeArray();
  3635. } else {
  3636. serialized = this.find(':input').serializeArray();
  3637. }
  3638. return new FormSerializer($, this)
  3639. .addPairs(serialized)
  3640. .serializeJSON();
  3641. };
  3642. if (typeof $.fn !== "undefined") {
  3643. $.fn.pumSerializeObject = FormSerializer.serializeObject;
  3644. $.fn.pumSerializeJSON = FormSerializer.serializeJSON;
  3645. }
  3646. exports.FormSerializer = FormSerializer;
  3647. return FormSerializer;
  3648. }));
  3649. /******/ (function(modules) { // webpackBootstrap
  3650. /******/ // The module cache
  3651. /******/ var installedModules = {};
  3652. /******/
  3653. /******/ // The require function
  3654. /******/ function __webpack_require__(moduleId) {
  3655. /******/
  3656. /******/ // Check if module is in cache
  3657. /******/ if(installedModules[moduleId]) {
  3658. /******/ return installedModules[moduleId].exports;
  3659. /******/ }
  3660. /******/ // Create a new module (and put it into the cache)
  3661. /******/ var module = installedModules[moduleId] = {
  3662. /******/ i: moduleId,
  3663. /******/ l: false,
  3664. /******/ exports: {}
  3665. /******/ };
  3666. /******/
  3667. /******/ // Execute the module function
  3668. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  3669. /******/
  3670. /******/ // Flag the module as loaded
  3671. /******/ module.l = true;
  3672. /******/
  3673. /******/ // Return the exports of the module
  3674. /******/ return module.exports;
  3675. /******/ }
  3676. /******/
  3677. /******/
  3678. /******/ // expose the modules object (__webpack_modules__)
  3679. /******/ __webpack_require__.m = modules;
  3680. /******/
  3681. /******/ // expose the module cache
  3682. /******/ __webpack_require__.c = installedModules;
  3683. /******/
  3684. /******/ // define getter function for harmony exports
  3685. /******/ __webpack_require__.d = function(exports, name, getter) {
  3686. /******/ if(!__webpack_require__.o(exports, name)) {
  3687. /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
  3688. /******/ }
  3689. /******/ };
  3690. /******/
  3691. /******/ // define __esModule on exports
  3692. /******/ __webpack_require__.r = function(exports) {
  3693. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  3694. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  3695. /******/ }
  3696. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  3697. /******/ };
  3698. /******/
  3699. /******/ // create a fake namespace object
  3700. /******/ // mode & 1: value is a module id, require it
  3701. /******/ // mode & 2: merge all properties of value into the ns
  3702. /******/ // mode & 4: return value when already ns object
  3703. /******/ // mode & 8|1: behave like require
  3704. /******/ __webpack_require__.t = function(value, mode) {
  3705. /******/ if(mode & 1) value = __webpack_require__(value);
  3706. /******/ if(mode & 8) return value;
  3707. /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  3708. /******/ var ns = Object.create(null);
  3709. /******/ __webpack_require__.r(ns);
  3710. /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  3711. /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  3712. /******/ return ns;
  3713. /******/ };
  3714. /******/
  3715. /******/ // getDefaultExport function for compatibility with non-harmony modules
  3716. /******/ __webpack_require__.n = function(module) {
  3717. /******/ var getter = module && module.__esModule ?
  3718. /******/ function getDefault() { return module['default']; } :
  3719. /******/ function getModuleExports() { return module; };
  3720. /******/ __webpack_require__.d(getter, 'a', getter);
  3721. /******/ return getter;
  3722. /******/ };
  3723. /******/
  3724. /******/ // Object.prototype.hasOwnProperty.call
  3725. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  3726. /******/
  3727. /******/ // __webpack_public_path__
  3728. /******/ __webpack_require__.p = "";
  3729. /******/
  3730. /******/
  3731. /******/ // Load entry module and return exports
  3732. /******/ return __webpack_require__(__webpack_require__.s = "./assets/js/src/integration/calderaforms.js");
  3733. /******/ })
  3734. /************************************************************************/
  3735. /******/ ({
  3736. /***/ "./assets/js/src/integration/calderaforms.js":
  3737. /*!***************************************************!*\
  3738. !*** ./assets/js/src/integration/calderaforms.js ***!
  3739. \***************************************************/
  3740. /*! no exports provided */
  3741. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  3742. "use strict";
  3743. __webpack_require__.r(__webpack_exports__);
  3744. /* harmony import */ var _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/slicedToArray */ "./node_modules/@babel/runtime/helpers/slicedToArray.js");
  3745. /* harmony import */ var _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_0__);
  3746. /*******************************************************************************
  3747. * Copyright (c) 2020, WP Popup Maker
  3748. ******************************************************************************/
  3749. {
  3750. var formProvider = 'calderaforms';
  3751. var $ = window.jQuery;
  3752. var $form;
  3753. /**
  3754. * This function is run before every CF Ajax call to store the form being submitted.
  3755. *
  3756. * @param event
  3757. * @param obj
  3758. */
  3759. var beforeAjax = function beforeAjax(event, obj) {
  3760. return $form = obj.$form;
  3761. };
  3762. $(document).on('cf.ajax.request', beforeAjax) // After all requests
  3763. .on('cf.submission', function (event, obj) {
  3764. // Only if status of request is complete|success.
  3765. if ('complete' === obj.data.status || 'success' === obj.data.status) {
  3766. //get the form that is submiting's ID attribute
  3767. var _$form$attr$split = $form.attr('id').split('_'),
  3768. _$form$attr$split2 = _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_0___default()(_$form$attr$split, 2),
  3769. formId = _$form$attr$split2[0],
  3770. _$form$attr$split2$ = _$form$attr$split2[1],
  3771. formInstanceId = _$form$attr$split2$ === void 0 ? null : _$form$attr$split2$; // All the magic happens here.
  3772. window.PUM.integrations.formSubmission($form, {
  3773. formProvider: formProvider,
  3774. formId: formId,
  3775. formInstanceId: formInstanceId,
  3776. extras: {
  3777. state: window.cfstate.hasOwnProperty(formId) ? window.cfstate[formId] : null
  3778. }
  3779. });
  3780. }
  3781. });
  3782. }
  3783. /***/ }),
  3784. /***/ "./node_modules/@babel/runtime/helpers/arrayLikeToArray.js":
  3785. /*!*****************************************************************!*\
  3786. !*** ./node_modules/@babel/runtime/helpers/arrayLikeToArray.js ***!
  3787. \*****************************************************************/
  3788. /*! no static exports found */
  3789. /***/ (function(module, exports) {
  3790. function _arrayLikeToArray(arr, len) {
  3791. if (len == null || len > arr.length) len = arr.length;
  3792. for (var i = 0, arr2 = new Array(len); i < len; i++) {
  3793. arr2[i] = arr[i];
  3794. }
  3795. return arr2;
  3796. }
  3797. module.exports = _arrayLikeToArray;
  3798. /***/ }),
  3799. /***/ "./node_modules/@babel/runtime/helpers/arrayWithHoles.js":
  3800. /*!***************************************************************!*\
  3801. !*** ./node_modules/@babel/runtime/helpers/arrayWithHoles.js ***!
  3802. \***************************************************************/
  3803. /*! no static exports found */
  3804. /***/ (function(module, exports) {
  3805. function _arrayWithHoles(arr) {
  3806. if (Array.isArray(arr)) return arr;
  3807. }
  3808. module.exports = _arrayWithHoles;
  3809. /***/ }),
  3810. /***/ "./node_modules/@babel/runtime/helpers/iterableToArrayLimit.js":
  3811. /*!*********************************************************************!*\
  3812. !*** ./node_modules/@babel/runtime/helpers/iterableToArrayLimit.js ***!
  3813. \*********************************************************************/
  3814. /*! no static exports found */
  3815. /***/ (function(module, exports) {
  3816. function _iterableToArrayLimit(arr, i) {
  3817. if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return;
  3818. var _arr = [];
  3819. var _n = true;
  3820. var _d = false;
  3821. var _e = undefined;
  3822. try {
  3823. for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
  3824. _arr.push(_s.value);
  3825. if (i && _arr.length === i) break;
  3826. }
  3827. } catch (err) {
  3828. _d = true;
  3829. _e = err;
  3830. } finally {
  3831. try {
  3832. if (!_n && _i["return"] != null) _i["return"]();
  3833. } finally {
  3834. if (_d) throw _e;
  3835. }
  3836. }
  3837. return _arr;
  3838. }
  3839. module.exports = _iterableToArrayLimit;
  3840. /***/ }),
  3841. /***/ "./node_modules/@babel/runtime/helpers/nonIterableRest.js":
  3842. /*!****************************************************************!*\
  3843. !*** ./node_modules/@babel/runtime/helpers/nonIterableRest.js ***!
  3844. \****************************************************************/
  3845. /*! no static exports found */
  3846. /***/ (function(module, exports) {
  3847. function _nonIterableRest() {
  3848. throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
  3849. }
  3850. module.exports = _nonIterableRest;
  3851. /***/ }),
  3852. /***/ "./node_modules/@babel/runtime/helpers/slicedToArray.js":
  3853. /*!**************************************************************!*\
  3854. !*** ./node_modules/@babel/runtime/helpers/slicedToArray.js ***!
  3855. \**************************************************************/
  3856. /*! no static exports found */
  3857. /***/ (function(module, exports, __webpack_require__) {
  3858. var arrayWithHoles = __webpack_require__(/*! ./arrayWithHoles */ "./node_modules/@babel/runtime/helpers/arrayWithHoles.js");
  3859. var iterableToArrayLimit = __webpack_require__(/*! ./iterableToArrayLimit */ "./node_modules/@babel/runtime/helpers/iterableToArrayLimit.js");
  3860. var unsupportedIterableToArray = __webpack_require__(/*! ./unsupportedIterableToArray */ "./node_modules/@babel/runtime/helpers/unsupportedIterableToArray.js");
  3861. var nonIterableRest = __webpack_require__(/*! ./nonIterableRest */ "./node_modules/@babel/runtime/helpers/nonIterableRest.js");
  3862. function _slicedToArray(arr, i) {
  3863. return arrayWithHoles(arr) || iterableToArrayLimit(arr, i) || unsupportedIterableToArray(arr, i) || nonIterableRest();
  3864. }
  3865. module.exports = _slicedToArray;
  3866. /***/ }),
  3867. /***/ "./node_modules/@babel/runtime/helpers/unsupportedIterableToArray.js":
  3868. /*!***************************************************************************!*\
  3869. !*** ./node_modules/@babel/runtime/helpers/unsupportedIterableToArray.js ***!
  3870. \***************************************************************************/
  3871. /*! no static exports found */
  3872. /***/ (function(module, exports, __webpack_require__) {
  3873. var arrayLikeToArray = __webpack_require__(/*! ./arrayLikeToArray */ "./node_modules/@babel/runtime/helpers/arrayLikeToArray.js");
  3874. function _unsupportedIterableToArray(o, minLen) {
  3875. if (!o) return;
  3876. if (typeof o === "string") return arrayLikeToArray(o, minLen);
  3877. var n = Object.prototype.toString.call(o).slice(8, -1);
  3878. if (n === "Object" && o.constructor) n = o.constructor.name;
  3879. if (n === "Map" || n === "Set") return Array.from(o);
  3880. if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return arrayLikeToArray(o, minLen);
  3881. }
  3882. module.exports = _unsupportedIterableToArray;
  3883. /***/ })
  3884. /******/ });
  3885. /******/ (function(modules) { // webpackBootstrap
  3886. /******/ // The module cache
  3887. /******/ var installedModules = {};
  3888. /******/
  3889. /******/ // The require function
  3890. /******/ function __webpack_require__(moduleId) {
  3891. /******/
  3892. /******/ // Check if module is in cache
  3893. /******/ if(installedModules[moduleId]) {
  3894. /******/ return installedModules[moduleId].exports;
  3895. /******/ }
  3896. /******/ // Create a new module (and put it into the cache)
  3897. /******/ var module = installedModules[moduleId] = {
  3898. /******/ i: moduleId,
  3899. /******/ l: false,
  3900. /******/ exports: {}
  3901. /******/ };
  3902. /******/
  3903. /******/ // Execute the module function
  3904. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  3905. /******/
  3906. /******/ // Flag the module as loaded
  3907. /******/ module.l = true;
  3908. /******/
  3909. /******/ // Return the exports of the module
  3910. /******/ return module.exports;
  3911. /******/ }
  3912. /******/
  3913. /******/
  3914. /******/ // expose the modules object (__webpack_modules__)
  3915. /******/ __webpack_require__.m = modules;
  3916. /******/
  3917. /******/ // expose the module cache
  3918. /******/ __webpack_require__.c = installedModules;
  3919. /******/
  3920. /******/ // define getter function for harmony exports
  3921. /******/ __webpack_require__.d = function(exports, name, getter) {
  3922. /******/ if(!__webpack_require__.o(exports, name)) {
  3923. /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
  3924. /******/ }
  3925. /******/ };
  3926. /******/
  3927. /******/ // define __esModule on exports
  3928. /******/ __webpack_require__.r = function(exports) {
  3929. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  3930. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  3931. /******/ }
  3932. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  3933. /******/ };
  3934. /******/
  3935. /******/ // create a fake namespace object
  3936. /******/ // mode & 1: value is a module id, require it
  3937. /******/ // mode & 2: merge all properties of value into the ns
  3938. /******/ // mode & 4: return value when already ns object
  3939. /******/ // mode & 8|1: behave like require
  3940. /******/ __webpack_require__.t = function(value, mode) {
  3941. /******/ if(mode & 1) value = __webpack_require__(value);
  3942. /******/ if(mode & 8) return value;
  3943. /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  3944. /******/ var ns = Object.create(null);
  3945. /******/ __webpack_require__.r(ns);
  3946. /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  3947. /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  3948. /******/ return ns;
  3949. /******/ };
  3950. /******/
  3951. /******/ // getDefaultExport function for compatibility with non-harmony modules
  3952. /******/ __webpack_require__.n = function(module) {
  3953. /******/ var getter = module && module.__esModule ?
  3954. /******/ function getDefault() { return module['default']; } :
  3955. /******/ function getModuleExports() { return module; };
  3956. /******/ __webpack_require__.d(getter, 'a', getter);
  3957. /******/ return getter;
  3958. /******/ };
  3959. /******/
  3960. /******/ // Object.prototype.hasOwnProperty.call
  3961. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  3962. /******/
  3963. /******/ // __webpack_public_path__
  3964. /******/ __webpack_require__.p = "";
  3965. /******/
  3966. /******/
  3967. /******/ // Load entry module and return exports
  3968. /******/ return __webpack_require__(__webpack_require__.s = "./assets/js/src/integration/contactform7.js");
  3969. /******/ })
  3970. /************************************************************************/
  3971. /******/ ({
  3972. /***/ "./assets/js/src/integration/contactform7.js":
  3973. /*!***************************************************!*\
  3974. !*** ./assets/js/src/integration/contactform7.js ***!
  3975. \***************************************************/
  3976. /*! no exports provided */
  3977. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  3978. "use strict";
  3979. __webpack_require__.r(__webpack_exports__);
  3980. /* harmony import */ var _babel_runtime_helpers_typeof__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/typeof */ "./node_modules/@babel/runtime/helpers/typeof.js");
  3981. /* harmony import */ var _babel_runtime_helpers_typeof__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_typeof__WEBPACK_IMPORTED_MODULE_0__);
  3982. /**************************************
  3983. * Copyright (c) 2020, Popup Maker
  3984. *************************************/
  3985. {
  3986. var formProvider = "contactform7";
  3987. var $ = window.jQuery;
  3988. $(document).on("wpcf7mailsent", function (event, details) {
  3989. var formId = event.detail.contactFormId,
  3990. $form = $(event.target),
  3991. identifier = event.detail.id || event.detail.unitTag,
  3992. // Converts string like wpcf7-f190-p2-o11 and reduces it to simply 11, the last o11 is the instance ID.
  3993. // More accurate way of doing it in case things change in the future, this version filters out all but the o param.
  3994. // formInstanceId = .split('-').filter((string) => string.indexOf('o') === 0)[0].replace('o','');
  3995. // Simpler version that simply splits and pops the last item in the array. This requires it always be the last.
  3996. formInstanceId = identifier.split("-").pop().replace("o", ""); // All the magic happens here.
  3997. window.PUM.integrations.formSubmission($form, {
  3998. formProvider: formProvider,
  3999. formId: formId,
  4000. formInstanceId: formInstanceId,
  4001. extras: {
  4002. details: details
  4003. }
  4004. });
  4005. /**
  4006. * TODO - Move this to a backward compatiblilty file, hook it into the pum.integration.form.success action.
  4007. *
  4008. * Listen for older popup actions applied directly to the form.
  4009. *
  4010. * This is here for backward compatibility with form actions prior to v1.9.
  4011. */
  4012. var $settings = $form.find("input.wpcf7-pum"),
  4013. settings = $settings.length ? JSON.parse($settings.val()) : false;
  4014. if (_babel_runtime_helpers_typeof__WEBPACK_IMPORTED_MODULE_0___default()(settings) === "object" && settings.closedelay !== undefined && settings.closedelay.toString().length >= 3) {
  4015. settings.closedelay = settings.closedelay / 1000;
  4016. } // Nothing should happen if older action settings not applied
  4017. // except triggering of pumFormSuccess event for old cookie method.
  4018. window.PUM.forms.success($form, settings);
  4019. });
  4020. }
  4021. /***/ }),
  4022. /***/ "./node_modules/@babel/runtime/helpers/typeof.js":
  4023. /*!*******************************************************!*\
  4024. !*** ./node_modules/@babel/runtime/helpers/typeof.js ***!
  4025. \*******************************************************/
  4026. /*! no static exports found */
  4027. /***/ (function(module, exports) {
  4028. function _typeof(obj) {
  4029. "@babel/helpers - typeof";
  4030. if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
  4031. module.exports = _typeof = function _typeof(obj) {
  4032. return typeof obj;
  4033. };
  4034. } else {
  4035. module.exports = _typeof = function _typeof(obj) {
  4036. return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
  4037. };
  4038. }
  4039. return _typeof(obj);
  4040. }
  4041. module.exports = _typeof;
  4042. /***/ })
  4043. /******/ });
  4044. /******/ (function(modules) { // webpackBootstrap
  4045. /******/ // The module cache
  4046. /******/ var installedModules = {};
  4047. /******/
  4048. /******/ // The require function
  4049. /******/ function __webpack_require__(moduleId) {
  4050. /******/
  4051. /******/ // Check if module is in cache
  4052. /******/ if(installedModules[moduleId]) {
  4053. /******/ return installedModules[moduleId].exports;
  4054. /******/ }
  4055. /******/ // Create a new module (and put it into the cache)
  4056. /******/ var module = installedModules[moduleId] = {
  4057. /******/ i: moduleId,
  4058. /******/ l: false,
  4059. /******/ exports: {}
  4060. /******/ };
  4061. /******/
  4062. /******/ // Execute the module function
  4063. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  4064. /******/
  4065. /******/ // Flag the module as loaded
  4066. /******/ module.l = true;
  4067. /******/
  4068. /******/ // Return the exports of the module
  4069. /******/ return module.exports;
  4070. /******/ }
  4071. /******/
  4072. /******/
  4073. /******/ // expose the modules object (__webpack_modules__)
  4074. /******/ __webpack_require__.m = modules;
  4075. /******/
  4076. /******/ // expose the module cache
  4077. /******/ __webpack_require__.c = installedModules;
  4078. /******/
  4079. /******/ // define getter function for harmony exports
  4080. /******/ __webpack_require__.d = function(exports, name, getter) {
  4081. /******/ if(!__webpack_require__.o(exports, name)) {
  4082. /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
  4083. /******/ }
  4084. /******/ };
  4085. /******/
  4086. /******/ // define __esModule on exports
  4087. /******/ __webpack_require__.r = function(exports) {
  4088. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  4089. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  4090. /******/ }
  4091. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  4092. /******/ };
  4093. /******/
  4094. /******/ // create a fake namespace object
  4095. /******/ // mode & 1: value is a module id, require it
  4096. /******/ // mode & 2: merge all properties of value into the ns
  4097. /******/ // mode & 4: return value when already ns object
  4098. /******/ // mode & 8|1: behave like require
  4099. /******/ __webpack_require__.t = function(value, mode) {
  4100. /******/ if(mode & 1) value = __webpack_require__(value);
  4101. /******/ if(mode & 8) return value;
  4102. /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  4103. /******/ var ns = Object.create(null);
  4104. /******/ __webpack_require__.r(ns);
  4105. /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  4106. /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  4107. /******/ return ns;
  4108. /******/ };
  4109. /******/
  4110. /******/ // getDefaultExport function for compatibility with non-harmony modules
  4111. /******/ __webpack_require__.n = function(module) {
  4112. /******/ var getter = module && module.__esModule ?
  4113. /******/ function getDefault() { return module['default']; } :
  4114. /******/ function getModuleExports() { return module; };
  4115. /******/ __webpack_require__.d(getter, 'a', getter);
  4116. /******/ return getter;
  4117. /******/ };
  4118. /******/
  4119. /******/ // Object.prototype.hasOwnProperty.call
  4120. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  4121. /******/
  4122. /******/ // __webpack_public_path__
  4123. /******/ __webpack_require__.p = "";
  4124. /******/
  4125. /******/
  4126. /******/ // Load entry module and return exports
  4127. /******/ return __webpack_require__(__webpack_require__.s = "./assets/js/src/integration/formidableforms.js");
  4128. /******/ })
  4129. /************************************************************************/
  4130. /******/ ({
  4131. /***/ "./assets/js/src/integration/formidableforms.js":
  4132. /*!******************************************************!*\
  4133. !*** ./assets/js/src/integration/formidableforms.js ***!
  4134. \******************************************************/
  4135. /*! no static exports found */
  4136. /***/ (function(module, exports) {
  4137. /***********************************
  4138. * Copyright (c) 2020, Popup Maker
  4139. **********************************/
  4140. {
  4141. var formProvider = "formidableforms";
  4142. var $ = window.jQuery;
  4143. $(document).on("frmFormComplete", function (event, form, response) {
  4144. var $form = $(form);
  4145. var formId = $form.find('input[name="form_id"]').val();
  4146. var $popup = PUM.getPopup($form.find('input[name="pum_form_popup_id"]').val()); // All the magic happens here.
  4147. window.PUM.integrations.formSubmission($form, {
  4148. popup: $popup,
  4149. formProvider: formProvider,
  4150. formId: formId,
  4151. extras: {
  4152. response: response
  4153. }
  4154. });
  4155. });
  4156. }
  4157. /***/ })
  4158. /******/ });
  4159. /******/ (function(modules) { // webpackBootstrap
  4160. /******/ // The module cache
  4161. /******/ var installedModules = {};
  4162. /******/
  4163. /******/ // The require function
  4164. /******/ function __webpack_require__(moduleId) {
  4165. /******/
  4166. /******/ // Check if module is in cache
  4167. /******/ if(installedModules[moduleId]) {
  4168. /******/ return installedModules[moduleId].exports;
  4169. /******/ }
  4170. /******/ // Create a new module (and put it into the cache)
  4171. /******/ var module = installedModules[moduleId] = {
  4172. /******/ i: moduleId,
  4173. /******/ l: false,
  4174. /******/ exports: {}
  4175. /******/ };
  4176. /******/
  4177. /******/ // Execute the module function
  4178. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  4179. /******/
  4180. /******/ // Flag the module as loaded
  4181. /******/ module.l = true;
  4182. /******/
  4183. /******/ // Return the exports of the module
  4184. /******/ return module.exports;
  4185. /******/ }
  4186. /******/
  4187. /******/
  4188. /******/ // expose the modules object (__webpack_modules__)
  4189. /******/ __webpack_require__.m = modules;
  4190. /******/
  4191. /******/ // expose the module cache
  4192. /******/ __webpack_require__.c = installedModules;
  4193. /******/
  4194. /******/ // define getter function for harmony exports
  4195. /******/ __webpack_require__.d = function(exports, name, getter) {
  4196. /******/ if(!__webpack_require__.o(exports, name)) {
  4197. /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
  4198. /******/ }
  4199. /******/ };
  4200. /******/
  4201. /******/ // define __esModule on exports
  4202. /******/ __webpack_require__.r = function(exports) {
  4203. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  4204. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  4205. /******/ }
  4206. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  4207. /******/ };
  4208. /******/
  4209. /******/ // create a fake namespace object
  4210. /******/ // mode & 1: value is a module id, require it
  4211. /******/ // mode & 2: merge all properties of value into the ns
  4212. /******/ // mode & 4: return value when already ns object
  4213. /******/ // mode & 8|1: behave like require
  4214. /******/ __webpack_require__.t = function(value, mode) {
  4215. /******/ if(mode & 1) value = __webpack_require__(value);
  4216. /******/ if(mode & 8) return value;
  4217. /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  4218. /******/ var ns = Object.create(null);
  4219. /******/ __webpack_require__.r(ns);
  4220. /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  4221. /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  4222. /******/ return ns;
  4223. /******/ };
  4224. /******/
  4225. /******/ // getDefaultExport function for compatibility with non-harmony modules
  4226. /******/ __webpack_require__.n = function(module) {
  4227. /******/ var getter = module && module.__esModule ?
  4228. /******/ function getDefault() { return module['default']; } :
  4229. /******/ function getModuleExports() { return module; };
  4230. /******/ __webpack_require__.d(getter, 'a', getter);
  4231. /******/ return getter;
  4232. /******/ };
  4233. /******/
  4234. /******/ // Object.prototype.hasOwnProperty.call
  4235. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  4236. /******/
  4237. /******/ // __webpack_public_path__
  4238. /******/ __webpack_require__.p = "";
  4239. /******/
  4240. /******/
  4241. /******/ // Load entry module and return exports
  4242. /******/ return __webpack_require__(__webpack_require__.s = "./assets/js/src/integration/gravityforms.js");
  4243. /******/ })
  4244. /************************************************************************/
  4245. /******/ ({
  4246. /***/ "./assets/js/src/integration/gravityforms.js":
  4247. /*!***************************************************!*\
  4248. !*** ./assets/js/src/integration/gravityforms.js ***!
  4249. \***************************************************/
  4250. /*! no exports provided */
  4251. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  4252. "use strict";
  4253. __webpack_require__.r(__webpack_exports__);
  4254. /* harmony import */ var _babel_runtime_helpers_typeof__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/typeof */ "./node_modules/@babel/runtime/helpers/typeof.js");
  4255. /* harmony import */ var _babel_runtime_helpers_typeof__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_typeof__WEBPACK_IMPORTED_MODULE_0__);
  4256. /***************************************
  4257. * Copyright (c) 2020, Popup Maker
  4258. ***************************************/
  4259. {
  4260. var formProvider = "gravityforms";
  4261. var $ = window.jQuery;
  4262. var gFormSettings = {};
  4263. $(document).on("gform_confirmation_loaded", function (event, formId) {
  4264. var $form = $("#gform_confirmation_wrapper_" + formId + ",#gforms_confirmation_message_" + formId)[0]; // All the magic happens here.
  4265. window.PUM.integrations.formSubmission($form, {
  4266. formProvider: formProvider,
  4267. formId: formId
  4268. });
  4269. /**
  4270. * TODO - Move this to a backward compatiblilty file, hook it into the pum.integration.form.success action.
  4271. *
  4272. * Listen for older popup actions applied directly to the form.
  4273. *
  4274. * This is here for backward compatibility with form actions prior to v1.9.
  4275. */
  4276. // Nothing should happen if older action settings not applied
  4277. // except triggering of pumFormSuccess event for old cookie method.
  4278. window.PUM.forms.success($form, gFormSettings[formId] || {});
  4279. });
  4280. /**
  4281. * TODO - Move this to a backward compatiblilty file, hook it into the pum.integration.form.success action.
  4282. *
  4283. * Listen for older popup actions applied directly to the form.
  4284. *
  4285. * This is here for backward compatibility with form actions prior to v1.9.
  4286. */
  4287. $(function () {
  4288. $(".gform_wrapper > form").each(function () {
  4289. var $form = $(this),
  4290. formId = $form.attr("id").replace("gform_", ""),
  4291. $settings = $form.find("input.gforms-pum"),
  4292. settings = $settings.length ? JSON.parse($settings.val()) : false;
  4293. if (!settings || _babel_runtime_helpers_typeof__WEBPACK_IMPORTED_MODULE_0___default()(settings) !== "object") {
  4294. return;
  4295. }
  4296. if (_babel_runtime_helpers_typeof__WEBPACK_IMPORTED_MODULE_0___default()(settings) === "object" && settings.closedelay !== undefined && settings.closedelay.toString().length >= 3) {
  4297. settings.closedelay = settings.closedelay / 1000;
  4298. }
  4299. gFormSettings[formId] = settings;
  4300. });
  4301. });
  4302. }
  4303. /***/ }),
  4304. /***/ "./node_modules/@babel/runtime/helpers/typeof.js":
  4305. /*!*******************************************************!*\
  4306. !*** ./node_modules/@babel/runtime/helpers/typeof.js ***!
  4307. \*******************************************************/
  4308. /*! no static exports found */
  4309. /***/ (function(module, exports) {
  4310. function _typeof(obj) {
  4311. "@babel/helpers - typeof";
  4312. if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
  4313. module.exports = _typeof = function _typeof(obj) {
  4314. return typeof obj;
  4315. };
  4316. } else {
  4317. module.exports = _typeof = function _typeof(obj) {
  4318. return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
  4319. };
  4320. }
  4321. return _typeof(obj);
  4322. }
  4323. module.exports = _typeof;
  4324. /***/ })
  4325. /******/ });
  4326. /******/ (function(modules) { // webpackBootstrap
  4327. /******/ // The module cache
  4328. /******/ var installedModules = {};
  4329. /******/
  4330. /******/ // The require function
  4331. /******/ function __webpack_require__(moduleId) {
  4332. /******/
  4333. /******/ // Check if module is in cache
  4334. /******/ if(installedModules[moduleId]) {
  4335. /******/ return installedModules[moduleId].exports;
  4336. /******/ }
  4337. /******/ // Create a new module (and put it into the cache)
  4338. /******/ var module = installedModules[moduleId] = {
  4339. /******/ i: moduleId,
  4340. /******/ l: false,
  4341. /******/ exports: {}
  4342. /******/ };
  4343. /******/
  4344. /******/ // Execute the module function
  4345. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  4346. /******/
  4347. /******/ // Flag the module as loaded
  4348. /******/ module.l = true;
  4349. /******/
  4350. /******/ // Return the exports of the module
  4351. /******/ return module.exports;
  4352. /******/ }
  4353. /******/
  4354. /******/
  4355. /******/ // expose the modules object (__webpack_modules__)
  4356. /******/ __webpack_require__.m = modules;
  4357. /******/
  4358. /******/ // expose the module cache
  4359. /******/ __webpack_require__.c = installedModules;
  4360. /******/
  4361. /******/ // define getter function for harmony exports
  4362. /******/ __webpack_require__.d = function(exports, name, getter) {
  4363. /******/ if(!__webpack_require__.o(exports, name)) {
  4364. /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
  4365. /******/ }
  4366. /******/ };
  4367. /******/
  4368. /******/ // define __esModule on exports
  4369. /******/ __webpack_require__.r = function(exports) {
  4370. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  4371. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  4372. /******/ }
  4373. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  4374. /******/ };
  4375. /******/
  4376. /******/ // create a fake namespace object
  4377. /******/ // mode & 1: value is a module id, require it
  4378. /******/ // mode & 2: merge all properties of value into the ns
  4379. /******/ // mode & 4: return value when already ns object
  4380. /******/ // mode & 8|1: behave like require
  4381. /******/ __webpack_require__.t = function(value, mode) {
  4382. /******/ if(mode & 1) value = __webpack_require__(value);
  4383. /******/ if(mode & 8) return value;
  4384. /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  4385. /******/ var ns = Object.create(null);
  4386. /******/ __webpack_require__.r(ns);
  4387. /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  4388. /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  4389. /******/ return ns;
  4390. /******/ };
  4391. /******/
  4392. /******/ // getDefaultExport function for compatibility with non-harmony modules
  4393. /******/ __webpack_require__.n = function(module) {
  4394. /******/ var getter = module && module.__esModule ?
  4395. /******/ function getDefault() { return module['default']; } :
  4396. /******/ function getModuleExports() { return module; };
  4397. /******/ __webpack_require__.d(getter, 'a', getter);
  4398. /******/ return getter;
  4399. /******/ };
  4400. /******/
  4401. /******/ // Object.prototype.hasOwnProperty.call
  4402. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  4403. /******/
  4404. /******/ // __webpack_public_path__
  4405. /******/ __webpack_require__.p = "";
  4406. /******/
  4407. /******/
  4408. /******/ // Load entry module and return exports
  4409. /******/ return __webpack_require__(__webpack_require__.s = "./assets/js/src/integration/mc4wp.js");
  4410. /******/ })
  4411. /************************************************************************/
  4412. /******/ ({
  4413. /***/ "./assets/js/src/integration/mc4wp.js":
  4414. /*!********************************************!*\
  4415. !*** ./assets/js/src/integration/mc4wp.js ***!
  4416. \********************************************/
  4417. /*! no static exports found */
  4418. /***/ (function(module, exports) {
  4419. /*******************************************************************************
  4420. * Copyright (c) 2020, WP Popup Maker
  4421. ******************************************************************************/
  4422. {
  4423. var formProvider = 'mc4wp';
  4424. var $ = window.jQuery; // Initiate when ready.
  4425. $(function () {
  4426. if (typeof mc4wp !== 'undefined') {
  4427. mc4wp.forms.on('success', function (form, data) {
  4428. var $form = $(form.element),
  4429. formId = form.id,
  4430. formInstanceId = $('.mc4wp-form-' + form.id).index($form) + 1; // All the magic happens here.
  4431. window.PUM.integrations.formSubmission($form, {
  4432. formProvider: formProvider,
  4433. formId: formId,
  4434. formInstanceId: formInstanceId,
  4435. extras: {
  4436. form: form,
  4437. data: data
  4438. }
  4439. });
  4440. });
  4441. }
  4442. });
  4443. }
  4444. /***/ })
  4445. /******/ });
  4446. /******/ (function(modules) { // webpackBootstrap
  4447. /******/ // The module cache
  4448. /******/ var installedModules = {};
  4449. /******/
  4450. /******/ // The require function
  4451. /******/ function __webpack_require__(moduleId) {
  4452. /******/
  4453. /******/ // Check if module is in cache
  4454. /******/ if(installedModules[moduleId]) {
  4455. /******/ return installedModules[moduleId].exports;
  4456. /******/ }
  4457. /******/ // Create a new module (and put it into the cache)
  4458. /******/ var module = installedModules[moduleId] = {
  4459. /******/ i: moduleId,
  4460. /******/ l: false,
  4461. /******/ exports: {}
  4462. /******/ };
  4463. /******/
  4464. /******/ // Execute the module function
  4465. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  4466. /******/
  4467. /******/ // Flag the module as loaded
  4468. /******/ module.l = true;
  4469. /******/
  4470. /******/ // Return the exports of the module
  4471. /******/ return module.exports;
  4472. /******/ }
  4473. /******/
  4474. /******/
  4475. /******/ // expose the modules object (__webpack_modules__)
  4476. /******/ __webpack_require__.m = modules;
  4477. /******/
  4478. /******/ // expose the module cache
  4479. /******/ __webpack_require__.c = installedModules;
  4480. /******/
  4481. /******/ // define getter function for harmony exports
  4482. /******/ __webpack_require__.d = function(exports, name, getter) {
  4483. /******/ if(!__webpack_require__.o(exports, name)) {
  4484. /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
  4485. /******/ }
  4486. /******/ };
  4487. /******/
  4488. /******/ // define __esModule on exports
  4489. /******/ __webpack_require__.r = function(exports) {
  4490. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  4491. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  4492. /******/ }
  4493. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  4494. /******/ };
  4495. /******/
  4496. /******/ // create a fake namespace object
  4497. /******/ // mode & 1: value is a module id, require it
  4498. /******/ // mode & 2: merge all properties of value into the ns
  4499. /******/ // mode & 4: return value when already ns object
  4500. /******/ // mode & 8|1: behave like require
  4501. /******/ __webpack_require__.t = function(value, mode) {
  4502. /******/ if(mode & 1) value = __webpack_require__(value);
  4503. /******/ if(mode & 8) return value;
  4504. /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  4505. /******/ var ns = Object.create(null);
  4506. /******/ __webpack_require__.r(ns);
  4507. /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  4508. /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  4509. /******/ return ns;
  4510. /******/ };
  4511. /******/
  4512. /******/ // getDefaultExport function for compatibility with non-harmony modules
  4513. /******/ __webpack_require__.n = function(module) {
  4514. /******/ var getter = module && module.__esModule ?
  4515. /******/ function getDefault() { return module['default']; } :
  4516. /******/ function getModuleExports() { return module; };
  4517. /******/ __webpack_require__.d(getter, 'a', getter);
  4518. /******/ return getter;
  4519. /******/ };
  4520. /******/
  4521. /******/ // Object.prototype.hasOwnProperty.call
  4522. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  4523. /******/
  4524. /******/ // __webpack_public_path__
  4525. /******/ __webpack_require__.p = "";
  4526. /******/
  4527. /******/
  4528. /******/ // Load entry module and return exports
  4529. /******/ return __webpack_require__(__webpack_require__.s = "./assets/js/src/integration/ninjaforms.js");
  4530. /******/ })
  4531. /************************************************************************/
  4532. /******/ ({
  4533. /***/ "./assets/js/src/integration/ninjaforms.js":
  4534. /*!*************************************************!*\
  4535. !*** ./assets/js/src/integration/ninjaforms.js ***!
  4536. \*************************************************/
  4537. /*! no exports provided */
  4538. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  4539. "use strict";
  4540. __webpack_require__.r(__webpack_exports__);
  4541. /* harmony import */ var _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/slicedToArray */ "./node_modules/@babel/runtime/helpers/slicedToArray.js");
  4542. /* harmony import */ var _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_0__);
  4543. /*******************************************************************************
  4544. * Copyright (c) 2020, WP Popup Maker
  4545. ******************************************************************************/
  4546. {
  4547. var formProvider = 'ninjaforms';
  4548. var $ = window.jQuery;
  4549. var pumNFController = false;
  4550. var initialize_nf_support = function initialize_nf_support() {
  4551. /** Ninja Forms Support */
  4552. if (typeof Marionette !== 'undefined' && typeof nfRadio !== 'undefined' && false === pumNFController) {
  4553. pumNFController = Marionette.Object.extend({
  4554. initialize: function initialize() {
  4555. this.listenTo(nfRadio.channel('forms'), 'submit:response', this.popupMaker);
  4556. },
  4557. popupMaker: function popupMaker(response, textStatus, jqXHR, formIdentifier) {
  4558. var $form = $('#nf-form-' + formIdentifier + '-cont'),
  4559. _formIdentifier$split = formIdentifier.split('_'),
  4560. _formIdentifier$split2 = _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_0___default()(_formIdentifier$split, 2),
  4561. formId = _formIdentifier$split2[0],
  4562. _formIdentifier$split3 = _formIdentifier$split2[1],
  4563. formInstanceId = _formIdentifier$split3 === void 0 ? null : _formIdentifier$split3,
  4564. settings = {}; // Bail if submission failed.
  4565. if (response.errors && response.errors.length) {
  4566. return;
  4567. } // All the magic happens here.
  4568. window.PUM.integrations.formSubmission($form, {
  4569. formProvider: formProvider,
  4570. formId: formId,
  4571. formInstanceId: formInstanceId,
  4572. extras: {
  4573. response: response
  4574. }
  4575. });
  4576. /**
  4577. * TODO - Move this to a backward compatiblilty file, hook it into the pum.integration.form.success action.
  4578. *
  4579. * Listen for older popup actions applied directly to the form.
  4580. *
  4581. * This is here for backward compatibility with form actions prior to v1.9.
  4582. */
  4583. if (response.data && response.data.actions) {
  4584. settings.openpopup = 'undefined' !== typeof response.data.actions.openpopup;
  4585. settings.openpopup_id = settings.openpopup ? parseInt(response.data.actions.openpopup) : 0;
  4586. settings.closepopup = 'undefined' !== typeof response.data.actions.closepopup;
  4587. settings.closedelay = settings.closepopup ? parseInt(response.data.actions.closepopup) : 0;
  4588. if (settings.closepopup && response.data.actions.closedelay) {
  4589. settings.closedelay = parseInt(response.data.actions.closedelay);
  4590. }
  4591. } // Nothing should happen if older action settings not applied
  4592. // except triggering of pumFormSuccess event for old cookie method.
  4593. window.PUM.forms.success($form, settings);
  4594. }
  4595. }); // Initialize it.
  4596. new pumNFController();
  4597. }
  4598. }; // Initiate when ready.
  4599. $(initialize_nf_support);
  4600. }
  4601. /***/ }),
  4602. /***/ "./node_modules/@babel/runtime/helpers/arrayLikeToArray.js":
  4603. /*!*****************************************************************!*\
  4604. !*** ./node_modules/@babel/runtime/helpers/arrayLikeToArray.js ***!
  4605. \*****************************************************************/
  4606. /*! no static exports found */
  4607. /***/ (function(module, exports) {
  4608. function _arrayLikeToArray(arr, len) {
  4609. if (len == null || len > arr.length) len = arr.length;
  4610. for (var i = 0, arr2 = new Array(len); i < len; i++) {
  4611. arr2[i] = arr[i];
  4612. }
  4613. return arr2;
  4614. }
  4615. module.exports = _arrayLikeToArray;
  4616. /***/ }),
  4617. /***/ "./node_modules/@babel/runtime/helpers/arrayWithHoles.js":
  4618. /*!***************************************************************!*\
  4619. !*** ./node_modules/@babel/runtime/helpers/arrayWithHoles.js ***!
  4620. \***************************************************************/
  4621. /*! no static exports found */
  4622. /***/ (function(module, exports) {
  4623. function _arrayWithHoles(arr) {
  4624. if (Array.isArray(arr)) return arr;
  4625. }
  4626. module.exports = _arrayWithHoles;
  4627. /***/ }),
  4628. /***/ "./node_modules/@babel/runtime/helpers/iterableToArrayLimit.js":
  4629. /*!*********************************************************************!*\
  4630. !*** ./node_modules/@babel/runtime/helpers/iterableToArrayLimit.js ***!
  4631. \*********************************************************************/
  4632. /*! no static exports found */
  4633. /***/ (function(module, exports) {
  4634. function _iterableToArrayLimit(arr, i) {
  4635. if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return;
  4636. var _arr = [];
  4637. var _n = true;
  4638. var _d = false;
  4639. var _e = undefined;
  4640. try {
  4641. for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
  4642. _arr.push(_s.value);
  4643. if (i && _arr.length === i) break;
  4644. }
  4645. } catch (err) {
  4646. _d = true;
  4647. _e = err;
  4648. } finally {
  4649. try {
  4650. if (!_n && _i["return"] != null) _i["return"]();
  4651. } finally {
  4652. if (_d) throw _e;
  4653. }
  4654. }
  4655. return _arr;
  4656. }
  4657. module.exports = _iterableToArrayLimit;
  4658. /***/ }),
  4659. /***/ "./node_modules/@babel/runtime/helpers/nonIterableRest.js":
  4660. /*!****************************************************************!*\
  4661. !*** ./node_modules/@babel/runtime/helpers/nonIterableRest.js ***!
  4662. \****************************************************************/
  4663. /*! no static exports found */
  4664. /***/ (function(module, exports) {
  4665. function _nonIterableRest() {
  4666. throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
  4667. }
  4668. module.exports = _nonIterableRest;
  4669. /***/ }),
  4670. /***/ "./node_modules/@babel/runtime/helpers/slicedToArray.js":
  4671. /*!**************************************************************!*\
  4672. !*** ./node_modules/@babel/runtime/helpers/slicedToArray.js ***!
  4673. \**************************************************************/
  4674. /*! no static exports found */
  4675. /***/ (function(module, exports, __webpack_require__) {
  4676. var arrayWithHoles = __webpack_require__(/*! ./arrayWithHoles */ "./node_modules/@babel/runtime/helpers/arrayWithHoles.js");
  4677. var iterableToArrayLimit = __webpack_require__(/*! ./iterableToArrayLimit */ "./node_modules/@babel/runtime/helpers/iterableToArrayLimit.js");
  4678. var unsupportedIterableToArray = __webpack_require__(/*! ./unsupportedIterableToArray */ "./node_modules/@babel/runtime/helpers/unsupportedIterableToArray.js");
  4679. var nonIterableRest = __webpack_require__(/*! ./nonIterableRest */ "./node_modules/@babel/runtime/helpers/nonIterableRest.js");
  4680. function _slicedToArray(arr, i) {
  4681. return arrayWithHoles(arr) || iterableToArrayLimit(arr, i) || unsupportedIterableToArray(arr, i) || nonIterableRest();
  4682. }
  4683. module.exports = _slicedToArray;
  4684. /***/ }),
  4685. /***/ "./node_modules/@babel/runtime/helpers/unsupportedIterableToArray.js":
  4686. /*!***************************************************************************!*\
  4687. !*** ./node_modules/@babel/runtime/helpers/unsupportedIterableToArray.js ***!
  4688. \***************************************************************************/
  4689. /*! no static exports found */
  4690. /***/ (function(module, exports, __webpack_require__) {
  4691. var arrayLikeToArray = __webpack_require__(/*! ./arrayLikeToArray */ "./node_modules/@babel/runtime/helpers/arrayLikeToArray.js");
  4692. function _unsupportedIterableToArray(o, minLen) {
  4693. if (!o) return;
  4694. if (typeof o === "string") return arrayLikeToArray(o, minLen);
  4695. var n = Object.prototype.toString.call(o).slice(8, -1);
  4696. if (n === "Object" && o.constructor) n = o.constructor.name;
  4697. if (n === "Map" || n === "Set") return Array.from(o);
  4698. if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return arrayLikeToArray(o, minLen);
  4699. }
  4700. module.exports = _unsupportedIterableToArray;
  4701. /***/ })
  4702. /******/ });
  4703. /******/ (function(modules) { // webpackBootstrap
  4704. /******/ // The module cache
  4705. /******/ var installedModules = {};
  4706. /******/
  4707. /******/ // The require function
  4708. /******/ function __webpack_require__(moduleId) {
  4709. /******/
  4710. /******/ // Check if module is in cache
  4711. /******/ if(installedModules[moduleId]) {
  4712. /******/ return installedModules[moduleId].exports;
  4713. /******/ }
  4714. /******/ // Create a new module (and put it into the cache)
  4715. /******/ var module = installedModules[moduleId] = {
  4716. /******/ i: moduleId,
  4717. /******/ l: false,
  4718. /******/ exports: {}
  4719. /******/ };
  4720. /******/
  4721. /******/ // Execute the module function
  4722. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  4723. /******/
  4724. /******/ // Flag the module as loaded
  4725. /******/ module.l = true;
  4726. /******/
  4727. /******/ // Return the exports of the module
  4728. /******/ return module.exports;
  4729. /******/ }
  4730. /******/
  4731. /******/
  4732. /******/ // expose the modules object (__webpack_modules__)
  4733. /******/ __webpack_require__.m = modules;
  4734. /******/
  4735. /******/ // expose the module cache
  4736. /******/ __webpack_require__.c = installedModules;
  4737. /******/
  4738. /******/ // define getter function for harmony exports
  4739. /******/ __webpack_require__.d = function(exports, name, getter) {
  4740. /******/ if(!__webpack_require__.o(exports, name)) {
  4741. /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
  4742. /******/ }
  4743. /******/ };
  4744. /******/
  4745. /******/ // define __esModule on exports
  4746. /******/ __webpack_require__.r = function(exports) {
  4747. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  4748. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  4749. /******/ }
  4750. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  4751. /******/ };
  4752. /******/
  4753. /******/ // create a fake namespace object
  4754. /******/ // mode & 1: value is a module id, require it
  4755. /******/ // mode & 2: merge all properties of value into the ns
  4756. /******/ // mode & 4: return value when already ns object
  4757. /******/ // mode & 8|1: behave like require
  4758. /******/ __webpack_require__.t = function(value, mode) {
  4759. /******/ if(mode & 1) value = __webpack_require__(value);
  4760. /******/ if(mode & 8) return value;
  4761. /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  4762. /******/ var ns = Object.create(null);
  4763. /******/ __webpack_require__.r(ns);
  4764. /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  4765. /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  4766. /******/ return ns;
  4767. /******/ };
  4768. /******/
  4769. /******/ // getDefaultExport function for compatibility with non-harmony modules
  4770. /******/ __webpack_require__.n = function(module) {
  4771. /******/ var getter = module && module.__esModule ?
  4772. /******/ function getDefault() { return module['default']; } :
  4773. /******/ function getModuleExports() { return module; };
  4774. /******/ __webpack_require__.d(getter, 'a', getter);
  4775. /******/ return getter;
  4776. /******/ };
  4777. /******/
  4778. /******/ // Object.prototype.hasOwnProperty.call
  4779. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  4780. /******/
  4781. /******/ // __webpack_public_path__
  4782. /******/ __webpack_require__.p = "";
  4783. /******/
  4784. /******/
  4785. /******/ // Load entry module and return exports
  4786. /******/ return __webpack_require__(__webpack_require__.s = "./assets/js/src/integration/wpforms.js");
  4787. /******/ })
  4788. /************************************************************************/
  4789. /******/ ({
  4790. /***/ "./assets/js/src/integration/wpforms.js":
  4791. /*!**********************************************!*\
  4792. !*** ./assets/js/src/integration/wpforms.js ***!
  4793. \**********************************************/
  4794. /*! no static exports found */
  4795. /***/ (function(module, exports) {
  4796. /*******************************************************************************
  4797. * Copyright (c) 2020, WP Popup Maker
  4798. ******************************************************************************/
  4799. {
  4800. var formProvider = 'wpforms';
  4801. var $ = window.jQuery;
  4802. $(document).on('wpformsAjaxSubmitSuccess', '.wpforms-ajax-form', function (event, details) {
  4803. var $form = $(this),
  4804. formId = $form.data('formid'),
  4805. formInstanceId = $('form#' + $form.attr('id')).index($form) + 1; // All the magic happens here.
  4806. window.PUM.integrations.formSubmission($form, {
  4807. formProvider: formProvider,
  4808. formId: formId,
  4809. formInstanceId: formInstanceId
  4810. });
  4811. });
  4812. }
  4813. /***/ })
  4814. /******/ });
  4815. (function (global, factory) {
  4816. typeof exports === 'object' && typeof module !== 'undefined' ? factory() :
  4817. typeof define === 'function' && define.amd ? define(factory) :
  4818. (factory());
  4819. }(this, (function () { 'use strict';
  4820. /**
  4821. * @this {Promise}
  4822. */
  4823. function finallyConstructor(callback) {
  4824. var constructor = this.constructor;
  4825. return this.then(
  4826. function(value) {
  4827. // @ts-ignore
  4828. return constructor.resolve(callback()).then(function() {
  4829. return value;
  4830. });
  4831. },
  4832. function(reason) {
  4833. // @ts-ignore
  4834. return constructor.resolve(callback()).then(function() {
  4835. // @ts-ignore
  4836. return constructor.reject(reason);
  4837. });
  4838. }
  4839. );
  4840. }
  4841. // Store setTimeout reference so promise-polyfill will be unaffected by
  4842. // other code modifying setTimeout (like sinon.useFakeTimers())
  4843. var setTimeoutFunc = setTimeout;
  4844. function isArray(x) {
  4845. return Boolean(x && typeof x.length !== 'undefined');
  4846. }
  4847. function noop() {}
  4848. // Polyfill for Function.prototype.bind
  4849. function bind(fn, thisArg) {
  4850. return function() {
  4851. fn.apply(thisArg, arguments);
  4852. };
  4853. }
  4854. /**
  4855. * @constructor
  4856. * @param {Function} fn
  4857. */
  4858. function Promise(fn) {
  4859. if (!(this instanceof Promise))
  4860. throw new TypeError('Promises must be constructed via new');
  4861. if (typeof fn !== 'function') throw new TypeError('not a function');
  4862. /** @type {!number} */
  4863. this._state = 0;
  4864. /** @type {!boolean} */
  4865. this._handled = false;
  4866. /** @type {Promise|undefined} */
  4867. this._value = undefined;
  4868. /** @type {!Array<!Function>} */
  4869. this._deferreds = [];
  4870. doResolve(fn, this);
  4871. }
  4872. function handle(self, deferred) {
  4873. while (self._state === 3) {
  4874. self = self._value;
  4875. }
  4876. if (self._state === 0) {
  4877. self._deferreds.push(deferred);
  4878. return;
  4879. }
  4880. self._handled = true;
  4881. Promise._immediateFn(function() {
  4882. var cb = self._state === 1 ? deferred.onFulfilled : deferred.onRejected;
  4883. if (cb === null) {
  4884. (self._state === 1 ? resolve : reject)(deferred.promise, self._value);
  4885. return;
  4886. }
  4887. var ret;
  4888. try {
  4889. ret = cb(self._value);
  4890. } catch (e) {
  4891. reject(deferred.promise, e);
  4892. return;
  4893. }
  4894. resolve(deferred.promise, ret);
  4895. });
  4896. }
  4897. function resolve(self, newValue) {
  4898. try {
  4899. // Promise Resolution Procedure: https://github.com/promises-aplus/promises-spec#the-promise-resolution-procedure
  4900. if (newValue === self)
  4901. throw new TypeError('A promise cannot be resolved with itself.');
  4902. if (
  4903. newValue &&
  4904. (typeof newValue === 'object' || typeof newValue === 'function')
  4905. ) {
  4906. var then = newValue.then;
  4907. if (newValue instanceof Promise) {
  4908. self._state = 3;
  4909. self._value = newValue;
  4910. finale(self);
  4911. return;
  4912. } else if (typeof then === 'function') {
  4913. doResolve(bind(then, newValue), self);
  4914. return;
  4915. }
  4916. }
  4917. self._state = 1;
  4918. self._value = newValue;
  4919. finale(self);
  4920. } catch (e) {
  4921. reject(self, e);
  4922. }
  4923. }
  4924. function reject(self, newValue) {
  4925. self._state = 2;
  4926. self._value = newValue;
  4927. finale(self);
  4928. }
  4929. function finale(self) {
  4930. if (self._state === 2 && self._deferreds.length === 0) {
  4931. Promise._immediateFn(function() {
  4932. if (!self._handled) {
  4933. Promise._unhandledRejectionFn(self._value);
  4934. }
  4935. });
  4936. }
  4937. for (var i = 0, len = self._deferreds.length; i < len; i++) {
  4938. handle(self, self._deferreds[i]);
  4939. }
  4940. self._deferreds = null;
  4941. }
  4942. /**
  4943. * @constructor
  4944. */
  4945. function Handler(onFulfilled, onRejected, promise) {
  4946. this.onFulfilled = typeof onFulfilled === 'function' ? onFulfilled : null;
  4947. this.onRejected = typeof onRejected === 'function' ? onRejected : null;
  4948. this.promise = promise;
  4949. }
  4950. /**
  4951. * Take a potentially misbehaving resolver function and make sure
  4952. * onFulfilled and onRejected are only called once.
  4953. *
  4954. * Makes no guarantees about asynchrony.
  4955. */
  4956. function doResolve(fn, self) {
  4957. var done = false;
  4958. try {
  4959. fn(
  4960. function(value) {
  4961. if (done) return;
  4962. done = true;
  4963. resolve(self, value);
  4964. },
  4965. function(reason) {
  4966. if (done) return;
  4967. done = true;
  4968. reject(self, reason);
  4969. }
  4970. );
  4971. } catch (ex) {
  4972. if (done) return;
  4973. done = true;
  4974. reject(self, ex);
  4975. }
  4976. }
  4977. Promise.prototype['catch'] = function(onRejected) {
  4978. return this.then(null, onRejected);
  4979. };
  4980. Promise.prototype.then = function(onFulfilled, onRejected) {
  4981. // @ts-ignore
  4982. var prom = new this.constructor(noop);
  4983. handle(this, new Handler(onFulfilled, onRejected, prom));
  4984. return prom;
  4985. };
  4986. Promise.prototype['finally'] = finallyConstructor;
  4987. Promise.all = function(arr) {
  4988. return new Promise(function(resolve, reject) {
  4989. if (!isArray(arr)) {
  4990. return reject(new TypeError('Promise.all accepts an array'));
  4991. }
  4992. var args = Array.prototype.slice.call(arr);
  4993. if (args.length === 0) return resolve([]);
  4994. var remaining = args.length;
  4995. function res(i, val) {
  4996. try {
  4997. if (val && (typeof val === 'object' || typeof val === 'function')) {
  4998. var then = val.then;
  4999. if (typeof then === 'function') {
  5000. then.call(
  5001. val,
  5002. function(val) {
  5003. res(i, val);
  5004. },
  5005. reject
  5006. );
  5007. return;
  5008. }
  5009. }
  5010. args[i] = val;
  5011. if (--remaining === 0) {
  5012. resolve(args);
  5013. }
  5014. } catch (ex) {
  5015. reject(ex);
  5016. }
  5017. }
  5018. for (var i = 0; i < args.length; i++) {
  5019. res(i, args[i]);
  5020. }
  5021. });
  5022. };
  5023. Promise.resolve = function(value) {
  5024. if (value && typeof value === 'object' && value.constructor === Promise) {
  5025. return value;
  5026. }
  5027. return new Promise(function(resolve) {
  5028. resolve(value);
  5029. });
  5030. };
  5031. Promise.reject = function(value) {
  5032. return new Promise(function(resolve, reject) {
  5033. reject(value);
  5034. });
  5035. };
  5036. Promise.race = function(arr) {
  5037. return new Promise(function(resolve, reject) {
  5038. if (!isArray(arr)) {
  5039. return reject(new TypeError('Promise.race accepts an array'));
  5040. }
  5041. for (var i = 0, len = arr.length; i < len; i++) {
  5042. Promise.resolve(arr[i]).then(resolve, reject);
  5043. }
  5044. });
  5045. };
  5046. // Use polyfill for setImmediate for performance gains
  5047. Promise._immediateFn =
  5048. // @ts-ignore
  5049. (typeof setImmediate === 'function' &&
  5050. function(fn) {
  5051. // @ts-ignore
  5052. setImmediate(fn);
  5053. }) ||
  5054. function(fn) {
  5055. setTimeoutFunc(fn, 0);
  5056. };
  5057. Promise._unhandledRejectionFn = function _unhandledRejectionFn(err) {
  5058. if (typeof console !== 'undefined' && console) {
  5059. console.warn('Possible Unhandled Promise Rejection:', err); // eslint-disable-line no-console
  5060. }
  5061. };
  5062. /** @suppress {undefinedVars} */
  5063. var globalNS = (function() {
  5064. // the only reliable means to get the global object is
  5065. // `Function('return this')()`
  5066. // However, this causes CSP violations in Chrome apps.
  5067. if (typeof self !== 'undefined') {
  5068. return self;
  5069. }
  5070. if (typeof window !== 'undefined') {
  5071. return window;
  5072. }
  5073. if (typeof global !== 'undefined') {
  5074. return global;
  5075. }
  5076. throw new Error('unable to locate global object');
  5077. })();
  5078. if (!('Promise' in globalNS)) {
  5079. globalNS['Promise'] = Promise;
  5080. } else if (!globalNS.Promise.prototype['finally']) {
  5081. globalNS.Promise.prototype['finally'] = finallyConstructor;
  5082. }
  5083. })));