aboutsummaryrefslogtreecommitdiff
path: root/app/public/static/package_edit.js
blob: 004f388f2e9399fcef26f4beee8b2555c560203e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// @author rubenwardy
// @license magnet:?xt=urn:btih:1f739d935676111cfff4b4693e3816e664797050&dn=gpl-3.0.txt GPL-v3-or-Later

$(function() {
	$("#type").change(function() {
		$(".not_mod, .not_game, .not_txp").show()
		$(".not_" + this.value.toLowerCase()).hide()
	})
	$(".not_mod, .not_game, .not_txp").show()
	$(".not_" + $("#type").val().toLowerCase()).hide()

	$("#forums").on('paste', function(e) {
		try {
			var pasteData = e.originalEvent.clipboardData.getData('text')
			var url = new URL(pasteData);
			if (url.hostname == "forum.minetest.net") {
				$(this).val(url.searchParams.get("t"));
				e.preventDefault();
			}
		} catch (e) {
			console.log("Not a URL");
		}
	});
})