diff --git a/README.md b/README.md
index 68f268cd..1a7472f1 100644
--- a/README.md
+++ b/README.md
@@ -48,7 +48,7 @@ To get started, first select a license:
Get it from this repo, or from the following sources:
-* CDN: Include `https://cdn.jsdelivr.net/jquery.typeit/4.2.0/typeit.min.js` or `https://cdnjs.cloudflare.com/ajax/libs/typeit/4.2.0/typeit.min.js` on your page.
+* CDN: Include `https://cdn.jsdelivr.net/jquery.typeit/4.2.1/typeit.min.js` or `https://cdnjs.cloudflare.com/ajax/libs/typeit/4.2.1/typeit.min.js` on your page.
* npm: Install with `npm install typeit`.
### Hook It Up
@@ -60,7 +60,7 @@ Get it from this repo, or from the following sources:
```
-2. Create an empty HTML element to select. (If you want to have a fallback for users without JavaScript, you can put a string or strings right into this element. More on that later.)
+2. Create an empty HTML element to select. (If you want to have a fallback for users without JavaScript, you can put a string or strings right into this element. For more on that, see the full documentation..)
```html
@@ -115,7 +115,7 @@ For example:
You can modify the options for the plugin by passging in JSON.
-There are a number of options you may use to customize typeIt.
+There are a number of options you may use to customize TypeIt. For more details on these options, view the full documentation.
| Option | Description | Default Value
| ------------- | ------------- | ------------- |
@@ -140,7 +140,7 @@ This project is setup with Gulp to lint & minify the JavaScript. In the root of
```
npm install
-gulp develop
+gulp
```
## Donations
diff --git a/dev/typeit.js b/dev/typeit.js
index 74d53e7a..2e59c263 100644
--- a/dev/typeit.js
+++ b/dev/typeit.js
@@ -1,7 +1,7 @@
/**
* jQuery TypeIt
* @author Alex MacArthur (http://macarthur.me)
- * @version 4.2.0
+ * @version 4.2.1
* @copyright 2016 Alex MacArthur
* @description Types out a given string or strings.
*/
@@ -57,7 +57,7 @@
this.tel = this.el.find('span');
this.insert = function(c) {
- this.tel.append(c);
+ this.tel.append(c);
};
if(this.s.startDelete) {
@@ -273,15 +273,40 @@
},
_isVisible : function() {
- var $win = $(window);
-
- var docTop = $win.scrollTop();
- var docBottom = docTop + $win.height();
-
- var elTop = this.el.offset().top;
- var elBottom = elTop + this.el.height();
-
- return ((elBottom <= docBottom) && (elTop >= docTop));
+ var win = $(window);
+
+ var viewport = {
+ top : win.scrollTop(),
+ left : win.scrollLeft()
+ };
+ viewport.right = viewport.left + win.width();
+ viewport.bottom = viewport.top + win.height();
+
+ var height = this.el.outerHeight();
+ var width = this.el.outerWidth();
+
+ if(!width || !height){
+ return false;
+ }
+
+ var bounds = this.el.offset();
+ bounds.right = bounds.left + width;
+ bounds.bottom = bounds.top + height;
+
+ var visible = (!(viewport.right < bounds.left || viewport.left > bounds.right || viewport.bottom < bounds.top || viewport.top > bounds.bottom));
+
+ if(!visible){
+ return false;
+ }
+
+ var deltas = {
+ top : Math.min( 1, ( bounds.bottom - viewport.top ) / height),
+ bottom : Math.min(1, ( viewport.bottom - bounds.top ) / height),
+ left : Math.min(1, ( bounds.right - viewport.left ) / width),
+ right : Math.min(1, ( viewport.right - bounds.left ) / width)
+ };
+
+ return (deltas.left * deltas.right) >= 1 && (deltas.top * deltas.bottom) >= 1;
},
/*
@@ -438,4 +463,4 @@ $.fn.tiSettings = function(settings) {
return this;
};
-}(jQuery));
\ No newline at end of file
+}(jQuery));
diff --git a/dev/typeit.min.js b/dev/typeit.min.js
index 0eec3324..cddc6a4a 100644
--- a/dev/typeit.min.js
+++ b/dev/typeit.min.js
@@ -1 +1 @@
-!function(t,e){var s=t(document);t.fn.typeIt=function(e){return this.each(function(){var i=t(this);i.data("typeit",new t.typeIt(i,e))})},t.typeIt=function(i,s){this.d={strings:[],speed:100,deleteSpeed:e,lifeLike:!0,cursor:!0,cursorSpeed:1e3,breakLines:!0,breakDelay:750,startDelay:250,startDelete:!1,loop:!1,loopDelay:750,html:!0,autoStart:!0,callback:function(){}},this.queue=[],this.queueIndex=0,this.hasStarted=!1,this.inTag=!1,this.stringsToDelete="",this.style='style="display:inline;position:relative;font:inherit;color:inherit;"',this.s=t.extend({},this.d,s),this.el=i,this._init()},t.typeIt.prototype={_init:function(){this.el.find(".ti-container, .ti-cursor, .ti-placeholder").remove(),this._elCheck(),this.s.strings=this._toArray(this.s.strings),this.el.html('.'),this.tel=this.el.find("span"),this.insert=function(t){this.tel.append(t)},this.s.startDelete&&(this.tel.html(this.stringsToDelete),this.queue.push([this["delete"]])),this._generateQueue(),this._kickoff()},_kickoff:function(){this._cursor(),this.s.autoStart?this._startQueue():this._isVisible()?(this.hasStarted=!0,this._startQueue()):s.on("scroll",function(){this._isVisible()&&!this.hasStarted&&(this.hasStarted=!0,this._startQueue())}.bind(this))},_generateQueue:function(){for(i=0;i=0;e--)-1!==t[e].indexOf("")&&(this.tagCount=1,this.tagDuration=e);this._makeNode(t[0])}else this._print(t[0]);t.splice(0,1),t.length?this.type(t,!1):this._executeQueue()}.bind(this),this.typePace)},pause:function(t){t=t===e?this.s.breakDelay:t,this._to(function(){this._executeQueue()}.bind(this),t)},"break":function(){this.insert("
"),this._executeQueue()},mergeSet:function(e){this.s=t.extend({},this.s,e),this._executeQueue()},_print:function(e){this.inTag?(t(this.tag,this.el).last().append(e),this.tagCount-1;h--){if(">"!==i[h]&&";"!==i[h]||!this.s.html){i.pop();break}for(var n=h;n>-1;n--){if("
"===i.slice(n-3,n+1).join("")){i.splice(n-3,4);break}if("&"===i[n]){i.splice(n,h-n+1);break}if("<"===i[n]&&">"!==i[n-1]){if(";"===i[n-1])for(var u=n-1;u>-1;u--)if("&"===i[u]){i.splice(u,n-u);break}i.splice(n-1,1);break}}break}if(this.tel.html().indexOf(">")>-1)for(var r=this.tel.html().indexOf(">")-2;r>=0;r--)if("<"===i[r]){i.splice(r,i.length-r);break}this.tel.html(i.join("")),s>(t===e?0:2)?this["delete"](t===e?e:t-1):this._executeQueue()}.bind(this),this.deletePace)},_isVisible:function(){var e=t(window),i=e.scrollTop(),s=i+e.height(),h=this.el.offset().top,n=h+this.el.height();return s>=n&&h>=i},_executeQueue:function(){if(this.queueIndex0?this.s.strings=this.el.html().trim():this.s.startDelete&&(this.stringsToDelete=this.el.html())},_toArray:function(t){return t.constructor===Array?t.slice(0):t.split("
")},_cursor:function(){if(this.s.cursor){this.el.append("|');var t=this.s.cursorSpeed,e=this;!function i(){e.el.find(".ti-cursor").fadeTo(t/2,0).fadeTo(t/2,1),e._to(i,t)}()}},_setPace:function(){var t=this.s.speed,i=this.s.deleteSpeed!==e?this.s.deleteSpeed:this.s.speed/3,s=t/2,h=i/2;this.typePace=this.s.lifeLike?this._randomInRange(t,s):t,this.deletePace=this.s.lifeLike?this._randomInRange(i,h):i},_randomInRange:function(t,e){return Math.abs(Math.random()*(t+e-(t-e))+(t-e))},_rake:function(t){for(var e=0;e"===t[e][n]||";"===t[e][n]&&h)&&(s[1]=n,n=0,i=t[e].slice(s[0],s[1]+1).join(""),t[e].splice(s[0],s[1]-s[0]+1,i),h=!1)}return t},_makeNode:function(e){this.tag=t(t.parseHTML(e)),this._print(this.tag),this.inTag=!0}},t.fn.tiType=function(i){var h=t(this).data("typeit");return h===e?s:(h.queue.push([h.type,i]),this)},t.fn.tiDelete=function(i){var h=t(this).data("typeit");return h===e?s:(h.queue.push([h["delete"],i]),this)},t.fn.tiPause=function(i){var h=t(this).data("typeit");return h===e?s:(h.queue.push([h.pause,i]),this)},t.fn.tiBreak=function(){var i=t(this).data("typeit");return i===e?s:(i.queue.push([i["break"]]),this)},t.fn.tiSettings=function(i){var h=t(this).data("typeit");return h===e?s:(h.queue.push([h.mergeSet,i]),this)}}(jQuery);
\ No newline at end of file
+!function(t,e){var s=t(document);t.fn.typeIt=function(e){return this.each(function(){var i=t(this);i.data("typeit",new t.typeIt(i,e))})},t.typeIt=function(i,s){this.d={strings:[],speed:100,deleteSpeed:e,lifeLike:!0,cursor:!0,cursorSpeed:1e3,breakLines:!0,breakDelay:750,startDelay:250,startDelete:!1,loop:!1,loopDelay:750,html:!0,autoStart:!0,callback:function(){}},this.queue=[],this.queueIndex=0,this.hasStarted=!1,this.inTag=!1,this.stringsToDelete="",this.style='style="display:inline;position:relative;font:inherit;color:inherit;"',this.s=t.extend({},this.d,s),this.el=i,this._init()},t.typeIt.prototype={_init:function(){this.el.find(".ti-container, .ti-cursor, .ti-placeholder").remove(),this._elCheck(),this.s.strings=this._toArray(this.s.strings),this.el.html('.'),this.tel=this.el.find("span"),this.insert=function(t){this.tel.append(t)},this.s.startDelete&&(this.tel.html(this.stringsToDelete),this.queue.push([this["delete"]])),this._generateQueue(),this._kickoff()},_kickoff:function(){this._cursor(),this.s.autoStart?this._startQueue():this._isVisible()?(this.hasStarted=!0,this._startQueue()):s.on("scroll",function(){this._isVisible()&&!this.hasStarted&&(this.hasStarted=!0,this._startQueue())}.bind(this))},_generateQueue:function(){for(i=0;i=0;e--)-1!==t[e].indexOf("")&&(this.tagCount=1,this.tagDuration=e);this._makeNode(t[0])}else this._print(t[0]);t.splice(0,1),t.length?this.type(t,!1):this._executeQueue()}.bind(this),this.typePace)},pause:function(t){t=t===e?this.s.breakDelay:t,this._to(function(){this._executeQueue()}.bind(this),t)},"break":function(){this.insert("
"),this._executeQueue()},mergeSet:function(e){this.s=t.extend({},this.s,e),this._executeQueue()},_print:function(e){this.inTag?(t(this.tag,this.el).last().append(e),this.tagCount-1;h--){if(">"!==i[h]&&";"!==i[h]||!this.s.html){i.pop();break}for(var n=h;n>-1;n--){if("
"===i.slice(n-3,n+1).join("")){i.splice(n-3,4);break}if("&"===i[n]){i.splice(n,h-n+1);break}if("<"===i[n]&&">"!==i[n-1]){if(";"===i[n-1])for(var r=n-1;r>-1;r--)if("&"===i[r]){i.splice(r,n-r);break}i.splice(n-1,1);break}}break}if(this.tel.html().indexOf(">")>-1)for(var u=this.tel.html().indexOf(">")-2;u>=0;u--)if("<"===i[u]){i.splice(u,i.length-u);break}this.tel.html(i.join("")),s>(t===e?0:2)?this["delete"](t===e?e:t-1):this._executeQueue()}.bind(this),this.deletePace)},_isVisible:function(){var e=t(window),i={top:e.scrollTop(),left:e.scrollLeft()};i.right=i.left+e.width(),i.bottom=i.top+e.height();var s=this.el.outerHeight(),h=this.el.outerWidth();if(!h||!s)return!1;var n=this.el.offset();n.right=n.left+h,n.bottom=n.top+s;var r=!(i.rightn.right||i.bottomn.bottom);if(!r)return!1;var u={top:Math.min(1,(n.bottom-i.top)/s),bottom:Math.min(1,(i.bottom-n.top)/s),left:Math.min(1,(n.right-i.left)/h),right:Math.min(1,(i.right-n.left)/h)};return u.left*u.right>=1&&u.top*u.bottom>=1},_executeQueue:function(){if(this.queueIndex0?this.s.strings=this.el.html().trim():this.s.startDelete&&(this.stringsToDelete=this.el.html())},_toArray:function(t){return t.constructor===Array?t.slice(0):t.split("
")},_cursor:function(){if(this.s.cursor){this.el.append("|');var t=this.s.cursorSpeed,e=this;!function i(){e.el.find(".ti-cursor").fadeTo(t/2,0).fadeTo(t/2,1),e._to(i,t)}()}},_setPace:function(){var t=this.s.speed,i=this.s.deleteSpeed!==e?this.s.deleteSpeed:this.s.speed/3,s=t/2,h=i/2;this.typePace=this.s.lifeLike?this._randomInRange(t,s):t,this.deletePace=this.s.lifeLike?this._randomInRange(i,h):i},_randomInRange:function(t,e){return Math.abs(Math.random()*(t+e-(t-e))+(t-e))},_rake:function(t){for(var e=0;e"===t[e][n]||";"===t[e][n]&&h)&&(s[1]=n,n=0,i=t[e].slice(s[0],s[1]+1).join(""),t[e].splice(s[0],s[1]-s[0]+1,i),h=!1)}return t},_makeNode:function(e){this.tag=t(t.parseHTML(e)),this._print(this.tag),this.inTag=!0}},t.fn.tiType=function(i){var h=t(this).data("typeit");return h===e?s:(h.queue.push([h.type,i]),this)},t.fn.tiDelete=function(i){var h=t(this).data("typeit");return h===e?s:(h.queue.push([h["delete"],i]),this)},t.fn.tiPause=function(i){var h=t(this).data("typeit");return h===e?s:(h.queue.push([h.pause,i]),this)},t.fn.tiBreak=function(){var i=t(this).data("typeit");return i===e?s:(i.queue.push([i["break"]]),this)},t.fn.tiSettings=function(i){var h=t(this).data("typeit");return h===e?s:(h.queue.push([h.mergeSet,i]),this)}}(jQuery);
\ No newline at end of file
diff --git a/dist/typeit.js b/dist/typeit.js
index 74d53e7a..2e59c263 100644
--- a/dist/typeit.js
+++ b/dist/typeit.js
@@ -1,7 +1,7 @@
/**
* jQuery TypeIt
* @author Alex MacArthur (http://macarthur.me)
- * @version 4.2.0
+ * @version 4.2.1
* @copyright 2016 Alex MacArthur
* @description Types out a given string or strings.
*/
@@ -57,7 +57,7 @@
this.tel = this.el.find('span');
this.insert = function(c) {
- this.tel.append(c);
+ this.tel.append(c);
};
if(this.s.startDelete) {
@@ -273,15 +273,40 @@
},
_isVisible : function() {
- var $win = $(window);
-
- var docTop = $win.scrollTop();
- var docBottom = docTop + $win.height();
-
- var elTop = this.el.offset().top;
- var elBottom = elTop + this.el.height();
-
- return ((elBottom <= docBottom) && (elTop >= docTop));
+ var win = $(window);
+
+ var viewport = {
+ top : win.scrollTop(),
+ left : win.scrollLeft()
+ };
+ viewport.right = viewport.left + win.width();
+ viewport.bottom = viewport.top + win.height();
+
+ var height = this.el.outerHeight();
+ var width = this.el.outerWidth();
+
+ if(!width || !height){
+ return false;
+ }
+
+ var bounds = this.el.offset();
+ bounds.right = bounds.left + width;
+ bounds.bottom = bounds.top + height;
+
+ var visible = (!(viewport.right < bounds.left || viewport.left > bounds.right || viewport.bottom < bounds.top || viewport.top > bounds.bottom));
+
+ if(!visible){
+ return false;
+ }
+
+ var deltas = {
+ top : Math.min( 1, ( bounds.bottom - viewport.top ) / height),
+ bottom : Math.min(1, ( viewport.bottom - bounds.top ) / height),
+ left : Math.min(1, ( bounds.right - viewport.left ) / width),
+ right : Math.min(1, ( viewport.right - bounds.left ) / width)
+ };
+
+ return (deltas.left * deltas.right) >= 1 && (deltas.top * deltas.bottom) >= 1;
},
/*
@@ -438,4 +463,4 @@ $.fn.tiSettings = function(settings) {
return this;
};
-}(jQuery));
\ No newline at end of file
+}(jQuery));
diff --git a/dist/typeit.min.js b/dist/typeit.min.js
index 0eec3324..cddc6a4a 100644
--- a/dist/typeit.min.js
+++ b/dist/typeit.min.js
@@ -1 +1 @@
-!function(t,e){var s=t(document);t.fn.typeIt=function(e){return this.each(function(){var i=t(this);i.data("typeit",new t.typeIt(i,e))})},t.typeIt=function(i,s){this.d={strings:[],speed:100,deleteSpeed:e,lifeLike:!0,cursor:!0,cursorSpeed:1e3,breakLines:!0,breakDelay:750,startDelay:250,startDelete:!1,loop:!1,loopDelay:750,html:!0,autoStart:!0,callback:function(){}},this.queue=[],this.queueIndex=0,this.hasStarted=!1,this.inTag=!1,this.stringsToDelete="",this.style='style="display:inline;position:relative;font:inherit;color:inherit;"',this.s=t.extend({},this.d,s),this.el=i,this._init()},t.typeIt.prototype={_init:function(){this.el.find(".ti-container, .ti-cursor, .ti-placeholder").remove(),this._elCheck(),this.s.strings=this._toArray(this.s.strings),this.el.html('.'),this.tel=this.el.find("span"),this.insert=function(t){this.tel.append(t)},this.s.startDelete&&(this.tel.html(this.stringsToDelete),this.queue.push([this["delete"]])),this._generateQueue(),this._kickoff()},_kickoff:function(){this._cursor(),this.s.autoStart?this._startQueue():this._isVisible()?(this.hasStarted=!0,this._startQueue()):s.on("scroll",function(){this._isVisible()&&!this.hasStarted&&(this.hasStarted=!0,this._startQueue())}.bind(this))},_generateQueue:function(){for(i=0;i=0;e--)-1!==t[e].indexOf("")&&(this.tagCount=1,this.tagDuration=e);this._makeNode(t[0])}else this._print(t[0]);t.splice(0,1),t.length?this.type(t,!1):this._executeQueue()}.bind(this),this.typePace)},pause:function(t){t=t===e?this.s.breakDelay:t,this._to(function(){this._executeQueue()}.bind(this),t)},"break":function(){this.insert("
"),this._executeQueue()},mergeSet:function(e){this.s=t.extend({},this.s,e),this._executeQueue()},_print:function(e){this.inTag?(t(this.tag,this.el).last().append(e),this.tagCount-1;h--){if(">"!==i[h]&&";"!==i[h]||!this.s.html){i.pop();break}for(var n=h;n>-1;n--){if("
"===i.slice(n-3,n+1).join("")){i.splice(n-3,4);break}if("&"===i[n]){i.splice(n,h-n+1);break}if("<"===i[n]&&">"!==i[n-1]){if(";"===i[n-1])for(var u=n-1;u>-1;u--)if("&"===i[u]){i.splice(u,n-u);break}i.splice(n-1,1);break}}break}if(this.tel.html().indexOf(">")>-1)for(var r=this.tel.html().indexOf(">")-2;r>=0;r--)if("<"===i[r]){i.splice(r,i.length-r);break}this.tel.html(i.join("")),s>(t===e?0:2)?this["delete"](t===e?e:t-1):this._executeQueue()}.bind(this),this.deletePace)},_isVisible:function(){var e=t(window),i=e.scrollTop(),s=i+e.height(),h=this.el.offset().top,n=h+this.el.height();return s>=n&&h>=i},_executeQueue:function(){if(this.queueIndex0?this.s.strings=this.el.html().trim():this.s.startDelete&&(this.stringsToDelete=this.el.html())},_toArray:function(t){return t.constructor===Array?t.slice(0):t.split("
")},_cursor:function(){if(this.s.cursor){this.el.append("|');var t=this.s.cursorSpeed,e=this;!function i(){e.el.find(".ti-cursor").fadeTo(t/2,0).fadeTo(t/2,1),e._to(i,t)}()}},_setPace:function(){var t=this.s.speed,i=this.s.deleteSpeed!==e?this.s.deleteSpeed:this.s.speed/3,s=t/2,h=i/2;this.typePace=this.s.lifeLike?this._randomInRange(t,s):t,this.deletePace=this.s.lifeLike?this._randomInRange(i,h):i},_randomInRange:function(t,e){return Math.abs(Math.random()*(t+e-(t-e))+(t-e))},_rake:function(t){for(var e=0;e"===t[e][n]||";"===t[e][n]&&h)&&(s[1]=n,n=0,i=t[e].slice(s[0],s[1]+1).join(""),t[e].splice(s[0],s[1]-s[0]+1,i),h=!1)}return t},_makeNode:function(e){this.tag=t(t.parseHTML(e)),this._print(this.tag),this.inTag=!0}},t.fn.tiType=function(i){var h=t(this).data("typeit");return h===e?s:(h.queue.push([h.type,i]),this)},t.fn.tiDelete=function(i){var h=t(this).data("typeit");return h===e?s:(h.queue.push([h["delete"],i]),this)},t.fn.tiPause=function(i){var h=t(this).data("typeit");return h===e?s:(h.queue.push([h.pause,i]),this)},t.fn.tiBreak=function(){var i=t(this).data("typeit");return i===e?s:(i.queue.push([i["break"]]),this)},t.fn.tiSettings=function(i){var h=t(this).data("typeit");return h===e?s:(h.queue.push([h.mergeSet,i]),this)}}(jQuery);
\ No newline at end of file
+!function(t,e){var s=t(document);t.fn.typeIt=function(e){return this.each(function(){var i=t(this);i.data("typeit",new t.typeIt(i,e))})},t.typeIt=function(i,s){this.d={strings:[],speed:100,deleteSpeed:e,lifeLike:!0,cursor:!0,cursorSpeed:1e3,breakLines:!0,breakDelay:750,startDelay:250,startDelete:!1,loop:!1,loopDelay:750,html:!0,autoStart:!0,callback:function(){}},this.queue=[],this.queueIndex=0,this.hasStarted=!1,this.inTag=!1,this.stringsToDelete="",this.style='style="display:inline;position:relative;font:inherit;color:inherit;"',this.s=t.extend({},this.d,s),this.el=i,this._init()},t.typeIt.prototype={_init:function(){this.el.find(".ti-container, .ti-cursor, .ti-placeholder").remove(),this._elCheck(),this.s.strings=this._toArray(this.s.strings),this.el.html('.'),this.tel=this.el.find("span"),this.insert=function(t){this.tel.append(t)},this.s.startDelete&&(this.tel.html(this.stringsToDelete),this.queue.push([this["delete"]])),this._generateQueue(),this._kickoff()},_kickoff:function(){this._cursor(),this.s.autoStart?this._startQueue():this._isVisible()?(this.hasStarted=!0,this._startQueue()):s.on("scroll",function(){this._isVisible()&&!this.hasStarted&&(this.hasStarted=!0,this._startQueue())}.bind(this))},_generateQueue:function(){for(i=0;i=0;e--)-1!==t[e].indexOf("")&&(this.tagCount=1,this.tagDuration=e);this._makeNode(t[0])}else this._print(t[0]);t.splice(0,1),t.length?this.type(t,!1):this._executeQueue()}.bind(this),this.typePace)},pause:function(t){t=t===e?this.s.breakDelay:t,this._to(function(){this._executeQueue()}.bind(this),t)},"break":function(){this.insert("
"),this._executeQueue()},mergeSet:function(e){this.s=t.extend({},this.s,e),this._executeQueue()},_print:function(e){this.inTag?(t(this.tag,this.el).last().append(e),this.tagCount-1;h--){if(">"!==i[h]&&";"!==i[h]||!this.s.html){i.pop();break}for(var n=h;n>-1;n--){if("
"===i.slice(n-3,n+1).join("")){i.splice(n-3,4);break}if("&"===i[n]){i.splice(n,h-n+1);break}if("<"===i[n]&&">"!==i[n-1]){if(";"===i[n-1])for(var r=n-1;r>-1;r--)if("&"===i[r]){i.splice(r,n-r);break}i.splice(n-1,1);break}}break}if(this.tel.html().indexOf(">")>-1)for(var u=this.tel.html().indexOf(">")-2;u>=0;u--)if("<"===i[u]){i.splice(u,i.length-u);break}this.tel.html(i.join("")),s>(t===e?0:2)?this["delete"](t===e?e:t-1):this._executeQueue()}.bind(this),this.deletePace)},_isVisible:function(){var e=t(window),i={top:e.scrollTop(),left:e.scrollLeft()};i.right=i.left+e.width(),i.bottom=i.top+e.height();var s=this.el.outerHeight(),h=this.el.outerWidth();if(!h||!s)return!1;var n=this.el.offset();n.right=n.left+h,n.bottom=n.top+s;var r=!(i.rightn.right||i.bottomn.bottom);if(!r)return!1;var u={top:Math.min(1,(n.bottom-i.top)/s),bottom:Math.min(1,(i.bottom-n.top)/s),left:Math.min(1,(n.right-i.left)/h),right:Math.min(1,(i.right-n.left)/h)};return u.left*u.right>=1&&u.top*u.bottom>=1},_executeQueue:function(){if(this.queueIndex0?this.s.strings=this.el.html().trim():this.s.startDelete&&(this.stringsToDelete=this.el.html())},_toArray:function(t){return t.constructor===Array?t.slice(0):t.split("
")},_cursor:function(){if(this.s.cursor){this.el.append("|');var t=this.s.cursorSpeed,e=this;!function i(){e.el.find(".ti-cursor").fadeTo(t/2,0).fadeTo(t/2,1),e._to(i,t)}()}},_setPace:function(){var t=this.s.speed,i=this.s.deleteSpeed!==e?this.s.deleteSpeed:this.s.speed/3,s=t/2,h=i/2;this.typePace=this.s.lifeLike?this._randomInRange(t,s):t,this.deletePace=this.s.lifeLike?this._randomInRange(i,h):i},_randomInRange:function(t,e){return Math.abs(Math.random()*(t+e-(t-e))+(t-e))},_rake:function(t){for(var e=0;e"===t[e][n]||";"===t[e][n]&&h)&&(s[1]=n,n=0,i=t[e].slice(s[0],s[1]+1).join(""),t[e].splice(s[0],s[1]-s[0]+1,i),h=!1)}return t},_makeNode:function(e){this.tag=t(t.parseHTML(e)),this._print(this.tag),this.inTag=!0}},t.fn.tiType=function(i){var h=t(this).data("typeit");return h===e?s:(h.queue.push([h.type,i]),this)},t.fn.tiDelete=function(i){var h=t(this).data("typeit");return h===e?s:(h.queue.push([h["delete"],i]),this)},t.fn.tiPause=function(i){var h=t(this).data("typeit");return h===e?s:(h.queue.push([h.pause,i]),this)},t.fn.tiBreak=function(){var i=t(this).data("typeit");return i===e?s:(i.queue.push([i["break"]]),this)},t.fn.tiSettings=function(i){var h=t(this).data("typeit");return h===e?s:(h.queue.push([h.mergeSet,i]),this)}}(jQuery);
\ No newline at end of file
diff --git a/gulpfile.js b/gulpfile.js
index be2adfde..2244a9a6 100644
--- a/gulpfile.js
+++ b/gulpfile.js
@@ -1,28 +1,7 @@
var gulp = require('gulp');
var jshint = require('gulp-jshint');
var uglify = require('gulp-uglify');
-var autoprefix = require('gulp-autoprefixer');
-var sass = require('gulp-sass');
var rename = require("gulp-rename");
-var browserSync = require('browser-sync');
-var cp = require('child_process');
-
-gulp.task('build', function (done) {
- return cp.spawn('jekyll', ['build'], {stdio: 'inherit'})
- .on('close', done);
-});
-
-gulp.task('rebuild', ['build'], function () {
- browserSync.reload();
-});
-
-gulp.task('browserSync', ['sass','scripts','build'], function() {
- browserSync({
- server: {
- baseDir: '_site'
- }
- });
-});
gulp.task('jshint',function(){
gulp.src('dev/typeit.js')
@@ -31,36 +10,14 @@ gulp.task('jshint',function(){
});
gulp.task('scripts', function() {
-
gulp.src('dev/typeit.js')
.pipe(gulp.dest('dist'))
.pipe(uglify())
.pipe(rename('typeit.min.js'))
.pipe(gulp.dest('dev'))
- .pipe(gulp.dest('dist'))
- .pipe(gulp.dest('_includes'));
-
- gulp.src('assets/js/scripts.js')
- .pipe(uglify())
- .pipe(rename('scripts.min.js'))
- .pipe(gulp.dest('_includes'));
-});
-
-gulp.task('sass',function(){
- gulp.src('assets/scss/style.scss')
- .pipe(sass({outputStyle: 'compressed'}))
- .pipe(autoprefix('last 3 versions'))
- .pipe(gulp.dest('_includes'));
+ .pipe(gulp.dest('dist'));
});
-gulp.task('watchSite', function() {
- gulp.watch('assets/js/*.js', ['jshint', 'scripts', 'rebuild']);
- gulp.watch(['index.html', '_layouts/*', '_includes/*', 'docs/*'], ['rebuild']);
- gulp.watch('assets/scss/**/*.scss', ['sass', 'rebuild']);
-});
-
-gulp.task('default', ['browserSync', 'watchSite']);
-
-gulp.task('develop', ['scripts'], function() {
+gulp.task('default', ['jshint', 'scripts'], function() {
gulp.watch('dev/*', ['jshint', 'scripts']);
});
\ No newline at end of file
diff --git a/package.json b/package.json
index fb4fd139..7802249d 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "typeit",
- "version": "4.2.0",
+ "version": "4.2.1",
"license": "GPL-2.0",
"author": "Alex MacArthur ",
"description": "The most versatile jQuery animated typing plugin on the planet.",