Upgraded Alertify to v1.7.1

This version includes the feature request about invoking the callbacks
for different resize events. It will allows us to adjust the layout of
the dialogs based on its width, just like we've in the panels.
This commit is contained in:
Ashesh Vashi 2016-06-20 11:45:17 +05:30
parent 05e7ee5a05
commit 95c79e3a4c
19 changed files with 154 additions and 151 deletions

View File

@ -7,7 +7,7 @@ QT 4.6.2+ LGPL v2.1/3 http://www.qt.io/
Bootstrap 3.3.4 MIT http://getbootstrap.com/
jQuery 1.11.1 MIT http://jquery.com/
Modernizr 2.6.2 MIT/BSD http://modernizr.com/
AlertifyJS 1.7.0 MIT http://alertifyjs.com/
AlertifyJS 1.7.1 MIT http://alertifyjs.com/
CodeMirror 5.14.2 MIT http://codemirror.net/
aciTree 4.5.0-rc.7 MIT/GPL http://acoderinsights.ro/en/aciTree-tree-view-with-jQuery
contextMenu 2.1.0 MIT https://github.com/swisnl/jQuery-contextMenu

View File

@ -1,5 +1,5 @@
/**
* alertifyjs 1.7.0 http://alertifyjs.com
* alertifyjs 1.7.1 http://alertifyjs.com
* AlertifyJS is a javascript framework for developing pretty browser dialogs and notifications.
* Copyright 2016 Mohammad Younes <Mohammad@alertifyjs.com> (http://alertifyjs.com)
* Licensed under MIT <http://opensource.org/licenses/mit-license.php>*/

View File

@ -1,5 +1,5 @@
/**
* alertifyjs 1.7.0 http://alertifyjs.com
* alertifyjs 1.7.1 http://alertifyjs.com
* AlertifyJS is a javascript framework for developing pretty browser dialogs and notifications.
* Copyright 2016 Mohammad Younes <Mohammad@alertifyjs.com> (http://alertifyjs.com)
* Licensed under MIT <http://opensource.org/licenses/mit-license.php>*/

View File

@ -1,5 +1,5 @@
/**
* alertifyjs 1.7.0 http://alertifyjs.com
* alertifyjs 1.7.1 http://alertifyjs.com
* AlertifyJS is a javascript framework for developing pretty browser dialogs and notifications.
* Copyright 2016 Mohammad Younes <Mohammad@alertifyjs.com> (http://alertifyjs.com)
* Licensed under MIT <http://opensource.org/licenses/mit-license.php>*/

View File

@ -1,5 +1,5 @@
/**
* alertifyjs 1.7.0 http://alertifyjs.com
* alertifyjs 1.7.1 http://alertifyjs.com
* AlertifyJS is a javascript framework for developing pretty browser dialogs and notifications.
* Copyright 2016 Mohammad Younes <Mohammad@alertifyjs.com> (http://alertifyjs.com)
* Licensed under MIT <http://opensource.org/licenses/mit-license.php>*/

View File

@ -1,5 +1,5 @@
/**
* alertifyjs 1.7.0 http://alertifyjs.com
* alertifyjs 1.7.1 http://alertifyjs.com
* AlertifyJS is a javascript framework for developing pretty browser dialogs and notifications.
* Copyright 2016 Mohammad Younes <Mohammad@alertifyjs.com> (http://alertifyjs.com)
* Licensed under MIT <http://opensource.org/licenses/mit-license.php>*/

View File

@ -1,5 +1,5 @@
/**
* alertifyjs 1.7.0 http://alertifyjs.com
* alertifyjs 1.7.1 http://alertifyjs.com
* AlertifyJS is a javascript framework for developing pretty browser dialogs and notifications.
* Copyright 2016 Mohammad Younes <Mohammad@alertifyjs.com> (http://alertifyjs.com)
* Licensed under MIT <http://opensource.org/licenses/mit-license.php>*/

View File

