<commit_before>function setPage(newPage) {
	$(".page.open-page").removeClass("open-page");
	if ($("#" + newPage).length != 0) {
		// yay, it exists. go to it
		$("#" + newPage).addClass("open-page");
		if ($(".upsell[data-feature=" + newPage + "]").length == 0) {
			$("#" + newPage).trigger("tabOpened");
		}
		window.location.hash = newPage;
	} else {
		// fetch it!
		window.api.get("pageHandler/fetchPage/" + newPage, function(response) {
			// check for error
			if (response.status === "error") {
				console.error("Error loading page!");
				return;
			}

			// and load it
			var $page = $(response);

			var $scripts = $page.children("planhub-page-scripts");
			$("head").append($scripts);

			var $styles = $page.children("planhub-page-styles");
			$("head").append($styles);

			var $modals = $page.children("planhub-page-modals");
			$("body").append($modals);

			var $upsell = $page.children("planhub-page-upsell");
				$upsell.attr("id", newPage + "-upsell");
				$upsell.addClass("upsell");
				$upsell.addClass("row");
				$upsell.attr("data-feature", newPage);
			var $content = $page.children("planhub-page-content");
				$content.attr("id", newPage);
				$content.addClass("page");
				if (window.page.features.indexOf(newPage) == -1) {
					$content.append($upsell);
				}
			$("body").append($content);

			//setPage(newPage); // and show it
		});
	}
}

window.page = {
	features: [],
	loadTimeout: null,
	loadWarnTimeout: null
};

window.page.getBasePath = function() {
	return $("#basePath").text();
};

window.page.showLoading = function() {
	window.page.loadTimeout = setTimeout(function() {
		$(".loadOverlay").addClass("showLoadOverlay");
		$(".loadWarn").removeClass("showingLoadWarn");
		window.page.loadWarnTimeout = setTimeout(function() {
			console.warn("Loading is taking time...");
			$(".loadWarn").addClass("showingLoadWarn");
		}, 10000);
	}, 400);
};

window.page.hideLoading = function() {
	$(".loadOverlay").removeClass("showLoadOverlay");
	if (window.page.loadTimeout != null) {
		clearTimeout(window.page.loadTimeout);
	}
	if (window.page.loadWarnTimeout != null) {
		clearTimeout(window.page.loadWarnTimeout);
	}
	window.page.loadTimeout = 0;
	window.page.loadWarnTimeout = 0;
};

window.page.getFeatures = function(callback) {
	window.api.get("features/get/", function(data) {
		callback(data.features);
	});
};

window.page.addFeature = function(feature, callback) {
	window.api.post("features/add/", { feature: feature }, function(data) {
		callback();
	});
};

window.page.getOpenPage = function() {
	return $(".page.open-page").attr("id");
};

// default color is #333333 and complement is #222222
window.page.setColor = function(color, complement) {
	window.page.color = color;
	window.page.complement = complement;

	$(".tabs").css("background-color", color);
	$(".navbar-default").css("background-color", color);
	$("#page-pref-btn").css("background-color", color);
	$(".navbar-default .dropdown-menu").css("background-color", color);

	$(".tabs").css("border-right", "solid 1px " + complement);
	$("#page-pref-btn").css("border-color", complement);
	$.each(["#page-pref-btn", ".tabs li", ".navbar-default .navbar-nav>li>a"], function() {
		console.log(this);
		$(this).off("mouseenter").off("mouseleave").mouseenter(function() {
			console.log("enter");
			$(this).css("background-color", window.page.complement);
		}).mouseleave(function() {
			console.log("exit");
			$(this).css("background-color", window.page.color);
		});
	});
};

