MediaWiki:Common.js: Difference between revisions
Appearance
Yadasampati (talk | contribs) No edit summary |
No edit summary |
||
| (114 intermediate revisions by 2 users not shown) | |||
| Line 1: | Line 1: | ||
/* | /* V176: remove legacy decorative cursor if it was left by cached site code. */ | ||
(function restoreNativeMainPageCursor() { | |||
function clean() { | |||
if (!document.body || !document.body.classList.contains("page-Main_Page")) return; | |||
var cursor = document.getElementById("vh-cursor-pointer"); | |||
if (cursor) cursor.remove(); | |||
var injected = document.getElementById("vh-kill-windows-cursor"); | |||
if (injected) injected.remove(); | |||
document.body.classList.remove("vh-cursor-link", "vh-cursor-click"); | |||
} | |||
if (document.readyState === "loading") document.addEventListener("DOMContentLoaded", clean); | |||
else clean(); | |||
})(); | |||
if (mw.config.get('wgPageName' ) === 'Krishna_says_in_Bhagavad-gita') { | /* Any JavaScript here will be loaded for all users on every page load. */ | ||
if (mw.config.get('wgPageName' ) === 'Krishna_says_in_Bhagavad-gita') { | |||
/* switch tooltip texts from content-div to label-div */ | |||
const v_labels = Array.from(document.getElementsByClassName("tabs-label")); | |||
const v_content = Array.from(document.getElementsByClassName("tabs-content")); | |||
for (var i = 0; i < v_labels.length; i++) { | |||
v_labels[i].title = v_content[i].title; | |||
v_content[i].title = ""; | |||
} | |||
/* adjust wikitables */ | |||
var arr = Array.from(document.getElementsByClassName("wikitable")); | |||
for (var t = 0; t < arr.length; t++) { | |||
/* insert THEAD in wikitable */ | |||
var thead = document.createElement("thead"); | |||
thead.style.display = "block"; | |||
var wtbl = arr[t]; | |||
wtbl.insertBefore(thead, wtbl.firstChild); | |||
/* move first row of TBODY to THEAD */ | |||
thead.appendChild(wtbl.rows[0]); | |||
/* make TBODY scrollable */ | |||
var tbody = wtbl.tBodies[0]; | |||
tbody.style.display = "block"; | |||
tbody.style.overflowY = "auto"; | |||
tbody.style.maxHeight = "500px"; | |||
for (var r = 0; r < wtbl.rows.length; r++) { | |||
var row = wtbl.rows[r]; | |||
/* adjust column widths and hide from-until columns */ | |||
row.cells[0].classList = "cw_0"; | |||
row.cells[1].classList = "cw_150"; | |||
row.cells[2].classList = "cw_500"; | |||
/* mark the text */ | |||
if (r == 0) continue; | |||
var v_text = row.cells[2].textContent; | |||
var v_html = ""; var v_from = 0; | |||
var marks = JSON.parse(row.cells[0].textContent.replaceAll("O", "[").replaceAll("C", "]")); | |||
for (var m = 0; m < marks.length; m++) { | |||
v_html += | |||
v_text.substr(v_from,marks[m][0]-v_from) + "<mark>" + | |||
v_text.substr(marks[m][0],marks[m][1]-marks[m][0]+1) + "</mark>"; | |||
v_from = marks[m][1]+1; | |||
} | |||
v_html += v_text.substr(v_from); | |||
row.cells[2].innerHTML = v_html; | |||
} | |||
} | } | ||
} | } | ||
// install Google Search | // install Google Search | ||
// document.write('<script type="text/javascript" src="' | // document.write('<script type="text/javascript" src="' | ||
// + 'http://vanipedia.org/w/index.php?title=MediaWiki:GoogleSearch.js' | // + 'http://vanipedia.org/w/index.php?title=MediaWiki:GoogleSearch.js' | ||
// + '&action=raw&ctype=text/javascript"></' + 'script>'); | // + '&action=raw&ctype=text/javascript"></' + 'script>'); | ||
// install JQuery | // install JQuery | ||
//document.write('<script type="text/javascript" src="' | //document.write('<script type="text/javascript" src="' | ||
//+ 'http://vanipedia.org/w/index.php?title=MediaWiki:JQuery.js' | //+ 'http://vanipedia.org/w/index.php?title=MediaWiki:JQuery.js' | ||
//+ '&action=raw&ctype=text/javascript"></' + 'script>'); | //+ '&action=raw&ctype=text/javascript"></' + 'script>'); | ||
// install WikEd toolbar and Vanify | // install WikEd toolbar and Vanify | ||
//document.write('<script type="text/javascript" src="' | //document.write('<script type="text/javascript" src="' | ||
//+ 'http://vanipedia.org/w/index.php?title=MediaWiki:Vaniquotes.js' | //+ 'http://vanipedia.org/w/index.php?title=MediaWiki:Vaniquotes.js' | ||
//+ '&action=raw&ctype=text/javascript"></' + 'script>'); | //+ '&action=raw&ctype=text/javascript"></' + 'script>'); | ||
// install Replace | // install Replace | ||
//document.write('<script type="text/javascript" src="' | //document.write('<script type="text/javascript" src="' | ||
//+ 'http://vanipedia.org/w/index.php?title=MediaWiki:TextboxReplace.js' | //+ 'http://vanipedia.org/w/index.php?title=MediaWiki:TextboxReplace.js' | ||
//+ '&action=raw&ctype=text/javascript"></' + 'script>'); | //+ '&action=raw&ctype=text/javascript"></' + 'script>'); | ||
// install Unify | // install Unify | ||
//document.write('<script type="text/javascript" src="' | //document.write('<script type="text/javascript" src="' | ||
//+ 'http://vanipedia.org/w/index.php?title=MediaWiki:Unify.js' | //+ 'http://vanipedia.org/w/index.php?title=MediaWiki:Unify.js' | ||
//+ '&action=raw&ctype=text/javascript"></' + 'script>'); | //+ '&action=raw&ctype=text/javascript"></' + 'script>'); | ||
// install Vanify | // install Vanify | ||
//document.write('<script type="text/javascript" src="' | //document.write('<script type="text/javascript" src="' | ||
//+ 'http://vanipedia.org/w/index.php?title=MediaWiki:Vanify.js' | //+ 'http://vanipedia.org/w/index.php?title=MediaWiki:Vanify.js' | ||
//+ '&action=raw&ctype=text/javascript"></' + 'script>'); | //+ '&action=raw&ctype=text/javascript"></' + 'script>'); | ||
// install Vani_suggest for diacritics auto-suggest pulldown on the search bar | // install Vani_suggest for diacritics auto-suggest pulldown on the search bar | ||
//document.write('<script type="text/javascript" src="' | //document.write('<script type="text/javascript" src="' | ||
//+ 'http://vanipedia.org/w/index.php?title=MediaWiki:Vani_suggest.js' | //+ 'http://vanipedia.org/w/index.php?title=MediaWiki:Vani_suggest.js' | ||
//+ '&action=raw&ctype=text/javascript"></' + 'script>'); | //+ '&action=raw&ctype=text/javascript"></' + 'script>'); | ||
// install previous/next links for video categories in all languages | // install previous/next links for video categories in all languages | ||
//document.write('<script type="text/javascript" src="/navcat/navcat.js"></' + 'script>'); | |||
// Buttons | // Buttons | ||
//addOnloadHook(function() { | //addOnloadHook(function() { | ||
//if (document.editform) { | //if (document.editform) { | ||
//addPortletLink("p-cactions", "javascript:Unify()", "unify", "ca-unify", "Convert Balarama fonts to Unicode", ""); | //addPortletLink("p-cactions", "javascript:Unify()", "unify", "ca-unify", "Convert Balarama fonts to Unicode", ""); | ||
| Line 130: | Line 98: | ||
//} | //} | ||
//}); | //}); | ||
// end Buttons | // end Buttons | ||
// --- YouTube Random Shorts (Kasya) --- | |||
$(document).ready(function() { | |||
var $widget = $('.vani-shorts-viewport'); | |||
if ($widget.length) { | |||
var $viewport = $widget; | |||
var $titleFrame = $widget.find('.vani-shorts-title'); | |||
new mw.Api().get({ | |||
action: 'query', | |||
prop: 'revisions', | |||
titles: 'VanimediaMayapur YouTube SHORTS List', | |||
rvprop: 'content', | |||
format: 'json' | |||
}).done(function(data) { | |||
try { | |||
var pages = data.query.pages; | |||
var pageId = Object.keys(pages)[0]; | |||
if (pageId == "-1" || !pages[pageId].revisions) { | |||
$viewport.text("Database list page not found."); | |||
return; | |||
} | |||
// FIXED: Corrected MediaWiki revision array syntax lookup | |||
var rawWikiText = pages[pageId].revisions[0]['*']; | |||
var lines = rawWikiText.split('\n'); | |||
var validShorts = []; | |||
for (var i = 0; i < lines.length; i++) { | |||
var line = $.trim(lines[i]); | |||
if (line.indexOf('File:') === 0 && line.toLowerCase().indexOf('link=') !== -1) { | |||
validShorts.push(line); | |||
} | |||
} | |||
if (validShorts.length === 0) { | |||
$viewport.text("No gallery entries recognized."); | |||
return; | |||
} | |||
var randomLine = validShorts[Math.floor(Math.random() * validShorts.length)]; | |||
var parts = randomLine.split('|'); | |||
// Reset defaults before parsing line elements | |||
var rawUrl = ""; | |||
for (var j = 0; j < parts.length; j++) { | |||
var part = $.trim(parts[j]); | |||
if (part.toLowerCase().indexOf('link=') === 0) { | |||
rawUrl = part.substring(5).trim(); | |||
} | |||
} | |||
// Clean all template formatting brackets, space characters, and hidden control markers | |||
var urlCleaned = rawUrl.replace(/[\u200e\u200f\s\}\}\]]/g, ''); | |||
// Direct YouTube Alphanumeric Pattern Matcher | |||
var idRegex = /(?:shorts\/|v=|embed\/|\/)([a-zA-Z0-9_-]{11})/; | |||
var matchResults = urlCleaned.match(idRegex); | |||
var videoId = ""; | |||
if (matchResults && matchResults[1]) { | |||
// FIXED: Grabbed index 1 to pull the standalone 11-digit ID without any slashes | |||
videoId = matchResults[1].trim(); | |||
} | |||
if (videoId && videoId.length === 11) { | |||
// FIXED: Isolated to inject ONLY the video player iframe at the correct 280px width | |||
var embedUrl = "https://www.youtube.com/embed/" + videoId; | |||
$viewport.html('<iframe width="280" height="225" src="' + embedUrl + '" frameborder="0" allowfullscreen style="border-radius: 8px; border: none;"></iframe>'); | |||
} else { | |||
$viewport.html("<div style='color:#c0392b; padding:10px; font-size:11px;'>Invalid video ID sequence extracted.</div>"); | |||
} | |||
} catch (err) { | |||
console.error("Shorts engine exception:", err); | |||
$viewport.text("Error handling text structure values."); | |||
} | |||
}).fail(function() { | |||
$viewport.text("API connection failed."); | |||
}); | |||
} | |||
}); | |||
// Kasya | |||
/* Open Timeline links in a new tab ONLY on the Chapters page */ | |||
mw.hook('wikipage.content').add(function($content) { | |||
// Check if we are exactly on the timeline page | |||
if (mw.config.get('wgPageName') === "Chapters_in_Srila_Prabhupada's_Life") { | |||
// If yes, apply the new tab rule to the table | |||
$content.find('#mp-tfp a').attr('target', '_blank').attr('rel', 'noopener noreferrer'); | |||
} | |||
}); | |||
// Wait for MediaWiki core modules and the DOM to load | |||
mw.loader.using(['mediawiki.api', 'mediawiki.util']).then(function () { | |||
$(document).ready(function () { | |||
// 1. FIND THE "102 Languages" SIDEBAR SECTION | |||
var $sidebarMenu = $('#p-102_Languages ul').first(); | |||
// Fallback in case your specific MediaWiki version formats the ID differently | |||
if ($sidebarMenu.length === 0) { | |||
$('.vector-menu-heading, .portal h3').each(function() { | |||
// Looks for the heading text directly | |||
if ($(this).text().trim() === '102 Languages') { | |||
$sidebarMenu = $(this).closest('.vector-menu, .portal').find('ul').first(); | |||
} | |||
}); | |||
} | |||
// Exit if the 102 Languages menu isn't found on the page | |||
if (!$sidebarMenu || $sidebarMenu.length === 0) return; | |||
// 2. CREATE THE SEARCH BAR AS A MENU ITEM | |||
var $searchLi = $('<li id="n-language-search" style="margin-top: 10px; margin-bottom: 5px; list-style: none;"></li>'); | |||
var $searchBox = $('<input type="text" id="sidebarLanguageSearch" placeholder="Search 102 Languages..." style="width: 100%; box-sizing: border-box; padding: 5px; font-size: 0.85em; border: 1px solid #a2a9b1; border-radius: 2px;" autocomplete="off" />'); | |||
// Container for the results (hidden by default) | |||
var $resultsContainer = $('<ul id="sidebarLanguageResults" style="list-style: none; padding: 0; margin: 4px 0 0 0; max-height: 200px; overflow-y: auto; border: 1px solid #eaecf0; background: #ffffff; display: none;"></ul>'); | |||
// Build the menu item and append it to the sidebar | |||
$searchLi.append($searchBox).append($resultsContainer); | |||
$sidebarMenu.prepend($searchLi); | |||
var api = new mw.Api(); | |||
var languageList = []; | |||
// 3. FETCH LANGUAGES FROM THE CATEGORY VIA API IN THE BACKGROUND | |||
api.get({ | |||
action: 'query', | |||
list: 'categorymembers', | |||
cmtitle: 'Category:Languages_with_Total_Pages', | |||
cmlimit: 'max', | |||
format: 'json' | |||
}).done(function (data) { | |||
if (data.query && data.query.categorymembers) { | |||
languageList = data.query.categorymembers.map(function (member) { | |||
return { | |||
title: member.title, | |||
url: mw.util.getUrl(member.title) | |||
}; | |||
}); | |||
} | |||
}); | |||
// 4. ADD SEARCH FUNCTIONALITY TO THE SIDEBAR BOX | |||
$('#sidebarLanguageSearch').on('keyup', function (e) { | |||
e.stopPropagation(); | |||
var searchTerm = $(this).val().toLowerCase(); | |||
$resultsContainer.empty(); | |||
// Hide the results box if the search is empty | |||
if (searchTerm.length === 0) { | |||
$resultsContainer.hide(); | |||
return; | |||
} | |||
// Filter the fetched languages | |||
var filteredLanguages = languageList.filter(function (lang) { | |||
return lang.title.toLowerCase().indexOf(searchTerm) > -1; | |||
}); | |||
// Show results container | |||
$resultsContainer.show(); | |||
// Append results using Vector's standard dark text color | |||
if (filteredLanguages.length > 0) { | |||
filteredLanguages.forEach(function (lang) { | |||
$resultsContainer.append('<li style="padding: 4px 6px; border-bottom: 1px solid #f8f9fa;"><a href="' + lang.url + '" style="text-decoration: none; color: #0645ad; display: block; font-size: 0.9em;">' + lang.title + '</a></li>'); | |||
}); | |||
} else { | |||
$resultsContainer.append('<li style="padding: 4px 6px; color: #72777d; font-size: 0.9em;">No languages found</li>'); | |||
} | |||
}); | |||
// Prevent typing from accidentally triggering global keyboard shortcuts | |||
$('#sidebarLanguageSearch').on('keydown', function(e) { | |||
e.stopPropagation(); | |||
}); | |||
// Optional: Hide results when clicking outside the sidebar search | |||
$(document).on('click', function(e) { | |||
if (!$(e.target).closest('#n-language-search').length) { | |||
$resultsContainer.hide(); | |||
} | |||
}); | |||
// Re-show results if they click back into the search box | |||
$('#sidebarLanguageSearch').on('click', function() { | |||
if ($(this).val().length > 0) { | |||
$resultsContainer.show(); | |||
} | |||
}); | |||
}); | |||
}); | |||
// 5. SIDEBAR ACCORDION - STRICT LEFT-COLUMN ISOLATION & TRUE ACCORDION | |||
(function() { | |||
// 1. Tag ONLY menus physically located in the left sidebar | |||
function tagSidebarMenus() { | |||
var allMenus = document.querySelectorAll('.vector-menu'); | |||
for (var i = 0; i < allMenus.length; i++) { | |||
var menu = allMenus[i]; | |||
// STRICT INCLUSION: Only tag menus inside the modern or legacy left sidebar containers | |||
if (menu.closest('#vector-main-menu, #mw-panel, #mw-navigation')) { | |||
menu.classList.add('vanipedia-sidebar-menu'); | |||
// Collapse them by default if they have a heading | |||
if (menu.querySelector('.vector-menu-heading') && !menu.classList.contains('vanipedia-collapsed')) { | |||
menu.classList.add('vanipedia-collapsed'); | |||
} | |||
} | |||
} | |||
} | |||
// Run tagging immediately, and again on load as a failsafe | |||
tagSidebarMenus(); | |||
if (document.readyState === 'loading') { | |||
document.addEventListener('DOMContentLoaded', tagSidebarMenus); | |||
} | |||
// 2. Inject CSS targeted STRICTLY at our newly tagged custom class | |||
var style = document.createElement('style'); | |||
style.textContent = | |||
/* Widen only our tagged sidebar menus */ | |||
'.vanipedia-sidebar-menu { width: 185px !important; } ' + | |||
/* Core functional hiding rule */ | |||
'.vanipedia-sidebar-menu.vanipedia-collapsed .vector-menu-content { display: none !important; } ' + | |||
/* Bold, Dark Header */ | |||
'.vanipedia-sidebar-menu .vector-menu-heading { ' + | |||
' cursor: pointer !important; ' + | |||
' background-color: #2c4c50 !important; ' + | |||
' border: 1px solid #1b3033 !important; ' + | |||
' border-radius: 4px !important; ' + | |||
' margin-bottom: 4px !important; ' + | |||
' padding: 10px 12px !important; ' + | |||
' font-weight: 600 !important; ' + | |||
' color: #ffffff !important; ' + | |||
' display: flex !important; ' + | |||
' justify-content: space-between !important; ' + | |||
' align-items: center !important; ' + | |||
' gap: 10px !important; ' + | |||
' transition: all 0.2s ease; ' + | |||
'} ' + | |||
/* Fix header corners when expanded */ | |||
'.vanipedia-sidebar-menu:not(.vanipedia-collapsed) .vector-menu-heading { ' + | |||
' border-radius: 4px 4px 0 0 !important; ' + | |||
' margin-bottom: 0 !important; ' + | |||
'} ' + | |||
/* Hover effect */ | |||
'.vanipedia-sidebar-menu .vector-menu-heading:hover { background-color: #385e63 !important; } ' + | |||
/* The dropdown caret */ | |||
'.vanipedia-sidebar-menu .vector-menu-heading::after { ' + | |||
' content: "▼"; ' + | |||
' font-size: 0.75em; ' + | |||
' color: #ffffff !important; ' + | |||
' transition: transform 0.2s ease; ' + | |||
'} ' + | |||
/* Rotate the arrow when collapsed */ | |||
'.vanipedia-sidebar-menu.vanipedia-collapsed .vector-menu-heading::after { ' + | |||
' transform: rotate(-90deg); ' + | |||
'} ' + | |||
/* The Expanded Content Area */ | |||
'.vanipedia-sidebar-menu .vector-menu-content { ' + | |||
' background-color: #eaeff0 !important; ' + | |||
' border: 1px solid #2c4c50 !important; ' + | |||
' border-top: none !important; ' + | |||
' border-radius: 0 0 4px 4px !important; ' + | |||
' padding: 0 0 4px 0 !important; ' + | |||
' margin-bottom: 6px !important; ' + | |||
' box-shadow: 0 3px 6px rgba(0,0,0,0.15) !important; ' + | |||
'} ' + | |||
/* Reset the list styles */ | |||
'.vanipedia-sidebar-menu .vector-menu-content ul { ' + | |||
' list-style: none !important; ' + | |||
' margin: 0 !important; ' + | |||
' padding: 0 !important; ' + | |||
'} ' + | |||
/* Menu links */ | |||
'.vanipedia-sidebar-menu .vector-menu-content li a { ' + | |||
' display: block !important; ' + | |||
' padding: 8px 12px 8px 16px !important; ' + | |||
' color: #1b3033 !important; ' + | |||
' text-decoration: none !important; ' + | |||
' border-left: 3px solid transparent !important; ' + | |||
' border-bottom: 1px solid rgba(44, 76, 80, 0.1) !important; ' + | |||
' transition: all 0.15s ease !important; ' + | |||
'} ' + | |||
/* Remove separator from last item */ | |||
'.vanipedia-sidebar-menu .vector-menu-content li:last-child a { ' + | |||
' border-bottom: none !important; ' + | |||
'} ' + | |||
/* Hover effect for individual menu items */ | |||
'.vanipedia-sidebar-menu .vector-menu-content li a:hover { ' + | |||
' background-color: #dbe4e6 !important; ' + | |||
' border-left: 3px solid #2c4c50 !important; ' + | |||
' color: #000000 !important; ' + | |||
'} '; | |||
document.head.appendChild(style); | |||
// 3. Helper function to collapse all of our securely tagged menus | |||
function collapseAllSidebarMenus() { | |||
var menus = document.querySelectorAll('.vanipedia-sidebar-menu'); | |||
for (var i = 0; i < menus.length; i++) { | |||
menus[i].classList.add('vanipedia-collapsed'); | |||
} | |||
} | |||
// 4. Intercept clicks for True Accordion Behavior | |||
document.addEventListener('click', function(e) { | |||
var heading = e.target.closest('.vector-menu-heading'); | |||
if (!heading) return; | |||
// ONLY react if this click belongs to one of our tagged sidebar menus | |||
var navContainer = heading.closest('.vanipedia-sidebar-menu'); | |||
if (navContainer) { | |||
var isAlreadyOpen = !navContainer.classList.contains('vanipedia-collapsed'); | |||
// Forcefully collapse ALL left sidebar menus first | |||
collapseAllSidebarMenus(); | |||
// Open the clicked one if it wasn't already open | |||
if (!isAlreadyOpen) { | |||
navContainer.classList.remove('vanipedia-collapsed'); | |||
} | |||
e.stopPropagation(); | |||
e.preventDefault(); | |||
} | |||
}, true); | |||
})(); | |||
mw.loader.using('mediawiki.user').then(function() { | |||
// Fetch the user's assigned groups | |||
var userGroups = mw.config.get('wgUserGroups') || []; | |||
// Define the roles that SHOULD see the administrative tabs | |||
var isAuthorized = userGroups.includes('sysop') || | |||
userGroups.includes('interface-admin') || | |||
userGroups.includes('Editor'); | |||
// If the user is not in one of those groups, restrict the UI | |||
if (!isAuthorized) { | |||
document.body.classList.add('restricted-ui'); | |||
} | |||
}); | |||
// Function to open accordion from TOC and jump there // | |||
mw.hook('wikipage.content').add(function() { | |||
function handleAccordionTOC(hash) { | |||
if (!hash || hash === '#') return false; | |||
try { | |||
var targetId = hash.substring(1); | |||
var targetElement = document.getElementById(targetId) || document.getElementById(decodeURIComponent(targetId)); | |||
if (!targetElement) return false; | |||
var $target = $(targetElement); | |||
// Match either h2 or h3 | |||
var $heading = $target.is('h2, h3') ? $target : $target.closest('h2, h3'); | |||
if (!$heading.length) return false; | |||
var $accordion = $heading.next('.book-accordion'); | |||
// If the heading itself is not followed directly by an accordion, | |||
// check if the heading is located INSIDE a parent accordion (e.g., nested h3) | |||
var $parentAccordions = $heading.parents('.book-accordion'); | |||
// If there's no direct accordion next to it and it's not inside any accordion, | |||
// let the browser handle standard jump. | |||
if (!$accordion.length && !$parentAccordions.length) return false; | |||
// 1. Open all ancestor accordions (if target heading is nested inside one) | |||
$parentAccordions.each(function() { | |||
var $parentCollapsible = $(this).children('.mw-collapsible'); | |||
if ($parentCollapsible.length && $parentCollapsible.hasClass('mw-collapsed')) { | |||
var pId = $parentCollapsible.attr('id'); | |||
if (pId) { | |||
var pToggleClass = pId.replace('mw-customcollapsible-', 'mw-customtoggle-'); | |||
$('.' + pToggleClass).first().click(); | |||
} | |||
} | |||
}); | |||
// 2. Open the accordion immediately following this heading (if present) | |||
if ($accordion.length) { | |||
var $collapsible = $accordion.children('.mw-collapsible, .mw-collapsible-content').first(); | |||
if (!$collapsible.length) { | |||
$collapsible = $accordion.find('.mw-collapsible'); | |||
} | |||
if ($collapsible.length && $collapsible.hasClass('mw-collapsed')) { | |||
var collapsibleId = $collapsible.attr('id'); | |||
if (collapsibleId) { | |||
var toggleClass = collapsibleId.replace('mw-customcollapsible-', 'mw-customtoggle-'); | |||
$('.' + toggleClass).first().click(); | |||
} | |||
} | |||
} | |||
// Target element to scroll to (the accordion, or the heading itself if accordion is missing) | |||
var $scrollTarget = $accordion.length ? $accordion : $heading; | |||
// 3. Scroll to the visible section | |||
setTimeout(function() { | |||
$('html, body').animate({ | |||
scrollTop: $scrollTarget.offset().top - 75 | |||
}, 300); | |||
}, 100); | |||
// Return true to indicate we successfully handled the TOC accordion click | |||
return true; | |||
} catch (e) { | |||
console.error("TOC Accordion script error:", e); | |||
return false; | |||
} | |||
} | |||
$(document).off('click.tocAccordion').on('click.tocAccordion', 'a[href^="#"]', function(e) { | |||
if ($(this).closest('#toc, .toc, .vector-toc').length > 0) { | |||
var href = $(this).attr('href'); | |||
// Run our function to see if this is an accordion/heading link | |||
var isAccordion = handleAccordionTOC(href); | |||
// ONLY stop the default browser jump if we handled it | |||
if (isAccordion) { | |||
e.preventDefault(); | |||
// Update the URL manually so the user can still share the link | |||
if (history.pushState) { | |||
history.pushState(null, null, href); | |||
} else { | |||
window.location.hash = href; | |||
} | |||
} | |||
} | |||
}); | |||
if (window.location.hash) { | |||
setTimeout(function() { | |||
handleAccordionTOC(window.location.hash); | |||
}, 500); | |||
} | |||
}); | |||
/* Sticky burger menu - Pure Floating Dropdown (Forces Unpinned & Full Title) */ | |||
(function () { | |||
let isMenuOpen = false; | |||
// 1. Force the sidebar out of pinned mode and return menu into the dropdown container | |||
function forceUnpinSidebar() { | |||
document.documentElement.classList.remove('vector-feature-main-menu-pinned-enabled', 'vector-feature-main-menu-pinned-clientpref-1'); | |||
document.documentElement.classList.add('vector-feature-main-menu-pinned-disabled', 'vector-feature-main-menu-pinned-clientpref-0'); | |||
if (document.body) { | |||
document.body.classList.remove('vector-feature-main-menu-pinned-enabled', 'vector-feature-main-menu-pinned-clientpref-1'); | |||
document.body.classList.add('vector-feature-main-menu-pinned-disabled', 'vector-feature-main-menu-pinned-clientpref-0'); | |||
} | |||
// Clear stored pin preference | |||
document.cookie = "vector-feature-main-menu-pinned=0; path=/; max-age=31536000"; | |||
try { localStorage.setItem('vector-feature-main-menu-pinned', '0'); } catch(e) {} | |||
// If #vector-main-menu was moved into the pinned container, move it back into dropdown | |||
const mainMenu = document.getElementById('vector-main-menu'); | |||
const unpinnedContainer = document.getElementById('vector-main-menu-unpinned-container') || | |||
document.querySelector('#vector-main-menu-dropdown .vector-dropdown-content'); | |||
const pinnedContainer = document.getElementById('vector-main-menu-pinned-container'); | |||
if (mainMenu && unpinnedContainer && pinnedContainer && pinnedContainer.contains(mainMenu)) { | |||
unpinnedContainer.appendChild(mainMenu); | |||
} | |||
} | |||
function getDropdownElement() { | |||
return document.querySelector('#vector-main-menu-dropdown .vector-dropdown-content') || | |||
document.getElementById('vector-main-menu-dropdown-content') || | |||
document.getElementById('vector-main-menu-unpinned-container') || | |||
document.getElementById('vector-main-menu'); | |||
} | |||
function openMenu(menuBtn) { | |||
forceUnpinSidebar(); | |||
const checkbox = document.getElementById('vector-main-menu-dropdown-checkbox'); | |||
const dropdown = getDropdownElement(); | |||
if (!dropdown) return; | |||
if (checkbox) { | |||
checkbox.checked = true; | |||
checkbox.dispatchEvent(new Event('change', { bubbles: true })); | |||
} | |||
const rect = menuBtn.getBoundingClientRect(); | |||
dropdown.style.setProperty('position', 'fixed', 'important'); | |||
dropdown.style.setProperty('top', rect.bottom + 'px', 'important'); | |||
dropdown.style.setProperty('left', rect.left + 'px', 'important'); | |||
dropdown.style.setProperty('z-index', '99999', 'important'); | |||
dropdown.style.setProperty('max-height', (window.innerHeight - rect.bottom - 16) + 'px', 'important'); | |||
dropdown.style.setProperty('overflow-y', 'auto', 'important'); | |||
dropdown.style.setProperty('display', 'block', 'important'); | |||
dropdown.style.setProperty('visibility', 'visible', 'important'); | |||
dropdown.style.setProperty('opacity', '1', 'important'); | |||
dropdown.style.setProperty('background-color', 'var(--background-color-base, #ffffff)', 'important'); | |||
dropdown.style.setProperty('box-shadow', '0 4px 16px rgba(0, 0, 0, 0.2)', 'important'); | |||
dropdown.style.setProperty('border-radius', '4px', 'important'); | |||
isMenuOpen = true; | |||
} | |||
function closeMenu() { | |||
const checkbox = document.getElementById('vector-main-menu-dropdown-checkbox'); | |||
const dropdown = getDropdownElement(); | |||
if (!dropdown) return; | |||
if (checkbox) { | |||
checkbox.checked = false; | |||
checkbox.dispatchEvent(new Event('change', { bubbles: true })); | |||
} | |||
dropdown.style.removeProperty('position'); | |||
dropdown.style.removeProperty('top'); | |||
dropdown.style.removeProperty('left'); | |||
dropdown.style.removeProperty('z-index'); | |||
dropdown.style.removeProperty('max-height'); | |||
dropdown.style.removeProperty('overflow-y'); | |||
dropdown.style.removeProperty('background-color'); | |||
dropdown.style.removeProperty('box-shadow'); | |||
dropdown.style.removeProperty('border-radius'); | |||
dropdown.style.setProperty('display', 'none', 'important'); | |||
dropdown.style.setProperty('visibility', 'hidden', 'important'); | |||
dropdown.style.setProperty('opacity', '0', 'important'); | |||
isMenuOpen = false; | |||
} | |||
function initStickyBurger() { | |||
forceUnpinSidebar(); | |||
const stickyHeader = document.getElementById('vector-sticky-header'); | |||
if (!stickyHeader) return false; | |||
if (document.getElementById('vanipedia-sticky-main-menu')) return true; | |||
// 1. Create burger button | |||
const menuBtn = document.createElement('div'); | |||
menuBtn.id = 'vanipedia-sticky-main-menu'; | |||
menuBtn.title = 'Main menu'; | |||
menuBtn.style.cursor = 'pointer'; | |||
menuBtn.className = 'vector-dropdown-label cdx-button cdx-button--fake-button cdx-button--icon-only'; | |||
// 2. Add hamburger icon | |||
const iconSpan = document.createElement('span'); | |||
iconSpan.className = 'vector-icon mw-ui-icon-menu mw-ui-icon-wikimedia-menu'; | |||
menuBtn.appendChild(iconSpan); | |||
// 3. Toggle click handler (1st click opens, 2nd click rolls back) | |||
menuBtn.addEventListener('click', function (e) { | |||
e.preventDefault(); | |||
e.stopPropagation(); | |||
if (isMenuOpen) { | |||
closeMenu(); | |||
} else { | |||
openMenu(menuBtn); | |||
} | |||
}); | |||
// 4. Inject into start container | |||
let startContainer = stickyHeader.querySelector('.vector-sticky-header-start'); | |||
if (!startContainer) { | |||
startContainer = document.createElement('div'); | |||
startContainer.className = 'vector-sticky-header-start'; | |||
stickyHeader.insertBefore(startContainer, stickyHeader.firstChild); | |||
} | |||
startContainer.insertBefore(menuBtn, startContainer.firstChild); | |||
return true; | |||
} | |||
// 5. Close when clicking anywhere outside | |||
document.addEventListener('click', function (e) { | |||
if (!isMenuOpen) return; | |||
const menuBtn = document.getElementById('vanipedia-sticky-main-menu'); | |||
const dropdown = getDropdownElement(); | |||
if (dropdown && menuBtn && !menuBtn.contains(e.target) && !dropdown.contains(e.target)) { | |||
closeMenu(); | |||
} | |||
}); | |||
// 6. Bootstrap initializer | |||
if (!initStickyBurger()) { | |||
const checkTimer = setInterval(function () { | |||
if (initStickyBurger()) { | |||
clearInterval(checkTimer); | |||
} | |||
}, 100); | |||
setTimeout(function () { clearInterval(checkTimer); }, 4000); | |||
} | |||
mw.hook('wikipage.content').add(initStickyBurger); | |||
$(initStickyBurger); | |||
})(); | |||
/* Floating "Back to Top" Button Controller */ | |||
(function () { | |||
function initBackToTop() { | |||
if (document.getElementById('vanipedia-back-to-top')) return; | |||
// 1. Create button element with an up-arrow SVG icon | |||
const btn = document.createElement('button'); | |||
btn.id = 'vanipedia-back-to-top'; | |||
btn.title = 'Back to top'; | |||
btn.setAttribute('aria-label', 'Back to top'); | |||
btn.innerHTML = '<svg xmlns="http://www.w3.org/2000/svg" width="22" height="22" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><polyline points="18 15 12 9 6 15"></polyline></svg>'; | |||
// 2. Smooth scroll to top on click | |||
btn.addEventListener('click', function (e) { | |||
e.preventDefault(); | |||
window.scrollTo({ top: 0, behavior: 'smooth' }); | |||
}); | |||
// 3. Show button only after scrolling down 300px | |||
function toggleVisibility() { | |||
if (window.scrollY > 300) { | |||
btn.classList.add('visible'); | |||
} else { | |||
btn.classList.remove('visible'); | |||
} | |||
} | |||
window.addEventListener('scroll', toggleVisibility, { passive: true }); | |||
toggleVisibility(); | |||
document.body.appendChild(btn); | |||
} | |||
$(initBackToTop); | |||
mw.hook('wikipage.content').add(initBackToTop); | |||
})(); | |||
/* V176: Removed the homepage animation/random-content initializer. Main-page | |||
features now remain exactly as curated in Main-Page.wikitext. */ | |||
// SAFE LEFT-ANCHORED SEARCH (STEP 18) | |||
// ========================================================================== | |||
$(document).ready(function() { | |||
var $search = $('#p-search'); | |||
var $start = $('.vector-header-start'); | |||
if ($search.length && $start.length && !$start.find('#p-search').length) { | |||
$start.append($search); | |||
} | |||
}); | |||
/* ====================================================================== | |||
STEP 59: REMOVE TOP BAR HOVER HELP TEXTS (BROWSER TOOLTIPS) | |||
====================================================================== */ | |||
function removeTopBarHelpTexts() { | |||
var selectors = [ | |||
'#mw-head [title]', | |||
'.vector-header [title]', | |||
'#vanipedia-header-title', | |||
'.vh-header-title', | |||
'.vanipedia-header-title', | |||
'#p-logo [title]', | |||
'#p-logo a', | |||
'header [title]', | |||
'#p-personal [title]', | |||
'#p-search [title]', | |||
'.vector-user-menu [title]', | |||
'#pt-login [title]', | |||
'#pt-anonuserpage [title]', | |||
'#pt-anontalk [title]', | |||
'.vector-menu [title]' | |||
]; | |||
$(selectors.join(', ')).removeAttr('title'); | |||
// Aggressively remove title from all top bar elements | |||
$('#mw-head, .vector-header, header, .vector-header-container').find('*').removeAttr('title'); | |||
} | |||
function initSanctuaryTitle() { | |||
$('.vh-sanctuary-title a').each(function () { | |||
var $link = $(this); | |||
$link.removeClass('vh-title-morph'); | |||
$link.find('.vh-title-hover, .vh-title-default').remove(); | |||
$link.text('Who Is Śrīla Prabhupāda'); | |||
}); | |||
} | |||
$(document).ready(function () { | |||
removeTopBarHelpTexts(); | |||
initSanctuaryTitle(); | |||
setTimeout(removeTopBarHelpTexts, 400); | |||
setTimeout(removeTopBarHelpTexts, 1500); | |||
}); | |||
// ========================================================================== | |||
/* V175: decorative cursor code removed; the native system cursor is retained. */ | |||
/* ========================================================================== | |||
STEP 92: PERMANENT BOTTOM NAVIGATION BAR (MAIN PAGE & REGULAR WIKI PAGES) | |||
- Fixed at bottom of screen, permanently visible while scrolling. | |||
- Core Principles (/wiki/Vanipedia_Vision) | |||
- Volunteer (/wiki/Vaniseva) | |||
- Community (/wiki/Vanipedia_Community) | |||
- Contact (/contact.php, opens in new window) | |||
- Donate (/wiki/Special:IframePage) | |||
========================================================================== */ | |||
(function initPermanentBottomBar() { | |||
function isEntryPage() { | |||
return ( | |||
document.body.classList.contains('ext-vp3d-fullscreen') || | |||
!!document.querySelector('.vp-entry3d-container') || | |||
!!document.querySelector('.vp-entry3d-wrapper') || | |||
window.location.pathname === '/' || | |||
(window.location.pathname === '/index.php' && !window.location.search) || | |||
(window.mw && mw.config && (mw.config.get('wgPageName') === 'Entry_Page' || mw.config.get('wgTitle') === 'Entry Page')) | |||
); | |||
} | |||
/* V190: mobile footer navigation starts at Home/Main Page, with reachable horizontal overflow. */ | |||
function updateBottomBarLayout(bar) { | |||
if (!bar) return; | |||
var mobile = window.innerWidth <= 999 || document.body.classList.contains('skin-minerva'); | |||
var inner = bar.querySelector('.vh-bottom-bar-inner'); | |||
var links = bar.querySelector('.vh-bottom-nav-links'); | |||
var left = bar.querySelector('.vh-bottom-bar-left-space'); | |||
var right = bar.querySelector('.vh-bottom-bar-right-space'); | |||
if (!inner || !links) return; | |||
inner.style.setProperty('padding', mobile ? '0 10px' : '0 24px', 'important'); | |||
inner.style.setProperty('min-width', '0', 'important'); | |||
if (mobile) inner.style.setProperty('justify-content', 'flex-start', 'important'); | |||
else inner.style.removeProperty('justify-content'); | |||
links.style.setProperty('justify-content', mobile ? 'flex-start' : 'center', 'important'); | |||
links.style.setProperty('flex', mobile ? '1 1 auto' : '0 0 auto', 'important'); | |||
links.style.setProperty('width', mobile ? '100%' : 'auto', 'important'); | |||
links.style.setProperty('min-width', '0', 'important'); | |||
links.style.setProperty('gap', mobile ? '8px' : '12px', 'important'); | |||
links.style.setProperty('flex-wrap', 'nowrap', 'important'); | |||
if (mobile) links.style.setProperty('overflow-x', 'auto', 'important'); | |||
else links.style.removeProperty('overflow-x'); | |||
links.querySelectorAll('.vh-bottom-link, .vh-bottom-sep').forEach(function (item) { | |||
item.style.setProperty('flex-shrink', '0', 'important'); | |||
}); | |||
if (left) left.style.setProperty('display', mobile ? 'none' : 'block', 'important'); | |||
if (right) right.style.setProperty('display', mobile ? 'none' : 'flex', 'important'); | |||
if (mobile && bar.dataset.vpFooterMode !== 'mobile') { | |||
links.scrollLeft = 0; | |||
inner.scrollLeft = 0; | |||
} | |||
bar.dataset.vpFooterMode = mobile ? 'mobile' : 'desktop'; | |||
} | |||
function setupBottomBar() { | |||
// Never inject on the 3D entry page; remove if already present | |||
if (isEntryPage()) { | |||
var existing = document.getElementById('vh-bottom-bar'); | |||
if (existing) existing.remove(); | |||
return; | |||
} | |||
var currentBar = document.getElementById('vh-bottom-bar'); | |||
if (currentBar) { updateBottomBarLayout(currentBar); return; } | |||
var bar = document.createElement('nav'); | |||
bar.id = 'vh-bottom-bar'; | |||
bar.className = 'vh-bottom-bar'; | |||
bar.setAttribute('aria-label', 'Vanipedia Global Navigation'); | |||
bar.innerHTML = | |||
'<div class="vh-bottom-bar-inner" style="display:flex !important; align-items:center !important; width:100% !important; max-width:100% !important; height:100% !important; padding:0 24px !important; box-sizing:border-box !important;">' + | |||
'<div class="vh-bottom-bar-left-space" style="flex:1 1 0 !important; min-width:0 !important;"></div>' + | |||
'<div class="vh-bottom-nav-links" style="flex:0 0 auto !important; display:flex !important; align-items:center !important; justify-content:center !important; gap:12px !important; white-space:nowrap !important;">' + | |||
'<a href="/" class="vh-bottom-link vh-bottom-entry">Home</a>' + | |||
'<span class="vh-bottom-sep" aria-hidden="true">•</span>' + | |||
'<a href="/wiki/Main_Page" class="vh-bottom-link vh-bottom-home">Main Page</a>' + | |||
'<span class="vh-bottom-sep" aria-hidden="true">•</span>' + | |||
'<a href="/wiki/Vanipedia_Vision" class="vh-bottom-link">Core Principles</a>' + | |||
'<span class="vh-bottom-sep" aria-hidden="true">•</span>' + | |||
'<a href="/wiki/Vaniseva" class="vh-bottom-link">Volunteer</a>' + | |||
'<span class="vh-bottom-sep" aria-hidden="true">•</span>' + | |||
'<a href="/wiki/Vanipedia_Community" class="vh-bottom-link">Community</a>' + | |||
'<span class="vh-bottom-sep" aria-hidden="true">•</span>' + | |||
'<a href="/contact.php" target="_blank" rel="noopener noreferrer" class="vh-bottom-link">Contact</a>' + | |||
'<span class="vh-bottom-sep" aria-hidden="true">•</span>' + | |||
'<a href="/wiki/Special:IframePage" class="vh-bottom-link vh-bottom-donate">Donate</a>' + | |||
'</div>' + | |||
'<div class="vh-bottom-bar-right-space" style="flex:1 1 0 !important; min-width:0 !important; display:flex !important; align-items:center !important; justify-content:center !important;">' + | |||
'<div class="vh-bottom-social-links" style="position:static !important; transform:none !important; display:inline-flex !important; align-items:center !important; gap:24px !important;">' + | |||
'<a href="https://www.youtube.com/@VanimediaPrabhupada" target="_blank" rel="noopener noreferrer" class="vh-bottom-social-item" title="YouTube" style="display:inline-flex !important;align-items:center !important;">' + | |||
'<img src="/wiki/Special:FilePath/YouTube_Logo_B.png" alt="YouTube" style="height:20px !important;width:auto !important;vertical-align:middle !important;display:block !important;">' + | |||
'</a>' + | |||
'<a href="https://www.facebook.com/vanipedia.org" target="_blank" rel="noopener noreferrer" class="vh-bottom-social-item" title="Facebook Page" style="display:inline-flex !important;align-items:center !important;">' + | |||
'<img src="/wiki/Special:FilePath/Facebook_Group_Logo.png" alt="Facebook" style="height:20px !important;width:auto !important;vertical-align:middle !important;display:block !important;">' + | |||
'</a>' + | |||
'<a href="https://www.facebook.com/groups/VanipediaGroup" target="_blank" rel="noopener noreferrer" class="vh-bottom-social-item" title="Facebook Group" style="display:inline-flex !important;align-items:center !important;">' + | |||
'<img src="/wiki/Special:FilePath/Facebook_Logo_2023.png" alt="Facebook Group" style="height:20px !important;width:auto !important;vertical-align:middle !important;display:block !important;">' + | |||
'</a>' + | |||
'<a href="https://www.instagram.com/vanipediaprabhupada/" target="_blank" rel="noopener noreferrer" class="vh-bottom-social-item" title="Instagram" style="display:inline-flex !important;align-items:center !important;">' + | |||
'<img src="/wiki/Special:FilePath/Insta Logo.png" alt="Instagram" style="height:20px !important;width:auto !important;vertical-align:middle !important;display:block !important;">' + | |||
'</a>' + | |||
'</div>' + | |||
'</div>' + | |||
'</div>'; | |||
var stageSlot = document.getElementById('vani-stage-footer-slot'); | |||
if (stageSlot) { | |||
stageSlot.appendChild(bar); | |||
} else { | |||
document.body.appendChild(bar); | |||
} | |||
updateBottomBarLayout(bar); | |||
} | |||
window.addEventListener('resize', function () { | |||
updateBottomBarLayout(document.getElementById('vh-bottom-bar')); | |||
}, { passive: true }); | |||
// Remove bar if 3D entry page activates asynchronously | |||
if (window.MutationObserver && document.body) { | |||
var observer = new MutationObserver(function() { | |||
if (isEntryPage()) { | |||
var existing = document.getElementById('vh-bottom-bar'); | |||
if (existing) existing.remove(); | |||
} | |||
}); | |||
observer.observe(document.body, { attributes: true, attributeFilter: ['class'], childList: true }); | |||
} | |||
if (document.readyState === 'loading') { | |||
document.addEventListener('DOMContentLoaded', setupBottomBar); | |||
} else { | |||
setupBottomBar(); | |||
} | |||
})(); | |||
// Chrome suppression for Entry Page | |||
(function suppressEntryPageChrome() { | |||
function checkEntryChrome() { | |||
var isEntry = ( | |||
document.body.classList.contains('ext-vp3d-fullscreen') || | |||
!!document.querySelector('.vp-entry3d-container') || | |||
!!document.querySelector('.vp-entry3d-wrapper') || | |||
window.location.pathname === '/' || | |||
(window.location.pathname === '/index.php' && !window.location.search) | |||
); | |||
if (isEntry) { | |||
var headers = document.querySelectorAll('.header-container, .header-chrome, .minerva-header, .vector-header-container, #mw-head, .mw-header'); | |||
for (var i = 0; i < headers.length; i++) { | |||
headers[i].style.setProperty('display', 'none', 'important'); | |||
} | |||
var b = document.getElementById('vh-bottom-bar'); | |||
if (b) b.remove(); | |||
} | |||
} | |||
if (document.readyState === 'loading') { | |||
document.addEventListener('DOMContentLoaded', checkEntryChrome); | |||
} else { | |||
checkEntryChrome(); | |||
} | |||
})(); | |||
/* ========================================================================== | |||
STEP 97: MOBILE BURGER MENU TOGGLE ENHANCER | |||
Ensures the hamburger menu reliably opens and closes the Vector navigation | |||
drawer on mobile viewports and touch devices. | |||
========================================================================== */ | |||
(function() { | |||
function initMobileMenuToggle() { | |||
var dropdown = document.getElementById('vector-main-menu-dropdown'); | |||
if (!dropdown || dropdown.dataset.vaniMobileInit) return; | |||
dropdown.dataset.vaniMobileInit = 'true'; | |||
var label = dropdown.querySelector('.vector-dropdown-label'); | |||
var checkbox = document.getElementById('vector-main-menu-dropdown-checkbox'); | |||
var content = dropdown.querySelector('.vector-dropdown-content'); | |||
if (label && checkbox) { | |||
label.addEventListener('click', function(e) { | |||
setTimeout(function() { | |||
if (content) { | |||
if (checkbox.checked) { | |||
content.classList.add('is-open'); | |||
} else { | |||
content.classList.remove('is-open'); | |||
} | |||
} | |||
}, 50); | |||
}); | |||
} | |||
} | |||
$(document).ready(initMobileMenuToggle); | |||
if (window.mw && mw.hook) { | |||
mw.hook('wikipage.content').add(initMobileMenuToggle); | |||
} | |||
})(); | |||
/* ========================================================================== | |||
VANIPEDIA MOBILE JAVASCRIPT (MediaWiki:Mobile.js) | |||
1. User Menu Dropdown: Intercepts #ca-mytalks on mobile to show the regular | |||
user dropdown menu (Talk, Preferences, Contributions, Log out) matching desktop. | |||
2. Self-contained styles injected into <head>. | |||
3. Screen Orientation lock to landscape on Main Page. | |||
========================================================================== */ | |||
(function() { | |||
// 1. Inject self-contained dropdown styles immediately into <head> | |||
var styleId = 'vani-mobile-dropdown-styles'; | |||
if (!document.getElementById(styleId)) { | |||
var style = document.createElement('style'); | |||
style.id = styleId; | |||
style.textContent = [ | |||
'#vanipedia-mobile-user-menu {', | |||
' display: none !important;', | |||
' position: fixed !important;', | |||
' top: 52px !important;', | |||
' right: 8px !important;', | |||
' width: 175px !important;', | |||
' background-color: #1f3e45 !important;', | |||
' border: 1.5px solid #b1873d !important;', | |||
' border-radius: 6px !important;', | |||
' box-shadow: 0 8px 24px rgba(0,0,0,0.5) !important;', | |||
' padding: 6px 0 !important;', | |||
' z-index: 999999 !important;', | |||
' box-sizing: border-box !important;', | |||
' flex-direction: column !important;', | |||
'}', | |||
'#vanipedia-mobile-user-menu.is-open {', | |||
' display: flex !important;', | |||
'}', | |||
'#vanipedia-mobile-user-menu a.vani-user-menu-item {', | |||
' color: #f5d77f !important;', | |||
' font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif !important;', | |||
' font-size: 15px !important;', | |||
' font-weight: 500 !important;', | |||
' padding: 10px 18px !important;', | |||
' text-decoration: none !important;', | |||
' display: block !important;', | |||
' line-height: 1.2 !important;', | |||
'}', | |||
'#vanipedia-mobile-user-menu a.vani-user-menu-item:hover,', | |||
'#vanipedia-mobile-user-menu a.vani-user-menu-item:active {', | |||
' background-color: #345B63 !important;', | |||
' color: #ffffff !important;', | |||
'}', | |||
'#vanipedia-mobile-user-menu .vani-user-menu-divider {', | |||
' height: 1px !important;', | |||
' background-color: rgba(177, 135, 61, 0.35) !important;', | |||
' margin: 5px 0 !important;', | |||
'}', | |||
'#vanipedia-mobile-user-menu a.vani-user-menu-logout {', | |||
' color: #fca5a5 !important;', | |||
'}', | |||
'#vanipedia-mobile-user-menu a.vani-user-menu-logout:hover {', | |||
' background-color: rgba(239, 68, 68, 0.2) !important;', | |||
' color: #ffffff !important;', | |||
'}' | |||
].join('\n'); | |||
document.head.appendChild(style); | |||
} | |||
// 2. Setup user dropdown click interceptor | |||
function initUserMenuDropdown() { | |||
var $userBtn = $('#ca-mytalks'); | |||
if (!$userBtn.length || $userBtn.data('vaniMenuInit')) return; | |||
$userBtn.data('vaniMenuInit', true); | |||
// Prevent opening talk page directly | |||
$userBtn.attr('href', 'javascript:void(0)'); | |||
// Build the dropdown container attached to body | |||
var $dropdown = $('#vanipedia-mobile-user-menu'); | |||
if (!$dropdown.length) { | |||
$dropdown = $('<div>', { | |||
id: 'vanipedia-mobile-user-menu', | |||
class: 'vanipedia-mobile-user-dropdown' | |||
}); | |||
var user = (window.mw && mw.config && mw.config.get('wgUserName')) || 'Kashya'; | |||
var talkUrl = '/wiki/User_talk:' + encodeURIComponent(user); | |||
var prefUrl = '/wiki/Special:Preferences'; | |||
var contUrl = '/wiki/Special:Contributions/' + encodeURIComponent(user); | |||
var page = (window.mw && mw.config && mw.config.get('wgPageName')) || 'Main_Page'; | |||
var logoutUrl = '/w/index.php?title=Special:UserLogout&returnto=' + encodeURIComponent(page) + '&useformat=mobile'; | |||
$dropdown.html( | |||
'<a href="' + talkUrl + '" class="vani-user-menu-item">Talk</a>' + | |||
'<a href="' + prefUrl + '" class="vani-user-menu-item">Preferences</a>' + | |||
'<a href="' + contUrl + '" class="vani-user-menu-item">Contributions</a>' + | |||
'<div class="vani-user-menu-divider"></div>' + | |||
'<a href="' + logoutUrl + '" class="vani-user-menu-item vani-user-menu-logout">Log out</a>' | |||
); | |||
$('body').append($dropdown); | |||
} | |||
// Toggle on click | |||
$userBtn.on('click', function(e) { | |||
e.preventDefault(); | |||
e.stopPropagation(); | |||
$dropdown.toggleClass('is-open'); | |||
}); | |||
// Close on clicking outside | |||
$(document).on('click touchstart', function(e) { | |||
if (!$(e.target).closest('#ca-mytalks, #vanipedia-mobile-user-menu').length) { | |||
$dropdown.removeClass('is-open'); | |||
} | |||
}); | |||
} | |||
// ========================================================================= | |||
// 3. Container-Level Auto-Landscape & 2D Fitting (STEP 115) | |||
// Matches the exact architecture of VanipediaEntry3D: | |||
// - Keeps <body> stable without full-page transforms. | |||
// - Wraps #vani-home inside #vani-mobile-stage > #vani-rotated-box. | |||
// - Rotates #vani-rotated-box 90deg in portrait mode. | |||
// - Scales the 1200px desktop layout so all sections (Triad, Timeline, | |||
// 4 Taxonomy Cards, Bottom Bar) fit the phone screen without cropping. | |||
// ========================================================================= | |||
/* ========================================================================= | |||
3. STEP 117: UNIFIED 3-SLOT ROTATED LANDSCAPE STAGE (TOP BAR + MAIN PAGE + BOTTOM BAR) | |||
- Puts Top Bar, #vani-home, and Bottom Bar together in landscape. | |||
- Rotates 90deg as a single unified screen when held in portrait. | |||
- Stays completely horizontal with zero rotation when held in native landscape. | |||
- Leaves regular wiki pages and desktop view completely untouched. | |||
========================================================================= */ | |||
function initMobileMainPageStage() { | |||
if (window._vaniMainPageStageInit) return; | |||
var pageName = (window.mw && mw.config && mw.config.get('wgPageName')) || ''; | |||
var isMainPage = pageName === 'Main_Page' || document.body.classList.contains('page-Main_Page'); | |||
if (!isMainPage) return; | |||
var $vh = $('#vani-home'); | |||
if (!$vh.length) return; | |||
window._vaniMainPageStageInit = true; | |||
var $stage = null; | |||
var $rotatedBox = null; | |||
var $headerSlot = null; | |||
var $contentSlot = null; | |||
var $footerSlot = null; | |||
var $topHeader = null; | |||
var $bottomBar = null; | |||
var $headerParent = null; | |||
var $footerParent = null; | |||
var $vhParent = null; | |||
function ensureStage() { | |||
if (!$('#vani-mobile-stage').length) { | |||
$topHeader = $('.vector-header-container, #mw-head, .mw-header, .header-container, header.header-chrome').filter(':visible').first(); | |||
if (!$topHeader.length) { | |||
$topHeader = $('.vector-header-container, #mw-head, .mw-header, .header-container, header.header-chrome').first(); | |||
} | |||
$bottomBar = $('#vh-bottom-bar'); | |||
if ($topHeader.length) $headerParent = $topHeader.parent(); | |||
if ($bottomBar.length) $footerParent = $bottomBar.parent(); | |||
$vhParent = $vh.parent(); | |||
var stageHtml = [ | |||
'<div id="vani-mobile-stage">', | |||
' <div id="vani-rotated-box">', | |||
' <div id="vani-stage-header-slot"></div>', | |||
' <div id="vani-stage-content-slot"></div>', | |||
' <div id="vani-stage-footer-slot"></div>', | |||
' </div>', | |||
'</div>' | |||
].join(''); | |||
$('body').append(stageHtml); | |||
document.body.classList.add('has-vani-stage'); | |||
$stage = $('#vani-mobile-stage'); | |||
$rotatedBox = $('#vani-rotated-box'); | |||
$headerSlot = $('#vani-stage-header-slot'); | |||
$contentSlot = $('#vani-stage-content-slot'); | |||
$footerSlot = $('#vani-stage-footer-slot'); | |||
if ($topHeader.length) { | |||
$headerSlot.append($topHeader); | |||
var $menu = $('#vanipedia-mobile-user-menu'); | |||
if ($menu.length) $headerSlot.append($menu); | |||
} | |||
$contentSlot.append($vh); | |||
if ($bottomBar.length) { | |||
$footerSlot.append($bottomBar); | |||
} | |||
} else { | |||
$stage = $('#vani-mobile-stage'); | |||
$rotatedBox = $('#vani-rotated-box'); | |||
$headerSlot = $('#vani-stage-header-slot'); | |||
$contentSlot = $('#vani-stage-content-slot'); | |||
$footerSlot = $('#vani-stage-footer-slot'); | |||
if (!$footerSlot.find('#vh-bottom-bar').length) { | |||
var $b = $('#vh-bottom-bar'); | |||
if ($b.length) $footerSlot.append($b); | |||
} | |||
if (!$headerSlot.find('.vector-header-container, #mw-head, .header-container').length) { | |||
var $h = $('.vector-header-container, #mw-head, .mw-header, .header-container').first(); | |||
if ($h.length) $headerSlot.append($h); | |||
} | |||
} | |||
if ($headerSlot && !$headerSlot.find('.vanipedia-stage-title-link').length) { | |||
var $st = $('<a class="vanipedia-stage-title-link" href="/wiki/Main_Page">Vanipedia</a>'); | |||
var $targetNav = $headerSlot.find('.vector-header-start, .minerva-header, .header-container'); | |||
if ($targetNav.length) { | |||
$targetNav.first().children().first().after($st); | |||
} else { | |||
$headerSlot.prepend($st); | |||
} | |||
} | |||
} | |||
function updateLayout() { | |||
var screenW = window.innerWidth; | |||
var screenH = window.innerHeight; | |||
var isMobile = ('ontouchstart' in window) || (navigator.maxTouchPoints > 0) || (screenW < 900) || (screenH < 900 && screenH > screenW); | |||
if (!isMobile && screenW >= 1000 && screenW > screenH) { | |||
if ($('#vani-mobile-stage').length) { | |||
if ($topHeader && $topHeader.length && $headerParent) { | |||
$headerParent.prepend($topHeader); | |||
} | |||
if ($vhParent) { | |||
$vhParent.append($vh); | |||
} | |||
if ($bottomBar && $bottomBar.length && $footerParent) { | |||
$footerParent.append($bottomBar); | |||
} | |||
var $m = $('#vanipedia-mobile-user-menu'); | |||
if ($m.length) $('body').append($m); | |||
$('#vani-mobile-stage').remove(); | |||
document.body.classList.remove('has-vani-stage'); | |||
$vh.css({ 'transform': '', 'transform-origin': '', 'width': '' }); | |||
} | |||
return; | |||
} | |||
ensureStage(); | |||
var isMobilePortrait = (screenH > screenW) && (screenW < 850); | |||
var landscapeW = isMobilePortrait ? screenH : screenW; | |||
var landscapeH = isMobilePortrait ? screenW : screenH; | |||
$rotatedBox.css({ | |||
'width': landscapeW + 'px', | |||
'height': landscapeH + 'px' | |||
}); | |||
if (isMobilePortrait) { | |||
$rotatedBox.removeClass('is-native-landscape').addClass('is-auto-landscape'); | |||
} else { | |||
$rotatedBox.removeClass('is-auto-landscape').addClass('is-native-landscape'); | |||
} | |||
var headerH = 50; | |||
var footerH = 36; | |||
var availableContentH = Math.max(120, landscapeH - headerH - footerH); | |||
$contentSlot.css({ | |||
'height': availableContentH + 'px' | |||
}); | |||
var baseW = 1200; | |||
var baseH = 475; | |||
var scaleW = landscapeW / baseW; | |||
var scaleH = availableContentH / baseH; | |||
var scale = Math.min(scaleW, scaleH); | |||
if (scale > 0.85) scale = 0.85; | |||
if (scale < 0.45) scale = 0.45; | |||
var scaledWidth = baseW * scale; | |||
var offsetX = Math.max(0, (landscapeW - scaledWidth) / 2); | |||
$vh.css({ | |||
'transform': 'translate(' + offsetX.toFixed(1) + 'px, 0) scale(' + scale.toFixed(4) + ')', | |||
'transform-origin': 'top left', | |||
'width': baseW + 'px' | |||
}); | |||
} | |||
var touchStartY = 0; | |||
var touchStartScroll = 0; | |||
window.addEventListener('touchstart', function(e) { | |||
if ($rotatedBox && $rotatedBox.hasClass('is-auto-landscape') && e.touches && e.touches.length === 1) { | |||
touchStartY = e.touches[0].clientX; | |||
if ($contentSlot && $contentSlot[0]) { | |||
touchStartScroll = $contentSlot[0].scrollTop || 0; | |||
} | |||
} | |||
}, { passive: true }); | |||
window.addEventListener('touchmove', function(e) { | |||
if ($rotatedBox && $rotatedBox.hasClass('is-auto-landscape') && e.touches && e.touches.length === 1) { | |||
var delta = touchStartY - e.touches[0].clientX; | |||
if ($contentSlot && $contentSlot[0]) { | |||
$contentSlot[0].scrollTop = touchStartScroll + delta; | |||
} | |||
} | |||
}, { passive: true }); | |||
window.addEventListener('wheel', function(e) { | |||
if ($rotatedBox && $rotatedBox.hasClass('is-auto-landscape') && $contentSlot && $contentSlot[0]) { | |||
$contentSlot[0].scrollTop += e.deltaY; | |||
} | |||
}, { passive: true }); | |||
window.addEventListener('resize', updateLayout); | |||
window.addEventListener('orientationchange', function() { | |||
setTimeout(updateLayout, 150); | |||
}); | |||
updateLayout(); | |||
} | |||
$(document).ready(function() { | |||
initUserMenuDropdown(); // V174: natural portrait/landscape flow; no forced rotation. | |||
}); | |||
if (window.mw && mw.hook) { | |||
mw.hook('wikipage.content').add(function() { | |||
initUserMenuDropdown(); // V174: natural portrait/landscape flow; no forced rotation. | |||
}); | |||
} | |||
})(); | |||
/* ========================================================================== | |||
STEP 119: EXACT DESKTOP SIDEBAR INJECTION INTO MOBILE BURGER DRAWER | |||
1. Empties all irrelevant Minerva items (Nearby, Random, Settings, About). | |||
2. Clones or fetches the exact desktop Vector 2022 sidebar (#vector-main-menu). | |||
3. Tags each section with .vanipedia-sidebar-menu for the true desktop accordion. | |||
4. Connects the 102 Languages live search box. | |||
========================================================================== */ | |||
(function initExactMobileSidebar() { | |||
function cleanAndInject($drawer, sidebarHtml) { | |||
if ($drawer.data('vaniSidebarCleaned')) return; | |||
$drawer.data('vaniSidebarCleaned', true); | |||
// 1. Remove all default Minerva items (Nearby, Random, Personal, Hlist) | |||
$drawer.find('#p-navigation, #p-personal, ul.hlist, .menu__item--nearby, .menu__item--random').remove(); | |||
// 2. Parse and filter desktop sidebar HTML | |||
var $parsed = $('<div>').append($.parseHTML(sidebarHtml)); | |||
var $menus = $parsed.find('.vector-menu'); | |||
if (!$menus.length) { | |||
$menus = $parsed.find('.portal, [id^="p-"]'); | |||
} | |||
var $container = $('<div>', { id: 'vani-mobile-synced-sidebar' }); | |||
$menus.each(function(idx) { | |||
var $menu = $(this).clone(); | |||
var menuId = $menu.attr('id') || ''; | |||
// Ignore personal or search menus if caught | |||
if (menuId === 'p-personal' || menuId === 'p-search' || menuId === 'p-logo') return; | |||
// Apply standard desktop class | |||
$menu.addClass('vanipedia-sidebar-menu'); | |||
// Collapse by default, except the first section (Navigation) | |||
if (idx === 0) { | |||
$menu.removeClass('vanipedia-collapsed'); | |||
} else { | |||
$menu.addClass('vanipedia-collapsed'); | |||
} | |||
$container.append($menu); | |||
}); | |||
// 3. Mount cleanly inside mobile drawer | |||
$drawer.empty().append($container); | |||
// 4. Initialize 102 Languages live search box in the cloned menu | |||
initLanguageSearchInDrawer($container); | |||
} | |||
function initLanguageSearchInDrawer($container) { | |||
var $sidebarMenu = $container.find('#p-102_Languages ul, [id*="102_Languages"] ul').first(); | |||
if ($sidebarMenu.length === 0) { | |||
$container.find('.vector-menu-heading, .portal h3').each(function() { | |||
if ($(this).text().trim().indexOf('102 Languages') !== -1) { | |||
$sidebarMenu = $(this).closest('.vector-menu, .portal').find('ul').first(); | |||
} | |||
}); | |||
} | |||
if (!$sidebarMenu || $sidebarMenu.length === 0 || $sidebarMenu.find('#sidebarLanguageSearch').length) return; | |||
var $searchLi = $('<li id="n-language-search" style="margin: 8px 10px; list-style: none;"></li>'); | |||
var $searchBox = $('<input type="text" id="sidebarLanguageSearch" placeholder="Search 102 Languages..." autocomplete="off" />'); | |||
var $resultsContainer = $('<ul id="sidebarLanguageResults" style="list-style: none; padding: 0; margin: 4px 0 0 0; max-height: 200px; overflow-y: auto; border: 1px solid #2c4c50; background: #ffffff; display: none;"></ul>'); | |||
$searchLi.append($searchBox).append($resultsContainer); | |||
$sidebarMenu.prepend($searchLi); | |||
var api = new mw.Api(); | |||
var languageList = []; | |||
api.get({ | |||
action: 'query', | |||
list: 'categorymembers', | |||
cmtitle: 'Category:Languages_with_Total_Pages', | |||
cmlimit: 'max', | |||
format: 'json' | |||
}).done(function(data) { | |||
if (data.query && data.query.categorymembers) { | |||
languageList = data.query.categorymembers.map(function(member) { | |||
return { | |||
title: member.title, | |||
url: mw.util.getUrl(member.title) | |||
}; | |||
}); | |||
} | |||
}); | |||
$searchBox.on('keyup', function(e) { | |||
e.stopPropagation(); | |||
var term = $(this).val().toLowerCase().trim(); | |||
$resultsContainer.empty(); | |||
if (term.length === 0) { | |||
$resultsContainer.hide(); | |||
return; | |||
} | |||
var matches = languageList.filter(function(item) { | |||
return item.title.toLowerCase().indexOf(term) !== -1; | |||
}); | |||
if (matches.length > 0) { | |||
matches.slice(0, 15).forEach(function(item) { | |||
var $li = $('<li>', { style: 'padding: 6px 12px; border-bottom: 1px solid #eaeff0;' }); | |||
var $a = $('<a>', { | |||
href: item.url, | |||
text: item.title, | |||
style: 'color: #1b3033; text-decoration: none; display: block;' | |||
}); | |||
$li.append($a); | |||
$resultsContainer.append($li); | |||
}); | |||
$resultsContainer.show(); | |||
} else { | |||
$resultsContainer.html('<li style="padding: 6px 12px; color: #888; font-style: italic;">No languages found</li>').show(); | |||
} | |||
}); | |||
$(document).on('click touchstart', function(e) { | |||
if (!$(e.target).closest('#n-language-search').length) { | |||
$resultsContainer.hide(); | |||
} | |||
}); | |||
} | |||
function setupMobileDrawer() { | |||
var $drawer = $('#mw-mf-page-left'); | |||
if (!$drawer.length) return; | |||
// Check if desktop sidebar is already in DOM | |||
var $desktopSidebar = $('#vector-main-menu, .vector-sidebar-container #mw-panel'); | |||
if ($desktopSidebar.length && $desktopSidebar.find('.vector-menu').length) { | |||
cleanAndInject($drawer, $desktopSidebar.html()); | |||
return; | |||
} | |||
// Check sessionStorage cache | |||
var cached = null; | |||
try { cached = sessionStorage.getItem('vani_desktop_sidebar_html'); } catch(e) {} | |||
if (cached) { | |||
cleanAndInject($drawer, cached); | |||
return; | |||
} | |||
// Fetch desktop Vector 2022 page to get exact sidebar markup | |||
var fetchUrl = (window.mw && mw.util && mw.util.getUrl('Main_Page', { useskin: 'vector-2022' })) || | |||
'/wiki/Main_Page?useskin=vector-2022'; | |||
$.ajax({ | |||
url: fetchUrl, | |||
type: 'GET', | |||
dataType: 'html', | |||
success: function(response) { | |||
try { | |||
var $parsed = $('<div>').append($.parseHTML(response)); | |||
var $sidebar = $parsed.find('#vector-main-menu'); | |||
if (!$sidebar.length) { | |||
$sidebar = $parsed.find('#mw-panel, .vector-sidebar-container'); | |||
} | |||
if ($sidebar.length) { | |||
var html = $sidebar.html(); | |||
try { sessionStorage.setItem('vani_desktop_sidebar_html', html); } catch(e) {} | |||
cleanAndInject($drawer, html); | |||
} | |||
} catch(e) { | |||
console.warn('[VANIPEDIA] Error extracting desktop sidebar:', e); | |||
} | |||
} | |||
}); | |||
} | |||
$(document).ready(setupMobileDrawer); | |||
if (window.mw && mw.hook) { | |||
mw.hook('wikipage.content').add(setupMobileDrawer); | |||
} | |||
})(); | |||
/* ========================================================================== | |||
PARTICIPATING LANGUAGES: INLINE SVG FLAG INJECTOR (STEP 153) | |||
MediaWiki CSS sanitizer strips data:image from stylesheets. | |||
Injecting pure vector SVGs directly into DOM spans ensures 100% compliance. | |||
========================================================================== */ | |||
function initLanguageFlags() { | |||
var flags = { | |||
'es': '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 750 500" style="width:100%;height:100%;display:block;border-radius:1.5px;"><rect width="750" height="500" fill="#c60b1e"/><rect y="125" width="750" height="250" fill="#ffc400"/></svg>', | |||
'fr': '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 900 600" style="width:100%;height:100%;display:block;border-radius:1.5px;"><rect width="300" height="600" fill="#002654"/><rect x="300" width="300" height="600" fill="#fff"/><rect x="600" width="300" height="600" fill="#ce1126"/></svg>', | |||
'de': '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 5 3" style="width:100%;height:100%;display:block;border-radius:1.5px;"><rect width="5" height="1" fill="#000"/><rect y="1" width="5" height="1" fill="#d00"/><rect y="2" width="5" height="1" fill="#ffce00"/></svg>', | |||
'it': '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 3 2" style="width:100%;height:100%;display:block;border-radius:1.5px;"><rect width="1" height="2" fill="#008c45"/><rect x="1" width="1" height="2" fill="#f4f5f0"/><rect x="2" width="1" height="2" fill="#cd212a"/></svg>', | |||
'ru': '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 9 6" style="width:100%;height:100%;display:block;border-radius:1.5px;"><rect width="9" height="2" fill="#fff"/><rect y="2" width="9" height="2" fill="#0039a6"/><rect y="4" width="9" height="2" fill="#d52b1e"/></svg>', | |||
'in': '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 900 600" style="width:100%;height:100%;display:block;border-radius:1.5px;"><rect width="900" height="200" fill="#ff9933"/><rect y="200" width="900" height="200" fill="#fff"/><rect y="400" width="900" height="200" fill="#128807"/><circle cx="450" cy="300" r="80" fill="none" stroke="#000080" stroke-width="16"/><circle cx="450" cy="300" r="20" fill="#000080"/></svg>', | |||
'br': '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1000 700" style="width:100%;height:100%;display:block;border-radius:1.5px;"><rect width="1000" height="700" fill="#009b3a"/><polygon points="500,85 915,350 500,615 85,350" fill="#fedf00"/><circle cx="500" cy="350" r="175" fill="#002776"/></svg>', | |||
'pl': '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 8 5" style="width:100%;height:100%;display:block;border-radius:1.5px;"><rect width="8" height="2.5" fill="#fff"/><rect y="2.5" width="8" height="2.5" fill="#dc143c"/></svg>', | |||
'bd': '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 10 6" style="width:100%;height:100%;display:block;border-radius:1.5px;"><rect width="10" height="6" fill="#006a4e"/><circle cx="4.5" cy="3" r="2" fill="#f42a41"/></svg>', | |||
'cn': '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 900 600" style="width:100%;height:100%;display:block;border-radius:1.5px;"><rect width="900" height="600" fill="#de2910"/><polygon points="150,50 180,140 100,85 200,85 120,140" fill="#ffde00"/></svg>', | |||
'jp': '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 900 600" style="width:100%;height:100%;display:block;border-radius:1.5px;"><rect width="900" height="600" fill="#fff"/><circle cx="450" cy="300" r="180" fill="#bc002d"/></svg>', | |||
'nl': '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 9 6" style="width:100%;height:100%;display:block;border-radius:1.5px;"><rect width="9" height="2" fill="#ae1c28"/><rect y="2" width="9" height="2" fill="#fff"/><rect y="4" width="9" height="2" fill="#21468b"/></svg>', | |||
'hr': '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 6 3" style="width:100%;height:100%;display:block;border-radius:1.5px;"><rect width="6" height="1" fill="#f00"/><rect y="1" width="6" height="1" fill="#fff"/><rect y="2" width="6" height="1" fill="#00f"/></svg>', | |||
'cz': '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 900 600" style="width:100%;height:100%;display:block;border-radius:1.5px;"><rect width="900" height="300" fill="#fff"/><rect y="300" width="900" height="300" fill="#d7141a"/><polygon points="0,0 450,300 0,600" fill="#11457e"/></svg>', | |||
'hu': '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 6 3" style="width:100%;height:100%;display:block;border-radius:1.5px;"><rect width="6" height="1" fill="#ce2939"/><rect y="1" width="6" height="1" fill="#fff"/><rect y="2" width="6" height="1" fill="#477050"/></svg>' | |||
}; | |||
for (var code in flags) { | |||
var elements = document.getElementsByClassName('vh-flag-' + code); | |||
for (var i = 0; i < elements.length; i++) { | |||
if (!elements[i].childNodes.length) { | |||
elements[i].innerHTML = flags[code]; | |||
} | |||
} | |||
} | |||
} | |||
$(document).ready(initLanguageFlags); | |||
if (window.mw && mw.hook) { | |||
mw.hook('wikipage.content').add(initLanguageFlags); | |||
} | |||
/* V179: one viewport-contained rollout at a time, with fixed-footer clearance. */ | |||
(function initViewportPortalRollouts() { | |||
/* V187: prepared link pools, matching the other petals' rollout sampling. | |||
Select 20 unique entries once per browser page load from each 120-link pool. | |||
Sources: Vaniquotes Questions asked to Srila Prabhupada; public Vanipedia | |||
Living Devotees Remembering Srila Prabhupada (snapshot: 2026-10-27). | |||
Question links open Vaniquotes; remembrance links use the current wiki. | |||
No runtime API requests or persistent browser cache are needed. | |||
*/ | |||
var hookPools = {"questions":["And after you left the college, were you employed?","And that mental process, if you are working, is it a wrong mental process?","And this is your first visit to this (Paris) center?","Aren't there coverings of the 8 elements?","As the spirit soul is leaving the body, do you become older?","Babar was also a minister of his (Akbar)?","But how can that (real process is devotion) be scientifically presented? How can we accept that scientifically?","But how can we understand all this science and technology just by understanding Krsna, just by one book?","But is it (that worship made by trees and other lower animals) voluntary or involuntary?","But the innocent souls, they're not surrendered to Krsna?","Can one assume that matter is a kind of energy?","Could you explain further, purification of the senses? You said that you had to purify your senses before you can see God","Could you give them by name, the five kinds of liberation? In English?","Did Krsna describe to Arjuna the disciplic succession?","Do you have a name that you call... are they called students?","Do you have children? You just left them?","Do you spend a certain amount of time in each center? Do you yourself travel from one center to another?","Do you want to keep the checks or give them to him (Kirtanananda)?","Does any physical change take place in your body when you become Krsna conscious?","Does our line of succession go directly to Gaurakisora dasa Babaji or to Bhaktivinoda Thakura?","Excuse me, does that mean that people from other religions may..., it is not possible for them to achieve the highest perfection?","God has not created us imperfect?","How are the boys and girls to learn these things in manners of decorum and manners from the sannyasis, for example. How are they to offer respects to their godbrothers?","How are they feeling about it (temple), the Vrndavana Gosais?","How can a spirit become so ignorant?","How do you call devotion to the Lord?","How do you know (that is a bogus)? Have you met him (Guru Maharaji)?","How do you know if you have satisfied God?","How do you know that you know? May I ask this (we have to find out, we have to find out who can give the perfect knowledge)?","How do you want India to take this movement?","How is it that when our coat, size of the coat, changes because the body grows bigger the size of the coat is bigger?","How is our movement doing in India?","How old is this man (Prakasananda Sarasvati)?","I am thinking about this, Swamiji, that your Guru Maharaja is preaching through you, and you are preaching through them?","I mean, what is the idea in \"Even if it goes slowly, it must begin\"(so let them begin the foundation… Let it go on slowly, but it must begin)?","If a person experiences difficulty attaining a level of consciousness of God, how to counteract that?","If Krsna knows that we will suffer here in this material world if we come here, why does He let us go?","If we are given charge of the society, we should dismantle all this industry, all these cities...?","In what way we will live in that spiritual form?","Initiation (of Srila Prabhupada) was held at that Gaudiya Matha in Allahabad?","Introduced starting with ISKCON community (varnasrama-dharma should be introduced all over the world)?","Is everything done in our movement for preaching? Everything that is done in our movement is done for preaching?","Is he (Syamasundara's father is very rich man)?","Is it possible through Krsna consciousness to, in the supreme state, to be able to remember all that you were?","Is it true that there are more young people now in the world that are giving more serious thought to what life is really all about?","Is that differentiated (total material elements, mahat-tattva)?","Is that part of your income, to run a...(publishing house)?","Is that perfection possible in one life (our healthy life is to enjoy eternal life... So our human life should be utilized for attaining that perfectional stage)?","Is there any possible way of a balanced combination between spiritualism and materialism?","Is your spiritual master still alive?","Isn't it inevitable that it's going to occur, that the devolution occurs inevitably without anyone's being able to change it?","It becomes a belief rather than a logic now, then, for when we think about the God. You were saying everybody has father, so why God, in exception, He hasn't got a father?","It is possible to attain that affection of love for God... without taking part in this Krsna consciousness movement?","It's not dedicated to Krsna? The work is not dedicated to Krsna. How, specifically, how can you do this?","Krsna says to perform your sva-dharma, so how does one know what is his sva-dharma?","Last night you said that what is the meaning of the word \"nothing.\" That maya means \"nothing\"?","Maybe we will show Lord Caitanya's marriage? Is that nice to show?","No doubt, but what about the daily worship? Should we have Jagannatha deities if it's not possible for worshiping them? Should we have them just for the festival?","No, most of them, they have lived, a very short times. But still is it a fact that the soul is transplanted from one body to another body?","One thing that puzzles me is if what is practical for one person is not practical for another person, then what is the criterion of truth? Is truth relative?","Prabhupada, are all living entities, always under the protection at all times of the Supreme Lord, the Personality of Godhead, at all times?","Prabhupada, what does Balabhadra mean?","Sambodhana is to remove the evil, remove the bad part isn't it?","Say someone prepares something, like some prasadam for Krsna, but he does not make it so good?","She's (Mrs.Marchand) asking that since in these Western countries the families are so broken up and the women sometimes cannot find a qualified husband, what should she do?","So is that a fact, that he (Jesus Christ) went to India?","So then to love Krsna is unnatural?","So they're representatives (Guru Nanak, Muhammad, and other people)?","So why not eat, drink, and be merry because tomorrow you die?","Sometimes the question is put before us: \"You ask us not to eat meat, but you are eating vegetables. Do you think that is not violence?\"","Spiritual master is the mercy of God?","Srila Prabhupada, is the subtle bodies in the subtle world, are they made up of subtle atoms?","Srila Prabhupada, there was a fish on Laksmi's hand yesterday. The Deity in the temple, where Laksmi had her hand up like this, there was a fish here across her hand. What is this?","Swami, what do you think accounts for the..., your popularity, popularity of the..., the Krsna consciousness movement sweeping America?","Swamiji, so the government, the present government in the world...?","Swamiji? Are there people living on the moon now or were they in other yugas living there?","That desire is simple (he does not desire. He desires, and the matter helps. In the material world)?","That doesn't mean (in the spiritual world, it is full of variegatedness) that it is complex, Srila Prabhupada, yes?","That later-on Ramayana has caused some havoc... That later-on interpretation?","The body is matter, but still it is conscious as long as I am alive. So that means the life is consciousness?","The karmi and the jnani are both within the material world. Is the jnani considered more elevated than the karmi?","The literal meaning of sutra is a condensed statement, Prabhupada?","The school in Vrndavana, is this, I assume this is to be out there in the yard that they were clearing. When do you anticipate that will be built?","The shaved head, he's asking?","There are two, two functions in the tongue, one is (indistinct) and one is (indistinct)? So which one (indistinct). Preaching is a form of tapasya?","These days there are so many men who claim to have found the Absolute, who claim to be spiritual masters in their own way. How does one tell who is a bona fide spiritual master?","They have so many people in boxes in the hospitals they are keeping alive. So the big battle is raging whether or not they should pull out the plug?","They say, \"Then my chanting is useless? So I should stop?\" That's what they say","This would be the prescription for all people?","Today there's a little swelling in your... It seems to come and go… It seems to come and go. Is it bothering you?… Is it disturbing?... Really?","Upendra is here now. Should we give him the kismis to make?","We have a display over here in the window of your books, Srila Prabhupada... Would you like to see?","We have a spiritual body to serve Krsna?","Well, then, how is the individual soul eternal if it has a beginning?","Were some of the animals destined to survive through the destruction of other animals?","Were they liberated souls? The thief?","Were you just waiting to finish your books?","What about the poor, hungry, and the suffering bodies?","What does it (Gandharvapur) mean?","What happens to his consciousness which he has achieved as a man during that time which he is in the animal kingdom?","What happens to them (the devotees)?","What is an example of the throwing potency of maya?","What is good and what is bad, what is sinful activity?","What is the position of a soul that's in a sacred tree like a fig tree?","What is the purpose? What is the sense, if there is any, or does the very question (Why anything exists?) make sense?","What was that story of Caesar (scissors)?","What will the business of the trustees (for construction of Bombay) be?","Who are we, why are we here and where are we going?","Why is it seen that they (impersonalists) are making spiritual advancement?","Why is that better than loving your fellow man in the traditional bhakti-marga?","Why was it (Hindu-Muslim unity) the programs failed?","Why would someone who is not Krsna conscious have one hundred children? For example, why would someone like Dhrtarastra, who is not particularly Krsna conscious...?","Would, say, the cutting down of a plant, vegetable.... You are killing the growth there. Is that a living matter?","You conclude that when you become enlightened, you will see the God in form of human nature?","You don't think the patients have any mind of their own?","You have inquired about how we leave our body and enter into the Spiritual Sky?","You think we can't help people?","You were very well known in Vrndavana before you came? Because you were writing or…?… Or because of your ambition to come to the West?","You're feeling a little stronger today, Srila Prabhupada?","Your Divine Grace, since religion is one, do you think man will enter into a golden age in which he will accept one God?"],"memories":["Abhirama das Remembers Srila Prabhupada","Adideva das Remembers Srila Prabhupada","Aditi devi dasi Remembers Srila Prabhupada","Amarendra das Remembers Srila Prabhupada","Anada devi dasi Remembers Srila Prabhupada","Anandamaya das Remembers Srila Prabhupada","Anuttama das Remembers Srila Prabhupada","Arjuna das Remembers Srila Prabhupada","Armarendra das Remembers Srila Prabhupada","Atreya Rsi das Remembers Srila Prabhupada","Bala Gopal devi dasi Remembers Srila Prabhupada","Balai devi dasi Remembers Srila Prabhupada","Batu Gopal das Remembers Srila Prabhupada","Bhakta das Remembers Srila Prabhupada","Bhakti Gauravani Goswami Remembers Srila Prabhupada","Bhavatarini devi dasi Remembers Srila Prabhupada","Bhima das Remembers Srila Prabhupada","Bhurijana das Remembers Srila Prabhupada","Brahmatirtha das Remembers Srila Prabhupada","Brajendranandana das Remembers Srila Prabhupada","Candramauli Swami Remembers Srila Prabhupada","Chaitanyachandra das Remembers Srila Prabhupada","Chitralekha devi dasi Remembers Srila Prabhupada","Dadhi-harta das Remembers Srila Prabhupada","Dayanidhi das Remembers Srila Prabhupada","Dhananjaya das Remembers Srila Prabhupada","Dharmatma das Remembers Srila Prabhupada","Dhristadyumna das Remembers Srila Prabhupada","Dhruva Maharaja das Remembers Srila Prabhupada","Dina Bandhu das Remembers Srila Prabhupada","Dinatarine devi dasi Remembers Srila Prabhupada","Dravinaksha das Remembers Srila Prabhupada","Drumila das Remembers Srila Prabhupada","Gadi das Remembers Srila Prabhupada","Gaura das Remembers Srila Prabhupada","Gokulananda das Remembers Srila Prabhupada","Gokularanajana das Remembers Srila Prabhupada","Gopinath Acharya das Remembers Srila Prabhupada","Guru Gauranga das Remembers Srila Prabhupada","Guruprasad das Remembers Srila Prabhupada","Haravapuh das Remembers Srila Prabhupada","Harikesa das Remembers Srila Prabhupada","Jagadisa das Remembers Srila Prabhupada","Jagat Guru Swami Remembers Srila Prabhupada","Jagat Purusa das Remembers Srila Prabhupada","Jahnava devi dasi Remembers Srila Prabhupada","Janaki devi dasi 01 Remembers Srila Prabhupada","Janaki devi dasi Remembers Srila Prabhupada 02","Janananda Swami Remembers Srila Prabhupada","Jaya Jagadish das Remembers Srila Prabhupada","Jivananda das Remembers Srila Prabhupada","Jyestha devi dasi Remembers Srila Prabhupada","Kamalini devi dasi Remembers Srila Prabhupada","Kanti devi dasi Remembers Srila Prabhupada","Karanodakasayi Visnu das Remembers Srila Prabhupada","Kaushalya devi dasi Remembers Srila Prabhupada","Kedara das Remembers Srila Prabhupada","Kesava Bharati Goswami Remembers Srila Prabhupada","Ksudi das Remembers Srila Prabhupada","Kulashekhara das Remembers Srila Prabhupada","Madan Mohan Mohini devi dasi Remembers Srila Prabhupada","Madhava Gosh das Remembers Srila Prabhupada","Maha devi dasi Remembers Srila Prabhupada","Mahakratu das Remembers Srila Prabhupada","Mahamaya devi dasi Remembers Srila Prabhupada","Mahatma das Remembers Srila Prabhupada","Mandapa das Remembers Srila Prabhupada","Mishra Bhagavan das Remembers Srila Prabhupada","Mohan Gopal das Remembers Srila Prabhupada","Mondakini devi dasi Remembers Srila Prabhupada","Nanda devi dasi Remembers Srila Prabhupada","Narahari 02 das Remembers Srila Prabhupada","Nayanabhiram das Remembers Srila Prabhupada","Niranjan das Remembers Srila Prabhupada","Nischintya das Remembers Srila Prabhupada","Pancadravida Swami Remembers Srila Prabhupada","Pavamana das Remembers Srila Prabhupada","Prabhavishnu Swami Remembers Srila Prabhupada","Prafulla devi dasi Remembers Srila Prabhupada","Pragosh das Remembers Srila Prabhupada","Prakashatma das Remembers Srila Prabhupada","Pratapana das Remembers Srila Prabhupada","Radha Krsna das Remembers Srila Prabhupada","Radha Kunda devi dasi Remembers Srila Prabhupada","Radhanatha Swami Remembers Srila Prabhupada","Rajashekar das Remembers Srila Prabhupada","Rambhoru devi dasi Remembers Srila Prabhupada","Ramprasad das Remembers Srila Prabhupada","Ranganath das Remembers Srila Prabhupada","Rangavati devi dasi Remembers Srila Prabhupada","Rucira devi dasi Remembers Srila Prabhupada","Sacinandana Swami Remembers Srila Prabhupada","Sahadevi devi dasi Remembers Srila Prabhupada","Sandamini devi dasi Remembers Srila Prabhupada","Sankarshan das Remembers Srila Prabhupada","Sarupananda das Remembers Srila Prabhupada","Satarupa devi dasi Remembers Srila Prabhupada","Satsvarupa das Goswami Remembers Srila Prabhupada","Satyanarayana das Remembers Srila Prabhupada","Sivananda das Remembers Srila Prabhupada","Sivarama Swami Remembers Srila Prabhupada","Sriniketana das Remembers Srila Prabhupada","Srutadev das Remembers Srila Prabhupada","Suddha Jiva das Remembers Srila Prabhupada","Sukhada devi dasi Remembers Srila Prabhupada","Surabhi das Remembers Srila Prabhupada","Suresvara das Remembers Srila Prabhupada","Susan Witty Remembers Srila Prabhupada","Tamohara das Remembers Srila Prabhupada","Tattvavit das Remembers Srila Prabhupada","Tota Gopinatha das Remembers Srila Prabhupada","Vaishesika das Remembers Srila Prabhupada","Vedamata devi dasi Remembers Srila Prabhupada","Vedavyas das Remembers Srila Prabhupada","Visakha devi dasi Remembers Srila Prabhupada","Vishvadevi devi dasi Remembers Srila Prabhupada","Vrindavan das Remembers Srila Prabhupada","Vrndavenesvari devi dasi Remembers Srila Prabhupada","Yadubara das Remembers Srila Prabhupada","Yogindra Vandana das Remembers Srila Prabhupada"]}; | |||
var hookSelections = Object.create(null); | |||
function shuffleHooks(items) { | |||
var copy = items.slice(); | |||
for (var i = copy.length - 1; i > 0; i--) { | |||
var j = Math.floor(Math.random() * (i + 1)); | |||
var value = copy[i]; copy[i] = copy[j]; copy[j] = value; | |||
} | |||
return copy; | |||
} | |||
function getHookSelection(key) { | |||
if (!Object.prototype.hasOwnProperty.call(hookSelections, key)) { | |||
hookSelections[key] = shuffleHooks(hookPools[key] || []).slice(0, 20); | |||
} | |||
return hookSelections[key]; | |||
} | |||
function populateHookLists(root) { | |||
['questions', 'memories'].forEach(function (key) { | |||
var card = root.querySelector('.vp-portal-card[data-vp-rollout="' + key + '"]'); | |||
var panel = card && card.querySelector('.vp-rollout-panel'); | |||
if (!panel || panel.dataset.vpHooksReady === '1') return; | |||
var fragment = document.createDocumentFragment(); | |||
var heading = document.createElement('span'); | |||
heading.className = 'vp-rollout-heading'; | |||
heading.textContent = key === 'questions' ? 'Questions and Answers' : 'Disciples Remember'; | |||
fragment.appendChild(heading); | |||
var list = document.createElement('span'); | |||
list.className = 'vp-rollout-options'; | |||
function addLink(title, label) { | |||
var row = document.createElement('span'); | |||
var link = document.createElement('a'); | |||
var host = key === 'questions' ? 'https://vaniquotes.org' : ''; | |||
link.href = host + '/wiki/' + encodeURIComponent(title.replace(/ /g, '_')); | |||
link.textContent = label; | |||
link.title = title; | |||
if (key === 'questions') { | |||
link.target = '_blank'; | |||
link.rel = 'noopener noreferrer'; | |||
} | |||
row.appendChild(link); | |||
list.appendChild(row); | |||
} | |||
if (key === 'questions') { | |||
addLink('Category:Questions asked to Srila Prabhupada', 'Browse all questions'); | |||
} else { | |||
addLink('Category:Living Devotees Remembering Srila Prabhupada', 'Browse all remembrances'); | |||
} | |||
getHookSelection(key).forEach(function (title) { | |||
var label = key === 'memories' ? title.replace(/ Remembers Srila Prabhupada$/, '') : title; | |||
addLink(title, label); | |||
}); | |||
fragment.appendChild(list); | |||
// Keep the original panel node and its existing hover/mobile behavior. | |||
panel.innerHTML = ''; | |||
panel.appendChild(fragment); | |||
panel.dataset.vpHooksReady = '1'; | |||
}); | |||
} | |||
/* V189: put the full index first in every other card's rollout too. */ | |||
function putBrowseAllFirst(root) { | |||
var indexes = [ | |||
{ key:'articles', existing:'.vp-article-all', title:'Category:Vanipedia Gemini - Articles', label:'Browse all articles A–Z' }, | |||
{ key:'media', existing:'.vp-media-all', title:'Category:Srila Prabhupada in the Media', label:'Browse all media' }, | |||
{ key:'timeline', title:"Timeline of Srila Prabhupada's Life", label:'Browse the full timeline' }, | |||
{ key:'languages', title:'Category:Participating Languages - Main Pages', label:'Browse all languages' } | |||
]; | |||
indexes.forEach(function (index) { | |||
var card = root.querySelector('.vp-portal-card[data-vp-rollout="' + index.key + '"]'); | |||
var panel = card && card.querySelector('.vp-rollout-panel'); | |||
if (!panel || panel.querySelector('.vp-browse-all')) return; | |||
var row = index.existing && panel.querySelector(index.existing); | |||
if (!row) { | |||
row = document.createElement('span'); | |||
var link = document.createElement('a'); | |||
link.href = '/wiki/' + encodeURIComponent(index.title.replace(/ /g, '_')); | |||
link.textContent = index.label; | |||
row.appendChild(link); | |||
} | |||
row.classList.add('vp-browse-all'); | |||
row.style.display = 'block'; | |||
row.style.margin = '0 0 8px'; | |||
var heading = panel.querySelector('.vp-rollout-heading'); | |||
panel.insertBefore(row, heading ? heading.nextSibling : panel.firstChild); | |||
}); | |||
} | |||
function init() { | |||
var root = document.querySelector("body.page-Main_Page #vani-home.vp-static-home"); | |||
if (!root) return; | |||
populateHookLists(root); | |||
putBrowseAllFirst(root); | |||
if (root.dataset.vpRolloutsReady === "1") return; | |||
root.dataset.vpRolloutsReady = "1"; | |||
var cards = Array.prototype.slice.call(root.querySelectorAll(".vp-portal-card[data-vp-rollout]")); | |||
var mobile = function () { | |||
return window.matchMedia && window.matchMedia("(max-width:700px), (hover:none), (pointer:coarse)").matches; | |||
}; | |||
function setExpanded(card, expanded) { | |||
var toggle = card.querySelector(".vp-rollout-toggle"); | |||
if (toggle) toggle.setAttribute("aria-expanded", expanded ? "true" : "false"); | |||
} | |||
function close(card) { | |||
card.classList.remove("is-open", "is-hover-open"); | |||
var panel = card.querySelector(".vp-rollout-panel"); | |||
if (panel) { | |||
panel.classList.remove("is-viewport-panel"); | |||
panel.style.removeProperty("--vp-panel-top"); | |||
panel.style.removeProperty("--vp-panel-left"); | |||
panel.style.removeProperty("--vp-panel-width"); | |||
if (panel.dataset.vpHooksReady === '1') { | |||
panel.style.removeProperty('max-height'); | |||
panel.style.removeProperty('overflow-y'); | |||
} | |||
} | |||
setExpanded(card, false); | |||
} | |||
function closeOthers(keep) { | |||
cards.forEach(function (card) { if (card !== keep) close(card); }); | |||
} | |||
// V188: keep long random lists attached to the browse control and scroll inside them. | |||
function positionRandomHookPanel(card, panel) { | |||
var key = card.getAttribute('data-vp-rollout'); | |||
if (key !== 'questions' && key !== 'memories') return false; | |||
var toggle = card.querySelector('.vp-rollout-toggle'); | |||
if (!toggle) return false; | |||
var control = toggle.getBoundingClientRect(); | |||
var cardBox = card.getBoundingClientRect(); | |||
var header = document.querySelector('header.vector-header, header.mw-header'); | |||
var footer = document.getElementById('vh-bottom-bar'); | |||
var topLimit = 12; | |||
var bottomLimit = window.innerHeight - 76; | |||
if (header) { | |||
var headerBox = header.getBoundingClientRect(); | |||
if (headerBox.top < window.innerHeight && headerBox.bottom > 0) { | |||
topLimit = Math.max(topLimit, headerBox.bottom + 8); | |||
} | |||
} | |||
if (footer) { | |||
var footerBox = footer.getBoundingClientRect(); | |||
if (footerBox.top > topLimit && footerBox.top < window.innerHeight) { | |||
bottomLimit = footerBox.top - 8; | |||
} | |||
} | |||
var below = Math.max(0, bottomLimit - control.bottom); | |||
var above = Math.max(0, control.top - topLimit); | |||
var openBelow = below >= 120 || below >= above; | |||
var room = openBelow ? below : above; | |||
var height = Math.min(420, room); | |||
var width = Math.min(panel.getBoundingClientRect().width || 290, window.innerWidth - 24); | |||
var left = Math.max(12, Math.min(cardBox.left, window.innerWidth - width - 12)); | |||
panel.style.setProperty('max-height', height + 'px', 'important'); | |||
panel.style.setProperty('overflow-y', 'auto', 'important'); | |||
var actualHeight = Math.min(panel.getBoundingClientRect().height, height); | |||
var top = openBelow ? control.bottom : control.top - actualHeight; | |||
top = Math.max(topLimit, Math.min(top, bottomLimit - actualHeight)); | |||
panel.style.setProperty('--vp-panel-width', width + 'px'); | |||
panel.style.setProperty('--vp-panel-left', left + 'px'); | |||
panel.style.setProperty('--vp-panel-top', top + 'px'); | |||
return true; | |||
} | |||
function place(card) { | |||
var panel = card.querySelector(".vp-rollout-panel"); | |||
if (!panel || mobile() || (!card.classList.contains("is-open") && !card.classList.contains("is-hover-open"))) return; | |||
panel.classList.add("is-viewport-panel"); | |||
if (positionRandomHookPanel(card, panel)) return; | |||
var anchor = card.getBoundingClientRect(); | |||
var width = Math.min(panel.getBoundingClientRect().width || 290, window.innerWidth - 24); | |||
var height = panel.getBoundingClientRect().height || 280; | |||
var topLimit = 12; | |||
var bottomLimit = window.innerHeight - 76; | |||
var side = card.getAttribute("data-vp-rollout-side"); | |||
var left; | |||
var top; | |||
if (side === "left" || side === "right") { | |||
var preferredLeft = side === "left" ? anchor.left - width : anchor.right; | |||
left = Math.max(12, Math.min(preferredLeft, window.innerWidth - width - 12)); | |||
top = Math.max(topLimit, Math.min(anchor.top, bottomLimit - height)); | |||
} else { | |||
left = Math.max(12, Math.min(anchor.left, window.innerWidth - width - 12)); | |||
var below = bottomLimit - anchor.bottom; | |||
var above = anchor.top - topLimit; | |||
if (height <= below) top = anchor.bottom; | |||
else if (height <= above) top = anchor.top - height; | |||
else top = Math.max(topLimit, Math.min(anchor.bottom, bottomLimit - height)); | |||
} | |||
panel.style.setProperty("--vp-panel-width", width + "px"); | |||
panel.style.setProperty("--vp-panel-left", left + "px"); | |||
panel.style.setProperty("--vp-panel-top", top + "px"); | |||
} | |||
function open(card, mode) { | |||
closeOthers(card); | |||
card.classList.toggle("is-hover-open", mode === "hover"); | |||
card.classList.toggle("is-open", mode === "pinned"); | |||
setExpanded(card, true); | |||
window.requestAnimationFrame(function () { place(card); }); | |||
} | |||
cards.forEach(function (card) { | |||
if (card.dataset.vpRolloutReady === "1") return; | |||
card.dataset.vpRolloutReady = "1"; | |||
var toggle = card.querySelector(".vp-rollout-toggle"); | |||
if (!toggle) return; | |||
card.addEventListener("pointerdown", function (event) { | |||
card.dataset.pointerTriggeredFocus = event.pointerType || "pointer"; | |||
window.setTimeout(function () { delete card.dataset.pointerTriggeredFocus; }, 0); | |||
}); | |||
card.addEventListener("pointerenter", function (event) { | |||
if (event.pointerType === "mouse" && !mobile() && !card.classList.contains("is-open")) open(card, "hover"); | |||
}); | |||
card.addEventListener("pointerleave", function (event) { | |||
if (card.contains(event.relatedTarget)) return; | |||
if (card.classList.contains("is-open") || card.contains(document.activeElement)) return; | |||
close(card); | |||
}); | |||
card.addEventListener("focusin", function () { | |||
if (!card.classList.contains("is-open")) open(card, "hover"); | |||
}); | |||
card.addEventListener("focusout", function () { | |||
window.setTimeout(function () { | |||
if (!card.contains(document.activeElement) && !card.matches(":hover")) close(card); | |||
}, 0); | |||
}); | |||
toggle.addEventListener("click", function (event) { | |||
event.preventDefault(); | |||
var wasPinned = card.classList.contains("is-open"); | |||
if (wasPinned) close(card); | |||
else open(card, "pinned"); | |||
}); | |||
toggle.addEventListener("keydown", function (event) { | |||
if (event.key === "Enter" || event.key === " ") { | |||
event.preventDefault(); | |||
if (card.classList.contains("is-open")) close(card); | |||
else open(card, "pinned"); | |||
} else if (event.key === "Escape") { | |||
close(card); | |||
toggle.blur(); | |||
} | |||
}); | |||
}); | |||
document.addEventListener("pointerdown", function (event) { | |||
if (root.contains(event.target)) return; | |||
cards.forEach(close); | |||
}); | |||
document.addEventListener("keydown", function (event) { | |||
if (event.key === "Escape") cards.forEach(close); | |||
}); | |||
function repositionOpen() { | |||
cards.forEach(function (card) { | |||
if (card.classList.contains("is-open") || card.classList.contains("is-hover-open")) place(card); | |||
}); | |||
} | |||
window.addEventListener("resize", repositionOpen, { passive: true }); | |||
window.addEventListener("scroll", repositionOpen, { passive: true, capture: true }); | |||
} | |||
if (document.readyState === "loading") document.addEventListener("DOMContentLoaded", init); | |||
else init(); | |||
if (window.mw && mw.hook) mw.hook("wikipage.content").add(init); | |||
})(); | |||
/* V182: restore original desktop Vanipedia top-bar branding and sister-petal links. */ | |||
/* ========================================================== | |||
/* ========================================================== | |||
/* ========================================================== | |||
/* ========================================================== | |||
/* ========================================================== | |||
VANIPEDIA TOP BAR CONTROLLER (Step 172: Guaranteed Vanipedia Title & Icons on Mobile) | |||
========================================================== */ | |||
(function() { | |||
var titleText = "VANIPEDIA - ŚRĪLA PRABHUPĀDA'S VANI-TEMPLE"; | |||
var targetUrl = "https://vanipedia.org"; | |||
function removeGlobalSiteNotice() { | |||
$('#siteNotice, #localNotice, .vector-sitenotice-container, #mainbanner, .sitenotice, .mw-sitenotice, .anonnotice, .dismissable-notice, #centralNotice').remove(); | |||
} | |||
function createHomeLink() { | |||
var homeSvg = '<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M3 9l9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"></path><polyline points="9 22 9 12 15 12 15 22"></polyline></svg>'; | |||
return $('<a>', { | |||
id: 'vanipedia-topbar-home-link', | |||
href: '/', | |||
title: 'Vanipedia Home / Entry Portal', | |||
'aria-label': 'Home', | |||
class: 'vanipedia-topbar-home' | |||
}).html('<span class="vanipedia-home-icon">' + homeSvg + '</span><span class="vanipedia-home-text">Home</span>'); | |||
} | |||
function createCenterBlock() { | |||
var blockStyle = 'position:absolute !important; left:50% !important; top:54% !important; transform:translate(-50%, -50%) !important; display:flex !important; flex-direction:column !important; align-items:center !important; justify-content:center !important; text-align:center !important; white-space:nowrap !important; z-index:10 !important; pointer-events:auto !important;'; | |||
var titleStyle = 'position:static !important; transform:none !important; display:block !important; font-family:"Cinzel", Georgia, serif !important; font-size:18px !important; font-weight:700 !important; letter-spacing:2px !important; color:#f5d77f !important; text-decoration:none !important; text-shadow:0 2px 4px rgba(0,0,0,0.9), 0 0 10px rgba(245,215,127,0.3) !important; line-height:1.25 !important; margin:0 0 4px 0 !important; padding:0 !important; user-select:text !important;'; | |||
var vanisevaWrapStyle = 'position:static !important; transform:none !important; display:block !important; margin:0 0 4px 0 !important; line-height:1.2 !important;'; | |||
var vanisevaLinkStyle = 'color:#f5d77f !important; font-family:"Noto Serif", Georgia, serif !important; font-size:12.5px !important; font-style:normal !important; font-weight:500 !important; letter-spacing:0.35px !important; text-decoration:none !important; border:0 !important; background:none !important; outline:none !important; padding:0 !important; border-radius:0 !important; cursor:pointer !important; display:inline-block !important; transition:all 0.18s ease !important;box-shadow:none !important;'; | |||
var sisterWrapStyle = 'position:static !important; transform:none !important; display:flex !important; align-items:center !important; justify-content:center !important; gap:14px !important; margin:0 !important; line-height:1.2 !important;'; | |||
var sisterLinkStyle = 'color:#f5d77f !important; font-family:"Noto Serif", Georgia, serif !important; font-size:13px !important; font-weight:600 !important; letter-spacing:0.4px !important; text-decoration:none !important; border:none !important; border-bottom:none !important; outline:none !important; padding:2px 8px !important; border-radius:3px !important; display:inline-flex !important; align-items:center !important; cursor:pointer !important; transition:all 0.18s ease !important;'; | |||
var sepStyle = 'color:rgba(245,215,127,0.4) !important; font-size:11px !important; line-height:1 !important; user-select:none !important;'; | |||
var $block = $('<div>', { | |||
id: 'vanipedia-topbar-center-block', | |||
class: 'vanipedia-topbar-center-block', | |||
style: blockStyle | |||
}); | |||
var $title = $('<div>', { | |||
id: 'vanipedia-topbar-title', | |||
class: 'vanipedia-topbar-main-title', | |||
style: titleStyle, | |||
text: titleText | |||
}); | |||
var $vaniseva = $('<div>', { | |||
class: 'vanipedia-topbar-vaniseva-title', | |||
style: vanisevaWrapStyle | |||
}).html('<a href="https://vaniseva.org" target="_blank" rel="noopener noreferrer" title="Vaniseva" style="' + vanisevaLinkStyle + '">Collaborate with us to invoke and fully manifest Śrīla Prabhupāda's Vani-presence</a>'); | |||
var $sisterLinks = $('<div>', { | |||
class: 'vanipedia-topbar-sister-links', | |||
style: sisterWrapStyle | |||
}).html( | |||
'<a href="https://vanisource.org" target="_blank" rel="noopener noreferrer" class="vanipedia-topbar-sister-link" title="Vanisource" style="' + sisterLinkStyle + '">vanisource.org</a>' + | |||
'<span class="vanipedia-topbar-sister-sep" aria-hidden="true" style="' + sepStyle + '">•</span>' + | |||
'<a href="https://vaniquotes.org" target="_blank" rel="noopener noreferrer" class="vanipedia-topbar-sister-link" title="Vaniquotes" style="' + sisterLinkStyle + '">vaniquotes.org</a>' + | |||
'<span class="vanipedia-topbar-sister-sep" aria-hidden="true" style="' + sepStyle + '">•</span>' + | |||
'<a href="https://vanimedia.org" target="_blank" rel="noopener noreferrer" class="vanipedia-topbar-sister-link" title="Vanimedia" style="' + sisterLinkStyle + '">vanimedia.org</a>' | |||
); | |||
$block.append($title, $vaniseva, $sisterLinks); | |||
return $block; | |||
} | |||
function updateTopBar() { | |||
removeGlobalSiteNotice(); | |||
$('#vanipedia-topbar-center-block, #vanipedia-topbar-center-block-mobile, #vanipedia-topbar-title, #vanipedia-topbar-title-mobile, #vanipedia-topbar-title-link, #vanipedia-topbar-center-title, #vanipedia-topbar-home-link, #vanipedia-topbar-sister-links, #vanipedia-topbar-sister-links-mobile, .vanipedia-topbar-sister-links, .vanipedia-topbar-center-block').remove(); | |||
$('.vector-header-container').css({ | |||
'background': 'transparent', | |||
'background-color': 'transparent', | |||
'border': 'none', | |||
'box-shadow': 'none', | |||
'padding': '0', | |||
'margin': '0', | |||
'min-height': '0', | |||
'height': 'auto', | |||
'width': '100%', | |||
'max-width': '100%' | |||
}); | |||
var isMobile = (window.innerWidth <= 999) || $('body').hasClass('skin-minerva') || $('body').hasClass('skin-vector-mobile') || $('.minerva-header').length > 0; | |||
var $header = $('header.mw-header, header.vector-header').not('.minerva-header').first(); | |||
if (!$header.length && !$('body').hasClass('skin-minerva') && !$('.minerva-header').length) { | |||
$header = $('#mw-head, header').not('.minerva-header').filter(':visible').first(); | |||
} | |||
if ($header.length) { | |||
$header.css({ | |||
'min-height': isMobile ? '52px' : '86px', | |||
'height': isMobile ? '52px' : 'auto', | |||
'max-height': isMobile ? '52px' : 'none', | |||
'padding': isMobile ? '0 10px' : '10px 24px', | |||
'background-color': '#345B63', | |||
'border-bottom': '2px solid #b1873d', | |||
'box-shadow': '0 4px 18px rgba(0,0,0,0.35)', | |||
'position': 'relative', | |||
'display': 'flex', | |||
'flex-wrap': 'nowrap', | |||
'align-items': 'center', | |||
'justify-content': 'space-between', | |||
'box-sizing': 'border-box', | |||
'width': '100%', | |||
'max-width': '100%' | |||
}); | |||
if (!isMobile) { | |||
$header.append(createCenterBlock()); | |||
} | |||
var $search = $header.find('.vector-header-start #p-search, #p-search'); | |||
if ($search.length) { | |||
$search.after(createHomeLink()); | |||
} else if ($header.find('.vector-header-start').length) { | |||
$header.find('.vector-header-start').append(createHomeLink()); | |||
} | |||
} | |||
var $minervaHeader = $('.minerva-header'); | |||
if ($minervaHeader.length) { | |||
// 1. Ensure "Vanipedia" Title Link exists with text in the branding box | |||
var $branding = $minervaHeader.find('.branding-box'); | |||
if ($branding.length) { | |||
var $brandLink = $branding.find('a'); | |||
if ($brandLink.length) { | |||
if (!$brandLink.text().trim()) { | |||
$brandLink.html('<span>Vanipedia</span>'); | |||
} | |||
} else { | |||
$branding.html('<a href="/wiki/Main_Page"><span>Vanipedia</span></a>'); | |||
} | |||
} else { | |||
var brandHtml = '<div class="branding-box"><a href="/wiki/Main_Page"><span>Vanipedia</span></a></div>'; | |||
var $burger = $minervaHeader.find('#mw-mf-main-menu-button, .navigation-drawer.toggle-list').first(); | |||
if ($burger.length) { | |||
$burger.after(brandHtml); | |||
} else { | |||
$minervaHeader.prepend(brandHtml); | |||
} | |||
} | |||
// 2. Ensure Home Link is inserted cleanly | |||
var $minervaForm = $minervaHeader.find('.minerva-search-form, #searchform').first(); | |||
if ($minervaForm.length && !$minervaHeader.find('#vanipedia-topbar-home-link').length) { | |||
$minervaForm.before(createHomeLink()); | |||
} else if (!$minervaHeader.find('#vanipedia-topbar-home-link').length) { | |||
var $minervaUser = $minervaHeader.find('.minerva-user-navigation, #ca-mytalks').first(); | |||
if ($minervaUser.length) { | |||
$minervaUser.before(createHomeLink()); | |||
} else { | |||
$minervaHeader.append(createHomeLink()); | |||
} | |||
} | |||
$minervaHeader.css({ | |||
'flex-wrap': 'nowrap', | |||
'height': '52px', | |||
'min-height': '52px', | |||
'max-height': '52px', | |||
'padding': '0 10px', | |||
'display': 'flex', | |||
'align-items': 'center', | |||
'justify-content': 'space-between', | |||
'box-sizing': 'border-box' | |||
}); | |||
} | |||
var $stageHeader = $('#vani-stage-header-slot'); | |||
if ($stageHeader.length && !$stageHeader.find('.vanipedia-topbar-center-block').length) { | |||
var $stageSearch = $stageHeader.find('#p-search, .search-box, .minerva-search-form').first(); | |||
if ($stageSearch.length && !$stageHeader.find('#vanipedia-topbar-home-link').length) { | |||
$stageSearch.after(createHomeLink()); | |||
} | |||
if (!isMobile) { | |||
$stageHeader.append(createCenterBlock()); | |||
} | |||
} | |||
var $stickyTitle = $('#vector-sticky-header .vector-sticky-header-title, #vector-sticky-header .vector-sticky-header-context-bar .mw-headline'); | |||
if ($stickyTitle.length) { | |||
$stickyTitle.html('<a href="' + targetUrl + '" style="color: inherit; text-decoration: none;">' + titleText + '</a>'); | |||
} | |||
} | |||
$(function() { | |||
removeGlobalSiteNotice(); | |||
}); | |||
var topbarResizeTimer; | |||
var lastVanipediaTopWidth = window.innerWidth; | |||
$(window).on('resize orientationchange', function() { | |||
if (Math.abs(window.innerWidth - lastVanipediaTopWidth) < 10) return; | |||
lastVanipediaTopWidth = window.innerWidth; | |||
clearTimeout(topbarResizeTimer); | |||
topbarResizeTimer = setTimeout(updateTopBar, 150); | |||
}); | |||
$(document).ready(updateTopBar); | |||
if (window.mw && mw.hook) { | |||
mw.hook('wikipage.content').add(updateTopBar); | |||
} | |||
})(); | |||
// ========================================================================== | |||
/* 2026-11-11 (Vamshi Krishna): keep the header and footer from overlapping at in-between widths. | |||
- Header: if the centre block (site title, Vaniseva line, petal links) would run over the search box, | |||
Home link or user links, it moves into the free space between them, shrinking a little if needed, | |||
then shows only the petal name, and is hidden only if even that doesn't fit (2026-11-12). | |||
- Footer: on wide screens the social icons are hidden when they would cover Donate, and the links | |||
are centred. On narrow screens the right edge of the links fades while more are off-screen. | |||
The skin sets these styles inline with !important (and re-applies the footer layout on every resize), so | |||
this runs after it, and Common.css cannot override them. */ | |||
(function () { | |||
function leaves(el) { | |||
var out = []; | |||
el.querySelectorAll('*').forEach(function (e) { | |||
if (!e.children.length) { | |||
var r = e.getBoundingClientRect(); | |||
if (r.width && r.height) out.push(r); | |||
} | |||
}); | |||
return out; | |||
} | |||
function clash(a, b) { | |||
for (var x = 0; x < a.length; x++) { | |||
for (var y = 0; y < b.length; y++) { | |||
var r = a[x], s = b[y]; | |||
if (Math.min(r.right, s.right) - Math.max(r.left, s.left) > 0 && | |||
Math.min(r.bottom, s.bottom) - Math.max(r.top, s.top) > 2) return true; | |||
} | |||
} | |||
return false; | |||
} | |||
function fixMidWidths() { | |||
var w = window.innerWidth; | |||
var header = document.querySelector('header.vector-header, header.mw-header'); | |||
document.querySelectorAll('.vanipedia-topbar-center-block').forEach(function (b) { | |||
var title = b.querySelector('.vanipedia-topbar-main-title'); | |||
if (title && !title.dataset.fullTitle) title.dataset.fullTitle = title.textContent; | |||
if (title) title.textContent = title.dataset.fullTitle; | |||
// Start from the skin's own position each time (Vanisource keeps the same block between resizes). | |||
if (!b.dataset.fitInit) { | |||
b.dataset.fitInit = '1'; | |||
b.dataset.fitTransform = b.style.getPropertyValue('transform'); | |||
} | |||
if (b.dataset.fitTransform) b.style.setProperty('transform', b.dataset.fitTransform, 'important'); | |||
else b.style.removeProperty('transform'); | |||
b.style.setProperty('display', 'flex', 'important'); | |||
if (w < 1000 || !header) return; | |||
var theirs = []; | |||
header.querySelectorAll('#p-search, #vanipedia-topbar-home-link, .vector-header-end').forEach(function (e) { | |||
if (!b.contains(e)) theirs = theirs.concat(leaves(e)); | |||
}); | |||
if (clash(leaves(b), theirs)) b.style.setProperty('display', 'none', 'important'); | |||
}); | |||
var bar = document.getElementById('vh-bottom-bar'); | |||
if (!bar) return; | |||
var left = bar.querySelector('.vh-bottom-bar-left-space'); | |||
var right = bar.querySelector('.vh-bottom-bar-right-space'); | |||
var inner = bar.querySelector('.vh-bottom-bar-inner'); | |||
var nav = bar.querySelector('.vh-bottom-nav-links'); | |||
var social = bar.querySelector('.vh-bottom-social-links'); | |||
if (!left || !right || !inner || !nav || !social) return; | |||
// The icons measure 0 px until their images load, so check again once they have. | |||
bar.querySelectorAll('img').forEach(function (img) { | |||
if (!img.complete && !img.dataset.fixBound) { | |||
img.dataset.fixBound = '1'; | |||
img.addEventListener('load', schedule); | |||
} | |||
}); | |||
if (w >= 1000) { | |||
// The footer is kept between resizes here, so clear a fade left over from a narrow window. | |||
nav.style.removeProperty('-webkit-mask-image'); | |||
nav.style.removeProperty('mask-image'); | |||
var nr = nav.getBoundingClientRect(), sr = social.getBoundingClientRect(); | |||
if (sr.width && (nr.right + 8 > sr.left || sr.right > w)) { | |||
left.style.setProperty('display', 'none', 'important'); | |||
right.style.setProperty('display', 'none', 'important'); | |||
inner.style.setProperty('justify-content', 'center', 'important'); | |||
} | |||
return; | |||
} | |||
var updateFade = function () { | |||
var more = nav.scrollLeft + nav.clientWidth < nav.scrollWidth - 2; | |||
var mask = more ? 'linear-gradient(to right, #000 calc(100% - 40px), transparent)' : 'none'; | |||
nav.style.setProperty('-webkit-mask-image', mask, 'important'); | |||
nav.style.setProperty('mask-image', mask, 'important'); | |||
}; | |||
updateFade(); | |||
if (!nav.dataset.fadeBound) { | |||
nav.dataset.fadeBound = '1'; | |||
nav.addEventListener('scroll', updateFade, { passive: true }); | |||
} | |||
} | |||
var pending; | |||
// Run after the skin's own header and footer setup (which re-runs on resize and 150 ms after it). | |||
function schedule() { clearTimeout(pending); pending = setTimeout(fixMidWidths, 300); } | |||
$(schedule); | |||
$(window).on('resize orientationchange', schedule); | |||
// This script often starts after the page has loaded, so also re-check when the fonts are ready. | |||
if (document.fonts && document.fonts.ready) document.fonts.ready.then(schedule); | |||
})(); | |||
/* VaniSearch Popup Launcher + Desktop Burger Restore */ | |||
(function() { | |||
var lockPopupSubmitUntil = 0; | |||
function ensureBurgerMenu() { | |||
var nodes = document.querySelectorAll('.vector-feature-main-menu-pinned-enabled, .vector-feature-main-menu-pinned-clientpref-1'); | |||
for (var i = 0; i < nodes.length; i++) { | |||
nodes[i].classList.remove('vector-feature-main-menu-pinned-enabled', 'vector-feature-main-menu-pinned-clientpref-1'); | |||
nodes[i].classList.add('vector-feature-main-menu-pinned-disabled', 'vector-feature-main-menu-pinned-clientpref-0'); | |||
} | |||
var dropdown = document.getElementById('vector-main-menu-dropdown'); | |||
var header = document.querySelector('header.vector-header, header.mw-header'); | |||
var start = header ? header.querySelector('.vector-header-start') : document.querySelector('.vector-header-start'); | |||
if (dropdown && start && dropdown.parentNode !== start) { | |||
start.insertBefore(dropdown, start.firstChild); | |||
} | |||
var menu = document.getElementById('vector-main-menu'); | |||
var unpinned = document.getElementById('vector-main-menu-unpinned-container') || | |||
(dropdown ? dropdown.querySelector('.vector-dropdown-content') : null); | |||
if (menu && unpinned) { | |||
menu.classList.remove('vanipedia-sidebar-menu', 'vanipedia-collapsed'); | |||
if (!unpinned.contains(menu)) { | |||
unpinned.appendChild(menu); | |||
} | |||
} | |||
} | |||
window.open_modal = function() { | |||
var ori = document.getElementById('ori_search') || document.getElementById('searchInput'); | |||
var modal = document.getElementById('mspu_div_wrapper'); | |||
var inpSearch = document.getElementById('mspu_txt_input'); | |||
var submitBtn = document.getElementById('mspu_but_submit'); | |||
if (!modal || !inpSearch) return false; | |||
lockPopupSubmitUntil = Date.now() + 500; | |||
if (submitBtn) { | |||
submitBtn.disabled = true; | |||
setTimeout(function() { submitBtn.disabled = false; }, 500); | |||
} | |||
if (typeof window.sync_but_search === 'function') { | |||
try { window.sync_but_search(); } catch (e) {} | |||
} | |||
if (ori) { | |||
inpSearch.value = ori.value; | |||
ori.blur(); | |||
} | |||
modal.style.display = 'block'; | |||
setTimeout(function() { | |||
inpSearch.focus(); | |||
}, 250); | |||
return false; | |||
}; | |||
function protectModalForm() { | |||
var modal = document.getElementById('mspu_div_wrapper'); | |||
if (!modal || modal.dataset.vaniHardLocked) return; | |||
modal.dataset.vaniHardLocked = 'true'; | |||
var strayBtns = modal.querySelectorAll('.vani-search-trigger-btn'); | |||
for (var i = 0; i < strayBtns.length; i++) { | |||
if (strayBtns[i].parentNode) strayBtns[i].parentNode.removeChild(strayBtns[i]); | |||
} | |||
var mForm = modal.querySelector('form'); | |||
if (mForm) { | |||
mForm.addEventListener('submit', function(e) { | |||
if (Date.now() < lockPopupSubmitUntil) { | |||
e.preventDefault(); | |||
e.stopPropagation(); | |||
e.stopImmediatePropagation(); | |||
return false; | |||
} | |||
}, true); | |||
} | |||
var inpSearch = document.getElementById('mspu_txt_input'); | |||
if (inpSearch) { | |||
['keydown', 'keypress', 'keyup'].forEach(function(evt) { | |||
inpSearch.addEventListener(evt, function(e) { | |||
if (Date.now() < lockPopupSubmitUntil && (e.key === 'Enter' || e.keyCode === 13)) { | |||
e.preventDefault(); | |||
e.stopPropagation(); | |||
e.stopImmediatePropagation(); | |||
return false; | |||
} | |||
}, true); | |||
}); | |||
} | |||
} | |||
function buildCleanSearchBox(oldElement, isMobile) { | |||
var wrap = document.createElement('div'); | |||
wrap.className = isMobile ? 'vani-mobile-search-wrap' : 'vani-desktop-search-wrap'; | |||
wrap.style.cssText = 'flex: 1 1 auto; width: 100%; max-width: 280px; display: flex !important; align-items: center !important; position: relative !important; margin: 0; z-index: 999999 !important;'; | |||
var inp = document.createElement('input'); | |||
inp.type = 'text'; | |||
inp.id = 'ori_search'; | |||
inp.className = 'vani-clean-search-input'; | |||
inp.placeholder = 'Search Vanipedia'; | |||
inp.autocomplete = 'off'; | |||
inp.style.cssText = 'width:100% !important; height:32px !important; background:#1f3e45 !important; background-image:none !important; color:#ffffff !important; -webkit-text-fill-color:#ffffff !important; border:1.5px solid #f5d77f !important; border-radius:16px !important; padding:2px 32px 2px 12px !important; font-size:15px !important; outline:none !important; box-sizing:border-box !important;'; | |||
var btn = document.createElement('button'); | |||
btn.type = 'button'; | |||
btn.className = 'vani-inline-go'; | |||
btn.innerHTML = '🔍'; | |||
btn.style.cssText = 'position:absolute !important; right:8px !important; top:50% !important; transform:translateY(-50%) !important; background:none !important; border:none !important; font-size:15px !important; cursor:pointer !important; padding:0 !important; line-height:1 !important; z-index:20 !important;'; | |||
['click', 'focus', 'focusin', 'touchstart', 'input', 'keypress'].forEach(function(evtType) { | |||
inp.addEventListener(evtType, function(e) { | |||
e.stopPropagation(); | |||
}, true); | |||
}); | |||
inp.addEventListener('keydown', function(e) { | |||
e.stopPropagation(); | |||
if (e.key === 'Enter' || e.keyCode === 13) { | |||
e.preventDefault(); | |||
e.stopImmediatePropagation(); | |||
window.open_modal(); | |||
} | |||
}, true); | |||
btn.addEventListener('click', function(e) { | |||
e.preventDefault(); | |||
e.stopPropagation(); | |||
e.stopImmediatePropagation(); | |||
window.open_modal(); | |||
}, true); | |||
wrap.appendChild(inp); | |||
wrap.appendChild(btn); | |||
if (oldElement.parentNode) { | |||
oldElement.parentNode.replaceChild(wrap, oldElement); | |||
} | |||
} | |||
function setupAllSearchBars() { | |||
ensureBurgerMenu(); | |||
protectModalForm(); | |||
var minervaHeader = document.querySelector('.minerva-header'); | |||
if (minervaHeader) { | |||
document.documentElement.classList.remove('overlay-enabled'); | |||
document.body.classList.remove('search-enabled', 'overlay-enabled'); | |||
var b = minervaHeader.querySelector('.branding-box'); | |||
if (b) b.style.setProperty('display', 'none', 'important'); | |||
var mForm = minervaHeader.querySelector('form.minerva-search-form, form#searchform'); | |||
if (mForm && !minervaHeader.querySelector('.vani-mobile-search-wrap')) { | |||
buildCleanSearchBox(mForm, true); | |||
} | |||
} | |||
if (!document.querySelector('.vani-desktop-search-wrap') && !minervaHeader) { | |||
var pSearch = document.querySelector('#p-search'); | |||
if (pSearch && !pSearch.dataset.vaniDetached) { | |||
var cleanPSearch = pSearch.cloneNode(true); | |||
cleanPSearch.dataset.vaniDetached = 'true'; | |||
cleanPSearch.classList.add('vector-search-box-show-thumbnail'); | |||
var toggle = cleanPSearch.querySelector('.search-toggle'); | |||
if (toggle && toggle.parentNode) toggle.parentNode.removeChild(toggle); | |||
if (pSearch.parentNode) pSearch.parentNode.replaceChild(cleanPSearch, pSearch); | |||
} | |||
var dTarget = document.querySelector('form#searchform, #p-search form, .vector-search-box form'); | |||
if (!dTarget) { | |||
var rawInput = document.querySelector('#ori_search, #searchInput, input[type="search"]'); | |||
if (rawInput && !rawInput.closest('#mspu_div_wrapper') && !rawInput.classList.contains('vani-clean-search-input')) { | |||
dTarget = rawInput.closest('form') || rawInput.parentElement; | |||
} | |||
} | |||
if (dTarget && !dTarget.closest('#mspu_div_wrapper')) { | |||
buildCleanSearchBox(dTarget, false); | |||
} | |||
} | |||
} | |||
if (document.readyState === 'loading') { | |||
document.addEventListener('DOMContentLoaded', setupAllSearchBars); | |||
} else { | |||
setupAllSearchBars(); | |||
} | |||
setTimeout(setupAllSearchBars, 200); | |||
setTimeout(setupAllSearchBars, 700); | |||
})(); | |||
Latest revision as of 00:26, 14 November 2026
/* V176: remove legacy decorative cursor if it was left by cached site code. */
(function restoreNativeMainPageCursor() {
function clean() {
if (!document.body || !document.body.classList.contains("page-Main_Page")) return;
var cursor = document.getElementById("vh-cursor-pointer");
if (cursor) cursor.remove();
var injected = document.getElementById("vh-kill-windows-cursor");
if (injected) injected.remove();
document.body.classList.remove("vh-cursor-link", "vh-cursor-click");
}
if (document.readyState === "loading") document.addEventListener("DOMContentLoaded", clean);
else clean();
})();
/* Any JavaScript here will be loaded for all users on every page load. */
if (mw.config.get('wgPageName' ) === 'Krishna_says_in_Bhagavad-gita') {
/* switch tooltip texts from content-div to label-div */
const v_labels = Array.from(document.getElementsByClassName("tabs-label"));
const v_content = Array.from(document.getElementsByClassName("tabs-content"));
for (var i = 0; i < v_labels.length; i++) {
v_labels[i].title = v_content[i].title;
v_content[i].title = "";
}
/* adjust wikitables */
var arr = Array.from(document.getElementsByClassName("wikitable"));
for (var t = 0; t < arr.length; t++) {
/* insert THEAD in wikitable */
var thead = document.createElement("thead");
thead.style.display = "block";
var wtbl = arr[t];
wtbl.insertBefore(thead, wtbl.firstChild);
/* move first row of TBODY to THEAD */
thead.appendChild(wtbl.rows[0]);
/* make TBODY scrollable */
var tbody = wtbl.tBodies[0];
tbody.style.display = "block";
tbody.style.overflowY = "auto";
tbody.style.maxHeight = "500px";
for (var r = 0; r < wtbl.rows.length; r++) {
var row = wtbl.rows[r];
/* adjust column widths and hide from-until columns */
row.cells[0].classList = "cw_0";
row.cells[1].classList = "cw_150";
row.cells[2].classList = "cw_500";
/* mark the text */
if (r == 0) continue;
var v_text = row.cells[2].textContent;
var v_html = ""; var v_from = 0;
var marks = JSON.parse(row.cells[0].textContent.replaceAll("O", "[").replaceAll("C", "]"));
for (var m = 0; m < marks.length; m++) {
v_html +=
v_text.substr(v_from,marks[m][0]-v_from) + "<mark>" +
v_text.substr(marks[m][0],marks[m][1]-marks[m][0]+1) + "</mark>";
v_from = marks[m][1]+1;
}
v_html += v_text.substr(v_from);
row.cells[2].innerHTML = v_html;
}
}
}
// install Google Search
// document.write('<script type="text/javascript" src="'
// + 'http://vanipedia.org/w/index.php?title=MediaWiki:GoogleSearch.js'
// + '&action=raw&ctype=text/javascript"></' + 'script>');
// install JQuery
//document.write('<script type="text/javascript" src="'
//+ 'http://vanipedia.org/w/index.php?title=MediaWiki:JQuery.js'
//+ '&action=raw&ctype=text/javascript"></' + 'script>');
// install WikEd toolbar and Vanify
//document.write('<script type="text/javascript" src="'
//+ 'http://vanipedia.org/w/index.php?title=MediaWiki:Vaniquotes.js'
//+ '&action=raw&ctype=text/javascript"></' + 'script>');
// install Replace
//document.write('<script type="text/javascript" src="'
//+ 'http://vanipedia.org/w/index.php?title=MediaWiki:TextboxReplace.js'
//+ '&action=raw&ctype=text/javascript"></' + 'script>');
// install Unify
//document.write('<script type="text/javascript" src="'
//+ 'http://vanipedia.org/w/index.php?title=MediaWiki:Unify.js'
//+ '&action=raw&ctype=text/javascript"></' + 'script>');
// install Vanify
//document.write('<script type="text/javascript" src="'
//+ 'http://vanipedia.org/w/index.php?title=MediaWiki:Vanify.js'
//+ '&action=raw&ctype=text/javascript"></' + 'script>');
// install Vani_suggest for diacritics auto-suggest pulldown on the search bar
//document.write('<script type="text/javascript" src="'
//+ 'http://vanipedia.org/w/index.php?title=MediaWiki:Vani_suggest.js'
//+ '&action=raw&ctype=text/javascript"></' + 'script>');
// install previous/next links for video categories in all languages
//document.write('<script type="text/javascript" src="/navcat/navcat.js"></' + 'script>');
// Buttons
//addOnloadHook(function() {
//if (document.editform) {
//addPortletLink("p-cactions", "javascript:Unify()", "unify", "ca-unify", "Convert Balarama fonts to Unicode", "");
// addPortletLink("p-cactions", "javascript:Vanify()", "vanify", "ca-vanify", "Corrects vani markup", "");
// addPortletLink('p-cactions', 'javascript:format()', 'format', 'ca-format', 'Format article', '');
//addPortletLink('p-cactions', 'javascript:wpTextboxReplace()', 'Replace', 'ca-replace', 'Replaces text in the edit window', 'R');
//}
//});
// end Buttons
// --- YouTube Random Shorts (Kasya) ---
$(document).ready(function() {
var $widget = $('.vani-shorts-viewport');
if ($widget.length) {
var $viewport = $widget;
var $titleFrame = $widget.find('.vani-shorts-title');
new mw.Api().get({
action: 'query',
prop: 'revisions',
titles: 'VanimediaMayapur YouTube SHORTS List',
rvprop: 'content',
format: 'json'
}).done(function(data) {
try {
var pages = data.query.pages;
var pageId = Object.keys(pages)[0];
if (pageId == "-1" || !pages[pageId].revisions) {
$viewport.text("Database list page not found.");
return;
}
// FIXED: Corrected MediaWiki revision array syntax lookup
var rawWikiText = pages[pageId].revisions[0]['*'];
var lines = rawWikiText.split('\n');
var validShorts = [];
for (var i = 0; i < lines.length; i++) {
var line = $.trim(lines[i]);
if (line.indexOf('File:') === 0 && line.toLowerCase().indexOf('link=') !== -1) {
validShorts.push(line);
}
}
if (validShorts.length === 0) {
$viewport.text("No gallery entries recognized.");
return;
}
var randomLine = validShorts[Math.floor(Math.random() * validShorts.length)];
var parts = randomLine.split('|');
// Reset defaults before parsing line elements
var rawUrl = "";
for (var j = 0; j < parts.length; j++) {
var part = $.trim(parts[j]);
if (part.toLowerCase().indexOf('link=') === 0) {
rawUrl = part.substring(5).trim();
}
}
// Clean all template formatting brackets, space characters, and hidden control markers
var urlCleaned = rawUrl.replace(/[\u200e\u200f\s\}\}\]]/g, '');
// Direct YouTube Alphanumeric Pattern Matcher
var idRegex = /(?:shorts\/|v=|embed\/|\/)([a-zA-Z0-9_-]{11})/;
var matchResults = urlCleaned.match(idRegex);
var videoId = "";
if (matchResults && matchResults[1]) {
// FIXED: Grabbed index 1 to pull the standalone 11-digit ID without any slashes
videoId = matchResults[1].trim();
}
if (videoId && videoId.length === 11) {
// FIXED: Isolated to inject ONLY the video player iframe at the correct 280px width
var embedUrl = "https://www.youtube.com/embed/" + videoId;
$viewport.html('<iframe width="280" height="225" src="' + embedUrl + '" frameborder="0" allowfullscreen style="border-radius: 8px; border: none;"></iframe>');
} else {
$viewport.html("<div style='color:#c0392b; padding:10px; font-size:11px;'>Invalid video ID sequence extracted.</div>");
}
} catch (err) {
console.error("Shorts engine exception:", err);
$viewport.text("Error handling text structure values.");
}
}).fail(function() {
$viewport.text("API connection failed.");
});
}
});
// Kasya
/* Open Timeline links in a new tab ONLY on the Chapters page */
mw.hook('wikipage.content').add(function($content) {
// Check if we are exactly on the timeline page
if (mw.config.get('wgPageName') === "Chapters_in_Srila_Prabhupada's_Life") {
// If yes, apply the new tab rule to the table
$content.find('#mp-tfp a').attr('target', '_blank').attr('rel', 'noopener noreferrer');
}
});
// Wait for MediaWiki core modules and the DOM to load
mw.loader.using(['mediawiki.api', 'mediawiki.util']).then(function () {
$(document).ready(function () {
// 1. FIND THE "102 Languages" SIDEBAR SECTION
var $sidebarMenu = $('#p-102_Languages ul').first();
// Fallback in case your specific MediaWiki version formats the ID differently
if ($sidebarMenu.length === 0) {
$('.vector-menu-heading, .portal h3').each(function() {
// Looks for the heading text directly
if ($(this).text().trim() === '102 Languages') {
$sidebarMenu = $(this).closest('.vector-menu, .portal').find('ul').first();
}
});
}
// Exit if the 102 Languages menu isn't found on the page
if (!$sidebarMenu || $sidebarMenu.length === 0) return;
// 2. CREATE THE SEARCH BAR AS A MENU ITEM
var $searchLi = $('<li id="n-language-search" style="margin-top: 10px; margin-bottom: 5px; list-style: none;"></li>');
var $searchBox = $('<input type="text" id="sidebarLanguageSearch" placeholder="Search 102 Languages..." style="width: 100%; box-sizing: border-box; padding: 5px; font-size: 0.85em; border: 1px solid #a2a9b1; border-radius: 2px;" autocomplete="off" />');
// Container for the results (hidden by default)
var $resultsContainer = $('<ul id="sidebarLanguageResults" style="list-style: none; padding: 0; margin: 4px 0 0 0; max-height: 200px; overflow-y: auto; border: 1px solid #eaecf0; background: #ffffff; display: none;"></ul>');
// Build the menu item and append it to the sidebar
$searchLi.append($searchBox).append($resultsContainer);
$sidebarMenu.prepend($searchLi);
var api = new mw.Api();
var languageList = [];
// 3. FETCH LANGUAGES FROM THE CATEGORY VIA API IN THE BACKGROUND
api.get({
action: 'query',
list: 'categorymembers',
cmtitle: 'Category:Languages_with_Total_Pages',
cmlimit: 'max',
format: 'json'
}).done(function (data) {
if (data.query && data.query.categorymembers) {
languageList = data.query.categorymembers.map(function (member) {
return {
title: member.title,
url: mw.util.getUrl(member.title)
};
});
}
});
// 4. ADD SEARCH FUNCTIONALITY TO THE SIDEBAR BOX
$('#sidebarLanguageSearch').on('keyup', function (e) {
e.stopPropagation();
var searchTerm = $(this).val().toLowerCase();
$resultsContainer.empty();
// Hide the results box if the search is empty
if (searchTerm.length === 0) {
$resultsContainer.hide();
return;
}
// Filter the fetched languages
var filteredLanguages = languageList.filter(function (lang) {
return lang.title.toLowerCase().indexOf(searchTerm) > -1;
});
// Show results container
$resultsContainer.show();
// Append results using Vector's standard dark text color
if (filteredLanguages.length > 0) {
filteredLanguages.forEach(function (lang) {
$resultsContainer.append('<li style="padding: 4px 6px; border-bottom: 1px solid #f8f9fa;"><a href="' + lang.url + '" style="text-decoration: none; color: #0645ad; display: block; font-size: 0.9em;">' + lang.title + '</a></li>');
});
} else {
$resultsContainer.append('<li style="padding: 4px 6px; color: #72777d; font-size: 0.9em;">No languages found</li>');
}
});
// Prevent typing from accidentally triggering global keyboard shortcuts
$('#sidebarLanguageSearch').on('keydown', function(e) {
e.stopPropagation();
});
// Optional: Hide results when clicking outside the sidebar search
$(document).on('click', function(e) {
if (!$(e.target).closest('#n-language-search').length) {
$resultsContainer.hide();
}
});
// Re-show results if they click back into the search box
$('#sidebarLanguageSearch').on('click', function() {
if ($(this).val().length > 0) {
$resultsContainer.show();
}
});
});
});
// 5. SIDEBAR ACCORDION - STRICT LEFT-COLUMN ISOLATION & TRUE ACCORDION
(function() {
// 1. Tag ONLY menus physically located in the left sidebar
function tagSidebarMenus() {
var allMenus = document.querySelectorAll('.vector-menu');
for (var i = 0; i < allMenus.length; i++) {
var menu = allMenus[i];
// STRICT INCLUSION: Only tag menus inside the modern or legacy left sidebar containers
if (menu.closest('#vector-main-menu, #mw-panel, #mw-navigation')) {
menu.classList.add('vanipedia-sidebar-menu');
// Collapse them by default if they have a heading
if (menu.querySelector('.vector-menu-heading') && !menu.classList.contains('vanipedia-collapsed')) {
menu.classList.add('vanipedia-collapsed');
}
}
}
}
// Run tagging immediately, and again on load as a failsafe
tagSidebarMenus();
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', tagSidebarMenus);
}
// 2. Inject CSS targeted STRICTLY at our newly tagged custom class
var style = document.createElement('style');
style.textContent =
/* Widen only our tagged sidebar menus */
'.vanipedia-sidebar-menu { width: 185px !important; } ' +
/* Core functional hiding rule */
'.vanipedia-sidebar-menu.vanipedia-collapsed .vector-menu-content { display: none !important; } ' +
/* Bold, Dark Header */
'.vanipedia-sidebar-menu .vector-menu-heading { ' +
' cursor: pointer !important; ' +
' background-color: #2c4c50 !important; ' +
' border: 1px solid #1b3033 !important; ' +
' border-radius: 4px !important; ' +
' margin-bottom: 4px !important; ' +
' padding: 10px 12px !important; ' +
' font-weight: 600 !important; ' +
' color: #ffffff !important; ' +
' display: flex !important; ' +
' justify-content: space-between !important; ' +
' align-items: center !important; ' +
' gap: 10px !important; ' +
' transition: all 0.2s ease; ' +
'} ' +
/* Fix header corners when expanded */
'.vanipedia-sidebar-menu:not(.vanipedia-collapsed) .vector-menu-heading { ' +
' border-radius: 4px 4px 0 0 !important; ' +
' margin-bottom: 0 !important; ' +
'} ' +
/* Hover effect */
'.vanipedia-sidebar-menu .vector-menu-heading:hover { background-color: #385e63 !important; } ' +
/* The dropdown caret */
'.vanipedia-sidebar-menu .vector-menu-heading::after { ' +
' content: "▼"; ' +
' font-size: 0.75em; ' +
' color: #ffffff !important; ' +
' transition: transform 0.2s ease; ' +
'} ' +
/* Rotate the arrow when collapsed */
'.vanipedia-sidebar-menu.vanipedia-collapsed .vector-menu-heading::after { ' +
' transform: rotate(-90deg); ' +
'} ' +
/* The Expanded Content Area */
'.vanipedia-sidebar-menu .vector-menu-content { ' +
' background-color: #eaeff0 !important; ' +
' border: 1px solid #2c4c50 !important; ' +
' border-top: none !important; ' +
' border-radius: 0 0 4px 4px !important; ' +
' padding: 0 0 4px 0 !important; ' +
' margin-bottom: 6px !important; ' +
' box-shadow: 0 3px 6px rgba(0,0,0,0.15) !important; ' +
'} ' +
/* Reset the list styles */
'.vanipedia-sidebar-menu .vector-menu-content ul { ' +
' list-style: none !important; ' +
' margin: 0 !important; ' +
' padding: 0 !important; ' +
'} ' +
/* Menu links */
'.vanipedia-sidebar-menu .vector-menu-content li a { ' +
' display: block !important; ' +
' padding: 8px 12px 8px 16px !important; ' +
' color: #1b3033 !important; ' +
' text-decoration: none !important; ' +
' border-left: 3px solid transparent !important; ' +
' border-bottom: 1px solid rgba(44, 76, 80, 0.1) !important; ' +
' transition: all 0.15s ease !important; ' +
'} ' +
/* Remove separator from last item */
'.vanipedia-sidebar-menu .vector-menu-content li:last-child a { ' +
' border-bottom: none !important; ' +
'} ' +
/* Hover effect for individual menu items */
'.vanipedia-sidebar-menu .vector-menu-content li a:hover { ' +
' background-color: #dbe4e6 !important; ' +
' border-left: 3px solid #2c4c50 !important; ' +
' color: #000000 !important; ' +
'} ';
document.head.appendChild(style);
// 3. Helper function to collapse all of our securely tagged menus
function collapseAllSidebarMenus() {
var menus = document.querySelectorAll('.vanipedia-sidebar-menu');
for (var i = 0; i < menus.length; i++) {
menus[i].classList.add('vanipedia-collapsed');
}
}
// 4. Intercept clicks for True Accordion Behavior
document.addEventListener('click', function(e) {
var heading = e.target.closest('.vector-menu-heading');
if (!heading) return;
// ONLY react if this click belongs to one of our tagged sidebar menus
var navContainer = heading.closest('.vanipedia-sidebar-menu');
if (navContainer) {
var isAlreadyOpen = !navContainer.classList.contains('vanipedia-collapsed');
// Forcefully collapse ALL left sidebar menus first
collapseAllSidebarMenus();
// Open the clicked one if it wasn't already open
if (!isAlreadyOpen) {
navContainer.classList.remove('vanipedia-collapsed');
}
e.stopPropagation();
e.preventDefault();
}
}, true);
})();
mw.loader.using('mediawiki.user').then(function() {
// Fetch the user's assigned groups
var userGroups = mw.config.get('wgUserGroups') || [];
// Define the roles that SHOULD see the administrative tabs
var isAuthorized = userGroups.includes('sysop') ||
userGroups.includes('interface-admin') ||
userGroups.includes('Editor');
// If the user is not in one of those groups, restrict the UI
if (!isAuthorized) {
document.body.classList.add('restricted-ui');
}
});
// Function to open accordion from TOC and jump there //
mw.hook('wikipage.content').add(function() {
function handleAccordionTOC(hash) {
if (!hash || hash === '#') return false;
try {
var targetId = hash.substring(1);
var targetElement = document.getElementById(targetId) || document.getElementById(decodeURIComponent(targetId));
if (!targetElement) return false;
var $target = $(targetElement);
// Match either h2 or h3
var $heading = $target.is('h2, h3') ? $target : $target.closest('h2, h3');
if (!$heading.length) return false;
var $accordion = $heading.next('.book-accordion');
// If the heading itself is not followed directly by an accordion,
// check if the heading is located INSIDE a parent accordion (e.g., nested h3)
var $parentAccordions = $heading.parents('.book-accordion');
// If there's no direct accordion next to it and it's not inside any accordion,
// let the browser handle standard jump.
if (!$accordion.length && !$parentAccordions.length) return false;
// 1. Open all ancestor accordions (if target heading is nested inside one)
$parentAccordions.each(function() {
var $parentCollapsible = $(this).children('.mw-collapsible');
if ($parentCollapsible.length && $parentCollapsible.hasClass('mw-collapsed')) {
var pId = $parentCollapsible.attr('id');
if (pId) {
var pToggleClass = pId.replace('mw-customcollapsible-', 'mw-customtoggle-');
$('.' + pToggleClass).first().click();
}
}
});
// 2. Open the accordion immediately following this heading (if present)
if ($accordion.length) {
var $collapsible = $accordion.children('.mw-collapsible, .mw-collapsible-content').first();
if (!$collapsible.length) {
$collapsible = $accordion.find('.mw-collapsible');
}
if ($collapsible.length && $collapsible.hasClass('mw-collapsed')) {
var collapsibleId = $collapsible.attr('id');
if (collapsibleId) {
var toggleClass = collapsibleId.replace('mw-customcollapsible-', 'mw-customtoggle-');
$('.' + toggleClass).first().click();
}
}
}
// Target element to scroll to (the accordion, or the heading itself if accordion is missing)
var $scrollTarget = $accordion.length ? $accordion : $heading;
// 3. Scroll to the visible section
setTimeout(function() {
$('html, body').animate({
scrollTop: $scrollTarget.offset().top - 75
}, 300);
}, 100);
// Return true to indicate we successfully handled the TOC accordion click
return true;
} catch (e) {
console.error("TOC Accordion script error:", e);
return false;
}
}
$(document).off('click.tocAccordion').on('click.tocAccordion', 'a[href^="#"]', function(e) {
if ($(this).closest('#toc, .toc, .vector-toc').length > 0) {
var href = $(this).attr('href');
// Run our function to see if this is an accordion/heading link
var isAccordion = handleAccordionTOC(href);
// ONLY stop the default browser jump if we handled it
if (isAccordion) {
e.preventDefault();
// Update the URL manually so the user can still share the link
if (history.pushState) {
history.pushState(null, null, href);
} else {
window.location.hash = href;
}
}
}
});
if (window.location.hash) {
setTimeout(function() {
handleAccordionTOC(window.location.hash);
}, 500);
}
});
/* Sticky burger menu - Pure Floating Dropdown (Forces Unpinned & Full Title) */
(function () {
let isMenuOpen = false;
// 1. Force the sidebar out of pinned mode and return menu into the dropdown container
function forceUnpinSidebar() {
document.documentElement.classList.remove('vector-feature-main-menu-pinned-enabled', 'vector-feature-main-menu-pinned-clientpref-1');
document.documentElement.classList.add('vector-feature-main-menu-pinned-disabled', 'vector-feature-main-menu-pinned-clientpref-0');
if (document.body) {
document.body.classList.remove('vector-feature-main-menu-pinned-enabled', 'vector-feature-main-menu-pinned-clientpref-1');
document.body.classList.add('vector-feature-main-menu-pinned-disabled', 'vector-feature-main-menu-pinned-clientpref-0');
}
// Clear stored pin preference
document.cookie = "vector-feature-main-menu-pinned=0; path=/; max-age=31536000";
try { localStorage.setItem('vector-feature-main-menu-pinned', '0'); } catch(e) {}
// If #vector-main-menu was moved into the pinned container, move it back into dropdown
const mainMenu = document.getElementById('vector-main-menu');
const unpinnedContainer = document.getElementById('vector-main-menu-unpinned-container') ||
document.querySelector('#vector-main-menu-dropdown .vector-dropdown-content');
const pinnedContainer = document.getElementById('vector-main-menu-pinned-container');
if (mainMenu && unpinnedContainer && pinnedContainer && pinnedContainer.contains(mainMenu)) {
unpinnedContainer.appendChild(mainMenu);
}
}
function getDropdownElement() {
return document.querySelector('#vector-main-menu-dropdown .vector-dropdown-content') ||
document.getElementById('vector-main-menu-dropdown-content') ||
document.getElementById('vector-main-menu-unpinned-container') ||
document.getElementById('vector-main-menu');
}
function openMenu(menuBtn) {
forceUnpinSidebar();
const checkbox = document.getElementById('vector-main-menu-dropdown-checkbox');
const dropdown = getDropdownElement();
if (!dropdown) return;
if (checkbox) {
checkbox.checked = true;
checkbox.dispatchEvent(new Event('change', { bubbles: true }));
}
const rect = menuBtn.getBoundingClientRect();
dropdown.style.setProperty('position', 'fixed', 'important');
dropdown.style.setProperty('top', rect.bottom + 'px', 'important');
dropdown.style.setProperty('left', rect.left + 'px', 'important');
dropdown.style.setProperty('z-index', '99999', 'important');
dropdown.style.setProperty('max-height', (window.innerHeight - rect.bottom - 16) + 'px', 'important');
dropdown.style.setProperty('overflow-y', 'auto', 'important');
dropdown.style.setProperty('display', 'block', 'important');
dropdown.style.setProperty('visibility', 'visible', 'important');
dropdown.style.setProperty('opacity', '1', 'important');
dropdown.style.setProperty('background-color', 'var(--background-color-base, #ffffff)', 'important');
dropdown.style.setProperty('box-shadow', '0 4px 16px rgba(0, 0, 0, 0.2)', 'important');
dropdown.style.setProperty('border-radius', '4px', 'important');
isMenuOpen = true;
}
function closeMenu() {
const checkbox = document.getElementById('vector-main-menu-dropdown-checkbox');
const dropdown = getDropdownElement();
if (!dropdown) return;
if (checkbox) {
checkbox.checked = false;
checkbox.dispatchEvent(new Event('change', { bubbles: true }));
}
dropdown.style.removeProperty('position');
dropdown.style.removeProperty('top');
dropdown.style.removeProperty('left');
dropdown.style.removeProperty('z-index');
dropdown.style.removeProperty('max-height');
dropdown.style.removeProperty('overflow-y');
dropdown.style.removeProperty('background-color');
dropdown.style.removeProperty('box-shadow');
dropdown.style.removeProperty('border-radius');
dropdown.style.setProperty('display', 'none', 'important');
dropdown.style.setProperty('visibility', 'hidden', 'important');
dropdown.style.setProperty('opacity', '0', 'important');
isMenuOpen = false;
}
function initStickyBurger() {
forceUnpinSidebar();
const stickyHeader = document.getElementById('vector-sticky-header');
if (!stickyHeader) return false;
if (document.getElementById('vanipedia-sticky-main-menu')) return true;
// 1. Create burger button
const menuBtn = document.createElement('div');
menuBtn.id = 'vanipedia-sticky-main-menu';
menuBtn.title = 'Main menu';
menuBtn.style.cursor = 'pointer';
menuBtn.className = 'vector-dropdown-label cdx-button cdx-button--fake-button cdx-button--icon-only';
// 2. Add hamburger icon
const iconSpan = document.createElement('span');
iconSpan.className = 'vector-icon mw-ui-icon-menu mw-ui-icon-wikimedia-menu';
menuBtn.appendChild(iconSpan);
// 3. Toggle click handler (1st click opens, 2nd click rolls back)
menuBtn.addEventListener('click', function (e) {
e.preventDefault();
e.stopPropagation();
if (isMenuOpen) {
closeMenu();
} else {
openMenu(menuBtn);
}
});
// 4. Inject into start container
let startContainer = stickyHeader.querySelector('.vector-sticky-header-start');
if (!startContainer) {
startContainer = document.createElement('div');
startContainer.className = 'vector-sticky-header-start';
stickyHeader.insertBefore(startContainer, stickyHeader.firstChild);
}
startContainer.insertBefore(menuBtn, startContainer.firstChild);
return true;
}
// 5. Close when clicking anywhere outside
document.addEventListener('click', function (e) {
if (!isMenuOpen) return;
const menuBtn = document.getElementById('vanipedia-sticky-main-menu');
const dropdown = getDropdownElement();
if (dropdown && menuBtn && !menuBtn.contains(e.target) && !dropdown.contains(e.target)) {
closeMenu();
}
});
// 6. Bootstrap initializer
if (!initStickyBurger()) {
const checkTimer = setInterval(function () {
if (initStickyBurger()) {
clearInterval(checkTimer);
}
}, 100);
setTimeout(function () { clearInterval(checkTimer); }, 4000);
}
mw.hook('wikipage.content').add(initStickyBurger);
$(initStickyBurger);
})();
/* Floating "Back to Top" Button Controller */
(function () {
function initBackToTop() {
if (document.getElementById('vanipedia-back-to-top')) return;
// 1. Create button element with an up-arrow SVG icon
const btn = document.createElement('button');
btn.id = 'vanipedia-back-to-top';
btn.title = 'Back to top';
btn.setAttribute('aria-label', 'Back to top');
btn.innerHTML = '<svg xmlns="http://www.w3.org/2000/svg" width="22" height="22" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><polyline points="18 15 12 9 6 15"></polyline></svg>';
// 2. Smooth scroll to top on click
btn.addEventListener('click', function (e) {
e.preventDefault();
window.scrollTo({ top: 0, behavior: 'smooth' });
});
// 3. Show button only after scrolling down 300px
function toggleVisibility() {
if (window.scrollY > 300) {
btn.classList.add('visible');
} else {
btn.classList.remove('visible');
}
}
window.addEventListener('scroll', toggleVisibility, { passive: true });
toggleVisibility();
document.body.appendChild(btn);
}
$(initBackToTop);
mw.hook('wikipage.content').add(initBackToTop);
})();
/* V176: Removed the homepage animation/random-content initializer. Main-page
features now remain exactly as curated in Main-Page.wikitext. */
// SAFE LEFT-ANCHORED SEARCH (STEP 18)
// ==========================================================================
$(document).ready(function() {
var $search = $('#p-search');
var $start = $('.vector-header-start');
if ($search.length && $start.length && !$start.find('#p-search').length) {
$start.append($search);
}
});
/* ======================================================================
STEP 59: REMOVE TOP BAR HOVER HELP TEXTS (BROWSER TOOLTIPS)
====================================================================== */
function removeTopBarHelpTexts() {
var selectors = [
'#mw-head [title]',
'.vector-header [title]',
'#vanipedia-header-title',
'.vh-header-title',
'.vanipedia-header-title',
'#p-logo [title]',
'#p-logo a',
'header [title]',
'#p-personal [title]',
'#p-search [title]',
'.vector-user-menu [title]',
'#pt-login [title]',
'#pt-anonuserpage [title]',
'#pt-anontalk [title]',
'.vector-menu [title]'
];
$(selectors.join(', ')).removeAttr('title');
// Aggressively remove title from all top bar elements
$('#mw-head, .vector-header, header, .vector-header-container').find('*').removeAttr('title');
}
function initSanctuaryTitle() {
$('.vh-sanctuary-title a').each(function () {
var $link = $(this);
$link.removeClass('vh-title-morph');
$link.find('.vh-title-hover, .vh-title-default').remove();
$link.text('Who Is Śrīla Prabhupāda');
});
}
$(document).ready(function () {
removeTopBarHelpTexts();
initSanctuaryTitle();
setTimeout(removeTopBarHelpTexts, 400);
setTimeout(removeTopBarHelpTexts, 1500);
});
// ==========================================================================
/* V175: decorative cursor code removed; the native system cursor is retained. */
/* ==========================================================================
STEP 92: PERMANENT BOTTOM NAVIGATION BAR (MAIN PAGE & REGULAR WIKI PAGES)
- Fixed at bottom of screen, permanently visible while scrolling.
- Core Principles (/wiki/Vanipedia_Vision)
- Volunteer (/wiki/Vaniseva)
- Community (/wiki/Vanipedia_Community)
- Contact (/contact.php, opens in new window)
- Donate (/wiki/Special:IframePage)
========================================================================== */
(function initPermanentBottomBar() {
function isEntryPage() {
return (
document.body.classList.contains('ext-vp3d-fullscreen') ||
!!document.querySelector('.vp-entry3d-container') ||
!!document.querySelector('.vp-entry3d-wrapper') ||
window.location.pathname === '/' ||
(window.location.pathname === '/index.php' && !window.location.search) ||
(window.mw && mw.config && (mw.config.get('wgPageName') === 'Entry_Page' || mw.config.get('wgTitle') === 'Entry Page'))
);
}
/* V190: mobile footer navigation starts at Home/Main Page, with reachable horizontal overflow. */
function updateBottomBarLayout(bar) {
if (!bar) return;
var mobile = window.innerWidth <= 999 || document.body.classList.contains('skin-minerva');
var inner = bar.querySelector('.vh-bottom-bar-inner');
var links = bar.querySelector('.vh-bottom-nav-links');
var left = bar.querySelector('.vh-bottom-bar-left-space');
var right = bar.querySelector('.vh-bottom-bar-right-space');
if (!inner || !links) return;
inner.style.setProperty('padding', mobile ? '0 10px' : '0 24px', 'important');
inner.style.setProperty('min-width', '0', 'important');
if (mobile) inner.style.setProperty('justify-content', 'flex-start', 'important');
else inner.style.removeProperty('justify-content');
links.style.setProperty('justify-content', mobile ? 'flex-start' : 'center', 'important');
links.style.setProperty('flex', mobile ? '1 1 auto' : '0 0 auto', 'important');
links.style.setProperty('width', mobile ? '100%' : 'auto', 'important');
links.style.setProperty('min-width', '0', 'important');
links.style.setProperty('gap', mobile ? '8px' : '12px', 'important');
links.style.setProperty('flex-wrap', 'nowrap', 'important');
if (mobile) links.style.setProperty('overflow-x', 'auto', 'important');
else links.style.removeProperty('overflow-x');
links.querySelectorAll('.vh-bottom-link, .vh-bottom-sep').forEach(function (item) {
item.style.setProperty('flex-shrink', '0', 'important');
});
if (left) left.style.setProperty('display', mobile ? 'none' : 'block', 'important');
if (right) right.style.setProperty('display', mobile ? 'none' : 'flex', 'important');
if (mobile && bar.dataset.vpFooterMode !== 'mobile') {
links.scrollLeft = 0;
inner.scrollLeft = 0;
}
bar.dataset.vpFooterMode = mobile ? 'mobile' : 'desktop';
}
function setupBottomBar() {
// Never inject on the 3D entry page; remove if already present
if (isEntryPage()) {
var existing = document.getElementById('vh-bottom-bar');
if (existing) existing.remove();
return;
}
var currentBar = document.getElementById('vh-bottom-bar');
if (currentBar) { updateBottomBarLayout(currentBar); return; }
var bar = document.createElement('nav');
bar.id = 'vh-bottom-bar';
bar.className = 'vh-bottom-bar';
bar.setAttribute('aria-label', 'Vanipedia Global Navigation');
bar.innerHTML =
'<div class="vh-bottom-bar-inner" style="display:flex !important; align-items:center !important; width:100% !important; max-width:100% !important; height:100% !important; padding:0 24px !important; box-sizing:border-box !important;">' +
'<div class="vh-bottom-bar-left-space" style="flex:1 1 0 !important; min-width:0 !important;"></div>' +
'<div class="vh-bottom-nav-links" style="flex:0 0 auto !important; display:flex !important; align-items:center !important; justify-content:center !important; gap:12px !important; white-space:nowrap !important;">' +
'<a href="/" class="vh-bottom-link vh-bottom-entry">Home</a>' +
'<span class="vh-bottom-sep" aria-hidden="true">•</span>' +
'<a href="/wiki/Main_Page" class="vh-bottom-link vh-bottom-home">Main Page</a>' +
'<span class="vh-bottom-sep" aria-hidden="true">•</span>' +
'<a href="/wiki/Vanipedia_Vision" class="vh-bottom-link">Core Principles</a>' +
'<span class="vh-bottom-sep" aria-hidden="true">•</span>' +
'<a href="/wiki/Vaniseva" class="vh-bottom-link">Volunteer</a>' +
'<span class="vh-bottom-sep" aria-hidden="true">•</span>' +
'<a href="/wiki/Vanipedia_Community" class="vh-bottom-link">Community</a>' +
'<span class="vh-bottom-sep" aria-hidden="true">•</span>' +
'<a href="/contact.php" target="_blank" rel="noopener noreferrer" class="vh-bottom-link">Contact</a>' +
'<span class="vh-bottom-sep" aria-hidden="true">•</span>' +
'<a href="/wiki/Special:IframePage" class="vh-bottom-link vh-bottom-donate">Donate</a>' +
'</div>' +
'<div class="vh-bottom-bar-right-space" style="flex:1 1 0 !important; min-width:0 !important; display:flex !important; align-items:center !important; justify-content:center !important;">' +
'<div class="vh-bottom-social-links" style="position:static !important; transform:none !important; display:inline-flex !important; align-items:center !important; gap:24px !important;">' +
'<a href="https://www.youtube.com/@VanimediaPrabhupada" target="_blank" rel="noopener noreferrer" class="vh-bottom-social-item" title="YouTube" style="display:inline-flex !important;align-items:center !important;">' +
'<img src="/wiki/Special:FilePath/YouTube_Logo_B.png" alt="YouTube" style="height:20px !important;width:auto !important;vertical-align:middle !important;display:block !important;">' +
'</a>' +
'<a href="https://www.facebook.com/vanipedia.org" target="_blank" rel="noopener noreferrer" class="vh-bottom-social-item" title="Facebook Page" style="display:inline-flex !important;align-items:center !important;">' +
'<img src="/wiki/Special:FilePath/Facebook_Group_Logo.png" alt="Facebook" style="height:20px !important;width:auto !important;vertical-align:middle !important;display:block !important;">' +
'</a>' +
'<a href="https://www.facebook.com/groups/VanipediaGroup" target="_blank" rel="noopener noreferrer" class="vh-bottom-social-item" title="Facebook Group" style="display:inline-flex !important;align-items:center !important;">' +
'<img src="/wiki/Special:FilePath/Facebook_Logo_2023.png" alt="Facebook Group" style="height:20px !important;width:auto !important;vertical-align:middle !important;display:block !important;">' +
'</a>' +
'<a href="https://www.instagram.com/vanipediaprabhupada/" target="_blank" rel="noopener noreferrer" class="vh-bottom-social-item" title="Instagram" style="display:inline-flex !important;align-items:center !important;">' +
'<img src="/wiki/Special:FilePath/Insta Logo.png" alt="Instagram" style="height:20px !important;width:auto !important;vertical-align:middle !important;display:block !important;">' +
'</a>' +
'</div>' +
'</div>' +
'</div>';
var stageSlot = document.getElementById('vani-stage-footer-slot');
if (stageSlot) {
stageSlot.appendChild(bar);
} else {
document.body.appendChild(bar);
}
updateBottomBarLayout(bar);
}
window.addEventListener('resize', function () {
updateBottomBarLayout(document.getElementById('vh-bottom-bar'));
}, { passive: true });
// Remove bar if 3D entry page activates asynchronously
if (window.MutationObserver && document.body) {
var observer = new MutationObserver(function() {
if (isEntryPage()) {
var existing = document.getElementById('vh-bottom-bar');
if (existing) existing.remove();
}
});
observer.observe(document.body, { attributes: true, attributeFilter: ['class'], childList: true });
}
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', setupBottomBar);
} else {
setupBottomBar();
}
})();
// Chrome suppression for Entry Page
(function suppressEntryPageChrome() {
function checkEntryChrome() {
var isEntry = (
document.body.classList.contains('ext-vp3d-fullscreen') ||
!!document.querySelector('.vp-entry3d-container') ||
!!document.querySelector('.vp-entry3d-wrapper') ||
window.location.pathname === '/' ||
(window.location.pathname === '/index.php' && !window.location.search)
);
if (isEntry) {
var headers = document.querySelectorAll('.header-container, .header-chrome, .minerva-header, .vector-header-container, #mw-head, .mw-header');
for (var i = 0; i < headers.length; i++) {
headers[i].style.setProperty('display', 'none', 'important');
}
var b = document.getElementById('vh-bottom-bar');
if (b) b.remove();
}
}
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', checkEntryChrome);
} else {
checkEntryChrome();
}
})();
/* ==========================================================================
STEP 97: MOBILE BURGER MENU TOGGLE ENHANCER
Ensures the hamburger menu reliably opens and closes the Vector navigation
drawer on mobile viewports and touch devices.
========================================================================== */
(function() {
function initMobileMenuToggle() {
var dropdown = document.getElementById('vector-main-menu-dropdown');
if (!dropdown || dropdown.dataset.vaniMobileInit) return;
dropdown.dataset.vaniMobileInit = 'true';
var label = dropdown.querySelector('.vector-dropdown-label');
var checkbox = document.getElementById('vector-main-menu-dropdown-checkbox');
var content = dropdown.querySelector('.vector-dropdown-content');
if (label && checkbox) {
label.addEventListener('click', function(e) {
setTimeout(function() {
if (content) {
if (checkbox.checked) {
content.classList.add('is-open');
} else {
content.classList.remove('is-open');
}
}
}, 50);
});
}
}
$(document).ready(initMobileMenuToggle);
if (window.mw && mw.hook) {
mw.hook('wikipage.content').add(initMobileMenuToggle);
}
})();
/* ==========================================================================
VANIPEDIA MOBILE JAVASCRIPT (MediaWiki:Mobile.js)
1. User Menu Dropdown: Intercepts #ca-mytalks on mobile to show the regular
user dropdown menu (Talk, Preferences, Contributions, Log out) matching desktop.
2. Self-contained styles injected into <head>.
3. Screen Orientation lock to landscape on Main Page.
========================================================================== */
(function() {
// 1. Inject self-contained dropdown styles immediately into <head>
var styleId = 'vani-mobile-dropdown-styles';
if (!document.getElementById(styleId)) {
var style = document.createElement('style');
style.id = styleId;
style.textContent = [
'#vanipedia-mobile-user-menu {',
' display: none !important;',
' position: fixed !important;',
' top: 52px !important;',
' right: 8px !important;',
' width: 175px !important;',
' background-color: #1f3e45 !important;',
' border: 1.5px solid #b1873d !important;',
' border-radius: 6px !important;',
' box-shadow: 0 8px 24px rgba(0,0,0,0.5) !important;',
' padding: 6px 0 !important;',
' z-index: 999999 !important;',
' box-sizing: border-box !important;',
' flex-direction: column !important;',
'}',
'#vanipedia-mobile-user-menu.is-open {',
' display: flex !important;',
'}',
'#vanipedia-mobile-user-menu a.vani-user-menu-item {',
' color: #f5d77f !important;',
' font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif !important;',
' font-size: 15px !important;',
' font-weight: 500 !important;',
' padding: 10px 18px !important;',
' text-decoration: none !important;',
' display: block !important;',
' line-height: 1.2 !important;',
'}',
'#vanipedia-mobile-user-menu a.vani-user-menu-item:hover,',
'#vanipedia-mobile-user-menu a.vani-user-menu-item:active {',
' background-color: #345B63 !important;',
' color: #ffffff !important;',
'}',
'#vanipedia-mobile-user-menu .vani-user-menu-divider {',
' height: 1px !important;',
' background-color: rgba(177, 135, 61, 0.35) !important;',
' margin: 5px 0 !important;',
'}',
'#vanipedia-mobile-user-menu a.vani-user-menu-logout {',
' color: #fca5a5 !important;',
'}',
'#vanipedia-mobile-user-menu a.vani-user-menu-logout:hover {',
' background-color: rgba(239, 68, 68, 0.2) !important;',
' color: #ffffff !important;',
'}'
].join('\n');
document.head.appendChild(style);
}
// 2. Setup user dropdown click interceptor
function initUserMenuDropdown() {
var $userBtn = $('#ca-mytalks');
if (!$userBtn.length || $userBtn.data('vaniMenuInit')) return;
$userBtn.data('vaniMenuInit', true);
// Prevent opening talk page directly
$userBtn.attr('href', 'javascript:void(0)');
// Build the dropdown container attached to body
var $dropdown = $('#vanipedia-mobile-user-menu');
if (!$dropdown.length) {
$dropdown = $('<div>', {
id: 'vanipedia-mobile-user-menu',
class: 'vanipedia-mobile-user-dropdown'
});
var user = (window.mw && mw.config && mw.config.get('wgUserName')) || 'Kashya';
var talkUrl = '/wiki/User_talk:' + encodeURIComponent(user);
var prefUrl = '/wiki/Special:Preferences';
var contUrl = '/wiki/Special:Contributions/' + encodeURIComponent(user);
var page = (window.mw && mw.config && mw.config.get('wgPageName')) || 'Main_Page';
var logoutUrl = '/w/index.php?title=Special:UserLogout&returnto=' + encodeURIComponent(page) + '&useformat=mobile';
$dropdown.html(
'<a href="' + talkUrl + '" class="vani-user-menu-item">Talk</a>' +
'<a href="' + prefUrl + '" class="vani-user-menu-item">Preferences</a>' +
'<a href="' + contUrl + '" class="vani-user-menu-item">Contributions</a>' +
'<div class="vani-user-menu-divider"></div>' +
'<a href="' + logoutUrl + '" class="vani-user-menu-item vani-user-menu-logout">Log out</a>'
);
$('body').append($dropdown);
}
// Toggle on click
$userBtn.on('click', function(e) {
e.preventDefault();
e.stopPropagation();
$dropdown.toggleClass('is-open');
});
// Close on clicking outside
$(document).on('click touchstart', function(e) {
if (!$(e.target).closest('#ca-mytalks, #vanipedia-mobile-user-menu').length) {
$dropdown.removeClass('is-open');
}
});
}
// =========================================================================
// 3. Container-Level Auto-Landscape & 2D Fitting (STEP 115)
// Matches the exact architecture of VanipediaEntry3D:
// - Keeps <body> stable without full-page transforms.
// - Wraps #vani-home inside #vani-mobile-stage > #vani-rotated-box.
// - Rotates #vani-rotated-box 90deg in portrait mode.
// - Scales the 1200px desktop layout so all sections (Triad, Timeline,
// 4 Taxonomy Cards, Bottom Bar) fit the phone screen without cropping.
// =========================================================================
/* =========================================================================
3. STEP 117: UNIFIED 3-SLOT ROTATED LANDSCAPE STAGE (TOP BAR + MAIN PAGE + BOTTOM BAR)
- Puts Top Bar, #vani-home, and Bottom Bar together in landscape.
- Rotates 90deg as a single unified screen when held in portrait.
- Stays completely horizontal with zero rotation when held in native landscape.
- Leaves regular wiki pages and desktop view completely untouched.
========================================================================= */
function initMobileMainPageStage() {
if (window._vaniMainPageStageInit) return;
var pageName = (window.mw && mw.config && mw.config.get('wgPageName')) || '';
var isMainPage = pageName === 'Main_Page' || document.body.classList.contains('page-Main_Page');
if (!isMainPage) return;
var $vh = $('#vani-home');
if (!$vh.length) return;
window._vaniMainPageStageInit = true;
var $stage = null;
var $rotatedBox = null;
var $headerSlot = null;
var $contentSlot = null;
var $footerSlot = null;
var $topHeader = null;
var $bottomBar = null;
var $headerParent = null;
var $footerParent = null;
var $vhParent = null;
function ensureStage() {
if (!$('#vani-mobile-stage').length) {
$topHeader = $('.vector-header-container, #mw-head, .mw-header, .header-container, header.header-chrome').filter(':visible').first();
if (!$topHeader.length) {
$topHeader = $('.vector-header-container, #mw-head, .mw-header, .header-container, header.header-chrome').first();
}
$bottomBar = $('#vh-bottom-bar');
if ($topHeader.length) $headerParent = $topHeader.parent();
if ($bottomBar.length) $footerParent = $bottomBar.parent();
$vhParent = $vh.parent();
var stageHtml = [
'<div id="vani-mobile-stage">',
' <div id="vani-rotated-box">',
' <div id="vani-stage-header-slot"></div>',
' <div id="vani-stage-content-slot"></div>',
' <div id="vani-stage-footer-slot"></div>',
' </div>',
'</div>'
].join('');
$('body').append(stageHtml);
document.body.classList.add('has-vani-stage');
$stage = $('#vani-mobile-stage');
$rotatedBox = $('#vani-rotated-box');
$headerSlot = $('#vani-stage-header-slot');
$contentSlot = $('#vani-stage-content-slot');
$footerSlot = $('#vani-stage-footer-slot');
if ($topHeader.length) {
$headerSlot.append($topHeader);
var $menu = $('#vanipedia-mobile-user-menu');
if ($menu.length) $headerSlot.append($menu);
}
$contentSlot.append($vh);
if ($bottomBar.length) {
$footerSlot.append($bottomBar);
}
} else {
$stage = $('#vani-mobile-stage');
$rotatedBox = $('#vani-rotated-box');
$headerSlot = $('#vani-stage-header-slot');
$contentSlot = $('#vani-stage-content-slot');
$footerSlot = $('#vani-stage-footer-slot');
if (!$footerSlot.find('#vh-bottom-bar').length) {
var $b = $('#vh-bottom-bar');
if ($b.length) $footerSlot.append($b);
}
if (!$headerSlot.find('.vector-header-container, #mw-head, .header-container').length) {
var $h = $('.vector-header-container, #mw-head, .mw-header, .header-container').first();
if ($h.length) $headerSlot.append($h);
}
}
if ($headerSlot && !$headerSlot.find('.vanipedia-stage-title-link').length) {
var $st = $('<a class="vanipedia-stage-title-link" href="/wiki/Main_Page">Vanipedia</a>');
var $targetNav = $headerSlot.find('.vector-header-start, .minerva-header, .header-container');
if ($targetNav.length) {
$targetNav.first().children().first().after($st);
} else {
$headerSlot.prepend($st);
}
}
}
function updateLayout() {
var screenW = window.innerWidth;
var screenH = window.innerHeight;
var isMobile = ('ontouchstart' in window) || (navigator.maxTouchPoints > 0) || (screenW < 900) || (screenH < 900 && screenH > screenW);
if (!isMobile && screenW >= 1000 && screenW > screenH) {
if ($('#vani-mobile-stage').length) {
if ($topHeader && $topHeader.length && $headerParent) {
$headerParent.prepend($topHeader);
}
if ($vhParent) {
$vhParent.append($vh);
}
if ($bottomBar && $bottomBar.length && $footerParent) {
$footerParent.append($bottomBar);
}
var $m = $('#vanipedia-mobile-user-menu');
if ($m.length) $('body').append($m);
$('#vani-mobile-stage').remove();
document.body.classList.remove('has-vani-stage');
$vh.css({ 'transform': '', 'transform-origin': '', 'width': '' });
}
return;
}
ensureStage();
var isMobilePortrait = (screenH > screenW) && (screenW < 850);
var landscapeW = isMobilePortrait ? screenH : screenW;
var landscapeH = isMobilePortrait ? screenW : screenH;
$rotatedBox.css({
'width': landscapeW + 'px',
'height': landscapeH + 'px'
});
if (isMobilePortrait) {
$rotatedBox.removeClass('is-native-landscape').addClass('is-auto-landscape');
} else {
$rotatedBox.removeClass('is-auto-landscape').addClass('is-native-landscape');
}
var headerH = 50;
var footerH = 36;
var availableContentH = Math.max(120, landscapeH - headerH - footerH);
$contentSlot.css({
'height': availableContentH + 'px'
});
var baseW = 1200;
var baseH = 475;
var scaleW = landscapeW / baseW;
var scaleH = availableContentH / baseH;
var scale = Math.min(scaleW, scaleH);
if (scale > 0.85) scale = 0.85;
if (scale < 0.45) scale = 0.45;
var scaledWidth = baseW * scale;
var offsetX = Math.max(0, (landscapeW - scaledWidth) / 2);
$vh.css({
'transform': 'translate(' + offsetX.toFixed(1) + 'px, 0) scale(' + scale.toFixed(4) + ')',
'transform-origin': 'top left',
'width': baseW + 'px'
});
}
var touchStartY = 0;
var touchStartScroll = 0;
window.addEventListener('touchstart', function(e) {
if ($rotatedBox && $rotatedBox.hasClass('is-auto-landscape') && e.touches && e.touches.length === 1) {
touchStartY = e.touches[0].clientX;
if ($contentSlot && $contentSlot[0]) {
touchStartScroll = $contentSlot[0].scrollTop || 0;
}
}
}, { passive: true });
window.addEventListener('touchmove', function(e) {
if ($rotatedBox && $rotatedBox.hasClass('is-auto-landscape') && e.touches && e.touches.length === 1) {
var delta = touchStartY - e.touches[0].clientX;
if ($contentSlot && $contentSlot[0]) {
$contentSlot[0].scrollTop = touchStartScroll + delta;
}
}
}, { passive: true });
window.addEventListener('wheel', function(e) {
if ($rotatedBox && $rotatedBox.hasClass('is-auto-landscape') && $contentSlot && $contentSlot[0]) {
$contentSlot[0].scrollTop += e.deltaY;
}
}, { passive: true });
window.addEventListener('resize', updateLayout);
window.addEventListener('orientationchange', function() {
setTimeout(updateLayout, 150);
});
updateLayout();
}
$(document).ready(function() {
initUserMenuDropdown(); // V174: natural portrait/landscape flow; no forced rotation.
});
if (window.mw && mw.hook) {
mw.hook('wikipage.content').add(function() {
initUserMenuDropdown(); // V174: natural portrait/landscape flow; no forced rotation.
});
}
})();
/* ==========================================================================
STEP 119: EXACT DESKTOP SIDEBAR INJECTION INTO MOBILE BURGER DRAWER
1. Empties all irrelevant Minerva items (Nearby, Random, Settings, About).
2. Clones or fetches the exact desktop Vector 2022 sidebar (#vector-main-menu).
3. Tags each section with .vanipedia-sidebar-menu for the true desktop accordion.
4. Connects the 102 Languages live search box.
========================================================================== */
(function initExactMobileSidebar() {
function cleanAndInject($drawer, sidebarHtml) {
if ($drawer.data('vaniSidebarCleaned')) return;
$drawer.data('vaniSidebarCleaned', true);
// 1. Remove all default Minerva items (Nearby, Random, Personal, Hlist)
$drawer.find('#p-navigation, #p-personal, ul.hlist, .menu__item--nearby, .menu__item--random').remove();
// 2. Parse and filter desktop sidebar HTML
var $parsed = $('<div>').append($.parseHTML(sidebarHtml));
var $menus = $parsed.find('.vector-menu');
if (!$menus.length) {
$menus = $parsed.find('.portal, [id^="p-"]');
}
var $container = $('<div>', { id: 'vani-mobile-synced-sidebar' });
$menus.each(function(idx) {
var $menu = $(this).clone();
var menuId = $menu.attr('id') || '';
// Ignore personal or search menus if caught
if (menuId === 'p-personal' || menuId === 'p-search' || menuId === 'p-logo') return;
// Apply standard desktop class
$menu.addClass('vanipedia-sidebar-menu');
// Collapse by default, except the first section (Navigation)
if (idx === 0) {
$menu.removeClass('vanipedia-collapsed');
} else {
$menu.addClass('vanipedia-collapsed');
}
$container.append($menu);
});
// 3. Mount cleanly inside mobile drawer
$drawer.empty().append($container);
// 4. Initialize 102 Languages live search box in the cloned menu
initLanguageSearchInDrawer($container);
}
function initLanguageSearchInDrawer($container) {
var $sidebarMenu = $container.find('#p-102_Languages ul, [id*="102_Languages"] ul').first();
if ($sidebarMenu.length === 0) {
$container.find('.vector-menu-heading, .portal h3').each(function() {
if ($(this).text().trim().indexOf('102 Languages') !== -1) {
$sidebarMenu = $(this).closest('.vector-menu, .portal').find('ul').first();
}
});
}
if (!$sidebarMenu || $sidebarMenu.length === 0 || $sidebarMenu.find('#sidebarLanguageSearch').length) return;
var $searchLi = $('<li id="n-language-search" style="margin: 8px 10px; list-style: none;"></li>');
var $searchBox = $('<input type="text" id="sidebarLanguageSearch" placeholder="Search 102 Languages..." autocomplete="off" />');
var $resultsContainer = $('<ul id="sidebarLanguageResults" style="list-style: none; padding: 0; margin: 4px 0 0 0; max-height: 200px; overflow-y: auto; border: 1px solid #2c4c50; background: #ffffff; display: none;"></ul>');
$searchLi.append($searchBox).append($resultsContainer);
$sidebarMenu.prepend($searchLi);
var api = new mw.Api();
var languageList = [];
api.get({
action: 'query',
list: 'categorymembers',
cmtitle: 'Category:Languages_with_Total_Pages',
cmlimit: 'max',
format: 'json'
}).done(function(data) {
if (data.query && data.query.categorymembers) {
languageList = data.query.categorymembers.map(function(member) {
return {
title: member.title,
url: mw.util.getUrl(member.title)
};
});
}
});
$searchBox.on('keyup', function(e) {
e.stopPropagation();
var term = $(this).val().toLowerCase().trim();
$resultsContainer.empty();
if (term.length === 0) {
$resultsContainer.hide();
return;
}
var matches = languageList.filter(function(item) {
return item.title.toLowerCase().indexOf(term) !== -1;
});
if (matches.length > 0) {
matches.slice(0, 15).forEach(function(item) {
var $li = $('<li>', { style: 'padding: 6px 12px; border-bottom: 1px solid #eaeff0;' });
var $a = $('<a>', {
href: item.url,
text: item.title,
style: 'color: #1b3033; text-decoration: none; display: block;'
});
$li.append($a);
$resultsContainer.append($li);
});
$resultsContainer.show();
} else {
$resultsContainer.html('<li style="padding: 6px 12px; color: #888; font-style: italic;">No languages found</li>').show();
}
});
$(document).on('click touchstart', function(e) {
if (!$(e.target).closest('#n-language-search').length) {
$resultsContainer.hide();
}
});
}
function setupMobileDrawer() {
var $drawer = $('#mw-mf-page-left');
if (!$drawer.length) return;
// Check if desktop sidebar is already in DOM
var $desktopSidebar = $('#vector-main-menu, .vector-sidebar-container #mw-panel');
if ($desktopSidebar.length && $desktopSidebar.find('.vector-menu').length) {
cleanAndInject($drawer, $desktopSidebar.html());
return;
}
// Check sessionStorage cache
var cached = null;
try { cached = sessionStorage.getItem('vani_desktop_sidebar_html'); } catch(e) {}
if (cached) {
cleanAndInject($drawer, cached);
return;
}
// Fetch desktop Vector 2022 page to get exact sidebar markup
var fetchUrl = (window.mw && mw.util && mw.util.getUrl('Main_Page', { useskin: 'vector-2022' })) ||
'/wiki/Main_Page?useskin=vector-2022';
$.ajax({
url: fetchUrl,
type: 'GET',
dataType: 'html',
success: function(response) {
try {
var $parsed = $('<div>').append($.parseHTML(response));
var $sidebar = $parsed.find('#vector-main-menu');
if (!$sidebar.length) {
$sidebar = $parsed.find('#mw-panel, .vector-sidebar-container');
}
if ($sidebar.length) {
var html = $sidebar.html();
try { sessionStorage.setItem('vani_desktop_sidebar_html', html); } catch(e) {}
cleanAndInject($drawer, html);
}
} catch(e) {
console.warn('[VANIPEDIA] Error extracting desktop sidebar:', e);
}
}
});
}
$(document).ready(setupMobileDrawer);
if (window.mw && mw.hook) {
mw.hook('wikipage.content').add(setupMobileDrawer);
}
})();
/* ==========================================================================
PARTICIPATING LANGUAGES: INLINE SVG FLAG INJECTOR (STEP 153)
MediaWiki CSS sanitizer strips data:image from stylesheets.
Injecting pure vector SVGs directly into DOM spans ensures 100% compliance.
========================================================================== */
function initLanguageFlags() {
var flags = {
'es': '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 750 500" style="width:100%;height:100%;display:block;border-radius:1.5px;"><rect width="750" height="500" fill="#c60b1e"/><rect y="125" width="750" height="250" fill="#ffc400"/></svg>',
'fr': '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 900 600" style="width:100%;height:100%;display:block;border-radius:1.5px;"><rect width="300" height="600" fill="#002654"/><rect x="300" width="300" height="600" fill="#fff"/><rect x="600" width="300" height="600" fill="#ce1126"/></svg>',
'de': '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 5 3" style="width:100%;height:100%;display:block;border-radius:1.5px;"><rect width="5" height="1" fill="#000"/><rect y="1" width="5" height="1" fill="#d00"/><rect y="2" width="5" height="1" fill="#ffce00"/></svg>',
'it': '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 3 2" style="width:100%;height:100%;display:block;border-radius:1.5px;"><rect width="1" height="2" fill="#008c45"/><rect x="1" width="1" height="2" fill="#f4f5f0"/><rect x="2" width="1" height="2" fill="#cd212a"/></svg>',
'ru': '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 9 6" style="width:100%;height:100%;display:block;border-radius:1.5px;"><rect width="9" height="2" fill="#fff"/><rect y="2" width="9" height="2" fill="#0039a6"/><rect y="4" width="9" height="2" fill="#d52b1e"/></svg>',
'in': '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 900 600" style="width:100%;height:100%;display:block;border-radius:1.5px;"><rect width="900" height="200" fill="#ff9933"/><rect y="200" width="900" height="200" fill="#fff"/><rect y="400" width="900" height="200" fill="#128807"/><circle cx="450" cy="300" r="80" fill="none" stroke="#000080" stroke-width="16"/><circle cx="450" cy="300" r="20" fill="#000080"/></svg>',
'br': '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1000 700" style="width:100%;height:100%;display:block;border-radius:1.5px;"><rect width="1000" height="700" fill="#009b3a"/><polygon points="500,85 915,350 500,615 85,350" fill="#fedf00"/><circle cx="500" cy="350" r="175" fill="#002776"/></svg>',
'pl': '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 8 5" style="width:100%;height:100%;display:block;border-radius:1.5px;"><rect width="8" height="2.5" fill="#fff"/><rect y="2.5" width="8" height="2.5" fill="#dc143c"/></svg>',
'bd': '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 10 6" style="width:100%;height:100%;display:block;border-radius:1.5px;"><rect width="10" height="6" fill="#006a4e"/><circle cx="4.5" cy="3" r="2" fill="#f42a41"/></svg>',
'cn': '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 900 600" style="width:100%;height:100%;display:block;border-radius:1.5px;"><rect width="900" height="600" fill="#de2910"/><polygon points="150,50 180,140 100,85 200,85 120,140" fill="#ffde00"/></svg>',
'jp': '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 900 600" style="width:100%;height:100%;display:block;border-radius:1.5px;"><rect width="900" height="600" fill="#fff"/><circle cx="450" cy="300" r="180" fill="#bc002d"/></svg>',
'nl': '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 9 6" style="width:100%;height:100%;display:block;border-radius:1.5px;"><rect width="9" height="2" fill="#ae1c28"/><rect y="2" width="9" height="2" fill="#fff"/><rect y="4" width="9" height="2" fill="#21468b"/></svg>',
'hr': '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 6 3" style="width:100%;height:100%;display:block;border-radius:1.5px;"><rect width="6" height="1" fill="#f00"/><rect y="1" width="6" height="1" fill="#fff"/><rect y="2" width="6" height="1" fill="#00f"/></svg>',
'cz': '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 900 600" style="width:100%;height:100%;display:block;border-radius:1.5px;"><rect width="900" height="300" fill="#fff"/><rect y="300" width="900" height="300" fill="#d7141a"/><polygon points="0,0 450,300 0,600" fill="#11457e"/></svg>',
'hu': '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 6 3" style="width:100%;height:100%;display:block;border-radius:1.5px;"><rect width="6" height="1" fill="#ce2939"/><rect y="1" width="6" height="1" fill="#fff"/><rect y="2" width="6" height="1" fill="#477050"/></svg>'
};
for (var code in flags) {
var elements = document.getElementsByClassName('vh-flag-' + code);
for (var i = 0; i < elements.length; i++) {
if (!elements[i].childNodes.length) {
elements[i].innerHTML = flags[code];
}
}
}
}
$(document).ready(initLanguageFlags);
if (window.mw && mw.hook) {
mw.hook('wikipage.content').add(initLanguageFlags);
}
/* V179: one viewport-contained rollout at a time, with fixed-footer clearance. */
(function initViewportPortalRollouts() {
/* V187: prepared link pools, matching the other petals' rollout sampling.
Select 20 unique entries once per browser page load from each 120-link pool.
Sources: Vaniquotes Questions asked to Srila Prabhupada; public Vanipedia
Living Devotees Remembering Srila Prabhupada (snapshot: 2026-10-27).
Question links open Vaniquotes; remembrance links use the current wiki.
No runtime API requests or persistent browser cache are needed.
*/
var hookPools = {"questions":["And after you left the college, were you employed?","And that mental process, if you are working, is it a wrong mental process?","And this is your first visit to this (Paris) center?","Aren't there coverings of the 8 elements?","As the spirit soul is leaving the body, do you become older?","Babar was also a minister of his (Akbar)?","But how can that (real process is devotion) be scientifically presented? How can we accept that scientifically?","But how can we understand all this science and technology just by understanding Krsna, just by one book?","But is it (that worship made by trees and other lower animals) voluntary or involuntary?","But the innocent souls, they're not surrendered to Krsna?","Can one assume that matter is a kind of energy?","Could you explain further, purification of the senses? You said that you had to purify your senses before you can see God","Could you give them by name, the five kinds of liberation? In English?","Did Krsna describe to Arjuna the disciplic succession?","Do you have a name that you call... are they called students?","Do you have children? You just left them?","Do you spend a certain amount of time in each center? Do you yourself travel from one center to another?","Do you want to keep the checks or give them to him (Kirtanananda)?","Does any physical change take place in your body when you become Krsna conscious?","Does our line of succession go directly to Gaurakisora dasa Babaji or to Bhaktivinoda Thakura?","Excuse me, does that mean that people from other religions may..., it is not possible for them to achieve the highest perfection?","God has not created us imperfect?","How are the boys and girls to learn these things in manners of decorum and manners from the sannyasis, for example. How are they to offer respects to their godbrothers?","How are they feeling about it (temple), the Vrndavana Gosais?","How can a spirit become so ignorant?","How do you call devotion to the Lord?","How do you know (that is a bogus)? Have you met him (Guru Maharaji)?","How do you know if you have satisfied God?","How do you know that you know? May I ask this (we have to find out, we have to find out who can give the perfect knowledge)?","How do you want India to take this movement?","How is it that when our coat, size of the coat, changes because the body grows bigger the size of the coat is bigger?","How is our movement doing in India?","How old is this man (Prakasananda Sarasvati)?","I am thinking about this, Swamiji, that your Guru Maharaja is preaching through you, and you are preaching through them?","I mean, what is the idea in \"Even if it goes slowly, it must begin\"(so let them begin the foundation… Let it go on slowly, but it must begin)?","If a person experiences difficulty attaining a level of consciousness of God, how to counteract that?","If Krsna knows that we will suffer here in this material world if we come here, why does He let us go?","If we are given charge of the society, we should dismantle all this industry, all these cities...?","In what way we will live in that spiritual form?","Initiation (of Srila Prabhupada) was held at that Gaudiya Matha in Allahabad?","Introduced starting with ISKCON community (varnasrama-dharma should be introduced all over the world)?","Is everything done in our movement for preaching? Everything that is done in our movement is done for preaching?","Is he (Syamasundara's father is very rich man)?","Is it possible through Krsna consciousness to, in the supreme state, to be able to remember all that you were?","Is it true that there are more young people now in the world that are giving more serious thought to what life is really all about?","Is that differentiated (total material elements, mahat-tattva)?","Is that part of your income, to run a...(publishing house)?","Is that perfection possible in one life (our healthy life is to enjoy eternal life... So our human life should be utilized for attaining that perfectional stage)?","Is there any possible way of a balanced combination between spiritualism and materialism?","Is your spiritual master still alive?","Isn't it inevitable that it's going to occur, that the devolution occurs inevitably without anyone's being able to change it?","It becomes a belief rather than a logic now, then, for when we think about the God. You were saying everybody has father, so why God, in exception, He hasn't got a father?","It is possible to attain that affection of love for God... without taking part in this Krsna consciousness movement?","It's not dedicated to Krsna? The work is not dedicated to Krsna. How, specifically, how can you do this?","Krsna says to perform your sva-dharma, so how does one know what is his sva-dharma?","Last night you said that what is the meaning of the word \"nothing.\" That maya means \"nothing\"?","Maybe we will show Lord Caitanya's marriage? Is that nice to show?","No doubt, but what about the daily worship? Should we have Jagannatha deities if it's not possible for worshiping them? Should we have them just for the festival?","No, most of them, they have lived, a very short times. But still is it a fact that the soul is transplanted from one body to another body?","One thing that puzzles me is if what is practical for one person is not practical for another person, then what is the criterion of truth? Is truth relative?","Prabhupada, are all living entities, always under the protection at all times of the Supreme Lord, the Personality of Godhead, at all times?","Prabhupada, what does Balabhadra mean?","Sambodhana is to remove the evil, remove the bad part isn't it?","Say someone prepares something, like some prasadam for Krsna, but he does not make it so good?","She's (Mrs.Marchand) asking that since in these Western countries the families are so broken up and the women sometimes cannot find a qualified husband, what should she do?","So is that a fact, that he (Jesus Christ) went to India?","So then to love Krsna is unnatural?","So they're representatives (Guru Nanak, Muhammad, and other people)?","So why not eat, drink, and be merry because tomorrow you die?","Sometimes the question is put before us: \"You ask us not to eat meat, but you are eating vegetables. Do you think that is not violence?\"","Spiritual master is the mercy of God?","Srila Prabhupada, is the subtle bodies in the subtle world, are they made up of subtle atoms?","Srila Prabhupada, there was a fish on Laksmi's hand yesterday. The Deity in the temple, where Laksmi had her hand up like this, there was a fish here across her hand. What is this?","Swami, what do you think accounts for the..., your popularity, popularity of the..., the Krsna consciousness movement sweeping America?","Swamiji, so the government, the present government in the world...?","Swamiji? Are there people living on the moon now or were they in other yugas living there?","That desire is simple (he does not desire. He desires, and the matter helps. In the material world)?","That doesn't mean (in the spiritual world, it is full of variegatedness) that it is complex, Srila Prabhupada, yes?","That later-on Ramayana has caused some havoc... That later-on interpretation?","The body is matter, but still it is conscious as long as I am alive. So that means the life is consciousness?","The karmi and the jnani are both within the material world. Is the jnani considered more elevated than the karmi?","The literal meaning of sutra is a condensed statement, Prabhupada?","The school in Vrndavana, is this, I assume this is to be out there in the yard that they were clearing. When do you anticipate that will be built?","The shaved head, he's asking?","There are two, two functions in the tongue, one is (indistinct) and one is (indistinct)? So which one (indistinct). Preaching is a form of tapasya?","These days there are so many men who claim to have found the Absolute, who claim to be spiritual masters in their own way. How does one tell who is a bona fide spiritual master?","They have so many people in boxes in the hospitals they are keeping alive. So the big battle is raging whether or not they should pull out the plug?","They say, \"Then my chanting is useless? So I should stop?\" That's what they say","This would be the prescription for all people?","Today there's a little swelling in your... It seems to come and go… It seems to come and go. Is it bothering you?… Is it disturbing?... Really?","Upendra is here now. Should we give him the kismis to make?","We have a display over here in the window of your books, Srila Prabhupada... Would you like to see?","We have a spiritual body to serve Krsna?","Well, then, how is the individual soul eternal if it has a beginning?","Were some of the animals destined to survive through the destruction of other animals?","Were they liberated souls? The thief?","Were you just waiting to finish your books?","What about the poor, hungry, and the suffering bodies?","What does it (Gandharvapur) mean?","What happens to his consciousness which he has achieved as a man during that time which he is in the animal kingdom?","What happens to them (the devotees)?","What is an example of the throwing potency of maya?","What is good and what is bad, what is sinful activity?","What is the position of a soul that's in a sacred tree like a fig tree?","What is the purpose? What is the sense, if there is any, or does the very question (Why anything exists?) make sense?","What was that story of Caesar (scissors)?","What will the business of the trustees (for construction of Bombay) be?","Who are we, why are we here and where are we going?","Why is it seen that they (impersonalists) are making spiritual advancement?","Why is that better than loving your fellow man in the traditional bhakti-marga?","Why was it (Hindu-Muslim unity) the programs failed?","Why would someone who is not Krsna conscious have one hundred children? For example, why would someone like Dhrtarastra, who is not particularly Krsna conscious...?","Would, say, the cutting down of a plant, vegetable.... You are killing the growth there. Is that a living matter?","You conclude that when you become enlightened, you will see the God in form of human nature?","You don't think the patients have any mind of their own?","You have inquired about how we leave our body and enter into the Spiritual Sky?","You think we can't help people?","You were very well known in Vrndavana before you came? Because you were writing or…?… Or because of your ambition to come to the West?","You're feeling a little stronger today, Srila Prabhupada?","Your Divine Grace, since religion is one, do you think man will enter into a golden age in which he will accept one God?"],"memories":["Abhirama das Remembers Srila Prabhupada","Adideva das Remembers Srila Prabhupada","Aditi devi dasi Remembers Srila Prabhupada","Amarendra das Remembers Srila Prabhupada","Anada devi dasi Remembers Srila Prabhupada","Anandamaya das Remembers Srila Prabhupada","Anuttama das Remembers Srila Prabhupada","Arjuna das Remembers Srila Prabhupada","Armarendra das Remembers Srila Prabhupada","Atreya Rsi das Remembers Srila Prabhupada","Bala Gopal devi dasi Remembers Srila Prabhupada","Balai devi dasi Remembers Srila Prabhupada","Batu Gopal das Remembers Srila Prabhupada","Bhakta das Remembers Srila Prabhupada","Bhakti Gauravani Goswami Remembers Srila Prabhupada","Bhavatarini devi dasi Remembers Srila Prabhupada","Bhima das Remembers Srila Prabhupada","Bhurijana das Remembers Srila Prabhupada","Brahmatirtha das Remembers Srila Prabhupada","Brajendranandana das Remembers Srila Prabhupada","Candramauli Swami Remembers Srila Prabhupada","Chaitanyachandra das Remembers Srila Prabhupada","Chitralekha devi dasi Remembers Srila Prabhupada","Dadhi-harta das Remembers Srila Prabhupada","Dayanidhi das Remembers Srila Prabhupada","Dhananjaya das Remembers Srila Prabhupada","Dharmatma das Remembers Srila Prabhupada","Dhristadyumna das Remembers Srila Prabhupada","Dhruva Maharaja das Remembers Srila Prabhupada","Dina Bandhu das Remembers Srila Prabhupada","Dinatarine devi dasi Remembers Srila Prabhupada","Dravinaksha das Remembers Srila Prabhupada","Drumila das Remembers Srila Prabhupada","Gadi das Remembers Srila Prabhupada","Gaura das Remembers Srila Prabhupada","Gokulananda das Remembers Srila Prabhupada","Gokularanajana das Remembers Srila Prabhupada","Gopinath Acharya das Remembers Srila Prabhupada","Guru Gauranga das Remembers Srila Prabhupada","Guruprasad das Remembers Srila Prabhupada","Haravapuh das Remembers Srila Prabhupada","Harikesa das Remembers Srila Prabhupada","Jagadisa das Remembers Srila Prabhupada","Jagat Guru Swami Remembers Srila Prabhupada","Jagat Purusa das Remembers Srila Prabhupada","Jahnava devi dasi Remembers Srila Prabhupada","Janaki devi dasi 01 Remembers Srila Prabhupada","Janaki devi dasi Remembers Srila Prabhupada 02","Janananda Swami Remembers Srila Prabhupada","Jaya Jagadish das Remembers Srila Prabhupada","Jivananda das Remembers Srila Prabhupada","Jyestha devi dasi Remembers Srila Prabhupada","Kamalini devi dasi Remembers Srila Prabhupada","Kanti devi dasi Remembers Srila Prabhupada","Karanodakasayi Visnu das Remembers Srila Prabhupada","Kaushalya devi dasi Remembers Srila Prabhupada","Kedara das Remembers Srila Prabhupada","Kesava Bharati Goswami Remembers Srila Prabhupada","Ksudi das Remembers Srila Prabhupada","Kulashekhara das Remembers Srila Prabhupada","Madan Mohan Mohini devi dasi Remembers Srila Prabhupada","Madhava Gosh das Remembers Srila Prabhupada","Maha devi dasi Remembers Srila Prabhupada","Mahakratu das Remembers Srila Prabhupada","Mahamaya devi dasi Remembers Srila Prabhupada","Mahatma das Remembers Srila Prabhupada","Mandapa das Remembers Srila Prabhupada","Mishra Bhagavan das Remembers Srila Prabhupada","Mohan Gopal das Remembers Srila Prabhupada","Mondakini devi dasi Remembers Srila Prabhupada","Nanda devi dasi Remembers Srila Prabhupada","Narahari 02 das Remembers Srila Prabhupada","Nayanabhiram das Remembers Srila Prabhupada","Niranjan das Remembers Srila Prabhupada","Nischintya das Remembers Srila Prabhupada","Pancadravida Swami Remembers Srila Prabhupada","Pavamana das Remembers Srila Prabhupada","Prabhavishnu Swami Remembers Srila Prabhupada","Prafulla devi dasi Remembers Srila Prabhupada","Pragosh das Remembers Srila Prabhupada","Prakashatma das Remembers Srila Prabhupada","Pratapana das Remembers Srila Prabhupada","Radha Krsna das Remembers Srila Prabhupada","Radha Kunda devi dasi Remembers Srila Prabhupada","Radhanatha Swami Remembers Srila Prabhupada","Rajashekar das Remembers Srila Prabhupada","Rambhoru devi dasi Remembers Srila Prabhupada","Ramprasad das Remembers Srila Prabhupada","Ranganath das Remembers Srila Prabhupada","Rangavati devi dasi Remembers Srila Prabhupada","Rucira devi dasi Remembers Srila Prabhupada","Sacinandana Swami Remembers Srila Prabhupada","Sahadevi devi dasi Remembers Srila Prabhupada","Sandamini devi dasi Remembers Srila Prabhupada","Sankarshan das Remembers Srila Prabhupada","Sarupananda das Remembers Srila Prabhupada","Satarupa devi dasi Remembers Srila Prabhupada","Satsvarupa das Goswami Remembers Srila Prabhupada","Satyanarayana das Remembers Srila Prabhupada","Sivananda das Remembers Srila Prabhupada","Sivarama Swami Remembers Srila Prabhupada","Sriniketana das Remembers Srila Prabhupada","Srutadev das Remembers Srila Prabhupada","Suddha Jiva das Remembers Srila Prabhupada","Sukhada devi dasi Remembers Srila Prabhupada","Surabhi das Remembers Srila Prabhupada","Suresvara das Remembers Srila Prabhupada","Susan Witty Remembers Srila Prabhupada","Tamohara das Remembers Srila Prabhupada","Tattvavit das Remembers Srila Prabhupada","Tota Gopinatha das Remembers Srila Prabhupada","Vaishesika das Remembers Srila Prabhupada","Vedamata devi dasi Remembers Srila Prabhupada","Vedavyas das Remembers Srila Prabhupada","Visakha devi dasi Remembers Srila Prabhupada","Vishvadevi devi dasi Remembers Srila Prabhupada","Vrindavan das Remembers Srila Prabhupada","Vrndavenesvari devi dasi Remembers Srila Prabhupada","Yadubara das Remembers Srila Prabhupada","Yogindra Vandana das Remembers Srila Prabhupada"]};
var hookSelections = Object.create(null);
function shuffleHooks(items) {
var copy = items.slice();
for (var i = copy.length - 1; i > 0; i--) {
var j = Math.floor(Math.random() * (i + 1));
var value = copy[i]; copy[i] = copy[j]; copy[j] = value;
}
return copy;
}
function getHookSelection(key) {
if (!Object.prototype.hasOwnProperty.call(hookSelections, key)) {
hookSelections[key] = shuffleHooks(hookPools[key] || []).slice(0, 20);
}
return hookSelections[key];
}
function populateHookLists(root) {
['questions', 'memories'].forEach(function (key) {
var card = root.querySelector('.vp-portal-card[data-vp-rollout="' + key + '"]');
var panel = card && card.querySelector('.vp-rollout-panel');
if (!panel || panel.dataset.vpHooksReady === '1') return;
var fragment = document.createDocumentFragment();
var heading = document.createElement('span');
heading.className = 'vp-rollout-heading';
heading.textContent = key === 'questions' ? 'Questions and Answers' : 'Disciples Remember';
fragment.appendChild(heading);
var list = document.createElement('span');
list.className = 'vp-rollout-options';
function addLink(title, label) {
var row = document.createElement('span');
var link = document.createElement('a');
var host = key === 'questions' ? 'https://vaniquotes.org' : '';
link.href = host + '/wiki/' + encodeURIComponent(title.replace(/ /g, '_'));
link.textContent = label;
link.title = title;
if (key === 'questions') {
link.target = '_blank';
link.rel = 'noopener noreferrer';
}
row.appendChild(link);
list.appendChild(row);
}
if (key === 'questions') {
addLink('Category:Questions asked to Srila Prabhupada', 'Browse all questions');
} else {
addLink('Category:Living Devotees Remembering Srila Prabhupada', 'Browse all remembrances');
}
getHookSelection(key).forEach(function (title) {
var label = key === 'memories' ? title.replace(/ Remembers Srila Prabhupada$/, '') : title;
addLink(title, label);
});
fragment.appendChild(list);
// Keep the original panel node and its existing hover/mobile behavior.
panel.innerHTML = '';
panel.appendChild(fragment);
panel.dataset.vpHooksReady = '1';
});
}
/* V189: put the full index first in every other card's rollout too. */
function putBrowseAllFirst(root) {
var indexes = [
{ key:'articles', existing:'.vp-article-all', title:'Category:Vanipedia Gemini - Articles', label:'Browse all articles A–Z' },
{ key:'media', existing:'.vp-media-all', title:'Category:Srila Prabhupada in the Media', label:'Browse all media' },
{ key:'timeline', title:"Timeline of Srila Prabhupada's Life", label:'Browse the full timeline' },
{ key:'languages', title:'Category:Participating Languages - Main Pages', label:'Browse all languages' }
];
indexes.forEach(function (index) {
var card = root.querySelector('.vp-portal-card[data-vp-rollout="' + index.key + '"]');
var panel = card && card.querySelector('.vp-rollout-panel');
if (!panel || panel.querySelector('.vp-browse-all')) return;
var row = index.existing && panel.querySelector(index.existing);
if (!row) {
row = document.createElement('span');
var link = document.createElement('a');
link.href = '/wiki/' + encodeURIComponent(index.title.replace(/ /g, '_'));
link.textContent = index.label;
row.appendChild(link);
}
row.classList.add('vp-browse-all');
row.style.display = 'block';
row.style.margin = '0 0 8px';
var heading = panel.querySelector('.vp-rollout-heading');
panel.insertBefore(row, heading ? heading.nextSibling : panel.firstChild);
});
}
function init() {
var root = document.querySelector("body.page-Main_Page #vani-home.vp-static-home");
if (!root) return;
populateHookLists(root);
putBrowseAllFirst(root);
if (root.dataset.vpRolloutsReady === "1") return;
root.dataset.vpRolloutsReady = "1";
var cards = Array.prototype.slice.call(root.querySelectorAll(".vp-portal-card[data-vp-rollout]"));
var mobile = function () {
return window.matchMedia && window.matchMedia("(max-width:700px), (hover:none), (pointer:coarse)").matches;
};
function setExpanded(card, expanded) {
var toggle = card.querySelector(".vp-rollout-toggle");
if (toggle) toggle.setAttribute("aria-expanded", expanded ? "true" : "false");
}
function close(card) {
card.classList.remove("is-open", "is-hover-open");
var panel = card.querySelector(".vp-rollout-panel");
if (panel) {
panel.classList.remove("is-viewport-panel");
panel.style.removeProperty("--vp-panel-top");
panel.style.removeProperty("--vp-panel-left");
panel.style.removeProperty("--vp-panel-width");
if (panel.dataset.vpHooksReady === '1') {
panel.style.removeProperty('max-height');
panel.style.removeProperty('overflow-y');
}
}
setExpanded(card, false);
}
function closeOthers(keep) {
cards.forEach(function (card) { if (card !== keep) close(card); });
}
// V188: keep long random lists attached to the browse control and scroll inside them.
function positionRandomHookPanel(card, panel) {
var key = card.getAttribute('data-vp-rollout');
if (key !== 'questions' && key !== 'memories') return false;
var toggle = card.querySelector('.vp-rollout-toggle');
if (!toggle) return false;
var control = toggle.getBoundingClientRect();
var cardBox = card.getBoundingClientRect();
var header = document.querySelector('header.vector-header, header.mw-header');
var footer = document.getElementById('vh-bottom-bar');
var topLimit = 12;
var bottomLimit = window.innerHeight - 76;
if (header) {
var headerBox = header.getBoundingClientRect();
if (headerBox.top < window.innerHeight && headerBox.bottom > 0) {
topLimit = Math.max(topLimit, headerBox.bottom + 8);
}
}
if (footer) {
var footerBox = footer.getBoundingClientRect();
if (footerBox.top > topLimit && footerBox.top < window.innerHeight) {
bottomLimit = footerBox.top - 8;
}
}
var below = Math.max(0, bottomLimit - control.bottom);
var above = Math.max(0, control.top - topLimit);
var openBelow = below >= 120 || below >= above;
var room = openBelow ? below : above;
var height = Math.min(420, room);
var width = Math.min(panel.getBoundingClientRect().width || 290, window.innerWidth - 24);
var left = Math.max(12, Math.min(cardBox.left, window.innerWidth - width - 12));
panel.style.setProperty('max-height', height + 'px', 'important');
panel.style.setProperty('overflow-y', 'auto', 'important');
var actualHeight = Math.min(panel.getBoundingClientRect().height, height);
var top = openBelow ? control.bottom : control.top - actualHeight;
top = Math.max(topLimit, Math.min(top, bottomLimit - actualHeight));
panel.style.setProperty('--vp-panel-width', width + 'px');
panel.style.setProperty('--vp-panel-left', left + 'px');
panel.style.setProperty('--vp-panel-top', top + 'px');
return true;
}
function place(card) {
var panel = card.querySelector(".vp-rollout-panel");
if (!panel || mobile() || (!card.classList.contains("is-open") && !card.classList.contains("is-hover-open"))) return;
panel.classList.add("is-viewport-panel");
if (positionRandomHookPanel(card, panel)) return;
var anchor = card.getBoundingClientRect();
var width = Math.min(panel.getBoundingClientRect().width || 290, window.innerWidth - 24);
var height = panel.getBoundingClientRect().height || 280;
var topLimit = 12;
var bottomLimit = window.innerHeight - 76;
var side = card.getAttribute("data-vp-rollout-side");
var left;
var top;
if (side === "left" || side === "right") {
var preferredLeft = side === "left" ? anchor.left - width : anchor.right;
left = Math.max(12, Math.min(preferredLeft, window.innerWidth - width - 12));
top = Math.max(topLimit, Math.min(anchor.top, bottomLimit - height));
} else {
left = Math.max(12, Math.min(anchor.left, window.innerWidth - width - 12));
var below = bottomLimit - anchor.bottom;
var above = anchor.top - topLimit;
if (height <= below) top = anchor.bottom;
else if (height <= above) top = anchor.top - height;
else top = Math.max(topLimit, Math.min(anchor.bottom, bottomLimit - height));
}
panel.style.setProperty("--vp-panel-width", width + "px");
panel.style.setProperty("--vp-panel-left", left + "px");
panel.style.setProperty("--vp-panel-top", top + "px");
}
function open(card, mode) {
closeOthers(card);
card.classList.toggle("is-hover-open", mode === "hover");
card.classList.toggle("is-open", mode === "pinned");
setExpanded(card, true);
window.requestAnimationFrame(function () { place(card); });
}
cards.forEach(function (card) {
if (card.dataset.vpRolloutReady === "1") return;
card.dataset.vpRolloutReady = "1";
var toggle = card.querySelector(".vp-rollout-toggle");
if (!toggle) return;
card.addEventListener("pointerdown", function (event) {
card.dataset.pointerTriggeredFocus = event.pointerType || "pointer";
window.setTimeout(function () { delete card.dataset.pointerTriggeredFocus; }, 0);
});
card.addEventListener("pointerenter", function (event) {
if (event.pointerType === "mouse" && !mobile() && !card.classList.contains("is-open")) open(card, "hover");
});
card.addEventListener("pointerleave", function (event) {
if (card.contains(event.relatedTarget)) return;
if (card.classList.contains("is-open") || card.contains(document.activeElement)) return;
close(card);
});
card.addEventListener("focusin", function () {
if (!card.classList.contains("is-open")) open(card, "hover");
});
card.addEventListener("focusout", function () {
window.setTimeout(function () {
if (!card.contains(document.activeElement) && !card.matches(":hover")) close(card);
}, 0);
});
toggle.addEventListener("click", function (event) {
event.preventDefault();
var wasPinned = card.classList.contains("is-open");
if (wasPinned) close(card);
else open(card, "pinned");
});
toggle.addEventListener("keydown", function (event) {
if (event.key === "Enter" || event.key === " ") {
event.preventDefault();
if (card.classList.contains("is-open")) close(card);
else open(card, "pinned");
} else if (event.key === "Escape") {
close(card);
toggle.blur();
}
});
});
document.addEventListener("pointerdown", function (event) {
if (root.contains(event.target)) return;
cards.forEach(close);
});
document.addEventListener("keydown", function (event) {
if (event.key === "Escape") cards.forEach(close);
});
function repositionOpen() {
cards.forEach(function (card) {
if (card.classList.contains("is-open") || card.classList.contains("is-hover-open")) place(card);
});
}
window.addEventListener("resize", repositionOpen, { passive: true });
window.addEventListener("scroll", repositionOpen, { passive: true, capture: true });
}
if (document.readyState === "loading") document.addEventListener("DOMContentLoaded", init);
else init();
if (window.mw && mw.hook) mw.hook("wikipage.content").add(init);
})();
/* V182: restore original desktop Vanipedia top-bar branding and sister-petal links. */
/* ==========================================================
/* ==========================================================
/* ==========================================================
/* ==========================================================
/* ==========================================================
VANIPEDIA TOP BAR CONTROLLER (Step 172: Guaranteed Vanipedia Title & Icons on Mobile)
========================================================== */
(function() {
var titleText = "VANIPEDIA - ŚRĪLA PRABHUPĀDA'S VANI-TEMPLE";
var targetUrl = "https://vanipedia.org";
function removeGlobalSiteNotice() {
$('#siteNotice, #localNotice, .vector-sitenotice-container, #mainbanner, .sitenotice, .mw-sitenotice, .anonnotice, .dismissable-notice, #centralNotice').remove();
}
function createHomeLink() {
var homeSvg = '<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M3 9l9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"></path><polyline points="9 22 9 12 15 12 15 22"></polyline></svg>';
return $('<a>', {
id: 'vanipedia-topbar-home-link',
href: '/',
title: 'Vanipedia Home / Entry Portal',
'aria-label': 'Home',
class: 'vanipedia-topbar-home'
}).html('<span class="vanipedia-home-icon">' + homeSvg + '</span><span class="vanipedia-home-text">Home</span>');
}
function createCenterBlock() {
var blockStyle = 'position:absolute !important; left:50% !important; top:54% !important; transform:translate(-50%, -50%) !important; display:flex !important; flex-direction:column !important; align-items:center !important; justify-content:center !important; text-align:center !important; white-space:nowrap !important; z-index:10 !important; pointer-events:auto !important;';
var titleStyle = 'position:static !important; transform:none !important; display:block !important; font-family:"Cinzel", Georgia, serif !important; font-size:18px !important; font-weight:700 !important; letter-spacing:2px !important; color:#f5d77f !important; text-decoration:none !important; text-shadow:0 2px 4px rgba(0,0,0,0.9), 0 0 10px rgba(245,215,127,0.3) !important; line-height:1.25 !important; margin:0 0 4px 0 !important; padding:0 !important; user-select:text !important;';
var vanisevaWrapStyle = 'position:static !important; transform:none !important; display:block !important; margin:0 0 4px 0 !important; line-height:1.2 !important;';
var vanisevaLinkStyle = 'color:#f5d77f !important; font-family:"Noto Serif", Georgia, serif !important; font-size:12.5px !important; font-style:normal !important; font-weight:500 !important; letter-spacing:0.35px !important; text-decoration:none !important; border:0 !important; background:none !important; outline:none !important; padding:0 !important; border-radius:0 !important; cursor:pointer !important; display:inline-block !important; transition:all 0.18s ease !important;box-shadow:none !important;';
var sisterWrapStyle = 'position:static !important; transform:none !important; display:flex !important; align-items:center !important; justify-content:center !important; gap:14px !important; margin:0 !important; line-height:1.2 !important;';
var sisterLinkStyle = 'color:#f5d77f !important; font-family:"Noto Serif", Georgia, serif !important; font-size:13px !important; font-weight:600 !important; letter-spacing:0.4px !important; text-decoration:none !important; border:none !important; border-bottom:none !important; outline:none !important; padding:2px 8px !important; border-radius:3px !important; display:inline-flex !important; align-items:center !important; cursor:pointer !important; transition:all 0.18s ease !important;';
var sepStyle = 'color:rgba(245,215,127,0.4) !important; font-size:11px !important; line-height:1 !important; user-select:none !important;';
var $block = $('<div>', {
id: 'vanipedia-topbar-center-block',
class: 'vanipedia-topbar-center-block',
style: blockStyle
});
var $title = $('<div>', {
id: 'vanipedia-topbar-title',
class: 'vanipedia-topbar-main-title',
style: titleStyle,
text: titleText
});
var $vaniseva = $('<div>', {
class: 'vanipedia-topbar-vaniseva-title',
style: vanisevaWrapStyle
}).html('<a href="https://vaniseva.org" target="_blank" rel="noopener noreferrer" title="Vaniseva" style="' + vanisevaLinkStyle + '">Collaborate with us to invoke and fully manifest Śrīla Prabhupāda's Vani-presence</a>');
var $sisterLinks = $('<div>', {
class: 'vanipedia-topbar-sister-links',
style: sisterWrapStyle
}).html(
'<a href="https://vanisource.org" target="_blank" rel="noopener noreferrer" class="vanipedia-topbar-sister-link" title="Vanisource" style="' + sisterLinkStyle + '">vanisource.org</a>' +
'<span class="vanipedia-topbar-sister-sep" aria-hidden="true" style="' + sepStyle + '">•</span>' +
'<a href="https://vaniquotes.org" target="_blank" rel="noopener noreferrer" class="vanipedia-topbar-sister-link" title="Vaniquotes" style="' + sisterLinkStyle + '">vaniquotes.org</a>' +
'<span class="vanipedia-topbar-sister-sep" aria-hidden="true" style="' + sepStyle + '">•</span>' +
'<a href="https://vanimedia.org" target="_blank" rel="noopener noreferrer" class="vanipedia-topbar-sister-link" title="Vanimedia" style="' + sisterLinkStyle + '">vanimedia.org</a>'
);
$block.append($title, $vaniseva, $sisterLinks);
return $block;
}
function updateTopBar() {
removeGlobalSiteNotice();
$('#vanipedia-topbar-center-block, #vanipedia-topbar-center-block-mobile, #vanipedia-topbar-title, #vanipedia-topbar-title-mobile, #vanipedia-topbar-title-link, #vanipedia-topbar-center-title, #vanipedia-topbar-home-link, #vanipedia-topbar-sister-links, #vanipedia-topbar-sister-links-mobile, .vanipedia-topbar-sister-links, .vanipedia-topbar-center-block').remove();
$('.vector-header-container').css({
'background': 'transparent',
'background-color': 'transparent',
'border': 'none',
'box-shadow': 'none',
'padding': '0',
'margin': '0',
'min-height': '0',
'height': 'auto',
'width': '100%',
'max-width': '100%'
});
var isMobile = (window.innerWidth <= 999) || $('body').hasClass('skin-minerva') || $('body').hasClass('skin-vector-mobile') || $('.minerva-header').length > 0;
var $header = $('header.mw-header, header.vector-header').not('.minerva-header').first();
if (!$header.length && !$('body').hasClass('skin-minerva') && !$('.minerva-header').length) {
$header = $('#mw-head, header').not('.minerva-header').filter(':visible').first();
}
if ($header.length) {
$header.css({
'min-height': isMobile ? '52px' : '86px',
'height': isMobile ? '52px' : 'auto',
'max-height': isMobile ? '52px' : 'none',
'padding': isMobile ? '0 10px' : '10px 24px',
'background-color': '#345B63',
'border-bottom': '2px solid #b1873d',
'box-shadow': '0 4px 18px rgba(0,0,0,0.35)',
'position': 'relative',
'display': 'flex',
'flex-wrap': 'nowrap',
'align-items': 'center',
'justify-content': 'space-between',
'box-sizing': 'border-box',
'width': '100%',
'max-width': '100%'
});
if (!isMobile) {
$header.append(createCenterBlock());
}
var $search = $header.find('.vector-header-start #p-search, #p-search');
if ($search.length) {
$search.after(createHomeLink());
} else if ($header.find('.vector-header-start').length) {
$header.find('.vector-header-start').append(createHomeLink());
}
}
var $minervaHeader = $('.minerva-header');
if ($minervaHeader.length) {
// 1. Ensure "Vanipedia" Title Link exists with text in the branding box
var $branding = $minervaHeader.find('.branding-box');
if ($branding.length) {
var $brandLink = $branding.find('a');
if ($brandLink.length) {
if (!$brandLink.text().trim()) {
$brandLink.html('<span>Vanipedia</span>');
}
} else {
$branding.html('<a href="/wiki/Main_Page"><span>Vanipedia</span></a>');
}
} else {
var brandHtml = '<div class="branding-box"><a href="/wiki/Main_Page"><span>Vanipedia</span></a></div>';
var $burger = $minervaHeader.find('#mw-mf-main-menu-button, .navigation-drawer.toggle-list').first();
if ($burger.length) {
$burger.after(brandHtml);
} else {
$minervaHeader.prepend(brandHtml);
}
}
// 2. Ensure Home Link is inserted cleanly
var $minervaForm = $minervaHeader.find('.minerva-search-form, #searchform').first();
if ($minervaForm.length && !$minervaHeader.find('#vanipedia-topbar-home-link').length) {
$minervaForm.before(createHomeLink());
} else if (!$minervaHeader.find('#vanipedia-topbar-home-link').length) {
var $minervaUser = $minervaHeader.find('.minerva-user-navigation, #ca-mytalks').first();
if ($minervaUser.length) {
$minervaUser.before(createHomeLink());
} else {
$minervaHeader.append(createHomeLink());
}
}
$minervaHeader.css({
'flex-wrap': 'nowrap',
'height': '52px',
'min-height': '52px',
'max-height': '52px',
'padding': '0 10px',
'display': 'flex',
'align-items': 'center',
'justify-content': 'space-between',
'box-sizing': 'border-box'
});
}
var $stageHeader = $('#vani-stage-header-slot');
if ($stageHeader.length && !$stageHeader.find('.vanipedia-topbar-center-block').length) {
var $stageSearch = $stageHeader.find('#p-search, .search-box, .minerva-search-form').first();
if ($stageSearch.length && !$stageHeader.find('#vanipedia-topbar-home-link').length) {
$stageSearch.after(createHomeLink());
}
if (!isMobile) {
$stageHeader.append(createCenterBlock());
}
}
var $stickyTitle = $('#vector-sticky-header .vector-sticky-header-title, #vector-sticky-header .vector-sticky-header-context-bar .mw-headline');
if ($stickyTitle.length) {
$stickyTitle.html('<a href="' + targetUrl + '" style="color: inherit; text-decoration: none;">' + titleText + '</a>');
}
}
$(function() {
removeGlobalSiteNotice();
});
var topbarResizeTimer;
var lastVanipediaTopWidth = window.innerWidth;
$(window).on('resize orientationchange', function() {
if (Math.abs(window.innerWidth - lastVanipediaTopWidth) < 10) return;
lastVanipediaTopWidth = window.innerWidth;
clearTimeout(topbarResizeTimer);
topbarResizeTimer = setTimeout(updateTopBar, 150);
});
$(document).ready(updateTopBar);
if (window.mw && mw.hook) {
mw.hook('wikipage.content').add(updateTopBar);
}
})();
// ==========================================================================
/* 2026-11-11 (Vamshi Krishna): keep the header and footer from overlapping at in-between widths.
- Header: if the centre block (site title, Vaniseva line, petal links) would run over the search box,
Home link or user links, it moves into the free space between them, shrinking a little if needed,
then shows only the petal name, and is hidden only if even that doesn't fit (2026-11-12).
- Footer: on wide screens the social icons are hidden when they would cover Donate, and the links
are centred. On narrow screens the right edge of the links fades while more are off-screen.
The skin sets these styles inline with !important (and re-applies the footer layout on every resize), so
this runs after it, and Common.css cannot override them. */
(function () {
function leaves(el) {
var out = [];
el.querySelectorAll('*').forEach(function (e) {
if (!e.children.length) {
var r = e.getBoundingClientRect();
if (r.width && r.height) out.push(r);
}
});
return out;
}
function clash(a, b) {
for (var x = 0; x < a.length; x++) {
for (var y = 0; y < b.length; y++) {
var r = a[x], s = b[y];
if (Math.min(r.right, s.right) - Math.max(r.left, s.left) > 0 &&
Math.min(r.bottom, s.bottom) - Math.max(r.top, s.top) > 2) return true;
}
}
return false;
}
function fixMidWidths() {
var w = window.innerWidth;
var header = document.querySelector('header.vector-header, header.mw-header');
document.querySelectorAll('.vanipedia-topbar-center-block').forEach(function (b) {
var title = b.querySelector('.vanipedia-topbar-main-title');
if (title && !title.dataset.fullTitle) title.dataset.fullTitle = title.textContent;
if (title) title.textContent = title.dataset.fullTitle;
// Start from the skin's own position each time (Vanisource keeps the same block between resizes).
if (!b.dataset.fitInit) {
b.dataset.fitInit = '1';
b.dataset.fitTransform = b.style.getPropertyValue('transform');
}
if (b.dataset.fitTransform) b.style.setProperty('transform', b.dataset.fitTransform, 'important');
else b.style.removeProperty('transform');
b.style.setProperty('display', 'flex', 'important');
if (w < 1000 || !header) return;
var theirs = [];
header.querySelectorAll('#p-search, #vanipedia-topbar-home-link, .vector-header-end').forEach(function (e) {
if (!b.contains(e)) theirs = theirs.concat(leaves(e));
});
if (clash(leaves(b), theirs)) b.style.setProperty('display', 'none', 'important');
});
var bar = document.getElementById('vh-bottom-bar');
if (!bar) return;
var left = bar.querySelector('.vh-bottom-bar-left-space');
var right = bar.querySelector('.vh-bottom-bar-right-space');
var inner = bar.querySelector('.vh-bottom-bar-inner');
var nav = bar.querySelector('.vh-bottom-nav-links');
var social = bar.querySelector('.vh-bottom-social-links');
if (!left || !right || !inner || !nav || !social) return;
// The icons measure 0 px until their images load, so check again once they have.
bar.querySelectorAll('img').forEach(function (img) {
if (!img.complete && !img.dataset.fixBound) {
img.dataset.fixBound = '1';
img.addEventListener('load', schedule);
}
});
if (w >= 1000) {
// The footer is kept between resizes here, so clear a fade left over from a narrow window.
nav.style.removeProperty('-webkit-mask-image');
nav.style.removeProperty('mask-image');
var nr = nav.getBoundingClientRect(), sr = social.getBoundingClientRect();
if (sr.width && (nr.right + 8 > sr.left || sr.right > w)) {
left.style.setProperty('display', 'none', 'important');
right.style.setProperty('display', 'none', 'important');
inner.style.setProperty('justify-content', 'center', 'important');
}
return;
}
var updateFade = function () {
var more = nav.scrollLeft + nav.clientWidth < nav.scrollWidth - 2;
var mask = more ? 'linear-gradient(to right, #000 calc(100% - 40px), transparent)' : 'none';
nav.style.setProperty('-webkit-mask-image', mask, 'important');
nav.style.setProperty('mask-image', mask, 'important');
};
updateFade();
if (!nav.dataset.fadeBound) {
nav.dataset.fadeBound = '1';
nav.addEventListener('scroll', updateFade, { passive: true });
}
}
var pending;
// Run after the skin's own header and footer setup (which re-runs on resize and 150 ms after it).
function schedule() { clearTimeout(pending); pending = setTimeout(fixMidWidths, 300); }
$(schedule);
$(window).on('resize orientationchange', schedule);
// This script often starts after the page has loaded, so also re-check when the fonts are ready.
if (document.fonts && document.fonts.ready) document.fonts.ready.then(schedule);
})();
/* VaniSearch Popup Launcher + Desktop Burger Restore */
(function() {
var lockPopupSubmitUntil = 0;
function ensureBurgerMenu() {
var nodes = document.querySelectorAll('.vector-feature-main-menu-pinned-enabled, .vector-feature-main-menu-pinned-clientpref-1');
for (var i = 0; i < nodes.length; i++) {
nodes[i].classList.remove('vector-feature-main-menu-pinned-enabled', 'vector-feature-main-menu-pinned-clientpref-1');
nodes[i].classList.add('vector-feature-main-menu-pinned-disabled', 'vector-feature-main-menu-pinned-clientpref-0');
}
var dropdown = document.getElementById('vector-main-menu-dropdown');
var header = document.querySelector('header.vector-header, header.mw-header');
var start = header ? header.querySelector('.vector-header-start') : document.querySelector('.vector-header-start');
if (dropdown && start && dropdown.parentNode !== start) {
start.insertBefore(dropdown, start.firstChild);
}
var menu = document.getElementById('vector-main-menu');
var unpinned = document.getElementById('vector-main-menu-unpinned-container') ||
(dropdown ? dropdown.querySelector('.vector-dropdown-content') : null);
if (menu && unpinned) {
menu.classList.remove('vanipedia-sidebar-menu', 'vanipedia-collapsed');
if (!unpinned.contains(menu)) {
unpinned.appendChild(menu);
}
}
}
window.open_modal = function() {
var ori = document.getElementById('ori_search') || document.getElementById('searchInput');
var modal = document.getElementById('mspu_div_wrapper');
var inpSearch = document.getElementById('mspu_txt_input');
var submitBtn = document.getElementById('mspu_but_submit');
if (!modal || !inpSearch) return false;
lockPopupSubmitUntil = Date.now() + 500;
if (submitBtn) {
submitBtn.disabled = true;
setTimeout(function() { submitBtn.disabled = false; }, 500);
}
if (typeof window.sync_but_search === 'function') {
try { window.sync_but_search(); } catch (e) {}
}
if (ori) {
inpSearch.value = ori.value;
ori.blur();
}
modal.style.display = 'block';
setTimeout(function() {
inpSearch.focus();
}, 250);
return false;
};
function protectModalForm() {
var modal = document.getElementById('mspu_div_wrapper');
if (!modal || modal.dataset.vaniHardLocked) return;
modal.dataset.vaniHardLocked = 'true';
var strayBtns = modal.querySelectorAll('.vani-search-trigger-btn');
for (var i = 0; i < strayBtns.length; i++) {
if (strayBtns[i].parentNode) strayBtns[i].parentNode.removeChild(strayBtns[i]);
}
var mForm = modal.querySelector('form');
if (mForm) {
mForm.addEventListener('submit', function(e) {
if (Date.now() < lockPopupSubmitUntil) {
e.preventDefault();
e.stopPropagation();
e.stopImmediatePropagation();
return false;
}
}, true);
}
var inpSearch = document.getElementById('mspu_txt_input');
if (inpSearch) {
['keydown', 'keypress', 'keyup'].forEach(function(evt) {
inpSearch.addEventListener(evt, function(e) {
if (Date.now() < lockPopupSubmitUntil && (e.key === 'Enter' || e.keyCode === 13)) {
e.preventDefault();
e.stopPropagation();
e.stopImmediatePropagation();
return false;
}
}, true);
});
}
}
function buildCleanSearchBox(oldElement, isMobile) {
var wrap = document.createElement('div');
wrap.className = isMobile ? 'vani-mobile-search-wrap' : 'vani-desktop-search-wrap';
wrap.style.cssText = 'flex: 1 1 auto; width: 100%; max-width: 280px; display: flex !important; align-items: center !important; position: relative !important; margin: 0; z-index: 999999 !important;';
var inp = document.createElement('input');
inp.type = 'text';
inp.id = 'ori_search';
inp.className = 'vani-clean-search-input';
inp.placeholder = 'Search Vanipedia';
inp.autocomplete = 'off';
inp.style.cssText = 'width:100% !important; height:32px !important; background:#1f3e45 !important; background-image:none !important; color:#ffffff !important; -webkit-text-fill-color:#ffffff !important; border:1.5px solid #f5d77f !important; border-radius:16px !important; padding:2px 32px 2px 12px !important; font-size:15px !important; outline:none !important; box-sizing:border-box !important;';
var btn = document.createElement('button');
btn.type = 'button';
btn.className = 'vani-inline-go';
btn.innerHTML = '🔍';
btn.style.cssText = 'position:absolute !important; right:8px !important; top:50% !important; transform:translateY(-50%) !important; background:none !important; border:none !important; font-size:15px !important; cursor:pointer !important; padding:0 !important; line-height:1 !important; z-index:20 !important;';
['click', 'focus', 'focusin', 'touchstart', 'input', 'keypress'].forEach(function(evtType) {
inp.addEventListener(evtType, function(e) {
e.stopPropagation();
}, true);
});
inp.addEventListener('keydown', function(e) {
e.stopPropagation();
if (e.key === 'Enter' || e.keyCode === 13) {
e.preventDefault();
e.stopImmediatePropagation();
window.open_modal();
}
}, true);
btn.addEventListener('click', function(e) {
e.preventDefault();
e.stopPropagation();
e.stopImmediatePropagation();
window.open_modal();
}, true);
wrap.appendChild(inp);
wrap.appendChild(btn);
if (oldElement.parentNode) {
oldElement.parentNode.replaceChild(wrap, oldElement);
}
}
function setupAllSearchBars() {
ensureBurgerMenu();
protectModalForm();
var minervaHeader = document.querySelector('.minerva-header');
if (minervaHeader) {
document.documentElement.classList.remove('overlay-enabled');
document.body.classList.remove('search-enabled', 'overlay-enabled');
var b = minervaHeader.querySelector('.branding-box');
if (b) b.style.setProperty('display', 'none', 'important');
var mForm = minervaHeader.querySelector('form.minerva-search-form, form#searchform');
if (mForm && !minervaHeader.querySelector('.vani-mobile-search-wrap')) {
buildCleanSearchBox(mForm, true);
}
}
if (!document.querySelector('.vani-desktop-search-wrap') && !minervaHeader) {
var pSearch = document.querySelector('#p-search');
if (pSearch && !pSearch.dataset.vaniDetached) {
var cleanPSearch = pSearch.cloneNode(true);
cleanPSearch.dataset.vaniDetached = 'true';
cleanPSearch.classList.add('vector-search-box-show-thumbnail');
var toggle = cleanPSearch.querySelector('.search-toggle');
if (toggle && toggle.parentNode) toggle.parentNode.removeChild(toggle);
if (pSearch.parentNode) pSearch.parentNode.replaceChild(cleanPSearch, pSearch);
}
var dTarget = document.querySelector('form#searchform, #p-search form, .vector-search-box form');
if (!dTarget) {
var rawInput = document.querySelector('#ori_search, #searchInput, input[type="search"]');
if (rawInput && !rawInput.closest('#mspu_div_wrapper') && !rawInput.classList.contains('vani-clean-search-input')) {
dTarget = rawInput.closest('form') || rawInput.parentElement;
}
}
if (dTarget && !dTarget.closest('#mspu_div_wrapper')) {
buildCleanSearchBox(dTarget, false);
}
}
}
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', setupAllSearchBars);
} else {
setupAllSearchBars();
}
setTimeout(setupAllSearchBars, 200);
setTimeout(setupAllSearchBars, 700);
})();