1(function($) { 2 3 Drupal.behaviors.global = { 4 attach : function(context, settings) { 5 6 /** 7 * Variables. 8 */ 9 10 var $ui = {}; 11 $ui.objects = jQuery('.view-objects'); 12 $ui.objects_slider = jQuery('.view-objects-slider'); 13 $ui.objects_filters = jQuery('.view-objects .view-filters'); 14 $ui.objects_filters_sortby = jQuery('.view-objects .view-filters *[name="sort_by"]'); 15 $ui.linklike = '.linklike'; 16 17 /** 18 * Append buttons to "Submitted objects" 19 * filters. 20 */ 21 22 if( $ui.objects_filters.length > 0 && $ui.objects_filters_sortby.length > 0 ) { 23 24 var sortby = getUrlParam('sort_by'); 25 26 $ui.objects_filters 27 .find('.form--inline') 28 .once() 29 .append(''+ 30 '<div class="form-item">'+ 31 '<a href="#field_object_category_target_id" class="btn btn--v2 btn--block sort-btn'+ ( sortby.length == 0 || sortby == 'field_object_category_target_id' ? '' : ' is-inactive' ) +'">Obiekty wg. kategorii</a>'+ 32 '</div>'+ 33 '<div class="form-item">'+ 34 '<a href="#field_country_region_target_id" class="btn btn--v2 btn--block sort-btn'+ ( sortby == 'field_country_region_target_id' ? '' : ' is-inactive' ) +'">Obiekty wg. województw</a>'+ 35 '</div>'); 36 37 /** 38 * Attach actions to sort buttons. 39 */ 40 41 $ui.objects_filters.find('.sort-btn').once().on('click', function(event) { 42 43 event.preventDefault(); 44 45 var sortby = jQuery(this).attr('href').replace('#', ''); 46 47 $ui.objects_filters_sortby 48 .val(sortby) 49 .closest('form') 50 .submit(); 51 52 }); 53 54 } 55 56 /** 57 * Initialize Linklike! 58 */ 59 60 jQuery(document).on('click', $ui.linklike, function(event) { 61 62 event.preventDefault(); 63 64 var url = jQuery(this).attr('data-href'); 65 66 if( url ) { 67 window.location.href = url; 68 } 69 70 }); 71 72 /** 73 * Toggle CSS button classes 74 * - on row hover. 75 */ 76 77 $ui.objects 78 .find('.submitted-object') 79 .once() 80 .on('mouseenter', function() { 81 jQuery(this).find('.btn').addClass('is-active'); 82 }) 83 .on('mouseleave', function() { 84 jQuery(this).find('.btn').removeClass('is-active'); 85 }); 86 87 /** 88 * Toggle objects slider item 89 * CSS classes on mouseenter / mouseleave. 90 */ 91 92 $ui.objects_slider 93 .find('.slide__media') 94 .each(function(key, value) { 95 96 var link = jQuery(this).closest('.slide__grid').find('.object-footer a'); 97 98 if( link.length > 0 ) { 99 link = link.attr('href'); 100 101 jQuery(this) 102 .attr('data-href', link) 103 .addClass('linklike'); 104 105 } 106 }); 107 108 /** 109 * Function used to get URL param. 110 */ 111 112 function getUrlParam(name) { 113 return ( location.search.split(name + '=')[1] || '' ).split('&')[0]; 114 } 115 116 function showFacebookModal() { 117 jQuery('#fb-dialog').dialog({ 118 width: "705", 119 minWidth: 400, 120 classes: { 121 "ui-dialog": "pager__item" 122 }, 123 height: 900, 124 modal: true, 125 draggable: false, 126 position: { my: "center", at: "center", of: window } 127 });
128 } 129 130 if (['https://www.modernizacjaroku.org.pl/', 'https://www.modernizacjaroku.org.pl/pl'].includes(window.location.href)) { 131 const storageKey = 'fbModalCounter'; 132 const currentCount = window.localStorage.getItem(storageKey); 133 134 //if (!currentCount) { 135 // window.localStorage.setItem(storageKey, 1); 136 // showFacebookModal(); 137 //} else if (currentCount && Number(currentCount) < 3) { 138 // window.localStorage.setItem(storageKey, Number(currentCount) + 1); 139 // showFacebookModal(); 140 //} 141 142 jQuery('a[href="/pl/galeria/zglos-mural"]').attr('href', 'https://glosowanie.modernizacjaroku.org.pl/pl/editions/f1db912d-4bbb-417e-94f7-87e9a1be464e/applications/create/?category=f85ddf0a-3a39-44f0-90f4-beaa8b8cbb0e'); 143 144 } 145 } 146 }; 147 148 if (window.location.href === 'https://www.modernizacjaroku.org.pl/pl/editions/2837/plebiscite/stage-1/regions') { 149 const el = jQuery('#block-modernization-content').find('.view-content'); 150 151 if (!!el) { 152 jQuery("<div class=\"views-row\"><div class=\"views-field views-field-name\"><span class=\"field-content\"><a href=\"/pl/editions/2837/plebiscite/stage-1\">wszystkie</a></span></div><div class=\"views-field views-field-nothing-1\"><span class=\"field-content\"><a href=\"/pl/editions/2837/plebiscite/stage-1\">Zobacz</a></span></div></div>").prependTo(el); 153 } 154 } 155 156 157 158}(jQuery)); 159;
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.