// Global object if (typeof CiteTB == 'undefined') { var CiteTB = { "Templates" : {}, // All templates "Options" : {}, // Global options "UserOptions" : {}, // User options "DefaultOptions" : {}, // Script defaults "ErrorChecks" : {} // Error check functions }; } if (typeof mw.usability == 'undefined') { mw.usability = {}; mw.usability.getMsg = function(m) { return mw.messages.get(m); } mw.usability.addMessages = function(msgs) { mw.messages.set(msgs); }; } // Object for cite templates function citeTemplate(templatename, shortform, basicfields, expandedfields) { // Properties this.templatename = templatename; // The template name - "cite web", "cite book", etc. this.shortform = shortform; // A short form, used for the dropdown box this.basic = basicfields; // Basic fields - author, title, publisher... // Less common - quote, archiveurl - should be everything the template supports minus the basic ones this.extra = expandedfields; // Add it to the list CiteTB.Templates[this.templatename] = this; // Methods this.makeFormInner = function(fields) { var i=0; var trs = new Array(); for (i=0; i').attr('src', '//upload.wikimedia.org/wikipedia/commons/thumb/7/7b/Nuvola_apps_date.svg/20px-Nuvola_apps_date.svg.png'); im.attr('alt', mw.usability.getMsg('cite-insert-date')).attr('title', mw.usability.getMsg('cite-insert-date')); var ad = $j('').attr('href', '#'); ad.append(im); ad.attr('id', 'cite-date-'+CiteTB.escStr(this.shortform)+'-'+field); $j('#cite-date-'+CiteTB.escStr(this.shortform)+'-'+field).live('click', CiteTB.fillAccessdate); } if (fieldobj.autofillid) { var autotype = fieldobj.autofillid; im = $j('').attr('src', '//upload.wikimedia.org/wikipedia/commons/thumb/1/17/System-search.svg/20px-System-search.svg.png'); im.attr('alt', mw.usability.getMsg('cite-autofill-alt')).attr('title', mw.usability.getMsg('cite-autofill-alt')); var ad = $j('').attr('href', '#'); ad.append(im); ad.attr('id', 'cite-auto-'+CiteTB.escStr(this.shortform)+'-'+field+'-'+autotype); $j('#cite-auto-'+CiteTB.escStr(this.shortform)+'-'+field+'-'+autotype).live('click', CiteTB.initAutofill); } var display = mw.usability.getMsg('cite-'+field+'-label'); var tooltip = fieldobj.tooltip ? $j('').attr('title', mw.usability.getMsg(fieldobj.tooltip)).html('?') : false; var input = ''; if (ad) { input = $j(''); } else { input = $j(''); } input.attr('id', 'cite-'+CiteTB.escStr(this.shortform)+'-'+field); if (fieldobj.autofillprop) { input.addClass('cite-'+CiteTB.escStr(this.shortform)+'-'+fieldobj.autofillprop); } var label = $j('