User:Marsupium/common.js

From Wikimedia Commons, the free media repository
Jump to navigation Jump to search
Note: After saving, you have to bypass your browser's cache to see the changes. Internet Explorer: press Ctrl-F5, Mozilla: hold down Shift while clicking Reload (or press Ctrl-Shift-R), Opera/Konqueror: press F5, Safari: hold down Shift + Alt while clicking Reload, Chrome: hold down Shift while clicking Reload.
mw.loader.load('//commons.wikimedia.org/w/index.php?title=User:Magnus_Manske/sdc_tool.js&action=raw&ctype=text/javascript'); // [[User:Magnus Manske/sdc_tool.js]]
mw.loader.load('//commons.wikimedia.org/w/index.php?title=User:Lucas_Werkmeister/wd-image-positions.js&action=raw&ctype=text/javascript'); // [[User:Lucas_Werkmeister/wd-image-positions.js]]
mw.loader.load('//commons.wikimedia.org/w/index.php?title=User:Magog_the_Ogre/cleanup.js&action=raw&ctype=text/javascript'); // [[User:Magog the Ogre/cleanup.js]]

window.disableAjaxTranslation = true; // cf. [[MediaWiki talk:AjaxTranslation.js]]

// WikiSyntaxTextMod config:
mw.libs.WikiSyntaxTextMod  =  { config:  { lang: { },
                                           load: { },
                                           mod:  { plain: [] },
                                           page: { }
                                         }
                              };

mw.libs.WikiSyntaxTextMod.config.mod.plain = [
   ["\n\n\n",
    "\n\n"],
                                             ];
mw.libs.WikiSyntaxTextMod.config.mod.tested  =  true; // don't test these replacements
mw.libs.WikiSyntaxTextMod.config.page.include  =  [ "File:", "Category:", "Template:", "Creator:" ];

var templateInformation  =  [
[ /^description$/i,        "description" ],
[ /^date$/i,               "date" ],
[ /^source$/i,             "source" ],
[ /^author$/i,             "author" ],
[ /^permission$/i,         "permission" ],
[ /^other( |_)versions$/i, "other versions" ],
];
// order was discussed in 2014's [[Template talk:Information/Archive 4#Inconsistencies]],
// the order and parameter names here are those used by
// * [[Template:Information/doc#Usage]] (as of 2019-04-06: https://commons.wikimedia.org/w/index.php?title=Template:Information/doc&oldid=337505446#Usage)
// * [[Special:UploadWizard]] (as of 2019-02-20: see e.g. [[File:Massmannpark memorial in snow 2019.jpg]])
// for order also:
// * the display of the template (as of 2019-04-06)

var templateArtworkOrder = ["wikidata", "artist", "author", "photographer",
    "title", "object type", "description"];
var templateArtPhotoOrder = ["wikidata", "artist", "author",
    "title", "object type", "description"];

var templateArtwork  =  [
[ /^wikidata$/i,              "wikidata", false ],
[ /^artist$/i,                "artist",      false ],
[ /^author$/i,                "author",      false ],
[ /^photographer$/i,          "photographer", false ],
[ /^title$/i,                 "title",       false ],
[ /^object type/i,            "object type", false ],
[ /^description/i,            "description", false ],
[ /^depicted part/i,          "depicted part", false ],
[ /^depicted people/i,        "depicted people", false ],
[ /^depicted place/i,         "depicted place", false ],
[ /^(date|year)$/i,           "date",        false ],
[ /^(medium|technique)/i,     "medium",      false ],
[ /^(dimensions|size)/i,      "dimensions",  false ],
[ /^(institution|gallery|museum)/i, "institution", false ],
[ /^department/i, "department", false ],
[ /^location/i, "location", false ], // "department" is preferable in most cases
[ /^(accession number|id)$/i, "accession number", false ],
// "^" and "$" here necessary for not matching "wikidata"!?
[ /^place of creation/i, "place of creation", false ],
[ /^place of discovery/i, "place of discovery", false ],
[ /^object history/i, "object history", false ],
[ /^exhibition history/i, "exhibition history", false ],
[ /^credit line/i, "credit line", false ],
[ /^inscriptions/i, "inscriptions", false ],
[ /^notes/i, "notes", false ],
[ /^references/i, "references", false ],
[ /^source/i, "source", false ],
[ /^permission/i, "permission", false ],
[ /^other( |_)versions/i, "other versions", false ], // better with or without "_"? see also for [[Template:Information]] above
                    ];
// order taken and slightly adapted from 
// https://commons.wikimedia.org/w/index.php?title=Template:Artwork/doc&oldid=562928747 (2021-05-22),

var templateCreatorOrder = ["Wikidata", "Name", "Alternative names", "Nationality",
    "Gender", "Occupation", "Description"];

var templateCreator = [
[ /^Wikidata$/i],
[ /^Name$/i, false],
[ /^Alternative names$/i, false],
[ /^Nationality$/i, false],
[ /^Gender$/i, false],
[ /^Occupation$/i, false],
[ /^Description$/i, false],
[ /^Birthdate$/i, false],
[ /^Birthloc$/i, false],
[ /^Deathdate$/i, false],
[ /^Deathloc$/i, false],
[ /^Workperiod$/i, false],
[ /^Workloc$/i, false],
[ /^Image$/i, false],
[ /^Sortkey$/i, false],
[ /^Homecat$/i, false],
[ /^Linkback$/i, false],
[ /^Lifespan$/i, false],
[ /^Type$/i, false],
[ /^References$/i, false],
[ /^Option$/i, false],
];

