Changes

Jump to navigation Jump to search
+ script
Line 62: Line 62:  
* <code>|hide-url=URL</code> (replacing <code>|url=</code>) moves the URL into a superscript link. Mainly useful for broken mods with a workaround, so players don't automatically click through to the old mod.
 
* <code>|hide-url=URL</code> (replacing <code>|url=</code>) moves the URL into a superscript link. Mainly useful for broken mods with a workaround, so players don't automatically click through to the old mod.
 
* <code>|link1=URL</code> and <code>|link2=URL</code> adds superscript links. Mainly useful for linking to pull requests.
 
* <code>|link1=URL</code> and <code>|link2=URL</code> adds superscript links. Mainly useful for linking to pull requests.
 +
 +
==Script==
 +
This script generates the template call when run from a Nexus or Chucklefish mod page.
 +
<source lang="javascript">
 +
switch(location.host)
 +
{
 +
case "www.nexusmods.com":
 +
var url = location.origin + location.pathname.replace(/\/*$/, '');
 +
var name = $(".header-name").text();
 +
var author = $(".uploader a").text();
 +
var author2 = $(".header-author strong").text();
 +
break;
 +
 +
case "community.playstarbound.com":
 +
var url = location.origin + location.pathname.replace(/\/*$/, '');
 +
var name = $.trim($("h1:first").contents().first().text());
 +
var author = $(".primaryContent[data-author]:first").attr("data-author");
 +
break;
 +
 +
default:
 +
throw `Unknown domain: ${location.host}`;
 +
}
 +
 +
var template = `
 +
{{/entry
 +
  |name    = ${name}
 +
  |author  = ${author}`;
 +
if(author2 && author2 != author)
 +
  template += '\n' + `  |author2 = ${author2}`;
 +
template += `
 +
  |url    = ${url}
 +
  |status  = ok
 +
  |summary =
 +
  |source  =
 +
}}
 +
`;
 +
</source>
    
[[Category:Modding]]</noinclude>
 
[[Category:Modding]]</noinclude>
translators
8,445

edits

Navigation menu