Skip to content

Commit

Permalink
Removed dependency on css class
Browse files Browse the repository at this point in the history
  • Loading branch information
ermish committed Dec 24, 2015
1 parent 5e78fe5 commit 94a5407
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 12 deletions.
8 changes: 5 additions & 3 deletions dist/jquery-inputcloak.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@

//////Private Methods
var init = function(){
if($element.hasClass('cloaked')){
if($element.attr('data-cloaked-id')){
return;
}

Expand All @@ -96,9 +96,11 @@
};

var createCloakedElement = function(){
$element.addClass('cloaked');
var newDataId = Math.floor((Math.random() * 100000000) + 1);
$element.attr('data-cloaked-id', newDataId);
$cloakedElement = $element.clone();
$cloakedElement.attr('id','cloaked-' + $element.attr('id'));

$cloakedElement.attr('data-cloaked-for', newDataId);
$cloakedElement.removeAttr('name');

$element.css( 'display', 'none' );
Expand Down
5 changes: 4 additions & 1 deletion dist/jquery-inputcloak.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions dist/jquery-inputcloak.min.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 11 additions & 4 deletions gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,14 @@
transform: [
["babelify", {
loose: "all",
"sourceMap": true,
"experimental": true,
"modules": "ignore"//"common"
}]
]
],

browserifyOptions : {
debug: true
}
}
},
files: {
Expand All @@ -41,11 +44,15 @@
"src": ["**/*.es6.js"],
"dest": "dist",
"ext": ".js"
}
},

},
uglify: {
options: {
banner: '/*! * Copyright (c) 2010 - <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>\n> */ '
banner: '/*! * Copyright (c) 2010 - <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>\n> */ ',
sourceMap : true,
sourceMapIncludeSources : true

},
build: {
src: 'dist/' + bundleName + '.js',
Expand Down
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
</style>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js" type="text/javascript"></script>
<script src="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/js/bootstrap.min.js"></script>
<script type="text/javascript" src="dist/jquery.inputcloak.min.js"></script>
<script type="text/javascript" src="dist/jquery-inputcloak.min.js"></script>
<script>
$(document).ready(function() {
$('.cloaked').inputCloak();
Expand Down
8 changes: 5 additions & 3 deletions src/jquery-inputcloak.es6.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@

//////Private Methods
var init = function(){
if($element.hasClass('cloaked')){
if($element.attr('data-cloaked-id')){
return;
}

Expand All @@ -95,9 +95,11 @@
};

var createCloakedElement = function(){
$element.addClass('cloaked');
var newDataId = Math.floor((Math.random() * 100000000) + 1);
$element.attr('data-cloaked-id', newDataId);
$cloakedElement = $element.clone();
$cloakedElement.attr('id','cloaked-' + $element.attr('id'));

$cloakedElement.attr('data-cloaked-for', newDataId);
$cloakedElement.removeAttr('name');

$element.css( 'display', 'none' );
Expand Down

0 comments on commit 94a5407

Please sign in to comment.