173 // Click on a link into the popup "link to" or other dropdown that ask to close drop down on element click, so close dropdown
174 $(".dropdowncloseonclick").on(\'click\', function () {
175 console.log("Link has class dropdowncloseonclick, so we close/hide the popup ul");
176 //$(this).parent().parent().hide(); // $(this).parent().parent() is ul
177 $(this).parent().parent().removeClass("open"); // $(this).parent().parent() is ul
178 });
179
180 // Click outside of any dropdown
181 $(document).bind(\'click\', function (e) {
182 var $clicked = $(e.target); // This is element we click on
183 if (!$clicked.parents().hasClass("dropdown")) {
184 //console.log("close dropdown dd ul - we click outside");
185 //$(".dropdown dd ul").hide();
186 $(".dropdown dd ul").removeClass("open");
187
188 if ($("input:hidden[name=formfilteraction]").val() == "listafterchangingselectedfields") {
189 console.log("resubmit form saved into lastopendropdown after clicking outside of dropdown and having change selectlist from selectlist field of hamburger dropdown");
218print "\n/* JS CODE TO ENABLE reposition management (does not work if a redirect is done after action of submission) */\n";
219print '
220 jQuery(document).ready(function() {
221 /* If page_y set, we set scrollbar with it */
222 page_y = getParameterByName("page_y", 0); /* search in GET parameter */
223 if (page_y == 0) page_y = jQuery("#page_y").text(); /* search in POST parameter that is filed at bottom of page */
224 if (page_y > 0) {
225 console.log("page_y found is "+page_y);
226 jQuery("html, body").scrollTop(page_y);
227 }
228
229 /* Set handler to add page_y param on output (click on href links or submit button) */
230 jQuery(".reposition").click(function(event) {
231 var page_y = jQuery(document).scrollTop();
232 if (page_y > 0) {
233 if (this.href) {
234 console.log("We click on tag with .reposition class. this.ref was "+this.href);
235 var url = new URL(this.href, window.location.origin);
236 url.searchParams.delete("page_y"); /* remove page_y param if already present */
237 url.searchParams.set("page_y", page_y);
238 this.href = url.toString();
239 console.log("We click on tag with .reposition class. this.ref is now "+this.href);
240 } else {
241 console.log("We click on tag with .reposition class but element is not an <a> html tag, so we try to update input form field with name=page_y with value "+page_y);
250print "\n/* JS CODE TO ENABLE ClipBoard copy paste */\n";
251// Suppress because dol_escape_js is wrapped in '' @phan-suppress-next-line FunctionMissingSingleQuoteWrapping
252print '
253 jQuery(document).ready(function() {
254 jQuery(\'.clipboardCPShowOnHover\').hover(
255 function() {
256 console.log("We hover a value with a copy paste feature");
257 $(this).children(".clipboardCPButton, .clipboardCPText").css("display", "inline-block"); /* better than .show() because the show set the display to "inline" */
258 },
259 function() {
260 console.log("We hover out the value with a copy paste feature");
305 $(this).parent().children(".clipboardCPTick").css("display", "inline-block"); /* better than .show() because the show set the display to "inline" */