FlightGear wiki:Instant-Refs: Difference between revisions

Jump to navigation Jump to search
m
→‎The Script: untested change: skip FGCquote, create ref-only quotes, i.e. less obnoxious appearance
(→‎The Script: dbLog function: remove alert boxes in debug mode (it's really annoying) log to console instead also update version number)
m (→‎The Script: untested change: skip FGCquote, create ref-only quotes, i.e. less obnoxious appearance)
Line 347: Line 347:
// ==UserScript==
// ==UserScript==
// @name        Instant-Cquotes
// @name        Instant-Cquotes
// @version    0.27
// @version    0.28
// @description Automatically converts mailing list and forum quotes into Mediawiki markup (cquotes).
// @description Automatically converts mailing list and forum quotes into Mediawiki markup (cquotes).
// @author      Hooray, bigstones, Philosopher & Red Leader (2013-2016)
// @author      Hooray, bigstones, Philosopher & Red Leader (2013-2016)
Line 758: Line 758:
// Formats the quote
// Formats the quote


function createCquote(data) {
function createCquote(data, light_quotes=true) {
// skip FGCquote (experimental)
if (light_quotes) return createOnlyRef(data);
 
   var date_added = new Date();
   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' +
Line 772: Line 775:
   return wikiText;
   return wikiText;
}
}
function createOnlyRef(data) {
  var date_added = new Date();
  var wikiText = data.content + '\n'+'<ref>{{cite web\n' +
  '  |url    = ' + data.url + '\n' +
  '  |title  = ' + nowiki(data.title) + '\n' +
  '  |author = ' + nowiki(data.author) + '\n' +
  '  |date  = ' + datef(data.date) + '\n' +
  '  |added  = ' + datef(date_added.toDateString()) + '\n' +
  '  |script_version = ' + GM_info.script.version + '\n' +
  '  }}</ref>\n';
  return wikiText;
}
// Output the text.
// Output the text.
// Tries the jQuery dialog, and falls back to window.prompt()
// Tries the jQuery dialog, and falls back to window.prompt()

Navigation menu