Revision as of 19:27, 28 February 2012 view sourceKaldari (talk | contribs)Autopatrolled, Extended confirmed users, File movers, Pending changes reviewers, Rollbackers68,434 edits using '<sup>?</sup>' for tooltips instead of '*', so people won't think they are required fields← Previous edit |
Revision as of 14:33, 15 March 2014 view source TheDJ (talk | contribs)Extended confirmed users, Template editors46,201 edits $j is deprecatedNext edit → |
Line 35: |
Line 35: |
|
var field = fieldobj.field; |
|
var field = fieldobj.field; |
|
var ad = false; |
|
var ad = false; |
|
if ($j.inArray(field, CiteTB.getOption('autodate fields')) != -1 ) { |
|
if ($.inArray(field, CiteTB.getOption('autodate fields')) != -1 ) { |
|
im = $j('<img />').attr('src', '//upload.wikimedia.org/wikipedia/commons/thumb/7/7b/Nuvola_apps_date.svg/20px-Nuvola_apps_date.svg.png'); |
|
im = $('<img />').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')); |
|
im.attr('alt', mw.usability.getMsg('cite-insert-date')).attr('title', mw.usability.getMsg('cite-insert-date')); |
|
var ad = $j('<a />').attr('href', '#'); |
|
var ad = $('<a />').attr('href', '#'); |
|
ad.append(im); |
|
ad.append(im); |
|
ad.attr('id', 'cite-date-'+CiteTB.escStr(this.shortform)+'-'+field); |
|
ad.attr('id', 'cite-date-'+CiteTB.escStr(this.shortform)+'-'+field); |
|
$j('#cite-date-'+CiteTB.escStr(this.shortform)+'-'+field).live('click', CiteTB.fillAccessdate); |
|
$('#cite-date-'+CiteTB.escStr(this.shortform)+'-'+field).live('click', CiteTB.fillAccessdate); |
|
} |
|
} |
|
|
|
|
|
if (fieldobj.autofillid) { |
|
if (fieldobj.autofillid) { |
|
var autotype = fieldobj.autofillid; |
|
var autotype = fieldobj.autofillid; |
|
im = $j('<img />').attr('src', '//upload.wikimedia.org/wikipedia/commons/thumb/1/17/System-search.svg/20px-System-search.svg.png'); |
|
im = $('<img />').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')); |
|
im.attr('alt', mw.usability.getMsg('cite-autofill-alt')).attr('title', mw.usability.getMsg('cite-autofill-alt')); |
|
var ad = $j('<a />').attr('href', '#'); |
|
var ad = $('<a />').attr('href', '#'); |
|
ad.append(im); |
|
ad.append(im); |
|
ad.attr('id', 'cite-auto-'+CiteTB.escStr(this.shortform)+'-'+field+'-'+autotype); |
|
ad.attr('id', 'cite-auto-'+CiteTB.escStr(this.shortform)+'-'+field+'-'+autotype); |
|
$j('#cite-auto-'+CiteTB.escStr(this.shortform)+'-'+field+'-'+autotype).live('click', CiteTB.initAutofill); |
|
$('#cite-auto-'+CiteTB.escStr(this.shortform)+'-'+field+'-'+autotype).live('click', CiteTB.initAutofill); |
|
} |
|
} |
|
|
|
|
|
var display = mw.usability.getMsg('cite-'+field+'-label'); |
|
var display = mw.usability.getMsg('cite-'+field+'-label'); |
|
var tooltip = fieldobj.tooltip ? $j('<abbr />').attr('title', mw.usability.getMsg(fieldobj.tooltip)).html('<sup>?</sup>') : false; |
|
var tooltip = fieldobj.tooltip ? $('<abbr />').attr('title', mw.usability.getMsg(fieldobj.tooltip)).html('<sup>?</sup>') : false; |
|
|
|
|
|
var input = ''; |
|
var input = ''; |
|
if (ad) { |
|
if (ad) { |
|
input = $j('<input tabindex="1" style="width:85%" type="text" />'); |
|
input = $('<input tabindex="1" style="width:85%" type="text" />'); |
|
} else { |
|
} else { |
|
input = $j('<input tabindex="1" style="width:100%" type="text" />'); |
|
input = $('<input tabindex="1" style="width:100%" type="text" />'); |
|
} |
|
} |
|
input.attr('id', 'cite-'+CiteTB.escStr(this.shortform)+'-'+field); |
|
input.attr('id', 'cite-'+CiteTB.escStr(this.shortform)+'-'+field); |
Line 67: |
Line 67: |
|
input.addClass('cite-'+CiteTB.escStr(this.shortform)+'-'+fieldobj.autofillprop); |
|
input.addClass('cite-'+CiteTB.escStr(this.shortform)+'-'+fieldobj.autofillprop); |
|
} |
|
} |
|
var label = $j('<label />'); |
|
var label = $('<label />'); |
|
label.attr('for', 'cite-'+CiteTB.escStr(this.shortform)+'-'+field).text(display); |
|
label.attr('for', 'cite-'+CiteTB.escStr(this.shortform)+'-'+field).text(display); |
|
if (tooltip) { |
|
if (tooltip) { |
Line 76: |
Line 76: |
|
style += ' padding-left:1em;'; |
|
style += ' padding-left:1em;'; |
|
} else { |
|
} else { |
|
var tr = $j('<tr />'); |
|
var tr = $('<tr />'); |
|
} |
|
} |
|
var td1 = $j('<td class="cite-form-td" />').attr('style', style); |
|
var td1 = $('<td class="cite-form-td" />').attr('style', style); |
|
td1.append(label); |
|
td1.append(label); |
|
tr.append(td1); |
|
tr.append(td1); |
|
var td2 = $j('<td class="cite-form-td" style="width:30%" />'); |
|
var td2 = $('<td class="cite-form-td" style="width:30%" />'); |
|
td2.append(input); |
|
td2.append(input); |
|
if (ad) { |
|
if (ad) { |
Line 97: |
Line 97: |
|
// gives a little bit of HTML so the open form can be identified |
|
// gives a little bit of HTML so the open form can be identified |
|
this.getInitial = function() { |
|
this.getInitial = function() { |
|
var hidden = $j('<input type="hidden" class="cite-template" />'); |
|
var hidden = $('<input type="hidden" class="cite-template" />'); |
|
hidden.val(this.templatename); |
|
hidden.val(this.templatename); |
|
return hidden; |
|
return hidden; |
Line 104: |
Line 104: |
|
// makes the form used in the dialog boxes |
|
// makes the form used in the dialog boxes |
|
this.getForm = function() { |
|
this.getForm = function() { |
|
var main = $j("<div class='cite-form-container' />"); |
|
var main = $("<div class='cite-form-container' />"); |
|
var form1 = $j('<table style="width:100%; background-color:transparent;" class="cite-basic-fields" />'); |
|
var form1 = $('<table style="width:100%; background-color:transparent;" class="cite-basic-fields" />'); |
|
var i=0; |
|
var i=0; |
|
var trs = this.makeFormInner(this.basic); |
|
var trs = this.makeFormInner(this.basic); |
Line 112: |
Line 112: |
|
} |
|
} |
|
|
|
|
|
var form2 = $j('<table style="width:100%; background-color:transparent; display:none" class="cite-extra-fields">'); |
|
var form2 = $('<table style="width:100%; background-color:transparent; display:none" class="cite-extra-fields">'); |
|
trs = this.makeFormInner(this.extra); |
|
trs = this.makeFormInner(this.extra); |
|
for (var i=0; i<trs.length; i++) { |
|
for (var i=0; i<trs.length; i++) { |
Line 119: |
Line 119: |
|
main.append(form1).append(form2); |
|
main.append(form1).append(form2); |
|
|
|
|
|
var form3 = $j('<table style="width:100%; background-color:transparent;padding-top:1em" class="cite-other-fields">'); |
|
var form3 = $('<table style="width:100%; background-color:transparent;padding-top:1em" class="cite-other-fields">'); |
|
var tr = $j('<tr />'); |
|
var tr = $('<tr />'); |
|
var td1 = $j('<td class="cite-form-td" style="text-align:right; width:20%" />'); |
|
var td1 = $('<td class="cite-form-td" style="text-align:right; width:20%" />'); |
|
var label1 = $j('<label />'); |
|
var label1 = $('<label />'); |
|
label1.attr('for', "cite-"+CiteTB.escStr(this.shortform)+'-name').text(mw.usability.getMsg('cite-name-label')); |
|
label1.attr('for', "cite-"+CiteTB.escStr(this.shortform)+'-name').text(mw.usability.getMsg('cite-name-label')); |
|
td1.append(label1); |
|
td1.append(label1); |
|
var td2 = $j('<td class="cite-form-td" style="width:30%" />'); |
|
var td2 = $('<td class="cite-form-td" style="width:30%" />'); |
|
var input1 = $j('<input tabindex="1" style="width:100%" type="text" />'); |
|
var input1 = $('<input tabindex="1" style="width:100%" type="text" />'); |
|
input1.attr('id', 'cite-'+CiteTB.escStr(this.shortform)+'-name'); |
|
input1.attr('id', 'cite-'+CiteTB.escStr(this.shortform)+'-name'); |
|
td2.append(input1); |
|
td2.append(input1); |
|
var td3 = $j('<td class="cite-form-td" style="text-align:right; padding-left:1em; width:20%">'); |
|
var td3 = $('<td class="cite-form-td" style="text-align:right; padding-left:1em; width:20%">'); |
|
var label2 = $j('<label />'); |
|
var label2 = $('<label />'); |
|
label2.attr('for', 'cite-'+CiteTB.escStr(this.shortform)+'-group').text(mw.usability.getMsg('cite-group-label')); |
|
label2.attr('for', 'cite-'+CiteTB.escStr(this.shortform)+'-group').text(mw.usability.getMsg('cite-group-label')); |
|
td3.append(label2); |
|
td3.append(label2); |
|
var td4 = $j('<td class="cite-form-td" style="width:30%" />'); |
|
var td4 = $('<td class="cite-form-td" style="width:30%" />'); |
|
var input2 = $j('<input tabindex="1" style="width:100%" type="text" />'); |
|
var input2 = $('<input tabindex="1" style="width:100%" type="text" />'); |
|
input2.attr('id', 'cite-'+CiteTB.escStr(this.shortform)+'-group'); |
|
input2.attr('id', 'cite-'+CiteTB.escStr(this.shortform)+'-group'); |
|
td4.append(input2); |
|
td4.append(input2); |
Line 140: |
Line 140: |
|
form3.append(tr); |
|
form3.append(tr); |
|
main.append(form3); |
|
main.append(form3); |
|
var extras = $j('<div />'); |
|
var extras = $('<div />'); |
|
extras.append('<input type="hidden" class="cite-form-status" value="closed" />'); |
|
extras.append('<input type="hidden" class="cite-form-status" value="closed" />'); |
|
var hidden = $j('<input type="hidden" class="cite-template" />'); |
|
var hidden = $('<input type="hidden" class="cite-template" />'); |
|
hidden.val(this.templatename); |
|
hidden.val(this.templatename); |
|
extras.append(hidden); |
|
extras.append(hidden); |
|
var span1 = $j('<span class="cite-preview-label" style="display:none;" />'); |
|
var span1 = $('<span class="cite-preview-label" style="display:none;" />'); |
|
span1.text(mw.usability.getMsg('cite-raw-preview')); |
|
span1.text(mw.usability.getMsg('cite-raw-preview')); |
|
extras.append(span1).append('<div class="cite-ref-preview" style="padding:0.5em; font-size:110%" />'); |
|
extras.append(span1).append('<div class="cite-ref-preview" style="padding:0.5em; font-size:110%" />'); |
|
var span2 = $j('<span class="cite-prev-parsed-label" style="display:none;" />'); |
|
var span2 = $('<span class="cite-prev-parsed-label" style="display:none;" />'); |
|
span2.text(mw.usability.getMsg('cite-parsed-label')); |
|
span2.text(mw.usability.getMsg('cite-parsed-label')); |
|
extras.append(span2).append('<div class="cite-preview-parsed" style="padding-bottom:0.5em; font-size:110%" />'); |
|
extras.append(span2).append('<div class="cite-preview-parsed" style="padding-bottom:0.5em; font-size:110%" />'); |
|
var link = $j('<a href="#" class="cite-prev-parse" style="margin:0 1em 0 1em; display:none; color:darkblue" />'); |
|
var link = $('<a href="#" class="cite-prev-parse" style="margin:0 1em 0 1em; display:none; color:darkblue" />'); |
|
link.text(mw.usability.getMsg('cite-form-parse')); |
|
link.text(mw.usability.getMsg('cite-form-parse')); |
|
extras.append(link); |
|
extras.append(link); |
Line 207: |
Line 207: |
|
|
|
|
|
this.getRow = function() { |
|
this.getRow = function() { |
|
var row = $j("<li />"); |
|
var row = $("<li />"); |
|
var check = $j("<input type='checkbox' name='cite-err-test' />"); |
|
var check = $("<input type='checkbox' name='cite-err-test' />"); |
|
check.attr('value', this.obj.testname); |
|
check.attr('value', this.obj.testname); |
|
var label = $j("<label />").html(mw.usability.getMsg(this.obj.desc)); |
|
var label = $("<label />").html(mw.usability.getMsg(this.obj.desc)); |
|
label.attr('for', this.obj.testname); |
|
label.attr('for', this.obj.testname); |
|
row.append(check).append(' – ').append(label); |
|
row.append(check).append(' – ').append(label); |
Line 216: |
Line 216: |
|
} |
|
} |
|
} |
|
} |
|
$j('head').trigger('reftoolbarbase'); |
|
$('head').trigger('reftoolbarbase'); |