PageSourceSearch

https://www.pnth-terreenaction.org/parcours-yeswiki/themes/margot/javascripts/margot.js?v=4.6.7

js pnth-terreenaction.org collected 2026-09-26 07:36:02 UTC 7,597 bytes, 219 lines download raw bytes

1$(document).ready(function() {
2
3  $(".form-control").each(function() {
4    var parent = $(this).closest(".form-group");
5    parent.addClass(
6      $(this)
7        .prop("tagName")
8        .toLowerCase()
9    );
10    parent.addClass($(this).attr("type"));
11    if ($(this).hasClass('bazar-date')) parent.addClass('date');
12    if ($(this).hasClass('summernote')) parent.addClass('summernote');
13    if ($(this).hasClass("wiki-textarea")) {
14      parent.addClass("wiki-textarea");
15      parent.find(".control-label").prependTo(parent.find(".aceditor-toolbar"));
16    }
17  });
18  $('[type=checkbox]').each(function() {
19    $(this).closest(".form-group").addClass('checkbox');
20  });
21
22  $(".controls .radio, .controls .checkbox").each(function() {
23    var parent = $(this).closest(".form-group");
24    parent.addClass("form-control wrapper");
25  });
26  $('.bazar-radio').each(function() {
27    $(this).closest('.wrapper').addClass('radio')
28  })
29
30  // also when page is loaded in modal
31  $(document).on("yw-modal-open", function() {
32    $modal = $("#YesWikiModal");
33    var title = $modal.find('.BAZ_fiche_titre:first');
34    if (title.length == 0){
35      title = $modal.find('.modal-body h1,.modal-body h3').first();
36    }
37    if (title.length > 0){
38      $modal.find('.modal-header h1').remove();
39      $modal.find('.modal-header h3').remove();
40      $modal.find('.modal-header').prepend(title);
41    }
42    var image = $modal.find('[data-id=bf_image]');
43    $modal.find(".BAZ_cadre_fiche").prepend(image);
44    $modal.find('.modal-body').prepend("<div class='separator'></div>");
45    // ajout du span pour les checkbox/radio oubliés
46    $("#YesWikiModal input[type='checkbox'], #YesWikiModal input[type='radio']").each(function(){updateSpanInput(this)})
47    // Modification des boutons pour retourner dans l'historique
48    $("#YesWikiModal input.btn[onclick*='history.back()']").each(function (){
49      $(this).attr('data-dismiss','modal') ;
50      $(this).removeAttr('onclick') ;
51    }) ;
52    $("#YesWikiModal .tooltip_aide").each(function(){addTooltip(this)});
53    $("#YesWikiModal .bazar-list .panel-collapse")
54    .on("hide.bs.collapse", function() {
55      $(this)
56        .parent()
57        .addClass("collapsed");
58    })
59    .on("show.bs.collapse", function() {
60      $(this)
61        .parent()
62        .removeClass("collapsed");
63    });
64    $("#YesWikiModal #search-form + .facette-container").each(function() {
65      $(this)
66        .siblings("#search-form")
67        .prependTo($(this).find(".results-col"));
68    });
69  });
70
71  // ajout du span pour les checkbox/radio oubliés
72  $("input[type='checkbox'],input[type='radio']").each(function(){updateSpanInput(this)});
73  
74  function updateSpanInput(element) {
75    if (
76      $(element)
77        .next().length == 0 ||
78        $(element).next().not("span").length > 0
79    ) {
80      if ($(element).parents(".switch").length==0) {
81		if ($(element).parent("td").length > 0){
82          $(element).after("<label class=" + $(element).attr('type') + "></label>");
83		  var label_elem = $(element).next() ;
84		  label_elem.append(element);
85		  label_elem.append("<span></span>");
86	    } else {
87	    
88  	    	// We need to do a special treatment for input with the following structure
89  	    	//	<label>
90  	    	//		<input>
91  	    	//		text
92  	    	//	</label>
93  	    	// The text inside the label is not included in a tag.
94	    	// Without it, the span is created after and it produces a misalignement of label and input
95	    	// The text must be included in the span.
96	    	// Example : 
97	    	// * in the dialog used in the wysiwyg editor when creating a link
98	    	// * for the text of the accept conditions checkbox
99	    	// The text must be included in the created span.
100	    	// Let's check if there is such text	    	    	
101	    	// Let's get it child nodes index
102
103			var vText = ""; // The span's content text, no text was found yet
104	
105			var vParent = element.parentElement; // The label
106	
107			if (vParent && vParent.tagName == "LABEL")
108			{
109				var vIndex = Object.keys(vParent.childNodes).find(key => vParent.childNodes[key].nodeName === "#text");  
110					    
111				// If we found one, let's get its text before to remove it 
112					    
113				if (vIndex)	  
114				{
115					vText = vParent.childNodes[vIndex].nodeValue;
116					vParent.removeChild(vParent.childNodes[vIndex]);
117				}
118			}
119			
120			// Let's create the span with the found text or with nothing if it was not found
121			
122			$(element).after("<span>" + vText + "</span>");
123		}
124      }
125    }
126  };
127  // hack pour la ferme a wiki dont l'input hidden cachait le reste
128  $("#bf_dossier-wiki")
129    .parents(".control-group.email.password")
130    .removeClass("hidden");
131
132  $(".tooltip_aide").each(function(){addTooltip(this)});
133  function addTooltip(element) {
134    var tooltip = $(element).data("original-title") || ($(element).attr("title") || '');
135    var newImage = $(
136      "<span class='form-help fa fa-question-circle' title='" +
137      tooltip.replace(/'/g, "&#39;") +
138      "' onclick=\"$(element).tooltip(\'toggle\')\"></span>"
139    );
140    $(element)
141      .parent()
142      .append(newImage);
143     newImage.tooltip();
144    $(element).remove();
145  };
146
147  $(".bazar-list .panel-collapse")
148    .on("hide.bs.collapse", function() {
149      $(this)
150        .parent()
151        .addClass("collapsed");
152    })
153    .on("show.bs.collapse", function() {
154      $(this)
155        .parent()
156        .removeClass("collapsed");
157    });
158
159  $("#search-form + .facette-container").each(function() {
160    $(this)
161      .siblings("#search-form")
162      .prependTo($(this).find(".results-col"));
163  });
164
165  window.onresize = resizeNav;
166  resizeNav();
167
168  $("#yw-topnav .btn-menu").click(function() {
169    $links = $("#yw-topnav:visible .links-container");
170    if ($links.is(":visible")) {
171      $links.fadeOut(200);
172      $("#yw-topnav:visible .menu-backdrop").remove();
173    } else {
174      $links.fadeIn(200);
175      $backdrop = $("<div class='menu-backdrop'></div>");
176      $links.before($backdrop);
177      $backdrop.click(function(e) {
178        $("#yw-topnav:visible .btn-menu").trigger("click");
179        e.preventDefault();
180        e.stopPropagation();
181      });
182    }
183  });
184
185  // Datatables
186  $('.dataTables_wrapper').each(function() {
187    var search = $(this).find('.dataTables_filter input[type=search]');
188    search.prependTo(search.closest('.dataTables_filter'));
189    search.before('<span class="input-group-addon"><i class="fa fa-search search-icon"></i></span>');
190    search.parent().addClass('input-group');
191    $(this).find('.dataTables_filter label').remove();
192    $(this).find('> .row:first-child').addClass('dataTables_header');
193    $(this).find('> .row:last-child').addClass('dataTables_footer');
194
195    var container = $(this)
196    var paginationSelect = $(this).find('.dataTables_length select')
197    paginationSelect.change(function() {
198      var pagination = container.find('.pagination')
199      pagination.closest('.dataTables_footer')
200        .toggleClass('no-pagination', pagination.find('li').length <= 3)
201    }).trigger('change');
202    
203    // remove ugly style of dt-button :)
204    $(this).find('.dt-button').removeClass('dt-button')    
205  });
206
207  // Annuaire
208  $('.bazar-list[data-template="annuaire_alphabetique.tpl.html"]').each(function() {
209    if ($(this).prev().is('h1, h2, h3, h4, h5')) {
210      $(this).prev().addClass('annuaire-title')
211      $(this).prev().prepend('<i class="fa fa-search fa-flip-horizontal"></i>')
212    }
213  })
214});
215
216function resizeNav() {
217  var navHeight = $("#yw-topnav").outerHeight();
218  $("<style type='text/css'>.nav-down ~ #yw-main #ACEditor .btn-toolbar { top: " + navHeight + "px } </style>").appendTo("head");
219}

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.