PageSourceSearch

https://comic.systems/ultra/js/scripts.js

js comic.systems collected 2026-10-02 06:22:59 UTC 7,079 bytes, 263 lines download raw bytes

1// custom css expression for a case-insensitive contains()
2jQuery.expr[':'].Contains = function(a,i,m){
3  return (a.textContent || a.innerText || "").toUpperCase().indexOf(m[3].toUpperCase())>=0;
4};
5
6/*
7document.querySelector("#reloadSW").addEventListener("click", () => {
8	navigator.serviceWorker
9	.getRegistration()
10	.then(registration => {
11		registration.waiting
12		.postMessage("skipWaiting");
13	});
14});
15
16let newWorker;
17
18// The click event on the notification
19document.getElementById('reloadSW').addEventListener('click', function(){
20	newWorker.postMessage({ action: 'skipWaiting' });
21});
22*/
23
24if ('serviceWorker' in navigator) {
25	// Register the service worker
26	navigator.serviceWorker.register('/sw.js').then(reg => {
27	  reg.addEventListener('updatefound', () => {
28
29		// An updated service worker has appeared in reg.installing!
30		newWorker = reg.installing;
31
32		newWorker.addEventListener('statechange', () => {
33
34		  // Has service worker state changed?
35		  switch (newWorker.state) {
36			case 'installed':
37
38	// There is a new service worker available, show the notification
39			  if (navigator.serviceWorker.controller) {
40				let notification = document.getElementById('notification ');
41	notification .className = 'show';
42			  }
43
44			  break;
45		  }
46		});
47	  });
48	});
49
50}
51
52$(document).ajaxComplete(function(){
53	$('a[href="#"]').on('click', function(e) {
54		e.preventDefault();
55	});
56	$("a[href!=''][href]:not([target='_blank']):not(.goto)").on("click", function() {
57		$("header").addClass("ouverture");
58	});
59});
60$("header .menu").on("click", function(){
61	$(this).toggleClass("actif");
62	$("menu").toggleClass("actif");
63});
64// $("header .recherche .loupe").on("click", function(){
65	// $(this).toggleClass("actif");
66	// $("header .recherche").toggleClass("actif");
67	// $("header .titre").toggleClass("inactif");
68	// $("header .recherche .filtre").focus();
69// });
70
71// administration
72$(".xyz").on("click", function(){
73	$(".fab-menu").toggleClass("active");
74});
75
76// floating action menu (administration)
77var overlay = $(".fab-overlay"),
78        fab = $(".fab.actu, .bouton.creerActu"),
79     fermer = $(".fab-close"),
80     submit = $(".fab-creer");
81
82//fab click
83fab.on('click', openFAB);
84overlay.on('click', closeFAB);
85fermer.on('click', closeFAB);
86
87function openFAB() {
88	fab.addClass("active");
89	overlay.addClass("dark");
90}
91function closeFAB(event){
92	if (event) {
93		event.preventDefault();
94		event.stopImmediatePropagation();
95	}
96	fab.removeClass("active");
97	overlay.removeClass("dark");
98}
99$("#queryCreer").change(function() {
100	var queryCreer	= $(this).val();
101	var dataString	= 'queryCreer='+ queryCreer;
102
103	$.ajax({
104		type: "POST",
105		url: "/admin/nouvelles-page-creer",
106		data: dataString,
107		cache: false,
108		success: function(html){
109			$("#urlCreer").html(html);
110		} 
111	});
112});
113$("#creerArticle").change(function() {
114	var catArticle	= $(this).val();
115	var dataString	= 'catArticle='+ catArticle;
116
117	$.ajax({
118		type: "POST",
119		url: "/actions/fab-articles-creer",
120		data: dataString,
121		cache: false,
122		success: function(html){
123			$("#urlCreer").html(html);
124		} 
125	});
126});
127
128$("a:not([target='_blank'])").on("click", function() {
129	$("header").addClass("ouverture");
130});
131
132$(".ouvrir,.ouvrirTxt,.ouvrirBloc,.fermer,.fermerTxt,.fermerBloc,.login,.derouler,.plier,.deplier").on("click", function() {
133	var $this = $(this);
134	$("." + $this.attr("ouvrir")).slideToggle("slow");
135});
136
137$(".ouvrir, .fermer").click(function(){
138	var $this = $(this);
139	$this.toggleClass("ouvrir fermer");
140});
141$(".ouvrirTxt, .fermerTxt").click(function(){
142	var $this = $(this);
143	$this.toggleClass("ouvrirTxt fermerTxt");
144
145	/* pour changer le texte du bouton */
146	var isEnabled = $this.hasClass("ouvrirTxt");
147	if(isEnabled){
148		$this.text("Montrer");
149	}else{
150		$this.text("Cacher");
151	}
152});
153
154var cookieAccept = localStorage.getItem("cookieAccept");
155if(cookieAccept!=="oui"){
156	$(".snackbar").addClass("active");
157}
158$(".snackbar .snackbar-action").click(function(){
159	$(".snackbar").removeClass("active");
160	localStorage.setItem("cookieAccept", "oui");
161});
162
163/*
164$(document).ready(function(){
165	if ( $(".popupScreen").hasClass("active") ) {
166		$("body").addClass("poped");
167	}
168});
169*/
170
171/* Chrome */
172const divResult = document.getElementById('result');
173const divInstall = document.getElementById('installContainer');
174const butInstall = document.getElementById('butInstall');
175const butShare = document.getElementById('butShare');
176
177window.addEventListener('beforeinstallprompt', (event) => {
178	console.log('👍', 'beforeinstallprompt', event);
179	// Stash the event so it can be triggered later.
180	window.deferredPrompt = event;
181	// Remove the 'hidden' class from the install button container
182	// butInstall.removeAttribute('disabled');
183});
184
185/*
186butInstall.addEventListener('click', () => {
187	console.log('👍', 'butInstall-clicked');
188	const promptEvent = window.deferredPrompt
189	if (!promptEvent) {
190		// The deferred prompt isn't available.
191		return;
192	}
193	// Show the install prompt.
194	promptEvent.prompt();
195	// Log the result
196	promptEvent.userChoice.then((result) => {
197		console.log('👍', 'userChoice', result);
198		// Reset the deferred prompt variable, since 
199		// prompt() can only be called once.
200		window.deferredPrompt = null;
201		// Hide the install button.
202		butInstall.setAttribute('disabled', true);
203	});
204});
205*/
206
207window.addEventListener('appinstalled', (event) => {
208	console.log('👍', 'appinstalled', event);
209});
210
211/*
212if ('share' in navigator) {
213	console.log('👍', 'navigator.share is supported');
214	butShare.removeAttribute('disabled');
215	butShare.addEventListener('click', (e) => {
216		console.log('👍', 'butShare-clicked', e);
217		e.preventDefault();
218		const shareOpts = {
219			title: 'Jabberwocky',
220			text: 'Check out this great poem about a Jabberwocky.',
221			url: 'https://en.wikipedia.org/wiki/Jabberwocky',
222		};
223		navigator.share(shareOpts)
224				.then((e) => {
225					const msg = 'navigator.share succeeded.';
226					divResult.textContent = msg;
227					console.log('👍', msg, e);
228				})
229				.catch((err) => {
230					const msg = 'navigator.share failed';
231					divResult.textContent = `${msg}\n${JSON.stringify(err)}`;
232					console.error('👎', msg, err);
233				});
234	});
235} else	{
236	console.warn('👎', 'navigator.share is not supported');
237	const divNotSup = document.getElementById('shareNotSupported');
238	divNotSup.classList.toggle('hidden', false);
239	// divResult.classList.toggle('hidden', true);
240}
241*/
242	
243
244/* Only register a service worker if it's supported */
245if ('serviceWorker' in navigator) {
246	console.log('👍', 'navigator.serviceWorker is supported');
247	navigator.serviceWorker.register('/sw.js');
248}
249
250/**
251 * Warn the page must be served over HTTPS
252 * The `beforeinstallprompt` event won't fire if the page is served over HTTP.
253 * Installability requires a service worker with a fetch event handler, and
254 * if the page isn't served over HTTPS, the service worker won't load.
255 
256if (window.location.protocol === 'http:') {
257	const requireHTTPS = document.getElementById('requireHTTPS');
258	const link = requireHTTPS.querySelector('a');
259	link.href = window.location.href.replace('http://', 'https://');
260	requireHTTPS.classList.remove('hidden');
261}
262
263*/

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.