我一直在使用JavaScript一段時間,剛開始用Plato分析我的代碼。我不確定它是如何計算可維護性的,但代碼如下返回可維護性得分69.3。我錯過了什麼?試圖添加評論,並沒有改變。JavaScript代碼分析 - 柏拉圖的可維護性評級
/*globals jQuery*/
var App = App|| {};
App.AnimateSearch = (function ($) {
'use strict';
var searchContainer = $('[search-container]'),
emptySearchMessage = $('.empty-search-message');
function animateEmptyMessage() {
emptySearchMessage.css({
'opacity': 0,
'transform': 'scale(0.5)',
'-webkit-transform': 'scale(0.5)',
'-moz-transform': 'scale(0.5)'
});
emptySearchMessage.fadeIn().animate({
'opacity': 1,
'transform': 'scale(1)',
'-webkit-transform': 'scale(1)',
'-moz-transform': 'scale(1)'
}, 300);
}
function animateSearch(customClass) {
searchContainer = typeof customClass === 'undefined' ? searchContainer : $(customClass);
searchContainer.css({ 'margin-top': '100px', 'opacity': 0 });
setTimeout(function() {
searchContainer.stop().animate({ 'margin-top': '0', 'opacity': 1 }, 300);
}, 500);
}
return {
animateEmptyMessage: animateEmptyMessage,
animateSearch: animateSearch
};
}(jQuery));
感謝您的幫助/建議!