2,733
edits
Red Leader (talk | contribs) (Re-design of the script. It does the same job, just differently and more generically. Please test and give feedback via #Issues.2Flimitations, etc. P.S. I will comment things, etc later.) |
Red Leader (talk | contribs) (Tiny fixes, etc.) |
||
Line 1: | Line 1: | ||
The '''Instant-Cquotes''' script is a userscript implemented in JavaScript in order to convert [http://forum.flightgear.org/ forum] or [[mailing list]] quotes into MediaWiki markup. It is supported by Firefox, Chrome/Chromium, Opera, Safari. | The '''Instant-Cquotes''' script is a userscript implemented in JavaScript in order to convert [http://forum.flightgear.org/ forum] or [[mailing list]] quotes into MediaWiki markup. It is supported by Firefox, Google Chrome/Chromium, Opera, and Safari. | ||
== Background == | == Background == | ||
Line 10: | Line 10: | ||
This is why it is important for other developers/contributors to know who came up with a certain idea and who originally supported it, possibly months (or even years) after a discussion took place. Good ideas should not just be preserved, but accompanied by corresponding quotes, linking back to the original discussion, so that potential contributors can make up their own minds to determine if/how they want to get involved in some effort or not. | This is why it is important for other developers/contributors to know who came up with a certain idea and who originally supported it, possibly months (or even years) after a discussion took place. Good ideas should not just be preserved, but accompanied by corresponding quotes, linking back to the original discussion, so that potential contributors can make up their own minds to determine if/how they want to get involved in some effort or not. | ||
The Instant-Cquotes script is intended to help with this. It also allows people to easily reuse forum or mailing list announcements in wiki articles, e.g., to update the [[Next Changelog|changelog]], [[Next newsletter|newsletter]] or the [[Release plan/Lessons learned]] page. It does this by making it easy to copy & paste important discussions over to the wiki, without having to rewrite any text or manually put together a proper [[Template: | The Instant-Cquotes script is intended to help with this. It also allows people to easily reuse forum or mailing list announcements in wiki articles, e.g., to update the [[Next Changelog|changelog]], [[Next newsletter|newsletter]] or the [[Release plan/Lessons learned]] page. It does this by making it easy to copy & paste important discussions over to the wiki, without having to rewrite any text or manually put together a proper [[Template:Cquote|Cquote]]. It doesn't take more than a few seconds. | ||
If you want to suggest a new feature/improvement, or have discovered a bug, please add details to the [[# | If you want to suggest a new feature/improvement, or have discovered a bug, please add details to the [[#Issues/limitations|Issues/limitations]] or [[#Feature requests & ideas|Feature requests & ideas]]. | ||
== Example Output == | == Example Output == | ||
Line 45: | Line 45: | ||
== Usage == | == Usage == | ||
# Go to some [[mailing list]] archive URL, for example [http://sourceforge.net/p/flightgear/mailman/ | # Go to some [[mailing list]] archive URL, for example [http://sourceforge.net/p/flightgear/mailman/message/32400727/] or any forum message, such as [http://forum.flightgear.org/viewtopic.php?f=71&t=23299#p212558]. | ||
# Select the relevant portion of text. | # Select the relevant portion of text. | ||
# When you release the mouse button, a box will appear containing the converted text. | # When you release the mouse button, a box will appear containing the converted text. | ||
Line 55: | Line 55: | ||
== Issues/limitations == | == Issues/limitations == | ||
* The JavaScript {{Func link|prompt()|ext=https://developer.mozilla.org/en-US/docs/Web/API/Window/prompt}} boxes used are typically restricted to a max size of about 10 KB; other options should be looked at. {{Not done}} | |||
* The JavaScript | |||
== Feature requests & ideas == | == Feature requests & ideas == | ||
* GET-encoded SID arguments should be stripped from forum URLs. {{Not done}} | * GET-encoded SID arguments should be stripped from forum URLs. {{Not done}} | ||
* Links to repositories should be converted to use wiki templates. {{Not done}} | * Links to repositories should be converted to use wiki templates. {{Not done}} | ||
Line 66: | Line 64: | ||
** Try multiple regexes in order. {{Not done}} | ** Try multiple regexes in order. {{Not done}} | ||
* Use the script to update previously created Cquotes automatically | * Use the script to update previously created Cquotes automatically | ||
** Instead of using the getSelection() helper, we could register a match for <tt>wiki.flightgear.org</tt> with <code>action=edit</code> set, so that we can directly process all text of an edited page, using AJAX calls to open the URL in the background. {{Not done}} | ** Instead of using the <code>getSelection()</code> helper, we could register a match for <tt>wiki.flightgear.org</tt> with <code>action=edit</code> set, so that we can directly process all text of an edited page, using AJAX calls to open the URL in the background. {{Not done}} | ||
== The Script == | == The Script == | ||
{{ | {{PD-author|FlightGear contributors}} | ||
Anybody interested in contributing to the code is invited to directly edit this wiki article. | |||
<syntaxhighlight lang="javascript" enclose="div"> | <syntaxhighlight lang="javascript" enclose="div"> | ||
// ==UserScript== | // ==UserScript== | ||
Line 75: | Line 76: | ||
// @version 0.18 | // @version 0.18 | ||
// @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 | |||
// @icon http://wiki.flightgear.org/images/6/62/FlightGear_logo.png | // @icon http://wiki.flightgear.org/images/6/62/FlightGear_logo.png | ||
// @match http://sourceforge.net/p/flightgear/mailman/* | // @match http://sourceforge.net/p/flightgear/mailman/* | ||
// @match http://forum.flightgear.org/* | // @match http://forum.flightgear.org/* | ||
// @namespace http://wiki.flightgear.org/ | // @namespace http://wiki.flightgear.org/FlightGear_wiki:Instant-Cquotes | ||
// @run-at document-end | // @run-at document-end | ||
// @require http://code.jquery.com/jquery-2.1.4.min.js | // @require http://code.jquery.com/jquery-2.1.4.min.js | ||
Line 85: | Line 87: | ||
// @grant GM_addStyle | // @grant GM_addStyle | ||
// @grant GM_getResourceText | // @grant GM_getResourceText | ||
// @noframes | |||
// ==/UserScript== | // ==/UserScript== | ||