|
|
| Line 78: |
Line 78: |
| self.proofreadpage_add_container = true; | | self.proofreadpage_add_container = true; |
| | | |
| //importScriptURI('http://wiki.mises.org/mediawiki/index.php?title=MediaWiki:Base.js&action=raw&ctype=text/javascript');
| | importScriptURI('http://wiki.mises.org/mediawiki/index.php?title=MediaWiki:Base.js&action=raw&ctype=text/javascript'); |
| //importScriptURI('http://wiki.mises.org/mediawiki/index.php?title=MediaWiki:OCR.js&action=raw&ctype=text/javascript'); | | //importScriptURI('http://wiki.mises.org/mediawiki/index.php?title=MediaWiki:OCR.js&action=raw&ctype=text/javascript'); |
| importScriptURI('http://wiki.mises.org/mediawiki/index.php?title=MediaWiki:DisplayFooter.js&action=raw&ctype=text/javascript'); | | importScriptURI('http://wiki.mises.org/mediawiki/index.php?title=MediaWiki:DisplayFooter.js&action=raw&ctype=text/javascript'); |
| importScriptURI('http://wiki.mises.org/mediawiki/index.php?title=MediaWiki:PageNumbers.js&action=raw&ctype=text/javascript'); | | importScriptURI('http://wiki.mises.org/mediawiki/index.php?title=MediaWiki:PageNumbers.js&action=raw&ctype=text/javascript'); |
| importScriptURI('http://wiki.mises.org/mediawiki/index.php?title=MediaWiki:Corrections.js&action=raw&ctype=text/javascript'); | | importScriptURI('http://wiki.mises.org/mediawiki/index.php?title=MediaWiki:Corrections.js&action=raw&ctype=text/javascript'); |
| //importScriptURI('http://wiki.mises.org/mediawiki/index.php?title=MediaWiki:IndexForm.js&action=raw&ctype=text/javascript');
| | importScriptURI('http://wiki.mises.org/mediawiki/index.php?title=MediaWiki:IndexForm.js&action=raw&ctype=text/javascript'); |
| | | |
| /* | | /* |
| Line 92: |
Line 92: |
| */ | | */ |
| self.proofreadpage_disable_wheelzoom=true; | | self.proofreadpage_disable_wheelzoom=true; |
|
| |
| /* Direct copy from MediaWiki:IndexForm.js and MediaWiki:Base.js, for testing */
| |
|
| |
| var page_ns_prefixes= {
| |
| 'en':'Page',
| |
| 'fr':'Page',
| |
| 'de':'Seite',
| |
| 'it':'Pagina',
| |
| 'la':'Pagina',
| |
| 'no':'Side',
| |
| 'es':'Página',
| |
| 'pt':'Página',
| |
| 'sv':'Sida',
| |
| 'pl':'Strona',
| |
| 'hy':'Էջ',
| |
| 'ru':'Страница',
| |
| 'hr':'Stranica',
| |
| 'hu':'Oldal',
| |
| 'ca':'Pàgina',
| |
| 'vi':'Trang',
| |
| 'sl':'Stran',
| |
| 'zh':'Page',
| |
| 'vec':'Pagina',
| |
| 'br':'Pajenn'
| |
| }
| |
|
| |
| var index_ns_prefixes= {
| |
| 'en':'Index',
| |
| 'fr':'Livre',
| |
| 'de':'Index',
| |
| 'it':'Indice',
| |
| 'la':'Liber',
| |
| 'no':'Indeks',
| |
| 'es':'Índice',
| |
| 'pt':'Galeria',
| |
| 'sv':'Index',
| |
| 'hy':'Ինդեքս',
| |
| 'ru':'Индекс',
| |
| 'br':'Meneger',
| |
| 'vec':'Indice'
| |
| }
| |
|
| |
| /* messages to be moved
| |
| 'it':'Il testo proviene da',
| |
| 'la':'Hic textus visibils est in',
| |
| 'es':'Su texto procede de',
| |
| 'ca':'El seu text procedeix de'
| |
| */
| |
|
| |
|
| |
| if(!self.ws_messages) self.ws_messages = { }
| |
|
| |
| function ws_msg(name) {
| |
| var m = self.ws_messages[name];
| |
| if(m) return m; else return name;
| |
| }
| |
|
| |
| /* Note : there is a similar function in wikibits.js, but it does not work for me pn page numbers */
| |
| function get_elements_by_classname(classname, tagname) {
| |
| if(document.getElementsByClassName) return document.getElementsByClassName(classname);
| |
| var ml = new Array();
| |
| var l = document.getElementsByTagName(tagname);
| |
| for (var i=0; i< l.length; i++) {
| |
| var a = l[i];
| |
| if( a.className.indexOf(classname) !=-1 ) ml[ml.length] = l[i];
| |
| }
| |
| return ml;
| |
| }
| |
|
| |
|
| |
| function get_optlist() {
| |
| var optlist = document.getElementById("optlist");
| |
| if(!optlist) {
| |
| var displayOptions = document.createElement("div");
| |
| if (self.skin=='vector') displayOptions.className = "portal"; else displayOptions.className = "portlet";
| |
| if (self.skin=='vector') cl="body"; else cl="pBody";
| |
| displayOptions.innerHTML = '<h5>' + ws_msg('optlist') + '<\/h5><div class="'+cl+'"><ul id="optlist"> </ul><\/div>';
| |
| var ptb = document.getElementById("p-tb");
| |
| ptb.parentNode.insertBefore(displayOptions,ptb);
| |
| displayOptions.setAttribute("id","p-displayOptions");
| |
| displayOptions.id="p-displayOptions"; /* */
| |
| optlist = document.getElementById("optlist");
| |
| }
| |
| return optlist;
| |
| }
| |
|
| |
|
| |
| /*** Cookies ***/
| |
|
| |
| function SetCookie(name,value) {
| |
| document.cookie = name + "=" + escape(value);
| |
| }
| |
|
| |
| function GetCookie(name) {
| |
| var i =0;
| |
| while (i < document.cookie.length) {
| |
| if (document.cookie.substr(i,name.length) == name) {
| |
| var valend = document.cookie.indexOf(";",i+name.length+1);
| |
| if (valend == -1) {
| |
| valend = document.cookie.length;
| |
| }
| |
| return unescape(document.cookie.substring(i+name.length+1,valend));
| |
| }
| |
| i = document.cookie.indexOf(" ", i) + 1;
| |
| if (i == 0) break;
| |
| }
| |
| }
| |
|
| |
|
| |
| /**** Display options ****/
| |
|
| |
| function OptionText() {
| |
| var indexNavigationBar = 0;
| |
| // iterate over all < span >-elements until class "OptionText" is found
| |
| for(
| |
| var i=0;
| |
| SpanElem = document.getElementsByTagName("span")[i];
| |
| i++
| |
| ) {
| |
| // if found an option span
| |
| if (SpanElem.className == "OptionText") {
| |
| //SpanElem.style.display = 'none';
| |
| OptionTitle = SpanElem.title;
| |
| OptionStyle = SpanElem.firstChild.getAttribute('style');
| |
|
| |
| //check if option was already encountered...
| |
| if(!document.getElementById(OptionTitle)){
| |
|
| |
| //read cookie
| |
| var DisplayOptionDefault = true;
| |
| CookieDisplayOption = GetCookie ("Display"+OptionTitle)
| |
| if (CookieDisplayOption ) {
| |
| if (CookieDisplayOption == "false") DisplayOptionDefault = false; }
| |
|
| |
| var PageDisplay = document.createElement("li");
| |
| PageDisplay.setAttribute('id', OptionTitle);
| |
| var PageDisplayLink = document.createElement("a");
| |
|
| |
| OptionText = document.createTextNode("Désactiver "+OptionTitle);
| |
| PageDisplayLink.appendChild(OptionText);
| |
| PageDisplayLink.setAttribute('href','javascript:displayOptionText("'+OptionTitle+'","' + OptionStyle +'", '+DisplayOptionDefault+');');
| |
| PageDisplay.appendChild(PageDisplayLink);
| |
|
| |
| var optlist = get_optlist();
| |
| optlist.appendChild(PageDisplay);
| |
|
| |
| displayOptionText(OptionTitle,OptionStyle,DisplayOptionDefault);
| |
| }
| |
| }
| |
| }
| |
| }
| |
|
| |
| function displayOptionText(optiontitle, optionstyle, bool) {
| |
|
| |
| SetCookie ("Display"+optiontitle,bool);
| |
| if( ! document.getElementById(optiontitle) ) return;
| |
| var PageDisplayLink = document.getElementById(optiontitle).firstChild;
| |
|
| |
| // iterate over all < span >-elements
| |
| for(
| |
| var i=0;
| |
| SpanElem = document.getElementsByTagName("span")[i];
| |
| i++
| |
| ) {
| |
| // if found an option text
| |
| if ((SpanElem.className == "OptionText") && (SpanElem.title == optiontitle)) {
| |
| if(bool==true ) {
| |
| SpanElem.setAttribute('style',optionstyle);
| |
| PageDisplayLink.firstChild.data = (optiontitle);
| |
| PageDisplayLink.setAttribute('href', 'javascript:displayOptionText("'+optiontitle+'","'+optionstyle+'", false);');
| |
| }
| |
| if(bool==false) {
| |
| SpanElem.setAttribute('style','null');
| |
| PageDisplayLink.firstChild.data = (optiontitle);
| |
| PageDisplayLink.setAttribute('href', 'javascript:displayOptionText("'+optiontitle+'","'+optionstyle+'", true);');
| |
|
| |
| }
| |
| }
| |
| }
| |
| }
| |
|
| |
| addOnloadHook(OptionText);
| |
|
| |
| function restore_lst(){
| |
| var editbox = document.getElementById('wpTextbox1');
| |
| var search = /##[\s]*(.*?)[\s]*##[\s]*\n/;
| |
| var a = editbox.value.split(search);
| |
| var s = a[0];
| |
| var ok = true;
| |
| var m = parseInt(a.length/2);
| |
| for( var i = 0 ; i < m ; i++ ) {
| |
| var title = a[i*2+1];
| |
| /*title = title.replace(' ','_');*/
| |
| var content = a[i*2+2];
| |
| if( title && content.substring(0,2)=='{|' ) content = '\n' + content;
| |
| if(title) s = s + "<section begin="+title+"/>" + content + "<section end="+title+"/>\n";
| |
| else s = s + content;
| |
| /* if( i < m-1 ) s = s + "----\n"; */
| |
| }
| |
| editbox.value = s;
| |
| }
| |
|
| |
| /*
| |
| * easy lst : hide section markers
| |
| */
| |
| function easy_lst() {
| |
| if(self.proofreadpage_raw_lst) return;
| |
| var editbox = document.getElementById('wpTextbox1');
| |
| if(editbox && self.proofreadPageIsEdit) {
| |
|
| |
| var search = /<section begin=[\s]*(.*?)[\s]*\/>/;
| |
| var a = editbox.value.split(search);
| |
| var s = a[0];
| |
| var ok = true;
| |
| for( var i = 0 ; i < parseInt(a.length/2) ; i++ ) {
| |
| var title = a[i*2+1];
| |
| var content = a[i*2+2];
| |
| var r2 = /^([\s\S]*?)<section end=(.*?)\/>(\n|)[\s]*([\s\S]*?)$/;
| |
| var m2 = content.match(r2);
| |
| if( m2 ) {
| |
| if(s && s.charAt(s.length-1)!='\n' && s.charAt(s.length-1)!='|' ) s = s+'\n';
| |
| s = s + "## " + title + " ##\n"+ m2[1] ;
| |
| if( m2[4] ) {
| |
| if( m2[4]!='----\n' ) {
| |
| if(s && s.charAt(s.length-1)!='\n' ) s = s+'\n';
| |
| s = s + "####\n" + m2[4] ;
| |
| }
| |
| }
| |
| } else {
| |
| ok = false; /* alert("error"+title);*/
| |
| }
| |
| }
| |
| if(ok) {
| |
| editbox.value = s;
| |
| }
| |
| var saveButton = document.getElementById("wpSave");
| |
| var previewButton = document.getElementById("wpPreview");
| |
| var diffButton = document.getElementById("wpDiff");
| |
| if(saveButton){
| |
| saveButton.onclick = restore_lst;
| |
| previewButton.onclick = restore_lst;
| |
| diffButton.onclick = restore_lst;
| |
| }
| |
| }
| |
| }
| |
|
| |
| addOnloadHook(easy_lst);
| |
|
| |
| /********************************
| |
| enhanced form for index pages
| |
| *********************************/
| |
|
| |
|
| |
| function set_index_field(name,value,on_book,on_collection,on_journal,on_phdthesis, on_dictionary){
| |
| var f = document.getElementsByName(name)[0];
| |
| if(!f) return;
| |
| f = f[0];
| |
| if(f) {
| |
| if( (value=="book" && on_book) || (value=="journal" && on_journal) || (value=="collection" && on_collection) || (value=="phdthesis" && on_phdthesis) || value=="dictionary" && on_dictionary ) {
| |
| f.disabled=false;
| |
| f.parentNode.parentNode.style.display="";
| |
| } else {
| |
| f.disabled=true;
| |
| f.parentNode.parentNode.style.display="none";
| |
| }
| |
| }
| |
| }
| |
|
| |
|
| |
| /*specifies which fields should appear for each material type */
| |
| function type_changed(f,value) {
| |
| //see http://www.easybib.com/reference/guide/apa/dictionary
| |
| set_index_field( ws_msg('author'), value, 1, 1, 0, 1, 0);
| |
| set_index_field( ws_msg('translator'), value, 1, 1, 0, 0, 0);
| |
| set_index_field( ws_msg('editor'), value, 1, 1, 1, 0, 1);
| |
| set_index_field( ws_msg('place'), value, 1, 1, 1, 0, 1);
| |
| set_index_field( ws_msg('editor'), value, 1, 1, 1, 0, 1);
| |
| set_index_field( ws_msg('volume'), value, 1, 1, 1, 0, 1);
| |
| set_index_field( ws_msg('school'), value, 0, 0, 0, 1, 0);
| |
| }
| |
|
| |
| /*replaced if( wgCanonicalNamespace == self.index_ns_prefixes[wgContentLanguage] ) { */
| |
| function index_choices(){
| |
| if( wgCanonicalNamespace == 'Index' ) {
| |
| var f = document.editform;
| |
| var value = "book"; //fixme: understand this
| |
| if(f) {
| |
| var a = f.Type;
| |
| if(a) {
| |
|
| |
| value = a.value;
| |
| a.parentNode.innerHTML="<select onchange=\"type_changed(this.form,this.options[this.selectedIndex].value);\" name=\"Type\">"
| |
| +"<option value=\"book\" selected=true>" + ws_msg('book') + "</option>"
| |
| +"<option value=\"collection\">" + ws_msg('collection') + "</option>"
| |
| +"<option value=\"journal\">" + ws_msg('journal') + "</option>"
| |
| +"<option value=\"phdthesis\">" + ws_msg('phdthesis') + "</option>"
| |
| +"<option value=\"dictionary\">" + ws_msg('dictionary') + "</option>"
| |
| +"</select>";
| |
| a = f.Type;
| |
| for (var i=0; i < a.length; i++) {
| |
| if (a[i].value == value) a[i].selected = true;
| |
| }
| |
| if(value=="") value="book";
| |
| type_changed(f,value);
| |
| }
| |
|
| |
| var suffix = wgPageName.substring(wgPageName.length-4,wgPageName.length).toLowerCase();
| |
| if( suffix=='djvu' || suffix=='.pdf') {
| |
| var m_source = ws_msg('Source');
| |
| set_index_field( m_source, value, 0, 0, 0, 0, 0);
| |
| f = document.getElementsByName(m_source)[0];
| |
| if(f) {
| |
| if( suffix=='djvu' ) f.value='djvu';
| |
| if( suffix=='.pdf' ) f.value='pdf';
| |
| }
| |
| f = document.getElementsByName( ws_msg('Image'))[0];
| |
| if(f && f.value=="") f.value="1";
| |
| f = document.getElementsByName( ws_msg('Pages'))[0];
| |
| if(f && f.value=="") f.value="<pagelist />";
| |
| }
| |
| var a = document.getElementsByName(ws_msg('progress'))[0];
| |
| if(a) {
| |
| value = a.value;
| |
| a.parentNode.innerHTML="<select name=\""+ ws_msg('progress') + "\">"
| |
| +"<option value=\"\" selected=true></option>"
| |
| +"<option value=\"T\">" + ws_msg('progress_T') + "</option>"
| |
| +"<option value=\"V\">" + ws_msg('progress_V') + "</option>"
| |
| +"<option value=\"C\">" + ws_msg('progress_C') + "</option>"
| |
| +"<option value=\"MS\">"+ ws_msg('progress_MS')+ "</option>"
| |
| +"<option value=\"OCR\">"+ws_msg('progress_OCR')+"</option>"
| |
| +"<option value=\"X\">" + ws_msg('progress_X') + "</option>"
| |
| +"<option value=\"L\">" + ws_msg('progress_L') + "</option>"
| |
| +"</select>";
| |
| a = document.getElementsByName(ws_msg('progress'))[0];
| |
| for (var i=0; i < a.length; i++) {
| |
| if (a[i].value == value) a[i].selected = true;
| |
| }
| |
| }
| |
|
| |
| }
| |
| }
| |
| }
| |
| hookEvent("load",index_choices);
| |
/* Import more specific scripts if necessary */
if (wgAction == "edit" || wgAction == "submit" || wgPageName == "Special:Upload") //scripts specific to editing pages
{
importScript("MediaWiki:Common.js/edit.js")
}
/*
* scripts imported from en.wikisource.org and wikisource.org
*/
/* messages are configurable here */
self.ws_messages = {
'optlist':'Display options',
'hide_page_numbers':'Hide page links',
'show_page_numbers':'Show page links',
'layout':'Layout',
'author':'Author',
'translator':'Translator',
'editor':'Editor',
'publisher':'Publisher',
'place':'Place',
'volume':'Volume',
'school':'School',
'book':'Book',
'collection':'Collection',
'journal':'Journal or magazine',
'phdthesis':'Thesis, report',
'dictionary':'Dictionary',
'progress':'Progress',
'progress_T':'Done',
'progress_V':'To be validated',
'progress_C':'To be proofread',
'progress_MS':'Ready for Match & Split',
'progress_OCR':'Needs an OCR text layer',
'progress_X':'Source file is an excerpt of a larger volume, or a mixture of several sources',
'progress_L':'Source file is incorrect (missing pages, unordered pages, etc)',
'▲':'Return to the top of the page.',
'corr_list':"List of corrections performed on this page" ,
'corr_link':"Corrections" ,
'corr_one':"One typo </a> has been corrected." ,
'corr_many':" typos</a> have been corrected." ,
'corr_close':"Close." ,
'iwtrans':'Its text comes from',
'iwtrans2':'Its text comes from other Wikisource subdomains.'
}
/* dynamic layouts from en.wikisource.org*/
self.ws_layouts = {
'Layout 1':{'text-wrap':"",
'#text-container':"" ,
'#text':"",
'.sidenote-right':"float:right;margin:0.5em;padding:3px;border:solid 1px gray;max-width:9em;text-indent:0em;text-align:left;",
'.sidenote-left':"float:left;margin:0.5em;padding:3px;border:solid 1px gray;max-width:9em;text-indent:0em;text-align:left;",
'.editsection':"display:none",
'#headertemplate':"" },
'Layout 2':{'text-wrap':"position:relative;margin-left:3em;margin-right:3em;",
'#text-container':"width:36em;margin:0px auto;font-family:Georgia,serif;" ,
'#text':"text-align:justify;",
'.sidenote-right':"position:absolute; left:37em;width:16em;text-indent:0em;text-align:left;",
'.sidenote-left':"position:absolute; right:37em;width:16em;text-indent:0em;text-align:right;",
'.editsection':"display:none",
'#headertemplate':"" },
'Layout 3':{'text-wrap':"margin-left:3em",
'#text-container':"position:relative; min-width:60em; float:left; width:100%; margin-right:-23em;" ,
'#text':"text-align:justify;margin-right:23em; text-indent:0em; padding-left:0px; padding-right:0px;width:auto;",
'.sidenote-right':"position:absolute; right:-10em; width:9em; background-color:#eeeeee;text-indent:0em;text-align:left;",
'.sidenote-left': "position:absolute; right:-10em; width:9em; background-color:#eeeeee;text-indent:0em;text-align:left;",
'.editsection':"display:none",
'#headertemplate':"position:absolute; top:0em; right:-23em; width:21em;float:right; text-align:left;" }
}
self.proofreadpage_add_container = true;
importScriptURI('http://wiki.mises.org/mediawiki/index.php?title=MediaWiki:Base.js&action=raw&ctype=text/javascript');
//importScriptURI('http://wiki.mises.org/mediawiki/index.php?title=MediaWiki:OCR.js&action=raw&ctype=text/javascript');
importScriptURI('http://wiki.mises.org/mediawiki/index.php?title=MediaWiki:DisplayFooter.js&action=raw&ctype=text/javascript');
importScriptURI('http://wiki.mises.org/mediawiki/index.php?title=MediaWiki:PageNumbers.js&action=raw&ctype=text/javascript');
importScriptURI('http://wiki.mises.org/mediawiki/index.php?title=MediaWiki:Corrections.js&action=raw&ctype=text/javascript');
importScriptURI('http://wiki.mises.org/mediawiki/index.php?title=MediaWiki:IndexForm.js&action=raw&ctype=text/javascript');
/*
From en.wikisource.org
Disabling mouse wheel until the problem is fixed.
Users that have a configurations where zoom wheel works can override this,
by adding "self.proofreadpage_disable_wheelzoom=false;" to their javascript.
self.proofreadpage_disable_wheelzoom=true;