User:Ca/RSNsearch.js

//written by ChatGPT function openRSNSearchBox { $('body').prepend(' ' +   ' ' +      ' RSN Search ' +      ' Search for topics on the Reliable Sources Noticeboard ' +      '' +      'Search' +      '&#10006; ' +    ' ' +  ' ');

$("#rsn-modal").css({   "position": "fixed",    "z-index": "1",    "left": "0",    "top": "0",    "width": "100%",    "height": "100%",    "overflow": "hidden",    "background-color": "rgba(0, 0, 0, 0.4)"  });

$("#rsn-content").css({   "background-color": "#ffffff",    "margin": "15% auto",    "padding": "20px",    "border": "1px solid #ccc",    "width": "400px",    "font-size": "16px",    "box-shadow": "0px 2px 8px rgba(0, 0, 0, 0.2)",    "border-radius": "4px",    "text-align": "center"  });

$("#rsn-close").css({   "position": "absolute",    "top": "10px",    "right": "10px",    "border": "none",    "background-color": "transparent",    "font-size": "24px",    "cursor": "pointer",    "outline": "none"  });

$("#rsn-close").click(function {   $("#rsn-modal").remove;  });

$("#rsn-input").on("input", function {   var inputValue = $(this).val;    var searchLink = "https://en.wikipedia.org/w/index.php?search=" + inputValue + "&prefix=Wikipedia%3AReliable+sources%2FNoticeboard&title=Special:Search&profile=advanced&fulltext=1&ns0=1";    $("#rsn-link").attr("href", searchLink);  }); }

$(document).ready(function { mw.util.addPortletLink('p-tb', 'javascript:void(0)', 'RSN Search', 'rsn-search-link', null, null);

$('#rsn-search-link').on('click', function {   openRSNSearchBox;  }); });