ru-se.com

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

webgradients-control.js (1069B)


      1 wp.customize.controlConstructor['web-gradients'] = wp.customize.Control.extend({
      2 
      3     ready: function () {
      4 
      5         'use strict';
      6 
      7         var control = this;
      8 
      9         // Change the value
     10         this.container.on('click', 'button, .webgradient-icon-preview .webgradient', function () {
     11 
     12             Materialis.openMediaCustomFrame(
     13                 wp.media.cp.extendFrameWithWebGradients(),
     14                 "cp_web_gradients",
     15                 materialis_customize_settings.l10n.selectGradient,
     16                 true,
     17                 function (attachement) {
     18 
     19                     if (attachement && attachement[0]) {
     20                         control.setting.set(attachement[0].gradient);
     21                         control.container.find('.webgradient-icon-preview > div.webgradient').attr('class', 'webgradient ' + attachement[0].gradient);
     22                         control.container.find('.webgradient-icon-preview > div.webgradient + .label').text(attachement[0].gradient.replace(/_/ig, ' '));
     23                     }
     24                 }
     25             )
     26         });
     27 
     28     }
     29 
     30 });