FlightGear wiki:Instant-Refs: Difference between revisions

Jump to navigation Jump to search
→‎The Script: remove line numbers to make copy&paste easier; fix date added (was the same as the date of the post) (note: untested)
(→‎The Script: remove line numbers to make copy&paste easier; fix date added (was the same as the date of the post) (note: untested))
Line 344: Line 344:
Anybody interested in contributing to the code is invited to directly edit this wiki article.
Anybody interested in contributing to the code is invited to directly edit this wiki article.


<syntaxhighlight lang="javascript" enclose="div" line>
<syntaxhighlight lang="javascript" enclose="div">
// ==UserScript==
// ==UserScript==
// @name        Instant-Cquotes
// @name        Instant-Cquotes
Line 759: Line 759:


function createCquote(data) {
function createCquote(data) {
  var date_added = new Date();
   var wikiText = '{{FGCquote\n' + ((data.content.match(/^\s*?{{cquote/) === null) ? '|1= ' : '| ') + data.content + '\n' +
   var wikiText = '{{FGCquote\n' + ((data.content.match(/^\s*?{{cquote/) === null) ? '|1= ' : '| ') + data.content + '\n' +
   '|2= {{cite web\n' +
   '|2= {{cite web\n' +
   '  | url    = ' + data.url + '\n' +
   '  |url    = ' + data.url + '\n' +
   '  | title  = ' + nowiki(data.title) + '\n' +
   '  |title  = ' + nowiki(data.title) + '\n' +
   '  | author = ' + nowiki(data.author) + '\n' +
   '  |author = ' + nowiki(data.author) + '\n' +
   '  | date  = ' + datef(data.date) + '\n' +
   '  |date  = ' + datef(data.date) + '\n' +
   '  | added   = ' + datef(data.date) + '\n' +
   '  |added = ' + datef(date_added.toDateString()) + '\n' +
   '  | script_version = '+ GM_info.script.version + '\n' +
   '  |script_version = ' + GM_info.script.version + '\n' +
   '  }}\n' +
   '  }}\n' +
   '}}';
   '}}';

Navigation menu