In this article, we will explore the impact and influence of
User:PrimeHunter/Source links.js on contemporary society. Since its emergence,
User:PrimeHunter/Source links.js has captured the attention of millions of people around the world and has gained a prominent place in popular culture. Over the years,
User:PrimeHunter/Source links.js has demonstrated his ability to shape opinions, inspire movements and challenge established norms. In this sense, it is crucial to carefully examine how
User:PrimeHunter/Source links.js has contributed to the evolution of society in different aspects, from politics and economics to the artistic sphere and individual expression. This article aims to shed light on the fundamental role
User:PrimeHunter/Source links.js has played in our daily lives and its influence on the way we perceive the world around us.
/* This script adds "Source links" below "What links here" in the sidebar.
"What links here" will include pages using a template with the link.
"Source links" tries to search for pages where the link is in the source.
To use the script, add the following line to ]:
importScript('User:PrimeHunter/Source links.js'); // Linkback: ]
*/
mw.loader.using(, function () {
var name = mw.config.get( 'wgPageName' ).replace("Special:WhatLinksHere/", "");
var url;
try {
url = mw.util.getUrl( 'Special:Search' ) + '?trimsearch=1&profile=all&search=' +
encodeURIComponent('linksto:"' + name + '" ' + 'insource:"' + name + '" ' +
'insource:/\\ + name.charAt(0).toLowerCase() + ']' +
name.substring(1).replace(/{}()*+!<=:?.\/\\^$|#\s,]/g, '\\$&') + '\\|#]/' ).replace(/_/g, " ");
} catch(e) {
url = '#error'; // EXAMPLE URL: https://en.wikipedia.org/w/index.php?title=%F0%9F%91%A9%F0%9F%8F%BF&action=history
}
mw.util.addPortletLink(
'p-tb',
url,
'Source links',
'pt-sourcelinks',
'What links here in the source',
null,
'#t-recentchangeslinked'
);
});
/* The url generated above adds the parameter trimsearch=1 when "Source links" is clicked.
If it's present then trim search results by hiding two classes for images and data. */
const queryString = window.location.search;
console.log(queryString);
const urlParams = new URLSearchParams(queryString);
const trimsearch = urlParams.get('trimsearch');
if (trimsearch === '1') {
var searchimages = document.getElementsByClassName('searchResultImage-thumbnail');
for (var i = 0; i < searchimages.length; i ++) {
searchimages.style.display = 'none';
}
var searchdata = document.getElementsByClassName('mw-search-result-data');
for (var i = 0; i < searchdata.length; i ++) {
searchdata.style.display = 'none';
}
}