Skip to content

Commit eca5fd2

Browse files
committed
bump to 0.1.1
1 parent 690b3d6 commit eca5fd2

File tree

3 files changed

+21
-7
lines changed

3 files changed

+21
-7
lines changed

dist/superplaceholder.js

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*! superplaceholder.js - v0.1.0 - 2016-02-29
1+
/*! superplaceholder.js - v0.1.1 - 2016-03-06
22
* http://kushagragour.in/lab/superplaceholderjs/
33
* Copyright (c) 2016 Kushagra Gour; Licensed CC-BY-ND-4.0 */
44

@@ -19,7 +19,10 @@
1919
letterDelay: 100, //milliseconds
2020
sentenceDelay: 1000, //milliseconds
2121
loop: false,
22-
startOnFocus: true
22+
startOnFocus: true,
23+
shuffle: false,
24+
showCursor: true,
25+
cursor: '|'
2326
};
2427

2528
// Constructor: PlaceHolder
@@ -33,8 +36,19 @@
3336
}
3437

3538
PlaceHolder.prototype.begin = function() {
36-
var self = this;
39+
var self = this,
40+
temp,
41+
randomIndex;
3742
self.originalPlaceholder = self.el.getAttribute('placeholder');
43+
if (self.options.shuffle) {
44+
for (var i = self.texts.length; i--;) {
45+
randomIndex = ~~(Math.random() * i);
46+
temp = self.texts[randomIndex];
47+
self.texts[randomIndex] = self.texts[i];
48+
self.texts[i] = temp;
49+
}
50+
}
51+
3852
if (self.options.startOnFocus) {
3953
self.el.addEventListener('focus', function () {
4054
self.processText(0);
@@ -65,7 +79,7 @@
6579
function setTimeoutCallback(index) {
6680
// Add cursor `|` after current substring unless we are showing last
6781
// character of the string.
68-
self.el.setAttribute('placeholder', str.substr(0, index + 1) + (index === str.length - 1 ? '' : '|'));
82+
self.el.setAttribute('placeholder', str.substr(0, index + 1) + (index === str.length - 1 || !self.options.showCursor ? '' : self.options.cursor));
6983
if (index === str.length - 1) {
7084
callback();
7185
}

dist/superplaceholder.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "superplaceholder",
33
"title": "superplaceholder.js",
44
"description": "Super charge your input placeholders",
5-
"version": "0.1.0",
5+
"version": "0.1.1",
66
"homepage": "http://kushagragour.in/lab/superplaceholderjs/",
77
"author": {
88
"name": "Kushagra Gour",

0 commit comments

Comments
 (0)