PageSourceSearch

https://bawaslu.go.id/themes/custom/progressive/js/drupal.js?v=1.x

js bawaslu.go.id collected 2026-10-01 10:34:14 UTC 15,258 bytes, 402 lines download raw bytes

1(function ($, Drupal) {
2  if (typeof(Drupal.AjaxCommands) != 'undefined') {
3    Drupal.AjaxCommands.prototype.progressive_cms_blog_timeline = function(ajax, response, status) {
4      var $article = $('#' + response.selector).closest('.post');
5      $article.find('.livicon').attr('data-n', response.data.livicon).updateLivicon({name: response.data.livicon});
6      $article.find('.timeline-content, .timeline-icon').removeClassPrefix('bg').removeClassPrefix('border');
7      $article.find('.timeline-icon').addClass('bg-' + response.data.color);
8      var bg = response.data.tranparent_bg ? 'border border-' : 'bg bg-';
9      $article.find('.timeline-content').addClass(bg + response.data.color);
10      if(response.data.title) {
11        $article.find('.entry-title').show();
12      }
13      else {
14        $article.find('.entry-title').hide();
15      }
16      if(response.data.no_padding) {
17        $article.addClass('no-padding');
18      }
19      else {
20        $article.removeClass('no-padding');
21      }
22    }
23  }
24})(jQuery, Drupal);
25
26(function() {
27  var $ = jQuery;
28  $.fn.removeClassPrefix = function(prefix) {
29      this.each(function(i, el) {
30          var classes = el.className.split(" ").filter(function(c) {
31              return c.lastIndexOf(prefix, 0) !== 0;
32          });
33          el.className = classes.join(" ");
34      });
35      return this;
36  };
37
38  Drupal.behaviors.search_form_click = {
39    attach: function (context, settings) {
40      $('.search-active .form-type-search label:not(.rendered)',context).addClass('rendered').click(function() {
41        $(this).closest('form').submit();
42      });
43    }
44  };
45
46  Drupal.behaviors.active_menu_expand = {
47    attach: function (context, settings) {
48      setTimeout(function(){
49        $('ul.menu .active').parent('.sub').show();
50      }, 1000);
51    }
52  };
53
54  Drupal.behaviors.rotate_blocks = {
55    attach: function (context, settings) {
56      if(!navigator.userAgent.match(/iPad|iPhone|Android/i)) {
57        $('.product, .employee', context).hover(function(event) {
58          event.preventDefault();
59          $(this).addClass('hover');
60        }, function(event) {
61          event.preventDefault();
62          $(this).removeClass('hover');
63        });
64      }
65    }
66  };
67
68
69  Drupal.behaviors.href_click = {
70    attach: function (context, settings) {
71       $('a[href="#"]').click(function() {
72        return false;
73       });
74    }
75  };
76
77  Drupal.behaviors.attachSelectBox = {
78    attach: function (context, settings) {
79      if(typeof($.fn.selectBox) !== 'undefined') {
80       $('select:not(".without-styles")').selectBox();
81      }
82    }
83  };
84
85  Drupal.behaviors.removefromcart = {
86    attach: function (context, settings) {
87      // Remove from block Cart
88      $(once('ajax', '.cart-header .product-remove:not(.ajax-processed)')).click(function() {
89        $(this).parents('li').animate({'opacity': 0, 'height' : 0}, 700, function() {
90          $(this).remove();
91          $('.cart-count').text(parseInt($('.cart-header .cart-count').text()) - 1);
92        });
93        $(this).closest('li').find('input').click();
94        return false;
95      });
96      // Click on the button from styled icon on the Cart Page
97      $(once('click', '.button-click:not(.click-processed)')).click(function() {
98        $(this).prev('input').click();
99        return false;
100      });
101      // Click on the Update Shopping Cart link
102      $(once('click', '.update-cart-link')).click(function() {
103        $(this).closest('form').find('.update-cart-button').click();
104        return false;
105      });
106    }
107  };
108
109  Drupal.behaviors.removefromcompare = {
110    attach: function (context, settings) {
111      // Remove from block Cart
112      $('#compare-table .product-remove', context).click(function(event) {
113        $('#compare-table tr .data-index-' + $(this).attr('data-index')).animate({'opacity': 0, 'height' : 0}, 700, function() {
114          $(this).remove();
115        });
116        let flag_counter = $('.compare-header .flag-counter');
117        flag_counter.text(parseInt(flag_counter.text()) - 1);
118        $(this).closest('td').find('.compare-flag a')[0].click();
119        return false;
120      });
121    }
122  };
123
124  Drupal.behaviors.contextual_form = {
125    attach: function (context, settings) {
126      // Stop the handler of contextual links to close the popup
127      $(once('contextual-form', '.contextual-form:not(.contextual-form-processed)', context)).click(function(e) {
128        e.stopPropagation();
129      });
130    }
131  };
132
133  Drupal.behaviors.livicons = {
134    attach: function (context, settings) {
135      if(typeof($.fn.updateLivicon) !== 'undefined') {
136        $(once('livicon', '.livicon:not(.livicon-processed)', context)).updateLivicon();
137      }
138    }
139  };
140
141  /**
142   *
143   * @param href_path_str
144   * @returns {*}
145   */
146  function set_flag_action_class(href_path_str) {
147    if (href_path_str.indexOf("unflag") != -1) {
148      return ' unflag-action';
149    }
150    else {
151      return ' flag-action';
152    }
153  }
154
155  Drupal.behaviors.js_styles = {
156    attach: function (context, settings) {
157      const compare_icon = '<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="16px" height="16px" viewBox="0 0 16 16" enable-background="new 0 0 16 16" xml:space="preserve"><path fill="#1e1e1e" d="M16,3.063L13,0v2H1C0.447,2,0,2.447,0,3s0.447,1,1,1h12v2L16,3.063z"></path><path fill="#1e1e1e" d="M16,13.063L13,10v2H1c-0.553,0-1,0.447-1,1s0.447,1,1,1h12v2L16,13.063z"></path><path fill="#1e1e1e" d="M15,7H3V5L0,7.938L3,11V9h12c0.553,0,1-0.447,1-1S15.553,7,15,7z"></path></svg>';
158      const wishlist_icon = '<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="16px" height="16px" viewBox="0 0 16 16" enable-background="new 0 0 16 16" xml:space="preserve"><path fill="#1e1e1e" d="M11.335,0C10.026,0,8.848,0.541,8,1.407C7.153,0.541,5.975,0,4.667,0C2.088,0,0,2.09,0,4.667C0,12,8,16,8,16s8-4,8-11.333C16.001,2.09,13.913,0,11.335,0z M8,13.684C6.134,12.49,2,9.321,2,4.667C2,3.196,3.197,2,4.667,2C6,2,8,4,8,4s2-2,3.334-2c1.47,0,2.666,1.196,2.666,2.667C14.001,9.321,9.867,12.49,8,13.684z"></path></svg>';
159
160      $('.flag-wrapper.flag-compare a').each(function(index) {
161        let href_str = $(this).attr('href');
162        let classes = 'add-compare flag' + set_flag_action_class(href_str);
163        $(this, context)
164          .addClass(classes)
165          .html(compare_icon);
166      });
167
168      $('.flag-wrapper.flag-wishlist a').each(function(index) {
169        let href_str = $(this).attr('href');
170        let classes = 'add-wishlist flag' + set_flag_action_class(href_str);
171        $(this, context)
172          .addClass(classes)
173          .html(wishlist_icon);
174      });
175
176      $('details.search-advanced summary').addClass('btn');
177      $('.search-form a.search-help-link').addClass('btn').css({'position':'absolute', 'right':0});
178
179      $('.link.field_link a').addClass('btn btn-default');
180
181      $('.field table').addClass('table');
182    }
183  };
184
185  Drupal.behaviors.add_cart_link = {
186    attach: function (context, settings) {
187      $('.add-cart.js-active-link', context).click(function() {
188        $(this).addClass('unflag-action');
189        $(this).closest('.actions').find('input.form-submit').click();
190        return false;
191      });
192    }
193  };
194
195  Drupal.behaviors.quantity_regulator = {
196    attach: function (context, settings) {
197      //Regulator Up/Down
198      $('.number-up', context).click(function(){
199        let value = ($(this).closest('.number').find('input[type="text"]').attr('value'));
200        $(this).closest('.number').find('input[type="text"]').attr('value', parseFloat(value)+1);
201        return false;
202      });
203      $('.number-down', context).click(function(){
204        let value = ($(this).closest('.number').find('input[type="text"]').attr('value'));
205        if (value > 1) {
206          $(this).closest('.number').find('input[type="text"]').attr('value', parseFloat(value)-1);
207        }
208        return false;
209      });
210    }
211  };
212
213  Drupal.behaviors.fixing_footer = {
214    attach: function (context, settings) {
215      $('footer #Footer-Top').removeClass('footer-top');
216      $('footer #footer_top').removeAttr('class');
217      $('footer #Footer-Bottom').removeClass('footer-bottom');
218    }
219  };
220
221  Drupal.behaviors.charts = {
222    attach: function (context, settings) {
223
224      $('.graph-resize').html('');
225
226      $('.bar-with-title', context).each(function() {
227        return Morris.Bar({
228          element    : $(this).attr('id'),
229          data       : $(this).data('values'),
230          xkey        : "item",
231          ykeys       : ["value"],
232          labels      : [$(this).attr('data-label')],
233          barRatio    : 0.4,
234          xLabelAngle : 35,
235          hideHover   : "auto",
236          barColors   : ["#ef005c"]
237        });
238      });
239
240      $('.donut-graph', context).each(function() {
241        Morris.Donut({
242          element   : $(this).attr('id'),
243          data      : $(this).data('values'),
244          colors    : $(this).data('colors'),
245          height    : 100,
246          formatter : function(y) {
247            return y + "%";
248          }
249        });
250      });
251
252    }
253  };
254
255  Drupal.behaviors.view_price_filter = {
256    attach: function (context, settings) {
257      if (typeof($.fn.slider) !== 'undefined' && $('#filter', context).length) {
258        let from_date = parseInt($('#filter', context).parents('.views-element-container').find('.form-control[name*=min]').val().substr(0, 4));
259        let to_date = parseInt($('#filter', context).parents('.views-element-container').find('.form-control[name*=max]').val().substr(0, 4));
260        $('#filter', context).attr('value', from_date + ';' + to_date);
261        $('#filter', context).slider({
262          from: from_date - 3,
263          to: to_date + 3,
264          limits: false,
265          step: 1,
266          dimension: '',
267          calculate: function( value ) {
268            return ( value );
269          },
270          callback: function(value) {
271            let dates = value.split(';');
272            let current_date = new Date();
273            let curr_day = current_date.getDay() + 1;
274            let curr_month = current_date.getMonth() + 1;
275            let array_date_from = [dates[0], curr_month, curr_day];
276            let array_date_to   = [dates[1], curr_month, curr_day];
277            let s_from_date = array_date_from.join('/');
278            let s_to_date = array_date_to.join('/');
279            $('#filter', context).parents('.views-element-container').find('.form-control[name*=min]').val(s_from_date);
280            $('#filter', context).parents('.views-element-container').find('.form-control[name*=max]').val(s_to_date);
281            $('#filter', context).parents('.views-element-container').find('.form-actions .form-submit').click();
282          }
283        });
284      }
285
286      if (typeof($.fn.slider) !== 'undefined') {
287        $("#edit-sell-price-wrapper:not(.processed), #edit-list-price-wrapper:not(.processed)", context).each(function() {
288          $(this).addClass('processed');
289          $(this).after('<div class="price-regulator pull-right"><b>' + $(this).find('> label').text() + ':</b><div class="layout-slider"><input type="slider" name="year" value="$0;$2000" class="form-control price-filter"></div></div>');
290          $(this).hide();
291          var from_price = parseInt($(this).find("input[name$='[min]']").val());
292          var to_price = parseInt($(this).find("input[name$='[max]']").val());
293          var $this = $(this);
294          $('.price-filter', context).attr('value', from_price + ';' + to_price);
295          $('.price-filter', context).slider({
296            from: from_price > 500 ? from_price - 500 : 0,
297            to: to_price + 500,
298            limits: false,
299            step: 1,
300            dimension: '&nbsp;' + Drupal.settings.ubercart_currency,
301            calculate: function( value ) {
302              return ( value );
303            },
304            callback: function(value) {
305              var prices = value.split(';');
306              $this.find("input[name$='[min]']").val(prices[0]);
307              $this.find("input[name$='[max]']").val(prices[1]).change();
308            }
309          });
310
311        });
312      }
313
314      if (typeof($.fn.slider) !== 'undefined') {
315        $('.jslider-pointer').html('\n\
316        <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 8 12" enable-background="new 0 0 8 12" xml:space="preserve">\n\
317          <path fill-rule="evenodd" clip-rule="evenodd" fill="#1e1e1e" d="M2,0h4c1.1,0,2,0.9,2,2l-2,8c-0.4,1.1-0.9,2-2,2l0,0c-1.1,0-1.6-0.9-2-2L0,2C0,0.9,0.9,0,2,0z"/>\n\
318        </svg>\n\
319        ');
320      }
321    
322    }
323  };
324
325  if(!navigator.userAgent.match(/iPad|iPhone|Android/i)) {
326    var delay_drupal = ( function() {
327    var timeout = { };
328    
329    return function( callback, id, time ) {
330      if( id !== null ) {
331      time = ( time !== null ) ? time : 100;
332      clearTimeout( timeout[ id ] );
333      timeout[ id ] = setTimeout( callback, time );
334      }
335    };
336    })();
337
338    $(window).on('resize', function() {
339      delay_drupal( function() {
340
341        var graphResize_drupal;
342        
343        clearTimeout(graphResize_drupal);
344        return graphResize_drupal = setTimeout(function() {
345          return Drupal.behaviors.charts.attach($(document), Drupal.settings);
346        }, 500);
347        
348      }, 'resize');
349    });
350  }
351
352  $(document).ready(function() {
353
354    $('.dropdown-toggle[href="#"]').click(function() {
355      $(this).parent().toggleClass('open');
356    });
357
358    $(document).bind('flagGlobalAfterLinkUpdate', function(event, data) {
359      if(data.flagName == 'compare' || data.flagName == 'wishlist') {
360        let new_value = parseInt($('.flag-count-' + data.flagName + ':first').text());
361        new_value = data.flagStatus == 'unflagged' ? new_value - 1 : new_value + 1;
362        if(new_value > 0) {
363          $('.flag-status-' + data.flagName + ', .flag-count-' + data.flagName).show();
364        }
365        else {
366          $('.flag-status-' + data.flagName + ', .flag-count-' + data.flagName).hide();
367        }
368        $('.flag-count-' + data.flagName).text(new_value);
369      }
370    });
371
372    $('.modern-gallery-action a').click(function(event) {
373      event.preventDefault();
374      let column = $(this).attr('data-id') * 3;
375      $.post(Drupal.url('ajax/progressive/save-variable'), {
376          'variable' : 'progressive_modern_gallery',
377          'variable_key' : $(this).parents('.modern-gallery-action').attr('data-id'),
378          'value' : column
379        });
380
381      $(this).parents('.images-box').removeClassPrefix('col-md-').addClass('col-md-' + column);
382      $(window).resize();
383
384      return false;
385    });
386
387    // To Blog Timeline form.
388    $('.form-item-form-id-clone').each(function(index) {
389      let form_id = $(this).closest('form').attr('id');
390      $(this).find('input').val(form_id);
391    });
392
393    // Sidebar Menu.
394    $('.sidebar-menu.drop-down li.parent:first').addClass('active');
395    $('.sidebar-menu.drop-down li.parent:first ul.sub').css('display', 'block');
396
397    // Autosubmit views exposed form.
398    $("form.views-exposed-form").find("select").bind("change", function () {
399      $(this).closest("form").trigger("submit");
400    }).end().find("input[type='submit']").addClass("visually-hidden");
401  });
402}());

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.