Commit fb4fb8ae authored by Karl Hasselbring's avatar Karl Hasselbring

Merge with MetaGer-Redesign

parents 92f1138b f29d02a1
......@@ -11,9 +11,10 @@ langfiles.zip
# The Files created by Gulp in the build process
/public/build
/public/js/lib.js
/public/js/quicktips.js
/public/js/scriptStartPage.js
/public/js/scriptResultPage.js
/public/js/searchbar.js
/public/js/utility.js
/public/css/beitritt.css
/public/css/themes/default.css
/public/css/utility.css
......
......@@ -16,8 +16,8 @@ elixir(function (mix) {
mix.less('metager/beitritt.less', 'public/css/beitritt.css')
// js
mix.scripts(['lib/jquery.js', 'lib/jquery-ui.min.js', 'lib/bootstrap.js', 'lib/lightslider.js', 'lib/masonry.js', 'lib/imagesloaded.js', 'lib/openpgp.min.js', 'lib/iframeResizer.min.js', 'lib/md5.js'], 'public/js/lib.js')
mix.scripts(['scriptStartPage.js', 'results.js'], 'public/js/scriptStartPage.js');
mix.scripts(['scriptResultPage.js', 'results.js', 'quicktips.js'], 'public/js/scriptResultPage.js');
mix.scripts(['scriptStartPage.js', 'result-saver.js'], 'public/js/scriptStartPage.js');
mix.scripts(['scriptResultPage.js', 'result-saver.js', 'quicktips.js'], 'public/js/scriptResultPage.js');
mix.scripts(['searchbar.js', 'focus-creator.js'], 'public/js/searchbar.js');
// utility
mix.scripts(['utility.js'], 'public/js/utility.js');
......
AUTHORS
Current Contributors (sorted alphabetically):
- Pravin Satpute <psatpute at redhat dot com>
Project Owner (Current)
Red Hat, Inc.
Previous Contributors
- Steve Matteson
Original Designer
Ascender, Inc.
Digitized data copyright (c) 2010 Google Corporation
with Reserved Font Arimo, Tinos and Cousine.
Copyright (c) 2012 Red Hat, Inc.
with Reserved Font Name Liberation.
This Font Software is licensed under the SIL Open Font License,
Version 1.1.
This license is copied below, and is also available with a FAQ at:
http://scripts.sil.org/OFL
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
PREAMBLE The goals of the Open Font License (OFL) are to stimulate
worldwide development of collaborative font projects, to support the font
creation efforts of academic and linguistic communities, and to provide
a free and open framework in which fonts may be shared and improved in
partnership with others.
The OFL allows the licensed fonts to be used, studied, modified and
redistributed freely as long as they are not sold by themselves.
The fonts, including any derivative works, can be bundled, embedded,
redistributed and/or sold with any software provided that any reserved
names are not used by derivative works. The fonts and derivatives,
however, cannot be released under any other type of license. The
requirement for fonts to remain under this license does not apply to
any document created using the fonts or their derivatives.
DEFINITIONS
"Font Software" refers to the set of files released by the Copyright
Holder(s) under this license and clearly marked as such.
This may include source files, build scripts and documentation.
"Reserved Font Name" refers to any names specified as such after the
copyright statement(s).
"Original Version" refers to the collection of Font Software components
as distributed by the Copyright Holder(s).
"Modified Version" refers to any derivative made by adding to, deleting,
or substituting ? in part or in whole ?
any of the components of the Original Version, by changing formats or
by porting the Font Software to a new environment.
"Author" refers to any designer, engineer, programmer, technical writer
or other person who contributed to the Font Software.
PERMISSION & CONDITIONS
Permission is hereby granted, free of charge, to any person obtaining a
copy of the Font Software, to use, study, copy, merge, embed, modify,
redistribute, and sell modified and unmodified copies of the Font
Software, subject to the following conditions:
1) Neither the Font Software nor any of its individual components,in
Original or Modified Versions, may be sold by itself.
2) Original or Modified Versions of the Font Software may be bundled,
redistributed and/or sold with any software, provided that each copy
contains the above copyright notice and this license. These can be
included either as stand-alone text files, human-readable headers or
in the appropriate machine-readable metadata fields within text or
binary files as long as those fields can be easily viewed by the user.
3) No Modified Version of the Font Software may use the Reserved Font
Name(s) unless explicit written permission is granted by the
corresponding Copyright Holder. This restriction only applies to the
primary font name as presented to the users.
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
Software shall not be used to promote, endorse or advertise any
Modified Version, except to acknowledge the contribution(s) of the
Copyright Holder(s) and the Author(s) or with their explicit written
permission.
5) The Font Software, modified or unmodified, in part or in whole, must
be distributed entirely under this license, and must not be distributed
under any other license. The requirement for fonts to remain under
this license does not apply to any document created using the Font
Software.
TERMINATION
This license becomes null and void if any of the above conditions are not met.
DISCLAIMER
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER
DEALINGS IN THE FONT SOFTWARE.
/* Liberation Sans Font */
@font-face {
font-family: "Liberation Sans";
src: url("./LiberationSans-Regular.ttf") format("truetype");
}
\ No newline at end of file
This diff is collapsed.
$(document).ready(function () {
$('.js-only').removeClass('js-only');
$('.no-js').addClass('hide');
});
//# sourceMappingURL=utility.js.map
......@@ -29,7 +29,7 @@ function getQuicktips (search, locale, blacklist, loadedHandler) {
type: $(this).children('mg\\:type').text(),
title: $(this).children('title').text(),
summary: $(this).children('content').text(),
url: $(this).children('link').text(),
url: $(this).children('link').attr("href"),
gefVon: $(this).children('mg\\:gefVon').text(),
score: $(this).children('relevance\\:score').text(),
details: $(this).children('mg\\:details').children('entry').map(function () {
......
This diff is collapsed.
/*
* This object gathers all stored Result Objects and can Update the Interface to show them.
*/
function Results(sort){
if(!localStorage) return;
this.prefix = "result_";
this.sort = sort;
this.results = [];
this.updateResults();
this.length = this.results.length;
this.sortResults();
}
Results.prototype.sortResults = function(){
if(this.sort === undefined) this.sort = "chronological";
var sortType = this.sort;
switch(sortType){
case "chronological":
this.results.sort(function(a,b){
if(a.added > b.added) return -1;
if(a.added < b.added) return 1;
return 0;
});
break;
case "rank":
this.results.sort(function(a,b){
if(a.rank > b.rank) return -1;
if(a.rank < b.rank) return 1;
return 0;
});
break;
case "alphabetical":
this.results.sort(function(a,b){
if(b.hostname > a.hostname) return -1;
if(b.hostname < a.hostname) return 1;
return 0;
});
break;
}
}
Results.prototype.updateResults = function(){
// Iterate over all Keys in the LocalStorage
for(var i = 0; i < localStorage.length; i++){
if(localStorage.key(i).indexOf(this.prefix) === 0){
var key = localStorage.key(i);
key = key.substr(this.prefix.length);
var tmpResult = new Result(undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, key);
tmpResult.setIndex(i);
this.results.push(tmpResult);
}
}
}
Results.prototype.deleteResults = function(){
var keys = [];
for(var i = 0; i < localStorage.length; i++){
if(localStorage.key(i).indexOf(this.prefix) === 0){
var key = localStorage.key(i);
keys.push(key);
}
}
$.each(keys, function(index, value){
localStorage.removeItem(value);
});
}
Results.prototype.updateResultPageInterface = function(){
var sortType = this.sort;
if(this.results.length === 0){
$("#savedFokiTabSelector, #savedFoki").remove();
$($("#foki > li[data-loaded=1]").get(0)).find(">a").tab("show");
return;
}
if($("#savedFokiTabSelector").length === 0){
var savedFoki = $('\
<li id="savedFokiTabSelector" data-loaded="1" class="tab-selector" role="presentation">\
<a aria-controls="savedFoki" href="#savedFoki" role="tab" data-toggle="tab">\
<span class="glyphicon glyphicon-floppy-disk"></span> gespeicherte Ergebnisse\
<span class="badge">' + this.results.length + '</span>\
</a>\
</li>\
');
$("#foki").append(savedFoki);
}else{
$("#savedFokiTabSelector span.badge").html(this.results.length);
}
if($("#savedFoki").length === 0){
// Now append the Tab Panel
var tabPanel = $('\
<div role="tabpanel" class="tab-pane" id="savedFoki">\
</div>\
');
$("#main-content-tabs").append(tabPanel);
}else{
$("#savedFoki").html("");
var tabPanel = $("#savedFoki");
}
this.addToContainer(tabPanel, sortType);
}
Results.prototype.addToContainer = function(container){
var sortType = this.sort;
$.each(this.results, function(index, result){
$(container).append(result.toHtml());
});
var options = $('\
<div class="saver-options row">\
<input class="form-control" type="text" placeholder="Filtern">\
<select class="form-control">\
<option value="chronological">Chronologisch</option>\
<option value="rank">MetaGer-Ranking</option>\
<option value="alphabetical">Alphabetisch (Hostname)</option>\
</select>\
<button class="btn btn-danger btn-md"><span class="glyphicon glyphicon-trash"></span> <span class="hidden-xs">Ergebnisse</span> löschen</button>\
</div>\
');
$(options).find("select").val(sortType);
$(container).prepend(options);
$(options).find("select").change(function(){
new Results($(this).val()).updateResultPageInterface();
});
$(options).find("button").click({caller: this}, function(event){
event.data.caller.deleteResults();
new Results().updateResultPageInterface();
});
$(options).find("input").keyup(function(){
var search = $(this).val();
$("#savedFoki > div.result").each(function(index, value){
var html = $(this).html();
if(html.toLowerCase().indexOf(search.toLowerCase()) === -1){
$(value).addClass("hidden");
}else{
$(value).removeClass("hidden");
}
});
});
}
function Result(title, link, anzeigeLink, gefVon, hoster, anonym, description, color, rank, hash){
this.prefix = "result_"; // Präfix for the localStorage so we can find all Items
if(hash !== null && hash !== undefined){
this.hash = hash;
this.load();
}else{
this.hash = MD5(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.color = color;
this.rank = rank;
this.added = new Date().getTime();
var parser = document.createElement('a');
parser.href = this.anzeigeLink;
this.hostname = parser.hostname;
this.save()
}
}
Result.prototype.load = function(){
if(localStorage){
var result = localStorage.getItem(this. prefix + this.hash);
if(result === null) return false;
result = b64DecodeUnicode(result);
result = JSON.parse(result);
this.title = result.title;
this.link = result.link;
this.anzeigeLink = result.anzeigeLink;
this.gefVon = result.gefVon;
this.hoster = result.hoster;
this.anonym = result.anonym;
this.description = result.description;
this.added = result.added;
this.color = result.color;
this.rank = result.rank;
this.hostname = result.hostname;
return true;
}else{
return false;
}
}
Result.prototype.save = function(){
/*
* This function will save the data of this Result to the LocalStorage
*/
if(localStorage){
var result = {
title: this.title,
link: this.link,
anzeigeLink: this.anzeigeLink,
gefVon: this.gefVon,
hoster: this.hoster,
anonym: this.anonym,
description: this.description,
added: this.added,
color: this.color,
rank: this.rank,
hostname: this.hostname
};
result = JSON.stringify(result);
result = b64EncodeUnicode(result);
localStorage.setItem(this.prefix + this.hash, result);
return true;
}else{
return false;
}
}
function b64EncodeUnicode(str) {
return btoa(encodeURIComponent(str).replace(/%([0-9A-F]{2})/g, function(match, p1) {
return String.fromCharCode('0x' + p1);
}));
}
function b64DecodeUnicode(str) {
return decodeURIComponent(Array.prototype.map.call(atob(str), function(c) {
return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2);
}).join(''));
}
Result.prototype.setIndex = function(index){
this.index = index;
}
Result.prototype.remove = function(){
localStorage.removeItem(this.prefix + this.hash);
new Results().updateResultPageInterface();
}
Result.prototype.toHtml = function(){
var result = $('\
<div class="result row">\
<div class="col-sm-1 glyphicon glyphicon-trash remover" title="Ergebnis aus dem Speicher löschen">\
</div>\
<div class="result-information col-xs-12 col-sm-11">\
<div class="col-xs-10 col-sm-11" style="padding:0; ">\
<p class="title">\
<a class="title" href="' + this.link + '" target="_blank" data-hoster="' + this.hoster + '" data-count="1" rel="noopener">\
' + this.title + '\
</a>\
</p>\
<div class="link">\
<div>\
<div class="link-link">\
<a href="' + this.link + '" target="_blank" data-hoster="' + this.hoster + '" data-count="' + this.index + '" rel="noopener">\
' + this.anzeigeLink + '\
</a>\
</div>\
</div>\
<span class="hoster">\
' + this.gefVon + '\
</span>\
<a class="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>\
</div>\
</div>\
<div class="description">' + this.description + '</div>\
</div>\
</div>');
$(result).find(".remover").click({caller: this}, function(event){
event.data.caller.remove();
});
return result;
}
\ No newline at end of file
......@@ -4,7 +4,6 @@ $(document).ready(function () {
var custom = $('#foki > li.active').hasClass('custom-focus-tab-selector');
getDocumentReadyForUse(focus, custom);
botProtection();
new Results().updateResultPageInterface(); // Adds the saved Results if they are present
if (document.location.href.indexOf('focus=container') !== -1) {
$($('#foki > li#savedFokiTabSelector').get(0)).find('>a').tab('show');
}
......@@ -375,19 +374,3 @@ function initialLoadContent (fokus) {
getDocumentReadyForUse(fokus);
});
}
function resultSaver (index) {
var title = $('div.tab-pane.active .result[data-count=' + index + '] a.title').html();
var link = $('div.tab-pane.active .result[data-count=' + index + '] a.title').attr('href');
var anzeigeLink = $('div.tab-pane.active .result[data-count=' + index + '] div.link-link > a').html();
var gefVon = $('div.tab-pane.active .result[data-count=' + index + '] span.hoster').html();
var hoster = $('div.tab-pane.active .result[data-count=' + index + '] a.title').attr('data-hoster');
var anonym = $('div.tab-pane.active .result[data-count=' + index + '] a.proxy').attr('href');
var description = $('div.tab-pane.active .result[data-count=' + index + '] div.description').html();
var color = $('div.tab-pane.active .result[data-count=' + index + '] div.number').css('color');
var rank = parseFloat($('div.tab-pane.active .result[data-count=' + index + ']').attr('data-rank'));
new Result(title, link, anzeigeLink, gefVon, hoster, anonym, description, color, rank, undefined);
var to = $('#savedFokiTabSelector').length ? $('#savedFokiTabSelector') : $('#foki');
$('div.tab-pane.active .result[data-count=' + index + ']').transfer({to: to, duration: 1000});
new Results().updateResultPageInterface();
}
......@@ -51,3 +51,5 @@ function toggleOptionsDialog () {
closeOptionsDialog();
}
}
//# sourceMappingURL=searchbar.js.map
\ No newline at end of file
/* Ergebnisseite */
@import "./quicktips.less";
@import "./result-saver.less";
@import "./result.less";
@import "./product.less";
//
......@@ -342,12 +343,12 @@ a {
@result-width: 700px;
@quicktip-width: 500px;
.resultpage-container {
#resultpage-container {
width: @result-width + @quicktip-width;
align-self: center;
@media (max-width: (@result-width + @quicktip-width - 1px)) {
width: @result-width;
#quicktips {
#additions-container {
display: none;
}
}
......@@ -356,11 +357,11 @@ a {
}
display: flex;
justify-content: center;
#results {
#results-container {
max-width: @result-width;
width: 100%;
}
#quicktips {
#additions-container {
padding-left: 50px;
width: @quicktip-width;
}
......
@saved-result-distance-first: 10px;
@saved-result-distance-between: 10px;
#savedFoki {
padding-top: 50px;
display: flex;
flex-direction: column;
h1 {
text-align: center;
font-size: 24px;
}
#saver-options {
display: flex;
flex-direction: column;
align-items: stretch;
>* {
margin: 5px 0px;
display: flex;
align-items: center;
}
.saver-option-filter>input {
font-family: FontAwesome, sans-serif;
}
.saver-option-sort>select {
&,
option {
font-family: FontAwesome, sans-serif;
}
}
.saver-option-delete button {
width: 100%;
}
}
.saved-result {
display: flex;
align-items: baseline;
margin-top: @saved-result-distance-first;
margin-bottom: @saved-result-distance-between;
padding-bottom: @saved-result-distance-between;
.saved-result-remover {
padding: 0px 10px;
.fa {
font-size: 20px;
}
}
.saved-result-content {
overflow: hidden;
}
}
}
\ No newline at end of file
......@@ -79,7 +79,7 @@
margin-top: 0;
margin-left: 10px;
}
.result-proxy {
.result-proxy, .result-proxy a {
font-size: 13px;
margin-top: 0;
white-space: nowrap;
......
......@@ -7,7 +7,7 @@
@color-almost-black: mix(@color-white, @color-black, 10%);
@color-black: black;
//
@background-color: rgba(2, 93, 140, 3%);
@background-color: white;
//
@brand-success: #5cb85c;
@brand-info: #FB0;
......
......@@ -8,18 +8,22 @@
</div>
</div>
@endif
<div class="content-wrapper">
<header id="research-bar">
<div id="header-logo">
<a href="{{ LaravelLocalization::getLocalizedURL(LaravelLocalization::getCurrentLocale(), "/") }}"><h1 class="mg-logo">MetaGer</h1></a>
</div>
<div id="header-searchbar">
@include('parts.searchbar', ['class' => 'resultpage-searchbar', 'request' => Request::method()])
</div>