/*! amazeui-dialog v0.0.2 | by Amaze UI Team | (c) 2016 AllMobilize, Inc. | Licensed under MIT | 2016-06-22T10:19:33+0800 */ (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o'); html.push('
'); if(options.title !== null || options.isClose === true) { html.push('
'); if(options.title !== null) { html.push(''+options.title+''); } if(options.isClose === true) { html.push('×'); } html.push('
'); } // 是否url模式 if((options.url || null) != null) { html.push(''); } else { html.push('
' + options.content + '
'); } if(options.isBtn) { html.push(''); } html.push('
'); html.push(''); return $(html.join('')) .appendTo('body') .modal(options.config) .on('closed.modal.amui', function() { options.onConfirm(); var $this = $(this); setTimeout(function() { $this.remove(); }, 1000); }); }; dialog.confirm = function(options) { options = options || {}; options.title = options.title || window['lang_operate_params_error'] || '提示'; options.content = options.content || '提示内容'; options.cancelText = options.cancelText || window['lang_cancel_name'] || '取消'; options.confirmText = options.confirmText || window['lang_confirm_name'] || '确定'; options.onConfirm = options.onConfirm || function() {}; options.onCancel = options.onCancel || function() {}; var html = []; html.push('
'); html.push('
'); html.push('
' + options.title + '
'); html.push('
' + options.content + '
'); html.push(''); html.push('
'); html.push('
'); return $(html.join('')).appendTo('body').modal({ onConfirm: function(e) { options.onConfirm(e); }, onCancel: function() { options.onCancel(); } }).on('closed.modal.amui', function() { var $this = $(this); setTimeout(function() { $this.remove(); }, 1000); }); }; dialog.loading = function(options) { if(options == 'close') { $('#my-modal-loading').modal('close'); } else { options = options || {}; options.title = options.title || window['lang_loading_tips'] || '正在载入...'; if($('#my-modal-loading').length > 0) { $('#my-modal-loading .am-modal-bd .am-margin-left-xs').text(options.title); } else { var html = []; html.push('
'); html.push('
'); html.push('
'); html.push('
'); html.push(''); html.push('' + options.title + ''); html.push('
'); html.push('
'); html.push('
'); html.push('
'); return $(html.join('')).appendTo('body').modal().on('closed.modal.amui', function() { $(this).remove(); }); } } }; dialog.actions = function(options) { options = options || {}; options.title = options.title || window['lang_operate_params_error'] || '您想整咋样?'; options.cancelText = options.cancelText || window['lang_cancel_name'] || '取消'; options.items = options.items || []; var html = []; html.push('
'); html.push('
'); html.push('
    '); html.push('
  • ' + options.title + '
  • '); options.items.forEach(function(item, index) { html.push('
  • ' + item.content + '
  • '); }); html.push('
'); html.push('
'); html.push('
'); html.push(''); html.push('
'); html.push('
'); var $acions = $(html.join('')).appendTo('body').modal(); if((options.onSelected || null) != null && typeof(options.onSelected) == 'function') { $acions.find('.am-list>li').bind('click', function(e) { options.onSelected($(this).attr('index'), $(this), $acions); }); } return { show: function() { $acions.modal('open'); }, close: function() { $acions.modal('close'); } }; }; dialog.popup = function(options) { options = options || {}; options.title = options.title || null; options.content = options.content || '正文'; options.class = options.class || ''; options.onClose = options.onClose || function() {}; var html = []; // 是否存在标题 if(options.title != null) { html.push('
'); html.push('
'); html.push('
'); html.push('

' + options.title + '

'); html.push('×'); html.push('
'); html.push('
' + options.content + '
'); } else { html.push(''); return $(html.join('')).appendTo('body').modal().on('closed.modal.amui', function() { var $this = $(this); setTimeout(function() { $this.remove(); }, 1000); options.onClose(); }); }; dialog.offcanvas = function(options) { options = options || {}; options.content = options.content || '正文'; options.class = options.class || ''; options.isClose = options.isClose || false; options.onClose = options.onClose || function() {}; options.width = ((options.width || 0) == 0) ? '' : 'width:'+options.width+'px;'; var random = 'am-offcanvas-' + Math.random().toString(36).substring(2); var html = []; html.push('
'); html.push('
'); // 是否需要关闭按钮 if(options.isClose){ html.push('×'); } // 是否url模式 if((options.url || null) != null) { html.push(''); } else { html.push('
' + options.content + '
'); } html.push('
'); html.push('
'); if(options.isClose){ $(document).on('click', '#' + random + ' .am-offcanvas-bar > .am-close', function(){ $('#' + random).offCanvas('close'); }); } return $(html.join('')).appendTo('body').offCanvas().on('closed.offcanvas.amui', function() { var $this = $(this); setTimeout(function() { $this.remove(); }, 1000); options.onClose(); }); }; module.exports = UI.dialog = dialog; }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) },{}]},{},[1]);