annotate themes/isobartik/color/preview.js @ 19:fa3358dc1485 tip

Add ndrum files
author Chris Cannam
date Wed, 28 Aug 2019 13:14:47 +0100
parents e11175134f4e
children
rev   line source
Chris@3 1 /**
Chris@3 2 * DO NOT EDIT THIS FILE.
Chris@3 3 * See the following change record for more information,
Chris@3 4 * https://www.drupal.org/node/2815083
Chris@3 5 * @preserve
Chris@3 6 **/
Chris@3 7
Chris@3 8 (function ($, Drupal, drupalSettings) {
Chris@3 9 Drupal.color = {
Chris@3 10 logoChanged: false,
Chris@3 11 callback: function callback(context, settings, $form) {
Chris@3 12 if (!this.logoChanged) {
Chris@3 13 $('.color-preview .color-preview-logo img').attr('src', drupalSettings.color.logo);
Chris@3 14 this.logoChanged = true;
Chris@3 15 }
Chris@3 16
Chris@3 17 if (drupalSettings.color.logo === null) {
Chris@3 18 $('div').remove('.color-preview-logo');
Chris@3 19 }
Chris@3 20
Chris@3 21 var $colorPreview = $form.find('.color-preview');
Chris@3 22 var $colorPalette = $form.find('.js-color-palette');
Chris@3 23
Chris@3 24 $colorPreview.css('backgroundColor', $colorPalette.find('input[name="palette[bg]"]').val());
Chris@3 25
Chris@3 26 $colorPreview.find('.color-preview-main h2, .color-preview .preview-content').css('color', $colorPalette.find('input[name="palette[text]"]').val());
Chris@3 27 $colorPreview.find('.color-preview-content a').css('color', $colorPalette.find('input[name="palette[link]"]').val());
Chris@3 28
Chris@3 29 var $colorPreviewBlock = $colorPreview.find('.color-preview-sidebar .color-preview-block');
Chris@3 30 $colorPreviewBlock.css('background-color', $colorPalette.find('input[name="palette[sidebar]"]').val());
Chris@3 31 $colorPreviewBlock.css('border-color', $colorPalette.find('input[name="palette[sidebarborders]"]').val());
Chris@3 32
Chris@3 33 $colorPreview.find('.color-preview-footer-wrapper').css('background-color', $colorPalette.find('input[name="palette[footer]"]').val());
Chris@3 34
Chris@3 35 var gradient_start = $colorPalette.find('input[name="palette[top]"]').val();
Chris@3 36 var gradient_end = $colorPalette.find('input[name="palette[bottom]"]').val();
Chris@3 37
Chris@3 38 $colorPreview.find('.color-preview-header').attr('style', 'background-color: ' + gradient_start + '; background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, from(' + gradient_start + '), to(' + gradient_end + ')); background-image: -moz-linear-gradient(-90deg, ' + gradient_start + ', ' + gradient_end + ');');
Chris@3 39
Chris@3 40 $colorPreview.find('.color-preview-site-name').css('color', $colorPalette.find('input[name="palette[titleslogan]"]').val());
Chris@3 41 }
Chris@3 42 };
Chris@3 43 })(jQuery, Drupal, drupalSettings);