PATH:
home
/
letacommog
/
letaweb
/
admin
/
modules
/
typedtext
define(['module/base'],function(base) { return createModuleDefinition([base], function($window) { this.initializeData = { texts:[ {label:'Well done! You successfully read this important alert message. '}, {label:'Heads up! This alert needs your attention, but it\'s not super important.'} ], prefix_text:'Before', postfix_text:'After', settings : { typeSpeed: 0, startDelay: 0, backSpeed: 0, backDelay: 500, showItems: 1, height: 0, margin: 0, padding: 0, loopCount:1 } }; this.getState = function() { return jQuery('#' + this.page_id + '_typed').data('typed'); }; this.controller = function($scope, $moduleInstance) { var state = $moduleInstance.getState(); var vtickerEl = jQuery('#' + $moduleInstance.page_id + '_typed'); $scope.animating = true; vtickerEl.unbind("type_animating"); vtickerEl.bind("type_animating", function() { $scope.animating = true; $scope.$digest(); }); vtickerEl.unbind("type_completed"); vtickerEl.bind("type_completed", function() { $scope.animating = false; $scope.$digest(); }); $scope.editText = function(index) { getElement(index); $scope.data.texts[index].edit_mode = 1; } var getElement = function(index) { var state = $moduleInstance.getState(); if(state.topIndex!= undefined) { var topIndex = state.topIndex % state.itemCount; var realIndex = (index - topIndex) < 0 ? (state.itemCount + index - topIndex) : (index - topIndex); // console.log(state.itemCount,realIndex); //console.log(vtickerEl.children('ul').children('li').eq( realIndex)); return (vtickerEl.children('ul').children('li').eq( realIndex)); } } $scope.changeLabel = function(index) { if($scope.animating) return; var state = $moduleInstance.getState(); var label = $scope.data.texts[index].label; state.strings[index] = label; if(index == $scope.data.texts.length - 1) { jQuery('#' + $moduleInstance.page_id + '_typed').html(label); } } $scope.deleteText = function(index) { if($scope.animating) return; $scope.data.texts.splice(index,1); var alertElement = $moduleInstance.getElement().children().children('.alert:eq('+index+')'); alertElement.remove(); console.log(alertElement); } $scope.addText = function() { if($scope.animating) return; var state = $moduleInstance.getState(); var p = {icon:'fa fa-info-circle',label:'New Text.'}; $scope.data.texts.push(p); state.strings.push(p.label); } $scope.changePostfix = function() { var postElement = vtickerEl.next('span'); postElement.html($scope.data.postfix_text) } $scope.changePrefix = function() { var preElement = vtickerEl.prev('span'); preElement.html($scope.data.prefix_text) } $scope.changeSettings = function() { this.typeSpeed = this.options.typeSpeed; this.startDelay = this.options.startDelay; this.backSpeed = this.options.backSpeed; this.backDelay = this.options.backDelay; } $scope.play = function() { play(); } $scope.stop = function() { stop(); } var play = function() { var state = $moduleInstance.getState(); $scope.animating = true; jQuery('.typed-cursor',$moduleInstance.getElement()).remove(); state.arrayPos = 0; state.stop = false; state.build(); } var stop = function() { var state = $moduleInstance.getState(); state.stop = true; } }; }) });
[+]
..
[-] frontend_script.php
[edit]
[-] frontend_class.php
[edit]
[-] backend.php
[edit]
[-] frontend_view.php
[edit]
[-] backend.js
[edit]