[+] BO: Add Jquery alerts for nice alert box
This commit is contained in:
@@ -54,7 +54,7 @@ echo ' <tr>
|
||||
$(document).ready(function() {
|
||||
$(\'div#categoryList input.categoryBox\').click(function (){
|
||||
if ($(this).is(\':not(:checked)\') && $(\'div#categoryList input.id_category_default\').val() == $(this).val())
|
||||
alert(\''.utf8_encode(html_entity_decode($adminProducts->getL('Consider changing the default category.'))).'\');
|
||||
jAlert(\''.utf8_encode(html_entity_decode($adminProducts->getL('Consider changing the default category.'))).'\');
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -75,7 +75,7 @@
|
||||
}
|
||||
catch(e)
|
||||
{
|
||||
alert('oups');
|
||||
jAlert('Technical error');
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -123,7 +123,7 @@
|
||||
}
|
||||
catch(e)
|
||||
{
|
||||
alert("oups");
|
||||
jAlert('Technical error');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -13,7 +13,8 @@
|
||||
</fieldset><br/>
|
||||
<script type="text/javascript">
|
||||
var ajaxQueries = new Array();
|
||||
function run_sync () {
|
||||
function run_sync()
|
||||
{
|
||||
$('#ajax_error').html('');
|
||||
$('#ajax_error').hide();
|
||||
$('#ajax_conf').html('');
|
||||
@@ -47,8 +48,9 @@
|
||||
|
||||
$('#ajax_loader').html('');
|
||||
},
|
||||
error: function(XMLHttpRequest, textStatus, errorThrown) {
|
||||
alert("TECHNICAL ERROR: unable to sync.\n\nDetails:\nError thrown: " + XMLHttpRequest + "\n" + 'Text status: ' + textStatus);
|
||||
error: function(XMLHttpRequest, textStatus, errorThrown)
|
||||
{
|
||||
jAlert("TECHNICAL ERROR: unable to sync.\n\nDetails:\nError thrown: " + XMLHttpRequest + "\n" + 'Text status: ' + textStatus);
|
||||
}
|
||||
});
|
||||
ajaxQueries.push(ajaxQuery);
|
||||
|
||||
@@ -107,7 +107,7 @@
|
||||
if ($(this).attr('name') == 'category_reduction['+$('[name="id_category"]:checked').val()+']')
|
||||
{
|
||||
exist = true;
|
||||
alert('{l s='This category already exist for this group'}');
|
||||
jAlert('{l s='This category already exist for this group'}');
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -137,7 +137,7 @@
|
||||
//IE6 bug fix
|
||||
if(error != 'indexOf')
|
||||
errors += jsonData.errors[error] + "\n";
|
||||
alert(errors);
|
||||
jAlert(errors);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -67,17 +67,17 @@ $(document).ready(function() {
|
||||
url: 'ajax-tab.php',
|
||||
dataType : 'json',
|
||||
success: function(data) {
|
||||
if(!data)
|
||||
alert("TECHNICAL ERROR - no return status found");
|
||||
else if(data.status != "ok")
|
||||
alert("TECHNICAL ERROR: "+data.msg);
|
||||
if (!data)
|
||||
jAlert("TECHNICAL ERROR - no return status found");
|
||||
else if (data.status != "ok")
|
||||
jAlert("TECHNICAL ERROR: "+data.msg);
|
||||
|
||||
$('#adminpresentation').slideUp('slow');
|
||||
|
||||
},
|
||||
error: function(data, textStatus, errorThrown)
|
||||
{
|
||||
alert("TECHNICAL ERROR: "+data);
|
||||
jAlert("TECHNICAL ERROR: "+data);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -131,10 +131,10 @@ $(document).ready(function() {
|
||||
url: 'ajax-tab.php',
|
||||
dataType : 'json',
|
||||
success: function(data) {
|
||||
if(!data)
|
||||
alert("TECHNICAL ERROR - no return status found");
|
||||
else if(data.status != "ok")
|
||||
alert("TECHNICAL ERROR: "+data.msg);
|
||||
if (!data)
|
||||
jAlert("TECHNICAL ERROR - no return status found");
|
||||
else if (data.status != "ok")
|
||||
jAlert("TECHNICAL ERROR: "+data.msg);
|
||||
if(data.upgrade.need_upgrade)
|
||||
{
|
||||
$('#blockNewVersionCheck').children("a").attr('href',data.upgrade.link);
|
||||
@@ -146,7 +146,7 @@ $(document).ready(function() {
|
||||
},
|
||||
error: function(data, textStatus, errorThrown)
|
||||
{
|
||||
alert("TECHNICAL ERROR: "+data);
|
||||
jAlert("TECHNICAL ERROR: "+data);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -146,7 +146,7 @@
|
||||
},
|
||||
error: function(res,textStatus,jqXHR)
|
||||
{
|
||||
//alert("TECHNICAL ERROR"+res);
|
||||
//jAlert("TECHNICAL ERROR"+res);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -176,7 +176,7 @@
|
||||
},
|
||||
error: function(res,textStatus,jqXHR)
|
||||
{
|
||||
//alert("TECHNICAL ERROR"+res);
|
||||
//jAlert("TECHNICAL ERROR"+res);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -221,7 +221,7 @@
|
||||
},
|
||||
error: function(res,textStatus,jqXHR)
|
||||
{
|
||||
//alert("TECHNICAL ERROR"+res);
|
||||
//jAlert("TECHNICAL ERROR"+res);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -263,7 +263,7 @@
|
||||
},
|
||||
error: function(res,textStatus,jqXHR)
|
||||
{
|
||||
//alert("TECHNICAL ERROR"+res);
|
||||
//jAlert("TECHNICAL ERROR"+res);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -79,12 +79,12 @@
|
||||
var curPackItemQty = $('#curPackItemQty').val();
|
||||
if (curPackItemId == '' || curPackItemName == '')
|
||||
{
|
||||
alert(msg_select_one);
|
||||
jAlert(msg_select_one);
|
||||
return false;
|
||||
}
|
||||
else if (curPackItemId == '' || curPackItemQty == '')
|
||||
{
|
||||
alert(msg_set_quantity);
|
||||
jAlert(msg_set_quantity);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -90,8 +90,8 @@
|
||||
$('#add_table').click(function(){
|
||||
var table = $('#selectTables select').val();
|
||||
|
||||
if (table == 'null')
|
||||
alert("{l s='Please, choose table.'}");
|
||||
if (!table)
|
||||
jAlert("{l s='Please, choose table.'}");
|
||||
else
|
||||
AddRequestSql(table);
|
||||
});
|
||||
|
||||
@@ -134,7 +134,7 @@
|
||||
// check if it's possible to add the product
|
||||
if (product_infos == null || $('#cur_product_name').val() == '')
|
||||
{
|
||||
alert('{l s='Thanks to select at least one product.'}');
|
||||
jAlert('{l s='Thanks to select at least one product.'}');
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -1574,7 +1574,7 @@ class AdminControllerCore extends Controller
|
||||
$this->addCSS(_THEME_CSS_DIR_.'rtl.css');
|
||||
|
||||
$this->addJquery();
|
||||
$this->addjQueryPlugin(array('cluetip', 'hoverIntent', 'scrollTo'));
|
||||
$this->addjQueryPlugin(array('cluetip', 'hoverIntent', 'scrollTo', 'alerts'));
|
||||
|
||||
$this->addJS(array(
|
||||
_PS_JS_DIR_.'admin.js',
|
||||
|
||||
@@ -303,7 +303,7 @@ function getParentCategoriesIdAndOpen(id_category)
|
||||
interval = setInterval(openParentCategories, 10);
|
||||
},
|
||||
error: function(XMLHttpRequest, textStatus, errorThrown) {
|
||||
alert("TECHNICAL ERROR: \n\nDetails:\nError thrown: " + XMLHttpRequest + "\n" + 'Text status: ' + textStatus);
|
||||
jAlert("TECHNICAL ERROR: \n\nDetails:\nError thrown: " + XMLHttpRequest + "\n" + 'Text status: ' + textStatus);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
+3
-3
@@ -312,7 +312,7 @@ function delAccessory(id)
|
||||
var nameCut = name.value.split('¤');
|
||||
|
||||
if (inputCut.length != nameCut.length)
|
||||
return alert('Bad size');
|
||||
return jAlert('Bad size');
|
||||
|
||||
// Reset all hidden fields
|
||||
input.value = '';
|
||||
@@ -641,7 +641,7 @@ function orderDeleteProduct(txtConfirm, txtExplain)
|
||||
totalAvailable = totalQty - totalQtyReturn;
|
||||
if (totalCancel > totalAvailable)
|
||||
{
|
||||
alert(txtConfirm + ' : \'' + ' ' + productName + '\' ! \n\n' + txtExplain + ' ('+ totalCancel + ' > ' + totalAvailable +')' + '\n ');
|
||||
jAlert(txtConfirm + ' : \'' + ' ' + productName + '\' ! \n\n' + txtExplain + ' ('+ totalCancel + ' > ' + totalAvailable +')' + '\n ');
|
||||
ret = false;
|
||||
}
|
||||
}
|
||||
@@ -958,7 +958,7 @@ function doAdminAjax(data, success_func, error_func)
|
||||
if (error_func)
|
||||
return error_func(data);
|
||||
|
||||
alert("[TECHNICAL ERROR]");
|
||||
jAlert("[TECHNICAL ERROR]");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
+4
-5
@@ -30,7 +30,7 @@ $(document).ready(function(){
|
||||
|
||||
var newImportMatchs = $('#newImportMatchs').attr('value');
|
||||
if (newImportMatchs == '')
|
||||
alert(errorEmpty);
|
||||
jAlert(errorEmpty);
|
||||
else
|
||||
{
|
||||
var matchFields = '';
|
||||
@@ -51,7 +51,7 @@ $(document).ready(function(){
|
||||
},
|
||||
error: function(XMLHttpRequest, textStatus, errorThrown)
|
||||
{
|
||||
alert('TECHNICAL ERROR Details: '+XMLHttpRequest.responseText);
|
||||
jAlert('TECHNICAL ERROR Details: '+XMLHttpRequest.responseText);
|
||||
|
||||
}
|
||||
});
|
||||
@@ -78,7 +78,7 @@ $(document).ready(function(){
|
||||
},
|
||||
error: function(XMLHttpRequest, textStatus, errorThrown)
|
||||
{
|
||||
alert('TECHNICAL ERROR Details: '+XMLHttpRequest.responseText);
|
||||
jAlert('TECHNICAL ERROR Details: '+XMLHttpRequest.responseText);
|
||||
|
||||
}
|
||||
});
|
||||
@@ -102,8 +102,7 @@ $(document).ready(function(){
|
||||
},
|
||||
error: function(XMLHttpRequest, textStatus, errorThrown)
|
||||
{
|
||||
alert('TECHNICAL ERROR Details: '+XMLHttpRequest.responseText);
|
||||
|
||||
jAlert('TECHNICAL ERROR Details: '+XMLHttpRequest.responseText);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
+9
-9
@@ -386,19 +386,19 @@ function init()
|
||||
|
||||
if ($('input#add_product_product_id').val() == 0)
|
||||
{
|
||||
alert(txt_add_product_no_product);
|
||||
jAlert(txt_add_product_no_product);
|
||||
go = false;
|
||||
}
|
||||
|
||||
if ($('input#add_product_product_quantity').val() == 0)
|
||||
{
|
||||
alert(txt_add_product_no_product_quantity);
|
||||
jAlert(txt_add_product_no_product_quantity);
|
||||
go = false;
|
||||
}
|
||||
|
||||
if ($('input#add_product_product_price_excl').val() == 0)
|
||||
{
|
||||
alert(txt_add_product_no_product_price);
|
||||
jAlert(txt_add_product_no_product_price);
|
||||
go = false;
|
||||
}
|
||||
|
||||
@@ -444,7 +444,7 @@ function init()
|
||||
$('.partial_refund_fields').hide();
|
||||
}
|
||||
else
|
||||
alert(data.error);
|
||||
jAlert(data.error);
|
||||
}
|
||||
});
|
||||
ajaxQueries.push(ajax_query);
|
||||
@@ -545,7 +545,7 @@ function init()
|
||||
$('.partial_refund_fields').hide();
|
||||
}
|
||||
else
|
||||
alert(data.error);
|
||||
jAlert(data.error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -578,13 +578,13 @@ function init()
|
||||
$('input[name=submitProductChange]').click(function() {
|
||||
if ($(this).parent().parent().find('td .edit_product_quantity').val() <= 0)
|
||||
{
|
||||
alert(txt_add_product_no_product_quantity);
|
||||
jAlert(txt_add_product_no_product_quantity);
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($(this).parent().parent().find('td .edit_product_price').val() <= 0)
|
||||
{
|
||||
alert(txt_add_product_no_product_price);
|
||||
jAlert(txt_add_product_no_product_price);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -618,7 +618,7 @@ function init()
|
||||
$('.partial_refund_fields').hide();
|
||||
}
|
||||
else
|
||||
alert(data.error);
|
||||
jAlert(data.error);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -687,7 +687,7 @@ function init()
|
||||
updateDiscountForm(data.discount_form_html);
|
||||
}
|
||||
else
|
||||
alert(data.error);
|
||||
jAlert(data.error);
|
||||
}
|
||||
});
|
||||
return false;
|
||||
|
||||
@@ -342,14 +342,14 @@ function add_attr()
|
||||
{
|
||||
var attr_group = $('#attribute_group option:selected');
|
||||
if (attr_group.val() == 0)
|
||||
return alert(msg_combination_1);
|
||||
return jAlert(msg_combination_1);
|
||||
|
||||
var attr_name = $('#attribute option:selected');
|
||||
if (attr_name.val() == 0)
|
||||
return alert(msg_combination_2);
|
||||
return jAlert(msg_combination_2);
|
||||
|
||||
if (attr_group.val() in storeUsedGroups)
|
||||
return alert(msg_combination_3);
|
||||
return jAlert(msg_combination_3);
|
||||
|
||||
storeUsedGroups[attr_group.val()] = true;
|
||||
$('<option></option>')
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 1.5 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 1.5 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 1.5 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 317 B |
@@ -0,0 +1,57 @@
|
||||
#popup_container {
|
||||
font-family: Arial, sans-serif;
|
||||
font-size: 12px;
|
||||
min-width: 300px; /* Dialog will be no smaller than this */
|
||||
max-width: 600px; /* Dialog will wrap after this width */
|
||||
background: #FFF;
|
||||
border: solid 5px #999;
|
||||
color: #000;
|
||||
-moz-border-radius: 5px;
|
||||
-webkit-border-radius: 5px;
|
||||
border-radius: 5px;
|
||||
}
|
||||
|
||||
#popup_title {
|
||||
font-size: 14px;
|
||||
font-weight: bold;
|
||||
text-align: center;
|
||||
line-height: 1.75em;
|
||||
color: #666;
|
||||
background: #CCC url(images/title.gif) top repeat-x;
|
||||
border: solid 1px #FFF;
|
||||
border-bottom: solid 1px #999;
|
||||
cursor: default;
|
||||
padding: 0em;
|
||||
margin: 0em;
|
||||
}
|
||||
|
||||
#popup_content {
|
||||
background: 16px 16px no-repeat url(images/info.gif);
|
||||
padding: 1em 1.75em;
|
||||
margin: 0em;
|
||||
}
|
||||
|
||||
#popup_content.alert {
|
||||
background-image: url(images/info.gif);
|
||||
}
|
||||
|
||||
#popup_content.confirm {
|
||||
background-image: url(images/important.gif);
|
||||
}
|
||||
|
||||
#popup_content.prompt {
|
||||
background-image: url(images/help.gif);
|
||||
}
|
||||
|
||||
#popup_message {
|
||||
padding-left: 48px;
|
||||
}
|
||||
|
||||
#popup_panel {
|
||||
text-align: center;
|
||||
margin: 1em 0em 0em 1em;
|
||||
}
|
||||
|
||||
#popup_prompt {
|
||||
margin: .5em 0em;
|
||||
}
|
||||
@@ -0,0 +1,235 @@
|
||||
// jQuery Alert Dialogs Plugin
|
||||
//
|
||||
// Version 1.1
|
||||
//
|
||||
// Cory S.N. LaViska
|
||||
// A Beautiful Site (http://abeautifulsite.net/)
|
||||
// 14 May 2009
|
||||
//
|
||||
// Visit http://abeautifulsite.net/notebook/87 for more information
|
||||
//
|
||||
// Usage:
|
||||
// jAlert( message, [title, callback] )
|
||||
// jConfirm( message, [title, callback] )
|
||||
// jPrompt( message, [value, title, callback] )
|
||||
//
|
||||
// History:
|
||||
//
|
||||
// 1.00 - Released (29 December 2008)
|
||||
//
|
||||
// 1.01 - Fixed bug where unbinding would destroy all resize events
|
||||
//
|
||||
// License:
|
||||
//
|
||||
// This plugin is dual-licensed under the GNU General Public License and the MIT License and
|
||||
// is copyright 2008 A Beautiful Site, LLC.
|
||||
//
|
||||
(function($) {
|
||||
|
||||
$.alerts = {
|
||||
|
||||
// These properties can be read/written by accessing $.alerts.propertyName from your scripts at any time
|
||||
|
||||
verticalOffset: -75, // vertical offset of the dialog from center screen, in pixels
|
||||
horizontalOffset: 0, // horizontal offset of the dialog from center screen, in pixels/
|
||||
repositionOnResize: true, // re-centers the dialog on window resize
|
||||
overlayOpacity: .01, // transparency level of overlay
|
||||
overlayColor: '#FFF', // base color of overlay
|
||||
draggable: true, // make the dialogs draggable (requires UI Draggables plugin)
|
||||
okButton: ' OK ', // text for the OK button
|
||||
cancelButton: ' Cancel ', // text for the Cancel button
|
||||
dialogClass: null, // if specified, this class will be applied to all dialogs
|
||||
|
||||
// Public methods
|
||||
|
||||
alert: function(message, title, callback) {
|
||||
if( title == null ) title = 'Alert';
|
||||
$.alerts._show(title, message, null, 'alert', function(result) {
|
||||
if( callback ) callback(result);
|
||||
});
|
||||
},
|
||||
|
||||
confirm: function(message, title, callback) {
|
||||
if( title == null ) title = 'Confirm';
|
||||
$.alerts._show(title, message, null, 'confirm', function(result) {
|
||||
if( callback ) callback(result);
|
||||
});
|
||||
},
|
||||
|
||||
prompt: function(message, value, title, callback) {
|
||||
if( title == null ) title = 'Prompt';
|
||||
$.alerts._show(title, message, value, 'prompt', function(result) {
|
||||
if( callback ) callback(result);
|
||||
});
|
||||
},
|
||||
|
||||
// Private methods
|
||||
|
||||
_show: function(title, msg, value, type, callback) {
|
||||
|
||||
$.alerts._hide();
|
||||
$.alerts._overlay('show');
|
||||
|
||||
$("BODY").append(
|
||||
'<div id="popup_container">' +
|
||||
'<h1 id="popup_title"></h1>' +
|
||||
'<div id="popup_content">' +
|
||||
'<div id="popup_message"></div>' +
|
||||
'</div>' +
|
||||
'</div>');
|
||||
|
||||
if( $.alerts.dialogClass ) $("#popup_container").addClass($.alerts.dialogClass);
|
||||
|
||||
// IE6 Fix
|
||||
var pos = ($.browser.msie && parseInt($.browser.version) <= 6 ) ? 'absolute' : 'fixed';
|
||||
|
||||
$("#popup_container").css({
|
||||
position: pos,
|
||||
zIndex: 99999,
|
||||
padding: 0,
|
||||
margin: 0
|
||||
});
|
||||
|
||||
$("#popup_title").text(title);
|
||||
$("#popup_content").addClass(type);
|
||||
$("#popup_message").text(msg);
|
||||
$("#popup_message").html( $("#popup_message").text().replace(/\n/g, '<br />') );
|
||||
|
||||
$("#popup_container").css({
|
||||
minWidth: $("#popup_container").outerWidth(),
|
||||
maxWidth: $("#popup_container").outerWidth()
|
||||
});
|
||||
|
||||
$.alerts._reposition();
|
||||
$.alerts._maintainPosition(true);
|
||||
|
||||
switch( type ) {
|
||||
case 'alert':
|
||||
$("#popup_message").after('<div id="popup_panel"><input type="button" value="' + $.alerts.okButton + '" id="popup_ok" /></div>');
|
||||
$("#popup_ok").click( function() {
|
||||
$.alerts._hide();
|
||||
callback(true);
|
||||
});
|
||||
$("#popup_ok").focus().keypress( function(e) {
|
||||
if( e.keyCode == 13 || e.keyCode == 27 ) $("#popup_ok").trigger('click');
|
||||
});
|
||||
break;
|
||||
case 'confirm':
|
||||
$("#popup_message").after('<div id="popup_panel"><input type="button" value="' + $.alerts.okButton + '" id="popup_ok" /> <input type="button" value="' + $.alerts.cancelButton + '" id="popup_cancel" /></div>');
|
||||
$("#popup_ok").click( function() {
|
||||
$.alerts._hide();
|
||||
if( callback ) callback(true);
|
||||
});
|
||||
$("#popup_cancel").click( function() {
|
||||
$.alerts._hide();
|
||||
if( callback ) callback(false);
|
||||
});
|
||||
$("#popup_ok").focus();
|
||||
$("#popup_ok, #popup_cancel").keypress( function(e) {
|
||||
if( e.keyCode == 13 ) $("#popup_ok").trigger('click');
|
||||
if( e.keyCode == 27 ) $("#popup_cancel").trigger('click');
|
||||
});
|
||||
break;
|
||||
case 'prompt':
|
||||
$("#popup_message").append('<br /><input type="text" size="30" id="popup_prompt" />').after('<div id="popup_panel"><input type="button" value="' + $.alerts.okButton + '" id="popup_ok" /> <input type="button" value="' + $.alerts.cancelButton + '" id="popup_cancel" /></div>');
|
||||
$("#popup_prompt").width( $("#popup_message").width() );
|
||||
$("#popup_ok").click( function() {
|
||||
var val = $("#popup_prompt").val();
|
||||
$.alerts._hide();
|
||||
if( callback ) callback( val );
|
||||
});
|
||||
$("#popup_cancel").click( function() {
|
||||
$.alerts._hide();
|
||||
if( callback ) callback( null );
|
||||
});
|
||||
$("#popup_prompt, #popup_ok, #popup_cancel").keypress( function(e) {
|
||||
if( e.keyCode == 13 ) $("#popup_ok").trigger('click');
|
||||
if( e.keyCode == 27 ) $("#popup_cancel").trigger('click');
|
||||
});
|
||||
if( value ) $("#popup_prompt").val(value);
|
||||
$("#popup_prompt").focus().select();
|
||||
break;
|
||||
}
|
||||
|
||||
// Make draggable
|
||||
if( $.alerts.draggable ) {
|
||||
try {
|
||||
$("#popup_container").draggable({ handle: $("#popup_title") });
|
||||
$("#popup_title").css({ cursor: 'move' });
|
||||
} catch(e) { /* requires jQuery UI draggables */ }
|
||||
}
|
||||
},
|
||||
|
||||
_hide: function() {
|
||||
$("#popup_container").remove();
|
||||
$.alerts._overlay('hide');
|
||||
$.alerts._maintainPosition(false);
|
||||
},
|
||||
|
||||
_overlay: function(status) {
|
||||
switch( status ) {
|
||||
case 'show':
|
||||
$.alerts._overlay('hide');
|
||||
$("BODY").append('<div id="popup_overlay"></div>');
|
||||
$("#popup_overlay").css({
|
||||
position: 'absolute',
|
||||
zIndex: 99998,
|
||||
top: '0px',
|
||||
left: '0px',
|
||||
width: '100%',
|
||||
height: $(document).height(),
|
||||
background: $.alerts.overlayColor,
|
||||
opacity: $.alerts.overlayOpacity
|
||||
});
|
||||
break;
|
||||
case 'hide':
|
||||
$("#popup_overlay").remove();
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
||||
_reposition: function() {
|
||||
var top = (($(window).height() / 2) - ($("#popup_container").outerHeight() / 2)) + $.alerts.verticalOffset;
|
||||
var left = (($(window).width() / 2) - ($("#popup_container").outerWidth() / 2)) + $.alerts.horizontalOffset;
|
||||
if( top < 0 ) top = 0;
|
||||
if( left < 0 ) left = 0;
|
||||
|
||||
// IE6 fix
|
||||
if( $.browser.msie && parseInt($.browser.version) <= 6 ) top = top + $(window).scrollTop();
|
||||
|
||||
$("#popup_container").css({
|
||||
top: top + 'px',
|
||||
left: left + 'px'
|
||||
});
|
||||
$("#popup_overlay").height( $(document).height() );
|
||||
},
|
||||
|
||||
_maintainPosition: function(status) {
|
||||
if( $.alerts.repositionOnResize ) {
|
||||
switch(status) {
|
||||
case true:
|
||||
$(window).bind('resize', $.alerts._reposition);
|
||||
break;
|
||||
case false:
|
||||
$(window).unbind('resize', $.alerts._reposition);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Shortuct functions
|
||||
jAlert = function(message, title, callback) {
|
||||
$.alerts.alert(message, title, callback);
|
||||
}
|
||||
|
||||
jConfirm = function(message, title, callback) {
|
||||
$.alerts.confirm(message, title, callback);
|
||||
};
|
||||
|
||||
jPrompt = function(message, value, title, callback) {
|
||||
$.alerts.prompt(message, value, title, callback);
|
||||
};
|
||||
|
||||
})(jQuery);
|
||||
Reference in New Issue
Block a user