2,733
edits
Red Leader (talk | contribs) m (Slight fixes + suggestion to remove IE stuff) |
Red Leader (talk | contribs) (output methods, version, enclose) |
||
Line 68: | Line 68: | ||
== The Script == | == The Script == | ||
{{Note|This code is put into the public domain, anybody interested in working with/contributing to the code, is invited to directly edit this wiki article.}} | {{Note|This code is put into the public domain, anybody interested in working with/contributing to the code, is invited to directly edit this wiki article.}} | ||
<syntaxhighlight lang="javascript"> | <syntaxhighlight lang="javascript" enclose="div"> | ||
// ==UserScript== | // ==UserScript== | ||
// @name Instant-Cquotes | // @name Instant-Cquotes | ||
Line 74: | Line 74: | ||
// @description Automatically converts mailing list and forum quotes into Mediawiki markup. | // @description Automatically converts mailing list and forum quotes into Mediawiki markup. | ||
// @namespace http://wiki.flightgear.org/ | // @namespace http://wiki.flightgear.org/ | ||
// @version 0. | // @version 0.14 | ||
// @icon http://wiki.flightgear.org/images/6/62/FlightGear_logo.png | // @icon http://wiki.flightgear.org/images/6/62/FlightGear_logo.png | ||
// @require http://code.jquery.com/jquery-1.11.1.min.js | // @require http://code.jquery.com/jquery-1.11.1.min.js | ||
Line 154: | Line 154: | ||
var OUTPUT = OutputMethods().msgbox; | var OUTPUT = OutputMethods().msgbox; | ||
function OutputMethods() { | function OutputMethods(){ | ||
var methods = { | var methods = { | ||
// Shows an alert(); message box | |||
msgbox: function(msg){ | |||
if (window.prompt("Copy to clipboard: Ctrl+C, Enter", msg) !== null){ | |||
msgbox: function(msg) { | |||
if (window.prompt ("Copy to clipboard: Ctrl+C, Enter", msg) !== null) | |||
window.getSelection().removeAllRanges(); // deselect all text | window.getSelection().removeAllRanges(); // deselect all text | ||
} | |||
}, | }, | ||
// | // Show a jQuery UI dialog | ||
jqueryDiag: function(msg){ | |||
jqueryDiag: function(msg) { | var diagDiv = $('<div id="MyDialog"><textarea id="quotedtext" rows="10" cols="80" style="width: 290px; height: 290px">' + msg + '</textarea></div>'); | ||
var diagDiv = $('<div id="MyDialog"><textarea id="quotedtext" rows="10" cols="80" | |||
var diagParam = { | |||
var diagParam = { title: "Copy your quote with | title: "Copy your quote with Ctrl-c", | ||
modal: true, | |||
width: 'auto', | |||
buttons: [ | |||
{ text: "Select all", click: function(){ $('#quotedtext').select(); } }, | |||
{ text: "Cancel", click: function(){ $(this).dialog('close'); } } | |||
] | |||
}; | }; | ||
diagDiv.dialog(diagParam); | diagDiv.dialog(diagParam); | ||
} | }, | ||
}; | }; | ||
return methods; | return methods; | ||
}; | }; |