У меня есть следующий jquery, который я хотел бы преобразовать в прототип. У меня возникли реальные проблемы с его работой, потому что я не могу понять, как правильно его инициализировать в приложении rails.
$(document).ready(function(){
/*** Search label ***/
htmlinput = $("input#panel-search").val() /* picks the inital value of the input (in the html) */
$("input#panel-search").css('color','#aeaeae').css('font-style','italic').css('font-weight','bold');
$("input#panel-search").focus(function(){ /* on focus.. */
curinput = $(this).val() /* picks the -current- value */
if(curinput == htmlinput){ /* if the current value corrispond to the initial value (htmlinput var) */
$(this).val(''); /* empty the input */
$(this).css('color','black').css('font-style', 'normal').css('font-weight','normal');
}
});
$("input#panel-search").blur(function(){ /* on blur */
curinput = $(this).val();
if(curinput == ''){ /* if the current value is null .. */
$(this).css('color','#aeaeae').css('font-style','italic').css('font-weight','bold');
$(this).val(htmlinput); /* sets the value with its inital value (htmlinput var) */
}
})
/* Main Navigation hover effect */
$("ul#navigation li:not('.current'), ul#navigation li:not('highlighted')").hover(
function () {
$(this).addClass("hover");
},
function () {
$(this).removeClass("hover");
}
);
/* Right Menu hover effect */
$("ul#fast-links li:not('.current')").hover(
function () {
$(this).addClass("current");
},
function () {
$(this).removeClass("current");
}
);
});
Любая помощь будет высоко ценится.