More actions
No edit summary |
No edit summary Tag: Reverted |
||
Line 36: | Line 36: | ||
}); | }); | ||
}); | }); | ||
}); | |||
$(document).ready(function() { | |||
setInterval(function() { | |||
$.ajax({ | |||
url: mw.util.wikiScript('api'), | |||
data: { | |||
action: 'query', | |||
prop: 'categories', | |||
titles: 'Dying_Light_Texture', // Replace with your page title | |||
format: 'json' | |||
}, | |||
success: function(data) { | |||
// Process the response and update your category tree dynamically | |||
} | |||
}); | |||
}, 30000); // Refresh every half a minute | |||
}); | }); |
Revision as of 22:32, 30 December 2024
/* Any JavaScript here will be loaded for all users on every page load. */
$(function(){
$('.card').on('mousenter', function(event){
event.preventDefault();
$(this).toggleClass('hovered');
});
$('.card').on('mouseleave', function(event){
event.preventDefault();
$(this).toggleClass('hovered');
});
});
document.querySelectorAll('.sub-card').forEach(card => {
card.addEventListener('click', function(event) {
event.stopPropagation(); // Prevent event bubbling
// Toggle the expanded state of the clicked card
const isExpanded = card.getAttribute('data-expanded') === 'true';
// Flip the current sub-card
card.setAttribute('data-expanded', isExpanded ? 'false' : 'true');
// Hide all other sub-cards
document.querySelectorAll('.sub-card').forEach(otherCard => {
if (otherCard !== card) {
otherCard.setAttribute('data-expanded', 'false');
}
});
});
});
document.querySelectorAll('.card').forEach(card => {
card.addEventListener('mouseleave', function() {
// Collapse all sub-cards when mouse leaves the main card
document.querySelectorAll('.sub-card').forEach(subCard => {
subCard.setAttribute('data-expanded', 'false');
});
});
});
$(document).ready(function() {
setInterval(function() {
$.ajax({
url: mw.util.wikiScript('api'),
data: {
action: 'query',
prop: 'categories',
titles: 'Dying_Light_Texture', // Replace with your page title
format: 'json'
},
success: function(data) {
// Process the response and update your category tree dynamically
}
});
}, 30000); // Refresh every half a minute
});