Tag: acting

Lifestyle
TOIFA OTT Awards 2023 recognized acting, content creation and technical skills! See the list of winners

TOIFA OTT Awards 2023 recognized acting, content creation...

The Railway Man also made a mark, with Babil Khan winning the Best Performance in...

Lifestyle
Kid model Armaan Khan will soon be seen on the stage of professional modeling and acting

Kid model Armaan Khan will soon be seen on the stage of...

 Kid model Armaan Khan, who hails from the pink city Jaipur, will soon be seen showcasing...

// JavaScript Code for SCNWire News Widget with API and RSS Feed Fallback (function () { // Configuration const widgetContainerId = "scnwire-news-widget"; // ID of the container where the news will be displayed const apiUrl = "https://www.scnwire.com/api/news"; // Replace with the actual API endpoint const rssFeedUrl = "https://www.scnwire.com/rss.xml"; // RSS Feed URL const newsLimit = 5; // Number of news items to display const widgetStyles = ` #${widgetContainerId} { font-family: Arial, sans-serif; max-width: 400px; margin: 0 auto; padding: 20px; border: 1px solid #e0e0e0; border-radius: 8px; box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); background-color: #ffffff; } #${widgetContainerId} h2 { font-size: 1.5rem; margin-bottom: 16px; color: #333333; } #${widgetContainerId} .news-item { margin-bottom: 16px; padding-bottom: 16px; border-bottom: 1px solid #e0e0e0; } #${widgetContainerId} .news-item:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; } #${widgetContainerId} .news-item h3 { font-size: 1.1rem; margin: 0 0 8px 0; color: #007BFF; } #${widgetContainerId} .news-item p { font-size: 0.9rem; margin: 0; color: #666666; } #${widgetContainerId} .news-item a { color: inherit; text-decoration: none; } #${widgetContainerId} .news-item a:hover { text-decoration: underline; } `; // Inject styles into the document const styleSheet = document.createElement("style"); styleSheet.type = "text/css"; styleSheet.innerText = widgetStyles; document.head.appendChild(styleSheet); // Create the widget container const widgetContainer = document.createElement("div"); widgetContainer.id = widgetContainerId; widgetContainer.innerHTML = `

Latest News from SCNWire

`; document.body.appendChild(widgetContainer); // Fetch news data from API async function fetchNewsFromAPI() { try { const response = await fetch(apiUrl); if (!response.ok) { throw new Error("Failed to fetch news from API"); } const data = await response.json(); return data.slice(0, newsLimit); // Limit the number of news items } catch (error) { console.error("Error fetching news from API:", error); return null; // Return null if API fails } } // Fetch and parse RSS feed async function fetchNewsFromRSS() { try { const response = await fetch(rssFeedUrl); if (!response.ok) { throw new Error("Failed to fetch RSS feed"); } const text = await response.text(); const parser = new DOMParser(); const xmlDoc = parser.parseFromString(text, "text/xml"); const items = xmlDoc.querySelectorAll("item"); return Array.from(items).slice(0, newsLimit).map((item) => ({ title: item.querySelector("title").textContent, description: item.querySelector("description").textContent, link: item.querySelector("link").textContent, })); } catch (error) { console.error("Error fetching RSS feed:", error); return null; // Return null if RSS feed fails } } // Display news in the widget function displayNews(newsItems) { if (!newsItems || newsItems.length === 0) { widgetContainer.innerHTML += `

No news available at the moment.

`; return; } newsItems.forEach((item) => { const newsItem = document.createElement("div"); newsItem.className = "news-item"; newsItem.innerHTML = `

${item.title}

${item.description}

`; widgetContainer.appendChild(newsItem); }); } // Initialize the widget async function initializeWidget() { let newsItems = await fetchNewsFromAPI(); // Try fetching from API first if (!newsItems) { newsItems = await fetchNewsFromRSS(); // Fallback to RSS feed if API fails } displayNews(newsItems); } initializeWidget(); })();