PageSourceSearch

https://www.wksbern.ch/themes/custom/iq_barrio/resources/js/admin.js?tm3kwd

js wksbern.ch collected 2026-09-29 16:23:01 UTC 2,687 bytes, 88 lines download raw bytes

1/**
2 * @file
3 * Global utilities.
4 *
5 */
6
7(function ($, Drupal) {
8  $('[data-style]').each(function(){$(this).attr('style', $(this).data('style') )});
9
10  var colors = {
11    'primary' : $('[name="color_primary"]').val(),
12    'secondary' : $('[name="color_secondary"]').val(),
13    'tertiary' : $('[name="color_tertiary"]').val(),
14    'quaternary' : $('[name="color_quaternary"]').val(),
15    'grey1' : $('[name="color_grey1"]').val(),
16    'grey2' : $('[name="color_grey2"]').val(),
17    'grey3' : $('[name="color_grey3"]').val(),
18    'grey4' : $('[name="color_grey4"]').val(),
19    'grey5' : $('[name="color_grey5"]').val(),
20    'black' : $('[name="color_black"]').val(),
21    'white' : $('[name="color_white"]').val(),
22  }
23
24
25
26  var style = $('#iq-barrio-source').html();
27  $('[data-drupal-selector="edit-iq-theme"]').find('input, select').each(function(){
28    var find = '{{' + $(this).attr('name') + '}}';
29    var re = new RegExp(find, 'g');
30
31    if( colors.hasOwnProperty( $(this).val() ) ){
32      style = style.replace(re, hexToRGB(colors[$(this).val()]) );
33    }else{
34      style = style.replace(re, $(this).val() );
35    }
36
37  });
38
39  $('#iq-barrio-target').html( '<style>' + style + '</style>' ) ;
40
41
42
43  $('[data-drupal-selector="edit-iq-theme"]').find('input, select').change(function(){
44
45    var colors = {
46      'primary' : $('[name="color_primary"]').val(),
47      'secondary' : $('[name="color_secondary"]').val(),
48      'tertiary' : $('[name="color_tertiary"]').val(),
49      'quaternary' : $('[name="color_quaternary"]').val(),
50      'grey1' : $('[name="color_grey1"]').val(),
51      'grey2' : $('[name="color_grey2"]').val(),
52      'grey3' : $('[name="color_grey3"]').val(),
53      'grey4' : $('[name="color_grey4"]').val(),
54      'grey5' : $('[name="color_grey5"]').val(),
55      'black' : $('[name="color_black"]').val(),
56      'white' : $('[name="color_white"]').val(),
57    }
58
59    var style = $('#iq-barrio-source').html();
60    $('[data-drupal-selector="edit-iq-theme"]').find('input, select').each(function(){
61      var find = '{{' + $(this).attr('name') + '}}';
62      var re = new RegExp(find, 'g');
63
64      if( colors.hasOwnProperty( $(this).val() ) ){
65        style = style.replace(re, hexToRGB(colors[$(this).val()]) );
66      }else{
67        style = style.replace(re, $(this).val() );
68      }
69
70    });
71
72    $('#iq-barrio-target').html( '<style>' + style + '</style>' ) ;
73  })
74
75})(jQuery, Drupal);
76
77function toHex(d) {
78  return  ("0"+((Number(d)*255).toString(16))).slice(-2).toUpperCase()
79}
80
81
82function hexToRGB(hex) {
83  var r = parseInt(hex.slice(1, 3), 16),
84      g = parseInt(hex.slice(3, 5), 16),
85      b = parseInt(hex.slice(5, 7), 16);
86
87      return r + "," + g + "," + b ;
88}

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.