PageSourceSearch

https://mayotte-streaming.com/templates/shaper_tixon/js/frontend-edit.js

js mayotte-streaming.com collected 2026-10-01 23:55:51 UTC 6,869 bytes, 244 lines download raw bytes

1/**
2 * @package Helix3 Framework
3 * @author JoomShaper https://www.joomshaper.com
4 * @copyright (c) 2010 - 2021 JoomShaper
5 * @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 or later
6 */
7
8(function ($) {
9	$.fn.extend({
10		/**
11		 * This jQuery custom method makes the elements absolute, and with true argument moves them to end of body to avoid CSS inheritence
12		 *
13		 * @param   rebase boolean
14		 * @returns {jQuery}
15		 */
16		jEditMakeAbsolute: function (rebase) {
17			return this.each(function () {
18				var el = $(this);
19				var pos;
20
21				if (rebase) {
22					pos = el.offset();
23				} else {
24					pos = el.position();
25				}
26
27				el.css({
28					position: "absolute",
29					marginLeft: 0,
30					marginTop: 0,
31					top: pos.top,
32					left: pos.left,
33					bottom: "auto",
34					right: "auto",
35				});
36
37				if (rebase) {
38					el.detach().appendTo("body");
39				}
40			});
41		},
42	});
43
44	$(document).ready(function () {
45		$(".jmoddiv").on({
46			mouseenter: function () {
47				// Get module editing URL and tooltip for module edit:
48				var moduleEditUrl = $(this).data("jmodediturl");
49				var moduleTip = $(this).data("jmodtip");
50				var moduleTarget = $(this).data("target");
51
52				// Stop timeout on previous tooltip and remove it:
53				$("body>.btn.jmodedit").clearQueue().tooltip("dispose").remove();
54
55				// Add editing button with tooltip:
56				$(this)
57					.addClass("jmodinside")
58					.prepend(
59						'<a class="btn btn-secondary btn-sm jmodedit" href="#" target="' +
60							moduleTarget +
61							'"><span class="fas fa-edit" aria-hidden="true"></span></a>'
62					)
63					.children(":first")
64					.attr("href", moduleEditUrl)
65					.attr("title", moduleTip)
66					.tooltip({ html: true, placement: "top" })
67					.jEditMakeAbsolute(true);
68
69				$(".btn.jmodedit").on({
70					mouseenter: function () {
71						// Stop delayed removal programmed by mouseleave of .jmoddiv or of this one:
72						$(this).clearQueue();
73					},
74					mouseleave: function () {
75						// Delay remove editing button if not hovering it:
76						$(this)
77							.delay(500)
78							.queue(function (next) {
79								$(this).tooltip("dispose").remove();
80								next();
81							});
82					},
83				});
84			},
85			mouseleave: function () {
86				// Delay remove editing button if not hovering it:
87				$("body>.btn.jmodedit")
88					.delay(500)
89					.queue(function (next) {
90						$(this).tooltip("dispose").remove();
91						next();
92					});
93			},
94		});
95
96		// Menu items edit icons:
97
98		var activePopover = null;
99
100		$(
101			".jmoddiv[data-jmenuedittip] .nav li,.jmoddiv[data-jmenuedittip].nav li,.jmoddiv[data-jmenuedittip] .nav .nav-child li,.jmoddiv[data-jmenuedittip].nav .nav-child li"
102		).on({
103			mouseenter: function () {
104				// Get menu ItemId from the item-nnn class of the li element of the menu:
105				var itemids = /\bitem-(\d+)\b/.exec($(this).attr("class"));
106				if (typeof itemids[1] == "string") {
107					// Find module editing URL from enclosing module:
108					var enclosingModuleDiv = $(this).closest(".jmoddiv");
109					var moduleEditUrl = enclosingModuleDiv.data("jmodediturl");
110					// Transform module editing URL into Menu Item editing url:
111					var menuitemEditUrl = moduleEditUrl.replace(
112						/\/index.php\?option=com_config&controller=config.display.modules([^\d]+).+$/,
113						"/administrator/index.php?option=com_menus&view=item&layout=edit$1" + itemids[1]
114					);
115				}
116
117				// Get tooltip for menu items from enclosing module
118				var menuEditTip = enclosingModuleDiv.data("jmenuedittip").replace("%s", itemids[1]);
119
120				var content = $(
121					'<div><a class="btn jfedit-menu" href="#" target="_blank" rel="noopener noreferrer"><span class="icon-edit"></span></a></div>'
122				);
123				content.children("a.jfedit-menu").prop("href", menuitemEditUrl).prop("title", menuEditTip);
124
125				if (activePopover) {
126					$(activePopover).popover("hide");
127				}
128				$(this)
129					.popover({
130						html: true,
131						content: content.html(),
132						container: "body",
133						trigger: "manual",
134						animation: false,
135						placement: "bottom",
136					})
137					.popover("show");
138				activePopover = this;
139
140				$("body>div.popover")
141					.on({
142						mouseenter: function () {
143							if (activePopover) {
144								$(activePopover).clearQueue();
145							}
146						},
147						mouseleave: function () {
148							if (activePopover) {
149								$(activePopover).popover("hide");
150							}
151						},
152					})
153					.find("a.jfedit-menu")
154					.tooltip({ html: true, placement: "bottom" });
155			},
156			mouseleave: function () {
157				$(this)
158					.delay(1500)
159					.queue(function (next) {
160						$(this).popover("hide");
161						next();
162					});
163			},
164		});
165	});
166
167	$(document).ready(function () {
168		// Turn radios into btn-group
169		$(".radio.btn-group label").addClass("btn btn-outline-secondary");
170		$(".btn-group label:not(.active)").click(function () {
171			var label = $(this);
172			var input = $("#" + label.attr("for"));
173
174			if (!input.prop("checked")) {
175				label
176					.closest(".btn-group")
177					.find("label")
178					.removeClass("active btn-outline-success btn-outline-danger btn-outline-primary");
179				if (input.val() == "") {
180					label.addClass("active btn-outline-primary");
181				} else if (input.val() == 0) {
182					label.addClass("active btn-outline-danger");
183				} else {
184					label.addClass("active btn-outline-success");
185				}
186				input.prop("checked", true);
187			}
188		});
189
190		$(".btn-group input[checked=checked]").each(function () {
191			if ($(this).val() == "") {
192				$("label[for=" + $(this).attr("id") + "]").addClass("active btn-outline-primary");
193			} else if ($(this).val() == 0) {
194				$("label[for=" + $(this).attr("id") + "]").addClass("active btn-outline-danger");
195			} else {
196				$("label[for=" + $(this).attr("id") + "]").addClass("active btn-outline-success");
197			}
198		});
199	});
200
201	if (typeof MooTools != "undefined") {
202		var mHide = Element.prototype.hide;
203		Element.implement({
204			hide: function () {
205				if ($(".hasPopover") && $(".hasPopover").attr("data-original-title")) {
206					return this;
207				}
208				mHide.apply(this, arguments);
209			},
210		});
211	}
212
213	// MooTools issue with Joomla 3
214	if (typeof jQuery != "undefined" && typeof MooTools != "undefined") {
215		$(document).ready(function () {
216			$(".carousel").each(function (index, element) {
217				$(this)[index].slide = null;
218			});
219		});
220
221		window.addEvent("domready", function () {
222			Element.prototype.hide = function () {};
223		});
224	}
225
226	// collapse
227	// $.fn.collapse = function (option) {
228	// 	return this.each(function () {
229	// 		var $this = $(this),
230	// 			data = $this.data("collapse"),
231	// 			options = $.extend({}, $.fn.collapse.defaults, $this.data(), typeof option == "object" && option);
232	// 		console.log("data", data);
233	// 		console.log(options);
234	// 		if (!data) {
235	// 			$this.data("collapse", (data = new bootstrap.Collapse(this, options)));
236	// 		}
237	// 		if (typeof option == "string") data[option]();
238	// 	});
239	// };
240
241	// $.fn.collapse.defaults = {
242	// 	toggle: true,
243	// };
244})(jQuery);

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.