mw.libs.WikiSyntaxTextMod.config.mod.template  =  [
   { detect: { title:  "[Ii]nformation" },
     clear:  [ ["^(other( |_)fields)$", false] ],
     rename: { title:  [true, "Information"],
               params: templateInformation
     },
     format: {
     	order: templateInformation,
     	style: {
     		indent: 1,
     		lastline: true,
     		later: true,
     		leap: false,
     		leave: true,
     		linebreak: true,
     		lineup: true
     	}
     }
   },
   { detect: { title:  "[Aa]rtwork" },
     clear:  [ ["^(author|Author)$", false] ],
     rename: { title:  [true, "Artwork"],
               params: templateArtwork
     },
     format: {
     	order: templateArtworkOrder,
     	style: {
     		indent: 1,
     		lastline: true,
     		later: true,
     		leap: false,
     		leave: true,
     		linebreak: true,
     		lineup: true
     	}
     }
   },
   { detect: { title:  "[Cc]ategory definition: Object" },
     clear:  [ ["^(author|Author)$", false] ],
     rename: { title:  [true, "Category definition: Object"],
               params: templateArtwork
     },
     format: {
//     	order: templateArtwork,
     	style: {
     		indent: 1,
     		lastline: true,
     		later: true,
     		leap: false,
     		leave: true,
     		linebreak: true,
     		lineup: true
     	}
     }
   },
   { detect: { title:  "[Aa]rt [Pp]hoto" },
     clear:  [ ["^(author|Author)$", false] ],
     rename: { title:  [true, "Art Photo"],
               params: templateArtwork
     },
     format: {
     	order: templateArtPhotoOrder,
     	style: {
     		indent: 1,
     		lastline: true,
     		later: true,
     		leap: false,
     		leave: true,
     		linebreak: true,
     		lineup: true
     	}
     }
   },
   { detect: { title:  "[Cc]reator" },
     clear: templateCreator,
     format: {
     	order: templateCreatorOrder,
     	style: {
     		indent: 1,
     		lastline: true,
     		later: true,
//     		leap: false,
     		leave: true,
     		linebreak: true,
     		lineup: true
     	}
     }
   },
                                                    ];
// syntax: [[:de:Benutzer:PerfektesChaos/js/WikiSyntaxTextMod/usage/replace/template]]

mw.loader.load("https://en.wikipedia.org/w/index.php?title=User:PerfektesChaos/js/WikiSyntaxTextMod/r.js&action=raw&bcache=1&maxage=604800&ctype=text/javascript",
               "text/javascript");
               
//<nowiki>

//vFCProfil/////////////////////////////////////
/////// VISUAL FILE CHANGE CONFIGURATION ///////
///// DO NOT MODIFY BY HAND - FINGERS AWAY! ////
////////////////////////////////////////////////
window.vFC_Profiles = {"Copy and Mastery exhibition":{"editInputs":{"mdDeleteReason":"","mdEditSummary":"use [[Template:Art Photo]]; add info","mdReplacePermission":false,"mdDeleteHeading":"Files in [[:Category:Copy and Mastery]] ","mdTalkNote":"Yours sincerely,","mdRRegEx1":false,"mdRVar1":true,"mdMatchText1":"{{Information\n|description=Pergamon Museum - Copy and Mastery Exhibition\n|date=","mdReplaceText1":"== {{int:filedesc}} ==\n{{Art Photo\n |description        = \n |date               = \n |medium             = \n |institution        = {{Institution:Museum für Islamische Kunst}}\n |accession number   = \n |place of creation  = \n |exhibition history = {{Temporary Exhibition|item=Q50512014}}\n |photo description  = {{taken during| {{Temporary Exhibition|item=Q50512014}} }}\n |photo date         = ","mdRRegEx2":false,"mdRVar2":true,"mdMatchText2":"|source={{own}}\n|author=[[User:Marsupium|Marsupium]]\n|permission=|other versions=}}\n\n== {int:license-header}} ==\n{{self|cc-zero}}\n[[Category:Copy and Mastery]]\n[[Category:Photographs by User:Marsupium]]","mdReplaceText2":" |source             = {{own}}\n |photographer       = [[User:Marsupium|Marsupium]]\n |other versions     = \n}}\n\n== {{int:license-header}} ==\n{{PD-Art|PD-old-100-1923}}\n\n[[Category:Copy and Mastery]]\n[[Category:Photographs by User:Marsupium]]","mdRRegEx3":false,"mdRVar3":true,"mdMatchText3":"","mdReplaceText3":"","selPreserve":"secure","alsoPreserve":""},"action":"c_replace","objectMembers":{"queryParams":{"target":"Category:Copy and Mastery","cmdir":"asc","cmsort":"sortkey","cmstartsortkey":""},"startInput":{"mode":"Category","modeCat":true,"modeUser":false,"modePage":false,"modeSearch":false,"target":"Category:Copy and Mastery","loadThumbs":true,"loadWikitext":true,"startDate":"","startFile":""}},"proceedAt":{"vals":[],"setVals":["cmcontinue"]},"time":"2018-03-24T13:13:51.178Z"}};
//////////////////////////////////vFCProfilEnd//
//</nowiki>