FlightGear wiki:Instant-Refs: Difference between revisions

Jump to navigation Jump to search
m
→‎The Script: add version number to output dialog
m (→‎The Script: directly copy to the clipboard using the corresponding greasemonkey API (may need to be genralized if used with TamperMonkey))
m (→‎The Script: add version number to output dialog)
Line 90: Line 90:


<syntaxhighlight lang="javascript" enclose="div">
<syntaxhighlight lang="javascript" enclose="div">
// ==UserScript==
// ==UserScript==
// @name        Instant-Cquotes
// @name        Instant-Cquotes
// @version    0.20
// @version    0.21
// @description Automatically converts mailing list and forum quotes into Mediawiki markup.
// @description Automatically converts mailing list and forum quotes into Mediawiki markup.
// @author      Hooray, bigstones, Philosopher & Red Leader
// @author      Hooray, bigstones, Philosopher & Red Leader
Line 111: Line 110:
// Check if Greasemonkey/Tampermonkey is available
// Check if Greasemonkey/Tampermonkey is available
try {
try {
  // TODO: add version check for clipboard API and check for TamperMonkey/Scriptish equivalents ?
   GM_addStyle(GM_getResourceText('jQUI_CSS'));
   GM_addStyle(GM_getResourceText('jQUI_CSS'));
  // http://wiki.greasespot.net/GM_info
  var scriptVersion = ' (v'+GM_info.script.version+')';
}  
}  
catch (error) {
catch (error) {
Line 195: Line 197:
   GM_setClipboard(msg);
   GM_setClipboard(msg);
}
}


var METHODS = {
var METHODS = {
   // Shows a window.prompt() message box
   // Shows a window.prompt() message box
   msgbox: function (msg) {
   msgbox: function (msg) {
     window.prompt('Copy to clipboard', msg);
     window.prompt('Copy to clipboard'+scriptVersion, msg);
     setClipboard(msg);
     setClipboard(msg);
   },
   },
Line 207: Line 210:
     var diagDiv = $('<div id="MyDialog"><textarea id="quotedtext" rows="10"cols="80" style="width: 290px; height: 290px">' + msg + '</textarea>' + target_format + '</div>');
     var diagDiv = $('<div id="MyDialog"><textarea id="quotedtext" rows="10"cols="80" style="width: 290px; height: 290px">' + msg + '</textarea>' + target_format + '</div>');
     var diagParam = {
     var diagParam = {
       title: 'Copy your quote with Ctrl+c',
       title: 'Copy your quote with Ctrl+c'+scriptVersion,
       modal: true,
       modal: true,
       width: 'auto',
       width: 'auto',
Line 658: Line 661:
function dbLog(message) {
function dbLog(message) {
   if (Boolean(DEBUG)) console.log(message);
   if (Boolean(DEBUG)) console.log(message);
}
}</syntaxhighlight>
</syntaxhighlight>


[[Category:Wiki maintenance]]
[[Category:Wiki maintenance]]

Navigation menu