User:Polygnotus/Scripts/Surveys.js: Difference between revisions

Content deleted Content added
No edit summary
No edit summary
 
(One intermediate revision by the same user not shown)
Line 224:
});
// Insert afterat the firsttop paragraphof or at the topmw-content-text
const $content = $('#mw-content-text');
const $firstPara = $content.find('p').firstprepend($surveyBox);
if ($firstPara.length) {
$firstPara.after($surveyBox);
} else {
$content.prepend($surveyBox);
}
})
.catch(error => {
Line 251 ⟶ 246:
// Auto-generate survey display on userpage
generateSurveyDisplay();
// Only add link if it doesn't already exist
if ($('#update-quicksurveys').length === 0) {
// Add a small link to manually update
const $link = $('<span style="font-size: 0.8em; margin-left: 1em;">').html(
'[<a href="#" id="update-quicksurveys">Check QuickSurveys</a>]'
);
$('#firstHeading').append($link);
$('#update-quicksurveys').on('click', function(e) {
e.preventDefault();
fetchAndProcessSurveys();
});
}
}, 100); // Small delay to ensure DOM is ready
}