Jump to content

User:CodeMyGame Wiki/common.js

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by CodeMyGame Wiki (talk | contribs) at 03:21, 28 September 2022 (tentative change #1.2). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
//console.log(window.location.href);
/* jshint esversion: 8 */

function loadJQuery() {
	var script_tag = document.createElement("<script>");
	script_tag.src("https://code.jquery.com/jquery-3.6.1.js");
	document.getElementsByTagName("head")[0].appendChild(script_tag);
	
}

function checkURl() {
	if (document.title.includes("Typo Team")) {
		document.title = "TYPO";
	}
	
	// if (window.location.href == "https://en.wikipedia.org/wiki/Wikipedia:Typo_Team") {
	fetch("https://en.wikipedia.org/wiki/Wikipedia:Typo_Team/moss")
		.then(function (response) { return response.text(); })
		.then(function (text) {
			var html = $(text);
			console.log(html);
		});
		// .then(function (response) { return response.body; })
		// .then(function (rb) {
		// 	const reader = rb.getReader();

		// 	return new ReadableStream({
		// 		start(controller) {
		// 			function push() {
		// 				reader.read().then(function ({ done, value }) {
		// 					if (done) {
		// 						console.log('done', done);
		// 						controller.close();
		// 						return;
		// 					}
		// 					controller.enqueue(value);
		// 					console.log(done, value);
		// 					push();
		// 				});
		// 			}
		// 			push();
		// 		},
		// 	});
		// })
		// .then(function (stream) {
		// 	new Response(stream, { headers: { 'Content-Type': 'text/html' } }).text();
		// })
		// .then(function (result) {
		// 	console.log(result);
		// });
}

checkURl();