PageSourceSearch

https://www.e-teaching.org/++webresource++cb73bdc4-dc2d-5a8a-8262-…mple-mastodon-share-button/mastodonShare.js

js e-teaching.org collected 2026-10-02 05:28:39 UTC 1,228 bytes, 27 lines download raw bytes

1function mastodonShareButtonClick(e) {
2	const btn = e.target;
3	let href = document.URL;
4	let title = document.title;
5	if ('data-title' in btn.attributes && 'data-href' in btn.attributes) {
6		href = btn.attributes['data-href'].value;
7		title = btn.attributes['data-title'].value;
8	}
9	const mastodonInstance = prompt(`Auf Mastodon teilen: \n\nBitte geben Sie die Mastodon-Instanz (z.B. higher-edu.social) ein, wo Sie den Beitrag Teilen wollen.`);
10	if (mastodonInstance == null) {
11		return;
12	}
13	if (mastodonInstance.indexOf('/') === -1) {
14		location.assign('https://' + mastodonInstance + '/share?text=' + encodeURIComponent(title) + ' ' + encodeURIComponent(href), "_blank");
15		/*window.open('https://' + mastodonInstance + '/share?text=' + encodeURIComponent(title) + ' ' + encodeURIComponent(href), "_blank");*/
16	} else {
17		alert("Bitte die Instanz ohne https:// oder anderen Pfaden eintragen!");
18	}
19}
20
21addEventListener('DOMContentLoaded', () => {
22	const buttons = document.querySelectorAll('a.mastodon-share');
23	buttons.forEach((btn) => {
24		btn.innerHTML = '<span><i class="bi bi-mastodon" style="font-size:1.7em; padding:15px" aria-hidden="true"></i></span>';
25		btn.addEventListener('click', mastodonShareButtonClick);
26	})
27})

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.