http://fr-i.demopaedia.org/w/api.php?action=feedcontributions&user=Nicolas+Brouard&feedformat=atom
Demopædia - Contributions de l’utilisateur [fr]
2024-03-29T09:49:20Z
Contributions de l’utilisateur
MediaWiki 1.28.0
http://fr-i.demopaedia.org/w/index.php?title=MediaWiki:Gadgets-definition&diff=11707
MediaWiki:Gadgets-definition
2017-06-25T19:58:42Z
<p>Nicolas Brouard : </p>
<hr />
<div>#Editing<br />
* wikEd[ResourceLoader]|wikEd.js<br />
* refToolbar[ResourceLoader|default|dependencies=user.options,mediawiki.legacy.wikibits]|refToolbar.js<br />
* refToolbarBase[ResourceLoader|hidden]|refToolbarBase.js<br />
* DotsSyntaxHighlighter[ResourceLoader|default|dependencies=jquery.client]|DotsSyntaxHighlighter.js<br />
<br />
#Interface<br />
* exlinks[ResourceLoader]|exlinks.js<br />
* purgeTab[ResourceLoader]|purgeTab.js<br />
* citations[ResourceLoader]|citations.js</div>
Nicolas Brouard
http://fr-i.demopaedia.org/w/index.php?title=MediaWiki:Editpage.js&diff=11692
MediaWiki:Editpage.js
2017-06-25T18:13:12Z
<p>Nicolas Brouard : 1 révision importée</p>
<hr />
<div>//dynamically load Commons-style Edittools<br />
function createEdittoolsLink(){<br />
//get div.mw-editTools<br />
var box = document.getElementById('wpTextbox1')<br />
while (box && box.className!='mw-editTools') box=box.nextSibling<br />
if (!box) return<br />
//create a link<br />
var lnk = document.createElement('a')<br />
lnk.href = 'javascript:loadCommonsTools()'<br />
lnk.title = 'Load Commons-style Edittools' <br />
lnk.id = 'loadCommonsEdittoos'<br />
lnk.appendChild(document.createTextNode('[load edittools]'))<br />
lnk.style.cssText = 'float:right'<br />
box.appendChild(lnk)<br />
}<br />
function loadCommonsTools(){<br />
importScript('MediaWiki:Edittools.js')<br />
var lnk = document.getElementById('loadCommonsEdittoos')<br />
if (lnk) lnk.parentNode.removeChild(lnk)<br />
}<br />
if (doneOnloadHook) createEdittoolsLink()<br />
else addOnloadHook(createEdittoolsLink)</div>
Nicolas Brouard
http://fr-i.demopaedia.org/w/index.php?title=MediaWiki:Gadget-citations.js&diff=11694
MediaWiki:Gadget-citations.js
2017-06-25T18:13:12Z
<p>Nicolas Brouard : 1 révision importée</p>
<hr />
<div>/* _____________________________________________________________________________<br />
* | |<br />
* | === WARNING: GLOBAL GADGET FILE === |<br />
* | Changes to this page affect many users. |<br />
* | Please discuss changes on the talk page or on [[WT:Gadget]] before editing. |<br />
* |_____________________________________________________________________________|<br />
*<br />
* Imported from version 1.0 as of 17:18, 9 April 2011 (UTC) from [[User:Smith609/citations.js]]<br />
* Adds a "Citation bot" link to the toolbox, and a button beneath edit fields, see [[User:Smith609/citations]]<br />
*/<br />
<br />
// @Version 1.0 - Adds an "Expand citations" link to the toolbox, and a button beneath edit fields.<br />
<br />
function addCBToToolbox() {<br />
if (wgCanonicalNamespace != "Special") {<br />
var pTb = document.getElementById("p-tb");<br />
if( !pTb ) return;<br />
var escPageName = encodeURIComponent(wgPageName);<br />
<br />
addPortletLink("p-tb", "http://toolserver.org/~verisimilus/Bot/citation-bot/doibot.php?edit=toolbar&slow=1&user="+encodeURIComponent(wgUserName)+"&page="+escPageName, 'Expand citations', '', "Expand citations and fix common formatting errors");<br />
}<br />
}<br />
<br />
// Add a citation bot button<br />
function addCitationBot() {<br />
if (document.getElementById('wpDiff')){<br />
var diff = document.getElementById('wpDiff');<br />
var cbButton = document.createElement("input");<br />
cbButton.value="Citations";<br />
cbButton.type="submit";<br />
originalAction=document.getElementById('editform').getAttribute('action');<br />
cbButton.setAttribute("onmousedown", " document.getElementById('editform').setAttribute('action', 'http://toolserver.org/~verisimilus/Bot/citation-bot/text.php')");<br />
cbButton.setAttribute("onkeydown", " document.getElementById('editform').setAttribute('action', 'http://toolserver.org/~verisimilus/Bot/citation-bot/text.php')");<br />
diff.setAttribute("onmousedown", originalAction);<br />
diff.setAttribute("onkeydown", originalAction);<br />
document.getElementById('wpPreview').setAttribute("onmousedown", originalAction);<br />
document.getElementById('wpPreview').setAttribute("onkeydown", originalAction);<br />
document.getElementById('wpSave').setAttribute("onmousedown", originalAction);<br />
document.getElementById('wpSave').setAttribute("onkeydown", originalAction);<br />
diff.parentNode.insertBefore(cbButton, diff.nextSibling);<br />
}<br />
<br />
}<br />
addOnloadHook(addCitationBot);<br />
if( skin == "myskin" || skin == "simple" || skin == "monobook" || skin == "modern" || skin == "chick" || skin == "vector") {<br />
addOnloadHook(addCBToToolbox);<br />
}</div>
Nicolas Brouard
http://fr-i.demopaedia.org/w/index.php?title=MediaWiki:Gadget-citations&diff=11696
MediaWiki:Gadget-citations
2017-06-25T18:13:12Z
<p>Nicolas Brouard : 1 révision importée</p>
<hr />
<div>[[WP:Citation expander|Citation expander]]: Automatically expand and format citations (uses "[[WP:UCB|Citation bot]]").<br />
<!--<br />
* A link in the toolbox will activate [[User:Citation bot]] on the page that you are currently viewing. The bot will expand, format and tidy all references on that page.<br />
<br />
* A button underneath the edit box (next to "Show Changes") will send the contents of the edit box to the bot, which will process them and return the expanded version. This has two possible uses:<br />
** It allows the manual checking of the bot's output before an article is modified<br />
** You can type a partial citation in to an article (e.g. <code><nowiki>{{cite journal|pmid=12345}}</nowiki></code>), then have the bot expand this to a complete citation before you save the page.<br />
<br />
<br />
For more information about the functions performed by [[User:Citation bot|Citation bot]], see [[User:Citation bot|its user page]] or [[WP:UCB|an introductory page]]. For information about the gadget's script, see [[User:Smith609/citation]].<br />
--></div>
Nicolas Brouard
http://fr-i.demopaedia.org/w/index.php?title=Mod%C3%A8le:NonRefTerm&diff=11698
Modèle:NonRefTerm
2017-06-25T18:13:12Z
<p>Nicolas Brouard : 1 révision importée</p>
<hr />
<div><i>{{{1}}}</i><noinclude><!--'''Template:NonRefTerm'''--><br />
[[Category:NonRefTerm]] {{PAGENAME}}<br />
</noinclude></div>
Nicolas Brouard
http://fr-i.demopaedia.org/w/index.php?title=Mod%C3%A8le:Note&diff=11700
Modèle:Note
2017-06-25T18:13:12Z
<p>Nicolas Brouard : 1 révision importée</p>
<hr />
<div><!--'''Template:Note'''-->* <font size="-1">{{{1}}}. {{{2}}}</font></div>
Nicolas Brouard
http://fr-i.demopaedia.org/w/index.php?title=Mod%C3%A8le:NoteTerm&diff=11702
Modèle:NoteTerm
2017-06-25T18:13:12Z
<p>Nicolas Brouard : 1 révision importée</p>
<hr />
<div><!--'''Template:NoteTerm'''--><b>{{{1}}}</b>{{<br />
#if: {{{2|}}} |({{{2}}})|}}<noinclude><br />
[[Category:Index]] {{PAGENAME}}<br />
</noinclude></div>
Nicolas Brouard
http://fr-i.demopaedia.org/w/index.php?title=Mod%C3%A8le:TextTerm&diff=11704
Modèle:TextTerm
2017-06-25T18:13:12Z
<p>Nicolas Brouard : 1 révision importée</p>
<hr />
<div><!--'''Template:TextTerm'''-->{{<br />
#if: {{{IndexEntry|}}} |<br />
<b>[[{{{IndexEntry}}}|{{{1}}}]]</b>|<br />
<b>[[{{{1}}}]]</b>}}<sup>{{{2}}}</sup>{{<br />
#if: {{{EnglishEntry|}}} |({{{EnglishEntry}}})|}}<noinclude><br />
[[Category:Dictionary]] {{PAGENAME}}<br />
</noinclude></div>
Nicolas Brouard
http://fr-i.demopaedia.org/w/index.php?title=Mod%C3%A8le:RefNumber&diff=11706
Modèle:RefNumber
2017-06-25T18:13:12Z
<p>Nicolas Brouard : 1 révision importée</p>
<hr />
<div><!--'''Template:RefNumber'''-->{{<br />
#if: {{{Page|}}} |<br />
[[{{{Page}}}#{{{1}}}{{{2}}}|{{{1}}}{{{2}}}-{{{3}}}]]|<br />
[[{{{1}}}#{{{1}}}{{{2}}}|{{{1}}}{{{2}}}-{{{3}}}]]}}</div>
Nicolas Brouard
http://fr-i.demopaedia.org/w/index.php?title=MediaWiki:Common.js/edit.js&diff=11682
MediaWiki:Common.js/edit.js
2017-06-25T18:13:11Z
<p>Nicolas Brouard : 1 révision importée</p>
<hr />
<div>/* Any JavaScript here will be loaded for all users on every page load. */<br />
/** Extra toolbar options ******************************************************<br />
* <br />
* Description: Adds extra buttons to the editing toolbar.<br />
* <br />
* To disable this script, add <code>mwCustomEditButtons = [];<code> to [[Special:Mypage/vector.js]].<br />
* <br />
* Maintainers: [[User:MarkS]], [[User:Voice of All]], [[User:R. Koot]]<br />
*/<br />
<br />
if (mwCustomEditButtons) {<br />
mwCustomEditButtons.push({<br />
"imageFile": "//upload.wikimedia.org/wikipedia/en/c/c8/Button_redirect.png",<br />
"speedTip": "Redirect",<br />
"tagOpen": "#REDIRECT [[",<br />
"tagClose": "]]",<br />
"sampleText": "Target page name"<br />
});<br />
<br />
mwCustomEditButtons.push({<br />
"imageFile": "//upload.wikimedia.org/wikipedia/en/c/c9/Button_strike.png",<br />
"speedTip": "Strike",<br />
"tagOpen": "<s>",<br />
"tagClose": "</s>",<br />
"sampleText": "Strike-through text"<br />
});<br />
<br />
mwCustomEditButtons.push({<br />
"imageFile": "//upload.wikimedia.org/wikipedia/en/1/13/Button_enter.png",<br />
"speedTip": "Line break",<br />
"tagOpen": "<br />",<br />
"tagClose": "",<br />
"sampleText": ""<br />
});<br />
<br />
mwCustomEditButtons.push({<br />
"imageFile": "//upload.wikimedia.org/wikipedia/en/8/80/Button_upper_letter.png",<br />
"speedTip": "Superscript",<br />
"tagOpen": "<sup>",<br />
"tagClose": "</sup>",<br />
"sampleText": "Superscript text"<br />
});<br />
<br />
mwCustomEditButtons.push({<br />
"imageFile": "//upload.wikimedia.org/wikipedia/en/7/70/Button_lower_letter.png",<br />
"speedTip": "Subscript",<br />
"tagOpen": "<sub>",<br />
"tagClose": "</sub>",<br />
"sampleText": "Subscript text"<br />
});<br />
<br />
mwCustomEditButtons.push({<br />
"imageFile": "//upload.wikimedia.org/wikipedia/en/5/58/Button_small.png",<br />
"speedTip": "Small",<br />
"tagOpen": "<small>",<br />
"tagClose": "</small>",<br />
"sampleText": "Small Text"<br />
});<br />
<br />
mwCustomEditButtons.push({<br />
"imageFile": "//upload.wikimedia.org/wikipedia/en/3/34/Button_hide_comment.png",<br />
"speedTip": "Insert hidden Comment",<br />
"tagOpen": "<!-- ",<br />
"tagClose": " -->",<br />
"sampleText": "Comment"<br />
});<br />
<br />
mwCustomEditButtons.push({<br />
"imageFile": "//upload.wikimedia.org/wikipedia/en/1/12/Button_gallery.png",<br />
"speedTip": "Insert a picture gallery",<br />
"tagOpen": "\n<gallery>\n",<br />
"tagClose": "\n</gallery>",<br />
"sampleText": "Image:Example.jpg|Caption1\nImage:Example.jpg|Caption2"<br />
});<br />
<br />
mwCustomEditButtons.push({<br />
"imageFile": "//upload.wikimedia.org/wikipedia/en/f/fd/Button_blockquote.png",<br />
"speedTip": "Insert block of quoted text",<br />
"tagOpen": "<blockquote>\n",<br />
"tagClose": "\n</blockquote>",<br />
"sampleText": "Block quote"<br />
});<br />
<br />
mwCustomEditButtons.push({<br />
"imageFile": "//upload.wikimedia.org/wikipedia/en/6/60/Button_insert_table.png",<br />
"speedTip": "Insert a table",<br />
"tagOpen": '{| class="wikitable"\n|',<br />
"tagClose": "\n|}",<br />
"sampleText": "-\n! header 1\n! header 2\n! header 3\n|-\n| row 1, cell 1\n| row 1, cell 2\n| row 1, cell 3\n|-\n| row 2, cell 1\n| row 2, cell 2\n| row 2, cell 3"<br />
});<br />
<br />
mwCustomEditButtons.push({<br />
"imageFile": "//upload.wikimedia.org/wikipedia/commons/7/79/Button_reflink.png",<br />
"speedTip": "Insert a reference",<br />
"tagOpen": "<ref>",<br />
"tagClose": "</ref>",<br />
"sampleText": "Insert footnote text here"<br />
});<br />
}<br />
<br />
<br />
/** Fix edit summary prompt for undo ******************************************<br />
* Fixes the fact that the undo function combined with the "no edit summary prompter"<br />
* causes problems if leaving the edit summary unchanged.<br />
* Added by [[User:Deskana]], code by [[User:Tra]].<br />
* See also [[bugzilla:8912]].<br />
*/<br />
$(function () {<br />
if (document.location.search.indexOf("undo=") != -1 && document.getElementsByName('wpAutoSummary')[0]) {<br />
document.getElementsByName('wpAutoSummary')[0].value='1';<br />
}<br />
});<br />
<br />
<br />
/** Edittools javascript loader ************************************************<br />
*<br />
* Description: Pulls in [[MediaWiki:Edittools.js]]. Includes a cache-bypassing<br />
* version number in the URL in order to allow any changes to the edittools to<br />
* be rapidly deployed to users.<br />
*<br />
* Note that, by default, this function does nothing unless the element with<br />
* the ID "editpage-specialchars" (which contains the old edittools code in<br />
* [[MediaWiki:Edittools]], and will be retained as a placeholder in the new<br />
* implementation) has a class named "edittools-version-NNN", where NNN is a<br />
* number. If the class name has "test" before the number, the code will only<br />
* run for users who have set "window.testJsEdittools = true" in their user JS.<br />
* The "test" should be retained in the class name until the new edittools<br />
* implementation is ready and fully tested, and until at least 30 days have<br />
* passed since this loader stub was added (which will be in 27 June 2008).<br />
*<br />
* For compatibility with Alex Smotrov's original implementation, on which this<br />
* code is loosely based (see [[mw:User talk:Alex Smotrov/edittools.js]]), this<br />
* loader can also be disabled by setting "window.noDefaultEdittools = true".<br />
*<br />
* Maintainers: [[User:Ilmari Karonen]]<br />
*/<br />
<br />
//Prevent the static edittools from flashing before the compact edittools below is loaded.<br />
mw.util.addCSS('div.edittools-text { display:none; }');<br />
<br />
$(function () {<br />
// needs to be deferred until the DOM has fully loaded<br />
var placeholder = document.getElementById("editpage-specialchars");<br />
if (!placeholder || window.noDefaultEdittools) {<br />
//Show the static edittools again for users with "window.noDefaultEdittools=true".<br />
mw.util.addCSS('div.edittools-text { display:block; }');<br />
return;<br />
}<br />
var match = /(?:^| )edittools-version-(\d+)(?: |$)/.exec(placeholder.className);<br />
console.log("Common.js/edit.js match =" + match);<br />
// set window.testJsEdittools = true to enable testing before full deployment<br />
if (!match && window.testJsEdittools)<br />
match = /(?:^| )edittools-version-(test\d+)(?: |$)/.exec(placeholder.className);<br />
<br />
if (!match) return;<br />
var url = wgScript + '?title=MediaWiki:Edittools.js&action=raw&ctype=text/javascript&nocache=' + match[1];<br />
importScriptURI(url);<br />
});<br />
var url = wgScript + '?title=MediaWiki:Edittools.js&action=raw&ctype=text/javascript';<br />
importScriptURI(url);</div>
Nicolas Brouard
http://fr-i.demopaedia.org/w/index.php?title=MediaWiki:Edittools.js&diff=11684
MediaWiki:Edittools.js
2017-06-25T18:13:11Z
<p>Nicolas Brouard : 1 révision importée</p>
<hr />
<div>// copied from [[mw:User:Alex Smotrov/edittools.js]], modified for use on the English Wikipedia.<br />
// enableForAllFields() feature from [[commons:MediaWiki:Edittools.js]]<br />
// combined and modified by [[User:Ilmari Karonen]]<br />
// after making changes to this page and testing them, update the number after "edittools-version-" in [[MediaWiki:Edittools]] to purge the cache for everyone<br />
<br />
if (typeof (EditTools_set_focus) == 'undefined')<br />
var EditTools_set_focus = true;<br />
<br />
if (typeof (EditTools_set_focus_initially) == 'undefined')<br />
var EditTools_set_focus_initially = EditTools_set_focus;<br />
<br />
var EditTools =<br />
{<br />
charinsert : {<br />
'Insert': ' – — ‘+’ “+” ° ″ ′ ≈ ≠ ≤ ≥ ± − × ÷ √ ← → · § Sign_your_posts_on_talk_pages: ~~\~~ Cite_your_sources: <ref>+</ref>',<br />
'Wiki markup': 'Insert: – — ‘+’ “+” ° ″ ′ ≈ ≠ ≤ ≥ ± − × ÷ √ ← → · § ~~\~~ <ref>+</ref> Wiki_markup: {\{+}} {\{\{+}}} | {\{TextTerm|demography|1+}} {\{RefNumber|+13|0|1}} {\{NonRefTerm|+}} {\{Note|+|}} {\{NoteTerm|+}} [+] [\[+]] [\[Category:+]] #REDIRECT.[\[+]] &nbsp; <s>+</s> <sup>+</sup> <sub>+</sub> <code>+</code> <pre>+</pre> <blockquote>+</blockquote> <ref.name="+"/> {\{#tag:ref|+|group="nb"}} {\{Reflist}} <references/> <includeonly>+</includeonly> <noinclude>+</noinclude> {\{DEFAULTSORT:+}} <nowiki>+</nowiki> <!--.+_--> <span.class="plainlinks">+</span>',<br />
'Symbols': '~ | ¡¿†‡↔↑↓•¶ # ½⅓⅔¼¾⅛⅜⅝⅞∞ ‘+’ “+” ‹+› «+» ⟨+⟩ ¤₳฿₵¢₡₢$₫₯€₠₣ƒ₴₭₤ℳ₥₦№₧₰£៛₨₪৳₮₩¥ ♠♣♥♦ m² m³ ♭♯♮ ©®™ ◌ {\{Unicode|+}}', <br />
'Latin': 'A a Á á À à  â Ä ä Ǎ ǎ Ă ă Ā ā à ã Å å Ą ą Æ æ Ǣ ǣ B b C c Ć ć Ċ ċ Ĉ ĉ Č č Ç ç D d Ď ď Đ đ Ḍ ḍ Ð ð E e É é È è Ė ė Ê ê Ë ë Ě ě Ĕ ĕ Ē ē Ẽ ẽ Ę ę Ɛ ɛ Ə ə F f G g Ġ ġ Ĝ ĝ Ğ ğ Ģ ģ H h Ĥ ĥ Ħ ħ Ḥ ḥ I i İ ı Í í Ì ì Î î Ï ï Ǐ ǐ Ĭ ĭ Ī ī Ĩ ĩ Į į J j Ĵ ĵ K k Ķ ķ L l Ĺ ĺ Ŀ ŀ Ľ ľ Ļ ļ Ł ł Ḷ ḷ Ḹ ḹ M m Ṃ ṃ N n Ń ń Ň ň Ñ ñ Ņ ņ Ṇ ṇ Ŋ ŋ O o Ó ó Ò ò Ô ô Ö ö Ǒ ǒ Ŏ ŏ Ō ō Õ õ Ǫ ǫ Ő ő Ø ø Œ œ Ɔ ɔ P p Q q R r Ŕ ŕ Ř ř Ŗ ŗ Ṛ ṛ Ṝ ṝ S s Ś ś Ŝ ŝ Š š Ş ş Ṣ ṣ ß T t Ť ť Ţ ţ Ṭ ṭ Þ þ U u Ú ú Ù ù Û û Ü ü Ǔ ǔ Ŭ ŭ Ū ū Ũ ũ Ů ů Ų ų Ű ű Ǘ ǘ Ǜ ǜ Ǚ ǚ Ǖ ǖ V v W w Ŵ ŵ X x Y y Ý ý Ŷ ŷ Ÿ ÿ Ỹ ỹ Ȳ ȳ Z z Ź ź Ż ż Ž ž ß Ð ð Þ þ Ŋ ŋ Ə ə {\{Unicode|+}}',<br />
'Greek': 'ΆάΈέΉήΊίΌόΎύΏώ ΑαΒβΓγΔδ ΕεΖζΗηΘθ ΙιΚκΛλΜμ ΝνΞξΟοΠπ ΡρΣσςΤτΥυ ΦφΧχΨψΩω ᾼᾳᾴᾺὰᾲᾶᾷἈἀᾈᾀἉἁᾉᾁἌἄᾌᾄἊἂᾊᾂἎἆᾎᾆἍἅᾍᾅἋἃᾋᾃἏἇᾏᾇ ῈὲἘἐἙἑἜἔἚἒἝἕἛἓ ῌῃῄῊὴῂῆῇἨἠᾘᾐἩἡᾙᾑἬἤᾜᾔἪἢᾚᾒἮἦᾞᾖἭἥᾝᾕἫἣᾛᾓἯἧᾟᾗ ῚὶῖἸἰἹἱἼἴἺἲἾἶἽἵἻἳἿἷ ῸὸὈὀὉὁὌὄὊὂὍὅὋὃ ῤῬῥ ῪὺῦὐὙὑὔὒὖὝὕὛὓὟὗ ῼῳῴῺὼῲῶῷὨὠᾨᾠὩὡᾩᾡὬὤᾬᾤὪὢᾪᾢὮὦᾮᾦὭὥᾭᾥὫὣᾫᾣὯὧᾯᾧ {\{Polytonic|+}}',<br />
'Cyrillic': 'АаБбВвГг ҐґЃѓДдЂђ ЕеЁёЄєЖж ЗзЅѕИиІі ЇїЙйЈјКк ЌќЛлЉљМм НнЊњОоПп РрСсТтЋћ УуЎўФфХх ЦцЧчЏџШш ЩщЪъЫыЬь ЭэЮюЯя ӘәӨөҒғҖҗ ҚқҜҝҢңҮү ҰұҲҳҸҹҺһ ҔҕӢӣӮӯҘҙ ҠҡҤҥҪҫӐӑ ӒӓӔӕӖӗӰӱ ӲӳӸӹӀ ҞҟҦҧҨҩҬҭ ҴҵҶҷҼҽҾҿ ӁӂӃӄӇӈӋӌ ӚӛӜӝӞӟӠӡ ӤӥӦӧӪӫӴӵ ́',<br />
'Hebrew': 'אבגדהוזחטיךכלםמןנסעףפץצקרשת ׳ ״ װױײ',<br />
'Arabic': ' Transcription: ʾ ṯ ḥ ḫ ẖ ḏ š ṣ ḍ ṭ ẓ ʿ ġ ẗ ا ﺁ ب ت ث ج ح خ د ذ ر ز س ش ص ض ط ظ ع غ ف ق ك ل م ن ه ة و ي ى ء أ إ ؤ ئ',<br />
'IPA (English)': 'ˈ ˌ ŋ ɡ tʃ dʒ ʃ ʒ θ ð ʔ iː ɪ uː ʊ ʌ ɜr eɪ ɛ æ oʊ ɒ ɔː ɔɪ ɔr ɑː ɑr aɪ aʊ ə ər ɨ ɵ ʉ {\{IPA-en|+}} {\{IPA|/+/}} ‹+›',<br />
'IPA': 'ʈɖɟɡɢʡʔ ɸβθðʃʒɕʑʂʐçʝɣχʁħʕʜʢɦ ɱɳɲŋɴ ʋɹɻɰ ʙⱱʀɾɽ ɬ ɮ ɺ ɭʎʟ ʍɥɧ ʼ ɓɗʄɠʛ ʘǀǃǂǁ ɨʉɯ ɪʏʊ øɘɵɤ ə ɛœɜɞʌɔ æ ɐ ɶɑɒ ʰʱʷʲˠˤˀ ᵊ k̚ ⁿˡ ˈˌːˑ t̪ d̪ s̺ s̻ θ̼ s̬ n̥ ŋ̊ a̤ a̰ β̞ ˕ r̝ ˔ o˞ ɚ ɝ e̘ e̙ u̟ i̠ ɪ̈ e̽ ɔ̹ ɔ̜ n̩ ə̆ ə̯ ə̃ ȷ̃ ɫ z̴ ə̋ ə́ ə̄ ə̀ ə̏ ə̌ ə̂ ə᷄ ə᷅ ə᷇ ə᷆ ə᷈ ə᷉ t͡ʃ d͡ʒ t͜ɬ ‿ ˥ ˦ ˧ ˨ ˩ ꜛ ꜜ | ‖ ↗ ↘ k͈ s͎ {\{IPA|+}}',<br />
'Math and logic': '− × ÷ ⋅ ° ∗ ∘ ± ∓ ≤ ≥ ≠ ≡ ≅ ≜ ≝ ≐ ≃ ≈ ⊕ ⊗ ⇐ ⇔ ⇒ ∞ ← ↔ → ≪ ≫ ∝ √ ∤ ≀ ◅ ▻ ⋉ ⋊ ⋈ ∴ ∵ ↦ ¬ ∧ ∨ ⊻ ∀ ∃ ∈ ∉ ∋ ⊆ ⊈ ⊊ ⊂ ⊄ ⊇ ⊉ ⊋ ⊃ ⊅ ∪ ∩ ∑ ∏ ∐ ′ ∫ ∬ ∭ ∮ ∇ ∂ ∆ ∅ ℂ ℍ ℕ ℙ ℚ ℝ ℤ ℵ ⌊ ⌋ ⌈ ⌉ ⊤ ⊥ ⊢ ⊣ ⊧ □ ∠ ⟨ ⟩ {\{frac|+|}} &nbsp; &minus; <math>+</math> {\{math|+}}'<br />
},<br />
<br />
charinsertDivider : "\240",<br />
<br />
extraCSS : '\<br />
#editpage-specialchars {\<br />
margin-top: 15px;\<br />
border-width: 1px;\<br />
border-style: solid;\<br />
border-color: #aaaaaa;\<br />
padding: 2px;\<br />
}\<br />
#editpage-specialchars a {\<br />
}\<br />
#editpage-specialchars a:hover {\<br />
}\<br />
',<br />
<br />
appendExtraCSS : function ()<br />
{<br />
appendCSS(EditTools.extraCSS);<br />
},<br />
<br />
<br />
cookieName : 'edittoolscharsubset',<br />
<br />
createEditTools : function (placeholder)<br />
{<br />
var box = document.createElement("div");<br />
box.id = "editpage-specialchars";<br />
box.title = 'Click on the character or tag to insert it into the edit window';<br />
<br />
//append user-defined sets<br />
if (window.charinsertCustom)<br />
for (id in charinsertCustom)<br />
if (EditTools.charinsert[id]) EditTools.charinsert[id] += ' ' + charinsertCustom[id];<br />
else EditTools.charinsert[id] = charinsertCustom[id];<br />
<br />
//create drop-down select<br />
var prevSubset = 0, curSubset = 0;<br />
var sel = document.createElement('select'), id;<br />
for (id in EditTools.charinsert)<br />
sel.options[sel.options.length] = new Option(id, id);<br />
sel.selectedIndex = 0;<br />
sel.style.cssFloat = sel.style.styleFloat = 'left';<br />
sel.style.marginRight = '5px';<br />
sel.title = 'Choose character subset';<br />
sel.onchange = sel.onkeyup = selectSubset;<br />
box.appendChild(sel);<br />
<br />
//create "recall" switch<br />
if (window.editToolsRecall) {<br />
var recall = document.createElement('span');<br />
recall.appendChild(document.createTextNode('↕')); // ↔<br />
recall.onclick = function () {<br />
sel.selectedIndex = prevSubset;<br />
selectSubset();<br />
}<br />
with (recall.style) { cssFloat = styleFloat = 'left'; marginRight = '5px'; cursor = 'pointer'; }<br />
box.appendChild(recall);<br />
}<br />
<br />
// load latest selection from cookies<br />
try {<br />
var cookieRe = new RegExp ("(?:^|;)\\s*" + EditTools.cookieName + "=(\\d+)\\s*(?:;|$)");<br />
var m = cookieRe.exec(document.cookie);<br />
if (m && m.length > 1 && parseInt(m[1]) < sel.options.length)<br />
sel.selectedIndex = parseInt(m[1]);<br />
} catch (err) { /* ignore */ }<br />
<br />
placeholder.parentNode.replaceChild(box, placeholder);<br />
selectSubset();<br />
return;<br />
<br />
function selectSubset ()<br />
{<br />
//remember previous (for "recall" button)<br />
prevSubset = curSubset;<br />
curSubset = sel.selectedIndex;<br />
//save into cookies for persistence<br />
try {<br />
var expires = new Date ();<br />
expires.setTime( expires.getTime() + 30 * 24 * 60 * 60 * 1000 ); // + 30 days<br />
document.cookie = EditTools.cookieName + "=" + curSubset + ";path=/;expires=" + expires.toUTCString();<br />
} catch (err) { /* ignore */ }<br />
//hide other subsets<br />
var pp = box.getElementsByTagName('p') ;<br />
for (var i=0; i<pp.length; i++)<br />
pp[i].style.display = 'none';<br />
//show/create current subset<br />
var id = sel.options[curSubset].value;<br />
var p = document.getElementById(id);<br />
if (!p){<br />
p = document.createElement('p');<br />
p.id = id;<br />
if (id == 'Arabic' || id == 'Hebrew'){ p.style.fontSize = '120%'; p.dir = 'rtl'; }<br />
EditTools.createTokens(p, EditTools.charinsert[id]);<br />
box.appendChild(p);<br />
}<br />
p.style.display = 'inline';<br />
} <br />
},<br />
createTokens : function (paragraph, str)<br />
{<br />
var tokens = str.split(' '), token, i, n;<br />
for (i = 0; i < tokens.length; i++) {<br />
token = tokens[i];<br />
n = token.indexOf('+');<br />
if (token == '' || token == '_')<br />
addText(EditTools.charinsertDivider + ' ');<br />
else if (token == '\n')<br />
paragraph.appendChild(document.createElement('br'));<br />
else if (token == '___')<br />
paragraph.appendChild(document.createElement('hr'));<br />
else if (token.charAt(token.length-1) == ':') // : at the end means just text<br />
addBold(token);<br />
else if (n == 0) // +<tag> -> <tag>+</tag><br />
addLink(token.substring(1), '</' + token.substring(2), token.substring(1));<br />
else if (n > 0) // <tag>+</tag><br />
addLink(token.substring(0,n), token.substring(n+1));<br />
else if (token.length > 2 && token.charCodeAt(0) > 127) //a string of insertable characters<br />
for (var j=0; j < token.length; j++) addLink(token.charAt(j), '');<br />
else<br />
addLink(token, '');<br />
}<br />
return;<br />
<br />
function addLink (tagOpen, tagClose, name)<br />
{<br />
var a = document.createElement('a');<br />
tagOpen = tagOpen.replace(/\./g,' ');<br />
tagClose = tagClose ? tagClose.replace(/_/g,' ') : '';<br />
name = name || tagOpen + tagClose;<br />
name = name.replace(/\\n/g,'');<br />
a.appendChild(document.createTextNode(name));<br />
a.href = "#";<br />
addHandler( a, 'click', new Function( "evt", "insertTags('" + tagOpen + "', '" + tagClose + "', ''); return killEvt( evt );" ) );<br />
paragraph.appendChild(a);<br />
addText(' ');<br />
}<br />
function addBold (text)<br />
{<br />
var b = document.createElement('b');<br />
b.appendChild(document.createTextNode(text.replace(/_/g,' ')));<br />
paragraph.appendChild(b);<br />
addText(' ');<br />
} <br />
function addText (txt)<br />
{<br />
paragraph.appendChild(document.createTextNode(txt));<br />
}<br />
},<br />
<br />
<br />
enableForAllFields : function ()<br />
{<br />
if (typeof (insertTags) != 'function' || window.WikEdInsertTags) return;<br />
// insertTags from the site-wide /skins-1.5/common/edit.js just inserts in the first<br />
// textarea in the document. Evidently, that's not good if we have multiple textareas.<br />
// My first idea was to simply add a hidden textarea as the first one, and redefine<br />
// insertTags such that it copied first the last active textareas contents over to that hidden<br />
// field, set the cursor or selection there, let the standard insertTags do its thing, and<br />
// then copy the hidden field's text, cursor position and selection back to the currently<br />
// active field. Unfortunately, that is just as complex as simply copying the whole code<br />
// from wikibits to here and let it work on the right text field in the first place.<br />
var texts = document.getElementsByTagName ('textarea'); <br />
for (var i = 0; i < texts.length; i++) {<br />
addHandler (texts[i], 'focus', EditTools.registerTextField);<br />
}<br />
// While we're at it, also enable it for input fields<br />
texts = document.getElementsByTagName ('input');<br />
for (var i = 0; i < texts.length; i++) {<br />
if (texts[i].type == 'text') addHandler (texts[i], 'focus', EditTools.registerTextField);<br />
}<br />
insertTags = EditTools.insertTags; // Redefine the global insertTags<br />
},<br />
<br />
last_active_textfield : null,<br />
<br />
registerTextField : function (evt)<br />
{<br />
var e = evt || window.event;<br />
var node = e.target || e.srcElement;<br />
if (!node) return;<br />
EditTools.last_active_textfield = node.id;<br />
return true;<br />
},<br />
<br />
getTextArea : function ()<br />
{<br />
var txtarea = null;<br />
if (EditTools.last_active_textfield && EditTools.last_active_textfield != "")<br />
txtarea = document.getElementById (EditTools.last_active_textfield);<br />
if (!txtarea) {<br />
// Fallback option: old behaviour<br />
if (document.editform) {<br />
txtarea = document.editform.wpTextbox1;<br />
} else {<br />
// Some alternate form? Take the first one we can find<br />
txtarea = document.getElementsByTagName ('textarea');<br />
if (txtarea.length > 0) txtarea = txtarea[0]; else txtarea = null;<br />
}<br />
}<br />
return txtarea;<br />
},<br />
<br />
insertTags : function (tagOpen, tagClose, sampleText)<br />
{<br />
var txtarea = EditTools.getTextArea ();<br />
if (!txtarea) return;<br />
<br />
<br />
/* Usability initiative compatibility */<br />
if ( typeof $j != 'undefined' && typeof $j.fn.textSelection != 'undefined' ) {<br />
$j( txtarea ).textSelection(<br />
'encapsulateSelection', { 'pre': tagOpen, 'peri': sampleText, 'post': tagClose }<br />
);<br />
return;<br />
}<br />
<br />
<br />
var selText, isSample = false;<br />
<br />
function checkSelectedText ()<br />
{<br />
if (!selText) {<br />
selText = sampleText; isSample = true;<br />
} else if (selText.charAt (selText.length - 1) == ' ') { // Exclude ending space char<br />
selText = selText.substring (0, selText.length - 1);<br />
tagClose += ' ';<br />
} <br />
}<br />
<br />
if (document.selection && document.selection.createRange) { // IE/Opera<br />
// Save window scroll position<br />
var winScroll = 0;<br />
if (document.documentElement && document.documentElement.scrollTop)<br />
winScroll = document.documentElement.scrollTop;<br />
else if (document.body)<br />
winScroll = document.body.scrollTop;<br />
// Get current selection <br />
txtarea.focus();<br />
var range = document.selection.createRange();<br />
selText = range.text;<br />
// Insert tags<br />
checkSelectedText ();<br />
range.text = tagOpen + selText + tagClose;<br />
// Mark sample text as selected<br />
if (isSample && range.moveStart) {<br />
if (window.opera) tagClose = tagClose.replace (/\n/g, "");<br />
range.moveStart( 'character', - tagClose.length - selText.length); <br />
range.moveEnd ('character', - tagClose.length); <br />
}<br />
range.select (); <br />
// Restore window scroll position<br />
if (document.documentElement && document.documentElement.scrollTop)<br />
document.documentElement.scrollTop = winScroll;<br />
else if (document.body)<br />
document.body.scrollTop = winScroll;<br />
} else if (txtarea.selectionStart || txtarea.selectionStart == '0') { // Mozilla<br />
// Save textarea scroll position<br />
var textScroll = txtarea.scrollTop;<br />
// Get current selection<br />
txtarea.focus();<br />
var startPos = txtarea.selectionStart;<br />
var endPos = txtarea.selectionEnd;<br />
selText = txtarea.value.substring (startPos, endPos);<br />
// Insert tags<br />
checkSelectedText ();<br />
txtarea.value = txtarea.value.substring (0, startPos)<br />
+ tagOpen + selText + tagClose<br />
+ txtarea.value.substring (endPos);<br />
// Set new selection<br />
if (isSample) {<br />
txtarea.selectionStart = startPos + tagOpen.length;<br />
txtarea.selectionEnd = startPos + tagOpen.length + selText.length;<br />
} else {<br />
txtarea.selectionStart = startPos + tagOpen.length + selText.length + tagClose.length;<br />
txtarea.selectionEnd = txtarea.selectionStart;<br />
}<br />
// Restore textarea scroll position<br />
txtarea.scrollTop = textScroll;<br />
}<br />
}, // end insertTags<br />
<br />
setup : function ()<br />
{<br />
var placeholder = document.getElementById("editpage-specialchars");<br />
if (!placeholder) return; // has this already been run once?<br />
EditTools.appendExtraCSS ();<br />
EditTools.createEditTools (placeholder);<br />
EditTools.enableForAllFields ();<br />
}<br />
<br />
}; // end EditTools<br />
<br />
// No need to hook this, as the loading of this page is itself hooked.<br />
EditTools.setup();</div>
Nicolas Brouard
http://fr-i.demopaedia.org/w/index.php?title=MediaWiki:Edittools&diff=11686
MediaWiki:Edittools
2017-06-25T18:13:11Z
<p>Nicolas Brouard : 1 révision importée</p>
<hr />
<div><div id="editpage-specialchars" style="margin-top: 15px; border: 1px solid #aaaaaa; padding: 2px;" class="edittools-text edittools-version-045"><!-- INCREMENT THIS VERSION NUMBER TO MAKE CHANGES TO [[MediaWiki:Edittools.js]] LIVE --><br />
<!--<br />
This div gets automatically replaced with the actual edit tools by the code in [[MediaWiki:Edittools.js]]. Please make any changes there. Any content is this div is only shown to users with JavaScript turned off (or unsupported).<br />
--><br />
'''Copy and paste:''' – — ° ″ ′ ≈ ≠ ≤ ≥ ± − × ÷ ← → · § &nbsp; '''Sign your posts on talk pages:''' <nowiki>~~~~</nowiki><br />
----<br />
<small><br />
Special Multilingual Demographic Dictionary :<br />
{{TextTerm|Demography|1}} is ... interdisciplinary fields such as {{NonRefTerm|economic demography}} ({{RefNumber|10|4|1}}), <br />
{{Note|1| {{NoteTerm|demographer}}, n.: a specialist in demography.}}<br />
<pre><br />
{{TextTerm|Demography|1}} is ... interdisciplinary fields such as {{NonRefTerm|economic demography}} ({{RefNumber|10|4|1}}), <br />
{{Note|1| {{NoteTerm|demographer}}, n.: a specialist in demography.}}</pre><br />
<charinsert><nowiki>{{</nowiki>TextTerm|+|}} <nowiki>{{</nowiki>RefNumber|+||}} <nowiki>{{</nowiki>Note|+|}} <nowiki>{{</nowiki>NoteTerm|}}</charinsert><br />
<nowiki>{{}}</nowiki> &nbsp; <nowiki>{{{}}}</nowiki> &nbsp; | &nbsp; <nowiki>[]</nowiki> &nbsp; <nowiki>[[]]</nowiki> &nbsp; <nowiki>[[Category:]]</nowiki> &nbsp; <nowiki>#REDIRECT [[]]</nowiki> &nbsp; &amp;nbsp; &nbsp; &lt;s>&lt;/s> &nbsp; &lt;sup>&lt;/sup> &nbsp; &lt;sub>&lt;/sub> &nbsp; &lt;code>&lt;/code> &nbsp; &lt;pre>&lt;/pre> &nbsp; &lt;blockquote>&lt;/blockquote> &nbsp; &lt;ref>&lt;/ref> &nbsp; <nowiki><br />
{{Reflist}}</nowiki> &nbsp; &lt;references/> &nbsp; &lt;includeonly>&lt;/includeonly> &nbsp; &lt;noinclude>&lt;/noinclude> &nbsp; <nowiki>{{DEFAULTSORT:}}</nowiki> &nbsp; &lt;nowiki>&lt;/nowiki> &nbsp; &lt;!-- --> &nbsp; &lt;span class="plainlinks">&lt;/span><br />
</small><br />
----<br />
<small><br />
'''Symbols:''' ~ | ¡ ¿ † ‡ ↔ ↑ ↓ • ¶ &nbsp; # ½ ⅓ ⅔ ¼ ¾ ⅛ ⅜ ⅝ ⅞ ∞ &nbsp; ‘ ’ “ ” «» &nbsp; ¤ ₳ ฿ ₵ ¢ ₡ ₢ $ ₫ ₯ € ₠ ₣ ƒ ₴ ₭ ₤ ℳ ₥ ₦ № ₧ ₰ £ ៛ ₨ ₪ ৳ ₮ ₩ ¥ &nbsp; ♠ ♣ ♥ ♦ &nbsp; m² m³ &nbsp; ♭ ♯ ♮ &nbsp; © ® ™<br /><br />
'''Latin:''' A a Á á À à  â Ä ä Ǎ ǎ Ă ă Ā ā à ã Å å Ą ą Æ æ Ǣ ǣ &nbsp; B b &nbsp; C c Ć ć Ċ ċ Ĉ ĉ Č č Ç ç &nbsp; D d Ď ď Đ đ Ḍ ḍ Ð ð &nbsp; E e É é È è Ė ė Ê ê Ë ë Ě ě Ĕ ĕ Ē ē Ẽ ẽ Ę ę Ə ə &nbsp; F f &nbsp; G g Ġ ġ Ĝ ĝ Ğ ğ Ģ ģ &nbsp; H h Ĥ ĥ Ħ ħ Ḥ ḥ &nbsp; I i İ ı Í í Ì ì Î î Ï ï Ǐ ǐ Ĭ ĭ Ī ī Ĩ ĩ Į į &nbsp; J j Ĵ ĵ &nbsp; K k Ķ ķ &nbsp; L l Ĺ ĺ Ŀ ŀ Ľ ľ Ļ ļ Ł ł Ḷ ḷ Ḹ ḹ &nbsp; M m Ṃ ṃ &nbsp; N n Ń ń Ň ň Ñ ñ Ņ ņ Ṇ ṇ &nbsp; O o Ó ó Ò ò Ô ô Ö ö Ǒ ǒ Ŏ ŏ Ō ō Õ õ Ǫ ǫ Ő ő Ø ø Œ œ &nbsp; P p &nbsp; Q q &nbsp; R r Ŕ ŕ Ř ř Ŗ ŗ Ṛ ṛ Ṝ ṝ &nbsp; S s Ś ś Ŝ ŝ Š š Ş ş Ș ș Ṣ ṣ ß &nbsp; T t Ť ť Ţ ţ Ț ț Ṭ ṭ Þ þ &nbsp; U u Ú ú Ù ù Û û Ü ü Ǔ ǔ Ŭ ŭ Ū ū Ũ ũ Ů ů Ų ų Ű ű Ǘ ǘ Ǜ ǜ Ǚ ǚ Ǖ ǖ &nbsp; V v &nbsp; W w Ŵ ŵ &nbsp; X x &nbsp; Y y Ý ý Ŷ ŷ Ÿ ÿ Ỹ ỹ Ȳ ȳ &nbsp; Z z Ź ź Ż ż Ž ž &nbsp; ß Ð ð Þ þ Ə ə &nbsp; <nowiki>{{Unicode|}}</nowiki> <br /><br />
'''Greek:''' Ά ά Έ έ Ή ή Ί ί Ό ό Ύ ύ Ώ ώ &nbsp; Α α Β β Γ γ Δ δ &nbsp; Ε ε Ζ ζ Η η Θ θ &nbsp; Ι ι Κ κ Λ λ Μ μ &nbsp; Ν ν Ξ ξ Ο ο Π π &nbsp; Ρ ρ Σ σ ς Τ τ Υ υ &nbsp; Φ φ Χ χ Ψ ψ Ω ω &nbsp; <nowiki>{{Polytonic|}}</nowiki> <br /><br />
'''Cyrillic:''' А а Б б В в Г г &nbsp; Ґ ґ Ѓ ѓ Д д Ђ ђ &nbsp; Е е Ё ё Є є Ж ж &nbsp; З з Ѕ ѕ И и І і &nbsp; Ї ї Й й Ј ј К к &nbsp; Ќ ќ Л л Љ љ М м &nbsp; Н н Њ њ О о П п &nbsp; Р р С с Т т Ћ ћ &nbsp; У у Ў ў Ф ф Х х &nbsp; Ц ц Ч ч Џ џ Ш ш &nbsp; Щ щ Ъ ъ Ы ы Ь ь &nbsp; Э э Ю ю Я я &nbsp; ́ <br /><br />
'''IPA:''' t̪ d̪ ʈ ɖ ɟ ɡ ɢ ʡ ʔ &nbsp; ɸ ʃ ʒ ɕ ʑ ʂ ʐ ʝ ɣ ʁ ʕ ʜ ʢ ɦ &nbsp; ɱ ɳ ɲ ŋ ɴ &nbsp; ʋ ɹ ɻ ɰ &nbsp; ʙ ʀ ɾ ɽ &nbsp; ɫ ɬ ɮ ɺ ɭ ʎ ʟ &nbsp; ɥ ʍ ɧ &nbsp; ɓ ɗ ʄ ɠ ʛ &nbsp; ʘ ǀ ǃ ǂ ǁ &nbsp; ɨ ʉ ɯ &nbsp; ɪ ʏ ʊ &nbsp; ɘ ɵ ɤ &nbsp; ə ɚ &nbsp; ɛ ɜ ɝ ɞ ʌ ɔ &nbsp; ɐ ɶ ɑ ɒ &nbsp; ʰ ʷ ʲ ˠ ˤ ⁿ ˡ &nbsp; ˈ ˌ ː ˑ ̪ &nbsp; <nowiki>{{IPA|}}</nowiki><br />
</small><br />
<!--<br />
Everything up to here gets automatically replaced with the JavaScript edit tools for users with JavaScript enabled.<br />
--><br />
</div><br />
<br />
<div style="margin-top: 1em;" id="editpage-copywarn2"><br />
<strong style="font-size: 130%;">Please note:</strong><br />
* When you click Save page, your changes will immediately become visible to everyone. If you wish to run a test, please edit the [[Wikipedia:Sandbox|Sandbox]] instead.<br />
*Please post only [[Wikipedia:Wikipedia is an encyclopedia|encyclopedic]] information that can be [[Wikipedia:Verifiability|verified]] by external sources. Please maintain a [[Wikipedia:Neutral point of view|neutral]], unbiased point of view.<br />
* Please [[Wikipedia:Copy-paste|do not copy and paste]] from copyrighted websites – only [[Wikipedia:public domain|public domain]] resources can be copied without permission.<br />
</div></div>
Nicolas Brouard
http://fr-i.demopaedia.org/w/index.php?title=MediaWiki:RefToolbarBaseTextTerm.js&diff=11688
MediaWiki:RefToolbarBaseTextTerm.js
2017-06-25T18:13:11Z
<p>Nicolas Brouard : 1 révision importée</p>
<hr />
<div>// Global object<br />
if (typeof CiteTB == 'undefined') {<br />
var CiteTB = {<br />
"Templates" : {}, // All templates<br />
"Options" : {}, // Global options<br />
"UserOptions" : {}, // User options<br />
"DefaultOptions" : {}, // Script defaults<br />
"ErrorChecks" : {} // Error check functions<br />
};<br />
}<br />
<br />
if (typeof mw.usability == 'undefined') {<br />
mw.usability = {};<br />
mw.usability.getMsg = function(m) { return mw.messages.get(m); }<br />
mw.usability.addMessages = function(msgs) { mw.messages.set(msgs); };<br />
}<br />
<br />
// Object for cite templates<br />
function citeTemplate(templatename, shortform, basicfields, expandedfields) {<br />
// Properties<br />
this.templatename = templatename; // The template name - "cite web", "cite book", etc.<br />
this.shortform = shortform; // A short form, used for the dropdown box<br />
this.basic = basicfields; // Basic fields - author, title, publisher...<br />
// Less common - quote, archiveurl - should be everything the template supports minus the basic ones<br />
this.extra = expandedfields;<br />
<br />
// Add it to the list<br />
CiteTB.Templates[this.templatename] = this;<br />
// Methods<br />
this.makeFormInner = function(fields) {<br />
var i=0;<br />
var trs = new Array();<br />
for (i=0; i<fields.length; i++) {<br />
var fieldobj = fields[i];<br />
var field = fieldobj.field;<br />
var ad = false;<br />
if ($j.inArray(field, CiteTB.getOption('autodate fields')) != -1 ) {<br />
im = $j('<img />').attr('src', '//upload.wikimedia.org/wikipedia/commons/thumb/7/7b/Nuvola_apps_date.svg/20px-Nuvola_apps_date.svg.png');<br />
im.attr('alt', mw.usability.getMsg('cite-insert-date')).attr('title', mw.usability.getMsg('cite-insert-date'));<br />
var ad = $j('<a />').attr('href', '#');<br />
ad.append(im);<br />
ad.attr('id', 'cite-date-'+CiteTB.escStr(this.shortform)+'-'+field);<br />
$j('#cite-date-'+CiteTB.escStr(this.shortform)+'-'+field).live('click', CiteTB.fillAccessdate);<br />
}<br />
<br />
if (fieldobj.autofillid) {<br />
var autotype = fieldobj.autofillid;<br />
im = $j('<img />').attr('src', '//upload.wikimedia.org/wikipedia/commons/thumb/1/17/System-search.svg/20px-System-search.svg.png');<br />
im.attr('alt', mw.usability.getMsg('cite-autofill-alt')).attr('title', mw.usability.getMsg('cite-autofill-alt'));<br />
var ad = $j('<a />').attr('href', '#');<br />
ad.append(im);<br />
ad.attr('id', 'cite-auto-'+CiteTB.escStr(this.shortform)+'-'+field+'-'+autotype);<br />
$j('#cite-auto-'+CiteTB.escStr(this.shortform)+'-'+field+'-'+autotype).live('click', CiteTB.initAutofill); <br />
}<br />
<br />
var display = mw.usability.getMsg('cite-'+field+'-label');<br />
var tooltip = fieldobj.tooltip ? $j('<abbr />').attr('title', mw.usability.getMsg(fieldobj.tooltip)).text('*') : false;<br />
<br />
var input = '';<br />
if (ad) {<br />
input = $j('<input tabindex="1" style="width:85%" type="text" />');<br />
} else {<br />
input = $j('<input tabindex="1" style="width:100%" type="text" />');<br />
}<br />
input.attr('id', 'cite-'+CiteTB.escStr(this.shortform)+'-'+field);<br />
if (fieldobj.autofillprop) {<br />
input.addClass('cite-'+CiteTB.escStr(this.shortform)+'-'+fieldobj.autofillprop);<br />
}<br />
var label = $j('<label />');<br />
label.attr('for', 'cite-'+CiteTB.escStr(this.shortform)+'-'+field).text(display);<br />
if (tooltip) {<br />
label.append(tooltip);<br />
}<br />
var style = 'text-align:right; width:20%;';<br />
if (i%2 == 1) {<br />
style += ' padding-left:1em;';<br />
} else {<br />
var tr = $j('<tr />');<br />
}<br />
var td1 = $j('<td class="cite-form-td" />').attr('style', style);<br />
td1.append(label);<br />
tr.append(td1);<br />
var td2 = $j('<td class="cite-form-td" style="width:30%" />');<br />
td2.append(input);<br />
if (ad) {<br />
td2.append(ad);<br />
}<br />
tr.append(td2);<br />
if (i%2 == 0) {<br />
trs.push(tr);<br />
}<br />
}<br />
return trs;<br />
<br />
}<br />
<br />
// gives a little bit of HTML so the open form can be identified<br />
this.getInitial = function() {<br />
var hidden = $j('<input type="hidden" class="cite-template" />');<br />
hidden.val(this.templatename);<br />
return hidden;<br />
}<br />
<br />
// makes the form used in the dialog boxes<br />
this.getForm = function() {<br />
var main = $j("<div class='cite-form-container' />");<br />
var form1 = $j('<table style="width:100%; background-color:transparent;" class="cite-basic-fields" />');<br />
var i=0;<br />
var trs = this.makeFormInner(this.basic);<br />
for (var i=0; i<trs.length; i++) {<br />
form1.append(trs[i]);<br />
}<br />
<br />
var form2 = $j('<table style="width:100%; background-color:transparent; display:none" class="cite-extra-fields">');<br />
trs = this.makeFormInner(this.extra);<br />
for (var i=0; i<trs.length; i++) {<br />
form2.append(trs[i]);<br />
} <br />
main.append(form1).append(form2);<br />
<br />
var form3 = $j('<table style="width:100%; background-color:transparent;padding-top:1em" class="cite-other-fields">');<br />
var tr = $j('<tr />');<br />
var td1 = $j('<td class="cite-form-td" style="text-align:right; width:20%" />');<br />
var label1 = $j('<label />');<br />
label1.attr('for', "cite-"+CiteTB.escStr(this.shortform)+'-name').text(mw.usability.getMsg('cite-name-label'));<br />
td1.append(label1);<br />
var td2 = $j('<td class="cite-form-td" style="width:30%" />');<br />
var input1 = $j('<input tabindex="1" style="width:100%" type="text" />');<br />
input1.attr('id', 'cite-'+CiteTB.escStr(this.shortform)+'-name');<br />
td2.append(input1);<br />
var td3 = $j('<td class="cite-form-td" style="text-align:right; padding-left:1em; width:20%">');<br />
var label2 = $j('<label />');<br />
label2.attr('for', 'cite-'+CiteTB.escStr(this.shortform)+'-group').text(mw.usability.getMsg('cite-group-label'));<br />
td3.append(label2);<br />
var td4 = $j('<td class="cite-form-td" style="width:30%" />');<br />
var input2 = $j('<input tabindex="1" style="width:100%" type="text" />');<br />
input2.attr('id', 'cite-'+CiteTB.escStr(this.shortform)+'-group');<br />
td4.append(input2);<br />
tr.append(td1).append(td2).append(td3).append(td4);<br />
form3.append(tr);<br />
main.append(form3);<br />
var extras = $j('<div />');<br />
extras.append('<input type="hidden" class="cite-form-status" value="closed" />');<br />
var hidden = $j('<input type="hidden" class="cite-template" />');<br />
hidden.val(this.templatename);<br />
extras.append(hidden);<br />
var span1 = $j('<span class="cite-preview-label" style="display:none;" />');<br />
span1.text(mw.usability.getMsg('cite-raw-preview'));<br />
extras.append(span1).append('<div class="cite-ref-preview" style="padding:0.5em; font-size:110%" />');<br />
var span2 = $j('<span class="cite-prev-parsed-label" style="display:none;" />');<br />
span2.text(mw.usability.getMsg('cite-parsed-label'));<br />
extras.append(span2).append('<div class="cite-preview-parsed" style="padding-bottom:0.5em; font-size:110%" />');<br />
var link = $j('<a href="#" class="cite-prev-parse" style="margin:0 1em 0 1em; display:none; color:darkblue" />');<br />
link.text(mw.usability.getMsg('cite-form-parse'));<br />
extras.append(link); <br />
main.append(extras);<br />
<br />
return main;<br />
}<br />
}<br />
<br />
/* Class for error checks<br />
FIXME: DOCS OUT OF DATE<br />
type - type of error check - current options:<br />
* 'refcheck' - apply a function on each ref individually<br />
* function should accept a ref object, return a string<br />
* 'reflist' - apply a function on the entire ref list<br />
* function should accept an array of ref objects, return an array of strings<br />
* 'search' - apply a function ro the page text<br />
* function should accept the page text as a string, return an array of strings<br />
The strings returned by the function should be valid HTML<br />
<br />
func - The function described above<br />
testname - Name of the error check, must not contain spaces<br />
desc - A short description of the test<br />
*/<br />
<br />
function citeErrorCheck(obj) {<br />
this.obj = obj<br />
CiteTB.ErrorChecks[this.obj.testname] = this;<br />
<br />
this.run = function() {<br />
var errors = [];<br />
switch(this.obj['type']) {<br />
case "refcheck":<br />
CiteTB.loadRefs();<br />
for(var i=0; i<CiteTB.mainRefList.length; i++) {<br />
var e = this.obj.func(CiteTB.mainRefList[i]);<br />
if (e) {<br />
errors.push(e);<br />
}<br />
}<br />
break;<br />
case "reflist":<br />
CiteTB.loadRefs();<br />
errors = this.obj.func(CiteTB.mainRefList);<br />
break;<br />
case "search":<br />
var func = this.obj.func<br />
CiteTB.getPageText(function(text) {<br />
errors = func(text);<br />
});<br />
break;<br />
}<br />
return errors;<br />
}<br />
<br />
this.getRow = function() {<br />
var row = $j("<li />");<br />
var check = $j("<input type='checkbox' name='cite-err-test' />");<br />
check.attr('value', this.obj.testname);<br />
var label = $j("<label />").html(mw.usability.getMsg(this.obj.desc));<br />
label.attr('for', this.obj.testname); <br />
row.append(check).append(' &ndash; ').append(label);<br />
return row;<br />
}<br />
}<br />
$j('head').trigger('reftoolbarbase');</div>
Nicolas Brouard
http://fr-i.demopaedia.org/w/index.php?title=MediaWiki:RefToolbarTextTerm.js&diff=11690
MediaWiki:RefToolbarTextTerm.js
2017-06-25T18:13:11Z
<p>Nicolas Brouard : 1 révision importée</p>
<hr />
<div>/*jshint smarttabs:true, loopfunc:true,forin:false*/<br />
/*global mw, $, importScript */<br />
// TODO: make autodate an option in the CiteTemplate object, not a preference<br />
<br />
// Global object<br />
// TODO:<br />
// * Remove this once the page is moved to a module 'ext.gadget.refToolbarDialogs' depending on 'ext.gadget.refToolbarBase'<br />
if (typeof CiteTB === 'undefined') {<br />
var CiteTB = {<br />
"Templates" : {}, // All templates<br />
"Options" : {}, // Global options<br />
"UserOptions" : {}, // User options<br />
"DefaultOptions" : {}, // Script defaults<br />
"ErrorChecks" : {} // Error check functions<br />
};<br />
}<br />
<br />
// Only execute on edit, unless it is a user JS/CSS page<br />
// TODO: Remove tests already done by [[MediaWiki:Gadget-refToolbar.js]]<br />
if (<br />
( mw.config.get('wgAction') === 'edit' || mw.config.get('wgAction') === 'submit' ) &&<br />
( ( mw.config.get('wgNamespaceNumber') !== 2 && mw.config.get('wgNamespaceNumber') !== 4 ) ||<br />
( mw.config.get('wgPageName').indexOf('.js') === -1 && mw.config.get('wgPageName').indexOf('.css') === -1 ) )<br />
) {<br />
<br />
// TODO: Move this to [[MediaWiki:Gadget-refToolbarDialogs.css]] and add it to the definition of module 'ext.gadget.refToolbarDialogs'<br />
mw.util.addCSS(".cite-form-td {"+<br />
"height: 0 !important;"+<br />
"padding: 0.1em !important;"+<br />
"}"); <br />
<br />
// Default options, these mainly exist so the script won't break if a new option is added<br />
CiteTB.DefaultOptions = {<br />
"date format" : "<year>-<zmonth>-<zdate>",<br />
"autodate fields" : [],<br />
"months" : ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],<br />
"modal" : true,<br />
"autoparse" : false,<br />
"expandtemplates": false<br />
};<br />
<br />
// Get an option - user settings override global which override defaults<br />
CiteTB.getOption = function(opt) {<br />
if (CiteTB.UserOptions[opt] !== undefined) {<br />
return CiteTB.UserOptions[opt];<br />
} else if (CiteTB.Options[opt] !== undefined) {<br />
return CiteTB.Options[opt];<br />
}<br />
return CiteTB.DefaultOptions[opt];<br />
};<br />
<br />
CiteTB.init = function() {<br />
/* Main stuff, build the actual toolbar structure<br />
* 1. get the template list, make the dropdown list and set up the template dialog boxes<br />
* 2. actually build the toolbar:<br />
* * A section for cites<br />
* ** dropdown for the templates (previously defined)<br />
* ** button for named refs with a dialog box<br />
* ** button for errorcheck<br />
* 3. add the whole thing to the main toolbar<br />
*/<br />
<br />
if (typeof $('div[rel=cites]')[0] !== 'undefined') { // Mystery IE bug workaround<br />
return;<br />
}<br />
$('head').trigger('reftoolbarbase');<br />
var $target = $('#wpTextbox1');<br />
var temlist = {};<br />
for (var t in CiteTB.Templates) {<br />
var tem = CiteTB.Templates[t];<br />
var sform = CiteTB.escStr(tem.shortform);<br />
var actionobj = { <br />
type: 'dialog',<br />
module: 'cite-dialog-'+sform<br />
};<br />
var dialogobj = {};<br />
dialogobj['cite-dialog-'+sform] = {<br />
resizeme: false,<br />
titleMsg: 'cite-dialog-'+sform, <br />
id: 'citetoolbar-'+sform,<br />
init: function() {}, <br />
html: tem.getInitial(), <br />
dialog: {<br />
width:675,<br />
open: function() { <br />
$(this).html(CiteTB.getOpenTemplate().getForm());<br />
/** @param {jQuery.Event} e */<br />
$('.cite-prev-parse').bind( 'click', function ( e ) {<br />
e.preventDefault();<br />
CiteTB.prevParseClick();<br />
});<br />
},<br />
buttons: {<br />
'cite-form-submit': function() {<br />
var ref = CiteTB.getRef(false, true);<br />
$(this).dialog( 'close' );<br />
$.wikiEditor.modules.toolbar.fn.doAction( $(this).data( 'context' ), {<br />
type: 'encapsulate',<br />
options: {<br />
post: ref<br />
}<br />
}, $(this) );<br />
},<br />
'cite-form-showhide': CiteTB.showHideExtra,<br />
'cite-refpreview': function() { <br />
var ref = CiteTB.getRef(false, false);<br />
var template = CiteTB.getOpenTemplate();<br />
var div = $("#citetoolbar-"+CiteTB.escStr(template.shortform));<br />
div.find('.cite-preview-label').show();<br />
div.find('.cite-ref-preview').text(ref).show();<br />
if (CiteTB.getOption('autoparse')) {<br />
CiteTB.prevParseClick();<br />
} else {<br />
div.find('.cite-prev-parse').show();<br />
div.find('.cite-prev-parsed-label').hide();<br />
div.find('.cite-preview-parsed').html('');<br />
} <br />
},<br />
'wikieditor-toolbar-tool-link-cancel': function() {<br />
$(this).dialog( 'close' );<br />
},<br />
'cite-form-reset': function() {<br />
CiteTB.resetForm();<br />
}<br />
}<br />
} <br />
};<br />
$target.wikiEditor('addDialog', dialogobj);<br />
//if (!CiteTB.getOption('modal')) {<br />
//$('#citetoolbar-'+sform).dialog('option', 'modal', false);<br />
//}<br />
temlist[sform] = {label: tem.templatename, action: actionobj }; <br />
}<br />
<br />
var refsection = {<br />
'sections': {<br />
'cites': { <br />
type: 'toolbar', <br />
labelMsg: 'cite-section-label',<br />
groups: { <br />
'template': {<br />
tools: {<br />
'template': {<br />
type: 'select',<br />
labelMsg: 'cite-template-list',<br />
list: temlist<br />
} <br />
}<br />
},<br />
'namedrefs': {<br />
labelMsg: 'cite-named-refs-label',<br />
tools: {<br />
'nrefs': {<br />
type: 'button',<br />
action: {<br />
type: 'dialog',<br />
module: 'cite-toolbar-namedrefs'<br />
},<br />
icon: '//upload.wikimedia.org/wikipedia/commons/thumb/b/be/Nuvola_clipboard_lined.svg/22px-Nuvola_clipboard_lined.svg.png',<br />
section: 'cites',<br />
group: 'namedrefs',<br />
labelMsg: 'cite-named-refs-button'<br />
}<br />
}<br />
},<br />
'errorcheck': {<br />
labelMsg: 'cite-errorcheck-label',<br />
tools: {<br />
'echeck': {<br />
type: 'button',<br />
action: {<br />
type: 'dialog',<br />
module: 'cite-toolbar-errorcheck' <br />
},<br />
icon: '//upload.wikimedia.org/wikipedia/commons/thumb/a/a3/Nuvola_apps_korganizer-NO.png/22px-Nuvola_apps_korganizer-NO.png',<br />
section: 'cites',<br />
group: 'errorcheck',<br />
labelMsg: 'cite-errorcheck-button'<br />
}<br />
}<br />
}<br />
} <br />
} <br />
} <br />
};<br />
<br />
var defaultdialogs = { <br />
'cite-toolbar-errorcheck': {<br />
titleMsg: 'cite-errorcheck-label',<br />
id: 'citetoolbar-errorcheck',<br />
resizeme: false,<br />
init: function() {},<br />
html: '<div id="cite-namedref-loading">'+<br />
'<img src="//upload.wikimedia.org/wikipedia/commons/4/42/Loading.gif" />'+<br />
'&nbsp;'+mw.usability.getMsg('cite-loading')+'</div>',<br />
dialog: {<br />
width:550,<br />
open: function() { <br />
CiteTB.loadRefs();<br />
},<br />
buttons: {<br />
'cite-errorcheck-submit': function() {<br />
var errorchecks = $("input[name='cite-err-test']:checked");<br />
var errors = [];<br />
for (var i=0; i<errorchecks.length; i++) {<br />
errors = errors.concat(CiteTB.ErrorChecks[$(errorchecks[i]).val()].run());<br />
}<br />
CiteTB.displayErrors(errors);<br />
$(this).dialog( 'close' ); <br />
},<br />
'wikieditor-toolbar-tool-link-cancel': function() {<br />
$(this).dialog( 'close' );<br />
}<br />
}<br />
}<br />
},<br />
'cite-toolbar-namedrefs': {<br />
titleMsg: 'cite-named-refs-title',<br />
resizeme: false,<br />
id: 'citetoolbar-namedrefs',<br />
html: '<div id="cite-namedref-loading">'+<br />
'<img src="//upload.wikimedia.org/wikipedia/commons/4/42/Loading.gif" />'+<br />
'&nbsp;'+mw.usability.getMsg('cite-loading')+'</div>',<br />
init: function() {},<br />
dialog: {<br />
width: 550,<br />
open: function() { <br />
CiteTB.loadRefs();<br />
},<br />
buttons: {<br />
'cite-form-submit': function() {<br />
var refname = $("#cite-namedref-select").val();<br />
if (refname === '') {<br />
return;<br />
}<br />
$(this).dialog( 'close' );<br />
$.wikiEditor.modules.toolbar.fn.doAction( $(this).data( 'context' ), {<br />
type: 'encapsulate',<br />
options: {<br />
post: CiteTB.getNamedRef(refname, true)<br />
}<br />
}, $(this) );<br />
},<br />
'wikieditor-toolbar-tool-link-cancel': function() {<br />
$(this).dialog( 'close' );<br />
} <br />
}<br />
} <br />
}<br />
};<br />
<br />
$target.wikiEditor('addDialog', defaultdialogs);<br />
$('#citetoolbar-namedrefs').unbind('dialogopen');<br />
if (!CiteTB.getOption('modal')) {<br />
//$('#citetoolbar-namedrefs').dialog('option', 'modal', false);<br />
//$('#citetoolbar-errorcheck').dialog('option', 'modal', false);<br />
mw.util.addCSS(".ui-widget-overlay {"+<br />
"display:none !important;"+<br />
"}"); <br />
}<br />
$target.wikiEditor('addToToolbar', refsection);<br />
};<br />
<br />
// Load local data - messages, cite templates, etc.<br />
$(document).ready( function() {<br />
switch( mw.config.get('wgUserLanguage') ) {<br />
case 'de': // German<br />
importScript('MediaWiki:RefToolbarMessages-de.js');<br />
break;<br />
default: // English<br />
importScript('MediaWiki:RefToolbarMessages-en.js');<br />
}<br />
});<br />
<br />
// Setup the main object<br />
CiteTB.mainRefList = [];<br />
CiteTB.refsLoaded = false;<br />
<br />
// REF FUNCTIONS<br />
// Actually assemble a ref from user input<br />
CiteTB.getRef = function(inneronly, forinsert) {<br />
var i;<br />
var template = CiteTB.getOpenTemplate();<br />
var templatename = template.templatename;<br />
var res = '';<br />
var refobj = {'shorttag':false};<br />
if (!inneronly) {<br />
var group = $('#cite-'+CiteTB.escStr(template.shortform)+'-group').val();<br />
var refname = $('#cite-'+CiteTB.escStr(template.shortform)+'-name').val();<br />
res += '<ref';<br />
if (refname) {<br />
refname = $.trim(refname);<br />
res+=' name='+CiteTB.getQuotedString(refname);<br />
refobj.refname = refname;<br />
}<br />
if (group) {<br />
group = $.trim(group);<br />
res+=' group='+CiteTB.getQuotedString(group);<br />
refobj.refgroup = group;<br />
}<br />
res+='>';<br />
}<br />
var content ='{{'+templatename;<br />
for( g in template.incrementables ) {<br />
group = template.incrementables[g];<br />
for (i=1; i<=group.val; i++) {<br />
for (j=0; j<group.fields.length; j++) {<br />
var fieldname = group.fields[j].field;<br />
var fieldid = fieldname.replace('<N>', i.toString());<br />
var field = $('#cite-'+CiteTB.escStr(template.shortform)+'-'+fieldid).val();<br />
if (field) {<br />
content+='|'+fieldid+'=';<br />
content+= $.trim(field);<br />
}<br />
}<br />
}<br />
}<br />
for( i=0; i<template.basic.length; i++ ) {<br />
if (template.basic[i].increment_group) {<br />
continue;<br />
}<br />
var fieldname = template.basic[i].field;<br />
var field = $('#cite-'+CiteTB.escStr(template.shortform)+'-'+fieldname).val();<br />
if (field) {<br />
content+='|'+fieldname+'=';<br />
content+= $.trim(field);<br />
}<br />
}<br />
if ($('#cite-form-status').val() !== 'closed') {<br />
for( i=0; i<template.extra.length; i++ ) {<br />
if (template.extra[i].increment_group) {<br />
continue;<br />
}<br />
var fieldname = template.extra[i].field;<br />
var field = $('#cite-'+CiteTB.escStr(template.shortform)+'-'+fieldname).val();<br />
if (field) {<br />
content+='|'+fieldname+'=';<br />
content+= $.trim(field);<br />
}<br />
}<br />
}<br />
content+= '}}';<br />
res+=content;<br />
refobj.content = content;<br />
if (!inneronly) {<br />
res+= '</ref>';<br />
}<br />
if (forinsert) {<br />
CiteTB.mainRefList.push(refobj);<br />
}<br />
return res;<br />
};<br />
<br />
// Make a reference to a named ref<br />
CiteTB.getNamedRef = function(refname, forinsert) {<br />
if (forinsert) {<br />
CiteTB.mainRefList.push( {'shorttag':true, 'refname':refname} );<br />
}<br />
return '<ref name='+CiteTB.getQuotedString(refname)+' />'; <br />
};<br />
<br />
// Function to load the ref list<br />
CiteTB.loadRefs = function() {<br />
if (CiteTB.refsLoaded) {<br />
return;<br />
}<br />
CiteTB.getPageText(CiteTB.loadRefsInternal);<br />
};<br />
<br />
// Function that actually loads the list from the page text<br />
CiteTB.loadRefsInternal = function(text) { <br />
// What this does: extract first name/group extract second name/group shorttag inner content<br />
var refsregex = /< *ref(?: +(name|group) *= *(?:"([^"]*?)"|'([^']*?)'|([^ '"\/\>]*?)) *)? *(?: +(name|group) *= *(?:"([^"]*?)"|'([^']*?)'|([^ '"\/\>]*?)) *)? *(?:\/ *>|>((?:.|\n)*?)< *\/ *ref *>)/gim;<br />
// This should work regardless of the quoting used for names/groups and for linebreaks in the inner content <br />
while (true) {<br />
var ref = refsregex.exec(text);<br />
if (ref === null) {<br />
break;<br />
}<br />
var refobj = {};<br />
if (ref[9]) { // Content + short tag check<br />
//alert('"'+ref[9]+'"');<br />
refobj.content = ref[9]; <br />
refobj.shorttag = false;<br />
} else {<br />
refobj.shorttag = true;<br />
}<br />
if (ref[1] !== '') { // First name/group<br />
if (ref[2]) {<br />
refobj['ref'+ref[1]] = ref[2];<br />
} else if (ref[3]) {<br />
refobj['ref'+ref[1]] = ref[3];<br />
} else {<br />
refobj['ref'+ref[1]] = ref[4];<br />
}<br />
}<br />
if (ref[5] !== '') { // Second name/group<br />
if (ref[6]) {<br />
refobj['ref'+ref[5]] = ref[6];<br />
} else if (ref[7]) {<br />
refobj['ref'+ref[5]] = ref[7];<br />
} else {<br />
refobj['ref'+ref[5]] = ref[8];<br />
}<br />
}<br />
CiteTB.mainRefList.push(refobj);<br />
}<br />
CiteTB.refsLoaded = true;<br />
CiteTB.setupErrorCheck();<br />
CiteTB.setupNamedRefs();<br />
};<br />
<br />
// AJAX FUNCTIONS<br />
// Parse some wikitext and hand it off to a callback function<br />
CiteTB.parse = function(text, callback) {<br />
$.post( mw.util.wikiScript( 'api' ),<br />
{action:'parse', title:mw.config.get('wgPageName'), text:text, prop:'text', format:'json'},<br />
function(data) {<br />
var html = data.parse.text['*'];<br />
callback(html);<br />
},<br />
'json'<br />
); <br />
};<br />
<br />
// Use the API to expand templates on some text<br />
CiteTB.expandtemplates = function(text, callback) {<br />
$.post( mw.util.wikiScript( 'api' ),<br />
{action:'expandtemplates', title:mw.config.get('wgPageName'), text:text, format:'json'},<br />
function(data) {<br />
var restext = data.expandtemplates['*'];<br />
callback(restext);<br />
},<br />
'json'<br />
);<br />
};<br />
<br />
// Function to get the page text<br />
CiteTB.getPageText = function(callback) {<br />
var section = $("input[name='wpSection']").val();<br />
if ( section !== '' ) {<br />
var postdata = {action:'query', prop:'revisions', rvprop:'content', pageids:mw.config.get('wgArticleId'), format:'json'};<br />
if (CiteTB.getOption('expandtemplates')) {<br />
postdata.rvexpandtemplates = '1';<br />
}<br />
$.get( mw.util.wikiScript( 'api' ),<br />
postdata,<br />
function(data) {<br />
var pagetext = data.query.pages[mw.config.get('wgArticleId').toString()].revisions[0]['*'];<br />
callback(pagetext);<br />
},<br />
'json'<br />
);<br />
} else {<br />
if (CiteTB.getOption('expandtemplates')) {<br />
CiteTB.expandtemplates($('#wpTextbox1').wikiEditor('getContents').text(), callback);<br />
} else {<br />
callback($('#wpTextbox1').wikiEditor('getContents').text());<br />
}<br />
}<br />
};<br />
<br />
// Autofill a template from an ID (ISBN, DOI, PMID, URL)<br />
CiteTB.initAutofill = function() {<br />
var elemid = $(this).attr('id');<br />
var res = /^cite\-auto\-(.*?)\-(.*)\-(.*)$/.exec(elemid);<br />
var tem = res[1];<br />
var field = res[2];<br />
var autotype = res[3];<br />
var id = $('#cite-'+tem+'-'+field).val();<br />
if (!id) {<br />
return false;<br />
}<br />
var url = '//tools.wmflabs.org/reftoolbar/lookup.php?';<br />
url+=autotype+'='+encodeURIComponent(id);<br />
url+='&template='+encodeURIComponent(tem);<br />
var s = document.createElement('script');<br />
s.setAttribute('src', url);<br />
s.setAttribute('type', 'text/javascript');<br />
document.getElementsByTagName('head')[0].appendChild(s);<br />
return false;<br />
};<br />
<br />
// Callback for autofill<br />
//TODO: Autofill the URL, at least for DOI<br />
CiteTB.autoFill = function(data, template, type) {<br />
var cl = 'cite-'+template+'-';<br />
var i,j, coauthors;<br />
$('.'+cl+'title').val(data.title);<br />
// Fill in authors<br />
if (data.authors && data.authors.length > 0) {<br />
if ($('.'+cl+'last-incr-1').length != 0) {<br />
var classes = $('.'+cl+'last-incr-1').eq(0).attr('class').split(/\s+/);<br />
var group = false;<br />
var patt = /cite-[^-]*?-incr-(.*)/<br />
for (var c=0; c<classes.length; c++) {<br />
if (patt.exec(classes[c])) {<br />
group = patt.exec(classes[c])[1];<br />
break;<br />
}<br />
}<br />
$('.'+cl+'last-incr-1').val(data.authors[0][0])<br />
$('.'+cl+'first-incr-1').val(data.authors[0][1])<br />
elemid = '#cite-incr-'+template+'-'+group;<br />
for (var i=2; i<data.authors.length+1; i++) {<br />
$(elemid).click();<br />
$('.'+cl+'last-incr-'+i.toString()).val(data.authors[i-1][0])<br />
$('.'+cl+'first-incr-'+i.toString()).val(data.authors[i-1][1])<br />
}<br />
} else if ($('.'+cl+'author-incr-1').length != 0) {<br />
var classes = $('.'+cl+'author-incr-1').eq(0).attr('class').split(/\s+/);<br />
var group = false;<br />
var patt = /cite-[^-]*?-incr-(.*)/<br />
for (var c=0; c<classes.length; c++) {<br />
if (patt.exec(classes[c])) {<br />
group = patt.exec(classes[c])[1];<br />
break;<br />
}<br />
}<br />
$('.'+cl+'author-incr-1').val(data.authors[0].join(', '))<br />
elemid = '#cite-incr-'+template+'-'+group;<br />
for (var i=2; i<data.authors.length+1; i++) {<br />
$(elemid).click();<br />
$('.'+cl+'author-incr-'+i.toString()).val(data.authors[i-1].join(', '))<br />
}<br />
} else if ($('.'+cl+'last1').length != 0) {<br />
for(i=0; data.authors && i<data.authors.length; i++) {<br />
if ($('.'+cl+'last'+(i+1)).length) {<br />
$('.'+cl+'last'+(i+1)).val(data.authors[i][0]);<br />
$('.'+cl+'first'+(i+1)).val(data.authors[i][1]);<br />
} else {<br />
coauthors = [];<br />
for(j=i; j<data.authors.length; j++) {<br />
coauthors.push(data.authors[j].join(', '));<br />
}<br />
$('.'+cl+'coauthors').val(coauthors.join('; '));<br />
break;<br />
}<br />
}<br />
} else if($('.'+cl+'author1').length !== 0) {<br />
for(i=0; data.authors && i<data.authors.length; i++) {<br />
if ($('.'+cl+'author'+(i+1)).length) {<br />
$('.'+cl+'author'+(i+1)).val(data.authors[i].join(', '));<br />
} else {<br />
coauthors = [];<br />
for(j=i; j<data.authors.length; j++) {<br />
coauthors.push(data.authors[j].join(', '));<br />
}<br />
$('.'+cl+'coauthors').val(coauthors.join('; '));<br />
break;<br />
}<br />
}<br />
} else {<br />
var authors = [];<br />
for(i=0; data.authors && i<data.authors.length; i++) {<br />
authors.push(data.authors[i].join(', '));<br />
}<br />
$('.'+cl+'authors').val(authors.join('; '));<br />
}<br />
}<br />
<br />
if (type === 'pmid' || type === 'doi') {<br />
if (data.date && (data.fulldate || !$('.'+cl+'month').length)) {<br />
var DT = new Date(data.date);<br />
var useday = /\d{4}-\d{2}-\d{2}/.test(data.date);<br />
var usemonth = /\d{4}-\d{2}/.test(data.date);<br />
$('.'+cl+'date').val(CiteTB.formatDate(DT, useday, usemonth));<br />
} else if (!data.fulldate && $('.'+cl+'month').length && $('.'+cl+'year').length) {<br />
if (data.month) { // lookup.php sets month to false if it isn't provided<br />
$('.'+cl+'month').val( CiteTB.getOption('months')[parseInt(data.month)-1] );<br />
}<br />
$('.'+cl+'year').val(data.year);<br />
} else {<br />
$('.'+cl+'date').val(data.date);<br />
}<br />
$('.'+cl+'journal').val(data.journal);<br />
$('.'+cl+'volume').val(data.volume);<br />
$('.'+cl+'issue').val(data.issue);<br />
$('.'+cl+'pages').val(data.pages);<br />
} else if (type === 'isbn') {<br />
$('.'+cl+'publisher').val(data.publisher);<br />
$('.'+cl+'location').val(data.location);<br />
$('.'+cl+'year').val(data.year);<br />
$('.'+cl+'edition').val(data.edition);<br />
} else if (type === 'url') {<br />
if (data.date) {<br />
var DT = new Date(data.date);<br />
var useday = /\d{4}-\d{2}-\d{2}/.test(data.date) && template !== 'book';<br />
var usemonth = /\d{4}-\d{2}/.test(data.date) && template !== 'book';<br />
var yearOrDate = (template === 'book') ? 'year' : 'date';<br />
$('.'+cl+yearOrDate).val(CiteTB.formatDate(DT, useday, usemonth));<br />
}<br />
$('.'+cl+'journal').val(data.journal);<br />
$('.'+cl+'volume').val(data.volume);<br />
$('.'+cl+'issue').val(data.issue);<br />
$('.'+cl+'pages').val(data.pages);<br />
$('.'+cl+'publisher').val(data.publisher);<br />
$('.'+cl+'edition').val(data.edition);<br />
$('.'+cl+'isbn').val(data.isbn);<br />
$('.'+cl+'issn').val(data.issn);<br />
$('.'+cl+'doi').val(data.doi);<br />
// "en-US" isn't a valid value for the language parameter<br />
if (data.language && data.language !== 'en-US' && data.language !== 'en-GB') {<br />
$('.'+cl+'language').val(data.language);<br />
}<br />
$('.'+cl+'chapter').val(data.chapter);<br />
}<br />
};<br />
<br />
// FORM DIALOG FUNCTIONS<br />
// Add new incrementable fields<br />
CiteTB.incrementFields = function() {<br />
template = CiteTB.getOpenTemplate();<br />
var currentrow = $(this).parents('tr')[0];<br />
$(this).prev().css('width', '100%')<br />
$(this).detach();<br />
var elemid = $(this).attr('id');<br />
var res = /^cite\-incr\-(.*?)\-(.*)$/.exec(elemid);<br />
group = res[2];<br />
increments = template.incrementables[group];<br />
fields = increments.fields;<br />
incrval = increments.val+1;<br />
template.incrementables[group].val += 1;<br />
trs = template.makeFormInner(fields, false);<br />
trs.reverse();<br />
for (var i=0; i<trs.length; i++) {<br />
$(currentrow).after(trs[i]);<br />
}<br />
};<br />
<br />
// fill the accessdate param with the current date<br />
CiteTB.fillAccessdate = function() {<br />
var elemid = $(this).attr('id');<br />
var res = /^cite\-date\-(.*?)\-(.*)$/.exec(elemid);<br />
var id = res[1];<br />
var field = res[2];<br />
var DT = new Date();<br />
var datestr = CiteTB.formatDate(DT);<br />
$('#cite-'+id+'-'+field).val(datestr);<br />
return false;<br />
};<br />
<br />
CiteTB.formatDate = function(DT, useday, usemonth) {<br />
if (typeof useday == "undefined") {<br />
useday = true; <br />
}<br />
if (typeof usemonth == "undefined") {<br />
usemonth = true; <br />
}<br />
var datestr = CiteTB.getOption('date format');<br />
var zmonth = '';<br />
var month = DT.getUTCMonth()+1;<br />
if (month < 10) {<br />
zmonth = "0"+month.toString();<br />
} else {<br />
zmonth = month.toString();<br />
}<br />
month = month.toString();<br />
var zdate = '';<br />
var date = DT.getUTCDate();<br />
if (date < 10) {<br />
zdate = "0"+date.toString();<br />
} else {<br />
zdate = date.toString();<br />
}<br />
date = date.toString();<br />
if (useday) {<br />
datestr = datestr.replace('<date>', date);<br />
datestr = datestr.replace('<zdate>', zdate);<br />
} else {<br />
datestr = datestr.replace('<date>', '');<br />
datestr = datestr.replace('<zdate>', '');<br />
}<br />
if (usemonth) {<br />
datestr = datestr.replace('<month>', month);<br />
datestr = datestr.replace('<zmonth>', zmonth);<br />
datestr = datestr.replace('<monthname>', CiteTB.getOption('months')[DT.getUTCMonth()]);<br />
} else {<br />
datestr = datestr.replace('<month>', '');<br />
datestr = datestr.replace('<zmonth>', '');<br />
datestr = datestr.replace('<monthname>', '');<br />
} <br />
datestr = datestr.replace('<year>', DT.getUTCFullYear().toString());<br />
return datestr.replace(/^[ \/\-\,\.]*(.*?)[ \/\-\,\.]*$/g, "$1"); // Cleanup any dangling spaces or connectors that might result from omitting date/month<br />
};<br />
<br />
// Function called after the ref list is loaded, to actually set the contents of the named ref dialog<br />
// Until the list is loaded, its just a "Loading" placeholder<br />
CiteTB.setupNamedRefs = function() {<br />
var names = [], i;<br />
for( i=0; i<CiteTB.mainRefList.length; i++) {<br />
if (!CiteTB.mainRefList[i].shorttag && CiteTB.mainRefList[i].refname) {<br />
names.push(CiteTB.mainRefList[i]);<br />
}<br />
}<br />
var stuff = $('<div>');<br />
$('#citetoolbar-namedrefs').html( stuff );<br />
if (names.length === 0) {<br />
stuff.html(mw.usability.getMsg('cite-no-namedrefs'));<br />
} else {<br />
stuff.html(mw.usability.getMsg('cite-namedrefs-intro'));<br />
var select = $('<select id="cite-namedref-select">');<br />
select.append($('<option value="" />').text(mw.usability.getMsg('cite-named-refs-dropdown')));<br />
for(i=0; i<names.length; i++) {<br />
select.append($('<option />').text(names[i].refname));<br />
}<br />
stuff.after(select);<br />
select.before('<br />'); <br />
var prevlabel = $('<div id="cite-nref-preview-label" style="display:none;" />').html(mw.usability.getMsg('cite-raw-preview'));<br />
select.after(prevlabel);<br />
prevlabel.before("<br /><br />");<br />
prevlabel.after('<div id="cite-namedref-preview" style="padding:0.5em; font-size:110%" />');<br />
var parselabel = $('<span id="cite-parsed-label" style="display:none;" />').html(mw.usability.getMsg('cite-parsed-label'));<br />
$('#cite-namedref-preview').after(parselabel);<br />
parselabel.after('<div id="cite-namedref-parsed" style="padding-bottom:0.5em; font-size:110%" />');<br />
var link = $('<a href="#" id="cite-nref-parse" style="margin:0 1em 0 1em; display:none; color:darkblue" />');<br />
link.html(mw.usability.getMsg('cite-form-parse'));<br />
$('#cite-namedref-parsed').after(link);<br />
<br />
$("#cite-namedref-select").bind( 'change', CiteTB.namedRefSelectClick);<br />
$('#cite-nref-parse').bind( 'click', CiteTB.nrefParseClick);<br />
} <br />
};<br />
<br />
// Function to get the errorcheck form HTML<br />
CiteTB.setupErrorCheck = function() {<br />
var form = $('<div id="cite-errorcheck-heading" />').html(mw.usability.getMsg('cite-errorcheck-heading'));<br />
var ul = $("<ul id='cite-errcheck-list' />");<br />
var test;<br />
for (var t in CiteTB.ErrorChecks) {<br />
test = CiteTB.ErrorChecks[t];<br />
ul.append(test.getRow());<br />
}<br />
form.append(ul);<br />
$('#citetoolbar-errorcheck').html(form);<br />
};<br />
<br />
// Callback function for parsed preview<br />
CiteTB.fillNrefPreview = function(parsed) {<br />
$('#cite-parsed-label').show();<br />
$('#cite-namedref-parsed').html(parsed);<br />
};<br />
<br />
// Click handler for the named-ref parsed preview<br />
CiteTB.nrefParseClick = function() {<br />
var choice = $("#cite-namedref-select").val();<br />
if (choice === '') {<br />
$('#cite-parsed-label').hide();<br />
$('#cite-namedref-parsed').text('');<br />
return false;<br />
}<br />
$('#cite-nref-parse').hide();<br />
for( var i=0; i<CiteTB.mainRefList.length; i++) {<br />
if (!CiteTB.mainRefList[i].shorttag && CiteTB.mainRefList[i].refname == choice) {<br />
CiteTB.parse(CiteTB.mainRefList[i].content, CiteTB.fillNrefPreview);<br />
return false;<br />
}<br />
} <br />
};<br />
<br />
// Click handler for the named-ref dropdown<br />
CiteTB.lastnamedrefchoice = '';<br />
CiteTB.namedRefSelectClick = function() {<br />
var choice = $("#cite-namedref-select").val();<br />
if (CiteTB.lastnamedrefchoice == choice) {<br />
return;<br />
}<br />
CiteTB.lastnamedrefchoice = choice;<br />
$('#cite-parsed-label').hide();<br />
$('#cite-namedref-parsed').text('');<br />
if (choice === '') {<br />
$('#cite-nref-preview-label').hide();<br />
$('#cite-namedref-preview').text('');<br />
$('#cite-nref-parse').hide();<br />
return;<br />
}<br />
for( var i=0; i<CiteTB.mainRefList.length; i++) {<br />
if (!CiteTB.mainRefList[i].shorttag && CiteTB.mainRefList[i].refname == choice) {<br />
$('#cite-nref-preview-label').show();<br />
$('#cite-namedref-preview').text(CiteTB.mainRefList[i].content);<br />
if (CiteTB.getOption('autoparse')) {<br />
CiteTB.nrefParseClick();<br />
} else {<br />
$('#cite-nref-parse').show();<br />
}<br />
}<br />
}<br />
};<br />
<br />
// callback function for parsed preview<br />
CiteTB.fillTemplatePreview = function(text) {<br />
var template = CiteTB.getOpenTemplate();<br />
var div = $("#citetoolbar-"+CiteTB.escStr(template.shortform));<br />
div.find('.cite-prev-parsed-label').show();<br />
div.find('.cite-preview-parsed').html(text);<br />
};<br />
<br />
// Click handler for template parsed preview<br />
CiteTB.prevParseClick = function() {<br />
var ref = CiteTB.getRef(true, false);<br />
var template = CiteTB.getOpenTemplate();<br />
var div = $("#citetoolbar-"+CiteTB.escStr(template.shortform));<br />
div.find('.cite-prev-parse').hide();<br />
CiteTB.parse(ref, CiteTB.fillTemplatePreview);<br />
};<br />
<br />
// Show/hide the extra fields in the dialog box<br />
CiteTB.showHideExtra = function() {<br />
var template = CiteTB.getOpenTemplate();<br />
var div = $("#citetoolbar-"+CiteTB.escStr(template.shortform));<br />
var setting = div.find(".cite-form-status").val();<br />
if ( setting === 'closed' ) {<br />
div.find(".cite-form-status").val('open');<br />
div.find('.cite-extra-fields').show(1, function() {<br />
// jQuery adds "display:block", which screws things up<br />
div.find('.cite-extra-fields').attr('style', 'width:100%; background-color:transparent;'); <br />
});<br />
} else {<br />
div.find(".cite-form-status").val('closed');<br />
div.find('.cite-extra-fields').hide();<br />
} <br />
};<br />
<br />
// Resets form fields and previews<br />
// Resets form fields and previews<br />
CiteTB.resetForm = function() {<br />
var template = CiteTB.getOpenTemplate();<br />
var div = $("#citetoolbar-"+CiteTB.escStr(template.shortform));<br />
div.html(template.getForm());<br />
};<br />
<br />
// STRING UTILITY FUNCTIONS<br />
// Returns a string quoted as necessary for name/group attributes<br />
CiteTB.getQuotedString = function(s) {<br />
var sq = /\'/.test(s); // single quotes<br />
var dq = /\"/.test(s); // double quotes<br />
if (!sq && !dq) { // Always quotes for non-latin alphabet<br />
return '"'+s+'"';<br />
} else if (!dq) { // Can use double quotes<br />
return '"'+s+'"';<br />
} else if (!sq) { // Can use single quotes<br />
return "'"+s+"'";<br />
} else { // Has double and single quotes<br />
s = s.replace(/\"/g, '\'');<br />
return '"'+s+'"';<br />
}<br />
};<br />
<br />
// Fix up strings for output - capitalize first char, replace underscores with spaces<br />
CiteTB.fixStr = function(s) {<br />
s = s.slice(0,1).toUpperCase() + s.slice(1);<br />
s = s.replace('_',' ');<br />
return s;<br />
};<br />
<br />
// Escape spaces and quotes for use in HTML classes/ids<br />
CiteTB.escStr = function(s) {<br />
return s.replace(' ', '-').replace("'", "\'").replace('"', '\"');<br />
};<br />
<br />
// MISC FUNCTIONS<br />
// Determine which template form is open, and get the template object for it<br />
CiteTB.getOpenTemplate = function() {<br />
var dialogs = $(".ui-dialog-content.ui-widget-content:visible");<br />
var templatename = $(dialogs[0]).find(".cite-template").val();<br />
return CiteTB.Templates[templatename];<br />
};<br />
<br />
// Display the report for the error checks<br />
CiteTB.displayErrors = function(errors) {<br />
$('#cite-err-report').remove();<br />
var table = $('<table id="cite-err-report" style="width:100%; border:1px solid #A9A9A9; background-color:#FFEFD5; padding:0.25em; margin-top:0.5em" />');<br />
$('#editpage-copywarn').before(table);<br />
var tr;<br />
var tr1 = $('<tr style="width:100%" />');<br />
var th1 = $('<th style="width:60%; font-size:110%" />').html(mw.usability.getMsg('cite-err-report-heading'));<br />
var th2 = $('<th style="text-align:right; width:40%" />');<br />
var im = $('<img />').attr('src', '//upload.wikimedia.org/wikipedia/commons/thumb/5/55/Gtk-stop.svg/20px-Gtk-stop.svg.png');<br />
im.attr('alt', mw.usability.getMsg('cite-err-report-close')).attr('title', mw.usability.getMsg('cite-err-report-close'));<br />
var ad = $('<a id="cite-err-check-close" />').attr('href', '#');<br />
ad.append(im);<br />
th2.append(ad);<br />
tr1.append(th1).append(th2);<br />
table.append(tr1);<br />
$('#cite-err-check-close').bind('click', function() { $('#cite-err-report').remove(); });<br />
if (errors.length === 0) {<br />
tr = $('<tr style="width:100%;" />');<br />
var td = $('<td style="text-align:center; margin:1.5px;" />').html(mw.usability.getMsg('cite-err-report-empty'));<br />
tr.append(td);<br />
table.append(tr);<br />
<br />
return;<br />
}<br />
for(var e in errors) {<br />
var err = errors[e];<br />
tr = $('<tr style="width:100%;" />');<br />
var td1 = $('<td style="border: 1px solid black; margin:1.5px; width:60%" />').html(err.err);<br />
var td2 = $('<td style="border: 1px solid black; margin:1.5px; width:40%" />').html(mw.usability.getMsg(err.msg));<br />
tr.append(td1).append(td2);<br />
table.append(tr);<br />
}<br />
};<br />
<br />
} // End of code loaded only on edit</div>
Nicolas Brouard
http://fr-i.demopaedia.org/w/index.php?title=MediaWiki:Gadget-DotsSyntaxHighlighter.js&diff=11668
MediaWiki:Gadget-DotsSyntaxHighlighter.js
2017-06-25T18:13:10Z
<p>Nicolas Brouard : 1 révision importée</p>
<hr />
<div>//Syntax highlighter with various advantages See [[User:Remember the<br />
//dot/Syntax highlighter]] for more information<br />
/*<br />
MediaWiki:Gadget-DotsSyntaxHighlighter<br />
[https://www.mediawiki.org/wiki/User:Remember_the_dot/Syntax_highlighter Adapted from Syntax highlighter]: Make syntax stand out colourfully in the edit box and especially with Demopaedia TextTerm etc.<br />
<br />
MediaWiki:Gadget-DotsSyntaxHighlighter.js<br />
<br />
*/<br />
//in the edit box and especially with Demopaedia TextTerm etc.<br />
/* This file may be used under the terms of any of the following<br />
licenses, as well as any later version of the same licenses:<br />
<br />
GNU General Public License 2.0<br />
<https://www.gnu.org/licenses/old-licenses/gpl-2.0.html><br />
<br />
Creative Commons Attribution-ShareAlike 3.0 Unported License<br />
<https://creativecommons.org/licenses/by-sa/3.0/><br />
<br />
GNU Free Documentation License 1.2<br />
<https://www.gnu.org/licenses/old-licenses/fdl-1.2.html><br />
Modified by Nicolas Brouard for Demopaedia.org 12 June 2017<br />
*/<br />
<br />
(function () {<br />
"use strict";<br />
<br />
//variables that are preserved between function calls<br />
var wpTextbox0;<br />
var wpTextbox1;<br />
var syntaxStyleTextNode;<br />
var lastText;<br />
var maxSpanNumber = -1; //the number of the last span available, used to tell if creating additional spans is necessary<br />
var highlightSyntaxIfNeededIntervalID;<br />
var attributeObserver;<br />
var parentObserver;<br />
<br />
/* Define context-specific regexes, one for every common token that ends the<br />
current context.<br />
<br />
An attempt has been made to search for the most common syntaxes first,<br />
thus maximizing performance. Syntaxes that begin with the same character<br />
are searched for at the same time.<br />
<br />
Supported wiki syntaxes from most common to least common:<br />
[[internal link]] [http:// named external link]<br />
{{template}} {{{template parameter}}} {| table |}<br />
<tag> <!-- comment --><br />
http:// bare external link<br />
=Heading= * unordered list # ordered list : indent ; small heading ---- horizontal line<br />
''italic'' '''bold'''<br />
three tildes username four tildes signature five tildes timestamp<br />
&entity;<br />
<br />
The tag-matching regex follows the XML standard closely so that users<br />
won't feel like they have to escape sequences that MediaWiki will never<br />
consider to be tags.<br />
<br />
Only entities for characters which need to be escaped or cannot be<br />
unambiguously represented in a monospace font are highlighted, such as<br />
Greek letters that strongly resemble Latin letters. Use of other entities<br />
is discouraged as a matter of style. For the same reasons, numeric<br />
entities should be in hexadecimal (giving character codes in decimal only<br />
adds confusion).<br />
<br />
Newlines are sucked up into ending tokens (including comments, bare<br />
external links, lists, horizontal lines, signatures, entities, etc.) to<br />
avoid creating spans with nothing but newlines in them.<br />
<br />
Flags: g for global search, m for make ^ match the beginning of each line<br />
and $ the end of each line<br />
*/<br />
var wgUrlProtocols = mw.config.get("wgUrlProtocols");<br />
var entityRegexBase = "&(?:(?:n(?:bsp|dash)|m(?:dash|inus)|lt|e[mn]sp|thinsp|amp|quot|gt|shy|zwn?j|lrm|rlm|Alpha|Beta|Epsilon|Zeta|Eta|Iota|Kappa|[Mm]u|micro|Nu|[Oo]micron|[Rr]ho|Tau|Upsilon|Chi)|#x[0-9a-fA-F]+);\n*";<br />
var breakerRegexBase = "\\[(?:\\[|(?:" + wgUrlProtocols + "))|\\{(?:\\{\\{?|\\|)|<(?:[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:\\w\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD-\\.\u00B7\u0300-\u036F\u203F-\u203F-\u2040]*(?=/?>| |\n)|!--[^]*?-->\n*)|(?:" + wgUrlProtocols.replace("|\\/\\/", "") + ")[^\\s\"<>[\\]{-}]*[^\\s\",\\.:;<>[\\]{-}]\n*|^(?:=|[*#:;]+\n*|-{4,}\n*)|\\\\'\\\\'(?:\\\\')?|~{3,5}\n*|" + entityRegexBase;<br />
function breakerRegexWithPrefix(prefix)<br />
{<br />
//the stop token has to be at the beginning of the regex so that it takes precedence over substrings of itself.<br />
return new RegExp("(" + prefix + ")\n*|" + breakerRegexBase, "gm");<br />
}<br />
function nowikiTagBreakerRegex(tagName)<br />
{<br />
return new RegExp("(</" + tagName + ">)\n*|" + entityRegexBase, "gm");<br />
}<br />
var defaultBreakerRegex = new RegExp(breakerRegexBase, "gm");<br />
var wikilinkBreakerRegex = breakerRegexWithPrefix("]][a-zA-Z]*");<br />
var namedExternalLinkBreakerRegex = breakerRegexWithPrefix("]");<br />
var parameterBreakerRegex = breakerRegexWithPrefix("}}}");<br />
var templateBreakerRegex = breakerRegexWithPrefix("}}");<br />
var templateArgBreakerRegex = breakerRegexWithPrefix("[\\|}]");<br />
var tableBreakerRegex = breakerRegexWithPrefix("\\|}");<br />
var headingBreakerRegex = breakerRegexWithPrefix("\n");<br />
var tagBreakerRegexCache = {};<br />
var nowikiTagBreakerRegexCache = {};<br />
<br />
function highlightSyntax()<br />
{<br />
lastText = wpTextbox1.value;<br />
/* Backslashes and apostrophes are CSS-escaped at the beginning and all<br />
parsing regexes and functions are designed to match. On the other hand,<br />
newlines are not escaped until written so that in the regexes ^ and $<br />
work for both newlines and the beginning or end of the string. */<br />
var text = lastText.replace(/['\\]/g, "\\$&") + "\n"; //add a newline to fix scrolling and parsing issues<br />
var i = 0; //the location of the parser as it goes through var text<br />
<br />
var css = "";<br />
var spanNumber = 0;<br />
var lastColor;<br />
var before = true;<br />
<br />
//writes text into to-be-created span elements of wpTextbox0 using :before and :after pseudo-elements<br />
//both :before and :after are used because using two pseudo-elements per span is significantly faster than doubling the number of spans required<br />
function writeText(text, color)<br />
{<br />
//no need to use another span if using the same color<br />
if (color != lastColor)<br />
{<br />
//whitespace is omitted in the hope of increasing performance<br />
css += "'}#s" + spanNumber; //spans will be created with IDs s0 through sN<br />
if (before)<br />
{<br />
css += ":before{";<br />
before = false;<br />
}<br />
else<br />
{<br />
css += ":after{";<br />
before = true;<br />
++spanNumber;<br />
}<br />
if (color)<br />
{<br />
//"background-color" is 6 characters longer than "background" but the browser processes it faster<br />
css += "background-color:" + color + ";";<br />
}<br />
css += "content:'";<br />
lastColor = color;<br />
}<br />
css += text;<br />
}<br />
<br />
/* About assumedBold and assumedItalic:<br />
<br />
Highlighting bold or italic markup presents a special challenge<br />
because the actual MediaWiki parser uses multiple passes to determine<br />
which ticks represent start tags and which represent end tags.<br />
Because that would be too slow for us here, we instead keep track of<br />
what kinds of unclosed opening ticks have been encountered and use<br />
that to make a good guess as to whether the next ticks encountered<br />
are an opening tag or a closing tag.<br />
<br />
The major downsides to this method are that '''apostrophe italic''<br />
and ''italic apostrophe''' are not highlighted correctly, and bold<br />
and italic are both highlighted in the same color.<br />
<br />
To permit ''The best<ref>''Reference Title''</ref> book ever'',<br />
assumedBold and assumedItalic are saved on the stack and reset to<br />
undefined (essentially, false) when recursing into a new block. */<br />
<br />
function highlightBlock(color, breakerRegex, assumedBold, assumedItalic)<br />
{<br />
var match;<br />
<br />
for (breakerRegex.lastIndex = i; match = breakerRegex.exec(text); breakerRegex.lastIndex = i)<br />
{<br />
// console.log(" breakerRegex.lastIndex="+breakerRegex.lastIndex);<br />
// console.log(" breakerRegex.source="+breakerRegex.source);<br />
//console.log(" match.input="+match.input);<br />
// if (match[1])<br />
// //console.log(" match1=" + match[1]+ " match0=" +match[0]);<br />
// else<br />
// //console.log(" unmatch1=" + match[1]+ " match0=" +match[0]);<br />
if (match[1])<br />
{<br />
//end token found, we are within a coloured zone <br />
writeText(text.substring(i, breakerRegex.lastIndex), color);<br />
//console.log(" breaker Regex i="+ i + " breakerRegex.lastIndex=" +breakerRegex.lastIndex + " t="+text.substring(i, breakerRegex.lastIndex) + " return highlight" );<br />
i = breakerRegex.lastIndex; /* end of zone */<br />
<br />
return; /* returns after the break ie for with a defautregex in order to search again */<br />
}<br />
<br />
var endIndexOfLastColor = breakerRegex.lastIndex - match[0].length; /* Not including the match? */<br />
if (i < endIndexOfLastColor) //avoid calling writeText with text == "" to improve performance<br />
{<br />
writeText(text.substring(i, endIndexOfLastColor), color); /* Includes i (from 0), excludes endIndexOfLastColor */<br />
//console.log(" substring i="+ i + " endIndexOfLastColor=" + endIndexOfLastColor );<br />
<br />
}<br />
<br />
i = breakerRegex.lastIndex; /* Out of coloured zone */ /* Dot is first position after the search "{{." */<br />
<br />
switch (match[0].charAt(0)) //cases in this switch should be arranged from most common to least common<br />
{<br />
case "[":<br />
if (match[0].charAt(1) == "[")<br />
{<br />
//wikilink<br />
writeText("[[", syntaxHighlighterConfig.wikilinkColor || color);<br />
highlightBlock(syntaxHighlighterConfig.wikilinkColor || color, wikilinkBreakerRegex);<br />
}<br />
else<br />
{<br />
//named external link<br />
writeText(match[0], syntaxHighlighterConfig.externalLinkColor || color);<br />
highlightBlock(syntaxHighlighterConfig.externalLinkColor || color, namedExternalLinkBreakerRegex);<br />
}<br />
break;<br />
case "{":<br />
if (match[0].charAt(1) == "{")<br />
{<br />
if (match[0].length == 3)<br />
{<br />
//parameter<br />
writeText("{{{", syntaxHighlighterConfig.parameterColor || color);<br />
highlightBlock(syntaxHighlighterConfig.parameterColor || color, parameterBreakerRegex);<br />
}<br />
else<br />
{<br />
//template<br />
//some other kind of template, search for its end<br />
//writeText("{{", syntaxHighlighterConfig.templateColor || color);<br />
//{{Note|6| {{NoteTerm|Biométrie}}, s.f. - {{NoteTerm|biométrique}}, adj. - {{NoteTerm|biométricien}}, s.m. : spécialiste de la biométrie.}}<br />
//var templEnd = text.indexOf("}", i) + 1; /* Just before first } +1*/<br />
var templTextTermEnd = text.indexOf("|", i); /* char from 0 to index "{{Note|" is position 6 (7th char); just after first | if any*/<br />
var iv=text.indexOf("|", i);//"{{Note|1|" termEnd is position 7 (starting at "1"), result is 8<br />
var ib=text.indexOf("}", i);//"{{RefTerm|Love}}" termEnd is position 9 (starting at "L"), result is 13<br />
var nbarg=0;<br />
var templTextTermEnd ;<br />
var templTextTermEndClose;<br />
if( (ib < iv) || (iv == -1) ){<br />
nbarg=0;<br />
templTextTermEndClose=templTextTermEnd = ib ;/* Just at } if any */ /* no argument */<br />
}else{<br />
nbarg=1;<br />
templTextTermEnd = iv ; /* Just at second | if any */<br />
}<br />
//{{Current status}}<br />
if(nbarg==1){<br />
iv=text.indexOf("|", templTextTermEnd+1);//"{{Note|1|" termEnd is position 7 (starting at "1"), result is 8<br />
ib=text.indexOf("}", templTextTermEnd+1);//"{{RefTerm|Love}}" termEnd is position 9 (starting at "L"), result is 13<br />
if( (ib < iv) || (iv == -1) ){<br />
templTextTermEndClose= ib ;/* Just at } if any */<br />
}else{<br />
nbarg=2;<br />
templTextTermEndClose = iv ; /* Just at second | if any {{Note|1| */<br />
}<br />
}<br />
//console.log("templ1 TextTermEndClose :" + templTextTermEndClose); // Ok before |<br />
// Be careful with scrolling and asynchronous generated by console.log see<br />
// https://developer.mozilla.org/en-US/docs/Mozilla/Performance/Scroll-linked_effects<br />
//console.log("templ End :" + templEnd + " noarg=", noarg); // Ok before }}<br />
// console.log("templ TextTermEnd :" + templTextTermEnd); // Ok before |<br />
//console.log("templ TextTermEndClose :" + templTextTermEndClose); // Ok before |<br />
// La {{TextTerm|démographie historique|1|102|OtherIndexEntry=historique. démographie ...}} s’occupe<br />
//de la {{NonRefTerm|structure}} <br />
//{{Note|6| {{NoteTerm|Biométrie}}, s.f. - {{NoteTerm|biométrique}}, adj. - {{NoteTerm|biométricien}}, s.m. : spécialiste de la biométrie.}}<br />
//var templText = text.substring(i+2 - match[0].length, templEnd-1);<br />
//TextTerm|démographie historique|1|102|OtherIndexEntry=historique. démographie ..<br />
//NonRefTerm|structure<br />
var templTextType = text.substring(i+2 - match[0].length, templTextTermEnd); /* Excluding char at TermEnd | or } */<br />
//TextTerm<br />
//NonRefTerm<br />
//var templTextTermall = text.substring(templTextTermEnd, templEnd); /* Just after termination | or }*/<br />
//démographie historique|1|102|OtherIndexEntry=historique. démographie ...<br />
//NonRefTerm|structure<br />
var templTextTerm;<br />
if(nbarg >0)<br />
templTextTerm = text.substring(templTextTermEnd+1,templTextTermEndClose); //excluding terminaison | or }<br />
else<br />
templTextTerm="";<br />
//templTextTermall.substring(0, templTextTermall.indexOf("|"));<br />
//démographie historique<br />
//structure<br />
var TypeTemplateColor=syntaxHighlighterConfig.templateColor;<br />
var TemplateColor=syntaxHighlighterConfig.templateColor;<br />
var Text1TemplateColor=syntaxHighlighterConfig.templateColor;<br />
var Text2TemplateColor=syntaxHighlighterConfig.templateColor;<br />
if((templTextType=="TextTerm") ){<br />
TypeTemplateColor= syntaxHighlighterConfig.templTextTermColor;<br />
TemplateColor= syntaxHighlighterConfig.templTypeTextTermColor;<br />
Text1TemplateColor= syntaxHighlighterConfig.backgroundColor;<br />
Text2TemplateColor=TemplateColor ;<br />
}else if ( (templTextType=="Note") ){<br />
TypeTemplateColor= syntaxHighlighterConfig.templTypeNoteColor;<br />
TemplateColor= syntaxHighlighterConfig.templNoteColor;<br />
Text1TemplateColor= syntaxHighlighterConfig.backgroundColor;<br />
Text2TemplateColor= syntaxHighlighterConfig.templNoteColor;<br />
}else if ( (templTextType=="NoteTerm") ){<br />
TypeTemplateColor= syntaxHighlighterConfig.templNoteTermColor;<br />
TemplateColor= syntaxHighlighterConfig.templNoteTermColor;<br />
Text1TemplateColor= syntaxHighlighterConfig.backgroundColor;<br />
Text2TemplateColor= syntaxHighlighterConfig.templNoteTermColor;<br />
}else if (templTextType=="NewTextTerm" ){<br />
TypeTemplateColor= syntaxHighlighterConfig.templTextTermColor;<br />
TemplateColor= syntaxHighlighterConfig.templTypeNewTextTermColor;<br />
Text1TemplateColor= syntaxHighlighterConfig.backgroundColor;<br />
Text2TemplateColor= TemplateColor;<br />
}else if ( templTextType=="RefNumber" ){<br />
TypeTemplateColor= syntaxHighlighterConfig.templRefNumberColor;<br />
TemplateColor= syntaxHighlighterConfig.templRefNumberColor;<br />
Text1TemplateColor= syntaxHighlighterConfig.backgroundColor;<br />
Text2TemplateColor= TemplateColor;<br />
}else if ((templTextType=="NonRefTerm") ){<br />
TypeTemplateColor= syntaxHighlighterConfig.templNonRefTermColor;<br />
TemplateColor= syntaxHighlighterConfig.templNonRefTermColor;<br />
Text1TemplateColor= syntaxHighlighterConfig.backgroundColor;<br />
Text2TemplateColor= syntaxHighlighterConfig.backgroundColor;<br />
}<br />
//writeText("{{", TemplateColor || color);<br />
writeText("{{", TemplateColor || color); //NonRefTerm| or TextTerm|<br />
writeText(templTextType, TypeTemplateColor || color); //NonRefTerm| or TextTerm|<br />
i=templTextTermEnd;<br />
if(nbarg>=1){<br />
writeText( "|", TemplateColor || color); //NonRefTerm| or TextTerm|<br />
//writeText(templTextType+"|", syntaxHighlighterConfig.templateColor || color); //NonRefTerm| or TextTerm|<br />
i=templTextTermEnd+1;<br />
//writeText(templTextTerm, syntaxHighlighterConfig.tagColor || color); //struture<br />
writeText(templTextTerm, Text1TemplateColor || color); //struture<br />
i=templTextTermEndClose; //-noarg; démographie historique| or 1|, at the terminaison (| or }.<br />
}<br />
if(nbarg==2){<br />
writeText("|",Text2TemplateColor || color);<br />
i=templTextTermEndClose+1; //-noarg; démographie historique| or 1|, at the terminaison (| or }.<br />
}<br />
//console.log(" i="+ i );<br />
//highlightBlock(syntaxHighlighterConfig.templateColor || color, templateBreakerRegex);<br />
highlightBlock(TemplateColor || color, templateBreakerRegex);<br />
}<br />
}<br />
else //|<br />
{<br />
//table<br />
writeText("{|", syntaxHighlighterConfig.tableColor || color);<br />
highlightBlock(syntaxHighlighterConfig.tableColor || color, tableBreakerRegex);<br />
}<br />
break;<br />
case "<":<br />
if (match[0].charAt(1) == "!")<br />
{<br />
//comment tag<br />
writeText(match[0], syntaxHighlighterConfig.commentColor || color);<br />
break;<br />
}<br />
else<br />
{<br />
//some other kind of tag, search for its end<br />
//the search is made easier because XML attributes may not contain the character ">"<br />
var tagEnd = text.indexOf(">", i) + 1;<br />
if (tagEnd == 0)<br />
{<br />
//not a tag, just a "<" with some text after it<br />
writeText("<", color);<br />
i = i - match[0].length + 1;<br />
break;<br />
}<br />
<br />
if (text.charAt(tagEnd - 2) == "/")<br />
{<br />
//empty tag<br />
writeText(text.substring(i - match[0].length, tagEnd), syntaxHighlighterConfig.tagColor || color);<br />
i = tagEnd;<br />
}<br />
else<br />
{<br />
var tagName = match[0].substring(1);<br />
<br />
if (syntaxHighlighterConfig.sourceTags.indexOf(tagName) != -1)<br />
{<br />
//tag that contains text in a different programming language<br />
var stopAfter = "</" + tagName + ">";<br />
var endIndex = text.indexOf(stopAfter, i);<br />
if (endIndex == -1)<br />
{<br />
endIndex = text.length;<br />
}<br />
else<br />
{<br />
endIndex += stopAfter.length;<br />
}<br />
writeText(text.substring(i - match[0].length, endIndex), syntaxHighlighterConfig.tagColor || color);<br />
i = endIndex;<br />
}<br />
else if (syntaxHighlighterConfig.nowikiTags.indexOf(tagName) != -1)<br />
{<br />
//tag that can contain only HTML entities<br />
writeText(text.substring(i - match[0].length, tagEnd), syntaxHighlighterConfig.tagColor || color);<br />
i = tagEnd;<br />
highlightBlock(syntaxHighlighterConfig.tagColor || color, nowikiTagBreakerRegexCache[tagName]);<br />
}<br />
else<br />
{<br />
//ordinary tag<br />
writeText(text.substring(i - match[0].length, tagEnd), syntaxHighlighterConfig.tagColor || color);<br />
i = tagEnd;<br />
if (!tagBreakerRegexCache[tagName])<br />
{<br />
tagBreakerRegexCache[tagName] = breakerRegexWithPrefix("</" + tagName + ">");<br />
}<br />
highlightBlock(syntaxHighlighterConfig.tagColor || color, tagBreakerRegexCache[tagName]);<br />
}<br />
}<br />
}<br />
break;<br />
case "=":<br />
if (/[^=]=+$/.test(text.substring(i, text.indexOf("\n", i)))) //the line begins and ends with an equals sign and has something else in the middle<br />
{<br />
//heading<br />
writeText("=", syntaxHighlighterConfig.headingColor || color);<br />
highlightBlock(syntaxHighlighterConfig.headingColor || color, headingBreakerRegex);<br />
}<br />
else<br />
{<br />
writeText("=", color); //move on, process this line as regular wikitext<br />
}<br />
break;<br />
case "*":<br />
case "#":<br />
case ":":<br />
//unordered list, ordered list, indent, small heading<br />
//just highlight the marker<br />
writeText(match[0], syntaxHighlighterConfig.listOrIndentColor || color);<br />
break;<br />
case ";":<br />
//small heading<br />
writeText(";", syntaxHighlighterConfig.headingColor || color);<br />
highlightBlock(syntaxHighlighterConfig.headingColor || color, headingBreakerRegex);<br />
break;<br />
case "-":<br />
//horizontal line<br />
writeText(match[0], syntaxHighlighterConfig.hrColor || color);<br />
break;<br />
case "\\":<br />
writeText(match[0], syntaxHighlighterConfig.boldOrItalicColor || color);<br />
if (match[0].length == 6)<br />
{<br />
//bold<br />
if (assumedBold)<br />
{<br />
//end tag<br />
if (assumedItalic)<br />
{<br />
//end of bold part of bold-italic block<br />
//block is now italic-only<br />
assumedBold = false;<br />
}<br />
else<br />
{<br />
//end of bold block<br />
return;<br />
}<br />
}<br />
else<br />
{<br />
//start tag<br />
if (assumedItalic)<br />
{<br />
//start of bold part of previously italic-only block<br />
//block is now bold-italic<br />
assumedBold = true;<br />
}<br />
else<br />
{<br />
//start of bold block<br />
highlightBlock(syntaxHighlighterConfig.boldOrItalicColor || color, defaultBreakerRegex, true, false);<br />
}<br />
}<br />
}<br />
else<br />
{<br />
//italic<br />
if (assumedItalic)<br />
{<br />
//end tag<br />
if (assumedBold)<br />
{<br />
//end of italic part of bold-italic block<br />
//block is now bold-only<br />
assumedItalic = false;<br />
}<br />
else<br />
{<br />
//end of italic block<br />
return;<br />
}<br />
}<br />
else<br />
{<br />
//start tag<br />
if (assumedBold)<br />
{<br />
//start of italic part of previously bold-only block<br />
//block is now bold-italic<br />
assumedItalic = true;<br />
}<br />
else<br />
{<br />
//start of italic block<br />
highlightBlock(syntaxHighlighterConfig.boldOrItalicColor || color, defaultBreakerRegex, false, true);<br />
}<br />
}<br />
}<br />
break;<br />
case "&":<br />
//entity<br />
writeText(match[0], syntaxHighlighterConfig.entityColor || color);<br />
break;<br />
case "~":<br />
//username, signature, timestamp<br />
writeText(match[0], syntaxHighlighterConfig.signatureColor || color);<br />
break;<br />
default:<br />
//bare external link<br />
writeText(match[0], syntaxHighlighterConfig.externalLinkColor || color);<br />
}<br />
}<br />
}<br />
<br />
<br />
//start!<br />
var startTime = Date.now();<br />
highlightBlock("", defaultBreakerRegex);<br />
<br />
//output the leftovers (if any) to make sure whitespace etc. matches<br />
if (i < text.length)<br />
{<br />
writeText(text.substring(i), "");<br />
}<br />
<br />
//if highlighting took too long, disable it.<br />
var endTime = Date.now();<br />
/*if (typeof(bestTime) == "undefined")<br />
{<br />
window.bestTime = endTime - startTime;<br />
document.title = bestTime;<br />
highlightSyntaxIfNeededIntervalID = setInterval(highlightSyntax, 250);<br />
}<br />
else<br />
{<br />
if (endTime - startTime < bestTime)<br />
{<br />
bestTime = endTime - startTime;<br />
document.title = bestTime;<br />
}<br />
}//*/<br />
if (endTime - startTime > syntaxHighlighterConfig.timeout)<br />
{<br />
clearInterval(highlightSyntaxIfNeededIntervalID);<br />
wpTextbox1.removeEventListener("input", highlightSyntax);<br />
wpTextbox1.removeEventListener("scroll", syncScrollX);<br />
wpTextbox1.removeEventListener("scroll", syncScrollY);<br />
attributeObserver.disconnect();<br />
parentObserver.disconnect();<br />
syntaxStyleTextNode.nodeValue = "";<br />
<br />
var errorMessage = {<br />
ca: "S'ha desactivat el remarcar de sintaxi en aquesta pàgina perquè ha trigat massa temps. El temps màxim permès per a remarcar és $1ms, i el vostre ordinador ha trigat $2ms. Proveu tancar algunes pestanyes i programes i fer clic en \"Mostra la previsualització\" o \"Mostra els canvis\". Si no funciona això, proveu un altre navegador web, i si això no funciona, proveu un ordinador més ràpid.",<br />
de: "Die Syntaxhervorhebung wurde auf dieser Seite deaktiviert, da diese zu lange gedauert hat. Die maximal erlaubte Zeit zur Hervorhebung beträgt $1ms und dein Computer benötigte $2ms. Versuche einige Tabs und Programme zu schließen und klicke \"Vorschau zeigen\" oder \"Änderungen zeigen\". Wenn das nicht funktioniert, probiere einen anderen Webbrowser und wenn immer noch nicht, probiere einen schnelleren Computer.",<br />
el: "Η έμφαση σύνταξης έχει απενεργοποιηθεί σε αυτήν τη σελίδα γιατί αργούσε πολύ. Ο μέγιστος επιτρεπτός χρόνος για την έμφαση σύνταξης είναι $1ms και ο υπολογιστής σας έκανε $2ms. Δοκιμάστε να κλείσετε μερικές καρτέλες και προγράμματα και να κάνετε κλικ στην «Εμφάνιση προεπισκόπησης» ή στην «Εμφάνιση αλλαγών». Αν αυτό δεν δουλέψει, δοκιμάστε έναν διαφορετικό περιηγητή και αν ούτε αυτό δουλέψει, δοκιμάστε έναν ταχύτερο υπολογιστή.",<br />
en: "Syntax highlighting on this page was disabled because it took too long. The maximum allowed highlighting time is $1ms, and your computer took $2ms. Try closing some tabs and programs and clicking \"Show preview\" or \"Show changes\". If that doesn't work, try a different web browser, and if that doesn't work, try a faster computer.",<br />
es: "Se desactivó el resaltar de sintaxis en esta página porque tardó demasiado. El tiempo máximo permitido para resaltar es $1ms, y tu ordenador tardó $2ms. Prueba cerrar algunas pestañas y programas y hacer clic en \"Mostrar previsualización\" o \"Mostrar cambios\". Si no funciona esto, prueba otro navegador web, y si eso no funciona, prueba un ordenador más rápido.",<br />
fa: "از آنجایی که زمان زیادی صرف آن میشد، برجستهسازی نحو در این صفحه غیرفعال شده است. بیشینهٔ زمان برجستهسازی برای ابزار $1ms تعریف شده در حالی که رایانهٔ شما $2ms زمان نیاز داشت. میتوانید بستن برخی سربرگها و برنامهها و سپس کلیککردن دکمهٔ «پیشنمایش» یا «نمایش تغییرات» را بیازمایید. اگر جواب نداد مرورگر دیگری را امتحان کنید؛ و اگر باز هم جواب نداد، رایانهٔ سریعتری را بیازمایید.",<br />
fr: "La coloration syntaxique a été désactivée sur cette page en raison d'un temps de chargement trop important ($2ms). Le temps maximum autorisé est $1ms. Vous pouvez essayer de fermer certains onglets et programmes et cliquez sur \"Prévisualisation\" ou \"Voir mes modifications\". Si cela ne fonctionne pas, essayez un autre navigateur web, et si cela ne fonctionne toujours pas, essayez un ordinateur plus rapide.",<br />
hy: "Շարադասության ընդգծումը այս էջում անջատվել է, քանի որ այն չափից շատ է տևել։ Ընդգծման թույլատրելի առավելագույն ժամանակը $1 միլիվայրկյան է, բայց այս էջում տևել է $2 միլիվայրկյան։ Փորձեք անջատել որոշ ներդիրներ կամ ծրագրեր և սեղմել «Նախադիտել» կամ «Կատարված փոփոխությունները»։ Կրկին չաշխատելու դեպքում փորձեք այլ վեբ դիտարկիչ, եթե կրկին չաշխատի, փորձեք ավելի արագ համակարգիչ։",<br />
io: "Sintaxo-hailaitar en ca pagino esis nekapabligata pro ke konsumis tro multa tempo. La maxima permisata hailaitala tempo es $1ms, e tua ordinatro konsumis $2ms. Probez klozar kelka tabi e programi e kliktar \"Previdar\" o \"Montrez chanji\". Se to ne funcionas, probez altra brauzero, e se to ne funcionas, probez plu rapida ordinatro.",<br />
it: "L'evidenziazione delle sintassi su questa pagina è stata disabilitata perché ha richiesto troppo tempo. Il tempo massimo per l'evidenziazione è di $1ms e al tuo computer sono serviti $2ms. Prova a chiudere alcune schede e programmi e ricarica la pagina cliccando su \"Visualizza anteprima\" o \"Mostra modifiche\". Se non funziona ancora, prova con un web browser differente e, in ultima alternativa, prova ad utilizzare un computer più veloce.",<br />
ko: "이 문서에서의 문법 강조가 너무 오래 걸러서 해제되었습니다. 최대로 할당된 강조 시간은 $1ms인데, 당신의 컴퓨터는 $2ms이나 걸렸습니다. 탭과 프로그램을 일부 닫으신 후에 \"미리 보기\"나 \"차이 보기\"를 클릭하시기 바랍니다. 만약 작동하지 않으면 다른 웹 브라우저로 시도해보시고, 그래도 안되면 더 빠른 컴퓨터를 이용하십시오",<br />
pt: "O marcador de sintaxe foi desativado nesta página porque demorou demais. O tempo máximo permitido para marcar é de $1ms, e seu computador demorou $2ms. Tente fechar algumas abas e programas e clique em \"Mostrar previsão\" ou \"Mostrar alterações\". Se isso não funcionar, tente usar um outro navegador web, e se ainda não funcionar, tente em um computador mais rápido.",<br />
ru: "Подсветка синтаксиса на странице была отключена, так как заняла слишком долго. Максимальное допустимое время операции - $1мс, сейчас на вашем компьютере она заняла $2мс. Попробуйте закрыть несколько вкладок и программ, затем нажать «Предварительный просмотр» или «Внесённые изменения». Если это не поможет, попробуйте другой браузер; если и это не поможет, используйте более быстрый компьютер.",<br />
sr: "Истицање синтаксе на овој страници је онемогућено јер се одвија предуго. Максимално дозвољено време истицања је $1ms, а на Вашем рачунару траје $2ms. Покушајте затворити неке картице и програме или кликните на „Прикажи претпреглед” или „Прикажи измене”. Ако то не ради, покушајте са другим веб-прегледачем, а ако и тада не ради, покушајте са бржим рачунаром.",<br />
};<br />
var wgUserLanguage = mw.config.get("wgUserLanguage");<br />
<br />
errorMessage = errorMessage[wgUserLanguage] || errorMessage[wgUserLanguage.substring(0, wgUserLanguage.indexOf("-"))] || errorMessage.en;<br />
<br />
wpTextbox1.style.backgroundColor = "";<br />
wpTextbox1.style.marginTop = wpTextbox0.style.marginTop;<br />
wpTextbox0.removeAttribute("dir");<br />
wpTextbox0.removeAttribute("lang");<br />
wpTextbox0.setAttribute("style", "color:red; font-size:small");<br />
<br />
wpTextbox0.textContent = errorMessage.replace("$1", syntaxHighlighterConfig.timeout).replace("$2", endTime - startTime);<br />
return;<br />
}<br />
<br />
//do we have enough span elements to match the generated CSS?<br />
//this step isn't included in the above benchmark because it takes a highly variable amount of time<br />
if (maxSpanNumber < spanNumber)<br />
{<br />
var fragment = document.createDocumentFragment();<br />
do<br />
{<br />
fragment.appendChild(document.createElement("span")).id = "s" + ++maxSpanNumber;<br />
}<br />
while (maxSpanNumber < spanNumber);<br />
wpTextbox0.appendChild(fragment);<br />
}<br />
<br />
/* finish CSS: move the extra '} from the beginning to the end and CSS-<br />
escape newlines. CSS ignores the space after the hex code of the<br />
escaped character */<br />
syntaxStyleTextNode.nodeValue = css.substring(2).replace(/\n/g, "\\A ") + "'}";<br />
}<br />
<br />
function syncScrollX()<br />
{<br />
//console.log("syncScrollX");<br />
wpTextbox0.scrollLeft = wpTextbox1.scrollLeft;<br />
}<br />
<br />
function syncScrollY()<br />
{<br />
//console.log("syncScrollY");<br />
wpTextbox0.scrollTop = wpTextbox1.scrollTop;<br />
}<br />
<br />
function syncTextDirection()<br />
{<br />
wpTextbox0.dir = wpTextbox1.dir;<br />
}<br />
<br />
function syncParent()<br />
{<br />
if (wpTextbox1.previousSibling != wpTextbox0)<br />
{<br />
wpTextbox1.parentNode.insertBefore(wpTextbox0, wpTextbox1);<br />
parentObserver.disconnect();<br />
parentObserver.observe(wpTextbox1.parentNode, {childList: true});<br />
}<br />
}<br />
<br />
//this function runs once every 500ms to detect changes to wpTextbox1's text that the input event does not catch<br />
//this happens when another script changes the text without knowing that the syntax highlighter needs to be informed<br />
function highlightSyntaxIfNeeded()<br />
{<br />
if (wpTextbox1.value != lastText)<br />
{<br />
highlightSyntax();<br />
}<br />
if (wpTextbox1.scrollLeft != wpTextbox0.scrollLeft)<br />
{<br />
//console.log("Box1syncScrollX");<br />
syncScrollX();<br />
}<br />
if (wpTextbox1.scrollTop != wpTextbox0.scrollTop)<br />
{<br />
//console.log("Box1syncScrollY");<br />
syncScrollY();<br />
}<br />
if (wpTextbox1.offsetHeight != wpTextbox0.offsetHeight)<br />
{<br />
var height = wpTextbox1.offsetHeight + "px";<br />
wpTextbox0.style.height = height;<br />
wpTextbox1.style.marginTop = "-" + height;<br />
}<br />
}<br />
<br />
function setup()<br />
{<br />
function configureColor(parameterName, hardcodedFallback, defaultOk)<br />
{<br />
if (typeof(syntaxHighlighterConfig[parameterName]) == "undefined")<br />
{<br />
syntaxHighlighterConfig[parameterName] = syntaxHighlighterSiteConfig[parameterName];<br />
}<br />
<br />
if (syntaxHighlighterConfig[parameterName] == "normal")<br />
{<br />
syntaxHighlighterConfig[parameterName] = hardcodedFallback;<br />
}<br />
else if (typeof(syntaxHighlighterConfig[parameterName]) != "undefined")<br />
{<br />
return;<br />
}<br />
else if (typeof(syntaxHighlighterConfig.defaultColor) != "undefined" && defaultOk)<br />
{<br />
syntaxHighlighterConfig[parameterName] = syntaxHighlighterConfig.defaultColor;<br />
}<br />
else<br />
{<br />
syntaxHighlighterConfig[parameterName] = hardcodedFallback;<br />
}<br />
}<br />
<br />
window.syntaxHighlighterSiteConfig = window.syntaxHighlighterSiteConfig || {};<br />
window.syntaxHighlighterConfig = window.syntaxHighlighterConfig || {};<br />
<br />
//use 3-digit colors instead of 6-digit colors for performance<br />
// See for example http://maettig.com/?page=PHP/CSS_Color_Converter<br />
configureColor("backgroundColor", "#FFF", false); //white<br />
configureColor("foregroundColor", "#000", false); //black<br />
configureColor("boldOrItalicColor", "#EEE", true); //gray<br />
configureColor("commentColor", "#EFE", true); //green<br />
configureColor("entityColor", "#DFD", true); //green<br />
configureColor("externalLinkColor", "#EFF", true); //cyan<br />
configureColor("headingColor", "#EEE", true); //gray<br />
configureColor("hrColor", "#EEE", true); //gray<br />
configureColor("listOrIndentColor", "#EFE", true); //green<br />
configureColor("parameterColor", "#FC6", true); //orange<br />
configureColor("signatureColor", "#FC6", true); //orange<br />
configureColor("tagColor", "#FEF", true); //pink<br />
configureColor("tableColor", "#FFC", true); //yellow<br />
configureColor("templateColor", "#FFC", true); //gray <br />
configureColor("templTextTermColor", "#888", true); //gray<br />
configureColor("templTypeTextTermColor", "#888", true); //gray<br />
configureColor("templNewTextTermColor", "#BBB", true); //gray light<br />
configureColor("templTypeNewTextTermColor", "#BBB", true); //gray light<br />
configureColor("templNonRefTermColor", "#FEF", true); //pink<br />
configureColor("templRefNumberColor", "#E9E", true); //pink<br />
configureColor("templNoteColor", "#EFE", true); //green<br />
configureColor("templNoteTermColor", "#484", true); //green<br />
configureColor("templTypeNoteColor", "#7C7", true); //green<br />
configureColor("wikilinkColor", "#EEF", true); //blue<br />
<br />
//tag lists are ordered from most common to least common<br />
syntaxHighlighterConfig.nowikiTags = syntaxHighlighterConfig.nowikiTags || syntaxHighlighterSiteConfig.nowikiTags || ["nowiki", "pre"];<br />
syntaxHighlighterConfig.sourceTags = syntaxHighlighterConfig.sourceTags || syntaxHighlighterSiteConfig.sourceTags || ["math", "syntaxhighlight", "source", "timeline", "hiero"];<br />
syntaxHighlighterConfig.timeout = syntaxHighlighterConfig.timeout || syntaxHighlighterSiteConfig.timeout || 50;<br />
<br />
syntaxHighlighterConfig.nowikiTags.forEach(function(tagName) {<br />
nowikiTagBreakerRegexCache[tagName] = nowikiTagBreakerRegex(tagName);<br />
});<br />
<br />
wpTextbox0 = document.createElement("div");<br />
wpTextbox1 = document.getElementById("wpTextbox1");<br />
<br />
var syntaxStyleElement = document.createElement("style");<br />
syntaxStyleTextNode = syntaxStyleElement.appendChild(document.createTextNode(""));<br />
<br />
//the styling of the textbox and the background div must be kept very similar<br />
var wpTextbox1Style = window.getComputedStyle(wpTextbox1);<br />
<br />
//horizontal resize would look horribly choppy, better to make the user resize the browser window instead<br />
var resize = (wpTextbox1Style.resize == "vertical" || wpTextbox1Style.resize == "both" ? "vertical" : "none");<br />
<br />
wpTextbox0.dir = wpTextbox1.dir;<br />
wpTextbox0.id = "wpTextbox0";<br />
wpTextbox0.lang = wpTextbox1.lang; //lang determines which font "monospace" is<br />
wpTextbox0.style.backgroundColor = syntaxHighlighterConfig.backgroundColor;<br />
wpTextbox0.style.border = "1px solid transparent";<br />
wpTextbox0.style.boxSizing = "border-box";<br />
wpTextbox0.style.clear = wpTextbox1Style.clear;<br />
wpTextbox0.style.color = "transparent"; //makes it look just a little bit smoother<br />
wpTextbox0.style.fontFamily = wpTextbox1Style.fontFamily;<br />
wpTextbox0.style.fontSize = wpTextbox1Style.fontSize;<br />
wpTextbox0.style.lineHeight = "normal";<br />
wpTextbox0.style.marginBottom = "0";<br />
wpTextbox0.style.marginLeft = "0";<br />
wpTextbox0.style.marginRight = "0";<br />
wpTextbox0.style.marginTop = wpTextbox1Style.marginTop;<br />
wpTextbox0.style.overflowX = "auto";<br />
wpTextbox0.style.overflowY = "scroll";<br />
wpTextbox0.style.resize = resize;<br />
wpTextbox0.style.tabSize = wpTextbox1Style.tabSize;<br />
wpTextbox0.style.whiteSpace = "pre-wrap";<br />
wpTextbox0.style.width = "100%";<br />
wpTextbox0.style.wordWrap = "normal"; //see below<br />
<br />
wpTextbox1.style.backgroundColor = "transparent";<br />
wpTextbox1.style.border = "1px inset gray";<br />
wpTextbox1.style.boxSizing = "border-box";<br />
wpTextbox1.style.color = syntaxHighlighterConfig.foregroundColor;<br />
wpTextbox1.style.fontSize = wpTextbox1Style.fontSize; //resolves alignment problems on mobile chrome<br />
wpTextbox1.style.lineHeight = "normal";<br />
wpTextbox1.style.marginBottom = wpTextbox1Style.marginBottom; //lock to pixel value because the top margin was also locked to a pixel value when it was moved to wpTextbox0<br />
wpTextbox1.style.marginLeft = "0";<br />
wpTextbox1.style.marginRight = "0";<br />
wpTextbox1.style.overflowX = "auto";<br />
wpTextbox1.style.overflowY = "scroll";<br />
wpTextbox1.style.padding = "0";<br />
wpTextbox1.style.resize = resize;<br />
wpTextbox1.style.width = "100%";<br />
wpTextbox1.style.wordWrap = "normal"; //overall more visually appealing<br />
<br />
// https://bugzilla.mozilla.org/show_bug.cgi?id=1301290<br />
if (layoutEngine == "gecko")<br />
{<br />
wpTextbox0.style.isolation = "isolate";<br />
wpTextbox1.style.isolation = "isolate";<br />
}<br />
<br />
//lock both heights to pixel values so that the browser zoom feature works better<br />
wpTextbox1.style.height = wpTextbox0.style.height = wpTextbox1.offsetHeight + "px";<br />
<br />
//insert wpTextbox0 underneath wpTextbox1<br />
wpTextbox1.style.marginTop = -wpTextbox1.offsetHeight + "px";<br />
wpTextbox1.parentNode.insertBefore(wpTextbox0, wpTextbox1);<br />
<br />
document.head.appendChild(syntaxStyleElement);<br />
<br />
wpTextbox1.addEventListener("input", highlightSyntax);<br />
//console.log("Box1ListenersyncScroll");<br />
wpTextbox1.addEventListener("scroll", syncScrollX);<br />
wpTextbox1.addEventListener("scroll", syncScrollY);<br />
attributeObserver = new MutationObserver(syncTextDirection);<br />
attributeObserver.observe(wpTextbox1, {attributes: true});<br />
parentObserver = new MutationObserver(syncParent);<br />
parentObserver.observe(wpTextbox1.parentNode, {childList: true});<br />
highlightSyntaxIfNeededIntervalID = setInterval(highlightSyntaxIfNeeded, 500);<br />
highlightSyntax();<br />
}<br />
<br />
<br />
//enable the highlighter only when editing wikitext pages<br />
//in the future a separate parser could be added for CSS and JS pages<br />
//blacklist Internet Explorer and Edge, they're just too broken<br />
var wgAction = mw.config.get("wgAction");<br />
var layoutEngine = $.client.profile().layout;<br />
if ((wgAction == "edit" || wgAction == "submit") && mw.config.get("wgPageContentModel") == "wikitext" && layoutEngine != "trident" && layoutEngine != "edge")<br />
{<br />
//give other scripts an opportunity to set syntaxHighlighterConfig<br />
if (document.readyState == "complete")<br />
{<br />
setup();<br />
}<br />
else<br />
{<br />
$(window).load(setup);<br />
}<br />
}<br />
})();</div>
Nicolas Brouard
http://fr-i.demopaedia.org/w/index.php?title=MediaWiki:RefToolbarNoDialogsTextTerm.js&diff=11670
MediaWiki:RefToolbarNoDialogsTextTerm.js
2017-06-25T18:13:10Z
<p>Nicolas Brouard : 1 révision importée</p>
<hr />
<div>var numforms = 0;<br />
var wikEdAutoUpdateUrl;<br />
function refbuttons() {<br />
if (mw.toolbar && (document.getElementById('toolbar') || document.getElementById('wikiEditor-section-main'))/* && wikEdAutoUpdateUrl == null*/) {<br />
if (document.getElementById('toolbar')) {<br />
button = document.createElement('a');<br />
button.href = "javascript:easyCiteMain()";<br />
button.title = "Insert citation";<br />
buttonimage = document.createElement('img');<br />
buttonimage.src = "//upload.wikimedia.org/wikipedia/commons/0/00/Button_easy_cite_%281%29.png";<br />
buttonimage.alt = "Insert footnote";<br />
button.appendChild(buttonimage);<br />
document.getElementById('toolbar').appendChild(button);<br />
} else {<br />
button = document.createElement('a');<br />
button.href = "#";<br />
button.title = "Insert citation";<br />
button.id = 'reftoolbar-button';<br />
buttonimage = document.createElement('img');<br />
buttonimage.src = "//upload.wikimedia.org/wikipedia/commons/thumb/9/9a/Curly_Brackets.svg/22px-Curly_Brackets.svg.png";<br />
buttonimage.alt = "Insert citation";<br />
button.classname = "tool tool-button";<br />
buttonimage.style.width = "22px";<br />
buttonimage.style.height = "17px";<br />
buttonimage.style.paddingTop = "5px";<br />
buttonimage.style.paddingLeft = "3px";<br />
button.appendChild(buttonimage);<br />
//document.getElementById('wikiEditor-ui-toolbar').childNodes[0].childNodes[1].appendChild(button);<br />
////document.getElementById('reftoolbar-button').onclick = easyCiteMain;<br />
//$j('#reftoolbar-button').live('click', function() { easyCiteMain(); });<br />
$('#wikiEditor-section-main .group-insert').append( button );<br />
$(button).click( function() { easyCiteMain(); });<br />
<br />
}<br />
if (navigator.userAgent.indexOf('MSIE') == -1) {<br />
//alert("NO MSIE");<br />
citemain = document.createElement('div');<br />
citemain.style.display = 'none';<br />
citemain.setAttribute('Id', 'citeselect');<br />
citemain.appendChild( addOption("citeWeb()", "Cite web") );<br />
citemain.appendChild( addOption("citeBook()", "Cite book") );<br />
citemain.appendChild( addOption("citeJournal()", "Cite journal") );<br />
citemain.appendChild( addOption("citeNews()", "Cite news") );<br />
citemain.appendChild( addOption("citeNamedRef()", "Named ref") );<br />
citemain.appendChild( addOption("dispErrors()", "Error check") );<br />
citemain.appendChild( addOption("hideInitial()", "Cancel") );<br />
citemain.appendChild( addOption("textTerm()", "TextTerm") );<br />
document.getElementById('wpTextbox1').parentNode.insertBefore(citemain, document.getElementById('wpTextbox1'));<br />
}<br />
else {<br />
selection = '<div id="citeselect" style="display:none"><input type="button" value="Cite web" onclick="citeWeb()" />'+<br />
'<input type="button" value="Cite book" onclick="citeBook()" />'+<br />
'<input type="button" value="Cite journal" onclick="citeJournal()" />'+<br />
'<input type="button" value="Cite news" onclick="citeNews()" />'+<br />
'<input type="button" value="Named ref" onclick="citeNamedRef()" />'+<br />
'<input type="button" value="Error check" onclick="dispErrors()" />'+<br />
'<input type="button" value="Cancel" onclick="hideInitial()" />'+<br />
'<input type="button" value="TextTerm" onclick="textTerm()" /></div>';<br />
document.getElementById('editform').innerHTML = selection + document.getElementById('editform').innerHTML;<br />
}<br />
}<br />
}<br />
<br />
function addOption(script, text) {<br />
option = document.createElement('input');<br />
option.setAttribute('type', 'button');<br />
option.setAttribute('onclick', script);<br />
option.setAttribute("value", text);<br />
return option;<br />
}<br />
<br />
function hideInitial() {<br />
document.getElementById('citeselect').style.display = 'none';<br />
oldFormHide();<br />
}<br />
<br />
function oldFormHide() {<br />
if (numforms != 0) {<br />
document.getElementById('citediv'+numforms).style.display = 'none';<br />
}<br />
if (document.getElementById('errorform') != null) {<br />
document.getElementById('citeselect').removeChild(document.getElementById('errorform'));<br />
}<br />
} <br />
<br />
function easyCiteMain() {<br />
document.getElementById('citeselect').style.display = '';<br />
}<br />
<br />
var months = ['January', 'February', 'March', 'April', 'May', 'June',<br />
'July', 'August', 'September', 'October', 'November', 'December'];<br />
var citeGlobalDateFormat = "<date> <monthname> <year>";<br />
function getTime() {<br />
var datestr = '';<br />
if (typeof citeUserDateFormat != 'undefined') {<br />
datestr = citeUserDateFormat;<br />
} else {<br />
datestr = citeGlobalDateFormat;<br />
}<br />
var DT = new Date();<br />
var zmonth = '';<br />
var month = DT.getUTCMonth()+1;<br />
if (month < 10) {<br />
zmonth = "0"+month.toString();<br />
} else {<br />
zmonth = month.toString();<br />
}<br />
month = month.toString();<br />
var zdate = '';<br />
var date = DT.getUTCDate()<br />
if (date < 10) {<br />
zdate = "0"+date.toString();<br />
} else {<br />
zdate = date.toString();<br />
}<br />
date = date.toString()<br />
datestr = datestr.replace('<date>', date);<br />
datestr = datestr.replace('<month>', month);<br />
datestr = datestr.replace('<zdate>', zdate);<br />
datestr = datestr.replace('<zmonth>', zmonth);<br />
datestr = datestr.replace('<monthname>', months[DT.getUTCMonth()]);<br />
datestr = datestr.replace('<year>', DT.getUTCFullYear().toString());<br />
return (datestr);<br />
}<br />
<br />
function citeWeb() {<br />
citeNewsWeb("cite web");<br />
}<br />
function citeNews() {<br />
citeNewsWeb("cite news");<br />
}<br />
<br />
function textTerm() {<br />
textTermf();<br />
} <br />
<br />
var texttermall = new Array();<br />
var texttermcur = new Array();<br />
var textterminput = new Array();<br />
var poffset=null, prange=null, noffset=null, nrange=null;<br />
var section = '';<br />
var subnote = '';<br />
<br />
function textTermf() {<br />
textTermform(null,null);<br />
}<br />
<br />
function nexttextterm() {<br />
//console.log("nexttexterm before noffset :" + noffset + " nrange=" + nrange);<br />
savetextterms(); // Save if changed<br />
if(noffset){ // If there is a next<br />
textTermform(noffset, nrange); // Call with offset !{{TextTerm }}<br />
}<br />
}<br />
function previoustextterm() {<br />
//console.log("previoustexterm before poffset :" + poffset + " prange=" + prange);<br />
savetextterms();<br />
if(poffset){ // If there is a next<br />
textTermform(poffset, prange); // Call with offset !{{TextTerm }}<br />
}<br />
}<br />
<br />
<br />
<br />
function texttermfill(subtext) {<br />
var ref = new Array();<br />
this.term = '';<br />
this.note= '';<br />
this.section= '';<br />
if(section != '')<br />
this.section = section;<br />
this.subnote = '';<br />
if(subnote != '')<br />
this.subnote = subnote;<br />
this.englishentry= '';<br />
this.indexentry= '';<br />
this.otherindexentry = '';<br />
this.otherindexentrytwo = '';<br />
this.otherindexentrythree = '';<br />
this.otherindexentryfour = '';<br />
this.otherindexentryfive = '';<br />
<br />
var j=0;<br />
var nr=true;<br />
regexbar= /\|([^|]*)/gm <br />
//regexbar =/\|((.)*?)(?=[\||\n])/gm //"|programmes de population|1|933|IndexEntry=programme de population|OtherIndexEntry=population, programme de"<br />
do {<br />
ref = regexbar.exec(subtext);<br />
//console.log(" subtext=" + subtext);<br />
//console.log(" ref=" + ref);<br />
if(ref != null){<br />
switch (j)<br />
{<br />
case 0 : this.term = ref[1]; break;<br />
case 1 : this.note = ref[1]; break;<br />
case 2 : this.section = ref[1]; break;<br />
default :<br />
if(ref[1].match(/^ *?EnglishEntry *?= *?(.*) *?$/))<br />
this.englishentry = ref[1].replace(/^ *?EnglishEntry *?= *?(.*) *?$/,"$1");<br />
else if(ref[1].match(/^ *?IndexEntry *?= *?(.*) *?$/))<br />
this.indexentry = ref[1].replace(/^ *?IndexEntry *?= *?(.*) *?$/,"$1");<br />
else if(ref[1].match(/^ *?OtherIndexEntry *?= *?(.*) *?$/))<br />
this.otherindexentry = ref[1].replace(/^ *?OtherIndexEntry *?= *?(.*) *?$/,"$1");<br />
else if(ref[1].match(/^ *?OtherIndexEntryTwo *?= *?(.*) *?$/))<br />
this.otherindexentrytwo = ref[1].replace(/^ *?OtherIndexEntryTwo *?= *?(.*) *?$/,"$1");<br />
else if(ref[1].match(/^ *?OtherIndexEntryThree *?= *?(.*) *?$/))<br />
this.otherindexentrythree = ref[1].replace(/^ *?OtherIndexEntryThree *?= *?(.*) *?$/,"$1");<br />
else if(ref[1].match(/^ *?OtherIndexEntryFour *?= *?(.*) *?$/))<br />
this.otherindexentryfour = ref[1].replace(/^ *?OtherIndexEntryFour *?= *?(.*) *?$/,"$1");<br />
else if(ref[1].match(/^ *?OtherIndexEntryFive *?= *?(.*) *?$/))<br />
this.otherindexentryfive = ref[1].replace(/^ *?OtherIndexEntryFive *?= *?(.*) *?$/,"$1");<br />
else if(ref[1].match(/^ *?EnglishEntry *?= *?(.*) *?$/))<br />
this.englishentry = ref[1].replace(/^ *?EnglishEntry *?= *?(.*) *?$/,"$1");<br />
else if(j==3){<br />
this.subnote = ref[1];<br />
}else{<br />
alert("texttermfill error j=" + j + " ref1= " +ref[1]);<br />
//console.log("texttermfill error j=" + j + " ref1= " +ref[1]);<br />
}<br />
}<br />
j++;<br />
} else {<br />
nr=false;<br />
}<br />
} while (nr==true);<br />
//console.log("j=" + j + " term=" + this.term + " note=" + this.note + " section=" + this.section +" subnote=" + this.subnote +" indexentry=" + this.indexentry + " otherindexentry=" + this.otherindexentry);<br />
}<br />
<br />
<br />
function textTermform(offset,range){<br />
<br />
// We search for TextTerm in wptexbox1 from cursor position (offset) and if selected (range)<br />
// If called by a previous or next, they are not null {{TextTerm<-......>}}<br />
// if outside of a TextTerm template, we will fill with the term with the selection<br />
// in any case we compute the previous nextstart and previus end and next offset not real.<br />
// if inside a TextTerm we fill the form<br />
// if saveterm is necessary, we save and exit.<br />
// if previous or next, we save if necessary and we call textTermform with a new offset >0 (next) or <0 (previous) and range<br />
// <br />
var textarea= document.getElementById('wpTextbox1');<br />
if ('selectionStart' in textarea) {<br />
if (offset == null){ // range should be null too<br />
offset = textarea.selectionStart;<br />
range = textarea.selectionEnd - textarea.selectionStart;<br />
<br />
var lstxtterm = textarea.value.substring(0,textarea.selectionEnd). lastIndexOf("{{TextTerm") ; // Just before the string. No regex<br />
var lstcltxtterm = textarea.value.substring(0,textarea.selectionStart). lastIndexOf("}}") ; //might be for another purpose than TextTerm<br />
// Looking for the section<br />
section = '';<br />
var psectione = textarea.value.substring(0,textarea.selectionEnd). lastIndexOf("===") ; // Just before the string. No regex<br />
if(psectione != -1){<br />
var psections = textarea.value.substring(0,psectione). lastIndexOf("===") ; // Just before the string. No regex<br />
if(psections != -1){<br />
section = textarea.value.substring(psections,psectione+3).match(/^=== *?(\d{3}) *?===$/)[1];<br />
}<br />
}<br />
//console.log(" section |" + section);<br />
//textarea.value.substring(0,textarea.selectionStart). search(new RegExp("((({{TextTerm[^}]+)[^{]+)+)");<br />
<br />
if ( (-1 == lstxtterm) || ((-1 < lstxtterm) && (lstxtterm < lstcltxtterm)) ) { // @{{TextTerm ...@}}...(...).. <br />
// {{Refnumber }} ....! <br />
// alert("We are after outside a previous TextTerm or no TextTerm before:" + textarea.value.substring(0,textarea.selectionStart ));<br />
texttermcur = new texttermfill("|" + textarea.value.substring(textarea.selectionStart,textarea.selectionEnd));<br />
//console.log(" We want to fill with the selection=" + textarea.value.substring(textarea.selectionStart,textarea.selectionEnd));<br />
// On se retrouve avec du texte à ajouter et le curseur inchangé à textarea.selectionStart <br />
} else if ( (lstxtterm > lstcltxtterm) && (lstcltxtterm > -1) ) { // @}}... @{{TextTerm ... (...).. <br />
//alert("We are within a TextTerm or no closing }}:" + textarea.value.substring(lstcltxtterm, lstxtterm));<br />
<br />
// ( textarea.value.substring(lstxtterm, textarea.selectionStart). search(new RegExp("}}")) == -1) {<br />
var endtxterm= textarea.value.substring(textarea.selectionStart, textarea.length). search("}}");<br />
if( endtxterm == -1)<br />
error(" Error no closing TextTerm; should be fixed:" + textarea.value.substring(textarea.selectionStart, textarea.length));<br />
else{<br />
endtxterm = endtxterm + textarea.selectionStart +2 ; // }} included<br />
// Looking for @{{TextTerm....}}@<br />
// alert("We are within textterm " + lstxtterm + " to " + endtxterm + " soit:" + textarea.value.substring(lstxtterm,endtxterm) );<br />
//console.log(" Replacing with form result:" + textarea.value.substring(lstxtterm+"{{TextTerm".length,endtxterm-"}}".length));<br />
texttermcur = new texttermfill(textarea.value.substring(lstxtterm+"{{TextTerm".length,endtxterm-"}}".length) );<br />
// On devrait remplacer {{TextTerm ...}} par la forme, soit de lstxtterm endtxtterm<br />
// On se fout de la sélection originale et la repositionne sur toute l'étendue du textterm.<br />
// alert("After null before textarea.selectionStart is" + textarea.selectionStart + " end=" + textarea.selectionEnd);<br />
// alert(" selection is:" + textarea.value.substring(textarea.selectionStart,textarea.selectionEnd));<br />
textarea.selectionStart = lstxtterm;<br />
textarea.selectionEnd = endtxterm;<br />
// alert("After null textarea.selectionStart is" + textarea.selectionStart + " end=" + textarea.selectionEnd);<br />
// alert(" selection is now:" + textarea.value.substring(textarea.selectionStart,textarea.selectionEnd));<br />
} //en endtxtterm<br />
} // end @}}... @{{TextTerm ... (...).. <br />
}else{ // coming from a previous or next<br />
// alert("After Next textarea.selectionStart is" + textarea.selectionStart + " end=" + textarea.selectionEnd);<br />
// alert(" After next selection is:" + textarea.value.substring(textarea.selectionStart,textarea.selectionEnd));<br />
// alert("Coming from a previous or next modifing selectionStart start is an offsetstart =" + offset + " and range=" + range)<br />
// Previous<br />
// selectionStart selectionEnd<br />
// > <<br />
// ^....@{{TextTerm....#}}.................@{{TextTerm ...}}!<br />
// !<-range-------->! <br />
// #<-offset--------->! <br />
// Next<br />
// selectionStart selectionEnd<br />
// > <<br />
// ^....@{{TextTerm....#}}.................@{{TextTerm ...}}!<br />
// !<--range------->! <br />
// #<-offset--------->! <br />
// alert(" Before textarea.selectionStart=" + textarea.selectionStart + " textarea.selectionEnd=" + textarea.selectionEnd);<br />
//alert(" Before is:" + textarea.value.substring(textarea.selectionStart,textarea.selectionEnd));<br />
textarea.selectionStart = (offset > 0 ? textarea.selectionEnd + offset : textarea.selectionStart + offset -range);<br />
textarea.selectionEnd = textarea.selectionStart + range;<br />
// Looking for the section<br />
section = '';<br />
var psectione = textarea.value.substring(0,textarea.selectionEnd). lastIndexOf("===") ; // Just before the string. No regex<br />
if(psectione != -1){<br />
var psections = textarea.value.substring(0,psectione). lastIndexOf("===") ; // Just before the string. No regex<br />
if(psections != -1){<br />
section = textarea.value.substring(psections,psectione+3).match(/^=== *?(\d{3}) *?===$/)[1];<br />
}<br />
}<br />
//console.log(" section Other |" + section);<br />
<br />
// alert(" After is:" + textarea.value.substring(textarea.selectionStart,textarea.selectionEnd));<br />
// alert(" After textarea.selectionStart=" + textarea.selectionStart + " textarea.selectionEnd=" + textarea.selectionEnd);<br />
//console.log("textterm cur is:" + textarea.value.substring(textarea.selectionStart+"{{TextTerm".length,textarea.selectionEnd-"}}".length));<br />
texttermcur = new texttermfill(textarea.value.substring(textarea.selectionStart+"{{TextTerm".length,textarea.selectionEnd-"}}".length) );<br />
}<br />
}else{<br />
alert("No selectionStart Internet Explorer < 9?");<br />
} <br />
// Looking for previous and next<br />
// Previous<br />
// ^....@{{TextTerm....#}}.................@{{TextTerm ...}}!<br />
// poffset<br />
// < prange ><<br />
// >< ><<br />
// pstart pend<br />
// !<--------offsetpstart------------>! <br />
// #<-offsetpsend---->! <br />
<br />
var pstart = textarea.value.substring(0,textarea.selectionStart). lastIndexOf("{{TextTerm"); <br />
if ( pstart == -1) { // No previous<br />
// alert( "NO previous : " + textarea.value.substring(0,textarea.selectionStart));<br />
poffset = null;<br />
prange = null;<br />
}else{<br />
// alert( "Previous pstart=" + pstart + " selectionStart=" + textarea.selectionStart + " pstart:selectionStart=" + textarea.value.substring(pstart,textarea.selectionStart));<br />
var pend = textarea.value.substring(pstart,textarea.selectionStart). search("}}") ; // Regex ?<br />
// alert( "Previous pstart=" + pstart + " pend= " + pend + " selectionStart=" + textarea.selectionStart + " pstart:selectionStart=" + textarea.value.substring(pstart,textarea.selectionStart));<br />
if ( pend == -1) { // Strange no ending<br />
stop( "NO ending }} in previous : " + textarea.value.substring(0,textarea.selectionStart));<br />
}else{<br />
prange = pend + 2; // }} included<br />
poffset = pstart + prange - textarea.selectionStart; // should be negative<br />
// alert( " prange =" + prange + " poffset=" + poffset);<br />
}<br />
}<br />
// Next<br />
// ^....@{{TextTerm....#}}.................@{{TextTerm ...}}!<br />
// !<--------offsetnend-------------->! <br />
// #<-offsetnstart--->! <br />
// noffset<br />
// >< nrange ><br />
// #<-offsetnstart--->! <br />
var nstart = textarea.value.substring(textarea.selectionEnd,textarea.length). search("{{TextTerm") <br />
if ( nstart == -1) { // No next<br />
// alert( "NO next TextTerm : " + textarea.value.substring(textarea.selectionEnd,textarea.length));<br />
noffset = null;<br />
nrange = null;<br />
}else{<br />
var nend = textarea.value.substring(textarea.selectionEnd + nstart,textarea.length). search("}}") ;<br />
if ( nend == -1) { // Strange no ending<br />
stop( "NO ending }} in previous : " + textarea.value.substring(textarea.selectionEnd,textarea.length)) ;<br />
}else{<br />
noffset = nstart ;<br />
nrange = nend +2 ;// }}<br />
}<br />
}<br />
<br />
<br />
// We do have offset or null, as well formfilled with a selection.<br />
<br />
oldFormHide();<br />
template = "TextTerm";<br />
var legend;<br />
if (template == "TextTerm") {<br />
legend = "TextTerm source";<br />
} else {<br />
legend = "Cite news source";<br />
}<br />
newtime = getTime();<br />
<br />
numforms++;<br />
form = '<div id="citediv'+numforms+'">'+<br />
'<fieldset><legend>'+legend+'</legend>'+<br />
'<table cellspacing="5">'+<br />
'<input type="hidden" value="'+template+'" id="template">'+<br />
'<tr><td><label for="term">&nbsp;*Term or expression: </label></td>'+<br />
'<td colspan="3"><input type="text" tabindex=1 style="width:100%" id="term" value= "' +<br />
texttermcur.term + '"></tr>'+<br />
'<tr><td width="100"><label for="note">&nbsp;*Note number (1, 2 etc .): </label></td>'+<br />
'<td width="40"><input type="text" tabindex=1 style="width:10%" id="note" value= "' +<br />
texttermcur.note + '"></td>'+<br />
'<td width="100"><label for="subnote">&nbsp;Subnote (2): </label></td>'+<br />
'<td width="40"><input type="text" tabindex=1 style="width:10%" id="subnote" value= "' +<br />
texttermcur.subnote + '"></td></tr>'+<br />
'<tr><td width="300"><label for="section">&nbsp;Section (102, 933 etc.): </label></td>'+<br />
'<td width="40"><input type="text" tabindex=1 style="width:10%" id="section" value= "' +<br />
texttermcur.section + '"></td>'+<br />
'<td width="120"><label for="indexentry">&nbsp;IndexEntry: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="indexentry" value= "' +<br />
texttermcur.indexentry + '"></td></tr>'+<br />
'<tr><td width="120"><label for="otherindexentry">&nbsp;OtherIndexEntry: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="otherindexentry" value= "' +<br />
texttermcur.otherindexentry + '"></td>'+<br />
'<td width="120"><label for="otherindexentrytwo">&nbsp;OtherIndexEntryTwo: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="otherindexentrytwo" value= "' +<br />
texttermcur.otherindexentrytwo + '"></td></tr>'+<br />
'<tr><td width="120"><label for="otherindexentrythree">&nbsp;OtherIndexEntryThree: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="otherindexentrythree" value= "' +<br />
texttermcur.otherindexentrythree + '"></td>'+<br />
'<td width="120"><label for="otherindexentryfour">&nbsp;OtherIndexEntryFour: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="otherindexentryfour" value= "' +<br />
texttermcur.otherindexentryfour + '"></td></tr>'+<br />
'<tr><td width="120"><label for="otherindexentryfive">&nbsp;OtherIndexEntryFive: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="otherindexentryfive" value= "' +<br />
texttermcur.otherindexentryfive + '"></td>'+<br />
'<td width="120"><label for="englishentry">&nbsp;EnglishEntry (for Chinese and Japanese): </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="englishentry" value= "' +<br />
texttermcur.englishentry + '"></td></tr>'+<br />
'</table>'+<br />
'<input type="button" id="previous" value="(save &) previous TextTerm" onClick="previoustextterm()">'+<br />
'<input type="button" value="(save &) exit" onClick="savetextterms()">'+<br />
'<input type="button" id="next" value="(save &) next TextTerm" onClick="nexttextterm()">'+<br />
'</fieldset></div>';<br />
document.getElementById('citeselect').innerHTML += form;<br />
}<br />
<br />
<br />
function citeNewsWeb(templatename) {<br />
oldFormHide();<br />
template = templatename;<br />
var legend;<br />
if (template == "cite web") {<br />
legend = "Cite web source";<br />
} else {<br />
legend = "Cite news source";<br />
}<br />
newtime = getTime();<br />
numforms++;<br />
form = '<div id="citediv'+numforms+'">'+<br />
'<fieldset><legend>'+legend+'</legend>'+<br />
'<table cellspacing="5">'+<br />
'<input type="hidden" value="'+template+'" id="template">'+<br />
'<tr><td width="120"><label for="url">&nbsp;URL: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="url"></td>'+<br />
'<td width="120"><label for="title">&nbsp;Title: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="title"></td></tr>'+<br />
'<tr><td width="120"><label for="last">&nbsp;Last name: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="last"></td>'+<br />
'<td width="120"><label for="first">&nbsp;First name: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="first"></td></tr>'+<br />
'<tr><td width="120"><label for="coauthors">&nbsp;Coauthors: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="coauthors"></td>'+<br />
'<td width="120"><label for="date">&nbsp;Publication date: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="date"></td></tr>'+<br />
'<tr><td width="120"><label for="work">&nbsp;Work: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="work"></td>'+<br />
'<td width="120"><label for="publisher">&nbsp;Publisher: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="publisher"></td></tr>'+<br />
'<tr><td width="120"><label for="pages">&nbsp;Pages: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="pages"></td>'+<br />
'<td width="120"><label for="language">&nbsp;Language: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="language"></td></tr>'+<br />
'<tr><td width="120"><label for="accessdate">&nbsp;Access date: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="accessdate" value="'+ newtime +'"></td>'+<br />
'<td width="120"><label for="location">&nbsp;Location: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="location"></td></tr>'+<br />
'<tr><td width="120"><label for="refname">&nbsp;Reference name: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="refname"></td></tr>'+<br />
'</table>'+<br />
'<input type="button" value="Add citation" onClick="addcites()">'+<br />
'</fieldset></div>';<br />
document.getElementById('citeselect').innerHTML += form;<br />
}<br />
<br />
function citeBook() {<br />
oldFormHide();<br />
template = "cite book";<br />
numforms++;<br />
form = '<div id="citediv'+numforms+'">'+<br />
'<fieldset><legend>Cite book source</legend>'+<br />
'<table cellspacing="5">'+<br />
'<input type="hidden" value="'+template+'" id="template">'+<br />
'<tr><td width="120"><label for="last">&nbsp;Last name: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="last"></td>'+<br />
'<td width="120"><label for="first">&nbsp;First name: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="first"></td></tr>'+<br />
'<tr><td width="120"><label for="coauthors">&nbsp;Coauthors: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="coauthors"></td>'+<br />
'<td width="120"><label for="others">&nbsp;Others: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="others"></td></tr>'+<br />
'<tr><td width="120"><label for="title">&nbsp;Title: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="title"></td>'+<br />
'<td width="120"><label for="editor">&nbsp;Editor: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="editor"></td></tr>'+<br />
'<tr><td width="120"><label for="publisher">&nbsp;Publisher: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="publisher"></td>'+<br />
'<td width="120"><label for="location">&nbsp;Location: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="location"></td></tr>'+<br />
'<tr><td width="120"><label for="date">&nbsp;Publication date: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="date"></td>'+<br />
'<td width="120"><label for="edition">&nbsp;Edition: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="edition"></td></tr>'+<br />
'<tr><td width="120"><label for="series">&nbsp;Series: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="series"></td>'+<br />
'<td width="120"><label for="volume">&nbsp;Volume: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="volume"></td></tr>'+<br />
'<tr><td width="120"><label for="pages">&nbsp;Pages: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="pages"></td>'+<br />
'<td width="120"><label for="chapter">&nbsp;Chapter: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="chapter"></td></tr>'+<br />
'<tr><td width="120"><label for="isbn">&nbsp;ISBN: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="isbn"></td>'+<br />
'<td width="120"><label for="oclc">&nbsp;OCLC: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="oclc"></td></tr>'+<br />
'<tr><td width="120"><label for="url">&nbsp;URL: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="url"></td>'+<br />
'<td width="120"><label for="accessdate">&nbsp;Access date: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="accessdate"></td></tr>'+<br />
'<tr><td width="120"><label for="language">&nbsp;Language: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="language"></td>'+<br />
'<td width="120"><label for="refname">&nbsp;Reference name: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="refname"></td></tr>'+<br />
'</table>'+<br />
'<input type="button" value="Add citation" onClick="addcites()">'+<br />
'</fieldset></div>';<br />
document.getElementById('citeselect').innerHTML += form;<br />
}<br />
<br />
function citeJournal() {<br />
oldFormHide();<br />
template = "cite journal";<br />
numforms++;<br />
form = '<div id="citediv'+numforms+'">'+<br />
'<fieldset><legend>Cite journal source</legend>'+<br />
'<table cellspacing="5">'+<br />
'<input type="hidden" value="'+template+'" id="template">'+<br />
'<tr><td width="120"><label for="last">&nbsp;Last name: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="last"></td>'+<br />
'<td width="120"><label for="first">&nbsp;First name: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="first"></td></tr>'+<br />
'<tr><td width="120"><label for="coauthors">&nbsp;Coauthors: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="coauthors"></td>'+<br />
'<td width="120"><label for="date">&nbsp;Publication date: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="date"></td></tr>'+<br />
'<tr><td width="120"><label for="title">&nbsp;Title: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="title"></td>'+<br />
'<td width="120"><label for="journal">&nbsp;Journal: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="journal"></td></tr>'+<br />
'<tr><td width="120"><label for="publisher">&nbsp;Publisher: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="publisher"></td>'+<br />
'<td width="120"><label for="location">&nbsp;Location: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="location"></td></tr>'+<br />
'<tr><td width="120"><label for="volume">&nbsp;Volume: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="volume"></td>'+<br />
'<td width="120"><label for="issue">&nbsp;Issue: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="issue"></td></tr>'+<br />
'<tr><td width="120"><label for="pages">&nbsp;Pages: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="pages"></td>'+<br />
'<td width="120"><label for="issn">&nbsp;ISSN: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="issn"></td></tr>'+<br />
'<tr><td width="120"><label for="oclc">&nbsp;OCLC: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="oclc"></td>'+<br />
'<td width="120"><label for="language">&nbsp;Language: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="language"></td></tr>'+<br />
'<tr><td width="120"><label for="url">&nbsp;URL: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="url"></td>'+<br />
'<td width="120"><label for="accessdate">&nbsp;Access date: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="accessdate"></td></tr>'+<br />
'<tr><td width="120"><label for="refname">&nbsp;Reference name: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="refname"></td></tr>'+<br />
'</table>'+<br />
'<input type="button" value="Add citation" onClick="addcites()">'+<br />
'</fieldset></div>';<br />
document.getElementById('citeselect').innerHTML += form;<br />
}<br />
<br />
function saveinput(terminput) {<br />
// terminput = document.getElementById('citediv'+numforms).getElementsByTagName('input');<br />
this.term = '';<br />
this.note= '';<br />
this.section = '';<br />
this.indexentry= '';<br />
this.otherindexentry = '';<br />
this.otherindexentrytwo = '';<br />
this.otherindexentrythree = '';<br />
this.otherindexentryfour = '';<br />
this.otherindexentryfive = '';<br />
this.englishentry = '';<br />
<br />
for (var i=0; i<terminput.length-1; i++) {<br />
if (terminput[i].id == "template" ){<br />
;<br />
}else if (terminput[i].id == "term" ){<br />
this.term = terminput[i].value;<br />
}else if(terminput[i].id == "note"){<br />
this.note = terminput[i].value;<br />
}else if(terminput[i].id == "section"){<br />
this.section = terminput[i].value;<br />
}else if(terminput[i].id == "subnote"){<br />
this.subnote = terminput[i].value;<br />
}else if(terminput[i].id == "indexentry"){<br />
this.indexentry = terminput[i].value;<br />
}else if(terminput[i].id == "otherindexentry"){<br />
this.otherindexentry = terminput[i].value;<br />
}else if(terminput[i].id == "otherindexentrytwo"){<br />
this.otherindexentrytwo = terminput[i].value;<br />
}else if(terminput[i].id == "otherindexentrythree"){<br />
this.otherindexentrythree = terminput[i].value;<br />
}else if(terminput[i].id == "otherindexentryfour"){<br />
this.otherindexentryfour = terminput[i].value;<br />
}else if(terminput[i].id == "otherindexentryfive"){<br />
this.otherindexentryfive = terminput[i].value;<br />
}else if(terminput[i].id == "englishentry"){<br />
this.englishentry = terminput[i].value;<br />
}else{<br />
;;//alert(" SaveInput terminput[i].id = " + terminput[i].id + " terminput[i].value =" + terminput[i].value);<br />
}<br />
<br />
}<br />
}<br />
<br />
function savetextterms(template) {<br />
var txtterminput = document.getElementById('citediv'+numforms).getElementsByTagName('input');<br />
textterminput = new saveinput(txtterminput);<br />
//alert("texttermcur=" + texttermcur);<br />
//alert("textterminput=" + textterminput);<br />
// Testing<br />
var different = false;<br />
if((textterminput.term != texttermcur.term) || (textterminput.note != texttermcur.note) ||<br />
(textterminput.section != texttermcur.section) ||<br />
(textterminput.subnote != texttermcur.subnote) ||<br />
(textterminput.indexentry != texttermcur.indexentry) ||<br />
(textterminput.otherindexentry != texttermcur.otherindexentry) || <br />
(textterminput.otherindexentrytwo != texttermcur.otherindexentrytwo) ||<br />
(textterminput.otherindexentrythree != texttermcur.otherindexentrythree) ||<br />
(textterminput.otherindexentryfour != texttermcur.otherindexentryfour) ||<br />
(textterminput.otherindexentryfive != texttermcur.otherindexentryfive) ||<br />
(textterminput.englishentry != texttermcur.englishentry) )<br />
different = true;<br />
<br />
if (different){<br />
// alert(" They are different, have to save" );<br />
var texttermchain="{{TextTerm";<br />
texttermchain += '|' + (textterminput.term ? textterminput.term : '');<br />
texttermchain += '|' + (textterminput.note ? textterminput.note : '');<br />
texttermchain += (textterminput.section ? '|' + textterminput.section : '');<br />
texttermchain += (textterminput.subnote ? '|' + textterminput.subnote : '');<br />
texttermchain += (textterminput.indexentry ? '|IndexEntry='+ textterminput.indexentry : '');<br />
texttermchain += (textterminput.otherindexentry ? '|OtherIndexEntry='+ textterminput.otherindexentry : '');<br />
texttermchain += (textterminput.otherindexentrytwo ? '|OtherIndexEntryTwo='+ textterminput.otherindexentrytwo : '');<br />
texttermchain += (textterminput.otherindexentrythree ? '|OtherIndexEntryThree='+ textterminput.otherindexentrythree : '');<br />
texttermchain += (textterminput.otherindexentryfour ? '|OtherIndexEntryFour='+ textterminput.otherindexentryfour : '');<br />
texttermchain += (textterminput.otherindexentryfive ? '|OtherIndexEntryFive='+ textterminput.otherindexentryfive : '');<br />
texttermchain += (textterminput.englishentry ? '|EnglishEntry='+ textterminput.englishentry : '');<br />
texttermchain += "}}";<br />
<br />
var textarea= document.getElementById('wpTextbox1');<br />
var savepos= textarea.selectionStart;<br />
if ('selectionStart' in textarea) {<br />
textarea.value=textarea.value.substring(0,textarea.selectionStart) + texttermchain + textarea.value.substring(textarea.selectionEnd, textarea.length); <br />
//insertTags(texttermchain, '', '');<br />
textarea.selectionStart = savepos;<br />
textarea.selectionEnd = savepos + texttermchain.length;<br />
}<br />
else{<br />
alert("No selectionStart firefox");<br />
}<br />
}<br />
else{<br />
;//alert(" They are similar, don't save" );<br />
}<br />
document.getElementById('citediv'+numforms).style.display = 'none';<br />
<br />
}<br />
<br />
function addcites(template) {<br />
cites = document.getElementById('citediv'+numforms).getElementsByTagName('input');<br />
var citebegin = '<ref';<br />
var citename = '';<br />
var citeinner = '';<br />
for (var i=0; i<cites.length-1; i++) {<br />
if (cites[i].value != '' && cites[i].id != "refname" && cites[i].id != "template") {<br />
citeinner += "|" + cites[i].id + "=" + cites[i].value;<br />
}<br />
else if (cites[i].value != '' && cites[i].id == "refname" && cites[i].id != "template") {<br />
citebegin += ' name="' + cites[i].value + '"';<br />
}<br />
else if (cites[i].value != '' && cites[i].id != "refname" && cites[i].id == "template") {<br />
citename = '>{{' + cites[i].value;<br />
}<br />
}<br />
cite = citebegin + citename + citeinner + "}}</ref>";<br />
$("#wpTextbox1").focus();<br />
insertTags(cite, '', '');<br />
document.getElementById('citediv'+numforms).style.display = 'none';<br />
}<br />
<br />
function getNamedRefs(calls) {<br />
if (typeof(wikEdUseWikEd) != 'undefined') {<br />
if (wikEdUseWikEd == true) {<br />
WikEdUpdateTextarea();<br />
}<br />
}<br />
text = document.getElementById('wpTextbox1').value;<br />
var regex;<br />
if (calls) {<br />
regex = /< *?ref +?name *?= *?(('([^']*?)')|("([^"]*?)")|([^'"\s]*?[^\/]\b)) *?\/ *?>/gi //'<br />
} else {<br />
regex = /< *?ref +?name *?= *?(('([^']*?)')|("([^"]*?)")|([^'"\s]*?[^\/]\b)) *?>/gi //'<br />
}<br />
var namedrefs = [];<br />
var i=0;<br />
var nr=true;<br />
do {<br />
ref = regex.exec(text);<br />
if(ref != null){<br />
if (ref[5]) {<br />
namedrefs[i] = ref[5];<br />
} else if (ref[3]) {<br />
namedrefs[i] = ref[3];<br />
} else {<br />
namedrefs[i] = ref[6];<br />
}<br />
i++;<br />
} else {<br />
nr=false;<br />
}<br />
} while (nr==true);<br />
return namedrefs;<br />
}<br />
<br />
function citeNamedRef() {<br />
namedrefs = getNamedRefs(false);<br />
if (namedrefs == '') {<br />
oldFormHide();<br />
numforms++;<br />
out = '<div id="citediv'+numforms+'"><fieldset>'+<br />
'<legend>References in text</legend>There are no named refs (<tt>&lt;ref name="Name"&gt;</tt>) in the text</fieldset></div>';<br />
document.getElementById('citeselect').innerHTML += out;<br />
}<br />
else {<br />
oldFormHide();<br />
numforms++;<br />
form = '<div id="citediv'+numforms+'">'+<br />
'<fieldset><legend>References in article</legend>'+<br />
'<table cellspacing="5">'+<br />
'<tr><td><label for="namedrefs">&nbsp;Named references in text</label></td>'+<br />
'<td><select name="namedrefs" id="namedrefs">';<br />
for (var i=0;i<namedrefs.length;i++) {<br />
form+= '<option value="'+namedrefs[i]+'">'+namedrefs[i]+'</option>';<br />
}<br />
form+= '</select>'+<br />
'</td></tr></table>'+<br />
'<input type="button" value="Add citation" onClick="addnamedcite()">'+<br />
'</fieldset></div>';<br />
document.getElementById('citeselect').innerHTML += form;<br />
}<br />
}<br />
<br />
function addnamedcite() {<br />
name = document.getElementById('citediv'+numforms).getElementsByTagName('select')[0].value;<br />
ref = '<ref name="'+name+'" />';<br />
$("#wpTextbox1").focus();<br />
insertTags(ref, '', '');<br />
document.getElementById('citediv'+numforms).style.display = 'none';<br />
}<br />
<br />
function getAllRefs() {<br />
if (typeof(wikEdUseWikEd) != 'undefined') {<br />
if (wikEdUseWikEd == true) {<br />
WikEdUpdateTextarea();<br />
}<br />
}<br />
text = document.getElementById('wpTextbox1').value;<br />
regex = /< *?ref( +?name *?= *?(('([^']*?)')|("([^"]*?)")|([^'"\s]*?[^\/]\b)))? *?>((.|\n)*?)< *?\/? *?ref *?>/gim //"<br />
var allrefs = [];<br />
var i=0;<br />
var nr=true;<br />
do {<br />
ref = regex.exec(text);<br />
if(ref != null){<br />
if (ref[0].search(/[^\s]{150}/) != -1) {<br />
ref[0] = ref[0].replace(/\|([^\s])/g, "| $1");<br />
}<br />
ref[0] = ref[0].replace(/</g, "&lt;");<br />
ref[0] = ref[0].replace(/>/g, "&gt;");<br />
allrefs[i] = ref[0];<br />
i++;<br />
} else {<br />
nr=false;<br />
}<br />
} while (nr==true);<br />
return allrefs;<br />
}<br />
<br />
function NRcallError(namedrefs, refname) {<br />
for (var i=0; i<namedrefs.length; i++) {<br />
if (namedrefs[i] == refname) {<br />
return true;<br />
}<br />
}<br />
return false;<br />
}<br />
<br />
function errorCheck() {<br />
var allrefs = getAllRefs();<br />
var allrefscontent = [];<br />
var samecontentexclude = [];<br />
var sx=0;<br />
var templateexclude = [];<br />
var tx=0;<br />
var skipcheck = false;<br />
var namedrefcalls = getNamedRefs(true);<br />
for (var i=0; i<allrefs.length; i++) {<br />
allrefscontent[i] = allrefs[i].replace(/&lt; *?ref( +?name *?= *?(('([^']*?)')|("([^"]*?)")|([^'"\s]*?[^\/]\b)))? *?&gt;((.|\n)*?)&lt; *?\/? *?ref *?&gt;/gim, "$8"); //"<br />
}<br />
var namedrefs = getNamedRefs(false);<br />
var errorlist = [];<br />
var q=0;<br />
unclosed = document.getElementById('unclosed').checked;<br />
samecontent = document.getElementById('samecontent').checked;<br />
templates = document.getElementById('templates').checked;<br />
repeated = document.getElementById('repeated').checked;<br />
undef = document.getElementById('undef').checked;<br />
for (var i=0; i<allrefs.length; i++) {<br />
if (allrefs[i].search(/&lt; *?\/ *?ref *?&gt;/) == -1 && unclosed) {<br />
errorlist[q] = '<tr><td width="75%"><tt>'+allrefs[i]+'</tt></td>';<br />
errorlist[q] += '<td width="25%">Unclosed <tt>&lt;ref&gt;</tt> tag</td></tr>';<br />
q++;<br />
}<br />
if (samecontent) {<br />
for (var d=0; d<samecontentexclude.length; d++) {<br />
if (allrefscontent[i] == samecontentexclude[d]) {<br />
skipcheck = true;<br />
}<br />
}<br />
var p=0;<br />
while (p<allrefs.length && !skipcheck) {<br />
if (allrefscontent[i] == allrefscontent[p] && i != p) {<br />
errorlist[q] = '<tr><td width="75%"><tt>'+allrefscontent[i]+'</tt></td>';<br />
errorlist[q] += '<td width="25%">Multiple refs contain this content, a <a href="//en.wikipedia.org/wiki/Wikipedia:Footnotes#Naming_a_ref_tag_so_it_can_be_used_more_than_once">named reference</a> should be used instead</td></tr>';<br />
q++;<br />
samecontentexclude[sx] = allrefscontent[i]<br />
sx++;<br />
break;<br />
}<br />
p++;<br />
}<br />
skipcheck=false;<br />
}<br />
if (templates) {<br />
if (allrefscontent[i].search(/\{\{cite/i) == -1 && allrefscontent[i].search(/\{\{citation/i) == -1 && allrefscontent[i].search(/\{\{Comic (book|strip) reference/i) == -1 && allrefscontent[i].search(/\{\{Editorial cartoon reference/i) == -1 && allrefscontent[i].search(/\{\{harv/i) == -1) {<br />
for (var x=0; x<templateexclude.length; x++) {<br />
if (allrefscontent[i] == templateexclude[x]) {<br />
skipcheck = true;<br />
}<br />
}<br />
if (!skipcheck) {<br />
errorlist[q] = '<tr><td width="75%"><tt>'+allrefs[i]+'</tt></td>';<br />
errorlist[q] += '<td width="25%">Does not use a <a href="//en.wikipedia.org/wiki/Wikipedia:Citation_templates">citation template</a></td></tr>';<br />
q++;<br />
templateexclude[tx] = allrefscontent[i];<br />
tx++;<br />
}<br />
skipcheck = false;<br />
}<br />
}<br />
}<br />
if (repeated) {<br />
var repeatnameexclude = [];<br />
var rx=0;<br />
for (var k=0; k<namedrefs.length; k++) {<br />
for (var d=0; d<repeatnameexclude.length; d++) {<br />
if (namedrefs[k] == repeatnameexclude[d]) {<br />
skipcheck = true;<br />
}<br />
}<br />
var z=0;<br />
while (z<namedrefs.length && !skipcheck) {<br />
if (namedrefs[k] == namedrefs[z] && k != z) {<br />
errorlist[q] = '<tr><td width="75%"><tt>'+namedrefs[k]+'</tt></td>';<br />
errorlist[q] += '<td width="25%">Multiple references are given the same <a href="//en.wikipedia.org/wiki/Wikipedia:Footnotes#Naming_a_ref_tag_so_it_can_be_used_more_than_once">name</a></td></tr>';<br />
q++;<br />
repeatnameexclude[rx] = namedrefs[z];<br />
rx++;<br />
break;<br />
}<br />
z++;<br />
}<br />
skipcheck = false;<br />
}<br />
}<br />
if (undef) {<br />
var undefexclude = [];<br />
var ux=0;<br />
for (var p=0; p<namedrefcalls.length; p++) {<br />
for (var d=0; d<undefexclude.length; d++) {<br />
if (allrefscontent[i] == undefexclude[d]) {<br />
skipcheck = true;<br />
}<br />
}<br />
if (!skipcheck) {<br />
if (!NRcallError(namedrefs, namedrefcalls[p])) {<br />
errorlist[q] = '<tr><td width="75%"><tt>'+namedrefcalls[p]+'</tt></td>';<br />
errorlist[q] += '<td width="25%">A <a href="//en.wikipedia.org/wiki/Wikipedia:Footnotes#Naming_a_ref_tag_so_it_can_be_used_more_than_once">named reference</a> is used but not defined</td></tr>';<br />
q++;<br />
undefexclude[ux] = namedrefs[p];<br />
ux++;<br />
}<br />
}<br />
skipcheck = false;<br />
}<br />
}<br />
if (q > 0) {<br />
return errorlist;<br />
} else {<br />
return 0;<br />
}<br />
}<br />
<br />
function dispErrors() {<br />
oldFormHide();<br />
form = '<div id="errorform"><fieldset>'+<br />
'<legend>Error checking</legend>'+<br />
'<b>Check for:</b><br/>'+<br />
'<input type="checkbox" id="unclosed" /> Unclosed <tt>&lt;ref&gt;</tt> tags<br/>'+<br />
'<input type="checkbox" id="samecontent" /> References with the same content<br/>'+<br />
'<input type="checkbox" id="templates" /> References not using a <a href="//en.wikipedia.org/wiki/Wikipedia:Citation_templates">citation template</a><br/>'+<br />
'<input type="checkbox" id="repeated" /> Multiple references with the same name<br/>'+<br />
'<input type="checkbox" id="undef" /> Usage of undefined named references<br/>'+<br />
'<input type="button" id="errorchecksubmit" value="Check for selected errors" onclick="doErrorCheck()"/>'+<br />
'</fieldset></div>';<br />
document.getElementById('citeselect').innerHTML += form;<br />
}<br />
<br />
function doErrorCheck() {<br />
var errors = errorCheck();<br />
document.getElementById('citeselect').removeChild(document.getElementById('errorform'));<br />
if (errors == 0) {<br />
if (numforms != 0) {<br />
document.getElementById('citediv'+numforms).style.display = 'none';<br />
}<br />
numforms++;<br />
out = '<div id="citediv'+numforms+'"><fieldset>'+<br />
'<legend>Error checking</legend>No errors found.</fieldset></div>';<br />
document.getElementById('citeselect').innerHTML += out;<br />
}<br />
else {<br />
if (numforms != 0) {<br />
document.getElementById('citediv'+numforms).style.display = 'none';<br />
}<br />
numforms++;<br />
form = '<div id="citediv'+numforms+'">'+<br />
'<fieldset><legend>Error checking</legend>'+<br />
'<table border="1px">';<br />
for (var i=0; i<errors.length; i++) {<br />
form+=errors[i];<br />
}<br />
form+= '</table>'+<br />
'</fieldset></div>';<br />
document.getElementById('citeselect').innerHTML += form;<br />
}<br />
}<br />
<br />
$( refbuttons );</div>
Nicolas Brouard
http://fr-i.demopaedia.org/w/index.php?title=MediaWiki:Gadget-refToolbar.js&diff=11672
MediaWiki:Gadget-refToolbar.js
2017-06-25T18:13:10Z
<p>Nicolas Brouard : 1 révision importée</p>
<hr />
<div>/**<br />
* RefToolbar<br />
*<br />
* Adds tools for citing references to the edit toolbar.<br />
* See [[Wikipedia:RefToolbar]] for further documentation. One of<br />
* three possible versions will load (Reftoolbar 2.0b, Reftoolbar 2.0a,<br />
* or Reftoolbar 1.0) depending on the user preferences (the<br />
* usebetatoolbar and usebetatoolbar-cgd parameters).<br />
*<br />
* @see: [[Wikipedia:RefToolbar]]<br />
* @see: [[MediaWiki:RefToolbar.js]]<br />
* @see: [[MediaWiki:RefToolbarConfig.js]]<br />
* @see: [[MediaWiki:RefToolbarLegacy.js]]<br />
* @see: [[MediaWiki:RefToolbarMessages-en.js]]<br />
* @see: [[MediaWiki:RefToolbarMessages-de.js]]<br />
* @see: [[MediaWiki:RefToolbarNoDialogs.js]]<br />
* @see: [[MediaWiki:Gadget-refToolbarBase.js]]<br />
* @author: [[User:Mr.Z-man]]<br />
* @author: [[User:Kaldari]]<br />
*/<br />
/*jshint browser: true, camelcase: true, curly: true, eqeqeq: true */<br />
/*global jQuery, mediaWiki, importScript */<br />
( function ( mw, $ ) {<br />
'use strict';<br />
function initializeRefTools() {<br />
if ( window.refToolbarInstalled || $( '#wpTextbox1[readonly]' ).length ){<br />
return;<br />
}<br />
// using weak comparison because ("0") is true, but ("0" == true) is false <br />
if ( mw.user.options.get( 'usebetatoolbar' ) == true ) {<br />
// Enhanced editing toolbar is on. Going to load RefToolbar 2.0a or 2.0b.<br />
if ( mw.user.options.get( 'usebetatoolbar-cgd' ) == true ) {<br />
// Dialogs are on. Loading 2.0b. (standard)<br />
// TODO:<br />
// * Explicitly declare global variables from [[MediaWiki:RefToolbar.js]] using window.*<br />
// * Move [[MediaWiki:RefToolbar.js]] to [[MediaWiki:Gadget-refToolbarDialogs.js]]<br />
// * Create the module 'ext.gadget.refToolbarDialogs' depending on 'ext.gadget.refToolbarBase' and 'ext.wikiEditor.toolbar'<br />
// * Replace the code below by mw.loader.load( 'ext.gadget.refToolbarDialogs' );<br />
mw.loader.using( [ 'ext.gadget.refToolbarBase', 'ext.wikiEditor.toolbar' ], function () {<br />
importScript( 'MediaWiki:RefToolbar.js' );<br />
} );<br />
} else {<br />
// Dialogs are off. Loading 2.0a.<br />
mw.loader.using( 'ext.wikiEditor.toolbar', function () {<br />
importScript( 'MediaWiki:RefToolbarNoDialogsTextTerm.js' );<br />
} );<br />
}<br />
} else if ( mw.user.options.get( 'showtoolbar' ) ) {<br />
// Enhanced editing toolbar is off. Loading RefToolbar 1.0. (legacy)<br />
importScript( 'MediaWiki:RefToolbarLegacy.js' );<br />
} else {<br />
return;<br />
}<br />
window.refToolbarInstalled = true;<br />
}<br />
<br />
if ( $.inArray( mw.config.get( 'wgAction' ), [ 'edit', 'submit' ] ) !== -1 ) {<br />
// Double check if user.options is loaded, to prevent errors when copy pasted accross installations<br />
$.when( mw.loader.using( ['user.options'] ), $.ready ).done( initializeRefTools );<br />
}<br />
<br />
}( mediaWiki, jQuery ) );</div>
Nicolas Brouard
http://fr-i.demopaedia.org/w/index.php?title=MediaWiki:Gadget-refToolbar&diff=11674
MediaWiki:Gadget-refToolbar
2017-06-25T18:13:10Z
<p>Nicolas Brouard : 1 révision importée</p>
<hr />
<div>[[:en:Wikipedia:RefToolbar|refTools]], adds a "cite" button to the editing toolbar for quick and easy addition of commonly used citation templates. It also adds a TextTerm icon</div>
Nicolas Brouard
http://fr-i.demopaedia.org/w/index.php?title=MediaWiki:RefToolbarConfig.js&diff=11676
MediaWiki:RefToolbarConfig.js
2017-06-25T18:13:10Z
<p>Nicolas Brouard : 1 révision importée</p>
<hr />
<div>/* Sitewide options for the the Cite toolbar button:<br />
* All options should be specified<br />
*<br />
* "date format" sets the date format used for the function to insert the current date<br />
* Current available options:<br />
* date - the day of the month<br />
* zdate - day of the month, zero padded to 2 digits<br />
* monthname - The month name<br />
* month - The numberic month (1-12)<br />
* zmonth - numeric month, zero padded to 2 digits<br />
* year - The full year (4 digits)<br />
*<br />
* "autodate fields" is a list of template fields that should have a button to insert the current date<br />
* <br />
* "months" is a list of localized month names<br />
*<br />
* "modal" - if true, the dialogs will be modal windows, blocking access to the rest of the window.<br />
* See http://en.wikipedia.org/wiki/Modal_window<br />
* All dialogs in the toolbar are modal by default<br />
*<br />
* "autoparse" - if true, previewing a ref will automatically trigger a preview of the parsed wikitext.<br />
* It is not recommended to set this to true as a global setting as it may slow the script down for<br />
* people with slow connections.<br />
*<br />
* "expandtemplates" - if true, templates and parser functions will be expanded when getting page text<br />
* (templates inside of ref tags will not be expanded). This will allow references inside of templates or<br />
* references using {{#tag:ref}} to be listed in the named refs dialog and searched by error checks.<br />
* This may slow loading the named refs and error check dialogs.<br />
*/<br />
<br />
CiteTB.Options = {<br />
"date format" : "<date> <monthname> <year>",<br />
"autodate fields" : ['accessdate'],<br />
"months" : ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],<br />
"modal" : true,<br />
"autoparse" : true,<br />
"expandtemplates" : false<br />
};<br />
<br />
// Cite template definitions<br />
new citeTemplate('cite web', 'web',<br />
[ // Basic fields<br />
{"field": "last<N>", "autofillprop":"last-incr", 'increment_group':'author'},<br />
{"field": "first<N>", "autofillprop":"first-incr", 'increment_group':'author', 'increment_button':true}, <br />
{"field": "title", "autofillprop":"title"},<br />
{"field": "url", "autofillid":"url"},<br />
{"field": "website", "autofillprop":"journal"},<br />
{"field": "publisher", "autofillprop":"publisher"},<br />
{"field": "accessdate"},<br />
{"field": "ref", "tooltip":"cite-ref-tooltip"}<br />
],<br />
[ // Expanded fields<br />
{"field": "author<N>", 'increment_group':'author_alt', 'increment_button':true},<br />
{"field": "authorlink<N>", "tooltip":"cite-authorlink-tooltip", 'increment_group':'authorlink', 'increment_button':true},<br />
{"field": "archiveurl"},<br />
{"field": "archivedate"},<br />
{"field": "location"},<br />
{"field": "page", "tooltip":"cite-page-tooltip"},<br />
{"field": "pages", "autofillprop":"pages", "tooltip":"cite-pages-tooltip"},<br />
{"field": "language", "autofillprop":"language"},<br />
{"field": "format"},<br />
{"field": "doi", "autofillid":"doi", "autofillprop":"doi"},<br />
{"field": "date", "autofillprop":"date"},<br />
{"field": "quote"}<br />
]);<br />
<br />
new citeTemplate('cite news', 'news',<br />
[ // Basic fields<br />
{"field": "last<N>", "autofillprop":"last-incr", 'increment_group':'author'},<br />
{"field": "first<N>", "autofillprop":"first-incr", 'increment_group':'author', 'increment_button':true}, <br />
{"field": "title", "autofillprop":"title"},<br />
{"field": "url", "autofillid":"url"},<br />
{"field": "accessdate"},<br />
{"field": "work", "tooltip":"cite-work-tooltip", "autofillprop":"journal"},<br />
{"field": "agency"},<br />
{"field": "issue"},<br />
{"field": "publisher", "autofillprop":"publisher"},<br />
{"field": "date", "autofillprop":"date"},<br />
{"field": "ref", "tooltip":"cite-ref-tooltip"}<br />
],<br />
[ // Expanded fields<br />
{"field": "author<N>", 'increment_group':'author_alt', 'increment_button':true},<br />
{"field": "authorlink<N>", "tooltip":"cite-authorlink-tooltip", 'increment_group':'authorlink', 'increment_button':true},<br />
{"field": "archiveurl"},<br />
{"field": "archivedate"},<br />
{"field": "location"},<br />
{"field": "page", "tooltip":"cite-page-tooltip"},<br />
{"field": "pages", "autofillprop":"pages", "tooltip":"cite-pages-tooltip"},<br />
{"field": "language", "autofillprop":"language"},<br />
{"field": "format"},<br />
{"field": "doi", "autofillid":"doi", "autofillprop":"doi"},<br />
{"field": "quote"}<br />
]);<br />
<br />
new citeTemplate('cite book', 'book',<br />
[ // Basic fields<br />
{"field": "last<N>", "autofillprop":"last-incr", 'increment_group':'author'},<br />
{"field": "first<N>", "autofillprop":"first-incr", 'increment_group':'author', 'increment_button':true}, <br />
{"field": "title", "autofillprop":"title"},<br />
{"field": "date", "autofillprop":"year"},<br />
{"field": "publisher", "autofillprop":"publisher"},<br />
{"field": "location", "autofillprop":"location"},<br />
{"field": "isbn", "autofillid":"isbn", "autofillprop":"isbn"},<br />
{"field": "page", "tooltip":"cite-page-tooltip"},<br />
{"field": "pages", "autofillprop":"pages", "tooltip":"cite-pages-tooltip"},<br />
{"field": "edition", "autofillprop":"edition"},<br />
{"field": "url", "autofillid":"url"},<br />
{"field": "accessdate"},<br />
{"field": "ref", "tooltip":"cite-ref-tooltip"}<br />
<br />
],<br />
[ // Expanded fields<br />
{"field": "author<N>", 'increment_group':'author_alt', 'increment_button':true},<br />
{"field": "authorlink<N>", "tooltip":"cite-authorlink-tooltip", 'increment_group':'authorlink', 'increment_button':true},<br />
{"field": "editor<N>-last", "increment_group":"editor"},<br />
{"field": "editor<N>-first", "increment_group":"editor", "increment_button":true},<br />
{"field": "editor<N>-link", 'increment_group':'editorlink', 'increment_button':true},<br />
{"field": "archiveurl"},<br />
{"field": "archivedate"},<br />
{"field": "language", "autofillprop":"language"},<br />
{"field": "format"},<br />
{"field": "chapter", "autofillprop":"chapter"},<br />
{"field": "quote"}<br />
]);<br />
<br />
new citeTemplate('cite journal', 'journal',<br />
[ // Basic fields<br />
{"field": "last<N>", "autofillprop":"last-incr", 'increment_group':'author'},<br />
{"field": "first<N>", "autofillprop":"first-incr", 'increment_group':'author', 'increment_button':true}, <br />
{"field": "title", "autofillprop":"title"},<br />
{"field": "journal", "autofillprop":"journal"},<br />
{"field": "date", "autofillprop":"date"},<br />
{"field": "volume", "autofillprop":"volume"},<br />
{"field": "issue", "autofillprop":"issue"},<br />
{"field": "page", "tooltip":"cite-page-tooltip"},<br />
{"field": "pages", "autofillprop":"pages", "tooltip":"cite-pages-tooltip"},<br />
{"field": "doi", "autofillid":"doi", "autofillprop":"doi"},<br />
{"field": "pmid", "autofillid":"pmid"},<br />
{"field": "url", "autofillid":"url"},<br />
{"field": "accessdate"},<br />
{"field": "ref", "tooltip":"cite-ref-tooltip"},<br />
],<br />
[ // Expanded fields<br />
{"field": "author<N>", 'increment_group':'author_alt', 'increment_button':true},<br />
{"field": "authorlink<N>", "tooltip":"cite-authorlink-tooltip", 'increment_group':'authorlink', 'increment_button':true},<br />
{"field": "editor<N>-last", "increment_group":"editor"},<br />
{"field": "editor<N>-first", "increment_group":"editor", "increment_button":true},<br />
{"field": "editor<N>-link", 'increment_group':'editorlink', 'increment_button':true},<br />
{"field": "series"},<br />
{"field": "at", "tooltip":"cite-at-tooltip"},<br />
{"field": "trans-title"},<br />
{"field": "publisher", "autofillprop":"publisher"},<br />
{"field": "location"},<br />
{"field": "language", "autofillprop":"language"},<br />
{"field": "format"},<br />
{"field": "issn", "autofillprop":"issn"},<br />
{"field": "pmc"},<br />
{"field": "oclc"},<br />
{"field": "bibcode"},<br />
{"field": "id"},<br />
{"field": "quote"},<br />
{"field": "postscript", "tooltip":"cite-postscript-tooltip"}<br />
]);<br />
<br />
new citeErrorCheck({'type':'reflist', 'testname':'samecontent', 'desc': 'cite-samecontent-desc',<br />
'func': function(reflist) {<br />
var errors = [];<br />
var refs2 = [];<br />
for(var i=0; i<reflist.length; i++) {<br />
if (!reflist[i].shorttag) {<br />
if ($.inArray(reflist[i].content, refs2) != -1) {<br />
if ($.inArray(reflist[i].content, errors) == -1) {<br />
errors.push(reflist[i].content);<br />
}<br />
} else {<br />
refs2.push(reflist[i].content);<br />
}<br />
}<br />
}<br />
ret = [];<br />
for(var j=0; j<errors.length; j++) {<br />
ret.push({'msg':'cite-samecontent-error', 'err':errors[j]});<br />
}<br />
return ret;<br />
}}<br />
);<br />
<br />
new citeErrorCheck({'type':'reflist', 'testname':'repeated', 'desc':'cite-repeated-desc',<br />
'func': function(reflist) {<br />
var errors = [];<br />
var refs2 = [];<br />
for(var i=0; i<reflist.length; i++) {<br />
if (!reflist[i].shorttag && reflist[i].refname) {<br />
if ($.inArray(reflist[i].refname, refs2) != -1) {<br />
if ($.inArray(reflist[i].refname, errors) == -1) {<br />
errors.push(reflist[i].refname);<br />
}<br />
} else {<br />
refs2.push(reflist[i].refname);<br />
}<br />
}<br />
}<br />
ret = [];<br />
for(var j=0; j<errors.length; j++) {<br />
ret.push({'msg':'cite-repeated-error', 'err':errors[j]});<br />
}<br />
return ret;<br />
}}<br />
);<br />
<br />
new citeErrorCheck({'type':'reflist', 'testname':'undefined', 'desc':'cite-undefined-desc',<br />
'func': function(reflist) {<br />
var errors = [];<br />
var longrefs = [];<br />
for(var i=0; i<reflist.length; i++) {<br />
if (!reflist[i].shorttag && reflist[i].refname) {<br />
longrefs.push(reflist[i].refname);<br />
}<br />
}<br />
for(var j=0; i<reflist.length; j++) {<br />
if (reflist[i].shorttag && $.inArray(reflist[i].refname, errors) == -1 && $.inArray(reflist[i].refname, longrefs) == -1) {<br />
errors.push(reflist[i].refname);<br />
}<br />
}<br />
ret = [];<br />
for(var j=0; j<errors.length; j++) {<br />
ret.push({'msg':'cite-undefined-error', 'err':errors[j]});<br />
}<br />
return ret;<br />
}}<br />
);<br />
<br />
CiteTB.init();</div>
Nicolas Brouard
http://fr-i.demopaedia.org/w/index.php?title=MediaWiki:Gadgets-definition&diff=11678
MediaWiki:Gadgets-definition
2017-06-25T18:13:10Z
<p>Nicolas Brouard : 1 révision importée</p>
<hr />
<div>#Editing<br />
* wikEd[ResourceLoader]|wikEd.js<br />
* refToolbar[ResourceLoader|dependencies=user.options,mediawiki.legacy.wikibits]|refToolbar.js<br />
* refToolbarBase[ResourceLoader|hidden]|refToolbarBase.js<br />
* DotsSyntaxHighlighter[ResourceLoader|default|dependencies=jquery.client]|DotsSyntaxHighlighter.js<br />
<br />
#Interface<br />
* exlinks[ResourceLoader]|exlinks.js<br />
* purgeTab[ResourceLoader]|purgeTab.js<br />
* citations[ResourceLoader]|citations.js</div>
Nicolas Brouard
http://fr-i.demopaedia.org/w/index.php?title=MediaWiki:Common.js&diff=11680
MediaWiki:Common.js
2017-06-25T18:13:10Z
<p>Nicolas Brouard : 1 révision importée</p>
<hr />
<div>/* Zde uvedený JavaScript bude použit pro všechny uživatele při načtení každé stránky. */<br />
/* N'importe quel JavaScript ici sera chargé pour n'importe quel utilisateur et pour chaque page accédée.<br />
<br />
ATTENTION : Avant de modifier cette page, veuillez tester vos changements avec votre propre<br />
monobook.js. Une erreur sur cette page peut faire bugger le site entier (et gêner l'ensemble des<br />
visiteurs), même plusieurs heures après la modification !<br />
<br />
NE PAS RETIRER CECI SINON : remplacement des signature, substitution des modèles, ... : <nowiki><br />
<br />
/*************************************************************/<br />
/* Fonctions javascript : pallient les limites de javascript */<br />
/* Surveiller : http://www.ecmascript.org/ */<br />
/*************************************************************/<br />
<br />
/* Test if an element has a certain class **************************************<br />
*<br />
* Description: Uses regular expressions and caching for better performance.<br />
* Maintainers: [[User:Mike Dillon]], [[User:R. Koot]], [[User:SG]]<br />
*/<br />
<br />
var hasClass = (function () {<br />
var reCache = {};<br />
return function (element, className) {<br />
return (reCache[className] ? reCache[className] : (reCache[className] = new RegExp("(?:\\s|^)" + className + "(?:\\s|$)"))).test(element.className);<br />
};<br />
})();<br />
<br />
<br />
<br />
<br />
/** Collapsible tables *********************************************************<br />
* From http://en.wikipedia.org/w/index.php?title=MediaWiki:Common.js&oldid=219789618<br />
* Description: Allows tables to be collapsed, showing only the header. See<br />
* [[Wikipedia:NavFrame]].<br />
* Maintainers: [[User:R. Koot]]<br />
*/<br />
<br />
var autoCollapse = 2;<br />
// Translations come from rev-delundel of Mediawiki 15 <br />
// ar */ var collapseCaption = "▲ إخفاء"; // ar <br />
// ar */ var expandCaption = "▼ عرض"; // ar <br />
// cs */ var collapseCaption = "▲ Skrýt překlady"; // cs <br />
// cs */ var expandCaption = "▼ Zobrazit překlady"; // cs <br />
// de */ var collapseCaption = "▲ verstecke"; // de <br />
// de */ var expandCaption = "▼ zeige"; // de <br />
// en */ var collapseCaption = "▲ hide"; // en <br />
// en */ var expandCaption = "▼ show"; // en <br />
// es */ var collapseCaption = "▲ occultar"; // es <br />
// es */ var expandCaption = "▼ mostrar"; // es <br />
// et */ var collapseCaption = "▲ peida"; // et <br />
// et */ var expandCaption = "▼ näita"; // et <br />
// fi */ var collapseCaption = "▲ piilota"; // fi <br />
// fi */ var expandCaption = "▼ näytä"; // fi <br />
var collapseCaption = "▲ masquer"; // fr <br />
var expandCaption = "▼ afficher"; // fr <br />
// it */ var collapseCaption = "▲ nascondi"; // it <br />
// it */ var expandCaption = "▼ mostra"; // it <br />
// ja */ var collapseCaption = "▲ 秘匿"; // ja <br />
// ja */ var expandCaption = "▼ 表示"; // ja <br />
// nl */ var collapseCaption = "▲ verbergen"; // nl <br />
// nl */ var expandCaption = "▼ weergeven"; // nl <br />
// pl */ var collapseCaption = "▲ ukryj"; // pl <br />
// pl */ var expandCaption = "▼ pokaż"; // pl <br />
// pt */ var collapseCaption = "▲ esconder"; // pt <br />
// pt */ var expandCaption = "▼ mostrar"; // pt <br />
// ru */ var collapseCaption = "▲ скрыть"; // ru <br />
// ru */ var expandCaption = "▼ показать"; // ru <br />
// sh */ var collapseCaption = "▲ skrij"; // sh <br />
// sh */ var expandCaption = "▼ pokaži"; // sh <br />
// sv */ var collapseCaption = "▲ göm"; // sv <br />
// sv */ var expandCaption = "▼ visa"; // sv <br />
// zh */ var collapseCaption = "▲ 隱藏"; // zh <br />
// zh */ var expandCaption = "▼ 顯示"; // zh <br />
// end <br />
function collapseTable( tableIndex )<br />
{<br />
var Button = document.getElementById( "collapseButton" + tableIndex );<br />
var Table = document.getElementById( "collapsibleTable" + tableIndex );<br />
<br />
if ( !Table || !Button ) {<br />
return false;<br />
}<br />
<br />
var Rows = Table.rows;<br />
<br />
if ( Button.firstChild.data == collapseCaption ) {<br />
for ( var i = 1; i < Rows.length; i++ ) {<br />
Rows[i].style.display = "none";<br />
}<br />
Button.firstChild.data = expandCaption;<br />
} else {<br />
for ( var i = 1; i < Rows.length; i++ ) {<br />
Rows[i].style.display = Rows[0].style.display;<br />
}<br />
Button.firstChild.data = collapseCaption;<br />
}<br />
}<br />
<br />
function createCollapseButtons()<br />
{<br />
var tableIndex = 0;<br />
var NavigationBoxes = new Object();<br />
var Tables = document.getElementsByTagName( "table" );<br />
<br />
for ( var i = 0; i < Tables.length; i++ ) {<br />
if ( hasClass( Tables[i], "collapsible" ) ) {<br />
<br />
/* only add button and increment count if there is a header row to work with */<br />
var HeaderRow = Tables[i].getElementsByTagName( "tr" )[0];<br />
if (!HeaderRow) continue;<br />
var Header = HeaderRow.getElementsByTagName( "th" )[0];<br />
if (!Header) continue;<br />
<br />
NavigationBoxes[ tableIndex ] = Tables[i];<br />
Tables[i].setAttribute( "id", "collapsibleTable" + tableIndex );<br />
<br />
var Button = document.createElement( "span" );<br />
var ButtonLink = document.createElement( "a" );<br />
var ButtonText = document.createTextNode( collapseCaption );<br />
<br />
Button.style.styleFloat = "right";<br />
Button.style.cssFloat = "right";<br />
Button.style.fontWeight = "normal";<br />
Button.style.textAlign = "right";<br />
Button.style.width = "6em";<br />
<br />
ButtonLink.style.color = Header.style.color;<br />
ButtonLink.setAttribute( "id", "collapseButton" + tableIndex );<br />
ButtonLink.setAttribute( "href", "javascript:collapseTable(" + tableIndex + ");" );<br />
ButtonLink.appendChild( ButtonText );<br />
<br />
Button.appendChild( document.createTextNode( "[" ) );<br />
Button.appendChild( ButtonLink );<br />
Button.appendChild( document.createTextNode( "]" ) );<br />
<br />
Header.insertBefore( Button, Header.childNodes[0] );<br />
tableIndex++;<br />
}<br />
}<br />
<br />
for ( var i = 0; i < tableIndex; i++ ) {<br />
if ( hasClass( NavigationBoxes[i], "collapsed" ) || ( tableIndex >= autoCollapse && hasClass( NavigationBoxes[i], "autocollapse" ) ) ) {<br />
collapseTable( i );<br />
}<br />
}<br />
}<br />
<br />
addOnloadHook( createCollapseButtons );<br />
<br />
<br />
/** Dynamic Navigation Bars (experimental) *************************************<br />
*<br />
* Description: See [[Wikipedia:NavFrame]].<br />
* Maintainers: UNMAINTAINED<br />
*/<br />
<br />
// set up the words in your language<br />
var NavigationBarHide = '[' + collapseCaption + ']';<br />
var NavigationBarShow = '[' + expandCaption + ']';<br />
<br />
// shows and hides content and picture (if available) of navigation bars<br />
// Parameters:<br />
// indexNavigationBar: the index of navigation bar to be toggled<br />
function toggleNavigationBar(indexNavigationBar)<br />
{<br />
var NavToggle = document.getElementById("NavToggle" + indexNavigationBar);<br />
var NavFrame = document.getElementById("NavFrame" + indexNavigationBar);<br />
<br />
if (!NavFrame || !NavToggle) {<br />
return false;<br />
}<br />
<br />
// if shown now<br />
if (NavToggle.firstChild.data == NavigationBarHide) {<br />
for (var NavChild = NavFrame.firstChild; NavChild != null; NavChild = NavChild.nextSibling) {<br />
if ( hasClass( NavChild, 'NavPic' ) ) {<br />
NavChild.style.display = 'none';<br />
}<br />
if ( hasClass( NavChild, 'NavContent') ) {<br />
NavChild.style.display = 'none';<br />
}<br />
}<br />
NavToggle.firstChild.data = NavigationBarShow;<br />
<br />
// if hidden now<br />
} else if (NavToggle.firstChild.data == NavigationBarShow) {<br />
for (var NavChild = NavFrame.firstChild; NavChild != null; NavChild = NavChild.nextSibling) {<br />
if (hasClass(NavChild, 'NavPic')) {<br />
NavChild.style.display = 'block';<br />
}<br />
if (hasClass(NavChild, 'NavContent')) {<br />
NavChild.style.display = 'block';<br />
}<br />
}<br />
NavToggle.firstChild.data = NavigationBarHide;<br />
}<br />
}<br />
<br />
// adds show/hide-button to navigation bars<br />
function createNavigationBarToggleButton()<br />
{<br />
var indexNavigationBar = 0;<br />
// iterate over all < div >-elements <br />
var divs = document.getElementsByTagName("div");<br />
for (var i = 0; NavFrame = divs[i]; i++) {<br />
// if found a navigation bar<br />
if (hasClass(NavFrame, "NavFrame")) {<br />
<br />
indexNavigationBar++;<br />
var NavToggle = document.createElement("a");<br />
NavToggle.className = 'NavToggle';<br />
NavToggle.setAttribute('id', 'NavToggle' + indexNavigationBar);<br />
NavToggle.setAttribute('href', 'javascript:toggleNavigationBar(' + indexNavigationBar + ');');<br />
<br />
var NavToggleText = document.createTextNode(NavigationBarHide);<br />
for (var NavChild = NavFrame.firstChild; NavChild != null; NavChild = NavChild.nextSibling) {<br />
if ( hasClass( NavChild, 'NavPic' ) || hasClass( NavChild, 'NavContent' ) ) {<br />
if (NavChild.style.display == 'none') {<br />
NavToggleText = document.createTextNode(NavigationBarShow);<br />
break;<br />
}<br />
}<br />
}<br />
<br />
NavToggle.appendChild(NavToggleText);<br />
// Find the NavHead and attach the toggle link (Must be this complicated because Moz's firstChild handling is borked)<br />
for(var j=0; j < NavFrame.childNodes.length; j++) {<br />
if (hasClass(NavFrame.childNodes[j], "NavHead")) {<br />
NavFrame.childNodes[j].appendChild(NavToggle);<br />
}<br />
}<br />
NavFrame.setAttribute('id', 'NavFrame' + indexNavigationBar);<br />
}<br />
}<br />
}<br />
<br />
addOnloadHook( createNavigationBarToggleButton );</div>
Nicolas Brouard
http://fr-i.demopaedia.org/w/index.php?title=MediaWiki:Common.js&diff=11666
MediaWiki:Common.js
2017-06-25T18:08:08Z
<p>Nicolas Brouard : </p>
<hr />
<div>/* Zde uvedený JavaScript bude použit pro všechny uživatele při načtení každé stránky. */<br />
/* N'importe quel JavaScript ici sera chargé pour n'importe quel utilisateur et pour chaque page accédée.<br />
<br />
ATTENTION : Avant de modifier cette page, veuillez tester vos changements avec votre propre<br />
monobook.js. Une erreur sur cette page peut faire bugger le site entier (et gêner l'ensemble des<br />
visiteurs), même plusieurs heures après la modification !<br />
<br />
NE PAS RETIRER CECI SINON : remplacement des signature, substitution des modèles, ... : <nowiki><br />
<br />
/*************************************************************/<br />
/* Fonctions javascript : pallient les limites de javascript */<br />
/* Surveiller : http://www.ecmascript.org/ */<br />
/*************************************************************/<br />
<br />
/* Test if an element has a certain class **************************************<br />
*<br />
* Description: Uses regular expressions and caching for better performance.<br />
* Maintainers: [[User:Mike Dillon]], [[User:R. Koot]], [[User:SG]]<br />
*/<br />
<br />
var hasClass = (function () {<br />
var reCache = {};<br />
return function (element, className) {<br />
return (reCache[className] ? reCache[className] : (reCache[className] = new RegExp("(?:\\s|^)" + className + "(?:\\s|$)"))).test(element.className);<br />
};<br />
})();<br />
<br />
<br />
<br />
<br />
/** Collapsible tables *********************************************************<br />
* From http://en.wikipedia.org/w/index.php?title=MediaWiki:Common.js&oldid=219789618<br />
* Description: Allows tables to be collapsed, showing only the header. See<br />
* [[Wikipedia:NavFrame]].<br />
* Maintainers: [[User:R. Koot]]<br />
*/<br />
<br />
var autoCollapse = 2;<br />
// Translations come from rev-delundel of Mediawiki 15 <br />
// ar */ var collapseCaption = "▲ إخفاء"; // ar <br />
// ar */ var expandCaption = "▼ عرض"; // ar <br />
// cs */ var collapseCaption = "▲ Skrýt překlady"; // cs <br />
// cs */ var expandCaption = "▼ Zobrazit překlady"; // cs <br />
// de */ var collapseCaption = "▲ verstecke"; // de <br />
// de */ var expandCaption = "▼ zeige"; // de <br />
// en */ var collapseCaption = "▲ hide"; // en <br />
// en */ var expandCaption = "▼ show"; // en <br />
// es */ var collapseCaption = "▲ occultar"; // es <br />
// es */ var expandCaption = "▼ mostrar"; // es <br />
// et */ var collapseCaption = "▲ peida"; // et <br />
// et */ var expandCaption = "▼ näita"; // et <br />
// fi */ var collapseCaption = "▲ piilota"; // fi <br />
// fi */ var expandCaption = "▼ näytä"; // fi <br />
var collapseCaption = "▲ masquer"; // fr <br />
var expandCaption = "▼ afficher"; // fr <br />
// it */ var collapseCaption = "▲ nascondi"; // it <br />
// it */ var expandCaption = "▼ mostra"; // it <br />
// ja */ var collapseCaption = "▲ 秘匿"; // ja <br />
// ja */ var expandCaption = "▼ 表示"; // ja <br />
// nl */ var collapseCaption = "▲ verbergen"; // nl <br />
// nl */ var expandCaption = "▼ weergeven"; // nl <br />
// pl */ var collapseCaption = "▲ ukryj"; // pl <br />
// pl */ var expandCaption = "▼ pokaż"; // pl <br />
// pt */ var collapseCaption = "▲ esconder"; // pt <br />
// pt */ var expandCaption = "▼ mostrar"; // pt <br />
// ru */ var collapseCaption = "▲ скрыть"; // ru <br />
// ru */ var expandCaption = "▼ показать"; // ru <br />
// sh */ var collapseCaption = "▲ skrij"; // sh <br />
// sh */ var expandCaption = "▼ pokaži"; // sh <br />
// sv */ var collapseCaption = "▲ göm"; // sv <br />
// sv */ var expandCaption = "▼ visa"; // sv <br />
// zh */ var collapseCaption = "▲ 隱藏"; // zh <br />
// zh */ var expandCaption = "▼ 顯示"; // zh <br />
// end <br />
function collapseTable( tableIndex )<br />
{<br />
var Button = document.getElementById( "collapseButton" + tableIndex );<br />
var Table = document.getElementById( "collapsibleTable" + tableIndex );<br />
<br />
if ( !Table || !Button ) {<br />
return false;<br />
}<br />
<br />
var Rows = Table.rows;<br />
<br />
if ( Button.firstChild.data == collapseCaption ) {<br />
for ( var i = 1; i < Rows.length; i++ ) {<br />
Rows[i].style.display = "none";<br />
}<br />
Button.firstChild.data = expandCaption;<br />
} else {<br />
for ( var i = 1; i < Rows.length; i++ ) {<br />
Rows[i].style.display = Rows[0].style.display;<br />
}<br />
Button.firstChild.data = collapseCaption;<br />
}<br />
}<br />
<br />
function createCollapseButtons()<br />
{<br />
var tableIndex = 0;<br />
var NavigationBoxes = new Object();<br />
var Tables = document.getElementsByTagName( "table" );<br />
<br />
for ( var i = 0; i < Tables.length; i++ ) {<br />
if ( hasClass( Tables[i], "collapsible" ) ) {<br />
<br />
/* only add button and increment count if there is a header row to work with */<br />
var HeaderRow = Tables[i].getElementsByTagName( "tr" )[0];<br />
if (!HeaderRow) continue;<br />
var Header = HeaderRow.getElementsByTagName( "th" )[0];<br />
if (!Header) continue;<br />
<br />
NavigationBoxes[ tableIndex ] = Tables[i];<br />
Tables[i].setAttribute( "id", "collapsibleTable" + tableIndex );<br />
<br />
var Button = document.createElement( "span" );<br />
var ButtonLink = document.createElement( "a" );<br />
var ButtonText = document.createTextNode( collapseCaption );<br />
<br />
Button.style.styleFloat = "right";<br />
Button.style.cssFloat = "right";<br />
Button.style.fontWeight = "normal";<br />
Button.style.textAlign = "right";<br />
Button.style.width = "6em";<br />
<br />
ButtonLink.style.color = Header.style.color;<br />
ButtonLink.setAttribute( "id", "collapseButton" + tableIndex );<br />
ButtonLink.setAttribute( "href", "javascript:collapseTable(" + tableIndex + ");" );<br />
ButtonLink.appendChild( ButtonText );<br />
<br />
Button.appendChild( document.createTextNode( "[" ) );<br />
Button.appendChild( ButtonLink );<br />
Button.appendChild( document.createTextNode( "]" ) );<br />
<br />
Header.insertBefore( Button, Header.childNodes[0] );<br />
tableIndex++;<br />
}<br />
}<br />
<br />
for ( var i = 0; i < tableIndex; i++ ) {<br />
if ( hasClass( NavigationBoxes[i], "collapsed" ) || ( tableIndex >= autoCollapse && hasClass( NavigationBoxes[i], "autocollapse" ) ) ) {<br />
collapseTable( i );<br />
}<br />
}<br />
}<br />
<br />
addOnloadHook( createCollapseButtons );<br />
<br />
<br />
/** Dynamic Navigation Bars (experimental) *************************************<br />
*<br />
* Description: See [[Wikipedia:NavFrame]].<br />
* Maintainers: UNMAINTAINED<br />
*/<br />
<br />
// set up the words in your language<br />
var NavigationBarHide = '[' + collapseCaption + ']';<br />
var NavigationBarShow = '[' + expandCaption + ']';<br />
<br />
// shows and hides content and picture (if available) of navigation bars<br />
// Parameters:<br />
// indexNavigationBar: the index of navigation bar to be toggled<br />
function toggleNavigationBar(indexNavigationBar)<br />
{<br />
var NavToggle = document.getElementById("NavToggle" + indexNavigationBar);<br />
var NavFrame = document.getElementById("NavFrame" + indexNavigationBar);<br />
<br />
if (!NavFrame || !NavToggle) {<br />
return false;<br />
}<br />
<br />
// if shown now<br />
if (NavToggle.firstChild.data == NavigationBarHide) {<br />
for (var NavChild = NavFrame.firstChild; NavChild != null; NavChild = NavChild.nextSibling) {<br />
if ( hasClass( NavChild, 'NavPic' ) ) {<br />
NavChild.style.display = 'none';<br />
}<br />
if ( hasClass( NavChild, 'NavContent') ) {<br />
NavChild.style.display = 'none';<br />
}<br />
}<br />
NavToggle.firstChild.data = NavigationBarShow;<br />
<br />
// if hidden now<br />
} else if (NavToggle.firstChild.data == NavigationBarShow) {<br />
for (var NavChild = NavFrame.firstChild; NavChild != null; NavChild = NavChild.nextSibling) {<br />
if (hasClass(NavChild, 'NavPic')) {<br />
NavChild.style.display = 'block';<br />
}<br />
if (hasClass(NavChild, 'NavContent')) {<br />
NavChild.style.display = 'block';<br />
}<br />
}<br />
NavToggle.firstChild.data = NavigationBarHide;<br />
}<br />
}<br />
<br />
// adds show/hide-button to navigation bars<br />
function createNavigationBarToggleButton()<br />
{<br />
var indexNavigationBar = 0;<br />
// iterate over all < div >-elements <br />
var divs = document.getElementsByTagName("div");<br />
for (var i = 0; NavFrame = divs[i]; i++) {<br />
// if found a navigation bar<br />
if (hasClass(NavFrame, "NavFrame")) {<br />
<br />
indexNavigationBar++;<br />
var NavToggle = document.createElement("a");<br />
NavToggle.className = 'NavToggle';<br />
NavToggle.setAttribute('id', 'NavToggle' + indexNavigationBar);<br />
NavToggle.setAttribute('href', 'javascript:toggleNavigationBar(' + indexNavigationBar + ');');<br />
<br />
var NavToggleText = document.createTextNode(NavigationBarHide);<br />
for (var NavChild = NavFrame.firstChild; NavChild != null; NavChild = NavChild.nextSibling) {<br />
if ( hasClass( NavChild, 'NavPic' ) || hasClass( NavChild, 'NavContent' ) ) {<br />
if (NavChild.style.display == 'none') {<br />
NavToggleText = document.createTextNode(NavigationBarShow);<br />
break;<br />
}<br />
}<br />
}<br />
<br />
NavToggle.appendChild(NavToggleText);<br />
// Find the NavHead and attach the toggle link (Must be this complicated because Moz's firstChild handling is borked)<br />
for(var j=0; j < NavFrame.childNodes.length; j++) {<br />
if (hasClass(NavFrame.childNodes[j], "NavHead")) {<br />
NavFrame.childNodes[j].appendChild(NavToggle);<br />
}<br />
}<br />
NavFrame.setAttribute('id', 'NavFrame' + indexNavigationBar);<br />
}<br />
}<br />
}<br />
<br />
addOnloadHook( createNavigationBarToggleButton );</div>
Nicolas Brouard
http://fr-i.demopaedia.org/w/index.php?title=MediaWiki:Common.js&diff=11679
MediaWiki:Common.js
2017-06-25T15:00:10Z
<p>Nicolas Brouard : Back to minimum</p>
<hr />
<div>/**<br />
* Keep code in MediaWiki:Common.js to a minimum as it is unconditionally<br />
* loaded for all users on every wiki page. If possible create a gadget that is<br />
* enabled by default instead of adding it here (since gadgets are fully<br />
* optimized ResourceLoader modules with possibility to add dependencies etc.)<br />
*<br />
* Since Common.js isn't a gadget, there is no place to declare its<br />
* dependencies, so we have to lazy load them with mw.loader.using on demand and<br />
* then execute the rest in the callback. In most cases these dependencies will<br />
* be loaded (or loading) already and the callback will not be delayed. In case a<br />
* dependency hasn't arrived yet it'll make sure those are loaded before this.<br />
*/</div>
Nicolas Brouard
http://fr-i.demopaedia.org/w/index.php?title=MediaWiki:Gadget-DotsSyntaxHighlighter.js&diff=11667
MediaWiki:Gadget-DotsSyntaxHighlighter.js
2017-06-20T10:18:31Z
<p>Nicolas Brouard : modified</p>
<hr />
<div>//Syntax highlighter with various advantages See [[User:Remember the<br />
//dot/Syntax highlighter]] for more information<br />
/*<br />
MediaWiki:Gadget-DotsSyntaxHighlighter<br />
[https://www.mediawiki.org/wiki/User:Remember_the_dot/Syntax_highlighter Adapted from Syntax highlighter]: Make syntax stand out colourfully in the edit box and especially with Demopaedia TextTerm etc.<br />
<br />
MediaWiki:Gadget-DotsSyntaxHighlighter.js<br />
<br />
*/<br />
//in the edit box and especially with Demopaedia TextTerm etc.<br />
/* This file may be used under the terms of any of the following<br />
licenses, as well as any later version of the same licenses:<br />
<br />
GNU General Public License 2.0<br />
<https://www.gnu.org/licenses/old-licenses/gpl-2.0.html><br />
<br />
Creative Commons Attribution-ShareAlike 3.0 Unported License<br />
<https://creativecommons.org/licenses/by-sa/3.0/><br />
<br />
GNU Free Documentation License 1.2<br />
<https://www.gnu.org/licenses/old-licenses/fdl-1.2.html><br />
Modified by Nicolas Brouard for Demopaedia.org 12 June 2017<br />
*/<br />
<br />
(function () {<br />
"use strict";<br />
<br />
//variables that are preserved between function calls<br />
var wpTextbox0;<br />
var wpTextbox1;<br />
var syntaxStyleTextNode;<br />
var lastText;<br />
var maxSpanNumber = -1; //the number of the last span available, used to tell if creating additional spans is necessary<br />
var highlightSyntaxIfNeededIntervalID;<br />
var attributeObserver;<br />
var parentObserver;<br />
<br />
/* Define context-specific regexes, one for every common token that ends the<br />
current context.<br />
<br />
An attempt has been made to search for the most common syntaxes first,<br />
thus maximizing performance. Syntaxes that begin with the same character<br />
are searched for at the same time.<br />
<br />
Supported wiki syntaxes from most common to least common:<br />
[[internal link]] [http:// named external link]<br />
{{template}} {{{template parameter}}} {| table |}<br />
<tag> <!-- comment --><br />
http:// bare external link<br />
=Heading= * unordered list # ordered list : indent ; small heading ---- horizontal line<br />
''italic'' '''bold'''<br />
three tildes username four tildes signature five tildes timestamp<br />
&entity;<br />
<br />
The tag-matching regex follows the XML standard closely so that users<br />
won't feel like they have to escape sequences that MediaWiki will never<br />
consider to be tags.<br />
<br />
Only entities for characters which need to be escaped or cannot be<br />
unambiguously represented in a monospace font are highlighted, such as<br />
Greek letters that strongly resemble Latin letters. Use of other entities<br />
is discouraged as a matter of style. For the same reasons, numeric<br />
entities should be in hexadecimal (giving character codes in decimal only<br />
adds confusion).<br />
<br />
Newlines are sucked up into ending tokens (including comments, bare<br />
external links, lists, horizontal lines, signatures, entities, etc.) to<br />
avoid creating spans with nothing but newlines in them.<br />
<br />
Flags: g for global search, m for make ^ match the beginning of each line<br />
and $ the end of each line<br />
*/<br />
var wgUrlProtocols = mw.config.get("wgUrlProtocols");<br />
var entityRegexBase = "&(?:(?:n(?:bsp|dash)|m(?:dash|inus)|lt|e[mn]sp|thinsp|amp|quot|gt|shy|zwn?j|lrm|rlm|Alpha|Beta|Epsilon|Zeta|Eta|Iota|Kappa|[Mm]u|micro|Nu|[Oo]micron|[Rr]ho|Tau|Upsilon|Chi)|#x[0-9a-fA-F]+);\n*";<br />
var breakerRegexBase = "\\[(?:\\[|(?:" + wgUrlProtocols + "))|\\{(?:\\{\\{?|\\|)|<(?:[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:\\w\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD-\\.\u00B7\u0300-\u036F\u203F-\u203F-\u2040]*(?=/?>| |\n)|!--[^]*?-->\n*)|(?:" + wgUrlProtocols.replace("|\\/\\/", "") + ")[^\\s\"<>[\\]{-}]*[^\\s\",\\.:;<>[\\]{-}]\n*|^(?:=|[*#:;]+\n*|-{4,}\n*)|\\\\'\\\\'(?:\\\\')?|~{3,5}\n*|" + entityRegexBase;<br />
function breakerRegexWithPrefix(prefix)<br />
{<br />
//the stop token has to be at the beginning of the regex so that it takes precedence over substrings of itself.<br />
return new RegExp("(" + prefix + ")\n*|" + breakerRegexBase, "gm");<br />
}<br />
function nowikiTagBreakerRegex(tagName)<br />
{<br />
return new RegExp("(</" + tagName + ">)\n*|" + entityRegexBase, "gm");<br />
}<br />
var defaultBreakerRegex = new RegExp(breakerRegexBase, "gm");<br />
var wikilinkBreakerRegex = breakerRegexWithPrefix("]][a-zA-Z]*");<br />
var namedExternalLinkBreakerRegex = breakerRegexWithPrefix("]");<br />
var parameterBreakerRegex = breakerRegexWithPrefix("}}}");<br />
var templateBreakerRegex = breakerRegexWithPrefix("}}");<br />
var templateArgBreakerRegex = breakerRegexWithPrefix("[\\|}]");<br />
var tableBreakerRegex = breakerRegexWithPrefix("\\|}");<br />
var headingBreakerRegex = breakerRegexWithPrefix("\n");<br />
var tagBreakerRegexCache = {};<br />
var nowikiTagBreakerRegexCache = {};<br />
<br />
function highlightSyntax()<br />
{<br />
lastText = wpTextbox1.value;<br />
/* Backslashes and apostrophes are CSS-escaped at the beginning and all<br />
parsing regexes and functions are designed to match. On the other hand,<br />
newlines are not escaped until written so that in the regexes ^ and $<br />
work for both newlines and the beginning or end of the string. */<br />
var text = lastText.replace(/['\\]/g, "\\$&") + "\n"; //add a newline to fix scrolling and parsing issues<br />
var i = 0; //the location of the parser as it goes through var text<br />
<br />
var css = "";<br />
var spanNumber = 0;<br />
var lastColor;<br />
var before = true;<br />
<br />
//writes text into to-be-created span elements of wpTextbox0 using :before and :after pseudo-elements<br />
//both :before and :after are used because using two pseudo-elements per span is significantly faster than doubling the number of spans required<br />
function writeText(text, color)<br />
{<br />
//no need to use another span if using the same color<br />
if (color != lastColor)<br />
{<br />
//whitespace is omitted in the hope of increasing performance<br />
css += "'}#s" + spanNumber; //spans will be created with IDs s0 through sN<br />
if (before)<br />
{<br />
css += ":before{";<br />
before = false;<br />
}<br />
else<br />
{<br />
css += ":after{";<br />
before = true;<br />
++spanNumber;<br />
}<br />
if (color)<br />
{<br />
//"background-color" is 6 characters longer than "background" but the browser processes it faster<br />
css += "background-color:" + color + ";";<br />
}<br />
css += "content:'";<br />
lastColor = color;<br />
}<br />
css += text;<br />
}<br />
<br />
/* About assumedBold and assumedItalic:<br />
<br />
Highlighting bold or italic markup presents a special challenge<br />
because the actual MediaWiki parser uses multiple passes to determine<br />
which ticks represent start tags and which represent end tags.<br />
Because that would be too slow for us here, we instead keep track of<br />
what kinds of unclosed opening ticks have been encountered and use<br />
that to make a good guess as to whether the next ticks encountered<br />
are an opening tag or a closing tag.<br />
<br />
The major downsides to this method are that '''apostrophe italic''<br />
and ''italic apostrophe''' are not highlighted correctly, and bold<br />
and italic are both highlighted in the same color.<br />
<br />
To permit ''The best<ref>''Reference Title''</ref> book ever'',<br />
assumedBold and assumedItalic are saved on the stack and reset to<br />
undefined (essentially, false) when recursing into a new block. */<br />
<br />
function highlightBlock(color, breakerRegex, assumedBold, assumedItalic)<br />
{<br />
var match;<br />
<br />
for (breakerRegex.lastIndex = i; match = breakerRegex.exec(text); breakerRegex.lastIndex = i)<br />
{<br />
// console.log(" breakerRegex.lastIndex="+breakerRegex.lastIndex);<br />
// console.log(" breakerRegex.source="+breakerRegex.source);<br />
//console.log(" match.input="+match.input);<br />
// if (match[1])<br />
// //console.log(" match1=" + match[1]+ " match0=" +match[0]);<br />
// else<br />
// //console.log(" unmatch1=" + match[1]+ " match0=" +match[0]);<br />
if (match[1])<br />
{<br />
//end token found, we are within a coloured zone <br />
writeText(text.substring(i, breakerRegex.lastIndex), color);<br />
//console.log(" breaker Regex i="+ i + " breakerRegex.lastIndex=" +breakerRegex.lastIndex + " t="+text.substring(i, breakerRegex.lastIndex) + " return highlight" );<br />
i = breakerRegex.lastIndex; /* end of zone */<br />
<br />
return; /* returns after the break ie for with a defautregex in order to search again */<br />
}<br />
<br />
var endIndexOfLastColor = breakerRegex.lastIndex - match[0].length; /* Not including the match? */<br />
if (i < endIndexOfLastColor) //avoid calling writeText with text == "" to improve performance<br />
{<br />
writeText(text.substring(i, endIndexOfLastColor), color); /* Includes i (from 0), excludes endIndexOfLastColor */<br />
//console.log(" substring i="+ i + " endIndexOfLastColor=" + endIndexOfLastColor );<br />
<br />
}<br />
<br />
i = breakerRegex.lastIndex; /* Out of coloured zone */ /* Dot is first position after the search "{{." */<br />
<br />
switch (match[0].charAt(0)) //cases in this switch should be arranged from most common to least common<br />
{<br />
case "[":<br />
if (match[0].charAt(1) == "[")<br />
{<br />
//wikilink<br />
writeText("[[", syntaxHighlighterConfig.wikilinkColor || color);<br />
highlightBlock(syntaxHighlighterConfig.wikilinkColor || color, wikilinkBreakerRegex);<br />
}<br />
else<br />
{<br />
//named external link<br />
writeText(match[0], syntaxHighlighterConfig.externalLinkColor || color);<br />
highlightBlock(syntaxHighlighterConfig.externalLinkColor || color, namedExternalLinkBreakerRegex);<br />
}<br />
break;<br />
case "{":<br />
if (match[0].charAt(1) == "{")<br />
{<br />
if (match[0].length == 3)<br />
{<br />
//parameter<br />
writeText("{{{", syntaxHighlighterConfig.parameterColor || color);<br />
highlightBlock(syntaxHighlighterConfig.parameterColor || color, parameterBreakerRegex);<br />
}<br />
else<br />
{<br />
//template<br />
//some other kind of template, search for its end<br />
//writeText("{{", syntaxHighlighterConfig.templateColor || color);<br />
//{{Note|6| {{NoteTerm|Biométrie}}, s.f. - {{NoteTerm|biométrique}}, adj. - {{NoteTerm|biométricien}}, s.m. : spécialiste de la biométrie.}}<br />
//var templEnd = text.indexOf("}", i) + 1; /* Just before first } +1*/<br />
var templTextTermEnd = text.indexOf("|", i); /* char from 0 to index "{{Note|" is position 6 (7th char); just after first | if any*/<br />
var iv=text.indexOf("|", i);//"{{Note|1|" termEnd is position 7 (starting at "1"), result is 8<br />
var ib=text.indexOf("}", i);//"{{RefTerm|Love}}" termEnd is position 9 (starting at "L"), result is 13<br />
var nbarg=0;<br />
var templTextTermEnd ;<br />
var templTextTermEndClose;<br />
if( (ib < iv) || (iv == -1) ){<br />
nbarg=0;<br />
templTextTermEndClose=templTextTermEnd = ib ;/* Just at } if any */ /* no argument */<br />
}else{<br />
nbarg=1;<br />
templTextTermEnd = iv ; /* Just at second | if any */<br />
}<br />
//{{Current status}}<br />
if(nbarg==1){<br />
iv=text.indexOf("|", templTextTermEnd+1);//"{{Note|1|" termEnd is position 7 (starting at "1"), result is 8<br />
ib=text.indexOf("}", templTextTermEnd+1);//"{{RefTerm|Love}}" termEnd is position 9 (starting at "L"), result is 13<br />
if( (ib < iv) || (iv == -1) ){<br />
templTextTermEndClose= ib ;/* Just at } if any */<br />
}else{<br />
nbarg=2;<br />
templTextTermEndClose = iv ; /* Just at second | if any {{Note|1| */<br />
}<br />
}<br />
//console.log("templ1 TextTermEndClose :" + templTextTermEndClose); // Ok before |<br />
// Be careful with scrolling and asynchronous generated by console.log see<br />
// https://developer.mozilla.org/en-US/docs/Mozilla/Performance/Scroll-linked_effects<br />
//console.log("templ End :" + templEnd + " noarg=", noarg); // Ok before }}<br />
// console.log("templ TextTermEnd :" + templTextTermEnd); // Ok before |<br />
//console.log("templ TextTermEndClose :" + templTextTermEndClose); // Ok before |<br />
// La {{TextTerm|démographie historique|1|102|OtherIndexEntry=historique. démographie ...}} s’occupe<br />
//de la {{NonRefTerm|structure}} <br />
//{{Note|6| {{NoteTerm|Biométrie}}, s.f. - {{NoteTerm|biométrique}}, adj. - {{NoteTerm|biométricien}}, s.m. : spécialiste de la biométrie.}}<br />
//var templText = text.substring(i+2 - match[0].length, templEnd-1);<br />
//TextTerm|démographie historique|1|102|OtherIndexEntry=historique. démographie ..<br />
//NonRefTerm|structure<br />
var templTextType = text.substring(i+2 - match[0].length, templTextTermEnd); /* Excluding char at TermEnd | or } */<br />
//TextTerm<br />
//NonRefTerm<br />
//var templTextTermall = text.substring(templTextTermEnd, templEnd); /* Just after termination | or }*/<br />
//démographie historique|1|102|OtherIndexEntry=historique. démographie ...<br />
//NonRefTerm|structure<br />
var templTextTerm;<br />
if(nbarg >0)<br />
templTextTerm = text.substring(templTextTermEnd+1,templTextTermEndClose); //excluding terminaison | or }<br />
else<br />
templTextTerm="";<br />
//templTextTermall.substring(0, templTextTermall.indexOf("|"));<br />
//démographie historique<br />
//structure<br />
var TypeTemplateColor=syntaxHighlighterConfig.templateColor;<br />
var TemplateColor=syntaxHighlighterConfig.templateColor;<br />
var Text1TemplateColor=syntaxHighlighterConfig.templateColor;<br />
var Text2TemplateColor=syntaxHighlighterConfig.templateColor;<br />
if((templTextType=="TextTerm") ){<br />
TypeTemplateColor= syntaxHighlighterConfig.templTextTermColor;<br />
TemplateColor= syntaxHighlighterConfig.templTypeTextTermColor;<br />
Text1TemplateColor= syntaxHighlighterConfig.backgroundColor;<br />
Text2TemplateColor=TemplateColor ;<br />
}else if ( (templTextType=="Note") ){<br />
TypeTemplateColor= syntaxHighlighterConfig.templTypeNoteColor;<br />
TemplateColor= syntaxHighlighterConfig.templNoteColor;<br />
Text1TemplateColor= syntaxHighlighterConfig.backgroundColor;<br />
Text2TemplateColor= syntaxHighlighterConfig.templNoteColor;<br />
}else if ( (templTextType=="NoteTerm") ){<br />
TypeTemplateColor= syntaxHighlighterConfig.templNoteTermColor;<br />
TemplateColor= syntaxHighlighterConfig.templNoteTermColor;<br />
Text1TemplateColor= syntaxHighlighterConfig.backgroundColor;<br />
Text2TemplateColor= syntaxHighlighterConfig.templNoteTermColor;<br />
}else if (templTextType=="NewTextTerm" ){<br />
TypeTemplateColor= syntaxHighlighterConfig.templTextTermColor;<br />
TemplateColor= syntaxHighlighterConfig.templTypeNewTextTermColor;<br />
Text1TemplateColor= syntaxHighlighterConfig.backgroundColor;<br />
Text2TemplateColor= TemplateColor;<br />
}else if ( templTextType=="RefNumber" ){<br />
TypeTemplateColor= syntaxHighlighterConfig.templRefNumberColor;<br />
TemplateColor= syntaxHighlighterConfig.templRefNumberColor;<br />
Text1TemplateColor= syntaxHighlighterConfig.backgroundColor;<br />
Text2TemplateColor= TemplateColor;<br />
}else if ((templTextType=="NonRefTerm") ){<br />
TypeTemplateColor= syntaxHighlighterConfig.templNonRefTermColor;<br />
TemplateColor= syntaxHighlighterConfig.templNonRefTermColor;<br />
Text1TemplateColor= syntaxHighlighterConfig.backgroundColor;<br />
Text2TemplateColor= syntaxHighlighterConfig.backgroundColor;<br />
}<br />
//writeText("{{", TemplateColor || color);<br />
writeText("{{", TemplateColor || color); //NonRefTerm| or TextTerm|<br />
writeText(templTextType, TypeTemplateColor || color); //NonRefTerm| or TextTerm|<br />
i=templTextTermEnd;<br />
if(nbarg>=1){<br />
writeText( "|", TemplateColor || color); //NonRefTerm| or TextTerm|<br />
//writeText(templTextType+"|", syntaxHighlighterConfig.templateColor || color); //NonRefTerm| or TextTerm|<br />
i=templTextTermEnd+1;<br />
//writeText(templTextTerm, syntaxHighlighterConfig.tagColor || color); //struture<br />
writeText(templTextTerm, Text1TemplateColor || color); //struture<br />
i=templTextTermEndClose; //-noarg; démographie historique| or 1|, at the terminaison (| or }.<br />
}<br />
if(nbarg==2){<br />
writeText("|",Text2TemplateColor || color);<br />
i=templTextTermEndClose+1; //-noarg; démographie historique| or 1|, at the terminaison (| or }.<br />
}<br />
//console.log(" i="+ i );<br />
//highlightBlock(syntaxHighlighterConfig.templateColor || color, templateBreakerRegex);<br />
highlightBlock(TemplateColor || color, templateBreakerRegex);<br />
}<br />
}<br />
else //|<br />
{<br />
//table<br />
writeText("{|", syntaxHighlighterConfig.tableColor || color);<br />
highlightBlock(syntaxHighlighterConfig.tableColor || color, tableBreakerRegex);<br />
}<br />
break;<br />
case "<":<br />
if (match[0].charAt(1) == "!")<br />
{<br />
//comment tag<br />
writeText(match[0], syntaxHighlighterConfig.commentColor || color);<br />
break;<br />
}<br />
else<br />
{<br />
//some other kind of tag, search for its end<br />
//the search is made easier because XML attributes may not contain the character ">"<br />
var tagEnd = text.indexOf(">", i) + 1;<br />
if (tagEnd == 0)<br />
{<br />
//not a tag, just a "<" with some text after it<br />
writeText("<", color);<br />
i = i - match[0].length + 1;<br />
break;<br />
}<br />
<br />
if (text.charAt(tagEnd - 2) == "/")<br />
{<br />
//empty tag<br />
writeText(text.substring(i - match[0].length, tagEnd), syntaxHighlighterConfig.tagColor || color);<br />
i = tagEnd;<br />
}<br />
else<br />
{<br />
var tagName = match[0].substring(1);<br />
<br />
if (syntaxHighlighterConfig.sourceTags.indexOf(tagName) != -1)<br />
{<br />
//tag that contains text in a different programming language<br />
var stopAfter = "</" + tagName + ">";<br />
var endIndex = text.indexOf(stopAfter, i);<br />
if (endIndex == -1)<br />
{<br />
endIndex = text.length;<br />
}<br />
else<br />
{<br />
endIndex += stopAfter.length;<br />
}<br />
writeText(text.substring(i - match[0].length, endIndex), syntaxHighlighterConfig.tagColor || color);<br />
i = endIndex;<br />
}<br />
else if (syntaxHighlighterConfig.nowikiTags.indexOf(tagName) != -1)<br />
{<br />
//tag that can contain only HTML entities<br />
writeText(text.substring(i - match[0].length, tagEnd), syntaxHighlighterConfig.tagColor || color);<br />
i = tagEnd;<br />
highlightBlock(syntaxHighlighterConfig.tagColor || color, nowikiTagBreakerRegexCache[tagName]);<br />
}<br />
else<br />
{<br />
//ordinary tag<br />
writeText(text.substring(i - match[0].length, tagEnd), syntaxHighlighterConfig.tagColor || color);<br />
i = tagEnd;<br />
if (!tagBreakerRegexCache[tagName])<br />
{<br />
tagBreakerRegexCache[tagName] = breakerRegexWithPrefix("</" + tagName + ">");<br />
}<br />
highlightBlock(syntaxHighlighterConfig.tagColor || color, tagBreakerRegexCache[tagName]);<br />
}<br />
}<br />
}<br />
break;<br />
case "=":<br />
if (/[^=]=+$/.test(text.substring(i, text.indexOf("\n", i)))) //the line begins and ends with an equals sign and has something else in the middle<br />
{<br />
//heading<br />
writeText("=", syntaxHighlighterConfig.headingColor || color);<br />
highlightBlock(syntaxHighlighterConfig.headingColor || color, headingBreakerRegex);<br />
}<br />
else<br />
{<br />
writeText("=", color); //move on, process this line as regular wikitext<br />
}<br />
break;<br />
case "*":<br />
case "#":<br />
case ":":<br />
//unordered list, ordered list, indent, small heading<br />
//just highlight the marker<br />
writeText(match[0], syntaxHighlighterConfig.listOrIndentColor || color);<br />
break;<br />
case ";":<br />
//small heading<br />
writeText(";", syntaxHighlighterConfig.headingColor || color);<br />
highlightBlock(syntaxHighlighterConfig.headingColor || color, headingBreakerRegex);<br />
break;<br />
case "-":<br />
//horizontal line<br />
writeText(match[0], syntaxHighlighterConfig.hrColor || color);<br />
break;<br />
case "\\":<br />
writeText(match[0], syntaxHighlighterConfig.boldOrItalicColor || color);<br />
if (match[0].length == 6)<br />
{<br />
//bold<br />
if (assumedBold)<br />
{<br />
//end tag<br />
if (assumedItalic)<br />
{<br />
//end of bold part of bold-italic block<br />
//block is now italic-only<br />
assumedBold = false;<br />
}<br />
else<br />
{<br />
//end of bold block<br />
return;<br />
}<br />
}<br />
else<br />
{<br />
//start tag<br />
if (assumedItalic)<br />
{<br />
//start of bold part of previously italic-only block<br />
//block is now bold-italic<br />
assumedBold = true;<br />
}<br />
else<br />
{<br />
//start of bold block<br />
highlightBlock(syntaxHighlighterConfig.boldOrItalicColor || color, defaultBreakerRegex, true, false);<br />
}<br />
}<br />
}<br />
else<br />
{<br />
//italic<br />
if (assumedItalic)<br />
{<br />
//end tag<br />
if (assumedBold)<br />
{<br />
//end of italic part of bold-italic block<br />
//block is now bold-only<br />
assumedItalic = false;<br />
}<br />
else<br />
{<br />
//end of italic block<br />
return;<br />
}<br />
}<br />
else<br />
{<br />
//start tag<br />
if (assumedBold)<br />
{<br />
//start of italic part of previously bold-only block<br />
//block is now bold-italic<br />
assumedItalic = true;<br />
}<br />
else<br />
{<br />
//start of italic block<br />
highlightBlock(syntaxHighlighterConfig.boldOrItalicColor || color, defaultBreakerRegex, false, true);<br />
}<br />
}<br />
}<br />
break;<br />
case "&":<br />
//entity<br />
writeText(match[0], syntaxHighlighterConfig.entityColor || color);<br />
break;<br />
case "~":<br />
//username, signature, timestamp<br />
writeText(match[0], syntaxHighlighterConfig.signatureColor || color);<br />
break;<br />
default:<br />
//bare external link<br />
writeText(match[0], syntaxHighlighterConfig.externalLinkColor || color);<br />
}<br />
}<br />
}<br />
<br />
<br />
//start!<br />
var startTime = Date.now();<br />
highlightBlock("", defaultBreakerRegex);<br />
<br />
//output the leftovers (if any) to make sure whitespace etc. matches<br />
if (i < text.length)<br />
{<br />
writeText(text.substring(i), "");<br />
}<br />
<br />
//if highlighting took too long, disable it.<br />
var endTime = Date.now();<br />
/*if (typeof(bestTime) == "undefined")<br />
{<br />
window.bestTime = endTime - startTime;<br />
document.title = bestTime;<br />
highlightSyntaxIfNeededIntervalID = setInterval(highlightSyntax, 250);<br />
}<br />
else<br />
{<br />
if (endTime - startTime < bestTime)<br />
{<br />
bestTime = endTime - startTime;<br />
document.title = bestTime;<br />
}<br />
}//*/<br />
if (endTime - startTime > syntaxHighlighterConfig.timeout)<br />
{<br />
clearInterval(highlightSyntaxIfNeededIntervalID);<br />
wpTextbox1.removeEventListener("input", highlightSyntax);<br />
wpTextbox1.removeEventListener("scroll", syncScrollX);<br />
wpTextbox1.removeEventListener("scroll", syncScrollY);<br />
attributeObserver.disconnect();<br />
parentObserver.disconnect();<br />
syntaxStyleTextNode.nodeValue = "";<br />
<br />
var errorMessage = {<br />
ca: "S'ha desactivat el remarcar de sintaxi en aquesta pàgina perquè ha trigat massa temps. El temps màxim permès per a remarcar és $1ms, i el vostre ordinador ha trigat $2ms. Proveu tancar algunes pestanyes i programes i fer clic en \"Mostra la previsualització\" o \"Mostra els canvis\". Si no funciona això, proveu un altre navegador web, i si això no funciona, proveu un ordinador més ràpid.",<br />
de: "Die Syntaxhervorhebung wurde auf dieser Seite deaktiviert, da diese zu lange gedauert hat. Die maximal erlaubte Zeit zur Hervorhebung beträgt $1ms und dein Computer benötigte $2ms. Versuche einige Tabs und Programme zu schließen und klicke \"Vorschau zeigen\" oder \"Änderungen zeigen\". Wenn das nicht funktioniert, probiere einen anderen Webbrowser und wenn immer noch nicht, probiere einen schnelleren Computer.",<br />
el: "Η έμφαση σύνταξης έχει απενεργοποιηθεί σε αυτήν τη σελίδα γιατί αργούσε πολύ. Ο μέγιστος επιτρεπτός χρόνος για την έμφαση σύνταξης είναι $1ms και ο υπολογιστής σας έκανε $2ms. Δοκιμάστε να κλείσετε μερικές καρτέλες και προγράμματα και να κάνετε κλικ στην «Εμφάνιση προεπισκόπησης» ή στην «Εμφάνιση αλλαγών». Αν αυτό δεν δουλέψει, δοκιμάστε έναν διαφορετικό περιηγητή και αν ούτε αυτό δουλέψει, δοκιμάστε έναν ταχύτερο υπολογιστή.",<br />
en: "Syntax highlighting on this page was disabled because it took too long. The maximum allowed highlighting time is $1ms, and your computer took $2ms. Try closing some tabs and programs and clicking \"Show preview\" or \"Show changes\". If that doesn't work, try a different web browser, and if that doesn't work, try a faster computer.",<br />
es: "Se desactivó el resaltar de sintaxis en esta página porque tardó demasiado. El tiempo máximo permitido para resaltar es $1ms, y tu ordenador tardó $2ms. Prueba cerrar algunas pestañas y programas y hacer clic en \"Mostrar previsualización\" o \"Mostrar cambios\". Si no funciona esto, prueba otro navegador web, y si eso no funciona, prueba un ordenador más rápido.",<br />
fa: "از آنجایی که زمان زیادی صرف آن میشد، برجستهسازی نحو در این صفحه غیرفعال شده است. بیشینهٔ زمان برجستهسازی برای ابزار $1ms تعریف شده در حالی که رایانهٔ شما $2ms زمان نیاز داشت. میتوانید بستن برخی سربرگها و برنامهها و سپس کلیککردن دکمهٔ «پیشنمایش» یا «نمایش تغییرات» را بیازمایید. اگر جواب نداد مرورگر دیگری را امتحان کنید؛ و اگر باز هم جواب نداد، رایانهٔ سریعتری را بیازمایید.",<br />
fr: "La coloration syntaxique a été désactivée sur cette page en raison d'un temps de chargement trop important ($2ms). Le temps maximum autorisé est $1ms. Vous pouvez essayer de fermer certains onglets et programmes et cliquez sur \"Prévisualisation\" ou \"Voir mes modifications\". Si cela ne fonctionne pas, essayez un autre navigateur web, et si cela ne fonctionne toujours pas, essayez un ordinateur plus rapide.",<br />
hy: "Շարադասության ընդգծումը այս էջում անջատվել է, քանի որ այն չափից շատ է տևել։ Ընդգծման թույլատրելի առավելագույն ժամանակը $1 միլիվայրկյան է, բայց այս էջում տևել է $2 միլիվայրկյան։ Փորձեք անջատել որոշ ներդիրներ կամ ծրագրեր և սեղմել «Նախադիտել» կամ «Կատարված փոփոխությունները»։ Կրկին չաշխատելու դեպքում փորձեք այլ վեբ դիտարկիչ, եթե կրկին չաշխատի, փորձեք ավելի արագ համակարգիչ։",<br />
io: "Sintaxo-hailaitar en ca pagino esis nekapabligata pro ke konsumis tro multa tempo. La maxima permisata hailaitala tempo es $1ms, e tua ordinatro konsumis $2ms. Probez klozar kelka tabi e programi e kliktar \"Previdar\" o \"Montrez chanji\". Se to ne funcionas, probez altra brauzero, e se to ne funcionas, probez plu rapida ordinatro.",<br />
it: "L'evidenziazione delle sintassi su questa pagina è stata disabilitata perché ha richiesto troppo tempo. Il tempo massimo per l'evidenziazione è di $1ms e al tuo computer sono serviti $2ms. Prova a chiudere alcune schede e programmi e ricarica la pagina cliccando su \"Visualizza anteprima\" o \"Mostra modifiche\". Se non funziona ancora, prova con un web browser differente e, in ultima alternativa, prova ad utilizzare un computer più veloce.",<br />
ko: "이 문서에서의 문법 강조가 너무 오래 걸러서 해제되었습니다. 최대로 할당된 강조 시간은 $1ms인데, 당신의 컴퓨터는 $2ms이나 걸렸습니다. 탭과 프로그램을 일부 닫으신 후에 \"미리 보기\"나 \"차이 보기\"를 클릭하시기 바랍니다. 만약 작동하지 않으면 다른 웹 브라우저로 시도해보시고, 그래도 안되면 더 빠른 컴퓨터를 이용하십시오",<br />
pt: "O marcador de sintaxe foi desativado nesta página porque demorou demais. O tempo máximo permitido para marcar é de $1ms, e seu computador demorou $2ms. Tente fechar algumas abas e programas e clique em \"Mostrar previsão\" ou \"Mostrar alterações\". Se isso não funcionar, tente usar um outro navegador web, e se ainda não funcionar, tente em um computador mais rápido.",<br />
ru: "Подсветка синтаксиса на странице была отключена, так как заняла слишком долго. Максимальное допустимое время операции - $1мс, сейчас на вашем компьютере она заняла $2мс. Попробуйте закрыть несколько вкладок и программ, затем нажать «Предварительный просмотр» или «Внесённые изменения». Если это не поможет, попробуйте другой браузер; если и это не поможет, используйте более быстрый компьютер.",<br />
sr: "Истицање синтаксе на овој страници је онемогућено јер се одвија предуго. Максимално дозвољено време истицања је $1ms, а на Вашем рачунару траје $2ms. Покушајте затворити неке картице и програме или кликните на „Прикажи претпреглед” или „Прикажи измене”. Ако то не ради, покушајте са другим веб-прегледачем, а ако и тада не ради, покушајте са бржим рачунаром.",<br />
};<br />
var wgUserLanguage = mw.config.get("wgUserLanguage");<br />
<br />
errorMessage = errorMessage[wgUserLanguage] || errorMessage[wgUserLanguage.substring(0, wgUserLanguage.indexOf("-"))] || errorMessage.en;<br />
<br />
wpTextbox1.style.backgroundColor = "";<br />
wpTextbox1.style.marginTop = wpTextbox0.style.marginTop;<br />
wpTextbox0.removeAttribute("dir");<br />
wpTextbox0.removeAttribute("lang");<br />
wpTextbox0.setAttribute("style", "color:red; font-size:small");<br />
<br />
wpTextbox0.textContent = errorMessage.replace("$1", syntaxHighlighterConfig.timeout).replace("$2", endTime - startTime);<br />
return;<br />
}<br />
<br />
//do we have enough span elements to match the generated CSS?<br />
//this step isn't included in the above benchmark because it takes a highly variable amount of time<br />
if (maxSpanNumber < spanNumber)<br />
{<br />
var fragment = document.createDocumentFragment();<br />
do<br />
{<br />
fragment.appendChild(document.createElement("span")).id = "s" + ++maxSpanNumber;<br />
}<br />
while (maxSpanNumber < spanNumber);<br />
wpTextbox0.appendChild(fragment);<br />
}<br />
<br />
/* finish CSS: move the extra '} from the beginning to the end and CSS-<br />
escape newlines. CSS ignores the space after the hex code of the<br />
escaped character */<br />
syntaxStyleTextNode.nodeValue = css.substring(2).replace(/\n/g, "\\A ") + "'}";<br />
}<br />
<br />
function syncScrollX()<br />
{<br />
//console.log("syncScrollX");<br />
wpTextbox0.scrollLeft = wpTextbox1.scrollLeft;<br />
}<br />
<br />
function syncScrollY()<br />
{<br />
//console.log("syncScrollY");<br />
wpTextbox0.scrollTop = wpTextbox1.scrollTop;<br />
}<br />
<br />
function syncTextDirection()<br />
{<br />
wpTextbox0.dir = wpTextbox1.dir;<br />
}<br />
<br />
function syncParent()<br />
{<br />
if (wpTextbox1.previousSibling != wpTextbox0)<br />
{<br />
wpTextbox1.parentNode.insertBefore(wpTextbox0, wpTextbox1);<br />
parentObserver.disconnect();<br />
parentObserver.observe(wpTextbox1.parentNode, {childList: true});<br />
}<br />
}<br />
<br />
//this function runs once every 500ms to detect changes to wpTextbox1's text that the input event does not catch<br />
//this happens when another script changes the text without knowing that the syntax highlighter needs to be informed<br />
function highlightSyntaxIfNeeded()<br />
{<br />
if (wpTextbox1.value != lastText)<br />
{<br />
highlightSyntax();<br />
}<br />
if (wpTextbox1.scrollLeft != wpTextbox0.scrollLeft)<br />
{<br />
//console.log("Box1syncScrollX");<br />
syncScrollX();<br />
}<br />
if (wpTextbox1.scrollTop != wpTextbox0.scrollTop)<br />
{<br />
//console.log("Box1syncScrollY");<br />
syncScrollY();<br />
}<br />
if (wpTextbox1.offsetHeight != wpTextbox0.offsetHeight)<br />
{<br />
var height = wpTextbox1.offsetHeight + "px";<br />
wpTextbox0.style.height = height;<br />
wpTextbox1.style.marginTop = "-" + height;<br />
}<br />
}<br />
<br />
function setup()<br />
{<br />
function configureColor(parameterName, hardcodedFallback, defaultOk)<br />
{<br />
if (typeof(syntaxHighlighterConfig[parameterName]) == "undefined")<br />
{<br />
syntaxHighlighterConfig[parameterName] = syntaxHighlighterSiteConfig[parameterName];<br />
}<br />
<br />
if (syntaxHighlighterConfig[parameterName] == "normal")<br />
{<br />
syntaxHighlighterConfig[parameterName] = hardcodedFallback;<br />
}<br />
else if (typeof(syntaxHighlighterConfig[parameterName]) != "undefined")<br />
{<br />
return;<br />
}<br />
else if (typeof(syntaxHighlighterConfig.defaultColor) != "undefined" && defaultOk)<br />
{<br />
syntaxHighlighterConfig[parameterName] = syntaxHighlighterConfig.defaultColor;<br />
}<br />
else<br />
{<br />
syntaxHighlighterConfig[parameterName] = hardcodedFallback;<br />
}<br />
}<br />
<br />
window.syntaxHighlighterSiteConfig = window.syntaxHighlighterSiteConfig || {};<br />
window.syntaxHighlighterConfig = window.syntaxHighlighterConfig || {};<br />
<br />
//use 3-digit colors instead of 6-digit colors for performance<br />
// See for example http://maettig.com/?page=PHP/CSS_Color_Converter<br />
configureColor("backgroundColor", "#FFF", false); //white<br />
configureColor("foregroundColor", "#000", false); //black<br />
configureColor("boldOrItalicColor", "#EEE", true); //gray<br />
configureColor("commentColor", "#EFE", true); //green<br />
configureColor("entityColor", "#DFD", true); //green<br />
configureColor("externalLinkColor", "#EFF", true); //cyan<br />
configureColor("headingColor", "#EEE", true); //gray<br />
configureColor("hrColor", "#EEE", true); //gray<br />
configureColor("listOrIndentColor", "#EFE", true); //green<br />
configureColor("parameterColor", "#FC6", true); //orange<br />
configureColor("signatureColor", "#FC6", true); //orange<br />
configureColor("tagColor", "#FEF", true); //pink<br />
configureColor("tableColor", "#FFC", true); //yellow<br />
configureColor("templateColor", "#FFC", true); //gray <br />
configureColor("templTextTermColor", "#888", true); //gray<br />
configureColor("templTypeTextTermColor", "#888", true); //gray<br />
configureColor("templNewTextTermColor", "#BBB", true); //gray light<br />
configureColor("templTypeNewTextTermColor", "#BBB", true); //gray light<br />
configureColor("templNonRefTermColor", "#FEF", true); //pink<br />
configureColor("templRefNumberColor", "#E9E", true); //pink<br />
configureColor("templNoteColor", "#EFE", true); //green<br />
configureColor("templNoteTermColor", "#484", true); //green<br />
configureColor("templTypeNoteColor", "#7C7", true); //green<br />
configureColor("wikilinkColor", "#EEF", true); //blue<br />
<br />
//tag lists are ordered from most common to least common<br />
syntaxHighlighterConfig.nowikiTags = syntaxHighlighterConfig.nowikiTags || syntaxHighlighterSiteConfig.nowikiTags || ["nowiki", "pre"];<br />
syntaxHighlighterConfig.sourceTags = syntaxHighlighterConfig.sourceTags || syntaxHighlighterSiteConfig.sourceTags || ["math", "syntaxhighlight", "source", "timeline", "hiero"];<br />
syntaxHighlighterConfig.timeout = syntaxHighlighterConfig.timeout || syntaxHighlighterSiteConfig.timeout || 50;<br />
<br />
syntaxHighlighterConfig.nowikiTags.forEach(function(tagName) {<br />
nowikiTagBreakerRegexCache[tagName] = nowikiTagBreakerRegex(tagName);<br />
});<br />
<br />
wpTextbox0 = document.createElement("div");<br />
wpTextbox1 = document.getElementById("wpTextbox1");<br />
<br />
var syntaxStyleElement = document.createElement("style");<br />
syntaxStyleTextNode = syntaxStyleElement.appendChild(document.createTextNode(""));<br />
<br />
//the styling of the textbox and the background div must be kept very similar<br />
var wpTextbox1Style = window.getComputedStyle(wpTextbox1);<br />
<br />
//horizontal resize would look horribly choppy, better to make the user resize the browser window instead<br />
var resize = (wpTextbox1Style.resize == "vertical" || wpTextbox1Style.resize == "both" ? "vertical" : "none");<br />
<br />
wpTextbox0.dir = wpTextbox1.dir;<br />
wpTextbox0.id = "wpTextbox0";<br />
wpTextbox0.lang = wpTextbox1.lang; //lang determines which font "monospace" is<br />
wpTextbox0.style.backgroundColor = syntaxHighlighterConfig.backgroundColor;<br />
wpTextbox0.style.border = "1px solid transparent";<br />
wpTextbox0.style.boxSizing = "border-box";<br />
wpTextbox0.style.clear = wpTextbox1Style.clear;<br />
wpTextbox0.style.color = "transparent"; //makes it look just a little bit smoother<br />
wpTextbox0.style.fontFamily = wpTextbox1Style.fontFamily;<br />
wpTextbox0.style.fontSize = wpTextbox1Style.fontSize;<br />
wpTextbox0.style.lineHeight = "normal";<br />
wpTextbox0.style.marginBottom = "0";<br />
wpTextbox0.style.marginLeft = "0";<br />
wpTextbox0.style.marginRight = "0";<br />
wpTextbox0.style.marginTop = wpTextbox1Style.marginTop;<br />
wpTextbox0.style.overflowX = "auto";<br />
wpTextbox0.style.overflowY = "scroll";<br />
wpTextbox0.style.resize = resize;<br />
wpTextbox0.style.tabSize = wpTextbox1Style.tabSize;<br />
wpTextbox0.style.whiteSpace = "pre-wrap";<br />
wpTextbox0.style.width = "100%";<br />
wpTextbox0.style.wordWrap = "normal"; //see below<br />
<br />
wpTextbox1.style.backgroundColor = "transparent";<br />
wpTextbox1.style.border = "1px inset gray";<br />
wpTextbox1.style.boxSizing = "border-box";<br />
wpTextbox1.style.color = syntaxHighlighterConfig.foregroundColor;<br />
wpTextbox1.style.fontSize = wpTextbox1Style.fontSize; //resolves alignment problems on mobile chrome<br />
wpTextbox1.style.lineHeight = "normal";<br />
wpTextbox1.style.marginBottom = wpTextbox1Style.marginBottom; //lock to pixel value because the top margin was also locked to a pixel value when it was moved to wpTextbox0<br />
wpTextbox1.style.marginLeft = "0";<br />
wpTextbox1.style.marginRight = "0";<br />
wpTextbox1.style.overflowX = "auto";<br />
wpTextbox1.style.overflowY = "scroll";<br />
wpTextbox1.style.padding = "0";<br />
wpTextbox1.style.resize = resize;<br />
wpTextbox1.style.width = "100%";<br />
wpTextbox1.style.wordWrap = "normal"; //overall more visually appealing<br />
<br />
// https://bugzilla.mozilla.org/show_bug.cgi?id=1301290<br />
if (layoutEngine == "gecko")<br />
{<br />
wpTextbox0.style.isolation = "isolate";<br />
wpTextbox1.style.isolation = "isolate";<br />
}<br />
<br />
//lock both heights to pixel values so that the browser zoom feature works better<br />
wpTextbox1.style.height = wpTextbox0.style.height = wpTextbox1.offsetHeight + "px";<br />
<br />
//insert wpTextbox0 underneath wpTextbox1<br />
wpTextbox1.style.marginTop = -wpTextbox1.offsetHeight + "px";<br />
wpTextbox1.parentNode.insertBefore(wpTextbox0, wpTextbox1);<br />
<br />
document.head.appendChild(syntaxStyleElement);<br />
<br />
wpTextbox1.addEventListener("input", highlightSyntax);<br />
//console.log("Box1ListenersyncScroll");<br />
wpTextbox1.addEventListener("scroll", syncScrollX);<br />
wpTextbox1.addEventListener("scroll", syncScrollY);<br />
attributeObserver = new MutationObserver(syncTextDirection);<br />
attributeObserver.observe(wpTextbox1, {attributes: true});<br />
parentObserver = new MutationObserver(syncParent);<br />
parentObserver.observe(wpTextbox1.parentNode, {childList: true});<br />
highlightSyntaxIfNeededIntervalID = setInterval(highlightSyntaxIfNeeded, 500);<br />
highlightSyntax();<br />
}<br />
<br />
<br />
//enable the highlighter only when editing wikitext pages<br />
//in the future a separate parser could be added for CSS and JS pages<br />
//blacklist Internet Explorer and Edge, they're just too broken<br />
var wgAction = mw.config.get("wgAction");<br />
var layoutEngine = $.client.profile().layout;<br />
if ((wgAction == "edit" || wgAction == "submit") && mw.config.get("wgPageContentModel") == "wikitext" && layoutEngine != "trident" && layoutEngine != "edge")<br />
{<br />
//give other scripts an opportunity to set syntaxHighlighterConfig<br />
if (document.readyState == "complete")<br />
{<br />
setup();<br />
}<br />
else<br />
{<br />
$(window).load(setup);<br />
}<br />
}<br />
})();</div>
Nicolas Brouard
http://fr-i.demopaedia.org/w/index.php?title=MediaWiki:Gadgets-definition&diff=11677
MediaWiki:Gadgets-definition
2017-06-15T13:25:34Z
<p>Nicolas Brouard : </p>
<hr />
<div>#Editing<br />
* wikEd[ResourceLoader]|wikEd.js<br />
* refToolbar[ResourceLoader|dependencies=user.options,mediawiki.legacy.wikibits]|refToolbar.js<br />
* refToolbarBase[ResourceLoader|hidden]|refToolbarBase.js<br />
* DotsSyntaxHighlighter[ResourceLoader|default|dependencies=jquery.client]|DotsSyntaxHighlighter.js<br />
<br />
#Interface<br />
* exlinks[ResourceLoader]|exlinks.js<br />
* purgeTab[ResourceLoader]|purgeTab.js<br />
* citations[ResourceLoader]|citations.js</div>
Nicolas Brouard
http://fr-i.demopaedia.org/w/index.php?title=MediaWiki:Gadget-refToolbar.js&diff=11671
MediaWiki:Gadget-refToolbar.js
2017-06-09T09:42:02Z
<p>Nicolas Brouard : Adding TextTerm</p>
<hr />
<div>/**<br />
* RefToolbar<br />
*<br />
* Adds tools for citing references to the edit toolbar.<br />
* See [[Wikipedia:RefToolbar]] for further documentation. One of<br />
* three possible versions will load (Reftoolbar 2.0b, Reftoolbar 2.0a,<br />
* or Reftoolbar 1.0) depending on the user preferences (the<br />
* usebetatoolbar and usebetatoolbar-cgd parameters).<br />
*<br />
* @see: [[Wikipedia:RefToolbar]]<br />
* @see: [[MediaWiki:RefToolbar.js]]<br />
* @see: [[MediaWiki:RefToolbarConfig.js]]<br />
* @see: [[MediaWiki:RefToolbarLegacy.js]]<br />
* @see: [[MediaWiki:RefToolbarMessages-en.js]]<br />
* @see: [[MediaWiki:RefToolbarMessages-de.js]]<br />
* @see: [[MediaWiki:RefToolbarNoDialogs.js]]<br />
* @see: [[MediaWiki:Gadget-refToolbarBase.js]]<br />
* @author: [[User:Mr.Z-man]]<br />
* @author: [[User:Kaldari]]<br />
*/<br />
/*jshint browser: true, camelcase: true, curly: true, eqeqeq: true */<br />
/*global jQuery, mediaWiki, importScript */<br />
( function ( mw, $ ) {<br />
'use strict';<br />
function initializeRefTools() {<br />
if ( window.refToolbarInstalled || $( '#wpTextbox1[readonly]' ).length ){<br />
return;<br />
}<br />
// using weak comparison because ("0") is true, but ("0" == true) is false <br />
if ( mw.user.options.get( 'usebetatoolbar' ) == true ) {<br />
// Enhanced editing toolbar is on. Going to load RefToolbar 2.0a or 2.0b.<br />
if ( mw.user.options.get( 'usebetatoolbar-cgd' ) == true ) {<br />
// Dialogs are on. Loading 2.0b. (standard)<br />
// TODO:<br />
// * Explicitly declare global variables from [[MediaWiki:RefToolbar.js]] using window.*<br />
// * Move [[MediaWiki:RefToolbar.js]] to [[MediaWiki:Gadget-refToolbarDialogs.js]]<br />
// * Create the module 'ext.gadget.refToolbarDialogs' depending on 'ext.gadget.refToolbarBase' and 'ext.wikiEditor.toolbar'<br />
// * Replace the code below by mw.loader.load( 'ext.gadget.refToolbarDialogs' );<br />
mw.loader.using( [ 'ext.gadget.refToolbarBase', 'ext.wikiEditor.toolbar' ], function () {<br />
importScript( 'MediaWiki:RefToolbar.js' );<br />
} );<br />
} else {<br />
// Dialogs are off. Loading 2.0a.<br />
mw.loader.using( 'ext.wikiEditor.toolbar', function () {<br />
importScript( 'MediaWiki:RefToolbarNoDialogsTextTerm.js' );<br />
} );<br />
}<br />
} else if ( mw.user.options.get( 'showtoolbar' ) ) {<br />
// Enhanced editing toolbar is off. Loading RefToolbar 1.0. (legacy)<br />
importScript( 'MediaWiki:RefToolbarLegacy.js' );<br />
} else {<br />
return;<br />
}<br />
window.refToolbarInstalled = true;<br />
}<br />
<br />
if ( $.inArray( mw.config.get( 'wgAction' ), [ 'edit', 'submit' ] ) !== -1 ) {<br />
// Double check if user.options is loaded, to prevent errors when copy pasted accross installations<br />
$.when( mw.loader.using( ['user.options'] ), $.ready ).done( initializeRefTools );<br />
}<br />
<br />
}( mediaWiki, jQuery ) );</div>
Nicolas Brouard
http://fr-i.demopaedia.org/w/index.php?title=MediaWiki:RefToolbarTextTerm.js&diff=11689
MediaWiki:RefToolbarTextTerm.js
2017-06-09T09:41:07Z
<p>Nicolas Brouard : Identical to new RefToolbar.js</p>
<hr />
<div>/*jshint smarttabs:true, loopfunc:true,forin:false*/<br />
/*global mw, $, importScript */<br />
// TODO: make autodate an option in the CiteTemplate object, not a preference<br />
<br />
// Global object<br />
// TODO:<br />
// * Remove this once the page is moved to a module 'ext.gadget.refToolbarDialogs' depending on 'ext.gadget.refToolbarBase'<br />
if (typeof CiteTB === 'undefined') {<br />
var CiteTB = {<br />
"Templates" : {}, // All templates<br />
"Options" : {}, // Global options<br />
"UserOptions" : {}, // User options<br />
"DefaultOptions" : {}, // Script defaults<br />
"ErrorChecks" : {} // Error check functions<br />
};<br />
}<br />
<br />
// Only execute on edit, unless it is a user JS/CSS page<br />
// TODO: Remove tests already done by [[MediaWiki:Gadget-refToolbar.js]]<br />
if (<br />
( mw.config.get('wgAction') === 'edit' || mw.config.get('wgAction') === 'submit' ) &&<br />
( ( mw.config.get('wgNamespaceNumber') !== 2 && mw.config.get('wgNamespaceNumber') !== 4 ) ||<br />
( mw.config.get('wgPageName').indexOf('.js') === -1 && mw.config.get('wgPageName').indexOf('.css') === -1 ) )<br />
) {<br />
<br />
// TODO: Move this to [[MediaWiki:Gadget-refToolbarDialogs.css]] and add it to the definition of module 'ext.gadget.refToolbarDialogs'<br />
mw.util.addCSS(".cite-form-td {"+<br />
"height: 0 !important;"+<br />
"padding: 0.1em !important;"+<br />
"}"); <br />
<br />
// Default options, these mainly exist so the script won't break if a new option is added<br />
CiteTB.DefaultOptions = {<br />
"date format" : "<year>-<zmonth>-<zdate>",<br />
"autodate fields" : [],<br />
"months" : ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],<br />
"modal" : true,<br />
"autoparse" : false,<br />
"expandtemplates": false<br />
};<br />
<br />
// Get an option - user settings override global which override defaults<br />
CiteTB.getOption = function(opt) {<br />
if (CiteTB.UserOptions[opt] !== undefined) {<br />
return CiteTB.UserOptions[opt];<br />
} else if (CiteTB.Options[opt] !== undefined) {<br />
return CiteTB.Options[opt];<br />
}<br />
return CiteTB.DefaultOptions[opt];<br />
};<br />
<br />
CiteTB.init = function() {<br />
/* Main stuff, build the actual toolbar structure<br />
* 1. get the template list, make the dropdown list and set up the template dialog boxes<br />
* 2. actually build the toolbar:<br />
* * A section for cites<br />
* ** dropdown for the templates (previously defined)<br />
* ** button for named refs with a dialog box<br />
* ** button for errorcheck<br />
* 3. add the whole thing to the main toolbar<br />
*/<br />
<br />
if (typeof $('div[rel=cites]')[0] !== 'undefined') { // Mystery IE bug workaround<br />
return;<br />
}<br />
$('head').trigger('reftoolbarbase');<br />
var $target = $('#wpTextbox1');<br />
var temlist = {};<br />
for (var t in CiteTB.Templates) {<br />
var tem = CiteTB.Templates[t];<br />
var sform = CiteTB.escStr(tem.shortform);<br />
var actionobj = { <br />
type: 'dialog',<br />
module: 'cite-dialog-'+sform<br />
};<br />
var dialogobj = {};<br />
dialogobj['cite-dialog-'+sform] = {<br />
resizeme: false,<br />
titleMsg: 'cite-dialog-'+sform, <br />
id: 'citetoolbar-'+sform,<br />
init: function() {}, <br />
html: tem.getInitial(), <br />
dialog: {<br />
width:675,<br />
open: function() { <br />
$(this).html(CiteTB.getOpenTemplate().getForm());<br />
/** @param {jQuery.Event} e */<br />
$('.cite-prev-parse').bind( 'click', function ( e ) {<br />
e.preventDefault();<br />
CiteTB.prevParseClick();<br />
});<br />
},<br />
buttons: {<br />
'cite-form-submit': function() {<br />
var ref = CiteTB.getRef(false, true);<br />
$(this).dialog( 'close' );<br />
$.wikiEditor.modules.toolbar.fn.doAction( $(this).data( 'context' ), {<br />
type: 'encapsulate',<br />
options: {<br />
post: ref<br />
}<br />
}, $(this) );<br />
},<br />
'cite-form-showhide': CiteTB.showHideExtra,<br />
'cite-refpreview': function() { <br />
var ref = CiteTB.getRef(false, false);<br />
var template = CiteTB.getOpenTemplate();<br />
var div = $("#citetoolbar-"+CiteTB.escStr(template.shortform));<br />
div.find('.cite-preview-label').show();<br />
div.find('.cite-ref-preview').text(ref).show();<br />
if (CiteTB.getOption('autoparse')) {<br />
CiteTB.prevParseClick();<br />
} else {<br />
div.find('.cite-prev-parse').show();<br />
div.find('.cite-prev-parsed-label').hide();<br />
div.find('.cite-preview-parsed').html('');<br />
} <br />
},<br />
'wikieditor-toolbar-tool-link-cancel': function() {<br />
$(this).dialog( 'close' );<br />
},<br />
'cite-form-reset': function() {<br />
CiteTB.resetForm();<br />
}<br />
}<br />
} <br />
};<br />
$target.wikiEditor('addDialog', dialogobj);<br />
//if (!CiteTB.getOption('modal')) {<br />
//$('#citetoolbar-'+sform).dialog('option', 'modal', false);<br />
//}<br />
temlist[sform] = {label: tem.templatename, action: actionobj }; <br />
}<br />
<br />
var refsection = {<br />
'sections': {<br />
'cites': { <br />
type: 'toolbar', <br />
labelMsg: 'cite-section-label',<br />
groups: { <br />
'template': {<br />
tools: {<br />
'template': {<br />
type: 'select',<br />
labelMsg: 'cite-template-list',<br />
list: temlist<br />
} <br />
}<br />
},<br />
'namedrefs': {<br />
labelMsg: 'cite-named-refs-label',<br />
tools: {<br />
'nrefs': {<br />
type: 'button',<br />
action: {<br />
type: 'dialog',<br />
module: 'cite-toolbar-namedrefs'<br />
},<br />
icon: '//upload.wikimedia.org/wikipedia/commons/thumb/b/be/Nuvola_clipboard_lined.svg/22px-Nuvola_clipboard_lined.svg.png',<br />
section: 'cites',<br />
group: 'namedrefs',<br />
labelMsg: 'cite-named-refs-button'<br />
}<br />
}<br />
},<br />
'errorcheck': {<br />
labelMsg: 'cite-errorcheck-label',<br />
tools: {<br />
'echeck': {<br />
type: 'button',<br />
action: {<br />
type: 'dialog',<br />
module: 'cite-toolbar-errorcheck' <br />
},<br />
icon: '//upload.wikimedia.org/wikipedia/commons/thumb/a/a3/Nuvola_apps_korganizer-NO.png/22px-Nuvola_apps_korganizer-NO.png',<br />
section: 'cites',<br />
group: 'errorcheck',<br />
labelMsg: 'cite-errorcheck-button'<br />
}<br />
}<br />
}<br />
} <br />
} <br />
} <br />
};<br />
<br />
var defaultdialogs = { <br />
'cite-toolbar-errorcheck': {<br />
titleMsg: 'cite-errorcheck-label',<br />
id: 'citetoolbar-errorcheck',<br />
resizeme: false,<br />
init: function() {},<br />
html: '<div id="cite-namedref-loading">'+<br />
'<img src="//upload.wikimedia.org/wikipedia/commons/4/42/Loading.gif" />'+<br />
'&nbsp;'+mw.usability.getMsg('cite-loading')+'</div>',<br />
dialog: {<br />
width:550,<br />
open: function() { <br />
CiteTB.loadRefs();<br />
},<br />
buttons: {<br />
'cite-errorcheck-submit': function() {<br />
var errorchecks = $("input[name='cite-err-test']:checked");<br />
var errors = [];<br />
for (var i=0; i<errorchecks.length; i++) {<br />
errors = errors.concat(CiteTB.ErrorChecks[$(errorchecks[i]).val()].run());<br />
}<br />
CiteTB.displayErrors(errors);<br />
$(this).dialog( 'close' ); <br />
},<br />
'wikieditor-toolbar-tool-link-cancel': function() {<br />
$(this).dialog( 'close' );<br />
}<br />
}<br />
}<br />
},<br />
'cite-toolbar-namedrefs': {<br />
titleMsg: 'cite-named-refs-title',<br />
resizeme: false,<br />
id: 'citetoolbar-namedrefs',<br />
html: '<div id="cite-namedref-loading">'+<br />
'<img src="//upload.wikimedia.org/wikipedia/commons/4/42/Loading.gif" />'+<br />
'&nbsp;'+mw.usability.getMsg('cite-loading')+'</div>',<br />
init: function() {},<br />
dialog: {<br />
width: 550,<br />
open: function() { <br />
CiteTB.loadRefs();<br />
},<br />
buttons: {<br />
'cite-form-submit': function() {<br />
var refname = $("#cite-namedref-select").val();<br />
if (refname === '') {<br />
return;<br />
}<br />
$(this).dialog( 'close' );<br />
$.wikiEditor.modules.toolbar.fn.doAction( $(this).data( 'context' ), {<br />
type: 'encapsulate',<br />
options: {<br />
post: CiteTB.getNamedRef(refname, true)<br />
}<br />
}, $(this) );<br />
},<br />
'wikieditor-toolbar-tool-link-cancel': function() {<br />
$(this).dialog( 'close' );<br />
} <br />
}<br />
} <br />
}<br />
};<br />
<br />
$target.wikiEditor('addDialog', defaultdialogs);<br />
$('#citetoolbar-namedrefs').unbind('dialogopen');<br />
if (!CiteTB.getOption('modal')) {<br />
//$('#citetoolbar-namedrefs').dialog('option', 'modal', false);<br />
//$('#citetoolbar-errorcheck').dialog('option', 'modal', false);<br />
mw.util.addCSS(".ui-widget-overlay {"+<br />
"display:none !important;"+<br />
"}"); <br />
}<br />
$target.wikiEditor('addToToolbar', refsection);<br />
};<br />
<br />
// Load local data - messages, cite templates, etc.<br />
$(document).ready( function() {<br />
switch( mw.config.get('wgUserLanguage') ) {<br />
case 'de': // German<br />
importScript('MediaWiki:RefToolbarMessages-de.js');<br />
break;<br />
default: // English<br />
importScript('MediaWiki:RefToolbarMessages-en.js');<br />
}<br />
});<br />
<br />
// Setup the main object<br />
CiteTB.mainRefList = [];<br />
CiteTB.refsLoaded = false;<br />
<br />
// REF FUNCTIONS<br />
// Actually assemble a ref from user input<br />
CiteTB.getRef = function(inneronly, forinsert) {<br />
var i;<br />
var template = CiteTB.getOpenTemplate();<br />
var templatename = template.templatename;<br />
var res = '';<br />
var refobj = {'shorttag':false};<br />
if (!inneronly) {<br />
var group = $('#cite-'+CiteTB.escStr(template.shortform)+'-group').val();<br />
var refname = $('#cite-'+CiteTB.escStr(template.shortform)+'-name').val();<br />
res += '<ref';<br />
if (refname) {<br />
refname = $.trim(refname);<br />
res+=' name='+CiteTB.getQuotedString(refname);<br />
refobj.refname = refname;<br />
}<br />
if (group) {<br />
group = $.trim(group);<br />
res+=' group='+CiteTB.getQuotedString(group);<br />
refobj.refgroup = group;<br />
}<br />
res+='>';<br />
}<br />
var content ='{{'+templatename;<br />
for( g in template.incrementables ) {<br />
group = template.incrementables[g];<br />
for (i=1; i<=group.val; i++) {<br />
for (j=0; j<group.fields.length; j++) {<br />
var fieldname = group.fields[j].field;<br />
var fieldid = fieldname.replace('<N>', i.toString());<br />
var field = $('#cite-'+CiteTB.escStr(template.shortform)+'-'+fieldid).val();<br />
if (field) {<br />
content+='|'+fieldid+'=';<br />
content+= $.trim(field);<br />
}<br />
}<br />
}<br />
}<br />
for( i=0; i<template.basic.length; i++ ) {<br />
if (template.basic[i].increment_group) {<br />
continue;<br />
}<br />
var fieldname = template.basic[i].field;<br />
var field = $('#cite-'+CiteTB.escStr(template.shortform)+'-'+fieldname).val();<br />
if (field) {<br />
content+='|'+fieldname+'=';<br />
content+= $.trim(field);<br />
}<br />
}<br />
if ($('#cite-form-status').val() !== 'closed') {<br />
for( i=0; i<template.extra.length; i++ ) {<br />
if (template.extra[i].increment_group) {<br />
continue;<br />
}<br />
var fieldname = template.extra[i].field;<br />
var field = $('#cite-'+CiteTB.escStr(template.shortform)+'-'+fieldname).val();<br />
if (field) {<br />
content+='|'+fieldname+'=';<br />
content+= $.trim(field);<br />
}<br />
}<br />
}<br />
content+= '}}';<br />
res+=content;<br />
refobj.content = content;<br />
if (!inneronly) {<br />
res+= '</ref>';<br />
}<br />
if (forinsert) {<br />
CiteTB.mainRefList.push(refobj);<br />
}<br />
return res;<br />
};<br />
<br />
// Make a reference to a named ref<br />
CiteTB.getNamedRef = function(refname, forinsert) {<br />
if (forinsert) {<br />
CiteTB.mainRefList.push( {'shorttag':true, 'refname':refname} );<br />
}<br />
return '<ref name='+CiteTB.getQuotedString(refname)+' />'; <br />
};<br />
<br />
// Function to load the ref list<br />
CiteTB.loadRefs = function() {<br />
if (CiteTB.refsLoaded) {<br />
return;<br />
}<br />
CiteTB.getPageText(CiteTB.loadRefsInternal);<br />
};<br />
<br />
// Function that actually loads the list from the page text<br />
CiteTB.loadRefsInternal = function(text) { <br />
// What this does: extract first name/group extract second name/group shorttag inner content<br />
var refsregex = /< *ref(?: +(name|group) *= *(?:"([^"]*?)"|'([^']*?)'|([^ '"\/\>]*?)) *)? *(?: +(name|group) *= *(?:"([^"]*?)"|'([^']*?)'|([^ '"\/\>]*?)) *)? *(?:\/ *>|>((?:.|\n)*?)< *\/ *ref *>)/gim;<br />
// This should work regardless of the quoting used for names/groups and for linebreaks in the inner content <br />
while (true) {<br />
var ref = refsregex.exec(text);<br />
if (ref === null) {<br />
break;<br />
}<br />
var refobj = {};<br />
if (ref[9]) { // Content + short tag check<br />
//alert('"'+ref[9]+'"');<br />
refobj.content = ref[9]; <br />
refobj.shorttag = false;<br />
} else {<br />
refobj.shorttag = true;<br />
}<br />
if (ref[1] !== '') { // First name/group<br />
if (ref[2]) {<br />
refobj['ref'+ref[1]] = ref[2];<br />
} else if (ref[3]) {<br />
refobj['ref'+ref[1]] = ref[3];<br />
} else {<br />
refobj['ref'+ref[1]] = ref[4];<br />
}<br />
}<br />
if (ref[5] !== '') { // Second name/group<br />
if (ref[6]) {<br />
refobj['ref'+ref[5]] = ref[6];<br />
} else if (ref[7]) {<br />
refobj['ref'+ref[5]] = ref[7];<br />
} else {<br />
refobj['ref'+ref[5]] = ref[8];<br />
}<br />
}<br />
CiteTB.mainRefList.push(refobj);<br />
}<br />
CiteTB.refsLoaded = true;<br />
CiteTB.setupErrorCheck();<br />
CiteTB.setupNamedRefs();<br />
};<br />
<br />
// AJAX FUNCTIONS<br />
// Parse some wikitext and hand it off to a callback function<br />
CiteTB.parse = function(text, callback) {<br />
$.post( mw.util.wikiScript( 'api' ),<br />
{action:'parse', title:mw.config.get('wgPageName'), text:text, prop:'text', format:'json'},<br />
function(data) {<br />
var html = data.parse.text['*'];<br />
callback(html);<br />
},<br />
'json'<br />
); <br />
};<br />
<br />
// Use the API to expand templates on some text<br />
CiteTB.expandtemplates = function(text, callback) {<br />
$.post( mw.util.wikiScript( 'api' ),<br />
{action:'expandtemplates', title:mw.config.get('wgPageName'), text:text, format:'json'},<br />
function(data) {<br />
var restext = data.expandtemplates['*'];<br />
callback(restext);<br />
},<br />
'json'<br />
);<br />
};<br />
<br />
// Function to get the page text<br />
CiteTB.getPageText = function(callback) {<br />
var section = $("input[name='wpSection']").val();<br />
if ( section !== '' ) {<br />
var postdata = {action:'query', prop:'revisions', rvprop:'content', pageids:mw.config.get('wgArticleId'), format:'json'};<br />
if (CiteTB.getOption('expandtemplates')) {<br />
postdata.rvexpandtemplates = '1';<br />
}<br />
$.get( mw.util.wikiScript( 'api' ),<br />
postdata,<br />
function(data) {<br />
var pagetext = data.query.pages[mw.config.get('wgArticleId').toString()].revisions[0]['*'];<br />
callback(pagetext);<br />
},<br />
'json'<br />
);<br />
} else {<br />
if (CiteTB.getOption('expandtemplates')) {<br />
CiteTB.expandtemplates($('#wpTextbox1').wikiEditor('getContents').text(), callback);<br />
} else {<br />
callback($('#wpTextbox1').wikiEditor('getContents').text());<br />
}<br />
}<br />
};<br />
<br />
// Autofill a template from an ID (ISBN, DOI, PMID, URL)<br />
CiteTB.initAutofill = function() {<br />
var elemid = $(this).attr('id');<br />
var res = /^cite\-auto\-(.*?)\-(.*)\-(.*)$/.exec(elemid);<br />
var tem = res[1];<br />
var field = res[2];<br />
var autotype = res[3];<br />
var id = $('#cite-'+tem+'-'+field).val();<br />
if (!id) {<br />
return false;<br />
}<br />
var url = '//tools.wmflabs.org/reftoolbar/lookup.php?';<br />
url+=autotype+'='+encodeURIComponent(id);<br />
url+='&template='+encodeURIComponent(tem);<br />
var s = document.createElement('script');<br />
s.setAttribute('src', url);<br />
s.setAttribute('type', 'text/javascript');<br />
document.getElementsByTagName('head')[0].appendChild(s);<br />
return false;<br />
};<br />
<br />
// Callback for autofill<br />
//TODO: Autofill the URL, at least for DOI<br />
CiteTB.autoFill = function(data, template, type) {<br />
var cl = 'cite-'+template+'-';<br />
var i,j, coauthors;<br />
$('.'+cl+'title').val(data.title);<br />
// Fill in authors<br />
if (data.authors && data.authors.length > 0) {<br />
if ($('.'+cl+'last-incr-1').length != 0) {<br />
var classes = $('.'+cl+'last-incr-1').eq(0).attr('class').split(/\s+/);<br />
var group = false;<br />
var patt = /cite-[^-]*?-incr-(.*)/<br />
for (var c=0; c<classes.length; c++) {<br />
if (patt.exec(classes[c])) {<br />
group = patt.exec(classes[c])[1];<br />
break;<br />
}<br />
}<br />
$('.'+cl+'last-incr-1').val(data.authors[0][0])<br />
$('.'+cl+'first-incr-1').val(data.authors[0][1])<br />
elemid = '#cite-incr-'+template+'-'+group;<br />
for (var i=2; i<data.authors.length+1; i++) {<br />
$(elemid).click();<br />
$('.'+cl+'last-incr-'+i.toString()).val(data.authors[i-1][0])<br />
$('.'+cl+'first-incr-'+i.toString()).val(data.authors[i-1][1])<br />
}<br />
} else if ($('.'+cl+'author-incr-1').length != 0) {<br />
var classes = $('.'+cl+'author-incr-1').eq(0).attr('class').split(/\s+/);<br />
var group = false;<br />
var patt = /cite-[^-]*?-incr-(.*)/<br />
for (var c=0; c<classes.length; c++) {<br />
if (patt.exec(classes[c])) {<br />
group = patt.exec(classes[c])[1];<br />
break;<br />
}<br />
}<br />
$('.'+cl+'author-incr-1').val(data.authors[0].join(', '))<br />
elemid = '#cite-incr-'+template+'-'+group;<br />
for (var i=2; i<data.authors.length+1; i++) {<br />
$(elemid).click();<br />
$('.'+cl+'author-incr-'+i.toString()).val(data.authors[i-1].join(', '))<br />
}<br />
} else if ($('.'+cl+'last1').length != 0) {<br />
for(i=0; data.authors && i<data.authors.length; i++) {<br />
if ($('.'+cl+'last'+(i+1)).length) {<br />
$('.'+cl+'last'+(i+1)).val(data.authors[i][0]);<br />
$('.'+cl+'first'+(i+1)).val(data.authors[i][1]);<br />
} else {<br />
coauthors = [];<br />
for(j=i; j<data.authors.length; j++) {<br />
coauthors.push(data.authors[j].join(', '));<br />
}<br />
$('.'+cl+'coauthors').val(coauthors.join('; '));<br />
break;<br />
}<br />
}<br />
} else if($('.'+cl+'author1').length !== 0) {<br />
for(i=0; data.authors && i<data.authors.length; i++) {<br />
if ($('.'+cl+'author'+(i+1)).length) {<br />
$('.'+cl+'author'+(i+1)).val(data.authors[i].join(', '));<br />
} else {<br />
coauthors = [];<br />
for(j=i; j<data.authors.length; j++) {<br />
coauthors.push(data.authors[j].join(', '));<br />
}<br />
$('.'+cl+'coauthors').val(coauthors.join('; '));<br />
break;<br />
}<br />
}<br />
} else {<br />
var authors = [];<br />
for(i=0; data.authors && i<data.authors.length; i++) {<br />
authors.push(data.authors[i].join(', '));<br />
}<br />
$('.'+cl+'authors').val(authors.join('; '));<br />
}<br />
}<br />
<br />
if (type === 'pmid' || type === 'doi') {<br />
if (data.date && (data.fulldate || !$('.'+cl+'month').length)) {<br />
var DT = new Date(data.date);<br />
var useday = /\d{4}-\d{2}-\d{2}/.test(data.date);<br />
var usemonth = /\d{4}-\d{2}/.test(data.date);<br />
$('.'+cl+'date').val(CiteTB.formatDate(DT, useday, usemonth));<br />
} else if (!data.fulldate && $('.'+cl+'month').length && $('.'+cl+'year').length) {<br />
if (data.month) { // lookup.php sets month to false if it isn't provided<br />
$('.'+cl+'month').val( CiteTB.getOption('months')[parseInt(data.month)-1] );<br />
}<br />
$('.'+cl+'year').val(data.year);<br />
} else {<br />
$('.'+cl+'date').val(data.date);<br />
}<br />
$('.'+cl+'journal').val(data.journal);<br />
$('.'+cl+'volume').val(data.volume);<br />
$('.'+cl+'issue').val(data.issue);<br />
$('.'+cl+'pages').val(data.pages);<br />
} else if (type === 'isbn') {<br />
$('.'+cl+'publisher').val(data.publisher);<br />
$('.'+cl+'location').val(data.location);<br />
$('.'+cl+'year').val(data.year);<br />
$('.'+cl+'edition').val(data.edition);<br />
} else if (type === 'url') {<br />
if (data.date) {<br />
var DT = new Date(data.date);<br />
var useday = /\d{4}-\d{2}-\d{2}/.test(data.date) && template !== 'book';<br />
var usemonth = /\d{4}-\d{2}/.test(data.date) && template !== 'book';<br />
var yearOrDate = (template === 'book') ? 'year' : 'date';<br />
$('.'+cl+yearOrDate).val(CiteTB.formatDate(DT, useday, usemonth));<br />
}<br />
$('.'+cl+'journal').val(data.journal);<br />
$('.'+cl+'volume').val(data.volume);<br />
$('.'+cl+'issue').val(data.issue);<br />
$('.'+cl+'pages').val(data.pages);<br />
$('.'+cl+'publisher').val(data.publisher);<br />
$('.'+cl+'edition').val(data.edition);<br />
$('.'+cl+'isbn').val(data.isbn);<br />
$('.'+cl+'issn').val(data.issn);<br />
$('.'+cl+'doi').val(data.doi);<br />
// "en-US" isn't a valid value for the language parameter<br />
if (data.language && data.language !== 'en-US' && data.language !== 'en-GB') {<br />
$('.'+cl+'language').val(data.language);<br />
}<br />
$('.'+cl+'chapter').val(data.chapter);<br />
}<br />
};<br />
<br />
// FORM DIALOG FUNCTIONS<br />
// Add new incrementable fields<br />
CiteTB.incrementFields = function() {<br />
template = CiteTB.getOpenTemplate();<br />
var currentrow = $(this).parents('tr')[0];<br />
$(this).prev().css('width', '100%')<br />
$(this).detach();<br />
var elemid = $(this).attr('id');<br />
var res = /^cite\-incr\-(.*?)\-(.*)$/.exec(elemid);<br />
group = res[2];<br />
increments = template.incrementables[group];<br />
fields = increments.fields;<br />
incrval = increments.val+1;<br />
template.incrementables[group].val += 1;<br />
trs = template.makeFormInner(fields, false);<br />
trs.reverse();<br />
for (var i=0; i<trs.length; i++) {<br />
$(currentrow).after(trs[i]);<br />
}<br />
};<br />
<br />
// fill the accessdate param with the current date<br />
CiteTB.fillAccessdate = function() {<br />
var elemid = $(this).attr('id');<br />
var res = /^cite\-date\-(.*?)\-(.*)$/.exec(elemid);<br />
var id = res[1];<br />
var field = res[2];<br />
var DT = new Date();<br />
var datestr = CiteTB.formatDate(DT);<br />
$('#cite-'+id+'-'+field).val(datestr);<br />
return false;<br />
};<br />
<br />
CiteTB.formatDate = function(DT, useday, usemonth) {<br />
if (typeof useday == "undefined") {<br />
useday = true; <br />
}<br />
if (typeof usemonth == "undefined") {<br />
usemonth = true; <br />
}<br />
var datestr = CiteTB.getOption('date format');<br />
var zmonth = '';<br />
var month = DT.getUTCMonth()+1;<br />
if (month < 10) {<br />
zmonth = "0"+month.toString();<br />
} else {<br />
zmonth = month.toString();<br />
}<br />
month = month.toString();<br />
var zdate = '';<br />
var date = DT.getUTCDate();<br />
if (date < 10) {<br />
zdate = "0"+date.toString();<br />
} else {<br />
zdate = date.toString();<br />
}<br />
date = date.toString();<br />
if (useday) {<br />
datestr = datestr.replace('<date>', date);<br />
datestr = datestr.replace('<zdate>', zdate);<br />
} else {<br />
datestr = datestr.replace('<date>', '');<br />
datestr = datestr.replace('<zdate>', '');<br />
}<br />
if (usemonth) {<br />
datestr = datestr.replace('<month>', month);<br />
datestr = datestr.replace('<zmonth>', zmonth);<br />
datestr = datestr.replace('<monthname>', CiteTB.getOption('months')[DT.getUTCMonth()]);<br />
} else {<br />
datestr = datestr.replace('<month>', '');<br />
datestr = datestr.replace('<zmonth>', '');<br />
datestr = datestr.replace('<monthname>', '');<br />
} <br />
datestr = datestr.replace('<year>', DT.getUTCFullYear().toString());<br />
return datestr.replace(/^[ \/\-\,\.]*(.*?)[ \/\-\,\.]*$/g, "$1"); // Cleanup any dangling spaces or connectors that might result from omitting date/month<br />
};<br />
<br />
// Function called after the ref list is loaded, to actually set the contents of the named ref dialog<br />
// Until the list is loaded, its just a "Loading" placeholder<br />
CiteTB.setupNamedRefs = function() {<br />
var names = [], i;<br />
for( i=0; i<CiteTB.mainRefList.length; i++) {<br />
if (!CiteTB.mainRefList[i].shorttag && CiteTB.mainRefList[i].refname) {<br />
names.push(CiteTB.mainRefList[i]);<br />
}<br />
}<br />
var stuff = $('<div>');<br />
$('#citetoolbar-namedrefs').html( stuff );<br />
if (names.length === 0) {<br />
stuff.html(mw.usability.getMsg('cite-no-namedrefs'));<br />
} else {<br />
stuff.html(mw.usability.getMsg('cite-namedrefs-intro'));<br />
var select = $('<select id="cite-namedref-select">');<br />
select.append($('<option value="" />').text(mw.usability.getMsg('cite-named-refs-dropdown')));<br />
for(i=0; i<names.length; i++) {<br />
select.append($('<option />').text(names[i].refname));<br />
}<br />
stuff.after(select);<br />
select.before('<br />'); <br />
var prevlabel = $('<div id="cite-nref-preview-label" style="display:none;" />').html(mw.usability.getMsg('cite-raw-preview'));<br />
select.after(prevlabel);<br />
prevlabel.before("<br /><br />");<br />
prevlabel.after('<div id="cite-namedref-preview" style="padding:0.5em; font-size:110%" />');<br />
var parselabel = $('<span id="cite-parsed-label" style="display:none;" />').html(mw.usability.getMsg('cite-parsed-label'));<br />
$('#cite-namedref-preview').after(parselabel);<br />
parselabel.after('<div id="cite-namedref-parsed" style="padding-bottom:0.5em; font-size:110%" />');<br />
var link = $('<a href="#" id="cite-nref-parse" style="margin:0 1em 0 1em; display:none; color:darkblue" />');<br />
link.html(mw.usability.getMsg('cite-form-parse'));<br />
$('#cite-namedref-parsed').after(link);<br />
<br />
$("#cite-namedref-select").bind( 'change', CiteTB.namedRefSelectClick);<br />
$('#cite-nref-parse').bind( 'click', CiteTB.nrefParseClick);<br />
} <br />
};<br />
<br />
// Function to get the errorcheck form HTML<br />
CiteTB.setupErrorCheck = function() {<br />
var form = $('<div id="cite-errorcheck-heading" />').html(mw.usability.getMsg('cite-errorcheck-heading'));<br />
var ul = $("<ul id='cite-errcheck-list' />");<br />
var test;<br />
for (var t in CiteTB.ErrorChecks) {<br />
test = CiteTB.ErrorChecks[t];<br />
ul.append(test.getRow());<br />
}<br />
form.append(ul);<br />
$('#citetoolbar-errorcheck').html(form);<br />
};<br />
<br />
// Callback function for parsed preview<br />
CiteTB.fillNrefPreview = function(parsed) {<br />
$('#cite-parsed-label').show();<br />
$('#cite-namedref-parsed').html(parsed);<br />
};<br />
<br />
// Click handler for the named-ref parsed preview<br />
CiteTB.nrefParseClick = function() {<br />
var choice = $("#cite-namedref-select").val();<br />
if (choice === '') {<br />
$('#cite-parsed-label').hide();<br />
$('#cite-namedref-parsed').text('');<br />
return false;<br />
}<br />
$('#cite-nref-parse').hide();<br />
for( var i=0; i<CiteTB.mainRefList.length; i++) {<br />
if (!CiteTB.mainRefList[i].shorttag && CiteTB.mainRefList[i].refname == choice) {<br />
CiteTB.parse(CiteTB.mainRefList[i].content, CiteTB.fillNrefPreview);<br />
return false;<br />
}<br />
} <br />
};<br />
<br />
// Click handler for the named-ref dropdown<br />
CiteTB.lastnamedrefchoice = '';<br />
CiteTB.namedRefSelectClick = function() {<br />
var choice = $("#cite-namedref-select").val();<br />
if (CiteTB.lastnamedrefchoice == choice) {<br />
return;<br />
}<br />
CiteTB.lastnamedrefchoice = choice;<br />
$('#cite-parsed-label').hide();<br />
$('#cite-namedref-parsed').text('');<br />
if (choice === '') {<br />
$('#cite-nref-preview-label').hide();<br />
$('#cite-namedref-preview').text('');<br />
$('#cite-nref-parse').hide();<br />
return;<br />
}<br />
for( var i=0; i<CiteTB.mainRefList.length; i++) {<br />
if (!CiteTB.mainRefList[i].shorttag && CiteTB.mainRefList[i].refname == choice) {<br />
$('#cite-nref-preview-label').show();<br />
$('#cite-namedref-preview').text(CiteTB.mainRefList[i].content);<br />
if (CiteTB.getOption('autoparse')) {<br />
CiteTB.nrefParseClick();<br />
} else {<br />
$('#cite-nref-parse').show();<br />
}<br />
}<br />
}<br />
};<br />
<br />
// callback function for parsed preview<br />
CiteTB.fillTemplatePreview = function(text) {<br />
var template = CiteTB.getOpenTemplate();<br />
var div = $("#citetoolbar-"+CiteTB.escStr(template.shortform));<br />
div.find('.cite-prev-parsed-label').show();<br />
div.find('.cite-preview-parsed').html(text);<br />
};<br />
<br />
// Click handler for template parsed preview<br />
CiteTB.prevParseClick = function() {<br />
var ref = CiteTB.getRef(true, false);<br />
var template = CiteTB.getOpenTemplate();<br />
var div = $("#citetoolbar-"+CiteTB.escStr(template.shortform));<br />
div.find('.cite-prev-parse').hide();<br />
CiteTB.parse(ref, CiteTB.fillTemplatePreview);<br />
};<br />
<br />
// Show/hide the extra fields in the dialog box<br />
CiteTB.showHideExtra = function() {<br />
var template = CiteTB.getOpenTemplate();<br />
var div = $("#citetoolbar-"+CiteTB.escStr(template.shortform));<br />
var setting = div.find(".cite-form-status").val();<br />
if ( setting === 'closed' ) {<br />
div.find(".cite-form-status").val('open');<br />
div.find('.cite-extra-fields').show(1, function() {<br />
// jQuery adds "display:block", which screws things up<br />
div.find('.cite-extra-fields').attr('style', 'width:100%; background-color:transparent;'); <br />
});<br />
} else {<br />
div.find(".cite-form-status").val('closed');<br />
div.find('.cite-extra-fields').hide();<br />
} <br />
};<br />
<br />
// Resets form fields and previews<br />
// Resets form fields and previews<br />
CiteTB.resetForm = function() {<br />
var template = CiteTB.getOpenTemplate();<br />
var div = $("#citetoolbar-"+CiteTB.escStr(template.shortform));<br />
div.html(template.getForm());<br />
};<br />
<br />
// STRING UTILITY FUNCTIONS<br />
// Returns a string quoted as necessary for name/group attributes<br />
CiteTB.getQuotedString = function(s) {<br />
var sq = /\'/.test(s); // single quotes<br />
var dq = /\"/.test(s); // double quotes<br />
if (!sq && !dq) { // Always quotes for non-latin alphabet<br />
return '"'+s+'"';<br />
} else if (!dq) { // Can use double quotes<br />
return '"'+s+'"';<br />
} else if (!sq) { // Can use single quotes<br />
return "'"+s+"'";<br />
} else { // Has double and single quotes<br />
s = s.replace(/\"/g, '\'');<br />
return '"'+s+'"';<br />
}<br />
};<br />
<br />
// Fix up strings for output - capitalize first char, replace underscores with spaces<br />
CiteTB.fixStr = function(s) {<br />
s = s.slice(0,1).toUpperCase() + s.slice(1);<br />
s = s.replace('_',' ');<br />
return s;<br />
};<br />
<br />
// Escape spaces and quotes for use in HTML classes/ids<br />
CiteTB.escStr = function(s) {<br />
return s.replace(' ', '-').replace("'", "\'").replace('"', '\"');<br />
};<br />
<br />
// MISC FUNCTIONS<br />
// Determine which template form is open, and get the template object for it<br />
CiteTB.getOpenTemplate = function() {<br />
var dialogs = $(".ui-dialog-content.ui-widget-content:visible");<br />
var templatename = $(dialogs[0]).find(".cite-template").val();<br />
return CiteTB.Templates[templatename];<br />
};<br />
<br />
// Display the report for the error checks<br />
CiteTB.displayErrors = function(errors) {<br />
$('#cite-err-report').remove();<br />
var table = $('<table id="cite-err-report" style="width:100%; border:1px solid #A9A9A9; background-color:#FFEFD5; padding:0.25em; margin-top:0.5em" />');<br />
$('#editpage-copywarn').before(table);<br />
var tr;<br />
var tr1 = $('<tr style="width:100%" />');<br />
var th1 = $('<th style="width:60%; font-size:110%" />').html(mw.usability.getMsg('cite-err-report-heading'));<br />
var th2 = $('<th style="text-align:right; width:40%" />');<br />
var im = $('<img />').attr('src', '//upload.wikimedia.org/wikipedia/commons/thumb/5/55/Gtk-stop.svg/20px-Gtk-stop.svg.png');<br />
im.attr('alt', mw.usability.getMsg('cite-err-report-close')).attr('title', mw.usability.getMsg('cite-err-report-close'));<br />
var ad = $('<a id="cite-err-check-close" />').attr('href', '#');<br />
ad.append(im);<br />
th2.append(ad);<br />
tr1.append(th1).append(th2);<br />
table.append(tr1);<br />
$('#cite-err-check-close').bind('click', function() { $('#cite-err-report').remove(); });<br />
if (errors.length === 0) {<br />
tr = $('<tr style="width:100%;" />');<br />
var td = $('<td style="text-align:center; margin:1.5px;" />').html(mw.usability.getMsg('cite-err-report-empty'));<br />
tr.append(td);<br />
table.append(tr);<br />
<br />
return;<br />
}<br />
for(var e in errors) {<br />
var err = errors[e];<br />
tr = $('<tr style="width:100%;" />');<br />
var td1 = $('<td style="border: 1px solid black; margin:1.5px; width:60%" />').html(err.err);<br />
var td2 = $('<td style="border: 1px solid black; margin:1.5px; width:40%" />').html(mw.usability.getMsg(err.msg));<br />
tr.append(td1).append(td2);<br />
table.append(tr);<br />
}<br />
};<br />
<br />
} // End of code loaded only on edit</div>
Nicolas Brouard
http://fr-i.demopaedia.org/w/index.php?title=MediaWiki:RefToolbarNoDialogsTextTerm.js&diff=11669
MediaWiki:RefToolbarNoDialogsTextTerm.js
2017-06-09T09:28:43Z
<p>Nicolas Brouard : New mw28 version</p>
<hr />
<div>var numforms = 0;<br />
var wikEdAutoUpdateUrl;<br />
function refbuttons() {<br />
if (mw.toolbar && (document.getElementById('toolbar') || document.getElementById('wikiEditor-section-main'))/* && wikEdAutoUpdateUrl == null*/) {<br />
if (document.getElementById('toolbar')) {<br />
button = document.createElement('a');<br />
button.href = "javascript:easyCiteMain()";<br />
button.title = "Insert citation";<br />
buttonimage = document.createElement('img');<br />
buttonimage.src = "//upload.wikimedia.org/wikipedia/commons/0/00/Button_easy_cite_%281%29.png";<br />
buttonimage.alt = "Insert footnote";<br />
button.appendChild(buttonimage);<br />
document.getElementById('toolbar').appendChild(button);<br />
} else {<br />
button = document.createElement('a');<br />
button.href = "#";<br />
button.title = "Insert citation";<br />
button.id = 'reftoolbar-button';<br />
buttonimage = document.createElement('img');<br />
buttonimage.src = "//upload.wikimedia.org/wikipedia/commons/thumb/9/9a/Curly_Brackets.svg/22px-Curly_Brackets.svg.png";<br />
buttonimage.alt = "Insert citation";<br />
button.classname = "tool tool-button";<br />
buttonimage.style.width = "22px";<br />
buttonimage.style.height = "17px";<br />
buttonimage.style.paddingTop = "5px";<br />
buttonimage.style.paddingLeft = "3px";<br />
button.appendChild(buttonimage);<br />
//document.getElementById('wikiEditor-ui-toolbar').childNodes[0].childNodes[1].appendChild(button);<br />
////document.getElementById('reftoolbar-button').onclick = easyCiteMain;<br />
//$j('#reftoolbar-button').live('click', function() { easyCiteMain(); });<br />
$('#wikiEditor-section-main .group-insert').append( button );<br />
$(button).click( function() { easyCiteMain(); });<br />
<br />
}<br />
if (navigator.userAgent.indexOf('MSIE') == -1) {<br />
//alert("NO MSIE");<br />
citemain = document.createElement('div');<br />
citemain.style.display = 'none';<br />
citemain.setAttribute('Id', 'citeselect');<br />
citemain.appendChild( addOption("citeWeb()", "Cite web") );<br />
citemain.appendChild( addOption("citeBook()", "Cite book") );<br />
citemain.appendChild( addOption("citeJournal()", "Cite journal") );<br />
citemain.appendChild( addOption("citeNews()", "Cite news") );<br />
citemain.appendChild( addOption("citeNamedRef()", "Named ref") );<br />
citemain.appendChild( addOption("dispErrors()", "Error check") );<br />
citemain.appendChild( addOption("hideInitial()", "Cancel") );<br />
citemain.appendChild( addOption("textTerm()", "TextTerm") );<br />
document.getElementById('wpTextbox1').parentNode.insertBefore(citemain, document.getElementById('wpTextbox1'));<br />
}<br />
else {<br />
selection = '<div id="citeselect" style="display:none"><input type="button" value="Cite web" onclick="citeWeb()" />'+<br />
'<input type="button" value="Cite book" onclick="citeBook()" />'+<br />
'<input type="button" value="Cite journal" onclick="citeJournal()" />'+<br />
'<input type="button" value="Cite news" onclick="citeNews()" />'+<br />
'<input type="button" value="Named ref" onclick="citeNamedRef()" />'+<br />
'<input type="button" value="Error check" onclick="dispErrors()" />'+<br />
'<input type="button" value="Cancel" onclick="hideInitial()" />'+<br />
'<input type="button" value="TextTerm" onclick="textTerm()" /></div>';<br />
document.getElementById('editform').innerHTML = selection + document.getElementById('editform').innerHTML;<br />
}<br />
}<br />
}<br />
<br />
function addOption(script, text) {<br />
option = document.createElement('input');<br />
option.setAttribute('type', 'button');<br />
option.setAttribute('onclick', script);<br />
option.setAttribute("value", text);<br />
return option;<br />
}<br />
<br />
function hideInitial() {<br />
document.getElementById('citeselect').style.display = 'none';<br />
oldFormHide();<br />
}<br />
<br />
function oldFormHide() {<br />
if (numforms != 0) {<br />
document.getElementById('citediv'+numforms).style.display = 'none';<br />
}<br />
if (document.getElementById('errorform') != null) {<br />
document.getElementById('citeselect').removeChild(document.getElementById('errorform'));<br />
}<br />
} <br />
<br />
function easyCiteMain() {<br />
document.getElementById('citeselect').style.display = '';<br />
}<br />
<br />
var months = ['January', 'February', 'March', 'April', 'May', 'June',<br />
'July', 'August', 'September', 'October', 'November', 'December'];<br />
var citeGlobalDateFormat = "<date> <monthname> <year>";<br />
function getTime() {<br />
var datestr = '';<br />
if (typeof citeUserDateFormat != 'undefined') {<br />
datestr = citeUserDateFormat;<br />
} else {<br />
datestr = citeGlobalDateFormat;<br />
}<br />
var DT = new Date();<br />
var zmonth = '';<br />
var month = DT.getUTCMonth()+1;<br />
if (month < 10) {<br />
zmonth = "0"+month.toString();<br />
} else {<br />
zmonth = month.toString();<br />
}<br />
month = month.toString();<br />
var zdate = '';<br />
var date = DT.getUTCDate()<br />
if (date < 10) {<br />
zdate = "0"+date.toString();<br />
} else {<br />
zdate = date.toString();<br />
}<br />
date = date.toString()<br />
datestr = datestr.replace('<date>', date);<br />
datestr = datestr.replace('<month>', month);<br />
datestr = datestr.replace('<zdate>', zdate);<br />
datestr = datestr.replace('<zmonth>', zmonth);<br />
datestr = datestr.replace('<monthname>', months[DT.getUTCMonth()]);<br />
datestr = datestr.replace('<year>', DT.getUTCFullYear().toString());<br />
return (datestr);<br />
}<br />
<br />
function citeWeb() {<br />
citeNewsWeb("cite web");<br />
}<br />
function citeNews() {<br />
citeNewsWeb("cite news");<br />
}<br />
<br />
function textTerm() {<br />
textTermf();<br />
} <br />
<br />
var texttermall = new Array();<br />
var texttermcur = new Array();<br />
var textterminput = new Array();<br />
var poffset=null, prange=null, noffset=null, nrange=null;<br />
var section = '';<br />
var subnote = '';<br />
<br />
function textTermf() {<br />
textTermform(null,null);<br />
}<br />
<br />
function nexttextterm() {<br />
//console.log("nexttexterm before noffset :" + noffset + " nrange=" + nrange);<br />
savetextterms(); // Save if changed<br />
if(noffset){ // If there is a next<br />
textTermform(noffset, nrange); // Call with offset !{{TextTerm }}<br />
}<br />
}<br />
function previoustextterm() {<br />
//console.log("previoustexterm before poffset :" + poffset + " prange=" + prange);<br />
savetextterms();<br />
if(poffset){ // If there is a next<br />
textTermform(poffset, prange); // Call with offset !{{TextTerm }}<br />
}<br />
}<br />
<br />
<br />
<br />
function texttermfill(subtext) {<br />
var ref = new Array();<br />
this.term = '';<br />
this.note= '';<br />
this.section= '';<br />
if(section != '')<br />
this.section = section;<br />
this.subnote = '';<br />
if(subnote != '')<br />
this.subnote = subnote;<br />
this.englishentry= '';<br />
this.indexentry= '';<br />
this.otherindexentry = '';<br />
this.otherindexentrytwo = '';<br />
this.otherindexentrythree = '';<br />
this.otherindexentryfour = '';<br />
this.otherindexentryfive = '';<br />
<br />
var j=0;<br />
var nr=true;<br />
regexbar= /\|([^|]*)/gm <br />
//regexbar =/\|((.)*?)(?=[\||\n])/gm //"|programmes de population|1|933|IndexEntry=programme de population|OtherIndexEntry=population, programme de"<br />
do {<br />
ref = regexbar.exec(subtext);<br />
//console.log(" subtext=" + subtext);<br />
//console.log(" ref=" + ref);<br />
if(ref != null){<br />
switch (j)<br />
{<br />
case 0 : this.term = ref[1]; break;<br />
case 1 : this.note = ref[1]; break;<br />
case 2 : this.section = ref[1]; break;<br />
default :<br />
if(ref[1].match(/^ *?EnglishEntry *?= *?(.*) *?$/))<br />
this.englishentry = ref[1].replace(/^ *?EnglishEntry *?= *?(.*) *?$/,"$1");<br />
else if(ref[1].match(/^ *?IndexEntry *?= *?(.*) *?$/))<br />
this.indexentry = ref[1].replace(/^ *?IndexEntry *?= *?(.*) *?$/,"$1");<br />
else if(ref[1].match(/^ *?OtherIndexEntry *?= *?(.*) *?$/))<br />
this.otherindexentry = ref[1].replace(/^ *?OtherIndexEntry *?= *?(.*) *?$/,"$1");<br />
else if(ref[1].match(/^ *?OtherIndexEntryTwo *?= *?(.*) *?$/))<br />
this.otherindexentrytwo = ref[1].replace(/^ *?OtherIndexEntryTwo *?= *?(.*) *?$/,"$1");<br />
else if(ref[1].match(/^ *?OtherIndexEntryThree *?= *?(.*) *?$/))<br />
this.otherindexentrythree = ref[1].replace(/^ *?OtherIndexEntryThree *?= *?(.*) *?$/,"$1");<br />
else if(ref[1].match(/^ *?OtherIndexEntryFour *?= *?(.*) *?$/))<br />
this.otherindexentryfour = ref[1].replace(/^ *?OtherIndexEntryFour *?= *?(.*) *?$/,"$1");<br />
else if(ref[1].match(/^ *?OtherIndexEntryFive *?= *?(.*) *?$/))<br />
this.otherindexentryfive = ref[1].replace(/^ *?OtherIndexEntryFive *?= *?(.*) *?$/,"$1");<br />
else if(ref[1].match(/^ *?EnglishEntry *?= *?(.*) *?$/))<br />
this.englishentry = ref[1].replace(/^ *?EnglishEntry *?= *?(.*) *?$/,"$1");<br />
else if(j==3){<br />
this.subnote = ref[1];<br />
}else{<br />
alert("texttermfill error j=" + j + " ref1= " +ref[1]);<br />
//console.log("texttermfill error j=" + j + " ref1= " +ref[1]);<br />
}<br />
}<br />
j++;<br />
} else {<br />
nr=false;<br />
}<br />
} while (nr==true);<br />
//console.log("j=" + j + " term=" + this.term + " note=" + this.note + " section=" + this.section +" subnote=" + this.subnote +" indexentry=" + this.indexentry + " otherindexentry=" + this.otherindexentry);<br />
}<br />
<br />
<br />
function textTermform(offset,range){<br />
<br />
// We search for TextTerm in wptexbox1 from cursor position (offset) and if selected (range)<br />
// If called by a previous or next, they are not null {{TextTerm<-......>}}<br />
// if outside of a TextTerm template, we will fill with the term with the selection<br />
// in any case we compute the previous nextstart and previus end and next offset not real.<br />
// if inside a TextTerm we fill the form<br />
// if saveterm is necessary, we save and exit.<br />
// if previous or next, we save if necessary and we call textTermform with a new offset >0 (next) or <0 (previous) and range<br />
// <br />
var textarea= document.getElementById('wpTextbox1');<br />
if ('selectionStart' in textarea) {<br />
if (offset == null){ // range should be null too<br />
offset = textarea.selectionStart;<br />
range = textarea.selectionEnd - textarea.selectionStart;<br />
<br />
var lstxtterm = textarea.value.substring(0,textarea.selectionEnd). lastIndexOf("{{TextTerm") ; // Just before the string. No regex<br />
var lstcltxtterm = textarea.value.substring(0,textarea.selectionStart). lastIndexOf("}}") ; //might be for another purpose than TextTerm<br />
// Looking for the section<br />
section = '';<br />
var psectione = textarea.value.substring(0,textarea.selectionEnd). lastIndexOf("===") ; // Just before the string. No regex<br />
if(psectione != -1){<br />
var psections = textarea.value.substring(0,psectione). lastIndexOf("===") ; // Just before the string. No regex<br />
if(psections != -1){<br />
section = textarea.value.substring(psections,psectione+3).match(/^=== *?(\d{3}) *?===$/)[1];<br />
}<br />
}<br />
//console.log(" section |" + section);<br />
//textarea.value.substring(0,textarea.selectionStart). search(new RegExp("((({{TextTerm[^}]+)[^{]+)+)");<br />
<br />
if ( (-1 == lstxtterm) || ((-1 < lstxtterm) && (lstxtterm < lstcltxtterm)) ) { // @{{TextTerm ...@}}...(...).. <br />
// {{Refnumber }} ....! <br />
// alert("We are after outside a previous TextTerm or no TextTerm before:" + textarea.value.substring(0,textarea.selectionStart ));<br />
texttermcur = new texttermfill("|" + textarea.value.substring(textarea.selectionStart,textarea.selectionEnd));<br />
//console.log(" We want to fill with the selection=" + textarea.value.substring(textarea.selectionStart,textarea.selectionEnd));<br />
// On se retrouve avec du texte à ajouter et le curseur inchangé à textarea.selectionStart <br />
} else if ( (lstxtterm > lstcltxtterm) && (lstcltxtterm > -1) ) { // @}}... @{{TextTerm ... (...).. <br />
//alert("We are within a TextTerm or no closing }}:" + textarea.value.substring(lstcltxtterm, lstxtterm));<br />
<br />
// ( textarea.value.substring(lstxtterm, textarea.selectionStart). search(new RegExp("}}")) == -1) {<br />
var endtxterm= textarea.value.substring(textarea.selectionStart, textarea.length). search("}}");<br />
if( endtxterm == -1)<br />
error(" Error no closing TextTerm; should be fixed:" + textarea.value.substring(textarea.selectionStart, textarea.length));<br />
else{<br />
endtxterm = endtxterm + textarea.selectionStart +2 ; // }} included<br />
// Looking for @{{TextTerm....}}@<br />
// alert("We are within textterm " + lstxtterm + " to " + endtxterm + " soit:" + textarea.value.substring(lstxtterm,endtxterm) );<br />
//console.log(" Replacing with form result:" + textarea.value.substring(lstxtterm+"{{TextTerm".length,endtxterm-"}}".length));<br />
texttermcur = new texttermfill(textarea.value.substring(lstxtterm+"{{TextTerm".length,endtxterm-"}}".length) );<br />
// On devrait remplacer {{TextTerm ...}} par la forme, soit de lstxtterm endtxtterm<br />
// On se fout de la sélection originale et la repositionne sur toute l'étendue du textterm.<br />
// alert("After null before textarea.selectionStart is" + textarea.selectionStart + " end=" + textarea.selectionEnd);<br />
// alert(" selection is:" + textarea.value.substring(textarea.selectionStart,textarea.selectionEnd));<br />
textarea.selectionStart = lstxtterm;<br />
textarea.selectionEnd = endtxterm;<br />
// alert("After null textarea.selectionStart is" + textarea.selectionStart + " end=" + textarea.selectionEnd);<br />
// alert(" selection is now:" + textarea.value.substring(textarea.selectionStart,textarea.selectionEnd));<br />
} //en endtxtterm<br />
} // end @}}... @{{TextTerm ... (...).. <br />
}else{ // coming from a previous or next<br />
// alert("After Next textarea.selectionStart is" + textarea.selectionStart + " end=" + textarea.selectionEnd);<br />
// alert(" After next selection is:" + textarea.value.substring(textarea.selectionStart,textarea.selectionEnd));<br />
// alert("Coming from a previous or next modifing selectionStart start is an offsetstart =" + offset + " and range=" + range)<br />
// Previous<br />
// selectionStart selectionEnd<br />
// > <<br />
// ^....@{{TextTerm....#}}.................@{{TextTerm ...}}!<br />
// !<-range-------->! <br />
// #<-offset--------->! <br />
// Next<br />
// selectionStart selectionEnd<br />
// > <<br />
// ^....@{{TextTerm....#}}.................@{{TextTerm ...}}!<br />
// !<--range------->! <br />
// #<-offset--------->! <br />
// alert(" Before textarea.selectionStart=" + textarea.selectionStart + " textarea.selectionEnd=" + textarea.selectionEnd);<br />
//alert(" Before is:" + textarea.value.substring(textarea.selectionStart,textarea.selectionEnd));<br />
textarea.selectionStart = (offset > 0 ? textarea.selectionEnd + offset : textarea.selectionStart + offset -range);<br />
textarea.selectionEnd = textarea.selectionStart + range;<br />
// Looking for the section<br />
section = '';<br />
var psectione = textarea.value.substring(0,textarea.selectionEnd). lastIndexOf("===") ; // Just before the string. No regex<br />
if(psectione != -1){<br />
var psections = textarea.value.substring(0,psectione). lastIndexOf("===") ; // Just before the string. No regex<br />
if(psections != -1){<br />
section = textarea.value.substring(psections,psectione+3).match(/^=== *?(\d{3}) *?===$/)[1];<br />
}<br />
}<br />
//console.log(" section Other |" + section);<br />
<br />
// alert(" After is:" + textarea.value.substring(textarea.selectionStart,textarea.selectionEnd));<br />
// alert(" After textarea.selectionStart=" + textarea.selectionStart + " textarea.selectionEnd=" + textarea.selectionEnd);<br />
//console.log("textterm cur is:" + textarea.value.substring(textarea.selectionStart+"{{TextTerm".length,textarea.selectionEnd-"}}".length));<br />
texttermcur = new texttermfill(textarea.value.substring(textarea.selectionStart+"{{TextTerm".length,textarea.selectionEnd-"}}".length) );<br />
}<br />
}else{<br />
alert("No selectionStart Internet Explorer < 9?");<br />
} <br />
// Looking for previous and next<br />
// Previous<br />
// ^....@{{TextTerm....#}}.................@{{TextTerm ...}}!<br />
// poffset<br />
// < prange ><<br />
// >< ><<br />
// pstart pend<br />
// !<--------offsetpstart------------>! <br />
// #<-offsetpsend---->! <br />
<br />
var pstart = textarea.value.substring(0,textarea.selectionStart). lastIndexOf("{{TextTerm"); <br />
if ( pstart == -1) { // No previous<br />
// alert( "NO previous : " + textarea.value.substring(0,textarea.selectionStart));<br />
poffset = null;<br />
prange = null;<br />
}else{<br />
// alert( "Previous pstart=" + pstart + " selectionStart=" + textarea.selectionStart + " pstart:selectionStart=" + textarea.value.substring(pstart,textarea.selectionStart));<br />
var pend = textarea.value.substring(pstart,textarea.selectionStart). search("}}") ; // Regex ?<br />
// alert( "Previous pstart=" + pstart + " pend= " + pend + " selectionStart=" + textarea.selectionStart + " pstart:selectionStart=" + textarea.value.substring(pstart,textarea.selectionStart));<br />
if ( pend == -1) { // Strange no ending<br />
stop( "NO ending }} in previous : " + textarea.value.substring(0,textarea.selectionStart));<br />
}else{<br />
prange = pend + 2; // }} included<br />
poffset = pstart + prange - textarea.selectionStart; // should be negative<br />
// alert( " prange =" + prange + " poffset=" + poffset);<br />
}<br />
}<br />
// Next<br />
// ^....@{{TextTerm....#}}.................@{{TextTerm ...}}!<br />
// !<--------offsetnend-------------->! <br />
// #<-offsetnstart--->! <br />
// noffset<br />
// >< nrange ><br />
// #<-offsetnstart--->! <br />
var nstart = textarea.value.substring(textarea.selectionEnd,textarea.length). search("{{TextTerm") <br />
if ( nstart == -1) { // No next<br />
// alert( "NO next TextTerm : " + textarea.value.substring(textarea.selectionEnd,textarea.length));<br />
noffset = null;<br />
nrange = null;<br />
}else{<br />
var nend = textarea.value.substring(textarea.selectionEnd + nstart,textarea.length). search("}}") ;<br />
if ( nend == -1) { // Strange no ending<br />
stop( "NO ending }} in previous : " + textarea.value.substring(textarea.selectionEnd,textarea.length)) ;<br />
}else{<br />
noffset = nstart ;<br />
nrange = nend +2 ;// }}<br />
}<br />
}<br />
<br />
<br />
// We do have offset or null, as well formfilled with a selection.<br />
<br />
oldFormHide();<br />
template = "TextTerm";<br />
var legend;<br />
if (template == "TextTerm") {<br />
legend = "TextTerm source";<br />
} else {<br />
legend = "Cite news source";<br />
}<br />
newtime = getTime();<br />
<br />
numforms++;<br />
form = '<div id="citediv'+numforms+'">'+<br />
'<fieldset><legend>'+legend+'</legend>'+<br />
'<table cellspacing="5">'+<br />
'<input type="hidden" value="'+template+'" id="template">'+<br />
'<tr><td><label for="term">&nbsp;*Term or expression: </label></td>'+<br />
'<td colspan="3"><input type="text" tabindex=1 style="width:100%" id="term" value= "' +<br />
texttermcur.term + '"></tr>'+<br />
'<tr><td width="100"><label for="note">&nbsp;*Note number (1, 2 etc .): </label></td>'+<br />
'<td width="40"><input type="text" tabindex=1 style="width:10%" id="note" value= "' +<br />
texttermcur.note + '"></td>'+<br />
'<td width="100"><label for="subnote">&nbsp;Subnote (2): </label></td>'+<br />
'<td width="40"><input type="text" tabindex=1 style="width:10%" id="subnote" value= "' +<br />
texttermcur.subnote + '"></td></tr>'+<br />
'<tr><td width="300"><label for="section">&nbsp;Section (102, 933 etc.): </label></td>'+<br />
'<td width="40"><input type="text" tabindex=1 style="width:10%" id="section" value= "' +<br />
texttermcur.section + '"></td>'+<br />
'<td width="120"><label for="indexentry">&nbsp;IndexEntry: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="indexentry" value= "' +<br />
texttermcur.indexentry + '"></td></tr>'+<br />
'<tr><td width="120"><label for="otherindexentry">&nbsp;OtherIndexEntry: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="otherindexentry" value= "' +<br />
texttermcur.otherindexentry + '"></td>'+<br />
'<td width="120"><label for="otherindexentrytwo">&nbsp;OtherIndexEntryTwo: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="otherindexentrytwo" value= "' +<br />
texttermcur.otherindexentrytwo + '"></td></tr>'+<br />
'<tr><td width="120"><label for="otherindexentrythree">&nbsp;OtherIndexEntryThree: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="otherindexentrythree" value= "' +<br />
texttermcur.otherindexentrythree + '"></td>'+<br />
'<td width="120"><label for="otherindexentryfour">&nbsp;OtherIndexEntryFour: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="otherindexentryfour" value= "' +<br />
texttermcur.otherindexentryfour + '"></td></tr>'+<br />
'<tr><td width="120"><label for="otherindexentryfive">&nbsp;OtherIndexEntryFive: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="otherindexentryfive" value= "' +<br />
texttermcur.otherindexentryfive + '"></td>'+<br />
'<td width="120"><label for="englishentry">&nbsp;EnglishEntry (for Chinese and Japanese): </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="englishentry" value= "' +<br />
texttermcur.englishentry + '"></td></tr>'+<br />
'</table>'+<br />
'<input type="button" id="previous" value="(save &) previous TextTerm" onClick="previoustextterm()">'+<br />
'<input type="button" value="(save &) exit" onClick="savetextterms()">'+<br />
'<input type="button" id="next" value="(save &) next TextTerm" onClick="nexttextterm()">'+<br />
'</fieldset></div>';<br />
document.getElementById('citeselect').innerHTML += form;<br />
}<br />
<br />
<br />
function citeNewsWeb(templatename) {<br />
oldFormHide();<br />
template = templatename;<br />
var legend;<br />
if (template == "cite web") {<br />
legend = "Cite web source";<br />
} else {<br />
legend = "Cite news source";<br />
}<br />
newtime = getTime();<br />
numforms++;<br />
form = '<div id="citediv'+numforms+'">'+<br />
'<fieldset><legend>'+legend+'</legend>'+<br />
'<table cellspacing="5">'+<br />
'<input type="hidden" value="'+template+'" id="template">'+<br />
'<tr><td width="120"><label for="url">&nbsp;URL: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="url"></td>'+<br />
'<td width="120"><label for="title">&nbsp;Title: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="title"></td></tr>'+<br />
'<tr><td width="120"><label for="last">&nbsp;Last name: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="last"></td>'+<br />
'<td width="120"><label for="first">&nbsp;First name: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="first"></td></tr>'+<br />
'<tr><td width="120"><label for="coauthors">&nbsp;Coauthors: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="coauthors"></td>'+<br />
'<td width="120"><label for="date">&nbsp;Publication date: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="date"></td></tr>'+<br />
'<tr><td width="120"><label for="work">&nbsp;Work: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="work"></td>'+<br />
'<td width="120"><label for="publisher">&nbsp;Publisher: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="publisher"></td></tr>'+<br />
'<tr><td width="120"><label for="pages">&nbsp;Pages: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="pages"></td>'+<br />
'<td width="120"><label for="language">&nbsp;Language: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="language"></td></tr>'+<br />
'<tr><td width="120"><label for="accessdate">&nbsp;Access date: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="accessdate" value="'+ newtime +'"></td>'+<br />
'<td width="120"><label for="location">&nbsp;Location: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="location"></td></tr>'+<br />
'<tr><td width="120"><label for="refname">&nbsp;Reference name: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="refname"></td></tr>'+<br />
'</table>'+<br />
'<input type="button" value="Add citation" onClick="addcites()">'+<br />
'</fieldset></div>';<br />
document.getElementById('citeselect').innerHTML += form;<br />
}<br />
<br />
function citeBook() {<br />
oldFormHide();<br />
template = "cite book";<br />
numforms++;<br />
form = '<div id="citediv'+numforms+'">'+<br />
'<fieldset><legend>Cite book source</legend>'+<br />
'<table cellspacing="5">'+<br />
'<input type="hidden" value="'+template+'" id="template">'+<br />
'<tr><td width="120"><label for="last">&nbsp;Last name: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="last"></td>'+<br />
'<td width="120"><label for="first">&nbsp;First name: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="first"></td></tr>'+<br />
'<tr><td width="120"><label for="coauthors">&nbsp;Coauthors: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="coauthors"></td>'+<br />
'<td width="120"><label for="others">&nbsp;Others: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="others"></td></tr>'+<br />
'<tr><td width="120"><label for="title">&nbsp;Title: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="title"></td>'+<br />
'<td width="120"><label for="editor">&nbsp;Editor: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="editor"></td></tr>'+<br />
'<tr><td width="120"><label for="publisher">&nbsp;Publisher: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="publisher"></td>'+<br />
'<td width="120"><label for="location">&nbsp;Location: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="location"></td></tr>'+<br />
'<tr><td width="120"><label for="date">&nbsp;Publication date: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="date"></td>'+<br />
'<td width="120"><label for="edition">&nbsp;Edition: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="edition"></td></tr>'+<br />
'<tr><td width="120"><label for="series">&nbsp;Series: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="series"></td>'+<br />
'<td width="120"><label for="volume">&nbsp;Volume: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="volume"></td></tr>'+<br />
'<tr><td width="120"><label for="pages">&nbsp;Pages: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="pages"></td>'+<br />
'<td width="120"><label for="chapter">&nbsp;Chapter: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="chapter"></td></tr>'+<br />
'<tr><td width="120"><label for="isbn">&nbsp;ISBN: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="isbn"></td>'+<br />
'<td width="120"><label for="oclc">&nbsp;OCLC: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="oclc"></td></tr>'+<br />
'<tr><td width="120"><label for="url">&nbsp;URL: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="url"></td>'+<br />
'<td width="120"><label for="accessdate">&nbsp;Access date: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="accessdate"></td></tr>'+<br />
'<tr><td width="120"><label for="language">&nbsp;Language: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="language"></td>'+<br />
'<td width="120"><label for="refname">&nbsp;Reference name: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="refname"></td></tr>'+<br />
'</table>'+<br />
'<input type="button" value="Add citation" onClick="addcites()">'+<br />
'</fieldset></div>';<br />
document.getElementById('citeselect').innerHTML += form;<br />
}<br />
<br />
function citeJournal() {<br />
oldFormHide();<br />
template = "cite journal";<br />
numforms++;<br />
form = '<div id="citediv'+numforms+'">'+<br />
'<fieldset><legend>Cite journal source</legend>'+<br />
'<table cellspacing="5">'+<br />
'<input type="hidden" value="'+template+'" id="template">'+<br />
'<tr><td width="120"><label for="last">&nbsp;Last name: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="last"></td>'+<br />
'<td width="120"><label for="first">&nbsp;First name: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="first"></td></tr>'+<br />
'<tr><td width="120"><label for="coauthors">&nbsp;Coauthors: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="coauthors"></td>'+<br />
'<td width="120"><label for="date">&nbsp;Publication date: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="date"></td></tr>'+<br />
'<tr><td width="120"><label for="title">&nbsp;Title: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="title"></td>'+<br />
'<td width="120"><label for="journal">&nbsp;Journal: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="journal"></td></tr>'+<br />
'<tr><td width="120"><label for="publisher">&nbsp;Publisher: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="publisher"></td>'+<br />
'<td width="120"><label for="location">&nbsp;Location: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="location"></td></tr>'+<br />
'<tr><td width="120"><label for="volume">&nbsp;Volume: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="volume"></td>'+<br />
'<td width="120"><label for="issue">&nbsp;Issue: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="issue"></td></tr>'+<br />
'<tr><td width="120"><label for="pages">&nbsp;Pages: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="pages"></td>'+<br />
'<td width="120"><label for="issn">&nbsp;ISSN: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="issn"></td></tr>'+<br />
'<tr><td width="120"><label for="oclc">&nbsp;OCLC: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="oclc"></td>'+<br />
'<td width="120"><label for="language">&nbsp;Language: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="language"></td></tr>'+<br />
'<tr><td width="120"><label for="url">&nbsp;URL: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="url"></td>'+<br />
'<td width="120"><label for="accessdate">&nbsp;Access date: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="accessdate"></td></tr>'+<br />
'<tr><td width="120"><label for="refname">&nbsp;Reference name: </label></td>'+<br />
'<td width="400"><input type="text" tabindex=1 style="width:100%" id="refname"></td></tr>'+<br />
'</table>'+<br />
'<input type="button" value="Add citation" onClick="addcites()">'+<br />
'</fieldset></div>';<br />
document.getElementById('citeselect').innerHTML += form;<br />
}<br />
<br />
function saveinput(terminput) {<br />
// terminput = document.getElementById('citediv'+numforms).getElementsByTagName('input');<br />
this.term = '';<br />
this.note= '';<br />
this.section = '';<br />
this.indexentry= '';<br />
this.otherindexentry = '';<br />
this.otherindexentrytwo = '';<br />
this.otherindexentrythree = '';<br />
this.otherindexentryfour = '';<br />
this.otherindexentryfive = '';<br />
this.englishentry = '';<br />
<br />
for (var i=0; i<terminput.length-1; i++) {<br />
if (terminput[i].id == "template" ){<br />
;<br />
}else if (terminput[i].id == "term" ){<br />
this.term = terminput[i].value;<br />
}else if(terminput[i].id == "note"){<br />
this.note = terminput[i].value;<br />
}else if(terminput[i].id == "section"){<br />
this.section = terminput[i].value;<br />
}else if(terminput[i].id == "subnote"){<br />
this.subnote = terminput[i].value;<br />
}else if(terminput[i].id == "indexentry"){<br />
this.indexentry = terminput[i].value;<br />
}else if(terminput[i].id == "otherindexentry"){<br />
this.otherindexentry = terminput[i].value;<br />
}else if(terminput[i].id == "otherindexentrytwo"){<br />
this.otherindexentrytwo = terminput[i].value;<br />
}else if(terminput[i].id == "otherindexentrythree"){<br />
this.otherindexentrythree = terminput[i].value;<br />
}else if(terminput[i].id == "otherindexentryfour"){<br />
this.otherindexentryfour = terminput[i].value;<br />
}else if(terminput[i].id == "otherindexentryfive"){<br />
this.otherindexentryfive = terminput[i].value;<br />
}else if(terminput[i].id == "englishentry"){<br />
this.englishentry = terminput[i].value;<br />
}else{<br />
;;//alert(" SaveInput terminput[i].id = " + terminput[i].id + " terminput[i].value =" + terminput[i].value);<br />
}<br />
<br />
}<br />
}<br />
<br />
function savetextterms(template) {<br />
var txtterminput = document.getElementById('citediv'+numforms).getElementsByTagName('input');<br />
textterminput = new saveinput(txtterminput);<br />
//alert("texttermcur=" + texttermcur);<br />
//alert("textterminput=" + textterminput);<br />
// Testing<br />
var different = false;<br />
if((textterminput.term != texttermcur.term) || (textterminput.note != texttermcur.note) ||<br />
(textterminput.section != texttermcur.section) ||<br />
(textterminput.subnote != texttermcur.subnote) ||<br />
(textterminput.indexentry != texttermcur.indexentry) ||<br />
(textterminput.otherindexentry != texttermcur.otherindexentry) || <br />
(textterminput.otherindexentrytwo != texttermcur.otherindexentrytwo) ||<br />
(textterminput.otherindexentrythree != texttermcur.otherindexentrythree) ||<br />
(textterminput.otherindexentryfour != texttermcur.otherindexentryfour) ||<br />
(textterminput.otherindexentryfive != texttermcur.otherindexentryfive) ||<br />
(textterminput.englishentry != texttermcur.englishentry) )<br />
different = true;<br />
<br />
if (different){<br />
// alert(" They are different, have to save" );<br />
var texttermchain="{{TextTerm";<br />
texttermchain += '|' + (textterminput.term ? textterminput.term : '');<br />
texttermchain += '|' + (textterminput.note ? textterminput.note : '');<br />
texttermchain += (textterminput.section ? '|' + textterminput.section : '');<br />
texttermchain += (textterminput.subnote ? '|' + textterminput.subnote : '');<br />
texttermchain += (textterminput.indexentry ? '|IndexEntry='+ textterminput.indexentry : '');<br />
texttermchain += (textterminput.otherindexentry ? '|OtherIndexEntry='+ textterminput.otherindexentry : '');<br />
texttermchain += (textterminput.otherindexentrytwo ? '|OtherIndexEntryTwo='+ textterminput.otherindexentrytwo : '');<br />
texttermchain += (textterminput.otherindexentrythree ? '|OtherIndexEntryThree='+ textterminput.otherindexentrythree : '');<br />
texttermchain += (textterminput.otherindexentryfour ? '|OtherIndexEntryFour='+ textterminput.otherindexentryfour : '');<br />
texttermchain += (textterminput.otherindexentryfive ? '|OtherIndexEntryFive='+ textterminput.otherindexentryfive : '');<br />
texttermchain += (textterminput.englishentry ? '|EnglishEntry='+ textterminput.englishentry : '');<br />
texttermchain += "}}";<br />
<br />
var textarea= document.getElementById('wpTextbox1');<br />
var savepos= textarea.selectionStart;<br />
if ('selectionStart' in textarea) {<br />
textarea.value=textarea.value.substring(0,textarea.selectionStart) + texttermchain + textarea.value.substring(textarea.selectionEnd, textarea.length); <br />
//insertTags(texttermchain, '', '');<br />
textarea.selectionStart = savepos;<br />
textarea.selectionEnd = savepos + texttermchain.length;<br />
}<br />
else{<br />
alert("No selectionStart firefox");<br />
}<br />
}<br />
else{<br />
;//alert(" They are similar, don't save" );<br />
}<br />
document.getElementById('citediv'+numforms).style.display = 'none';<br />
<br />
}<br />
<br />
function addcites(template) {<br />
cites = document.getElementById('citediv'+numforms).getElementsByTagName('input');<br />
var citebegin = '<ref';<br />
var citename = '';<br />
var citeinner = '';<br />
for (var i=0; i<cites.length-1; i++) {<br />
if (cites[i].value != '' && cites[i].id != "refname" && cites[i].id != "template") {<br />
citeinner += "|" + cites[i].id + "=" + cites[i].value;<br />
}<br />
else if (cites[i].value != '' && cites[i].id == "refname" && cites[i].id != "template") {<br />
citebegin += ' name="' + cites[i].value + '"';<br />
}<br />
else if (cites[i].value != '' && cites[i].id != "refname" && cites[i].id == "template") {<br />
citename = '>{{' + cites[i].value;<br />
}<br />
}<br />
cite = citebegin + citename + citeinner + "}}</ref>";<br />
$("#wpTextbox1").focus();<br />
insertTags(cite, '', '');<br />
document.getElementById('citediv'+numforms).style.display = 'none';<br />
}<br />
<br />
function getNamedRefs(calls) {<br />
if (typeof(wikEdUseWikEd) != 'undefined') {<br />
if (wikEdUseWikEd == true) {<br />
WikEdUpdateTextarea();<br />
}<br />
}<br />
text = document.getElementById('wpTextbox1').value;<br />
var regex;<br />
if (calls) {<br />
regex = /< *?ref +?name *?= *?(('([^']*?)')|("([^"]*?)")|([^'"\s]*?[^\/]\b)) *?\/ *?>/gi //'<br />
} else {<br />
regex = /< *?ref +?name *?= *?(('([^']*?)')|("([^"]*?)")|([^'"\s]*?[^\/]\b)) *?>/gi //'<br />
}<br />
var namedrefs = [];<br />
var i=0;<br />
var nr=true;<br />
do {<br />
ref = regex.exec(text);<br />
if(ref != null){<br />
if (ref[5]) {<br />
namedrefs[i] = ref[5];<br />
} else if (ref[3]) {<br />
namedrefs[i] = ref[3];<br />
} else {<br />
namedrefs[i] = ref[6];<br />
}<br />
i++;<br />
} else {<br />
nr=false;<br />
}<br />
} while (nr==true);<br />
return namedrefs;<br />
}<br />
<br />
function citeNamedRef() {<br />
namedrefs = getNamedRefs(false);<br />
if (namedrefs == '') {<br />
oldFormHide();<br />
numforms++;<br />
out = '<div id="citediv'+numforms+'"><fieldset>'+<br />
'<legend>References in text</legend>There are no named refs (<tt>&lt;ref name="Name"&gt;</tt>) in the text</fieldset></div>';<br />
document.getElementById('citeselect').innerHTML += out;<br />
}<br />
else {<br />
oldFormHide();<br />
numforms++;<br />
form = '<div id="citediv'+numforms+'">'+<br />
'<fieldset><legend>References in article</legend>'+<br />
'<table cellspacing="5">'+<br />
'<tr><td><label for="namedrefs">&nbsp;Named references in text</label></td>'+<br />
'<td><select name="namedrefs" id="namedrefs">';<br />
for (var i=0;i<namedrefs.length;i++) {<br />
form+= '<option value="'+namedrefs[i]+'">'+namedrefs[i]+'</option>';<br />
}<br />
form+= '</select>'+<br />
'</td></tr></table>'+<br />
'<input type="button" value="Add citation" onClick="addnamedcite()">'+<br />
'</fieldset></div>';<br />
document.getElementById('citeselect').innerHTML += form;<br />
}<br />
}<br />
<br />
function addnamedcite() {<br />
name = document.getElementById('citediv'+numforms).getElementsByTagName('select')[0].value;<br />
ref = '<ref name="'+name+'" />';<br />
$("#wpTextbox1").focus();<br />
insertTags(ref, '', '');<br />
document.getElementById('citediv'+numforms).style.display = 'none';<br />
}<br />
<br />
function getAllRefs() {<br />
if (typeof(wikEdUseWikEd) != 'undefined') {<br />
if (wikEdUseWikEd == true) {<br />
WikEdUpdateTextarea();<br />
}<br />
}<br />
text = document.getElementById('wpTextbox1').value;<br />
regex = /< *?ref( +?name *?= *?(('([^']*?)')|("([^"]*?)")|([^'"\s]*?[^\/]\b)))? *?>((.|\n)*?)< *?\/? *?ref *?>/gim //"<br />
var allrefs = [];<br />
var i=0;<br />
var nr=true;<br />
do {<br />
ref = regex.exec(text);<br />
if(ref != null){<br />
if (ref[0].search(/[^\s]{150}/) != -1) {<br />
ref[0] = ref[0].replace(/\|([^\s])/g, "| $1");<br />
}<br />
ref[0] = ref[0].replace(/</g, "&lt;");<br />
ref[0] = ref[0].replace(/>/g, "&gt;");<br />
allrefs[i] = ref[0];<br />
i++;<br />
} else {<br />
nr=false;<br />
}<br />
} while (nr==true);<br />
return allrefs;<br />
}<br />
<br />
function NRcallError(namedrefs, refname) {<br />
for (var i=0; i<namedrefs.length; i++) {<br />
if (namedrefs[i] == refname) {<br />
return true;<br />
}<br />
}<br />
return false;<br />
}<br />
<br />
function errorCheck() {<br />
var allrefs = getAllRefs();<br />
var allrefscontent = [];<br />
var samecontentexclude = [];<br />
var sx=0;<br />
var templateexclude = [];<br />
var tx=0;<br />
var skipcheck = false;<br />
var namedrefcalls = getNamedRefs(true);<br />
for (var i=0; i<allrefs.length; i++) {<br />
allrefscontent[i] = allrefs[i].replace(/&lt; *?ref( +?name *?= *?(('([^']*?)')|("([^"]*?)")|([^'"\s]*?[^\/]\b)))? *?&gt;((.|\n)*?)&lt; *?\/? *?ref *?&gt;/gim, "$8"); //"<br />
}<br />
var namedrefs = getNamedRefs(false);<br />
var errorlist = [];<br />
var q=0;<br />
unclosed = document.getElementById('unclosed').checked;<br />
samecontent = document.getElementById('samecontent').checked;<br />
templates = document.getElementById('templates').checked;<br />
repeated = document.getElementById('repeated').checked;<br />
undef = document.getElementById('undef').checked;<br />
for (var i=0; i<allrefs.length; i++) {<br />
if (allrefs[i].search(/&lt; *?\/ *?ref *?&gt;/) == -1 && unclosed) {<br />
errorlist[q] = '<tr><td width="75%"><tt>'+allrefs[i]+'</tt></td>';<br />
errorlist[q] += '<td width="25%">Unclosed <tt>&lt;ref&gt;</tt> tag</td></tr>';<br />
q++;<br />
}<br />
if (samecontent) {<br />
for (var d=0; d<samecontentexclude.length; d++) {<br />
if (allrefscontent[i] == samecontentexclude[d]) {<br />
skipcheck = true;<br />
}<br />
}<br />
var p=0;<br />
while (p<allrefs.length && !skipcheck) {<br />
if (allrefscontent[i] == allrefscontent[p] && i != p) {<br />
errorlist[q] = '<tr><td width="75%"><tt>'+allrefscontent[i]+'</tt></td>';<br />
errorlist[q] += '<td width="25%">Multiple refs contain this content, a <a href="//en.wikipedia.org/wiki/Wikipedia:Footnotes#Naming_a_ref_tag_so_it_can_be_used_more_than_once">named reference</a> should be used instead</td></tr>';<br />
q++;<br />
samecontentexclude[sx] = allrefscontent[i]<br />
sx++;<br />
break;<br />
}<br />
p++;<br />
}<br />
skipcheck=false;<br />
}<br />
if (templates) {<br />
if (allrefscontent[i].search(/\{\{cite/i) == -1 && allrefscontent[i].search(/\{\{citation/i) == -1 && allrefscontent[i].search(/\{\{Comic (book|strip) reference/i) == -1 && allrefscontent[i].search(/\{\{Editorial cartoon reference/i) == -1 && allrefscontent[i].search(/\{\{harv/i) == -1) {<br />
for (var x=0; x<templateexclude.length; x++) {<br />
if (allrefscontent[i] == templateexclude[x]) {<br />
skipcheck = true;<br />
}<br />
}<br />
if (!skipcheck) {<br />
errorlist[q] = '<tr><td width="75%"><tt>'+allrefs[i]+'</tt></td>';<br />
errorlist[q] += '<td width="25%">Does not use a <a href="//en.wikipedia.org/wiki/Wikipedia:Citation_templates">citation template</a></td></tr>';<br />
q++;<br />
templateexclude[tx] = allrefscontent[i];<br />
tx++;<br />
}<br />
skipcheck = false;<br />
}<br />
}<br />
}<br />
if (repeated) {<br />
var repeatnameexclude = [];<br />
var rx=0;<br />
for (var k=0; k<namedrefs.length; k++) {<br />
for (var d=0; d<repeatnameexclude.length; d++) {<br />
if (namedrefs[k] == repeatnameexclude[d]) {<br />
skipcheck = true;<br />
}<br />
}<br />
var z=0;<br />
while (z<namedrefs.length && !skipcheck) {<br />
if (namedrefs[k] == namedrefs[z] && k != z) {<br />
errorlist[q] = '<tr><td width="75%"><tt>'+namedrefs[k]+'</tt></td>';<br />
errorlist[q] += '<td width="25%">Multiple references are given the same <a href="//en.wikipedia.org/wiki/Wikipedia:Footnotes#Naming_a_ref_tag_so_it_can_be_used_more_than_once">name</a></td></tr>';<br />
q++;<br />
repeatnameexclude[rx] = namedrefs[z];<br />
rx++;<br />
break;<br />
}<br />
z++;<br />
}<br />
skipcheck = false;<br />
}<br />
}<br />
if (undef) {<br />
var undefexclude = [];<br />
var ux=0;<br />
for (var p=0; p<namedrefcalls.length; p++) {<br />
for (var d=0; d<undefexclude.length; d++) {<br />
if (allrefscontent[i] == undefexclude[d]) {<br />
skipcheck = true;<br />
}<br />
}<br />
if (!skipcheck) {<br />
if (!NRcallError(namedrefs, namedrefcalls[p])) {<br />
errorlist[q] = '<tr><td width="75%"><tt>'+namedrefcalls[p]+'</tt></td>';<br />
errorlist[q] += '<td width="25%">A <a href="//en.wikipedia.org/wiki/Wikipedia:Footnotes#Naming_a_ref_tag_so_it_can_be_used_more_than_once">named reference</a> is used but not defined</td></tr>';<br />
q++;<br />
undefexclude[ux] = namedrefs[p];<br />
ux++;<br />
}<br />
}<br />
skipcheck = false;<br />
}<br />
}<br />
if (q > 0) {<br />
return errorlist;<br />
} else {<br />
return 0;<br />
}<br />
}<br />
<br />
function dispErrors() {<br />
oldFormHide();<br />
form = '<div id="errorform"><fieldset>'+<br />
'<legend>Error checking</legend>'+<br />
'<b>Check for:</b><br/>'+<br />
'<input type="checkbox" id="unclosed" /> Unclosed <tt>&lt;ref&gt;</tt> tags<br/>'+<br />
'<input type="checkbox" id="samecontent" /> References with the same content<br/>'+<br />
'<input type="checkbox" id="templates" /> References not using a <a href="//en.wikipedia.org/wiki/Wikipedia:Citation_templates">citation template</a><br/>'+<br />
'<input type="checkbox" id="repeated" /> Multiple references with the same name<br/>'+<br />
'<input type="checkbox" id="undef" /> Usage of undefined named references<br/>'+<br />
'<input type="button" id="errorchecksubmit" value="Check for selected errors" onclick="doErrorCheck()"/>'+<br />
'</fieldset></div>';<br />
document.getElementById('citeselect').innerHTML += form;<br />
}<br />
<br />
function doErrorCheck() {<br />
var errors = errorCheck();<br />
document.getElementById('citeselect').removeChild(document.getElementById('errorform'));<br />
if (errors == 0) {<br />
if (numforms != 0) {<br />
document.getElementById('citediv'+numforms).style.display = 'none';<br />
}<br />
numforms++;<br />
out = '<div id="citediv'+numforms+'"><fieldset>'+<br />
'<legend>Error checking</legend>No errors found.</fieldset></div>';<br />
document.getElementById('citeselect').innerHTML += out;<br />
}<br />
else {<br />
if (numforms != 0) {<br />
document.getElementById('citediv'+numforms).style.display = 'none';<br />
}<br />
numforms++;<br />
form = '<div id="citediv'+numforms+'">'+<br />
'<fieldset><legend>Error checking</legend>'+<br />
'<table border="1px">';<br />
for (var i=0; i<errors.length; i++) {<br />
form+=errors[i];<br />
}<br />
form+= '</table>'+<br />
'</fieldset></div>';<br />
document.getElementById('citeselect').innerHTML += form;<br />
}<br />
}<br />
<br />
$( refbuttons );</div>
Nicolas Brouard
http://fr-i.demopaedia.org/w/index.php?title=MediaWiki:RefToolbarConfig.js&diff=11675
MediaWiki:RefToolbarConfig.js
2017-06-09T08:44:56Z
<p>Nicolas Brouard : From https://en.wikipedia.org/w/index.php?title=MediaWiki:RefToolbarConfig.js&oldid=695089025</p>
<hr />
<div>/* Sitewide options for the the Cite toolbar button:<br />
* All options should be specified<br />
*<br />
* "date format" sets the date format used for the function to insert the current date<br />
* Current available options:<br />
* date - the day of the month<br />
* zdate - day of the month, zero padded to 2 digits<br />
* monthname - The month name<br />
* month - The numberic month (1-12)<br />
* zmonth - numeric month, zero padded to 2 digits<br />
* year - The full year (4 digits)<br />
*<br />
* "autodate fields" is a list of template fields that should have a button to insert the current date<br />
* <br />
* "months" is a list of localized month names<br />
*<br />
* "modal" - if true, the dialogs will be modal windows, blocking access to the rest of the window.<br />
* See http://en.wikipedia.org/wiki/Modal_window<br />
* All dialogs in the toolbar are modal by default<br />
*<br />
* "autoparse" - if true, previewing a ref will automatically trigger a preview of the parsed wikitext.<br />
* It is not recommended to set this to true as a global setting as it may slow the script down for<br />
* people with slow connections.<br />
*<br />
* "expandtemplates" - if true, templates and parser functions will be expanded when getting page text<br />
* (templates inside of ref tags will not be expanded). This will allow references inside of templates or<br />
* references using {{#tag:ref}} to be listed in the named refs dialog and searched by error checks.<br />
* This may slow loading the named refs and error check dialogs.<br />
*/<br />
<br />
CiteTB.Options = {<br />
"date format" : "<date> <monthname> <year>",<br />
"autodate fields" : ['accessdate'],<br />
"months" : ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],<br />
"modal" : true,<br />
"autoparse" : true,<br />
"expandtemplates" : false<br />
};<br />
<br />
// Cite template definitions<br />
new citeTemplate('cite web', 'web',<br />
[ // Basic fields<br />
{"field": "last<N>", "autofillprop":"last-incr", 'increment_group':'author'},<br />
{"field": "first<N>", "autofillprop":"first-incr", 'increment_group':'author', 'increment_button':true}, <br />
{"field": "title", "autofillprop":"title"},<br />
{"field": "url", "autofillid":"url"},<br />
{"field": "website", "autofillprop":"journal"},<br />
{"field": "publisher", "autofillprop":"publisher"},<br />
{"field": "accessdate"},<br />
{"field": "ref", "tooltip":"cite-ref-tooltip"}<br />
],<br />
[ // Expanded fields<br />
{"field": "author<N>", 'increment_group':'author_alt', 'increment_button':true},<br />
{"field": "authorlink<N>", "tooltip":"cite-authorlink-tooltip", 'increment_group':'authorlink', 'increment_button':true},<br />
{"field": "archiveurl"},<br />
{"field": "archivedate"},<br />
{"field": "location"},<br />
{"field": "page", "tooltip":"cite-page-tooltip"},<br />
{"field": "pages", "autofillprop":"pages", "tooltip":"cite-pages-tooltip"},<br />
{"field": "language", "autofillprop":"language"},<br />
{"field": "format"},<br />
{"field": "doi", "autofillid":"doi", "autofillprop":"doi"},<br />
{"field": "date", "autofillprop":"date"},<br />
{"field": "quote"}<br />
]);<br />
<br />
new citeTemplate('cite news', 'news',<br />
[ // Basic fields<br />
{"field": "last<N>", "autofillprop":"last-incr", 'increment_group':'author'},<br />
{"field": "first<N>", "autofillprop":"first-incr", 'increment_group':'author', 'increment_button':true}, <br />
{"field": "title", "autofillprop":"title"},<br />
{"field": "url", "autofillid":"url"},<br />
{"field": "accessdate"},<br />
{"field": "work", "tooltip":"cite-work-tooltip", "autofillprop":"journal"},<br />
{"field": "agency"},<br />
{"field": "issue"},<br />
{"field": "publisher", "autofillprop":"publisher"},<br />
{"field": "date", "autofillprop":"date"},<br />
{"field": "ref", "tooltip":"cite-ref-tooltip"}<br />
],<br />
[ // Expanded fields<br />
{"field": "author<N>", 'increment_group':'author_alt', 'increment_button':true},<br />
{"field": "authorlink<N>", "tooltip":"cite-authorlink-tooltip", 'increment_group':'authorlink', 'increment_button':true},<br />
{"field": "archiveurl"},<br />
{"field": "archivedate"},<br />
{"field": "location"},<br />
{"field": "page", "tooltip":"cite-page-tooltip"},<br />
{"field": "pages", "autofillprop":"pages", "tooltip":"cite-pages-tooltip"},<br />
{"field": "language", "autofillprop":"language"},<br />
{"field": "format"},<br />
{"field": "doi", "autofillid":"doi", "autofillprop":"doi"},<br />
{"field": "quote"}<br />
]);<br />
<br />
new citeTemplate('cite book', 'book',<br />
[ // Basic fields<br />
{"field": "last<N>", "autofillprop":"last-incr", 'increment_group':'author'},<br />
{"field": "first<N>", "autofillprop":"first-incr", 'increment_group':'author', 'increment_button':true}, <br />
{"field": "title", "autofillprop":"title"},<br />
{"field": "date", "autofillprop":"year"},<br />
{"field": "publisher", "autofillprop":"publisher"},<br />
{"field": "location", "autofillprop":"location"},<br />
{"field": "isbn", "autofillid":"isbn", "autofillprop":"isbn"},<br />
{"field": "page", "tooltip":"cite-page-tooltip"},<br />
{"field": "pages", "autofillprop":"pages", "tooltip":"cite-pages-tooltip"},<br />
{"field": "edition", "autofillprop":"edition"},<br />
{"field": "url", "autofillid":"url"},<br />
{"field": "accessdate"},<br />
{"field": "ref", "tooltip":"cite-ref-tooltip"}<br />
<br />
],<br />
[ // Expanded fields<br />
{"field": "author<N>", 'increment_group':'author_alt', 'increment_button':true},<br />
{"field": "authorlink<N>", "tooltip":"cite-authorlink-tooltip", 'increment_group':'authorlink', 'increment_button':true},<br />
{"field": "editor<N>-last", "increment_group":"editor"},<br />
{"field": "editor<N>-first", "increment_group":"editor", "increment_button":true},<br />
{"field": "editor<N>-link", 'increment_group':'editorlink', 'increment_button':true},<br />
{"field": "archiveurl"},<br />
{"field": "archivedate"},<br />
{"field": "language", "autofillprop":"language"},<br />
{"field": "format"},<br />
{"field": "chapter", "autofillprop":"chapter"},<br />
{"field": "quote"}<br />
]);<br />
<br />
new citeTemplate('cite journal', 'journal',<br />
[ // Basic fields<br />
{"field": "last<N>", "autofillprop":"last-incr", 'increment_group':'author'},<br />
{"field": "first<N>", "autofillprop":"first-incr", 'increment_group':'author', 'increment_button':true}, <br />
{"field": "title", "autofillprop":"title"},<br />
{"field": "journal", "autofillprop":"journal"},<br />
{"field": "date", "autofillprop":"date"},<br />
{"field": "volume", "autofillprop":"volume"},<br />
{"field": "issue", "autofillprop":"issue"},<br />
{"field": "page", "tooltip":"cite-page-tooltip"},<br />
{"field": "pages", "autofillprop":"pages", "tooltip":"cite-pages-tooltip"},<br />
{"field": "doi", "autofillid":"doi", "autofillprop":"doi"},<br />
{"field": "pmid", "autofillid":"pmid"},<br />
{"field": "url", "autofillid":"url"},<br />
{"field": "accessdate"},<br />
{"field": "ref", "tooltip":"cite-ref-tooltip"},<br />
],<br />
[ // Expanded fields<br />
{"field": "author<N>", 'increment_group':'author_alt', 'increment_button':true},<br />
{"field": "authorlink<N>", "tooltip":"cite-authorlink-tooltip", 'increment_group':'authorlink', 'increment_button':true},<br />
{"field": "editor<N>-last", "increment_group":"editor"},<br />
{"field": "editor<N>-first", "increment_group":"editor", "increment_button":true},<br />
{"field": "editor<N>-link", 'increment_group':'editorlink', 'increment_button':true},<br />
{"field": "series"},<br />
{"field": "at", "tooltip":"cite-at-tooltip"},<br />
{"field": "trans-title"},<br />
{"field": "publisher", "autofillprop":"publisher"},<br />
{"field": "location"},<br />
{"field": "language", "autofillprop":"language"},<br />
{"field": "format"},<br />
{"field": "issn", "autofillprop":"issn"},<br />
{"field": "pmc"},<br />
{"field": "oclc"},<br />
{"field": "bibcode"},<br />
{"field": "id"},<br />
{"field": "quote"},<br />
{"field": "postscript", "tooltip":"cite-postscript-tooltip"}<br />
]);<br />
<br />
new citeErrorCheck({'type':'reflist', 'testname':'samecontent', 'desc': 'cite-samecontent-desc',<br />
'func': function(reflist) {<br />
var errors = [];<br />
var refs2 = [];<br />
for(var i=0; i<reflist.length; i++) {<br />
if (!reflist[i].shorttag) {<br />
if ($.inArray(reflist[i].content, refs2) != -1) {<br />
if ($.inArray(reflist[i].content, errors) == -1) {<br />
errors.push(reflist[i].content);<br />
}<br />
} else {<br />
refs2.push(reflist[i].content);<br />
}<br />
}<br />
}<br />
ret = [];<br />
for(var j=0; j<errors.length; j++) {<br />
ret.push({'msg':'cite-samecontent-error', 'err':errors[j]});<br />
}<br />
return ret;<br />
}}<br />
);<br />
<br />
new citeErrorCheck({'type':'reflist', 'testname':'repeated', 'desc':'cite-repeated-desc',<br />
'func': function(reflist) {<br />
var errors = [];<br />
var refs2 = [];<br />
for(var i=0; i<reflist.length; i++) {<br />
if (!reflist[i].shorttag && reflist[i].refname) {<br />
if ($.inArray(reflist[i].refname, refs2) != -1) {<br />
if ($.inArray(reflist[i].refname, errors) == -1) {<br />
errors.push(reflist[i].refname);<br />
}<br />
} else {<br />
refs2.push(reflist[i].refname);<br />
}<br />
}<br />
}<br />
ret = [];<br />
for(var j=0; j<errors.length; j++) {<br />
ret.push({'msg':'cite-repeated-error', 'err':errors[j]});<br />
}<br />
return ret;<br />
}}<br />
);<br />
<br />
new citeErrorCheck({'type':'reflist', 'testname':'undefined', 'desc':'cite-undefined-desc',<br />
'func': function(reflist) {<br />
var errors = [];<br />
var longrefs = [];<br />
for(var i=0; i<reflist.length; i++) {<br />
if (!reflist[i].shorttag && reflist[i].refname) {<br />
longrefs.push(reflist[i].refname);<br />
}<br />
}<br />
for(var j=0; i<reflist.length; j++) {<br />
if (reflist[i].shorttag && $.inArray(reflist[i].refname, errors) == -1 && $.inArray(reflist[i].refname, longrefs) == -1) {<br />
errors.push(reflist[i].refname);<br />
}<br />
}<br />
ret = [];<br />
for(var j=0; j<errors.length; j++) {<br />
ret.push({'msg':'cite-undefined-error', 'err':errors[j]});<br />
}<br />
return ret;<br />
}}<br />
);<br />
<br />
CiteTB.init();</div>
Nicolas Brouard
http://fr-i.demopaedia.org/w/index.php?title=Pr%C3%A9face&diff=11665
Préface
2015-06-29T11:11:15Z
<p>Nicolas Brouard : /* Préface */</p>
<hr />
<div><!--'''Préface'''--><br />
{{Summary}}<br />
<br />
=Préface=<br />
<br />
A sa quatrième session, la Commission de la population demanda au Secrétaire général d'inclure la préparation d'un dictionnaire démographique multilingue dans son programme de travail (E/1313).<br />
<br />
Quelques mois plus tard, l'Union internationale pour l'étude scientifique de la population, réunie à Genève en assemblée générale, offrit sa collaboration au Secrétaire général de l'Organisation des Nations Unies pour la réalisation d'un tel ouvrage et décida la création d'une Commission du dictionnaire démographique qui fut chargée de présenter un projet. A sa cinquième session, la Commission de la population demanda au Secrétaire général d'accepter l'offre faite par l'Union, et la Commission du dictionnaire fut alors chargée de réaliser en trois langues, anglais, espagnol et français, le projet qu'elle avait présenté.<br />
<br />
L'ouvrage a été conçu comme un dictionnaire essentiellement multilingue, destiné aux traducteurs. Il se compose d'une collection de volumes unilingues, constitués chacun par un texte de présentation de la terminologie technique usitée en démographie, suivi d'un index alphabétique. Le parallélisme des textes dans les différents volumes, et un système de numérotage par concepts, permettent d'établir une correspondance entre les expressions d'un même concept en diverses langues.<br />
<br />
La Commission de l'Union chargée de l'élaboration des trois volumes initiaux comprenait : MM. Paul Vincent (France), président-rapporteur ; Carlos E. Dieulefait (Argentine), Harold F. Dorn (Etats-Unis d'Amérique), Eugène Grebenik (Royaume-Uni), Pierpaolo Luzzatto-Fegiz (Italie), Marcelino Pascua (Suisse) et José Ros Jimeno (Espagne), membres.<br />
<br />
Une première ébauche de l'ouvrage fut entreprise, sur la base d'un texte français préparé par l'Institut national d'études démographiques (France) sous la direction de M. Vincent. Des versions anglaise et espagnole de ce texte furent rédigées respectivement par MM. Grebenik et Ros Jimeno.<br />
<br />
Le travail dut être exécuté avec quelque hâte, en raison de la proximité du Congrès mondial de la population, auquel le projet fut présenté sous forme d'une « édition provisoire (juin 1954) », publiée par l'Organisation des Nations Unies (ST/SOA/Series A — Etudes démographiques, n° 19). Mais la diffusion d'une édition provisoire eut le grand avantage de faire bénéficier la Commission de la collaboration de nombreux spécialistes, qui voulurent bien lui transmettre leurs observations.<br />
<br />
Nombre d'imperfections de l'édition provisoire provenaient de ce que celle-ci avait été élaborée à partir d'un seul texte, en l'espèce un texte français. Il s'avérait indispensable d'établir un compromis entre les conceptions anglo-saxonnes d'une part, et les conceptions latines d'autre part. L'expérience montrait également la nécessité d'enrichir le texte de définitions, afin de permettre à l'utilisateur de détecter les divergences éventuelles entre les expressions d'un même concept en diverses langues. <br />
<br />
Ces conclusions de la Commission ayant été approuvées, M. Grebenik reçut mission de refondre, en anglais, le texte primitif. Après quoi, MM. Grebenik et Vincent élaborèrent en commun une sorte de texte transactionnel, dont chacun rédigea une version dans sa langue. M. Ros Jimeno établit ensuite la version espagnole correspondante, et les trois volumes furent soumis à la Commission, au Bureau de l'Union, ainsi qu'à un certain nombre de spécialistes, en vue d'ultimes mises au point.<br />
<br />
En publiant les volumes anglais, espagnol et français du <i>Dictionnaire démographique multilingue, </i>il est indispensable de souligner certains caractères de l'ouvrage.<br />
<br />
En premier lieu, le fait qu'il résulte d'un travail éminemment collectif. Il est le fruit, non seulement d'une étroite coopération entre les trois principaux rédacteurs, mais de la collaboration active de tous les membres de la Commission. Il a bénéficié en outre des avis autorisés de nombreux spécialistes, qui ont bien voulu se donner la peine d'en examiner les textes aux divers stades de leur élaboration, et de consigner leurs remarques, souvent d'une façon très détaillée. La plupart des recommandations ainsi recueillies ont été retenues, en totalité ou en partie. Certaines ont été écartées, peut-être indûment.<br />
<br />
En effet, les rédacteurs ont souvent dû procéder à des options. La conception même de l'ouvrage éliminait la possibilité d'entrer dans de longues explications : il fallait fréquemment choisir entre diverses formulations possibles. Chaque volume porte ainsi l'empreinte de son rédacteur : la mention du nom de celui-ci dans la préface a pour but de signaler cette responsabilité particulière, en dégageant dans la même mesure celle des autres participants à l'entreprise.<br />
<br />
Il convient toutefois de souligner que les rédacteurs n'ont pas été libres d'écrire le texte à leur guise : les sujétions du parallélisme indispensable entre textes, ou le désir de tenir compte des avis exprimés, les ont souvent conduits à se rallier à des points de vue qu'ils ne partageaient pas entièrement. Ils ont néanmoins accepté d'assumer la responsabilité du texte, tel qu'il est.<br />
<br />
Il faut aussi appeler l'attention sur le fait que les volumes du Dictionnaire ne constituent pas des traités de démographie. Tout a été subordonné, dans leur élaboration, au but fondamental de l'ouvrage : offrir aux traducteurs un outil technique approprié à leurs besoins, et lui conférer un caractère véritablement multilingue en s'efforçant de placer toutes les langues sur un pied d'égalité.<br />
<br />
Or les langues sont des édifices empiriques, qui développent leur terminologie suivant leur logique propre, laquelle est parfois peu compatible avec les impératifs rationnels de la science. Les notions dénommées dans des langues différentes ne se correspondent souvent que fort imparfaitement. Telle langue témoigne, par un véritable luxe terminologique, de l'intérêt qu'elle porte à un sujet particulier, qu'une autre langue néglige au point de ne lui consacrer aucune dénomination spéciale. L'emploi de notes a permis d'atténuer les inconvénients qui en résultent, compte tenu du sytème de correspondance adopté. Mais il est évident qu'un exposé dépouillé de préoccupations lexicographiques se fût présenté de façon toute différente.<br />
<br />
Ces préoccupations lexicographiques sont aussi à l'origine de certains déséquilibres dans le contenu de l'ouvrage. Il a paru utile, dans certains cas, d'insérer dans le Dictionnaire une terminologie qui n'est pas à proprement parler démographique, mais qu'on a des chances de rencontrer fréquemment dans des textes démographiques, et qui est à peu près introuvable dans aucun dictionnaire et intraduisible par des non-initiés.<br />
<br />
C'est encore en considérant les besoins des traducteurs que la Commission a été conduite à adopter le principe suivant : le Dictionnaire doit avant tout faire état de l'usage, même quand il est vicieux, et ne peut déconseiller ou conseiller tel usage, que lorsqu'un consentement assez général semble pouvoir être obtenu à cet égard.<br />
<br />
L'ouvrage n'est donc pas destiné à normaliser la terminologie. Il n'est pas davantage destiné à proposer des définitions. Celles-ci n'ont été insérées que pour faciliter l'établissement des correspondances terminologiques et préciser leur portée. L'extrême concision de ces définitions n'a parfois été obtenue qu'aux dépens de leur rigoureuse pertinence. La normalisation de la terminologie nécessite des ouvrages d'un caractère tout différent. Afin d'éviter tout malentendu sur ce point, on trouvera après l'index alphabétique une liste de publications récentes émanant de divers organismes internationaux et traitant des définitions de divers concepts démographiques. C'est à ces ouvrages que le lecteur devra se reporter chaque fois qu'il rencontrera un problème de définition et non plus seulement de traduction.<br />
<br />
Le ''Dictionnaire démographique multilingue'' ne répondra pleinement au vœu de ses initiateurs que lorsqu'il sera étendu à de nombreuses langues. Grâce à des initiatives privées, la confection de quelques nouveaux volumes est d'ores et déjà projetée ou en voie de réalisation. De plus, la Commission de la population, à sa neuvième session, a demandé au Secrétariat d'étudier la possibilité d'éditer un volume en langue russe (E/2957). L'expérience dira si le compromis réalisé entre les conceptions anglo-saxonnes et latines, convient également aux langues germaniques, slaves, voire non indoeuropéennes.<br />
<br />
=Avertissement=<br />
<br />
Le ''Dictionnaire démographique multilingue'' revêt la forme d'une collection de volumes unilingues, comportant chacun deux parties : un ''texte'' assorti de ''notes'', et un ''index'' alphabétique.<br />
<br />
Le ''texte'' n'a d'autre objet que de présenter la terminologie technique usitée en démographie, dans un contexte qui en éclaire le sens. Il comprend neuf chapitres, groupant chacun un certain nombre de paragraphes. Un numéro à trois chiffres, dont le premier rappelle le rang du chapitre, permet d'identifier chaque paragraphe- -Les éléments terminologiques - mots ou expressions - qui y sont inclus, sont imprimés ''en caractères gras ''et accompagnés d'un chiffre. Celui-ci, lu à la suite du numéro du paragraphe, fournit le ''numéro de référence ''de l'élément terminologique en cause.<br />
<br />
Le numérotage a été effectué ''par concept''. Il en résulte qu'un même numéro de référence est attribué aux éléments terminologiques de même sens ou de sens très voisins, tandis que plusieurs numéros de référence sont affectés à un même élément terminologique, lorsque celui-ci est susceptible de revêtir des acceptions différentes.<br />
<br />
Certains paragraphes sont suivis de ''notes''. Celles-ci contiennent des remarques particulières au volume où elles sont insérées, et une terminologie complémentaire afférente au concept auquel elles se rapportent. Le dernier chiffre du numéro affecté à ce concept est reproduit en tête de la note correspondante. Les références à la terminologie incluse dans les notes se distinguent des références à la matière fondamentale du dictionnaire (incorporée dans le texte proprement dit) par un ''astérisque ''placé à la suite du numéro du concept.<br />
<br />
Seuls les éléments terminologiques figurant dans le texte proprement dit se correspondent de volume à volume, cette correspondance étant établie par le moyen du numéro de référence identique (à quatre chiffres, et sans astérisque) qui leur est attribué.<br />
<br />
Deux séries de paragraphes (ceux dont le numéro, commençant par 303 ou 344, se termine par une lettre) comportent, dans chaque volume, des dénominations propres à certains pays de la langue en cause. Aucune correspondance précise ne saurait être établie, de volume à volume, entre les éléments terminologiques figurant dans ces paragraphes. C'est pourquoi ces éléments n'ont pas été numérotés individuellement.<br />
<br />
Tous les éléments terminologiques imprimés en caractères gras, tant dans le texte proprement dit que dans les notes, sont classés alphabétiquement dans ''l'index, ''avec indication du ou des numéros de référence permettant de localiser leur emplacement dans la première partie du volume.<br />
<br />
Lorsqu'un concept pourvu d'un numéro de référence dans le Dictionnaire, n'a pas reçu d'expression propre dans une certaine langue, celle qui figure sous ce numéro dans le volume correspondant est imprimée ''en italique, ''et non en caractères gras comme les expressions reçues. Elle n'est indiquée qu'à titre de suggestion, pour faciliter le travail des traducteurs, et n'est pas reproduite dans l'index. Elle se distingue des citations, également imprimées en italique, par le chiffre qui l'accompagne.<br />
<br />
Le ''mode d'utilisation'' du Dictionnaire peut être illustré schématiquement de la façon suivante. Soit à traduire en français l'expression anglaise d'un certain concept. L'index anglais fournit, en regard de l'élément terminologique à traduire, le numéro affecté au concept exprimé. En se reportant au paragraphe correspondant du texte français, on trouve l'expression française de ce concept.<br />
<br />
Dans la pratique, il est indispensable de ''lire tout le paragraphe ''auquel on se reporte, sans oublier les notes, non seulement parce qu'on y trouvera souvent des indications utiles, mais aussi parce que les nécessités de la rédaction ont parfois imposé de ranger au sein d'un même paragraphe les éléments terminologiques ou les explications qui s'y rapportent, dans un ordre différent de celui des numéros de référence.<br />
<br />
Il est non moins indispensable de ''comparer les deux versions du même paragraphe ''dans les deux langues, ce qui permettra de se rendre compte, le cas échéant, des différences de sens entre expressions qui ne sont qu'approximativement équivalentes.<br />
<br />
Signalons enfin que si plusieurs expressions synonymes figurent sous le même numéro dans le texte français, on aura généralement avantage à choisir la première, ou l'une des premières expressions citées. En effet, celles dont l'emploi est recommandé ont été, sauf indication contraire, systématiquement insérées en tête des énumérations.<br />
<br />
Quant à la ''recherche dans l'index français, ''elle sera facilitée par la connaissance de certains des principes qui ont présidé à la confection de cet index.<br />
<br />
Les expressions incluses dans la première partie du volume à titre d'éléments teminologiques ont été reproduites dans l'index sous les principaux mots et groupes de mots constitutifs. Les ''groupes de mots'' pouvant être considérés comme exprimant, à eux seuls, un concept particulier ont été inclus dans l'index, à la suite du premier mot constitutif du groupe, dans un ordre alphabétique strict, les particules (articles, prépositions, etc.) étant prises en considération pour ce classement. On notera pourtant que les mots composés comportant un trait d'union ont été traités comme des groupes de mots — ceci afin d'éviter toute ambiguïté sur la localisation d'éléments tels que : « enquête pilote », « âge pivot », « population-type », etc.<br />
<br />
<br />
Cette conception de l'ordre alphabétique a paru avantageuse pour la recherche au sein de longues listes d'expressions présentées en colonne, et préférable, à ce titre, à la méthode du classement par mots significatifs. Il en résulte pourtant quelques particularités qu'il importe de signaler à l'utilisateur.<br />
<br />
C'est ainsi que, pour ne pas surcharger l'index de variantes encombrantes, certaines expressions telles que « statistiques ''de ''famille », « cause ''de ''décès », « dissolution ''du ''mariage », n'y ont été citées que sous cette forme, à l'exclusion de la suivante qu'elles revêtent volontiers : « statistique ''des'' familles », « cause ''du'' décès », « dissolution ''des'' mariages ». On pourra s'affranchir des incertitudes de classement qui en résultent, en cherchant d'abord les expressions de ce genre sous le dernier mot constitutif du groupe. <br />
<br />
<br />
=Liste des abréviations utilisées dans le volume français=<br />
<br />
{|<br />
|adj. ||adjectif<br />
|-<br />
|adv. ||adverbe<br />
|-<br />
|cf. ||conférer, voir<br />
|-<br />
|ex. || exemple<br />
|-<br />
|f. ||féminins.<br />
|-<br />
|ff. ||faisant fonction de<br />
|-<br />
|i. ||intransitif<br />
|-<br />
|m. ||masculin<br />
|-<br />
|néol. ||néologisme<br />
|-<br />
|p.ex. ||par exemple<br />
|-<br />
|pl. ||pluriel<br />
|-<br />
|pp. ||participe passé<br />
|-<br />
|ppr. ||participe présent<br />
|-<br />
|sg. ||singulier<br />
|-<br />
|s. ||substantif<br />
|-<br />
|t. ||transitif<br />
|-<br />
|v. ||verbe<br />
|-<br />
|vx. ||vieux, vieilli, archaïque<br />
|}<br />
<br />
{{SummaryShort}}<br />
{{OtherLangPrefaces}}</div>
Nicolas Brouard
http://fr-i.demopaedia.org/w/index.php?title=Mod%C3%A8le:OtherLangPrefaces&diff=11664
Modèle:OtherLangPrefaces
2013-05-19T18:05:48Z
<p>Nicolas Brouard : Adding Serbocroation Predgovor</p>
<hr />
<div><br />
<!--'''Template:OtherLangPrefaces'''--><br />
[[ar-I:مـقـدمــــة]] [[ar-II:مـقـدمــــة]] [[cs-I:Předmluva]] [[cs-II:Předmluva]] [[de-I:Vorwort]] [[de-II:Vorwort]] [[en-I:Preface]] [[en-II:Preface]] [[es-I:Prólogo]] [[es-II:Prólogo]] [[et-II:Prantsuse]] [[fi-I:Esipuhe]] [[fr-II:Préface]] [[fr-I:Préface]] [[it-I:Prefazione]] [[it-II:Prefazione]] [[ja-II:序文]] [[pl-I:Przedmowa]] [[pt-I:Prefacio]] [[pt-II:Prefacio]] [[ru-I:Вступление]] [[ru-II:Вступление]] [[sh-i:Predgovor]] [[sv-I:Förord]] [[zh-II:序文]]</div>
Nicolas Brouard
http://fr-i.demopaedia.org/w/index.php?title=Accueil&diff=11663
Accueil
2013-05-19T18:03:54Z
<p>Nicolas Brouard : Other languages</p>
<hr />
<div><!--'''Accueil'''--><br />
{{Summary}}<br />
__TOC__<br />
<br />
= Le dictionnaire démographique multilingue accessible en ligne =<br />
<br />
Le dictionnaire démographique multilingue a été publié dans deux éditions et de nombreuses langues, récemment pour certaines. Le site Demopædia donne accès à leur version électronique. <br />
Vous pouvez désormais lire ce classique « en ligne » ou imprimer une version au format PDF.<br />
Vous pouvez rechercher un terme démographique, surfer vers un terme ou une expression similaire ou changer de langue ou d'édition.<br />
<br />
= Demopædia =<br />
Prenant comme point de départ la dernière édition du dictionnaire démographique multilingue, nous lançons Demopædia – une encyclopédie basée sur la technologie wiki, ouverte à tous les spécialistes en matière de population qui désirent améliorer et compléter ces textes qui doivent être révisés.<br />
<br />
Demopædia a l'ambition de laisser les scientifiques déterminer eux-mêmes les frontières de la discipline démographique tout en partageant leurs connaissances via des médias modernes.<br />
<br />
= La prochaine édition du dictionnaire démographique multilingue =<br />
<br />
A partir des travaux de Demopædia, un groupe de Démopædiens, sélectionné parmi les plus actifs, élaborera la troisième édition. Plus vous collaborerez à l'encyclopédie, meilleure sera la qualité de cette troisième édition.<br />
<br />
= Historique =<br />
<br />
La création de la série des dictionnaires démographiques encyclopédiques multilingues est un des projets les plus longs de l'histoire de notre discipline. Mais aussi un des plus fructueux. Au milieu des années 1950, la Division de la population des Nations Unies a rassemblé une équipe d'experts, afin de diffuser l'état de l'art de la démographie dans un dictionnaire publié dans l'ensemble des langues officielles des Nations Unies. Deux décennies plus tard, la Division a contribué au travail de révision de cet outil de référence lancé par l'UIESP. Les chercheurs et enseignants de nombreux pays ont rejoint le projet, le plus souvent de manière informelle, en élaborant leur propre édition locale à partir de ces standards ONU/UIESP. Ainsi la communauté internationale dispose d'une série de 14 dictionnaires démographiques encyclopédiques. Mais aujourd'hui ces ouvrages sont épuisés et il est bien difficile de trouver les rares bibliothèques qui les possèdent tous.<br />
<br />
= Pourquoi en ligne ?=<br />
<br />
La disponibilité du dictionnaire démographique multilingue sur l'Internet le rend à nouveau accessible et au plus grand nombre. Les expressions démographiques, leur sens et leur contexte, sont désormais à deux clics pour les étudiants, professeurs, chercheurs, journalistes, experts gouvernementaux ou membres des ONG. Il vous est possible de comprendre le sens d'un terme dans votre langue de travail. De plus, le dictionnaire multilingue vous aide à comprendre les textes spécialisés écrits dans d'autres langues.<br />
<br />
= Des usages multiples =<br />
<br />
Outre les possibilités offertes par les versions électroniques comme la recherche et la navigation, le dictionnaire encyclopédique est aussi un livre organisé en chapitres thématiques qui peuvent être lus d'une traite. Vous pouvez consulter les différentes langues du dictionnaire, les lire en ligne, les télécharger et les imprimer : tous les détenteurs de droits d'auteurs nous ont autorisé à vous fournir ces possibilités. Les index permettent également de cerner une recherche. <br />
La plateforme Wiki fournit des outils puissants pour les développements futurs. Les spécialistes peuvent proposer des ajouts ou corrections en ligne et les discuter de manière collective. <br />
<br />
= La prochaine étape =<br />
<br />
Le savoir démographique a fait d'énormes avancées depuis les dernières éditions du dictionnaire. Il paraît évident que la structure et les textes doivent être mis à jour. Effectuer cette mise à jour de manière traditionnelle avec des participants se rencontrant de visu et des groupes de travail, semble aujourd'hui difficilement possible. Le développement en ligne d'une nouvelle édition du dictionnaire encyclopédique démographique multilingue devrait être efficace et utiliser au mieux le potentiel d'une large communauté de professionnels. Demopædia sera l'hôte de ce projet. Demopædia pourra également devenir une plateforme de partage et de construction d'une base de connaissance élargie sur la démographie et les études de population. Notre approche est celle d'une encyclopédie sur la population en constante évolution qui puisse servir la communauté mondiale tout en bénéficiant d'un afflux d'idées et de textes.<br />
<br />
<noinclude><br />
{{SummaryShort}}<br />
</noinclude><br />
[[ar-i:الصفحة الرئيسية]]<br />
[[cs-i:Hlavní strana]]<br />
[[en-i:Main_Page]]<br />
[[es-i:Página principal]]<br />
[[fr-ii:Accueil]]<br />
[[id-ii:Halaman Utama]]<br />
[[it-i:Pagina principale]]<br />
[[ja-ii:メインページ]]<br />
[[ko-ii:대문]]<br />
[[ms-ii:Laman utama]]<br />
[[ne-ii:मुख्य पृष्ठ]]<br />
[[pl-i:Strona główna]]<br />
[[pt-i:Página principal]]<br />
[[ru-i:Заглавная страница]]<br />
[[sv-i:Glavna strana]]<br />
[[th-ii:หน้าหลัก]]<br />
[[vi-ii:Trang Chính]]<br />
[[zh-ii:首页]]</div>
Nicolas Brouard
http://fr-i.demopaedia.org/w/index.php?title=10&diff=11662
10
2012-12-12T16:14:39Z
<p>Nicolas Brouard : /* 101 */</p>
<hr />
<div><br />
<!--'''10'''--><br />
{{CurrentStatus}}<br />
{{Unmodified edition I}}<br />
{{Summary}}<br />
__NOTOC__<br />
= Généralités =<br />
== 10 ==<br />
<br />
<br />
=== 101 ===<br />
<br />
La {{TextTerm|démographie|1|101}} est une science ayant pour objet l’étude des {{NonRefTerm|populations}} humaines, et traitant de leur dimension, de leur structure, de leur évolution et de leurs caractères généraux envisagés principalement d’un point de vue quantitatif. En terminologie statistique, le mot {{TextTerm|population|2|101}} peut désigner toute collection d’unités distinctes : il est alors synonyme d’{{TextTerm|univers|2|101|2}}. On emploie plus communément le mot {{TextTerm|population|3|101}} pour désigner l’ensemble des {{TextTerm|habitants|4|101|IndexEntry=habitant}} d’un certain territoire, parfois même une fraction seulement de cet ensemble (ex. : {{NonRefTerm|population d’âge scolaire}}, {{NonRefTerm|population mariable)}}, auquel cas il s’agit, à proprement parler, d’une {{TextTerm|sous-population|5|101|OtherIndexEntry=population. sous- ...}}. Il arrive fréquemment qu’on entende par {{TextTerm|population|6|101}}, non pas la collectivité elle-même (au sens du n° {{RefNumber|10|1|3}}), mais son {{TextTerm|effectif|6|101|2}}, c’est-à-dire le nombre des habitants qui la composent.<br />
{{Note|1| {{NoteTerm|démographie}}, s. f. — {{NoteTerm|démographique}}, adj. — {{NoteTerm|démographe}}, s. m. : spécialiste de la démographie.<br />Noter que l’adjectif {{NonRefTerm|démographique}} offre généralement la traduction correcte du substantif anglais «population» employé adjectivement; ex. «population problems», {{NonRefTerm|problèmes démographiques}} (ou : {{NonRefTerm|questions démographiques}}).}}<br />
{{Note|3| Noter qu’au XVIII<sup>e</sup> siècle, le mot {{NoteTerm|population}} avait aussi un sens actif qu’il a perdu depuis. Il désignait alors l’action de {{NonRefTerm|peupler}}, et a été remplacé par le mot {{NonRefTerm|peuplement}} ({{RefNumber|81|5|6}}*) en cet emploi.}}<br />
{{Note|4| {{NoteTerm|habitant}}, s. m. — {{NoteTerm|habiter}}, v. t. — {{NoteTerm|habitation}} s. f. : action d’habiter (cf. {{RefNumber|12|0|1}}*); maison où l’on habite.}}<br />
<br />
=== 102 ===<br />
<br />
On peut distinguer, au sein de la {{NonRefTerm|démographie}} ({{RefNumber|10|1|1}}), plusieurs grandes disciplines, dont certaines ont reçu des dénominations spéciales. La {{TextTerm|démographie descriptive|1|102|OtherIndexEntry=descriptive. démographie ...}} traite de la dimension, de la répartition géographique, de la structure et du développement des {{NonRefTerm|populations}} ({{RefNumber|10|1|3}}), d’un point de vue purement descriptif, en s’appuyant principalement sur des {{TextTerm|statistiques démographiques|2|102|IndexEntry=statistique démographique|OtherIndexEntry=démographique. statistique ...}} — tableaux numériques élaborés à l’aide de la {{NonRefTerm|statistique démographique}} (sg., {{RefNumber|13|0|1}}). Au contraire, la {{TextTerm|démographie théorique|3|102|OtherIndexEntry=théorique. démographie ...}}, dite aussi {{TextTerm|démographie pure|3|102|2|OtherIndexEntry=pure. démographie ...}}, envisage les populations d’un point de vue général et abstrait, s’attachant à l’étude des relations formelles entre les différents phénomènes démographiques. Entre ces deux disciplines se situe l’{{NonRefTerm|analyse démographique}} (cf. {{RefNumber|10|5|2}}, 1<sup>er</sup> sens), qui étudie les phénomènes démographiques observés dans des populations concrètes. L’expression {{TextTerm|étude démographique|4|102|OtherIndexEntry=démographique. étude ...}} est fréquemment employée pour désigner un travail particulier de cette nature. L’ensemble des disciplines précédentes constitue ce qu’on appelle parfois la {{TextTerm|démographie quantitative|5|102|OtherIndexEntry=quantitative. démographie ...}}, en raison de l’importance qui y est attribuée à l’aspect numérique des phénomènes, et pour la distinguer des branches de la démographie mentionnées aux paragraphes suivants (103 et 104).<br />
{{Note|4| Étudier la {{NoteTerm|conjoncture démographique}}, c’est s’efforcer de déterminer les tendances qui se dessinent dans l’évolution d’une population, le mot {{NonRefTerm|conjoncture}} évoquant une situation mouvante envisagée d’après les données les plus actuelles. }}<br />
<br />
=== 103 ===<br />
<br />
La {{NonRefTerm|démographie}} ({{RefNumber|10|1|1}}) comprend aussi l’étude des relations entre les phénomènes démographiques d’une part, et les phénomènes économiques ou sociaux d’autre part : les dénominations {{TextTerm|démographie économique|1|103|OtherIndexEntry=économique. démographie ...}} et {{TextTerm|démographie sociale|2|103|OtherIndexEntry=sociale. démographie ...}} sont utilisées pour désigner ces branches particulières de la démographie. Quant à la {{TextTerm|démographie qualitative|3|103|OtherIndexEntry=qualitative. démographie ...}}, elle s’intéresse spécialement à la distribution des caractères qualitatifs — intellectuels, physiques, sociaux, etc. — au sein des {{NonRefTerm|populations}} ({{RefNumber|10|1|3}}), et comprend notamment la {{TextTerm|génétique démographique|4|103|OtherIndexEntry=démographique. génétique ...}}, ou {{TextTerm|génétique de population|4|103|2|OtherIndexEntry=population. génétique de ...}} (cf. {{RefNumber|91|0|4}}). L’{{TextTerm|écologie humaine|5|103|OtherIndexEntry=humaine. écologie ...}}, qui étudie la répartition territoriale et l’organisation des communautés, en apportant une attention particulière aux processus compétitifs et coopératifs qui s’y manifestent, a de nombreux points communs avec la démographie, de même que la {{TextTerm|biométrie|6|103}}, qui englobe les applications de la statistique à la recherche biologique.<br />
{{Note|4| Ne pas confondre la {{NonRefTerm|génétique démographique}} avec la {{NoteTerm|génétique humaine}} : cette dernière étudie la transmission des {{NonRefTerm|gènes}} ({{RefNumber|91|0|3}}) dans l’espèce humaine, alors que la première traite de la répartition de ces gènes dans les {{NonRefTerm|populations}}.<br />Noter, d’autre part, qu’à la différence de {{NonRefTerm|génétique démographique}}, l’expression {{NonRefTerm|génétique de population}} peut s’appliquer éventuellement à des {{NonRefTerm|populations}} non humaines (cf. {{RefNumber|10|1|2}}), d’animaux ou de plantes.}}<br />
{{Note|5| {{NoteTerm|écologie}}, s. f. — {{NoteTerm|écologique}}, adj. — {{NoteTerm|écologue}}, s. m. : spécialiste de l’écologie.}}<br />
{{Note|6| {{NoteTerm|biométrie}}, s. f. — {{NoteTerm|biométrique}}, adj. — {{NoteTerm|biométricien}}, s. m. : spécialiste de la biométrie}}<br />
<br />
=== 104 ===<br />
<br />
La {{NonRefTerm|démographie}} ({{RefNumber|10|1|1}}) comprend enfin l’étude des {{TextTerm|doctrines démographiques|1|104|IndexEntry=doctrine démographique|OtherIndexEntry=démographique. doctrine ...}} ou {{TextTerm|théories démographiques|1|104|2|IndexEntry=théorie démographique|OtherIndexEntry=démographique. théorie ...}} ou {{TextTerm|théories de la population|1|104|3|IndexEntry=théorie de la population|OtherIndexEntry=population. théorie de la ...}} qui se proposent d’expliquer ou de prévoir, par des considérations économiques, sociologiques ou autres, l’évolution des phénomènes démographiques et de mettre en lumière leurs conséquences. Ces doctrines peuvent éventuellement servir de base à l’élaboration d’une {{TextTerm|politique démographique|2|104|OtherIndexEntry=démographique. politique ...}} (cf. § {{NonRefTerm|930}}), dont les démographes s’efforcent de déterminer l’efficacité.<br />
{{Note|1| L’expression {{NoteTerm|théorie de la population}} (sg.) revêt parfois le sens de {{NonRefTerm|démographie théorique}} ({{RefNumber|10|2|3}}).}}<br />
<br />
=== 105 ===<br />
<br />
Quelques disciplines particulières de la {{NonRefTerm|démographie}} ({{RefNumber|10|1|1}}) ont reçu des dénominations spéciales. La {{TextTerm|démographie historique|1|105|OtherIndexEntry=historique. démographie ...}} traite de l’histoire du développement des {{NonRefTerm|populations}} ({{RefNumber|10|3|3}}); l’expression est parfois employée en un sens étroit, pour désigner l’étude des seules populations de l’ère préstatistique, en raison des méthodes particulières auxquelles on doit alors avoir recours. L’expression {{TextTerm|analyse démographique|2|105|OtherIndexEntry=démographique. analyse ...}} semble devoir être réservée à l’étude des phénomènes démographiques observés dans des populations concrètes (cf. {{RefNumber|10|2|4}}). Elle a pourtant été utilisée pour distinguer la partie de la {{NonRefTerm|démographie théorique}} ({{RefNumber|10|2|3}}) qui fait appel aux méthodes de l’analyse mathématique; il semblerait toutefois préférable de lui substituer l’expression {{TextTerm|démographie mathématique|3|105|OtherIndexEntry=mathématique. démographie ...}} en cet emploi. Une école démographique contemporaine comprend sous le nom de {{TextTerm|démographie potentielle|4|105|OtherIndexEntry=potentielle. démographie ...}} la théorie des {{NonRefTerm|potentiels-vie}} ({{RefNumber|43|3|6}}) et ses applications.<br />
<br />
==<center><font size=12>* * * </font></center>==<br />
{{SummaryShort}}<br />
<br />
{{OtherLanguages|10}}</div>
Nicolas Brouard
http://fr-i.demopaedia.org/w/index.php?title=Mod%C3%A8le:OtherLanguages&diff=11661
Modèle:OtherLanguages
2012-12-12T16:09:52Z
<p>Nicolas Brouard : serbo-croate</p>
<hr />
<div><!--'''Template:OtherLanguages'''--><br />
[[fr-II:{{{1}}}]] [[ar-I:{{{1}}}]] [[cs-I:{{{1}}}]] [[de-I:{{{1}}}]] [[en-I:{{{1}}}]] [[es-I:{{{1}}}]] [[fi-I:{{{1}}}]] [[it-I:{{{1}}}]] [[pl-I:{{{1}}}]] [[pt-I:{{{1}}}]] [[sh-I:{{{1}}}]] [[ru-I:{{{1}}}]]</div>
Nicolas Brouard
http://fr-i.demopaedia.org/w/index.php?title=MediaWiki:Edittools&diff=11685
MediaWiki:Edittools
2012-08-30T15:23:15Z
<p>Nicolas Brouard : </p>
<hr />
<div><div id="editpage-specialchars" style="margin-top: 15px; border: 1px solid #aaaaaa; padding: 2px;" class="edittools-text edittools-version-045"><!-- INCREMENT THIS VERSION NUMBER TO MAKE CHANGES TO [[MediaWiki:Edittools.js]] LIVE --><br />
<!--<br />
This div gets automatically replaced with the actual edit tools by the code in [[MediaWiki:Edittools.js]]. Please make any changes there. Any content is this div is only shown to users with JavaScript turned off (or unsupported).<br />
--><br />
'''Copy and paste:''' – — ° ″ ′ ≈ ≠ ≤ ≥ ± − × ÷ ← → · § &nbsp; '''Sign your posts on talk pages:''' <nowiki>~~~~</nowiki><br />
----<br />
<small><br />
Special Multilingual Demographic Dictionary :<br />
{{TextTerm|Demography|1}} is ... interdisciplinary fields such as {{NonRefTerm|economic demography}} ({{RefNumber|10|4|1}}), <br />
{{Note|1| {{NoteTerm|demographer}}, n.: a specialist in demography.}}<br />
<pre><br />
{{TextTerm|Demography|1}} is ... interdisciplinary fields such as {{NonRefTerm|economic demography}} ({{RefNumber|10|4|1}}), <br />
{{Note|1| {{NoteTerm|demographer}}, n.: a specialist in demography.}}</pre><br />
<charinsert><nowiki>{{</nowiki>TextTerm|+|}} <nowiki>{{</nowiki>RefNumber|+||}} <nowiki>{{</nowiki>Note|+|}} <nowiki>{{</nowiki>NoteTerm|}}</charinsert><br />
<nowiki>{{}}</nowiki> &nbsp; <nowiki>{{{}}}</nowiki> &nbsp; | &nbsp; <nowiki>[]</nowiki> &nbsp; <nowiki>[[]]</nowiki> &nbsp; <nowiki>[[Category:]]</nowiki> &nbsp; <nowiki>#REDIRECT [[]]</nowiki> &nbsp; &amp;nbsp; &nbsp; &lt;s>&lt;/s> &nbsp; &lt;sup>&lt;/sup> &nbsp; &lt;sub>&lt;/sub> &nbsp; &lt;code>&lt;/code> &nbsp; &lt;pre>&lt;/pre> &nbsp; &lt;blockquote>&lt;/blockquote> &nbsp; &lt;ref>&lt;/ref> &nbsp; <nowiki><br />
{{Reflist}}</nowiki> &nbsp; &lt;references/> &nbsp; &lt;includeonly>&lt;/includeonly> &nbsp; &lt;noinclude>&lt;/noinclude> &nbsp; <nowiki>{{DEFAULTSORT:}}</nowiki> &nbsp; &lt;nowiki>&lt;/nowiki> &nbsp; &lt;!-- --> &nbsp; &lt;span class="plainlinks">&lt;/span><br />
</small><br />
----<br />
<small><br />
'''Symbols:''' ~ | ¡ ¿ † ‡ ↔ ↑ ↓ • ¶ &nbsp; # ½ ⅓ ⅔ ¼ ¾ ⅛ ⅜ ⅝ ⅞ ∞ &nbsp; ‘ ’ “ ” «» &nbsp; ¤ ₳ ฿ ₵ ¢ ₡ ₢ $ ₫ ₯ € ₠ ₣ ƒ ₴ ₭ ₤ ℳ ₥ ₦ № ₧ ₰ £ ៛ ₨ ₪ ৳ ₮ ₩ ¥ &nbsp; ♠ ♣ ♥ ♦ &nbsp; m² m³ &nbsp; ♭ ♯ ♮ &nbsp; © ® ™<br /><br />
'''Latin:''' A a Á á À à  â Ä ä Ǎ ǎ Ă ă Ā ā à ã Å å Ą ą Æ æ Ǣ ǣ &nbsp; B b &nbsp; C c Ć ć Ċ ċ Ĉ ĉ Č č Ç ç &nbsp; D d Ď ď Đ đ Ḍ ḍ Ð ð &nbsp; E e É é È è Ė ė Ê ê Ë ë Ě ě Ĕ ĕ Ē ē Ẽ ẽ Ę ę Ə ə &nbsp; F f &nbsp; G g Ġ ġ Ĝ ĝ Ğ ğ Ģ ģ &nbsp; H h Ĥ ĥ Ħ ħ Ḥ ḥ &nbsp; I i İ ı Í í Ì ì Î î Ï ï Ǐ ǐ Ĭ ĭ Ī ī Ĩ ĩ Į į &nbsp; J j Ĵ ĵ &nbsp; K k Ķ ķ &nbsp; L l Ĺ ĺ Ŀ ŀ Ľ ľ Ļ ļ Ł ł Ḷ ḷ Ḹ ḹ &nbsp; M m Ṃ ṃ &nbsp; N n Ń ń Ň ň Ñ ñ Ņ ņ Ṇ ṇ &nbsp; O o Ó ó Ò ò Ô ô Ö ö Ǒ ǒ Ŏ ŏ Ō ō Õ õ Ǫ ǫ Ő ő Ø ø Œ œ &nbsp; P p &nbsp; Q q &nbsp; R r Ŕ ŕ Ř ř Ŗ ŗ Ṛ ṛ Ṝ ṝ &nbsp; S s Ś ś Ŝ ŝ Š š Ş ş Ș ș Ṣ ṣ ß &nbsp; T t Ť ť Ţ ţ Ț ț Ṭ ṭ Þ þ &nbsp; U u Ú ú Ù ù Û û Ü ü Ǔ ǔ Ŭ ŭ Ū ū Ũ ũ Ů ů Ų ų Ű ű Ǘ ǘ Ǜ ǜ Ǚ ǚ Ǖ ǖ &nbsp; V v &nbsp; W w Ŵ ŵ &nbsp; X x &nbsp; Y y Ý ý Ŷ ŷ Ÿ ÿ Ỹ ỹ Ȳ ȳ &nbsp; Z z Ź ź Ż ż Ž ž &nbsp; ß Ð ð Þ þ Ə ə &nbsp; <nowiki>{{Unicode|}}</nowiki> <br /><br />
'''Greek:''' Ά ά Έ έ Ή ή Ί ί Ό ό Ύ ύ Ώ ώ &nbsp; Α α Β β Γ γ Δ δ &nbsp; Ε ε Ζ ζ Η η Θ θ &nbsp; Ι ι Κ κ Λ λ Μ μ &nbsp; Ν ν Ξ ξ Ο ο Π π &nbsp; Ρ ρ Σ σ ς Τ τ Υ υ &nbsp; Φ φ Χ χ Ψ ψ Ω ω &nbsp; <nowiki>{{Polytonic|}}</nowiki> <br /><br />
'''Cyrillic:''' А а Б б В в Г г &nbsp; Ґ ґ Ѓ ѓ Д д Ђ ђ &nbsp; Е е Ё ё Є є Ж ж &nbsp; З з Ѕ ѕ И и І і &nbsp; Ї ї Й й Ј ј К к &nbsp; Ќ ќ Л л Љ љ М м &nbsp; Н н Њ њ О о П п &nbsp; Р р С с Т т Ћ ћ &nbsp; У у Ў ў Ф ф Х х &nbsp; Ц ц Ч ч Џ џ Ш ш &nbsp; Щ щ Ъ ъ Ы ы Ь ь &nbsp; Э э Ю ю Я я &nbsp; ́ <br /><br />
'''IPA:''' t̪ d̪ ʈ ɖ ɟ ɡ ɢ ʡ ʔ &nbsp; ɸ ʃ ʒ ɕ ʑ ʂ ʐ ʝ ɣ ʁ ʕ ʜ ʢ ɦ &nbsp; ɱ ɳ ɲ ŋ ɴ &nbsp; ʋ ɹ ɻ ɰ &nbsp; ʙ ʀ ɾ ɽ &nbsp; ɫ ɬ ɮ ɺ ɭ ʎ ʟ &nbsp; ɥ ʍ ɧ &nbsp; ɓ ɗ ʄ ɠ ʛ &nbsp; ʘ ǀ ǃ ǂ ǁ &nbsp; ɨ ʉ ɯ &nbsp; ɪ ʏ ʊ &nbsp; ɘ ɵ ɤ &nbsp; ə ɚ &nbsp; ɛ ɜ ɝ ɞ ʌ ɔ &nbsp; ɐ ɶ ɑ ɒ &nbsp; ʰ ʷ ʲ ˠ ˤ ⁿ ˡ &nbsp; ˈ ˌ ː ˑ ̪ &nbsp; <nowiki>{{IPA|}}</nowiki><br />
</small><br />
<!--<br />
Everything up to here gets automatically replaced with the JavaScript edit tools for users with JavaScript enabled.<br />
--><br />
</div><br />
<br />
<div style="margin-top: 1em;" id="editpage-copywarn2"><br />
<strong style="font-size: 130%;">Please note:</strong><br />
* When you click Save page, your changes will immediately become visible to everyone. If you wish to run a test, please edit the [[Wikipedia:Sandbox|Sandbox]] instead.<br />
*Please post only [[Wikipedia:Wikipedia is an encyclopedia|encyclopedic]] information that can be [[Wikipedia:Verifiability|verified]] by external sources. Please maintain a [[Wikipedia:Neutral point of view|neutral]], unbiased point of view.<br />
* Please [[Wikipedia:Copy-paste|do not copy and paste]] from copyrighted websites – only [[Wikipedia:public domain|public domain]] resources can be copied without permission.<br />
</div></div>
Nicolas Brouard
http://fr-i.demopaedia.org/w/index.php?title=MediaWiki:Edittools.js&diff=11683
MediaWiki:Edittools.js
2012-08-30T15:13:10Z
<p>Nicolas Brouard : </p>
<hr />
<div>// copied from [[mw:User:Alex Smotrov/edittools.js]], modified for use on the English Wikipedia.<br />
// enableForAllFields() feature from [[commons:MediaWiki:Edittools.js]]<br />
// combined and modified by [[User:Ilmari Karonen]]<br />
// after making changes to this page and testing them, update the number after "edittools-version-" in [[MediaWiki:Edittools]] to purge the cache for everyone<br />
<br />
if (typeof (EditTools_set_focus) == 'undefined')<br />
var EditTools_set_focus = true;<br />
<br />
if (typeof (EditTools_set_focus_initially) == 'undefined')<br />
var EditTools_set_focus_initially = EditTools_set_focus;<br />
<br />
var EditTools =<br />
{<br />
charinsert : {<br />
'Insert': ' – — ‘+’ “+” ° ″ ′ ≈ ≠ ≤ ≥ ± − × ÷ √ ← → · § Sign_your_posts_on_talk_pages: ~~\~~ Cite_your_sources: <ref>+</ref>',<br />
'Wiki markup': 'Insert: – — ‘+’ “+” ° ″ ′ ≈ ≠ ≤ ≥ ± − × ÷ √ ← → · § ~~\~~ <ref>+</ref> Wiki_markup: {\{+}} {\{\{+}}} | {\{TextTerm|demography|1+}} {\{RefNumber|+13|0|1}} {\{NonRefTerm|+}} {\{Note|+|}} {\{NoteTerm|+}} [+] [\[+]] [\[Category:+]] #REDIRECT.[\[+]] &nbsp; <s>+</s> <sup>+</sup> <sub>+</sub> <code>+</code> <pre>+</pre> <blockquote>+</blockquote> <ref.name="+"/> {\{#tag:ref|+|group="nb"}} {\{Reflist}} <references/> <includeonly>+</includeonly> <noinclude>+</noinclude> {\{DEFAULTSORT:+}} <nowiki>+</nowiki> <!--.+_--> <span.class="plainlinks">+</span>',<br />
'Symbols': '~ | ¡¿†‡↔↑↓•¶ # ½⅓⅔¼¾⅛⅜⅝⅞∞ ‘+’ “+” ‹+› «+» ⟨+⟩ ¤₳฿₵¢₡₢$₫₯€₠₣ƒ₴₭₤ℳ₥₦№₧₰£៛₨₪৳₮₩¥ ♠♣♥♦ m² m³ ♭♯♮ ©®™ ◌ {\{Unicode|+}}', <br />
'Latin': 'A a Á á À à  â Ä ä Ǎ ǎ Ă ă Ā ā à ã Å å Ą ą Æ æ Ǣ ǣ B b C c Ć ć Ċ ċ Ĉ ĉ Č č Ç ç D d Ď ď Đ đ Ḍ ḍ Ð ð E e É é È è Ė ė Ê ê Ë ë Ě ě Ĕ ĕ Ē ē Ẽ ẽ Ę ę Ɛ ɛ Ə ə F f G g Ġ ġ Ĝ ĝ Ğ ğ Ģ ģ H h Ĥ ĥ Ħ ħ Ḥ ḥ I i İ ı Í í Ì ì Î î Ï ï Ǐ ǐ Ĭ ĭ Ī ī Ĩ ĩ Į į J j Ĵ ĵ K k Ķ ķ L l Ĺ ĺ Ŀ ŀ Ľ ľ Ļ ļ Ł ł Ḷ ḷ Ḹ ḹ M m Ṃ ṃ N n Ń ń Ň ň Ñ ñ Ņ ņ Ṇ ṇ Ŋ ŋ O o Ó ó Ò ò Ô ô Ö ö Ǒ ǒ Ŏ ŏ Ō ō Õ õ Ǫ ǫ Ő ő Ø ø Œ œ Ɔ ɔ P p Q q R r Ŕ ŕ Ř ř Ŗ ŗ Ṛ ṛ Ṝ ṝ S s Ś ś Ŝ ŝ Š š Ş ş Ṣ ṣ ß T t Ť ť Ţ ţ Ṭ ṭ Þ þ U u Ú ú Ù ù Û û Ü ü Ǔ ǔ Ŭ ŭ Ū ū Ũ ũ Ů ů Ų ų Ű ű Ǘ ǘ Ǜ ǜ Ǚ ǚ Ǖ ǖ V v W w Ŵ ŵ X x Y y Ý ý Ŷ ŷ Ÿ ÿ Ỹ ỹ Ȳ ȳ Z z Ź ź Ż ż Ž ž ß Ð ð Þ þ Ŋ ŋ Ə ə {\{Unicode|+}}',<br />
'Greek': 'ΆάΈέΉήΊίΌόΎύΏώ ΑαΒβΓγΔδ ΕεΖζΗηΘθ ΙιΚκΛλΜμ ΝνΞξΟοΠπ ΡρΣσςΤτΥυ ΦφΧχΨψΩω ᾼᾳᾴᾺὰᾲᾶᾷἈἀᾈᾀἉἁᾉᾁἌἄᾌᾄἊἂᾊᾂἎἆᾎᾆἍἅᾍᾅἋἃᾋᾃἏἇᾏᾇ ῈὲἘἐἙἑἜἔἚἒἝἕἛἓ ῌῃῄῊὴῂῆῇἨἠᾘᾐἩἡᾙᾑἬἤᾜᾔἪἢᾚᾒἮἦᾞᾖἭἥᾝᾕἫἣᾛᾓἯἧᾟᾗ ῚὶῖἸἰἹἱἼἴἺἲἾἶἽἵἻἳἿἷ ῸὸὈὀὉὁὌὄὊὂὍὅὋὃ ῤῬῥ ῪὺῦὐὙὑὔὒὖὝὕὛὓὟὗ ῼῳῴῺὼῲῶῷὨὠᾨᾠὩὡᾩᾡὬὤᾬᾤὪὢᾪᾢὮὦᾮᾦὭὥᾭᾥὫὣᾫᾣὯὧᾯᾧ {\{Polytonic|+}}',<br />
'Cyrillic': 'АаБбВвГг ҐґЃѓДдЂђ ЕеЁёЄєЖж ЗзЅѕИиІі ЇїЙйЈјКк ЌќЛлЉљМм НнЊњОоПп РрСсТтЋћ УуЎўФфХх ЦцЧчЏџШш ЩщЪъЫыЬь ЭэЮюЯя ӘәӨөҒғҖҗ ҚқҜҝҢңҮү ҰұҲҳҸҹҺһ ҔҕӢӣӮӯҘҙ ҠҡҤҥҪҫӐӑ ӒӓӔӕӖӗӰӱ ӲӳӸӹӀ ҞҟҦҧҨҩҬҭ ҴҵҶҷҼҽҾҿ ӁӂӃӄӇӈӋӌ ӚӛӜӝӞӟӠӡ ӤӥӦӧӪӫӴӵ ́',<br />
'Hebrew': 'אבגדהוזחטיךכלםמןנסעףפץצקרשת ׳ ״ װױײ',<br />
'Arabic': ' Transcription: ʾ ṯ ḥ ḫ ẖ ḏ š ṣ ḍ ṭ ẓ ʿ ġ ẗ ا ﺁ ب ت ث ج ح خ د ذ ر ز س ش ص ض ط ظ ع غ ف ق ك ل م ن ه ة و ي ى ء أ إ ؤ ئ',<br />
'IPA (English)': 'ˈ ˌ ŋ ɡ tʃ dʒ ʃ ʒ θ ð ʔ iː ɪ uː ʊ ʌ ɜr eɪ ɛ æ oʊ ɒ ɔː ɔɪ ɔr ɑː ɑr aɪ aʊ ə ər ɨ ɵ ʉ {\{IPA-en|+}} {\{IPA|/+/}} ‹+›',<br />
'IPA': 'ʈɖɟɡɢʡʔ ɸβθðʃʒɕʑʂʐçʝɣχʁħʕʜʢɦ ɱɳɲŋɴ ʋɹɻɰ ʙⱱʀɾɽ ɬ ɮ ɺ ɭʎʟ ʍɥɧ ʼ ɓɗʄɠʛ ʘǀǃǂǁ ɨʉɯ ɪʏʊ øɘɵɤ ə ɛœɜɞʌɔ æ ɐ ɶɑɒ ʰʱʷʲˠˤˀ ᵊ k̚ ⁿˡ ˈˌːˑ t̪ d̪ s̺ s̻ θ̼ s̬ n̥ ŋ̊ a̤ a̰ β̞ ˕ r̝ ˔ o˞ ɚ ɝ e̘ e̙ u̟ i̠ ɪ̈ e̽ ɔ̹ ɔ̜ n̩ ə̆ ə̯ ə̃ ȷ̃ ɫ z̴ ə̋ ə́ ə̄ ə̀ ə̏ ə̌ ə̂ ə᷄ ə᷅ ə᷇ ə᷆ ə᷈ ə᷉ t͡ʃ d͡ʒ t͜ɬ ‿ ˥ ˦ ˧ ˨ ˩ ꜛ ꜜ | ‖ ↗ ↘ k͈ s͎ {\{IPA|+}}',<br />
'Math and logic': '− × ÷ ⋅ ° ∗ ∘ ± ∓ ≤ ≥ ≠ ≡ ≅ ≜ ≝ ≐ ≃ ≈ ⊕ ⊗ ⇐ ⇔ ⇒ ∞ ← ↔ → ≪ ≫ ∝ √ ∤ ≀ ◅ ▻ ⋉ ⋊ ⋈ ∴ ∵ ↦ ¬ ∧ ∨ ⊻ ∀ ∃ ∈ ∉ ∋ ⊆ ⊈ ⊊ ⊂ ⊄ ⊇ ⊉ ⊋ ⊃ ⊅ ∪ ∩ ∑ ∏ ∐ ′ ∫ ∬ ∭ ∮ ∇ ∂ ∆ ∅ ℂ ℍ ℕ ℙ ℚ ℝ ℤ ℵ ⌊ ⌋ ⌈ ⌉ ⊤ ⊥ ⊢ ⊣ ⊧ □ ∠ ⟨ ⟩ {\{frac|+|}} &nbsp; &minus; <math>+</math> {\{math|+}}'<br />
},<br />
<br />
charinsertDivider : "\240",<br />
<br />
extraCSS : '\<br />
#editpage-specialchars {\<br />
margin-top: 15px;\<br />
border-width: 1px;\<br />
border-style: solid;\<br />
border-color: #aaaaaa;\<br />
padding: 2px;\<br />
}\<br />
#editpage-specialchars a {\<br />
}\<br />
#editpage-specialchars a:hover {\<br />
}\<br />
',<br />
<br />
appendExtraCSS : function ()<br />
{<br />
appendCSS(EditTools.extraCSS);<br />
},<br />
<br />
<br />
cookieName : 'edittoolscharsubset',<br />
<br />
createEditTools : function (placeholder)<br />
{<br />
var box = document.createElement("div");<br />
box.id = "editpage-specialchars";<br />
box.title = 'Click on the character or tag to insert it into the edit window';<br />
<br />
//append user-defined sets<br />
if (window.charinsertCustom)<br />
for (id in charinsertCustom)<br />
if (EditTools.charinsert[id]) EditTools.charinsert[id] += ' ' + charinsertCustom[id];<br />
else EditTools.charinsert[id] = charinsertCustom[id];<br />
<br />
//create drop-down select<br />
var prevSubset = 0, curSubset = 0;<br />
var sel = document.createElement('select'), id;<br />
for (id in EditTools.charinsert)<br />
sel.options[sel.options.length] = new Option(id, id);<br />
sel.selectedIndex = 0;<br />
sel.style.cssFloat = sel.style.styleFloat = 'left';<br />
sel.style.marginRight = '5px';<br />
sel.title = 'Choose character subset';<br />
sel.onchange = sel.onkeyup = selectSubset;<br />
box.appendChild(sel);<br />
<br />
//create "recall" switch<br />
if (window.editToolsRecall) {<br />
var recall = document.createElement('span');<br />
recall.appendChild(document.createTextNode('↕')); // ↔<br />
recall.onclick = function () {<br />
sel.selectedIndex = prevSubset;<br />
selectSubset();<br />
}<br />
with (recall.style) { cssFloat = styleFloat = 'left'; marginRight = '5px'; cursor = 'pointer'; }<br />
box.appendChild(recall);<br />
}<br />
<br />
// load latest selection from cookies<br />
try {<br />
var cookieRe = new RegExp ("(?:^|;)\\s*" + EditTools.cookieName + "=(\\d+)\\s*(?:;|$)");<br />
var m = cookieRe.exec(document.cookie);<br />
if (m && m.length > 1 && parseInt(m[1]) < sel.options.length)<br />
sel.selectedIndex = parseInt(m[1]);<br />
} catch (err) { /* ignore */ }<br />
<br />
placeholder.parentNode.replaceChild(box, placeholder);<br />
selectSubset();<br />
return;<br />
<br />
function selectSubset ()<br />
{<br />
//remember previous (for "recall" button)<br />
prevSubset = curSubset;<br />
curSubset = sel.selectedIndex;<br />
//save into cookies for persistence<br />
try {<br />
var expires = new Date ();<br />
expires.setTime( expires.getTime() + 30 * 24 * 60 * 60 * 1000 ); // + 30 days<br />
document.cookie = EditTools.cookieName + "=" + curSubset + ";path=/;expires=" + expires.toUTCString();<br />
} catch (err) { /* ignore */ }<br />
//hide other subsets<br />
var pp = box.getElementsByTagName('p') ;<br />
for (var i=0; i<pp.length; i++)<br />
pp[i].style.display = 'none';<br />
//show/create current subset<br />
var id = sel.options[curSubset].value;<br />
var p = document.getElementById(id);<br />
if (!p){<br />
p = document.createElement('p');<br />
p.id = id;<br />
if (id == 'Arabic' || id == 'Hebrew'){ p.style.fontSize = '120%'; p.dir = 'rtl'; }<br />
EditTools.createTokens(p, EditTools.charinsert[id]);<br />
box.appendChild(p);<br />
}<br />
p.style.display = 'inline';<br />
} <br />
},<br />
createTokens : function (paragraph, str)<br />
{<br />
var tokens = str.split(' '), token, i, n;<br />
for (i = 0; i < tokens.length; i++) {<br />
token = tokens[i];<br />
n = token.indexOf('+');<br />
if (token == '' || token == '_')<br />
addText(EditTools.charinsertDivider + ' ');<br />
else if (token == '\n')<br />
paragraph.appendChild(document.createElement('br'));<br />
else if (token == '___')<br />
paragraph.appendChild(document.createElement('hr'));<br />
else if (token.charAt(token.length-1) == ':') // : at the end means just text<br />
addBold(token);<br />
else if (n == 0) // +<tag> -> <tag>+</tag><br />
addLink(token.substring(1), '</' + token.substring(2), token.substring(1));<br />
else if (n > 0) // <tag>+</tag><br />
addLink(token.substring(0,n), token.substring(n+1));<br />
else if (token.length > 2 && token.charCodeAt(0) > 127) //a string of insertable characters<br />
for (var j=0; j < token.length; j++) addLink(token.charAt(j), '');<br />
else<br />
addLink(token, '');<br />
}<br />
return;<br />
<br />
function addLink (tagOpen, tagClose, name)<br />
{<br />
var a = document.createElement('a');<br />
tagOpen = tagOpen.replace(/\./g,' ');<br />
tagClose = tagClose ? tagClose.replace(/_/g,' ') : '';<br />
name = name || tagOpen + tagClose;<br />
name = name.replace(/\\n/g,'');<br />
a.appendChild(document.createTextNode(name));<br />
a.href = "#";<br />
addHandler( a, 'click', new Function( "evt", "insertTags('" + tagOpen + "', '" + tagClose + "', ''); return killEvt( evt );" ) );<br />
paragraph.appendChild(a);<br />
addText(' ');<br />
}<br />
function addBold (text)<br />
{<br />
var b = document.createElement('b');<br />
b.appendChild(document.createTextNode(text.replace(/_/g,' ')));<br />
paragraph.appendChild(b);<br />
addText(' ');<br />
} <br />
function addText (txt)<br />
{<br />
paragraph.appendChild(document.createTextNode(txt));<br />
}<br />
},<br />
<br />
<br />
enableForAllFields : function ()<br />
{<br />
if (typeof (insertTags) != 'function' || window.WikEdInsertTags) return;<br />
// insertTags from the site-wide /skins-1.5/common/edit.js just inserts in the first<br />
// textarea in the document. Evidently, that's not good if we have multiple textareas.<br />
// My first idea was to simply add a hidden textarea as the first one, and redefine<br />
// insertTags such that it copied first the last active textareas contents over to that hidden<br />
// field, set the cursor or selection there, let the standard insertTags do its thing, and<br />
// then copy the hidden field's text, cursor position and selection back to the currently<br />
// active field. Unfortunately, that is just as complex as simply copying the whole code<br />
// from wikibits to here and let it work on the right text field in the first place.<br />
var texts = document.getElementsByTagName ('textarea'); <br />
for (var i = 0; i < texts.length; i++) {<br />
addHandler (texts[i], 'focus', EditTools.registerTextField);<br />
}<br />
// While we're at it, also enable it for input fields<br />
texts = document.getElementsByTagName ('input');<br />
for (var i = 0; i < texts.length; i++) {<br />
if (texts[i].type == 'text') addHandler (texts[i], 'focus', EditTools.registerTextField);<br />
}<br />
insertTags = EditTools.insertTags; // Redefine the global insertTags<br />
},<br />
<br />
last_active_textfield : null,<br />
<br />
registerTextField : function (evt)<br />
{<br />
var e = evt || window.event;<br />
var node = e.target || e.srcElement;<br />
if (!node) return;<br />
EditTools.last_active_textfield = node.id;<br />
return true;<br />
},<br />
<br />
getTextArea : function ()<br />
{<br />
var txtarea = null;<br />
if (EditTools.last_active_textfield && EditTools.last_active_textfield != "")<br />
txtarea = document.getElementById (EditTools.last_active_textfield);<br />
if (!txtarea) {<br />
// Fallback option: old behaviour<br />
if (document.editform) {<br />
txtarea = document.editform.wpTextbox1;<br />
} else {<br />
// Some alternate form? Take the first one we can find<br />
txtarea = document.getElementsByTagName ('textarea');<br />
if (txtarea.length > 0) txtarea = txtarea[0]; else txtarea = null;<br />
}<br />
}<br />
return txtarea;<br />
},<br />
<br />
insertTags : function (tagOpen, tagClose, sampleText)<br />
{<br />
var txtarea = EditTools.getTextArea ();<br />
if (!txtarea) return;<br />
<br />
<br />
/* Usability initiative compatibility */<br />
if ( typeof $j != 'undefined' && typeof $j.fn.textSelection != 'undefined' ) {<br />
$j( txtarea ).textSelection(<br />
'encapsulateSelection', { 'pre': tagOpen, 'peri': sampleText, 'post': tagClose }<br />
);<br />
return;<br />
}<br />
<br />
<br />
var selText, isSample = false;<br />
<br />
function checkSelectedText ()<br />
{<br />
if (!selText) {<br />
selText = sampleText; isSample = true;<br />
} else if (selText.charAt (selText.length - 1) == ' ') { // Exclude ending space char<br />
selText = selText.substring (0, selText.length - 1);<br />
tagClose += ' ';<br />
} <br />
}<br />
<br />
if (document.selection && document.selection.createRange) { // IE/Opera<br />
// Save window scroll position<br />
var winScroll = 0;<br />
if (document.documentElement && document.documentElement.scrollTop)<br />
winScroll = document.documentElement.scrollTop;<br />
else if (document.body)<br />
winScroll = document.body.scrollTop;<br />
// Get current selection <br />
txtarea.focus();<br />
var range = document.selection.createRange();<br />
selText = range.text;<br />
// Insert tags<br />
checkSelectedText ();<br />
range.text = tagOpen + selText + tagClose;<br />
// Mark sample text as selected<br />
if (isSample && range.moveStart) {<br />
if (window.opera) tagClose = tagClose.replace (/\n/g, "");<br />
range.moveStart( 'character', - tagClose.length - selText.length); <br />
range.moveEnd ('character', - tagClose.length); <br />
}<br />
range.select (); <br />
// Restore window scroll position<br />
if (document.documentElement && document.documentElement.scrollTop)<br />
document.documentElement.scrollTop = winScroll;<br />
else if (document.body)<br />
document.body.scrollTop = winScroll;<br />
} else if (txtarea.selectionStart || txtarea.selectionStart == '0') { // Mozilla<br />
// Save textarea scroll position<br />
var textScroll = txtarea.scrollTop;<br />
// Get current selection<br />
txtarea.focus();<br />
var startPos = txtarea.selectionStart;<br />
var endPos = txtarea.selectionEnd;<br />
selText = txtarea.value.substring (startPos, endPos);<br />
// Insert tags<br />
checkSelectedText ();<br />
txtarea.value = txtarea.value.substring (0, startPos)<br />
+ tagOpen + selText + tagClose<br />
+ txtarea.value.substring (endPos);<br />
// Set new selection<br />
if (isSample) {<br />
txtarea.selectionStart = startPos + tagOpen.length;<br />
txtarea.selectionEnd = startPos + tagOpen.length + selText.length;<br />
} else {<br />
txtarea.selectionStart = startPos + tagOpen.length + selText.length + tagClose.length;<br />
txtarea.selectionEnd = txtarea.selectionStart;<br />
}<br />
// Restore textarea scroll position<br />
txtarea.scrollTop = textScroll;<br />
}<br />
}, // end insertTags<br />
<br />
setup : function ()<br />
{<br />
var placeholder = document.getElementById("editpage-specialchars");<br />
if (!placeholder) return; // has this already been run once?<br />
EditTools.appendExtraCSS ();<br />
EditTools.createEditTools (placeholder);<br />
EditTools.enableForAllFields ();<br />
}<br />
<br />
}; // end EditTools<br />
<br />
// No need to hook this, as the loading of this page is itself hooked.<br />
EditTools.setup();</div>
Nicolas Brouard
http://fr-i.demopaedia.org/w/index.php?title=40&diff=11660
40
2012-06-04T13:32:38Z
<p>Nicolas Brouard : /* 403 */ parla -> par la</p>
<hr />
<div><br />
<!--'''40'''--><br />
{{CurrentStatus}}<br />
{{Unmodified edition I}}<br />
{{Summary}}<br />
__NOTOC__<br />
= Mortalité et morbidité =<br />
== 40 ==<br />
<br />
<br />
=== 401 ===<br />
<br />
On étudie sous le nom de {{TextTerm|mortalité|1|401}} l’action de la mort sur les populations. La dénomination générique de {{TextTerm|taux de mortalité|2|401|OtherIndexEntry=mortalité. taux de ...}}, englobe tous les {{NonRefTerm|taux}} ({{RefNumber|13|3|4}}) servant à mesurer la fréquence des {{TextTerm|décès|3|401}} au sein d’une {{NonRefTerm|population}} ({{RefNumber|10|1|3}}) ou d’une {{NonRefTerm|sous-population}} ({{RefNumber|10|1|5}}). En l’absence d’indications contraires, l’expression {{NonRefTerm|taux de mortalité}} doit cependant s’entendre au sens de {{TextTerm|taux brut de mortalité|4|401|OtherIndexEntry=mortalité. taux brut de ...}}, ou plus précisément de {{TextTerm|taux brut annuel de mortalité générale|4|401|2|OtherIndexEntry=générale. taux brut annuel de mortalité ...}} (sur le sens de {{NonRefTerm|taux brut}}, cf. {{RefNumber|13|5|8}}). On désigne ainsi le quotient du nombre annuel des décès observés dans une {{NonRefTerm|population}} par l’{{TextTerm|effectif moyen|5|401|OtherIndexEntry=moyen. effectif ...}} de cette population au cours de la période d’observation. Ce taux est généralement exprimé {{NonRefTerm|pour mille}} (sous-entendu : {{NonRefTerm|habitants}} -— cf. {{RefNumber|13|3|4}}*). Parmi les {{NonRefTerm|taux de mortalité}} calculée pour des sous-populations, mentionnons les {{TextTerm|taux de mortalité par sexe et par groupe d’âges|6|401|OtherIndexEntry=mortalité par sexe et par groupe d’âges. taux de ...}}. L’expression {{TextTerm|taux de mortalité par âge|7|401|OtherIndexEntry=âge. taux de mortalité par ...}} revêt d’ordinaire une signification analogue, car il est rare de calculer des taux de mortalité par année d’âge, voire par groupe d’âges, sans distinction de sexe.<br />
{{Note|1| Le mot {{NoteTerm|mortalité}} est parfois employé comme synonyme de {{NonRefTerm|taux de mortalité}} au sens du n° {{RefNumber|40|1|4}} (cf. {{RefNumber|13|3|4}}*).}}<br />
{{Note|3| {{NoteTerm|décès}}, s. m. — {{NoteTerm|décéder}}, v. i. — {{NoteTerm|décédé}}, pp. ff. s. m.<br />Noter que le mot {{NonRefTerm|décès}} a perdu, en démographie, son sens étymologique de {{NonRefTerm|mort naturelle}} (cf. {{RefNumber|42|2|3}}*), de sorte que les mots précédents sont respectivement synonymes, dans le langage technique, de : {{NoteTerm|mort}}, s. f. — {{NoteTerm|mourir}}, v. i. — {{NoteTerm|mort}}, pp. ff. s. m.}}<br />
{{Note|4| L’expression {{NoteTerm|mortalité générale}} indique qu’on prend en considération tous les décès, sans distinction (cf. {{RefNumber|13|4|7}}*).}}<br />
{{Note|5| Lorsque la période d’observation s’étend sur plusieurs années, on définit généralement cet {{NonRefTerm|effectif moyen}}, comme la moyenne des estimations de l’{{NonRefTerm|effectif}} ({{RefNumber|10|1|6}}) de la population {{NoteTerm|au milieu}} de chaque année d’observation.}}<br />
<br />
=== 402 ===<br />
<br />
Les études de {{TextTerm|mortalité différentielle|1|402|OtherIndexEntry=différentielle. mortalité ...}} portent sur les différences de mortalité entre groupes. Lorsqu’un groupe présente une mortalité nettement plus élevée qu’un ou plusieurs autres groupes, auxquels on le compare au moins implicitement, on parle parfois de la {{TextTerm|surmortalité|2|402}} du premier (sous-entendu : par rapport aux autres). On étudie sous le nom de {{TextTerm|mortalité par profession|3|402|OtherIndexEntry=profession. mortalité par ...}}, la mortalité des différents {{NonRefTerm|groupes professionnels}} ({{RefNumber|35|2|3}}). Il convient de ne pas confondre la {{NonRefTerm|mortalité par profession}} avec la {{TextTerm|mortalité professionnelle|4|402|OtherIndexEntry=professionnelle. mortalité ...}}, qui est une {{NonRefTerm|surmortalité}} directement engendrée par les risques spéciaux associés à l’exercice de telle profession. Parmi ces risques, mentionnons notamment les {{TextTerm|maladies professionnelles|5|402|IndexEntry=maladie professionnelle|OtherIndexEntry=professionnelle. maladie ...}}.<br />
{{Note|2| L’expression {{NoteTerm|surmortalité masculine}} implique une référence à la mortalité féminine correspondante — p. ex. : au même âge.}}<br />
<br />
=== 403 ===<br />
<br />
Les {{TextTerm|taux comparatifs de mortalité|1|403|IndexEntry=taux comparatif de mortalité|OtherIndexEntry=mortalité. taux comparatif de ...}} (cf. {{RefNumber|13|5|7}}) sont généralement destinés à comparer le niveau de la mortalité dans diverses {{NonRefTerm|populations}} ({{RefNumber|10|1|3}}), abstraction faite de leurs différences de {{NonRefTerm|structure}} ({{RefNumber|14|4|4}}), et notamment de leur {{NonRefTerm|structure par âge}} ({{RefNumber|32|5|6}}). Un mode de calcul usuel des taux comparatifs, consiste à appliquer les taux par âge observés dans les populations étudiées, aux effectifs d’âge correspondant d’une {{TextTerm|population-type|2|403}}, <sub></sub>c’est-à-dire d’une population de structure donnée, prise pour référence, A défaut de taux par âge, cette méthode directe de calcul, dite {{TextTerm|méthode de la population-type|3|403|OtherIndexEntry=population-type. méthode de la ...}}, devient inapplicable. On peut alors obtenir indirectement des taux comparatifs, par conversion à la dimension de taux, d’{{NonRefTerm|indices}} ({{RefNumber|13|6|2}}) calculés par la {{TextTerm|méthode des taux-types|4|403|OtherIndexEntry=taux-type. méthode des ...}}. Utilisés directement — notamment pour les comparaisons entre {{NonRefTerm|sous-populations}} ({{RefNumber|10|1|5}}) —, les indices obtenus par cette méthode prennent le nom d’{{TextTerm|indices comparatifs de mortalité|5|403|IndexEntry=indice comparatif de mortalité|OtherIndexEntry=mortalité. indice comparatif de ...}}. Leur calcul s’effectue sur la base d’une {{TextTerm|mortalité-type|6|403|OtherIndexEntry=type. mortalité- ...}}, c’est-à-dire d’une série de {{TextTerm|taux-types de mortalité|6|403|2|IndexEntry=taux-type de mortalité|OtherIndexEntry=mortalité. taux-type de ...}} par âge, qu’on applique aux effectifs d’âge correspondant des populations étudiées. La valeur de l’indice pour une population donnée s’obtient en rapportant le nombre global des {{TextTerm|décès observés|7|403|IndexEntry=décès observé|OtherIndexEntry=observé. décès ...}} dans cette population au nombre ainsi obtenu de {{TextTerm|décès hypothétiques|8|403|OtherIndexEntry=hypothétique. décès ...}}, ou {{TextTerm|décès calculés|8|403|2|OtherIndexEntry=calculé. décès ...}}, ou {{TextTerm|décès théoriques|8|403|3|OtherIndexEntry=théorique. décès ...}},pris pour {{NonRefTerm|base 100}} ({{RefNumber|13|6|3}}).<br />
<br />
==<center><font size=12>* * * </font></center>==<br />
{{SummaryShort}}<br />
<br />
{{OtherLanguages|40}}</div>
Nicolas Brouard
http://fr-i.demopaedia.org/w/index.php?title=Mod%C3%A8le:RefNumber&diff=11705
Modèle:RefNumber
2012-04-15T14:47:16Z
<p>Nicolas Brouard : </p>
<hr />
<div><!--'''Template:RefNumber'''-->{{<br />
#if: {{{Page|}}} |<br />
[[{{{Page}}}#{{{1}}}{{{2}}}|{{{1}}}{{{2}}}-{{{3}}}]]|<br />
[[{{{1}}}#{{{1}}}{{{2}}}|{{{1}}}{{{2}}}-{{{3}}}]]}}</div>
Nicolas Brouard
http://fr-i.demopaedia.org/w/index.php?title=MediaWiki:Gadget-refToolbar&diff=11673
MediaWiki:Gadget-refToolbar
2012-03-12T14:58:19Z
<p>Nicolas Brouard : </p>
<hr />
<div>[[:en:Wikipedia:RefToolbar|refTools]], adds a "cite" button to the editing toolbar for quick and easy addition of commonly used citation templates. It also adds a TextTerm icon</div>
Nicolas Brouard
http://fr-i.demopaedia.org/w/index.php?title=MediaWiki:Editpage.js&diff=11691
MediaWiki:Editpage.js
2012-03-10T12:19:15Z
<p>Nicolas Brouard : 1 version : Essai</p>
<hr />
<div>//dynamically load Commons-style Edittools<br />
function createEdittoolsLink(){<br />
//get div.mw-editTools<br />
var box = document.getElementById('wpTextbox1')<br />
while (box && box.className!='mw-editTools') box=box.nextSibling<br />
if (!box) return<br />
//create a link<br />
var lnk = document.createElement('a')<br />
lnk.href = 'javascript:loadCommonsTools()'<br />
lnk.title = 'Load Commons-style Edittools' <br />
lnk.id = 'loadCommonsEdittoos'<br />
lnk.appendChild(document.createTextNode('[load edittools]'))<br />
lnk.style.cssText = 'float:right'<br />
box.appendChild(lnk)<br />
}<br />
function loadCommonsTools(){<br />
importScript('MediaWiki:Edittools.js')<br />
var lnk = document.getElementById('loadCommonsEdittoos')<br />
if (lnk) lnk.parentNode.removeChild(lnk)<br />
}<br />
if (doneOnloadHook) createEdittoolsLink()<br />
else addOnloadHook(createEdittoolsLink)</div>
Nicolas Brouard
http://fr-i.demopaedia.org/w/index.php?title=MediaWiki:Gadget-citations.js&diff=11693
MediaWiki:Gadget-citations.js
2012-03-10T12:19:15Z
<p>Nicolas Brouard : 1 version : Essai</p>
<hr />
<div>/* _____________________________________________________________________________<br />
* | |<br />
* | === WARNING: GLOBAL GADGET FILE === |<br />
* | Changes to this page affect many users. |<br />
* | Please discuss changes on the talk page or on [[WT:Gadget]] before editing. |<br />
* |_____________________________________________________________________________|<br />
*<br />
* Imported from version 1.0 as of 17:18, 9 April 2011 (UTC) from [[User:Smith609/citations.js]]<br />
* Adds a "Citation bot" link to the toolbox, and a button beneath edit fields, see [[User:Smith609/citations]]<br />
*/<br />
<br />
// @Version 1.0 - Adds an "Expand citations" link to the toolbox, and a button beneath edit fields.<br />
<br />
function addCBToToolbox() {<br />
if (wgCanonicalNamespace != "Special") {<br />
var pTb = document.getElementById("p-tb");<br />
if( !pTb ) return;<br />
var escPageName = encodeURIComponent(wgPageName);<br />
<br />
addPortletLink("p-tb", "http://toolserver.org/~verisimilus/Bot/citation-bot/doibot.php?edit=toolbar&slow=1&user="+encodeURIComponent(wgUserName)+"&page="+escPageName, 'Expand citations', '', "Expand citations and fix common formatting errors");<br />
}<br />
}<br />
<br />
// Add a citation bot button<br />
function addCitationBot() {<br />
if (document.getElementById('wpDiff')){<br />
var diff = document.getElementById('wpDiff');<br />
var cbButton = document.createElement("input");<br />
cbButton.value="Citations";<br />
cbButton.type="submit";<br />
originalAction=document.getElementById('editform').getAttribute('action');<br />
cbButton.setAttribute("onmousedown", " document.getElementById('editform').setAttribute('action', 'http://toolserver.org/~verisimilus/Bot/citation-bot/text.php')");<br />
cbButton.setAttribute("onkeydown", " document.getElementById('editform').setAttribute('action', 'http://toolserver.org/~verisimilus/Bot/citation-bot/text.php')");<br />
diff.setAttribute("onmousedown", originalAction);<br />
diff.setAttribute("onkeydown", originalAction);<br />
document.getElementById('wpPreview').setAttribute("onmousedown", originalAction);<br />
document.getElementById('wpPreview').setAttribute("onkeydown", originalAction);<br />
document.getElementById('wpSave').setAttribute("onmousedown", originalAction);<br />
document.getElementById('wpSave').setAttribute("onkeydown", originalAction);<br />
diff.parentNode.insertBefore(cbButton, diff.nextSibling);<br />
}<br />
<br />
}<br />
addOnloadHook(addCitationBot);<br />
if( skin == "myskin" || skin == "simple" || skin == "monobook" || skin == "modern" || skin == "chick" || skin == "vector") {<br />
addOnloadHook(addCBToToolbox);<br />
}</div>
Nicolas Brouard
http://fr-i.demopaedia.org/w/index.php?title=MediaWiki:Gadget-citations&diff=11695
MediaWiki:Gadget-citations
2012-03-10T12:19:15Z
<p>Nicolas Brouard : 1 version : Essai</p>
<hr />
<div>[[WP:Citation expander|Citation expander]]: Automatically expand and format citations (uses "[[WP:UCB|Citation bot]]").<br />
<!--<br />
* A link in the toolbox will activate [[User:Citation bot]] on the page that you are currently viewing. The bot will expand, format and tidy all references on that page.<br />
<br />
* A button underneath the edit box (next to "Show Changes") will send the contents of the edit box to the bot, which will process them and return the expanded version. This has two possible uses:<br />
** It allows the manual checking of the bot's output before an article is modified<br />
** You can type a partial citation in to an article (e.g. <code><nowiki>{{cite journal|pmid=12345}}</nowiki></code>), then have the bot expand this to a complete citation before you save the page.<br />
<br />
<br />
For more information about the functions performed by [[User:Citation bot|Citation bot]], see [[User:Citation bot|its user page]] or [[WP:UCB|an introductory page]]. For information about the gadget's script, see [[User:Smith609/citation]].<br />
--></div>
Nicolas Brouard
http://fr-i.demopaedia.org/w/index.php?title=MediaWiki:Common.js/edit.js&diff=11681
MediaWiki:Common.js/edit.js
2012-03-10T12:19:14Z
<p>Nicolas Brouard : 1 version : Essai</p>
<hr />
<div>/* Any JavaScript here will be loaded for all users on every page load. */<br />
/** Extra toolbar options ******************************************************<br />
* <br />
* Description: Adds extra buttons to the editing toolbar.<br />
* <br />
* To disable this script, add <code>mwCustomEditButtons = [];<code> to [[Special:Mypage/vector.js]].<br />
* <br />
* Maintainers: [[User:MarkS]], [[User:Voice of All]], [[User:R. Koot]]<br />
*/<br />
<br />
if (mwCustomEditButtons) {<br />
mwCustomEditButtons.push({<br />
"imageFile": "//upload.wikimedia.org/wikipedia/en/c/c8/Button_redirect.png",<br />
"speedTip": "Redirect",<br />
"tagOpen": "#REDIRECT [[",<br />
"tagClose": "]]",<br />
"sampleText": "Target page name"<br />
});<br />
<br />
mwCustomEditButtons.push({<br />
"imageFile": "//upload.wikimedia.org/wikipedia/en/c/c9/Button_strike.png",<br />
"speedTip": "Strike",<br />
"tagOpen": "<s>",<br />
"tagClose": "</s>",<br />
"sampleText": "Strike-through text"<br />
});<br />
<br />
mwCustomEditButtons.push({<br />
"imageFile": "//upload.wikimedia.org/wikipedia/en/1/13/Button_enter.png",<br />
"speedTip": "Line break",<br />
"tagOpen": "<br />",<br />
"tagClose": "",<br />
"sampleText": ""<br />
});<br />
<br />
mwCustomEditButtons.push({<br />
"imageFile": "//upload.wikimedia.org/wikipedia/en/8/80/Button_upper_letter.png",<br />
"speedTip": "Superscript",<br />
"tagOpen": "<sup>",<br />
"tagClose": "</sup>",<br />
"sampleText": "Superscript text"<br />
});<br />
<br />
mwCustomEditButtons.push({<br />
"imageFile": "//upload.wikimedia.org/wikipedia/en/7/70/Button_lower_letter.png",<br />
"speedTip": "Subscript",<br />
"tagOpen": "<sub>",<br />
"tagClose": "</sub>",<br />
"sampleText": "Subscript text"<br />
});<br />
<br />
mwCustomEditButtons.push({<br />
"imageFile": "//upload.wikimedia.org/wikipedia/en/5/58/Button_small.png",<br />
"speedTip": "Small",<br />
"tagOpen": "<small>",<br />
"tagClose": "</small>",<br />
"sampleText": "Small Text"<br />
});<br />
<br />
mwCustomEditButtons.push({<br />
"imageFile": "//upload.wikimedia.org/wikipedia/en/3/34/Button_hide_comment.png",<br />
"speedTip": "Insert hidden Comment",<br />
"tagOpen": "<!-- ",<br />
"tagClose": " -->",<br />
"sampleText": "Comment"<br />
});<br />
<br />
mwCustomEditButtons.push({<br />
"imageFile": "//upload.wikimedia.org/wikipedia/en/1/12/Button_gallery.png",<br />
"speedTip": "Insert a picture gallery",<br />
"tagOpen": "\n<gallery>\n",<br />
"tagClose": "\n</gallery>",<br />
"sampleText": "Image:Example.jpg|Caption1\nImage:Example.jpg|Caption2"<br />
});<br />
<br />
mwCustomEditButtons.push({<br />
"imageFile": "//upload.wikimedia.org/wikipedia/en/f/fd/Button_blockquote.png",<br />
"speedTip": "Insert block of quoted text",<br />
"tagOpen": "<blockquote>\n",<br />
"tagClose": "\n</blockquote>",<br />
"sampleText": "Block quote"<br />
});<br />
<br />
mwCustomEditButtons.push({<br />
"imageFile": "//upload.wikimedia.org/wikipedia/en/6/60/Button_insert_table.png",<br />
"speedTip": "Insert a table",<br />
"tagOpen": '{| class="wikitable"\n|',<br />
"tagClose": "\n|}",<br />
"sampleText": "-\n! header 1\n! header 2\n! header 3\n|-\n| row 1, cell 1\n| row 1, cell 2\n| row 1, cell 3\n|-\n| row 2, cell 1\n| row 2, cell 2\n| row 2, cell 3"<br />
});<br />
<br />
mwCustomEditButtons.push({<br />
"imageFile": "//upload.wikimedia.org/wikipedia/commons/7/79/Button_reflink.png",<br />
"speedTip": "Insert a reference",<br />
"tagOpen": "<ref>",<br />
"tagClose": "</ref>",<br />
"sampleText": "Insert footnote text here"<br />
});<br />
}<br />
<br />
<br />
/** Fix edit summary prompt for undo ******************************************<br />
* Fixes the fact that the undo function combined with the "no edit summary prompter"<br />
* causes problems if leaving the edit summary unchanged.<br />
* Added by [[User:Deskana]], code by [[User:Tra]].<br />
* See also [[bugzilla:8912]].<br />
*/<br />
$(function () {<br />
if (document.location.search.indexOf("undo=") != -1 && document.getElementsByName('wpAutoSummary')[0]) {<br />
document.getElementsByName('wpAutoSummary')[0].value='1';<br />
}<br />
});<br />
<br />
<br />
/** Edittools javascript loader ************************************************<br />
*<br />
* Description: Pulls in [[MediaWiki:Edittools.js]]. Includes a cache-bypassing<br />
* version number in the URL in order to allow any changes to the edittools to<br />
* be rapidly deployed to users.<br />
*<br />
* Note that, by default, this function does nothing unless the element with<br />
* the ID "editpage-specialchars" (which contains the old edittools code in<br />
* [[MediaWiki:Edittools]], and will be retained as a placeholder in the new<br />
* implementation) has a class named "edittools-version-NNN", where NNN is a<br />
* number. If the class name has "test" before the number, the code will only<br />
* run for users who have set "window.testJsEdittools = true" in their user JS.<br />
* The "test" should be retained in the class name until the new edittools<br />
* implementation is ready and fully tested, and until at least 30 days have<br />
* passed since this loader stub was added (which will be in 27 June 2008).<br />
*<br />
* For compatibility with Alex Smotrov's original implementation, on which this<br />
* code is loosely based (see [[mw:User talk:Alex Smotrov/edittools.js]]), this<br />
* loader can also be disabled by setting "window.noDefaultEdittools = true".<br />
*<br />
* Maintainers: [[User:Ilmari Karonen]]<br />
*/<br />
<br />
//Prevent the static edittools from flashing before the compact edittools below is loaded.<br />
mw.util.addCSS('div.edittools-text { display:none; }');<br />
<br />
$(function () {<br />
// needs to be deferred until the DOM has fully loaded<br />
var placeholder = document.getElementById("editpage-specialchars");<br />
if (!placeholder || window.noDefaultEdittools) {<br />
//Show the static edittools again for users with "window.noDefaultEdittools=true".<br />
mw.util.addCSS('div.edittools-text { display:block; }');<br />
return;<br />
}<br />
var match = /(?:^| )edittools-version-(\d+)(?: |$)/.exec(placeholder.className);<br />
console.log("Common.js/edit.js match =" + match);<br />
// set window.testJsEdittools = true to enable testing before full deployment<br />
if (!match && window.testJsEdittools)<br />
match = /(?:^| )edittools-version-(test\d+)(?: |$)/.exec(placeholder.className);<br />
<br />
if (!match) return;<br />
var url = wgScript + '?title=MediaWiki:Edittools.js&action=raw&ctype=text/javascript&nocache=' + match[1];<br />
importScriptURI(url);<br />
});<br />
var url = wgScript + '?title=MediaWiki:Edittools.js&action=raw&ctype=text/javascript';<br />
importScriptURI(url);</div>
Nicolas Brouard
http://fr-i.demopaedia.org/w/index.php?title=MediaWiki:RefToolbarBaseTextTerm.js&diff=11687
MediaWiki:RefToolbarBaseTextTerm.js
2012-03-10T12:19:14Z
<p>Nicolas Brouard : 1 version : Essai</p>
<hr />
<div>// Global object<br />
if (typeof CiteTB == 'undefined') {<br />
var CiteTB = {<br />
"Templates" : {}, // All templates<br />
"Options" : {}, // Global options<br />
"UserOptions" : {}, // User options<br />
"DefaultOptions" : {}, // Script defaults<br />
"ErrorChecks" : {} // Error check functions<br />
};<br />
}<br />
<br />
if (typeof mw.usability == 'undefined') {<br />
mw.usability = {};<br />
mw.usability.getMsg = function(m) { return mw.messages.get(m); }<br />
mw.usability.addMessages = function(msgs) { mw.messages.set(msgs); };<br />
}<br />
<br />
// Object for cite templates<br />
function citeTemplate(templatename, shortform, basicfields, expandedfields) {<br />
// Properties<br />
this.templatename = templatename; // The template name - "cite web", "cite book", etc.<br />
this.shortform = shortform; // A short form, used for the dropdown box<br />
this.basic = basicfields; // Basic fields - author, title, publisher...<br />
// Less common - quote, archiveurl - should be everything the template supports minus the basic ones<br />
this.extra = expandedfields;<br />
<br />
// Add it to the list<br />
CiteTB.Templates[this.templatename] = this;<br />
// Methods<br />
this.makeFormInner = function(fields) {<br />
var i=0;<br />
var trs = new Array();<br />
for (i=0; i<fields.length; i++) {<br />
var fieldobj = fields[i];<br />
var field = fieldobj.field;<br />
var ad = false;<br />
if ($j.inArray(field, CiteTB.getOption('autodate fields')) != -1 ) {<br />
im = $j('<img />').attr('src', '//upload.wikimedia.org/wikipedia/commons/thumb/7/7b/Nuvola_apps_date.svg/20px-Nuvola_apps_date.svg.png');<br />
im.attr('alt', mw.usability.getMsg('cite-insert-date')).attr('title', mw.usability.getMsg('cite-insert-date'));<br />
var ad = $j('<a />').attr('href', '#');<br />
ad.append(im);<br />
ad.attr('id', 'cite-date-'+CiteTB.escStr(this.shortform)+'-'+field);<br />
$j('#cite-date-'+CiteTB.escStr(this.shortform)+'-'+field).live('click', CiteTB.fillAccessdate);<br />
}<br />
<br />
if (fieldobj.autofillid) {<br />
var autotype = fieldobj.autofillid;<br />
im = $j('<img />').attr('src', '//upload.wikimedia.org/wikipedia/commons/thumb/1/17/System-search.svg/20px-System-search.svg.png');<br />
im.attr('alt', mw.usability.getMsg('cite-autofill-alt')).attr('title', mw.usability.getMsg('cite-autofill-alt'));<br />
var ad = $j('<a />').attr('href', '#');<br />
ad.append(im);<br />
ad.attr('id', 'cite-auto-'+CiteTB.escStr(this.shortform)+'-'+field+'-'+autotype);<br />
$j('#cite-auto-'+CiteTB.escStr(this.shortform)+'-'+field+'-'+autotype).live('click', CiteTB.initAutofill); <br />
}<br />
<br />
var display = mw.usability.getMsg('cite-'+field+'-label');<br />
var tooltip = fieldobj.tooltip ? $j('<abbr />').attr('title', mw.usability.getMsg(fieldobj.tooltip)).text('*') : false;<br />
<br />
var input = '';<br />
if (ad) {<br />
input = $j('<input tabindex="1" style="width:85%" type="text" />');<br />
} else {<br />
input = $j('<input tabindex="1" style="width:100%" type="text" />');<br />
}<br />
input.attr('id', 'cite-'+CiteTB.escStr(this.shortform)+'-'+field);<br />
if (fieldobj.autofillprop) {<br />
input.addClass('cite-'+CiteTB.escStr(this.shortform)+'-'+fieldobj.autofillprop);<br />
}<br />
var label = $j('<label />');<br />
label.attr('for', 'cite-'+CiteTB.escStr(this.shortform)+'-'+field).text(display);<br />
if (tooltip) {<br />
label.append(tooltip);<br />
}<br />
var style = 'text-align:right; width:20%;';<br />
if (i%2 == 1) {<br />
style += ' padding-left:1em;';<br />
} else {<br />
var tr = $j('<tr />');<br />
}<br />
var td1 = $j('<td class="cite-form-td" />').attr('style', style);<br />
td1.append(label);<br />
tr.append(td1);<br />
var td2 = $j('<td class="cite-form-td" style="width:30%" />');<br />
td2.append(input);<br />
if (ad) {<br />
td2.append(ad);<br />
}<br />
tr.append(td2);<br />
if (i%2 == 0) {<br />
trs.push(tr);<br />
}<br />
}<br />
return trs;<br />
<br />
}<br />
<br />
// gives a little bit of HTML so the open form can be identified<br />
this.getInitial = function() {<br />
var hidden = $j('<input type="hidden" class="cite-template" />');<br />
hidden.val(this.templatename);<br />
return hidden;<br />
}<br />
<br />
// makes the form used in the dialog boxes<br />
this.getForm = function() {<br />
var main = $j("<div class='cite-form-container' />");<br />
var form1 = $j('<table style="width:100%; background-color:transparent;" class="cite-basic-fields" />');<br />
var i=0;<br />
var trs = this.makeFormInner(this.basic);<br />
for (var i=0; i<trs.length; i++) {<br />
form1.append(trs[i]);<br />
}<br />
<br />
var form2 = $j('<table style="width:100%; background-color:transparent; display:none" class="cite-extra-fields">');<br />
trs = this.makeFormInner(this.extra);<br />
for (var i=0; i<trs.length; i++) {<br />
form2.append(trs[i]);<br />
} <br />
main.append(form1).append(form2);<br />
<br />
var form3 = $j('<table style="width:100%; background-color:transparent;padding-top:1em" class="cite-other-fields">');<br />
var tr = $j('<tr />');<br />
var td1 = $j('<td class="cite-form-td" style="text-align:right; width:20%" />');<br />
var label1 = $j('<label />');<br />
label1.attr('for', "cite-"+CiteTB.escStr(this.shortform)+'-name').text(mw.usability.getMsg('cite-name-label'));<br />
td1.append(label1);<br />
var td2 = $j('<td class="cite-form-td" style="width:30%" />');<br />
var input1 = $j('<input tabindex="1" style="width:100%" type="text" />');<br />
input1.attr('id', 'cite-'+CiteTB.escStr(this.shortform)+'-name');<br />
td2.append(input1);<br />
var td3 = $j('<td class="cite-form-td" style="text-align:right; padding-left:1em; width:20%">');<br />
var label2 = $j('<label />');<br />
label2.attr('for', 'cite-'+CiteTB.escStr(this.shortform)+'-group').text(mw.usability.getMsg('cite-group-label'));<br />
td3.append(label2);<br />
var td4 = $j('<td class="cite-form-td" style="width:30%" />');<br />
var input2 = $j('<input tabindex="1" style="width:100%" type="text" />');<br />
input2.attr('id', 'cite-'+CiteTB.escStr(this.shortform)+'-group');<br />
td4.append(input2);<br />
tr.append(td1).append(td2).append(td3).append(td4);<br />
form3.append(tr);<br />
main.append(form3);<br />
var extras = $j('<div />');<br />
extras.append('<input type="hidden" class="cite-form-status" value="closed" />');<br />
var hidden = $j('<input type="hidden" class="cite-template" />');<br />
hidden.val(this.templatename);<br />
extras.append(hidden);<br />
var span1 = $j('<span class="cite-preview-label" style="display:none;" />');<br />
span1.text(mw.usability.getMsg('cite-raw-preview'));<br />
extras.append(span1).append('<div class="cite-ref-preview" style="padding:0.5em; font-size:110%" />');<br />
var span2 = $j('<span class="cite-prev-parsed-label" style="display:none;" />');<br />
span2.text(mw.usability.getMsg('cite-parsed-label'));<br />
extras.append(span2).append('<div class="cite-preview-parsed" style="padding-bottom:0.5em; font-size:110%" />');<br />
var link = $j('<a href="#" class="cite-prev-parse" style="margin:0 1em 0 1em; display:none; color:darkblue" />');<br />
link.text(mw.usability.getMsg('cite-form-parse'));<br />
extras.append(link); <br />
main.append(extras);<br />
<br />
return main;<br />
}<br />
}<br />
<br />
/* Class for error checks<br />
FIXME: DOCS OUT OF DATE<br />
type - type of error check - current options:<br />
* 'refcheck' - apply a function on each ref individually<br />
* function should accept a ref object, return a string<br />
* 'reflist' - apply a function on the entire ref list<br />
* function should accept an array of ref objects, return an array of strings<br />
* 'search' - apply a function ro the page text<br />
* function should accept the page text as a string, return an array of strings<br />
The strings returned by the function should be valid HTML<br />
<br />
func - The function described above<br />
testname - Name of the error check, must not contain spaces<br />
desc - A short description of the test<br />
*/<br />
<br />
function citeErrorCheck(obj) {<br />
this.obj = obj<br />
CiteTB.ErrorChecks[this.obj.testname] = this;<br />
<br />
this.run = function() {<br />
var errors = [];<br />
switch(this.obj['type']) {<br />
case "refcheck":<br />
CiteTB.loadRefs();<br />
for(var i=0; i<CiteTB.mainRefList.length; i++) {<br />
var e = this.obj.func(CiteTB.mainRefList[i]);<br />
if (e) {<br />
errors.push(e);<br />
}<br />
}<br />
break;<br />
case "reflist":<br />
CiteTB.loadRefs();<br />
errors = this.obj.func(CiteTB.mainRefList);<br />
break;<br />
case "search":<br />
var func = this.obj.func<br />
CiteTB.getPageText(function(text) {<br />
errors = func(text);<br />
});<br />
break;<br />
}<br />
return errors;<br />
}<br />
<br />
this.getRow = function() {<br />
var row = $j("<li />");<br />
var check = $j("<input type='checkbox' name='cite-err-test' />");<br />
check.attr('value', this.obj.testname);<br />
var label = $j("<label />").html(mw.usability.getMsg(this.obj.desc));<br />
label.attr('for', this.obj.testname); <br />
row.append(check).append(' &ndash; ').append(label);<br />
return row;<br />
}<br />
}<br />
$j('head').trigger('reftoolbarbase');</div>
Nicolas Brouard
http://fr-i.demopaedia.org/w/index.php?title=Accueil&diff=5859
Accueil
2012-02-29T16:23:09Z
<p>Nicolas Brouard : </p>
<hr />
<div><!--'''Accueil'''--><br />
__TOC__<br />
<br />
= Le dictionnaire démographique multilingue accessible en ligne =<br />
<br />
Le dictionnaire démographique multilingue a été publié dans deux éditions et de nombreuses langues, récemment pour certaines. Le site Demopædia donne accès à leur version électronique. <br />
Vous pouvez désormais lire ce classique « en ligne » ou imprimer une version au format PDF.<br />
Vous pouvez rechercher un terme démographique, surfer vers un terme ou une expression similaire ou changer de langue ou d'édition.<br />
<br />
= Demopædia =<br />
Prenant comme point de départ la dernière édition du dictionnaire démographique multilingue, nous lançons Demopædia – une encyclopédie basée sur la technologie wiki, ouverte à tous les spécialistes en matière de population qui désirent améliorer et compléter ces textes qui doivent être révisés.<br />
<br />
Demopædia a l'ambition de laisser les scientifiques déterminer eux-mêmes les frontières de la discipline démographique tout en partageant leurs connaissances via des médias modernes.<br />
<br />
= La prochaine édition du dictionnaire démographique multilingue =<br />
<br />
A partir des travaux de Demopædia, un groupe de Démopædiens, sélectionné parmi les plus actifs, élaborera la troisième édition. Plus vous collaborerez à l'encyclopédie, meilleure sera la qualité de cette troisième édition.<br />
<br />
= Historique =<br />
<br />
La création de la série des dictionnaires démographiques encyclopédiques multilingues est un des projets les plus longs de l'histoire de notre discipline. Mais aussi un des plus fructueux. Au milieu des années 1950, la Division de la population des Nations Unies a rassemblé une équipe d'experts, afin de diffuser l'état de l'art de la démographie dans un dictionnaire publié dans l'ensemble des langues officielles des Nations Unies. Deux décennies plus tard, la Division a contribué au travail de révision de cet outil de référence lancé par l'UIESP. Les chercheurs et enseignants de nombreux pays ont rejoint le projet, le plus souvent de manière informelle, en élaborant leur propre édition locale à partir de ces standards ONU/UIESP. Ainsi la communauté internationale dispose d'une série de 14 dictionnaires démographiques encyclopédiques. Mais aujourd'hui ces ouvrages sont épuisés et il est bien difficile de trouver les rares bibliothèques qui les possèdent tous.<br />
<br />
= Pourquoi en ligne ?=<br />
<br />
La disponibilité du dictionnaire démographique multilingue sur l'Internet le rend à nouveau accessible et au plus grand nombre. Les expressions démographiques, leur sens et leur contexte, sont désormais à deux clics pour les étudiants, professeurs, chercheurs, journalistes, experts gouvernementaux ou membres des ONG. Il vous est possible de comprendre le sens d'un terme dans votre langue de travail. De plus, le dictionnaire multilingue vous aide à comprendre les textes spécialisés écrits dans d'autres langues.<br />
<br />
= Des usages multiples =<br />
<br />
Outre les possibilités offertes par les versions électroniques comme la recherche et la navigation, le dictionnaire encyclopédique est aussi un livre organisé en chapitres thématiques qui peuvent être lus d'une traite. Vous pouvez consulter les différentes langues du dictionnaire, les lire en ligne, les télécharger et les imprimer : tous les détenteurs de droits d'auteurs nous ont autorisé à vous fournir ces possibilités. Les index permettent également de cerner une recherche. <br />
La plateforme Wiki fournit des outils puissants pour les développements futurs. Les spécialistes peuvent proposer des ajouts ou corrections en ligne et les discuter de manière collective. <br />
<br />
= La prochaine étape =<br />
<br />
Le savoir démographique a fait d'énormes avancées depuis les dernières éditions du dictionnaire. Il paraît évident que la structure et les textes doivent être mis à jour. Effectuer cette mise à jour de manière traditionnelle avec des participants se rencontrant de visu et des groupes de travail, semble aujourd'hui difficilement possible. Le développement en ligne d'une nouvelle édition du dictionnaire encyclopédique démographique multilingue devrait être efficace et utiliser au mieux le potentiel d'une large communauté de professionnels. Demopædia sera l'hôte de ce projet. Demopædia pourra également devenir une plateforme de partage et de construction d'une base de connaissance élargie sur la démographie et les études de population. Notre approche est celle d'une encyclopédie sur la population en constante évolution qui puisse servir la communauté mondiale tout en bénéficiant d'un afflux d'idées et de textes.<br />
<br />
<noinclude><br />
{{SummaryShort}}<br />
</noinclude></div>
Nicolas Brouard
http://fr-i.demopaedia.org/w/index.php?title=32&diff=4056
32
2012-01-27T12:14:09Z
<p>Nicolas Brouard : /* 323 */ erreur de reconnaissance de style</p>
<hr />
<div><br />
<!--'''32'''--><br />
{{CurrentStatus}}<br />
{{Unmodified edition I}}<br />
{{Summary}}<br />
__NOTOC__<br />
== 32 ==<br />
<br />
<br />
=== 320 ===<br />
<br />
Pour étudier la {{TextTerm|répartition par sexe|1|320|OtherIndexEntry=sexe. répartition par ...}} de la population, on rapporte généralement l’effectif de l’un des {{TextTerm|sexes|2|320|IndexEntry=sexe}} à l’effectif correspondant, soit des deux sexes, soit de l’autre sexe. Le sexe pris en considération au numérateur étant d’ordinaire le sexe masculin, on dit parfois qu’on étudie la {{TextTerm|masculinité|3|320}} de la population. L’expression {{TextTerm|taux de masculinité|4|320|OtherIndexEntry=masculinité. taux de ...}} devrait, dans une terminologie correcte, désigner la proportion des individus du sexe masculin dans l’ensemble. Mais cette expression est souvent employée pour désigner ce qu’on pourrait appeler le {{TextTerm|rapport de masculinité|5|320|OtherIndexEntry=masculinité. rapport de ...}}, rapport de l’effectif du sexe masculin à l’effectif correspondant du sexe féminin. Ce rapport usuel est généralement exprimé comme un {{NonRefTerm|indice}} ({{RefNumber|13|6|2}}), l’effectif du sexe féminin étant pris pour {{NonRefTerm|base 100}} ({{RefNumber|13|6|3}}).<br />
<br />
=== 321 ===<br />
<br />
Les mots {{TextTerm|homme|1|321}} et {{TextTerm|femme|2|321}} peuvent être employés, en démographie, comme synonymes d’{{TextTerm|individu du sexe masculin|1|321|2|OtherIndexEntry=masculin. individu du sexe ...}} et d’{{TextTerm|individu du sexe féminin|2|321|2|OtherIndexEntry=féminin. individu du sexe ...}}, bien qu’on évite en général de les appliquer à des {{NonRefTerm|enfants}} ({{RefNumber|32|3|3}}). Les mots {{TextTerm|garçon|3|321}} et {{TextTerm|fille|4|321}} revêtent, entre autres significations (cf. {{RefNumber|51|5|3}}*, {{RefNumber|51|5|4}}* et {{RefNumber|11|2|7}}), celles d’{{TextTerm|enfant du sexe masculin|3|321|2|OtherIndexEntry=masculin. enfant du sexe ...}} et d’{{TextTerm|enfant du sexe féminin|4|321|2|OtherIndexEntry=féminin. enfant du sexe ...}}. Le mot {{TextTerm|homme|5|321}} s’emploie également au sens général d’{{TextTerm|être humain|5|321|2|OtherIndexEntry=humain. être ...}}.<br />
<br />
=== 322 ===<br />
<br />
L’{{TextTerm|âge|1|322|IndexEntry=âge chronologique|OtherIndexEntry=chronologique. âge ...}} — on précise parfois {{NoteTerm|âge chronologique}} (cf. § {{NonRefTerm|327}}) — est une des caractéristiques fondamentales envisagées dans l’étude de la {{NonRefTerm|structure}} ({{RefNumber|14|4|4}}) des populations. On l’exprime généralement en années, ou en années et mois, voire en mois et jours pour les {{NonRefTerm|enfants en bas âge}} ({{RefNumber|32|3|6}}); parfois en années et fraction décimale d’année. Les démographes arrondissent d’ordinaire l’âge à l’unité inférieure, l’exprimant ainsi en {{TextTerm|années accomplies|2|322|IndexEntry=année accomplie|OtherIndexEntry=accomplie. année ...}}, ou {{TextTerm|années révolues|2|322|2|IndexEntry=année révolue|OtherIndexEntry=révolue. année ...}} — le cas échéant en {{TextTerm|mois accomplis|2|322|3|IndexEntry=mois accompli|OtherIndexEntry=accompli. mois ...}}, ou {{TextTerm|mois révolus|2|322|4|IndexEntry=mois révolu|OtherIndexEntry=révolu. mois ...}}. En conséquence, les questions relatives à l’âge sont éventuellement formulées en demandant l’{{TextTerm|âge au dernier anniversaire|3|322|OtherIndexEntry=anniversaire. âge au dernier ...}}. Les {{NonRefTerm|actuaires}} ({{RefNumber|43|5|5}}*), au contraire, considèrent parfois l’{{TextTerm|âge au prochain anniversaire|4|322|OtherIndexEntry=anniversaire. âge au prochain ...}}. Les données statistiques se rapportent parfois à l’{{TextTerm|âge arrondi à l’entier le plus proche|5|322|OtherIndexEntry=arrondi à l’entier le plus proche. âge ...}}. Le cas échéant, on peut préciser qu’on considère un {{TextTerm|âge exact|6|322|OtherIndexEntry=exact. âge ...}}, pour éviter une confusion avec un {{NonRefTerm|âge}} représentant en fait une {{NonRefTerm|classe d’âge}}. C’est ainsi qu’un individu atteint l’{{NonRefTerm|âge exact}} de 25 ans le jour de son 25<sup>e</sup> anniversaire; par contre, le groupe des {{NonRefTerm|décédés à l’âge de 25 ans}} comprend en réalité les individus décédés à un {{NonRefTerm|âge exact}} compris entre 25 et 26 ans (cf. {{RefNumber|43|2|1}}*), de même que les individus {{NonRefTerm|âgés de 25 ans}} à une certaine date ont alors des {{NonRefTerm|âges exacts}} compris entre 25 et 26 ans.<br />
{{Note|2| D’où l’interprétation à donner de la notation usuelle des {{NonRefTerm|groupes d’âges}} ({{RefNumber|32|5|2}}). Celle-ci devant s’entendre {{NonRefTerm|âges extrêmes inclus}}, le groupe 6-13 ans, p. ex,, comprend les individus dont l’âge {{NonRefTerm|exact}} ({{RefNumber|32|2|6}}) est compris entre 6 et 14 ans.}}<br />
{{Note|3| En français, le mot {{NoteTerm|anniversaire}} évoque une commémoration; le premier anniversaire se situe donc un an après la naissance. Certains pays adoptent un mode de décompte différent : le premier «Geburtstag» allemand, p. ex.., s’identifie avec le jour même de la naissance.}}<br />
<br />
=== 323 ===<br />
<br />
La démographie emprunte au langage courant toute une terminologie, malheureusement imprécise, pour désigner les principaux {{TextTerm|âges de la vie|1|323|IndexEntry=âge de la vie|OtherIndexEntry=vie. âge de la ...}}, ou {{TextTerm|périodes de la vie|1|323|2|IndexEntry=période de la vie|OtherIndexEntry=vie. période de la ...}}. Au début de l’existence se situe l’{{TextTerm|enfance|2|323}}, le mot {{TextTerm|enfant|3|323}} désignant, en général, un individu qui n’a pas encore atteint l’âge de la {{NonRefTerm|puberté}} ({{RefNumber|62|0|2}}). Dans les tout premiers jours de sa vie, l’individu est dénommé {{TextTerm|nouveau-né|4|323|OtherIndexEntry=né. nouveau- ...}} (cf. {{RefNumber|41|0|3}}). Le mot {{TextTerm|nourrisson|5|323}} ne s’applique, à proprement parler, qu’aux enfants qui n’ont pas encore été sevrés. Le mot {{TextTerm|bébé|6|323}}, par lequel on désigne d’ordinaire un enfant incapable de marcher seul, est peu usité en démographie; on lui préfère l’expression {{TextTerm|enfant en bas âge|6|323|2|OtherIndexEntry=âge. enfant en bas ...}}. Par {{TextTerm|jeunes enfants|7|323|IndexEntry=jeune enfant|OtherIndexEntry=enfant. jeune ...}}, on entend généralement les enfants qui n’ont pas encore atteint l’{{NonRefTerm|âge scolaire}} ({{RefNumber|34|6|6}}). L’expression {{TextTerm|enfants d’âge scolaire|8|323|IndexEntry=enfant d’âge scolaire|OtherIndexEntry=scolaire. enfant d’âge ...}} sert fréquemment à désigner la catégorie d’âge immédiatement supérieur.<br />
{{Note|1| En cette acception, le mot {{NoteTerm|âge}}, qui s’employait jadis isolément, ne demeure vivant que dans des expressions (cf. {{RefNumber|32|4|4}}, {{RefNumber|34|6|6}} et {{RefNumber|62|0|1}}*).}}<br />
{{Note|4| {{NoteTerm|nouveau-né}}, adj. ff. s. m. — {{NoteTerm|néonatal}}, adj.}}<br />
{{Note|6| La période correspondante est dénommée {{NoteTerm|première enfance}}; elle s’étend approximativement sur la première année de la vie (cf. {{RefNumber|41|0|1}}*).}}<br />
<br />
=== 324 ===<br />
<br />
Le passage de l’{{NonRefTerm|enfance}} ({{RefNumber|32|3|2}}) à l’{{TextTerm|adolescence|1|324}} est marqué par la {{NonRefTerm|puberté}} ({{RefNumber|62|0|2}}). Le mot {{TextTerm|adolescent|2|324}} désigne généralement des individus qui viennent d’entrer dans la phase de l’{{NonRefTerm|adolescence}}. On lui préfère l’expression {{TextTerm|jeunes gens|3|324|OtherIndexEntry=gens. jeunes ...}} pour désigner les personnes plus proches de l’{{TextTerm|âge adulte|4|324|OtherIndexEntry=adulte. âge ...}}, période de {{TextTerm|maturité|4|324|2}} qui succède à l’adolescence. Le mot {{TextTerm|adulte|5|324}} désigne un individu d’{{NonRefTerm|âge adulte}}. Faute de pouvoir préciser objectivement le début de la {{TextTerm|vieillesse|6|324}}, on convient généralement de la faire commencer à un âge uniforme, éventuellement voisin de l’{{TextTerm|âge de la retraite|7|324|OtherIndexEntry=retraite. âge de la ...}} (cf. {{RefNumber|35|8|5}}), par exemple 60 ou 65 ans. Les personnes qui ont dépassé cet âge constituent la catégorie des {{TextTerm|vieillards|8|324|IndexEntry=vieillard}}, ou {{TextTerm|personnes âgées|8|324|2|IndexEntry=personne âgée|OtherIndexEntry=âgée. personne ...}}.<br />
{{Note|3| Expression souvent abrégée en {{NoteTerm|jeunes}}, pour éviter l’emploi des singuliers différenciés par sexe : {{NoteTerm|jeune homme}} et {{NoteTerm|jeune fille}}. — Cette dernière dénomination ne peut d’ailleurs s’appliquer qu’à des célibataires (cf. {{RefNumber|51|5|4}}*).}}<br />
{{Note|5| On comprend parfois les {{NonRefTerm|vieillards}} parmi les {{NonRefTerm|adultes}}. Le groupe des {{NonRefTerm|adultes}} coïncide alors approximativement avec celui des personnes {{NoteTerm|majeures}} du point de vue juridique. Dans la répartition de la population en trois {{NonRefTerm|grands groupes d’âges}} ({{RefNumber|32|5|4}}), par contre, on considère d’ordinaire que ceux-ci sont respectivement constitués de {{NonRefTerm|jeunes, d’adultes}} et de {{NonRefTerm|vieillards}}. Il y a alors coïncidence approximative entre le groupe des {{NonRefTerm|jeunes}} et celui des personnes {{NoteTerm|mineures}} du point de vue juridique. Les législations française et belge fixent à 21 ans l’{{NoteTerm|âge de la majorité}}, c’est-à-dire l’âge de passage de la {{NoteTerm|minorité à la majorité}}.}}<br />
{{Note|8| Les vieillards les plus âgés — ayant p. ex. plus de 80 ans — constituent le groupe des {{NoteTerm|grands vieillards}}, et l’on appelle parfois {{NoteTerm|longévités}} (cf. {{RefNumber|43|4|4}}) ceux qui atteignent dos âges extrêmes — supérieurs à 95 ou 100 ans, p. ex.}}<br />
<br />
=== 325 ===<br />
<br />
Le classement par âge de la population est généralement établi, soit par {{TextTerm|années d’âge|1|325|IndexEntry=année d’âge|OtherIndexEntry=âge. année d’ ...}}, soit par {{TextTerm|groupes d’âges|2|325|IndexEntry=groupe d’âges|OtherIndexEntry=âge. groupe d’ ...}}, notamment par {{TextTerm|groupes d’âges quinquennaux|3|325|IndexEntry=groupe d’âges quinquennal|OtherIndexEntry=quinquennaux. groupe d’âges ...}}, ou {{TextTerm|groupes de cinq années d’âge|3|325|2|IndexEntry=groupe de cinq années d’âge|OtherIndexEntry=âge. groupe de cinq années d’ ...}}, soit encore par {{TextTerm|grands groupes d’âges|4|325|IndexEntry=grand groupe d’âges|OtherIndexEntry=âge. grand groupe d’ ...}} : p. ex. 0-19 ans, 20-59 ans, 60 ans et plus (cf. {{RefNumber|32|2|2}}*). Aux classements par âge sont éventuellement substitués des classements par {{TextTerm|années de naissance|5|325|IndexEntry=année de naissance|OtherIndexEntry=naissance. année de ...}}. La {{TextTerm|structure par âge|6|325|OtherIndexEntry=âge. structure par ...}}, ou {{TextTerm|composition par âge|6|325|2|OtherIndexEntry=âge. composition par ...}} (cf. {{RefNumber|14|4|4}}), de la population est souvent représentée, conjointement avec sa répartition par sexe, par un double {{NonRefTerm|histogramme}} ({{RefNumber|15|5|8}}), appelé {{TextTerm|pyramide des âges|7|325|OtherIndexEntry=âge. pyramide des ...}} à cause de la figure qu’il évoque par sa forme triangulaire et sa disposition en assises superposées.<br />
<br />
=== 326 ===<br />
<br />
On appelle {{TextTerm|âge moyen|1|326|OtherIndexEntry=moyen. âge ...}} d’une population, la {{NonRefTerm|moyenne}} ({{RefNumber|14|0|1}}) des âges de ses membres, et {{TextTerm|âge médian|2|326|OtherIndexEntry=médian. âge ...}} d’une population, l’âge qui partage les individus qui la composent en deux groupes d’effectifs égaux (cf. {{RefNumber|14|0|6}}). L’augmentation de la proportion des vieillards au sein d’une population traduit son {{TextTerm|vieillissement|3|326}}. Ce phénomène est parfois dénommé {{TextTerm|vieillissement démographique|3|326|2|OtherIndexEntry=démographique. vieillissement ...}}, pour éviter une confusion (cf. {{RefNumber|32|7|1}}). Le phénomène inverse a reçu le nom de {{TextTerm|rajeunissement|4|326}}, ou {{TextTerm|rajeunissement démographique|4|326|2|OtherIndexEntry=démographique. rajeunissement ...}}. <br />Il convient de ne pas confondre le {{NonRefTerm|vieillissement}} de la population, au sens précédent, avec la technique employée pour les {{NonRefTerm|projections démographiques}} ({{RefNumber|72|0|1}}), technique qui consiste à {{TextTerm|vieillir|5|326}} (v. t.) une population en lui appliquant des {{TextTerm|coefficients de survie|6|326|IndexEntry=coefficient de survie|OtherIndexEntry=survie. coefficient de ...}} par groupes d’âges, pour déterminer quel sera l’effectif de ces groupes un certain nombre d’années plus tard.<br />
{{Note|3| {{NoteTerm|vieillissement}}, s. m. — {{NoteTerm|vieillir}}, v. i.}}<br />
{{Note|4| {{NoteTerm|rajeunissement}}, s. m. — {{NoteTerm|rajeunir}}, v. i.}}<br />
<br />
=== 327 ===<br />
<br />
Le {{NonRefTerm|vieillissement démographique}} ({{RefNumber|32|6|3}}) doit être distingué, d’une part de la {{TextTerm|sénescence|1|327}}, ou {{TextTerm|vieillissement individuel|1|327|2|OtherIndexEntry=individuel. vieillissement ...}}, d’autre part de l’{{TextTerm|allongement de la vie humaine|2|327|OtherIndexEntry=humaine. allongement de la vie ...}} résultant notamment du progrès des sciences médicales et de l’amélioration des conditions d’existence. On appelle respectivement {{TextTerm|âge physiologique|3|327|OtherIndexEntry=physiologique. âge ...}} et {{TextTerm|âge mental|4|327|OtherIndexEntry=mental. âge ...}} d’un individu, l’âge auquel correspondrait normalement l’état de ses tissus et organes d’une part, de ses facultés intellectuelles d’autre part. Dans les études où interviennent ces notions, on appelle {{NonRefTerm|âge chronologique}} ({{RefNumber|32|2|1}}) l’âge mesuré par le temps écoulé depuis la {{TextTerm|date de naissance|5|327|OtherIndexEntry=naissance. date de ...}} de l’individu en cause. Le {{TextTerm|quotient intellectuel|6|327|OtherIndexEntry=intellectuel. quotient ...}} — abréviation {{TextTerm|q. i.|6|327|2|IndexEntry=q. i., abréviation de « quotient intellectuel »}} —, utilisé dans l’étude du développement intellectuel des enfants, est le rapport de l’{{NonRefTerm|âge mental}} du sujet à son {{NonRefTerm|âge chronologique}}.<br />
<br />
==<center><font size=12>* * * </font></center>==<br />
{{SummaryShort}}<br />
<br />
{{OtherLanguages|32}}</div>
Nicolas Brouard
http://fr-i.demopaedia.org/w/index.php?title=34&diff=4084
34
2011-10-05T14:52:14Z
<p>Nicolas Brouard : /* 344 */ missing sup></p>
<hr />
<div><br />
<!--'''34'''--><br />
{{CurrentStatus}}<br />
{{Unmodified edition I}}<br />
{{Summary}}<br />
__NOTOC__<br />
== 34 ==<br />
<br />
<br />
=== 340 ===<br />
<br />
On répartit parfois la population d’après les {{TextTerm|langues|1|340|IndexEntry=langue}} parlées, voire d’après les {{TextTerm|dialectes|2|340|IndexEntry=dialecte}}, qui sont des variétés des langues principales. On distingue alors fréquemment la {{TextTerm|langue maternelle|3|340|OtherIndexEntry=maternelle. langue ...}}, dans laquelle l’individu a appris d’abord à parler, et la {{TextTerm|langue usuelle|4|340|OtherIndexEntry=usuel. langue ...}}, dans laquelle il s’exprime habituellement. Cette distinction n’élimine toutefois qu’une partie des difficultés que présente le classement des individus {{TextTerm|bilingues|5|340|IndexEntry=bilingue}}, ou plus généralement {{TextTerm|plurilingues|5|340|2|IndexEntry=plurilingue}}.<br />
{{Note|1| {{NoteTerm|langue}}, s. f. — {{NoteTerm|linguistique}}, s. f. : étude historique et comparative des langues; ff. adj. relatif à l’étude scientifique des langues.<br />Le mot idiome est parfois utilisé pour désigner une langue d’extension limitée.}}<br />
{{Note|2| {{NoteTerm|dialecte}}, s. m. — {{NoteTerm|dialectal}}, adj.<br />En linguistique, on appelle {{NoteTerm|parler}} (s. m.), un dialecte qui n’est utilisé que d’une façon très localisée.<br />En France, on appelle {{NoteTerm|patois}} (s. m.) un dialecte ou parler qui n’est plus employé que par les ruraux.}}<br />
{{Note|5| {{NoteTerm|bilingue}}, adj. — {{NoteTerm|bilinguisme}}, s. m. }}<br />
<br />
=== 341 ===<br />
<br />
On appelle {{TextTerm|statistiques confessionnelles|1|341|IndexEntry=statistique confessionnelle|OtherIndexEntry=confessionnelle. statistique ...}}, ou {{TextTerm|statistiques cultuelles|1|341|2|IndexEntry=statistique cultuelle|OtherIndexEntry=cultuelle. statistique ...}}, des statistiques établies d’après les croyances religieuses des individus. On y distingue généralement, au sein des grandes {{TextTerm|religions|2|341|IndexEntry=religion}}, les principaux {{TextTerm|cultes|3|341|IndexEntry=culte}}, et parfois les {{TextTerm|rites|4|341|IndexEntry=rite}} et les {{TextTerm|sectes|5|341|IndexEntry=secte}}. Un individu qui ne se réclame d’aucune religion, peut se déclarer soit {{TextTerm|libre penseur|6|341|OtherIndexEntry=penseur. libre ...}}, soit {{TextTerm|athée|6|341|2}}.<br />
<br />
=== 342 ===<br />
<br />
La population est souvent classée d’après son {{TextTerm|degré d’instruction|1|342|OtherIndexEntry=instruction. degré d’ ...}}. On appelle généralement {{TextTerm|analphabète|2|342}}, ou {{TextTerm|illettré|2|342|2}}, un individu ne sachant {{NoteTerm|ni}} lire ni écrire. Le groupe des {{TextTerm|alphabètes|3|342|IndexEntry=alphabète}} (néol.) comprend les personnes {{TextTerm|sachant lire et écrire|3|342|2|OtherIndexEntry=lire et écrire. sachant ...}}. On pourrait appeler {{TextTerm|semi-analphabète|4|342}} un individu sachant seulement lire, sans savoir écrire. Les {{TextTerm|statistiques suivant le degré d’instruction|5|342|IndexEntry=statistique suivant le degré d’instruction|OtherIndexEntry=degré d’instruction. statistique suivant le ...}} peuvent comporter un classement d’après la {{TextTerm|durée des études|6|342|OtherIndexEntry=études. durée des ...}}, ou {{TextTerm|durée de scolarité accomplie|6|342|2|OtherIndexEntry=accomplie. durée de scolarité ...}}. On peut aussi établir un classement d’après les {{TextTerm|diplômes|7|342|IndexEntry=diplôme}} obtenus, classement qui dépend alors de l’organisation de l’{{TextTerm|enseignement|8|342}} dans le pays en cause (cf. § suivant).<br />
{{Note|2| {{NoteTerm|analphabète}}, adj. ff. s. m. — {{NoteTerm|analphabétisme}}, s. m.<br />On a parfois employé le mot {{NonRefTerm|illettré}} pour désigner les individus ne sachant pas à la fois lire et écrire.}}<br />
{{Note|4| La structure du terme s’oppose à ce qu’on donne ce sens au mot {{NoteTerm|semi-illettré}}, qui désigne un individu n’ayant reçu qu’une instruction très rudimentaire.}}<br />
<br />
=== 343 ===<br />
<br />
On distingue généralement trois {{TextTerm|degrés d’enseignement|1|343|IndexEntry=degré d’enseignement|OtherIndexEntry=enseignement. degré d’ ...}} (cf. {{RefNumber|34|2|8}}), dénommés respectivement, par niveau croissant : {{TextTerm|enseignement du premier degré|2|343|OtherIndexEntry=degré. enseignement du premier ...}}, ou {{TextTerm|enseignement primaire|2|343|2|OtherIndexEntry=primaire. enseignement ...}}; {{TextTerm|enseignement du second degré|3|343|OtherIndexEntry=degré. enseignement du second ...}}, ou {{TextTerm|enseignement secondaire|3|343|2|OtherIndexEntry=secondaire. enseignement ...}}; {{TextTerm|enseignement supérieur|4|343|OtherIndexEntry=supérieur. enseignement ...}}. Les diverses catégories d’{{TextTerm|établissements d’enseignement|5|343|IndexEntry=établissement d’enseignement|OtherIndexEntry=enseignement. établissement d’ ...}}, et leurs dénominations, dépendent de l’organisation de l’enseignement dans chaque pays (cf. §§ 344). Les trois degrés d’enseignement mentionnés ci-dessous sont généralement dispensés dans des établissements respectivement dénommés : {{TextTerm|écoles primaires|6|343|IndexEntry=école primaire}}, {{TextTerm|établissements secondaires|7|343|IndexEntry=établissement secondaire|OtherIndexEntry=secondaire. établissement ...}} et {{TextTerm|universités|8|343|IndexEntry=université}}.<br />
{{Note|6| {{NoteTerm|école}}, s. f. —- {{NoteTerm|scolaire}}, adj.}}<br />
{{Note|8| {{NoteTerm|université}}, s. f. — {{NoteTerm|universitaire}}, adj.}}<br />
<br />
=== 344 ===<br />
<br />
344-B. En Belgique, on distingue l’{{NoteTerm|enseignement officiel}}, organisé par les pouvoirs publics, et l’{{NoteTerm|enseignement privé}}. Les {{NoteTerm|écoles gardiennes}} et les {{NoteTerm|écoles frœbeliennes}} sont des établissements destinés aux enfants d’âge préscolaire. Dans l’{{NonRefTerm|enseignement secondaire}} ({{RefNumber|34|3|3}}), dit aussi {{NoteTerm|enseignement moyen}}, on distingue deux {{NoteTerm|degrés}} : le {{NonRefTerm|moyen du degré inférieur}} et le {{NonRefTerm|moyen du degré supérieur}}. Les {{NonRefTerm|établissements secondaires}} ({{RefNumber|34|3|7}}) comportant ces deux degrés sont dénommés {{NoteTerm|athénées}} ou {{NoteTerm|lycées}} dans l’enseignement officiel, et {{NoteTerm|collèges}} ou {{NoteTerm|instituts}} dans l’enseignement privé. Les {{NonRefTerm|universités}} ({{RefNumber|34|3|8}}) groupent un certain nombre de {{NoteTerm|facultés}}, dont chacune enseigne les matières relevant d’une même grande discipline, l’{{NonRefTerm|enseignement supérieur}} ({{RefNumber|34|3|4}}) est aussi dispensé dans des {{NoteTerm|écoles supérieures}} et des {{NoteTerm|instituts supérieurs}}. L’{{NoteTerm|enseignement technique}} est donné dans des écoles de plein exercice et dans des cours à horaire réduit. Les {{NoteTerm|écoles techniques}} de plein exercice appartiennent à l’un des trois degrés suivants : {{NonRefTerm|moyen du degré inférieur}}, {{NonRefTerm|moyen du degré supérieur}}, et {{NonRefTerm|degré supérieur}}. Il existe, d’autre part, des {{NoteTerm|écoles normales}}, qui forment le personnel destiné à enseigner dans les écoles gardiennes, primaires ou moyennes du degré inférieur.<br />344-C. Au Canada, on distingue l’{{NoteTerm|enseignement public}}, relevant des ministères provinciaux (cf. 303-C), et l’{{NoteTerm|enseignement privé}}. L’enseignement public est dispensé dans les {{NoteTerm|écoles publiques}}, ainsi que dans les {{NoteTerm|écoles séparées}} (écoles de la minorité religieuse au Canada anglais) — au Canada français, les écoles privées sont appelées {{NoteTerm|écoles indépendantes}}. Les {{NoteTerm|écoles maternelles}} sont des établissements destinés aux enfants d’âge préscolaire, ainsi que les {{NoteTerm|jardins d’enfants}} (au Canada anglais).<br />Au Canada français, l’{{NoteTerm|école primaire}} comprend le {{NoteTerm|cours élémentaire}} qui s’étend jusqu’à la 7<sup>e</sup> année d’enseignement, et le {{NoteTerm|cours secondaire}} qui lui succède jusqu’à la 11<sup>e</sup> ou 12<sup>e</sup> année. Les {{NonRefTerm|établissements secondaires}} ({{RefNumber|34|3|7}}) — {{NoteTerm|collèges classiques}} et {{NoteTerm|séminaires}} — comportent deux {{NoteTerm|cycles}} de quatre années d’études.<br />Au Canada anglais, les {{NoteTerm|écoles élémentaires}} dispensent l’enseignement jusqu’à la 6<sup>e</sup>, 7<sup>e</sup> ou 8<sup>e</sup> année, et les {{NoteTerm|écoles secondaires}} ( «high schools») le continuent jusqu’à la 11<sup>e</sup>, 12<sup>e</sup> ou 13<sup>e</sup> année. L’{{NonRefTerm|enseignement secondaire}} ({{RefNumber|34|3|3}}) est souvent réparti en deux cycles, correspondant respectivement aux «junior high schools» et aux «senior high schools».<br />L’{{NonRefTerm|enseignement supérieur}} ({{RefNumber|34|3|4}}) est dispensé dans des {{NonRefTerm|universités}} ({{RefNumber|34|3|8}}), qui groupent un certain nombre de {{NoteTerm|facultés}}, dont chacune enseigne les matières relevant d’une même grande discipline, et d’{{NoteTerm|écoles professionnelles supérieures}} — au Canada anglais, il existe en outre des {{NoteTerm|collèges}}, établissements d’enseignement supérieur qui peuvent être ou non rattachés à une université. La formation professionnelle relève d’{{NoteTerm|écoles spécialisées}} : {{NoteTerm|écoles techniques, instituts techniques, écoles professionnelles, centres d’apprentissage}}, etc. La formation du personnel enseignant est assurée par des {{NoteTerm|écoles normales}}, ainsi que par des {{NoteTerm|écoles universitaires de pédagogie}} (au Canada français) ou {{NoteTerm|collèges universitaires de pédagogie}} (au Canada anglais).<br />344-F. En France, on distingue l’{{NoteTerm|enseignement public}}, dispensé par des organismes officiels, et l’{{NoteTerm|enseignement privé}}. Les {{NoteTerm|écoles maternelles}} <sup>2</sup> sont des établissements destinés aux enfants d’âge préscolaire. Les {{NoteTerm|lycées}} et {{NoteTerm|collèges}} sont des {{NonRefTerm|établissements secondaires}} ({{RefNumber|34|3|7}}) qui ne diffèrent les uns des autres que par leur mode de gestion. Au sein de l’{{NonRefTerm|enseignement secondaire}} ({{RefNumber|34|3|3}}), on distingue deux {{NoteTerm|cycles}}, le {{NonRefTerm|premier cycle}} correspondant au niveau le plus faible. Des {{NoteTerm|cours complémentaires}}, relevant administrativement de l’{{NonRefTerm|enseignement primaire}}, dispensent aussi l’enseignement du {{NonRefTerm|premier cycle}}. Les {{NonRefTerm|universités}} ({{RefNumber|34|3|8}}) groupent un certain nombre de {{NoteTerm|facultés}}, dont chacune enseigne les matières relevant d’une même grande discipline. L’{{NonRefTerm|enseignement supérieur}} ({{RefNumber|34|3|4}}) est aussi dispensé dans des {{NoteTerm|grandes écoles}} et des {{NoteTerm|instituts}}, qui peuvent être ou non rattachés à une université. Il existe aussi des établissements d’{{NoteTerm|enseignement technique}}, qui ne relèvent admi-nistrativement ni de l’{{NonRefTerm|enseignement primaire}}, ni de l’{{NonRefTerm|enseignement secondaire}}. On les dénomme : {{NoteTerm|centres d’apprentissage}}, {{NoteTerm|collèges techniques, écoles supérieures techniques}}, suivant le niveau de l’enseignement qui y est dispensé. On appelle {{NoteTerm|écoles normales}} des établissements spécialisés dans la formation du personnel enseignant.<br />344-S. En Suisse, l’organisation de l’enseignement relève, dans une très large mesure, de la compétence des {{NonRefTerm|cantons}} (cf. 303-S). Ceux-ci, tenus d’assurer un {{NonRefTerm|enseignement primaire}} ({{RefNumber|34|3|2}}) gratuit, disposent d’une grande latitude pour l’organisation des autres enseignements. A côté des {{NoteTerm|écoles publiques}} de l’enseignement officiel existent des {{NoteTerm|écoles privées}}. Les enfants en âge de scolarité sont instruits dans les {{NonRefTerm|écoles primaires}} ({{RefNumber|34|3|6}}), les {{NoteTerm|écoles secondaires}}, et les {{NoteTerm|écoles moyennes inférieures : écoles de district}} (cf. 303-S), {{NoteTerm|écoles réales inférieures, progymnases, collèges}}. A l’issue de la période de scolarité obligatoire, qui dure de 7 à 9 ans selon les cantons, les élèves peuvent poursuivre leurs études dans des {{NoteTerm|écoles moyennes supérieures — écoles réales supérieures, gymnases, écoles de commerce, écoles normales}} — ou dans des {{NoteTerm|écoles professionnelles}}. Ceux qui entrent en apprentissage sont tenus de suivre parallèlement des cours dans des {{NoteTerm|écoles des arts et métiers}} ou dans des {{NoteTerm|écoles commerciales}}. Les autres sont, dans la plupart des cantons, astreints à suivre périodiquement des {{NoteTerm|cours complémentaires}} (généraux, ménagers, ou d’agriculture). L’apprentissage aux arts et métiers terminé, les jeunes gens peuvent parfaire leur formation dans une {{NoteTerm|école technique}} ( «technicum»). L’{{NonRefTerm|enseignement supérieur}} ({{RefNumber|34|3|4}}) est dispensé par sept {{NonRefTerm|universités}} ({{RefNumber|34|3|8}}) cantonales, ainsi que par l’{{NonRefTerm|École polytechnique fédérale}} de Zurich et l’ {{NonRefTerm|École des hautes études commerciales}} de Saint-Gall. </sup><br />
<br />
=== 345 ===<br />
<br />
Le mot {{TextTerm|classe|1|345}} peut désigner un groupe d’{{TextTerm|élèves|2|345|IndexEntry=élève}} instruits simultanément par le ou les mêmes {{TextTerm|maîtres|3|345|IndexEntry=maître}}. Le mot {{TextTerm|classe|4|345}} peut aussi désigner une {{TextTerm|salle de classe|4|345|2|OtherIndexEntry=classe. salle de ...}}, c’est-à-dire une pièce aménagée pour recevoir une {{NonRefTerm|classe}} au sens précédent ({{RefNumber|34|5|1}}). On emploie encore le mot {{TextTerm|classe|5|345}} pour désigner un ensemble d’élèves parvenus au même niveau d’instruction, et auxquels sont dispensés, pendant l’année scolaire, les cours correspondant à une certaine {{TextTerm|année|5|345|2}} d’enseignement. Les jeunes gens qui s’instruisent dans une {{NonRefTerm|université}} ({{RefNumber|34|3|8}}) sont appelés des {{TextTerm|étudiants|6|345|IndexEntry=étudiant}}.<br />
{{Note|2| Le mot {{NoteTerm|écolier}} ne s’emploie que pour les enfants suivant l’{{NonRefTerm|enseignement du premier degré}} ({{RefNumber|34|3|2}}). Le mot {{NonRefTerm|élève}} s’applique à tout individu suivant les cours d’une {{NonRefTerm|école}}. Dans l’{{NonRefTerm|enseignement supérieur}} ({{RefNumber|34|3|4}}), en particulier, on n’appelle généralement pas {{NonRefTerm|étudiants}} ({{RefNumber|34|5|6}}) les {{NonRefTerm|élèves des grandes écoles}} (cf. 344-F).}}<br />
{{Note|3| appelés {{NoteTerm|instituteurs}} dans l’enseignement primaire, et {{NoteTerm|professeurs}} dans les enseignements secondaire et supérieur.}}<br />
{{Note|5| Noter qu’en France, il est d’usage de numéroter les {{NonRefTerm|classes}} en commençant par le niveau le plus élevé (ordre de préséance), et les {{NonRefTerm|années}} en commençant par le niveau le plus faible (ordre chronologique).}}<br />
<br />
=== 346 ===<br />
<br />
Les {{TextTerm|statistiques scolaires et universitaires|1|346|IndexEntry=statistique scolaire et universitaire|OtherIndexEntry=universitaire. statistique scolaire et ...}} distinguent généralement l’{{TextTerm|effectif scolaire inscrit|2|346|OtherIndexEntry=inscrit. effectif scolaire ...}} et l’{{TextTerm|effectif scolaire présent|3|346|OtherIndexEntry=présent. effectif scolaire ...}} à une certaine date, ce qui permet d’étudier la {{TextTerm|fréquentation scolaire|4|346|OtherIndexEntry=scolaire. fréquentation ...}}. Dans certains pays, les enfants sont soumis à l’{{TextTerm|obligation scolaire|5|346|OtherIndexEntry=scolaire. obligation ...}} entre certaines limites d’âge; l’expression {{TextTerm|âge scolaire|6|346|OtherIndexEntry=scolaire. âge ...}} (cf. {{RefNumber|32|3|8}}) y revêt alors volontiers le sens d’{{TextTerm|âge de scolarité obligatoire|6|346|2|OtherIndexEntry=obligatoire. âge de scolarité ...}}, et l’on y considère fréquemment l’{{TextTerm|effectif d’âge scolaire obligatoire|7|346|OtherIndexEntry=obligatoire. effectif d’âge scolaire ...}}.<br />
{{Note|4| Il semble qu’on devrait réserver l’expression {{NoteTerm|taux de scolarisation}} pour désigner le rapport de l’effectif inscrit à l’effectif d’âge scolaire, et dénommer {{NoteTerm|taux de fréquentation scolaire}} le rapport de l’effectif présent à l’effectif inscrit.<br />{{NoteTerm|scolarisation}}, s. f. — {{NoteTerm|scolariser}}, v. t. : amener à s’instruire dans des écoles — {{NoteTerm|scolarisante}}, adj. : susceptible d’être scolarisé.}}<br />
{{Note|6| correspondant actuellement (1957) au groupe d’âges 6-13 ans (cf. {{RefNumber|32|2|2}}*) en France et en Belgique.}}<br />
<br />
==<center><font size=12>* * * </font></center>==<br />
{{SummaryShort}}<br />
<br />
{{OtherLanguages|34}}</div>
Nicolas Brouard
http://fr-i.demopaedia.org/w/index.php?title=30&diff=4035
30
2011-10-05T14:49:46Z
<p>Nicolas Brouard : /* 303 */</p>
<hr />
<div><br />
<!--'''30'''--><br />
{{CurrentStatus}}<br />
{{Unmodified edition I}}<br />
{{Summary}}<br />
__NOTOC__<br />
= État de la population =<br />
== 30 ==<br />
<br />
<br />
=== 301 ===<br />
<br />
L’étude de l’ {{NonRefTerm|état de la population}} ({{RefNumber|20|1|5}}) comprend celle de la {{TextTerm|localisation du peuplement|1|301|OtherIndexEntry=peuplement. localisation du ...}} (cf. {{RefNumber|81|5|6}}*), et celle de la {{NonRefTerm|structure}} ({{RefNumber|14|4|4}}) de la population. Toute {{NonRefTerm|population}} (au sens du n° {{RefNumber|10|1|3}}) vit sur un certain {{TextTerm|territoire|2|301}}, et l’on étudie sous le nom de {{TextTerm|répartition territoriale|3|301|OtherIndexEntry=territoriale. répartition ...}}, ou {{TextTerm|répartition géographique|3|301|2|OtherIndexEntry=géographique. répartition ...}}, ou {{TextTerm|répartition spatiale|3|301|3|OtherIndexEntry=spatiale. répartition ...}}, la façon dont elle s’y trouve répartie.<br />
<br />
=== 302 ===<br />
<br />
Le {{NonRefTerm|territoire}} ({{RefNumber|30|1|2}}) sur lequel vit une population peut être fractionné en {{TextTerm|divisions territoriales|1|302|IndexEntry=division territoriale|OtherIndexEntry=territoriale. division ...}} selon divers critères. Les statistiques démographiques sont souvent établies par {{TextTerm|divisions administratives|2|302|IndexEntry=division administrative|OtherIndexEntry=administrative. division ...}}, ou {{TextTerm|unités administratives|2|302|2|IndexEntry=unité administrative|OtherIndexEntry=administrative. unité ...}} (cf. §§ 303); mais on considère aussi la répartition de la population par {{TextTerm|régions|3|302|IndexEntry=région}} et par {{TextTerm|zones|4|302|IndexEntry=zone}}, définies d’après des critères géographiques, économiques ou sociologiques. Les mots {{NonRefTerm|région}} et {{NonRefTerm|zone}} peuvent d’ailleurs s’appliquer à des territoires d’étendues très diverses. Ainsi l’expression {{TextTerm|région naturelle|5|302|OtherIndexEntry=naturelle. région ...}} doit souvent s’entendre au sens de {{NonRefTerm|petite région présentant une unité géographique}} — correspondant alors à une ancienne acception du mot {{TextTerm|pays|5|302|2}} (cf. {{RefNumber|30|5|1}}) que les géographes tendent à rajeunir —, mais peut parfois désigner une véritable zone climatique. Le territoire d’un {{NonRefTerm|État}} ({{RefNumber|30|5|3}}) peut être divisé en {{TextTerm|régions économiques|6|302|IndexEntry=région économique|OtherIndexEntry=économique. région ...}}; en France, celles-ci sont d’ordinaire conçues de façon telle, qu’elles s’étendent sur plusieurs {{NonRefTerm|départements}} (cf. 303-F). L’expression {{TextTerm|aire naturelle|7|302|OtherIndexEntry=naturelle. aire ...}} désigne, en {{NonRefTerm|écologie humaine}} ({{RefNumber|10|3|5}}), le territoire de répartition d’un groupe présentant certains caractères; l’emploi du qualificatif {{NonRefTerm|naturel}}, en l’occurrence, s’explique par l’origine biologique de l’expression.<br />
{{Note|2| Pour serrer de plus près la réalité démographique, la statistique française effectue certains dépouillements par {{NoteTerm|unités de peuplement}} (cf. {{RefNumber|81|5|6}}*), englobant sous cette dénomination unique à la fois les {{NonRefTerm|agglomérations multicommunales}} ({{RefNumber|30|7|1}}) et les {{NonRefTerm|communes}} (cf. 303-F) non comprises dans de telles agglomérations.}}<br />
<br />
=== 303 ===<br />
<br />
303-B. En Belgique, les principales {{NonRefTerm|unités administratives}} ({{RefNumber|30|2|2}}) sont la {{NoteTerm|commune}} et la {{NoteTerm|province}}. Les unités intermédiaires sont constituées par les {{NoteTerm|cantons électoraux}} et les {{NoteTerm|cantons judiciaires}} à l’échelon inférieur, et par les {{NoteTerm|arrondissements administratifs}} et les {{NoteTerm|arrondissements judiciaires à}} l’échelon supérieur.<br />303-C. Au Canada, les principales {{NonRefTerm|unités administratives}} ({{RefNumber|30|2|2}}) sont la {{NoteTerm|province}}, le {{NoteTerm|comté}} et la {{NoteTerm|municipalité}}. L’organisation administrative varie selon les provinces. La plupart sont divisées en comtés. Dans certaines d’entre elles, seule la {{NonRefTerm|population urbaine}} (cf. {{RefNumber|31|1|4}}), c’est-à-dire celle vivant dans des {{NoteTerm|cités}}, {{NoteTerm|villes}} ou {{NoteTerm|villages}} {{NonRefTerm|constitués}}, bénéficie d’une organisation en municipalités. Dans d’autres, il existe en outre des municipalités de {{NoteTerm|canton}} ou de {{NoteTerm|paroisse}}, ou des {{NoteTerm|municipalités rurales}}. En général, cependant, une fraction importante de la {{NonRefTerm|population rurale}} (cf. {{RefNumber|31|1|3}}) des provinces reste en dehors de toute organisation municipale. <br />303-F. En France, les {{NonRefTerm|unités administratives}} ({{RefNumber|30|2|2}}) sont désignées comme suit, dans l’ordre hiérarchique ascendant : la {{NoteTerm|commune}}, unité administrative élémentaire; le {{NoteTerm|canton}} groupant plusieurs communes; l’{{NoteTerm|arrondissement}}, constitué de plusieurs cantons; et le {{NoteTerm|département}}, comprenant plusieurs arrondissements. Une nouvelle unité administrative tend à s’affirmer : la {{NoteTerm|région}}, groupant plusieurs départements; mais son rôle demeure encore très discret. Les deux unités fondamentales de la hiérarchie sont la {{NonRefTerm|commune}} et le {{NonRefTerm|département}}.<br />Les principales unités territoriales mentionnées dans les documents anciens sont : la {{NoteTerm|paroisse}}, jouant le rôle d’unité territoriale élémentaire, généralement moins étendue que l’actuelle {{NonRefTerm|commune}}; le {{NoteTerm|bailliage}}, ou la {{NoteTerm|sénéchaussée}}, de dimension intermédiaire entre le {{NonRefTerm|canton}} et l’{{NonRefTerm|arrondissement}} actuels; l’{{NoteTerm|élection}}, comprenant plusieurs bailliages ou sénéchaussées; la {{NoteTerm|généralité}}, constituée de plusieurs élections et dont la superficie équivalait d’ordinaire à celle de plusieurs des {{NonRefTerm|départements}} actuels.<br />303-S. En Suisse, les {{NonRefTerm|unités administratives}} ({{RefNumber|30|2|2}}) fondamentales sont la {{NoteTerm|commune}} et le {{NoteTerm|canton}}. Malgré leurs dimensions restreintes, les {{NonRefTerm|cantons}} suisses jouissent d’une autonomie comparable à celle d’un {{NonRefTerm|État}} au sens du n° {{RefNumber|30|5|5}}. Ils sont divisés en {{NoteTerm|districts}} groupant plusieurs communes.<br />
<br />
=== 304 ===<br />
<br />
Une population est dite {{TextTerm|sédentaire|1|304}} lorsqu’elle vit à demeure dans des {{NonRefTerm|habitations}} ({{RefNumber|10|1|4}}*) fixes, {{TextTerm|nomade|2|304}} lorsqu’elle ne cesse de se déplacer d’un lieu à un autre, et {{TextTerm|semi-nomade|3|304|OtherIndexEntry=nomade. semi- ...}} lorsqu’elle ne vit qu’une partie de l’année dans des habitations fixes. Dans quelques pays, certaines portions du territoire sont constituées en {{TextTerm|réserves|4|304|IndexEntry=réserve}}, où des groupes peu évolués peuvent continuer à vivre selon leurs traditions ancestrales.<br />
{{Note|1| {{NoteTerm|sédentaire}}, adj. ff. s. m. — {{NoteTerm|sédentarité}}, s. f.}}<br />
{{Note|2| {{NoteTerm|nomade}}, adj. ff. s. m. — {{NoteTerm|nomadisme}}, s. m.}}<br />
<br />
=== 305 ===<br />
<br />
A proprement parler, le mot {{TextTerm|pays|1|305}} désigne un {{NonRefTerm|territoire}} ({{RefNumber|30|1|2}}), le mot {{TextTerm|nation|2|305}} un ensemble d’individus liés par un passé commun et vivant sur un même territoire, et le mot {{TextTerm|État|3|305}} (toujours pourvu d’une majuscule en cet emploi) une entité politique; mais lorsqu’il y a correspondance intime entre le {{NonRefTerm|pays}}, la {{NonRefTerm|nation}} et l’ {{NonRefTerm|État}}, il n’est pas rare qu’on confonde les trois mots dans leurs emplois. De l’{{NonRefTerm|État}} au sens précédent, qu’on dénomme alors volontiers {{TextTerm|État souverain|3|305|2|OtherIndexEntry=souverain. État ...}}, il faut distinguer l’{{TextTerm|État|5|305}} constitutif d’un {{TextTerm|État fédéral|4|305|OtherIndexEntry=fédéral. État ...}}, qui peut avoir conservé une certaine autonomie législative, mais ne jouit plus de l’indépendance politique. Le mot {{TextTerm|territoire|6|305}} recouvre parfois une conception voisine de celle d’État; il s’applique alors à d’anciennes régions colonisées qui ont accédé récemment à une indépendance plus ou moins complète; on distingue à cet égard les {{TextTerm|territoires autonomes|7|305|IndexEntry=territoire autonome|OtherIndexEntry=autonome. territoire ...}} et les {{TextTerm|territoires non autonomes|8|305|IndexEntry=territoire non autonome|OtherIndexEntry=autonome. territoire non ...}}.<br />
{{Note|2| {{NoteTerm|nation}}, s. f. — {{NoteTerm|national}}, adj. ff. s. m.}}<br />
<br />
=== 306 ===<br />
<br />
Le mot {{TextTerm|agglomération|1|306}} peut s’appliquer à tout ensemble compact de maisons d’habitation, quelle que soit sa taille. Le mot {{TextTerm|localité|1|306|2}}, parfois synonyme de {{NonRefTerm|commune}} (cf. 303-B, 303-F et 303-S), peut s’employer dans le même sens, bien qu’il s’applique de préférence a des agglomérations de dimensions modestes. Un {{TextTerm|hameau|2|306}} est une {{NonRefTerm|agglomération rurale}} ({{RefNumber|30|6|3}}) constituée d’un petit groupe de maisons. Le {{TextTerm|village|3|306}} est une {{NonRefTerm|agglomération rurale}} plus importante, où apparaît une certaine différenciation économique. On appelle {{TextTerm|ville|4|306}}, une {{NonRefTerm|commune}} dans la vie de laquelle les activités agricoles ne jouent pas un rôle essentiel. Ce critère, appliqué non plus aux {{NonRefTerm|communes}}, mais aux {{NonRefTerm|agglomérations}}, permet d’établir une distinction entre {{TextTerm|agglomérations rurales|3|306|2|IndexEntry=agglomération rurale|OtherIndexEntry=rurale. agglomération ...}} et {{TextTerm|agglomérations urbaines|4|306|2|IndexEntry=agglomération urbaine|OtherIndexEntry=urbaine. agglomération ...}}. La {{NonRefTerm|ville}} où siège le gouvernement d’un État est appelée sa {{TextTerm|capitale|5|306}}. L’agglomération principale (à tel point de vue, d’ordinaire administratif) d’une certaine {{NonRefTerm|division territoriale}} ({{RefNumber|30|2|1}}) est appelée son {{TextTerm|chef-lieu|6|306|OtherIndexEntry=lieu. chef- ...}}. La division des grandes villes en {{TextTerm|quartiers|7|306|IndexEntry=quartier}} est parfois sanctionnée par voie administrative, sous des dénominations variées; p. ex. {{TextTerm|arrondissement|7|306|2}}, {{TextTerm|canton|7|306|3}}, {{TextTerm|section|7|306|4}}.<br />
{{Note|1| La statistique française désigne par {{NoteTerm|population agglomérée}} d’une commune, la population agglomérée au {{NonRefTerm|chef-lieu}} ({{RefNumber|30|6|6}}) administratif de la commune et par {{NoteTerm|population éparse}}, le reste de la population de la commune, y compris éventuellement la population des agglomérations distinctes de celle du chef-lieu. Lorsque ces dernières sont assez importantes, leur existence est souvent sanctionnée administrativement par la constitution de {{NoteTerm|sections de commune}}.}}<br />
{{Note|3| Le mot {{NoteTerm|bourg}}, qui s’appliquait originellement à une localité entourée d’une enceinte fortifiée, désigne généralement aujourd’hui un village plus important que ceux qui l’entourent, jouant pour eux le rôle de centre d’attraction par son marché.}}<br />
{{Note|6| Une agglomération de faible importance, dépendant du {{NonRefTerm|chef-lieu}} du territoire sur lequel elle se trouve, constitue ce qu’on appelle un {{NoteTerm|écart}}.}}<br />
{{Note|7| Les {{NonRefTerm|arrondissements}} et {{NonRefTerm|cantons}} des villes françaises sont à distinguer des divisions du territoire comportant des dénominations semblables (cf. 303-F). Paris est la seule ville française comportant des divisions administratives effectivement dénommées {{NonRefTerm|quartiers }}: on en compte quatre dans chacun de ses vingt {{NonRefTerm|arrondissements}}.}}<br />
<br />
=== 307 ===<br />
<br />
Les {{NonRefTerm|agglomérations urbaines}} ({{RefNumber|30|6|4}}) se développent souvent par intégration de localités limitrophes, qui perdent progressivement leur autonomie fonctionnelle tout en conservant leur autonomie administrative. Ce processus aboutit à la constitution d’{{TextTerm|agglomérations multicommunales|1|307|IndexEntry=agglomération multicommunale|OtherIndexEntry=multicommunale. agglomération ...}}, comportant généralement, lorsqu’il s’agit de grandes agglomérations, un {{TextTerm|noyau urbain|2|307|OtherIndexEntry=urbain. noyau ...}} dirigeant, et des {{TextTerm|banlieues|3|307|IndexEntry=banlieue}} à fonctions spécialisées. La {{TextTerm|conurbation|4|307}}, par contre, est un ensemble organique constitué de plusieurs {{NonRefTerm|agglomérations}}, ayant conservé chacune leur individualité et constituant autant d’unités de vie urbaine équilibrée.<br />
{{Note|3| {{NoteTerm|banlieue}}, s. f. — {{NoteTerm|suburbain}}, adj.}}<br />
<br />
==<center><font size=12>* * * </font></center>==<br />
{{SummaryShort}}<br />
<br />
{{OtherLanguages|30}}</div>
Nicolas Brouard
http://fr-i.demopaedia.org/w/index.php?title=Mod%C3%A8le:OtherLanguages&diff=11585
Modèle:OtherLanguages
2010-09-10T13:51:27Z
<p>Nicolas Brouard : </p>
<hr />
<div><!--'''Template:OtherLanguages'''--><br />
[[fr-II:{{{1}}}]] [[ar-I:{{{1}}}]] [[cs-I:{{{1}}}]] [[de-I:{{{1}}}]] [[en-I:{{{1}}}]] [[es-I:{{{1}}}]] [[fi-I:{{{1}}}]] [[it-I:{{{1}}}]] [[pl-I:{{{1}}}]] [[pt-I:{{{1}}}]] [[ru-I:{{{1}}}]]</div>
Nicolas Brouard
http://fr-i.demopaedia.org/w/index.php?title=MediaWiki:Sitesubtitle&diff=11659
MediaWiki:Sitesubtitle
2010-09-10T13:16:58Z
<p>Nicolas Brouard : Dictionnaire démographique multilingue (première édition, 1958)</p>
<hr />
<div>Dictionnaire démographique multilingue (première édition, 1958)</div>
Nicolas Brouard