2
* Copyright (C) 2013 Adnane Belmadiaf <daker@ubuntu.com>
3
* License granted by Canonical Limited
5
* This file is part of ubuntu-html5-ui-toolkit.
7
* This package is free software; you can redistribute it and/or modify
8
* it under the terms of the GNU Lesser General Public License as
9
* published by the Free Software Foundation; either version 3 of the
11
* (at your option) any later version.
13
* This package is distributed in the hope that it will be useful,
14
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
* GNU General Public License for more details.
18
* You should have received a copy of the GNU Lesser General Public
19
* License along with this program. If not, see
20
* <http://www.gnu.org/licenses/>.
24
* Dialogs are modal full-screen popups that prevent other GUI interactions with the application until dismissed.
26
Dialogs wrap arbitrary markup.
28
Dialogs are declared at the top level inside the <em>content</em> div.
33
<div data-role="content">
34
<div data-role="pagestack">
37
<div data-role="dialog" id="dialogID">
43
var dialog = UI.dialog("dialogID");
46
var Dialog = function (id) {
48
this.dialog = document.getElementById(id);
53
* Display a dialog by adding 'active' CSS class
57
this.dialog.classList.add('active');
60
* Hide a dialog by removing 'active' class
64
this.dialog.classList.remove('active');
67
* Toggle a dialog, which means removing its 'active' class if it has one, or adding the 'active' class if it does not have one
71
this.dialog.classList.toggle('active');
74
* Returns the DOM element associated with the id this widget is bind to.
76
* @return {DOMElement}
78
var mydialog = UI.dialog("dialogid").element();
80
element: function () {
81
return document.getElementById(this.id);