popup
by uiwwnw
HTML
<button id="aa">a</button>
JavaScript
var Popup = (function(Popup) {
var options = [],
option = {
animation: true,
classNameArea: 'popup',
classNameBox: 'popup--box',
classNameHeader: 'popup--header',
classNameContainer: 'popup--container',
classNameContent: 'popup--content',
classNameFooter: 'popup--footer',
classNameDim: 'popup--dim',
classNameButtonClose: 'popup--button__close',
classNameButtonCancel: 'popup--button__cancel',
classNameButtonConfirm: 'popup--button__confirm',
styleBoxWidth: 'auto',
styleBoxHeight: 'auto',
styleBoxHorizonMargin: 80,
styleBoxVerticalMargin: 80,
styleBoxShadow: 5,
styleHeaderHeight: 30,
styleHeaderBorderWidth: 1,
styleHeaderBorderColor: '#ddd',
styleHeaderVerticalMargin: 18,
styleHeaderHorizonMargin: 30,
styleHeaderTextAlign: 'left',
styleContentHeight: 'auto',
styleContentVerticalMargin: 18,
styleContentHorizonMargin: 10,
styleContentTextAlign: 'center',
styleFooterHeight: 30,
styleFooterBorderWidth: 1,
styleFooterBorderColor: '#ddd',
styleFooterVerticalMargin: 18,
styleFooterHorizonMargin: 10,
styleFooterTextAlign: 'left',
styleFooterButtonBorderWidth: 1,
styleFooterButtonBorderColor: '#ddd',
styleButtonCloseSize: 20
},
contents = {
textHeader: 'Notice',
textContent: '',
textConfirm: '',
textCancel: ''
},
fn = {
fnConfirm: function() {},
fnCancel: function() {}
};
function assign(x, y) {
var _option = {};
for (var a of Object.keys(x)) {
if (y[a]) {
_option[a] = y[a];
} else {
_option[a] = x[a];
}
}
return _option;
}
function equals(x, y) {
if (x === y) return true;
if (!(x instanceof Object) || !(y instanceof Object)) return false;
if (x.constructor !== y.constructor) return false;
for (var p in x) {
if...