PageSourceSearch

https://slvha.com/wp-content/plugins/simple-google-icalendar-widge…ple-ical-block-view.js?ver=3.2.0-1789581994

js slvha.com collected 2026-10-05 22:27:39 UTC 2,792 bytes, 71 lines download raw bytes

1/**
2 * simple-ical-block-view.js
3 * view simple-ical-block output with extra client parameter tzid_ui using REST 
4 * restRoot for endpoint passed via inlinescript and this script in enqueue_block_assets
5 *  * v2.7.0
6 * 2.4.3 add search in iFrame and choice of used timezone via data-sib-utzui
7 * 2.4.4 title from params
8**/
9const endpoint = window.simpleIcalBlock.restRoot + "simple-google-icalendar-widget/v1/content-by-ids";
10let titl;
11
12window.simpleIcalBlock = {...(window.simpleIcalBlock || {}), ...{
13	fetchFromRest: function(dobj, ni) {
14		fetch(endpoint, {
15			method: "POST",
16			cache: "no-cache", // *default, no-cache, reload, force-cache, only-if-cached
17			headers: { "Content-Type": "application/json", },
18			body: JSON.stringify(dobj),
19		}).then((response) => {
20			if (!response.ok) {
21				throw new Error(`HTTP error, status = ${response.status}`);
22			}
23			return response.json();
24		}).then((res) => {
25			if (res.params && res.params.title) {
26				if (ni.querySelector('[data-sib-t="true"]')) {
27					ni.querySelector('[data-sib-t="true"]').innerHTML = res.params.title;
28					titl = ni.querySelector('[data-sib-t="true"]').outerHTML;
29				} else {
30					if (!res.params.tag_title) {res.params.tag_title = 'h3';}
31					titl = '<' + res.params.tag_title + ' class="widget-title block-title" data-sib-t="true">' + res.params.title + '</' + res.params.tag_title + '>';
32				}
33			} else {
34				titl = '';
35			}
36			ni.innerHTML = titl + res.content;
37			ni.setAttribute('data-sib-st', 'completed');
38		}
39		).catch((error) => {
40			console.log(error);
41			ni.setAttribute('data-sib-st', 'Error :' + error.code + ':' + error.message);
42			ni.innerHTML = '<p>= Code: ' + error.code + '<br>= Msg: ' + error.message + '</p>';
43		})
44	}
45	,
46	processNodelist: function (nodeList){
47		const ptzid_ui = Intl.DateTimeFormat().resolvedOptions().timeZone;
48		let paramsObj = {"wptype": "REST"};
49		for (let i = 0; i < nodeList.length; i++) {
50			paramsObj.sibid = nodeList[i].getAttribute('data-sib-id');
51   			paramsObj.tzid_ui = (typeof nodeList[i].getAttribute('data-sib-utzui') == 'string' && nodeList[i].getAttribute('data-sib-utzui') == '1') ? ptzid_ui : ''; 
52			nodeList[i].setAttribute('data-sib-st', 'f1');
53			this.fetchFromRest(paramsObj, nodeList[i]);
54		}
55	}
56	,
57	getBlockByIds: function() {
58		const nf = document.querySelectorAll('iframe');
59		let cwf, nodeList = document.querySelectorAll('[data-sib-st]');
60        this.processNodelist(nodeList);
61		for (let j = 0; j < nf.length; j++) {
62			cwf = (nf[j].contentWindow  || nf[j].contentDocument );
63			if (cwf.document)cwf = cwf.document;
64			nodeList =cwf.querySelectorAll('[data-sib-st]');
65	        this.processNodelist(nodeList);
66		}
67        
68	}
69}
70}
71window.simpleIcalBlock.getBlockByIds();

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.