Minecraft is an interesting game for a lot of reasons. One of the biggest is the fact that there are two versions of the game in completely different coding languages being maintained at the same time. These two versions are Java and Bedrock, and they tend to receive major updates, such as the upcoming , at the same time.
------Advertisement-----
However, there is a lesser-known third version of the game tucked away within Bedrock Edition. This is Education Edition, meant to be used to teach children in the classroom. Due to this version’s unique nature, it has a plethora of interesting crafting recipes, all of which are detailed below.
All the crafting recipes in Minecraft Education Edition
Crafting Stations
The crafting stations available within are not technically craftable, but they are required to make nearly every other item within this version of the game.
------Advertisement-----
Education Edition has the element constructor, which can be used to create elements; the compound creator, which can combine elements into compounds; the material reducer, which reduces items into their base elements; and the lab table, which can be used to conduct chemical experiments.
Compounds
Compounds represent the largest type of crafting recipe within Education Edition. Players can create compounds within the previously mentioned compound creator using the elements available through the element constructor. Here are the compounds available, along with their compound recipe.
------Advertisement-----
- Aluminium Oxide: Al2O3
- Ammonia: N1H3
- Barium Sulfate: Ba1S1O4
- Benzene: C6H6
- Boron Trioxide: B2O3
- Calcium Bromide: Ca1Br2
- Crude Oil: C9H20
- Cyanoacrylate: C5H5N1O2
- Hydrogen Peroxide: H2O2
- Latex: C5H8
- Lithium Hydride: Li1H1
- Luminol: C8H7N3O2
- Lye: Na1O1H1
- Magnesium Nitrate: Mg1N2O6
- Magnesium Oxide: Mg1O1
- Polyethylene: C10H20
- Potassium Iodide: K1I1
- Soap: C18H35Na1O2
- Sodium Acetate: C2H3Na1O2
- Sodium Fluoride: Na1F1
- Sodium Hydride: Na1H1
- Sodium Hypochlorite: Na1Cl1O1
- Sulfate: S1O4
- Salt: Na1Cl1
- Calcium Chloride: Ca1Cl2
- Cerium Chloride: Ce1Cl3
- Mercuric Chloride: Hg1Cl2
- Potassium Chloride: K1Cl1
- Tungsten Chloride: W1Cl6
- Charcoal: C7H4O1
- Glow Ink Sac/Ink Sac: Fe1S1O4
- Sugar: C6H12O6
- Water: H2O1
Balloons
Balloons are craftable entities that float upward once they have been placed. They are crafted by combining a lead, a single helium, a color of dye, and six latex. Since they can be crafted using dye, there are 16 different variants, each with a different color. They can be attached to mobs, which will cause them to float away, or to fences, which will anchor them.
Sparklers
Sparklers are in-game fireworks that players can create. This is done with a stick, magnesium, and one of five different chlorides, each with a different color. The sparkler colors are:
- Calcium Chloride: Orange
- Cerium Chloride: Blue
- Mercuric Chloride: Red
- Potassium Chloride: Purple
- Tungsten Chloride: Green
Each of these different chlorides can be created using the compound creator, with their formulas being found in the compounds section.
Underwater TNT
Underwater TNT, as the name suggests, is TNT that functions underwater. This allows interesting scientific experiments in Education Edition but also makes incredible TNT to duplicate in a survival world created using Education Edition settings.
Underwater TNT is made with regular TNT and the element sodium. While it can be used underwater, it cannot be used in lava.
Underwater Torches
Underwater torches are similar to underwater TNT in that they are also a variant of a vanilla item that now works underwater. Players can make underwater torches by combining a regular torch with the element magnesium.
Other than the fact they can be placed underwater, these torches function the same as regular torches.
Hardened Glass
Hardened glass is an education-exclusive version of glass that takes longer to break and has a different texture. It is made by combining glass with aluminum oxide and boron trioxide.
There are hardened glass variants of all of the game’s different glass colors and panes. Unlike regular glass, this will drop a collectible item when broken.
Colored Torches
Colored Torches are different versions of the regular Minecraft torch that emit various colors of light as they burn with different chemicals. There are four different colors of torch, each created by combining a torch with a different chloride, as described below.
- Cerium chloride: Blue torch
- Mercuric chloride: Red torch
- Potassium chloride: Purple torch
- Tungsten chloride: Green torch
Heat Block
Heat blocks are exclusive to Minecraft Education Edition. They can be crafted with iron, water, charcoal, and salt within a lab table crafting station.
Heat blocks will melt snow and ice within a two-block radius while not emitting any light.
Bleach
Bleach is an exclusive Education Edition variant of white dye. It is a craftable compound, obtainable from the lab table crafting station. The ingredients to craft it are three waters and three sodium hypochlorites.
As mentioned previously, Bleach is a white dye variant. It is, therefore, usable in any crafting recipes that use that color of dye, including and dying leather armor.
Ice Bomb
Ice bombs are throwables that can be created on a lab table within Minecraft Education Edition by combining four sodium acetates.
Ice bombs explode when hitting most blocks or entities. When they explode, any water within a three-by-three-by-three cube of the explosion is frozen.
Super Fertilizer
Super Fertilizer is an upgraded bone meal found within Minecraft Education Edition. It can be crafted on the lab table by combining ammonia and phosphorous.
Super Fertilizer affects a larger area when used on grass and instantly grows any crops it is used on.
Medicine
Medicines are Education Edition-exclusive that can be used to cure a specific status effect rather than applying it. They are all brewed with awkward potions and an element.
The medicines, along with their recipes and what they cure, can be found below:
- Antidote: Cures poison, crafted with silver
- Elixir: Cures weakness, crafted with cobalt
- Eye drops: Cures blindness, crafted with calcium
- Tonic: Cures nausea, crafted with bismuth
Glow Stick
Glow sticks are Education Edition-exclusive items that act as temporary torches. They can be cracked by players, after which they will emit a colored light for a short time before running out of durability and breaking.
There are 16 different glowsticks, one for each of . Glowsticks are crafted by combining polyethylene, a dye, a single hydrogen peroxide, and a single luminol.
(function() {
var maxScrollCaptured = 0;
var eventTriggered = false;
var gaScrollObject = {
‘event_label’: “percentage_scrolled”
}
var sessionCookieValue = getCookie(“keeda-session-uuid”);
if (sessionCookieValue) {
gaScrollObject[‘keeda-session-uuid’] = sessionCookieValue;
}
var userID = getCookie(“fw_ID”);
if (userID) {
gaScrollObject[‘loggedIn_user_id’] = userID;
}
function calculateScrollDepth() {
var targetEle = document.getElementById(“in-house-ads”);
gaScrollObject[‘event_category’] = “article_read_depth”;
gaScrollObject[“post_id”] = “1882066”;
gaScrollObject[‘content_total_pages’] = “1”;
gaScrollObject[‘content_current_page’] = “1”;
if (!targetEle) return;
var scrollDepth = window.scrollY.toFixed(2);
var targetScrollHeight = targetEle.offsetTop.toFixed(2);
var percentageScrolled = (100 – ((targetScrollHeight-scrollDepth)/targetScrollHeight)*100).toFixed(2);
if (percentageScrolled > 100) {
percentageScrolled = 100;
}
if (maxScrollCaptured < percentageScrolled) {
maxScrollCaptured = percentageScrolled;
}
if (!eventTriggered && maxScrollCaptured == 100) {
sendPageDepthScrollGAEvent();
window.removeEventListener('pagehide', recalculateDepthAndSendGAEvent);
eventTriggered = true;
}
}
function sendPageDepthScrollGAEvent() {
gaScrollObject["scrolled_depth"] = Math.round(maxScrollCaptured);
gtag('event', 'scroll', gaScrollObject);
}
var timeoutScroll = 0;
function articleDepthDebounce(fn, delay) {
clearTimeout(timeoutScroll);
timeoutScroll = setTimeout(fn, delay);
}
function recalculateDepthAndSendGAEvent() {
calculateScrollDepth();
sendPageDepthScrollGAEvent();
}
document.addEventListener('scroll', function(e) {
articleDepthDebounce(calculateScrollDepth, 100);
})
window.addEventListener('pagehide', recalculateDepthAndSendGAEvent);
})();
(function(){
var pageType = "Articlepage";
var pageLoadedTime = Date.now();
var postId = "1882066";
var timeSpentHandlerLoaded = false;
function loadTimeSpentHandler() {
if (timeSpentHandlerLoaded) return;
timeSpentHandlerLoaded = true;
function timeSpentHandler() {
var timeSpentDifference = Date.now() - pageLoadedTime;
var timeSpentSeconds = Math.floor(timeSpentDifference/1000);
var payload = {
"transport_type": "beacon",
"time_spent_seconds": timeSpentSeconds
};
var sessionCookieValue = getCookie("keeda-session-uuid");
if (sessionCookieValue) {
payload['keeda-session-uuid'] = sessionCookieValue;
}
if (postId && (pageType == "Articlepage" || pageType == "slideshow" || pageType == "Singlepageslideshow")) {
payload["post_id"] = postId;
gtag("event", "time_spent_on_article", payload);
} else if (pageType == "Homepage") {
payload["device"] = IS_MOBILE ? "Mobile" : "Desktop";
gtag("event", "time_spent_on_homepage", payload);
} else if (pageType == "wikipage" || pageType == "WikiHomepage" || pageType == "wiki_tagpage") {
payload["wiki_page"] = window.location.href;
payload["page_id"] = "";
payload["wiki_lang"] = "";
gtag("event", "time_spent_on_wikipage", payload);
} else if (pageType == "Tagpage" || pageType == "playerpage" || pageType == "teampage" || pageType == "Eventpage" || "") {
payload["tag_page"] = window.location.href;
payload["page_id"] = "";
gtag("event", "time_spent_on_staticpage", payload);
}
}
document.addEventListener("visibilitychange", function() {
if (document.visibilityState === "visible") {
pageLoadedTime = Date.now();
} else {
timeSpentHandler();
}
});
}
document.addEventListener("scroll", loadTimeSpentHandler, { once: true });
document.addEventListener("mousemove", loadTimeSpentHandler, { once: true });
document.addEventListener("touchmove", loadTimeSpentHandler, { once: true });
})();
var trackedClick = false;
function trackBelowContentFeedClick(event) {
if(trackedClick) {
return true;
}
var clickedElement = event.target;
while(!!clickedElement.parentNode) {
if(hasClass(clickedElement, "story-wrapper")) {
trackedClick = true;
gtag('event', 'click', {
'event_category': "All Sports_Articles_Related Articles_Below Article_Desktop_17March2021",
'event_label': Array.prototype.indexOf.call(clickedElement.parentNode.getElementsByClassName("story-wrapper"), clickedElement) + 1,
'non_interaction': true
});
return true;
}
clickedElement = clickedElement.parentNode;
}
return true;
}
if ($(".comments-total-container")) {
$(".comments-total-container").addEventListener("click", function () {
var gaObject = {
'event_category': "Comments",
'event_label': "No_of_comments",
}
var sessionCookieValue = getCookie("keeda-session-uuid");
if (sessionCookieValue) {
gaObject['keeda-session-uuid'] = sessionCookieValue;
}
var userID = getCookie("fw_ID");
if (userID) {
gaObject['loggedIn_user_id'] = userID;
}
gtag('event', 'click', gaObject);
})
}
if ($(".comments-total-container-bottom")) {
$(".comments-total-container-bottom").addEventListener("click", function () {
var gaObject = {
'event_category': "Comments",
'event_label': "No_of_comments_bottom",
}
var sessionCookieValue = getCookie("keeda-session-uuid");
if (sessionCookieValue) {
gaObject['keeda-session-uuid'] = sessionCookieValue;
}
var userID = getCookie("fw_ID");
if (userID) {
gaObject['loggedIn_user_id'] = userID;
}
gtag('event', 'click', gaObject);
})
}
document.addEventListener("click", trackBelowContentFeedClick.bind(this));
var followButtons = $all('.btn-follow');
var followButtons = $all('.follow-btn');
var authorId;
var source;
/* for user profile page */
function displayFollowContent() {
addClass($('.follow-pc'),'hidden');
removeClass($('.follow-content .author-profile-info'), 'hidden');
removeClass($('.follow-content .follow-author'),'hidden');
}
function followCallback (resp) {
data = JSON.parse(resp);
displayFollowContent();
for(i=0;i 0) ? userName.substring(0, userName.indexOf(' ')) : userName;
if (myUserId) {
var ths = this;
var action = 'follow';
if(ths.innerText == "Following") {
action = 'un-follow';
}
pureJSAjaxPut('https://a-login.sportskeeda.com/en/user/' + authorId + '/' + action,'{}',
function (resp) {
data = JSON.parse(resp);
if (data.status == true) {
flipFollowStatus(action);
if (source == 'profile') {
getFollowsCount();
}
if(action == 'follow') {
showMessage("Hey! You've just followed “+firstName+”. We will notify you when they publish new content.”);
}
gtag(‘event’, action, {
‘event_category’: ‘FOLLOW’,
‘event_label’: source,
‘non_interaction’: true
});
} else {
var actionRevert = (action == ‘follow’) ? ‘un-follow’ : ‘follow’;
flipFollowStatus(actionRevert);
}
},
function (error) {
console.log(error);
var actionRevert = (action == ‘follow’) ? ‘un-follow’ : ‘follow’;
flipFollowStatus(actionRevert);
}
);
flipFollowStatus(action);
} else {
window.location = (‘/login?after-login=’ + window.location.href );
}
};
function setAdFloatingParams() {
if ($(“.rightStickyTopWrap”) && $(‘.fragments-container’)) {
$(“.rightStickyTopWrap”).style.height = ($(‘.fragments-container’).clientHeight – 44) + “px”;
}
}
setInterval(function() {
setAdFloatingParams();
}, 2000);
window.addEventListener(“load”, setAdFloatingParams.bind(this));
window.addEventListener(“DOMContentLoaded”, function() {
var trackCopyURL = “https://a-login.sportskeeda.com/en” + “/track-events”;
document.addEventListener(“scroll”, addevents_youtube_embeds.bind(this));
document.addEventListener(“mousemove”, addevents_youtube_embeds.bind(this));
document.addEventListener(‘copy’, logCopyEvent.bind(this));
function addevents_youtube_embeds() {
var youtube = document.getElementsByClassName(“youtube”);
for (var i = 0; i < youtube.length; i++) {
var ytURL = youtube[i].dataset.embed;
var youtubeWrapper = youtube[i].parentElement;
var youtubeCoverImg = youtube[i].getElementsByTagName("img")[0];
var iframe = document.createElement( "iframe" );
iframe.setAttribute( "width", youtubeCoverImg.width );
iframe.setAttribute( "height", youtubeCoverImg.height );
iframe.setAttribute( "src", "https://www.youtube.com/embed/"+ ytURL);
iframe.setAttribute( "frameborder", "0" );
iframe.setAttribute( "allowfullscreen", "");
youtubeWrapper.innerHTML = "";
youtubeWrapper.appendChild( iframe );
};
var iframeEmbeds = document.getElementsByClassName("iframe-embeds");
for (var i = 0; i < iframeEmbeds.length; i++) {
var iframeSRC = iframeEmbeds[i].dataset.embed;
var aspectRatio = iframeEmbeds[i].dataset.aspectratio;
var height = iframeEmbeds[i].dataset.height;
var source = iframeEmbeds[i].dataset.source;
var allowValue = iframeEmbeds[i].dataset.allow;
var iframeWrapper = iframeEmbeds[i].parentElement;
var iframe = document.createElement( "iframe" );
iframe.setAttribute( "width", "100%");
if(aspectRatio) {
iframe.setAttribute( "style", "height: calc(" + iframeEmbeds[i].clientWidth + "px * " + aspectRatio + ")");
} else if (height) {
iframe.setAttribute("style", "height: "+ height + "px");
}
iframe.setAttribute( "src", iframeSRC);
iframe.setAttribute( "frameborder", "0" );
iframe.setAttribute( "allowfullscreen", "");
if (allowValue) {
iframe.setAttribute("allow", allowValue);
}
if (source && iframeWrapper.parentElement) {
iframeWrapper.parentElement.classList.add(source);
}
iframeWrapper.innerHTML = "";
iframeWrapper.appendChild( iframe );
}
}
function logCopyEvent() {
var payload = { event_type: "copy", post_id: 1882066 };
pureJSAjaxPost(trackCopyURL, payload, function() {}, function () {
console.error('Failed to save copy event');
}, null, true);
}
});
(function() {
var followUsCTA = $(".follow-us-cta");
function followUsGoogleNews(){
if (!followUsCTA) return;
var st = window.pageYOffset || document.documentElement.scrollTop;
if ( st < 0 ) {
st = 0;
}
if ( st > 300 ) {
followUsCTA.classList.remove(“hidden”);
} else {
followUsCTA.classList.add(“hidden”);
}
}
window.addEventListener(“scroll”, followUsGoogleNews);
})();
var followUsCTAs = $all(“.follow-action”);
for (var i = 0; i < followUsCTAs.length; i++) {
followUsCTAs[i].addEventListener("click", function(e) {
var element = e.currentTarget;
var elementClass = element.getAttribute("class");
var payload = {
"title": document.title,
"category": "minecraft" || "all-minecraft-education-edition-recipes",
"device": "Desktop"
}
if (elementClass.includes("follow-us-cta")) {
payload["position"] = "header";
} else if (elementClass.includes("follow-action-bottom")) {
payload["position"] = "bottom";
} else {
payload["position"] = "top";
}
gtag("event", "Follow_Us", payload);
});
}
(function() {
var article_sponserd_links = $all(".sponsored_link");
for (var i = 0; i < article_sponserd_links.length; i++) {
article_sponserd_links[i].addEventListener("click", function(element) {
var sportCategory = "minecraft" || "all-minecraft-education-edition-recipes";
var isDesktop = "1";
var payload = {
"sponsed_link": element.target.href,
"sponsed_link_text": element.target.innerHTML,
"page_url": window.location.href,
"category": sportCategory,
}
if (isDesktop) {
payload["device"] = "Desktop"
} else {
payload["device"] = "Mobile"
}
gtag("event", "Article_Sponsered_Link_Click", payload);
});
}
var bottom_tagline_links = document.querySelectorAll('.bottom_tagline_link');
for (var i = 0; i < bottom_tagline_links.length; i++) {
bottom_tagline_links[i].addEventListener('click', trackBottomTaglineClickEvent.bind(this));
}
var bottom_tagline_video_links = document.querySelectorAll('.bottom-tagline-video-link');
for (var i = 0; i < bottom_tagline_video_links.length; i++) {
bottom_tagline_video_links[i].addEventListener('click', trackBottomTaglineClickEvent.bind(this));
}
function trackBottomTaglineClickEvent(element) {
var taglinePosition = element.currentTarget.getAttribute("data-tab");
var taglineUrl = element.currentTarget.getAttribute("href");
var payload = {
"tagline_position": taglinePosition,
"destination_url": taglineUrl
}
trackGAEvent("Clicks_BottomTagline", payload);
}
var bottom_tagline_text_container = document.querySelectorAll('.bottom-tagline');
for (var i = 0; i < bottom_tagline_text_container.length; i++) {
trackBottomTaglineImpression(bottom_tagline_text_container[i]);
}
var bottom_tagline_video_container = document.querySelectorAll('.bottom-tagline-video');
for (var i = 0; i < bottom_tagline_video_container.length; i++) {
trackBottomTaglineImpression(bottom_tagline_video_container[i]);
}
var bottom_tagline_promo_container = document.querySelectorAll('.bottom-tagline-banner');
for (var i = 0; i < bottom_tagline_promo_container.length; i++) {
trackPromoBannerImpression(bottom_tagline_promo_container[i]);
var bannerLink = bottom_tagline_promo_container[i].querySelector('.bottom-tagline-banner-link');
if (bannerLink) {
bannerLink.addEventListener('click', trackPromoBannerClickEvent);
}
}
function trackPromoBannerClickEvent(e) {
var target = e.target.closest(".bottom-tagline-banner-link");
if (!target) return;
var taglinePosition = target.getAttribute("data-tab");
var taglineUrl = target.getAttribute("href");
trackGAEvent("TAGLINE_CLICK", {
"position": taglinePosition,
"variant": "promo-banner",
"destination_url": taglineUrl
});
}
function trackBottomTaglineImpression(element) {
var taglinePosition = element.getAttribute("data-tab");
trackImpressionGAEventWhenInViewport({
element: element,
identifier: "element_" + taglinePosition,
eventName: "Tagline_Impression",
eventParams: {
"tagline_position": taglinePosition,
}
});
}
function trackPromoBannerImpression(element) {
var taglinePosition = element.getAttribute("data-tab");
trackImpressionGAEventWhenInViewport({
element: element,
identifier: "tagline_promo_banner_" + taglinePosition,
eventName: "TAGLINE_IMPRESSION",
eventParams: {
"position": taglinePosition,
"variant": "promo-banner",
}
});
}
// this will fire ga event on anchor tag clicks in article page
var hyperLinks = $all("#article-content p a, #article-content table a");
for (var i = 0; i < hyperLinks.length; i++) {
var hyperLink = hyperLinks[i];
hyperLink.addEventListener("click", sendHyperlinkClickedGAEvent);
}
function sendHyperlinkClickedGAEvent() {
trackGAEvent("Clicks_hyperlinks", {
destURL: this.href,
});
}
})();
(function() {
var spotifyMonitor = setInterval(function() {
var elem = document.activeElement;
if (elem && elem.tagName == "IFRAME") {
var src = elem.getAttribute("src");
if (src && src.indexOf("open.spotify.com") > -1) {
clearInterval(spotifyMonitor);
gtag(“event”, “ARTICLE_EMBED_CLICK__SPOTIFY”, {
link: window.location.href
});
}
}
}, 100);
})();
(function() {
function lazyTweetLoader() {
var twitterEmbeds = document.querySelectorAll(“.hidden-lazy”);
var intersectionObserverForLazyHidden = new IntersectionObserver(
function(entries) {
entries.forEach(function(entry) {
if (entry.isIntersecting) {
var verifiedElement = entry.target.querySelector(“.verified”);
removeClass(verifiedElement, “hidden”);
var likeElement = entry.target.querySelector(“.tweet-like-icon”);
removeClass(likeElement, “hidden”);
var retweetElement = entry.target.querySelector(“.tweet-retweet-icon”);
removeClass(retweetElement, “hidden”);
var twitterLogoElement = entry.target.querySelector(“.tweet-logo”);
removeClass(twitterLogoElement, “hidden”);
}
});
}, {
threshold: 0.1
}
);
twitterEmbeds.forEach(function(element) {
intersectionObserverForLazyHidden.observe(element);
});
}
window.addEventListener(“DOMContentLoaded”, function() {
lazyTweetLoader();
});
}());
(function() {
var storyMap = {};
const storyGAObserver = new IntersectionObserver (function (entries) {
entries.forEach(function (story, index) {
if(story.isIntersecting) {
var storyLink = story.target.querySelector(“.list-story-link”);
var storyID = storyLink.getAttribute(“data-id”);
var storyNumber = storyLink.getAttribute(“story-sequence”);
var destination = story.target.querySelector(“.story-link-overlay”).href;
var title = story.target.querySelector(“.block-story-title”).innerText;
trackGAEvent(“MORE_FROM_SK_IMPRESSION”, {
“sequence”: storyNumber,
“destinationURL” : destination,
“destinationTitle” : title
});
story.target.addEventListener(“click”, function() {
trackGAEvent(“MORE_FROM_SK_CLICKS”, {
“sequence”: storyNumber,
“destinationURL” : destination,
“destinationTitle” : title
});
});
storyMap[storyID] = true;
}
storyGAObserver.unobserve(story.target);
});
},
{
threshold: 0.5
});
function observeStoryWrapper() {
var storyWrappers = document.querySelectorAll(“.story-wrapper, .social-story-wrapper”);
storyWrappers.forEach(function(story, index) {
storyLink = story.querySelector(“.list-story-link”);
storyLink.setAttribute(“story-sequence”, index + 1);
storyID = storyLink.getAttribute(“data-id”);
if(!storyMap[storyID]) {
storyGAObserver.observe(story);
}
});
}
window.addEventListener(“DOMContentLoaded”, function() {
document.addEventListener(“scroll”, debounce(observeStoryWrapper, 500) , { passive: true })
});
})();
window._taboola = window._taboola || [];
_taboola.push({ flush: true });
(function() {
var isOpera = “”;
var showAlsoReadSection = “”;
var showAlsoReadSectionV2 = “”;
var showAlsoReadTagBasedRecommendation = “”;
function renderRecommendedArticles(data) {
var recommendedArticlesContainer = document.querySelector(‘.recommended-articles’);
data = JSON.parse(data);
if (showAlsoReadSection && !showAlsoReadSectionV2 && !showAlsoReadTagBasedRecommendation) {
if (data.recommended_posts && data.recommended_posts.length > 2) {
var alsoReadArticles = data.recommended_posts.splice(0, 2);
renderAlsoReadArticles(alsoReadArticles);
}
}
var recommendedPosts = data.recommended_posts;
if (recommendedPosts && recommendedPosts.length > 0) {
recommendedPosts.forEach(function (story, index) {
var storyTitle = encodeURIComponent(story.title);
var permalink = story.permalink;
if (isOpera) {
permalink = permalink.replace(“https://www.sportskeeda.com/”, “/”);
}
var storyHTML =
`
${story.title}
`;
if (index == 3 && isOpera) {
storyHTML += `
`;
}
recommendedArticlesContainer.innerHTML += storyHTML;
});
}
}
function recommendedArticles() {
var baseUrl = “https://cf-gotham.sportskeeda.com/recommendations/post/all-minecraft-education-edition-recipes?lang=en&category=minecraft”;
pureJSAjaxGet(baseUrl, function(data) {
renderRecommendedArticles(data);
if (isOpera) {
renderOperaFeedAd();
}
}, function() {}, false);
}
var options = {
root: null,
rootMargin: “0px 0px 70% 0px”,
threshold: 0.1
};
var observer = new IntersectionObserver(function (entries) {
entries.forEach(function (entry) {
if (entry.isIntersecting) {
recommendedArticles();
observer.unobserve(entry.target);
}
});
}, options);
var targetElement;
if (showAlsoReadSection && !showAlsoReadSectionV2) {
targetElement = document.querySelector(‘.also-read-articles-container’);
} else {
targetElement = document.querySelector(‘.recommended-posts’);
}
if (targetElement) {
observer.observe(targetElement);
}
function renderOperaFeedAd() {
var operaFeedArticleAd = $(“.opera-article-feed-ad”);
if (!operaFeedArticleAd) {
return;
}
var firstScript= document.createElement(‘script’);
firstScript.setAttribute(“type”, “text/javascript”);
firstScript.setAttribute(“src”, “https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-1883810847636355”);
firstScript.setAttribute(“async”, true);
firstScript.setAttribute(“crossorigin”, “anonymous”);
operaFeedArticleAd.appendChild(firstScript);
operaFeedArticleAd.innerHTML += `
`;
var secondScript = document.createElement(‘script’);
var secondScriptCode = ‘(adsbygoogle = window.adsbygoogle || []).push({});’;
try {
secondScript.appendChild(document.createTextNode(secondScriptCode));
operaFeedArticleAd.appendChild(secondScript);
} catch (e) {
console.error(e);
}
}
})();
var socialStoriesObserved = {};
var videoPlayedEventTriggered = {}
var socialStoriesIOConfig = {
root: null,
rootMargin: “0px”,
threshold: 0.5
}
var socialStoriesIntersectionObserver = new IntersectionObserver(handlerForSocialStoryIO, socialStoriesIOConfig);
function handlerForSocialStoryIO(entries) {
entries.forEach(function(entry) {
var targetEle = entry.target;
if (entry.isIntersecting) {
var videoEle = targetEle.querySelector(“video”);
if (videoEle) {
var postId = targetEle.dataset.id;
socialStoriesIntersectionObserver.unobserve(targetEle);
setEventListenerForVideoPlay(videoEle, postId, targetEle.dataset);
} else {
targetEle.setAttribute(“data-visible-start”, Date.now());
targetEle.removeAttribute(“data-visible-end”);
}
return
}
if (entry.boundingClientRect.top < 1) {
var dataset = targetEle.dataset
if (dataset.visibleEnd) return;
if (!dataset.visibleStart) return;
var now = Date.now();
targetEle.setAttribute("data-visible-end", now);
if((now - dataset.visibleStart) > 2000) {
// post viewed for more than 2 seconds
sendPageViewTracking(dataset);
socialStoriesIntersectionObserver.unobserve(targetEle);
}
}
})
}
function sendPageViewTracking(dataset) {
if (TrackUsersLive === “undefined”) {
return;
}
try {
var storyAbsolutePermalink = new URL(dataset.link);
dataset.link = storyAbsolutePermalink.href;
} catch (error) {
dataset.link = “https://www.sportskeeda.com” + dataset.link;
}
var data = ‘uri=’ + encodeURIComponent(dataset.link) +
‘&userIdentifier=’ + userId +
‘&post_id=’ + dataset.wpId +
‘&post_type=’ + dataset.type +
‘&published_date=’ + dataset.published +
‘&author_id=’ + (dataset.authorSlug || “”) +
‘&tt_id_json=’ + (dataset.ttIds || “[]”) +
‘&session_id=’ + TrackUsersLive.getUniqueSessionId() +
‘&query_string=’ + encodeURIComponent(window.location.search) +
‘&pageType=Articlepage’ +
‘&revenue_share=false&key1=&key2=&key3=&key4=&lang=en&update_reads=true&page_view=true’;
TrackUsersLive.sendPageViewRequest(data, “https://ingestion.sportskeeda.com”);
var eventUrl = dataset.link;
sendGAPageViewEventForSocialPost(eventUrl);
}
// sends page view event for the social post to GA
function sendGAPageViewEventForSocialPost(url) {
if (!gtag) return;
gtag(‘config’, ‘G-T41EZF14QW’, { ‘page_path’: url });
}
function setIntersectionObserverSocialPosts() {
var socialStories = $all(“.social-story-wrapper .list-story-link”);
for (var i = 0; i < socialStories.length; i++) {
var storyEle = socialStories[i];
if (!storyEle || !storyEle.dataset.id || !!socialStoriesObserved[storyEle.dataset.id]) {
continue;
}
socialStoriesIntersectionObserver.observe(storyEle);
}
}
function setEventListenerForVideoPlay(videoEle, postId, dataset) {
if (!videoEle || !postId) return;
videoEle.addEventListener("play", function() {
if (!!videoPlayedEventTriggered[postId]) {
return;
}
videoPlayedEventTriggered[postId] = true;
sendGAEventForSocialStory("video_play", postId, false);
sendPageViewTracking(dataset);
}, { once: true });
}
function sendGAEventForSocialStory(action, postId, nonInteraction) {
if (!gtag || !action) {
return;
}
var params = {
"event_category": "Social_post",
"event_label": "Articlepage" || "",
}
if (nonInteraction) {
params["non_interaction"] = true;
}
gtag("event", action, params);
}
function showFeedCommentsContainer() {
window.showFeedCommentsContainerShim = true;
}
·
0
0
function onExpandableTextareaInput({ target: elm }) {
var minRows = 1,
rows;
!elm._baseScrollHeight && getScrollHeight(elm);
elm.rows = minRows;
rows = Math.ceil((elm.scrollHeight – elm._baseScrollHeight) / 16);
elm.rows = (minRows + rows) < 5 ? (minRows + rows) : 4;
elm.style.height = 'auto';
}
function getScrollHeight(elm) {
var savedValue = elm.value;
elm.value = "";
elm._baseScrollHeight = elm.scrollHeight;
elm.value = savedValue;
}
function initGifTagScroll() {
var tagsContainer = document.querySelector(".gif-display-tags");
var leftScrollButton = document.querySelector(".scroll-left-button");
var rightScrollButton = document.querySelector(".scroll-right-button");
leftScrollButton.onclick = function () {
tagsContainer.scrollBy({
behavior:"smooth",
top: 0,
left: -450
});
}
rightScrollButton.onclick = function () {
tagsContainer.scrollBy({
behavior:"smooth",
top: 0,
left: 450
});
}
new KeedaCarousalControlsHelper({
target: tagsContainer,
whenFistItemInViewport: function(entry) {
addClass(leftScrollButton, "hidden");
},
whenFistItemNotInViewport: function(entry) {
removeClass(leftScrollButton, "hidden");
},
whenLastItemInViewport: function(entry) {
addClass(rightScrollButton, "hidden");
},
whenLastItemNotInViewport: function(entry) {
removeClass(rightScrollButton, "hidden");
}
}).observeTarget();
}
var isCommentsScriptLazyLoaded = false;
var isCommentPopupVisible = false;
var currentShownId = null;
function isValidURL(string) {
var res = string.match(/(http(s)?://.)?(www.)?[-a-zA-Z0-9@:%._+~#=]{2,256}.[a-z]{2,6}b([-a-zA-Z0-9@:%_+.~#?&//=]*)/g);
return (res !== null)
};
function setUrlParam(key, value) {
var url = new URL(window.location.href);
url.searchParams.set(key, value);
window.history.replaceState(null, null, url);
}
function getUrlParamByKey(key) {
var url = new URL(window.location.href);
return url.searchParams.get(key);
}
function deleteUrlParam(key) {
var url = new URL(window.location.href);
url.searchParams.delete(key);
window.history.replaceState(null, null, url);
}
function storeStoryDetailsAndToggleFeedComment(element, story) {
var id = element.dataset.id;
if (!id) return;
var ssKey = new Date().getTime();
sessionStorage.setItem(“comment_meta_” + ssKey, JSON.stringify({
“id”: element.dataset.id,
“title”: element.dataset.pollQuestion || element.dataset.title,
“href”: element.dataset.href,
“type”: element.dataset.type,
“scrollY”: window.scrollY
}));
setUrlParam(“comment-meta-id”, ssKey);
setUrlParam(“comment-popup”, “1”);
toggleCommentsPopup(ssKey, false);
}
function toggleCommentsPopup(ssKey, doScroll) {
var sessionStorageData = sessionStorage.getItem(“comment_meta_” + ssKey);
if (!sessionStorageData) return;
var commentData = {};
try {
commentData = JSON.parse(sessionStorageData);
} catch (e) {
console.error(e);
return;
}
if (!commentData.id) return;
if (isCommentPopupVisible && commentData.id == currentShownId) {
hideCommentsContainer(true);
return;
}
var popover = document.getElementById(“feed-comments-popover”);
if (!popover) return;
popover.classList.remove(“inactive”);
showCommentPopupArticleInfo(commentData.title);
var articleLink = commentData.href + window.location.search;
if (!isValidURL(articleLink)) {
articleLink = window.location.origin + articleLink;
}
loadCommentsScriptWithCallback(function() {
var feedComments = new KeedaComments({
id: commentData.id,
wpId: null,
popup: true,
commentsContainer: document.getElementById(“feed-comments-container”),
pageType: “post”,
articleLink: articleLink,
gaCategory: “Feedpage”
});
feedComments.fetchCommentsAndRender();
isCommentPopupVisible = true;
currentShownId = commentData.id;
})
var payload = {
“event_category”: “Feedpage_Interactions”,
“event_label”: getGALabelForFeedCommentClick(commentData.type),
“page_url”: window.location.href
}
var isDesktop = “1”;
if (commentData.id) {
payload[“post_id”] = commentData.id;
}
if (articleLink) {
payload[“destination_url”] = window.location.origin + commentData.href;
}
if (isDesktop) {
payload[“device”] = “Desktop”;
} else {
payload[“device”] = “Mobile”;
}
gtag(“event”, “click”, payload);
if (doScroll && commentData.scrollY) {
window.scrollTo(0, commentData.scrollY);
}
addListenerToCommentBox();
}
function getGALabelForFeedCommentClick(type) {
if (type === “tweet”) {
return “Social_Twitter_Comment_Button”;
} else if (type === “youtube”) {
return “Social_Youtube_Comment_Button”;
} else if (type === “instagram”) {
return “Social_Instagram_Comment_Button”;
}
return “Article_Comment_Button”;
}
function hideCommentsContainer(fromWindowPop) {
if (!isCommentPopupVisible) {
return;
}
isCommentPopupVisible = false;
currentShownId = null;
var popover = document.getElementById(“feed-comments-popover”);
if (!popover) return;
deleteUrlParam(‘comment-meta-id’);
deleteUrlParam(‘comment-popup’);
popover.classList.add(“inactive”);
if (!fromWindowPop) {
window.history.back();
}
}
function showCommentPopupArticleInfo(title) {
var articleInfoContainer = document.getElementById(“comments-article-info”);
if (!articleInfoContainer) return;
if (!title) {
articleInfoContainer.classList.add(“hidden”);
} else {
articleInfoContainer.classList.remove(“hidden”);
}
var titleEle = articleInfoContainer.querySelector(“.comments-article-title”);
if (titleEle) titleEle.innerText = decodeURIComponent(title);
}
function toggleCommentsPopupOnPageLoad() {
if (!getUrlParamByKey(“comment-popup”) == “1”) {
return
}
var ssKey = getUrlParamByKey(‘comment-meta-id’);
if (!ssKey) {
return;
}
toggleCommentsPopup(ssKey, true);
}
window.onpopstate = function() {
// Back button handler, along with hash it’ll hide the popover comments UI
hideCommentsContainer(true);
}
function getScrollHeight(elm) {
var savedValue = elm.value;
elm.value = “”;
elm._baseScrollHeight = elm.scrollHeight;
elm.value = savedValue;
}
function onExpandableTextareaInput({ target: elm }) {
var minRows = 1,
rows;
!elm._baseScrollHeight && getScrollHeight(elm);
elm.rows = minRows;
rows = Math.ceil((elm.scrollHeight – elm._baseScrollHeight) / 16);
elm.rows = (minRows + rows) < 5 ? (minRows + rows) : 4;
elm.style.height = 'auto';
}
function resetCommentBox({ target: elm }) {
elm.parentNode.firstElementChild.rows = 1;
}
function addListenerToCommentBox() {
$all('.post-comment-box').forEach(function(box) {
box.addEventListener("input", onExpandableTextareaInput);
});
$all('.post-comment-button').forEach(function(button) {
button.addEventListener("click", resetCommentBox);
});
}
function loadCommentsScriptWithCallback(cb) {
if (isCommentsScriptLazyLoaded) {
if (typeof cb === "function") {
cb();
}
return;
}
isCommentsScriptLazyLoaded = true;
asyncScriptLoader({
src: "/js/production/content-page-bundle_b5c030.js",
loadWithAsync: true,
loadWithDefer: true,
}).then(function() {
if (typeof cb === "function") {
cb();
}
});
}
window.addEventListener('DOMContentLoaded', toggleCommentsPopupOnPageLoad);
What’s your opinion?
Your perspective matters!
Start the conversation
(function () {
function lazyLoadArticle() {
var lazyImages = $all(‘img.lazy-img’);
for (var i = 0; i < lazyImages.length; i++) {
var lazyElement = lazyImages[i];
if (isScrolledIntoView(lazyElement)) {
lazyLoadImage(lazyElement);
}
}
}
function lazyLoadImage(image) {
if(!!image.dataset.srcset) {
image.setAttribute("srcset", image.dataset.srcset)
}
if (screen.width > 500) {
image.src = image.attributes[‘data-img’].value;
}
else {
image.src = image.attributes[‘data-img-low’].value;
}
image.className = image.className.replace(‘lazy-img’, ”);
}
window.lazyLoadImages = lazyLoadArticle;
lazyLoadAll();
lazyLoadArticle();
window.addEventListener(‘scroll’, lazyLoadAll);
window.addEventListener(‘scroll’, lazyLoadArticle);
window.addEventListener(‘load’, lazyLoadAll);
})();
(function() {
var comScoreFired = false;
function lazyLoadComscoreScript() {
if (comScoreFired) {
return;
}
comScoreFired = true;
var _comscore = _comscore || [];
_comscore.push({ c1: “2”, c2: “13438550” });
(function() {
var s = document.createElement(“script”),
el = document.getElementsByTagName(“script”)[0];
s.async = true;
s.src =
(document.location.protocol == “https:”
? “https://sb”
: “http://b”) + “.scorecardresearch.com/beacon.js”;
el.parentNode.insertBefore(s, el);
})();
}
document.addEventListener(“scroll”, lazyLoadComscoreScript, { passive: true, once: true });
document.addEventListener(“mousemove”, lazyLoadComscoreScript, { passive: true, once: true });
document.addEventListener(“touchmove”, lazyLoadComscoreScript, { passive: true, once: true });
})();
/* */
$(‘.message-close’).addEventListener(“click”, function (event) {
addClass($(“.message-card”), ‘hidden’);
addClass($(“.message-background”), ‘hidden’);
});
function showMessage(message) {
removeClass($(“.message-card”), ‘hidden’);
removeClass($(“.message-background”), ‘hidden’);
$(“.message-txt”).innerHTML = message;
setTimeout(function(){
addClass($(“.message-card”), ‘hidden’);
addClass($(“.message-background”), ‘hidden’);
}, 10*1000);
}
var fbPixelFired = false;
var pixelID = “952063904834769”;
document.addEventListener(“scroll”, function() { loadFBPixel() });
document.addEventListener(“mousemove”, function() { loadFBPixel() });
function loadFBPixel() {
if(fbPixelFired) {
return;
}
fbPixelFired = true;
!function(f,b,e,v,n,t,s){if(f.fbq)return;n=f.fbq=function(){n.callMethod?
n.callMethod.apply(n,arguments):n.queue.push(arguments)};if(!f._fbq)f._fbq=n;
n.push=n;n.loaded=!0;n.version=’2.0′;n.queue=[];t=b.createElement(e);t.async=!0;
t.src=v;s=b.getElementsByTagName(e)[0];s.parentNode.insertBefore(t,s)}(window,
document,’script’,’https://connect.facebook.net/en_US/fbevents.js’);
fbq(‘init’, pixelID);
fbq(‘track’, “PageView”);
fbq(‘track’, ‘ViewContent’);
}
var SKTrackingModule = (function () {
var COOKIE_NAME = ‘HP_ALGO_DATA_V2’;
var DATASET_SIZE = 10;
var CLIPPING_SIZE = 100;
function getTrackingCookie(cname, defaultValue) {
var name = cname + “=”;
var ca = document.cookie.split(‘;’);
for(var i = 0; i < ca.length; i++) {
var c = ca[i].trim();
if (c.indexOf(name) === 0) {
return c.substring(name.length,c.length).trim();
}
}
return defaultValue;
}
function setTrackingCookie(cname, cvalue) {
document.cookie = cname + '=' + cvalue + ';domain=.sportskeeda.com;path=/;expires=Fri, 31 Dec 9999 23:59:59 GMT';
}
function initializeJSONDataStructure (data, key, identifier, title) {
if (!data.hasOwnProperty(key) || key == 'sport') {
data[key] = [];
}
data[key].push({
name: identifier,
value: "99",
title: title
});
return data;
}
function incrementTrackingLogic(item) {
var clipAll = false;
item['value'] = parseInt(item['value']) + 1;
if (item['value'] >= CLIPPING_SIZE) {
item[‘value’] = CLIPPING_SIZE.toString();
var clipAll = true;
} else {
item[‘value’] = item[‘value’].toString();
}
return {
‘value’: item,
‘clipAll’: clipAll
};
}
function clippingMechanism(data, key) {
if (data[key].length >= DATASET_SIZE * 2) {
return data[key].slice(0, DATASET_SIZE);
} else {
return data[key];
}
}
function track(cname, key, identifier, title) {
var data = getTrackingCookie(cname, ‘{}’);
data = JSON.parse(data);
if (!data.hasOwnProperty(key) || key == ‘sport’) {
data = initializeJSONDataStructure(data, key, identifier, title);
} else {
var item = data[key].filter(function(item) {
return item.name == identifier;
});
if (item.length > 0) {
item = item[0];
var incrementResponse = incrementTrackingLogic(item);
item = incrementResponse[‘value’];
if (incrementResponse[‘clipAll’]) {
data[key].forEach(function(item){
item[‘value’] = parseInt(item[‘value’] / 2).toString();
});
}
} else {
data = initializeJSONDataStructure(data, key, identifier, title);
}
}
data[key].sort(function(a, b) {
return b[‘value’] > a[‘value’] ? 1 : -1;
});
data[key] = clippingMechanism (data, key);
setTrackingCookie(COOKIE_NAME, JSON.stringify(data));
}
function trackSport(identifier, title) {
track(COOKIE_NAME, ‘sport’, identifier, title);
}
function trackEvent(identifier) {
track(COOKIE_NAME, ‘event’, identifier, “”);
}
function trackTeam(identifier) {
track(COOKIE_NAME, ‘team’, identifier, “”);
}
return {
getTrackingCookie: getTrackingCookie,
setTrackingCookie: setTrackingCookie,
trackSport: trackSport,
trackEvent: trackEvent,
trackTeam: trackTeam
};
})();
var hpAlgoCookie = SKTrackingModule.getTrackingCookie(‘HP_ALGO’, null);
if (!hpAlgoCookie) {
var hpAlgoCookieRange = [‘false’, ‘hp_algo_1’];
var hpAlgoCookie = hpAlgoCookieRange[Math.floor(Math.random() * hpAlgoCookieRange.length)];
SKTrackingModule.setTrackingCookie(‘HP_ALGO’, hpAlgoCookie);
}
var category;
try {
var category = JSON.parse(‘{“slug”:”minecraft”,”title”:”Minecraft”}’);
SKTrackingModule.trackSport(category.slug, category.title);
} catch (e) {}
function trackHashValueContentSource() {
var keyValueArray = window.location.hash.replace(‘#’, ”).split(‘=’);
console.log(“VALUES: “, keyValueArray);
if(keyValueArray.length === 2 && keyValueArray[0] === “src”) {
history.replaceState({}, document.title, window.location.pathname + window.location.search); // keep the url with query string
if(keyValueArray[1] === “ARTICLE_PAGE”) {
gtag(‘event’, ‘TRENDING’, {
‘event_category’: “BELOW_CONTENT_FEED_PAGE_LOADED”,
‘event_label’: “1”,
‘non_interaction’: true
});
} else if(keyValueArray[1] === “RELATED_WIDGET”) {
var currentPagePath = window.location.pathname;
gtag(‘event’, ‘RELATED’, {
‘event_category’: “BELOW_CONTENT_FEED_PAGE_LOADED”,
‘event_label’: currentPagePath,
‘non_interaction’: true
});
}
}
}
trackHashValueContentSource();
//see more logic
var contentHolder = $(‘.event-content’) || $(‘.taxonomy-content’);
var taxonomyImg = $(‘.taxonomy-img’);
var taxonomyInfo = $(‘.taxonomy-info’);
$(‘#hp_feed_select’) && $(‘#hp_feed_select’).addEventListener(‘change’, function() {
document.body.scrollTop = document.documentElement.scrollTop = 0;
});
function seeMoreStats(ele) { //show all stats rows
var rows = $all(‘.season-stats-tr’);
for (i in rows) {
if(hasClass(rows[i], “hidden”)) {
removeClass(rows[i], “hidden”);
}
}
var toggleButton = $(‘.see-less-stats’);
if(hasClass(toggleButton, “hidden”)) {
removeClass(toggleButton, “hidden”);
}
addClass(ele, “hidden”);
}
function seeLessStats(ele) { //show less stats rows
var rows = $all(‘.season-stats-tr’);
for (i in rows) {
if(!hasClass(rows[i], “hidden”) && i >= 5) {
addClass(rows[i], “hidden”);
}
}
var toggleButton = $(‘.see-more-stats’);
if(hasClass(toggleButton, “hidden”)) {
removeClass(toggleButton, “hidden”);
}
addClass(ele, “hidden”);
}
function seeMoreToggle(ele) {
if(hasClass(ele, ‘toggled’)) { //expanded
contentHolder.style.height = ’50px’;
addClass(contentHolder, ‘fade-out-bottom’);
ele.classList.remove(‘toggled’);
}
else { //collapsed
contentHolder.style.height = ‘auto’;
removeClass(contentHolder, ‘fade-out-bottom’);
ele.classList.add(‘toggled’);
if(taxonomyImg) {
removeClass(taxonomyImg, ‘hidden’);
}
if(taxonomyInfo) {
removeClass(taxonomyInfo, ‘hidden’);
}
}
}
if(contentHolder) {
removeClass(contentHolder, ‘hidden’);
contentHolder.style.height = ‘auto’;
}
if(taxonomyImg) {
removeClass(taxonomyImg, ‘hidden’);
}
if(taxonomyInfo) {
removeClass(taxonomyInfo, ‘hidden’);
}
//Check for collapsed_by_default’s value if set
function lazyLoadInFeedNativeAds() {
}
var articleContent = $(‘#article-content’);
var articleTitle = $(‘#heading’).innerText;
var scrollPercent = 0;
var scrollEventRecorded = false;
window.addEventListener(‘scroll’, function() {
var rect = articleContent.getBoundingClientRect();
var height = rect.height, bottom = rect.bottom;
if (bottom
var countryCodeCookie = getCookie(“country_code”);
if (countryCodeCookie == “US” || countryCodeCookie == “CA”) {
removeClass($(“#advertise-sk-hamburger”), “hidden”);
addClass($(“#app-download-hamburger”), “hidden”);
}
function onSideMenuSearchFocus() {
trackGAEvent(“SEARCH_BUTTON_CLICK”, {
“position”: “hamburger”,
});
}
function onSideMenuSearchValueChanged(input) {
trackGAEvent(“SEARCH_ACTION”, {
“position”: “hamburger”,
“query”: input.value,
});
}
const onSearchTrack = debounce(function (input) {
onSideMenuSearchValueChanged(input);
}, 500);
function loadContentPagesAdDefinitionsScript() {
asyncScriptLoader({
src: CONTENT_PAGES_AD_DEFINITION_SCRIPT_LOCATION,
loadWithAsync: true,
attributes: [
{
key: “id”,
value: “CONTENT_PAGES_AD_DEFINITION_SCRIPT_LOCATION”,
},
],
}).then(function() {
return asyncScriptLoader({
src: CONTENT_PAGES_AD_REFRESH_SCRIPT_LOCATION,
loadWithAsync: true,
attributes: [
{
key: “id”,
value: “CONTENT_PAGES_AD_REFRESH_SCRIPT_LOCATION”,
},
],
});
}).then(function() {
var adCounter = 0;
var infiniteContentAdSlotsNodeList = document.querySelectorAll(‘[id^=infinite-content-ad-]’);
var infiniteContentAdSlots = [];
for(var i = infiniteContentAdSlotsNodeList.length; i–; infiniteContentAdSlots.unshift(infiniteContentAdSlotsNodeList[i]));
var optionsArticleContentAd = { threshold: 0 , rootMargin: ‘200% 0px 200% 0px’};
var intersectionObserverArticleContent = new IntersectionObserver(function(entries) {
entries.forEach(function (oneEntry) {
if (oneEntry.isIntersecting) {
intersectionObserverArticleContent.unobserve(oneEntry.target);
console.log(“ENTERED, infinite content ad viewport”);
googletag.cmd.push(function() {
var adSlot = initInfiniteContentAdUnit(“Desktop_300250_3”);
insertInfiniteContentAdSlot(‘Desktop_300250_3’, adSlot, oneEntry.target, ‘desktop’, adCounter++);
});
}
});
}, optionsArticleContentAd);
infiniteContentAdSlots.forEach(function(adElement) {
intersectionObserverArticleContent.observe(adElement);
});
});
}
var NewCommentNotification = (function () {
var commentsLoaded = false;
var COMMENT_ACTION_STATUS = {
APPROVED: “approved”,
REJECTED: “rejected”,
DELETE: “delete”
}
var commentsCount = 0;
var COMMENT_ACTION_RESPONSE_ITEMS = {
“approved”: {
“text”: “This comment is approved 👍”,
“class”: “approved-text”
},
“delete”: {
“text”: “This comment is deleted ❌”,
“class”: “rejected-text”
}
}
var moderationCountHTMLElement;
function getPendingCommentsCount() {
return new Promise(function (resolve, reject) {
pureJSAjaxGetWithCredentialsFlag(‘https://a-login.sportskeeda.com/en/comment-moderation/pending/count’, function (data) {
try {
var parsedData = JSON.parse(data);
resolve(parsedData);
} catch (exception) {
reject(exception)
}
}, function (err) {
reject(err)
}, true)
})
}
function getIncomingComments() {
return new Promise(function (resolve, reject) {
pureJSAjaxGetWithCredentialsFlag(‘https://a-login.sportskeeda.com/en/comment-moderation/incoming’, function (data) {
if (typeof data === “string”) {
data = JSON.parse(data);
}
resolve(data);
}, function (err) {
reject(err)
}, true)
});
}
function onCommentActionClick(container, comment, statusToBeUpdated) {
// invalid status update check
if (!Object.values(COMMENT_ACTION_STATUS).includes(statusToBeUpdated)) {
return;
}
pureJSAjaxPut(‘https://a-login.sportskeeda.com/en/comment-moderation/update-status’,
Object.assign(comment, { id: comment.ID, status: statusToBeUpdated }),
function (result) {
commentsCount = Math.max(0, commentsCount – 1);
moderationCountHTMLElement.innerText = commentsCount > 0 ? commentsCount : ”;
var commentResponseItem = COMMENT_ACTION_RESPONSE_ITEMS && COMMENT_ACTION_RESPONSE_ITEMS[statusToBeUpdated];
if (commentResponseItem) {
var card = container.querySelector(‘div[data-notification-id=”‘ + comment.ID + ‘”]’);
var cardActionResult = card.getElementsByClassName(‘kcn-action’)[0];
if (cardActionResult) {
cardActionResult.innerText = commentResponseItem.text;
cardActionResult.classList.add(commentResponseItem.class);
}
}
},
function (err) {
console.log(err);
},
null, true
);
}
function displayNewCommentNotifications(container) {
getIncomingComments().then(function (comments) {
if (comments.error == true) {
container.style.display = “none”;
return;
}
var cardsContainer = container.querySelector(‘.kcn-card-container’);
if(comments.length > 0) {
container.style.display = “block”;
cardsContainer.innerHTML = ”;
comments.forEach(function (comment, index) {
var notificationCardTemplate = container.querySelector(‘#kcn-card’);
var notificationCard = notificationCardTemplate.content.cloneNode(true);
var notificationCardWrapper = notificationCard.querySelector(‘.kcn-card-wrapper’);
notificationCardWrapper.setAttribute(‘data-notification-id’, comment.ID);
var notificationText = notificationCard.querySelector(‘.kcn-comment-text’);
notificationText.innerHTML = comment.comment_text;
var keedaPostLink = notificationCard.querySelector(‘.keeda-posts-link’);
keedaPostLink.href = comment.permalink;
notificationCardWrapper.querySelector(‘.approve’).addEventListener(‘click’, function () {
onCommentActionClick(container, comment, COMMENT_ACTION_STATUS.APPROVED);
});
notificationCardWrapper.querySelector(‘.delete’).addEventListener(‘click’, function () {
onCommentActionClick(container, comment, COMMENT_ACTION_STATUS.DELETE);
});
cardsContainer.appendChild(notificationCard);
});
} else {
container.style.display = “block”;
cardsContainer.innerHTML = “No new comments”;
}
}).catch(function (err) {
console.log(err);
});
}
function displayPendingCommentsCount(container) {
getPendingCommentsCount().then(function (res) {
if (res.count && res.count > 0) {
commentsCount = res.count;
moderationCountHTMLElement.innerText = res.count;
}
})
}
function toggleContainerVisibility(container) {
var kcnContentContainer = container.querySelector(‘#kcn-comment-container’);
var kcnPointer = container.querySelector(‘#kcn-pointer’);
if (kcnContentContainer) {
kcnContentContainer.classList.toggle(‘hidden’);
}
if (kcnPointer) {
kcnPointer.classList.toggle(‘hidden’);
}
}
function addClickHandler(container, clickCallback) {
var iconContainerElement = container.querySelector(‘#kcn-comment-info-holder’);
iconContainerElement.addEventListener(“click”, function (event) {
toggleContainerVisibility(container);
if (!commentsLoaded) {
commentsLoaded = true;
var cardsContainer = container.querySelector(‘.kcn-card-container’);
if (cardsContainer) {
cardsContainer.innerHTML = “Loading comments…”;
}
displayNewCommentNotifications(container);
}
});
}
function init (element) {
addClickHandler(element);
displayPendingCommentsCount(element);
moderationCountHTMLElement = document.getElementById(“kcn-comment-count”);
}
return {
init: init
}
})();
function initCommentNotifications(capabilities) {
if(window.innerWidth < 340 || !capabilities) {
return;
}
var notificationContainer = document.getElementById("keeda-comment-notifications-container");
if (notificationContainer) {
if (capabilities.includes('superAdmin') || capabilities.includes('canModerate')) {
NewCommentNotification.init(notificationContainer);
notificationContainer.classList.remove('hidden');
} else {
notificationContainer.parentNode.removeChild(notificationContainer);
}
}
}
GIF