vendor: 2,684 bytes, lines 1-92
1/*! 2 * Morphext - Text Rotating Plugin for jQuery 3 * https://github.com/MrSaints/Morphext 4 * 5 * Built on jQuery Boilerplate 6 * http://jqueryboilerplate.com/ 7 * 8 * Copyright 2014 Ian Lai and other contributors 9 * Released under the MIT license 10 * http://ian.mit-license.org/ 11 */ 12 13/*eslint-env browser */ 14/*global jQuery:false */ 15/*eslint-disable no-underscore-dangle */ 16 17(function ($) { 18 "use strict"; 19 20 var pluginName = "Morphext", 21 defaults = { 22 animation: "bounceIn", 23 separator: ",", 24 speed: 2000, 25 activeClass: 'active', 26 loop: 10, // loop n times around TBC 27 complete: $.noop 28 }; 29 30 function Plugin (element, options) { 31 this.element = $(element); 32 33 this.settings = $.extend({}, defaults, options); 34 this._defaults = defaults; 35 this._init(); 36 } 37 38 Plugin.prototype = { 39 _init: function () { 40 var $that = this; 41 this.position = 0; 42 this.loops = 0; 43 this.phrases = []; 44 45 this.element.addClass("morphext"); 46 47 $.each(this.element.text().split(this.settings.separator), function (key, value) { 48 $that.phrases.push($.trim(value)); 49 50 }); 51 this.loops = this.settings.loop * this.phrases.length; 52 53 this.index = -1; 54 this.animate(); 55 this.start(); 56 57 }, 58 animate: function () { 59 this.position++; 60 this.index = ++this.index % this.phrases.length; 61 this.element[0].innerHTML = "<span class=\"animated " + this.settings.animation + "\">" + this.phrases[this.index] + "</span>"; 62 this.element[0].classList.add(this.settings.activeClass); 63 64 65 66 //console.log(this.position); 67 if(this.position == this.loops){ 68 this.stop(); 69 } 70 if ($.isFunction(this.settings.complete)) { 71 this.settings.complete.call(this); 72 } 73 }, 74 start: function () { 75 var $that = this; 76 this._interval = setInterval(function () { 77 $that.animate(); 78 }, this.settings.speed); 79 }, 80 stop: function () { 81 this._interval = clearInterval(this._interval); 82 } 83 }; 84 85 $.fn[pluginName] = function (options) { 86 return this.each(function() { 87 if (!$.data(this, "plugin_" + pluginName)) { 88 $.data(this, "plugin_" + pluginName, new Plugin(this, options)); 89 } 90 }); 91 }; 92})(jQuery);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.