Skip to content

Commit

Permalink
Fix jshint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
MohammadYounes committed Nov 21, 2015
1 parent f87a87d commit 42cc2af
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 49 deletions.
20 changes: 10 additions & 10 deletions src/js/dialog/dialog.js
Expand Up @@ -364,16 +364,16 @@
* @return {undefined}
*/
destroy:function(){
if (this.__internal.isOpen ) {
//mark dialog for destruction, this will be called on tranistionOut event.
this.__internal.destroy = function(){
destruct(this, initialize);
if (this.__internal.isOpen ) {
//mark dialog for destruction, this will be called on tranistionOut event.
this.__internal.destroy = function(){
destruct(this, initialize);
};
//close the dialog to unbind all events.
this.close();
}else{
destruct(this, initialize);
}
//close the dialog to unbind all events.
this.close();
}else{
destruct(this, initialize);
}
return this;
return this;
},
};
6 changes: 3 additions & 3 deletions src/js/dialog/intro.js
Expand Up @@ -67,9 +67,9 @@
delete instance.__init;

//keep a copy of initial dialog settings
if(!this.__settings)
this.__settings = copy(this.settings);
if(!instance.__settings){
instance.__settings = copy(instance.settings);
}
//in case the script was included before body.
//after first dialog gets initialized, it won't be null anymore!
if(null === reflow){
Expand Down
2 changes: 1 addition & 1 deletion src/js/dialog/transition.js
Expand Up @@ -62,6 +62,6 @@

//destory the instance
if (typeof instance.__internal.destroy === 'function') {
instance.__internal.destroy.apply(instance);
instance.__internal.destroy.apply(instance);
}
}
70 changes: 35 additions & 35 deletions src/js/intro.js
Expand Up @@ -131,56 +131,56 @@
* @return {Object} The extended prototype.
*/
function copy(src) {
if(null === src)
return src;

if(null === src){
return src;
}
var cpy;
if(Array.isArray(src)){
var cpy = [];
for(var x=0;x<src.length;x+=1){
cpy.push(copy(src[x]));
}
return cpy;
cpy = [];
for(var x=0;x<src.length;x+=1){
cpy.push(copy(src[x]));
}
return cpy;
}

if(src instanceof Date){
return new Date(src.getTime());
return new Date(src.getTime());
}

if(src instanceof RegExp){
var cpy = new RegExp(src.source);
cpy.global = src.global;
cpy.ignoreCase = src.ignoreCase;
cpy.multiline = src.multiline;
cpy.lastIndex = src.lastIndex;
return cpy;
cpy = new RegExp(src.source);
cpy.global = src.global;
cpy.ignoreCase = src.ignoreCase;
cpy.multiline = src.multiline;
cpy.lastIndex = src.lastIndex;
return cpy;
}

if(typeof src === 'object'){
var cpy = {};
// copy dialog pototype over definition.
for (var prop in src) {
if (src.hasOwnProperty(prop)) {
cpy[prop] = copy(src[prop]);
}
}
return cpy;
cpy = {};
// copy dialog pototype over definition.
for (var prop in src) {
if (src.hasOwnProperty(prop)) {
cpy[prop] = copy(src[prop]);
}
}
return cpy;
}

return src;
return src;
}
/**
* Helper: destruct the dialog
*
*/
function destruct(instance, initialize){
//delete the dom and it's references.
var root = instance.elements.root;
root.parentNode.removeChild(root);
delete instance.elements;
//copy back initial settings.
instance.settings = copy(instance.__settings);
//re-reference init function.
instance.__init = initialize;
//delete __internal variable to allow re-initialization.
delete instance.__internal;
//delete the dom and it's references.
var root = instance.elements.root;
root.parentNode.removeChild(root);
delete instance.elements;
//copy back initial settings.
instance.settings = copy(instance.__settings);
//re-reference init function.
instance.__init = initialize;
//delete __internal variable to allow re-initialization.
delete instance.__internal;
}

0 comments on commit 42cc2af

Please sign in to comment.