מדיה ויקי:Gadget-TemplateParamWizard.js: הבדלים בין גרסאות בדף
←using [[mw:CodeEditor|CodeEditor]]: שמות הפרמטרים בכתב מודגש; צביעת פרמטרים עם רמז בכחול. |
←using [[mw:CodeEditor|CodeEditor]]: אפשרות לקוד ויקי בטולטיפים. |
||
| שורה 246: | שורה 246: | ||
} | } | ||
var | |||
timer = null, | |||
lastVisited = $('<a>'); | |||
function enterTipsy() { | |||
clearTimeout(timer); | |||
$(this).attr('inside', 1); | |||
} | |||
function leaveTipsy() { | |||
var $this = $(this); | |||
if ($this.attr('master') || $this.attr('inside')) { | |||
$this.attr('inside', ''); | |||
timer = setTimeout(function(){lastVisited.tipsy('hide');}, 500); | |||
} | |||
} | |||
function addRow(paramName, table) { | function addRow(paramName, table) { | ||
function tipsyContent() { | function tipsyContent() { | ||
var desc = templateParams[$(this).text()].desc || ''; | |||
if (/[\[\]\{\}\<\>]/.test(desc)) // does it need parsing? | |||
$.ajax({ | |||
url: mw.util.wikiScript('api'), | |||
async: false, | |||
type: 'post', | |||
data: {action: 'parse', text: desc, disablepp: 1, format: 'json'}, // parse it. | |||
success: function(data) { | |||
var div = $('<div>').html(data.parse.text['*']); | |||
$('a', div).attr({target: '_blank'}); | |||
desc = div.html(); | |||
} | |||
}) | |||
return desc; | |||
}; | |||
var inputField = createInputField(paramName), | var inputField = createInputField(paramName), | ||
tr = $('<tr>') | tr = $('<tr>') | ||
.append( | |||
$('<td>', {width: 120}) | |||
.css({fontWeight: 'bold', color: templateParams[paramName].desc ? 'blue' : 'black'}) | |||
.text(paramName) | |||
.tipsy({html: true, trigger: 'manual', title: tipsyContent}) | |||
.mouseenter(function() { | |||
clearTimeout(timer); | |||
$('.tipsy').remove(); | |||
lastVisited = $(this); | |||
lastVisited.tipsy('show'); | |||
}) | |||
.mouseleave(leaveTipsy) | |||
.attr('master', 'true') | |||
) | |||
.append($('<td>').css({width: '30em'}).append(inputField)); | |||
dialogFields.push([paramName, inputField]); | dialogFields.push([paramName, inputField]); | ||
table.append(tr); | table.append(tr); | ||
| שורה 297: | שורה 337: | ||
circumventRtlBug(); | circumventRtlBug(); | ||
updateRawPreview(); | updateRawPreview(); | ||
$('.tipsy') | |||
.live('mouseenter', enterTipsy) | |||
.live('mouseleave', leaveTipsy); | |||
} | } | ||