duroth

joined 1 year ago
[โ€“] duroth 2 points 1 year ago

Be careful though; the code actually loads a different script that's been posted by a Wikipedia user, not Wikipedia itself. You can view the script here, and do heed the warning at the top:

Code that you insert on this page could contain malicious content capable of compromising your account. If you import a script from another page with "importScript", "mw.loader.load", "iusc", or "lusc", take note that this causes you to dynamically load a remote script, which could be changed by others. Editors are responsible for all edits and actions they perform, including by scripts. User scripts are not centrally supported and may malfunction or become inoperable due to software changes. A guide to help you find broken scripts is available. If you are unsure whether code you are adding to this page is safe, you can ask at the appropriate village pump. This code will be executed when previewing this page.

Never run/execute code that you haven't verified yourself. Also, keep in mind that while the code might be trusted now, because you're including code from a wikipedia page that might be changed at any one moment, you can't be sure the page won't serve you malware tomorrow. So instead of using the code above, it's safer to use the code below (which is just a copy-paste of the actual script, and therefore can not be changed by other people):

/*
  Force Wikipedia to use the desktop version.
  Google on mobile uses "en.m.wikipedia.org", this scripts redirects to the normal version.
  
  CC0
*/
if(window.location.href.match(/^https?:\/\/[^.]+\.m\./)) {
  var desktopUrl = $('#mw-mf-display-toggle').attr('href')
  if(desktopUrl) {
  	window.location.href = desktopUrl
  }
}
[โ€“] duroth 1 points 1 year ago (1 children)

Isn't the "Lemmy API" basically just ActivityPub? Could this package be made to work with Kbin, for example? Possibly other Fediverse projects?