我必须通过一些代码并找到以下功能,我不明白。什么是hintContainer,它获取each() 的返回值,并且似乎这个对象应该放在回调函数中?
提前感谢您的任何猜测,不幸的是我无法联系开发人员。简而言之,该函数应该使用类 userHinterPanel 抓取所有 div 并显示它们。
function prepareHintMessages() {
// gets all userHintePanels
var hintContainer = jQuery('div.userHintPanel').each(function() {
hintContainer = jQuery(this);
// hint content div
var hintContent = hintContainer.next();
// hint content text
var closeText = hintContainer.find('div.closeTextContainer');
// inserts text into the content container
hintContent.insertBefore(closeText);
// show the complete hint panel
hintContainer.parent().show();
});
}
更新 HTML 片段,这是信息框:
<form id="form" name="form" method="post"
action="xxx.jsf"
enctype="application/x-www-form-urlencoded" class="newPatientForm">
<div id="form_showAllHintsContainer" class="showAllHintsContainer"
onclick="jQuery('#form_showAllUserHints').click();"
title="Alle verfügbaren Hinweise auf dieser Seite einblenden">
?<input class="hidden" id="form_showAllUserHints"
name="form_showAllUserHints"
onclick="A4J.AJAX.Submit('form',event,{'oncomplete':function(request,event,data){prepareHintMessages();},'similarityGroupingId':'form_showAllUserHints','parameters':{'userPrefActionParamShow':'NEW_PATIENT_HINT','form_showAllUserHints':'form_showAllUserHints'} } );return false;"
value="showUserHints" type="button" />
</div>
<div class="generalPadding">
<div id="form_hintRerenderContainer">
<div id="form_newPatientHintWithIsh"
class="userHintPanelContainer newPatient">
<div id="form_newPatientHintWithIshHintPanel"
class="alert-message block-message warning userHintPanel">
<a href="#" onclick="closeHintMessage(this);"
title="Hinweis ausblenden" class="close">×</a>
<div class="header">Hinweis</div>
<div class="text">
<div class="closeTextContainer"
style="position: relative; height: 20px;">
<a href="#" onclick="closeHintMessage(this);"
style="font-size: 14px;" class="close"> Hinweis ausblenden</a>
</div>
</div>
<input class="hidden hideHintButton"
id="form_newPatientHintWithIshHintPanelHideButton"
name="form_newPatientHintWithIshHintPanelHideButton"
onclick="A4J.AJAX.Submit('form',event,{'similarityGroupingId':'form_newPatientHintWithIshHintPanelHideButton','parameters':{'form_newPatientHintWithIshHintPanelHideButton':'form_newPatientHintWithIshHintPanelHideButton','userPrefActionParam':'NEW_PATIENT_HINT'} } );return false;"
value="hideUserHints" type="button" />
</div>
<div class="hintContent">
<ul>...</ul>
</div>
</div>
</div>