From 0a1dbf4461257d887798d320c9b7dd38198ecec2 Mon Sep 17 00:00:00 2001 From: Candid Dauth Date: Wed, 12 Oct 2016 01:36:27 +0300 Subject: [PATCH] Always open external links in new window --- frontend/app/map/map/map.js | 12 ++++++------ frontend/app/marked/marked.js | 7 ++++++- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/frontend/app/map/map/map.js b/frontend/app/map/map/map.js index c1733817..dd4598c9 100644 --- a/frontend/app/map/map/map.js +++ b/frontend/app/map/map/map.js @@ -37,41 +37,41 @@ fpName: "MapSurfer Road", fpBase: true, fpKey: "MSfR", - attribution: $sce.trustAsHtml('© OpenMapSurfer / OSM Contributors'), + attribution: $sce.trustAsHtml('© OpenMapSurfer / OSM Contributors'), noWrap: true }), L.tileLayer("https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png", { fpName: "Mapnik", fpBase: true, fpKey: "Mpnk", - attribution: $sce.trustAsHtml('© OSM Contributors'), + attribution: $sce.trustAsHtml('© OSM Contributors'), noWrap: true }), L.tileLayer("https://{s}.tile.opencyclemap.org/cycle/{z}/{x}/{y}.png", { fpName: "OpenCycleMap", fpBase: true, fpKey: "OCyc", - attribution: $sce.trustAsHtml('© OpenCycleMap / OSM Contributors'), + attribution: $sce.trustAsHtml('© OpenCycleMap / OSM Contributors'), noWrap: true }), L.tileLayer("http://{s}.tiles.wmflabs.org/hikebike/{z}/{x}/{y}.png", { fpName: "Hike & Bike Map", fpBase: true, fpKey: "HiBi", - attribution: $sce.trustAsHtml('© Hike & Bike Map / OSM Contributors'), + attribution: $sce.trustAsHtml('© Hike & Bike Map / OSM Contributors'), noWrap: true }), L.tileLayer("http://openptmap.org/tiles/{z}/{x}/{y}.png", { fpName: "Public transportation", fpKey: "OPTM", - attribution: $sce.trustAsHtml('© OpenPTMap / OSM Contributors'), + attribution: $sce.trustAsHtml('© OpenPTMap / OSM Contributors'), zIndex: 300, noWrap: true }), L.tileLayer("http://korona.geog.uni-heidelberg.de/tiles/asterh/x={x}&y={y}&z={z}", { fpName: "Relief", fpKey: "Rlie", - attribution: $sce.trustAsHtml('© OpenMapSurfer / METI / NASA'), + attribution: $sce.trustAsHtml('© OpenMapSurfer / METI / NASA'), zIndex: 300, noWrap: true }) diff --git a/frontend/app/marked/marked.js b/frontend/app/marked/marked.js index f8ee13fa..7a16e099 100644 --- a/frontend/app/marked/marked.js +++ b/frontend/app/marked/marked.js @@ -7,10 +7,15 @@ }); return { - block: marked, + block: function(string, options) { + var ret = $("
").html(marked(string, options)); + $("a[href]", ret).attr("target", "_blank"); + return ret.html(); + }, inline: function(string, options) { var ret = $("
").html(marked(string, options)); $("p", ret).replaceWith(function() { return $(this).contents(); }); + $("a[href]", ret).attr("target", "_blank"); return ret.html(); } };