[TASK] Href with working links
This commit is contained in:
		
							parent
							
								
									66f09a2e32
								
							
						
					
					
						commit
						e8ff43c6a7
					
				| @ -18,7 +18,7 @@ define(['helper'], function (helper) { | ||||
|     var a1; | ||||
|     if (!unknown) { | ||||
|       a1 = document.createElement('a'); | ||||
|       a1.href = '#'; | ||||
|       a1.href = router.getUrl({ n: d.source.node_id }); | ||||
|       a1.onclick = router.node(d.source.node); | ||||
|     } else { | ||||
|       a1 = document.createElement('span'); | ||||
| @ -31,7 +31,7 @@ define(['helper'], function (helper) { | ||||
|     h2.appendChild(arrow); | ||||
| 
 | ||||
|     var a2 = document.createElement('a'); | ||||
|     a2.href = '#'; | ||||
|     a2.href = router.getUrl({ n: d.target.node_id }); | ||||
|     a2.onclick = router.node(d.target.node); | ||||
|     a2.textContent = d.target.node.nodeinfo.hostname; | ||||
|     h2.appendChild(a2); | ||||
|  | ||||
| @ -175,7 +175,7 @@ define(['chroma-js', 'moment', 'tablesort', 'helper'], | ||||
|         return undefined; | ||||
|       } | ||||
| 
 | ||||
|       return au.enabled ? _.t('node.activated', {branch: au.branch}) : _.t('node.deactivated'); | ||||
|       return au.enabled ? _.t('node.activated', { branch: au.branch }) : _.t('node.deactivated'); | ||||
|     } | ||||
| 
 | ||||
|     function showStatImg(o, d) { | ||||
| @ -286,7 +286,7 @@ define(['chroma-js', 'moment', 'tablesort', 'helper'], | ||||
|             var a1 = document.createElement('a'); | ||||
|             a1.textContent = n.node.nodeinfo.hostname; | ||||
|             a1.classList.add('online'); | ||||
|             a1.href = '#'; | ||||
|             a1.href = router.getUrl({ n: n.node.nodeinfo.node_id }); | ||||
|             a1.onclick = router.node(n.node); | ||||
|             td2.appendChild(a1); | ||||
|           } else { | ||||
|  | ||||
| @ -16,9 +16,9 @@ define(['helper'], function (helper) { | ||||
|         return n.flags.gateway; | ||||
|       }).map(helper.one)); | ||||
| 
 | ||||
|       stats.textContent = _.t('sidebar.nodes', {total: totalNodes, online: totalOnlineNodes}) + ' ' + | ||||
|         _.t('sidebar.clients', {smart_count: totalClients}) + ' ' + | ||||
|         _.t('sidebar.gateway', {smart_count: totalGateways}); | ||||
|       stats.textContent = _.t('sidebar.nodes', { total: totalNodes, online: totalOnlineNodes }) + ' ' + | ||||
|         _.t('sidebar.clients', { smart_count: totalClients }) + ' ' + | ||||
|         _.t('sidebar.gateway', { smart_count: totalGateways }); | ||||
| 
 | ||||
|       timestamp.textContent = _.t('sidebar.lastUpdate') + ': ' + d.timestamp.format('DD.MM.Y HH:mm'); | ||||
|     }; | ||||
|  | ||||
| @ -31,7 +31,7 @@ define(['sorttable', 'virtual-dom', 'helper'], function (SortTable, V, helper) { | ||||
|     table.el.classList.add('link-list'); | ||||
| 
 | ||||
|     function renderRow(d) { | ||||
|       var td1Content = [V.h('a', { href: '#', onclick: router.link(d) }, linkName(d))]; | ||||
|       var td1Content = [V.h('a', { href: router.getUrl({ l: d.id }), onclick: router.link(d) }, linkName(d))]; | ||||
| 
 | ||||
|       var td1 = V.h('td', td1Content); | ||||
|       var td2 = V.h('td', { style: { color: linkScale(d.tq).hex() } }, helper.showTq(d)); | ||||
|  | ||||
| @ -177,7 +177,7 @@ define(['polyglot', 'moment', 'router', 'leaflet', 'gui', 'helper'], | ||||
|         return false; | ||||
|       }); | ||||
| 
 | ||||
|       window._ = new Polyglot({locale: locale, allowMissing: true}); | ||||
|       window._ = new Polyglot({ locale: locale, allowMissing: true }); | ||||
|       helper.getJSON('locale/' + _.locale() + '.json?' + config.cacheBreaker).then(setTranslation); | ||||
| 
 | ||||
|       var router = new Router(); | ||||
|  | ||||
| @ -63,9 +63,8 @@ define(['sorttable', 'virtual-dom', 'helper'], function (SortTable, V, helper) { | ||||
|       td1Content.push(V.h('a', { | ||||
|         className: aClass.join(' '), | ||||
|         onclick: router.node(d), | ||||
|         href: '#' | ||||
|         href: router.getUrl({ n: d.nodeinfo.node_id }) | ||||
|       }, d.nodeinfo.hostname)); | ||||
| 
 | ||||
|       if (helper.hasLocation(d)) { | ||||
|         td0Content.push(V.h('span', { className: 'icon ion-location' })); | ||||
|       } | ||||
|  | ||||
| @ -11,25 +11,19 @@ define(['helper'], function (helper) { | ||||
|     var running = false; | ||||
| 
 | ||||
|     function saveState() { | ||||
|       var e = []; | ||||
|       var e = '#!'; | ||||
| 
 | ||||
|       if (currentView) { | ||||
|         e.push('v:' + currentView); | ||||
|       } | ||||
|       e += 'v:' + currentView; | ||||
| 
 | ||||
|       if (currentObject) { | ||||
|         if ('node' in currentObject) { | ||||
|           e.push('n:' + encodeURIComponent(currentObject.node.nodeinfo.node_id)); | ||||
|         } | ||||
| 
 | ||||
|         if ('link' in currentObject) { | ||||
|           e.push('l:' + encodeURIComponent(currentObject.link.id)); | ||||
|           e += ';n:' + encodeURIComponent(currentObject.node.nodeinfo.node_id); | ||||
|         } else if ('link' in currentObject) { | ||||
|           e += ';l:' + encodeURIComponent(currentObject.link.id); | ||||
|         } | ||||
|       } | ||||
| 
 | ||||
|       var s = '#!' + e.join(';'); | ||||
| 
 | ||||
|       window.history.pushState(s, undefined, s); | ||||
|       window.history.pushState(e, undefined, e); | ||||
|     } | ||||
| 
 | ||||
|     function resetView(push) { | ||||
| @ -129,6 +123,20 @@ define(['helper'], function (helper) { | ||||
|       return targetSet; | ||||
|     } | ||||
| 
 | ||||
|     self.getUrl = function getUrl(data) { | ||||
|       var e = '#!'; | ||||
| 
 | ||||
|       if (data.n) { | ||||
|         e += 'n:' + encodeURIComponent(data.n); | ||||
|       } | ||||
| 
 | ||||
|       if (data.l) { | ||||
|         e += 'l:' + encodeURIComponent(data.l); | ||||
|       } | ||||
| 
 | ||||
|       return e; | ||||
|     }; | ||||
| 
 | ||||
|     self.start = function start() { | ||||
|       running = true; | ||||
| 
 | ||||
|  | ||||
| @ -42,7 +42,7 @@ define(['moment', 'virtual-dom', 'helper'], function (moment, V, helper) { | ||||
|         td1Content.push(V.h('a', { | ||||
|           className: aClass.join(' '), | ||||
|           onclick: router.node(d), | ||||
|           href: '#' | ||||
|           href: router.getUrl({ n: d.nodeinfo.node_id }) | ||||
|         }, d.nodeinfo.hostname)); | ||||
| 
 | ||||
|         if (helper.hasLocation(d)) { | ||||
|  | ||||
| @ -132,7 +132,6 @@ define({ | ||||
|       return ''; | ||||
|     } | ||||
| 
 | ||||
| 
 | ||||
|     var tr = document.createElement('tr'); | ||||
|     var th = document.createElement('th'); | ||||
|     th.textContent = _.t(label); | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user