1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110
| define(['app', 'ngload!wowslider', 'ngload!scriptslider'], function (app) {
"use strict";
app.register.directive('goldSlider', function () {
var glSlider = {};
glSlider.restrict = 'E';
glSlider.controller = 'RootCategoriesController';
glSlider.replace = true;
glSlider.template =
'<div class="row">' +
'<div class="col-md-2-1" ng-repeat="item in topData">' +
'<article>' +
'<div class="category-header">' +
'<a id="header{{item.data.OrderNumber}}" class="rootcategory" href="#/categories/{{item.data.CategoryID}}"></a>' +
'</div>' +
'<div id="ws-wrapper{{item.data.OrderNumber}}" class="ws-wrapper">' +
'<div class="ws_images">' +
'<ul ng-if="item.data.Products.length" id="ws_images{{item.data.OrderNumber}}">' +
'<li ng-repeat="entry in item.Products">' +
'<a id="{{entry.ProductID}}" href=""><img src="{{imageServerPath}}{{entry.ImageUri}}" alt="{{entry.ProductName}}{{formatCurrency(entry.Currency, entry.UnitPrice)}}" title="{{entry.ProductName}}{{formatCurrency(entry.Currency, entry.UnitPrice)}}" /></a>' +
'</li>' +
'</ul>' +
'<p ng-if="!item.data.Products.length">{{noProdMessage}}</p>' +
'</div>' +
'</article>' +
'</div>' +
'</div>' +
'<div class="row">' +
'<div class="col-md-2-1" ng-repeat="item2 in bottomData">' +
'<article>' +
'<div class="category-header">' +
'<a id="header{{item2.data.OrderNumber}}" class="rootcategory" href="#/categories/{{item2.data.CategoryID}}"></a>' +
'</div>' +
'<div id="ws-wrapper{{item2.data.OrderNumber}}" class="ws-wrapper">' +
'<div class="ws_images">' +
'<ul ng-if="item2.data.Products.length" id="ws_images{{item2.data.OrderNumber}}">' +
'<li ng-repeat="entry2 in item2.Products">' +
'<a id="{{entry2.ProductID}}" href=""><img src="{{imageServerPath}}{{entry2.ImageUri}}" alt="{{entry2.ProductName}}{{formatCurrency(entry2.Currency, entry2.UnitPrice)}}" title="{{entry2.ProductName}}{{formatCurrency(entry2.Currency, entry2.UnitPrice)}}" /></a>' +
'</li>' +
'</ul>' +
'<p ng-if="!item2.data.Products.length">{{noProdMessage}}</p>' +
'</div>' +
'</article>' +
'</div>' +
'</div>';
glSlider.scope = {};
glSlider.link = function (scope, element, attrs, rootCategoriesCtrl) {
scope.imageServerPath = rootCategoriesCtrl.imageServerPath;
scope.noProdMessage = rootCategoriesCtrl.noProdMessage;
scope.topData = rootCategoriesCtrl.topData;
scope.bottomData = rootCategoriesCtrl.bottomData;
scope.objIndic = rootCategoriesCtrl.objIndic;
scope.applyPlugin();
scope.formatCurrency = function (currency, value) {
return " - " + rootCategoriesCtrl.formatCurrency(currency, value);
}
scope.applyPlugin = function () {
var script = document.createElement("script");
script.type = "text/javascript";
if (objIndic.isWrapper1) {
script.text = script.text + 'jQuery("#ws-wrapper1").wowSlider({ effect:"cube",prev:"",next:"",duration:50*100,delay:50*100,width:232,height:235,autoPlay:true,autoPlayVideo:false,playPause:false,stopOnHover:true,loop:false,bullets:0,caption:true,captionEffect:"parallax",controls:true,responsive:1,fullScreen:false,gestures:1,onBeforeStep:0,images:0 });';
}
if (objIndic.isWrapper2) {
script.text = script.text + 'jQuery("#ws-wrapper2").wowSlider({ effect:"cube",prev:"",next:"",duration:50*100,delay:50*100,width:232,height:235,autoPlay:true,autoPlayVideo:false,playPause:false,stopOnHover:true,loop:false,bullets:0,caption:true,captionEffect:"parallax",controls:true,responsive:1,fullScreen:false,gestures:1,onBeforeStep:0,images:0 });';
}
if (objIndic.isWrapper3) {
script.text = script.text + 'jQuery("#ws-wrapper3").wowSlider({ effect:"cube",prev:"",next:"",duration:50*100,delay:50*100,width:232,height:235,autoPlay:true,autoPlayVideo:false,playPause:false,stopOnHover:true,loop:false,bullets:0,caption:true,captionEffect:"parallax",controls:true,responsive:1,fullScreen:false,gestures:1,onBeforeStep:0,images:0 });';
}
if (objIndic.isWrapper4) {
script.text = script.text + 'jQuery("#ws-wrapper4").wowSlider({ effect:"cube",prev:"",next:"",duration:50*100,delay:50*100,width:232,height:235,autoPlay:true,autoPlayVideo:false,playPause:false,stopOnHover:true,loop:false,bullets:0,caption:true,captionEffect:"parallax",controls:true,responsive:1,fullScreen:false,gestures:1,onBeforeStep:0,images:0 });';
}
if (objIndic.isWrapper5) {
script.text = script.text + 'jQuery("#ws-wrapper5").wowSlider({ effect:"cube",prev:"",next:"",duration:50*100,delay:50*100,width:232,height:235,autoPlay:true,autoPlayVideo:false,playPause:false,stopOnHover:true,loop:false,bullets:0,caption:true,captionEffect:"parallax",controls:true,responsive:1,fullScreen:false,gestures:1,onBeforeStep:0,images:0 });';
}
if (objIndic.isWrapper6) {
script.text = script.text + 'jQuery("#ws-wrapper6").wowSlider({ effect:"cube",prev:"",next:"",duration:50*100,delay:50*100,width:232,height:235,autoPlay:true,autoPlayVideo:false,playPause:false,stopOnHover:true,loop:false,bullets:0,caption:true,captionEffect:"parallax",controls:true,responsive:1,fullScreen:false,gestures:1,onBeforeStep:0,images:0 });';
}
if (objIndic.isWrapper7) {
script.text = script.text + 'jQuery("#ws-wrapper7").wowSlider({ effect:"cube",prev:"",next:"",duration:50*100,delay:50*100,width:232,height:235,autoPlay:true,autoPlayVideo:false,playPause:false,stopOnHover:true,loop:false,bullets:0,caption:true,captionEffect:"parallax",controls:true,responsive:1,fullScreen:false,gestures:1,onBeforeStep:0,images:0 });';
}
if (objIndic.isWrapper8) {
script.text = script.text + 'jQuery("#ws-wrapper8").wowSlider({ effect:"cube",prev:"",next:"",duration:50*100,delay:50*100,width:232,height:235,autoPlay:true,autoPlayVideo:false,playPause:false,stopOnHover:true,loop:false,bullets:0,caption:true,captionEffect:"parallax",controls:true,responsive:1,fullScreen:false,gestures:1,onBeforeStep:0,images:0 });';
}
if (objIndic.isWrapper9) {
script.text = script.text + 'jQuery("#ws-wrapper9").wowSlider({ effect:"cube",prev:"",next:"",duration:50*100,delay:50*100,width:232,height:235,autoPlay:true,autoPlayVideo:false,playPause:false,stopOnHover:true,loop:false,bullets:0,caption:true,captionEffect:"parallax",controls:true,responsive:1,fullScreen:false,gestures:1,onBeforeStep:0,images:0 });';
}
if (objIndic.isWrapper10) {
script.text = script.text + 'jQuery("#ws-wrapper10").wowSlider({ effect:"cube",prev:"",next:"",duration:50*100,delay:50*100,width:232,height:235,autoPlay:true,autoPlayVideo:false,playPause:false,stopOnHover:true,loop:false,bullets:0,caption:true,captionEffect:"parallax",controls:true,responsive:1,fullScreen:false,gestures:1,onBeforeStep:0,images:0 });';
}
document.body.appendChild(script);
}
};
return glSlider;
});
}); |
Partager