Commit f27c4145e13a12476ae3b7cee4ee575437aadaa9
- Diff rendering mode:
- inline
- side by side
swtr/static/js/swtmaker.js
(20 / 2)
  | |||
492 | 492 | // create the text to displayed for each annotation from the other | |
493 | 493 | // attributes of the sweet/annotation | |
494 | 494 | createPopupText: function(annotation) { | |
495 | // title | ||
495 | 496 | var text = (annotation.title) ? '<h4>' + annotation.title + '</h4>' : ''; | |
497 | |||
498 | // comment | ||
496 | 499 | text += (annotation.comment) ? '<p>' + annotation.comment + '</p>' : ''; | |
497 | text += (annotation.link) ? '<p>' + annotation.link + '</p>' : ''; | ||
500 | |||
501 | // link | ||
502 | text += (annotation.link) ? '<a target="blank" href="' + | ||
503 | swtr.utils.linkify(annotation.link) + '">' + annotation.link + | ||
504 | '</a>' : ''; | ||
505 | |||
506 | // tags | ||
498 | 507 | text += (annotation.tags) ? '<p>' + annotation.tags + '</p>' : ''; | |
499 | 508 | ||
500 | 509 | // if older annotation i.e w/o comment,title etc fields | |
… | … | ||
572 | 572 | }); | |
573 | 573 | ||
574 | 574 | // utilities and helper functions to go here | |
575 | swtr.utils = {}; | ||
575 | swtr.utils = { | ||
576 | linkify: function(link) { | ||
577 | if(link.match('http')) { | ||
578 | return link; | ||
579 | } | ||
580 | else { | ||
581 | return 'http://' + link; | ||
582 | } | ||
583 | } | ||
584 | }; | ||
576 | 585 | ||
577 | 586 | //swtr.AppView = AppView; | |
578 | 587 |