From 2bc2bd13c43bdd51f1aabd047d1556833e39f95a Mon Sep 17 00:00:00 2001 From: Karl Hasselbring <Karl Hasselbring> Date: Tue, 30 Jan 2018 10:37:02 +0100 Subject: [PATCH] =?UTF-8?q?Ergebnisse=20k=C3=B6nnebn=20wieder=20gespeicher?= =?UTF-8?q?t=20werden=20und=20sehen=20den=20Originalen=20=C3=A4hnlich?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- resources/assets/js/result-saver.js | 55 +++++++++++------------- resources/views/layouts/result.blade.php | 2 +- 2 files changed, 26 insertions(+), 31 deletions(-) diff --git a/resources/assets/js/result-saver.js b/resources/assets/js/result-saver.js index 43818d779..444fb5dde 100644 --- a/resources/assets/js/result-saver.js +++ b/resources/assets/js/result-saver.js @@ -78,7 +78,7 @@ Results.prototype.loadAllResults = function () { // Remove the prefix key = key.substr(this.prefix.length); // Create the result for this key by loading it from localstorage - var tmpResult = new Result(undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, key); + var tmpResult = new Result(undefined, undefined, undefined, undefined, undefined, undefined, key); // Add the result to the list of results this.results.push(tmpResult); } @@ -212,20 +212,18 @@ Results.prototype.addToContainer = function (container) { * @param {String} title The title of this result * @param {String} link The link to this result * @param {String} anzeigeLink The displayed link - * @param {String} gefVon The ?? - * @param {String} hoster The website this result is hosted on - * @param {String} anonym The link to open this result anonymously * @param {String} description The description of this result + * @param {String} anonym The link to open this result anonymously * @param {int} rank The rank of this result * @param {int} hash The hash value for this result */ -function Result (title, link, anzeigeLink, gefVon, hoster, anonym, description, index, hash) { +function Result (title, link, anzeigeLink, description, anonym, index, hash) { // Set prefix for localstorage this.prefix = 'result_'; if (hash === null || hash === undefined) { // Calculate the hash value of this result - hash = MD5(title + link + anzeigeLink + gefVon + hoster + anonym + description); + hash = MD5(title + link + anzeigeLink + description + anonym); } this.hash = hash; @@ -236,10 +234,8 @@ function Result (title, link, anzeigeLink, gefVon, hoster, anonym, description, this.title = title; this.link = link; this.anzeigeLink = anzeigeLink; - this.gefVon = gefVon; - this.hoster = hoster; - this.anonym = anonym; this.description = description; + this.anonym = anonym; this.index = index; this.rank = index; this.added = new Date().getTime(); @@ -364,28 +360,29 @@ Result.prototype.toHtml = function () { <i class="fa fa-trash"></i>\ </div>\ <div class="saved-result-content">\ - <h2 class="result-title">\ - <a class="title" href="' + this.link + '" target="_blank" data-hoster="' + this.hoster + '" data-count="1" rel="noopener">\ - ' + this.title + '\ - </a>\ - </h2>\ <div class="result-header">\ - <div class="result-link">\ - <a href="' + this.link + '" target="_blank" data-hoster="' + this.hoster + '" rel="noopener">\ - ' + this.anzeigeLink + '\ + <h2 class="result-title">\ + <a class="title" href="' + this.link + '" target="_blank" data-count="1" rel="noopener">\ + ' + this.title + '\ </a>\ - </div>\ - <span class="result-hoster">' + this.gefVon + '</span>\ - <span class="result-proxy">\ - <a class="result-proxy" onmouseover="$(this).popover(\'show\');" onmouseout="$(this).popover(\'hide\');" data-toggle="popover" data-placement="auto right" data-container="body" data-content="Der Link wird anonymisiert geöffnet. Ihre Daten werden nicht zum Zielserver übertragen. Möglicherweise funktionieren manche Webseiten nicht wie gewohnt." href="' + this.proxy + '" target="_blank" rel="noopener" data-original-title="" title="">\ - <img src="/img/proxyicon.png" alt="">\ - anonym öffnen\ + <a class="result-link" href="' + this.link + '" target="_blank" data-hoster="' + this.hoster + '" rel="noopener">\ + ' + this.anzeigeLink + '\ </a>\ - </span>\ - </div>\ + </h2>\ <div class="result-body">\ <div class="description">' + this.description + '</div>\ </div>\ + <div class="result-footer">\ + <a class="result-open" href="' + this.link + '" target="_self" rel="noopener">\ + ÖFFNEN\ + </a>\ + <a class="result-open" href="' + this.link + '" target="_blank" rel="noopener">\ + IN NEUEM TAB\ + </a>\ + <a class="result-open-proxy" onmouseover="$(this).popover(\'show\');" onmouseout="$(this).popover(\'hide\');" data-toggle="popover" data-placement="auto right" data-container="body" data-content="Der Link wird anonymisiert geöffnet. Ihre Daten werden nicht zum Zielserver übertragen. Möglicherweise funktionieren manche Webseiten nicht wie gewohnt." href="' + this.anonym + '" target="_blank" rel="noopener" data-original-title="" title="">\ + ANONYM ÖFFNEN\ + </a>\ + </div>\ </div>\ </div>'); @@ -408,14 +405,12 @@ function resultSaver (index) { // Read the necessary data from the result html var title = $('.result[data-count=' + index + '] .result-title a').html().trim(); var link = $('.result[data-count=' + index + '] .result-title a').attr('href').trim(); - var anzeigeLink = $('.result[data-count=' + index + '] .result-link a').html().trim(); - var gefVon = $('.result[data-count=' + index + '] .result-hoster a').html().trim(); - var hoster = $('.result[data-count=' + index + '] .result-hoster a').attr('href').trim(); - var anonym = $('.result[data-count=' + index + '] .result-proxy a').attr('href').trim(); + var anzeigeLink = $('.result[data-count=' + index + '] .result-link').html().trim(); var description = $('.result[data-count=' + index + '] .result-description').html().trim(); + var anonym = $('.result[data-count=' + index + '] .result-open-proxy').attr('href').trim(); // Create the result object - var result = new Result(title, link, anzeigeLink, gefVon, hoster, anonym, description, index, null); + var result = new Result(title, link, anzeigeLink, description, anonym, index, null); // Add new result to results results.addResult(result); diff --git a/resources/views/layouts/result.blade.php b/resources/views/layouts/result.blade.php index 2ef36ac52..44bc2e2f1 100644 --- a/resources/views/layouts/result.blade.php +++ b/resources/views/layouts/result.blade.php @@ -1,4 +1,4 @@ -<div class="result"> +<div class="result" data-count="{{ $result->number }}"> <div class="result-header"> <h2 class="result-title"> <a href="{{ $result->link }}" target="{{ $metager->getNewtab() }}" rel="noopener"> -- GitLab