Skip to content
This repository has been archived by the owner on Oct 8, 2021. It is now read-only.

Commit

Permalink
Popup: Add classes option
Browse files Browse the repository at this point in the history
Fixes gh-7686
  • Loading branch information
Gabriel Schulhof committed Sep 30, 2014
1 parent 77f0ac1 commit 9a00f79
Showing 1 changed file with 23 additions and 13 deletions.
36 changes: 23 additions & 13 deletions js/widgets/popup.js
Expand Up @@ -51,6 +51,12 @@ function getWindowCoordinates( theWindow ) {

$.widget( "mobile.popup", {
options: {
classes: {
"ui-popup-screen": null,
"ui-popup-placeholder": null,
"ui-popup": null,
"ui-popup-container": null
},
wrapperClass: null,
theme: null,
overlayTheme: null,
Expand All @@ -74,14 +80,6 @@ $.widget( "mobile.popup", {
history: !$.mobile.browser.oldIE
},

// When the user depresses the mouse/finger on an element inside the popup while the popup is
// open, we ignore resize events for a short while. This prevents #6961.
_handleDocumentVmousedown: function( theEvent ) {
if ( this._isOpen && $.contains( this._ui.container[ 0 ], theEvent.target ) ) {
this._ignoreResizeEvents();
}
},

_create: function() {
var theElement = this.element,
myId = theElement.attr( "id" ),
Expand Down Expand Up @@ -143,10 +141,14 @@ $.widget( "mobile.popup", {
var currentOptions = this.options,
wrapperClass = currentOptions.wrapperClass,
ui = {
screen: $( "<div class='ui-screen-hidden ui-popup-screen " +
this._themeClassFromOption( "ui-overlay-", currentOptions.overlayTheme ) + "'></div>" ),
placeholder: $( "<div style='display: none;'><!-- placeholder --></div>" ),
container: $( "<div class='ui-popup-container ui-popup-hidden ui-popup-truncate" +
screen: $( "<div class='ui-screen-hidden " +
this._classes( "ui-popup-screen" ) + " " +
this._themeClassFromOption( "ui-overlay-", currentOptions.overlayTheme ) +
"'></div>" ),
placeholder: $( "<div class='" + this._classes( "ui-popup-placeholder" ) +
"' style='display: none;'><!-- placeholder --></div>" ),
container: $( "<div class='" + this._classes( "ui-popup-container" ) +
" ui-popup-hidden ui-popup-truncate" +
( wrapperClass ? ( " " + wrapperClass ) : "" ) + "'></div>" )
},
fragment = this.document[ 0 ].createDocumentFragment();
Expand All @@ -168,7 +170,7 @@ $.widget( "mobile.popup", {
ui.placeholder.insertAfter( theElement );
theElement
.detach()
.addClass( "ui-popup " +
.addClass( this._classes( "ui-popup" ) + " " +
this._themeClassFromOption( "ui-body-", currentOptions.theme ) + " " +
( currentOptions.shadow ? "ui-overlay-shadow " : "" ) +
( currentOptions.corners ? "ui-corner-all " : "" ) )
Expand All @@ -177,6 +179,14 @@ $.widget( "mobile.popup", {
return ui;
},

// When the user depresses the mouse/finger on an element inside the popup while the popup is
// open, we ignore resize events for a short while. This prevents #6961.
_handleDocumentVmousedown: function( theEvent ) {
if ( this._isOpen && $.contains( this._ui.container[ 0 ], theEvent.target ) ) {
this._ignoreResizeEvents();
}
},

_eatEventAndClose: function( theEvent ) {
theEvent.preventDefault();
theEvent.stopImmediatePropagation();
Expand Down

0 comments on commit 9a00f79

Please sign in to comment.