User:Alexis Jazz/Factotum/modules/FileTemplates.js

//Factotum module to insert common file templates if (mw.config.get('wgNamespaceNumber')==6){ if ( typeof window.FTTModules == 'undefined' ) { window.FTTModules=[]; } window.FTTModules.push({'load':['afterOpenForm'],'afterOpenFormFunc':function{ FTT.MD.fileTemplates = {}; FTT.MD.fileTemplates.int = FTT.loadedModulesInt; window.FTTModules[FTT.MD.fileTemplates.int].extraUI = new OO.ui.DropdownInputWidget({label:'File templates',options:[ {data:'',label:'File templates'}, {data:'',label:'Logo+TM+MTC'}, {data:'',label:'Information'}, {data:'',label:'Non-free rationale'}, {data:'',label:'CC BY-SA 3.0'}, {data:'',label:'CC BY-SA 4.0'}, {data:'',label:'CC BY 4.0'}, {data:'',label:'CC0'}, {data:'',label:'PD-old-70'}, {data:'',label:'PD US expired'}, {data:'',label:'PD old auto'} ]}); window.FTTModules[FTT.MD.fileTemplates.int].extraUI.on('change',function{ FTT.MD.fileTemplates.fileInsertsValue = window.FTTModules[FTT.MD.fileTemplates.int].extraUI.getValue; if (FTT.MD.fileTemplates.fileInsertsValue.match(/FTTCRT/) ) { FTT.fileInsertsBefore = FTT.MD.fileTemplates.fileInsertsValue.replace(/FTTCRT.*/,''); FTT.fileInsertsAfter = FTT.MD.fileTemplates.fileInsertsValue.replace(/.*FTTCRT/,''); } else { FTT.fileInsertsBefore = FTT.MD.fileTemplates.fileInsertsValue; FTT.fileInsertsAfter = ''; } FTT.UITextInput.encapsulateContent(FTT.fileInsertsBefore,FTT.fileInsertsAfter); }); }});} //