Некодим логотипНекодим
МодификацииПубликацииНекодИИмЦены
Некодим логотипНекодим

© 2020-2026 Некодим

Готовые модификации для вашего сайта. Улучшайте функциональность и дизайн без программирования.

Компания

  • Контакты
  • Публичная оферта
  • Политика конфиденциальности
  • Согласие на обработку данных
  • Лицензионное соглашение
  • Реферальная программа

Полезное

  • Модификации
  • Публикации
  • Каталог блоков Tilda
  • MCP для агентов
  • Журнал изменений
  • Доска почёта

Личный кабинет

  • Вход
  • Регистрация
  • Цены
Журнал измененийИстория GitФайлыTilda MCP
Каталог файлов

tilda-tooltip-1.0.js

Код файла
Версия от 18.08.2026, 07:00:16 МСК
Оригинал на CDNСнимок 56c3b845Полный текст
1401 1402		for (var i = 1; i < arguments.length; i++) {1403			args.push(arguments[i]);1404		}1405 1406		initTooltip(elements, args);1407	};1408 1409	// init jQuery1410	if (typeof jQuery !== 'undefined') {1411		$.fn[pluginName] = function () {1412			var self = this;1413
История файла и сравнение версий
  • 18.08.2026, 07:00:16 · 56c3b845
var elements = [];
1414
1415 for (var i = 0; i < self.length; i++) {
1416 elements.push(self[i]);
1417 }
1418
1419 initTooltip(elements, arguments);
1420 };
1421 }
1422
1423 /**
1424 * Init plugin tooltip
1425 *
1426 * @param {Node} element - element init
1427 * @param {object} args - arguments options
1428 * @returns {array || Node || boolean} - return value init or not init
1429 */
1430 function initTooltip(element, args) {
1431 // for using in closures
1432 // if we are not in the context of jQuery wrapped HTML element(s) :
1433 // this happens when calling element.tooltipster('methodName or options') where element matches one or more elements
1434 if (element.length > 0) {
1435 // method calls
1436 if (typeof args[0] === 'string') {
1437 var symbols = '#*$~&';
1438
1439 for (var i = 0; i < element.length; i++) {
1440 var currentElement = element[i];
1441 var arrId;
1442
1443 arrId = currentElement['tooltipster-ns'];
1444
1445 var self = arrId && arrId[0] ? currentElement[arrId[0]] : null;
1446
1447 if (self) {
1448 if (typeof self[args[0]] === 'function') {
1449 // note : args[1] and args[2] may not be defined
1450 var resp = self[args[0]](args[1], args[2]);
1451 } else {
1452 throw new Error('Unknown method .tooltipster("' + args[0] + '")');
1453 }
1454
1455 // if the function returned anything other than the instance itself (which implies chaining)
1456 if (resp !== self) {
1457 symbols = resp;
1458 // return false to stop .each iteration on the first element matched by the selector
1459 return false;
1460 }
1461 } else {
1462 throw new Error(
1463 'You called Tooltipster\'s "' + args[0] + '" method on an uninitialized element'
1464 );
1465 }
1466 }
1467
1468 return symbols !== '#*$~&' ? symbols : element;
1469 } else {
1470 // first argument is undefined or an object : the tooltip is initializing
1471 var instances = [];
1472 // is there a defined value for the multiple option in the options object ?
1473 var multipleIsSet = args[0] && typeof args[0].multiple !== 'undefined';
1474 // if the multiple option is set to true, or if it's not defined but set to true in the defaults
1475 var multiple = (multipleIsSet && args[0].multiple) || (!multipleIsSet && defaults.multiple);
1476 // same for debug
1477 var debugIsSet = args[0] && typeof args[0].debug !== 'undefined';
1478 var debug = (debugIsSet && args[0].debug) || (!debugIsSet && defaults.debug);
1479
1480 // initialize a tooltipster instance for each element if it doesn't already have one or if the multiple option is set, and attach the object to it
1481 for (var i = 0; i < element.length; i++) {
1482 var currentElement = element[i];
1483 var isInitPlugin = false;
1484 var instance = null;
1485 var arrId = currentElement['tooltipster-ns'];
1486
1487 if (!arrId) {
1488 isInitPlugin = true;
1489 } else if (multiple) {
1490 isInitPlugin = true;
1491 } else if (debug) {
1492 // Tooltipster: one or more tooltips are already attached to this element: ignoring. Use the "multiple" option to attach more tooltips.
1493 }
1494
1495 if (isInitPlugin) {
1496 instance = new Plugin(currentElement, args[0]);
1497
1498 // save the reference of the new instance
1499 if (!arrId) arrId = [];
1500
Предыдущие 100 строкСледующие 100 строк