1 2function closeRegisterVoucherLayer() { 3 $('.register-login-backgroundlayer, .register-login-layer').fadeOut(666); 4 $('.register-login-layer').html(''); 5 window.location.hash = ""; 6} 7 8function registerRegisterVoucherLayerMenuButton() { 9 // CLOSE BUTTON 10 $('button.register-login-layer-close-button').on('click', function () { 11 closeRegisterVoucherLayer(); 12 }); 13 14 // TAB BUTTONS 15 $('button.menu-button').on('click', function () { 16 var nextTabId = $(this).data('tab-id'); 17 $('button.menu-button').removeClass('active'); 18 $(this).addClass('active'); 19 $('.register-login-layer-tab').removeClass('active'); 20 $('.register-login-layer-tab[data-tab-id="' + nextTabId + '"]').addClass('active'); 21 22 switch (nextTabId) { 23 case 1: 24 $('.register-login-layer-tab[data-tab-id="1"] .register-login-layer-container').removeClass('active'); 25 $('.register-login-layer-tab[data-tab-id="1"] .register-login-layer-container[data-container-id="1"]').addClass('active'); 26 $('.register-login-layer-tab[data-tab-id="1"] input[name="barcode"]').focus(); 27 break; 28 case 2: 29 $('.register-login-layer-tab[data-tab-id="2"] input[name="email"]').focus(); 30 break; 31 } 32 }); 33} 34 35function updateMenuButtonTextRegisterVoucherLayer() { 36 $('button.menu-button.active').html($('.register-login-layer-tab[data-tab-id="1"] .register-login-layer-container.active').data('menu-button-text')); 37} 38 39function checkVoucher(voucher, project, callback) { 40 var body = { 41 m: 'check_voucher', 42 voucher: voucher, 43 project: project, 44 language_id: ENV.id_language 45 }; 46 47 $.get("/register-login/api/register_voucher", body, function (success) { 48 callback(success); 49 }); 50 51} 52 53function setAclByVoucher(voucher, project, callback) { 54 var body = { 55 m: 'set_acl_by_voucher', 56 voucher: voucher, 57 project: project, 58 language_id: ENV.id_language 59 }; 60 61 $.get("/register-login/api/register_voucher", body, function (success) { 62 callback(success); 63 }); 64} 65 66function registerRegisterVoucherLayerContainerButtons() { 67 68 // LOGIN BUTTON 69 function clickVoucherButton() { 70 var voucher = $('input[name="voucher"]').val(); 71 var project = $('.register-login-layer').data('project'); 72 73 checkVoucher(voucher, project, function (success) { 74 if (success === true) { 75 $('.voucher-error').hide();
76 setAclByVoucher(voucher, project, function (success) { 77 if (success === true) { 78 $('.register-login-layer-tab[data-tab-id="1"] .register-login-layer-container').removeClass('active'); 79 $('.register-login-layer-tab[data-tab-id="1"] .register-login-layer-container[data-container-id="302"]').addClass('active'); 80 $('.register-login-layer-tab[data-tab-id="1"] .register-login-layer-container[data-container-id="302"] .ml-headline').html(data.data.headline); 81 $('.register-login-layer-tab[data-tab-id="1"] .register-login-layer-container[data-container-id="302"] .ml-text').html(data.data.text); 82 updateMenuButtonTextRegisterVoucherLayer(); 83 } else { 84 $('.voucher-error').fadeIn(500); 85 } 86 }); 87 88 } else { 89 $('.voucher-error').html(success).fadeIn(500); 90 } 91 }); 92 } 93 94 $('button.voucher-button').on('click', function () { 95 clickVoucherButton(); 96 }); 97 98 $('input[name="voucher"]').on('keypress', function (e) { 99 if (e.which == 13) { 100 clickVoucherButton(); 101 } 102 }); 103 104 $('button.voucher-success-button').on('click', function () { 105 window.history.replaceState(null, null, "?"); 106 closeRegisterVoucherLayer(); 107 CbUx.showLoader(); 108 window.location.reload(); 109 }); 110 111} 112 113function registerRegisterVoucherLayerButtons() { 114 registerRegisterVoucherLayerMenuButton(); 115 registerRegisterVoucherLayerContainerButtons(); 116} 117 118function openRegisterVoucherLayer() { 119 var body = { 120 m: "register_voucher_layer", 121 project: $('.register-login-layer').data('project'), 122 language_id: ENV.id_language 123 }; 124 125 CbUx.showLoader(); 126 $.get("/register-login/api/register_voucher", body, function (data) { 127 CbUx.hideLoader(); 128 $('.register-login-layer').html(data); 129 $('.register-login-backgroundlayer, .register-login-layer').fadeIn(666); 130 131 registerRegisterVoucherLayerButtons(); 132 $('nav .menu-button.active').focus(); 133 updateMenuButtonTextRegisterVoucherLayer(); 134 }); 135 136 if ($('#film-sile-layer-close-button').length > 0) { 137 $('#film-sile-layer-close-button').click(); 138 } 139} 140 141function getUrlParameter(sParam) { 142 var sPageURL = window.location.search.substring(1), 143 sURLVariables = sPageURL.split('&'), 144 sParameterName, 145 i; 146 147 for (i = 0; i < sURLVariables.length; i++) { 148 sParameterName = sURLVariables[i].split('='); 149 150 if (sParameterName[0] === sParam) { 151 return typeof sParameterName[1] === undefined ? true : decodeURIComponent(sParameterName[1]); 152 } 153 } 154 return false; 155} 156; 157 158$(document).ready(function () { 159 $('.register-voucher-layer-button').on('click', $('body'), function () { 160 openRegisterVoucherLayer(); 161 }); 162 163});
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.