PageSourceSearch

https://concertinisrael.com/tickchak/js/tickchak.functions.js?c=3

js concertinisrael.com collected 2026-09-26 03:11:20 UTC 42,512 bytes, 958 lines download raw bytes

1function ts2date(ts){
2	var date=new Date(ts*1000);
3	var year = date.getFullYear();
4	var month = (1 + date.getMonth()).toString();
5	month = month.length > 1 ? month : '0' + month;
6	var day = date.getDate().toString();
7	day = day.length > 1 ? day : '0' + day;
8	return day + '.' + month + '.' + year;
9}
10
11function date2ts(date,time){
12	return new Date(date.substr(6), parseInt(date.substr(3,2))-1, date.substr(0,2), (time?time.substr(0,2):0), (time?time.substr(3):0), 0).getTime() / 1000;
13}
14
15function getTimeRemaining(endtime){
16  var t = endtime - (new Date()).getTime();
17  if(t<=0)
18	return {total:0,days:0,hours:0,minutes:0,seconds:0}
19  var seconds = Math.floor( (t/1000) % 60 );
20  var minutes = Math.floor( (t/60000) % 60 );
21  var hours = Math.floor( (t/(1000*60*60)) % 24 );
22  var days = Math.floor( t/(1000*60*60*24) );
23  return {
24    total: t,
25    days: days,
26    hours: hours,
27    minutes: minutes,
28    seconds: seconds
29  };
30}
31
32function dateUpdateToTimezone(date, timezone) {
33    var invdate = new Date(date.toLocaleString('en-US', {
34        timeZone: timezone
35    }));
36
37    var diff = date.getTime() - invdate.getTime();
38    return new Date(date.getTime() - diff);
39}
40
41function ts2time(ts) {
42    var time_zone = 'Asia/Jerusalem';
43    if(typeof TICKCHAK != 'undefined' && TICKCHAK && TICKCHAK.event && TICKCHAK.event.time_zone){
44        time_zone = TICKCHAK.event.time_zone;
45    }
46    var date = dateUpdateToTimezone(new Date(ts * 1000),time_zone);
47	var hours = "0" + date.getHours();
48	var minutes = "0" + date.getMinutes();
49	return hours.substr(-2) + ':' + minutes.substr(-2);
50}
51
52function validTime(time) {
53	return time.match(/^[\d]{2}:[\d]{2}$/);
54}
55function validDate(date) {
56	return date.match(/^[\d]{2}(\/|.)[\d]{2}(\/|.)[\d]{4}$/);
57}
58function validTZ(r){if(r.toString().length==0)return!1;for(var n,t=("00000000"+r).slice(-9),a=0,e=0;9>e;e++)n=parseInt(t[e]),e%2!=0&&(n*=2,n>9&&(n=n%10+1)),a+=n;return a%=10,0==a?!0:!1}
59function validCC(val) { return (val.length<2?false:(val.length<12?true:validateCreditCard(val)!='BAD'));}
60
61
62
63function formatNumber(string) {
64    string=parseNumber(string);
65    var parts = string.toString().split(".");
66    parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ",");
67    return parts.join(".");
68}
69function formatDecimal(num){
70    num=parseFloat(num).toFixed(2);
71    number = num % 1 == 0 ? parseInt(num) : num;
72    return number.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
73}
74
75function formatDecimalNoComma(num){
76    num=parseFloat(num).toFixed(2);
77    number = num % 1 == 0 ? parseInt(num) : num;
78    return number.toString();
79}
80
81function formatDecimalDesigned(num, payments=1){
82    num=formatDecimal(num/payments).replace(/[^0-9.]/g, '');
83        remainder = num % 1 == 0? "" : parseInt((num % 1).toFixed(2)*100);
84        if(remainder<10 && remainder>0)
85        remainder="0"+remainder;
86        integer = parseInt(num).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
87        var number = '<span class="integer-de">'+integer+'</span><sup class="remainder-de">'+remainder+'</sup>'
88
89    return number;
90}
91
92function formatPrice(string) {
93	string=parsePrice(string);
94    var parts = string.toFixed(2).toString().split(".");
95    parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ",");
96    return parts.join(".");
97}
98
99function parseDecimal(string) {
100    if(string==null)
101        string=0;
102    return parseFloat(string.toString().replace(/[^0-9.\-]/g,'')).toFixed(2);
103}
104function parseDecimalNumber(string) {
105    if(string==null)
106        string=0;
107    string=string.toString().replace(/[^0-9.\-]/g,'');
108    var number = string % 1 == 0 ? parseInt(string) : parseFloat(string).toFixed(2);
109    return number;
110}
111
112function parseNumber(string) {
113    if(string==null)
114        string=0;
115	return parseInt(Math.floor(string.toString().replace(/[^0-9.\-]/g,'')));
116}
117
118function parsePrice(string) {
119	return parseFloat(string.toString().replace(/[^0-9.]/g,''))|0;
120}
121
122function nl2br(str){
123    return (str + '').replace(/([^>\r\n]?)(\r\n|\n\r|\r|\n)/g, '$1<br />$2');
124}
125
126function hex2rgb(hex) {
127	return parseInt(hex,16);
128}
129function rgb2hex(rgb) {
130	return ('000000'+parseInt(rgb).toString(16)).slice(-6);
131}
132function css_color(rgb) {
133	return '#'+rgb2hex(rgb);
134}
135
136function invertColor(rgbhex){
137	return invertCssColor(rgbhex.toString());
138	function invertCssColor(color) {
139		var rgb = invertColor(hexColor2rgb(color));
140		return rgb2hexColor(rgb);
141	}
142	function invertColor(rgb) {
143		var yuv = rgb2yuv(rgb);
144		var factor = 90;
145		var threshold = 100;
146		yuv.y = clamp(yuv.y + (yuv.y > threshold ? -factor : factor));
147		return yuv2rgb(yuv);
148	}
149	function rgb2hexColor(rgb) {
150		return dec2hex(rgb.r) + dec2hex(rgb.g) + dec2hex(rgb.b);
151	}
152	function hexColor2rgb(color) {
153		return {
154			r: parseInt(color.substring(0, 2), 16),
155			g: parseInt(color.substring(2, 4), 16),
156			b: parseInt(color.substring(4, 6), 16)
157		};
158	}
159	function dec2hex(n) {
160		var hex = n.toString(16);
161		if (hex.length < 2) {
162			return '0' + hex;
163		}
164		return hex;
165	}
166	function rgb2yuv(rgb){
167	  var y = clamp(rgb.r *  0.29900 + rgb.g *  0.587   + rgb.b * 0.114);
168	  var u = clamp(rgb.r * -0.16874 + rgb.g * -0.33126 + rgb.b * 0.50000 + 128);
169	  var v = clamp(rgb.r *  0.50000 + rgb.g * -0.41869 + rgb.b * -0.08131 + 128);
170	  return {y:y, u:u, v:v};
171	}
172	function yuv2rgb(yuv){
173	  var y = yuv.y;
174	  var u = yuv.u;
175	  var v = yuv.v;
176	  var r = clamp(y + (v - 128) *  1.40200);
177	  var g = clamp(y + (u - 128) * -0.34414 + (v - 128) * -0.71414);
178	  var b = clamp(y + (u - 128) *  1.77200);
179	  return {r:r,g:g,b:b};
180	}
181	function clamp(n){
182		if (n<0) { return 0;}
183		if (n>255) { return 255;}
184		return Math.floor(n);
185	}
186}
187
188function parseUrl(url) {
189	var parser = document.createElement('a');
190	parser.href = url;
191	return parser;
192
193	/*parser.protocol; // => "http:"
194	parser.hostname; // => "example.com"
195	parser.port;     // => "3000"
196	parser.pathname; // => "/pathname/"
197	parser.search;   // => "?search=test"
198	parser.hash;     // => "#hash"/*
199	parser.host;     // => "example.com:3000"*/
200}
201
202(function($){
203    $.fn.getStyleObject = function(){
204        var dom = this.get(0);
205        var style;
206        var returns = {};
207        if(window.getComputedStyle){
208            var camelize = function(a,b){
209                return b.toUpperCase();
210            };
211            style = window.getComputedStyle(dom, null);
212            for(var i = 0, l = style.length; i < l; i++){
213                var prop = style[i];
214                var camel = prop.replace(/\-([a-z])/g, camelize);
215                var val = style.getPropertyValue(prop);
216                returns[camel] = val;
217            };
218            return returns;
219        };
220        if(style == dom.currentStyle){
221            for(var prop in style){
222                returns[prop] = style[prop];
223            };
224            return returns;
225        };
226        return this.css();
227    }
228})(jQuery);
229
230function html_escape(str) {
231	var htmlEscapes = {
232		'&': '&amp;',
233		'<': '&lt;',
234		'>': '&gt;',
235		'"': '&quot;',
236		"'": '&#x27;',
237		'/': '&#x2F;'
238	  };
239
240	  // Regex containing the keys listed immediately above.
241	  var htmlEscaper = /[&<>
241"'\/]/g;
242
243	  // Escape a string for HTML interpolation.
244	return ('' + str).replace(htmlEscaper, function(match) {
245	  return htmlEscapes[match];
246	});
247}
248
249function youtube_parse(url) {
250    var regExp = /^.*(youtu.be\/|v\/|u\/\w\/|embed\/|shorts\/|watch\?v=|\&v=)([^#\&\?]*).*/;
251    var match = url.match(regExp);
252
253    if (match && match[2].length == 11) {
254        return match[2];
255    } else {
256        return 'error';
257    }
258}
259
260function vimeo_parse(url) {
261    var code = url.substring(18);
262    return code;
263}
264
265function getRotationDegrees(obj) {
266    var matrix = obj.css("-webkit-transform") ||
267        obj.css("-moz-transform")    ||
268        obj.css("-ms-transform")     ||
269        obj.css("-o-transform")      ||
270        obj.css("transform");
271    if(matrix !== 'none' && matrix) {
272        var values = matrix.split('(')[1].split(')')[0].split(',');
273        var a = values[0];
274        var b = values[1];
275        var angle = Math.round(Math.atan2(b, a) * (180/Math.PI));
276    } else { var angle = 0; }
277    return (angle < 0) ? angle + 360 : angle;
278}
279var permission_package;
280function has_access_js(perm,obj ,update) {
281    if(!permission_package)
282        permission_package=TICKCHAK.permission;
283    // $.post('/ajax/tickchak/get_package_permission',{pid:TICKCHAK.is_manager?TICKCHAK.package.pid:TICKCHAK.event.pid},function (data) {
284    //     permission_package=data.permission;
285    //     return has_access_js_update(perm,obj,update);
286    // });
287    // else {
288        return has_access_js_update(perm,obj,update);
289	// }
290}
291function has_access_js_update(perm,obj,update) {
292    if(permission_package.indexOf(perm)==-1 && !TICKCHAK.is_master){
293    	if(update){
294            obj.addClass('no-access');
295            // $.post('/ajax/tickchak/get_role_package',{pid:TICKCHAK.is_manager?TICKCHAK.package.pid:TICKCHAK.event.pid},function (data) {
296            //     if(data.result=='ok' && data.role=='owner'){
297                if(TICKCHAK.role=='owner'){
298                    obj.append('<div class="no-access-upgrade _pac-img"><div class="pac-upgrade"><div>'+tl('רוצה גם?')+'</div><div>'+tl('באפשרותכם לשדרג חבילה ולהוסיף אלמנטים')+'</div><div class="btn-white">'+tl('שדרגו חבילה')+'</div></div></div>')
299                    $('.no-access-upgrade').hover(function () {
300                        $(this).parent().find('.pac-upgrade').addClass('show')
301                    },function () {
302                        $(this).parent().find('.pac-upgrade').removeClass('show')
303                    });
304                    $('.pac-upgrade .btn-white').click(function () {
305                        if(!$(this).hasClass('area'))
306                            package_upgrade();
307                    });
308                }
309            // });
310		}
311        return false;
312    }
313    return true
314}
315
316var package_permission = [];
317package_permission.push({name: tl('כרטיסים ללא עלות/מוזמנים'),pac_1: tl('1.9 ש"ח'),pac_2: tl('100 כרטיסים לאירוע מעבר 1.9 ש"ח'),pac_3: tl('חופשי')},
318    {name: tl('אירוע עד 100 כרטיסים'),pac_1: tl('חופשי'),pac_2: tl('חופשי'),pac_3: tl('חופשי')},
319    {name: tl('כרטיסים בתשלום'),pac_1: tl('5% + מע"מ'),pac_2: tl('2.5% + מע"מ'),pac_3: tl('מחיר שמותאם בשבילך')},
320    {name: tl('חיבור מסלקה עצמאית'),pac_1: '-',pac_2: '-',pac_3: 'v'},
321    {name: tl('הקמת אירועים'),pac_1: tl('ללא הגבלה'),pac_2: tl('ללא הגבלה'),pac_3: tl('ללא הגבלה')},
322    {name: tl('מסרון ומייל ברכישה'),pac_1: tl('חינם'),pac_2: tl('חינם'),pac_3: tl('חינם')},
323    {name: tl('ממשק דיוור'),pac_1: 'v',pac_2: 'v',pac_3: 'v'},
324    {name: tl('לניהול אירועים CRM'),pac_1: 'v',pac_2: 'v',pac_3: 'v'},
325    {name: tl('ניהול קהלים'),pac_1: '-',pac_2: 'v',pac_3: 'v'},
326    {name: tl('הטמעות'),pac_1: '-',pac_2: 'v',pac_3: 'v'},
327    {name: tl('דומיין יחודי'),pac_1: '-',pac_2: 'v',pac_3: 'v'},
328    {name: tl('מודל הרצאות'),pac_1: '-',pac_2: '-',pac_3: 'v'},
329    {name: tl('מודל מקומות (בתאום עם המשרד)'),pac_1: 'v',pac_2: 'v',pac_3: 'v'},
330    //{name: 'מודל הסעות',pac_1: '-',pac_2: 'v',pac_3: 'v'},
331    {name: tl('ביטול עסקה'),pac_1: '2 ש"ח',pac_2: tl('חינם'),pac_3: tl('חינם')},
332    {name: tl('מודל מרכזי מבקרים'),pac_1: '-',pac_2: '-',pac_3: 'v'},
333    {name: tl('קבוצות כרטיסים'),pac_1: '-',pac_2: 'v',pac_3: 'v'},
334    {name: tl('תשלומים'),pac_1: '-',pac_2: 'v',pac_3: 'v'},
335    {name: tl('קופון קבוצתי'),pac_1: '-',pac_2: '-',pac_3: 'v'},
336    {name: tl('ממשק עיצוב דפי מכירה'),pac_1: 'v',pac_2: 'v',pac_3: 'v'},
337    {name: tl('פיקסל מותאם אישית'),pac_1: 'v',pac_2: 'v',pac_3: 'v'},
338    {name: tl('שרות לקוחות'),pac_1: tl(" צ'ט נציג"),pac_2: tl("מענה בטלפון, צ'ט נציג"),pac_3: tl("מנהל תיק לקוחות אישי")})
339
340function package_upgrade(new_user) {
341	return;
342    if(new_user){
343        title=tl('אנחנו נרגשים לקבל את פניכם!');
344        text=tl('בחר חבילה, ונתחיל לעבוד. אה... ויש כמה פרטים שיש להשלים בכדי שנוכל להעביר לכם את התשלום :)')
345    }
346    else{
347        new_user=0
348        title=tl('תמיד מרגש להשתדרג');
349        text=tl('שדרגו לאחת מהחבילות שלנו! לא מצאתם את מה שאתם מחפשים פנו לנציג שרות')
350    }
351    $('body').append('<div class="_pop-screen-frame">' +
352        '<div class="_pop-screen packages"><div class="_close _close-svg"></div>' +
353        '<div class="packages-top"><div>'+title+'</div><div>'+text+'</div></div>' +
354        '<div class="packages-type"><div class="packages-type-top"><div></div><div class="packages-type-top-pac" data-type="1"><div class="img"></div><div class="title">'+tl('חבילת בירה')+'</div><div class="text">'+tl('למפיקים שרוצים פשוט להתחיל למכור')+'</div>
354<div class="pac-details"><div class="pac-details-price"><span>₪</span>0<span>'+tl('בחודש')+'</span></div><div class="pac-details-details"><div class="pac-details-comment"></div></div></div></div><div class="packages-type-top-pac" data-type="3"><div class="img"></div><div class="title">'+tl('חבילת קוקטייל')+'</div><div class="text">'+tl('מתאימים את עצמינו בול אליך, דבר איתנו ותופתע!')+'</div><div class="pac-details"><div class="pac-details-price">'+tl('מחיר שמותאם בשבילך')+'</div><div class="pac-details-details"><div class="pac-details-comment">'+tl('יש לנו הפתעות בשבילכם')+'</div></div></div></div><div class="packages-type-top-pac" data-type="2"><div class="img"></div><div class="title">'+tl('מרלו')+'</div><div class="text">'+tl('לארגונים ועסקים שהולכים להפיק הרבה אירועים קטנים | עד 700 כרטיסים לאירוע')+'</div><div class="pac-details"><div class="pac-details-price"><span>₪</span>290<span>'+tl('בחודש')+'</span></div><div class="pac-details-details"><div class="pac-details-comment">+'+tl('מע"מ')+'</div></div></div></div></div>' +
355        '<ul class="_scroll"></ul>' +
356        '<div class="packages-type-bottom"><div></div><div data-type="1"><div class="btn">'+tl('החלו להשתמש עכשיו!')+'</div></div><div data-type="3"><div class="btn">'+tl('סגרנו עסקה')+'</div></div><div data-type="2"><div class="btn">'+tl('סגרנו עסקה!')+'</div></div></div>' +
357        '</div>' +
358        '</div></div>');
359    $('.packages-type').append('<div class="package-lines"></div>');
360    $('.packages-type').append('<div class="package-special"></div><div class="package-special-curent"></div>');
361
362    $('._close').click(function () {
363        $('._pop-screen-frame').remove();
364    })
365
366    $.each(package_permission, function (i, item) {
367        $('.packages-type ul').append('<li><div>'+item.name+'</div><div class="pac-1" data-type="1">'+item.pac_1+'</div><div  class="pac-3" data-type="3">'+item.pac_3+'</div><div  class="pac-2" data-type="2">'+item.pac_2+'</div></li>')
368    });
369
370    var pac_type= TICKCHAK.package.type
371    if(pac_type && pac_type!=0){
372        $('.packages-type-bottom div[data-type="'+pac_type+'"] .btn').text('').removeClass('btn').addClass('your');
373        $('.packages-type ul li>div.pac-'+pac_type+', .packages-type-bottom > div[data-type="'+pac_type+'"],.packages-type-top-pac[data-type="'+pac_type+'"]').css({'pointer-events':'none'});
374        $('.package-special-curent').addClass('show pac-type'+pac_type);
375    }
376
377
378    $('.packages-type ul li>div[class^="pac-"], .packages-type-bottom > div,.packages-type-top-pac').hover(function () {
379        var type=$(this).attr('data-type');
380        //dont focus on package 2
381        if(type != 2) {
382            $('.package-special').addClass('show');
383            $('.package-special').addClass('pac-type' + type);
384            $('.packages-type-bottom div[data-type="' + type + '"] div').addClass('focus');
385        }
386    },function () {
387        $('.package-special').removeClass().addClass('package-special');
388        $('.packages-type-bottom div div').removeClass('focus');
389    });
390    $('.packages-type-bottom > div').click(function () {
391        select_package($(this).attr('data-type'),new_user)
392    });
393    $('.packages-type-top-pac > div').click(function () {
394        select_package($(this).parents('.packages-type-top-pac').attr('data-type'),new_user)
395    });
396    $('.packages-type ul li div[class^="pac-"]').click(function () {
397        select_package($(this).attr('data-type'),new_user)
398    })
399
400}
401function select_package(pac_type,new_user) {
402    setTimeout(function(){
403        $('.pop-go-to-package').hide();
404    },100)
405
406    if (pac_type!=2) {
407        change_package(pac_type, 0, new_user)
408    }
409    else {
410        $('._pop-screen.packages').append('<div class="packages-pay-pop"><div class="pac-pay-pop-top"><div class="_close _close-svg"></div><div class="pac-pay-pop-top-price cur">
410'+tl('מחיר')+'</div><div class="pac-pay-pop-top-pay">'+tl('תשלום')+'</div></div><div class="pac-pay-pop-contain price"></div></div>')
411        build_price();
412        $('.pac-pay-pop-top div:not(._close)').click(function () {
413            $('.pac-pay-pop-top div').removeClass('cur');
414            $(this).addClass('cur');
415            if($(this).hasClass('pac-pay-pop-top-price'))
416                build_price()
417            else
418                build_pay($('.pac-pay-pop-contain input[name="pay"]:checked').val());
419        });
420        $('._close').click(function () {
421            $('.packages-pay-pop').remove();
422        })
423
424
425        function build_price() {
426            $('.pac-pay-pop-contain').html('<div><input id="monthly" type="radio" name="pay"  value="month" checked><label for="monthly"></label><input id="yearly" type="radio" name="pay" value="year" ><label for="yearly"></label></div><div class="pac-pay-pop-m"><div class="price">₪340</div><div class="text">לחודש</div><div class="total">₪4,080</div></div><div class="pac-pay-pop-y"><div class="price">₪290</div><div class="text">לחודש<br> בתשלום לשנה</div><div class="total">₪3,480</div></div><div class="pac-pay-pop-btn"></div>').removeClass('pay').addClass('price')
427            $('.pac-pay-pop-top-pay').removeClass('cur');
428            $('.pac-pay-pop-top-price').addClass('cur');
429            // if(!exist_card)
430            $('.pac-pay-pop-btn').html('<div class="btn-white other-ticket">'+tl('שדרגו חבילה')+'</div>');
431            // else
432            //     $('.pac-pay-pop-btn').html('<div class="btn">שלם בכרטיס 1456</div><div class="other-ticket">כרטיס אחר</div>');
433            $('.other-ticket').click(function () {
434                build_pay($('.pac-pay-pop-contain input[name="pay"]:checked').val());
435            })
436
437        }
438        function build_pay(monthly){
439            $('.pac-pay-pop-contain').html('<div><div style="height: 168px;padding: 58px;">'+tl('בקרוב תוכלו לשלם באמצעות כרטיס אשראי')+'</div><div class="btn">'+tl('חייבו אותי מעמלת הסליקה')+'</div></div>').removeClass('pay').addClass('price')
440            $('.pac-pay-pop-contain .btn').click(function () {
441                change_package(2,monthly=='month'?1:0,new_user);
442            })
443            $('.pac-pay-pop-top-price').removeClass('cur');
444            $('.pac-pay-pop-top-pay').addClass('cur');
445        }
446    }
447}
448function change_package(type,monthly_payment,new_package) {
449    prev_type=TICKCHAK.package.type;
450
451    $.post('/ajax/tickchak/change_package',{pid:TICKCHAK.is_manager?TICKCHAK.package.pid:TICKCHAK.event.pid,type:type,monthly_payment:monthly_payment,new:new_package},function (data) {
452        if(data.result=='ok'){
453            if(prev_type == 0 && type > 0) {
454                var npid = TICKCHAK.is_manager?TICKCHAK.package.pid:TICKCHAK.event.pid;
455                TICKCHAK.inbox_control.inbox_push(4, npid,0,0,0);
456                TICKCHAK.inbox_control.inbox_push(3, npid,0,0,0);
457
458                //TICKCHAK.inbox_control.inbox_refresh(705);
459                //TICKCHAK.inbox_control.showAlert();
460            }
461            if(type==3){
462                title=tl('תודה!');
463                text=tl('כדי שתוכל להתחיל לטקצ\'אק פתחנו בעבורך את החבילת בירה הבסיסית נציגינו יחזרו אליך עד 24 שעות עם הצעה לקוקטייל משובח במיוחד לטעמך.')
464            }
465            else{
466                if(data.days){
467                    title=''
468                    text=tl('זוהי ירידה לצורך עליה, אנו בטוחים... חבילתכם תתעדכן עוד '+data.days+' ימים. תמיד תוכלו לשוב ולשדרג.');
469                }
470                else if(data.type_prev){
471                    title=tl('מה יוצאים לחופשה?')
472                    text=tl('נציג השרות יחזור אליכם ויחד נתפור לכם חבילה מהחלומות')
473                }
474                else {
475                    title=tl('בחרתם טוב!!' );
476                    text=  tl('מיד תועברו להשלמת פרטי החבילה בקרוב נאשר אתכם ותוכלו להקים את האירוע שלכם...');
477                }
478
479            }
480            $('.packages-pay-pop').remove();
481            $('.packages-type').append('<div class="packages-pay-pop"><div class="packages-type-end"><div class="title">'+title+'</div><p>'+text+'</p><div class="btn-white">'+tl('המשך')+'<span>15</span></div></div></div>')
482
483            count=15;
484            couner();
485            $('.packages-type-end .btn-white').click(function () {
486                $('._pop-screen-frame').remove();
487                location.reload();
488            })
489            function couner() {
490                setTimeout(function () {
491                    if(count>0 && $('.packages-type-end .btn-white span').length){
492                        count--;
493                        $('.packages-type-end .btn-white span').text(count)
494                        couner();
495                    }
496                    else {
497                        $('.packages-type-end .btn-white').click();
498                    }
499                },1000);
500            }
501        }
502
503    })
504}
505function check_owner() {
506    // $.post('/ajax/tickchak/get_role_package',{pid:TICKCHAK.is_manager?TICKCHAK.package.pid:TICKCHAK.event.pid},function (data) {
507    //     if(data.result=='ok' && data.role=='owner')
508        if(TICKCHAK.role=='owner')
509            return true;
510        else
511            return false;
512    // })
513}
514function readCookie(name) {
515    var nameEQ = encodeURIComponent(name) + "=";
516    var ca = document.cookie.split(';');
517    for (var i = 0; i <=ca.length-1; i++) {
518        var c = ca[i];
519        while (c.charAt(0) === ' ') c = c.substring(1, c.length);
520        if (c.indexOf(nameEQ) === 0) return decodeURIComponent(c.substring(nameEQ.length, c.length));
521    }
522    return null;
523}
524
525var tl_post_count=0;
526var translation_strings_temp=[];
527function tl(str,options){
528    if((typeof TICKCHAK=='undefined' || !TICKCHAK.user))
529        return str;
530    if(TICKCHAK.user.lang=='he'&&str.indexOf('{') == -1){
531        return str;
532    }
533
534    if(TICKCHAK.user.lang=='he'){
535        if(typeof options!='undefined'&&options.params){
536            $.each(options.params,function(param,value){
537                str=str.replace('{'+param+'}',value);
538            });
539        }
540        return str;
541    }
542
543    if(typeof tickchak_translation_strings == 'undefined'){
544        try{
545            // parent access throws SecurityError when the form is embedded cross-origin
546            if(typeof parent.tickchak_translation_strings != 'undefined')
547                window.tickchak_translation_strings = parent.tickchak_translation_strings;
548        }catch(e){}
549        // pages that don't inline the strings (event page template) fall back to
550        // lazy per-string registration below instead of crashing the caller
551        if(typeof tickchak_translation_strings == 'undefined')
552            window.tickchak_translation_strings = {};
553    }
554
555    if(tickchak_translation_strings[str]){
556        str = tickchak_translation_strings[str];
557    } else if(translation_strings_temp.indexOf(str) === -1){
558        if(tl_post_count<10){
559            translation_strings_temp.push(str);
560            tl_post_count++;
561            $.post('/ajax/api/register_js_translation',{string:str},function(data){
562                tickchak_translation_strings[str] = data.string;
563            });
564        }
565    }
566
567    if(typeof options!='undefined'&&options.params){
568        $.each(options.params,function(param,value){
569            str=str.replace('{'+param+'}',value);
570        });
571    }
572    return str;
573}
574
575function tl2(str,options){
576
577
578
579
580    if((typeof TICKCHAK=='undefined' || !TICKCHAK.user))
581        return str;
582    if(TICKCHAK.user.lang=='he'&&str.indexOf('{') == -1){
583        return str;
584    }
585
586
587    if(TICKCHAK.user.lang=='he'&&typeof tickchak_translation_strings=='undefined'){
588        if(typeof options!='undefined'&&options.params){
589            $.each(options.params,function(param,value){
590                str=str.replace('{'+param+'}',value);
591            });
592        }
593        return str;
594    }
595
596    if(typeof tickchak_translation_strings_reversed=='undefined'&&typeof tickchak_translation_strings!='undefined'){
597        window.tickchak_translation_strings_reversed={};
598        $.each(tickchak_translation_strings,function(i,v){
599            if(TICKCHAK.is_master||TICKCHAK.user.uid==439)
600                tickchak_translation_strings_reversed[v]=i;
601            else
602                tickchak_translation_strings_reversed[v]=v;
603        });
604    }
605
606    //if(TICKCHAK.user.uid==439&&!tickchak_translation_strings){
607
608    //}
609
610    if(typeof tickchak_translation_strings_reversed!='undefined')
611        if(tickchak_translation_strings_reversed[str]){
612            str=tickchak_translation_strings_reversed[str];
613        } else {
614    		console.log(str,TICKCHAK.user.lang);
615            if(tl_post_count++<10)
616                $.post('/ajax/api/register_js_translation',{string:str},function(){});
617        }
618
619    if(typeof options!='undefined'&&options.params){
620        $.each(options.params,function(param,value){
621            str=str.replace('{'+param+'}',value);
622        });
623    }
624
625
626    return str;
627
628
629    $.each(tickchak_translation_strings,function(i,v){
630       tickchak_translation_strings[v]=v;
631    });
632
633    if(tickchak_translation_strings[str]){
634        str=tickchak_translation_strings[str];
635        if(typeof options!='undefined'&&options.params){
636            $.each(options.params,function(param,value){
637                str=str.replace('{'+param+'}',value);
638            });
639        }
640        return str;
641    }
642
643    if(tl_post_count++<10)
644        $.post('/ajax/api/register_js_translation',{string:str},function(){});
645
646    return str;
647}
648function iframe_on_load() {
649    $('.iframe-loader').remove();
650}
651
652function tday(day,format){
653    var days= {
654        he: {
655            short : ['ש', 'א', 'ב', 'ג', 'ד', 'ה', 'ו'],
656            full : ['שבת', 'ראשון', 'שני', 'שלישי', 'רביעי', 'חמישי', 'שישי']
657        },
658        en : {
659            short: ['Sa', 'Su', 'Mo', 'Tu', 'We', 'Th', 'Fr'],
660            full : ['Saturday', 'Sunday', 'Monday', 'Tuesday', 'Wendsday', 'Thursday', 'Friday']
661        }
662    };
663
664    if(TICKCHAK.user.lang){
665        var lang = TICKCHAK.user.lang;
666    }
667
668    var final_day = days[lang][format][day] ? days[lang][format][day] : day;
669    return final_day;
670
671}
672
673function GetMonthName(monthNumber, lang) {
674    var months = [];
675    if(!lang || lang == 'he'){
676        months = ['ינואר', 'פברואר', 'מרץ', 'אפריל', 'מאי', 'יוני', 'יולי', 'אוגוסט', 'ספטמבר', 'אוקטובר', 'נובמבר', 'דצמבר'];
677    } else {
678        months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];
679    }
680    return months[monthNumber];
681}
682function GetMonthNumber(monthName) {
683    var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
684    var num = (months.indexOf(monthName)+1).toString().length ==1?  "0"+(months.indexOf(monthName)+1).toString():(months.indexOf(monthName)+1).toString();
685    return num;
686}
687function GetDayName(dayNumber, lang) {
688    var days = [];
689    if(!lang || lang == 'he'){
690        days = ['ראשון', 'שני', 'שלישי', 'רביעי', 'חמישי', 'שישי', 'שבת'];
691    } else {
692        days = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];
693    }
694    return days[dayNumber];
695}
696
697function getQueryString() {
698    for (var e = {}, n = window.location.search.substring(1), o = n.split("&"), t = 0; t < o.length; t++) {
699        var r = o[t].split("=");
700        if ("undefined" == typeof e[r[0]])
701            e[r[0]] = decodeURIComponent(r[1]);
702        else if ("string" == typeof e[r[0]]) {
703            var i = [e[r[0]], decodeURIComponent(r[1])];
704            e[r[0]] = i;
705        } else
706            e[r[0]].push(decodeURIComponent(r[1]));
707    }
708    return e;
709}
710
711function get_banks() {
712    var banks = [];
713    banks.push(
714        {id: '99', title: 'בנק ישראל'}, {id: '12', title: 'הפועלים'}, {id: '10', title: 'לאומי'},
715        {id: '11', title: 'דיסקונט'}, {id: '20', title: 'מזרחי טפחות'}, {id: '31', title: 'הבינלאומי הראשון'},
716        {id: '14', title: 'אוצר החייל'}, {id: '17', title: 'מרכנתיל דיסקונט'}, {id: '9', title: 'הדואר'},
717        {id: '13', title: 'איגוד'}, {id: '46', title: 'מסד'}, {id: '52', title: 'פועלי אגודת ישראל'},
718        {id: '90', title: 'דיסקונט למשכנתאות'}, {id: '77', title: 'לאומי למשכנתאות בע"מ'}, {id: '4', title: 'יהב לעובדי המדינה'},
719        {id: '26', title: 'יובנק'}, {id: '7', title: 'בנק לפיתוח התעשיה'}, {id: '8', title: 'בנק הספנות לישראל'},
720        {id: '6', title: 'בנק אדנים'}, {id: '54', title: 'בנק ירושלים'}, {id: '34', title: 'בנק ערבי ישראיל'},
721        {id: '1', title: 'בנק יורו טרייד'}, {id: '19', title: 'בנק החקלאות לישראל'}, {id: '48', title: 'קופת העובד הלאומי'},
722        {id: '23', title: 'HSBC'}, {id: '67', title: 'Arab Land Bank'}, {id: '25', title: 'BNP Paribas Israel'},
723        {id: '39', title: 'SBI State Bank of India'}, {id: '22', title: 'סיטי'}, {id: '68', title: 'בנק אוצר השלטון המקומי'},
724        {id: '18', title: 'וואן זירו'}
725    );
726    return banks;
727 }
728
729function get_Base64() {
730    var Base64={_keyStr:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789
730+/=",encode:function(r){var t,e,o,a,h,c,n,d="",C=0;for(r=Base64._utf8_encode(r);C<r.length;)a=(t=r.charCodeAt(C++))>>2,h=(3&t)<<4|(e=r.charCodeAt(C++))>>4,c=(15&e)<<2|(o=r.charCodeAt(C++))>>6,n=63&o,isNaN(e)?c=n=64:isNaN(o)&&(n=64),d=d+this._keyStr.charAt(a)+this._keyStr.charAt(h)+this._keyStr.charAt(c)+this._keyStr.charAt(n);return d},decode:function(r){var t,e,o,a,h,c,n="",d=0;for(r=r.replace(/[^A-Za-z0-9\+\/\=]/g,"");d<r.length;)t=this._keyStr.indexOf(r.charAt(d++))<<2|(a=this._keyStr.indexOf(r.charAt(d++)))>>4,e=(15&a)<<4|(h=this._keyStr.indexOf(r.charAt(d++)))>>2,o=(3&h)<<6|(c=this._keyStr.indexOf(r.charAt(d++))),n+=String.fromCharCode(t),64!=h&&(n+=String.fromCharCode(e)),64!=c&&(n+=String.fromCharCode(o));return n=Base64._utf8_decode(n)},_utf8_encode:function(r){r=r.replace(/\r\n/g,"\n");for(var t="",e=0;e<r.length;e++){var o=r.charCodeAt(e);o<128?t+=String.fromCharCode(o):(127<o&&o<2048?t+=String.fromCharCode(o>>6|192):(t+=String.fromCharCode(o>>12|224),t+=String.fromCharCode(o>>6&63|128)),t+=String.fromCharCode(63&o|128))}return t},_utf8_decode:function(r){for(var t="",e=0,o=c1=c2=0;e<r.length;)(o=r.charCodeAt(e))<128?(t+=String.fromCharCode(o),e++):191<o&&o<224?(c2=r.charCodeAt(e+1),t+=String.fromCharCode((31&o)<<6|63&c2),e+=2):(c2=r.charCodeAt(e+1),c3=r.charCodeAt(e+2),t+=String.fromCharCode((15&o)<<12|(63&c2)<<6|63&c3),e+=3);return t}};
731    return Base64;
732}
733window.tickchak_animation={}
734function fire_animation(name,callback) {
735    load_animation(name,function () {
736        window.tickchak_animation[name]()
737        if(callback)
738            callback()
739    });
740}
741function load_animation(name,callback) {
742    var arr=[]
743    if(!$('script[src="https://code.createjs.com/createjs-2015.11.26.min.js"]').length)
744        arr.push("https://code.createjs.com/createjs-2015.11.26.min.js");
745    if(!$('script[src="/tickchak/js/inc/tick-anim.js"]').length)
746        arr.push("/tickchak/js/inc/tick-anim.js")
747    if(name){
748        if(!$('script[src="/tickchak/anim/anim-'+name+'/tick-anim.js"]').length){
749            arr.push("/tickchak/anim/anim-"+name+"/tick-anim.js")
750            arr.push("/tickchak/anim/anim-"+name+"/tick-anim-exp.js")
751        }
752    }
753    if(arr.length)
754        loadScripts(arr,callback)
755    else if(callback)
756        callback();
757}
758function loadScripts(sources,callback) {
759    var i=0
760    $.each(sources,function (i,src) {
761        var script = document.createElement('script');
762        script.src = src;
763        script.async = false; //<-- the important part
764        script.onload=function () {
765            if(++i==sources.length && callback)
766                callback()
767        }
768        document.body.appendChild( script ); //<-- make sure to append to body instead of head
769    });
770}
771function htmlDecode(input) {
772    var doc = new DOMParser().parseFromString(input, "text/html");
773    return doc.documentElement.textContent;
774}
775//
776function app_domain_to_link(){
777	return TICKCHAK.new_app && TICKCHAK.tickchak_app_domain ? TICKCHAK.tickchak_app_domain : '';
778}
779
780function handlePortalIframe($elem){
781	if(TICKCHAK.event.eid == 27950 || TICKCHAK.event.eid == 102961
782		|| TICKCHAK.event.eid == 103307 || TICKCHAK.event.eid == 106507){
783		$elem.remove();
784		return;
785	}
786    $.post('/ajax/api_v2/userPortal',{eid:TICKCHAK.event.eid},function (data) {
787
788        const defaultImage = "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' id='b6252e10dfabf914d820f849a1e9f6ed' width='34' height='34' viewBox='0 0 34 34'%3E%3Cdefs%3E%3CclipPath id='clip-path'%3E%3Crect id='Rectangle_1454' data-name='Rectangle 1454' width='34' height='34'/%3E%3C/clipPath%3E%3C/defs%3E%3Cg id='Group_2316' data-name='Group 2316'%3E%3Cg id='Group_2315' data-name='Group 2315' clip-path='url(%23clip-path)'%3E%3Cpath id='Path_6950' data-name='Path 6950' d='M17,21.221a6.182,6.182,0,1,1,6.182-6.182A6.182,6.182,0,0,1,17,21.221M17,34A17,17,0,1,0,0,17,17,17,0,0,0,17,34M7.145,28.849a10.64,10.64,0,0,1,19.71,0,15.412,15.412,0,1,0-19.71,0' transform='translate(-0.001)' fill-rule='evenodd'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E";
789
790        const setUser = (firstName, lastName, image) =>{
791            if(firstName)
792                $elem.text(`${firstName} ${lastName}`);
793
794            if(image)
795                $('<div class="in"></div>').prependTo($elem).css('background-image', `url(${image})`);
796            $elem.addClass('connected')
797
798        }
799
800        const portalUser = data.portalUser;
801
802        setUser(portalUser.first_name, portalUser.last_name, portalUser.profile_image);
803
804        $elem.click(()=>{
805	        const currentOrigin = window.location?.origin?.replace(/^(https?:\/\/)/, '');
806	        
807	        const isOtherDomain = !currentOrigin.endsWith('tickchak.co.il') &&
808		        currentOrigin !== 'tickchak.co.il' && !data.isLocalhost;
809			if(isOtherDomain){
810				window.open('https://live.tickchak.co.il/portal/login?source=tickchak', '_blank');
811			} else {
812				openPortalPop();
813			}
814        });
815
816        // Broadcasts a message recursively to every descendant frame, so a deeply nested
817        // consumer iframe (e.g. top → form iframe → /subscriptionStatus iframe) receives
818        // portal-close notifications regardless of nesting depth.
819        const descendantOrigins = [TICKCHAK.liveUrl, TICKCHAK.consumer_form_domain].filter(Boolean);
820        const broadcastToDescendants = (message, win) => {
821            win = win || window;
822            for(let i = 0; i < win.frames.length; i++) {
823                try {
824                    descendantOrigins.forEach(origin => win.frames[i].postMessage(message, origin));
825                    broadcastToDescendants(message, win.frames[i]);
826                } catch(e) {}
827            }
828        };
829
830        const notifyPortalClosed = () => {
831            broadcastToDescendants({type: 'PARENT_PORTAL_CLOSED'});
832        };
833
834        const messageHandlers = {
835            SET_USER: (data) => {
836                const user = data.user;
837                setUser(user.firstName, user.lastName, user.profileImage);
838                closePortalPop();
839            },
840            CLOSE_PORTAL: () => {
841                $('.portalPop, .portalPop-backdrop').removeClass('show');
842                notifyPortalClosed();
843            },
844            LOGOUT_PORTAL: () => {
845                setUser(tl('אזור אישי'), '', defaultImage);
846                $elem.removeClass('connected')
847                notifyPortalClosed();
848            }
849        };
850
851        const isValidMessage = (event) => {
852            return event.origin === TICKCHAK.liveUrl && event.data && event.data.type in messageHandlers;
853        };
854
855        const receiveMessage = (event) => {
856            if(!isValidMessage(event)) return;
857            const handler = messageHandlers[event.data.type];
858            if(handler) {
859                handler(event.data);
860            }
861        };
862
863        // Show backdrop alongside popup so cross-origin iframes on the page don't swallow
864        // outside clicks. Matches the blur-overlay pattern used by PortalPopup in
865        // tickchak-consumer and tickchak-live.
866        const openPortalPop = () => {
867            $('.portalPop, .portalPop-backdrop').addClass('show');
868        };
869        const closePortalPop = () => {
870            const portalFrame = $('.portalPop iframe')[0];
871            if(portalFrame && portalFrame.contentWindow) {
872                portalFrame.contentWindow.postMessage({type: 'CLOSE_PORTAL'}, TICKCHAK.liveUrl);
873            }
874            $('.portalPop, .portalPop-backdrop').removeClass('show');
875            notifyPortalClosed();
876        };
877
878        // Open the portal popup when a descendant consumer iframe requests it.
879        // We accept the message based on event.data.type — the click that produced it
880        // already required the user to be on a page that loaded our consumer iframe.
881        const receiveConsumerRequest = (event) => {
882            if(descendantOrigins.length && descendantOrigins.indexOf(event.origin) === -1) return;
883            if(!event.data || event.data.type !== 'CONSUMER_OPEN_PORTAL') return;
884            openPortalPop();
885        };
886
887        if(!$('.portalPop').length){
888            window.addEventListener('message', receiveMessage, false);
889            window.addEventListener('message', receiveConsumerRequest, false);
890            $('body').append(
891                `<div class='portalPop-backdrop'></div>
892                <div class='portalPop' >
893                        <iframe tabindex="-1" width=100% height=100% src=${TICKCHAK.liveUrl}/portal/login?source=tickchak&innerWidth=${window.innerWidth}></iframe>
894                    </div>`
895            )
896            $(document).on('click.portalPop', '.portalPop-backdrop', closePortalPop);
897        }
898    })
899}
900
901function validatePassword(password, email, phone) {
902	if(!password || !email){
903		return {result: 'bad', error: "חסר אימייל או סיסמה"};
904	}
905	if (password.length < 8 || password.length > 24) {
906		return {result: 'bad', error: "אורך הסיסמה צריך להיות בין 8 ל-24 תווים."};
907	}
908
909	// לפחות אות גדולה אחת
910	if (!/[A-Z]/.test(password)) {
911		return {result: 'bad', error: "הסיסמה צריכה לכלול לפחות אות גדולה אחת."};
912	}
913
914	// לפחות אות קטנה אחת
915	if (!/[a-z]/.test(password)) {
916		return {result: 'bad', error: "הסיסמה צריכה לכלול לפחות אות קטנה אחת."};
917	}
918
919	// לפחות סמל אחד
920	if (!/[!@#$%^&*(),.?":{}|<>]/.test(password)) {
921		return {result: 'bad', error: "הסיסמה צריכה לכלול לפחות סמל אחד."};
922	}
923
924	// לפחות מספר אחד
925	if (!/\d/.test(password)) {
926		return {result: 'bad', error: "הסיסמה צריכה לכלול לפחות מספר אחד."};
927	}
928
929	// הסיסמה לא יכולה להכיל את מספר הטלפון או האימייל
930	if (password.includes(email) || (phone && password.includes(phone))) {
931		return {result: 'bad', error: "הסיסמה לא יכולה להכיל את מספר הטלפון או את האימייל."};
932	}
933
934	// בדיקת סיסמאות נפוצות
935	let commonPasswords = [
936		"Password1!",
937		"Welcome123@",
938		"Qwerty@789",
939		"Monkey@456",
940		"Football#99",
941		"Sunshine2*",
942		"Dragon@98",
943		"Shadow123$",
944		"Superman1#",
945		"Baseball9%",
946		"Trustno1@!",
947		"Master$12",
948		"Freedom@22",
949		"Batman@99#",
950		"Princess@#1"
951	];
952	if (commonPasswords.includes(password.toUpperCase())) {
953		return {result: 'bad', error: "הסיסמה נפוצה מדי."};
954	}
955
956	// אם הכל תקין
957	return {result: 'good'};
958}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.