diff --git a/dist/v-scrollin.esm.js b/dist/v-scrollin.esm.js index f1a0a10..911231f 100644 --- a/dist/v-scrollin.esm.js +++ b/dist/v-scrollin.esm.js @@ -58,6 +58,7 @@ var component = {render: function(){var _vm=this;var _h=_vm.$createElement;var _ ]; }, replace: function replace(str, i, replacement) { + if (!replacement) { return str } return ( str.substr(0, i) + replacement + str.substr(i + replacement.length) ); diff --git a/dist/v-scrollin.min.js b/dist/v-scrollin.min.js index f64ac5f..5970c32 100644 --- a/dist/v-scrollin.min.js +++ b/dist/v-scrollin.min.js @@ -1 +1 @@ -var VScrollin=function(t,e){"use strict";function i(t){i.installed||(i.installed=!0,t.component("VScrollin",s))}!function(){if("undefined"!=typeof document){var t=document.head||document.getElementsByTagName("head")[0],e=document.createElement("style");e.type="text/css",e.styleSheet?e.styleSheet.cssText="":e.appendChild(document.createTextNode("")),t.appendChild(e)}}();var s={render:function(){var t=this,e=t.$createElement;return(t._self._c||e)("div",{staticClass:"v-scrollin"},[t._v(" "+t._s(t.scrollingText)+" ")])},staticRenderFns:[],name:"VScrollin",props:{characters:{type:Array,required:!1,default:function(){return"qwertyuiopasdfghjklzxcvbnm".split("")}},misses:{type:Number,required:!1,default:4},speed:{type:Number,required:!1,default:80}},data:function(){return{amountFinished:0,currentMisses:0,finishedText:this.$slots.default[0].text,scroll:null,scrollingText:"",workingIndices:[]}},mounted:function(){var t=this;this.fillRandomLetters(),this.scroll=e.setInterval(function(){t.tick()},this.speed)},methods:{fillRandomLetters:function(){for(var t=this,e=[],i=0;i=this.finishedText.length-2?this.workingIndices.sort(function(t,e){return t-e}).shift():this.workingIndices.sort(function(t,e){return t-e})[0]=this.amountFinished+3)}}},n={install:i},r=null;return"undefined"!=typeof window?r=window.Vue:"undefined"!=typeof global&&(r=global.Vue),r&&r.use(n),t.install=i,t.default=s,t}({},timers); +var VScrollin=function(t,e){"use strict";function i(t){i.installed||(i.installed=!0,t.component("VScrollin",s))}!function(){if("undefined"!=typeof document){var t=document.head||document.getElementsByTagName("head")[0],e=document.createElement("style");e.type="text/css",e.styleSheet?e.styleSheet.cssText="":e.appendChild(document.createTextNode("")),t.appendChild(e)}}();var s={render:function(){var t=this,e=t.$createElement;return(t._self._c||e)("div",{staticClass:"v-scrollin"},[t._v(" "+t._s(t.scrollingText)+" ")])},staticRenderFns:[],name:"VScrollin",props:{characters:{type:Array,required:!1,default:function(){return"qwertyuiopasdfghjklzxcvbnm".split("")}},misses:{type:Number,required:!1,default:4},speed:{type:Number,required:!1,default:80}},data:function(){return{amountFinished:0,currentMisses:0,finishedText:this.$slots.default[0].text,scroll:null,scrollingText:"",workingIndices:[]}},mounted:function(){var t=this;this.fillRandomLetters(),this.scroll=e.setInterval(function(){t.tick()},this.speed)},methods:{fillRandomLetters:function(){for(var t=this,e=[],i=0;i=this.finishedText.length-2?this.workingIndices.sort(function(t,e){return t-e}).shift():this.workingIndices.sort(function(t,e){return t-e})[0]=this.amountFinished+3)}}},n={install:i},r=null;return"undefined"!=typeof window?r=window.Vue:"undefined"!=typeof global&&(r=global.Vue),r&&r.use(n),t.install=i,t.default=s,t}({},timers); diff --git a/dist/v-scrollin.umd.js b/dist/v-scrollin.umd.js index e3e7f00..a1b26b1 100644 --- a/dist/v-scrollin.umd.js +++ b/dist/v-scrollin.umd.js @@ -62,6 +62,7 @@ ]; }, replace: function replace(str, i, replacement) { + if (!replacement) { return str } return ( str.substr(0, i) + replacement + str.substr(i + replacement.length) ); diff --git a/package.json b/package.json index 706e782..c81de43 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "vue-scrollin", - "version": "0.1.1", + "version": "0.1.2", "description": "Vue scroll-in text component", "author": "William L ", "license": "MIT",