Commit 0336910b authored by Dominik Hebeler's avatar Dominik Hebeler

Merge branch '671-sponsorentext-andern-und-produktsuche-raus' into 'development'

Resolve "Sponsorentext ändern und Produktsuche raus"

Closes #671

See merge request !1156
parents c86faba0 daf5cab7
......@@ -30,7 +30,6 @@ class MetaGer
protected $engines = [];
protected $results = [];
protected $ads = [];
protected $products = [];
protected $warnings = [];
protected $errors = [];
protected $addedHosts = [];
......@@ -280,7 +279,6 @@ class MetaGer
if ($this->validated) {
$this->ads = [];
$this->products = [];
$this->maps = false;
}
......@@ -365,9 +363,6 @@ class MetaGer
foreach ($engine->ads as $ad) {
$this->ads[] = $ad;
}
foreach ($engine->products as $product) {
$this->products[] = $product;
}
}
}
......@@ -1249,24 +1244,6 @@ class MetaGer
}
}
public function hasProducts()
{
if (count($this->products) > 0) {
return true;
} else {
return false;
}
}
public function getProducts()
{
$return = [];
foreach ($this->products as $product) {
$return[] = get_object_vars($product);
}
return $return;
}
public function canCache()
{
return $this->canCache;
......
<?php
namespace app\Models\parserSkripte;
use App\Models\Searchengine;
class RlvProduct extends Searchengine
{
public $results = [];
public function __construct(\SimpleXMLElement $engine, \App\MetaGer $metager)
{
parent::__construct($engine, $metager);
}
public function loadResults($result)
{
# try
# {
$results = json_decode($result, true);
$counter = 0;
foreach ($results["products"] as $result) {
$counter++;
$image = $result["productImage"];
$image = str_replace("//", "https://", $image);
$this->products[] = new \App\Models\Result(
$this->engine,
$result["productTitle"],
$result["shopLink"],
$result["shopLink"],
"",
$result["shopTitle"],
$counter,
['partnershop' => false,
'price' => $result["price"],
'image' => $image,
'shipping' => $result["distribution"]]
);
}
}
}
......@@ -22,7 +22,7 @@ elixir(function (mix) {
| scriptStartPage.js
| settings.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(['lib/jquery.js', 'lib/jquery-ui.min.js', 'lib/bootstrap.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'], 'public/js/scriptResultPage.js');
//mix.scripts(['scriptSubpages.js'], 'public/js/scriptSubpages.js');
......
(function ($, undefined) {
'use strict';
var defaults = {
item: 3,
autoWidth: false,
slideMove: 1,
slideMargin: 10,
addClass: '',
mode: 'slide',
useCSS: true,
cssEasing: 'ease', //'cubic-bezier(0.25, 0, 0.25, 1)',
easing: 'linear', //'for jquery animation',//
speed: 400, //ms'
auto: false,
pauseOnHover: false,
loop: false,
slideEndAnimation: true,
pause: 2000,
keyPress: false,
controls: true,
prevHtml: '',
nextHtml: '',
rtl: false,
adaptiveHeight: false,
vertical: false,
verticalHeight: 500,
vThumbWidth: 100,
thumbItem: 10,
pager: true,
gallery: false,
galleryMargin: 5,
thumbMargin: 5,
currentPagerPosition: 'middle',
enableTouch: true,
enableDrag: true,
freeMove: true,
swipeThreshold: 40,
responsive: [],
/* jshint ignore:start */
onBeforeStart: function ($el) {},
onSliderLoad: function ($el) {},
onBeforeSlide: function ($el, scene) {},
onAfterSlide: function ($el, scene) {},
onBeforeNextSlide: function ($el, scene) {},
onBeforePrevSlide: function ($el, scene) {}
/* jshint ignore:end */
};
$.fn.lightSlider = function (options) {
if (this.length === 0) {
return this;
}
if (this.length > 1) {
this.each(function () {
$(this).lightSlider(options);
});
return this;
}
var plugin = {},
settings = $.extend(true, {}, defaults, options),
settingsTemp = {},
$el = this;
plugin.$el = this;
if (settings.mode === 'fade') {
settings.vertical = false;
}
var $children = $el.children(),
windowW = $(window).width(),
breakpoint = null,
resposiveObj = null,
length = 0,
w = 0,
on = false,
elSize = 0,
$slide = '',
scene = 0,
property = (settings.vertical === true) ? 'height' : 'width',
gutter = (settings.vertical === true) ? 'margin-bottom' : 'margin-right',
slideValue = 0,
pagerWidth = 0,
slideWidth = 0,
thumbWidth = 0,
interval = null,
isTouch = ('ontouchstart' in document.documentElement);
var refresh = {};
refresh.chbreakpoint = function () {
windowW = $(window).width();
if (settings.responsive.length) {
var item;
if (settings.autoWidth === false) {
item = settings.item;
}
if (windowW < settings.responsive[0].breakpoint) {
for (var i = 0; i < settings.responsive.length; i++) {
if (windowW < settings.responsive[i].breakpoint) {
breakpoint = settings.responsive[i].breakpoint;
resposiveObj = settings.responsive[i];
}
}
}
if (typeof resposiveObj !== 'undefined' && resposiveObj !== null) {
for (var j in resposiveObj.settings) {
if (resposiveObj.settings.hasOwnProperty(j)) {
if (typeof settingsTemp[j] === 'undefined' || settingsTemp[j] === null) {
settingsTemp[j] = settings[j];
}
settings[j] = resposiveObj.settings[j];
}
}
}
if (!$.isEmptyObject(settingsTemp) && windowW > settings.responsive[0].breakpoint) {
for (var k in settingsTemp) {
if (settingsTemp.hasOwnProperty(k)) {
settings[k] = settingsTemp[k];
}
}
}
if (settings.autoWidth === false) {
if (slideValue > 0 && slideWidth > 0) {
if (item !== settings.item) {
scene = Math.round(slideValue / ((slideWidth + settings.slideMargin) * settings.slideMove));
}
}
}
}
};
refresh.calSW = function () {
if (settings.autoWidth === false) {
slideWidth = (elSize - ((settings.item * (settings.slideMargin)) - settings.slideMargin)) / settings.item;
}
};
refresh.calWidth = function (cln) {
var ln = cln === true ? $slide.find('.lslide').length : $children.length;
if (settings.autoWidth === false) {
w = ln * (slideWidth + settings.slideMargin);
} else {
w = 0;
for (var i = 0; i < ln; i++) {
w += (parseInt($children.eq(i).width()) + settings.slideMargin);
}
}
return w;
};
plugin = {
doCss: function () {
var support = function () {
var transition = ['transition', 'MozTransition', 'WebkitTransition', 'OTransition', 'msTransition', 'KhtmlTransition'];
var root = document.documentElement;
for (var i = 0; i < transition.length; i++) {
if (transition[i] in root.style) {
return true;
}
}
};
if (settings.useCSS && support()) {
return true;
}
return false;
},
keyPress: function () {
if (settings.keyPress) {
$(document).on('keyup.lightslider', function (e) {
if (!$(':focus').is('input, textarea')) {
if (e.preventDefault) {
e.preventDefault();
} else {
e.returnValue = false;
}
if (e.keyCode === 37) {
$el.goToPrevSlide();
} else if (e.keyCode === 39) {
$el.goToNextSlide();
}
}
});
}
},
controls: function () {
if (settings.controls) {
$el.after('<div class="lSAction"><a class="lSPrev">' + settings.prevHtml + '</a><a class="lSNext">' + settings.nextHtml + '</a></div>');
if (!settings.autoWidth) {
if (length <= settings.item) {
$slide.find('.lSAction').hide();
}
} else {
if (refresh.calWidth(false) < elSize) {
$slide.find('.lSAction').hide();
}
}
$slide.find('.lSAction a').on('click', function (e) {
if (e.preventDefault) {
e.preventDefault();
} else {
e.returnValue = false;
}
if ($(this).attr('class') === 'lSPrev') {
$el.goToPrevSlide();
} else {
$el.goToNextSlide();
}
return false;
});
}
},
initialStyle: function () {
var $this = this;
if (settings.mode === 'fade') {
settings.autoWidth = false;
settings.slideEndAnimation = false;
}
if (settings.auto) {
settings.slideEndAnimation = false;
}
if (settings.autoWidth) {
settings.slideMove = 1;
settings.item = 1;
}
if (settings.loop) {
settings.slideMove = 1;
settings.freeMove = false;
}
settings.onBeforeStart.call(this, $el);
refresh.chbreakpoint();
$el.addClass('lightSlider').wrap('<div class="lSSlideOuter ' + settings.addClass + '"><div class="lSSlideWrapper"></div></div>');
$slide = $el.parent('.lSSlideWrapper');
if (settings.rtl === true) {
$slide.parent().addClass('lSrtl');
}
if (settings.vertical) {
$slide.parent().addClass('vertical');
elSize = settings.verticalHeight;
$slide.css('height', elSize + 'px');
} else {
elSize = $el.outerWidth();
}
$children.addClass('lslide');
if (settings.loop === true && settings.mode === 'slide') {
refresh.calSW();
refresh.clone = function () {
if (refresh.calWidth(true) > elSize) {
/**/
var tWr = 0,
tI = 0;
for (var k = 0; k < $children.length; k++) {
tWr += (parseInt($el.find('.lslide').eq(k).width()) + settings.slideMargin);
tI++;
if (tWr >= (elSize + settings.slideMargin)) {
break;
}
}
var tItem = settings.autoWidth === true ? tI : settings.item;
/**/
if (tItem < $el.find('.clone.left').length) {
for (var i = 0; i < $el.find('.clone.left').length - tItem; i++) {
$children.eq(i).remove();
}
}
if (tItem < $el.find('.clone.right').length) {
for (var j = $children.length - 1; j > ($children.length - 1 - $el.find('.clone.right').length); j--) {
scene--;
$children.eq(j).remove();
}
}
/**/
for (var n = $el.find('.clone.right').length; n < tItem; n++) {
$el.find('.lslide').eq(n).clone().removeClass('lslide').addClass('clone right').appendTo($el);
scene++;
}
for (var m = $el.find('.lslide').length - $el.find('.clone.left').length; m > ($el.find('.lslide').length - tItem); m--) {
$el.find('.lslide').eq(m - 1).clone().removeClass('lslide').addClass('clone left').prependTo($el);
}
$children = $el.children();
} else {
if ($children.hasClass('clone')) {
$el.find('.clone').remove();
$this.move($el, 0);
}
}
};
refresh.clone();
}
refresh.sSW = function () {
length = $children.length;
if (settings.rtl === true && settings.vertical === false) {
gutter = 'margin-left';
}
if (settings.autoWidth === false) {
$children.css(property, slideWidth + 'px');
}
$children.css(gutter, settings.slideMargin + 'px');
w = refresh.calWidth(false);
$el.css(property, w + 'px');
if (settings.loop === true && settings.mode === 'slide') {
if (on === false) {
scene = $el.find('.clone.left').length;
}
}
};
refresh.calL = function () {
$children = $el.children();
length = $children.length;
};
if (this.doCss()) {
$slide.addClass('usingCss');
}
refresh.calL();
if (settings.mode === 'slide') {
refresh.calSW();
refresh.sSW();
if (settings.loop === true) {
slideValue = $this.slideValue();
this.move($el, slideValue);
}
if (settings.vertical === false) {
this.setHeight($el, false);
}
} else {
this.setHeight($el, true);
$el.addClass('lSFade');
if (!this.doCss()) {
$children.fadeOut(0);
$children.eq(scene).fadeIn(0);
}
}
if (settings.loop === true && settings.mode === 'slide') {
$children.eq(scene).addClass('active');
} else {
$children.first().addClass('active');
}
},
pager: function () {
var $this = this;
refresh.createPager = function () {
thumbWidth = (elSize - ((settings.thumbItem * (settings.thumbMargin)) - settings.thumbMargin)) / settings.thumbItem;
var $children = $slide.find('.lslide');
var length = $slide.find('.lslide').length;
var i = 0,
pagers = '',
v = 0;
for (i = 0; i < length; i++) {
if (settings.mode === 'slide') {
// calculate scene * slide value
if (!settings.autoWidth) {
v = i * ((slideWidth + settings.slideMargin) * settings.slideMove);
} else {
v += ((parseInt($children.eq(i).width()) + settings.slideMargin) * settings.slideMove);
}
}
var thumb = $children.eq(i * settings.slideMove).attr('data-thumb');
if (settings.gallery === true) {
pagers += '<li style="width:100%;' + property + ':' + thumbWidth + 'px;' + gutter + ':' + settings.thumbMargin + 'px"><a href="#"><img src="' + thumb + '" /></a></li>';
} else {
pagers += '<li><a href="#">' + (i + 1) + '</a></li>';
}
if (settings.mode === 'slide') {
if ((v) >= w - elSize - settings.slideMargin) {
i = i + 1;
var minPgr = 2;
if (settings.autoWidth) {
pagers += '<li><a href="#">' + (i + 1) + '</a></li>';
minPgr = 1;
}
if (i < minPgr) {
pagers = null;
$slide.parent().addClass('noPager');
} else {
$slide.parent().removeClass('noPager');
}
break;
}
}
}
var $cSouter = $slide.parent();
$cSouter.find('.lSPager').html(pagers);
if (settings.gallery === true) {
if (settings.vertical === true) {
// set Gallery thumbnail width
$cSouter.find('.lSPager').css('width', settings.vThumbWidth + 'px');
}
pagerWidth = (i * (settings.thumbMargin + thumbWidth)) + 0.5;
$cSouter.find('.lSPager').css({
property: pagerWidth + 'px',
'transition-duration': settings.speed + 'ms'
});
if (settings.vertical === true) {
$slide.parent().css('padding-right', (settings.vThumbWidth + settings.galleryMargin) + 'px');
}
$cSouter.find('.lSPager').css(property, pagerWidth + 'px');
}
var $pager = $cSouter.find('.lSPager').find('li');
$pager.first().addClass('active');
$pager.on('click', function () {
if (settings.loop === true && settings.mode === 'slide') {
scene = scene + ($pager.index(this) - $cSouter.find('.lSPager').find('li.active').index());
} else {
scene = $pager.index(this);
}
$el.mode(false);
if (settings.gallery === true) {
$this.slideThumb();
}
return false;
});
};
if (settings.pager) {
var cl = 'lSpg';
if (settings.gallery) {
cl = 'lSGallery';
}
$slide.after('<ul class="lSPager ' + cl + '"></ul>');
var gMargin = (settings.vertical) ? 'margin-left' : 'margin-top';
$slide.parent().find('.lSPager').css(gMargin, settings.galleryMargin + 'px');
refresh.createPager();
}
setTimeout(function () {
refresh.init();
}, 0);
},
setHeight: function (ob, fade) {
var obj = null,
$this = this;
if (settings.loop) {
obj = ob.children('.lslide ').first();
} else {
obj = ob.children().first();
}
var setCss = function () {
var tH = obj.outerHeight(),
tP = 0,
tHT = tH;
if (fade) {
tH = 0;
tP = ((tHT) * 100) / elSize;
}
ob.css({
'height': tH + 'px',
'padding-bottom': tP + '%'
});
};
setCss();
if (obj.find('img').length) {
if ( obj.find('img')[0].complete) {
setCss();
if (!interval) {
$this.auto();
}
}else{
obj.find('img').load(function () {
setTimeout(function () {
setCss();
if (!interval) {
$this.auto();
}
}, 100);
});
}
}else{
if (!interval) {
$this.auto();
}
}
},
active: function (ob, t) {
if (this.doCss() && settings.mode === 'fade') {
$slide.addClass('on');
}
var sc = 0;
if (scene * settings.slideMove < length) {
ob.removeClass('active');
if (!this.doCss() && settings.mode === 'fade' && t === false) {
ob.fadeOut(settings.speed);
}
if (t === true) {
sc = scene;
} else {
sc = scene * settings.slideMove;
}
//t === true ? sc = scene : sc = scene * settings.slideMove;
var l, nl;
if (t === true) {
l = ob.length;
nl = l - 1;
if (sc + 1 >= l) {
sc = nl;
}
}
if (settings.loop === true && settings.mode === 'slide') {
//t === true ? sc = scene - $el.find('.clone.left').length : sc = scene * settings.slideMove;
if (t === true) {
sc = scene - $el.find('.clone.left').length;
} else {
sc = scene * settings.slideMove;
}
if (t === true) {
l = ob.length;
nl = l - 1;
if (sc + 1 === l) {
sc = nl;
} else if (sc + 1 > l) {
sc = 0;
}
}
}
if (!this.doCss() && settings.mode === 'fade' && t === false) {
ob.eq(sc).fadeIn(settings.speed);
}
ob.eq(sc).addClass('active');
} else {
ob.removeClass('active');
ob.eq(ob.length - 1).addClass('active');
if (!this.doCss() && settings.mode === 'fade' && t === false) {
ob.fadeOut(settings.speed);
ob.eq(sc).fadeIn(settings.speed);
}
}
},
move: function (ob, v) {
if (settings.rtl === true) {
v = -v;
}
if (this.doCss()) {
if (settings.vertical === true) {
ob.css({
'transform': 'translate3d(0px, ' + (-v) + 'px, 0px)',
'-webkit-transform': 'translate3d(0px, ' + (-v) + 'px, 0px)'
});
} else {
ob.css({
'transform': 'translate3d(' + (-v) + 'px, 0px, 0px)',
'-webkit-transform': 'translate3d(' + (-v) + 'px, 0px, 0px)',
});
}
} else {
if (settings.vertical === true) {
ob.css('position', 'relative').animate({
top: -v + 'px'
}, settings.speed, settings.easing);
} else {
ob.css('position', 'relative').animate({
left: -v + 'px'
}, settings.speed, settings.easing);
}
}
var $thumb = $slide.parent().find('.lSPager').find('li');
this.active($thumb, true);
},
fade: function () {
this.active($children, false);
var $thumb = $slide.parent().find('.lSPager').find('li');
this.active($thumb, true);
},
slide: function () {
var $this = this;
refresh.calSlide = function () {
if (w > elSize) {
slideValue = $this.slideValue();
$this.active($children, false);
if ((slideValue) > w - elSize - settings.slideMargin) {
slideValue = w - elSize - settings.slideMargin;
} else if (slideValue < 0) {
slideValue = 0;
}
$this.move($el, slideValue);
if (settings.loop === true && settings.mode === 'slide') {
if (scene >= (length - ($el.find('.clone.left').length / settings.slideMove))) {
$this.resetSlide($el.find('.clone.left').length);
}
if (scene === 0) {
$this.resetSlide($slide.find('.lslide').length);
}
}
}
};
refresh.calSlide();
},