PageSourceSearch

https://www.acteursbelangen.nl/wp-content/themes/act2019/js/actor_scripts.js?ver=1029656339

js acteursbelangen.nl collected 2026-09-24 21:38:01 UTC 15,257 bytes, 447 lines download raw bytes

1let soundManagerLoaded = false;
2let soundman;
3
4$(document).ready(function() {
5  $('.header_author ul a').on('click', function(e) {
6    e.preventDefault();
7    if ($(".section--" + $(this).attr('data-type')).length > 0) {
8      $('html, body').animate({
9        scrollTop: $(".section--" + $(this).attr('data-type')).offset().top - $('.header_top').height() - parseInt($(".section--" + $(this).attr('data-type')).css('margin-top'))
10      }, 300);
11    }
12  });
13
14  $('body').on('click', '.edit_buttons.edit_buttons--author a, .button--edit.button--edit_author, .profile_menu_link ul.subscriber_menu a, .mobile_nav .user_menu--subscriber a', function(e) {
15    if ($(this).attr('href') === '#') {
16      e.preventDefault();
17
18      const actorid = userId;
19      const type = $(this).attr('data-type');
20
21      if (type) {
22        if ($('body').hasClass('body--menuopen')) $('body').removeClass('body--menuopen');
23        showPopup(actorid, type);
24      }
25    }
26  });
27
28  $('body.author .header').on('mouseenter', function() {
29    $('body.author .header .header_bottom').addClass("header_bottom--vis");
30  });
31
32  $('body.author .header').on('mouseleave', function() {
33    $('body.author .header .header_bottom').removeClass("header_bottom--vis");
34  });
35
36  $('body').on('click', '.button--logout', function(e) {
37    e.preventDefault();
38
39    let html = "<div class='logout_popup'>";
40      html += "<div class='logout_popup_inner'>";
41        html += "<h2>Weet je zeker dat je wilt uitloggen?</h2>";
42        html += "<div class='popup_buttons'>";
43          html += "<a href='#' class='popup_close button button--white button--autowidth'>Annuleren</a>";
44          html += "<a href='" + $(this).attr('href') + "' class='button button--green button--autowidth'>Ok</a></div>";
45      html += "</div>";
46    html += "</div>";
47
48    $('body').prepend(html);
49  });
50
51  $('body').on('click', '.logout_popup .popup_close', function(e) {
52    e.preventDefault();
53    $('.logout_popup').remove();
54  });
55
56  $('body').on('click', '.button--send_email', function(e) {
57    e.preventDefault();
58    const actorid = $(this).closest('.page--actor').attr('data-actor-id');
59    showPopup(actorid, 'send_email');
60  });
61
62  if ($(".section_content--videolist").length === 1) {
63    if ($('.section_content--videolist .video_box[data-show-home="1"]').length > 0) {
64      let videos = $('.section_content--videolist .video_box').show();
65
66      const newVideos = videos.filter(function(index, video) { return $(video).attr('data-show-home') === "1" });
67      const otherVideos = videos.filter(function(index, video) { return $(video).attr('data-show-home') != "1" || $(video).attr('data-show-home') === "" }).hide();
68      $('.section_content--videolist').html(newVideos).append(otherVideos);
69    }
70  }
71
72  $('body').on('change', 'select[name=video_category]', function(e) {
73    const val = $(this).val();
74    let videos = $(this).closest('.section--videos_actor').find('.section_content--videolist .video_box').show();
75
76    videos.sort(function (a, b) {
77      const orderA = parseInt($(a).attr('data-order'));
78      const orderB = parseInt($(b).attr('data-order'));
79      return (orderA < orderB) ? -1 : (orderA > orderB) ? 1 : 0;
80    });
81
82    if (val === '') {
83      $(this).closest('.section--videos_actor').find('.section_content--videolist').html(videos);
84    } else {
85      const newVideos = videos.filter(function(index, video) { return $(video).attr('data-category') === val });
86      const otherVideos = videos.filter(function(index, video) { return $(video).attr('data-category') != val || $(video).attr('data-category') === "" }).hide();
87      $(this).closest('.section--videos_actor').find('.section_content--videolist').html(newVideos).append(otherVideos);
88    }
89  });
90
91  $('body').on('change', '.section_header select[name=photo_category]', function(e) {
92    const val = $(this).val();
93    $('.photobox').removeClass('photobox--hide');
94
95    if (val !== '') {
96      $('.photobox[data-category!="' + val + '"]').addClass('photobox--hide');
97    }
98
99    createGalleries();
100  });
101
102  if ($('.section_content--audiolist .audio_box').length > 0) {
103    soundman = soundManager.setup({
104      onready: function() {
105        soundManagerLoaded = true;
106      }
107    });
108    if ($('.section_content--audiolist .audio_box[data-show-home="1"]').length > 0) {
109      let audio = $('.section_content--audiolist .audio_box').show();
110
111      const newAudio = audio.filter(function(index, aud) { return $(aud).attr('data-show-home') === '1' });
112      const otherAudio = audio.filter(function(index, aud) { return $(aud).attr('data-show-home') != '1' || $(aud).attr('data-show-home') === "" }).hide();
113
114      $('.section_content--audiolist').html(newAudio).append(otherAudio);
115    }
116  }
117
118  $('body').on('change', 'select[name=audio_category]', function(e) {
119    const val = $(this).val();
120    let audio = $(this).closest('.section--audio').find('.section_content--audiolist .audio_box').show();
121
122    if (soundManagerLoaded) {
123      soundman.stopAll();
124    }
125
126    audio.sort(function (a, b) {
127      const orderA = parseInt($(a).attr('data-order'));
128      const orderB = parseInt($(b).attr('data-order'));
129      return (orderA < orderB) ? -1 : (orderA > orderB) ? 1 : 0;
130    });
131
132    if (val === '') {
133      $(this).closest('.section--audio').find('.section_content--audiolist').html(audio);
134    } else {
135      const newAudio = audio.filter(function(index, aud) { return $(aud).attr('data-category') === val });
136      const otherAudio = audio.filter(function(index, aud) { return $(aud).attr('data-category') != val || $(aud).attr('data-category') === "" }).hide();
137      $(this).closest('.section--audio').find('.section_content--audiolist').html(newAudio).append(otherAudio);
138    }
139  });
140
141  $('body').on('click', '.button--download_cv', function(e) {
142    e.preventDefault();
143    const actorid = $(this).closest('.page--actor').attr('data-actor-id');
144    const that = $(this);
145
146    showPopup(actorid, 'download_cv');
147  });
148
149  if ($('.cv .cv_blocks').length > 0) {
150    var $grid = $('.cv').masonry({
151      itemSelector: '.cv_block_elm',
152      percentPosition: true,
153      gutter:20,
154      transitionDuration:0
155    });
156  }
157
158  $('body').on('click', '.cv_row--customfields', function(e) {
159    e.preventDefault();
160
161    if ($(this).hasClass('cv_row--customfields--open')) {
162      $(this).removeClass('cv_row--customfields--open');
163    } else {
164      $('.cv_row--customfields').removeClass('cv_row--customfields--open');
165      $(this).addClass('cv_row--customfields--open');
166    }
167    $grid.masonry('layout');
168  });
169
170});
171
172function showPopup(actorid, type) {
173  let title = 'Account';
174  if (type != 'account' && type != 'facturatie' && type != 'password') title = type.replace('_',' ');
175  if (type === 'photos') title = "Foto's";
176  if (type === 'profile_picture') title = "Profielfoto";
177  if (type === 'description') title = "Omschrijving";
178  if (type === 'links') title = "Links en social media";
179  if (type === 'send_email') title = "Verstuur een bericht";
180  if (type === 'other_cv') title = "Verstuur een bericht";
181
182  if ($('.popup').length > 0) {
183    removePopup();
184  }
185
186  if (soundManagerLoaded) {
187    soundman.stopAll();
188  }
189
190  const popup = createPopup(title);
191
192  $('body').prepend(popup);
193  let scriptURL;
194
195  switch(type) {
196    case "links":
197      scriptURL = templateDir + "/services/actors/links.php";
198      break;
199    case "videos":
200      scriptURL = templateDir + "/services/actors/videos.php";
201      break;
202    case "photos":
203      scriptURL = templateDir + "/services/actors/photos.php";
204      break;
205    case "audio":
206      scriptURL = templateDir + "/services/actors/audio.php";
207      break;
208    case "cv":
209      scriptURL = templateDir + "/services/actors/cv.php";
210      break;
211    case "other_cv":
212      scriptURL = templateDir + "/services/actors/cv.php?page=other_cv";
213      break;
214    case "profile_picture":
215      scriptURL = templateDir + "/services/actors/profile_picture.php";
216      break;
217    case "facturatie":
218      scriptURL = templateDir + "/services/actors/account.php?page=invoice";
219      break;
220    case "password":
221      scriptURL = templateDir + "/services/actors/account.php?page=password";
222      break;
223    case "agentschap":
224      scriptURL = templateDir + "/services/actors/account.php?page=agent";
225      break;
226    case "bio":
227      scriptURL = templateDir + "/services/actors/cv.php?page=description";
228      break;
229    case "download_cv":
230      scriptURL = templateDir + "/services/actors/download_cv.php";
231      break;
232    case "send_email":
233      scriptURL = templateDir + "/services/actors/send_email.php";
234      break;
235    default:
236      scriptURL = templateDir + "/services/actors/account.php";
237  }
238
239  $.ajax({
240    url: scriptURL,
241    data: { actorid: actorid },
242    cache: false,
243    headers: {
244      'Cache-Control': 'no-cache, no-store, must-revalidate',
245      'Pragma': 'no-cache'
246    }
247  }).done(function(res) {
248    if (res === 'WRONG') removePopup();
249    else {
250      $('body').addClass('body--noscroll');
251      $('.popup_content').removeClass('popup_content--loading').html(res);
252      setSelects();
253      setSwitches();
254      setPasswordFields();
255      loadEditor();
256      linkActions();
257      videoActions();
258      photoActions();
259      audioActions();
260      cvActions();
261      sendActorMessage();
262      setImageUploaderFields();
263      setUploadFormFields();
264
265      $('.popup .popup_tabs a').on('click', function(e) {
266        e.preventDefault();
267        const type = $(this).attr('data-type');
268        resetActorForm();
269        if (noty !== '') noty.close();
270
271        if (!$(this).hasClass('active')) {
272          $('.popup_tabs a').removeClass('active');
273          $('.tab').addClass('hide');
274          $(this).addClass('active');
275          $('.tab.' + type).removeClass('hide');
276
277          $('.popup .popup_content').animate({ scrollTop: 0 }, 0);
278        }
279      });
280
281      $('.popup .popup_list').on('click', '.add_item', function(e) {
282        e.preventDefault();
283        $('.popup .popup_tabs a[data-type^="insert"]').click();
284      });
285    }
286  });
287
288  $('.popup .popup_inner').on('click', function(e) {
289    e.stopPropagation();
290  });
291
292  $('.popup .popup_close').on('click', function(e) {
293    e.preventDefault();
294    removePopup();
295  });
296}
297
298function createPopup(title) {
299  return "<div class='popup'><div class='popup_inner'><div class='popup_title'><h2>" + title + "</h2><a href='#' class='popup_close'></a></div><div class='popup_content popup_content--loading'><i class='fas fa-circle-notch fa-spin'></i></div></div></div>";
300}
301
302function removePopup() {
303  if ($('.popup #tinymce').length === 1) {
304    unloadEditor();
305  }
306  $('body').removeClass('body--noscroll');
307  $('.popup').remove();
308  $('.popup').off('click');
309  $('.popup .popup_inner').off('click');
310  $('.popup .popup_tabs a').off('click');
311  $('.popup .popup_list .add_item').off('click');
312  if (noty !== '') noty.close();
313}
314
315function resetActorForm() {
316  $('.popup_content .tab form').each(function() {
317    if (!$(this).hasClass('form--account') && !$(this).hasClass('form--password') && !$(this).hasClass('form--contact') && !$(this).hasClass('form--main_cv') && !$(this).hasClass('form--sizes_cv') && !$(this).hasClass('form--specifications_cv') && !$(this).hasClass('form--other_cv')) $(this).resetForm();
318
319    if ($(this).find('.select').length > 0) {
320      $(this).find('.select').each(function() {
321        if ($(this).find('.new_option').length === 1) {
322          $(this).find('.new_option').remove();
323          $(this).find('select').show();
324        }
325      })
326    }
327
328    if ($(this).find('.form_column--search_results').length > 0) {
329      $(this).find('.form_column--search_results .results').html('');
330    }
331
332    if ($(this).find('.form_column--img_uploader').length > 0) {
333      $(this).find('.form_column--img_uploader').each(function() {
334        if ($(this).find('.image').hasClass('ui-resizable')) {
335          $(this).find('.image').resizable('destroy').draggable('destroy');
336        }
337
338        $(this).find('.uploader_container').removeClass('uploader_container--p
338ortrait uploader_container--landscape');
339        $(this).find('.uploader_buttons').removeClass('uploader_buttons--show').find('.button.active').removeClass('active');
340        $(this).find('.image').remove();
341
342        $(this).find('input[type=hidden]').val('');
343      });
344    }
345
346    if ($(this).find('.form_column--upload_file').length > 0) {
347      $(this).find('.form_column--upload_file').each(function() {
348        $(this).find('span').html('');
349        $(this).find('input[type=file]').val('');
350      });
351    }
352
353    if ($(this).find('.custom_field_rows').length > 0) {
354      $(this).find('.custom_field_rows .row').remove();
355    }
356
357
358  });
359}
360
361function updateActorPage() {
362  const url = window.location.href;
363
364  $.ajax({
365    url: url,
366    type: 'GET',
367    cache: false,
368    headers: {
369      'Cache-Control': 'no-cache, no-store, must-revalidate',
370      'Pragma': 'no-cache'
371    }
372  }).done(function(data) {
373    let actorElm = $(data).find('.page--actor');
374    $('.page--actor').html($(actorElm).html());
375    setSelects();
376    elms = $('.section--photos .section_content--photolist .photobox').length > 0 ? $('.section--photos .section_content--photolist .photobox') : [];
377    tempElms = [];
378
379    createGalleries();
380    lazyLoadInstance.update();
381
382    if (soundManagerLoaded) {
383      soundman.reboot();
384    }
385
386    if ($('.cv .cv_blocks').length > 0) {
387      var $grid = $('.cv').masonry({
388        itemSelector: '.cv_block_elm',
389        percentPosition: true,
390        gutter:20,
391        transitionDuration:0
392      });
393    }
394  });
395}
396
397function sendActorMessage() {
398  if ($('.form--send_email').length === 1) {
399    setTimeout(function() {
400      grecaptcha.ready(function() {
401        grecaptcha.execute('6Le7QbQZAAAAAEwS6OFtqyu1zjEGgRKTxj6Vd4Xz', { action: 'send_email_to_actor' }).then(function(token) {
402          $('.form--send_email input[name=recaptcha]').val(token);
403        });
404      });
405    }, 500);
406
407    $('.form--send_email').on('submit', function(e) {
408      e.preventDefault();
409
410      if (!saving) {
411        const actorid = $(this).find('input[name=actorid]').val();
412        console.log(templateDir + '/services/actors/sendEmail.php');
413        
414        $(this).ajaxSubmit({
415          url: templateDir + '/services/actors/sendEmail.php',
416          dataType: "JSON",
417          method: "POST",
418          beforeSend: function() {
419            if (noty !== '') noty.close();
420            $(".form--send_email :input").prop("disabled", true);
421            saving = true;
422          },
423          success: function(res) {
424            $(".form--send_email :input").prop("disabled", false);
425            saving = false;
426
427            if (res.errors) {
428              let errors = "<ul>";
429              res.errors.map((error) => { errors += "<li>" + error + "</li>"; });
430              errors += "</ul>";
431
432              noty = new Noty({
433                text: errors,
434                theme: "nest",
435                type: "error",
436                closeWith: ['click', 'button'],
437                killer: true
438              });
439            } else {
440              $(".form--send_email").html("<div class='form_row form_row--text'><div class='form_column'>Het formulier is verstuurd.</div>");
441            }
442          }
443        });
444      }
445    });
446  }
447}

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.