window.page.sendFeedback = function(type, msg, name, username, webpage, callback) {
	// if the user does not want to send the webpage, the variable will be set to undefined, so don't do any checks here.
	window.api.post("feedback/post/", {
		type: type,
		msg: msg,
		name: name,
		username: username,
		webpage: webpage
	}, function(data) {
		callback();<commit_msg>idk wheye but this works<commit_after>function setPage(newPage) {
	$(".page.open-page").removeClass("open-page");
	if ($("#" + newPage).length != 0) {
		// yay, it exists. go to it
		$("#" + newPage).addClass("open-page");
		if ($(".upsell[data-feature=" + newPage + "]").length == 0) {
			$("#" + newPage).trigger("tabOpened");
		}
		window.location.hash = newPage;
	} else {
		// fetch it!
		window.api.get("pageHandler/fetchPage/" + newPage, function(response) {
			// check for error
			if (response.status === "error") {
				console.error("Error loading page!");
				return;
			}

			// and load it
			var $page = $(response);

			var $scripts = $page.children("planhub-page-scripts");
			$("head").append($scripts);

			var $styles = $page.children("planhub-page-styles");
			$("head").append($styles);

			var $modals = $page.children("planhub-page-modals");
			$("body").append($modals);

			var $upsell = $page.children("planhub-page-upsell");
				$upsell.attr("id", newPage + "-upsell");
				$upsell.addClass("upsell");
				$upsell.addClass("row");
				$upsell.attr("data-feature", newPage);
			var $content = $page.children("planhub-page-content");
				$content.attr("id", newPage);
				$content.addClass("page");
				if (window.page.features.indexOf(newPage) == -1) {
					$content.append($upsell);
				}
			$("body").append($content);

			//setPage(newPage); // and show it
		});
	}
}

window.page = {
	features: [],
	loadTimeout: null,
	loadWarnTimeout: null
};

window.page.getBasePath = function() {
	return $("#basePath").text();
};

window.page.showLoading = function() {
	window.page.loadTimeout = setTimeout(function() {
		$(".loadOverlay").addClass("showLoadOverlay");
		$(".loadWarn").removeClass("showingLoadWarn");
		window.page.loadWarnTimeout = setTimeout(function() {
			console.warn("Loading is taking time...");
			$(".loadWarn").addClass("showingLoadWarn");
		}, 10000);
	}, 400);
};

window.page.hideLoading = function() {
	$(".loadOverlay").removeClass("showLoadOverlay");
	if (window.page.loadTimeout != null) {
		clearTimeout(window.page.loadTimeout);
	}
	if (window.page.loadWarnTimeout != null) {
		clearTimeout(window.page.loadWarnTimeout);
	}
	window.page.loadTimeout = 0;
	window.page.loadWarnTimeout = 0;
};

window.page.getFeatures = function(callback) {
	window.api.get("features/get/", function(data) {
		callback(data.features);
	});
};

window.page.addFeature = function(feature, callback) {
	window.api.post("features/add/", { feature: feature }, function(data) {
		callback();
	});
};

window.page.getOpenPage = function() {
	return $(".page.open-page").attr("id");
};

// default color is #333333 and complement is #222222
window.page.setColor = function(color, complement) {
	window.page.color = color;
	window.page.complement = complement;

	$(".tabs").css("background-color", color);
	$(".navbar-default").css("background-color", color);
	$("#page-pref-btn").css("background-color", color);
	$(".navbar-default .dropdown-menu").css("background-color", color);

	$(".tabs").css("border-right", "solid 1px " + complement);
	$("#page-pref-btn").css("border-color", complement);
	$.each(["#page-pref-btn", ".tabs li", ".navbar-default .navbar-nav>li>a"], function() {
		$(this.toString()).off("mouseenter").off("mouseleave").mouseenter(function() {
			$(this).css("background-color", window.page.complement);
		}).mouseleave(function() {
			$(this).css("background-color", window.page.color);
		});
	});
};

window.page.sendFeedback = function(type, msg, name, username, webpage, callback) {
	// if the user does not want to send the webpage, the variable will be set to undefined, so don't do any checks here.
	window.api.post("feedback/post/", {
		type: type,
		msg: msg,
		name: name,
		username: username,
		webpage: webpage
	}, function(data) {
		callback();
{'fraction_non_alphanumeric': 0.20852895148669798, 'fraction_numerical': 0.006781429316640584, 'mean_word_length': 4.325694444444444, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3901744', 'n_tokens_mistral': 2782, 'n_tokens_neox': 2546, 'n_words': 450}