For faster navigation, this Iframe is preloading the Wikiwand page for User:PrimeHunter/Source links.js.

User:PrimeHunter/Source links.js

/* 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 Special:MyPage/common.js:
 
importScript('User:PrimeHunter/Source links.js'); // Linkback: [[User:PrimeHunter/Source links.js]]

*/

mw.loader.using(['mediawiki.util'], 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[0] + 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[i].style.display = 'none';
  }
  var searchdata = document.getElementsByClassName('mw-search-result-data');
  for (var i = 0; i < searchdata.length; i ++) {
    searchdata[i].style.display = 'none';
  }
}
{{bottomLinkPreText}} {{bottomLinkText}}
User:PrimeHunter/Source links.js
Listen to this article

This browser is not supported by Wikiwand :(
Wikiwand requires a browser with modern capabilities in order to provide you with the best reading experience.
Please download and use one of the following browsers:

This article was just edited, click to reload
This article has been deleted on Wikipedia (Why?)

Back to homepage

Please click Add in the dialog above
Please click Allow in the top-left corner,
then click Install Now in the dialog
Please click Open in the download dialog,
then click Install
Please click the "Downloads" icon in the Safari toolbar, open the first download in the list,
then click Install
{{::$root.activation.text}}

Install Wikiwand

Install on Chrome Install on Firefox
Don't forget to rate us

Tell your friends about Wikiwand!

Gmail Facebook Twitter Link

Enjoying Wikiwand?

Tell your friends and spread the love:
Share on Gmail Share on Facebook Share on Twitter Share on Buffer

Our magic isn't perfect

You can help our automatic cover photo selection by reporting an unsuitable photo.

This photo is visually disturbing This photo is not a good choice

Thank you for helping!


Your input will affect cover photo selection, along with input from other users.

X

Get ready for Wikiwand 2.0 ๐ŸŽ‰! the new version arrives on September 1st! Don't want to wait?