@ -1,5 +1,5 @@
/**
* alertifyjs 1.7.0 http://alertifyjs.com
* alertifyjs 1.7.1 http://alertifyjs.com
* AlertifyJS is a javascript framework for developing pretty browser dialogs and notifications.
* Copyright 2016 Mohammad Younes <Mohammad@alertifyjs.com> (http://alertifyjs.com)
* Licensed under MIT <http://opensource.org/licenses/mit-license.php>*/

View File

@ -1,5 +1,5 @@
/**
* alertifyjs 1.7.0 http://alertifyjs.com
* alertifyjs 1.7.1 http://alertifyjs.com
* AlertifyJS is a javascript framework for developing pretty browser dialogs and notifications.
* Copyright 2016 Mohammad Younes <Mohammad@alertifyjs.com> (http://alertifyjs.com)
* Licensed under MIT <http://opensource.org/licenses/mit-license.php>*/

View File

@ -1,5 +1,5 @@
/**
* alertifyjs 1.7.0 http://alertifyjs.com
* alertifyjs 1.7.1 http://alertifyjs.com
* AlertifyJS is a javascript framework for developing pretty browser dialogs and notifications.
* Copyright 2016 Mohammad Younes <Mohammad@alertifyjs.com> (http://alertifyjs.com)
* Licensed under MIT <http://opensource.org/licenses/mit-license.php>*/

View File

@ -1,5 +1,5 @@
/**
* alertifyjs 1.7.0 http://alertifyjs.com
* alertifyjs 1.7.1 http://alertifyjs.com
* AlertifyJS is a javascript framework for developing pretty browser dialogs and notifications.
* Copyright 2016 Mohammad Younes <Mohammad@alertifyjs.com> (http://alertifyjs.com)
* Licensed under MIT <http://opensource.org/licenses/mit-license.php>*/

View File

@ -1,5 +1,5 @@
/**
* alertifyjs 1.7.0 http://alertifyjs.com
* alertifyjs 1.7.1 http://alertifyjs.com
* AlertifyJS is a javascript framework for developing pretty browser dialogs and notifications.
* Copyright 2016 Mohammad Younes <Mohammad@alertifyjs.com> (http://alertifyjs.com)
* Licensed under MIT <http://opensource.org/licenses/mit-license.php>*/

View File

@ -1,5 +1,5 @@
/**
* alertifyjs 1.7.0 http://alertifyjs.com
* alertifyjs 1.7.1 http://alertifyjs.com
* AlertifyJS is a javascript framework for developing pretty browser dialogs and notifications.
* Copyright 2016 Mohammad Younes <Mohammad@alertifyjs.com> (http://alertifyjs.com)
* Licensed under MIT <http://opensource.org/licenses/mit-license.php>*/

View File

@ -1,5 +1,5 @@
/**
* alertifyjs 1.7.0 http://alertifyjs.com
* alertifyjs 1.7.1 http://alertifyjs.com
* AlertifyJS is a javascript framework for developing pretty browser dialogs and notifications.
* Copyright 2016 Mohammad Younes <Mohammad@alertifyjs.com> (http://alertifyjs.com)
* Licensed under MIT <http://opensource.org/licenses/mit-license.php>*/

View File

@ -1,5 +1,5 @@
/**
* alertifyjs 1.7.0 http://alertifyjs.com
* alertifyjs 1.7.1 http://alertifyjs.com
* AlertifyJS is a javascript framework for developing pretty browser dialogs and notifications.
* Copyright 2016 Mohammad Younes <Mohammad@alertifyjs.com> (http://alertifyjs.com)
* Licensed under MIT <http://opensource.org/licenses/mit-license.php>*/

View File

@ -1,5 +1,5 @@
/**
* alertifyjs 1.7.0 http://alertifyjs.com
* alertifyjs 1.7.1 http://alertifyjs.com
* AlertifyJS is a javascript framework for developing pretty browser dialogs and notifications.
* Copyright 2016 Mohammad Younes <Mohammad@alertifyjs.com> (http://alertifyjs.com)
* Licensed under MIT <http://opensource.org/licenses/mit-license.php>*/

View File

