()
| 1386 | .join(',') |
| 1387 | |
| 1388 | function tooltipster () { |
| 1389 | let tipped = $(TIP_SELECTOR) |
| 1390 | tipped.tooltipster({ |
| 1391 | updateAnimation: false, |
| 1392 | contentAsHTML: true, |
| 1393 | debug: false, |
| 1394 | delay: cardOptions.delay, |
| 1395 | side: cardOptions.side || 'top', |
| 1396 | // trigger: 'click', |
| 1397 | zIndex: 2147483646, |
| 1398 | functionBefore(self, event) { |
| 1399 | let elem = $(event.origin) |
| 1400 | elem.tooltipster('content', $('<span class="loading"></span>')) |
| 1401 | let type = elem.data(TYPE_KEY) |
| 1402 | let value = elem.data(VALUE_KEY) |
| 1403 | |
| 1404 | let raw = cache[type][value] |
| 1405 | if (raw && type !== EXTRACT_TYPE.USER) { |
| 1406 | elem.tooltipster('content', getCardContent(type, raw, elem)) |
| 1407 | } else { |
| 1408 | if (raw && type === EXTRACT_TYPE.USER) { |
| 1409 | let subject = getHovercardSubject() || {} |
| 1410 | // '@' for contextless |
| 1411 | let subjectSlug = subject ? `${subject.type}:${subject.id}` : '@' |
| 1412 | if (cache.hovercard[value] && cache.hovercard[value][subjectSlug]) { |
| 1413 | Object.assign(raw, { |
| 1414 | hovercard: cache.hovercard[value][subjectSlug] |
| 1415 | }) |
| 1416 | elem.tooltipster('content', getCardContent(type, raw, elem)) |
| 1417 | return |
| 1418 | } |
| 1419 | } |
| 1420 | |
| 1421 | let apiPath |
| 1422 | switch (type) { |
| 1423 | case EXTRACT_TYPE.USER: |
| 1424 | apiPath = `users/${value}` |
| 1425 | break |
| 1426 | case EXTRACT_TYPE.REPO: |
| 1427 | apiPath = `repos/${value}` |
| 1428 | break |
| 1429 | case EXTRACT_TYPE.ISSUE: { |
| 1430 | let [fullRepo, issue] = value.split('#') |
| 1431 | apiPath = `repos/${fullRepo}/issues/${issue}` |
| 1432 | break |
| 1433 | } |
| 1434 | case EXTRACT_TYPE.COMMENT: { |
| 1435 | let [fullRepo, comment] = value.split(':') |
| 1436 | apiPath = `repos/${fullRepo}/issues/comments/${comment}` |
| 1437 | break |
| 1438 | } |
| 1439 | case EXTRACT_TYPE.COMMIT: { |
| 1440 | let values = value.split('@') |
| 1441 | let fullRepo = values[0] |
| 1442 | let commit = values[1] |
| 1443 | apiPath = `repos/${fullRepo}/commits/${commit}` |
| 1444 | break |
| 1445 | } |
nothing calls this directly
no outgoing calls
no test coverage detected