From 338d01726970db73f9b94ddc29bfaa6d4a605f32 Mon Sep 17 00:00:00 2001 From: TonyFord <tonyford@strategy-investor.de> Date: Mon, 3 Feb 2020 18:15:43 +0100 Subject: [PATCH] add country code --- _includes/overview.html | 2 +- assets/js/script.js | 7 ++++--- css/main.scss | 6 +++++- script/get_orders.py | 1 + 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/_includes/overview.html b/_includes/overview.html index 39aa47f..69c92d8 100644 --- a/_includes/overview.html +++ b/_includes/overview.html @@ -26,7 +26,7 @@ <div class="orderlist-title"> <a href="{{ o.git-repo }}/blob/master/{{ o.order-title }}" target="git-order"><u>{{ o.headline | truncate: 32 }}</u></a> <a href="{{ o.git-profile }}" target="git-profile"><span class="feather-icon icon-user"></span></a> <a href="{{ o.git-repo }}/issues/new?issue[title]={{ o.order-title }}" target="git-contact"><span class="feather-icon icon-mail"></span></a><br> - <small><lang><span class="feather-icon icon-tag"></span>{{ o.ln }}</lang> <used><span class="feather-icon icon-tag"></span>{{ o.condition }}</used> <tags><span class="feather-icon icon-tag"></span>{{ o.tags }}</tags> <span class="d-none distance-data">{{ o.latitude }},{{ o.longitude }}</span> <span class="distance"></span></small><br> + <small><lang><span class="feather-icon icon-tag"></span>{{ o.language-code }}</lang> <span class="d-none distance-data">{{ o.latitude }},{{ o.longitude }},{{ o.country-code }}</span> <span class="distance"></span> <used><span class="feather-icon icon-tag"></span>{{ o.condition }}</used> <tags><span class="feather-icon icon-tag"></span>{{ o.tags }}</tags></small><br> <div><small>{{ o.description }}</small></div> </div> diff --git a/assets/js/script.js b/assets/js/script.js index 404f4f5..5bf15e1 100644 --- a/assets/js/script.js +++ b/assets/js/script.js @@ -35,15 +35,16 @@ function get_distances(){ if( lat == null || long == null ){ lat=-100; } + var calc_distance=false; if( lat >= -90 && lat <= 90 && long >=-180 && long <= 180 ){ - } else { - return; + calc_distance=true; } $.each( $('.distance'), function(i,v){ var geo=$( $(v).context.previousElementSibling ).text(); var llat=geo.split(/,/g)[0]; var llong=geo.split(/,/g)[1]; - $(v).html('<span class="feather-icon icon-map-pin"></span> ' + Math.round( getDistanceFromLatLonInKm (lat, long, llat, llong ) )+'km' ); + var lcountry=geo.split(/,/g)[2]; + $(v).html('<span class="feather-icon icon-map-pin"></span> ' + lcountry + ' ' + (( calc_distance ) ? '( ' + Math.round( getDistanceFromLatLonInKm (lat, long, llat, llong ) )+'km ) ' : '' ) ); } ); } diff --git a/css/main.scss b/css/main.scss index 8b861b1..0e1688b 100644 --- a/css/main.scss +++ b/css/main.scss @@ -181,7 +181,7 @@ used { } lang { - color:midnightblue; + color:darkmagenta; } tags { @@ -192,3 +192,7 @@ tags { font-size:1rem; color: goldenrod; } + +.distance { + color:midnightblue; +} diff --git a/script/get_orders.py b/script/get_orders.py index 44279c8..96d56bf 100644 --- a/script/get_orders.py +++ b/script/get_orders.py @@ -52,6 +52,7 @@ for source in Sources: file.write('order-title: '+furl+'\n' ) file.write('latitude: '+str( O['latitude'] )+'\n' ) file.write('longitude: '+str( O['longitude'] )+'\n' ) + file.write('country-code: '+ O['country-code'] +'\n' ) file.write(contents.decode("utf-8")) file.write('\n---') file.close() -- GitLab