(function () { function onClosed() { $(this).remove(); } function show(options) { require(['paperbuttonstyle'], function() { // items // positionTo // showCancel // title var id = 'dlg' + new Date().getTime(); var html = ''; html += ''; if (options.title) { html += '

'; html += options.title; html += '

'; } html += ''; for (var i = 0, length = options.items.length; i < length; i++) { var option = options.items[i]; html += ''; //html += ''; html += '' + option.name + ''; html += ''; } html += ''; if (options.showCancel) { html += '
'; html += '' + Globalize.translate('ButtonCancel') + ''; html += '
'; } html += '
'; $(html).appendTo(document.body); setTimeout(function () { var dlg = document.getElementById(id); dlg.open(); // Has to be assigned a z-index after the call to .open() $(dlg).css('z-index', '999999').on('iron-overlay-closed', onClosed); $('.btnOption', dlg).on('click', function () { if (options.callback) { options.callback(this.getAttribute('data-id')); } dlg.close(); }); }, 100); }); } window.ActionSheetElement = { show: show }; })();