Mercurial > projects > booket
comparison booket.js @ 3:4786df0aec03
Display URL and hostname
Display the hostname after the title and the full URL below it
author | Guido Berhoerster <guido+booket@berhoerster.name> |
---|---|
date | Mon, 08 Sep 2014 20:01:41 +0200 |
parents | 82c50265c8dc |
children | 39c95b9826d2 |
comparison
equal
deleted
inserted
replaced
2:82c50265c8dc | 3:4786df0aec03 |
---|---|
1029 | 1029 |
1030 BookmarkView.prototype.onBookmarkAdded = function (bookmark) { | 1030 BookmarkView.prototype.onBookmarkAdded = function (bookmark) { |
1031 var newNode; | 1031 var newNode; |
1032 var bookmarkElement; | 1032 var bookmarkElement; |
1033 var linkElement; | 1033 var linkElement; |
1034 var hostnameElement; | |
1035 var urlElement; | |
1034 var ctimeElement; | 1036 var ctimeElement; |
1035 var mtimeElement; | 1037 var mtimeElement; |
1036 var tagListElement; | 1038 var tagListElement; |
1037 | 1039 |
1038 newNode = document.importNode(this.bookmarkTemplate.content, true); | 1040 newNode = document.importNode(this.bookmarkTemplate.content, true); |
1041 bookmarkElement.dataset.bookmarkUrl = bookmark.url; | 1043 bookmarkElement.dataset.bookmarkUrl = bookmark.url; |
1042 | 1044 |
1043 linkElement = bookmarkElement.querySelector('a.bookmark-link'); | 1045 linkElement = bookmarkElement.querySelector('a.bookmark-link'); |
1044 linkElement.textContent = linkElement.title = bookmark.title; | 1046 linkElement.textContent = linkElement.title = bookmark.title; |
1045 linkElement.href = bookmark.url; | 1047 linkElement.href = bookmark.url; |
1048 | |
1049 hostnameElement = bookmarkElement.querySelector('.bookmark-hostname'); | |
1050 hostnameElement.textContent = (linkElement.hostname !== '') ? | |
1051 '[' + linkElement.hostname + ']' : ''; | |
1052 | |
1053 urlElement = bookmarkElement.querySelector('.bookmark-url'); | |
1054 urlElement.textContent = bookmark.url; | |
1046 | 1055 |
1047 ctimeElement = bookmarkElement.querySelector('.ctime'); | 1056 ctimeElement = bookmarkElement.querySelector('.ctime'); |
1048 ctimeElement.dateTime = bookmark.ctime.toISOString(); | 1057 ctimeElement.dateTime = bookmark.ctime.toISOString(); |
1049 ctimeElement.textContent = bookmark.ctime.toString(); | 1058 ctimeElement.textContent = bookmark.ctime.toString(); |
1050 | 1059 |