Benutzer:Matthias M./Gadget-AceWikiEditor.js
aus Wikipedia, der freien Enzyklopädie
< Benutzer:Matthias M.
Dies ist die aktuelle Version dieser Seite, zuletzt bearbeitet am 5. Oktober 2012 um 11:57 Uhr durch imported>Matthias M.(474919) (→using [[mw:CodeEditor|CodeEditor]]: fix Typo).
Hinweis: Leere nach dem Veröffentlichen den Browser-Cache, um die Änderungen sehen zu können.
- Firefox/Safari: Umschalttaste drücken und gleichzeitig Aktualisieren anklicken oder entweder Strg+F5 oder Strg+R (⌘+R auf dem Mac) drücken
- Google Chrome: Umschalttaste+Strg+R (⌘+Umschalttaste+R auf dem Mac) drücken
- Internet Explorer/Edge: Strg+F5 drücken oder Strg drücken und gleichzeitig Aktualisieren anklicken
- Opera: Strg+F5
/*jslint browser: true, sloppy: true, plusplus: true, indent: 4 */
/*global mediaWiki, jQuery, ace */
/**
* [[no:MediaWiki:Gadget-AceWikiEditor.js]]
* 2012 [[no:Bruker:Danmichaelo]]
*
* Forked from MediaWiki:Gadget-codeeditor.js
* (c) 2011 Brion Vibber <brion @ pobox.com>
* GPLv2 or later
*
* Syntax highlighting for editing wikimarkup.
* Uses embedded Ajax.org Cloud9 Editor: http://ace.ajax.org/
*
* Note: By default, the toolbar menus will appear below the editor.
* This can be fixed by increase their z-index, adding something like
* this to common.css:
*
* .wikiEditor-ui-toolbar .group .tool-select .menu .options {
* z-index: 500
* }
*
* Browsers tested:
* - Firefox 11.0 / Mac
* - Chrome 18.0.1025.142 / Mac
* - Firefox 15.0.1 / Linux
*
* Browsers tested with issues:
* - Opera 12.00 alpha / Mac: copy / paste doesn't work
* - Safari: renders ok, but for some funny reason you can't type "}"
* Same problem at http://ace.ajax.org/build/kitchen-sink.html
*
* Browsers not tested:
* - IE 8.0.6001.18702 / Win XP: Problems have been reported with
* Brion's CodeEditor, so problems should be expected!
*
* Known issues:
* - serious problems with right-to-left scripts and perhaps other complex scripts.
* - 'discard your changes?' check on tab close doesn't trigger
* - ties into WikiEditor, so doesn't work on classic toolbar
* - copy/paste not available from context menu (Firefox, Chrome on Linux -- kbd & main menu commands ok)
* - accessibility: tab/shift-tab are overridden. is there a consistent alternative for keyboard-reliant users?
* - accessibility: accesskey on the original textarea needs to be moved over or otherwise handled
* - cursor/scroll position not maintained over previews/show changes
* - minor issue: repeated insertion by holding down a key does not work
*/
(function ($, mw) {
if ($.inArray(mw.config.get('wgAction'), ['edit', 'submit']) !== -1) {
var $box = $('#wpTextbox1'),
matches = /\.(js|css)$/.exec(mw.config.get('wgTitle'));
// @fixme move to better hosting location
mw.config.set('wgAceWikiEditorAssetsPath', 'http://de.wikipedia.org/w/index.php?title=Benutzer:Matthias_M./AceWiki');
// $.wikiEditor not defined for old toolbar
if ($box.length && !matches && mw.user.options.get('usebetatoolbar')) {
$(function () {
var moduleBase = mw.config.get('wgAceWikiEditorAssetsPath'),
modules = [
moduleBase + '/ace/ace.js&action=raw&ctype=text/javascript&maxage=86400',
moduleBase + '/ace/mode-wiki.js&action=raw&ctype=text/javascript&maxage=86400',
moduleBase + '/ace/theme-wiki.js&action=raw&ctype=text/javascript&maxage=86400',
moduleBase + '/jquery.aceWikiEditor.js&action=raw&ctype=text/javascript&maxage=86400',
moduleBase + '/ext.aceWikiEditor.js&action=raw&ctype=text/javascript&maxage=86400'
],
i = 0,
ping = function () {
// @fixme loading serially is kinda lame, but it works for now
if (i < modules.length) {
var url = modules[i];
$.getScript(url, function () {
i++;
ping();
});
}
};
ping();
});
}
}
}(jQuery, mediaWiki));