本文整理匯總了TypeScript中jQuery.default函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript default函數的具體用法?TypeScript default怎麽用?TypeScript default使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了default函數的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: it
it("should default with no messages", () => {
expect($(element).find("p").length).toEqual(0);
});
示例2: function
$('#bewerk-melding').slideUp(200, function () {
$(this).remove();
});
示例3: setTimeout
link: ($scope, elem, attrs) => {
const $input = $(inputTemplate);
const $button = $(buttonTemplate);
$input.appendTo(elem);
$button.appendTo(elem);
if (attrs.linkText) {
$button.html(attrs.linkText);
}
if (attrs.ngModel) {
$scope.$watch('model', newValue => {
_.each($scope.menuItems, item => {
_.each(item.submenu, subItem => {
if (subItem.value === newValue) {
$button.html(subItem.text);
}
});
});
});
}
const typeaheadValues = _.reduce(
$scope.menuItems,
(memo, value, index) => {
if (!value.submenu) {
value.click = 'menuItemSelected(' + index + ')';
memo.push(value.text);
} else {
_.each(value.submenu, (item, subIndex) => {
item.click = 'menuItemSelected(' + index + ',' + subIndex + ')';
memo.push(value.text + ' ' + item.text);
});
}
return memo;
},
[]
);
$scope.menuItemSelected = (index, subIndex) => {
const menuItem = $scope.menuItems[index];
const payload: any = { $item: menuItem };
if (menuItem.submenu && subIndex !== void 0) {
payload.$subItem = menuItem.submenu[subIndex];
}
$scope.dropdownTypeaheadOnSelect(payload);
};
$input.attr('data-provide', 'typeahead');
$input.typeahead({
source: typeaheadValues,
minLength: 1,
items: 10,
updater: value => {
const result: any = {};
_.each($scope.menuItems, menuItem => {
_.each(menuItem.submenu, submenuItem => {
if (value === menuItem.text + ' ' + submenuItem.text) {
result.$subItem = submenuItem;
result.$item = menuItem;
}
});
});
if (result.$item) {
$scope.$apply(() => {
$scope.dropdownTypeaheadOnSelect(result);
});
}
$input.trigger('blur');
return '';
},
});
$button.click(() => {
$button.hide();
$input.show();
$input.focus();
});
$input.keyup(() => {
elem.toggleClass('open', $input.val() === '');
});
$input.blur(() => {
$input.hide();
$input.val('');
$button.show();
$button.focus();
// clicking the function dropdown menu won't
// work if you remove class at once
setTimeout(() => {
elem.removeClass('open');
}, 200);
});
$compile(elem.contents())($scope);
},
示例4: function
$.get(root_path + 'templates/custom_menu.mst', function(template) {
$('.content .messages').html( template );
});
示例5: setKeggPathwaySearch
/**
* set the search box to search by KEGG pathway
* @returns {void}
*/
function setKeggPathwaySearch(): void
{
initKeggPathwayList($('#searchBox'), (event, keggObj) => {
drawCompleteGraph(keggObj, 'kegg_pathways');
}, _.noop);
}
示例6: updateHighlighting
updateHighlighting(() => {
clearHighlighting();
$(e.target).addClass('active');
});
示例7: checkForInActiveUser
link: (scope, elem) => {
var ignoreSideMenuHide;
var body = $('body');
// see https://github.com/zenorocha/clipboard.js/issues/155
$.fn.modal.Constructor.prototype.enforceFocus = function() {};
// handle sidemenu open state
scope.$watch('contextSrv.sidemenu', newVal => {
if (newVal !== undefined) {
body.toggleClass('sidemenu-open', scope.contextSrv.sidemenu);
if (!newVal) {
contextSrv.setPinnedState(false);
}
}
if (contextSrv.sidemenu) {
ignoreSideMenuHide = true;
setTimeout(() => {
ignoreSideMenuHide = false;
}, 300);
}
});
scope.$watch('contextSrv.pinned', newVal => {
if (newVal !== undefined) {
body.toggleClass('sidemenu-pinned', newVal);
}
});
// tooltip removal fix
// manage page classes
var pageClass;
scope.$on("$routeChangeSuccess", function(evt, data) {
if (pageClass) {
body.removeClass(pageClass);
}
if (data.$$route) {
pageClass = data.$$route.pageClass;
if (pageClass) {
body.addClass(pageClass);
}
}
$("#tooltip, .tooltip").remove();
// check for kiosk url param
if (data.params.kiosk) {
appEvents.emit('toggle-kiosk-mode');
}
// close all drops
for (let drop of Drop.drops) {
drop.destroy();
}
});
// handle kiosk mode
appEvents.on('toggle-kiosk-mode', () => {
body.toggleClass('page-kiosk-mode');
});
// handle in active view state class
var lastActivity = new Date().getTime();
var activeUser = true;
var inActiveTimeLimit = 60 * 1000;
function checkForInActiveUser() {
if (!activeUser) {
return;
}
// only go to activity low mode on dashboard page
if (!body.hasClass('page-dashboard')) {
return;
}
if ((new Date().getTime() - lastActivity) > inActiveTimeLimit) {
activeUser = false;
body.addClass('user-activity-low');
}
}
function userActivityDetected() {
lastActivity = new Date().getTime();
if (!activeUser) {
activeUser = true;
body.removeClass('user-activity-low');
}
}
// mouse and keyboard is user activity
body.mousemove(userActivityDetected);
body.keydown(userActivityDetected);
// treat tab change as activity
document.addEventListener('visibilitychange', userActivityDetected);
// check every 2 seconds
setInterval(checkForInActiveUser, 2000);
appEvents.on('toggle-view-mode', () => {
//.........這裏部分代碼省略.........
示例8: onclose
onclose() {
if ($('.modal-backdrop').length > 0) {
D.body.addClass('modal-open');
}
}
示例9: if
link: (scope, element) => {
const event = scope.event;
let title = event.title;
let text = event.text;
const dashboard = dashboardSrv.getCurrent();
let tooltip = '<div class="graph-annotation">';
let titleStateClass = '';
if (event.alertId) {
const stateModel = alertDef.getStateDisplayModel(event.newState);
titleStateClass = stateModel.stateClass;
title = `<i class="icon-gf ${stateModel.iconClass}"></i> ${stateModel.text}`;
text = alertDef.getAlertAnnotationInfo(event);
if (event.text) {
text = text + '<br />' + event.text;
}
} else if (title) {
text = title + '<br />' + (_.isString(text) ? text : '');
title = '';
}
let header = `<div class="graph-annotation__header">`;
if (event.login) {
header += `<div class="graph-annotation__user" bs-tooltip="'Created by ${event.login}'"><img src="${
event.avatarUrl
}" /></div>`;
}
header += `
<span class="graph-annotation__title ${titleStateClass}">${sanitizeString(title)}</span>
<span class="graph-annotation__time">${dashboard.formatDate(event.min)}</span>
`;
// Show edit icon only for users with at least Editor role
if (event.id && dashboard.meta.canEdit) {
header += `
<span class="pointer graph-annotation__edit-icon" ng-click="onEdit()">
<i class="fa fa-pencil-square"></i>
</span>
`;
}
header += `</div>`;
tooltip += header;
tooltip += '<div class="graph-annotation__body">';
if (text) {
tooltip += '<div>' + sanitizeString(text.replace(/\n/g, '<br>')) + '</div>';
}
const tags = event.tags;
if (tags && tags.length) {
scope.tags = tags;
tooltip +=
'<span class="label label-tag small" ng-repeat="tag in tags" tag-color-from-name="tag">{{tag}}</span><br/>';
}
tooltip += '</div>';
tooltip += '</div>';
const $tooltip = $(tooltip);
$tooltip.appendTo(element);
$compile(element.contents())(scope);
},