User:Writ Keeper/Scripts/searchWatcher.js

$(document).ready(function{	if(mw.config.get("wgCanonicalSpecialPageName") == "Search")	{		var pageList = $("div.mw-search-result-heading > a").map(function {return $(this).text;}).toArray.join("|");		var requestData = {action:"query",prop:"info",format:"json",inprop:"watched",titles:pageList};		$.post("/w/api.php",requestData,function(response){ for(var pageIndex in response.query.pages) {				var page = response.query.pages[pageIndex]; if(typeof page.watched != "undefined") {					$("div.mw-search-result-heading > a[title='"+page.title+"'],div.mw-search-result-heading > a[title^='"+page.title+"; ']").append("<div style=\"display:inline-block; width:16px;height:16px;background-image: linear-gradient(rgba(0, 0, 0, 0), rgba(0, 0, 0, 0)), url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+CjxzdmcKICAgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIgogICB4bWxuczpjYz0iaHR0cDovL2NyZWF0aXZlY29tbW9ucy5vcmcvbnMjIgogICB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiCiAgIHhtbG5zOnN2Zz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciCiAgIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIKICAgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiCiAgIHZlcnNpb249IjEuMSIKICAgd2lkdGg9IjE2IgogICBoZWlnaHQ9IjE2IgogICBpZD0ic3ZnMiI+CiAgPGRlZnMKICAgICBpZD0iZGVmczQiPgogICAgPGxpbmVhckdyYWRpZW50CiAgICAgICBpZD0ibGluZWFyR3JhZGllbnQzNzg4Ij4KICAgICAgPHN0b3AKICAgICAgICAgaWQ9InN0b3AzNzkwIgogICAgICAgICBzdHlsZT0ic3RvcC1jb2xvcjoj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