http://sh-i.demopaedia.org/w/api.php?action=feedcontributions&user=Nicolas+Brouard&feedformat=atom
Demopædia - Doprinosi korisnika [sh]
2024-03-28T15:26:03Z
Doprinosi korisnika
MediaWiki 1.28.0
http://sh-i.demopaedia.org/w/index.php?title=MediaWiki:RefToolbarTextTerm.js&diff=6765
MediaWiki:RefToolbarTextTerm.js
2017-06-25T19:39:30Z
<p>Nicolas Brouard: 1 revizija</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://sh-i.demopaedia.org/w/index.php?title=MediaWiki:Editpage.js&diff=6767
MediaWiki:Editpage.js
2017-06-25T19:39:30Z
<p>Nicolas Brouard: 1 revizija</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://sh-i.demopaedia.org/w/index.php?title=MediaWiki:Gadget-citations.js&diff=6769
MediaWiki:Gadget-citations.js
2017-06-25T19:39:30Z
<p>Nicolas Brouard: 1 revizija</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://sh-i.demopaedia.org/w/index.php?title=MediaWiki:Gadget-citations&diff=6771
MediaWiki:Gadget-citations
2017-06-25T19:39:30Z
<p>Nicolas Brouard: 1 revizija</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://sh-i.demopaedia.org/w/index.php?title=%C5%A0ablon:NonRefTerm&diff=6773
Šablon:NonRefTerm
2017-06-25T19:39:30Z
<p>Nicolas Brouard: 1 revizija</p>
<hr />
<div><i>{{{1}}}</i><noinclude><!--'''Template:NonRefTerm'''--><br />
[[Category:NonRefTerm]] {{PAGENAME}}<br />
</noinclude></div>
Nicolas Brouard
http://sh-i.demopaedia.org/w/index.php?title=%C5%A0ablon:Note&diff=6775
Šablon:Note
2017-06-25T19:39:30Z
<p>Nicolas Brouard: 1 revizija</p>
<hr />
<div><!--'''Template:Note'''-->* <font size="-1">{{{1}}}. {{{2}}}</font></div>
Nicolas Brouard
http://sh-i.demopaedia.org/w/index.php?title=%C5%A0ablon:NoteTerm&diff=6777
Šablon:NoteTerm
2017-06-25T19:39:30Z
<p>Nicolas Brouard: 1 revizija</p>
<hr />
<div><!--'''Template:NoteTerm'''--><b>{{{1}}}</b>{{<br />
#if: {{{2|}}} |({{{2}}})|}}<noinclude><br />
[[Category:Index]] {{PAGENAME}}<br />
</noinclude></div>
Nicolas Brouard
http://sh-i.demopaedia.org/w/index.php?title=%C5%A0ablon:TextTerm&diff=6779
Šablon:TextTerm
2017-06-25T19:39:30Z
<p>Nicolas Brouard: 1 revizija</p>
<hr />
<div><!--'''Template:TextTerm'''-->{{<br />
#if: {{{IndexEntry|}}} |<br />
<b>[[{{{IndexEntry}}}|{{{1}}}]]</b>|<br />
<b>[[{{{1}}}]]</b>}}&nbsp;<sup>{{{2}}}</sup>{{<br />
#if: {{{EnglishEntry|}}} |({{{EnglishEntry}}})|}}<noinclude><br />
[[Category:Dictionary]] {{PAGENAME}}<br />
</noinclude></div>
Nicolas Brouard
http://sh-i.demopaedia.org/w/index.php?title=%C5%A0ablon:RefNumber&diff=6781
Šablon:RefNumber
2017-06-25T19:39:30Z
<p>Nicolas Brouard: 1 revizija</p>
<hr />
<div><!--'''Template:RefNumber'''-->[[{{{1}}}#{{{1}}}{{{2}}}|{{{1}}}{{{2}}}-{{{3}}}]]</div>
Nicolas Brouard
http://sh-i.demopaedia.org/w/index.php?title=MediaWiki:RefToolbarConfig.js&diff=6751
MediaWiki:RefToolbarConfig.js
2017-06-25T19:39:29Z
<p>Nicolas Brouard: 1 revizija</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://sh-i.demopaedia.org/w/index.php?title=MediaWiki:Gadgets-definition&diff=6753
MediaWiki:Gadgets-definition
2017-06-25T19:39:29Z
<p>Nicolas Brouard: 1 revizija</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://sh-i.demopaedia.org/w/index.php?title=MediaWiki:Common.js&diff=6755
MediaWiki:Common.js
2017-06-25T19:39:29Z
<p>Nicolas Brouard: 1 revizija</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://sh-i.demopaedia.org/w/index.php?title=MediaWiki:Common.js/edit.js&diff=6757
MediaWiki:Common.js/edit.js
2017-06-25T19:39:29Z
<p>Nicolas Brouard: 1 revizija</p>
<hr />
<div>/* Any JavaScript here will be loaded for all users on every page load. */<br />
/* 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://sh-i.demopaedia.org/w/index.php?title=MediaWiki:Edittools.js&diff=6759
MediaWiki:Edittools.js
2017-06-25T19:39:29Z
<p>Nicolas Brouard: 1 revizija</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://sh-i.demopaedia.org/w/index.php?title=MediaWiki:Edittools&diff=6761
MediaWiki:Edittools
2017-06-25T19:39:29Z
<p>Nicolas Brouard: 1 revizija</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://sh-i.demopaedia.org/w/index.php?title=MediaWiki:RefToolbarBaseTextTerm.js&diff=6763
MediaWiki:RefToolbarBaseTextTerm.js
2017-06-25T19:39:29Z
<p>Nicolas Brouard: 1 revizija</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://sh-i.demopaedia.org/w/index.php?title=MediaWiki:Gadget-DotsSyntaxHighlighter.js&diff=6743
MediaWiki:Gadget-DotsSyntaxHighlighter.js
2017-06-25T19:39:28Z
<p>Nicolas Brouard: 1 revizija</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://sh-i.demopaedia.org/w/index.php?title=MediaWiki:RefToolbarNoDialogsTextTerm.js&diff=6745
MediaWiki:RefToolbarNoDialogsTextTerm.js
2017-06-25T19:39:28Z
<p>Nicolas Brouard: 1 revizija</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://sh-i.demopaedia.org/w/index.php?title=MediaWiki:Gadget-refToolbar.js&diff=6747
MediaWiki:Gadget-refToolbar.js
2017-06-25T19:39:28Z
<p>Nicolas Brouard: 1 revizija</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://sh-i.demopaedia.org/w/index.php?title=MediaWiki:Gadget-refToolbar&diff=6749
MediaWiki:Gadget-refToolbar
2017-06-25T19:39:28Z
<p>Nicolas Brouard: 1 revizija</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://sh-i.demopaedia.org/w/index.php?title=MediaWiki:Common.js&diff=6754
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://sh-i.demopaedia.org/w/index.php?title=MediaWiki:Gadget-DotsSyntaxHighlighter.js&diff=6742
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://sh-i.demopaedia.org/w/index.php?title=MediaWiki:Gadgets-definition&diff=6752
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://sh-i.demopaedia.org/w/index.php?title=MediaWiki:Gadget-refToolbar.js&diff=6746
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://sh-i.demopaedia.org/w/index.php?title=MediaWiki:RefToolbarTextTerm.js&diff=6764
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://sh-i.demopaedia.org/w/index.php?title=MediaWiki:RefToolbarNoDialogsTextTerm.js&diff=6744
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://sh-i.demopaedia.org/w/index.php?title=MediaWiki:RefToolbarConfig.js&diff=6750
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://sh-i.demopaedia.org/w/index.php?title=%C5%BDIVORO%C4%90ENJE,_sr.&diff=5395
ŽIVOROĐENJE, sr.
2013-05-19T18:24:57Z
<p>Nicolas Brouard: Trying the new sorting algorithm of wikipedia!!!</p>
<hr />
<div><!--'''ŽIVOROĐENJE, sr.'''--><br />
{{TextTerms|S=601|P=60|Ed=I|CompleteIndexTerm=| content=<br />
{{NewLineT|S=601|N=1}} {{<br />
TofT|Lang=sh|Ed=I|N=1|Color=yes|Te=PLODNOST, ž.}}{{<br />
TofT|Lang=sh|Ed=I|N=1|SubN=2|Te=NATALITET, m.}}{{<br />
TofT|Lang=sh|Ed=I|N=1|SubN=3|Te=RODNOST, ž.}}{{<br />
TofT|Lang=ar|Ed=I|N=1|Te=خصوبة الفعالة}}{{<br />
TofT|Lang=ar|Ed=I|N=1|SubN=2|Te=خصوبة}}{{<br />
TofT|Lang=cs|Ed=I|N=1|Color=yes|Te=plodnost}}{{<br />
TofT|Lang=cs|Ed=I|N=1|SubN=2|Te=porodnost}}{{<br />
TofT|Lang=de|Ed=I|N=1|Te=Fruchtbarkeit}}{{<br />
TofT|Lang=de|Ed=I|N=1|SubN=2|Te=Geborenenhäufigkeit}}{{<br />
TofT|Lang=de|Ed=I|N=1|SubN=3|Te=Geburtlichkeit}}{{<br />
TofT|Lang=de|Ed=I|N=1|SubN=4|Te=Natalität}}{{<br />
TofT|Lang=en|Ed=I|N=1|Color=yes|Te=fertility}}{{<br />
TofT|Lang=en|Ed=I|N=1|SubN=2|Te=natality}}{{<br />
TofT|Lang=es|Ed=I|N=1|Te=fecundidad}}{{<br />
TofT|Lang=es|Ed=I|N=1|SubN=2|Te=natalidad}}{{<br />
TofT|Lang=fi|Ed=I|N=1|Color=yes|Te=syntyneisyys}}{{<br />
TofT|Lang=fr|Ed=I|N=1|Te=fécondité}}{{<br />
TofT|Lang=fr|Ed=I|N=1|SubN=2|Te=natalité}}{{<br />
TofT|Lang=it|Ed=I|N=1|Color=yes|Te=fecondità}}{{<br />
TofT|Lang=it|Ed=I|N=1|SubN=2|Te=natalità}}{{<br />
TofT|Lang=it|Ed=I|N=1|SubN=2|Te=fertilità}}{{<br />
TofT|Lang=pl|Ed=I|N=1|Te=płodność}}{{<br />
TofT|Lang=pl|Ed=I|N=1|SubN=2|Te=rodność}}{{<br />
TofT|Lang=pt|Ed=I|N=1|Color=yes|Te=FECUNDIDADE}}{{<br />
TofT|Lang=pt|Ed=I|N=1|SubN=2|Te=NATALIDADE}}{{<br />
TofT|Lang=ru|Ed=I|N=1|Te=Плодовитость}}{{<br />
TofT|Lang=ru|Ed=I|N=1|SubN=2|Te=Рождаемость}}{{<br />
TofT|Lang=ru|Ed=I|N=1|SubN=2|Te=Фертильность (см. плодовитость)}}<br />
{{NewLineT|S=601|N=2}} {{<br />
TofT|Lang=sh|Ed=I|N=2|Color=yes|Te=RAĐANJE, sr.}}{{<br />
TofT|Lang=ar|Ed=I|N=2|Te=توالد}}{{<br />
TofT|Lang=ar|Ed=I|N=2|SubN=2|Te=تناسل}}{{<br />
TofT|Lang=cs|Ed=I|N=2|Color=yes|Te=rození}}{{<br />
TofT|Lang=de|Ed=I|N=2|Te=Zeugung}}{{<br />
TofT|Lang=de|Ed=I|N=2|SubN=2|Te=Erzeugung}}{{<br />
TofT|Lang=de|Ed=I|N=2|SubN=3|Te=Hervorbringung}}{{<br />
TofT|Lang=en|Ed=I|N=2|Color=yes|Te=reproduction}}{{<br />
TofT|Lang=es|Ed=I|N=2|Te=procreación}}{{<br />
TofT|Lang=fi|Ed=I|N=2|Color=yes|Te=suvunjatkaminen}}{{<br />
TofT|Lang=fr|Ed=I|N=2|Te=procréation}}{{<br />
TofT|Lang=it|Ed=I|N=2|Color=yes|Te=procreazione}}{{<br />
TofT|Lang=pl|Ed=I|N=2|Te=reprodukcja}}{{<br />
TofT|Lang=pt|Ed=I|N=2|Color=yes|Te=REPRODUÇÃO}}{{<br />
TofT|Lang=ru|Ed=I|N=2|Te=Деторождение}}<br />
{{NewLineT|S=601|N=3}} {{<br />
TofT|Lang=sh|Ed=I|N=3|Color=yes|Te=ROĐENJE, sr.}}{{<br />
TofT|Lang=ar|Ed=I|N=3|Te=ولادات المواليد}}{{<br />
TofT|Lang=cs|Ed=I|N=3|Color=yes|Te=narození}}{{<br />
TofT|Lang=de|Ed=I|N=3|Te=Geborene}}{{<br />
TofT|Lang=en|Ed=I|N=3|Color=yes|Te=birth}}{{<br />
TofT|Lang=es|Ed=I|N=3|Te=nacimiento}}{{<br />
TofT|Lang=fi|Ed=I|N=3|Color=yes|Te=syntyminen}}{{<br />
TofT|Lang=fi|Ed=I|N=3|SubN=2|Te=syntymätapaus}}{{<br />
TofT|Lang=fr|Ed=I|N=3|Te=naissance}}{{<br />
TofT|Lang=it|Ed=I|N=3|Color=yes|Te=nascita}}{{<br />
TofT|Lang=pl|Ed=I|N=3|Te=urodzenia}}{{<br />
TofT|Lang=pt|Ed=I|N=3|Color=yes|Te=NASCIMENTO}}{{<br />
TofT|Lang=ru|Ed=I|N=3|Te=Рождения}}<br />
{{NewLineT|S=601|N=4}} {{<br />
TofT|Lang=sh|Ed=I|N=4|Color=yes|Te=ŽIVOROĐENJE, sr.}}{{<br />
TofT|Lang=ar|Ed=I|N=4|Te=ولادة الحية}}{{<br />
TofT|Lang=cs|Ed=I|N=4|Color=yes|Te=živě narozený}}{{<br />
TofT|Lang=de|Ed=I|N=4|Te=Lebendgeburten}}{{<br />
TofT|Lang=de|Ed=I|N=4|SubN=2|Te=Geburten von lebendgeborenen Kindern}}{{<br />
TofT|Lang=en|Ed=I|N=4|Color=yes|Te=live birth}}{{<br />
TofT|Lang=es|Ed=I|N=4|Te=nacimientos de niños vivos}}{{<br />
TofT|Lang=fi|Ed=I|N=4|Color=yes|Te=elävänä syntyminen}}{{<br />
TofT|Lang=fr|Ed=I|N=4|Te=naissance vivante}}{{<br />
TofT|Lang=it|Ed=I|N=4|Color=yes|Te=nascita di un nato vivo}}{{<br />
TofT|Lang=pl|Ed=I|N=4|Te=urodzenia żywe}}{{<br />
TofT|Lang=pt|Ed=I|N=4|Color=yes|Te=NASCIMENTO de criança viva}}{{<br />
TofT|Lang=ru|Ed=I|N=4|Te=Живорождения}}<br />
{{NewLineT|S=601|N=5}} {{<br />
TofT|Lang=sh|Ed=I|N=5|Color=yes|Te=ROĐENJE žive dece}}{{<br />
TofT|Lang=ar|Ed=I|N=5|Te=مولود الحي}}{{<br />
TofT|Lang=cs|Ed=I|N=5|Color=yes|Te=živě narozené dítě}}{{<br />
TofT|Lang=de|Ed=I|N=5|Te=Lebendgeborene}}{{<br />
TofT|Lang=en|Ed=I|N=5|Color=yes|Te=live-born child}}{{<br />
TofT|Lang=es|Ed=I|N=5|Te=niños nacidos vivos}}{{<br />
TofT|Lang=fi|Ed=I|N=5|Color=yes|Te=elävänä syntynyt lapsi}}{{<br />
TofT|Lang=fr|Ed=I|N=5|Te=enfant né vivant}}{{<br />
TofT|Lang=it|Ed=I|N=5|Color=yes|Te=nato vivo}}{{<br />
TofT|Lang=pl|Ed=I|N=5|Te=urodzenia dzieci żywych}}{{<br />
TofT|Lang=pt|Ed=I|N=5|Color=yes|Te=NASCIDO vivo}}{{<br />
TofT|Lang=ru|Ed=I|N=5|Te=Живорожденный}}<br />
{{NewLineT|S=601|N=6}} {{<br />
TofT|Lang=sh|Ed=I|N=6|Color=yes|Te=EFEKTIVNI natalitet}}{{<br />
TofT|Lang=ar|Ed=I|N=6|Te=خصب الواقعي}}{{<br />
TofT|Lang=ar|Ed=I|N=6|SubN=2|Te=خصوبة الحقيقية}}{{<br />
TofT|Lang=ar|Ed=I|N=6|SubN=3|Te=خصوبة الفعالة}}{{<br />
TofT|Lang=cs|Ed=I|N=6|Color=yes|Te=čistá plodnost}}{{<br />
TofT|Lang=de|Ed=I|N=6|Te=wirksame Geborenenhäufigkeit}}{{<br />
TofT|Lang=de|Ed=I|N=6|SubN=2|Te=wirksame Fruchtbarkeit}}{{<br />
TofT|Lang=en|Ed=I|N=6|Color=yes|Te=effective fertility}}{{<br />
TofT|Lang=es|Ed=I|N=6|Te=natalidad efectiva}}{{<br />
TofT|Lang=es|Ed=I|N=6|SubN=2|Te=fecundidad efectiva}}{{<br />
TofT|Lang=fi|Ed=I|N=6|Color=yes|Te=elävänäsyntyvyys}}{{<br />
TofT|Lang=fi|Ed=I|N=6|SubN=2|Te=effektiivinen syntyvyys}}{{<br />
TofT|Lang=fr|Ed=I|N=6|Te=natalité effective}}{{<br />
TofT|Lang=fr|Ed=I|N=6|SubN=2|Te=fécondité effective}}{{<br />
TofT|Lang=it|Ed=I|N=6|Color=yes|Te=natalità effetiva}}{{<br />
TofT|Lang=it|Ed=I|N=6|SubN=2|Te=natalità utile}}{{<br />
TofT|Lang=pl|Ed=I|N=6|Te=rodność efektywna}}{{<br />
TofT|Lang=pl|Ed=I|N=6|SubN=2|Te=płodność efektywna}}{{<br />
TofT|Lang=pt|Ed=I|N=6|Color=yes|Te=NATALIDADE efetiva}}{{<br />
TofT|Lang=pt|Ed=I|N=6|SubN=2|Te=FECUNDIDADE efetiva}}{{<br />
TofT|Lang=ru|Ed=I|N=6|Te=Действительная плодовитость}}{{<br />
TofT|Lang=ru|Ed=I|N=6|SubN=2|Te=Действительная рождаемость}}<br />
{{NewLineT|S=601|N=7}} {{<br />
TofT|Lang=sh|Ed=I|N=7|Color=yes|Te=UKUPAN natalitet}}{{<br />
TofT|Lang=sh|Ed=I|N=7|SubN=2|Te=UKUPNA plodnost}}{{<br />
TofT|Lang=ar|Ed=I|N=7|Te=خصوبة الكلية}}{{<br />
TofT|Lang=cs|Ed=I|N=7|Color=yes|Te=hrubý plodnost}}{{<br />
TofT|Lang=de|Ed=I|N=7|Te=gesamte Geborenenhäufigkeit}}{{<br />
TofT|Lang=de|Ed=I|N=7|SubN=2|Te=gesamte Fruchtbarkeit}}{{<br />
TofT|Lang=en|Ed=I|N=7|Color=yes|Te=total fertility}}{{<br />
TofT|Lang=es|Ed=I|N=7|Te=natalidad total}}{{<br />
TofT|Lang=es|Ed=I|N=7|SubN=2|Te=fecundidad total}}{{<br />
TofT|Lang=fi|Ed=I|N=7|Color=yes|Te=kokonaissyntyvyys}}{{<br />
TofT|Lang=fr|Ed=I|N=7|Te=natalité totale}}{{<br />
TofT|Lang=fr|Ed=I|N=7|SubN=2|Te=fécondité totale}}{{<br />
TofT|Lang=it|Ed=I|N=7|Color=yes|Te=natalità totale}}{{<br />
TofT|Lang=pl|Ed=I|N=7|Te=całkowita rodność}}{{<br />
TofT|Lang=pl|Ed=I|N=7|SubN=2|Te=płodność całkowita}}{{<br />
TofT|Lang=pt|Ed=I|N=7|Color=yes|Te=NATALIDADE total}}{{<br />
TofT|Lang=pt|Ed=I|N=7|SubN=2|Te=FECUNDIDADE total}}{{<br />
TofT|Lang=ru|Ed=I|N=7|Te=Общая плодовитость}}{{<br />
TofT|Lang=ru|Ed=I|N=7|SubN=2|Te=Общая рождаемость}}|<br />
Lang=sh|Lang2=ar|Lang3=cs|Lang4=de|Lang5=en|Lang6=es|Lang7=fi|Lang8=fr|Lang9=it|Lang10=pl|Lang11=pt|Lang12=ru}}<br />
<br />
{{Gallery<br />
| caption={{Lang_audio_pronunciation_-sh}}<br />
| width=100<br />
| height=20<br />
| lines=3<br />
|601_1_1_sh_I PLODNOST, ž..ogg|'''PLODNOST, ž.''' <br />
|601_1_2_sh_I NATALITET, m..ogg|'''NATALITET, m.''' <br />
|601_1_3_sh_I RODNOST, ž..ogg|'''RODNOST, ž.''' <br />
|601_2_1_sh_I RAĐANJE, sr..ogg|'''RAĐANJE, sr.''' <br />
|601_3_1_sh_I ROĐENJE, sr..ogg|'''ROĐENJE, sr.''' <br />
|601_4_1_sh_I ŽIVOROĐENJE, sr..ogg|'''ŽIVOROĐENJE, sr.''' <br />
|601_5_1_sh_I ROĐENJE žive dece.ogg|'''ROĐENJE žive dece''' <br />
|601_6_1_sh_I EFEKTIVNI natalitet.ogg|'''EFEKTIVNI natalitet''' <br />
|601_7_1_sh_I UKUPAN natalitet.ogg|'''UKUPAN natalitet''' <br />
|601_7_2_sh_I UKUPNA plodnost.ogg|'''UKUPNA plodnost''' <br />
}}<br />
<br />
<noinclude><br />
[[sh-I:ŽIVOROĐENJE, sr.]] [[ar-I:ولادة الحية]] [[cs-I:živě narozený]] [[de-I:Lebendgeburten]] [[en-I:live birth]] [[es-I:nacimientos de niños vivos]] [[fi-I:elävänä syntyminen]] [[fr-I:naissance vivante]] [[it-I:nascita di un nato vivo]] [[pl-I:urodzenia żywe]] [[pt-I:NASCIMENTO de criança viva]] [[ru-I:Живорождения]] <br />
</noinclude><br />
{{DEFAULTSORT:ŽIVIVORO#ENJE, sr.}}<br />
<br />
<noinclude><br />
[[Category:Uvjeti od prvog izdanja višejezični rječnik demografskog]]<br />
[[Category:Plodnost]]<br />
[[Category:60]]<br />
</noinclude></div>
Nicolas Brouard
http://sh-i.demopaedia.org/w/index.php?title=(specifi%C4%8Dne)_stope_smrtnosti_po_starosti_i_polu&diff=5394
(specifične) stope smrtnosti po starosti i polu
2013-05-19T18:19:33Z
<p>Nicolas Brouard: Better sort</p>
<hr />
<div>#REDIRECT[[STOPA smrtnosti po polu i po starosnim grupama]]<!--'''(specifične) stope smrtnosti po starosti i polu'''--><br />
{{DEFAULTSORT:specific{vne) stope smrtnosti po starosti i polu}}<br />
<noinclude><br />
[[Category:Uvjeti od prvog izdanja višejezični rječnik demografskog]]<br />
[[Category:40]]</noinclude></div>
Nicolas Brouard
http://sh-i.demopaedia.org/w/index.php?title=(specifi%C4%8Dne)_stope_smrtnosti_po_starosti&diff=5393
(specifične) stope smrtnosti po starosti
2013-05-19T18:18:35Z
<p>Nicolas Brouard: Better sort</p>
<hr />
<div>#REDIRECT[[STOPA smrtnosti po starosti]]<!--'''(specifične) stope smrtnosti po starosti'''--><br />
{{DEFAULTSORT:specific{vne) stope smrtnosti po starosti}}<br />
<noinclude><br />
[[Category:Uvjeti od prvog izdanja višejezični rječnik demografskog]]<br />
[[Category:40]]</noinclude></div>
Nicolas Brouard
http://sh-i.demopaedia.org/w/index.php?title=%D0%9CA%C5%A0INA_za_ra%C4%8Dunanje&diff=5392
МAŠINA za računanje
2013-05-19T18:17:16Z
<p>Nicolas Brouard: M instead of # (don't know why)</p>
<hr />
<div><!--'''МAŠINA za računanje'''--><br />
{{TextTerms|S=224|P=22|Ed=I|CompleteIndexTerm=| content=<br />
{{NewLineT|S=224|N=1}} {{<br />
TofT|Lang=sh|Ed=I|N=1|Color=yes|Te=}}{{<br />
TofT|Lang=ar|Ed=I|N=1|Te=آلات الجمع}}{{<br />
TofT|Lang=cs|Ed=I|N=1|Color=yes|Te=sčítací stroj}}{{<br />
TofT|Lang=cs|Ed=I|N=1|SubN=2|Te=sečítačka}}{{<br />
TofT|Lang=de|Ed=I|N=1|Te=Additionsmaschine}}{{<br />
TofT|Lang=en|Ed=I|N=1|Color=yes|Te=adding machine}}{{<br />
TofT|Lang=es|Ed=I|N=1|Te=máquinas de sumar}}{{<br />
TofT|Lang=fi|Ed=I|N=1|Color=yes|Te=yhteenlaskukone}}{{<br />
TofT|Lang=fr|Ed=I|N=1|Te=machine à additionner}}{{<br />
TofT|Lang=it|Ed=I|N=1|Color=yes|Te=addizionatrice}}{{<br />
TofT|Lang=pl|Ed=I|N=1|Te=maszyny sumujące}}{{<br />
TofT|Lang=pt|Ed=I|N=1|Color=yes|Te=MÁQUINA de somar}}{{<br />
TofT|Lang=ru|Ed=I|N=1|Te=Суммирующие машины}}<br />
{{NewLineT|S=224|N=2}} {{<br />
TofT|Lang=sh|Ed=I|N=2|Color=yes|Te=МAŠINA za računanje}}{{<br />
TofT|Lang=ar|Ed=I|N=2|Te=الآلات الحاسبة}}{{<br />
TofT|Lang=cs|Ed=I|N=2|Color=yes|Te=kalkulační stroj}}{{<br />
TofT|Lang=cs|Ed=I|N=2|SubN=2|Te=kalkulačka}}{{<br />
TofT|Lang=de|Ed=I|N=2|Te=Rechenmaschine}}{{<br />
TofT|Lang=en|Ed=I|N=2|Color=yes|Te=calculating machine}}{{<br />
TofT|Lang=es|Ed=I|N=2|Te=máquinas de calcular}}{{<br />
TofT|Lang=fi|Ed=I|N=2|Color=yes|Te=yleislaskukone}}{{<br />
TofT|Lang=fi|Ed=I|N=2|SubN=2|Te=kertolaskukone}}{{<br />
TofT|Lang=fr|Ed=I|N=2|Te=machine à calculer}}{{<br />
TofT|Lang=it|Ed=I|N=2|Color=yes|Te=macchina calcolatrice}}{{<br />
TofT|Lang=it|Ed=I|N=2|SubN=2|Te=calcolatrice}}{{<br />
TofT|Lang=pl|Ed=I|N=2|Te=maszyna do liczenia}}{{<br />
TofT|Lang=pt|Ed=I|N=2|Color=yes|Te=MÁQUINA de calcular}}{{<br />
TofT|Lang=ru|Ed=I|N=2|Te=Арифмометр}}{{<br />
TofT|Lang=ru|Ed=I|N=2|SubN=2|Te=Вычислительные машины}}<br />
{{NewLineT|S=224|N=3}} {{<br />
TofT|Lang=sh|Ed=I|N=3|Color=yes|Te=}}{{<br />
TofT|Lang=ar|Ed=I|N=3|Te=آلات المكتب}}{{<br />
TofT|Lang=ar|Ed=I|N=3|SubN=2|Te=آلات خفيفة}}{{<br />
TofT|Lang=cs|Ed=I|N=3|Color=yes|Te=počítací stroj}}{{<br />
TofT|Lang=de|Ed=I|N=3|Te=Büromaschine}}{{<br />
TofT|Lang=en|Ed=I|N=3|Color=yes|Te=desk machine}}{{<br />
TofT|Lang=es|Ed=I|N=3|Te=máquinas de oficina}}{{<br />
TofT|Lang=fi|Ed=I|N=3|Color=yes|Te=konttorikone}}{{<br />
TofT|Lang=fr|Ed=I|N=3|Te=machine de bureau}}{{<br />
TofT|Lang=it|Ed=I|N=3|Color=yes|Te=macchina da calcolo}}{{<br />
TofT|Lang=pl|Ed=I|N=3|Te=maszyny biurowe}}{{<br />
TofT|Lang=pt|Ed=I|N=3|Color=yes|Te=MÁQUINA de escritório}}{{<br />
TofT|Lang=ru|Ed=I|N=3|Te=Максимальная Малая счетная машина}}<br />
{{NewLineT|S=224|N=4}} {{<br />
TofT|Lang=sh|Ed=I|N=4|Color=yes|Te=KALKULATOR}}{{<br />
TofT|Lang=ar|Ed=I|N=4|Te=مثقبة الحاسبة (آلة)}}{{<br />
TofT|Lang=cs|Ed=I|N=4|Color=yes|Te=kalkulační děrovač}}{{<br />
TofT|Lang=de|Ed=I|N=4|Te=Rechenlocher}}{{<br />
TofT|Lang=de|Ed=I|N=4|SubN=2|Te=Kalkulationsmaschine}}{{<br />
TofT|Lang=en|Ed=I|N=4|Color=yes|Te=multiplier}}{{<br />
TofT|Lang=es|Ed=I|N=4|Te=calculadora}}{{<br />
TofT|Lang=fi|Ed=I|N=4|Color=yes|Te=kalkylaattori}}{{<br />
TofT|Lang=fr|Ed=I|N=4|Te=calculatrice}}{{<br />
TofT|Lang=it|Ed=I|N=4|Color=yes|Te=calcolatrice}}{{<br />
TofT|Lang=pl|Ed=I|N=4|Te=kalkulator (maszyna)}}{{<br />
TofT|Lang=pt|Ed=I|N=4|Color=yes|Te=CALCULADORA}}{{<br />
TofT|Lang=ru|Ed=I|N=4|Te=Вычислительные перфораторы}}<br />
{{NewLineT|S=224|N=5}} {{<br />
TofT|Lang=sh|Ed=I|N=5|Color=yes|Te=ELEKTRONSKI kalkulator}}{{<br />
TofT|Lang=ar|Ed=I|N=5|Te=حساب الالكتروني}}{{<br />
TofT|Lang=cs|Ed=I|N=5|Color=yes|Te=elektronický kalkulační děrovač}}{{<br />
TofT|Lang=de|Ed=I|N=5|Te=elektronischer Rechenstanzer}}{{<br />
TofT|Lang=de|Ed=I|N=5|SubN=2|Te=elektronische Kalkulationsmaschine}}{{<br />
TofT|Lang=en|Ed=I|N=5|Color=yes|Te=electronic computing}}{{<br />
TofT|Lang=es|Ed=I|N=5|Te=cálculo electrónico}}{{<br />
TofT|Lang=fi|Ed=I|N=5|Color=yes|Te=elektroninen laskukone}}{{<br />
TofT|Lang=fr|Ed=I|N=5|Te=calculatrice électronique}}{{<br />
TofT|Lang=it|Ed=I|N=5|Color=yes|Te=calcolatrice elettronica}}{{<br />
TofT|Lang=pl|Ed=I|N=5|Te=kalkulator elektronowy}}{{<br />
TofT|Lang=pt|Ed=I|N=5|Color=yes|Te=COMPUTAÇÃO eletrônica}}{{<br />
TofT|Lang=pt|Ed=I|N=5|SubN=2|Te=CÁLCULO eletrônico}}{{<br />
TofT|Lang=ru|Ed=I|N=5|Te=Электронные принципы выполнения счетных и вычислительных операций}}<br />
{{NewLineT|S=224|N=6}} {{<br />
TofT|Lang=sh|Ed=I|N=6|Color=yes|Te=ELEKTRONSKA mašina}}{{<br />
TofT|Lang=ar|Ed=I|N=6|Te=آلات الحاسبة الالكترونية}}{{<br />
TofT|Lang=cs|Ed=I|N=6|Color=yes|Te=samočinný počítač}}{{<br />
TofT|Lang=de|Ed=I|N=6|Te=Großrechenanlage}}{{<br />
TofT|Lang=en|Ed=I|N=6|Color=yes|Te=electronic computer}}{{<br />
TofT|Lang=es|Ed=I|N=6|Te=calculadoras electrónicas}}{{<br />
TofT|Lang=fi|Ed=I|N=6|Color=yes|Te=elektroninen tietokone}}{{<br />
TofT|Lang=fi|Ed=I|N=6|SubN=2|Te=ETK-kone}}{{<br />
TofT|Lang=fr|Ed=I|N=6|Te=machine électronique}}{{<br />
TofT|Lang=it|Ed=I|N=6|Color=yes|Te=macchina elettronica}}{{<br />
TofT|Lang=pl|Ed=I|N=6|Te=maszyny elektronowe}}{{<br />
TofT|Lang=pt|Ed=I|N=6|Color=yes|Te=COMPUTADOR}}{{<br />
TofT|Lang=pt|Ed=I|N=6|SubN=2|Te=CALCULADOR eletrônico}}{{<br />
TofT|Lang=ru|Ed=I|N=6|Te=Электронные вычислительные машины}}|<br />
Lang=sh|Lang2=ar|Lang3=cs|Lang4=de|Lang5=en|Lang6=es|Lang7=fi|Lang8=fr|Lang9=it|Lang10=pl|Lang11=pt|Lang12=ru}}<br />
<br />
{{Gallery<br />
| caption={{Lang_audio_pronunciation_-sh}}<br />
| width=100<br />
| height=20<br />
| lines=3<br />
|224_2_1_sh_I МAŠINA za računanje.ogg|'''МAŠINA za računanje''' <br />
|224_4_1_sh_I KALKULATOR.ogg|'''KALKULATOR''' <br />
|224_5_1_sh_I ELEKTRONSKI kalkulator.ogg|'''ELEKTRONSKI kalkulator''' <br />
|224_6_1_sh_I ELEKTRONSKA mašina.ogg|'''ELEKTRONSKA mašina''' <br />
}}<br />
<br />
<noinclude><br />
[[sh-I:МAŠINA za računanje]] [[ar-I:الآلات الحاسبة]] [[cs-I:kalkulační stroj]] [[de-I:Rechenmaschine]] [[en-I:calculating machine]] [[es-I:máquinas de calcular]] [[fi-I:yleislaskukone]] [[fr-I:machine à calculer]] [[it-I:macchina calcolatrice]] [[pl-I:maszyna do liczenia]] [[pt-I:MÁQUINA de calcular]] [[ru-I:Арифмометр]] <br />
</noinclude><br />
{{DEFAULTSORT:MAS{VINA za rac{vunanje}}<br />
<br />
<noinclude><br />
[[Category:Uvjeti od prvog izdanja višejezični rječnik demografskog]]<br />
[[Category:Demografske statistike]]<br />
[[Category:22]]<br />
</noinclude></div>
Nicolas Brouard
http://sh-i.demopaedia.org/w/index.php?title=%D0%9CA%C5%A0INA_za_me%C4%91uklasiranje&diff=5391
МAŠINA za međuklasiranje
2013-05-19T18:16:10Z
<p>Nicolas Brouard: M instead of # (don't know why)</p>
<hr />
<div><!--'''МAŠINA za međuklasiranje'''--><br />
{{TextTerms|S=223|P=22|Ed=I|CompleteIndexTerm=| content=<br />
{{NewLineT|S=223|N=1}} {{<br />
TofT|Lang=sh|Ed=I|N=1|Color=yes|Te=MAŠINE za bušenje}}{{<br />
TofT|Lang=sh|Ed=I|N=1|SubN=2|Te=BUŠILICA, ž.}}{{<br />
TofT|Lang=ar|Ed=I|N=1|Te=مثقبة}}{{<br />
TofT|Lang=cs|Ed=I|N=1|Color=yes|Te=děrovač}}{{<br />
TofT|Lang=de|Ed=I|N=1|Te=Lochmaschine}}{{<br />
TofT|Lang=de|Ed=I|N=1|SubN=2|Te=Locher}}{{<br />
TofT|Lang=en|Ed=I|N=1|Color=yes|Te=punch}}{{<br />
TofT|Lang=es|Ed=I|N=1|Te=perforadora}}{{<br />
TofT|Lang=fi|Ed=I|N=1|Color=yes|Te=lävistyskone}}{{<br />
TofT|Lang=fr|Ed=I|N=1|Te=perforatrice}}{{<br />
TofT|Lang=fr|Ed=I|N=1|SubN=2|Te=poinçonneuse}}{{<br />
TofT|Lang=it|Ed=I|N=1|Color=yes|Te=perforatrice}}{{<br />
TofT|Lang=pl|Ed=I|N=1|Te=dziurkarka (maszyna)}}{{<br />
TofT|Lang=pt|Ed=I|N=1|Color=yes|Te=PERFURADORA}}{{<br />
TofT|Lang=ru|Ed=I|N=1|Te=Перфоратор}}<br />
{{NewLineT|S=223|N=2}} {{<br />
TofT|Lang=sh|Ed=I|N=2|Color=yes|Te=VERIFICIRKA, ž.}}{{<br />
TofT|Lang=ar|Ed=I|N=2|Te=مراجعة}}{{<br />
TofT|Lang=ar|Ed=I|N=2|SubN=2|Te=مدققة}}{{<br />
TofT|Lang=cs|Ed=I|N=2|Color=yes|Te=přezkoušeč}}{{<br />
TofT|Lang=de|Ed=I|N=2|Te=Prüfmaschine}}{{<br />
TofT|Lang=de|Ed=I|N=2|SubN=2|Te=Kontroilocher}}{{<br />
TofT|Lang=en|Ed=I|N=2|Color=yes|Te=verifier}}{{<br />
TofT|Lang=es|Ed=I|N=2|Te=verificadora}}{{<br />
TofT|Lang=fi|Ed=I|N=2|Color=yes|Te=tarkistuslävistyskone}}{{<br />
TofT|Lang=fr|Ed=I|N=2|Te=vérificatrice}}{{<br />
TofT|Lang=it|Ed=I|N=2|Color=yes|Te=verificatrice}}{{<br />
TofT|Lang=pl|Ed=I|N=2|Te=kontrolerka (maszyna)}}{{<br />
TofT|Lang=pt|Ed=I|N=2|Color=yes|Te=CONFERIDORA}}{{<br />
TofT|Lang=ru|Ed=I|N=2|Te=Контрольник}}<br />
{{NewLineT|S=223|N=3}} {{<br />
TofT|Lang=sh|Ed=I|N=3|Color=yes|Te=SORTIRKA, ž.}}{{<br />
TofT|Lang=ar|Ed=I|N=3|Te=فرازة}}{{<br />
TofT|Lang=cs|Ed=I|N=3|Color=yes|Te=třídič}}{{<br />
TofT|Lang=de|Ed=I|N=3|Te=Sortiermaschine}}{{<br />
TofT|Lang=en|Ed=I|N=3|Color=yes|Te=sorter}}{{<br />
TofT|Lang=es|Ed=I|N=3|Te=clasificadora}}{{<br />
TofT|Lang=fi|Ed=I|N=3|Color=yes|Te=lajittelukone}}{{<br />
TofT|Lang=fr|Ed=I|N=3|Te=trieuse}}{{<br />
TofT|Lang=it|Ed=I|N=3|Color=yes|Te=selezionatrice}}{{<br />
TofT|Lang=pl|Ed=I|N=3|Te=sorter (maszyna statystyczna)}}{{<br />
TofT|Lang=pt|Ed=I|N=3|Color=yes|Te=SEPARADORA}}{{<br />
TofT|Lang=ru|Ed=I|N=3|Te=Счетно-сортировальные машины}}<br />
{{NewLineT|S=223|N=4}} {{<br />
TofT|Lang=sh|Ed=I|N=4|Color=yes|Te=TABELIRKA, ž.}}{{<br />
TofT|Lang=ar|Ed=I|N=4|Te=مبوبة}}{{<br />
TofT|Lang=cs|Ed=I|N=4|Color=yes|Te=tabelátor}}{{<br />
TofT|Lang=de|Ed=I|N=4|Te=Tabelliermaschine}}{{<br />
TofT|Lang=en|Ed=I|N=4|Color=yes|Te=tabulator}}{{<br />
TofT|Lang=es|Ed=I|N=4|Te=tabuladora}}{{<br />
TofT|Lang=fi|Ed=I|N=4|Color=yes|Te=taulukointikone}}{{<br />
TofT|Lang=fi|Ed=I|N=4|SubN=2|Te=tabulaattori}}{{<br />
TofT|Lang=fr|Ed=I|N=4|Te=tabulatrice}}{{<br />
TofT|Lang=it|Ed=I|N=4|Color=yes|Te=tabulatrice}}{{<br />
TofT|Lang=pl|Ed=I|N=4|Te=tabulator (maszyna)}}{{<br />
TofT|Lang=pt|Ed=I|N=4|Color=yes|Te=TABULADORA}}{{<br />
TofT|Lang=ru|Ed=I|N=4|Te=Табулятор}}<br />
{{NewLineT|S=223|N=5}} {{<br />
TofT|Lang=sh|Ed=I|N=5|Color=yes|Te=REPRODUKTOR, m.}}{{<br />
TofT|Lang=ar|Ed=I|N=5|Te=ناسخة}}{{<br />
TofT|Lang=cs|Ed=I|N=5|Color=yes|Te=opakovač}}{{<br />
TofT|Lang=de|Ed=I|N=5|Te=Kartendoppler}}{{<br />
TofT|Lang=de|Ed=I|N=5|SubN=2|Te=Übertragungsmaschine}}{{<br />
TofT|Lang=de|Ed=I|N=5|SubN=3|Te=Reproduktionsmaschine}}{{<br />
TofT|Lang=en|Ed=I|N=5|Color=yes|Te=reproducer}}{{<br />
TofT|Lang=es|Ed=I|N=5|Te=reproductora}}{{<br />
TofT|Lang=fi|Ed=I|N=5|Color=yes|Te=toisintokone}}{{<br />
TofT|Lang=fr|Ed=I|N=5|Te=reproductrice}}{{<br />
TofT|Lang=it|Ed=I|N=5|Color=yes|Te=riproduttrice}}{{<br />
TofT|Lang=pl|Ed=I|N=5|Te=reproducer (maszyna)}}{{<br />
TofT|Lang=pt|Ed=I|N=5|Color=yes|Te=REPRODUTORA}}{{<br />
TofT|Lang=ru|Ed=I|N=5|Te=Репродуктор}}<br />
{{NewLineT|S=223|N=6}} {{<br />
TofT|Lang=sh|Ed=I|N=6|Color=yes|Te=INTERPRETATOR, m.}}{{<br />
TofT|Lang=ar|Ed=I|N=6|Te=مترجمة}}{{<br />
TofT|Lang=cs|Ed=I|N=6|Color=yes|Te=popisovač}}{{<br />
TofT|Lang=de|Ed=I|N=6|Te=Lochschriftübersetzer}}{{<br />
TofT|Lang=en|Ed=I|N=6|Color=yes|Te=interpreter}}{{<br />
TofT|Lang=es|Ed=I|N=6|Te=interpretadora}}{{<br />
TofT|Lang=fi|Ed=I|N=6|Color=yes|Te=tulkkikone}}{{<br />
TofT|Lang=fr|Ed=I|N=6|Te=interpréteuse}}{{<br />
TofT|Lang=it|Ed=I|N=6|Color=yes|Te=macchina interprete}}{{<br />
TofT|Lang=pl|Ed=I|N=6|Te=interpretator (maszyna)}}{{<br />
TofT|Lang=pt|Ed=I|N=6|Color=yes|Te=INTERPRETADORA}}{{<br />
TofT|Lang=ru|Ed=I|N=6|Te=Расшифровывающая машина}}<br />
{{NewLineT|S=223|N=7}} {{<br />
TofT|Lang=sh|Ed=I|N=7|Color=yes|Te=МAŠINA za međuklasiranje}}{{<br />
TofT|Lang=ar|Ed=I|N=7|Te=قارنة}}{{<br />
TofT|Lang=cs|Ed=I|N=7|Color=yes|Te=zakládač}}{{<br />
TofT|Lang=de|Ed=I|N=7|Te=Kartenmischer}}{{<br />
TofT|Lang=en|Ed=I|N=7|Color=yes|Te=collator}}{{<br />
TofT|Lang=es|Ed=I|N=7|Te=interclasificadora}}{{<br />
TofT|Lang=fi|Ed=I|N=7|Color=yes|Te=kollaattori}}{{<br />
TofT|Lang=fr|Ed=I|N=7|Te=interclasseuse}}{{<br />
TofT|Lang=it|Ed=I|N=7|Color=yes|Te=inseritrice}}{{<br />
TofT|Lang=pl|Ed=I|N=7|Te=kolator (maszyna)}}{{<br />
TofT|Lang=pt|Ed=I|N=7|Color=yes|Te=INTERCALADORA}}{{<br />
TofT|Lang=ru|Ed=I|N=7|Te=Сортировально-подборочная машина}}{{<br />
TofT|Lang=ru|Ed=I|N=7|SubN=2|Te=Картоподборочные машины}}<br />
{{NewLineT|S=223|N=8}} {{<br />
TofT|Lang=sh|Ed=I|N=8|Color=yes|Te=REKAPITULATIVNA bušilica}}{{<br />
TofT|Lang=ar|Ed=I|N=8|Te=مثقبة التلخيص}}{{<br />
TofT|Lang=cs|Ed=I|N=8|Color=yes|Te=součtový děrovač}}{{<br />
TofT|Lang=de|Ed=I|N=8|Te=Summenlocher}}{{<br />
TofT|Lang=de|Ed=I|N=8|SubN=2|Te=Motor-Wiederholungslocher}}{{<br />
TofT|Lang=en|Ed=I|N=8|Color=yes|Te=summary punch}}{{<br />
TofT|Lang=es|Ed=I|N=8|Te=perforadora-recapituladora}}{{<br />
TofT|Lang=fi|Ed=I|N=8|Color=yes|Te=summalävistyskone}}{{<br />
TofT|Lang=fr|Ed=I|N=8|Te=perforatrice récapitulative}}{{<br />
TofT|Lang=it|Ed=I|N=8|Color=yes|Te=riepilogatrice}}{{<br />
TofT|Lang=pl|Ed=I|N=8|Te=dziurkarka sumacyjna}}{{<br />
TofT|Lang=pt|Ed=I|N=8|Color=yes|Te=PERFURADORA resumo}}{{<br />
TofT|Lang=ru|Ed=I|N=8|Te=Итоговые перфораторы}}<br />
{{NewLineT|S=223|N=9}} {{<br />
TofT|Lang=sh|Ed=I|N=9|Color=yes|Te=REKAPITULATIVNA kartica}}{{<br />
TofT|Lang=ar|Ed=I|N=9|Te=بطاقات التلخيص}}{{<br />
TofT|Lang=cs|Ed=I|N=9|Color=yes|Te=součtový štítek}}{{<br />
TofT|Lang=de|Ed=I|N=9|Te=Summenkarte}}{{<br />
TofT|Lang=en|Ed=I|N=9|Color=yes|Te=summary card}}{{<br />
TofT|Lang=es|Ed=I|N=9|Te=fichas recapitulativas}}{{<br />
TofT|Lang=fi|Ed=I|N=9|Color=yes|Te=summakortti}}{{<br />
TofT|Lang=fr|Ed=I|N=9|Te=carte récapitulative}}{{<br />
TofT|Lang=it|Ed=I|N=9|Color=yes|Te=scheda riepilogativa}}{{<br />
TofT|Lang=pl|Ed=I|N=9|Te=karty sumacyjne}}{{<br />
TofT|Lang=pt|Ed=I|N=9|Color=yes|Te=CARTÃO resumo}}{{<br />
TofT|Lang=ru|Ed=I|N=9|Te=Итоговые карточки карточки}}|<br />
Lang=sh|Lang2=ar|Lang3=cs|Lang4=de|Lang5=en|Lang6=es|Lang7=fi|Lang8=fr|Lang9=it|Lang10=pl|Lang11=pt|Lang12=ru}}<br />
<br />
{{Gallery<br />
| caption={{Lang_audio_pronunciation_-sh}}<br />
| width=100<br />
| height=20<br />
| lines=3<br />
|223_1_1_sh_I MAŠINE za bušenje.ogg|'''MAŠINE za bušenje''' <br />
|223_1_2_sh_I BUŠILICA, ž..ogg|'''BUŠILICA, ž.''' <br />
|223_2_1_sh_I VERIFICIRKA, ž..ogg|'''VERIFICIRKA, ž.''' <br />
|223_3_1_sh_I SORTIRKA, ž..ogg|'''SORTIRKA, ž.''' <br />
|223_4_1_sh_I TABELIRKA, ž..ogg|'''TABELIRKA, ž.''' <br />
|223_5_1_sh_I REPRODUKTOR, m..ogg|'''REPRODUKTOR, m.''' <br />
|223_6_1_sh_I INTERPRETATOR, m..ogg|'''INTERPRETATOR, m.''' <br />
|223_7_1_sh_I МAŠINA za međuklasiranje.ogg|'''МAŠINA za međuklasiranje''' <br />
|223_8_1_sh_I REKAPITULATIVNA bušilica.ogg|'''REKAPITULATIVNA bušilica''' <br />
|223_9_1_sh_I REKAPITULATIVNA kartica.ogg|'''REKAPITULATIVNA kartica''' <br />
}}<br />
<br />
<noinclude><br />
[[sh-I:МAŠINA za međuklasiranje]] [[ar-I:قارنة]] [[cs-I:zakládač]] [[de-I:Kartenmischer]] [[en-I:collator]] [[es-I:interclasificadora]] [[fi-I:kollaattori]] [[fr-I:interclasseuse]] [[it-I:inseritrice]] [[pl-I:kolator (maszyna)]] [[pt-I:INTERCALADORA]] [[ru-I:Сортировально-подборочная машина]] <br />
</noinclude><br />
{{DEFAULTSORT:MAS{VINA za me#uklasiranje}}<br />
<br />
<noinclude><br />
[[Category:Uvjeti od prvog izdanja višejezični rječnik demografskog]]<br />
[[Category:Demografske statistike]]<br />
[[Category:22]]<br />
</noinclude></div>
Nicolas Brouard
http://sh-i.demopaedia.org/w/index.php?title=Kategorija:Uvjeti_od_prvog_izdanja_vi%C5%A1ejezi%C4%8Dni_rje%C4%8Dnik_demografskog&diff=5390
Kategorija:Uvjeti od prvog izdanja višejezični rječnik demografskog
2013-05-19T18:11:56Z
<p>Nicolas Brouard: </p>
<hr />
<div>Il s'agit de l'index des termes, mots ou expressions dont il peut exister un équivalent dans chacune des langues d'une même édition du dictionnaire. <br />
<br />
Ici, il s'agit de la première édition du dictionnaire éditée en serbo-croate en 1971. Voir la [[Predgovor|préface]].<br />
<br />
Chacun de ces termes, par exemple <b>Démographie</b><sup>1</sup> défini au paragraphe 101 (lui-même défini en tant que première paragraphe de la page ''10'' du chapitre 1) figurait en gras dans le texte principal (et non dans une note) d'un paragraphe accompagné d'un numéro de note (ici 1). <br />
<br />
Au couple, paragraphe-note correspond en général un ou plusieurs termes dans chacune des langues de la même édition. Mais il se peut qu'il n'existe pas d'équivalent dans une langue.<br />
<br />
{{CategoryTOC}}</div>
Nicolas Brouard
http://sh-i.demopaedia.org/w/index.php?title=Glavna_strana&diff=5389
Glavna strana
2013-05-18T18:39:01Z
<p>Nicolas Brouard: Link to English Demopaedia:About (to be translated)</p>
<hr />
<div><!--'''Glavna strana'''--><br />
{{Summary}}<br />
[[sh-i:Demopædia:O projektu Demopædia]]<br />
<!--{{:sh-i:Demopædia:O projektu Demopædia}}--><br />
{{:en-ii:Demopædia:About}}<br />
{{SummaryShort}}<br />
<br />
[[ar-i:الصفحة الرئيسية]]<br />
[[cs-i:Hlavní strana]]<br />
[[en-i:Main_Page]]<br />
[[es-i:Página principal]]<br />
[[fr-i: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 />
[[th-ii:หน้าหลัก]]<br />
[[vi-ii:Trang Chính]]<br />
[[zh-ii:首页]]</div>
Nicolas Brouard
http://sh-i.demopaedia.org/w/index.php?title=Glavna_strana&diff=5388
Glavna strana
2013-05-18T18:35:18Z
<p>Nicolas Brouard: </p>
<hr />
<div><!--'''Glavna strana'''--><br />
[[sh-i:Demopædia:O projektu Demopædia]]<br />
{{:sh-i:Demopædia:O projektu Demopædia}}<br />
{{SummaryShort}}<br />
<br />
[[ar-i:الصفحة الرئيسية]]<br />
[[cs-i:Hlavní strana]]<br />
[[en-i:Main_Page]]<br />
[[es-i:Página principal]]<br />
[[fr-i: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 />
[[th-ii:หน้าหลัก]]<br />
[[vi-ii:Trang Chính]]<br />
[[zh-ii:首页]]</div>
Nicolas Brouard
http://sh-i.demopaedia.org/w/index.php?title=Demop%C3%A6dia:O_projektu_Demop%C3%A6dia&diff=5387
Demopædia:O projektu Demopædia
2013-05-18T18:32:04Z
<p>Nicolas Brouard: </p>
<hr />
<div><!--'''Demopædia:O projektu Demopædia'''--><br />
<!--'''Demopædia:About'''--><br />
<small>''This page will be translated from the '''Demopædia:About''' page of the English second edition site [[:en-ii:Demopædia:About]]''</small><br />
<br />
<center><big>Demopædia</big></center><br />
<center><big>A multi-lingual wiki-based demographic encyclopedia</big></center><br />
<br />
<br />
__TOC__<br />
<br />
=History=<br />
<br />
Developing the series of multilingual encyclopedic demographic dictionaries is one of the most enduring projects in the history of our discipline. And one of the most fruitful. In the early late 1960s, the United Nations Population Division has assembled a brilliant team of specialists to produce the then state of the art dictionaries in the official languages of the Organization. Two decades later the Division joined efforts with IUSSP to update these reference tools. The researchers and trainers of many countries have joined the project, albeit informally, by tailoring their national modules on the UN/IUSSP standard. As a result the international community might have at its disposal a standardized series of 14 encyclopedic demographic dictionaries. But in practice it does not because all language module are out of print and hardly a couple of libraries in the entire world may be expected to possess all of them. <br />
<br />
=Why on-line?=<br />
<br />
The multilingual encyclopedic demographic dictionary on the Internet became widely accessible. Demographic terms, their meaning and cross-references are now two clicks away for students, professors, researchers, government experts, journalists and NGO activists. You can elucidate the understanding of the term in the language of your work. Also, the multilingual dictionary assists you in grasping the subject of specialized texts in other languages. <br />
<br />
=Functionalities=<br />
<br />
You can consult the Dictionary's language modules, read them or download and print them: all copyright owners have authorized us to provide you these options. You can search for a demographic term, surf to linked terms and expressions or move to another language or edition. As the Dictionary is structured in thematic chapters, you can locate a term within its contextual environment. The language modules have built-in indexes which makes possible easy navigation and cross-referencing. The Wiki platform provides powerful tools for further development. The specialists could post their additions and corrections on-line and discuss them collectively. <br />
<br />
=What is next=<br />
<br />
Demographic knowledge made huge advances since the last editions of the Dictionary have been published. There is a clear sense that the structure and texts need updating. Doing it in a traditional format of 'live' panels and working groups would be hardly feasible. Developing on-line a renewed edition of multilingual encyclopedic demographic dictionary should be efficient and will unleash the potential of wide cooperation of professionals. Demopædia will host this project.<br />
<br />
Demopædia also has the potential to become a platform for sharing and building a wider knowledge base in demography and population studies. Our vision is an extensive and constantly evolving encyclopedia on population, serving the world community and benefiting from influxes of ideas and texts.<br />
<br />
= How to use Demopædia =<br />
<br />
== By searching for a term or demographic expression ==<br />
The main URL (Internet address) of Demopædia is http://demopaedia.org. From this main page, you can enter in the search area for a term or expression and choose the language: it will search within the full text of the second (last edition) edition of the Multilingual Demographic Dictionary of this particular language. For Arabic, it will search within the ar-ii.demopaedia.org wiki site. <br />
<br />
At least two kinds of link can be retrieved:<br />
* either a numbered page, like [[10#101|101]], [[11#112|112]] etc., which corresponds to a section of the Multilingual Demographic Dictionary. Former users of the printed old books are very familiar with this special but efficient method ;<br />
* either a link to a named page (like Demography [[en-ii:Demography]] for example) which contains the searched expression (read below). <br />
<br />
== By reading the book==<br />
Starting with the first numbered page or section [[10]], you will read the first paragraph (101) of the first chapter entitled ''General concepts''. <br />
<br />
Each paragraph (about 5 to 10 paragraphs) per section (Internet page) describes a demographical concept by using other similar terms. The terms in bold face are supposed to be main terms (called TextTerm) which have to be translated in any language. A TextTerm is uniquely defined by its footnote number. This unique definition (paragraph number - footnote number), for example 101-1 for Demography, permits an easy link between languages. Sometimes, the footnote is also used to give details specific to a peculiar language or country but most of times it is just used for cross-language navigation. Please read the preface of the original printed books in order to better understand how the dictionaries were originally built. <br />
<br />
On the top and bottom of each page, a navigation bar helps you to read the next numbered page. When the first digit of a numbered page changes, you are accessing a newer chapter. Nine chapters were available for the second edition. <br />
<br />
If you need or want to read the page in another available language, you just have to click on the link.<br />
<br />
You can also access to the text of the first edition. <br />
<br />
And from another edition you can access to any available language of the same edition.<br />
<br />
== By reading just a paragraph describing the searched term ==<br />
<br />
If your Internet search originates from a search crawler, you will probably not be linked to a meaningless ''numbered'' (10, 20 etc.) page but to a ''named'' page, like ''fertility rate'' for example. In that case, you will be able to read the paragraph where ''fertility rate'' was defined in the Multilingual Demographic Dictionary of the corresponding page. <br />
<br />
=== Easy access to other translated text terms ===<br />
<br />
If you want to directly see how to translate any TextTerm of the same paragraph, you can click on the dynamic rolling box link and you will access to the table of all terms. From any language specific table column, you can jump to the numbered page of a chosen language.<br />
<br />
=== How to pronounce a term in another language ===<br />
<br />
At the bottom of a named page (not a numbered page) you will access to the audio file corresponding to the correct pronunciation recorded by demographers. This is an ongoing project and many links are still empty (red link).<br />
<br />
=== Index of all named pages ===<br />
At the very bottom of the page you will have access to the list of all named pages similar to the Index of the printed book.<br />
<br />
== Accessing the Multilingual Demographic Dictionary directly by its URL ==<br />
<br />
=== Accessing a numbered paragraph of the second edition ...===<br />
If you want to access to the numbered paragraph 632 of the Arabic second edition just type the URL of the numbered page (section) by entering '''63''' (first two digits) after the '''<nowiki>wiki/</nowiki>''' address: http://ar-ii.demopaedia.org/wiki/63 <br />
<br />
=== ... and of the first edition ...===<br />
If you want to access to the same paragraph but of the first edition , just enter '''-i''' instead of '''-ii''': http://ar-i.demopaedia/wiki/63 . Many of the sections have kept the same numbering between the first two editions and it might be interesting to consider the evolution of the language as well as of the concept.<br />
<br />
=== ... and of another language ===<br />
<br />
In order to access the same paragraph in another language, just change the two letters using the international English abbreviation of languages ([http://www.sil.org/iso639-3/codes.asp?order=639_1&letter=%25 ISO 639]):<br />
==== List of language abbreviations ====<br />
{|<br />
|Abbreviation || Language<br />
|-<br />
| ar || Arabic<br />
|-<br />
| cs || Czech<br />
|-<br />
| de || German<br />
|-<br />
| en || English<br />
|-<br />
| es || Spanish<br />
|- <br />
| et || Estonian<br />
|-<br />
| it || Italian<br />
|- <br />
| ja || Japanese<br />
|-<br />
| fi || Finnish<br />
|-<br />
| fr || French<br />
|-<br />
| pl || Polish<br />
|-<br />
| pt || Portuguese<br />
|-<br />
| ru || Russian<br />
|-<br />
| sv || Swedish<br />
|-<br />
| zh || Chinese<br />
|}<br />
<br />
=== Accessing directly to a term or expression ===<br />
<br />
If you want to access the named page [[en-ii:Age-specific fertility rates|Age-specific fertility rates]] directly because you know that this term or expression belongs to the second edition of the English dictionary, just type '''<nowiki>http://en-ii.demopaedia.org/wiki/Age-specific fertility rates</nowiki>'''. Please note that you can enter space and they will be replaced by underscore. If the expressions contains also accents or cyrillic or Chinese or Arabic etc. characters, please enter them into the URL, they will be replaced by their Unicode values on the returned URL (making them ugly but functional). Please send these URLs using Unicoded (utf-8) e-mails in order to keep them exchangeable and always readable.<br />
<br />
<br />
== Accessing the Open Encyclopedia on Population ==<br />
<br />
Each text term, defined as a demographic term or demographical expression of the Multilingual Demographic Dictionary which must be translated into any language, will have its own named page in the Open Encyclopedia on Population. <br />
<br />
The original definition expressed in one of the two Multilingual Demographic Dictionary editions is (or was if the paragraph has been overwritten by the second edition) a first start for a multimedia Encyclopedia on Populations. <br />
<br />
The Multilingual Demographic Dictionary offers the advantage of large consensus (United Nations commission on terminology of the early 50's) and having been translated into various languages (about 15 languages). But it has the disadvantage of being old (1981 for the second edition in French): some sections or even chapters have to written or rewritten. <br />
<br />
Also Encyclopedia have always used graphs or pictures which were missing in the printed Multilingual Demographic Dictionary and modern Encyclopedia can be multimedia and can offer animated drawings or audio files.<br />
<br />
Using the free software of the Wikimedia foundation (called MediaWiki), Demopædia will offer the same possibilities with the same rules and constraints as Wikipedia.<br />
<br />
Thus the syntax of the various URLS is similar to any Wikipedia site, i.e by suppressing any mention of the edition, just keeping the two letters of the abbreviated language: '''<nowiki>http://en.demopaedia.org/wiki/Age-specific fertility rates</nowiki>'''<br />
<br />
Also the wiki syntax of Demopædia is exactly the same as the Wikipedia syntax.<br />
<br />
== When will the site be open? ==<br />
<br />
The Demopædia site will be first opened for the [http://iussp2009.princeton.edu International Conference on Population in Marrakesh] in early October 2009, and the Open Encyclopedia will be opened only to the members of the [http//iussp.org IUSSP association] (a first training has been proposed to participants in Marrakech). <br />
<br />
Once the various tools in order to fight against spammers and vandalism will be installed, the site will, hopefully, be opened to any specialist in Population Studies.<br />
<br />
= For a ''Unified second edition'' of the dictionaries as an intermediate step =<br />
<br />
Since the training in Marrakech, a lot of work has been done to improve the quality of the scanned texts. Specific computer programs using parsers have cross check the texts of the first and second editions in about 12 to 13 languages in order to detect the missing text terms in one or another language.<br />
<br />
The first analysis of this work reveals that the second edition is not as rigorous as the first was. The first edition was the result of the Commission on terminology during the mid 50's, but the second was first revised in French in 1981 and translated and adapted to English in 1982 and in Spanish in 1985, German in 1987 etc. up to Czech in 2005. <br />
<br />
Some terms, expressions and even complete paragraphs have not been translated into English, but in Spanish, Arabic, German etc.. And a few sentences and paragraphs have been added into the English second edition but never translated into the French second edition which was already published. Also the Spanish second edition added a few new text terms which are not translated into any other language but Arabic.<br />
<br />
The German second edition (1987) defined a lot of more modern text terms which haven't been translated in any other language.<br />
<br />
The current proposition (February 2010) to the [http://demopaedia.org/wiki/Paris2007 Demopædia team] is to discuss the opportunity of an harmonized or unified second edition before opening the Open Encyclopedia.<br />
<br />
Editions, published after 1987, did not add any new term and thus a natural limit is 1987 (German) but harmonization between the three languages of the IUSSP could be an important step.<br />
<br />
In many language specific editions, the numbering of the text terms differed (even between French and English) most of times due to errors but sometimes because a text term was not translated. The advantage of the technical work is to highlight the missing text terms in order to decide if the word is not used in this language or if it is an omission. <br />
<br />
One advantage of such a short term project, will be that all the useful but out of print versions (English, French, Spanish, German, Arabic, Japanese etc.) as well as the four recently translated versions (Russian, Chinese, Italian) would be available in their unified second edition as ''printed book'' which could be ordered on the Demopaedia site. Such nice samples were on display at the UN booth of the Marrakech conference. It will also be a good exercise for the third edition... <br />
<br />
<br />
<br />
<noinclude><br />
{{SummaryShort}}<br />
</noinclude></div>
Nicolas Brouard
http://sh-i.demopaedia.org/w/index.php?title=Demop%C3%A6dia:O_projektu_Demop%C3%A6dia&diff=5188
Demopædia:O projektu Demopædia
2013-05-18T18:12:28Z
<p>Nicolas Brouard: Napravljena stranica sa '<!--'''Demopædia:O projektu Demopædia'''--> sh-i:Demopædia:O projektu Demopædia {{:sh-i:Demopædia:O projektu Demopædia}} {{SummaryShort}}'</p>
<hr />
<div><!--'''Demopædia:O projektu Demopædia'''--><br />
[[sh-i:Demopædia:O projektu Demopædia]]<br />
{{:sh-i:Demopædia:O projektu Demopædia}}<br />
{{SummaryShort}}</div>
Nicolas Brouard
http://sh-i.demopaedia.org/w/index.php?title=Glavna_strana&diff=5184
Glavna strana
2013-05-18T18:12:15Z
<p>Nicolas Brouard: </p>
<hr />
<div><!--'''Glavna strana'''--><br />
[[sh-i:Demopædia:O projektu Demopædia]]<br />
{{:sh-i:Demopædia:O projektu Demopædia}}<br />
{{SummaryShort}}<br />
[[ar-i:الصفحة الرئيسية]]<br />
[[cs-i:Hlavní strana]]<br />
[[en-i:Main_Page]]<br />
[[es-i:Página principal]]<br />
[[fr-i: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 />
[[th-ii:หน้าหลัก]]<br />
[[vi-ii:Trang Chính]]<br />
[[zh-ii:首页]]</div>
Nicolas Brouard
http://sh-i.demopaedia.org/w/index.php?title=Predgovor&diff=4980
Predgovor
2013-05-18T17:53:23Z
<p>Nicolas Brouard: Predgovor</p>
<hr />
<div><!--'''Predgovor'''--><br />
{{Summary}} <br />
<br />
= PREDGOVOR ZA SRPSKOHRVATSKU VERZIJU »VISEJEZIČKOG DEMOGRAFSKOG REČNIKA« =<br />
<br />
Još početkom 1965. godine u Centru za demografska istraživanja Instituta društvenih nauka doneta je odluka da se izradi srpskohrvatska verzija Višejezičkog demografskog rečnika. Iz predgovora francuskom izdanju vidi se da je tekst najpre izrađen na francuskom, engleskom, španskom jeziku, i da je do njega došlo u toku saradnje između Komisije za pitanja stanovništva OUN i Međunarodne unije za naučno proučavanje stanovništva. Definitivnu francusku verziju Rečnika publikovale su UN 1958. godine (pod brojem ST/SOA/Ser. A/29), a privremeno izdanje publikovano je juna 1954. godine (pod brojem ST/SOA/Ser. A/19). Prva skica Rečnika bila je napravljena na osnovu jednog francuskog teksta koji je pripremio Nacionalni institut za demografska istraživanja (Francuska), pod rukovodstvom g. Vincent-a. Engleski i španski prevod ovog teksta sastavili su g.g. Grebenik i Ros Jimeno. Nakon širih diskusija, g. Grebenik i g. Vincent izradili su, zajedno, na osnovu engleskog i francuskog teksta, neku vrstu prilagođenog teksta, koji je zatim preveden na francuski, engleski i španski jezik.<br />
<br />
Prilikom izrade srpskohrvatske verzije Višejezičkog demografskog rečnika kao osnova služila je francuska verzija Rečnika. Pošto i ova verzija, kao uostalom i engleska i španska, predstavlja kompromis među anglosaksonskim i latinskim koncepcijama, u međuvremenu se pojavio niz izdanja na drugim jezicima (češkom, ruskom, nemačkom, itd.), saradnici CDI su prilikom konačne redakcije Rečnika konsultovali pored francuske kao osnovne, i verzije Rečnika na drugim, naročito slovenskim jezicima. S obzirom na razvoj demografije u nas, a u vezi s tim i na formiranje demografske terminologije, prilikom rada na Rečniku korišćena je u znatnoj meri i engleska verzija Višejezičkog demografskog rečnika. To znači da tekstovi u srpskohrvatskoj verziji nisu prosti prevod francuske verzije, već se težilo da se nađu rešenja koja su u skladu sa aktuelnim stanjem demografske terminologije kod autora - demografa sa srpskohrvatskog jezičkog područja. Međutim, razumljivo je da su pojmovi numerisani na isti način kao i u francuskoj, odnosno u drugim verzijama Rečnika, što omogućava korisnicima njihovo međusobno povezivanje. Kao i u drugim verzijama, paragrafi 303. i 344. sadrže nazive koji su svojstveni našoj zemlji. Znatan broj paragrafa sadrži objašnjenja koja su svojstvena samo srpskohrvatskoj verziji, a sadrže ili dopunsku terminologiju ili su u njima data, odnosno obrazložena pitanja za koja su redaktori smatrali da su korisna za srpskohrvatsku verziju.<br />
<br />
Prilikom prvih diskusija o izdavanju srpskohrvatske verzije Višejezičkog demografskog rečnika, došle su do izražaja dve koncepcije. Po prvoj, saradnici CDI koji su preuzeli zadatak da izrade prevod francuske verzije, trebalo je da koriste terminologiju koja se najčešće javlja u novijim radovima i publikacijama (Savezni i republički zavodi za statistiku, »Statistička revija« i druge publikacije Jugoslovenskog statističkog društva, »Stanovništvo« i druge publikacije Centra za demografska istraživanja IDN itd.). Po drugoj, koncepciji trebalo je da se predvidi duži istraživački rad i analiza stručnih i naučnih radova iz sadašnje, kao i iz ranije literature. Za prvu fazu rada usvojena je prva koncepcija, s tim da se u prevodu navede i više termina, ukoliko se oni upotrebljavaju u literaturi.<br />
<br />
Prvi nacrt srpskohrvatske verzije Rečnika urađen je na osnovu francuske verzije, a od sklonosti pojedinih autora je zavisilo koliko su neki tekstovi bili šire obrađeni, u smislu objašnjenja uz pojedine paragrafe, odnosno u pogledu navođenja većeg broja termina. Na prevodima pojedinih delova radili su ovi saradnici Centra za demografska istraživanja:<br />
<br />
{|<br />
|glava I ||- »Osnovni i opšti izrazi i pojmovi« ||- dr Čedomil Novković;<br />
|-<br />
glava II || — »Obrada demografskih statistika« ||— Dragomir Popović;<br />
|-<br />
|glava III || — »Stanje stanovništva« || — Slobodanka Simić;<br />
|-<br />
|glava IV || — »Mortalitet i morbiditet« || — Liljana Matić;<br />
|-<br />
|glava V || — »Nupcijalitet — Sklapanje brakova« || — Stane Zrimec;<br />
|-<br />
|glava VI || — »Plodnost« || — Dragoljub Tasić;<br />
|-<br />
|glava VII || — »Kretanje i reprodukcija stanovništva« || — Vera Đorđević;<br />
|-<br />
|glava VIII || — »Migracije« || — Olivera Kazlica;<br />
|-<br />
|glava IX || — »Ekonomska i socijalna demografija« || — Slobodanka Simić.<br />
|}<br />
<br />
Prvi nacrt srpskohrvatske verzije Višejezičkog demografskog rečnika dostavljen je većem broju naučnih i stručnih saradnika koji se bave problemima stanovništva. Primedbe su dali: Dragoljub Tasić, Milenko Ban, Slobodanka Simić, dr Čedomil Novković Vera Đorđević, Dragoljub Popović, Gorčin Pecelj, dr Nevena Stojkov, dr Sava Obradović, dr Zora Steinman, dr Angelina Mojić, Sonja Masevska, dr Živko Šifrer, Radmila Apostolović, dr Milica Sentić, dr Ivanka Ginić, dr Miroslav Rašević, mgr. Gordana Todorović, Olivera Kozlica i dr Dušan Breznik. Sem toga, u vezi sa radom na Rečniku, vođeni su veoma korisni razgovori sa g. Vincent-om koji je izneo svoja iskustva na izradi originalnih tekstova i francuske verzije Rečnika. Na sređivanju primedaba radila je Olivera Kozlica, koja je istovremeno pripremala drugi nacrt Rečnika. O drugom nacrtu su najpre raspravljali saradnici koji su radili na prvom nacrtu, a zatim je uža redakcijska grupa - u sastavu: Olivera Kozlica, dr Dušan Breznik i dr Milica Sentić - razmotrila još neka pitanja, posle čega je Olivera Kozlica izradila konačnu srpskohrvatsku verziju Višejezičkog demografskog rečnika. Redakciju konačne verzije Rečnika izvršio je Tihomir Marsenić.<br />
<br />
Saradnici CDI su svesni mogućnih nedostataka srpskohrvatske verzije VDR, ali su se odlučili na njegovo publikovanje zbog neodložnih potreba da njime raspolažu ne samo jugoslovenski demografi i ostali koji se bave problemima stanovništva, već i svi strani korisnici naše demografske literature. Nedostaci mogu biti otklonjeni u eventualnom novom izdanju. CDI se unapred zahvaljuje na primedbama koje će dostaviti korisnici Rečnika.<br />
<br />
S obzirom na to da je demografija, iako na putu sve bržeg razvoja, još uvek u fazi svog naučnog konstituisanja, Rečnik ne sadrži znatan broj pojmova koji su u toku poslednje decenije prihvaćeni u sve obimnijoj demografskoj literaturi. Naime, saradnici CDI nisu smatrali za celishodno da pristupe proširenju Rečnika (na primer, 'u aneksu), pošto su želeli da sačuvaju osnovnu koncepciju njegovih autora. Stoga je, demografska terminologija u srpskohrvatskoj verziji Rečnika identična sa terminologijom u dosadašnjim verzijama Višejezičkog demografskog rečnika publikovanim na drugim jezicima.<br />
<br />
Napominje se da su uz ovaj predgovor dati predgovor za francusku verziju kao i obaveštenje korisniku, koje je takođe dato uz francusku verziju.<br />
<br />
Centar za demografska istraživanja koristi ovu priliku da se zahvali svima koji su svojim radom ili primedbama doprineli publikovanju konačne redakcije srpskohrvatske verzije Višejezičkog demografskog rečnika.<br />
<br />
<i>Dr Dušan Breznik</i><br />
<br/><br />
Upravnik Centra za demografska istraživanja<br />
<br/><br />
Instituta društvenih nauka<br />
<br />
=PREDGOVOR ZA FRANCUSKU VERZIJU »VIŠEJEZIČKOG DEMOGRAFSKOG REČNIKA« =<br />
<br />
Na svom četvrtom zasedanju, Komisija za pitanja stanovništva tražila je od Generalnog sekretara da uključi u svoj program rada pripremu demografskog rečnika na više jezika (E/1313).<br />
<br />
Nekoliko meseci kasnije Međunarodna unija za naučno proučavanje stanovništva na generalnoj skupštini u Ženevi, ponudila je svoju saradnju generalnom sekretaru Organizacije Ujedinjenih Nacija za ostvarenje jednog takvog dela i odlučila je da osnuje komisiju za izradu demografskog rečnika, koja je dobila zadatak da podnese njegov nacrt. Na svom petom zasedanju, Komisija za pitanja stanovništva zatražila je od Generalnog sekretara da prihvatí ponudu Unije, a Komisija za izradu rečnika dobila je zadatak da nacrt koji je podnela realizuje na tri jezika: engleskom, španskom i francuskom.<br />
<br />
Delo je bilo zamišljeno kao rečnik na više jezika, namenjen prevodiocima. On bi se sastojao od nekoliko svezaka na jednom stranom jeziku, od kojih bi svaka sadržala tehničku terminologiju koja se upotrebljava u demografiji, sa abecednim registrom. Paralelnost tekstova u različitim sveskama i sistem numerisanja pojmova, omogućuju da se utvrdi veza između istraživanja istog pojma na različitim jezicima.<br />
<br />
U Komisiji Unije zaduženoj za izradu tri prve sveske bili su: Paul Vincent (Francuska), predsednik - podnosilac izveštaja, Carlos E. Dieulefait (Argentina), Harold F. Dorn (SAD), Eugene Grebenik (Ujedinjeno kraljevstvo), Pierpaolo Luzzatto-Fegiz (Italija), Marcelino Pascua (Švajcarska) i Jose Ros Jimeno (Španija) - članovi.<br />
<br />
Prva skica bila je napravljena na osnovu jednog francuskog teksta koji je pripremio Nacionalni institut za demografska istraživanja (Francuska) pod rukovodstvom g. Vincent-a. Engleski i španski prevod ovog teksta sastavili su g.g. Grebenik i Ros Jimeno.<br />
<br />
Moralo se raditi užurbano zbog toga što se uskoro održavao Svetski kongres za pitanja stanovništva na kome je bio podnet nacrt rečnika u vidu »privremenog izdanja« (juni 1954.), koga je izdala Organizacija Ujedinjenih Nacija (ST/SOA/Séries A – Etudes démographíques, No 19). Ali rasturanje privremenog izdanja imalo je veliku prednost što je Komisija pridobila saradnju mnogobrojnih stručnjaka koji su rado želeli da joj prenesu svoja zapažanja.<br />
<br />
Veliki broj nedostataka prvog izdanja potiče otuda što se za njegovu izradu pošlo od jednog jedinog teksta, u ovom slučaju francuskog. Pokazalo se da je neophodno napraviti kompromis između anglo-saksonskih koncepcija s jedne strane i latinskih s druge strane. Iskustvo je takođe pokazalo da tekst neizostavno treba obogatiti definicijama da bi se omogućilo korisniku da otkrije eventualna razmimoilaženja između izražavanja jednog istog pojma na različitim jezicima.<br />
<br />
Pošto su ovi zaključci Komisije bili prihvaćeni, g. Grebenik dobio je zadatak da preradi na engleski prvobitni tekst. Posle toga su g.g. Grebenik i Vincent izradili zajedno, na osnovu tog engleskog i francuskog teksta, neku vrstu prilagođenog teksta koji je zatim svako od njih preveo na svoj jezik. G. Ros Jimeno je zatim napravio odgovarajući prevod na španskom jeziku, i prve tri sveske bile su podnete Komisiji, Birou Unije, kao i izvesnom broju stručnjaka, u cilju poslednjih doterivanja.<br />
<br />
Pošto su objavljene sveske Demografskog rečnika na engleskom, španskom i francuskom, neophodno je istaći neke njegove osobine.<br />
<br />
Na prvom mestu, on je rezultat jednog izvanredno kolektivnog rada. On je plod ne samo tesne saradnje između tri glavna redaktora, nego i aktivne saradnje svih članova Komisije. Osim toga za njegovu izradu koristila su se mišljenja mnogobrojnih stručnjaka koji su rado hteli da pregledaju tekstove u različitim fazama njegove izrade i da iznesu svoje primedbe, često ulazeći u detalje. Većina preporuka tako sakupljenih bilo je zadržano, u celini ili delimično. Neke su bile odbačene, možda nepravedno.<br />
<br />
U stvari, redaktori su često morali da vrše izbor. Sama koncepcija dela isključivala je mogućnost ulaženja u duža objašnjenja; često je trebalo izabrati između više mogućih formulacija. Na taj način svaka sveska nosi pečat svoga redaktora. Pominjanje njegovog imena u predgovoru ima za cilj da ukaže na njegovu ličnu odgovornost, ističući u isto vreme odgovornost ostalih učesnika u ovom poduhvatu.<br />
<br />
Treba ipak istaći da redaktori nisu mogli da sastave tekst po svom nahođenju: neophodna paralelnost između tekstova ili želja da se ne zanemare izražena mišljenja često su ih rukovodili da se pridruže gledištima koja nisu u potpunosti delili. Oni su ipak prihvatili da prime na sebe odgovornost za tekst, onakav kakav je.<br />
<br />
Treba takođe ukazati na činjenicu da sveske rečnika ne predstavljaju rasprave iz demografije. U toku njihove izrade sve je bilo podređeno osnovnom cilju dela: pružiti prevodiocima tehničko oruđe podešeno njihovim potrebama, i dati mu obeležje zaista višejezičko, nastojeći da svi jezici budu ravnopravno zastupljeni.<br />
<br />
Međutim, jezici su empirijske tvorevine, koje razvijaju svoju terminologiju prema sopstvenoj logici, koja se ponekad ne slaže sa racionalnim imperativima nauke. Nazivi pojmova na različitim jezicima često se ne slažu. Neki jezik, pravim terminološkim obiljem, svedoči o interesu koji ima za neki poseban predmet koji neki drugi jezik zanemaruje u toj meri da mu ne daje nikakav specijalan naziv. Upotreba objašnjenja omogućavala je da se ove teškoće koje otuda proističu umanje, jer se vodilo računa o sistemu koji je bio usvojen. Ali očigledno je da bi se podrobno izlaganje leksikografičkih teškoća pokazalo sasvim drugačije.<br />
<br />
Te leksikografičke teškoće su takođe u osnovi nekih neujednačenosti u sadržini teksta. Izgledalo je korisno, u nekim slučajevima, da se unese u rečnik terminologija koja nije u pravom smislu demografska, ali koju često srećemo u demografskim tekstovima, a koja se gotovo ne može naći ni u jednom rečniku i ne mogu je prevesti oni koji nisu upućeni.<br />
<br />
Komisija je, uzimajući u obzir potrebe prevodioca, još usvojila sledeći princip: Rečnik treba, pre svega, da služi za upotrebu, čak i kada ima nedostataka, i može da preporuči ili ne tu upotrebu, tek<br />
<br />
pošto jedan opšti pristanak izgleda da može biti postignut u tom pogledu.<br />
<br />
Delo nije dakle namenjeno uprošćavanju terminologija. Ono je još manje namenjeno da da definicije. One su bile unete samo da bi olakšale utvrđivanje terminoloških veza i precizirale njihov značaj. Krajnja konciznost ovih definicija ponekad je postizana na štetu njihove stroge umesnosti. Standardizacija terminologije zahteva delo potpuno različitog karaktera. Da bi se izbegao svaki nesporazum po tom pitanju, naći ćemo iza abecednog indeksa listu publikacija koje su nedavno izdali razni međunarodni organi i koje raspravljaju o definicijama demografskih pojmova. Čitalac će naročito da se koristi ovim radovima kada naiđe na neki problem u definiciji, a ne samo u prevođenju.<br />
<br />
Višejezički demografski rečnik, odgovoriće potpuno želji njegovih pokretača tek kada bude obuhvatio mnogobrojne jezike. Zahvaljujući nekim ličnim inicijativama, izrada nekih novih svezaka je već sada planirana ili je na putu da bude ostvarena. Šta više, Komisija za pitanja stanovništva na svom devetom zasedanju tražila je od sekretarijata da ispita mogućnost izdavanja jedne sveske na ruskom jeziku (E/2957). Iskustvo će pokazati da li kompromis koji je ostvaren između anglosaksonskih i latinskih koncepcija, odgovara takođe germanskim, slovenskim, čak i neindoevropskim jezicima.<br />
<br />
= OBAVEŠTENJE KORISNIKU REČNIKA =<br />
<br />
Višejezički demografski rečnik dobija formu zbirke svezaka na jednom jeziku, od kojih svaka sadrži dva dela: tekst sa objašnjenjima i abecedni registar termina.<br />
<br />
Tekst ima samo za cilj da izloži tehničku terminologiju koja se upotrebljava u demografiji, u jednom kontekstu koji objašnjava njeno značenje. On obuhvata 9 poglavlja od kojih svako ima izvestan broj paragrafa. Jedan broj sa tri cifre od kojih prva označava red poglavlja, omogućava da se identifikuje svaki paragraf. Terminološki elementi - reči ili izrazi - koji tu spadaju, štampani su masnim slovima i svaki nosi po jedan broj. Ovaj broj, koji se čita posle broja paragrafa, je uputni broj dotičnog terminološkog elementa.<br />
<br />
Numerisanje je izvršeno po pojmovima. Rezultat toga je, da jedan isti uputni broj je dat terminološkim elementima istog ili približno istog značenja, dok više uputnih brojeva su dati jednom istom terminološkom elementu, kada on može da ima više značenja.<br />
<br />
Neki paragrafi sadrže objašnjenja. Ova sadrže primedbe koje važe za svesku u kojoj se nalaze, i dopunsku terminologiju koja pripada pojmu na koji se ova objašnjenja odnose. Poslednja cifra broja koji je dat tom pojmu ponavlja se na početku odgovarajućeg objašnjenja. Upućivanje na terminologiju sadržanu u objašnjenjima razlikuje se od upućivanja na osnovnu materiju rečnika (koja sačinjava tekst u pravom smislu te reči) po jednoj zvezdici koja se nalazi posle broja pojma.<br />
<br />
Jedino terminološki elementi koji se nalaze u samom tekstu podudaraju se za svaku svesku, jer je ta veza utvrđena pomoću istovetnog uputnog broja (sa četiri cifre i bez zvezdica), koji im je dat.<br />
<br />
Dve serije paragrafa (paragrafi koji su obeleženi sa brojevima 303 ili 344) sadrže u svakoj svesci nazive koji su svojstveni zemlji gde se govori dotični jezik. Nikakva precizna veza ne bi mogla biti utvrđena između terminoloških elemenata koji se nalaze u tim paragrafima u svakoj od svezaka. Zbog toga ovi elementi nisu bili numerisani pojedinačno.<br />
<br />
Svi terminološki elementi štampani kurzivom, kako u samom tekstu tako i u objašnjenjima, su sređeni u indeksu abecednim redom, sa naznačenjem jednog ili više uputnih brojeva koji nam omogućavaju da odredimo njihovo mesto u prvom delu sveske.<br />
<br />
Kada jedan pojam koji nosi jedan uputni broj u rečniku, nije dobio pravi izraz na nekom jeziku, izraz koji se nalazi pod tim brojem u odgovarajućoj svesci štampan je kurzivom a ne masnim slovima kao dobijeni izrazi. On je samo naznačen kao sugestija da bi se olakšao rad prevodiocima i ne ponavlja se u indeksu. On se razlikuje od citata, koji su takođe štampani kurzivom, po broju koji ga prati.<br />
<br />
Način kako se služi Rečnikom može šematski biti prikazan na sledeći način: Na primer, treba prevesti na francuski, englesku reč za neki pojam. Registar sveske na engleskom daje, u pogledu terminološkog elementa koga treba prevesti, broj koji nosi izraženi pojam. Pozivajući se na odgovarajući paragraf francuskog teksta nalazimo francuski izraz za taj pojam.<br />
<br />
U praksi je neophodno pročitati ceo paragraf na koga se pozivamo, ne propuštajući objašnjenja, ne samo zbog toga što ćemo tu često naći korisna obaveštenja, nego i zbog toga što su potrebe redakcije ponekad nalagale da se terminološki elementi ili objašnjenja koja se na njih odnose rasporede drugačije, nego uputni brojevi.<br />
<br />
Isto tako neophodno je porediti dva prevoda istog paragrafa na dva jezika, što će omogućiti da se u slučaju potrebe, vide razlike u značenju između izraza koji su samo približno ekvivalentni.<br />
<br />
Napomenimo, najzad, da ako se više sinonima nalaze pod istim brojem u francuskom tekstu, uglavnom biće bolje da izaberemo prvi ili jedan od prvih navedenih izraza. U stvari, izrazi čija upotreba je preporučena sistematski su stavljeni ispred ostalih izraza.<br />
<br />
Što se tiče traženja u francuskom registru termina, ono će biti olakšano poznavanjem nekih principa po kojima se upravljalo pri izradi tog registra.<br />
<br />
Izrazi koji se nalaze u prvom delu sveske kao terminološki elementi ponavljaju se u registru pod glavnim rečima i grupama sastavnih reči. Budući da grupe reči mogu biti smatrane kao da one same po sebi izražavaju jedan poseban pojam bile su svrstane u indeks, posle prve reči iz grupe, po strogo abecednom redu, uzimajući u obzir pri slaganju članova, predloge itd. Međutim, imaćemo u vidu da su složene reči povezane crticom smatrane kao grupe reči – i to da bi se izbegla zbrka oko određivanja mesta reči kao što su: »enquéte-pilote«, »âge-pivot«, »population-type«, itd.<br />
<br />
Tako zamišljen abecedni registar izgledao je pogodan za traženje na dugačkim listama izraza poređanih u koloni i bolji od metode razvrstavanja po značenju reči, Međutim, odatle proističu neke<br />
<br />
pojedinosti na koje treba ukazati korisniku rečnika.<br />
<br />
Tako, da ne bi pretrpali registar mnogobrojnim varijantama, neki izrazi kao što su »statistique de familles«, »cause de decès«, »dissolution du mariage«, tu su navedeni samo u toj formi, isključujući sledeći oblik u kome se oni često javljaju; »statistique des familles«, »cause du décès«, »dissolution des mariages«. Oslobodićemo se nesigurnosti u razrvstavanju koja odatle proističe, tražeći najpre izraze te vrste pod poslednjom sastavnom reči grupe.<br />
<br />
=LISTA SKRAĆENICA KORIŠĆENIH U SRPSKOHRVATSKOJ VERZIJI REČNIKA=<br />
{|<br />
gl. || — glagol<br />
|-<br />
|gl. prid. || — glagolski pridev<br />
|-<br />
|itd. || — i tako dalje<br />
|-<br />
|m. || — muški rod imenice<br />
|-<br />
|mn. || — množina<br />
|-<br />
|npr. || — na primer<br />
|-<br />
|prid. || — pridev<br />
|-<br />
|pril. || — prilog<br />
|-<br />
|sr. || — srednji rod imenice<br />
|-<br />
|upor. || — uporedi<br />
|-<br />
|V. || — vidi<br />
|-<br />
|ž. || — ženski rod imenice<br />
|}</div>
Nicolas Brouard
http://sh-i.demopaedia.org/w/index.php?title=Kategorija:Uvjeti_od_prvog_izdanja_vi%C5%A1ejezi%C4%8Dni_rje%C4%8Dnik_demografskog&diff=4494
Kategorija:Uvjeti od prvog izdanja višejezični rječnik demografskog
2013-05-18T17:09:19Z
<p>Nicolas Brouard: To be translated</p>
<hr />
<div>List of all terms of the first edition</div>
Nicolas Brouard
http://sh-i.demopaedia.org/w/index.php?title=%C5%A0ablon:Lang_audio_pronunciation_-sh&diff=2761
Šablon:Lang audio pronunciation -sh
2013-05-18T14:01:10Z
<p>Nicolas Brouard: Napravljena stranica sa '<!--'''Template:Lang_audio_pronunciation_-sh'''-->Izogovora'</p>
<hr />
<div><!--'''Template:Lang_audio_pronunciation_-sh'''-->Izogovora</div>
Nicolas Brouard
http://sh-i.demopaedia.org/w/index.php?title=%C5%A0ablon:Lang_more_-sh&diff=2708
Šablon:Lang more -sh
2013-05-18T13:56:41Z
<p>Nicolas Brouard: Napravljena stranica sa '<!--'''Template:Lang_more_-cs'''--><includeonly>More...</includeonly> <noinclude>Category:template_to_be_translated</noinclude>'</p>
<hr />
<div><!--'''Template:Lang_more_-cs'''--><includeonly>More...</includeonly><br />
<noinclude>[[Category:template_to_be_translated]]</noinclude></div>
Nicolas Brouard
http://sh-i.demopaedia.org/w/index.php?title=Kategorija:Template_to_be_translated&diff=2693
Kategorija:Template to be translated
2013-05-18T13:55:23Z
<p>Nicolas Brouard: Here is the list of terms which can be edited and translated in Serbo-Croatian</p>
<hr />
<div>Here is the list of terms which can be edited and translated in Serbo-Croatian</div>
Nicolas Brouard
http://sh-i.demopaedia.org/w/index.php?title=%C5%A0ablon:Lang_translation_-sh&diff=2671
Šablon:Lang translation -sh
2013-05-18T13:53:23Z
<p>Nicolas Brouard: To be checked</p>
<hr />
<div><!--'''Template:Lang_translation_-sh'''--><includeonly>Prijevodi</includeonly><br />
<noinclude>[[Category:template_to_be_translated]]</noinclude></div>
Nicolas Brouard
http://sh-i.demopaedia.org/w/index.php?title=%C5%A0ablon:Definition_from_edition_-sh&diff=2631
Šablon:Definition from edition -sh
2013-05-18T13:49:39Z
<p>Nicolas Brouard: To be checked</p>
<hr />
<div><!--'''Template:Definition_from_second_edition_-sh'''--><includeonly>Definicija iz prvog izdanja (1971)</includeonly><br />
<noinclude>[[Category:template_to_be_translated]]</noinclude></div>
Nicolas Brouard
http://sh-i.demopaedia.org/w/index.php?title=%C5%A0ablon:OtherLanguages&diff=39
Šablon:OtherLanguages
2013-01-14T10:04:55Z
<p>Nicolas Brouard: Ajout du français omis</p>
<hr />
<div><!--'''Template:OtherLanguages'''--><br />
[[ar-I:{{{1}}}]] [[cs-I:{{{1}}}]] [[de-I:{{{1}}}]] [[en-I:{{{1}}}]] [[es-I:{{{1}}}]] [[fi-I:{{{1}}}]] [[fr-I:{{{1}}}]] [[it-I:{{{1}}}]] [[pl-I:{{{1}}}]] [[pt-I:{{{1}}}]] [[ru-I:{{{1}}}]]</div>
Nicolas Brouard
http://sh-i.demopaedia.org/w/index.php?title=MediaWiki:Edittools&diff=38
MediaWiki:Edittools
2012-12-11T11:43:35Z
<p>Nicolas Brouard: From French demopaedia</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://sh-i.demopaedia.org/w/index.php?title=MediaWiki:Edittools&diff=37
MediaWiki:Edittools
2012-12-11T11:18:39Z
<p>Nicolas Brouard: from it-i</p>
<hr />
<div><!-- Text here will be shown below edit and upload forms. --><br />
<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 />
<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://sh-i.demopaedia.org/w/index.php?title=MediaWiki:Editpage.js&diff=36
MediaWiki:Editpage.js
2012-12-11T10:59:15Z
<p>Nicolas Brouard: From it-i</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://sh-i.demopaedia.org/w/index.php?title=MediaWiki:Common.js/edit.js&diff=35
MediaWiki:Common.js/edit.js
2012-12-11T10:57:25Z
<p>Nicolas Brouard: from it-i</p>
<hr />
<div>/* Any JavaScript here will be loaded for all users on every page load. */<br />
/* 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