Commented + Tidying Up
This commit is contained in:
		| @@ -31,16 +31,19 @@ $(".sport").on("click", function() { | ||||
|     $(this).trigger("selected", [selectedSports.includes(sportName), selectedSports]) // Trigger event | ||||
| }) | ||||
|  | ||||
| //evaluate and alter our page layout when page gets resized | ||||
| $(window).on("resize", function(){ | ||||
|     showFeeds() | ||||
| }); | ||||
|  | ||||
| //evaluate and alter our page layout when page gets loaded | ||||
| $(window).on("load", function() { | ||||
|     showFeeds() | ||||
| }) | ||||
|  | ||||
| let root = document.querySelector(":root") | ||||
|  | ||||
| //switch between light and dark mode | ||||
| $(".logo").on("click", function() { | ||||
|     if (root.style.getPropertyValue("--main-bg") === 'snow') { | ||||
| 		var audio = new Audio("../media/Chicken.mp3"); | ||||
| @@ -63,6 +66,7 @@ $(".logo").on("click", function() { | ||||
|     } | ||||
| }) | ||||
|  | ||||
| //when a filter event happens, filter and sort tweets, then remove all old HTML and fill with new HTML | ||||
| $(window).on("filter", function() { | ||||
|     var parent = document.querySelector("#filtered") | ||||
|     var lastTweet = parent.firstChild | ||||
| @@ -87,6 +91,7 @@ $(window).on("filter", function() { | ||||
|     } | ||||
| }) | ||||
|  | ||||
| // toggle html for the sorting dropdown menu | ||||
| $(".current-sort").on("click", function() { | ||||
|     $(".sort-dropdown-list li:not(:first-of-type)").toggle() | ||||
| })  | ||||
| @@ -100,7 +105,7 @@ $(".sort-dropdown-list li:not(:first-of-type)").on("click", function() { | ||||
|     $(".current-sort").html($(this).html()) | ||||
| }) | ||||
|  | ||||
|  | ||||
| // toggle ordering between ascending or descending and changing arrow to match | ||||
| $(".order-btn").on("click", function() { | ||||
|     if($(this).html() == "arrow_downward") {    // Descending to ascending | ||||
|         $(this).html("arrow_upward") | ||||
| @@ -113,6 +118,7 @@ $(".order-btn").on("click", function() { | ||||
|     showFeeds() | ||||
| }) | ||||
|  | ||||
| //functions that get called in HTML onchange attributes to trigger filters | ||||
| function updateSearched(searched){ | ||||
|     searched = searched.split(","); | ||||
|     filters.searchedWords = searched; | ||||
| @@ -134,6 +140,7 @@ function updateSort(sort){ | ||||
|     showFeeds() | ||||
| } | ||||
|  | ||||
| // toggle between paused and unpaused | ||||
| $(".pause-btn").on("click", function() { | ||||
|     if($(".pause-btn").html() == "pause") { // Unpaused to paused | ||||
|         $(".pause-btn").html("play_arrow") | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 jacktjong
					jacktjong