Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasJang committed Apr 2, 2016
1 parent 63a8656 commit 31d6135
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 30 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ax5ui-modal",
"version": "0.5.2",
"version": "0.5.3",
"authors": [
"ThomasJ <[email protected]>"
],
Expand Down
24 changes: 15 additions & 9 deletions dist/ax5modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,8 @@
/**
* @class ax5.ui.modal
* @classdesc
* @version v0.0.1
* @version 0.5.3
* @author [email protected]
* @logs
* 2014-06-23 tom : 시작
* @example
* ```
* var my_modal = new ax5.ui.modal();
Expand Down Expand Up @@ -52,7 +50,9 @@
* ```
*/
//== class body start
this.init = function () {};
this.init = function () {
this.onStateChanged = cfg.onStateChanged;
};

this.getContent = function (modalId, opts) {
var po = [],
Expand Down Expand Up @@ -143,9 +143,11 @@
this.$["iframe-form"].attr({ "target": opts.id + "-frame" });
this.$["iframe-form"].attr({ "action": opts.iframe.url });
this.$["iframe"].on("load", function () {
that.state = "load";
if (opts && opts.onStateChanged) {
that.state = "load";
opts.onStateChanged.call(that, that);
} else if (this.onStateChanged) {
this.onStateChanged.call(that, that);
}
}.bind(this));
this.$["iframe-form"].submit();
Expand All @@ -154,6 +156,8 @@
if (callBack) callBack.call(that);
if (opts && opts.onStateChanged) {
opts.onStateChanged.call(that, that);
} else if (this.onStateChanged) {
this.onStateChanged.call(that, that);
}

// bind key event
Expand Down Expand Up @@ -242,12 +246,14 @@
setTimeout(function () {
this.activeModal.remove();
this.activeModal = null;
that = {
self: this,
state: "close"
};
if (opts && opts.onStateChanged) {
that = {
self: this,
state: "close"
};
opts.onStateChanged.call(that, that);
} else if (this.onStateChanged) {
this.onStateChanged.call(that, that);
}
}.bind(this), cfg.animateTime);
}
Expand Down
2 changes: 1 addition & 1 deletion dist/ax5modal.min.js

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

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"name": "ax5ui-modal",
"version": "0.5.2",
"version": "0.5.3",
"description": "A modal plugin that works with Bootstrap & jQuery",
"license": "MIT",
"license": "Apache 2.0",
"repository": {
"type": "git",
"url": "git+https://github.com/ax5ui/ax5ui-modal"
Expand Down
25 changes: 16 additions & 9 deletions src/ax5modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@
/**
* @class ax5.ui.modal
* @classdesc
* @version v0.0.1
* @version 0.5.3
* @author [email protected]
* @logs
* 2014-06-23 tom : 시작
* @example
* ```
* var my_modal = new ax5.ui.modal();
Expand Down Expand Up @@ -52,7 +50,7 @@
*/
//== class body start
this.init = function () {

this.onStateChanged = cfg.onStateChanged;
};

this.getContent = function (modalId, opts) {
Expand Down Expand Up @@ -146,10 +144,13 @@
this.$["iframe-form"].attr({"target": opts.id + "-frame"});
this.$["iframe-form"].attr({"action": opts.iframe.url});
this.$["iframe"].on("load", (function () {
that.state = "load";
if (opts && opts.onStateChanged) {
that.state = "load";
opts.onStateChanged.call(that, that);
}
else if (this.onStateChanged) {
this.onStateChanged.call(that, that);
}
}).bind(this));
this.$["iframe-form"].submit();
}
Expand All @@ -158,6 +159,9 @@
if (opts && opts.onStateChanged) {
opts.onStateChanged.call(that, that);
}
else if (this.onStateChanged) {
this.onStateChanged.call(that, that);
}

// bind key event
if (opts.closeToEsc) {
Expand Down Expand Up @@ -252,13 +256,16 @@
setTimeout((function () {
this.activeModal.remove();
this.activeModal = null;
that = {
self: this,
state: "close"
};
if (opts && opts.onStateChanged) {
that = {
self: this,
state: "close"
};
opts.onStateChanged.call(that, that);
}
else if (this.onStateChanged) {
this.onStateChanged.call(that, that);
}
}).bind(this), cfg.animateTime);
}
return this;
Expand Down
13 changes: 5 additions & 8 deletions test/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,26 +20,23 @@


<script>
var modal = new ax5.ui.modal();
var modal = new ax5.ui.modal({});
modal.onStateChanged = function(){
console.log(this);
};

function modalCallBack(){
modal.close();
}

$(document.body).ready(function () {
modal.setConfig({
onStateChanged: function(){
console.log(this);
}
});
$("#modal-open").click(function(){
modal.open({
fullScreen: true,
iframe: {
method: "get",
url: "/ax5docs/ax5ui-modal/demo/modal-iframe-content.html",
param: "callBack=modalCallBack"
},
}
});
});
$("#modal-close").click(function(){
Expand Down

0 comments on commit 31d6135

Please sign in to comment.