customize-controls-conditionals.js 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
  2. 'use strict';
  3. /* jshint esnext:true */
  4. (function ($, undefined) {
  5. 'use strict';
  6. var api = wp.customize;
  7. // toggle visibility of some controls based on a setting's value
  8. // @see wp-admin/js/customize-controls.js
  9. $.each({
  10. 'vamtam_theme[header-logo-type]': [{
  11. controls: ['vamtam_theme[custom-header-logo]'],
  12. callback: function callback(to) {
  13. return 'image' === to;
  14. }
  15. }],
  16. 'vamtam_theme[site-layout-type]': [{
  17. controls: ['vamtam_theme[full-width-header]'],
  18. callback: function callback(to) {
  19. return 'boxed' !== to;
  20. }
  21. }, {
  22. controls: ['vamtam_theme[boxed-layout-padding]'],
  23. callback: function callback(to) {
  24. return 'boxed' === to;
  25. }
  26. }],
  27. 'vamtam_theme[header-layout]': [{
  28. controls: ['vamtam_theme[full-width-header]'],
  29. callback: function callback(to) {
  30. return 'logo-menu' === to;
  31. } // show if header is 'logo-menu'
  32. }, {
  33. controls: ['vamtam_theme[sub-header-background]'],
  34. callback: function callback(to) {
  35. return 'logo-menu' !== to;
  36. } // show if header is not 'logo-menu'
  37. }],
  38. 'vamtam_theme[top-bar-layout]': [{
  39. controls: ['vamtam_theme[top-bar-social-lead]', 'vamtam_theme[top-bar-social-fb]', 'vamtam_theme[top-bar-social-twitter]', 'vamtam_theme[top-bar-social-linkedin]', 'vamtam_theme[top-bar-social-gplus]', 'vamtam_theme[top-bar-social-flickr]', 'vamtam_theme[top-bar-social-pinterest]', 'vamtam_theme[top-bar-social-dribbble]', 'vamtam_theme[top-bar-social-instagram]', 'vamtam_theme[top-bar-social-youtube]', 'vamtam_theme[top-bar-social-vimeo]'],
  40. callback: function callback(to) {
  41. return ['menu-social', 'social-menu', 'social-text', 'text-social'].indexOf(to) > -1;
  42. }
  43. }, {
  44. controls: ['vamtam_theme[top-bar-text]'],
  45. callback: function callback(to) {
  46. return ['menu-text', 'text-menu', 'social-text', 'text-social', 'fulltext'].indexOf(to) > -1;
  47. }
  48. }]
  49. }, function (settingId, conditions) {
  50. api(settingId, function (setting) {
  51. $.each(conditions, function (cndi, o) {
  52. $.each(o.controls, function (i, controlId) {
  53. api.control(controlId, function (control) {
  54. var visibility = function visibility(to) {
  55. control.container.toggle(o.callback(to));
  56. };
  57. visibility(setting.get());
  58. setting.bind(visibility);
  59. });
  60. });
  61. });
  62. });
  63. });
  64. })(jQuery);
  65. },{}]},{},[1]);