@ -1,5 +1,5 @@
/**
* alertifyjs 1.7.0 http://alertifyjs.com
* alertifyjs 1.7.1 http://alertifyjs.com
* AlertifyJS is a javascript framework for developing pretty browser dialogs and notifications.
* Copyright 2016 Mohammad Younes <Mohammad@alertifyjs.com> (http://alertifyjs.com)
* Licensed under MIT <http://opensource.org/licenses/mit-license.php>*/

View File

@ -1,11 +1,11 @@
/**
* alertifyjs 1.7.0 http://alertifyjs.com
* alertifyjs 1.7.1 http://alertifyjs.com
* AlertifyJS is a javascript framework for developing pretty browser dialogs and notifications.
* Copyright 2016 Mohammad Younes <Mohammad@alertifyjs.com> (http://alertifyjs.com)
* Copyright 2016 Mohammad Younes <Mohammad@alertifyjs.com> (http://alertifyjs.com)
* Licensed under MIT <http://opensource.org/licenses/mit-license.php>*/
( function ( window ) {
'use strict';
/**
* Keys enum
* @type {Object}
@ -19,7 +19,7 @@
RIGHT: 39
};
/**
* Default options
* Default options
* @type {Object}
*/
var defaults = {
@ -62,7 +62,7 @@
cancel:'ajs-cancel',
}
};
//holds open dialogs instances
var openDialogs = [];
@ -71,19 +71,19 @@
*
* @element {node} The element
* @className {string} One or more space-separated classes to be added to the class attribute of the element.
*
*
* @return {undefined}
*/
function addClass(element,classNames){
element.className += ' ' + classNames;
}
/**
* [Helper] Removes the specified class(es) from the element.
*
* @element {node} The element
* @className {string} One or more space-separated classes to be removed from the class attribute of the element.
*
*
* @return {undefined}
*/
function removeClass(element, classNames) {
@ -153,11 +153,11 @@
}
return cpy;
}
if(src instanceof Date){
return new Date(src.getTime());
}
if(src instanceof RegExp){
cpy = new RegExp(src.source);
cpy.global = src.global;
@ -166,7 +166,7 @@
cpy.lastIndex = src.lastIndex;
return cpy;
}
if(typeof src === 'object'){
cpy = {};
// copy dialog pototype over definition.
@ -285,7 +285,7 @@
/**
* Creates event handler delegate that sends the instance as last argument.
*
*
* @return {Function} a function wrapper which sends the instance as last argument.
*/
function delegate(context, method) {
@ -303,7 +303,7 @@
}
/**
* Helper for creating a dialog close event.
*
*
* @return {object}
*/
function createCloseEvent(index, button) {
@ -383,31 +383,31 @@
basic:'ajs-basic',
frameless:'ajs-frameless'
};
/**
* Helper: initializes the dialog instance
*
*
* @return {Number} The total count of currently open modals.
*/
function initialize(instance){
if(!instance.__internal){
//no need to expose init after this.
delete instance.__init;
//keep a copy of initial dialog settings
if(!instance.__settings){
instance.__settings = copy(instance.settings);
}
//in case the script was included before body.
//after first dialog gets initialized, it won't be null anymore!
//after first dialog gets initialized, it won't be null anymore!
if(null === reflow){
// set tabindex attribute on body element this allows script to give it
// focus after the dialog is closed
document.body.setAttribute( 'tabindex', '0' );
}
//get dialog buttons/focus setup
var setup;
if(typeof instance.setup === 'function'){
@ -425,7 +425,7 @@
}
};
}
//initialize hooks object.
if(typeof instance.hooks !== 'object'){
instance.hooks = {};
@ -449,7 +449,7 @@
var internal = instance.__internal = {
/**
* Flag holding the open state of the dialog
*
*
* @type {Boolean}
*/
isOpen:false,
@ -506,19 +506,19 @@
transitionOutHandler:undefined,
destroy:undefined
};
var elements = {};
//root node
elements.root = document.createElement('div');
elements.root.className = classes.base + ' ' + classes.hidden + ' ';
elements.root.innerHTML = templates.dimmer + templates.modal;
//dimmer
elements.dimmer = elements.root.firstChild;
//dialog
elements.modal = elements.root.lastChild;
elements.modal.innerHTML = templates.dialog;
@ -529,14 +529,14 @@
elements.reset = [];
elements.reset.push(elements.dialog.firstChild);
elements.reset.push(elements.dialog.lastChild);
//commands
elements.commands = {};
elements.commands.container = elements.reset[0].nextSibling;
elements.commands.pin = elements.commands.container.firstChild;
elements.commands.maximize = elements.commands.pin.nextSibling;
elements.commands.close = elements.commands.maximize.nextSibling;
//header
elements.header = elements.commands.container.nextSibling;
@ -548,7 +548,7 @@
//footer
elements.footer = elements.body.nextSibling;
elements.footer.innerHTML = templates.buttons.auxiliary + templates.buttons.primary;
//resize handle
elements.resizeHandle = elements.footer.nextSibling;
@ -560,10 +560,10 @@
elements.buttonTemplate = elements.buttons.primary.firstChild;
//remove button template
elements.buttons.primary.removeChild(elements.buttonTemplate);
for(var x=0; x < instance.__internal.buttons.length; x+=1) {
var button = instance.__internal.buttons[x];
// add to the list of used keys.
if(usedKeys.indexOf(button.key) < 0){
usedKeys.push(button.key);
@ -587,7 +587,7 @@
}
//make elements pubic
instance.elements = elements;
//save event handlers delegates
internal.resetHandler = delegate(instance, onReset);
internal.beginMoveHandler = delegate(instance, beginMove);
@ -599,39 +599,39 @@
internal.transitionInHandler = delegate(instance, handleTransitionInEvent);
internal.transitionOutHandler = delegate(instance, handleTransitionOutEvent);
//settings
instance.set('title', setup.options.title === undefined ? alertify.defaults.glossary.title : setup.options.title);
instance.set('modal', setup.options.modal === undefined ? alertify.defaults.modal : setup.options.modal);
instance.set('basic', setup.options.basic === undefined ? alertify.defaults.basic : setup.options.basic);
instance.set('frameless', setup.options.frameless === undefined ? alertify.defaults.frameless : setup.options.frameless);
instance.set('movable', setup.options.movable === undefined ? alertify.defaults.movable : setup.options.movable);
instance.set('moveBounded', setup.options.moveBounded === undefined ? alertify.defaults.moveBounded : setup.options.moveBounded);
instance.set('resizable', setup.options.resizable === undefined ? alertify.defaults.resizable : setup.options.resizable);
instance.set('autoReset', setup.options.autoReset === undefined ? alertify.defaults.autoReset : setup.options.autoReset);
instance.set('closable', setup.options.closable === undefined ? alertify.defaults.closable : setup.options.closable);
instance.set('closableByDimmer', setup.options.closableByDimmer === undefined ? alertify.defaults.closableByDimmer : setup.options.closableByDimmer);
instance.set('maximizable', setup.options.maximizable === undefined ? alertify.defaults.maximizable : setup.options.maximizable);
instance.set('startMaximized', setup.options.startMaximized === undefined ? alertify.defaults.startMaximized : setup.options.startMaximized);
instance.set('pinnable', setup.options.pinnable === undefined ? alertify.defaults.pinnable : setup.options.pinnable);
instance.set('pinned', setup.options.pinned === undefined ? alertify.defaults.pinned : setup.options.pinned);
instance.set('transition', setup.options.transition === undefined ? alertify.defaults.transition : setup.options.transition);
instance.set('padding', setup.options.padding === undefined ? alertify.defaults.padding : setup.options.padding);
instance.set('overflow', setup.options.overflow === undefined ? alertify.defaults.overflow : setup.options.overflow);
// allow dom customization
if(typeof instance.build === 'function'){
instance.build();
}
}
//add to the end of the DOM tree.
document.body.appendChild(instance.elements.root);
}
@ -669,10 +669,10 @@
addClass(document.body, classes.noOverflow);
}
}
/**
* Sets the name of the transition used to show/hide the dialog
*
*
* @param {Object} instance The dilog instance.
*
*/
@ -683,7 +683,7 @@
addClass(instance.elements.root, classes.prefix + value);
reflow = instance.elements.root.offsetWidth;
}
/**
* Toggles the dialog display mode
*
@ -696,34 +696,34 @@
//make modal
removeClass(instance.elements.root, classes.modeless);
//only if open
if(instance.isOpen()){
unbindModelessEvents(instance);
//in case a pinned modless dialog was made modal while open.
updateAbsPositionFix(instance);
ensureNoOverflow();
}
}else{
//make modelss
addClass(instance.elements.root, classes.modeless);
//only if open
if(instance.isOpen()){
bindModelessEvents(instance);
//in case pin/unpin was called while a modal is open
updateAbsPositionFix(instance);
ensureNoOverflow();
}
}
}
/**
* Toggles the dialog basic view mode
* Toggles the dialog basic view mode
*
* @param {Object} instance The dilog instance.
*
@ -740,7 +740,7 @@
}
/**
* Toggles the dialog frameless view mode
* Toggles the dialog frameless view mode
*
* @param {Object} instance The dilog instance.
*
@ -755,7 +755,7 @@
removeClass(instance.elements.root, classes.frameless);
}
}
/**
* Helper: Brings the modeless dialog to front, attached to modeless dialogs.
*
@ -765,7 +765,7 @@
* @return {undefined}
*/
function bringToFront(event, instance){
// Do not bring to front if preceeded by an open modal
var index = openDialogs.indexOf(instance);
for(var x=index+1;x<openDialogs.length;x+=1){
@ -773,7 +773,7 @@
return;
}
}
// Bring to front by making it the last child.
if(document.body.lastChild !== instance.elements.root){
document.body.appendChild(instance.elements.root);
@ -782,17 +782,17 @@
openDialogs.push(instance);
setFocus(instance);
}
return false;
}
/**
* Helper: reflects dialogs options updates
*
* @param {Object} instance The dilog instance.
* @param {String} option The updated option name.
*
* @return {undefined}
* @return {undefined}
*/
function optionUpdated(instance, option, oldValue, newValue){
switch(option){
@ -853,7 +853,7 @@
instance.hooks.onupdate.call(instance, option, oldValue, newValue);
}
}
/**
* Helper: reflects dialogs options updates
*
@ -864,9 +864,9 @@
* @param {Object} value Optional, the value associated with the key (in case it was a string).
* @param {String} option The updated option name.
*
* @return {Object} result object
* @return {Object} result object
* The result objects has an 'op' property, indicating of this is a SET or GET operation.
* GET:
* GET:
* - found: a flag indicating if the key was found or not.
* - value: the property value.
* SET:
@ -918,7 +918,7 @@
callback.call(instance,key, old, value);
}
result.items.push({'key': key, 'value': value , 'found':true});
}else{
result.items.push({'key': key, 'value': value , 'found':false});
}
@ -929,13 +929,13 @@
}
return result;
}
/**
* Triggers a close event.
*
* @param {Object} instance The dilog instance.
*
*
* @return {undefined}
*/
function triggerClose(instance) {
@ -955,7 +955,7 @@
*
* @param {Event} event DOM event object.
* @param {Object} instance The dilog instance.
*
*
* @return {undefined}
*/
function commandsClickHandler(event, instance) {
@ -986,7 +986,7 @@
* Helper: pins the modeless dialog.
*
* @param {Object} instance The dialog instance.
*
*
* @return {undefined}
*/
function pin(instance) {
@ -998,11 +998,11 @@
* Helper: unpins the modeless dialog.
*
* @param {Object} instance The dilog instance.
*
*
* @return {undefined}
*/
function unpin(instance) {
//unpin the dialog
//unpin the dialog
instance.set('pinned', false);
}
@ -1011,13 +1011,13 @@
* Helper: enlarges the dialog to fill the entire screen.
*
* @param {Object} instance The dilog instance.
*
*
* @return {undefined}
*/
function maximize(instance) {
// allow custom `onmaximize` method
dispatchEvent('onmaximize', instance);
//maximize the dialog
//maximize the dialog
addClass(instance.elements.root, classes.maximized);
if (instance.isOpen()) {
ensureNoOverflow();
@ -1030,13 +1030,13 @@
* Helper: returns the dialog to its former size.
*
* @param {Object} instance The dilog instance.
*
*
* @return {undefined}
*/
function restore(instance) {
// allow custom `onrestore` method
dispatchEvent('onrestore', instance);
//maximize the dialog
//maximize the dialog
removeClass(instance.elements.root, classes.maximized);
if (instance.isOpen()) {
ensureNoOverflow();
@ -1203,7 +1203,7 @@
// flag to cancel keyup event if already handled by click event (pressing Enter on a focusted button).
var cancelKeyup = false;
/**
/**
* Helper: triggers a button callback
*
* @param {Object} The dilog instance.
@ -1233,7 +1233,7 @@
*
* @param {Event} DOM event object.
* @param {Object} The dilog instance.
*
*
* @return {undefined}
*/
function buttonsClickHandler(event, instance) {
@ -1249,7 +1249,7 @@
*
* @param {Event} DOM event object.
* @param {Object} The dilog instance.
*
*
* @return {undefined}
*/
function keyupHandler(event) {
@ -1276,7 +1276,7 @@
*
* @param {Event} DOM event object.
* @param {Object} The dilog instance.
*
*
* @return {undefined}
*/
function keydownHandler(event) {
@ -1346,7 +1346,7 @@
element = focus.element.call(instance);
break;
}
// if no focus element, default to first reset element.
if ((typeof element === 'undefined' || element === null) && instance.__internal.buttons.length === 0) {
element = instance.elements.reset[0];
@ -1373,7 +1373,7 @@
*/
function onReset(event, instance) {
// should work on last modal if triggered from document.body
// should work on last modal if triggered from document.body
if (!instance) {
for (var x = openDialogs.length - 1; x > -1; x -= 1) {
if (openDialogs[x].isModal()) {
@ -1419,7 +1419,7 @@
}
}
/**
* Transition in transitionend event handler.
* Transition in transitionend event handler.
*
* @param {Event} TransitionEnd event object.
* @param {Object} The dilog instance.
@ -1449,7 +1449,7 @@
}
/**
* Transition out transitionend event handler.
* Transition out transitionend event handler.
*
* @param {Event} TransitionEnd event object.
* @param {Object} The dilog instance.
@ -1477,7 +1477,7 @@
instance.__internal.activeElement.focus();
instance.__internal.activeElement = null;
}
//destory the instance
if (typeof instance.__internal.destroy === 'function') {
instance.__internal.destroy.apply(instance);
@ -1502,7 +1502,7 @@
*
* @param {Event} event DOM event object.
* @param {Node} element The element being moved.
*
*
* @return {undefined}
*/
function moveElement(event, element) {
@ -1512,17 +1512,17 @@
if(refreshTop){
top -= document.body.scrollTop;
}
element.style.left = left + 'px';
element.style.top = top + 'px';
}
/**
* Helper: sets the element top/left coordinates within screen bounds
*
* @param {Event} event DOM event object.
* @param {Node} element The element being moved.
*
*
* @return {undefined}
*/
function moveElementBounded(event, element) {
@ -1532,7 +1532,7 @@
if(refreshTop){
top -= document.body.scrollTop;
}
element.style.left = Math.min(bounds.maxLeft, Math.max(bounds.minLeft, left)) + 'px';
if(refreshTop){
element.style.top = Math.min(bounds.maxTop, Math.max(bounds.minTop, top)) + 'px';
@ -1540,7 +1540,7 @@
element.style.top = Math.max(bounds.minTop, top) + 'px';
}
}
/**
* Triggers the start of a move event, attached to the header element mouse down event.
@ -1548,7 +1548,7 @@
*
* @param {Event} event DOM event object.
* @param {Object} instance The dilog instance.
*
*
* @return {Boolean} false
*/
function beginMove(event, instance) {
@ -1575,7 +1575,7 @@
if (element.style.top) {
top = parseInt(element.style.top, 10);
}
offsetX = eventSrc[xProp] - left;
offsetY = eventSrc[yProp] - top;
@ -1584,18 +1584,18 @@
}else if(instance.isPinned()){
offsetY -= document.body.scrollTop;
}
if(instance.get('moveBounded')){
var current = element,
offsetLeft = -left,
offsetTop = -top;
//calc offset
do {
offsetLeft += current.offsetLeft;
offsetTop += current.offsetTop;
} while (current = current.offsetParent);
bounds = {
maxLeft : offsetLeft,
minLeft : -offsetLeft,
@ -1607,7 +1607,7 @@
bounds = null;
moveDelegate = moveElement;
}
// allow custom `onmove` method
dispatchEvent('onmove', instance);
@ -1624,7 +1624,7 @@
* The actual move handler, attached to document.body mousemove event.
*
* @param {Event} event DOM event object.
*
*
* @return {undefined}
*/
function move(event) {
@ -1700,7 +1700,7 @@
}
/* Controls moving a dialog around */
//holde the current instance being resized
//holde the current instance being resized
var resizable = null,
//holds the staring left offset when resize starts.
startingLeft = Number.Nan,
@ -1718,7 +1718,7 @@
* @param {Event} event DOM mousemove event object.
* @param {Node} element The element being moved.
* @param {Boolean} pinned A flag indicating if the element being resized is pinned to the screen.
*
*
* @return {undefined}
*/
function resizeElement(event, element, pageRelative) {
@ -1744,7 +1744,7 @@
// rtl handling
var isRTL = isRightToLeft();
if (isRTL) {
// reverse X
// reverse X
X = document.body.offsetWidth - X;
// if has a starting left, calculate offsetRight
if (!isNaN(startingLeft)) {
@ -1782,7 +1782,7 @@
*
* @param {Event} event DOM event object.
* @param {Object} instance The dilog instance.
*
*
* @return {Boolean} false
*/
function beginResize(event, instance) {
@ -1797,7 +1797,7 @@
if (eventSrc) {
// allow custom `onresize` method
dispatchEvent('onresize', instance);
resizable = instance;
handleOffset = instance.elements.resizeHandle.offsetHeight / 2;
var element = instance.elements.dialog;
@ -1821,7 +1821,7 @@
* The actual resize handler, attached to document.body mousemove event.
*
* @param {Event} event DOM event object.
*
*
* @return {undefined}
*/
function resize(event) {
@ -2178,12 +2178,12 @@
if(!isNaN(x) && !isNaN(y)){
// allow custom `onmove` method
dispatchEvent('onmove', this);
var element = this.elements.dialog,
current = element,
offsetLeft = 0,
offsetTop = 0;
//subtract existing left,top
if (element.style.left) {
offsetLeft -= parseInt(element.style.left, 10);
@ -2208,7 +2208,7 @@
element.style.left = left + 'px';
element.style.top = top + 'px';
// allow custom `onmoved` method
dispatchEvent('onmoved', this);
}
@ -2233,10 +2233,10 @@
;
if(!isNaN(w) && !isNaN(h) && this.get('resizable') === true){
// allow custom `onresize` method
dispatchEvent('onresize', this);
if(('' + width).match(regex)){
w = w / 100 * document.documentElement.clientWidth ;
}
@ -2253,14 +2253,14 @@
element.style.minHeight = this.elements.header.offsetHeight + this.elements.footer.offsetHeight + 'px';
element.style.width = w + 'px';
element.style.height = h + 'px';
// allow custom `onresized` method
dispatchEvent('onresized', this);
}
return this;
},
/**
* Gets or Sets dialog settings/options
* Gets or Sets dialog settings/options
*
* @param {String|Object} key A string specifying a propery name or a collection of key/value pairs.
* @param {Object} value Optional, the value associated with the key (in case it was a string).
@ -2292,14 +2292,14 @@
}
},
/**
* [Alias] Sets dialog settings/options
* [Alias] Sets dialog settings/options
*/
set:function(key, value){
this.setting(key,value);
return this;
},
/**
* [Alias] Gets dialog settings/options
* [Alias] Gets dialog settings/options
*/
get:function(key){
return this.setting(key);
@ -2350,7 +2350,7 @@
* @return {Object} the dialog instance.
*/
show: function (modal, className) {
// ensure initialization
initialize(this);
@ -2412,7 +2412,7 @@
//reflow
reflow = this.elements.root.offsetWidth;
// show dialog
removeClass(this.elements.root, classes.hidden);
@ -2472,7 +2472,7 @@
// allow custom `onclose` method
dispatchEvent('onclose', this);
//remove from open dialogs
//remove from open dialogs
openDialogs.splice(openDialogs.indexOf(this),1);
this.__internal.isOpen = false;
@ -2526,7 +2526,7 @@
};
/**
* Helper: initializes the notifier instance
*
*
*/
function initialize(instance) {
@ -2546,7 +2546,7 @@
document.body.appendChild(element);
}
}
function pushInstance(instance) {
instance.__internal.pushed = true;
openInstances.push(instance);
@ -2557,7 +2557,7 @@
}
/**
* Helper: update the notifier instance position
*
*
*/
function updatePosition(instance) {
element.className = classes.base;
@ -2624,10 +2624,10 @@
/* notification DOM element*/
element: div,
/*
* Pushes a notification message
* Pushes a notification message
* @param {string or DOMElement} content The notification message content
* @param {Number} wait The time (in seconds) to wait before the message is dismissed, a value of 0 means keep open till clicked.
*
*
*/
push: function (_content, _wait) {
if (!this.__internal.pushed) {
@ -2674,18 +2674,18 @@
/*
* {Function} callback function to be invoked before dismissing the notification message.
* Remarks: A return value === 'false' will cancel the dismissal
*
*
*/
ondismiss: function () { },
/*
* {Function} callback function to be invoked when the message is dismissed.
*
*
*/
callback: callback,
/*
* Dismisses the notification message
* Dismisses the notification message
* @param {Boolean} clicked A flag indicating if the dismissal was caused by a click.
*
*
*/
dismiss: function (clicked) {
if (this.__internal.pushed) {
@ -2712,7 +2712,7 @@
/*
* Delays the notification message dismissal
* @param {Number} wait The time (in seconds) to wait before the message is dismissed, a value of 0 means keep open till clicked.
*
*
*/
delay: function (wait) {
clearTimers(this);
@ -2726,7 +2726,7 @@
/*
* Sets the notification message contents
* @param {string or DOMElement} content The notification message content
*
*
*/
setContent: function (content) {
if (typeof content === 'string') {
@ -2740,7 +2740,7 @@
},
/*
* Dismisses all open notifications except this.
*
*
*/
dismissOthers: function () {
notifier.dismissAll(this);
@ -2752,7 +2752,7 @@
//notifier api
return {
/**
* Gets or Sets notifier settings.
* Gets or Sets notifier settings.
*
* @param {string} key The setting name
* @param {Variant} value The setting value.
@ -2781,14 +2781,14 @@
return this;
},
/**
* [Alias] Sets dialog settings/options
* [Alias] Sets dialog settings/options
*/
set:function(key,value){
this.setting(key,value);
return this;
},
/**
* [Alias] Gets dialog settings/options
* [Alias] Gets dialog settings/options
*/
get:function(key){
return this.setting(key);
@ -2907,12 +2907,12 @@
return {
/**
* Alertify defaults
*
*
* @type {Object}
*/
defaults: defaults,
/**
* Dialogs factory
* Dialogs factory
*
* @param {string} Dialog name.
* @param {Function} A Dialog factory function.
@ -3005,13 +3005,13 @@
}
},
/**
* [Alias] Sets dialog settings/options
* [Alias] Sets dialog settings/options
*/
set: function(name,key,value){
return this.setting(name, key,value);
},
/**
* [Alias] Gets dialog settings/options
* [Alias] Gets dialog settings/options
*/
get: function(name, key){
return this.setting(name, key);
@ -3538,6 +3538,9 @@
closeEvent.cancel = !returnValue;
}
}
if(!closeEvent.cancel){
input.value = this.settings.value;
}
break;
}
}

File diff suppressed because one or more lines are too long