PATH:
home
/
letacommog
/
letaweb
/
scripts
/
editor
/
modules
define(['module/base'],function(base) { return createModuleDefinition([base], function($window,$file_manager) { this.initializeData = { images: [ {src:'/assets/samples/image.png',caption:'Enter caption here',description:'Enter description here',link:''}, {src:'/assets/samples/image.png',caption:'Enter caption here',description:'Enter description here',link:''}, {src:'/assets/samples/image.png',caption:'Enter caption here',description:'Enter description here',link:''}, ], effect:'effect1', shape:'square', column:4, margin:20, align:'top-right', direction:'top_to_bottom', }; this.controller = function($scope, $moduleInstance) { var full_directions = { effect1:{ square:['left_to_right','top_to_bottom','bottom_to_top',], circle:['left_to_right','top_to_bottom','bottom_to_top']}, effect2:{ square:[], circle:['left_to_right','right_to_left','top_to_bottom','bottom_to_top',]}, effect3:{ square:['top_to_bottom','bottom_to_top',], circle:['left_to_right','right_to_left','top_to_bottom','bottom_to_top',]}, effect4:{ square:[], circle:['left_to_right','right_to_left','top_to_bottom','bottom_to_top',]}, effect5:{ square:['left_to_right','right_to_left',], circle:[]}, effect6:{ square:['from_left_and_right','top_to_bottom','bottom_to_top','from_top_and_bottom'], circle:[]}, effect7:{ square:[], circle:['left_to_right','right_to_left','top_to_bottom','bottom_to_top']}, effect8:{ square:[], circle:['left_to_right','right_to_left','top_to_bottom','bottom_to_top',]}, effect9:{ square:['left_to_right','right_to_left','top_to_bottom','bottom_to_top',], circle:['left_to_right','right_to_left','top_to_bottom','bottom_to_top',]}, effect10:{ square:['left_to_right','right_to_left','top_to_bottom','bottom_to_top'], circle:['top_to_bottom','bottom_to_top']}, effect11:{ square:['left_to_right','right_to_left','top_to_bottom','bottom_to_top'], circle:['left_to_right','right_to_left','top_to_bottom','bottom_to_top']}, effect12:{ square:['left_to_right','right_to_left','top_to_bottom','bottom_to_top'], circle:['left_to_right','right_to_left','top_to_bottom','bottom_to_top']}, effect13:{ square:['left_to_right','right_to_left','top_to_bottom','bottom_to_top'], circle:['from_left_and_right','top_to_bottom','bottom_to_top']}, effect14:{ square:['left_to_right','right_to_left','top_to_bottom','bottom_to_top'], circle:['left_to_right','right_to_left','top_to_bottom','bottom_to_top']}, effect15:{ square:['left_to_right','right_to_left','top_to_bottom','bottom_to_top'], circle:[]} } $scope.changeShape = function() { var element = $moduleInstance.getElement().find('.ih-item'); var shapes = ['circle', 'square']; for(var i in shapes) { if(!shapes[i]) continue; element.removeClass(shapes[i]); } element.addClass($scope.data.shape); $scope.directions = full_directions[$scope.data.effect][$scope.data.shape] } $scope.changeEffect = function() { var element = $moduleInstance.getElement().find('.ih-item'); for(var i = 0;i < 15;i++) { element.removeClass('effect' + i); } element.addClass($scope.data.effect); $scope.directions = full_directions[$scope.data.effect][$scope.data.shape]; if($scope.directions!= undefined && $scope.directions.length ==0){ $scope.data.direction=""; $scope.changeDirection(); } else if($scope.directions!= undefined){ if($scope.directions.indexOf($scope.data.direction) == -1 ) { $scope.data.direction = $scope.directions[0]; $scope.changeDirection(); } } } $scope.changeDirection = function() { var element = $moduleInstance.getElement().find('.ih-item'); for(var i in full_directions) { if(!full_directions[i]) continue; for(var j in full_directions[i]) { if(!full_directions[i][j]) continue; for(var k in full_directions[i][j]) { if(!full_directions[i][j][k]) continue; element.removeClass(full_directions[i][j][k]); } } } element.addClass($scope.data.direction); } $scope.enter_url_mode = 0; $scope.selectFile = function() { $file_manager.open().result.then(function(images) { if(images.length == 0) return; var image = images[0]; $scope.data.image = (image.full_url); $scope.changeSource(); }); } $scope.onUploadComplete = function(files) { if(files!= undefined && files.length > 0) { var file = files[0].response; $scope.data.image = (file.full_url); $scope.changeSource(); } }; $scope.data = $scope.data || {}; $scope.data.margin = parseInt($scope.data.margin || 20); $scope.changeEffect(); $scope.data.column = $scope.data.column || 1; $scope.deleteImageItem = function($index) { var r = confirm("Delete slide!"); if (!r) { return; } var portfolioList = $moduleInstance.getElement().children('.portfolio-container').children('.portfolio-list'); var gallery_item = jQuery('.portfolio-item', portfolioList).eq($index); gallery_item.remove(); $scope.data.images.splice($index ,1); relayout(); }; function relayout() { var portfolioList = $moduleInstance.getElement().children('.portfolio-container').children('.portfolio-list'); var isotopeInstance = portfolioList.data('isotope' ); if ( isotopeInstance ) isotopeInstance.destroy(); $moduleInstance.getElement().cherryPortfolioLayoutPlugin(); } $scope.onItemAdded = function() { var new_item = $scope.data.images[$scope.data.images.length - 1]; var portfolioList = $moduleInstance.getElement().children('.portfolio-container').children('.portfolio-list'); id = $moduleInstance.getPage_id(); var portfolioItem = jQuery('<div class="portfolio-item"><div class="inner-wrap"><div class="ih-item"><a href="#"><div class="img"></div><div class="info"></div></a></div></div></div>'); jQuery('.img',portfolioItem).html('<div class="ih-wrapper"></div><img alt="" src="'+new_item.src+'">'); jQuery('.item_content',portfolioItem).html('<div class="info"><h3>'+new_item.caption+'</h3></div><div class="info_description"><p>'+new_item.description+'</p></div>'); portfolioList.append(portfolioItem); relayout(); $scope.changeEffect(); $scope.changeShape(); $scope.changeDirection(); }; var ctrl = this; this._selectSlide = function(index) { if($scope.editing_item == index) return false; $scope.editing_item = $scope.data.images[index]; $scope.editing = true; $scope.editing_index = index; } ctrl._selectSlide(0); $scope.editImageItem = function(index) { ctrl._selectSlide(index); }; $scope.editSlideBG = function() { $file_manager.open().result.then(function(images) { if(images.length == 0) return; var image = images[0]; $scope.editing_item.src = image.full_url; var gallery_item = $moduleInstance.getElement().children('.portfolio-container').children('.portfolio-list').children('.portfolio-item:eq('+$scope.editing_index+')'); var image = jQuery('img',gallery_item); image.attr('src', $scope.editing_item.src); }); } $scope.changeSlideInfo = function() { var portfolioList = $moduleInstance.getElement().children('.portfolio-container').children('.portfolio-list'); var gallery_item = jQuery('.portfolio-item', portfolioList).eq($scope.editing_index); var item_content = jQuery('.info', gallery_item); jQuery('h3', item_content).html($scope.editing_item.caption); jQuery('p', item_content).html($scope.editing_item.description); } $scope.addImageItem = function() { $file_manager.open().result.then(function(images) { if(images.length == 0) return; var image = images[0]; var data = {src:image.full_url,caption:'Enter caption here',description:'Enter description here',link:'#' }; $scope.data.images.push(data); $scope.onItemAdded(); }); } $scope.changeColumn = function() { $moduleInstance.getElement().children('.portfolio-container').data('column',$scope.data.column); relayout(); } $scope.changeMargin = function() { $moduleInstance.getElement().children('.portfolio-container').data('item-margin',$scope.data.margin); relayout(); } }; }) });
[+]
..
[-] productlist.js
[edit]
[-] facebookvideo.js
[edit]
[-] newslist.js
[edit]
[-] image.js
[edit]
[-] video.js
[edit]
[-] button.js
[edit]
[-] zone.js
[edit]
[-] text.js
[edit]
[-] newscategory.js
[edit]
[-] googlemap.js
[edit]
[-] base_structure.js
[edit]
[-] contactform.js
[edit]
[-] spacer.js
[edit]
[-] infobox.js
[edit]
[-] html.js
[edit]
[-] testmodule.js
[edit]
[-] facebookcomment.js
[edit]
[-] iframe.js
[edit]
[-] twitterfeed.js
[edit]
[-] recentnews.js
[edit]
[-] audio_player.js
[edit]
[-] slick.js
[edit]
[-] newsdetail.js
[edit]
[-] facebookpost.js
[edit]
[-] pagezone.js
[edit]
[-] panigation.js
[edit]
[-] row.js
[edit]
[-] __custom_module_template.js
[edit]
[-] carousel.js
[edit]
[-] icon.js
[edit]
[-] typedtext.js
[edit]
[-] newscomment.js
[edit]
[-] box.js
[edit]
[-] base_custom.js
[edit]
[-] wordpress.js
[edit]
[-] base.js
[edit]
[-] column.js
[edit]
[-] fancytext.js
[edit]
[-] recentproduct.js
[edit]
[-] statcounter.js
[edit]
[-] tab.js
[edit]
[-] bootstrap_slider.js
[edit]
[-] ihover.js
[edit]
[-] line.js
[edit]
[-] blogger.js
[edit]
[-] slideshow.js
[edit]
[-] title.js
[edit]
[-] facebookpage.js
[edit]
[-] share_buttons.js
[edit]
[-] facebooklike.js
[edit]
[-] infobanner.js
[edit]
[-] rssfeed.js
[edit]
[-] flash.js
[edit]
[-] countdown.js
[edit]
[-] facebooksend.js
[edit]
[-] mailchimp.js
[edit]
[-] infotable.js
[edit]
[-] navbar.js
[edit]
[-] cycleslider.js
[edit]
[-] modal.js
[edit]
[-] embed.js
[edit]
[-] alert.js
[edit]
[-] progress_bar.js
[edit]
[-] accordion.js
[edit]
[-] youtube.js
[edit]
[-] social_buttons.js
[edit]
[-] productcategory.js
[edit]
[-] menu.js
[edit]
[-] pricetable.js
[edit]
[-] productdetail.js
[edit]
[-] gallery.js
[edit]