1function InitFavorites() { 2 (function ($) { 3 // document.getElementById('clicka').click(); 4 5 // get favorites from local storage or empty array 6 var favorites = JSON.parse(localStorage.getItem('favorites')) || []; 7 8 9 10 // add class 'fav' to each favorite 11 setTimeout(function () { 12 favorites.forEach(function (favorite) { 13 var Item = $("#" + favorite); 14 if (Item) { 15 $(Item).addClass('fav'); 16 if (document.documentElement.lang == "en-gb") { 17 $("#" + favorite).attr("data-original-title", "<b>Travel planner</b><br />Entry saved!"); 18 } else { 19 20 $("#" + favorite).attr("data-original-title", "<b>Reiseplaner</b><br />Eintrag gespeichert!"); 21 } 22 } 23 }); 24 }, 300); 25 26 // register click event listener 27 $(".reiseplaner").on("click", function (e) { 28 var id = e.target.id, 29 item = e.target, 30 index = favorites.indexOf(id); 31 // return if target doesn't have an id (shouldn't happen) 32 if (!id) return; 33 // item is not favorite 34 if (index == -1) { 35 favorites.push(id); 36 item.className = 'fav'; 37 $(item).tooltip('hide') 38 if (document.documentElement.lang == "en-gb") { 39 $(item).attr("data-original-title", "<b>Travel planner</b><br />Entry saved!"); 40 } else { 41 $(item).attr("data-original-title", "<b>Reiseplaner</b><br />Eintrag gespeichert!"); 42 } 43 $(item).tooltip('show'); 44 45 // item is already favorite 46 } else { 47 favorites.splice(index, 1); 48 item.className = ''; 49 $(item).tooltip('hide') 50 if (document.documentElement.lang == "en-gb") { 51 $(item).attr("data-original-title", "<b>Travel planner</b><br />Save entry in travel planner?"); 52 } else { 53 $(item).attr("data-original-title", "<b>Reiseplaner</b><br />Eintrag im Reiseplaner speichern?"); 54 } 55 $(item).tooltip('show'); 56 if ($(".itemid-815").length) { 57 document.getElementById(id).className = 'd-none'; 58 } 59 } 60 61 // store array in local storage 62 localStorage.setItem('favorites', JSON.stringify(favorites)); 63 writetolink(); 64 }); 65 66 67 if (document.documentElement.lang == "en-gb") { 68 var menupunkt = "/travelplaner"; 69 } else { 70 var menupunkt = "/reiseplaner"; 71 } 72 73 function writetolink() { 74 var urlparameters = "?"; 75 favorites.forEach(function (favorite, index) { 76 if (index != 0) { 77 urlparameters = urlparameters + "&id[]=" + favorite; 78 } else { 79 urlparameters = urlparameters + "id[]=" + favorite; 80 } 81 }); 82 document.getElementById("reiseplanerlink").href = menupunkt // + urlparameters; 83 document.getElementById("counterbadge").innerHTML = length(favorites); 84 if (document.querySelector('.itemid-815')) { 85 86 if (document.documentElement.lang == "en-gb") { 87 var lang = "en"; 88 } else { 89 var lang = "de"; 90 } 91 var url = "https://www.mosel-inside.de/" + lang + menupunkt + urlparameters; 92 document.getElementById("facebook").href = "https://www.facebook.com/sharer/sharer.php?u=" + encodeURIComponent(url); 93 document.getElementById("twitter").href = "https://twitter.com/home?status=" + encodeURIComponent(url); 94 document.getElementById("whatsapp").href = "whatsapp://send?text=" + url; 95 document.getElementById("PreparePdf").href = menupunkt + urlparameters; 96 if (window.location.href.indexOf('?id[]=') > 0) { 97 $('#printPdf').show(); 98 $('#PreparePdf').hide(); 99 } else { 100 $('#printPdf').hide(); 101 $('#PreparePdf').show(); 102 } 103 } 104 } 105 106 function length(obj) { 107 return Object.keys(obj).length; 108 } 109 writetolink(); 110 111 if (document.querySelector('.itemid-815')) { // Steuerung der Reiseplaner-Seite 112 var oldLocation = location.href; 113 if (oldLocation.indexOf("?id[]=") > -1) { // wenn IDs in URL vorhanden sind, in Favorites schreiben 114 var urlIDs = oldLocation.split("?id[]=") 115 var urlIDs = urlIDs[1].split("&id[]=") 116 117 118 119 urlIDs.forEach(function (id) { 120 if (favorites.indexOf(id) > -1) {} else { 121 favorites.push(id); 122 } 123 124 }); 125 } 126 if (favorites.length == 0) { 127 if (document.documentElement.lang == "en-gb") { 128 $("#itemListSecondary").html('<div class="col-12"><div class="noentries"><p>You have not yet added any tips to the travel planner.</p></div></div><div class="itemList noitems"><div class="row"><div class="col-md-4 itemContainer"><figure class="" itemprop="blogPost" itemscope="itemscope" itemtype="https://schema.org/BlogPosting"><div class="article-body"><div class="article-introtext"><div class="wrp"><img src="/images/stories/teaserbilder/unterkuenfte.jpg" class="itemimage"> <a class="itemlink" href="/en/hosts/accommodations.html" title="Accomodations along the Mosel">Read more</a><div class="figcaption"><h3 itemprop="name">Accomodations</h3><h4 class="ort">The best accomodations along the Mosel</h4><p>As diverse as the Mosel is, so diverse are the accommo­dations. Around 50.000 guest beds are avail­able through­out the Mosel region.</p></div></div></div></div></figure></div><div class="col-md-4 itemContainer"><figure class="" itemprop="blogPost" itemscope="itemscope" itemtype="https://schema.org/BlogPosting"><div class="article-body"><div class="article-introtext"><div class="wrp"><img src="/images/stories/teaserbilder/essen-trinken.jpg" alt="Food & Drinks at the Mosel" class="itemimage"> <a class="itemlink" href="/en/hosts/food-drinks.html" title="Food & Drinks along the Mosel">Read more</a><div class="figcaption"><h3 itemprop="name">Food & Drinks</h3><h4 class="ort">The best restaurants & bars along the Mosel</h4><p>You will find a variety of restau­rants, from the gourmet restau­rant to the typical Mosel cuisine on the Mosel.</p></div></div></div></div></figure></div><div class="col-md-4 itemContainer"><figure class="" itemprop="blogPost" itemscope="itemscope" itemtype="https://schema.org/BlogPosting"><div class="article-body"><div class="article-introtext"><div class="wrp"><img src="/images/stories/teaserbilder/wein.jpg" alt="Wine hosts at the Mosel" class="itemimage"> <a class="itemlink" href="/en/hosts/wine.html" title="Wine hosts along the Mosel">Read more</a><div class="figcaption"><h3 itemprop="name">Wine - Hosts</h3><h4 class="ort">The best wine­ries along the Mosel</h4><p>As you know, every­thing revolves around wine on the Mosel - here you will find the best wineries along the Mosel.</p></div></div></div></div></figure></div><div class="col-md-4 itemContainer"><figure class="" itemprop="blogPost" itemscope="itemscope" itemtype="https://schema.org/BlogPosting"><div class="article-body"><div class="article-introtext"><div class="wrp"><img src="/images/stories/teaserbilder/sehenswertes.jpg" alt="Attractions at the Mosel" class="itemimage"> <a class="itemlink" href="/en/activities/attractions.html" title="Attractions along the Mosel">Read more</a><div class="figcaption"><h3 itemprop="name">Attractions</h3><h4 class="ort">The most beauti­ful sights of the Mosel valley</h4><p>No matter on which bank or on which vineyard you are stan­ding right now - the Mosel always surprises with new breath­taking views and buil­dings.</p></div></div></div></div></figure></div><div class="col-md-4 itemContainer"><figure class="" itemprop="blogPost" itemscope="itemscope" itemtype="https://schema.org/BlogPosting"><div class="article-body"><div class="article-introtext"><div class="wrp"><img src="/images/stories/teaserbilder/kultur.jpg" alt="Leisure & Culture at the Mosel" class="itemimage"> <a class="itemlink" href="/en/activities/leisure-culture.html" title="Leisure & Culture along the Mosel">Read more</a><div class="figcaption"><h3 itemprop="name">Leisure & Culture</h3><h4 class="ort">
128Learn to love the Mosel cosiness</h4><p>Hardly any other landscape is as charac­terized by cultural diver­sity as the Mosel.</p></div></div></div></div></figure></div><div class="col-md-4 itemContainer"><figure class="" itemprop="blogPost" itemscope="itemscope" itemtype="https://schema.org/BlogPosting"><div class="article-body"><div class="article-introtext"><div class="wrp"><img src="/images/stories/teaserbilder/freizeit.jpg" alt="Exercise & Sport at the Mosel" class="itemimage"> <a class="itemlink" href="/en/activities/exercise-sport.html" title="Exercise & Sport along the Mosel">Read more</a><div class="figcaption"><h3 itemprop="name">Exercise & Sport</h3><h4 class="ort">The best activities at the Mosel</h4><p>The beauti­ful Mosel valley with all its scenic attrac­tions offers its guests a wide range of activi­ties.</p></div></div></div></div></figure></div></div></div>'); 129 } else { 130 $("#itemListSecondary").html('<div class="col-12"><div class="noentries"><p>Sie haben bisher keine Tipps zum Reiseplaner hinzugefügt.</p></div></div><div class="itemList noitems"><div class="row"><div class="col-md-4 itemContainer"><figure class="animated fadeInUp vcard "><div class="wrp"><img class="itemimage" src="/images/stories/teaserbilder/unterkuenfte.jpg" alt="Unterkünfte an der Mosel" itemprop="image"> <a class="itemlink" href="/de/gastgeber/unterkuenfte.html"></a><div class="figcaption"><a href="/de/gastgeber/unterkuenfte.html"><div class="CatItemHeader"><h3 itemprop="name">Unterkünfte</h3><h4 class="ort">Die besten Unter­künfte entlang der Mosel</h4></div><div class="CatItemIntroText">So viel­fältig die Mosel ist, so viel­fältig sind auch die Unter­künfte. Rund 50.000 Gäste­betten stehen Ihnen in der gesamten Mosel­region zu Auswahl.</div></a></div></div></figure></div><div class="col-md-4 itemContainer"><figure class="animated fadeInUp vcard "><div class="wrp"><img class="itemimage" src="/images/stories/teaserbilder/essen-trinken.jpg" alt="Essen & Trinken an der Mosel" itemprop="image"> <a class="itemlink" href="/de/gastgeber/essen-trinken.html"></a><div class="figcaption"><a href="/de/gastgeber/essen-trinken.html"><div class="CatItemHeader"><h3 itemprop="name">Essen & Trinken</h3><h4 class="ort">Die besten Restaurants & Bars an der Mosel</h4></div><div class="CatItemIntroText">Viel­fältige Gastro­nomie, vom Gourmet­restau­rant bis hin zur typisch mosel­ländisch­en Küche, ist an der Mosel zu finden.</div></a></div></div></figure></div><div class="col-md-4 itemContainer"><figure class="animated fadeInUp vcard "><div class="wrp"><img class="itemimage" src="/images/stories/teaserbilder/wein.jpg" alt="Wein Gastgeber an der Mosel" itemprop="image"> <a class="itemlink" href="/de/gastgeber/wein.html"></a><div class="figcaption"><a href="/de/gastgeber/wein.html"><div class="CatItemHeader"><h3 itemprop="name">Wein - Gastgeber</h3><h4 class="ort">Die besten Wein­güter entlang der Mosel</h4></div><div class="CatItemIntroText">An der Mosel dreht sich bekannt­lich alles um den Wein - hier finden Sie die besten Wein­güter entlang der Mosel.</div></a></div></div></figure></div><div class="col-md-4 itemContainer"><figure class="animated fadeInUp vcard "><div class="wrp"><img class="itemimage" src="/images/stories/teaserbilder/sehenswertes.jpg" alt="Sehenswertes an der Mosel" itemprop="image"> <a class="itemlink" href="/de/aktivitaeten/sehenswertes.html"></a><div class="figcaption"><a href="/de/aktivitaeten/sehenswertes.html"><div class="CatItemHeader"><h3 itemprop="name">Sehenswertes</h3><h4 class="ort">Die schönsten Sehens­würdig­keiten des Mosel­tals</h4></div><div class="CatItemIntroText">Egal an welchem Ufer oder auf wel­chem Wein­hang Sie gerade stehen â die Mosel über­rascht immer wieder mit neuen atem­berauben­den Aus­blicken und Bauwerken.</div></a></div></div></figure></div><div class="col-md-4 itemContainer"><figure class="animated fadeInUp vcard "><div class="wrp"><img class="itemimage" src="/images/stories/teaserbilder/kultur.jpg" alt="Freizeit & Kultur an der Mosel" itemprop="image"> <a class="itemlink" href="/de/aktivitaeten/freizeit-kultur.html"></a><div class="figcaption"><a href="/de/aktivitaeten/freizeit-kultur.html"><div class="CatItemHeader"><h3 itemprop="name">Freizeit & Kultur</h3><h4 class="ort">Lernen Sie die mosel­ländische Gemüt­lich­keit lieben</h4></div><div class="CatItemIntroText">Kaum eine andere Land­schaft wird so durch kultu­relle Vielfalt geprägt wie die Mosel.</div></a></div></div></figure></div><div class="col-md-4 itemContainer"><figure class="animated fadeInUp vcard "><div class="wrp"><img class="itemimage" src="/images/stories/teaserbilder/freizeit.jpg" alt="Bewegung & Sport an der Mosel" itemprop="image">
130 <a class="itemlink" href="/de/aktivitaeten/bewegung-sport.html"></a><div class="figcaption"><a href="/de/aktivitaeten/bewegung-sport.html"><div class="CatItemHeader"><h3 itemprop="name">Bewegung & Sport</h3><h4 class="ort">Die besten Aktiv­angebote der Mosel</h4></div><div class="CatItemIntroText">Das wunder­schöne Mosel­tal mit all seinen land­schaft­lichen Reizen bietet seinen Gästen ein breit­gefächer­tes Aktiv­angebot.</div></a></div></div></figure></div></div></div>'); 131 } 132 } else { 133 favorites.forEach(function (favorite) { 134 135 var Item = document.querySelector('.itemid-' + favorite); 136 if (Item) { 137 document.getElementById(favorite).className = 'fav'; 138 document.querySelector('[id="' + favorite + '"] .reiseplaner a').className = 'fav'; 139 $('#' + favorite + ' .itemimage').attr("src",$('#' + favorite + ' .itemimage').attr("data-src")); 140 141 } 142 }); 143 $('#k2Container').css('background-image', 'none'); 144 } 145 writetolink(); 146 localStorage.setItem('favorites', JSON.stringify(favorites)); 147 148 149 }; 150 document.querySelectorAll('.reiseplaner .fav').forEach(function (actelem) { 151 if (document.documentElement.lang == "en-gb") { 152 $(actelem).attr("data-original-title", "<b>Travel planner</b><br />Click to remove"); 153 } else { 154 $(actelem).attr("data-original-title", "<b>Reiseplaner</b><br />zum Löschen klicken"); 155 } 156 157 }); 158 })(jQuery); 159 160} 161InitFavorites();
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.