Version Notes
Altima Lookbook Free extension provides online merchants with an ability to show their product in nice and compelling way, close to the way it is shown in print catalogues, but with interactive link to product pages. For example you can show your dresses and accessories on sexy models and furniture in well designed living room. Each element of lookbook image can be tagged as a hotspot and linked to specific product page of your Magento online store.
Download this release
Release Info
Developer | Magento Core Team |
Extension | Altima_lookbook_free |
Version | 0.1.0 |
Comparing to | |
See all releases |
Version 0.1.0
- app/code/local/Altima/Lookbook/Block/Adminhtml/Lookbook.php +32 -0
- app/code/local/Altima/Lookbook/Block/Adminhtml/Lookbook/Edit.php +56 -0
- app/code/local/Altima/Lookbook/Block/Adminhtml/Lookbook/Edit/Form.php +38 -0
- app/code/local/Altima/Lookbook/Block/Adminhtml/Lookbook/Edit/Form/Element/Hotspots.php +108 -0
- app/code/local/Altima/Lookbook/Block/Adminhtml/Lookbook/Edit/Form/Element/Lookbookimage.php +121 -0
- app/code/local/Altima/Lookbook/Block/Adminhtml/Lookbook/Edit/Tab/Form.php +81 -0
- app/code/local/Altima/Lookbook/Block/Adminhtml/Lookbook/Edit/Tabs.php +43 -0
- app/code/local/Altima/Lookbook/Block/Adminhtml/Lookbook/Grid.php +144 -0
- app/code/local/Altima/Lookbook/Block/Adminhtml/Template/Grid/Renderer/Image.php +44 -0
- app/code/local/Altima/Lookbook/Block/Lookbook.php +47 -0
- app/code/local/Altima/Lookbook/Helper/Data.php +222 -0
- app/code/local/Altima/Lookbook/Model/Fileuploader.php +152 -0
- app/code/local/Altima/Lookbook/Model/Layout/Generate/Observer.php +46 -0
- app/code/local/Altima/Lookbook/Model/Lookbook.php +33 -0
- app/code/local/Altima/Lookbook/Model/Mysql4/Lookbook.php +29 -0
- app/code/local/Altima/Lookbook/Model/Mysql4/Lookbook/Collection.php +29 -0
- app/code/local/Altima/Lookbook/Model/Status.php +34 -0
- app/code/local/Altima/Lookbook/Model/Uploadedfileform.php +44 -0
- app/code/local/Altima/Lookbook/Model/Uploadedfilexhr.php +52 -0
- app/code/local/Altima/Lookbook/controllers/Adminhtml/LookbookController.php +256 -0
- app/code/local/Altima/Lookbook/controllers/IndexController.php +48 -0
- app/code/local/Altima/Lookbook/etc/config.xml +174 -0
- app/code/local/Altima/Lookbook/etc/system.xml +117 -0
- app/code/local/Altima/Lookbook/sql/lookbook_setup/mysql4-install-0.1.0.php +45 -0
- app/design/adminhtml/default/default/layout/lookbook.xml +42 -0
- app/design/frontend/base/default/layout/lookbook.xml +38 -0
- app/design/frontend/base/default/template/lookbook/lookbook.phtml +201 -0
- app/etc/modules/Altima_Lookbook.xml +36 -0
- js/jquery/jquery-1.7.min.js +4 -0
- js/jquery/jquery.noconflict.js +1 -0
- js/lookbook/fileuploader.js +1251 -0
- js/lookbook/jquery-ui-1.8.17.js +11827 -0
- js/lookbook/jquery.annotate.js +536 -0
- js/lookbook/json2.min.js +1 -0
- js/lookbook/slides.min.jquery.js +20 -0
- media/lookbook/icons/default/hotspot-icon.png +0 -0
- package.xml +18 -0
- skin/adminhtml/default/default/lookbook/css/annotation.css +288 -0
- skin/adminhtml/default/default/lookbook/css/fileuploader.css +75 -0
- skin/adminhtml/default/default/lookbook/images/btn_bg.gif +0 -0
- skin/adminhtml/default/default/lookbook/images/btn_gray_bg.gif +0 -0
- skin/adminhtml/default/default/lookbook/images/btn_over_bg.gif +0 -0
- skin/adminhtml/default/default/lookbook/images/cancel_btn_icon.png +0 -0
- skin/adminhtml/default/default/lookbook/images/cross.png +0 -0
- skin/adminhtml/default/default/lookbook/images/delete_btn_icon.png +0 -0
- skin/adminhtml/default/default/lookbook/images/icon_btn_add.png +0 -0
- skin/adminhtml/default/default/lookbook/images/link_external.png +0 -0
- skin/adminhtml/default/default/lookbook/images/loading.gif +0 -0
- skin/adminhtml/default/default/lookbook/images/ok_btn_icon.png +0 -0
- skin/adminhtml/default/default/lookbook/images/upload_btn_icon.png +0 -0
- skin/frontend/base/default/lookbook/css/hotspots.css +141 -0
- skin/frontend/base/default/lookbook/images/adv-bg.png +0 -0
- skin/frontend/base/default/lookbook/images/arrow-next.png +0 -0
- skin/frontend/base/default/lookbook/images/arrow-prev.png +0 -0
- skin/frontend/base/default/lookbook/images/background.png +0 -0
- skin/frontend/base/default/lookbook/images/caption-bg.png +0 -0
- skin/frontend/base/default/lookbook/images/info-bg.png +0 -0
- skin/frontend/base/default/lookbook/images/loading.gif +0 -0
- skin/frontend/base/default/lookbook/images/pagination.png +0 -0
app/code/local/Altima/Lookbook/Block/Adminhtml/Lookbook.php
ADDED
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Altima Lookbook Free Extension
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* @category Altima
|
16 |
+
* @package Altima_LookbookFree
|
17 |
+
* @author Altima Web Systems http://altimawebsystems.com/
|
18 |
+
* @email support@altima.net.au
|
19 |
+
* @copyright Copyright (c) 2012 Altima Web Systems (http://altimawebsystems.com/)
|
20 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
21 |
+
*/
|
22 |
+
class Altima_Lookbook_Block_Adminhtml_Lookbook extends Mage_Adminhtml_Block_Widget_Grid_Container
|
23 |
+
{
|
24 |
+
public function __construct()
|
25 |
+
{
|
26 |
+
$this->_controller = 'adminhtml_lookbook';
|
27 |
+
$this->_blockGroup = 'lookbook';
|
28 |
+
$this->_headerText = Mage::helper('lookbook')->__('Lookbook slides manager');
|
29 |
+
$this->_addButtonLabel = Mage::helper('lookbook')->__('Add slide');
|
30 |
+
parent::__construct();
|
31 |
+
}
|
32 |
+
}
|
app/code/local/Altima/Lookbook/Block/Adminhtml/Lookbook/Edit.php
ADDED
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Altima Lookbook Free Extension
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* @category Altima
|
16 |
+
* @package Altima_LookbookFree
|
17 |
+
* @author Altima Web Systems http://altimawebsystems.com/
|
18 |
+
* @email support@altima.net.au
|
19 |
+
* @copyright Copyright (c) 2012 Altima Web Systems (http://altimawebsystems.com/)
|
20 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
21 |
+
*/
|
22 |
+
class Altima_Lookbook_Block_Adminhtml_Lookbook_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
|
23 |
+
{
|
24 |
+
public function __construct()
|
25 |
+
{
|
26 |
+
parent::__construct();
|
27 |
+
|
28 |
+
$this->_objectId = 'id';
|
29 |
+
$this->_blockGroup = 'lookbook';
|
30 |
+
$this->_controller = 'adminhtml_lookbook';
|
31 |
+
|
32 |
+
$this->_updateButton('save', 'label', Mage::helper('lookbook')->__('Save slide'));
|
33 |
+
$this->_updateButton('delete', 'label', Mage::helper('lookbook')->__('Delete slide'));
|
34 |
+
|
35 |
+
$this->_addButton('saveandcontinue', array(
|
36 |
+
'label' => Mage::helper('adminhtml')->__('Save And Continue Edit'),
|
37 |
+
'onclick' => 'saveAndContinueEdit()',
|
38 |
+
'class' => 'save',
|
39 |
+
), -100);
|
40 |
+
|
41 |
+
$this->_formScripts[] = "
|
42 |
+
function saveAndContinueEdit(){
|
43 |
+
editForm.submit($('edit_form').action+'back/edit/');
|
44 |
+
}
|
45 |
+
";
|
46 |
+
}
|
47 |
+
|
48 |
+
public function getHeaderText()
|
49 |
+
{
|
50 |
+
if( Mage::registry('lookbook_data') && Mage::registry('lookbook_data')->getId() ) {
|
51 |
+
return Mage::helper('lookbook')->__("Edit slide '%s'", $this->htmlEscape(Mage::registry('lookbook_data')->getName()));
|
52 |
+
} else {
|
53 |
+
return Mage::helper('lookbook')->__('Add slide');
|
54 |
+
}
|
55 |
+
}
|
56 |
+
}
|
app/code/local/Altima/Lookbook/Block/Adminhtml/Lookbook/Edit/Form.php
ADDED
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Altima Lookbook Free Extension
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* @category Altima
|
16 |
+
* @package Altima_LookbookFree
|
17 |
+
* @author Altima Web Systems http://altimawebsystems.com/
|
18 |
+
* @email support@altima.net.au
|
19 |
+
* @copyright Copyright (c) 2012 Altima Web Systems (http://altimawebsystems.com/)
|
20 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
21 |
+
*/
|
22 |
+
class Altima_Lookbook_Block_Adminhtml_Lookbook_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
|
23 |
+
{
|
24 |
+
protected function _prepareForm()
|
25 |
+
{
|
26 |
+
$form = new Varien_Data_Form(array(
|
27 |
+
'id' => 'edit_form',
|
28 |
+
'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))),
|
29 |
+
'method' => 'post',
|
30 |
+
'enctype' => 'multipart/form-data'
|
31 |
+
)
|
32 |
+
);
|
33 |
+
|
34 |
+
$form->setUseContainer(true);
|
35 |
+
$this->setForm($form);
|
36 |
+
return parent::_prepareForm();
|
37 |
+
}
|
38 |
+
}
|
app/code/local/Altima/Lookbook/Block/Adminhtml/Lookbook/Edit/Form/Element/Hotspots.php
ADDED
@@ -0,0 +1,108 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Altima Lookbook Free Extension
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* @category Altima
|
16 |
+
* @package Altima_LookbookFree
|
17 |
+
* @author Altima Web Systems http://altimawebsystems.com/
|
18 |
+
* @email support@altima.net.au
|
19 |
+
* @copyright Copyright (c) 2012 Altima Web Systems (http://altimawebsystems.com/)
|
20 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
21 |
+
*/
|
22 |
+
class Altima_Lookbook_Block_Adminhtml_Lookbook_Edit_Form_Element_Hotspots extends Varien_Data_Form_Element_Abstract
|
23 |
+
{
|
24 |
+
public function __construct($data)
|
25 |
+
{
|
26 |
+
parent::__construct($data);
|
27 |
+
$this->setType('hidden');
|
28 |
+
}
|
29 |
+
|
30 |
+
public function getElementHtml()
|
31 |
+
{
|
32 |
+
$hotspot_icon = Mage::getBaseUrl('media').'lookbook/icons/default/hotspot-icon.png';
|
33 |
+
$products_link = Mage::helper("adminhtml")->getUrl('adminhtml/catalog_product/');
|
34 |
+
$helper = Mage::helper('lookbook');
|
35 |
+
|
36 |
+
$html = '
|
37 |
+
<style>
|
38 |
+
.image-annotate-area, .image-annotate-edit-area {
|
39 |
+
background: url('.$hotspot_icon.') no-repeat center center;
|
40 |
+
}
|
41 |
+
</style>
|
42 |
+
<script type="text/javascript">
|
43 |
+
//<![CDATA[
|
44 |
+
function InitHotspotBtn() {
|
45 |
+
if ($j("img#LookbookImage").attr("id")) {
|
46 |
+
var annotObj = $j("img#LookbookImage").annotateImage({
|
47 |
+
editable: true,
|
48 |
+
useAjax: false,';
|
49 |
+
if ($this->getValue()) $html .= 'notes: '. $this->getValue() . ',';
|
50 |
+
|
51 |
+
$html .= ' input_field_id: "hotspots"
|
52 |
+
});
|
53 |
+
|
54 |
+
$j("img#LookbookImage").before(\'<div class="products-link"><a href="'.$products_link.'" title="'.$helper->__('Products List').'" target="_blank">'. $helper->__('Products List').'</a></div>\');
|
55 |
+
|
56 |
+
var top = Math.round($j("img#LookbookImage").height()/2);
|
57 |
+
$j(".image-annotate-canvas").append(\'<div class="hotspots-msg" style="top:\' + top + \'px;">'. $helper->__('Rollover on the image to see hotspots').'</div>\');
|
58 |
+
|
59 |
+
$j(".image-annotate-canvas").hover(
|
60 |
+
function () {
|
61 |
+
ShowHideHotspotsMsg();
|
62 |
+
},
|
63 |
+
function () {
|
64 |
+
ShowHideHotspotsMsg();
|
65 |
+
}
|
66 |
+
);
|
67 |
+
|
68 |
+
return annotObj;
|
69 |
+
}
|
70 |
+
else
|
71 |
+
{
|
72 |
+
return false;
|
73 |
+
}
|
74 |
+
};
|
75 |
+
|
76 |
+
function checkSKU(){
|
77 |
+
result = "";
|
78 |
+
request = new Ajax.Request(
|
79 |
+
"'. Mage::getUrl("lookbook/adminhtml_lookbook/getproduct").'",
|
80 |
+
{
|
81 |
+
method: \'post\',
|
82 |
+
asynchronous: false,
|
83 |
+
onComplete: function(transport){
|
84 |
+
if (200 == transport.status) {
|
85 |
+
result = transport.responseText;
|
86 |
+
return result;
|
87 |
+
}
|
88 |
+
if (result.error) {
|
89 |
+
alert("Unable to check product SKU");
|
90 |
+
return false;
|
91 |
+
}
|
92 |
+
},
|
93 |
+
parameters: Form.serialize($("annotate-edit-form"))
|
94 |
+
}
|
95 |
+
);
|
96 |
+
return result;
|
97 |
+
};
|
98 |
+
//]]>
|
99 |
+
</script>';
|
100 |
+
|
101 |
+
$html.= parent::getElementHtml();
|
102 |
+
|
103 |
+
return $html;
|
104 |
+
}
|
105 |
+
}
|
106 |
+
|
107 |
+
|
108 |
+
|
app/code/local/Altima/Lookbook/Block/Adminhtml/Lookbook/Edit/Form/Element/Lookbookimage.php
ADDED
@@ -0,0 +1,121 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Altima Lookbook Free Extension
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* @category Altima
|
16 |
+
* @package Altima_LookbookFree
|
17 |
+
* @author Altima Web Systems http://altimawebsystems.com/
|
18 |
+
* @email support@altima.net.au
|
19 |
+
* @copyright Copyright (c) 2012 Altima Web Systems (http://altimawebsystems.com/)
|
20 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
21 |
+
*/
|
22 |
+
class Altima_Lookbook_Block_Adminhtml_Lookbook_Edit_Form_Element_Lookbookimage extends Varien_Data_Form_Element_Abstract
|
23 |
+
{
|
24 |
+
public function __construct($data)
|
25 |
+
{
|
26 |
+
parent::__construct($data);
|
27 |
+
$this->setType('hidden');
|
28 |
+
}
|
29 |
+
|
30 |
+
public function getElementHtml()
|
31 |
+
{
|
32 |
+
$block_class = Mage::getBlockSingleton('lookbook/adminhtml_lookbook');
|
33 |
+
$upload_action = Mage::getUrl('lookbook/adminhtml_lookbook/upload').'?isAjax=true';
|
34 |
+
$media_url = Mage::getBaseUrl('media');
|
35 |
+
$upload_folder_path = str_replace("/",DS, Mage::getBaseDir("media").DS);
|
36 |
+
$helper = Mage::helper('lookbook');
|
37 |
+
$min_image_width = $helper->getMinImageWidth();
|
38 |
+
$min_image_height = $helper->getMinImageHeight();
|
39 |
+
$sizeLimit = $helper->getMaxUploadFilesize();
|
40 |
+
$allowed_extensions = implode('","',explode(',',$helper->getAllowedExtensions()));
|
41 |
+
|
42 |
+
$html = '<script type="text/javascript">
|
43 |
+
//<![CDATA[
|
44 |
+
|
45 |
+
$j(document).ready(function() {
|
46 |
+
|
47 |
+
InitHotspotBtn();
|
48 |
+
|
49 |
+
img_uploader = new qq.FileUploader({
|
50 |
+
element: document.getElementById(\'maket_image\'),
|
51 |
+
action: "'.$upload_action.'",
|
52 |
+
params: {"form_key":"'.$block_class->getFormKey().'"},
|
53 |
+
multiple: false,
|
54 |
+
allowedExtensions: ["'.$allowed_extensions.'"],
|
55 |
+
sizeLimit: '. $sizeLimit .',
|
56 |
+
onComplete: function(id, fileName, responseJSON){
|
57 |
+
if (responseJSON.success)
|
58 |
+
{
|
59 |
+
if ($j(\'#LookbookImageBlock\'))
|
60 |
+
{
|
61 |
+
$j.each($j(\'#LookbookImageBlock\').children(),function(index) {
|
62 |
+
$j(this).remove();
|
63 |
+
});
|
64 |
+
}
|
65 |
+
$j(\'#LookbookImageBlock\').append(\'<img id="LookbookImage"';
|
66 |
+
$html .= ' src="'.$media_url.'lookbook/\'+responseJSON.filename+\'" alt="\'+responseJSON.filename+\'"';
|
67 |
+
$html .= ' width="\'+responseJSON.dimensions.width+\'" height="\'+responseJSON.dimensions.height+\'"/>\');
|
68 |
+
|
69 |
+
if ($j(\'#advice-required-entry-image\'))
|
70 |
+
{
|
71 |
+
$j(\'#advice-required-entry-image\').remove();
|
72 |
+
}
|
73 |
+
$j(\'#LookbookImage\').load(function(){
|
74 |
+
$j(this).attr(\'width\',responseJSON.dimensions.width);
|
75 |
+
$j(this).attr(\'height\',responseJSON.dimensions.height);
|
76 |
+
InitHotspotBtn();
|
77 |
+
});
|
78 |
+
$j(\'#image\').val(\'lookbook/\'+responseJSON.filename);
|
79 |
+
$j(\'#image\').removeClass(\'validation-failed\');
|
80 |
+
}
|
81 |
+
|
82 |
+
}
|
83 |
+
});
|
84 |
+
});
|
85 |
+
//]]>
|
86 |
+
</script>
|
87 |
+
<div id="LookbookImageBlock">';
|
88 |
+
|
89 |
+
if ($this->getValue()) {
|
90 |
+
$img_src = $media_url.$this->getValue();
|
91 |
+
$img_path = $upload_folder_path.$this->getValue();
|
92 |
+
if (file_exists($img_path)) {
|
93 |
+
|
94 |
+
$dimensions = Mage::helper('lookbook')->getImageDimensions($img_path);
|
95 |
+
|
96 |
+
$html .= '<img id="LookbookImage" src="'.$img_src.'" alt="'.basename($img_src).'" width="'.$dimensions['width'].'" height="'.$dimensions['height'].'"/>';
|
97 |
+
}
|
98 |
+
else
|
99 |
+
{
|
100 |
+
$html .= '<h4 id="LookbookImage" style="color:red;">File '.$img_src.' doesn\'t exists.</h4>';
|
101 |
+
}
|
102 |
+
}
|
103 |
+
|
104 |
+
$html .= '</div>
|
105 |
+
<div id="maket_image">
|
106 |
+
<noscript>
|
107 |
+
<p>Please enable JavaScript to use file uploader.</p>
|
108 |
+
<!-- or put a simple form for upload here -->
|
109 |
+
</noscript>
|
110 |
+
</div>';
|
111 |
+
|
112 |
+
$html.= parent::getElementHtml();
|
113 |
+
|
114 |
+
if ($min_image_width!=0 && $min_image_height!=0){
|
115 |
+
$html.= '<p class="note" style="clear:both; float:left;">Please make sure that the image your load is at least '
|
116 |
+
.$min_image_width.'x'.$min_image_height.' pixels</p>';
|
117 |
+
}
|
118 |
+
|
119 |
+
return $html;
|
120 |
+
}
|
121 |
+
}
|
app/code/local/Altima/Lookbook/Block/Adminhtml/Lookbook/Edit/Tab/Form.php
ADDED
@@ -0,0 +1,81 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Altima Lookbook Free Extension
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* @category Altima
|
16 |
+
* @package Altima_LookbookFree
|
17 |
+
* @author Altima Web Systems http://altimawebsystems.com/
|
18 |
+
* @email support@altima.net.au
|
19 |
+
* @copyright Copyright (c) 2012 Altima Web Systems (http://altimawebsystems.com/)
|
20 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
21 |
+
*/
|
22 |
+
class Altima_Lookbook_Block_Adminhtml_Lookbook_Edit_Tab_Form extends Mage_Adminhtml_Block_Widget_Form
|
23 |
+
{
|
24 |
+
protected function _prepareForm()
|
25 |
+
{
|
26 |
+
$form = new Varien_Data_Form();
|
27 |
+
|
28 |
+
$this->setForm($form);
|
29 |
+
|
30 |
+
$fieldset = $form->addFieldset('lookbook_form', array('legend'=>Mage::helper('lookbook')->__('Lookbook slide information')));
|
31 |
+
|
32 |
+
$fieldset->addField('name', 'text', array(
|
33 |
+
'label' => Mage::helper('lookbook')->__('Name'),
|
34 |
+
'required' => true,
|
35 |
+
'name' => 'name',
|
36 |
+
));
|
37 |
+
|
38 |
+
$fieldset->addField('position', 'text', array(
|
39 |
+
'label' => Mage::helper('lookbook')->__('Order'),
|
40 |
+
'required' => false,
|
41 |
+
'name' => 'position',
|
42 |
+
));
|
43 |
+
|
44 |
+
$fieldset->addField('status', 'select', array(
|
45 |
+
'label' => Mage::helper('lookbook')->__('Status'),
|
46 |
+
'name' => 'status',
|
47 |
+
'values' => array(
|
48 |
+
array(
|
49 |
+
'value' => 1,
|
50 |
+
'label' => Mage::helper('lookbook')->__('Enabled'),
|
51 |
+
),
|
52 |
+
|
53 |
+
array(
|
54 |
+
'value' => 2,
|
55 |
+
'label' => Mage::helper('lookbook')->__('Disabled'),
|
56 |
+
),
|
57 |
+
),
|
58 |
+
));
|
59 |
+
|
60 |
+
$fieldset->addType('lookbookimage','Altima_Lookbook_Block_Adminhtml_Lookbook_Edit_Form_Element_Lookbookimage');
|
61 |
+
$fieldset->addField('image', 'lookbookimage', array(
|
62 |
+
'label' => Mage::helper('lookbook')->__('Image'),
|
63 |
+
'name' => 'image',
|
64 |
+
'required' => true,
|
65 |
+
));
|
66 |
+
|
67 |
+
$fieldset->addType('hotspots','Altima_Lookbook_Block_Adminhtml_Lookbook_Edit_Form_Element_Hotspots');
|
68 |
+
$fieldset->addField('hotspots', 'hotspots', array(
|
69 |
+
'name' => 'hotspots',
|
70 |
+
));
|
71 |
+
|
72 |
+
if ( Mage::getSingleton('adminhtml/session')->getLookbookData() )
|
73 |
+
{
|
74 |
+
$form->setValues(Mage::getSingleton('adminhtml/session')->getLookbookData());
|
75 |
+
Mage::getSingleton('adminhtml/session')->setLookbookData(null);
|
76 |
+
} elseif ( Mage::registry('lookbook_data') ) {
|
77 |
+
$form->setValues(Mage::registry('lookbook_data')->getData());
|
78 |
+
}
|
79 |
+
return parent::_prepareForm();
|
80 |
+
}
|
81 |
+
}
|
app/code/local/Altima/Lookbook/Block/Adminhtml/Lookbook/Edit/Tabs.php
ADDED
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Altima Lookbook Free Extension
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* @category Altima
|
16 |
+
* @package Altima_LookbookFree
|
17 |
+
* @author Altima Web Systems http://altimawebsystems.com/
|
18 |
+
* @email support@altima.net.au
|
19 |
+
* @copyright Copyright (c) 2012 Altima Web Systems (http://altimawebsystems.com/)
|
20 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
21 |
+
*/
|
22 |
+
class Altima_Lookbook_Block_Adminhtml_Lookbook_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs
|
23 |
+
{
|
24 |
+
|
25 |
+
public function __construct()
|
26 |
+
{
|
27 |
+
parent::__construct();
|
28 |
+
$this->setId('lookbook_tabs');
|
29 |
+
$this->setDestElementId('edit_form');
|
30 |
+
$this->setTitle(Mage::helper('lookbook')->__('Lookbook slide information'));
|
31 |
+
}
|
32 |
+
|
33 |
+
protected function _beforeToHtml()
|
34 |
+
{
|
35 |
+
$this->addTab('form_section', array(
|
36 |
+
'label' => Mage::helper('lookbook')->__('Lookbook slide information'),
|
37 |
+
'title' => Mage::helper('lookbook')->__('Lookbook slide information'),
|
38 |
+
'content' => $this->getLayout()->createBlock('lookbook/adminhtml_lookbook_edit_tab_form')->toHtml(),
|
39 |
+
));
|
40 |
+
|
41 |
+
return parent::_beforeToHtml();
|
42 |
+
}
|
43 |
+
}
|
app/code/local/Altima/Lookbook/Block/Adminhtml/Lookbook/Grid.php
ADDED
@@ -0,0 +1,144 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Altima Lookbook Free Extension
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* @category Altima
|
16 |
+
* @package Altima_LookbookFree
|
17 |
+
* @author Altima Web Systems http://altimawebsystems.com/
|
18 |
+
* @email support@altima.net.au
|
19 |
+
* @copyright Copyright (c) 2012 Altima Web Systems (http://altimawebsystems.com/)
|
20 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
21 |
+
*/
|
22 |
+
class Altima_Lookbook_Block_Adminhtml_Lookbook_Grid extends Mage_Adminhtml_Block_Widget_Grid
|
23 |
+
{
|
24 |
+
public function __construct()
|
25 |
+
{
|
26 |
+
parent::__construct();
|
27 |
+
$this->setId('lookbookGrid');
|
28 |
+
$this->setDefaultSort('lookbook_id');
|
29 |
+
$this->setDefaultDir('ASC');
|
30 |
+
$this->setSaveParametersInSession(true);
|
31 |
+
}
|
32 |
+
|
33 |
+
protected function _prepareCollection()
|
34 |
+
{
|
35 |
+
$collection = Mage::getModel('lookbook/lookbook')->getCollection();
|
36 |
+
$this->setCollection($collection);
|
37 |
+
return parent::_prepareCollection();
|
38 |
+
}
|
39 |
+
|
40 |
+
protected function _prepareColumns()
|
41 |
+
{
|
42 |
+
$this->addColumn('lookbook_id', array(
|
43 |
+
'header' => Mage::helper('lookbook')->__('ID'),
|
44 |
+
'align' =>'right',
|
45 |
+
'width' => '50px',
|
46 |
+
'index' => 'lookbook_id',
|
47 |
+
));
|
48 |
+
|
49 |
+
$this->addColumn( 'image', array(
|
50 |
+
'header' => Mage::helper( 'lookbook' )->__( 'Image' ),
|
51 |
+
'type' => 'image',
|
52 |
+
'width' => '75px',
|
53 |
+
'index' => 'image',
|
54 |
+
'filter' => false,
|
55 |
+
'sortable' => false,
|
56 |
+
'renderer' => 'lookbook/adminhtml_template_grid_renderer_image',
|
57 |
+
));
|
58 |
+
|
59 |
+
$this->addColumn('name', array(
|
60 |
+
'header' => Mage::helper('lookbook')->__('Name'),
|
61 |
+
'align' =>'left',
|
62 |
+
'index' => 'name',
|
63 |
+
));
|
64 |
+
|
65 |
+
$this->addColumn('position', array(
|
66 |
+
'header' => Mage::helper('lookbook')->__('Order'),
|
67 |
+
'align' =>'left',
|
68 |
+
'width' => '50px',
|
69 |
+
'index' => 'position',
|
70 |
+
));
|
71 |
+
|
72 |
+
$this->addColumn('status', array(
|
73 |
+
'header' => Mage::helper('lookbook')->__('Status'),
|
74 |
+
'align' => 'left',
|
75 |
+
'width' => '80px',
|
76 |
+
'index' => 'status',
|
77 |
+
'type' => 'options',
|
78 |
+
'options' => array(
|
79 |
+
1 => 'Enabled',
|
80 |
+
2 => 'Disabled',
|
81 |
+
),
|
82 |
+
));
|
83 |
+
|
84 |
+
$this->addColumn('action',
|
85 |
+
array(
|
86 |
+
'header' => Mage::helper('lookbook')->__('Action'),
|
87 |
+
'width' => '100',
|
88 |
+
'type' => 'action',
|
89 |
+
'getter' => 'getId',
|
90 |
+
'actions' => array(
|
91 |
+
array(
|
92 |
+
'caption' => Mage::helper('lookbook')->__('Edit'),
|
93 |
+
'url' => array('base'=> '*/*/edit'),
|
94 |
+
'field' => 'id'
|
95 |
+
)
|
96 |
+
),
|
97 |
+
'filter' => false,
|
98 |
+
'sortable' => false,
|
99 |
+
'index' => 'stores',
|
100 |
+
'is_system' => true,
|
101 |
+
));
|
102 |
+
|
103 |
+
$this->addExportType('*/*/exportCsv', Mage::helper('lookbook')->__('CSV'));
|
104 |
+
$this->addExportType('*/*/exportXml', Mage::helper('lookbook')->__('XML'));
|
105 |
+
|
106 |
+
return parent::_prepareColumns();
|
107 |
+
}
|
108 |
+
|
109 |
+
protected function _prepareMassaction()
|
110 |
+
{
|
111 |
+
$this->setMassactionIdField('lookbook_id');
|
112 |
+
$this->getMassactionBlock()->setFormFieldName('lookbook');
|
113 |
+
|
114 |
+
$this->getMassactionBlock()->addItem('delete', array(
|
115 |
+
'label' => Mage::helper('lookbook')->__('Delete'),
|
116 |
+
'url' => $this->getUrl('*/*/massDelete'),
|
117 |
+
'confirm' => Mage::helper('lookbook')->__('Are you sure?')
|
118 |
+
));
|
119 |
+
|
120 |
+
$statuses = Mage::getSingleton('lookbook/status')->getOptionArray();
|
121 |
+
|
122 |
+
array_unshift($statuses, array('label'=>'', 'value'=>''));
|
123 |
+
$this->getMassactionBlock()->addItem('status', array(
|
124 |
+
'label'=> Mage::helper('lookbook')->__('Change status'),
|
125 |
+
'url' => $this->getUrl('*/*/massStatus', array('_current'=>true)),
|
126 |
+
'additional' => array(
|
127 |
+
'visibility' => array(
|
128 |
+
'name' => 'status',
|
129 |
+
'type' => 'select',
|
130 |
+
'class' => 'required-entry',
|
131 |
+
'label' => Mage::helper('lookbook')->__('Status'),
|
132 |
+
'values' => $statuses
|
133 |
+
)
|
134 |
+
)
|
135 |
+
));
|
136 |
+
return $this;
|
137 |
+
}
|
138 |
+
|
139 |
+
public function getRowUrl($row)
|
140 |
+
{
|
141 |
+
return $this->getUrl('*/*/edit', array('id' => $row->getId()));
|
142 |
+
}
|
143 |
+
|
144 |
+
}
|
app/code/local/Altima/Lookbook/Block/Adminhtml/Template/Grid/Renderer/Image.php
ADDED
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Altima Lookbook Free Extension
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* @category Altima
|
16 |
+
* @package Altima_LookbookFree
|
17 |
+
* @author Altima Web Systems http://altimawebsystems.com/
|
18 |
+
* @email support@altima.net.au
|
19 |
+
* @copyright Copyright (c) 2012 Altima Web Systems (http://altimawebsystems.com/)
|
20 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
21 |
+
*/
|
22 |
+
class Altima_Lookbook_Block_Adminhtml_Template_Grid_Renderer_Image extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Action
|
23 |
+
{
|
24 |
+
public function render(Varien_Object $row)
|
25 |
+
{
|
26 |
+
return $this->_getValue($row);
|
27 |
+
}
|
28 |
+
|
29 |
+
public function _getValue(Varien_Object $row)
|
30 |
+
{
|
31 |
+
if ($getter = $this->getColumn()->getGetter()) {
|
32 |
+
$val = $row->$getter();
|
33 |
+
}
|
34 |
+
$width = str_replace('px','',$this->getColumn()->getWidth());
|
35 |
+
$val = $row->getData($this->getColumn()->getIndex());
|
36 |
+
$url = Mage::helper('lookbook')->getResizedUrl($val,$width);
|
37 |
+
$out = '<center>';
|
38 |
+
$out .= "<img src=" . $url . " />";
|
39 |
+
$out .= '</center>';
|
40 |
+
|
41 |
+
return $out;
|
42 |
+
|
43 |
+
}
|
44 |
+
}
|
app/code/local/Altima/Lookbook/Block/Lookbook.php
ADDED
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Altima Lookbook Free Extension
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* @category Altima
|
16 |
+
* @package Altima_LookbookFree
|
17 |
+
* @author Altima Web Systems http://altimawebsystems.com/
|
18 |
+
* @email support@altima.net.au
|
19 |
+
* @copyright Copyright (c) 2012 Altima Web Systems (http://altimawebsystems.com/)
|
20 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
21 |
+
*/
|
22 |
+
class Altima_Lookbook_Block_Lookbook extends Mage_Core_Block_Template
|
23 |
+
{
|
24 |
+
protected function _construct()
|
25 |
+
{
|
26 |
+
$this->addData(array(
|
27 |
+
'cache_lifetime' => false,
|
28 |
+
'cache_tags' => array(Altima_Lookbook_Model_Lookbook::CACHE_TAG),
|
29 |
+
'cache_key' => 'slider',
|
30 |
+
));
|
31 |
+
}
|
32 |
+
|
33 |
+
public function _prepareLayout()
|
34 |
+
{
|
35 |
+
return parent::_prepareLayout();
|
36 |
+
}
|
37 |
+
|
38 |
+
public function getCollection()
|
39 |
+
{
|
40 |
+
$collection = Mage::getModel('lookbook/lookbook')
|
41 |
+
->getCollection()
|
42 |
+
->addFieldToFilter('status', 1)
|
43 |
+
->setOrder('position', 'ASC');
|
44 |
+
return $collection;
|
45 |
+
}
|
46 |
+
|
47 |
+
}
|
app/code/local/Altima/Lookbook/Helper/Data.php
ADDED
@@ -0,0 +1,222 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Altima Lookbook Free Extension
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* @category Altima
|
16 |
+
* @package Altima_LookbookFree
|
17 |
+
* @author Altima Web Systems http://altimawebsystems.com/
|
18 |
+
* @email support@altima.net.au
|
19 |
+
* @copyright Copyright (c) 2012 Altima Web Systems (http://altimawebsystems.com/)
|
20 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
21 |
+
*/
|
22 |
+
class Altima_Lookbook_Helper_Data extends Mage_Core_Helper_Abstract
|
23 |
+
{
|
24 |
+
public function getEnabled()
|
25 |
+
{
|
26 |
+
return Mage::getStoreConfig('lookbook/general/enabled');
|
27 |
+
}
|
28 |
+
|
29 |
+
public function getMaxImageWidth()
|
30 |
+
{
|
31 |
+
return intval(Mage::getStoreConfig('lookbook/general/max_image_width'));
|
32 |
+
}
|
33 |
+
|
34 |
+
public function getMaxImageHeight()
|
35 |
+
{
|
36 |
+
return intval(Mage::getStoreConfig('lookbook/general/max_image_height'));
|
37 |
+
}
|
38 |
+
|
39 |
+
public function getMinImageWidth()
|
40 |
+
{
|
41 |
+
return intval(Mage::getStoreConfig('lookbook/general/min_image_width'));
|
42 |
+
}
|
43 |
+
|
44 |
+
public function getMinImageHeight()
|
45 |
+
{
|
46 |
+
return intval(Mage::getStoreConfig('lookbook/general/min_image_height'));
|
47 |
+
}
|
48 |
+
|
49 |
+
public function getMaxUploadFilesize()
|
50 |
+
{
|
51 |
+
return intval(Mage::getStoreConfig('lookbook/general/max_upload_filesize'));
|
52 |
+
}
|
53 |
+
|
54 |
+
public function getAllowedExtensions()
|
55 |
+
{
|
56 |
+
return Mage::getStoreConfig('lookbook/general/allowed_extensions');
|
57 |
+
}
|
58 |
+
/**
|
59 |
+
* Returns the resized Image URL
|
60 |
+
*
|
61 |
+
* @param string $imgUrl - This is relative to the the media folder (custom/module/images/example.jpg)
|
62 |
+
* @param int $x Width
|
63 |
+
* @param int $y Height
|
64 |
+
*Remember your base image or big image must be in Root/media/lookbook/example.jpg
|
65 |
+
*
|
66 |
+
* echo Mage::helper('lookbook')->getResizedUrl("lookbook/example.jpg",101,65)
|
67 |
+
*
|
68 |
+
*By doing this new image will be created in Root/media/lookbook/101X65/example.jpg
|
69 |
+
*/
|
70 |
+
|
71 |
+
public function getResizedUrl($imgUrl,$x,$y=NULL){
|
72 |
+
|
73 |
+
$imgPath=$this->splitImageValue($imgUrl,"path");
|
74 |
+
$imgName=$this->splitImageValue($imgUrl,"name");
|
75 |
+
|
76 |
+
/**
|
77 |
+
* Path with Directory Seperator
|
78 |
+
*/
|
79 |
+
$imgPath=str_replace("/",DS,$imgPath);
|
80 |
+
|
81 |
+
/**
|
82 |
+
* Absolute full path of Image
|
83 |
+
*/
|
84 |
+
$imgPathFull=Mage::getBaseDir("media").DS.$imgPath.DS.$imgName;
|
85 |
+
|
86 |
+
/**
|
87 |
+
* If Y is not set set it to as X
|
88 |
+
*/
|
89 |
+
$width=$x;
|
90 |
+
$y?$height=$y:$height=$x;
|
91 |
+
|
92 |
+
/**
|
93 |
+
* Resize folder is widthXheight
|
94 |
+
*/
|
95 |
+
$resizeFolder=$width."X".$height;
|
96 |
+
|
97 |
+
/**
|
98 |
+
* Image resized path will then be
|
99 |
+
*/
|
100 |
+
$imageResizedPath=Mage::getBaseDir("media").DS.$imgPath.DS.$resizeFolder.DS.$imgName;
|
101 |
+
|
102 |
+
/**
|
103 |
+
* First check in cache i.e image resized path
|
104 |
+
* If not in cache then create image of the width=X and height = Y
|
105 |
+
*/
|
106 |
+
if (!file_exists($imageResizedPath) && file_exists($imgPathFull)) :
|
107 |
+
$imageObj = new Varien_Image($imgPathFull);
|
108 |
+
$imageObj->constrainOnly(TRUE);
|
109 |
+
$imageObj->keepAspectRatio(TRUE);
|
110 |
+
$imageObj->keepTransparency(TRUE);
|
111 |
+
$imageObj->resize($width,$height);
|
112 |
+
$imageObj->save($imageResizedPath);
|
113 |
+
endif;
|
114 |
+
|
115 |
+
/**
|
116 |
+
* Else image is in cache replace the Image Path with / for http path.
|
117 |
+
*/
|
118 |
+
$imgUrl=str_replace(DS,"/",$imgPath);
|
119 |
+
|
120 |
+
/**
|
121 |
+
* Return full http path of the image
|
122 |
+
*/
|
123 |
+
return Mage::getBaseUrl("media").$imgUrl."/".$resizeFolder."/".$imgName;
|
124 |
+
}
|
125 |
+
|
126 |
+
/**
|
127 |
+
* Splits images Path and Name
|
128 |
+
*
|
129 |
+
* Path=lookbook/
|
130 |
+
* Name=example.jpg
|
131 |
+
*
|
132 |
+
* @param string $imageValue
|
133 |
+
* @param string $attr
|
134 |
+
* @return string
|
135 |
+
*/
|
136 |
+
public function splitImageValue($imageValue,$attr="name"){
|
137 |
+
$imArray=explode("/",$imageValue);
|
138 |
+
|
139 |
+
$name=$imArray[count($imArray)-1];
|
140 |
+
$path=implode("/",array_diff($imArray,array($name)));
|
141 |
+
if($attr=="path"){
|
142 |
+
return $path;
|
143 |
+
}
|
144 |
+
else
|
145 |
+
return $name;
|
146 |
+
|
147 |
+
}
|
148 |
+
|
149 |
+
/**
|
150 |
+
* Splits images Path and Name
|
151 |
+
*
|
152 |
+
* img_path=lookbook/example.jpg
|
153 |
+
*
|
154 |
+
* @param string $img_path
|
155 |
+
* @return array('width'=>$width, 'height'=>$height)
|
156 |
+
*/
|
157 |
+
public function getImageDimensions($img_path){
|
158 |
+
$imageObj = new Varien_Image($img_path);
|
159 |
+
$width = $imageObj->getOriginalWidth();
|
160 |
+
$height = $imageObj->getOriginalHeight();
|
161 |
+
$result = array('width'=>$width, 'height'=>$height);
|
162 |
+
return $result;
|
163 |
+
}
|
164 |
+
|
165 |
+
/**
|
166 |
+
* Change SKU to product information into Json array
|
167 |
+
*
|
168 |
+
* img_path=lookbook/example.jpg
|
169 |
+
*
|
170 |
+
* @param json array $array
|
171 |
+
* @return json array('width'=>$width, 'height'=>$height)
|
172 |
+
*/
|
173 |
+
public function getHotspotsWithProductDetails($hotspots_json){
|
174 |
+
if ($hotspots_json=='') return '';
|
175 |
+
$decoded_array = json_decode($hotspots_json,true);
|
176 |
+
$img_width = intval(Mage::getStoreConfig('lookbook/general/max_image_width'));
|
177 |
+
$hotspot_icon = Mage::getBaseUrl('media').'lookbook/icons/default/hotspot-icon.png';
|
178 |
+
$hotspot_icon_path = Mage::getBaseDir('media').DS.'lookbook'.DS.'icons'.DS.'default'.DS.'hotspot-icon.png';
|
179 |
+
$icon_dimensions = $this->getImageDimensions($hotspot_icon_path);
|
180 |
+
$_coreHelper = Mage::helper('core');
|
181 |
+
foreach($decoded_array as $key => $value){
|
182 |
+
$product_details = Mage::getModel('catalog/product')->loadByAttribute('sku',$decoded_array[$key]['text']);
|
183 |
+
|
184 |
+
$html_content = '<img class="hotspot-icon" src="'.$hotspot_icon.'" alt="" style="
|
185 |
+
left:'. (round($value['width']/2)-round($icon_dimensions['width']/2)) .'px;
|
186 |
+
top:'. (round($value['height']/2)-round($icon_dimensions['height']/2)) .'px;
|
187 |
+
"/><div class="product-info" style="';
|
188 |
+
$html_content .= 'left:'.round($value['width']/2).'px;';
|
189 |
+
$html_content .= 'top:'.round($value['height']/2).'px;';
|
190 |
+
|
191 |
+
if ($product_details) {
|
192 |
+
$_p_name = $product_details->getName();
|
193 |
+
$html_content .= 'width: '. strlen($_p_name)*8 .'px;';
|
194 |
+
}
|
195 |
+
else
|
196 |
+
{
|
197 |
+
$html_content .= 'width: 200px;';
|
198 |
+
}
|
199 |
+
|
200 |
+
$html_content .= '">';
|
201 |
+
if ($product_details) {
|
202 |
+
$_p_price = $_coreHelper->currency($product_details->getPrice(),true,false);
|
203 |
+
$_p_url = $product_details->getProductUrl();
|
204 |
+
$html_content .= '<div><a href=\''.$_p_url.'\'>'.$_p_name.'</a></div>';
|
205 |
+
if($product_details->getPrice()){
|
206 |
+
$html_content .= '<div class="price">'.$_p_price.'</div>';
|
207 |
+
}
|
208 |
+
}
|
209 |
+
else
|
210 |
+
{
|
211 |
+
$html_content .= '<div>Product with SKU "'.$decoded_array[$key]['text'].'" doesn\'t exists.</div>';
|
212 |
+
}
|
213 |
+
$html_content .= '
|
214 |
+
</div>
|
215 |
+
';
|
216 |
+
|
217 |
+
$decoded_array[$key]['text'] = $html_content;
|
218 |
+
}
|
219 |
+
$result = $decoded_array;
|
220 |
+
return $result;
|
221 |
+
}
|
222 |
+
}
|
app/code/local/Altima/Lookbook/Model/Fileuploader.php
ADDED
@@ -0,0 +1,152 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Altima Lookbook Free Extension
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* @category Altima
|
16 |
+
* @package Altima_LookbookFree
|
17 |
+
* @author Altima Web Systems http://altimawebsystems.com/
|
18 |
+
* @email support@altima.net.au
|
19 |
+
* @copyright Copyright (c) 2012 Altima Web Systems (http://altimawebsystems.com/)
|
20 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
21 |
+
*/
|
22 |
+
class Altima_Lookbook_Model_Fileuploader {
|
23 |
+
|
24 |
+
private $allowedExtensions = array();
|
25 |
+
private $sizeLimit = 10485760;
|
26 |
+
private $min_image_width = 0;
|
27 |
+
private $min_image_height = 0;
|
28 |
+
private $max_image_width = 0;
|
29 |
+
private $max_image_height = 0;
|
30 |
+
private $filemodel;
|
31 |
+
|
32 |
+
function __construct(){
|
33 |
+
|
34 |
+
$helper = Mage::helper('lookbook');
|
35 |
+
$sizeLimit = $helper->getMaxUploadFilesize();
|
36 |
+
$this->min_image_width = $helper->getMinImageWidth();
|
37 |
+
$this->min_image_height = $helper->getMinImageHeight();
|
38 |
+
$this->max_image_width = $helper->getMaxImageWidth();
|
39 |
+
$this->max_image_height = $helper->getMaxImageHeight();
|
40 |
+
$allowed_extensions = explode(',',$helper->getAllowedExtensions());
|
41 |
+
|
42 |
+
$this->allowedExtensions = array_map("strtolower", $allowed_extensions);
|
43 |
+
if ($sizeLimit>0) $this->sizeLimit = $sizeLimit;
|
44 |
+
|
45 |
+
if (isset($_GET['qqfile'])) {
|
46 |
+
$this->filemodel = Mage::getModel('lookbook/uploadedfilexhr');
|
47 |
+
} elseif (isset($_FILES['qqfile'])) {
|
48 |
+
$this->filemodel = Mage::getModel('lookbook/uploadedfileform');
|
49 |
+
} else {
|
50 |
+
$this->filemodel = false;
|
51 |
+
}
|
52 |
+
|
53 |
+
}
|
54 |
+
|
55 |
+
public function checkServerSettings(){
|
56 |
+
$postSize = $this->toBytes(ini_get('post_max_size'));
|
57 |
+
$uploadSize = $this->toBytes(ini_get('upload_max_filesize'));
|
58 |
+
|
59 |
+
if ($postSize < $this->sizeLimit || $uploadSize < $this->sizeLimit){
|
60 |
+
$size = max(1, $this->sizeLimit / 1024 / 1024) . 'M';
|
61 |
+
return array('error' => 'increase post_max_size and upload_max_filesize to $size');
|
62 |
+
}
|
63 |
+
|
64 |
+
if ($this->max_image_width < $this->min_image_width || $this->max_image_height < $this->min_image_height){
|
65 |
+
return array('error' => 'File was not uploaded. Minimal image width (height) can\'t be greater then maximal. Please, check settings.');
|
66 |
+
}
|
67 |
+
return true;
|
68 |
+
|
69 |
+
}
|
70 |
+
|
71 |
+
private function toBytes($str){
|
72 |
+
$val = trim($str);
|
73 |
+
$last = strtolower($str[strlen($str)-1]);
|
74 |
+
switch($last) {
|
75 |
+
case 'g': $val *= 1024;
|
76 |
+
case 'm': $val *= 1024;
|
77 |
+
case 'k': $val *= 1024;
|
78 |
+
}
|
79 |
+
return $val;
|
80 |
+
}
|
81 |
+
|
82 |
+
/**
|
83 |
+
* Returns array('success'=>true) or array('error'=>'error message')
|
84 |
+
*/
|
85 |
+
function handleUpload($uploadDirectory, $replaceOldFile = FALSE){
|
86 |
+
if (!is_writable($uploadDirectory)){
|
87 |
+
return array('error' => "Server error. Upload directory isn't writable.");
|
88 |
+
}
|
89 |
+
|
90 |
+
if (!$this->filemodel){
|
91 |
+
return array('error' => 'No files were uploaded.');
|
92 |
+
}
|
93 |
+
|
94 |
+
$size = $this->filemodel->getSize();
|
95 |
+
|
96 |
+
if ($size == 0) {
|
97 |
+
return array('error' => 'File is empty');
|
98 |
+
}
|
99 |
+
|
100 |
+
if ($size > $this->sizeLimit) {
|
101 |
+
return array('error' => 'File is too large');
|
102 |
+
}
|
103 |
+
|
104 |
+
$pathinfo = pathinfo($this->filemodel->getName());
|
105 |
+
$filename = $pathinfo['filename'];
|
106 |
+
//$filename = md5(uniqid());
|
107 |
+
$filename = uniqid();
|
108 |
+
$ext = $pathinfo['extension'];
|
109 |
+
|
110 |
+
if($this->allowedExtensions && !in_array(strtolower($ext), $this->allowedExtensions)){
|
111 |
+
$these = implode(', ', $this->allowedExtensions);
|
112 |
+
return array('error' => 'File has an invalid extension, it should be one of '. $these . '.');
|
113 |
+
}
|
114 |
+
|
115 |
+
if(!$replaceOldFile){
|
116 |
+
/// don't overwrite previous files that were uploaded
|
117 |
+
while (file_exists($uploadDirectory . $filename . '.' . $ext)) {
|
118 |
+
$filename .= rand(10, 99);
|
119 |
+
}
|
120 |
+
}
|
121 |
+
|
122 |
+
if ($this->filemodel->save($uploadDirectory . $filename . '.' . $ext)){
|
123 |
+
$imgPathFull = $uploadDirectory . $filename . '.' . $ext;
|
124 |
+
$dimensions = Mage::helper('lookbook')->getImageDimensions($imgPathFull);
|
125 |
+
if ($this->min_image_width!=0 && $this->min_image_height!=0) {
|
126 |
+
if ($dimensions['width'] < $this->min_image_width || $dimensions['height'] < $this->min_image_height)
|
127 |
+
{
|
128 |
+
unlink($imgPathFull);
|
129 |
+
return array('error'=> 'Uploaded file dimensions are less than those specified in the configuration.');
|
130 |
+
}
|
131 |
+
}
|
132 |
+
|
133 |
+
if ($this->max_image_width!=0 && $this->max_image_height!=0) {
|
134 |
+
if ($dimensions['width'] > $this->max_image_width || $dimensions['height'] > $this->max_image_heigh)
|
135 |
+
{
|
136 |
+
$resized_image = new Varien_Image($imgPathFull);
|
137 |
+
$resized_image->constrainOnly(TRUE);
|
138 |
+
$resized_image->keepAspectRatio(TRUE);
|
139 |
+
$resized_image->keepTransparency(TRUE);
|
140 |
+
$resized_image->resize($this->max_image_width,$this->max_image_height);
|
141 |
+
$resized_image->save($imgPathFull);
|
142 |
+
$dimensions = Mage::helper('lookbook')->getImageDimensions($imgPathFull);
|
143 |
+
}
|
144 |
+
}
|
145 |
+
return array('success'=>true, 'filename'=>$filename . '.' . $ext, 'dimensions' => $dimensions);
|
146 |
+
} else {
|
147 |
+
return array('error'=> 'Could not save uploaded file.' .
|
148 |
+
'The upload was cancelled, or server error encountered');
|
149 |
+
}
|
150 |
+
|
151 |
+
}
|
152 |
+
}
|
app/code/local/Altima/Lookbook/Model/Layout/Generate/Observer.php
ADDED
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Altima Lookbook Free Extension
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* @category Altima
|
16 |
+
* @package Altima_LookbookFree
|
17 |
+
* @author Altima Web Systems http://altimawebsystems.com/
|
18 |
+
* @email support@altima.net.au
|
19 |
+
* @copyright Copyright (c) 2012 Altima Web Systems (http://altimawebsystems.com/)
|
20 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
21 |
+
*/
|
22 |
+
class Altima_Lookbook_Model_Layout_Generate_Observer {
|
23 |
+
|
24 |
+
public function addHeadItems($observer) {
|
25 |
+
if (Mage::helper('lookbook')->getEnabled()) {
|
26 |
+
$data = $observer->getData();
|
27 |
+
$page = $data['page'];
|
28 |
+
if ($page) {
|
29 |
+
$pagecontent = $page->getContent();
|
30 |
+
$search_string = '{{block type="lookbook/lookbook" template="lookbook/lookbook.phtml"}}';
|
31 |
+
if (preg_match($search_string, $pagecontent)) {
|
32 |
+
$updates = $page->getLayoutUpdateXml();
|
33 |
+
$newupdates = '<reference name="head">
|
34 |
+
<action method="addCss"><stylesheet>lookbook/css/hotspots.css</stylesheet></action>
|
35 |
+
<action method="addJs"><script>jquery/jquery-1.7.min.js</script></action>
|
36 |
+
<action method="addJs"><script>jquery/jquery.noconflict.js</script></action>
|
37 |
+
<action method="addJs"><script>lookbook/slides.min.jquery.js</script></action>
|
38 |
+
</reference>';
|
39 |
+
$page->setLayoutUpdateXml($updates.$newupdates);
|
40 |
+
}
|
41 |
+
|
42 |
+
}
|
43 |
+
}
|
44 |
+
}
|
45 |
+
|
46 |
+
}
|
app/code/local/Altima/Lookbook/Model/Lookbook.php
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Altima Lookbook Free Extension
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* @category Altima
|
16 |
+
* @package Altima_LookbookFree
|
17 |
+
* @author Altima Web Systems http://altimawebsystems.com/
|
18 |
+
* @email support@altima.net.au
|
19 |
+
* @copyright Copyright (c) 2012 Altima Web Systems (http://altimawebsystems.com/)
|
20 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
21 |
+
*/
|
22 |
+
class Altima_Lookbook_Model_Lookbook extends Mage_Core_Model_Abstract
|
23 |
+
{
|
24 |
+
const CACHE_TAG = 'lookbook_free';
|
25 |
+
protected $_cacheTag = 'lookbook_free';
|
26 |
+
|
27 |
+
public function _construct()
|
28 |
+
{
|
29 |
+
parent::_construct();
|
30 |
+
$this->_init('lookbook/lookbook');
|
31 |
+
}
|
32 |
+
|
33 |
+
}
|
app/code/local/Altima/Lookbook/Model/Mysql4/Lookbook.php
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Altima Lookbook Free Extension
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* @category Altima
|
16 |
+
* @package Altima_LookbookFree
|
17 |
+
* @author Altima Web Systems http://altimawebsystems.com/
|
18 |
+
* @email support@altima.net.au
|
19 |
+
* @copyright Copyright (c) 2012 Altima Web Systems (http://altimawebsystems.com/)
|
20 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
21 |
+
*/
|
22 |
+
class Altima_Lookbook_Model_Mysql4_Lookbook extends Mage_Core_Model_Mysql4_Abstract
|
23 |
+
{
|
24 |
+
public function _construct()
|
25 |
+
{
|
26 |
+
// Note that the lookbook_id refers to the key field in your database table.
|
27 |
+
$this->_init('lookbook/lookbook', 'lookbook_id');
|
28 |
+
}
|
29 |
+
}
|
app/code/local/Altima/Lookbook/Model/Mysql4/Lookbook/Collection.php
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Altima Lookbook Free Extension
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* @category Altima
|
16 |
+
* @package Altima_LookbookFree
|
17 |
+
* @author Altima Web Systems http://altimawebsystems.com/
|
18 |
+
* @email support@altima.net.au
|
19 |
+
* @copyright Copyright (c) 2012 Altima Web Systems (http://altimawebsystems.com/)
|
20 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
21 |
+
*/
|
22 |
+
class Altima_Lookbook_Model_Mysql4_Lookbook_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
|
23 |
+
{
|
24 |
+
public function _construct()
|
25 |
+
{
|
26 |
+
parent::_construct();
|
27 |
+
$this->_init('lookbook/lookbook');
|
28 |
+
}
|
29 |
+
}
|
app/code/local/Altima/Lookbook/Model/Status.php
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Altima Lookbook Free Extension
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* @category Altima
|
16 |
+
* @package Altima_LookbookFree
|
17 |
+
* @author Altima Web Systems http://altimawebsystems.com/
|
18 |
+
* @email support@altima.net.au
|
19 |
+
* @copyright Copyright (c) 2012 Altima Web Systems (http://altimawebsystems.com/)
|
20 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
21 |
+
*/
|
22 |
+
class Altima_Lookbook_Model_Status extends Varien_Object
|
23 |
+
{
|
24 |
+
const STATUS_ENABLED = 1;
|
25 |
+
const STATUS_DISABLED = 2;
|
26 |
+
|
27 |
+
static public function getOptionArray()
|
28 |
+
{
|
29 |
+
return array(
|
30 |
+
self::STATUS_ENABLED => Mage::helper('lookbook')->__('Enabled'),
|
31 |
+
self::STATUS_DISABLED => Mage::helper('lookbook')->__('Disabled')
|
32 |
+
);
|
33 |
+
}
|
34 |
+
}
|
app/code/local/Altima/Lookbook/Model/Uploadedfileform.php
ADDED
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Altima Lookbook Free Extension
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* @category Altima
|
16 |
+
* @package Altima_LookbookFree
|
17 |
+
* @author Altima Web Systems http://altimawebsystems.com/
|
18 |
+
* @email support@altima.net.au
|
19 |
+
* @copyright Copyright (c) 2012 Altima Web Systems (http://altimawebsystems.com/)
|
20 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
21 |
+
*/
|
22 |
+
/**
|
23 |
+
* Handle file uploads via regular form post (uses the $_FILES array)
|
24 |
+
*/
|
25 |
+
class Altima_Lookbook_Model_Uploadedfileform {
|
26 |
+
/**
|
27 |
+
* Save the file to the specified path
|
28 |
+
* @return boolean TRUE on success
|
29 |
+
*/
|
30 |
+
function save($path) {
|
31 |
+
if(!move_uploaded_file($_FILES['qqfile']['tmp_name'], $path)){
|
32 |
+
return false;
|
33 |
+
}
|
34 |
+
return true;
|
35 |
+
}
|
36 |
+
function getName() {
|
37 |
+
return $_FILES['qqfile']['name'];
|
38 |
+
}
|
39 |
+
function getSize() {
|
40 |
+
return (int)$_FILES['qqfile']['size'];
|
41 |
+
}
|
42 |
+
}
|
43 |
+
|
44 |
+
|
app/code/local/Altima/Lookbook/Model/Uploadedfilexhr.php
ADDED
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Altima Lookbook Free Extension
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* @category Altima
|
16 |
+
* @package Altima_LookbookFree
|
17 |
+
* @author Altima Web Systems http://altimawebsystems.com/
|
18 |
+
* @email support@altima.net.au
|
19 |
+
* @copyright Copyright (c) 2012 Altima Web Systems (http://altimawebsystems.com/)
|
20 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
21 |
+
*/
|
22 |
+
class Altima_Lookbook_Model_Uploadedfilexhr {
|
23 |
+
|
24 |
+
function save($path) {
|
25 |
+
$input = fopen("php://input", "r");
|
26 |
+
$temp = tmpfile();
|
27 |
+
$realSize = stream_copy_to_stream($input, $temp);
|
28 |
+
fclose($input);
|
29 |
+
|
30 |
+
if ($realSize != $this->getSize()){
|
31 |
+
return false;
|
32 |
+
}
|
33 |
+
|
34 |
+
$target = fopen($path, "w");
|
35 |
+
fseek($temp, 0, SEEK_SET);
|
36 |
+
stream_copy_to_stream($temp, $target);
|
37 |
+
fclose($target);
|
38 |
+
|
39 |
+
return true;
|
40 |
+
}
|
41 |
+
function getName() {
|
42 |
+
return $_GET['qqfile'];
|
43 |
+
}
|
44 |
+
function getSize() {
|
45 |
+
if (isset($_SERVER["CONTENT_LENGTH"])){
|
46 |
+
return (int)$_SERVER["CONTENT_LENGTH"];
|
47 |
+
} else {
|
48 |
+
throw new Exception('Getting content length is not supported.');
|
49 |
+
}
|
50 |
+
}
|
51 |
+
}
|
52 |
+
|
app/code/local/Altima/Lookbook/controllers/Adminhtml/LookbookController.php
ADDED
@@ -0,0 +1,256 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Altima Lookbook Free Extension
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* @category Altima
|
16 |
+
* @package Altima_LookbookFree
|
17 |
+
* @author Altima Web Systems http://altimawebsystems.com/
|
18 |
+
* @email support@altima.net.au
|
19 |
+
* @copyright Copyright (c) 2012 Altima Web Systems (http://altimawebsystems.com/)
|
20 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
21 |
+
*/
|
22 |
+
class Altima_Lookbook_Adminhtml_LookbookController extends Mage_Adminhtml_Controller_Action
|
23 |
+
{
|
24 |
+
|
25 |
+
protected function _initAction() {
|
26 |
+
$this->loadLayout()
|
27 |
+
->_setActiveMenu('cms')
|
28 |
+
->_addBreadcrumb(Mage::helper('adminhtml')->__('Lookbook slides manager'), Mage::helper('adminhtml')->__('Lookbook slides manager'));
|
29 |
+
|
30 |
+
return $this;
|
31 |
+
}
|
32 |
+
|
33 |
+
public function indexAction() {
|
34 |
+
$this->_initAction()
|
35 |
+
->renderLayout();
|
36 |
+
}
|
37 |
+
|
38 |
+
public function editAction() {
|
39 |
+
$slides_count = Mage::getModel('lookbook/lookbook')->getCollection()
|
40 |
+
->getSize();
|
41 |
+
$id = $this->getRequest()->getParam('id');
|
42 |
+
if ($slides_count<5 || $id) {
|
43 |
+
|
44 |
+
$model = Mage::getModel('lookbook/lookbook')->load($id);
|
45 |
+
|
46 |
+
if ($model->getId() || $id == 0) {
|
47 |
+
$data = Mage::getSingleton('adminhtml/session')->getFormData(true);
|
48 |
+
if (!empty($data)) {
|
49 |
+
$model->setData($data);
|
50 |
+
}
|
51 |
+
|
52 |
+
Mage::register('lookbook_data', $model);
|
53 |
+
|
54 |
+
$this->loadLayout();
|
55 |
+
$this->_setActiveMenu('cms');
|
56 |
+
|
57 |
+
$this->_addBreadcrumb(Mage::helper('adminhtml')->__('Lookbook slides manager'), Mage::helper('adminhtml')->__('Lookbook slides manager'));
|
58 |
+
|
59 |
+
$this->_addContent($this->getLayout()->createBlock('lookbook/adminhtml_lookbook_edit'))
|
60 |
+
->_addLeft($this->getLayout()->createBlock('lookbook/adminhtml_lookbook_edit_tabs'));
|
61 |
+
|
62 |
+
$this->renderLayout();
|
63 |
+
} else {
|
64 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('lookbook')->__('Slide does not exist'));
|
65 |
+
$this->_redirect('*/*/');
|
66 |
+
}
|
67 |
+
}
|
68 |
+
else
|
69 |
+
{
|
70 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('lookbook')->__('Only up to 5 slides could be uploaded in Free Lookbook extension.'));
|
71 |
+
$this->_redirect('*/*/');
|
72 |
+
}
|
73 |
+
}
|
74 |
+
|
75 |
+
public function newAction() {
|
76 |
+
$this->_forward('edit');
|
77 |
+
}
|
78 |
+
|
79 |
+
public function saveAction() {
|
80 |
+
if ($data = $this->getRequest()->getPost()) {
|
81 |
+
|
82 |
+
$model = Mage::getModel('lookbook/lookbook');
|
83 |
+
$model->setData($data)
|
84 |
+
->setId($this->getRequest()->getParam('id'));
|
85 |
+
|
86 |
+
try {
|
87 |
+
|
88 |
+
if ($model->getId() && isset($data['identifier_create_redirect']))
|
89 |
+
{
|
90 |
+
$model->setData('save_rewrites_history', (bool)$data['identifier_create_redirect']);
|
91 |
+
}
|
92 |
+
|
93 |
+
$model->save();
|
94 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('lookbook')->__('Lookbook slide was successfully saved'));
|
95 |
+
Mage::getSingleton('adminhtml/session')->setFormData(false);
|
96 |
+
|
97 |
+
if ($this->getRequest()->getParam('back')) {
|
98 |
+
$this->_redirect('*/*/edit', array('id' => $model->getId()));
|
99 |
+
return;
|
100 |
+
}
|
101 |
+
$this->_redirect('*/*/');
|
102 |
+
return;
|
103 |
+
} catch (Exception $e) {
|
104 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
105 |
+
Mage::getSingleton('adminhtml/session')->setFormData($data);
|
106 |
+
$this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
|
107 |
+
return;
|
108 |
+
}
|
109 |
+
}
|
110 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('lookbook')->__('Unable to find lookbook slide to save'));
|
111 |
+
$this->_redirect('*/*/');
|
112 |
+
}
|
113 |
+
|
114 |
+
public function deleteAction() {
|
115 |
+
if( $this->getRequest()->getParam('id') > 0 ) {
|
116 |
+
try {
|
117 |
+
$model = Mage::getModel('lookbook/lookbook');
|
118 |
+
|
119 |
+
$model->setId($this->getRequest()->getParam('id'))
|
120 |
+
->delete();
|
121 |
+
|
122 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('Lookbook slide was successfully deleted'));
|
123 |
+
$this->_redirect('*/*/');
|
124 |
+
} catch (Exception $e) {
|
125 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
126 |
+
$this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
|
127 |
+
}
|
128 |
+
}
|
129 |
+
$this->_redirect('*/*/');
|
130 |
+
}
|
131 |
+
|
132 |
+
public function uploadAction()
|
133 |
+
{
|
134 |
+
|
135 |
+
$upload_dir = Mage::getBaseDir('media').'/lookbook/';
|
136 |
+
if (!file_exists($upload_dir)) mkdir($upload_dir, 0755, true);
|
137 |
+
|
138 |
+
$uploader = Mage::getModel('lookbook/fileuploader');
|
139 |
+
|
140 |
+
$config_check = $uploader->checkServerSettings();
|
141 |
+
|
142 |
+
if ($config_check === true){
|
143 |
+
$result = $uploader->handleUpload($upload_dir);
|
144 |
+
}
|
145 |
+
else
|
146 |
+
{
|
147 |
+
$result = $config_check;
|
148 |
+
}
|
149 |
+
|
150 |
+
// to pass data through iframe you will need to encode all html tags
|
151 |
+
$this->getResponse()->setBody(htmlspecialchars(json_encode($result), ENT_NOQUOTES));
|
152 |
+
}
|
153 |
+
|
154 |
+
|
155 |
+
public function getproductAction(){
|
156 |
+
$sku = $this->getRequest()->getParam('text');
|
157 |
+
$product_id = Mage::getModel('catalog/product')->getIdBySku($sku);
|
158 |
+
$status = Mage::getModel('catalog/product')->load($product_id)->getStatus();
|
159 |
+
if ($product_id) {
|
160 |
+
if ($status==1)
|
161 |
+
{
|
162 |
+
$result= 1;
|
163 |
+
}
|
164 |
+
else
|
165 |
+
{
|
166 |
+
$result = "is disabled";
|
167 |
+
}
|
168 |
+
|
169 |
+
}
|
170 |
+
else
|
171 |
+
{
|
172 |
+
$result = "doesn't exists";
|
173 |
+
}
|
174 |
+
$this->getResponse()->setBody($result);
|
175 |
+
}
|
176 |
+
|
177 |
+
public function massDeleteAction() {
|
178 |
+
$lookbookIds = $this->getRequest()->getParam('lookbook');
|
179 |
+
if(!is_array($lookbookIds)) {
|
180 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('Please select slide(s)'));
|
181 |
+
} else {
|
182 |
+
try {
|
183 |
+
foreach ($lookbookIds as $lookbookId) {
|
184 |
+
$lookbook = Mage::getModel('lookbook/lookbook')->load($lookbookId);
|
185 |
+
$lookbook->delete();
|
186 |
+
}
|
187 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(
|
188 |
+
Mage::helper('adminhtml')->__(
|
189 |
+
'Total of %d record(s) were successfully deleted', count($lookbookIds)
|
190 |
+
)
|
191 |
+
);
|
192 |
+
} catch (Exception $e) {
|
193 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
194 |
+
}
|
195 |
+
}
|
196 |
+
$this->_redirect('*/*/index');
|
197 |
+
}
|
198 |
+
|
199 |
+
public function massStatusAction()
|
200 |
+
{
|
201 |
+
$lookbookIds = $this->getRequest()->getParam('lookbook');
|
202 |
+
if(!is_array($lookbookIds)) {
|
203 |
+
Mage::getSingleton('adminhtml/session')->addError($this->__('Please select slide(s)'));
|
204 |
+
} else {
|
205 |
+
try {
|
206 |
+
foreach ($lookbookIds as $lookbookId) {
|
207 |
+
$lookbook = Mage::getSingleton('lookbook/lookbook')
|
208 |
+
->load($lookbookId)
|
209 |
+
->setStatus($this->getRequest()->getParam('status'))
|
210 |
+
->setIsMassupdate(true)
|
211 |
+
->save();
|
212 |
+
}
|
213 |
+
$this->_getSession()->addSuccess(
|
214 |
+
$this->__('Total of %d record(s) were successfully updated', count($lookbookIds))
|
215 |
+
);
|
216 |
+
} catch (Exception $e) {
|
217 |
+
$this->_getSession()->addError($e->getMessage());
|
218 |
+
}
|
219 |
+
}
|
220 |
+
$this->_redirect('*/*/index');
|
221 |
+
}
|
222 |
+
|
223 |
+
public function exportCsvAction()
|
224 |
+
{
|
225 |
+
$fileName = 'lookbook.csv';
|
226 |
+
$content = $this->getLayout()->createBlock('lookbook/adminhtml_lookbook_grid')
|
227 |
+
->getCsv();
|
228 |
+
|
229 |
+
$this->_sendUploadResponse($fileName, $content);
|
230 |
+
}
|
231 |
+
|
232 |
+
public function exportXmlAction()
|
233 |
+
{
|
234 |
+
$fileName = 'lookbook.xml';
|
235 |
+
$content = $this->getLayout()->createBlock('lookbook/adminhtml_lookbook_grid')
|
236 |
+
->getXml();
|
237 |
+
|
238 |
+
$this->_sendUploadResponse($fileName, $content);
|
239 |
+
}
|
240 |
+
|
241 |
+
protected function _sendUploadResponse($fileName, $content, $contentType='application/octet-stream')
|
242 |
+
{
|
243 |
+
$response = $this->getResponse();
|
244 |
+
$response->setHeader('HTTP/1.1 200 OK','');
|
245 |
+
$response->setHeader('Pragma', 'public', true);
|
246 |
+
$response->setHeader('Cache-Control', 'must-revalidate, post-check=0, pre-check=0', true);
|
247 |
+
$response->setHeader('Content-Disposition', 'attachment; filename='.$fileName);
|
248 |
+
$response->setHeader('Last-Modified', date('r'));
|
249 |
+
$response->setHeader('Accept-Ranges', 'bytes');
|
250 |
+
$response->setHeader('Content-Length', strlen($content));
|
251 |
+
$response->setHeader('Content-type', $contentType);
|
252 |
+
$response->setBody($content);
|
253 |
+
$response->sendResponse();
|
254 |
+
die;
|
255 |
+
}
|
256 |
+
}
|
app/code/local/Altima/Lookbook/controllers/IndexController.php
ADDED
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Altima Lookbook Free Extension
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* @category Altima
|
16 |
+
* @package Altima_LookbookFree
|
17 |
+
* @author Altima Web Systems http://altimawebsystems.com/
|
18 |
+
* @email support@altima.net.au
|
19 |
+
* @copyright Copyright (c) 2012 Altima Web Systems (http://altimawebsystems.com/)
|
20 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
21 |
+
*/
|
22 |
+
class Altima_Lookbook_IndexController extends Mage_Core_Controller_Front_Action
|
23 |
+
{
|
24 |
+
public function indexAction()
|
25 |
+
{
|
26 |
+
if (Mage::helper('lookbook')->getEnabled()) {
|
27 |
+
$this->loadLayout();
|
28 |
+
$this->renderLayout();
|
29 |
+
}
|
30 |
+
else
|
31 |
+
{
|
32 |
+
$this->_forward('*/*/noRouteAction');
|
33 |
+
}
|
34 |
+
|
35 |
+
}
|
36 |
+
|
37 |
+
public function noRouteAction($coreRoute = null)
|
38 |
+
{
|
39 |
+
//modify this method as you need
|
40 |
+
$this->getResponse()->setHeader('HTTP/1.1','404 Not Found');
|
41 |
+
$this->getResponse()->setHeader('Status','404 File not found');
|
42 |
+
$pageId = Mage::getStoreConfig('web/default/cms_no_route');
|
43 |
+
if (!Mage::helper('cms/page')->renderPage($this, $pageId)) {
|
44 |
+
$this->_forward('defaultNoRoute');
|
45 |
+
}
|
46 |
+
}
|
47 |
+
|
48 |
+
}
|
app/code/local/Altima/Lookbook/etc/config.xml
ADDED
@@ -0,0 +1,174 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* Altima Lookbook Free Extension
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://opensource.org/licenses/osl-3.0.php
|
12 |
+
* If you did not receive a copy of the license and are unable to
|
13 |
+
* obtain it through the world-wide-web, please send an email
|
14 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
15 |
+
*
|
16 |
+
* @category Altima
|
17 |
+
* @package Altima_LookbookFree
|
18 |
+
* @author Altima Web Systems http://altimawebsystems.com/
|
19 |
+
* @email support@altima.net.au
|
20 |
+
* @copyright Copyright (c) 2012 Altima Web Systems (http://altimawebsystems.com/)
|
21 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
22 |
+
*/
|
23 |
+
-->
|
24 |
+
<config>
|
25 |
+
<modules>
|
26 |
+
<Altima_Lookbook>
|
27 |
+
<version>0.1.0</version>
|
28 |
+
</Altima_Lookbook>
|
29 |
+
</modules>
|
30 |
+
<frontend>
|
31 |
+
<routers>
|
32 |
+
<lookbook>
|
33 |
+
<use>standard</use>
|
34 |
+
<args>
|
35 |
+
<module>Altima_Lookbook</module>
|
36 |
+
<frontName>lookbook</frontName>
|
37 |
+
</args>
|
38 |
+
</lookbook>
|
39 |
+
</routers>
|
40 |
+
<layout>
|
41 |
+
<updates>
|
42 |
+
<lookbook>
|
43 |
+
<file>lookbook.xml</file>
|
44 |
+
</lookbook>
|
45 |
+
</updates>
|
46 |
+
</layout>
|
47 |
+
</frontend>
|
48 |
+
<admin>
|
49 |
+
<routers>
|
50 |
+
<lookbook>
|
51 |
+
<use>admin</use>
|
52 |
+
<args>
|
53 |
+
<module>Altima_Lookbook</module>
|
54 |
+
<frontName>lookbook</frontName>
|
55 |
+
</args>
|
56 |
+
</lookbook>
|
57 |
+
</routers>
|
58 |
+
</admin>
|
59 |
+
<adminhtml>
|
60 |
+
<menu>
|
61 |
+
<cms>
|
62 |
+
<children>
|
63 |
+
<lookbook translate="title" module="lookbook">
|
64 |
+
<title>LookBook Free</title>
|
65 |
+
<action>lookbook/adminhtml_lookbook</action>
|
66 |
+
</lookbook>
|
67 |
+
</children>
|
68 |
+
</cms>
|
69 |
+
</menu>
|
70 |
+
<acl>
|
71 |
+
<resources>
|
72 |
+
<admin>
|
73 |
+
<children>
|
74 |
+
<cms>
|
75 |
+
<children>
|
76 |
+
<lookbook>
|
77 |
+
<title>LookBook Free</title>
|
78 |
+
</lookbook>
|
79 |
+
</children>
|
80 |
+
</cms>
|
81 |
+
<system>
|
82 |
+
<children>
|
83 |
+
<config>
|
84 |
+
<children>
|
85 |
+
<lookbook>
|
86 |
+
<title>LookBook Free</title>
|
87 |
+
</lookbook>
|
88 |
+
</children>
|
89 |
+
</config>
|
90 |
+
</children>
|
91 |
+
</system>
|
92 |
+
</children>
|
93 |
+
</admin>
|
94 |
+
</resources>
|
95 |
+
</acl>
|
96 |
+
<layout>
|
97 |
+
<updates>
|
98 |
+
<lookbook>
|
99 |
+
<file>lookbook.xml</file>
|
100 |
+
</lookbook>
|
101 |
+
</updates>
|
102 |
+
</layout>
|
103 |
+
</adminhtml>
|
104 |
+
<default>
|
105 |
+
<lookbook>
|
106 |
+
<general>
|
107 |
+
<enabled>1</enabled>
|
108 |
+
<min_image_width>300</min_image_width>
|
109 |
+
<min_image_height>400</min_image_height>
|
110 |
+
<max_image_width>450</max_image_width>
|
111 |
+
<max_image_height>600</max_image_height>
|
112 |
+
<max_upload_filesize>2097152</max_upload_filesize>
|
113 |
+
<allowed_extensions>jpg,jpeg,png,gif</allowed_extensions>
|
114 |
+
</general>
|
115 |
+
</lookbook>
|
116 |
+
</default>
|
117 |
+
<global>
|
118 |
+
<models>
|
119 |
+
<lookbook>
|
120 |
+
<class>Altima_Lookbook_Model</class>
|
121 |
+
<resourceModel>lookbook_mysql4</resourceModel>
|
122 |
+
</lookbook>
|
123 |
+
<lookbook_mysql4>
|
124 |
+
<class>Altima_Lookbook_Model_Mysql4</class>
|
125 |
+
<entities>
|
126 |
+
<lookbook>
|
127 |
+
<table>lookbook</table>
|
128 |
+
</lookbook>
|
129 |
+
</entities>
|
130 |
+
</lookbook_mysql4>
|
131 |
+
</models>
|
132 |
+
<resources>
|
133 |
+
<lookbook_setup>
|
134 |
+
<setup>
|
135 |
+
<module>Altima_Lookbook</module>
|
136 |
+
</setup>
|
137 |
+
<connection>
|
138 |
+
<use>core_setup</use>
|
139 |
+
</connection>
|
140 |
+
</lookbook_setup>
|
141 |
+
<lookbook_write>
|
142 |
+
<connection>
|
143 |
+
<use>core_write</use>
|
144 |
+
</connection>
|
145 |
+
</lookbook_write>
|
146 |
+
<lookbook_read>
|
147 |
+
<connection>
|
148 |
+
<use>core_read</use>
|
149 |
+
</connection>
|
150 |
+
</lookbook_read>
|
151 |
+
</resources>
|
152 |
+
<blocks>
|
153 |
+
<lookbook>
|
154 |
+
<class>Altima_Lookbook_Block</class>
|
155 |
+
</lookbook>
|
156 |
+
</blocks>
|
157 |
+
<helpers>
|
158 |
+
<lookbook>
|
159 |
+
<class>Altima_Lookbook_Helper</class>
|
160 |
+
</lookbook>
|
161 |
+
</helpers>
|
162 |
+
<events>
|
163 |
+
<cms_page_render>
|
164 |
+
<observers>
|
165 |
+
<lookbook_layout_generate_observer>
|
166 |
+
<type>singleton</type>
|
167 |
+
<class>lookbook/layout_generate_observer</class>
|
168 |
+
<method>addHeadItems</method>
|
169 |
+
</lookbook_layout_generate_observer>
|
170 |
+
</observers>
|
171 |
+
</cms_page_render>
|
172 |
+
</events>
|
173 |
+
</global>
|
174 |
+
</config>
|
app/code/local/Altima/Lookbook/etc/system.xml
ADDED
@@ -0,0 +1,117 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* Altima Lookbook Free Extension
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://opensource.org/licenses/osl-3.0.php
|
12 |
+
* If you did not receive a copy of the license and are unable to
|
13 |
+
* obtain it through the world-wide-web, please send an email
|
14 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
15 |
+
*
|
16 |
+
* @category Altima
|
17 |
+
* @package Altima_LookbookFree
|
18 |
+
* @author Altima Web Systems http://altimawebsystems.com/
|
19 |
+
* @email support@altima.net.au
|
20 |
+
* @copyright Copyright (c) 2012 Altima Web Systems (http://altimawebsystems.com/)
|
21 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
22 |
+
*/
|
23 |
+
-->
|
24 |
+
<config>
|
25 |
+
<tabs>
|
26 |
+
<altima translate="label comment" module="lookbook">
|
27 |
+
<label>Altima</label>
|
28 |
+
<sort_order>500</sort_order>
|
29 |
+
</altima>
|
30 |
+
</tabs>
|
31 |
+
<sections>
|
32 |
+
<lookbook translate="label comment" module="lookbook">
|
33 |
+
<tab>altima</tab>
|
34 |
+
<label>LookBook Free</label>
|
35 |
+
<frontend_type>text</frontend_type>
|
36 |
+
<sort_order>800</sort_order>
|
37 |
+
<show_in_default>1</show_in_default>
|
38 |
+
<show_in_website>1</show_in_website>
|
39 |
+
<show_in_store>1</show_in_store>
|
40 |
+
<groups>
|
41 |
+
<general translate="label comment" module="lookbook">
|
42 |
+
<label>General Settings</label>
|
43 |
+
<frontend_type>text</frontend_type>
|
44 |
+
<sort_order>10</sort_order>
|
45 |
+
<show_in_default>1</show_in_default>
|
46 |
+
<show_in_website>1</show_in_website>
|
47 |
+
<show_in_store>1</show_in_store>
|
48 |
+
<fields>
|
49 |
+
<enabled translate="label">
|
50 |
+
<label>Enabled</label>
|
51 |
+
<frontend_type>select</frontend_type>
|
52 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
53 |
+
<sort_order>10</sort_order>
|
54 |
+
<show_in_default>1</show_in_default>
|
55 |
+
<show_in_website>1</show_in_website>
|
56 |
+
<show_in_store>1</show_in_store>
|
57 |
+
</enabled>
|
58 |
+
<min_image_width translate="label">
|
59 |
+
<label>Minimal Image Width (px)</label>
|
60 |
+
<frontend_type>text</frontend_type>
|
61 |
+
<sort_order>20</sort_order>
|
62 |
+
<show_in_default>1</show_in_default>
|
63 |
+
<show_in_website>1</show_in_website>
|
64 |
+
<show_in_store>1</show_in_store>
|
65 |
+
<comment><![CDATA[Integer value. Must be less then Maximal Image Width.]]></comment>
|
66 |
+
</min_image_width>
|
67 |
+
<min_image_height translate="label">
|
68 |
+
<label>Minimal Image Height (px)</label>
|
69 |
+
<frontend_type>text</frontend_type>
|
70 |
+
<sort_order>30</sort_order>
|
71 |
+
<show_in_default>1</show_in_default>
|
72 |
+
<show_in_website>1</show_in_website>
|
73 |
+
<show_in_store>1</show_in_store>
|
74 |
+
<comment><![CDATA[Integer value. Must be less then Maximal Image Height.]]></comment>
|
75 |
+
</min_image_height>
|
76 |
+
<max_image_width translate="label">
|
77 |
+
<label>Maximal Image Width (px)</label>
|
78 |
+
<frontend_type>text</frontend_type>
|
79 |
+
<sort_order>40</sort_order>
|
80 |
+
<show_in_default>1</show_in_default>
|
81 |
+
<show_in_website>1</show_in_website>
|
82 |
+
<show_in_store>1</show_in_store>
|
83 |
+
<comment><![CDATA[Integer value. Must be greater then Minimal Image Width.]]></comment>
|
84 |
+
</max_image_width>
|
85 |
+
<max_image_height translate="label">
|
86 |
+
<label>Maximal Image Height (px)</label>
|
87 |
+
<frontend_type>text</frontend_type>
|
88 |
+
<sort_order>50</sort_order>
|
89 |
+
<show_in_default>1</show_in_default>
|
90 |
+
<show_in_website>1</show_in_website>
|
91 |
+
<show_in_store>1</show_in_store>
|
92 |
+
<comment><![CDATA[Integer value. Must be greater then Minimal Image Height.]]></comment>
|
93 |
+
</max_image_height>
|
94 |
+
<max_upload_filesize translate="label">
|
95 |
+
<label>Uploaded file max size (bytes)</label>
|
96 |
+
<frontend_type>text</frontend_type>
|
97 |
+
<sort_order>60</sort_order>
|
98 |
+
<show_in_default>1</show_in_default>
|
99 |
+
<show_in_website>1</show_in_website>
|
100 |
+
<show_in_store>1</show_in_store>
|
101 |
+
<comment><![CDATA[Integer value. Must be less then upload_max_filesize and post_max_size in php.ini]]></comment>
|
102 |
+
</max_upload_filesize>
|
103 |
+
<allowed_extensions translate="label">
|
104 |
+
<label>Allowed extensions</label>
|
105 |
+
<frontend_type>text</frontend_type>
|
106 |
+
<sort_order>70</sort_order>
|
107 |
+
<show_in_default>1</show_in_default>
|
108 |
+
<show_in_website>1</show_in_website>
|
109 |
+
<show_in_store>1</show_in_store>
|
110 |
+
<comment><![CDATA[Comma separated file extensions. Example, "jpg,gif,png"]]></comment>
|
111 |
+
</allowed_extensions>
|
112 |
+
</fields>
|
113 |
+
</general>
|
114 |
+
</groups>
|
115 |
+
</lookbook>
|
116 |
+
</sections>
|
117 |
+
</config>
|
app/code/local/Altima/Lookbook/sql/lookbook_setup/mysql4-install-0.1.0.php
ADDED
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Altima Lookbook Free Extension
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* @category Altima
|
16 |
+
* @package Altima_LookbookFree
|
17 |
+
* @author Altima Web Systems http://altimawebsystems.com/
|
18 |
+
* @email support@altima.net.au
|
19 |
+
* @copyright Copyright (c) 2012 Altima Web Systems (http://altimawebsystems.com/)
|
20 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
21 |
+
*/
|
22 |
+
|
23 |
+
$installer = $this;
|
24 |
+
|
25 |
+
$installer->startSetup();
|
26 |
+
|
27 |
+
$installer->run("
|
28 |
+
|
29 |
+
-- DROP TABLE IF EXISTS {$this->getTable('lookbook')};
|
30 |
+
CREATE TABLE {$this->getTable('lookbook')} (
|
31 |
+
`lookbook_id` int(11) unsigned NOT NULL auto_increment,
|
32 |
+
`name` varchar(255) NOT NULL default '',
|
33 |
+
`image` varchar(255) NOT NULL default '',
|
34 |
+
`hotspots` text NOT NULL default '',
|
35 |
+
`position` smallint(5) unsigned NOT NULL,
|
36 |
+
`status` smallint(6) NOT NULL default '0',
|
37 |
+
PRIMARY KEY (`lookbook_id`),
|
38 |
+
KEY `IDX_LOOKBOOK_LOOKBOOK_ID` (`lookbook_id`)
|
39 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
40 |
+
|
41 |
+
");
|
42 |
+
|
43 |
+
$installer->setConfigData('lookbook/general/hotspot_icon/','default/hotspot-icon.png');
|
44 |
+
|
45 |
+
$installer->endSetup();
|
app/design/adminhtml/default/default/layout/lookbook.xml
ADDED
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* Altima Lookbook Free Extension
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://opensource.org/licenses/osl-3.0.php
|
12 |
+
* If you did not receive a copy of the license and are unable to
|
13 |
+
* obtain it through the world-wide-web, please send an email
|
14 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
15 |
+
*
|
16 |
+
* @category Altima
|
17 |
+
* @package Altima_LookbookFree
|
18 |
+
* @author Altima Web Systems http://altimawebsystems.com/
|
19 |
+
* @email support@altima.net.au
|
20 |
+
* @copyright Copyright (c) 2012 Altima Web Systems (http://altimawebsystems.com/)
|
21 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
22 |
+
*/
|
23 |
+
-->
|
24 |
+
<layout version="0.1.0">
|
25 |
+
<lookbook_adminhtml_lookbook_index>
|
26 |
+
<reference name="content">
|
27 |
+
<block type="lookbook/adminhtml_lookbook" name="lookbook" />
|
28 |
+
</reference>
|
29 |
+
</lookbook_adminhtml_lookbook_index>
|
30 |
+
<lookbook_adminhtml_lookbook_edit>
|
31 |
+
<reference name="head">
|
32 |
+
<action method="addCss"><stylesheet>lookbook/css/annotation.css</stylesheet></action>
|
33 |
+
<action method="addCss"><stylesheet>lookbook/css/fileuploader.css</stylesheet></action>
|
34 |
+
<action method="addJs"><script>jquery/jquery-1.7.min.js</script></action>
|
35 |
+
<action method="addJs"><script>jquery/jquery.noconflict.js</script></action>
|
36 |
+
<action method="addJs"><script>lookbook/jquery-ui-1.8.17.js</script></action>
|
37 |
+
<action method="addJs"><script>lookbook/jquery.annotate.js</script></action>
|
38 |
+
<action method="addJs"><script>lookbook/fileuploader.js</script></action>
|
39 |
+
<action method="addJs"><script>lookbook/json2.min.js</script></action>
|
40 |
+
</reference>
|
41 |
+
</lookbook_adminhtml_lookbook_edit>
|
42 |
+
</layout>
|
app/design/frontend/base/default/layout/lookbook.xml
ADDED
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* Altima Lookbook Free Extension
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://opensource.org/licenses/osl-3.0.php
|
12 |
+
* If you did not receive a copy of the license and are unable to
|
13 |
+
* obtain it through the world-wide-web, please send an email
|
14 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
15 |
+
*
|
16 |
+
* @category Altima
|
17 |
+
* @package Altima_LookbookFree
|
18 |
+
* @author Altima Web Systems http://altimawebsystems.com/
|
19 |
+
* @email support@altima.net.au
|
20 |
+
* @copyright Copyright (c) 2012 Altima Web Systems (http://altimawebsystems.com/)
|
21 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
22 |
+
*/
|
23 |
+
-->
|
24 |
+
<layout version="0.1.0">
|
25 |
+
<default>
|
26 |
+
</default>
|
27 |
+
<lookbook_index_index>
|
28 |
+
<reference name="head">
|
29 |
+
<action method="addCss"><stylesheet>lookbook/css/hotspots.css</stylesheet></action>
|
30 |
+
<action method="addJs"><script>jquery/jquery-1.7.min.js</script></action>
|
31 |
+
<action method="addJs"><script>jquery/jquery.noconflict.js</script></action>
|
32 |
+
<action method="addJs"><script>lookbook/slides.min.jquery.js</script></action>
|
33 |
+
</reference>
|
34 |
+
<reference name="content">
|
35 |
+
<block type="lookbook/lookbook" name="lookbook" template="lookbook/lookbook.phtml" />
|
36 |
+
</reference>
|
37 |
+
</lookbook_index_index>
|
38 |
+
</layout>
|
app/design/frontend/base/default/template/lookbook/lookbook.phtml
ADDED
@@ -0,0 +1,201 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Altima Lookbook Free Extension
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* @category Altima
|
16 |
+
* @package Altima_LookbookFree
|
17 |
+
* @author Altima Web Systems http://altimawebsystems.com/
|
18 |
+
* @email support@altima.net.au
|
19 |
+
* @copyright Copyright (c) 2012 Altima Web Systems (http://altimawebsystems.com/)
|
20 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
21 |
+
*/
|
22 |
+
$helper = Mage::helper('lookbook');
|
23 |
+
|
24 |
+
if ($helper->getEnabled()) :
|
25 |
+
|
26 |
+
$makets = $this->getCollection();
|
27 |
+
|
28 |
+
$width = $helper->getMaxImageWidth();
|
29 |
+
$height = $helper->getMaxImageHeight();
|
30 |
+
$skin_img_folder = $this->getSkinUrl('lookbook/images/');
|
31 |
+
$hotspots = array();
|
32 |
+
|
33 |
+
if ($makets->getSize()) :
|
34 |
+
?>
|
35 |
+
<style type="text/css">
|
36 |
+
#lookbook {
|
37 |
+
width:<?php echo $width+40;?>px;
|
38 |
+
height:<?php echo $height+70;?>px;
|
39 |
+
}
|
40 |
+
|
41 |
+
.slides_container {
|
42 |
+
width:<?php echo $width?>px;
|
43 |
+
}
|
44 |
+
|
45 |
+
.slides_container div.slide {
|
46 |
+
width:<?php echo $width?>px;
|
47 |
+
height:<?php echo $height?>px;
|
48 |
+
}
|
49 |
+
|
50 |
+
#slides .next,#slides .prev {
|
51 |
+
top:<?php echo $height/2-21?>px;
|
52 |
+
left:-24px;
|
53 |
+
}
|
54 |
+
|
55 |
+
#slides .next {
|
56 |
+
left:<?php echo $width?>px;
|
57 |
+
}
|
58 |
+
|
59 |
+
.caption {
|
60 |
+
width:<?php echo $width?>px;
|
61 |
+
}
|
62 |
+
|
63 |
+
.pagination {
|
64 |
+
width:<?php echo 16*$makets->getSize()?>px;
|
65 |
+
}
|
66 |
+
</style>
|
67 |
+
<div id="lookbook">
|
68 |
+
<div id="slides" class="slides">
|
69 |
+
<div class="slides_container">
|
70 |
+
<?php foreach ($makets as $image): ?>
|
71 |
+
<div class="slide">
|
72 |
+
<?php echo base64_decode('PGRpdiBpZD0iYWR2X2xpbmsiPjxkaXY+UG93ZXJlZCBieSA8YSBocmVmPSJodHRwOi8vYWx0aW1hd2Vic3lzdGVtcy5jb20vIj5BbHRpbWE8L2E+PC9kaXY+PC9kaXY+');?>
|
73 |
+
<img src="<?php echo $helper->getResizedUrl($image->getImage(), $width, $height);?>" alt="Slide <?php echo $image->getId();?>"/>
|
74 |
+
<div class="caption" style="bottom:0;">
|
75 |
+
<p><?php echo $image->getName();?></p>
|
76 |
+
</div>
|
77 |
+
</div>
|
78 |
+
<?php $hotspots[] = $helper->getHotspotsWithProductDetails($image->getHotspots()); ?>
|
79 |
+
<?php endforeach; ?>
|
80 |
+
</div>
|
81 |
+
<a href="#" class="prev"><img src="<?php echo $skin_img_folder;?>arrow-prev.png" width="24" height="43" alt="Arrow Prev"/></a>
|
82 |
+
<a href="#" class="next"><img src="<?php echo $skin_img_folder;?>arrow-next.png" width="24" height="43" alt="Arrow Next"/></a>
|
83 |
+
</div>
|
84 |
+
</div>
|
85 |
+
<script type="text/javascript">
|
86 |
+
//<![CDATA[
|
87 |
+
$j(document).ready(function(){
|
88 |
+
$j('#lookbook .slides').slides({
|
89 |
+
preload: true,
|
90 |
+
preloadImage: '<?php echo $skin_img_folder;?>loading.gif',
|
91 |
+
play: 5000,
|
92 |
+
pause: 2500,
|
93 |
+
hoverPause: true,
|
94 |
+
hotspots:<?php echo json_encode($hotspots);?>,
|
95 |
+
animationStart: function(current){
|
96 |
+
$j('#lookbook .caption').animate({
|
97 |
+
bottom:-35
|
98 |
+
},100);
|
99 |
+
$j('#lookbook .hotspot:visible').each(function() {
|
100 |
+
$j(this).remove();
|
101 |
+
});
|
102 |
+
},
|
103 |
+
animationComplete: function(current){
|
104 |
+
$j('#lookbook .caption').animate({
|
105 |
+
bottom:0
|
106 |
+
},200);
|
107 |
+
var spots = this.hotspots[current-1];
|
108 |
+
SetHotspots(spots);
|
109 |
+
},
|
110 |
+
slidesLoaded: function() {
|
111 |
+
$j('#lookbook .caption').animate({
|
112 |
+
bottom:0
|
113 |
+
},200);
|
114 |
+
var spots = this.hotspots[0];
|
115 |
+
SetHotspots(spots);
|
116 |
+
}
|
117 |
+
});
|
118 |
+
|
119 |
+
function SetHotspots(hotspots) {
|
120 |
+
if (!hotspots) return false;
|
121 |
+
var i=0;
|
122 |
+
hotspots.each(function() {
|
123 |
+
if (!document.getElementById(hotspots[i].id)) {
|
124 |
+
$j('#lookbook .slide:visible').append('<div class="hotspot" id="'+hotspots[i].id+'" style="left:'+hotspots[i].left+'px; top:'+hotspots[i].top+'px; width:'+hotspots[i].width+'px; height:'+hotspots[i].height+'px;">'+hotspots[i].text+'</div>');
|
125 |
+
|
126 |
+
var infoblock = $j('#lookbook .slide:visible #'+hotspots[i].id).find('.product-info');
|
127 |
+
var slide = $j('#lookbook .slide:visible');
|
128 |
+
var imgwidth = slide.width();
|
129 |
+
var infowidth = infoblock.width();
|
130 |
+
var hspt_width_hf = parseInt(hotspots[i].width/2);
|
131 |
+
var leftposition = hotspots[i].left+hspt_width_hf+7;
|
132 |
+
infoblock.find('.info-icon').css('left',hspt_width_hf+'px');
|
133 |
+
if (((leftposition + infowidth + 10)> imgwidth) && (leftposition>(imgwidth-leftposition)))
|
134 |
+
{
|
135 |
+
if ( $j.browser.msie && $j.browser.version=='8.0') {
|
136 |
+
if (leftposition-5<infowidth) {
|
137 |
+
infoblock.css('width', leftposition-20 +'px');
|
138 |
+
infowidth = infoblock.width();
|
139 |
+
}
|
140 |
+
infoblock.css('left', hspt_width_hf-7-infowidth-2*parseInt(infoblock.css('padding-left'))+'px');
|
141 |
+
}
|
142 |
+
else
|
143 |
+
{
|
144 |
+
infoblock.css('left', '');
|
145 |
+
infoblock.css('right', hspt_width_hf+7+'px');
|
146 |
+
}
|
147 |
+
if (leftposition-5<infowidth) {
|
148 |
+
infoblock.css('width', leftposition-20 +'px');
|
149 |
+
infowidth = infoblock.width();
|
150 |
+
}
|
151 |
+
}
|
152 |
+
else
|
153 |
+
{
|
154 |
+
infoblock.css('left', hspt_width_hf+7 + 'px');
|
155 |
+
if ((imgwidth-leftposition-5)<infowidth) {
|
156 |
+
infoblock.css('width', imgwidth-leftposition-20 +'px');
|
157 |
+
infowidth = infoblock.width();
|
158 |
+
}
|
159 |
+
}
|
160 |
+
|
161 |
+
var imgheight = slide.height();
|
162 |
+
var infoheight = infoblock.height();
|
163 |
+
var hspt_height_hf = parseInt(hotspots[i].height/2);
|
164 |
+
var topposition = hotspots[i].top+hspt_height_hf;
|
165 |
+
if (((topposition + infoheight + 20)> imgheight) && (topposition>(imgheight-topposition)))
|
166 |
+
{
|
167 |
+
if ( $j.browser.msie && $j.browser.version=='8.0') {
|
168 |
+
if (topposition-5<infoheight) {
|
169 |
+
infoblock.css('height', topposition-10 +'px');
|
170 |
+
infoheight = infoblock.height();
|
171 |
+
}
|
172 |
+
infoblock.css('top', hspt_height_hf-infoheight-2*parseInt(infoblock.css('padding-top'))+'px');
|
173 |
+
}
|
174 |
+
else
|
175 |
+
{
|
176 |
+
infoblock.css('top', '');
|
177 |
+
infoblock.css('bottom', hspt_height_hf+'px');
|
178 |
+
}
|
179 |
+
if (topposition-5<infoheight) {
|
180 |
+
infoblock.css('height', topposition-10 +'px');
|
181 |
+
infoheight = infoblock.height();
|
182 |
+
}
|
183 |
+
}
|
184 |
+
else
|
185 |
+
{
|
186 |
+
infoblock.css('top', hspt_height_hf + 'px');
|
187 |
+
if ((imgheight-topposition-5)<infoheight) {
|
188 |
+
infoblock.css('height', imgheight-topposition-10 +'px');
|
189 |
+
infoheight = infoblock.height();
|
190 |
+
}
|
191 |
+
}
|
192 |
+
i++;
|
193 |
+
}
|
194 |
+
});
|
195 |
+
};
|
196 |
+
});
|
197 |
+
//]]>
|
198 |
+
</script>
|
199 |
+
<?php endif;?>
|
200 |
+
<?php endif;?>
|
201 |
+
|
app/etc/modules/Altima_Lookbook.xml
ADDED
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* Altima Lookbook Free Extension
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://opensource.org/licenses/osl-3.0.php
|
12 |
+
* If you did not receive a copy of the license and are unable to
|
13 |
+
* obtain it through the world-wide-web, please send an email
|
14 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
15 |
+
*
|
16 |
+
* @category Altima
|
17 |
+
* @package Altima_LookbookFree
|
18 |
+
* @author Altima Web Systems http://altimawebsystems.com/
|
19 |
+
* @email support@altima.net.au
|
20 |
+
* @copyright Copyright (c) 2012 Altima Web Systems (http://altimawebsystems.com/)
|
21 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
22 |
+
*/
|
23 |
+
-->
|
24 |
+
<config>
|
25 |
+
<modules>
|
26 |
+
<Altima_Lookbook>
|
27 |
+
<active>true</active>
|
28 |
+
<codePool>local</codePool>
|
29 |
+
<depends>
|
30 |
+
<Mage_Core/>
|
31 |
+
<Mage_Adminhtml/>
|
32 |
+
<Mage_Catalog/>
|
33 |
+
</depends>
|
34 |
+
</Altima_Lookbook>
|
35 |
+
</modules>
|
36 |
+
</config>
|
js/jquery/jquery-1.7.min.js
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
/*! jQuery v1.7 jquery.com | jquery.org/license */
|
2 |
+
(function(a,b){function cA(a){return f.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:!1}function cx(a){if(!cm[a]){var b=c.body,d=f("<"+a+">").appendTo(b),e=d.css("display");d.remove();if(e==="none"||e===""){cn||(cn=c.createElement("iframe"),cn.frameBorder=cn.width=cn.height=0),b.appendChild(cn);if(!co||!cn.createElement)co=(cn.contentWindow||cn.contentDocument).document,co.write((c.compatMode==="CSS1Compat"?"<!doctype html>":"")+"<html><body>"),co.close();d=co.createElement(a),co.body.appendChild(d),e=f.css(d,"display"),b.removeChild(cn)}cm[a]=e}return cm[a]}function cw(a,b){var c={};f.each(cs.concat.apply([],cs.slice(0,b)),function(){c[this]=a});return c}function cv(){ct=b}function cu(){setTimeout(cv,0);return ct=f.now()}function cl(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}function ck(){try{return new a.XMLHttpRequest}catch(b){}}function ce(a,c){a.dataFilter&&(c=a.dataFilter(c,a.dataType));var d=a.dataTypes,e={},g,h,i=d.length,j,k=d[0],l,m,n,o,p;for(g=1;g<i;g++){if(g===1)for(h in a.converters)typeof h=="string"&&(e[h.toLowerCase()]=a.converters[h]);l=k,k=d[g];if(k==="*")k=l;else if(l!=="*"&&l!==k){m=l+" "+k,n=e[m]||e["* "+k];if(!n){p=b;for(o in e){j=o.split(" ");if(j[0]===l||j[0]==="*"){p=e[j[1]+" "+k];if(p){o=e[o],o===!0?n=p:p===!0&&(n=o);break}}}}!n&&!p&&f.error("No conversion from "+m.replace(" "," to ")),n!==!0&&(c=n?n(c):p(o(c)))}}return c}function cd(a,c,d){var e=a.contents,f=a.dataTypes,g=a.responseFields,h,i,j,k;for(i in g)i in d&&(c[g[i]]=d[i]);while(f[0]==="*")f.shift(),h===b&&(h=a.mimeType||c.getResponseHeader("content-type"));if(h)for(i in e)if(e[i]&&e[i].test(h)){f.unshift(i);break}if(f[0]in d)j=f[0];else{for(i in d){if(!f[0]||a.converters[i+" "+f[0]]){j=i;break}k||(k=i)}j=j||k}if(j){j!==f[0]&&f.unshift(j);return d[j]}}function cc(a,b,c,d){if(f.isArray(b))f.each(b,function(b,e){c||bG.test(a)?d(a,e):cc(a+"["+(typeof e=="object"||f.isArray(e)?b:"")+"]",e,c,d)});else if(!c&&b!=null&&typeof b=="object")for(var e in b)cc(a+"["+e+"]",b[e],c,d);else d(a,b)}function cb(a,c){var d,e,g=f.ajaxSettings.flatOptions||{};for(d in c)c[d]!==b&&((g[d]?a:e||(e={}))[d]=c[d]);e&&f.extend(!0,a,e)}function ca(a,c,d,e,f,g){f=f||c.dataTypes[0],g=g||{},g[f]=!0;var h=a[f],i=0,j=h?h.length:0,k=a===bV,l;for(;i<j&&(k||!l);i++)l=h[i](c,d,e),typeof l=="string"&&(!k||g[l]?l=b:(c.dataTypes.unshift(l),l=ca(a,c,d,e,l,g)));(k||!l)&&!g["*"]&&(l=ca(a,c,d,e,"*",g));return l}function b_(a){return function(b,c){typeof b!="string"&&(c=b,b="*");if(f.isFunction(c)){var d=b.toLowerCase().split(bR),e=0,g=d.length,h,i,j;for(;e<g;e++)h=d[e],j=/^\+/.test(h),j&&(h=h.substr(1)||"*"),i=a[h]=a[h]||[],i[j?"unshift":"push"](c)}}}function bE(a,b,c){var d=b==="width"?a.offsetWidth:a.offsetHeight,e=b==="width"?bz:bA;if(d>0){c!=="border"&&f.each(e,function(){c||(d-=parseFloat(f.css(a,"padding"+this))||0),c==="margin"?d+=parseFloat(f.css(a,c+this))||0:d-=parseFloat(f.css(a,"border"+this+"Width"))||0});return d+"px"}d=bB(a,b,b);if(d<0||d==null)d=a.style[b]||0;d=parseFloat(d)||0,c&&f.each(e,function(){d+=parseFloat(f.css(a,"padding"+this))||0,c!=="padding"&&(d+=parseFloat(f.css(a,"border"+this+"Width"))||0),c==="margin"&&(d+=parseFloat(f.css(a,c+this))||0)});return d+"px"}function br(a,b){b.src?f.ajax({url:b.src,async:!1,dataType:"script"}):f.globalEval((b.text||b.textContent||b.innerHTML||"").replace(bi,"/*$0*/")),b.parentNode&&b.parentNode.removeChild(b)}function bq(a){var b=(a.nodeName||"").toLowerCase();b==="input"?bp(a):b!=="script"&&typeof a.getElementsByTagName!="undefined"&&f.grep(a.getElementsByTagName("input"),bp)}function bp(a){if(a.type==="checkbox"||a.type==="radio")a.defaultChecked=a.checked}function bo(a){return typeof a.getElementsByTagName!="undefined"?a.getElementsByTagName("*"):typeof a.querySelectorAll!="undefined"?a.querySelectorAll("*"):[]}function bn(a,b){var c;if(b.nodeType===1){b.clearAttributes&&b.clearAttributes(),b.mergeAttributes&&b.mergeAttributes(a),c=b.nodeName.toLowerCase();if(c==="object")b.outerHTML=a.outerHTML;else if(c!=="input"||a.type!=="checkbox"&&a.type!=="radio"){if(c==="option")b.selected=a.defaultSelected;else if(c==="input"||c==="textarea")b.defaultValue=a.defaultValue}else a.checked&&(b.defaultChecked=b.checked=a.checked),b.value!==a.value&&(b.value=a.value);b.removeAttribute(f.expando)}}function bm(a,b){if(b.nodeType===1&&!!f.hasData(a)){var c,d,e,g=f._data(a),h=f._data(b,g),i=g.events;if(i){delete h.handle,h.events={};for(c in i)for(d=0,e=i[c].length;d<e;d++)f.event.add(b,c+(i[c][d].namespace?".":"")+i[c][d].namespace,i[c][d],i[c][d].data)}h.data&&(h.data=f.extend({},h.data))}}function bl(a,b){return f.nodeName(a,"table")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function X(a){var b=Y.split(" "),c=a.createDocumentFragment();if(c.createElement)while(b.length)c.createElement(b.pop());return c}function W(a,b,c){b=b||0;if(f.isFunction(b))return f.grep(a,function(a,d){var e=!!b.call(a,d,a);return e===c});if(b.nodeType)return f.grep(a,function(a,d){return a===b===c});if(typeof b=="string"){var d=f.grep(a,function(a){return a.nodeType===1});if(R.test(b))return f.filter(b,d,!c);b=f.filter(b,d)}return f.grep(a,function(a,d){return f.inArray(a,b)>=0===c})}function V(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function N(){return!0}function M(){return!1}function n(a,b,c){var d=b+"defer",e=b+"queue",g=b+"mark",h=f._data(a,d);h&&(c==="queue"||!f._data(a,e))&&(c==="mark"||!f._data(a,g))&&setTimeout(function(){!f._data(a,e)&&!f._data(a,g)&&(f.removeData(a,d,!0),h.fire())},0)}function m(a){for(var b in a){if(b==="data"&&f.isEmptyObject(a[b]))continue;if(b!=="toJSON")return!1}return!0}function l(a,c,d){if(d===b&&a.nodeType===1){var e="data-"+c.replace(k,"-$1").toLowerCase();d=a.getAttribute(e);if(typeof d=="string"){try{d=d==="true"?!0:d==="false"?!1:d==="null"?null:f.isNumeric(d)?parseFloat(d):j.test(d)?f.parseJSON(d):d}catch(g){}f.data(a,c,d)}else d=b}return d}function h(a){var b=g[a]={},c,d;a=a.split(/\s+/);for(c=0,d=a.length;c<d;c++)b[a[c]]=!0;return b}var c=a.document,d=a.navigator,e=a.location,f=function(){function K(){if(!e.isReady){try{c.documentElement.doScroll("left")}catch(a){setTimeout(K,1);return}e.ready()}}var e=function(a,b){return new e.fn.init(a,b,h)},f=a.jQuery,g=a.$,h,i=/^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,j=/\S/,k=/^\s+/,l=/\s+$/,m=/\d/,n=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,o=/^[\],:{}\s]*$/,p=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,q=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,r=/(?:^|:|,)(?:\s*\[)+/g,s=/(webkit)[ \/]([\w.]+)/,t=/(opera)(?:.*version)?[ \/]([\w.]+)/,u=/(msie) ([\w.]+)/,v=/(mozilla)(?:.*? rv:([\w.]+))?/,w=/-([a-z]|[0-9])/ig,x=/^-ms-/,y=function(a,b){return(b+"").toUpperCase()},z=d.userAgent,A,B,C,D=Object.prototype.toString,E=Object.prototype.hasOwnProperty,F=Array.prototype.push,G=Array.prototype.slice,H=String.prototype.trim,I=Array.prototype.indexOf,J={};e.fn=e.prototype={constructor:e,init:function(a,d,f){var g,h,j,k;if(!a)return this;if(a.nodeType){this.context=this[0]=a,this.length=1;return this}if(a==="body"&&!d&&c.body){this.context=c,this[0]=c.body,this.selector=a,this.length=1;return this}if(typeof a=="string"){a.charAt(0)!=="<"||a.charAt(a.length-1)!==">"||a.length<3?g=i.exec(a):g=[null,a,null];if(g&&(g[1]||!d)){if(g[1]){d=d instanceof e?d[0]:d,k=d?d.ownerDocument||d:c,j=n.exec(a),j?e.isPlainObject(d)?(a=[c.createElement(j[1])],e.fn.attr.call(a,d,!0)):a=[k.createElement(j[1])]:(j=e.buildFragment([g[1]],[k]),a=(j.cacheable?e.clone(j.fragment):j.fragment).childNodes);return e.merge(this,a)}h=c.getElementById(g[2]);if(h&&h.parentNode){if(h.id!==g[2])return f.find(a);this.length=1,this[0]=h}this.context=c,this.selector=a;return this}return!d||d.jquery?(d||f).find(a):this.constructor(d).find(a)}if(e.isFunction(a))return f.ready(a);a.selector!==b&&(this.selector=a.selector,this.context=a.context);return e.makeArray(a,this)},selector:"",jquery:"1.7",length:0,size:function(){return this.length},toArray:function(){return G.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this[this.length+a]:this[a]},pushStack:function(a,b,c){var d=this.constructor();e.isArray(a)?F.apply(d,a):e.merge(d,a),d.prevObject=this,d.context=this.context,b==="find"?d.selector=this.selector+(this.selector?" ":"")+c:b&&(d.selector=this.selector+"."+b+"("+c+")");return d},each:function(a,b){return e.each(this,a,b)},ready:function(a){e.bindReady(),B.add(a);return this},eq:function(a){return a===-1?this.slice(a):this.slice(a,+a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(G.apply(this,arguments),"slice",G.call(arguments).join(","))},map:function(a){return this.pushStack(e.map(this,function(b,c){return a.call(b,c,b)}))},end:function(){return this.prevObject||this.constructor(null)},push:F,sort:[].sort,splice:[].splice},e.fn.init.prototype=e.fn,e.extend=e.fn.extend=function(){var a,c,d,f,g,h,i=arguments[0]||{},j=1,k=arguments.length,l=!1;typeof i=="boolean"&&(l=i,i=arguments[1]||{},j=2),typeof i!="object"&&!e.isFunction(i)&&(i={}),k===j&&(i=this,--j);for(;j<k;j++)if((a=arguments[j])!=null)for(c in a){d=i[c],f=a[c];if(i===f)continue;l&&f&&(e.isPlainObject(f)||(g=e.isArray(f)))?(g?(g=!1,h=d&&e.isArray(d)?d:[]):h=d&&e.isPlainObject(d)?d:{},i[c]=e.extend(l,h,f)):f!==b&&(i[c]=f)}return i},e.extend({noConflict:function(b){a.$===e&&(a.$=g),b&&a.jQuery===e&&(a.jQuery=f);return e},isReady:!1,readyWait:1,holdReady:function(a){a?e.readyWait++:e.ready(!0)},ready:function(a){if(a===!0&&!--e.readyWait||a!==!0&&!e.isReady){if(!c.body)return setTimeout(e.ready,1);e.isReady=!0;if(a!==!0&&--e.readyWait>0)return;B.fireWith(c,[e]),e.fn.trigger&&e(c).trigger("ready").unbind("ready")}},bindReady:function(){if(!B){B=e.Callbacks("once memory");if(c.readyState==="complete")return setTimeout(e.ready,1);if(c.addEventListener)c.addEventListener("DOMContentLoaded",C,!1),a.addEventListener("load",e.ready,!1);else if(c.attachEvent){c.attachEvent("onreadystatechange",C),a.attachEvent("onload",e.ready);var b=!1;try{b=a.frameElement==null}catch(d){}c.documentElement.doScroll&&b&&K()}}},isFunction:function(a){return e.type(a)==="function"},isArray:Array.isArray||function(a){return e.type(a)==="array"},isWindow:function(a){return a&&typeof a=="object"&&"setInterval"in a},isNumeric:function(a){return a!=null&&m.test(a)&&!isNaN(a)},type:function(a){return a==null?String(a):J[D.call(a)]||"object"},isPlainObject:function(a){if(!a||e.type(a)!=="object"||a.nodeType||e.isWindow(a))return!1;try{if(a.constructor&&!E.call(a,"constructor")&&!E.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}var d;for(d in a);return d===b||E.call(a,d)},isEmptyObject:function(a){for(var b in a)return!1;return!0},error:function(a){throw a},parseJSON:function(b){if(typeof b!="string"||!b)return null;b=e.trim(b);if(a.JSON&&a.JSON.parse)return a.JSON.parse(b);if(o.test(b.replace(p,"@").replace(q,"]").replace(r,"")))return(new Function("return "+b))();e.error("Invalid JSON: "+b)},parseXML:function(c){var d,f;try{a.DOMParser?(f=new DOMParser,d=f.parseFromString(c,"text/xml")):(d=new ActiveXObject("Microsoft.XMLDOM"),d.async="false",d.loadXML(c))}catch(g){d=b}(!d||!d.documentElement||d.getElementsByTagName("parsererror").length)&&e.error("Invalid XML: "+c);return d},noop:function(){},globalEval:function(b){b&&j.test(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(x,"ms-").replace(w,y)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,c,d){var f,g=0,h=a.length,i=h===b||e.isFunction(a);if(d){if(i){for(f in a)if(c.apply(a[f],d)===!1)break}else for(;g<h;)if(c.apply(a[g++],d)===!1)break}else if(i){for(f in a)if(c.call(a[f],f,a[f])===!1)break}else for(;g<h;)if(c.call(a[g],g,a[g++])===!1)break;return a},trim:H?function(a){return a==null?"":H.call(a)}:function(a){return a==null?"":(a+"").replace(k,"").replace(l,"")},makeArray:function(a,b){var c=b||[];if(a!=null){var d=e.type(a);a.length==null||d==="string"||d==="function"||d==="regexp"||e.isWindow(a)?F.call(c,a):e.merge(c,a)}return c},inArray:function(a,b,c){var d;if(b){if(I)return I.call(b,a,c);d=b.length,c=c?c<0?Math.max(0,d+c):c:0;for(;c<d;c++)if(c in b&&b[c]===a)return c}return-1},merge:function(a,c){var d=a.length,e=0;if(typeof c.length=="number")for(var f=c.length;e<f;e++)a[d++]=c[e];else while(c[e]!==b)a[d++]=c[e++];a.length=d;return a},grep:function(a,b,c){var d=[],e;c=!!c;for(var f=0,g=a.length;f<g;f++)e=!!b(a[f],f),c!==e&&d.push(a[f]);return d},map:function(a,c,d){var f,g,h=[],i=0,j=a.length,k=a instanceof e||j!==b&&typeof j=="number"&&(j>0&&a[0]&&a[j-1]||j===0||e.isArray(a));if(k)for(;i<j;i++)f=c(a[i],i,d),f!=null&&(h[h.length]=f);else for(g in a)f=c(a[g],g,d),f!=null&&(h[h.length]=f);return h.concat.apply([],h)},guid:1,proxy:function(a,c){if(typeof c=="string"){var d=a[c];c=a,a=d}if(!e.isFunction(a))return b;var f=G.call(arguments,2),g=function(){return a.apply(c,f.concat(G.call(arguments)))};g.guid=a.guid=a.guid||g.guid||e.guid++;return g},access:function(a,c,d,f,g,h){var i=a.length;if(typeof c=="object"){for(var j in c)e.access(a,j,c[j],f,g,d);return a}if(d!==b){f=!h&&f&&e.isFunction(d);for(var k=0;k<i;k++)g(a[k],c,f?d.call(a[k],k,g(a[k],c)):d,h);return a}return i?g(a[0],c):b},now:function(){return(new Date).getTime()},uaMatch:function(a){a=a.toLowerCase();var b=s.exec(a)||t.exec(a)||u.exec(a)||a.indexOf("compatible")<0&&v.exec(a)||[];return{browser:b[1]||"",version:b[2]||"0"}},sub:function(){function a(b,c){return new a.fn.init(b,c)}e.extend(!0,a,this),a.superclass=this,a.fn=a.prototype=this(),a.fn.constructor=a,a.sub=this.sub,a.fn.init=function(d,f){f&&f instanceof e&&!(f instanceof a)&&(f=a(f));return e.fn.init.call(this,d,f,b)},a.fn.init.prototype=a.fn;var b=a(c);return a},browser:{}}),e.each("Boolean Number String Function Array Date RegExp Object".split(" "),function(a,b){J["[object "+b+"]"]=b.toLowerCase()}),A=e.uaMatch(z),A.browser&&(e.browser[A.browser]=!0,e.browser.version=A.version),e.browser.webkit&&(e.browser.safari=!0),j.test(" ")&&(k=/^[\s\xA0]+/,l=/[\s\xA0]+$/),h=e(c),c.addEventListener?C=function(){c.removeEventListener("DOMContentLoaded",C,!1),e.ready()}:c.attachEvent&&(C=function(){c.readyState==="complete"&&(c.detachEvent("onreadystatechange",C),e.ready())}),typeof define=="function"&&define.amd&&define.amd.jQuery&&define("jquery",[],function(){return e});return e}(),g={};f.Callbacks=function(a){a=a?g[a]||h(a):{};var c=[],d=[],e,i,j,k,l,m=function(b){var d,e,g,h,i;for(d=0,e=b.length;d<e;d++)g=b[d],h=f.type(g),h==="array"?m(g):h==="function"&&(!a.unique||!o.has(g))&&c.push(g)},n=function(b,f){f=f||[],e=!a.memory||[b,f],i=!0,l=j||0,j=0,k=c.length;for(;c&&l<k;l++)if(c[l].apply(b,f)===!1&&a.stopOnFalse){e=!0;break}i=!1,c&&(a.once?e===!0?o.disable():c=[]:d&&d.length&&(e=d.shift(),o.fireWith(e[0],e[1])))},o={add:function(){if(c){var a=c.length;m(arguments),i?k=c.length:e&&e!==!0&&(j=a,n(e[0],e[1]))}return this},remove:function(){if(c){var b=arguments,d=0,e=b.length;for(;d<e;d++)for(var f=0;f<c.length;f++)if(b[d]===c[f]){i&&f<=k&&(k--,f<=l&&l--),c.splice(f--,1);if(a.unique)break}}return this},has:function(a){if(c){var b=0,d=c.length;for(;b<d;b++)if(a===c[b])return!0}return!1},empty:function(){c=[];return this},disable:function(){c=d=e=b;return this},disabled:function(){return!c},lock:function(){d=b,(!e||e===!0)&&o.disable();return this},locked:function(){return!d},fireWith:function(b,c){d&&(i?a.once||d.push([b,c]):(!a.once||!e)&&n(b,c));return this},fire:function(){o.fireWith(this,arguments);return this},fired:function(){return!!e}};return o};var i=[].slice;f.extend({Deferred:function(a){var b=f.Callbacks("once memory"),c=f.Callbacks("once memory"),d=f.Callbacks("memory"),e="pending",g={resolve:b,reject:c,notify:d},h={done:b.add,fail:c.add,progress:d.add,state:function(){return e},isResolved:b.fired,isRejected:c.fired,then:function(a,b,c){i.done(a).fail(b).progress(c);return this},always:function(){return i.done.apply(i,arguments).fail.apply(i,arguments)},pipe:function(a,b,c){return f.Deferred(function(d){f.each({done:[a,"resolve"],fail:[b,"reject"],progress:[c,"notify"]},function(a,b){var c=b[0],e=b[1],g;f.isFunction(c)?i[a](function(){g=c.apply(this,arguments),g&&f.isFunction(g.promise)?g.promise().then(d.resolve,d.reject,d.notify):d[e+"With"](this===i?d:this,[g])}):i[a](d[e])})}).promise()},promise:function(a){if(a==null)a=h;else for(var b in h)a[b]=h[b];return a}},i=h.promise({}),j;for(j in g)i[j]=g[j].fire,i[j+"With"]=g[j].fireWith;i.done(function(){e="resolved"},c.disable,d.lock).fail(function(){e="rejected"},b.disable,d.lock),a&&a.call(i,i);return i},when:function(a){function m(a){return function(b){e[a]=arguments.length>1?i.call(arguments,0):b,j.notifyWith(k,e)}}function l(a){return function(c){b[a]=arguments.length>1?i.call(arguments,0):c,--g||j.resolveWith(j,b)}}var b=i.call(arguments,0),c=0,d=b.length,e=Array(d),g=d,h=d,j=d<=1&&a&&f.isFunction(a.promise)?a:f.Deferred(),k=j.promise();if(d>1){for(;c<d;c++)b[c]&&b[c].promise&&f.isFunction(b[c].promise)?b[c].promise().then(l(c),j.reject,m(c)):--g;g||j.resolveWith(j,b)}else j!==a&&j.resolveWith(j,d?[a]:[]);return k}}),f.support=function(){var a=c.createElement("div"),b=c.documentElement,d,e,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u;a.setAttribute("className","t"),a.innerHTML=" <link/><table></table><a href='/a' style='top:1px;float:left;opacity:.55;'>a</a><input type='checkbox'/><nav></nav>",d=a.getElementsByTagName("*"),e=a.getElementsByTagName("a")[0];if(!d||!d.length||!e)return{};g=c.createElement("select"),h=g.appendChild(c.createElement("option")),i=a.getElementsByTagName("input")[0],k={leadingWhitespace:a.firstChild.nodeType===3,tbody:!a.getElementsByTagName("tbody").length,htmlSerialize:!!a.getElementsByTagName("link").length,style:/top/.test(e.getAttribute("style")),hrefNormalized:e.getAttribute("href")==="/a",opacity:/^0.55/.test(e.style.opacity),cssFloat:!!e.style.cssFloat,unknownElems:!!a.getElementsByTagName("nav").length,checkOn:i.value==="on",optSelected:h.selected,getSetAttribute:a.className!=="t",enctype:!!c.createElement("form").enctype,submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0},i.checked=!0,k.noCloneChecked=i.cloneNode(!0).checked,g.disabled=!0,k.optDisabled=!h.disabled;try{delete a.test}catch(v){k.deleteExpando=!1}!a.addEventListener&&a.attachEvent&&a.fireEvent&&(a.attachEvent("onclick",function(){k.noCloneEvent=!1}),a.cloneNode(!0).fireEvent("onclick")),i=c.createElement("input"),i.value="t",i.setAttribute("type","radio"),k.radioValue=i.value==="t",i.setAttribute("checked","checked"),a.appendChild(i),l=c.createDocumentFragment(),l.appendChild(a.lastChild),k.checkClone=l.cloneNode(!0).cloneNode(!0).lastChild.checked,a.innerHTML="",a.style.width=a.style.paddingLeft="1px",m=c.getElementsByTagName("body")[0],o=c.createElement(m?"div":"body"),p={visibility:"hidden",width:0,height:0,border:0,margin:0,background:"none"},m&&f.extend(p,{position:"absolute",left:"-999px",top:"-999px"});for(t in p)o.style[t]=p[t];o.appendChild(a),n=m||b,n.insertBefore(o,n.firstChild),k.appendChecked=i.checked,k.boxModel=a.offsetWidth===2,"zoom"in a.style&&(a.style.display="inline",a.style.zoom=1,k.inlineBlockNeedsLayout=a.offsetWidth===2,a.style.display="",a.innerHTML="<div style='width:4px;'></div>",k.shrinkWrapBlocks=a.offsetWidth!==2),a.innerHTML="<table><tr><td style='padding:0;border:0;display:none'></td><td>t</td></tr></table>",q=a.getElementsByTagName("td"),u=q[0].offsetHeight===0,q[0].style.display="",q[1].style.display="none",k.reliableHiddenOffsets=u&&q[0].offsetHeight===0,a.innerHTML="",c.defaultView&&c.defaultView.getComputedStyle&&(j=c.createElement("div"),j.style.width="0",j.style.marginRight="0",a.appendChild(j),k.reliableMarginRight=(parseInt((c.defaultView.getComputedStyle(j,null)||{marginRight:0}).marginRight,10)||0)===0);if(a.attachEvent)for(t in{submit:1,change:1,focusin:1})s="on"+t,u=s in a,u||(a.setAttribute(s,"return;"),u=typeof a[s]=="function"),k[t+"Bubbles"]=u;f(function(){var a,b,d,e,g,h,i=1,j="position:absolute;top:0;left:0;width:1px;height:1px;margin:0;",l="visibility:hidden;border:0;",n="style='"+j+"border:5px solid #000;padding:0;'",p="<div "+n+"><div></div></div>"+"<table "+n+" cellpadding='0' cellspacing='0'>"+"<tr><td></td></tr></table>";m=c.getElementsByTagName("body")[0];!m||(a=c.createElement("div"),a.style.cssText=l+"width:0;height:0;position:static;top:0;margin-top:"+i+"px",m.insertBefore(a,m.firstChild),o=c.createElement("div"),o.style.cssText=j+l,o.innerHTML=p,a.appendChild(o),b=o.firstChild,d=b.firstChild,g=b.nextSibling.firstChild.firstChild,h={doesNotAddBorder:d.offsetTop!==5,doesAddBorderForTableAndCells:g.offsetTop===5},d.style.position="fixed",d.style.top="20px",h.fixedPosition=d.offsetTop===20||d.offsetTop===15,d.style.position=d.style.top="",b.style.overflow="hidden",b.style.position="relative",h.subtractsBorderForOverflowNotVisible=d.offsetTop===-5,h.doesNotIncludeMarginInBodyOffset=m.offsetTop!==i,m.removeChild(a),o=a=null,f.extend(k,h))}),o.innerHTML="",n.removeChild(o),o=l=g=h=m=j=a=i=null;return k}(),f.boxModel=f.support.boxModel;var j=/^(?:\{.*\}|\[.*\])$/,k=/([A-Z])/g;f.extend({cache:{},uuid:0,expando:"jQuery"+(f.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(a){a=a.nodeType?f.cache[a[f.expando]]:a[f.expando];return!!a&&!m(a)},data:function(a,c,d,e){if(!!f.acceptData(a)){var g,h,i,j=f.expando,k=typeof c=="string",l=a.nodeType,m=l?f.cache:a,n=l?a[f.expando]:a[f.expando]&&f.expando,o=c==="events";if((!n||!m[n]||!o&&!e&&!m[n].data)&&k&&d===b)return;n||(l?a[f.expando]=n=++f.uuid:n=f.expando),m[n]||(m[n]={},l||(m[n].toJSON=f.noop));if(typeof c=="object"||typeof c=="function")e?m[n]=f.extend(m[n],c):m[n].data=f.extend(m[n].data,c);g=h=m[n],e||(h.data||(h.data={}),h=h.data),d!==b&&(h[f.camelCase(c)]=d);if(o&&!h[c])return g.events;k?(i=h[c],i==null&&(i=h[f.camelCase(c)])):i=h;return i}},removeData:function(a,b,c){if(!!f.acceptData(a)){var d,e,g,h=f.expando,i=a.nodeType,j=i?f.cache:a,k=i?a[f.expando]:f.expando;if(!j[k])return;if(b){d=c?j[k]:j[k].data;if(d){f.isArray(b)?b=b:b in d?b=[b]:(b=f.camelCase(b),b in d?b=[b]:b=b.split(" "));for(e=0,g=b.length;e<g;e++)delete d[b[e]];if(!(c?m:f.isEmptyObject)(d))return}}if(!c){delete j[k].data;if(!m(j[k]))return}f.support.deleteExpando||!j.setInterval?delete j[k]:j[k]=null,i&&(f.support.deleteExpando?delete a[f.expando]:a.removeAttribute?a.removeAttribute(f.expando):a[f.expando]=null)}},_data:function(a,b,c){return f.data(a,b,c,!0)},acceptData:function(a){if(a.nodeName){var b=f.noData[a.nodeName.toLowerCase()];if(b)return b!==!0&&a.getAttribute("classid")===b}return!0}}),f.fn.extend({data:function(a,c){var d,e,g,h=null;if(typeof a=="undefined"){if(this.length){h=f.data(this[0]);if(this[0].nodeType===1&&!f._data(this[0],"parsedAttrs")){e=this[0].attributes;for(var i=0,j=e.length;i<j;i++)g=e[i].name,g.indexOf("data-")===0&&(g=f.camelCase(g.substring(5)),l(this[0],g,h[g]));f._data(this[0],"parsedAttrs",!0)}}return h}if(typeof a=="object")return this.each(function(){f.data(this,a)});d=a.split("."),d[1]=d[1]?"."+d[1]:"";if(c===b){h=this.triggerHandler("getData"+d[1]+"!",[d[0]]),h===b&&this.length&&(h=f.data(this[0],a),h=l(this[0],a,h));return h===b&&d[1]?this.data(d[0]):h}return this.each(function(){var b=f(this),e=[d[0],c];b.triggerHandler("setData"+d[1]+"!",e),f.data(this,a,c),b.triggerHandler("changeData"+d[1]+"!",e)})},removeData:function(a){return this.each(function(){f.removeData(this,a)})}}),f.extend({_mark:function(a,b){a&&(b=(b||"fx")+"mark",f._data(a,b,(f._data(a,b)||0)+1))},_unmark:function(a,b,c){a!==!0&&(c=b,b=a,a=!1);if(b){c=c||"fx";var d=c+"mark",e=a?0:(f._data(b,d)||1)-1;e?f._data(b,d,e):(f.removeData(b,d,!0),n(b,c,"mark"))}},queue:function(a,b,c){var d;if(a){b=(b||"fx")+"queue",d=f._data(a,b),c&&(!d||f.isArray(c)?d=f._data(a,b,f.makeArray(c)):d.push(c));return d||[]}},dequeue:function(a,b){b=b||"fx";var c=f.queue(a,b),d=c.shift(),e={};d==="inprogress"&&(d=c.shift()),d&&(b==="fx"&&c.unshift("inprogress"),f._data(a,b+".run",e),d.call(a,function(){f.dequeue(a,b)},e)),c.length||(f.removeData(a,b+"queue "+b+".run",!0),n(a,b,"queue"))}}),f.fn.extend({queue:function(a,c){typeof a!="string"&&(c=a,a="fx");if(c===b)return f.queue(this[0],a);return this.each(function(){var b=f.queue(this,a,c);a==="fx"&&b[0]!=="inprogress"&&f.dequeue(this,a)})},dequeue:function(a){return this.each(function(){f.dequeue(this,a)})},delay:function(a,b){a=f.fx?f.fx.speeds[a]||a:a,b=b||"fx";return this.queue(b,function(b,c){var d=setTimeout(b,a);c.stop=function(){clearTimeout(d)}})},clearQueue:function(a){return this.queue(a||"fx",[])},promise:function(a,c){function m(){--h||d.resolveWith(e,[e])}typeof a!="string"&&(c=a,a=b),a=a||"fx";var d=f.Deferred(),e=this,g=e.length,h=1,i=a+"defer",j=a+"queue",k=a+"mark",l;while(g--)if(l=f.data(e[g],i,b,!0)||(f.data(e[g],j,b,!0)||f.data(e[g],k,b,!0))&&f.data(e[g],i,f.Callbacks("once memory"),!0))h++,l.add(m);m();return d.promise()}});var o=/[\n\t\r]/g,p=/\s+/,q=/\r/g,r=/^(?:button|input)$/i,s=/^(?:button|input|object|select|textarea)$/i,t=/^a(?:rea)?$/i,u=/^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,v=f.support.getSetAttribute,w,x,y;f.fn.extend({attr:function(a,b){return f.access(this,a,b,!0,f.attr)},removeAttr:function(a){return this.each(function(){f.removeAttr(this,a)})},prop:function(a,b){return f.access(this,a,b,!0,f.prop)},removeProp:function(a){a=f.propFix[a]||a;return this.each(function(){try{this[a]=b,delete this[a]}catch(c){}})},addClass:function(a){var b,c,d,e,g,h,i;if(f.isFunction(a))return this.each(function(b){f(this).addClass(a.call(this,b,this.className))});if(a&&typeof a=="string"){b=a.split(p);for(c=0,d=this.length;c<d;c++){e=this[c];if(e.nodeType===1)if(!e.className&&b.length===1)e.className=a;else{g=" "+e.className+" ";for(h=0,i=b.length;h<i;h++)~g.indexOf(" "+b[h]+" ")||(g+=b[h]+" ");e.className=f.trim(g)}}}return this},removeClass:function(a){var c,d,e,g,h,i,j;if(f.isFunction(a))return this.each(function(b){f(this).removeClass(a.call(this,b,this.className))});if(a&&typeof a=="string"||a===b){c=(a||"").split(p);for(d=0,e=this.length;d<e;d++){g=this[d];if(g.nodeType===1&&g.className)if(a){h=(" "+g.className+" ").replace(o," ");for(i=0,j=c.length;i<j;i++)h=h.replace(" "+c[i]+" "," ");g.className=f.trim(h)}else g.className=""}}return this},toggleClass:function(a,b){var c=typeof a,d=typeof b=="boolean";if(f.isFunction(a))return this.each(function(c){f(this).toggleClass(a.call(this,c,this.className,b),b)});return this.each(function(){if(c==="string"){var e,g=0,h=f(this),i=b,j=a.split(p);while(e=j[g++])i=d?i:!h.hasClass(e),h[i?"addClass":"removeClass"](e)}else if(c==="undefined"||c==="boolean")this.className&&f._data(this,"__className__",this.className),this.className=this.className||a===!1?"":f._data(this,"__className__")||""})},hasClass:function(a){var b=" "+a+" ",c=0,d=this.length;for(;c<d;c++)if(this[c].nodeType===1&&(" "+this[c].className+" ").replace(o," ").indexOf(b)>-1)return!0;return!1},val:function(a){var c,d,e,g=this[0];if(!arguments.length){if(g){c=f.valHooks[g.nodeName.toLowerCase()]||f.valHooks[g.type];if(c&&"get"in c&&(d=c.get(g,"value"))!==b)return d;d=g.value;return typeof d=="string"?d.replace(q,""):d==null?"":d}return b}e=f.isFunction(a);return this.each(function(d){var g=f(this),h;if(this.nodeType===1){e?h=a.call(this,d,g.val()):h=a,h==null?h="":typeof h=="number"?h+="":f.isArray(h)&&(h=f.map(h,function(a){return a==null?"":a+""})),c=f.valHooks[this.nodeName.toLowerCase()]||f.valHooks[this.type];if(!c||!("set"in c)||c.set(this,h,"value")===b)this.value=h}})}}),f.extend({valHooks:{option:{get:function(a){var b=a.attributes.value;return!b||b.specified?a.value:a.text}},select:{get:function(a){var b,c,d,e,g=a.selectedIndex,h=[],i=a.options,j=a.type==="select-one";if(g<0)return null;c=j?g:0,d=j?g+1:i.length;for(;c<d;c++){e=i[c];if(e.selected&&(f.support.optDisabled?!e.disabled:e.getAttribute("disabled")===null)&&(!e.parentNode.disabled||!f.nodeName(e.parentNode,"optgroup"))){b=f(e).val();if(j)return b;h.push(b)}}if(j&&!h.length&&i.length)return f(i[g]).val();return h},set:function(a,b){var c=f.makeArray(b);f(a).find("option").each(function(){this.selected=f.inArray(f(this).val(),c)>=0}),c.length||(a.selectedIndex=-1);return c}}},attrFn:{val:!0,css:!0,html:!0,text:!0,data:!0,width:!0,height:!0,offset:!0},attr:function(a,c,d,e){var g,h,i,j=a.nodeType;if(!a||j===3||j===8||j===2)return b;if(e&&c in f.attrFn)return f(a)[c](d);if(!("getAttribute"in a))return f.prop(a,c,d);i=j!==1||!f.isXMLDoc(a),i&&(c=c.toLowerCase(),h=f.attrHooks[c]||(u.test(c)?x:w));if(d!==b){if(d===null){f.removeAttr(a,c);return b}if(h&&"set"in h&&i&&(g=h.set(a,d,c))!==b)return g;a.setAttribute(c,""+d);return d}if(h&&"get"in h&&i&&(g=h.get(a,c))!==null)return g;g=a.getAttribute(c);return g===null?b:g},removeAttr:function(a,b){var c,d,e,g,h=0;if(a.nodeType===1){d=(b||"").split(p),g=d.length;for(;h<g;h++)e=d[h].toLowerCase(),c=f.propFix[e]||e,f.attr(a,e,""),a.removeAttribute(v?e:c),u.test(e)&&c in a&&(a[c]=!1)}},attrHooks:{type:{set:function(a,b){if(r.test(a.nodeName)&&a.parentNode)f.error("type property can't be changed");else if(!f.support.radioValue&&b==="radio"&&f.nodeName(a,"input")){var c=a.value;a.setAttribute("type",b),c&&(a.value=c);return b}}},value:{get:function(a,b){if(w&&f.nodeName(a,"button"))return w.get(a,b);return b in a?a.value:null},set:function(a,b,c){if(w&&f.nodeName(a,"button"))return w.set(a,b,c);a.value=b}}},propFix:{tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},prop:function(a,c,d){var e,g,h,i=a.nodeType;if(!a||i===3||i===8||i===2)return b;h=i!==1||!f.isXMLDoc(a),h&&(c=f.propFix[c]||c,g=f.propHooks[c]);return d!==b?g&&"set"in g&&(e=g.set(a,d,c))!==b?e:a[c]=d:g&&"get"in g&&(e=g.get(a,c))!==null?e:a[c]},propHooks:{tabIndex:{get:function(a){var c=a.getAttributeNode("tabindex");return c&&c.specified?parseInt(c.value,10):s.test(a.nodeName)||t.test(a.nodeName)&&a.href?0:b}}}}),f.attrHooks.tabindex=f.propHooks.tabIndex,x={get:function(a,c){var d,e=f.prop(a,c);return e===!0||typeof e!="boolean"&&(d=a.getAttributeNode(c))&&d.nodeValue!==!1?c.toLowerCase():b},set:function(a,b,c){var d;b===!1?f.removeAttr(a,c):(d=f.propFix[c]||c,d in a&&(a[d]=!0),a.setAttribute(c,c.toLowerCase()));return c}},v||(y={name:!0,id:!0},w=f.valHooks.button={get:function(a,c){var d;d=a.getAttributeNode(c);return d&&(y[c]?d.nodeValue!=="":d.specified)?d.nodeValue:b},set:function(a,b,d){var e=a.getAttributeNode(d);e||(e=c.createAttribute(d),a.setAttributeNode(e));return e.nodeValue=b+""}},f.attrHooks.tabindex.set=w.set,f.each(["width","height"],function(a,b){f.attrHooks[b]=f.extend(f.attrHooks[b],{set:function(a,c){if(c===""){a.setAttribute(b,"auto");return c}}})}),f.attrHooks.contenteditable={get:w.get,set:function(a,b,c){b===""&&(b="false"),w.set(a,b,c)}}),f.support.hrefNormalized||f.each(["href","src","width","height"],function(a,c){f.attrHooks[c]=f.extend(f.attrHooks[c],{get:function(a){var d=a.getAttribute(c,2);return d===null?b:d}})}),f.support.style||(f.attrHooks.style={get:function(a){return a.style.cssText.toLowerCase()||b},set:function(a,b){return a.style.cssText=""+b}}),f.support.optSelected||(f.propHooks.selected=f.extend(f.propHooks.selected,{get:function(a){var b=a.parentNode;b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex);return null}})),f.support.enctype||(f.propFix.enctype="encoding"),f.support.checkOn||f.each(["radio","checkbox"],function(){f.valHooks[this]={get:function(a){return a.getAttribute("value")===null?"on":a.value}}}),f.each(["radio","checkbox"],function(){f.valHooks[this]=f.extend(f.valHooks[this],{set:function(a,b){if(f.isArray(b))return a.checked=f.inArray(f(a).val(),b)>=0}})});var z=/\.(.*)$/,A=/^(?:textarea|input|select)$/i,B=/\./g,C=/ /g,D=/[^\w\s.|`]/g,E=/^([^\.]*)?(?:\.(.+))?$/,F=/\bhover(\.\S+)?/,G=/^key/,H=/^(?:mouse|contextmenu)|click/,I=/^(\w*)(?:#([\w\-]+))?(?:\.([\w\-]+))?$/,J=function(a){var b=I.exec(a);b&&
|
3 |
+
(b[1]=(b[1]||"").toLowerCase(),b[3]=b[3]&&new RegExp("(?:^|\\s)"+b[3]+"(?:\\s|$)"));return b},K=function(a,b){return(!b[1]||a.nodeName.toLowerCase()===b[1])&&(!b[2]||a.id===b[2])&&(!b[3]||b[3].test(a.className))},L=function(a){return f.event.special.hover?a:a.replace(F,"mouseenter$1 mouseleave$1")};f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3||a.nodeType===8||!c||!d||!(h=f._data(a)))){d.handler&&(p=d,d=p.handler),d.guid||(d.guid=f.guid++),j=h.events,j||(h.events=j={}),i=h.handle,i||(h.handle=i=function(a){return typeof f!="undefined"&&(!a||f.event.triggered!==a.type)?f.event.dispatch.apply(i.elem,arguments):b},i.elem=a),c=L(c).split(" ");for(k=0;k<c.length;k++){l=E.exec(c[k])||[],m=l[1],n=(l[2]||"").split(".").sort(),s=f.event.special[m]||{},m=(g?s.delegateType:s.bindType)||m,s=f.event.special[m]||{},o=f.extend({type:m,origType:l[1],data:e,handler:d,guid:d.guid,selector:g,namespace:n.join(".")},p),g&&(o.quick=J(g),!o.quick&&f.expr.match.POS.test(g)&&(o.isPositional=!0)),r=j[m];if(!r){r=j[m]=[],r.delegateCount=0;if(!s.setup||s.setup.call(a,e,n,i)===!1)a.addEventListener?a.addEventListener(m,i,!1):a.attachEvent&&a.attachEvent("on"+m,i)}s.add&&(s.add.call(a,o),o.handler.guid||(o.handler.guid=d.guid)),g?r.splice(r.delegateCount++,0,o):r.push(o),f.event.global[m]=!0}a=null}},global:{},remove:function(a,b,c,d){var e=f.hasData(a)&&f._data(a),g,h,i,j,k,l,m,n,o,p,q;if(!!e&&!!(m=e.events)){b=L(b||"").split(" ");for(g=0;g<b.length;g++){h=E.exec(b[g])||[],i=h[1],j=h[2];if(!i){j=j?"."+j:"";for(l in m)f.event.remove(a,l+j,c,d);return}n=f.event.special[i]||{},i=(d?n.delegateType:n.bindType)||i,p=m[i]||[],k=p.length,j=j?new RegExp("(^|\\.)"+j.split(".").sort().join("\\.(?:.*\\.)?")+"(\\.|$)"):null;if(c||j||d||n.remove)for(l=0;l<p.length;l++){q=p[l];if(!c||c.guid===q.guid)if(!j||j.test(q.namespace))if(!d||d===q.selector||d==="**"&&q.selector)p.splice(l--,1),q.selector&&p.delegateCount--,n.remove&&n.remove.call(a,q)}else p.length=0;p.length===0&&k!==p.length&&((!n.teardown||n.teardown.call(a,j)===!1)&&f.removeEvent(a,i,e.handle),delete m[i])}f.isEmptyObject(m)&&(o=e.handle,o&&(o.elem=null),f.removeData(a,["events","handle"],!0))}},customEvent:{getData:!0,setData:!0,changeData:!0},trigger:function(c,d,e,g){if(!e||e.nodeType!==3&&e.nodeType!==8){var h=c.type||c,i=[],j,k,l,m,n,o,p,q,r,s;h.indexOf("!")>=0&&(h=h.slice(0,-1),k=!0),h.indexOf(".")>=0&&(i=h.split("."),h=i.shift(),i.sort());if((!e||f.event.customEvent[h])&&!f.event.global[h])return;c=typeof c=="object"?c[f.expando]?c:new f.Event(h,c):new f.Event(h),c.type=h,c.isTrigger=!0,c.exclusive=k,c.namespace=i.join("."),c.namespace_re=c.namespace?new RegExp("(^|\\.)"+i.join("\\.(?:.*\\.)?")+"(\\.|$)"):null,o=h.indexOf(":")<0?"on"+h:"",(g||!e)&&c.preventDefault();if(!e){j=f.cache;for(l in j)j[l].events&&j[l].events[h]&&f.event.trigger(c,d,j[l].handle.elem,!0);return}c.result=b,c.target||(c.target=e),d=d!=null?f.makeArray(d):[],d.unshift(c),p=f.event.special[h]||{};if(p.trigger&&p.trigger.apply(e,d)===!1)return;r=[[e,p.bindType||h]];if(!g&&!p.noBubble&&!f.isWindow(e)){s=p.delegateType||h,n=null;for(m=e.parentNode;m;m=m.parentNode)r.push([m,s]),n=m;n&&n===e.ownerDocument&&r.push([n.defaultView||n.parentWindow||a,s])}for(l=0;l<r.length;l++){m=r[l][0],c.type=r[l][1],q=(f._data(m,"events")||{})[c.type]&&f._data(m,"handle"),q&&q.apply(m,d),q=o&&m[o],q&&f.acceptData(m)&&q.apply(m,d);if(c.isPropagationStopped())break}c.type=h,c.isDefaultPrevented()||(!p._default||p._default.apply(e.ownerDocument,d)===!1)&&(h!=="click"||!f.nodeName(e,"a"))&&f.acceptData(e)&&o&&e[h]&&(h!=="focus"&&h!=="blur"||c.target.offsetWidth!==0)&&!f.isWindow(e)&&(n=e[o],n&&(e[o]=null),f.event.triggered=h,e[h](),f.event.triggered=b,n&&(e[o]=n));return c.result}},dispatch:function(c){c=f.event.fix(c||a.event);var d=(f._data(this,"events")||{})[c.type]||[],e=d.delegateCount,g=[].slice.call(arguments,0),h=!c.exclusive&&!c.namespace,i=(f.event.special[c.type]||{}).handle,j=[],k,l,m,n,o,p,q,r,s,t,u;g[0]=c,c.delegateTarget=this;if(e&&!c.target.disabled&&(!c.button||c.type!=="click"))for(m=c.target;m!=this;m=m.parentNode||this){o={},q=[];for(k=0;k<e;k++)r=d[k],s=r.selector,t=o[s],r.isPositional?t=(t||(o[s]=f(s))).index(m)>=0:t===b&&(t=o[s]=r.quick?K(m,r.quick):f(m).is(s)),t&&q.push(r);q.length&&j.push({elem:m,matches:q})}d.length>e&&j.push({elem:this,matches:d.slice(e)});for(k=0;k<j.length&&!c.isPropagationStopped();k++){p=j[k],c.currentTarget=p.elem;for(l=0;l<p.matches.length&&!c.isImmediatePropagationStopped();l++){r=p.matches[l];if(h||!c.namespace&&!r.namespace||c.namespace_re&&c.namespace_re.test(r.namespace))c.data=r.data,c.handleObj=r,n=(i||r.handler).apply(p.elem,g),n!==b&&(c.result=n,n===!1&&(c.preventDefault(),c.stopPropagation()))}}return c.result},props:"attrChange attrName relatedNode srcElement altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(a,b){a.which==null&&(a.which=b.charCode!=null?b.charCode:b.keyCode);return a}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement wheelDelta".split(" "),filter:function(a,d){var e,f,g,h=d.button,i=d.fromElement;a.pageX==null&&d.clientX!=null&&(e=a.target.ownerDocument||c,f=e.documentElement,g=e.body,a.pageX=d.clientX+(f&&f.scrollLeft||g&&g.scrollLeft||0)-(f&&f.clientLeft||g&&g.clientLeft||0),a.pageY=d.clientY+(f&&f.scrollTop||g&&g.scrollTop||0)-(f&&f.clientTop||g&&g.clientTop||0)),!a.relatedTarget&&i&&(a.relatedTarget=i===a.target?d.toElement:i),!a.which&&h!==b&&(a.which=h&1?1:h&2?3:h&4?2:0);return a}},fix:function(a){if(a[f.expando])return a;var d,e,g=a,h=f.event.fixHooks[a.type]||{},i=h.props?this.props.concat(h.props):this.props;a=f.Event(g);for(d=i.length;d;)e=i[--d],a[e]=g[e];a.target||(a.target=g.srcElement||c),a.target.nodeType===3&&(a.target=a.target.parentNode),a.metaKey===b&&(a.metaKey=a.ctrlKey);return h.filter?h.filter(a,g):a},special:{ready:{setup:f.bindReady},focus:{delegateType:"focusin",noBubble:!0},blur:{delegateType:"focusout",noBubble:!0},beforeunload:{setup:function(a,b,c){f.isWindow(this)&&(this.onbeforeunload=c)},teardown:function(a,b){this.onbeforeunload===b&&(this.onbeforeunload=null)}}},simulate:function(a,b,c,d){var e=f.extend(new f.Event,c,{type:a,isSimulated:!0,originalEvent:{}});d?f.event.trigger(e,null,b):f.event.dispatch.call(b,e),e.isDefaultPrevented()&&c.preventDefault()}},f.event.handle=f.event.dispatch,f.removeEvent=c.removeEventListener?function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c,!1)}:function(a,b,c){a.detachEvent&&a.detachEvent("on"+b,c)},f.Event=function(a,b){if(!(this instanceof f.Event))return new f.Event(a,b);a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||a.returnValue===!1||a.getPreventDefault&&a.getPreventDefault()?N:M):this.type=a,b&&f.extend(this,b),this.timeStamp=a&&a.timeStamp||f.now(),this[f.expando]=!0},f.Event.prototype={preventDefault:function(){this.isDefaultPrevented=N;var a=this.originalEvent;!a||(a.preventDefault?a.preventDefault():a.returnValue=!1)},stopPropagation:function(){this.isPropagationStopped=N;var a=this.originalEvent;!a||(a.stopPropagation&&a.stopPropagation(),a.cancelBubble=!0)},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=N,this.stopPropagation()},isDefaultPrevented:M,isPropagationStopped:M,isImmediatePropagationStopped:M},f.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(a,b){f.event.special[a]=f.event.special[b]={delegateType:b,bindType:b,handle:function(a){var b=this,c=a.relatedTarget,d=a.handleObj,e=d.selector,g,h;if(!c||d.origType===a.type||c!==b&&!f.contains(b,c))g=a.type,a.type=d.origType,h=d.handler.apply(this,arguments),a.type=g;return h}}}),f.support.submitBubbles||(f.event.special.submit={setup:function(){if(f.nodeName(this,"form"))return!1;f.event.add(this,"click._submit keypress._submit",function(a){var c=a.target,d=f.nodeName(c,"input")||f.nodeName(c,"button")?c.form:b;d&&!d._submit_attached&&(f.event.add(d,"submit._submit",function(a){this.parentNode&&f.event.simulate("submit",this.parentNode,a,!0)}),d._submit_attached=!0)})},teardown:function(){if(f.nodeName(this,"form"))return!1;f.event.remove(this,"._submit")}}),f.support.changeBubbles||(f.event.special.change={setup:function(){if(A.test(this.nodeName)){if(this.type==="checkbox"||this.type==="radio")f.event.add(this,"propertychange._change",function(a){a.originalEvent.propertyName==="checked"&&(this._just_changed=!0)}),f.event.add(this,"click._change",function(a){this._just_changed&&(this._just_changed=!1,f.event.simulate("change",this,a,!0))});return!1}f.event.add(this,"beforeactivate._change",function(a){var b=a.target;A.test(b.nodeName)&&!b._change_attached&&(f.event.add(b,"change._change",function(a){this.parentNode&&!a.isSimulated&&f.event.simulate("change",this.parentNode,a,!0)}),b._change_attached=!0)})},handle:function(a){var b=a.target;if(this!==b||a.isSimulated||a.isTrigger||b.type!=="radio"&&b.type!=="checkbox")return a.handleObj.handler.apply(this,arguments)},teardown:function(){f.event.remove(this,"._change");return A.test(this.nodeName)}}),f.support.focusinBubbles||f.each({focus:"focusin",blur:"focusout"},function(a,b){var d=0,e=function(a){f.event.simulate(b,a.target,f.event.fix(a),!0)};f.event.special[b]={setup:function(){d++===0&&c.addEventListener(a,e,!0)},teardown:function(){--d===0&&c.removeEventListener(a,e,!0)}}}),f.fn.extend({on:function(a,c,d,e,g){var h,i;if(typeof a=="object"){typeof c!="string"&&(d=c,c=b);for(i in a)this.on(i,c,d,a[i],g);return this}d==null&&e==null?(e=c,d=c=b):e==null&&(typeof c=="string"?(e=d,d=b):(e=d,d=c,c=b));if(e===!1)e=M;else if(!e)return this;g===1&&(h=e,e=function(a){f().off(a);return h.apply(this,arguments)},e.guid=h.guid||(h.guid=f.guid++));return this.each(function(){f.event.add(this,a,e,d,c)})},one:function(a,b,c,d){return this.on.call(this,a,b,c,d,1)},off:function(a,c,d){if(a&&a.preventDefault&&a.handleObj){var e=a.handleObj;f(a.delegateTarget).off(e.namespace?e.type+"."+e.namespace:e.type,e.selector,e.handler);return this}if(typeof a=="object"){for(var g in a)this.off(g,c,a[g]);return this}if(c===!1||typeof c=="function")d=c,c=b;d===!1&&(d=M);return this.each(function(){f.event.remove(this,a,d,c)})},bind:function(a,b,c){return this.on(a,null,b,c)},unbind:function(a,b){return this.off(a,null,b)},live:function(a,b,c){f(this.context).on(a,this.selector,b,c);return this},die:function(a,b){f(this.context).off(a,this.selector||"**",b);return this},delegate:function(a,b,c,d){return this.on(b,a,c,d)},undelegate:function(a,b,c){return arguments.length==1?this.off(a,"**"):this.off(b,a,c)},trigger:function(a,b){return this.each(function(){f.event.trigger(a,b,this)})},triggerHandler:function(a,b){if(this[0])return f.event.trigger(a,b,this[0],!0)},toggle:function(a){var b=arguments,c=a.guid||f.guid++,d=0,e=function(c){var e=(f._data(this,"lastToggle"+a.guid)||0)%d;f._data(this,"lastToggle"+a.guid,e+1),c.preventDefault();return b[e].apply(this,arguments)||!1};e.guid=c;while(d<b.length)b[d++].guid=c;return this.click(e)},hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}}),f.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(a,b){f.fn[b]=function(a,c){c==null&&(c=a,a=null);return arguments.length>0?this.bind(b,a,c):this.trigger(b)},f.attrFn&&(f.attrFn[b]=!0),G.test(b)&&(f.event.fixHooks[b]=f.event.keyHooks),H.test(b)&&(f.event.fixHooks[b]=f.event.mouseHooks)}),function(){function x(a,b,c,e,f,g){for(var h=0,i=e.length;h<i;h++){var j=e[h];if(j){var k=!1;j=j[a];while(j){if(j[d]===c){k=e[j.sizset];break}if(j.nodeType===1){g||(j[d]=c,j.sizset=h);if(typeof b!="string"){if(j===b){k=!0;break}}else if(m.filter(b,[j]).length>0){k=j;break}}j=j[a]}e[h]=k}}}function w(a,b,c,e,f,g){for(var h=0,i=e.length;h<i;h++){var j=e[h];if(j){var k=!1;j=j[a];while(j){if(j[d]===c){k=e[j.sizset];break}j.nodeType===1&&!g&&(j[d]=c,j.sizset=h);if(j.nodeName.toLowerCase()===b){k=j;break}j=j[a]}e[h]=k}}}var a=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,d="sizcache"+(Math.random()+"").replace(".",""),e=0,g=Object.prototype.toString,h=!1,i=!0,j=/\\/g,k=/\r\n/g,l=/\W/;[0,0].sort(function(){i=!1;return 0});var m=function(b,d,e,f){e=e||[],d=d||c;var h=d;if(d.nodeType!==1&&d.nodeType!==9)return[];if(!b||typeof b!="string")return e;var i,j,k,l,n,q,r,t,u=!0,v=m.isXML(d),w=[],x=b;do{a.exec(""),i=a.exec(x);if(i){x=i[3],w.push(i[1]);if(i[2]){l=i[3];break}}}while(i);if(w.length>1&&p.exec(b))if(w.length===2&&o.relative[w[0]])j=y(w[0]+w[1],d,f);else{j=o.relative[w[0]]?[d]:m(w.shift(),d);while(w.length)b=w.shift(),o.relative[b]&&(b+=w.shift()),j=y(b,j,f)}else{!f&&w.length>1&&d.nodeType===9&&!v&&o.match.ID.test(w[0])&&!o.match.ID.test(w[w.length-1])&&(n=m.find(w.shift(),d,v),d=n.expr?m.filter(n.expr,n.set)[0]:n.set[0]);if(d){n=f?{expr:w.pop(),set:s(f)}:m.find(w.pop(),w.length===1&&(w[0]==="~"||w[0]==="+")&&d.parentNode?d.parentNode:d,v),j=n.expr?m.filter(n.expr,n.set):n.set,w.length>0?k=s(j):u=!1;while(w.length)q=w.pop(),r=q,o.relative[q]?r=w.pop():q="",r==null&&(r=d),o.relative[q](k,r,v)}else k=w=[]}k||(k=j),k||m.error(q||b);if(g.call(k)==="[object Array]")if(!u)e.push.apply(e,k);else if(d&&d.nodeType===1)for(t=0;k[t]!=null;t++)k[t]&&(k[t]===!0||k[t].nodeType===1&&m.contains(d,k[t]))&&e.push(j[t]);else for(t=0;k[t]!=null;t++)k[t]&&k[t].nodeType===1&&e.push(j[t]);else s(k,e);l&&(m(l,h,e,f),m.uniqueSort(e));return e};m.uniqueSort=function(a){if(u){h=i,a.sort(u);if(h)for(var b=1;b<a.length;b++)a[b]===a[b-1]&&a.splice(b--,1)}return a},m.matches=function(a,b){return m(a,null,null,b)},m.matchesSelector=function(a,b){return m(b,null,null,[a]).length>0},m.find=function(a,b,c){var d,e,f,g,h,i;if(!a)return[];for(e=0,f=o.order.length;e<f;e++){h=o.order[e];if(g=o.leftMatch[h].exec(a)){i=g[1],g.splice(1,1);if(i.substr(i.length-1)!=="\\"){g[1]=(g[1]||"").replace(j,""),d=o.find[h](g,b,c);if(d!=null){a=a.replace(o.match[h],"");break}}}}d||(d=typeof b.getElementsByTagName!="undefined"?b.getElementsByTagName("*"):[]);return{set:d,expr:a}},m.filter=function(a,c,d,e){var f,g,h,i,j,k,l,n,p,q=a,r=[],s=c,t=c&&c[0]&&m.isXML(c[0]);while(a&&c.length){for(h in o.filter)if((f=o.leftMatch[h].exec(a))!=null&&f[2]){k=o.filter[h],l=f[1],g=!1,f.splice(1,1);if(l.substr(l.length-1)==="\\")continue;s===r&&(r=[]);if(o.preFilter[h]){f=o.preFilter[h](f,s,d,r,e,t);if(!f)g=i=!0;else if(f===!0)continue}if(f)for(n=0;(j=s[n])!=null;n++)j&&(i=k(j,f,n,s),p=e^i,d&&i!=null?p?g=!0:s[n]=!1:p&&(r.push(j),g=!0));if(i!==b){d||(s=r),a=a.replace(o.match[h],"");if(!g)return[];break}}if(a===q)if(g==null)m.error(a);else break;q=a}return s},m.error=function(a){throw"Syntax error, unrecognized expression: "+a};var n=m.getText=function(a){var b,c,d=a.nodeType,e="";if(d){if(d===1){if(typeof a.textContent=="string")return a.textContent;if(typeof a.innerText=="string")return a.innerText.replace(k,"");for(a=a.firstChild;a;a=a.nextSibling)e+=n(a)}else if(d===3||d===4)return a.nodeValue}else for(b=0;c=a[b];b++)c.nodeType!==8&&(e+=n(c));return e},o=m.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(?:(['"])(.*?)\3|(#?(?:[\w\u00c0-\uFFFF\-]|\\.)*)|)|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\(\s*(even|odd|(?:[+\-]?\d+|(?:[+\-]?\d*)?n\s*(?:[+\-]\s*\d+)?))\s*\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/},leftMatch:{},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(a){return a.getAttribute("href")},type:function(a){return a.getAttribute("type")}},relative:{"+":function(a,b){var c=typeof b=="string",d=c&&!l.test(b),e=c&&!d;d&&(b=b.toLowerCase());for(var f=0,g=a.length,h;f<g;f++)if(h=a[f]){while((h=h.previousSibling)&&h.nodeType!==1);a[f]=e||h&&h.nodeName.toLowerCase()===b?h||!1:h===b}e&&m.filter(b,a,!0)},">":function(a,b){var c,d=typeof b=="string",e=0,f=a.length;if(d&&!l.test(b)){b=b.toLowerCase();for(;e<f;e++){c=a[e];if(c){var g=c.parentNode;a[e]=g.nodeName.toLowerCase()===b?g:!1}}}else{for(;e<f;e++)c=a[e],c&&(a[e]=d?c.parentNode:c.parentNode===b);d&&m.filter(b,a,!0)}},"":function(a,b,c){var d,f=e++,g=x;typeof b=="string"&&!l.test(b)&&(b=b.toLowerCase(),d=b,g=w),g("parentNode",b,f,a,d,c)},"~":function(a,b,c){var d,f=e++,g=x;typeof b=="string"&&!l.test(b)&&(b=b.toLowerCase(),d=b,g=w),g("previousSibling",b,f,a,d,c)}},find:{ID:function(a,b,c){if(typeof b.getElementById!="undefined"&&!c){var d=b.getElementById(a[1]);return d&&d.parentNode?[d]:[]}},NAME:function(a,b){if(typeof b.getElementsByName!="undefined"){var c=[],d=b.getElementsByName(a[1]);for(var e=0,f=d.length;e<f;e++)d[e].getAttribute("name")===a[1]&&c.push(d[e]);return c.length===0?null:c}},TAG:function(a,b){if(typeof b.getElementsByTagName!="undefined")return b.getElementsByTagName(a[1])}},preFilter:{CLASS:function(a,b,c,d,e,f){a=" "+a[1].replace(j,"")+" ";if(f)return a;for(var g=0,h;(h=b[g])!=null;g++)h&&(e^(h.className&&(" "+h.className+" ").replace(/[\t\n\r]/g," ").indexOf(a)>=0)?c||d.push(h):c&&(b[g]=!1));return!1},ID:function(a){return a[1].replace(j,"")},TAG:function(a,b){return a[1].replace(j,"").toLowerCase()},CHILD:function(a){if(a[1]==="nth"){a[2]||m.error(a[0]),a[2]=a[2].replace(/^\+|\s*/g,"");var b=/(-?)(\d*)(?:n([+\-]?\d*))?/.exec(a[2]==="even"&&"2n"||a[2]==="odd"&&"2n+1"||!/\D/.test(a[2])&&"0n+"+a[2]||a[2]);a[2]=b[1]+(b[2]||1)-0,a[3]=b[3]-0}else a[2]&&m.error(a[0]);a[0]=e++;return a},ATTR:function(a,b,c,d,e,f){var g=a[1]=a[1].replace(j,"");!f&&o.attrMap[g]&&(a[1]=o.attrMap[g]),a[4]=(a[4]||a[5]||"").replace(j,""),a[2]==="~="&&(a[4]=" "+a[4]+" ");return a},PSEUDO:function(b,c,d,e,f){if(b[1]==="not")if((a.exec(b[3])||"").length>1||/^\w/.test(b[3]))b[3]=m(b[3],null,null,c);else{var g=m.filter(b[3],c,d,!0^f);d||e.push.apply(e,g);return!1}else if(o.match.POS.test(b[0])||o.match.CHILD.test(b[0]))return!0;return b},POS:function(a){a.unshift(!0);return a}},filters:{enabled:function(a){return a.disabled===!1&&a.type!=="hidden"},disabled:function(a){return a.disabled===!0},checked:function(a){return a.checked===!0},selected:function(a){a.parentNode&&a.parentNode.selectedIndex;return a.selected===!0},parent:function(a){return!!a.firstChild},empty:function(a){return!a.firstChild},has:function(a,b,c){return!!m(c[3],a).length},header:function(a){return/h\d/i.test(a.nodeName)},text:function(a){var b=a.getAttribute("type"),c=a.type;return a.nodeName.toLowerCase()==="input"&&"text"===c&&(b===c||b===null)},radio:function(a){return a.nodeName.toLowerCase()==="input"&&"radio"===a.type},checkbox:function(a){return a.nodeName.toLowerCase()==="input"&&"checkbox"===a.type},file:function(a){return a.nodeName.toLowerCase()==="input"&&"file"===a.type},password:function(a){return a.nodeName.toLowerCase()==="input"&&"password"===a.type},submit:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"submit"===a.type},image:function(a){return a.nodeName.toLowerCase()==="input"&&"image"===a.type},reset:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"reset"===a.type},button:function(a){var b=a.nodeName.toLowerCase();return b==="input"&&"button"===a.type||b==="button"},input:function(a){return/input|select|textarea|button/i.test(a.nodeName)},focus:function(a){return a===a.ownerDocument.activeElement}},setFilters:{first:function(a,b){return b===0},last:function(a,b,c,d){return b===d.length-1},even:function(a,b){return b%2===0},odd:function(a,b){return b%2===1},lt:function(a,b,c){return b<c[3]-0},gt:function(a,b,c){return b>c[3]-0},nth:function(a,b,c){return c[3]-0===b},eq:function(a,b,c){return c[3]-0===b}},filter:{PSEUDO:function(a,b,c,d){var e=b[1],f=o.filters[e];if(f)return f(a,c,b,d);if(e==="contains")return(a.textContent||a.innerText||n([a])||"").indexOf(b[3])>=0;if(e==="not"){var g=b[3];for(var h=0,i=g.length;h<i;h++)if(g[h]===a)return!1;return!0}m.error(e)},CHILD:function(a,b){var c,e,f,g,h,i,j,k=b[1],l=a;switch(k){case"only":case"first":while(l=l.previousSibling)if(l.nodeType===1)return!1;if(k==="first")return!0;l=a;case"last":while(l=l.nextSibling)if(l.nodeType===1)return!1;return!0;case"nth":c=b[2],e=b[3];if(c===1&&e===0)return!0;f=b[0],g=a.parentNode;if(g&&(g[d]!==f||!a.nodeIndex)){i=0;for(l=g.firstChild;l;l=l.nextSibling)l.nodeType===1&&(l.nodeIndex=++i);g[d]=f}j=a.nodeIndex-e;return c===0?j===0:j%c===0&&j/c>=0}},ID:function(a,b){return a.nodeType===1&&a.getAttribute("id")===b},TAG:function(a,b){return b==="*"&&a.nodeType===1||!!a.nodeName&&a.nodeName.toLowerCase()===b},CLASS:function(a,b){return(" "+(a.className||a.getAttribute("class"))+" ").indexOf(b)>-1},ATTR:function(a,b){var c=b[1],d=m.attr?m.attr(a,c):o.attrHandle[c]?o.attrHandle[c](a):a[c]!=null?a[c]:a.getAttribute(c),e=d+"",f=b[2],g=b[4];return d==null?f==="!=":!f&&m.attr?d!=null:f==="="?e===g:f==="*="?e.indexOf(g)>=0:f==="~="?(" "+e+" ").indexOf(g)>=0:g?f==="!="?e!==g:f==="^="?e.indexOf(g)===0:f==="$="?e.substr(e.length-g.length)===g:f==="|="?e===g||e.substr(0,g.length+1)===g+"-":!1:e&&d!==!1},POS:function(a,b,c,d){var e=b[2],f=o.setFilters[e];if(f)return f(a,c,b,d)}}},p=o.match.POS,q=function(a,b){return"\\"+(b-0+1)};for(var r in o.match)o.match[r]=new RegExp(o.match[r].source+/(?![^\[]*\])(?![^\(]*\))/.source),o.leftMatch[r]=new RegExp(/(^(?:.|\r|\n)*?)/.source+o.match[r].source.replace(/\\(\d+)/g,q));var s=function(a,b){a=Array.prototype.slice.call(a,0);if(b){b.push.apply(b,a);return b}return a};try{Array.prototype.slice.call(c.documentElement.childNodes,0)[0].nodeType}catch(t){s=function(a,b){var c=0,d=b||[];if(g.call(a)==="[object Array]")Array.prototype.push.apply(d,a);else if(typeof a.length=="number")for(var e=a.length;c<e;c++)d.push(a[c]);else for(;a[c];c++)d.push(a[c]);return d}}var u,v;c.documentElement.compareDocumentPosition?u=function(a,b){if(a===b){h=!0;return 0}if(!a.compareDocumentPosition||!b.compareDocumentPosition)return a.compareDocumentPosition?-1:1;return a.compareDocumentPosition(b)&4?-1:1}:(u=function(a,b){if(a===b){h=!0;return 0}if(a.sourceIndex&&b.sourceIndex)return a.sourceIndex-b.sourceIndex;var c,d,e=[],f=[],g=a.parentNode,i=b.parentNode,j=g;if(g===i)return v(a,b);if(!g)return-1;if(!i)return 1;while(j)e.unshift(j),j=j.parentNode;j=i;while(j)f.unshift(j),j=j.parentNode;c=e.length,d=f.length;for(var k=0;k<c&&k<d;k++)if(e[k]!==f[k])return v(e[k],f[k]);return k===c?v(a,f[k],-1):v(e[k],b,1)},v=function(a,b,c){if(a===b)return c;var d=a.nextSibling;while(d){if(d===b)return-1;d=d.nextSibling}return 1}),function(){var a=c.createElement("div"),d="script"+(new Date).getTime(),e=c.documentElement;a.innerHTML="<a name='"+d+"'/>",e.insertBefore(a,e.firstChild),c.getElementById(d)&&(o.find.ID=function(a,c,d){if(typeof c.getElementById!="undefined"&&!d){var e=c.getElementById(a[1]);return e?e.id===a[1]||typeof e.getAttributeNode!="undefined"&&e.getAttributeNode("id").nodeValue===a[1]?[e]:b:[]}},o.filter.ID=function(a,b){var c=typeof a.getAttributeNode!="undefined"&&a.getAttributeNode("id");return a.nodeType===1&&c&&c.nodeValue===b}),e.removeChild(a),e=a=null}(),function(){var a=c.createElement("div");a.appendChild(c.createComment("")),a.getElementsByTagName("*").length>0&&(o.find.TAG=function(a,b){var c=b.getElementsByTagName(a[1]);if(a[1]==="*"){var d=[];for(var e=0;c[e];e++)c[e].nodeType===1&&d.push(c[e]);c=d}return c}),a.innerHTML="<a href='#'></a>",a.firstChild&&typeof a.firstChild.getAttribute!="undefined"&&a.firstChild.getAttribute("href")!=="#"&&(o.attrHandle.href=function(a){return a.getAttribute("href",2)}),a=null}(),c.querySelectorAll&&function(){var a=m,b=c.createElement("div"),d="__sizzle__";b.innerHTML="<p class='TEST'></p>";if(!b.querySelectorAll||b.querySelectorAll(".TEST").length!==0){m=function(b,e,f,g){e=e||c;if(!g&&!m.isXML(e)){var h=/^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(b);if(h&&(e.nodeType===1||e.nodeType===9)){if(h[1])return s(e.getElementsByTagName(b),f);if(h[2]&&o.find.CLASS&&e.getElementsByClassName)return s(e.getElementsByClassName(h[2]),f)}if(e.nodeType===9){if(b==="body"&&e.body)return s([e.body],f);if(h&&h[3]){var i=e.getElementById(h[3]);if(!i||!i.parentNode)return s([],f);if(i.id===h[3])return s([i],f)}try{return s(e.querySelectorAll(b),f)}catch(j){}}else if(e.nodeType===1&&e.nodeName.toLowerCase()!=="object"){var k=e,l=e.getAttribute("id"),n=l||d,p=e.parentNode,q=/^\s*[+~]/.test(b);l?n=n.replace(/'/g,"\\$&"):e.setAttribute("id",n),q&&p&&(e=e.parentNode);try{if(!q||p)return s(e.querySelectorAll("[id='"+n+"'] "+b),f)}catch(r){}finally{l||k.removeAttribute("id")}}}return a(b,e,f,g)};for(var e in a)m[e]=a[e];b=null}}(),function(){var a=c.documentElement,b=a.matchesSelector||a.mozMatchesSelector||a.webkitMatchesSelector||a.msMatchesSelector;if(b){var d=!b.call(c.createElement("div"),"div"),e=!1;try{b.call(c.documentElement,"[test!='']:sizzle")}catch(f){e=!0}m.matchesSelector=function(a,c){c=c.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!m.isXML(a))try{if(e||!o.match.PSEUDO.test(c)&&!/!=/.test(c)){var f=b.call(a,c);if(f||!d||a.document&&a.document.nodeType!==11)return f}}catch(g){}return m(c,null,null,[a]).length>0}}}(),function(){var a=c.createElement("div");a.innerHTML="<div class='test e'></div><div class='test'></div>";if(!!a.getElementsByClassName&&a.getElementsByClassName("e").length!==0){a.lastChild.className="e";if(a.getElementsByClassName("e").length===1)return;o.order.splice(1,0,"CLASS"),o.find.CLASS=function(a,b,c){if(typeof b.getElementsByClassName!="undefined"&&!c)return b.getElementsByClassName(a[1])},a=null}}(),c.documentElement.contains?m.contains=function(a,b){return a!==b&&(a.contains?a.contains(b):!0)}:c.documentElement.compareDocumentPosition?m.contains=function(a,b){return!!(a.compareDocumentPosition(b)&16)}:m.contains=function(){return!1},m.isXML=function(a){var b=(a?a.ownerDocument||a:0).documentElement;return b?b.nodeName!=="HTML":!1};var y=function(a,b,c){var d,e=[],f="",g=b.nodeType?[b]:b;while(d=o.match.PSEUDO.exec(a))f+=d[0],a=a.replace(o.match.PSEUDO,"");a=o.relative[a]?a+"*":a;for(var h=0,i=g.length;h<i;h++)m(a,g[h],e,c);return m.filter(f,e)};m.attr=f.attr,m.selectors.attrMap={},f.find=m,f.expr=m.selectors,f.expr[":"]=f.expr.filters,f.unique=m.uniqueSort,f.text=m.getText,f.isXMLDoc=m.isXML,f.contains=m.contains}();var O=/Until$/,P=/^(?:parents|prevUntil|prevAll)/,Q=/,/,R=/^.[^:#\[\.,]*$/,S=Array.prototype.slice,T=f.expr.match.POS,U={children:!0,contents:!0,next:!0,prev:!0};f.fn.extend({find:function(a){var b=this,c,d;if(typeof a!="string")return f(a).filter(function(){for(c=0,d=b.length;c<d;c++)if(f.contains(b[c],this))return!0});var e=this.pushStack("","find",a),g,h,i;for(c=0,d=this.length;c<d;c++){g=e.length,f.find(a,this[c],e);if(c>0)for(h=g;h<e.length;h++)for(i=0;i<g;i++)if(e[i]===e[h]){e.splice(h--,1);break}}return e},has:function(a){var b=f(a);return this.filter(function(){for(var a=0,c=b.length;a<c;a++)if(f.contains(this,b[a]))return!0})},not:function(a){return this.pushStack(W(this,a,!1),"not",a)},filter:function(a){return this.pushStack(W(this,a,!0),"filter",a)},is:function(a){return!!a&&(typeof a=="string"?T.test(a)?f(a,this.context).index(this[0])>=0:f.filter(a,this).length>0:this.filter(a).length>0)},closest:function(a,b){var c=[],d,e,g=this[0];if(f.isArray(a)){var h=1;while(g&&g.ownerDocument&&g!==b){for(d=0;d<a.length;d++)f(g).is(a[d])&&c.push({selector:a[d],elem:g,level:h});g=g.parentNode,h++}return c}var i=T.test(a)||typeof a!="string"?f(a,b||this.context):0;for(d=0,e=this.length;d<e;d++){g=this[d];while(g){if(i?i.index(g)>-1:f.find.matchesSelector(g,a)){c.push(g);break}g=g.parentNode;if(!g||!g.ownerDocument||g===b||g.nodeType===11)break}}c=c.length>1?f.unique(c):c;return this.pushStack(c,"closest",a)},index:function(a){if(!a)return this[0]&&this[0].parentNode?this.prevAll().length:-1;if(typeof a=="string")return f.inArray(this[0],f(a));return f.inArray(a.jquery?a[0]:a,this)},add:function(a,b){var c=typeof a=="string"?f(a,b):f.makeArray(a&&a.nodeType?[a]:a),d=f.merge(this.get(),c);return this.pushStack(V(c[0])||V(d[0])?d:f.unique(d))},andSelf:function(){return this.add(this.prevObject)}}),f.each({parent:function(a){var b=a.parentNode;return b&&b.nodeType!==11?b:null},parents:function(a){return f.dir(a,"parentNode")},parentsUntil:function(a,b,c){return f.dir(a,"parentNode",c)},next:function(a){return f.nth(a,2,"nextSibling")},prev:function(a){return f.nth(a,2,"previousSibling")},nextAll:function(a){return f.dir(a,"nextSibling")},prevAll:function(a){return f.dir(a,"previousSibling")},nextUntil:function(a,b,c){return f.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return f.dir(a,"previousSibling",c)},siblings:function(a){return f.sibling(a.parentNode.firstChild,a)},children:function(a){return f.sibling(a.firstChild)},contents:function(a){return f.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:f.makeArray(a.childNodes)}},function(a,b){f.fn[a]=function(c,d){var e=f.map(this,b,c),g=S.call(arguments);O.test(a)||(d=c),d&&typeof d=="string"&&(e=f.filter(d,e)),e=this.length>1&&!U[a]?f.unique(e):e,(this.length>1||Q.test(d))&&P.test(a)&&(e=e.reverse());return this.pushStack(e,a,g.join(","))}}),f.extend({filter:function(a,b,c){c&&(a=":not("+a+")");return b.length===1?f.find.matchesSelector(b[0],a)?[b[0]]:[]:f.find.matches(a,b)},dir:function(a,c,d){var e=[],g=a[c];while(g&&g.nodeType!==9&&(d===b||g.nodeType!==1||!f(g).is(d)))g.nodeType===1&&e.push(g),g=g[c];return e},nth:function(a,b,c,d){b=b||1;var e=0;for(;a;a=a[c])if(a.nodeType===1&&++e===b)break;return a},sibling:function(a,b){var c=[];for(;a;a=a.nextSibling)a.nodeType===1&&a!==b&&c.push(a);return c}});var Y="abbr article aside audio canvas datalist details figcaption figure footer header hgroup mark meter nav output progress section summary time video",Z=/ jQuery\d+="(?:\d+|null)"/g,$=/^\s+/,_=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,ba=/<([\w:]+)/,bb=/<tbody/i,bc=/<|&#?\w+;/,bd=/<(?:script|style)/i,be=/<(?:script|object|embed|option|style)/i,bf=new RegExp("<(?:"+Y.replace(" ","|")+")","i"),bg=/checked\s*(?:[^=]|=\s*.checked.)/i,bh=/\/(java|ecma)script/i,bi=/^\s*<!(?:\[CDATA\[|\-\-)/,bj={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],area:[1,"<map>","</map>"],_default:[0,"",""]},bk=X(c);bj.optgroup=bj.option,bj.tbody=bj.tfoot=bj.colgroup=bj.caption=bj.thead,bj.th=bj.td,f.support.htmlSerialize||(bj._default=[1,"div<div>","</div>"]),f.fn.extend({text:function(a){if(f.isFunction(a))return this.each(function(b){var c=f(this);c.text(a.call(this,b,c.text()))});if(typeof a!="object"&&a!==b)return this.empty().append((this[0]&&this[0].ownerDocument||c).createTextNode(a));return f.text(this)},wrapAll:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapAll(a.call(this,b))});if(this[0]){var b=f(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&a.firstChild.nodeType===1)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapInner(a.call(this,b))});return this.each(function(){var b=f(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){return this.each(function(){f(this).wrapAll(a)})},unwrap:function(){return this.parent().each(function(){f.nodeName(this,"body")||f(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this)});if(arguments.length){var a=f(arguments[0]);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this.nextSibling)});if(arguments.length){var a=this.pushStack(this,"after"
|
4 |
+
,arguments);a.push.apply(a,f(arguments[0]).toArray());return a}},remove:function(a,b){for(var c=0,d;(d=this[c])!=null;c++)if(!a||f.filter(a,[d]).length)!b&&d.nodeType===1&&(f.cleanData(d.getElementsByTagName("*")),f.cleanData([d])),d.parentNode&&d.parentNode.removeChild(d);return this},empty:function(){for(var a=0,b;(b=this[a])!=null;a++){b.nodeType===1&&f.cleanData(b.getElementsByTagName("*"));while(b.firstChild)b.removeChild(b.firstChild)}return this},clone:function(a,b){a=a==null?!1:a,b=b==null?a:b;return this.map(function(){return f.clone(this,a,b)})},html:function(a){if(a===b)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(Z,""):null;if(typeof a=="string"&&!bd.test(a)&&(f.support.leadingWhitespace||!$.test(a))&&!bj[(ba.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(_,"<$1></$2>");try{for(var c=0,d=this.length;c<d;c++)this[c].nodeType===1&&(f.cleanData(this[c].getElementsByTagName("*")),this[c].innerHTML=a)}catch(e){this.empty().append(a)}}else f.isFunction(a)?this.each(function(b){var c=f(this);c.html(a.call(this,b,c.html()))}):this.empty().append(a);return this},replaceWith:function(a){if(this[0]&&this[0].parentNode){if(f.isFunction(a))return this.each(function(b){var c=f(this),d=c.html();c.replaceWith(a.call(this,b,d))});typeof a!="string"&&(a=f(a).detach());return this.each(function(){var b=this.nextSibling,c=this.parentNode;f(this).remove(),b?f(b).before(a):f(c).append(a)})}return this.length?this.pushStack(f(f.isFunction(a)?a():a),"replaceWith",a):this},detach:function(a){return this.remove(a,!0)},domManip:function(a,c,d){var e,g,h,i,j=a[0],k=[];if(!f.support.checkClone&&arguments.length===3&&typeof j=="string"&&bg.test(j))return this.each(function(){f(this).domManip(a,c,d,!0)});if(f.isFunction(j))return this.each(function(e){var g=f(this);a[0]=j.call(this,e,c?g.html():b),g.domManip(a,c,d)});if(this[0]){i=j&&j.parentNode,f.support.parentNode&&i&&i.nodeType===11&&i.childNodes.length===this.length?e={fragment:i}:e=f.buildFragment(a,this,k),h=e.fragment,h.childNodes.length===1?g=h=h.firstChild:g=h.firstChild;if(g){c=c&&f.nodeName(g,"tr");for(var l=0,m=this.length,n=m-1;l<m;l++)d.call(c?bl(this[l],g):this[l],e.cacheable||m>1&&l<n?f.clone(h,!0,!0):h)}k.length&&f.each(k,br)}return this}}),f.buildFragment=function(a,b,d){var e,g,h,i,j=a[0];b&&b[0]&&(i=b[0].ownerDocument||b[0]),i.createDocumentFragment||(i=c),a.length===1&&typeof j=="string"&&j.length<512&&i===c&&j.charAt(0)==="<"&&!be.test(j)&&(f.support.checkClone||!bg.test(j))&&!f.support.unknownElems&&bf.test(j)&&(g=!0,h=f.fragments[j],h&&h!==1&&(e=h)),e||(e=i.createDocumentFragment(),f.clean(a,i,e,d)),g&&(f.fragments[j]=h?e:1);return{fragment:e,cacheable:g}},f.fragments={},f.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){f.fn[a]=function(c){var d=[],e=f(c),g=this.length===1&&this[0].parentNode;if(g&&g.nodeType===11&&g.childNodes.length===1&&e.length===1){e[b](this[0]);return this}for(var h=0,i=e.length;h<i;h++){var j=(h>0?this.clone(!0):this).get();f(e[h])[b](j),d=d.concat(j)}return this.pushStack(d,a,e.selector)}}),f.extend({clone:function(a,b,c){var d=a.cloneNode(!0),e,g,h;if((!f.support.noCloneEvent||!f.support.noCloneChecked)&&(a.nodeType===1||a.nodeType===11)&&!f.isXMLDoc(a)){bn(a,d),e=bo(a),g=bo(d);for(h=0;e[h];++h)g[h]&&bn(e[h],g[h])}if(b){bm(a,d);if(c){e=bo(a),g=bo(d);for(h=0;e[h];++h)bm(e[h],g[h])}}e=g=null;return d},clean:function(a,b,d,e){var g;b=b||c,typeof b.createElement=="undefined"&&(b=b.ownerDocument||b[0]&&b[0].ownerDocument||c);var h=[],i;for(var j=0,k;(k=a[j])!=null;j++){typeof k=="number"&&(k+="");if(!k)continue;if(typeof k=="string")if(!bc.test(k))k=b.createTextNode(k);else{k=k.replace(_,"<$1></$2>");var l=(ba.exec(k)||["",""])[1].toLowerCase(),m=bj[l]||bj._default,n=m[0],o=b.createElement("div");b===c?bk.appendChild(o):X(b).appendChild(o),o.innerHTML=m[1]+k+m[2];while(n--)o=o.lastChild;if(!f.support.tbody){var p=bb.test(k),q=l==="table"&&!p?o.firstChild&&o.firstChild.childNodes:m[1]==="<table>"&&!p?o.childNodes:[];for(i=q.length-1;i>=0;--i)f.nodeName(q[i],"tbody")&&!q[i].childNodes.length&&q[i].parentNode.removeChild(q[i])}!f.support.leadingWhitespace&&$.test(k)&&o.insertBefore(b.createTextNode($.exec(k)[0]),o.firstChild),k=o.childNodes}var r;if(!f.support.appendChecked)if(k[0]&&typeof (r=k.length)=="number")for(i=0;i<r;i++)bq(k[i]);else bq(k);k.nodeType?h.push(k):h=f.merge(h,k)}if(d){g=function(a){return!a.type||bh.test(a.type)};for(j=0;h[j];j++)if(e&&f.nodeName(h[j],"script")&&(!h[j].type||h[j].type.toLowerCase()==="text/javascript"))e.push(h[j].parentNode?h[j].parentNode.removeChild(h[j]):h[j]);else{if(h[j].nodeType===1){var s=f.grep(h[j].getElementsByTagName("script"),g);h.splice.apply(h,[j+1,0].concat(s))}d.appendChild(h[j])}}return h},cleanData:function(a){var b,c,d=f.cache,e=f.event.special,g=f.support.deleteExpando;for(var h=0,i;(i=a[h])!=null;h++){if(i.nodeName&&f.noData[i.nodeName.toLowerCase()])continue;c=i[f.expando];if(c){b=d[c];if(b&&b.events){for(var j in b.events)e[j]?f.event.remove(i,j):f.removeEvent(i,j,b.handle);b.handle&&(b.handle.elem=null)}g?delete i[f.expando]:i.removeAttribute&&i.removeAttribute(f.expando),delete d[c]}}}});var bs=/alpha\([^)]*\)/i,bt=/opacity=([^)]*)/,bu=/([A-Z]|^ms)/g,bv=/^-?\d+(?:px)?$/i,bw=/^-?\d/,bx=/^([\-+])=([\-+.\de]+)/,by={position:"absolute",visibility:"hidden",display:"block"},bz=["Left","Right"],bA=["Top","Bottom"],bB,bC,bD;f.fn.css=function(a,c){if(arguments.length===2&&c===b)return this;return f.access(this,a,c,!0,function(a,c,d){return d!==b?f.style(a,c,d):f.css(a,c)})},f.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=bB(a,"opacity","opacity");return c===""?"1":c}return a.style.opacity}}},cssNumber:{fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":f.support.cssFloat?"cssFloat":"styleFloat"},style:function(a,c,d,e){if(!!a&&a.nodeType!==3&&a.nodeType!==8&&!!a.style){var g,h,i=f.camelCase(c),j=a.style,k=f.cssHooks[i];c=f.cssProps[i]||i;if(d===b){if(k&&"get"in k&&(g=k.get(a,!1,e))!==b)return g;return j[c]}h=typeof d,h==="string"&&(g=bx.exec(d))&&(d=+(g[1]+1)*+g[2]+parseFloat(f.css(a,c)),h="number");if(d==null||h==="number"&&isNaN(d))return;h==="number"&&!f.cssNumber[i]&&(d+="px");if(!k||!("set"in k)||(d=k.set(a,d))!==b)try{j[c]=d}catch(l){}}},css:function(a,c,d){var e,g;c=f.camelCase(c),g=f.cssHooks[c],c=f.cssProps[c]||c,c==="cssFloat"&&(c="float");if(g&&"get"in g&&(e=g.get(a,!0,d))!==b)return e;if(bB)return bB(a,c)},swap:function(a,b,c){var d={};for(var e in b)d[e]=a.style[e],a.style[e]=b[e];c.call(a);for(e in b)a.style[e]=d[e]}}),f.curCSS=f.css,f.each(["height","width"],function(a,b){f.cssHooks[b]={get:function(a,c,d){var e;if(c){if(a.offsetWidth!==0)return bE(a,b,d);f.swap(a,by,function(){e=bE(a,b,d)});return e}},set:function(a,b){if(!bv.test(b))return b;b=parseFloat(b);if(b>=0)return b+"px"}}}),f.support.opacity||(f.cssHooks.opacity={get:function(a,b){return bt.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?parseFloat(RegExp.$1)/100+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle,e=f.isNumeric(b)?"alpha(opacity="+b*100+")":"",g=d&&d.filter||c.filter||"";c.zoom=1;if(b>=1&&f.trim(g.replace(bs,""))===""){c.removeAttribute("filter");if(d&&!d.filter)return}c.filter=bs.test(g)?g.replace(bs,e):g+" "+e}}),f(function(){f.support.reliableMarginRight||(f.cssHooks.marginRight={get:function(a,b){var c;f.swap(a,{display:"inline-block"},function(){b?c=bB(a,"margin-right","marginRight"):c=a.style.marginRight});return c}})}),c.defaultView&&c.defaultView.getComputedStyle&&(bC=function(a,c){var d,e,g;c=c.replace(bu,"-$1").toLowerCase();if(!(e=a.ownerDocument.defaultView))return b;if(g=e.getComputedStyle(a,null))d=g.getPropertyValue(c),d===""&&!f.contains(a.ownerDocument.documentElement,a)&&(d=f.style(a,c));return d}),c.documentElement.currentStyle&&(bD=function(a,b){var c,d,e,f=a.currentStyle&&a.currentStyle[b],g=a.style;f===null&&g&&(e=g[b])&&(f=e),!bv.test(f)&&bw.test(f)&&(c=g.left,d=a.runtimeStyle&&a.runtimeStyle.left,d&&(a.runtimeStyle.left=a.currentStyle.left),g.left=b==="fontSize"?"1em":f||0,f=g.pixelLeft+"px",g.left=c,d&&(a.runtimeStyle.left=d));return f===""?"auto":f}),bB=bC||bD,f.expr&&f.expr.filters&&(f.expr.filters.hidden=function(a){var b=a.offsetWidth,c=a.offsetHeight;return b===0&&c===0||!f.support.reliableHiddenOffsets&&(a.style&&a.style.display||f.css(a,"display"))==="none"},f.expr.filters.visible=function(a){return!f.expr.filters.hidden(a)});var bF=/%20/g,bG=/\[\]$/,bH=/\r?\n/g,bI=/#.*$/,bJ=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,bK=/^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,bL=/^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,bM=/^(?:GET|HEAD)$/,bN=/^\/\//,bO=/\?/,bP=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,bQ=/^(?:select|textarea)/i,bR=/\s+/,bS=/([?&])_=[^&]*/,bT=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,bU=f.fn.load,bV={},bW={},bX,bY,bZ=["*/"]+["*"];try{bX=e.href}catch(b$){bX=c.createElement("a"),bX.href="",bX=bX.href}bY=bT.exec(bX.toLowerCase())||[],f.fn.extend({load:function(a,c,d){if(typeof a!="string"&&bU)return bU.apply(this,arguments);if(!this.length)return this;var e=a.indexOf(" ");if(e>=0){var g=a.slice(e,a.length);a=a.slice(0,e)}var h="GET";c&&(f.isFunction(c)?(d=c,c=b):typeof c=="object"&&(c=f.param(c,f.ajaxSettings.traditional),h="POST"));var i=this;f.ajax({url:a,type:h,dataType:"html",data:c,complete:function(a,b,c){c=a.responseText,a.isResolved()&&(a.done(function(a){c=a}),i.html(g?f("<div>").append(c.replace(bP,"")).find(g):c)),d&&i.each(d,[c,b,a])}});return this},serialize:function(){return f.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?f.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||bQ.test(this.nodeName)||bK.test(this.type))}).map(function(a,b){var c=f(this).val();return c==null?null:f.isArray(c)?f.map(c,function(a,c){return{name:b.name,value:a.replace(bH,"\r\n")}}):{name:b.name,value:c.replace(bH,"\r\n")}}).get()}}),f.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){f.fn[b]=function(a){return this.bind(b,a)}}),f.each(["get","post"],function(a,c){f[c]=function(a,d,e,g){f.isFunction(d)&&(g=g||e,e=d,d=b);return f.ajax({type:c,url:a,data:d,success:e,dataType:g})}}),f.extend({getScript:function(a,c){return f.get(a,b,c,"script")},getJSON:function(a,b,c){return f.get(a,b,c,"json")},ajaxSetup:function(a,b){b?cb(a,f.ajaxSettings):(b=a,a=f.ajaxSettings),cb(a,b);return a},ajaxSettings:{url:bX,isLocal:bL.test(bY[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":bZ},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":a.String,"text html":!0,"text json":f.parseJSON,"text xml":f.parseXML},flatOptions:{context:!0,url:!0}},ajaxPrefilter:b_(bV),ajaxTransport:b_(bW),ajax:function(a,c){function w(a,c,l,m){if(s!==2){s=2,q&&clearTimeout(q),p=b,n=m||"",v.readyState=a>0?4:0;var o,r,u,w=c,x=l?cd(d,v,l):b,y,z;if(a>=200&&a<300||a===304){if(d.ifModified){if(y=v.getResponseHeader("Last-Modified"))f.lastModified[k]=y;if(z=v.getResponseHeader("Etag"))f.etag[k]=z}if(a===304)w="notmodified",o=!0;else try{r=ce(d,x),w="success",o=!0}catch(A){w="parsererror",u=A}}else{u=w;if(!w||a)w="error",a<0&&(a=0)}v.status=a,v.statusText=""+(c||w),o?h.resolveWith(e,[r,w,v]):h.rejectWith(e,[v,w,u]),v.statusCode(j),j=b,t&&g.trigger("ajax"+(o?"Success":"Error"),[v,d,o?r:u]),i.fireWith(e,[v,w]),t&&(g.trigger("ajaxComplete",[v,d]),--f.active||f.event.trigger("ajaxStop"))}}typeof a=="object"&&(c=a,a=b),c=c||{};var d=f.ajaxSetup({},c),e=d.context||d,g=e!==d&&(e.nodeType||e instanceof f)?f(e):f.event,h=f.Deferred(),i=f.Callbacks("once memory"),j=d.statusCode||{},k,l={},m={},n,o,p,q,r,s=0,t,u,v={readyState:0,setRequestHeader:function(a,b){if(!s){var c=a.toLowerCase();a=m[c]=m[c]||a,l[a]=b}return this},getAllResponseHeaders:function(){return s===2?n:null},getResponseHeader:function(a){var c;if(s===2){if(!o){o={};while(c=bJ.exec(n))o[c[1].toLowerCase()]=c[2]}c=o[a.toLowerCase()]}return c===b?null:c},overrideMimeType:function(a){s||(d.mimeType=a);return this},abort:function(a){a=a||"abort",p&&p.abort(a),w(0,a);return this}};h.promise(v),v.success=v.done,v.error=v.fail,v.complete=i.add,v.statusCode=function(a){if(a){var b;if(s<2)for(b in a)j[b]=[j[b],a[b]];else b=a[v.status],v.then(b,b)}return this},d.url=((a||d.url)+"").replace(bI,"").replace(bN,bY[1]+"//"),d.dataTypes=f.trim(d.dataType||"*").toLowerCase().split(bR),d.crossDomain==null&&(r=bT.exec(d.url.toLowerCase()),d.crossDomain=!(!r||r[1]==bY[1]&&r[2]==bY[2]&&(r[3]||(r[1]==="http:"?80:443))==(bY[3]||(bY[1]==="http:"?80:443)))),d.data&&d.processData&&typeof d.data!="string"&&(d.data=f.param(d.data,d.traditional)),ca(bV,d,c,v);if(s===2)return!1;t=d.global,d.type=d.type.toUpperCase(),d.hasContent=!bM.test(d.type),t&&f.active++===0&&f.event.trigger("ajaxStart");if(!d.hasContent){d.data&&(d.url+=(bO.test(d.url)?"&":"?")+d.data,delete d.data),k=d.url;if(d.cache===!1){var x=f.now(),y=d.url.replace(bS,"$1_="+x);d.url=y+(y===d.url?(bO.test(d.url)?"&":"?")+"_="+x:"")}}(d.data&&d.hasContent&&d.contentType!==!1||c.contentType)&&v.setRequestHeader("Content-Type",d.contentType),d.ifModified&&(k=k||d.url,f.lastModified[k]&&v.setRequestHeader("If-Modified-Since",f.lastModified[k]),f.etag[k]&&v.setRequestHeader("If-None-Match",f.etag[k])),v.setRequestHeader("Accept",d.dataTypes[0]&&d.accepts[d.dataTypes[0]]?d.accepts[d.dataTypes[0]]+(d.dataTypes[0]!=="*"?", "+bZ+"; q=0.01":""):d.accepts["*"]);for(u in d.headers)v.setRequestHeader(u,d.headers[u]);if(d.beforeSend&&(d.beforeSend.call(e,v,d)===!1||s===2)){v.abort();return!1}for(u in{success:1,error:1,complete:1})v[u](d[u]);p=ca(bW,d,c,v);if(!p)w(-1,"No Transport");else{v.readyState=1,t&&g.trigger("ajaxSend",[v,d]),d.async&&d.timeout>0&&(q=setTimeout(function(){v.abort("timeout")},d.timeout));try{s=1,p.send(l,w)}catch(z){s<2?w(-1,z):f.error(z)}}return v},param:function(a,c){var d=[],e=function(a,b){b=f.isFunction(b)?b():b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};c===b&&(c=f.ajaxSettings.traditional);if(f.isArray(a)||a.jquery&&!f.isPlainObject(a))f.each(a,function(){e(this.name,this.value)});else for(var g in a)cc(g,a[g],c,e);return d.join("&").replace(bF,"+")}}),f.extend({active:0,lastModified:{},etag:{}});var cf=f.now(),cg=/(\=)\?(&|$)|\?\?/i;f.ajaxSetup({jsonp:"callback",jsonpCallback:function(){return f.expando+"_"+cf++}}),f.ajaxPrefilter("json jsonp",function(b,c,d){var e=b.contentType==="application/x-www-form-urlencoded"&&typeof b.data=="string";if(b.dataTypes[0]==="jsonp"||b.jsonp!==!1&&(cg.test(b.url)||e&&cg.test(b.data))){var g,h=b.jsonpCallback=f.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,i=a[h],j=b.url,k=b.data,l="$1"+h+"$2";b.jsonp!==!1&&(j=j.replace(cg,l),b.url===j&&(e&&(k=k.replace(cg,l)),b.data===k&&(j+=(/\?/.test(j)?"&":"?")+b.jsonp+"="+h))),b.url=j,b.data=k,a[h]=function(a){g=[a]},d.always(function(){a[h]=i,g&&f.isFunction(i)&&a[h](g[0])}),b.converters["script json"]=function(){g||f.error(h+" was not called");return g[0]},b.dataTypes[0]="json";return"script"}}),f.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(a){f.globalEval(a);return a}}}),f.ajaxPrefilter("script",function(a){a.cache===b&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),f.ajaxTransport("script",function(a){if(a.crossDomain){var d,e=c.head||c.getElementsByTagName("head")[0]||c.documentElement;return{send:function(f,g){d=c.createElement("script"),d.async="async",a.scriptCharset&&(d.charset=a.scriptCharset),d.src=a.url,d.onload=d.onreadystatechange=function(a,c){if(c||!d.readyState||/loaded|complete/.test(d.readyState))d.onload=d.onreadystatechange=null,e&&d.parentNode&&e.removeChild(d),d=b,c||g(200,"success")},e.insertBefore(d,e.firstChild)},abort:function(){d&&d.onload(0,1)}}}});var ch=a.ActiveXObject?function(){for(var a in cj)cj[a](0,1)}:!1,ci=0,cj;f.ajaxSettings.xhr=a.ActiveXObject?function(){return!this.isLocal&&ck()||cl()}:ck,function(a){f.extend(f.support,{ajax:!!a,cors:!!a&&"withCredentials"in a})}(f.ajaxSettings.xhr()),f.support.ajax&&f.ajaxTransport(function(c){if(!c.crossDomain||f.support.cors){var d;return{send:function(e,g){var h=c.xhr(),i,j;c.username?h.open(c.type,c.url,c.async,c.username,c.password):h.open(c.type,c.url,c.async);if(c.xhrFields)for(j in c.xhrFields)h[j]=c.xhrFields[j];c.mimeType&&h.overrideMimeType&&h.overrideMimeType(c.mimeType),!c.crossDomain&&!e["X-Requested-With"]&&(e["X-Requested-With"]="XMLHttpRequest");try{for(j in e)h.setRequestHeader(j,e[j])}catch(k){}h.send(c.hasContent&&c.data||null),d=function(a,e){var j,k,l,m,n;try{if(d&&(e||h.readyState===4)){d=b,i&&(h.onreadystatechange=f.noop,ch&&delete cj[i]);if(e)h.readyState!==4&&h.abort();else{j=h.status,l=h.getAllResponseHeaders(),m={},n=h.responseXML,n&&n.documentElement&&(m.xml=n),m.text=h.responseText;try{k=h.statusText}catch(o){k=""}!j&&c.isLocal&&!c.crossDomain?j=m.text?200:404:j===1223&&(j=204)}}}catch(p){e||g(-1,p)}m&&g(j,k,m,l)},!c.async||h.readyState===4?d():(i=++ci,ch&&(cj||(cj={},f(a).unload(ch)),cj[i]=d),h.onreadystatechange=d)},abort:function(){d&&d(0,1)}}}});var cm={},cn,co,cp=/^(?:toggle|show|hide)$/,cq=/^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,cr,cs=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]],ct;f.fn.extend({show:function(a,b,c){var d,e;if(a||a===0)return this.animate(cw("show",3),a,b,c);for(var g=0,h=this.length;g<h;g++)d=this[g],d.style&&(e=d.style.display,!f._data(d,"olddisplay")&&e==="none"&&(e=d.style.display=""),e===""&&f.css(d,"display")==="none"&&f._data(d,"olddisplay",cx(d.nodeName)));for(g=0;g<h;g++){d=this[g];if(d.style){e=d.style.display;if(e===""||e==="none")d.style.display=f._data(d,"olddisplay")||""}}return this},hide:function(a,b,c){if(a||a===0)return this.animate(cw("hide",3),a,b,c);var d,e,g=0,h=this.length;for(;g<h;g++)d=this[g],d.style&&(e=f.css(d,"display"),e!=="none"&&!f._data(d,"olddisplay")&&f._data(d,"olddisplay",e));for(g=0;g<h;g++)this[g].style&&(this[g].style.display="none");return this},_toggle:f.fn.toggle,toggle:function(a,b,c){var d=typeof a=="boolean";f.isFunction(a)&&f.isFunction(b)?this._toggle.apply(this,arguments):a==null||d?this.each(function(){var b=d?a:f(this).is(":hidden");f(this)[b?"show":"hide"]()}):this.animate(cw("toggle",3),a,b,c);return this},fadeTo:function(a,b,c,d){return this.filter(":hidden").css("opacity",0).show().end().animate({opacity:b},a,c,d)},animate:function(a,b,c,d){function g(){e.queue===!1&&f._mark(this);var b=f.extend({},e),c=this.nodeType===1,d=c&&f(this).is(":hidden"),g,h,i,j,k,l,m,n,o;b.animatedProperties={};for(i in a){g=f.camelCase(i),i!==g&&(a[g]=a[i],delete a[i]),h=a[g],f.isArray(h)?(b.animatedProperties[g]=h[1],h=a[g]=h[0]):b.animatedProperties[g]=b.specialEasing&&b.specialEasing[g]||b.easing||"swing";if(h==="hide"&&d||h==="show"&&!d)return b.complete.call(this);c&&(g==="height"||g==="width")&&(b.overflow=[this.style.overflow,this.style.overflowX,this.style.overflowY],f.css(this,"display")==="inline"&&f.css(this,"float")==="none"&&(!f.support.inlineBlockNeedsLayout||cx(this.nodeName)==="inline"?this.style.display="inline-block":this.style.zoom=1))}b.overflow!=null&&(this.style.overflow="hidden");for(i in a)j=new f.fx(this,b,i),h=a[i],cp.test(h)?(o=f._data(this,"toggle"+i)||(h==="toggle"?d?"show":"hide":0),o?(f._data(this,"toggle"+i,o==="show"?"hide":"show"),j[o]()):j[h]()):(k=cq.exec(h),l=j.cur(),k?(m=parseFloat(k[2]),n=k[3]||(f.cssNumber[i]?"":"px"),n!=="px"&&(f.style(this,i,(m||1)+n),l=(m||1)/j.cur()*l,f.style(this,i,l+n)),k[1]&&(m=(k[1]==="-="?-1:1)*m+l),j.custom(l,m,n)):j.custom(l,h,""));return!0}var e=f.speed(b,c,d);if(f.isEmptyObject(a))return this.each(e.complete,[!1]);a=f.extend({},a);return e.queue===!1?this.each(g):this.queue(e.queue,g)},stop:function(a,c,d){typeof a!="string"&&(d=c,c=a,a=b),c&&a!==!1&&this.queue(a||"fx",[]);return this.each(function(){function h(a,b,c){var e=b[c];f.removeData(a,c,!0),e.stop(d)}var b,c=!1,e=f.timers,g=f._data(this);d||f._unmark(!0,this);if(a==null)for(b in g)g[b].stop&&b.indexOf(".run")===b.length-4&&h(this,g,b);else g[b=a+".run"]&&g[b].stop&&h(this,g,b);for(b=e.length;b--;)e[b].elem===this&&(a==null||e[b].queue===a)&&(d?e[b](!0):e[b].saveState(),c=!0,e.splice(b,1));(!d||!c)&&f.dequeue(this,a)})}}),f.each({slideDown:cw("show",1),slideUp:cw("hide",1),slideToggle:cw("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){f.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),f.extend({speed:function(a,b,c){var d=a&&typeof a=="object"?f.extend({},a):{complete:c||!c&&b||f.isFunction(a)&&a,duration:a,easing:c&&b||b&&!f.isFunction(b)&&b};d.duration=f.fx.off?0:typeof d.duration=="number"?d.duration:d.duration in f.fx.speeds?f.fx.speeds[d.duration]:f.fx.speeds._default;if(d.queue==null||d.queue===!0)d.queue="fx";d.old=d.complete,d.complete=function(a){f.isFunction(d.old)&&d.old.call(this),d.queue?f.dequeue(this,d.queue):a!==!1&&f._unmark(this)};return d},easing:{linear:function(a,b,c,d){return c+d*a},swing:function(a,b,c,d){return(-Math.cos(a*Math.PI)/2+.5)*d+c}},timers:[],fx:function(a,b,c){this.options=b,this.elem=a,this.prop=c,b.orig=b.orig||{}}}),f.fx.prototype={update:function(){this.options.step&&this.options.step.call(this.elem,this.now,this),(f.fx.step[this.prop]||f.fx.step._default)(this)},cur:function(){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null))return this.elem[this.prop];var a,b=f.css(this.elem,this.prop);return isNaN(a=parseFloat(b))?!b||b==="auto"?0:b:a},custom:function(a,c,d){function h(a){return e.step(a)}var e=this,g=f.fx;this.startTime=ct||cu(),this.end=c,this.now=this.start=a,this.pos=this.state=0,this.unit=d||this.unit||(f.cssNumber[this.prop]?"":"px"),h.queue=this.options.queue,h.elem=this.elem,h.saveState=function(){e.options.hide&&f._data(e.elem,"fxshow"+e.prop)===b&&f._data(e.elem,"fxshow"+e.prop,e.start)},h()&&f.timers.push(h)&&!cr&&(cr=setInterval(g.tick,g.interval))},show:function(){var a=f._data(this.elem,"fxshow"+this.prop);this.options.orig[this.prop]=a||f.style(this.elem,this.prop),this.options.show=!0,a!==b?this.custom(this.cur(),a):this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur()),f(this.elem).show()},hide:function(){this.options.orig[this.prop]=f._data(this.elem,"fxshow"+this.prop)||f.style(this.elem,this.prop),this.options.hide=!0,this.custom(this.cur(),0)},step:function(a){var b,c,d,e=ct||cu(),g=!0,h=this.elem,i=this.options;if(a||e>=i.duration+this.startTime){this.now=this.end,this.pos=this.state=1,this.update(),i.animatedProperties[this.prop]=!0;for(b in i.animatedProperties)i.animatedProperties[b]!==!0&&(g=!1);if(g){i.overflow!=null&&!f.support.shrinkWrapBlocks&&f.each(["","X","Y"],function(a,b){h.style["overflow"+b]=i.overflow[a]}),i.hide&&f(h).hide();if(i.hide||i.show)for(b in i.animatedProperties)f.style(h,b,i.orig[b]),f.removeData(h,"fxshow"+b,!0),f.removeData(h,"toggle"+b,!0);d=i.complete,d&&(i.complete=!1,d.call(h))}return!1}i.duration==Infinity?this.now=e:(c=e-this.startTime,this.state=c/i.duration,this.pos=f.easing[i.animatedProperties[this.prop]](this.state,c,0,1,i.duration),this.now=this.start+(this.end-this.start)*this.pos),this.update();return!0}},f.extend(f.fx,{tick:function(){var a,b=f.timers,c=0;for(;c<b.length;c++)a=b[c],!a()&&b[c]===a&&b.splice(c--,1);b.length||f.fx.stop()},interval:13,stop:function(){clearInterval(cr),cr=null},speeds:{slow:600,fast:200,_default:400},step:{opacity:function(a){f.style(a.elem,"opacity",a.now)},_default:function(a){a.elem.style&&a.elem.style[a.prop]!=null?a.elem.style[a.prop]=a.now+a.unit:a.elem[a.prop]=a.now}}}),f.each(["width","height"],function(a,b){f.fx.step[b]=function(a){f.style(a.elem,b,Math.max(0,a.now))}}),f.expr&&f.expr.filters&&(f.expr.filters.animated=function(a){return f.grep(f.timers,function(b){return a===b.elem}).length});var cy=/^t(?:able|d|h)$/i,cz=/^(?:body|html)$/i;"getBoundingClientRect"in c.documentElement?f.fn.offset=function(a){var b=this[0],c;if(a)return this.each(function(b){f.offset.setOffset(this,a,b)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return f.offset.bodyOffset(b);try{c=b.getBoundingClientRect()}catch(d){}var e=b.ownerDocument,g=e.documentElement;if(!c||!f.contains(g,b))return c?{top:c.top,left:c.left}:{top:0,left:0};var h=e.body,i=cA(e),j=g.clientTop||h.clientTop||0,k=g.clientLeft||h.clientLeft||0,l=i.pageYOffset||f.support.boxModel&&g.scrollTop||h.scrollTop,m=i.pageXOffset||f.support.boxModel&&g.scrollLeft||h.scrollLeft,n=c.top+l-j,o=c.left+m-k;return{top:n,left:o}}:f.fn.offset=function(a){var b=this[0];if(a)return this.each(function(b){f.offset.setOffset(this,a,b)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return f.offset.bodyOffset(b);var c,d=b.offsetParent,e=b,g=b.ownerDocument,h=g.documentElement,i=g.body,j=g.defaultView,k=j?j.getComputedStyle(b,null):b.currentStyle,l=b.offsetTop,m=b.offsetLeft;while((b=b.parentNode)&&b!==i&&b!==h){if(f.support.fixedPosition&&k.position==="fixed")break;c=j?j.getComputedStyle(b,null):b.currentStyle,l-=b.scrollTop,m-=b.scrollLeft,b===d&&(l+=b.offsetTop,m+=b.offsetLeft,f.support.doesNotAddBorder&&(!f.support.doesAddBorderForTableAndCells||!cy.test(b.nodeName))&&(l+=parseFloat(c.borderTopWidth)||0,m+=parseFloat(c.borderLeftWidth)||0),e=d,d=b.offsetParent),f.support.subtractsBorderForOverflowNotVisible&&c.overflow!=="visible"&&(l+=parseFloat(c.borderTopWidth)||0,m+=parseFloat(c.borderLeftWidth)||0),k=c}if(k.position==="relative"||k.position==="static")l+=i.offsetTop,m+=i.offsetLeft;f.support.fixedPosition&&k.position==="fixed"&&(l+=Math.max(h.scrollTop,i.scrollTop),m+=Math.max(h.scrollLeft,i.scrollLeft));return{top:l,left:m}},f.offset={bodyOffset:function(a){var b=a.offsetTop,c=a.offsetLeft;f.support.doesNotIncludeMarginInBodyOffset&&(b+=parseFloat(f.css(a,"marginTop"))||0,c+=parseFloat(f.css(a,"marginLeft"))||0);return{top:b,left:c}},setOffset:function(a,b,c){var d=f.css(a,"position");d==="static"&&(a.style.position="relative");var e=f(a),g=e.offset(),h=f.css(a,"top"),i=f.css(a,"left"),j=(d==="absolute"||d==="fixed")&&f.inArray("auto",[h,i])>-1,k={},l={},m,n;j?(l=e.position(),m=l.top,n=l.left):(m=parseFloat(h)||0,n=parseFloat(i)||0),f.isFunction(b)&&(b=b.call(a,c,g)),b.top!=null&&(k.top=b.top-g.top+m),b.left!=null&&(k.left=b.left-g.left+n),"using"in b?b.using.call(a,k):e.css(k)}},f.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),c=this.offset(),d=cz.test(b[0].nodeName)?{top:0,left:0}:b.offset();c.top-=parseFloat(f.css(a,"marginTop"))||0,c.left-=parseFloat(f.css(a,"marginLeft"))||0,d.top+=parseFloat(f.css(b[0],"borderTopWidth"))||0,d.left+=parseFloat(f.css(b[0],"borderLeftWidth"))||0;return{top:c.top-d.top,left:c.left-d.left}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||c.body;while(a&&!cz.test(a.nodeName)&&f.css(a,"position")==="static")a=a.offsetParent;return a})}}),f.each(["Left","Top"],function(a,c){var d="scroll"+c;f.fn[d]=function(c){var e,g;if(c===b){e=this[0];if(!e)return null;g=cA(e);return g?"pageXOffset"in g?g[a?"pageYOffset":"pageXOffset"]:f.support.boxModel&&g.document.documentElement[d]||g.document.body[d]:e[d]}return this.each(function(){g=cA(this),g?g.scrollTo(a?f(g).scrollLeft():c,a?c:f(g).scrollTop()):this[d]=c})}}),f.each(["Height","Width"],function(a,c){var d=c.toLowerCase();f.fn["inner"+c]=function(){var a=this[0];return a?a.style?parseFloat(f.css(a,d,"padding")):this[d]():null},f.fn["outer"+c]=function(a){var b=this[0];return b?b.style?parseFloat(f.css(b,d,a?"margin":"border")):this[d]():null},f.fn[d]=function(a){var e=this[0];if(!e)return a==null?null:this;if(f.isFunction(a))return this.each(function(b){var c=f(this);c[d](a.call(this,b,c[d]()))});if(f.isWindow(e)){var g=e.document.documentElement["client"+c],h=e.document.body;return e.document.compatMode==="CSS1Compat"&&g||h&&h["client"+c]||g}if(e.nodeType===9)return Math.max(e.documentElement["client"+c],e.body["scroll"+c],e.documentElement["scroll"+c],e.body["offset"+c],e.documentElement["offset"+c]);if(a===b){var i=f.css(e,d),j=parseFloat(i);return f.isNumeric(j)?j:i}return this.css(d,typeof a=="string"?a:a+"px")}}),a.jQuery=a.$=f})(window);
|
js/jquery/jquery.noconflict.js
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
var $j = jQuery.noConflict();
|
js/lookbook/fileuploader.js
ADDED
@@ -0,0 +1,1251 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* http://github.com/valums/file-uploader
|
3 |
+
*
|
4 |
+
* Multiple file upload component with progress-bar, drag-and-drop.
|
5 |
+
* © 2010 Andrew Valums ( andrew(at)valums.com )
|
6 |
+
*
|
7 |
+
* Licensed under GNU GPL 2 or later and GNU LGPL 2 or later, see license.txt.
|
8 |
+
*/
|
9 |
+
|
10 |
+
//
|
11 |
+
// Helper functions
|
12 |
+
//
|
13 |
+
|
14 |
+
var qq = qq || {};
|
15 |
+
|
16 |
+
/**
|
17 |
+
* Adds all missing properties from second obj to first obj
|
18 |
+
*/
|
19 |
+
qq.extend = function(first, second){
|
20 |
+
for (var prop in second){
|
21 |
+
first[prop] = second[prop];
|
22 |
+
}
|
23 |
+
};
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Searches for a given element in the array, returns -1 if it is not present.
|
27 |
+
* @param {Number} [from] The index at which to begin the search
|
28 |
+
*/
|
29 |
+
qq.indexOf = function(arr, elt, from){
|
30 |
+
if (arr.indexOf) return arr.indexOf(elt, from);
|
31 |
+
|
32 |
+
from = from || 0;
|
33 |
+
var len = arr.length;
|
34 |
+
|
35 |
+
if (from < 0) from += len;
|
36 |
+
|
37 |
+
for (; from < len; from++){
|
38 |
+
if (from in arr && arr[from] === elt){
|
39 |
+
return from;
|
40 |
+
}
|
41 |
+
}
|
42 |
+
return -1;
|
43 |
+
};
|
44 |
+
|
45 |
+
qq.getUniqueId = (function(){
|
46 |
+
var id = 0;
|
47 |
+
return function(){ return id++; };
|
48 |
+
})();
|
49 |
+
|
50 |
+
//
|
51 |
+
// Events
|
52 |
+
|
53 |
+
qq.attach = function(element, type, fn){
|
54 |
+
if (element.addEventListener){
|
55 |
+
element.addEventListener(type, fn, false);
|
56 |
+
} else if (element.attachEvent){
|
57 |
+
element.attachEvent('on' + type, fn);
|
58 |
+
}
|
59 |
+
};
|
60 |
+
qq.detach = function(element, type, fn){
|
61 |
+
if (element.removeEventListener){
|
62 |
+
element.removeEventListener(type, fn, false);
|
63 |
+
} else if (element.attachEvent){
|
64 |
+
element.detachEvent('on' + type, fn);
|
65 |
+
}
|
66 |
+
};
|
67 |
+
|
68 |
+
qq.preventDefault = function(e){
|
69 |
+
if (e.preventDefault){
|
70 |
+
e.preventDefault();
|
71 |
+
} else{
|
72 |
+
e.returnValue = false;
|
73 |
+
}
|
74 |
+
};
|
75 |
+
|
76 |
+
//
|
77 |
+
// Node manipulations
|
78 |
+
|
79 |
+
/**
|
80 |
+
* Insert node a before node b.
|
81 |
+
*/
|
82 |
+
qq.insertBefore = function(a, b){
|
83 |
+
b.parentNode.insertBefore(a, b);
|
84 |
+
};
|
85 |
+
qq.remove = function(element){
|
86 |
+
element.parentNode.removeChild(element);
|
87 |
+
};
|
88 |
+
|
89 |
+
qq.contains = function(parent, descendant){
|
90 |
+
// compareposition returns false in this case
|
91 |
+
if (parent == descendant) return true;
|
92 |
+
|
93 |
+
if (parent.contains){
|
94 |
+
return parent.contains(descendant);
|
95 |
+
} else {
|
96 |
+
return !!(descendant.compareDocumentPosition(parent) & 8);
|
97 |
+
}
|
98 |
+
};
|
99 |
+
|
100 |
+
/**
|
101 |
+
* Creates and returns element from html string
|
102 |
+
* Uses innerHTML to create an element
|
103 |
+
*/
|
104 |
+
qq.toElement = (function(){
|
105 |
+
var div = document.createElement('div');
|
106 |
+
return function(html){
|
107 |
+
div.innerHTML = html;
|
108 |
+
var element = div.firstChild;
|
109 |
+
div.removeChild(element);
|
110 |
+
return element;
|
111 |
+
};
|
112 |
+
})();
|
113 |
+
|
114 |
+
//
|
115 |
+
// Node properties and attributes
|
116 |
+
|
117 |
+
/**
|
118 |
+
* Sets styles for an element.
|
119 |
+
* Fixes opacity in IE6-8.
|
120 |
+
*/
|
121 |
+
qq.css = function(element, styles){
|
122 |
+
if (styles.opacity != null){
|
123 |
+
if (typeof element.style.opacity != 'string' && typeof(element.filters) != 'undefined'){
|
124 |
+
styles.filter = 'alpha(opacity=' + Math.round(100 * styles.opacity) + ')';
|
125 |
+
}
|
126 |
+
}
|
127 |
+
qq.extend(element.style, styles);
|
128 |
+
};
|
129 |
+
qq.hasClass = function(element, name){
|
130 |
+
var re = new RegExp('(^| )' + name + '( |$)');
|
131 |
+
return re.test(element.className);
|
132 |
+
};
|
133 |
+
qq.addClass = function(element, name){
|
134 |
+
if (!qq.hasClass(element, name)){
|
135 |
+
element.className += ' ' + name;
|
136 |
+
}
|
137 |
+
};
|
138 |
+
qq.removeClass = function(element, name){
|
139 |
+
var re = new RegExp('(^| )' + name + '( |$)');
|
140 |
+
element.className = element.className.replace(re, ' ').replace(/^\s+|\s+$/g, "");
|
141 |
+
};
|
142 |
+
qq.setText = function(element, text){
|
143 |
+
element.innerText = text;
|
144 |
+
element.textContent = text;
|
145 |
+
};
|
146 |
+
|
147 |
+
//
|
148 |
+
// Selecting elements
|
149 |
+
|
150 |
+
qq.children = function(element){
|
151 |
+
var children = [],
|
152 |
+
child = element.firstChild;
|
153 |
+
|
154 |
+
while (child){
|
155 |
+
if (child.nodeType == 1){
|
156 |
+
children.push(child);
|
157 |
+
}
|
158 |
+
child = child.nextSibling;
|
159 |
+
}
|
160 |
+
|
161 |
+
return children;
|
162 |
+
};
|
163 |
+
|
164 |
+
qq.getByClass = function(element, className){
|
165 |
+
if (element.querySelectorAll){
|
166 |
+
return element.querySelectorAll('.' + className);
|
167 |
+
}
|
168 |
+
|
169 |
+
var result = [];
|
170 |
+
var candidates = element.getElementsByTagName("*");
|
171 |
+
var len = candidates.length;
|
172 |
+
|
173 |
+
for (var i = 0; i < len; i++){
|
174 |
+
if (qq.hasClass(candidates[i], className)){
|
175 |
+
result.push(candidates[i]);
|
176 |
+
}
|
177 |
+
}
|
178 |
+
return result;
|
179 |
+
};
|
180 |
+
|
181 |
+
/**
|
182 |
+
* obj2url() takes a json-object as argument and generates
|
183 |
+
* a querystring. pretty much like jQuery.param()
|
184 |
+
*
|
185 |
+
* how to use:
|
186 |
+
*
|
187 |
+
* `qq.obj2url({a:'b',c:'d'},'http://any.url/upload?otherParam=value');`
|
188 |
+
*
|
189 |
+
* will result in:
|
190 |
+
*
|
191 |
+
* `http://any.url/upload?otherParam=value&a=b&c=d`
|
192 |
+
*
|
193 |
+
* @param Object JSON-Object
|
194 |
+
* @param String current querystring-part
|
195 |
+
* @return String encoded querystring
|
196 |
+
*/
|
197 |
+
qq.obj2url = function(obj, temp, prefixDone){
|
198 |
+
var uristrings = [],
|
199 |
+
prefix = '&',
|
200 |
+
add = function(nextObj, i){
|
201 |
+
var nextTemp = temp
|
202 |
+
? (/\[\]$/.test(temp)) // prevent double-encoding
|
203 |
+
? temp
|
204 |
+
: temp+'['+i+']'
|
205 |
+
: i;
|
206 |
+
if ((nextTemp != 'undefined') && (i != 'undefined')) {
|
207 |
+
uristrings.push(
|
208 |
+
(typeof nextObj === 'object')
|
209 |
+
? qq.obj2url(nextObj, nextTemp, true)
|
210 |
+
: (Object.prototype.toString.call(nextObj) === '[object Function]')
|
211 |
+
? encodeURIComponent(nextTemp) + '=' + encodeURIComponent(nextObj())
|
212 |
+
: encodeURIComponent(nextTemp) + '=' + encodeURIComponent(nextObj)
|
213 |
+
);
|
214 |
+
}
|
215 |
+
};
|
216 |
+
|
217 |
+
if (!prefixDone && temp) {
|
218 |
+
prefix = (/\?/.test(temp)) ? (/\?$/.test(temp)) ? '' : '&' : '?';
|
219 |
+
uristrings.push(temp);
|
220 |
+
uristrings.push(qq.obj2url(obj));
|
221 |
+
} else if ((Object.prototype.toString.call(obj) === '[object Array]') && (typeof obj != 'undefined') ) {
|
222 |
+
// we wont use a for-in-loop on an array (performance)
|
223 |
+
for (var i = 0, len = obj.length; i < len; ++i){
|
224 |
+
add(obj[i], i);
|
225 |
+
}
|
226 |
+
} else if ((typeof obj != 'undefined') && (obj !== null) && (typeof obj === "object")){
|
227 |
+
// for anything else but a scalar, we will use for-in-loop
|
228 |
+
for (var i in obj){
|
229 |
+
add(obj[i], i);
|
230 |
+
}
|
231 |
+
} else {
|
232 |
+
uristrings.push(encodeURIComponent(temp) + '=' + encodeURIComponent(obj));
|
233 |
+
}
|
234 |
+
|
235 |
+
return uristrings.join(prefix)
|
236 |
+
.replace(/^&/, '')
|
237 |
+
.replace(/%20/g, '+');
|
238 |
+
};
|
239 |
+
|
240 |
+
//
|
241 |
+
//
|
242 |
+
// Uploader Classes
|
243 |
+
//
|
244 |
+
//
|
245 |
+
|
246 |
+
var qq = qq || {};
|
247 |
+
|
248 |
+
/**
|
249 |
+
* Creates upload button, validates upload, but doesn't create file list or dd.
|
250 |
+
*/
|
251 |
+
qq.FileUploaderBasic = function(o){
|
252 |
+
this._options = {
|
253 |
+
// set to true to see the server response
|
254 |
+
debug: false,
|
255 |
+
action: '/server/upload',
|
256 |
+
params: {},
|
257 |
+
button: null,
|
258 |
+
buttontext: 'Upload file',
|
259 |
+
multiple: true,
|
260 |
+
maxConnections: 3,
|
261 |
+
// validation
|
262 |
+
allowedExtensions: [],
|
263 |
+
sizeLimit: 0,
|
264 |
+
minSizeLimit: 0,
|
265 |
+
// events
|
266 |
+
// return false to cancel submit
|
267 |
+
onSubmit: function(id, fileName){},
|
268 |
+
onProgress: function(id, fileName, loaded, total){},
|
269 |
+
onComplete: function(id, fileName, responseJSON){},
|
270 |
+
onCancel: function(id, fileName){},
|
271 |
+
// messages
|
272 |
+
messages: {
|
273 |
+
typeError: "{file} has invalid extension. Only {extensions} are allowed.",
|
274 |
+
sizeError: "{file} is too large, maximum file size is {sizeLimit}.",
|
275 |
+
minSizeError: "{file} is too small, minimum file size is {minSizeLimit}.",
|
276 |
+
emptyError: "{file} is empty, please select files again without it.",
|
277 |
+
onLeave: "The files are being uploaded, if you leave now the upload will be cancelled."
|
278 |
+
},
|
279 |
+
showMessage: function(message){
|
280 |
+
alert(message);
|
281 |
+
}
|
282 |
+
};
|
283 |
+
qq.extend(this._options, o);
|
284 |
+
|
285 |
+
// number of files being uploaded
|
286 |
+
this._filesInProgress = 0;
|
287 |
+
this._handler = this._createUploadHandler();
|
288 |
+
|
289 |
+
if (this._options.button){
|
290 |
+
this._button = this._createUploadButton(this._options.button);
|
291 |
+
}
|
292 |
+
|
293 |
+
this._preventLeaveInProgress();
|
294 |
+
};
|
295 |
+
|
296 |
+
qq.FileUploaderBasic.prototype = {
|
297 |
+
setParams: function(params){
|
298 |
+
this._options.params = params;
|
299 |
+
},
|
300 |
+
getInProgress: function(){
|
301 |
+
return this._filesInProgress;
|
302 |
+
},
|
303 |
+
_createUploadButton: function(element){
|
304 |
+
var self = this;
|
305 |
+
|
306 |
+
return new qq.UploadButton({
|
307 |
+
element: element,
|
308 |
+
multiple: this._options.multiple && qq.UploadHandlerXhr.isSupported(),
|
309 |
+
onChange: function(input){
|
310 |
+
self._onInputChange(input);
|
311 |
+
}
|
312 |
+
});
|
313 |
+
},
|
314 |
+
_createUploadHandler: function(){
|
315 |
+
var self = this,
|
316 |
+
handlerClass;
|
317 |
+
|
318 |
+
if(qq.UploadHandlerXhr.isSupported()){
|
319 |
+
handlerClass = 'UploadHandlerXhr';
|
320 |
+
} else {
|
321 |
+
handlerClass = 'UploadHandlerForm';
|
322 |
+
}
|
323 |
+
|
324 |
+
var handler = new qq[handlerClass]({
|
325 |
+
debug: this._options.debug,
|
326 |
+
action: this._options.action,
|
327 |
+
maxConnections: this._options.maxConnections,
|
328 |
+
onProgress: function(id, fileName, loaded, total){
|
329 |
+
self._onProgress(id, fileName, loaded, total);
|
330 |
+
self._options.onProgress(id, fileName, loaded, total);
|
331 |
+
},
|
332 |
+
onComplete: function(id, fileName, result){
|
333 |
+
self._onComplete(id, fileName, result);
|
334 |
+
self._options.onComplete(id, fileName, result);
|
335 |
+
},
|
336 |
+
onCancel: function(id, fileName){
|
337 |
+
self._onCancel(id, fileName);
|
338 |
+
self._options.onCancel(id, fileName);
|
339 |
+
}
|
340 |
+
});
|
341 |
+
|
342 |
+
return handler;
|
343 |
+
},
|
344 |
+
_preventLeaveInProgress: function(){
|
345 |
+
var self = this;
|
346 |
+
|
347 |
+
qq.attach(window, 'beforeunload', function(e){
|
348 |
+
if (!self._filesInProgress){return;}
|
349 |
+
|
350 |
+
var e = e || window.event;
|
351 |
+
// for ie, ff
|
352 |
+
e.returnValue = self._options.messages.onLeave;
|
353 |
+
// for webkit
|
354 |
+
return self._options.messages.onLeave;
|
355 |
+
});
|
356 |
+
},
|
357 |
+
_onSubmit: function(id, fileName){
|
358 |
+
this._filesInProgress++;
|
359 |
+
},
|
360 |
+
_onProgress: function(id, fileName, loaded, total){
|
361 |
+
},
|
362 |
+
_onComplete: function(id, fileName, result){
|
363 |
+
this._filesInProgress--;
|
364 |
+
if (result.error){
|
365 |
+
this._options.showMessage(result.error);
|
366 |
+
}
|
367 |
+
},
|
368 |
+
_onCancel: function(id, fileName){
|
369 |
+
this._filesInProgress--;
|
370 |
+
},
|
371 |
+
_onInputChange: function(input){
|
372 |
+
if (this._handler instanceof qq.UploadHandlerXhr){
|
373 |
+
this._uploadFileList(input.files);
|
374 |
+
} else {
|
375 |
+
if (this._validateFile(input)){
|
376 |
+
this._uploadFile(input);
|
377 |
+
}
|
378 |
+
}
|
379 |
+
this._button.reset();
|
380 |
+
},
|
381 |
+
_uploadFileList: function(files){
|
382 |
+
for (var i=0; i<files.length; i++){
|
383 |
+
if ( !this._validateFile(files[i])){
|
384 |
+
return;
|
385 |
+
}
|
386 |
+
}
|
387 |
+
|
388 |
+
for (var i=0; i<files.length; i++){
|
389 |
+
this._uploadFile(files[i]);
|
390 |
+
}
|
391 |
+
},
|
392 |
+
_uploadFile: function(fileContainer){
|
393 |
+
var id = this._handler.add(fileContainer);
|
394 |
+
var fileName = this._handler.getName(id);
|
395 |
+
|
396 |
+
if (this._options.onSubmit(id, fileName) !== false){
|
397 |
+
this._onSubmit(id, fileName);
|
398 |
+
this._handler.upload(id, this._options.params);
|
399 |
+
}
|
400 |
+
},
|
401 |
+
_validateFile: function(file){
|
402 |
+
var name, size;
|
403 |
+
|
404 |
+
if (file.value){
|
405 |
+
// it is a file input
|
406 |
+
// get input value and remove path to normalize
|
407 |
+
name = file.value.replace(/.*(\/|\\)/, "");
|
408 |
+
} else {
|
409 |
+
// fix missing properties in Safari
|
410 |
+
name = file.fileName != null ? file.fileName : file.name;
|
411 |
+
size = file.fileSize != null ? file.fileSize : file.size;
|
412 |
+
}
|
413 |
+
|
414 |
+
if (! this._isAllowedExtension(name)){
|
415 |
+
this._error('typeError', name);
|
416 |
+
return false;
|
417 |
+
|
418 |
+
} else if (size === 0){
|
419 |
+
this._error('emptyError', name);
|
420 |
+
return false;
|
421 |
+
|
422 |
+
} else if (size && this._options.sizeLimit && size > this._options.sizeLimit){
|
423 |
+
this._error('sizeError', name);
|
424 |
+
return false;
|
425 |
+
|
426 |
+
} else if (size && size < this._options.minSizeLimit){
|
427 |
+
this._error('minSizeError', name);
|
428 |
+
return false;
|
429 |
+
}
|
430 |
+
|
431 |
+
return true;
|
432 |
+
},
|
433 |
+
_error: function(code, fileName){
|
434 |
+
var message = this._options.messages[code];
|
435 |
+
function r(name, replacement){ message = message.replace(name, replacement); }
|
436 |
+
|
437 |
+
r('{file}', this._formatFileName(fileName));
|
438 |
+
r('{extensions}', this._options.allowedExtensions.join(', '));
|
439 |
+
r('{sizeLimit}', this._formatSize(this._options.sizeLimit));
|
440 |
+
r('{minSizeLimit}', this._formatSize(this._options.minSizeLimit));
|
441 |
+
|
442 |
+
this._options.showMessage(message);
|
443 |
+
},
|
444 |
+
_formatFileName: function(name){
|
445 |
+
if (name.length > 33){
|
446 |
+
name = name.slice(0, 19) + '...' + name.slice(-13);
|
447 |
+
}
|
448 |
+
return name;
|
449 |
+
},
|
450 |
+
_isAllowedExtension: function(fileName){
|
451 |
+
var ext = (-1 !== fileName.indexOf('.')) ? fileName.replace(/.*[.]/, '').toLowerCase() : '';
|
452 |
+
var allowed = this._options.allowedExtensions;
|
453 |
+
|
454 |
+
if (!allowed.length){return true;}
|
455 |
+
|
456 |
+
for (var i=0; i<allowed.length; i++){
|
457 |
+
if (allowed[i].toLowerCase() == ext){ return true;}
|
458 |
+
}
|
459 |
+
|
460 |
+
return false;
|
461 |
+
},
|
462 |
+
_formatSize: function(bytes){
|
463 |
+
var i = -1;
|
464 |
+
do {
|
465 |
+
bytes = bytes / 1024;
|
466 |
+
i++;
|
467 |
+
} while (bytes > 99);
|
468 |
+
|
469 |
+
return Math.max(bytes, 0.1).toFixed(1) + ['kB', 'MB', 'GB', 'TB', 'PB', 'EB'][i];
|
470 |
+
}
|
471 |
+
};
|
472 |
+
|
473 |
+
|
474 |
+
/**
|
475 |
+
* Class that creates upload widget with drag-and-drop and file list
|
476 |
+
* @inherits qq.FileUploaderBasic
|
477 |
+
*/
|
478 |
+
qq.FileUploader = function(o){
|
479 |
+
// call parent constructor
|
480 |
+
qq.FileUploaderBasic.apply(this, arguments);
|
481 |
+
|
482 |
+
// additional options
|
483 |
+
qq.extend(this._options, {
|
484 |
+
element: null,
|
485 |
+
// if set, will be used instead of qq-upload-list in template
|
486 |
+
listElement: null,
|
487 |
+
|
488 |
+
template: '<div class="qq-uploader">' +
|
489 |
+
'<div class="qq-upload-drop-area"><span>Drop files here to upload</span></div>' +
|
490 |
+
'<div class="qq-upload-button"><span>'+this._options.buttontext+'</span></div>' +
|
491 |
+
'<ul class="qq-upload-list"></ul>' +
|
492 |
+
'</div>',
|
493 |
+
|
494 |
+
// template for one item in file list
|
495 |
+
fileTemplate: '<li>' +
|
496 |
+
'<span class="qq-upload-file"></span>' +
|
497 |
+
'<span class="qq-upload-spinner"></span>' +
|
498 |
+
'<span class="qq-upload-size"></span>' +
|
499 |
+
'<a class="qq-upload-cancel" href="#">Cancel</a>' +
|
500 |
+
'<span class="qq-upload-failed-text">Failed</span>' +
|
501 |
+
'</li>',
|
502 |
+
|
503 |
+
classes: {
|
504 |
+
// used to get elements from templates
|
505 |
+
button: 'qq-upload-button',
|
506 |
+
drop: 'qq-upload-drop-area',
|
507 |
+
dropActive: 'qq-upload-drop-area-active',
|
508 |
+
list: 'qq-upload-list',
|
509 |
+
|
510 |
+
file: 'qq-upload-file',
|
511 |
+
spinner: 'qq-upload-spinner',
|
512 |
+
size: 'qq-upload-size',
|
513 |
+
cancel: 'qq-upload-cancel',
|
514 |
+
|
515 |
+
// added to list item when upload completes
|
516 |
+
// used in css to hide progress spinner
|
517 |
+
success: 'qq-upload-success',
|
518 |
+
fail: 'qq-upload-fail'
|
519 |
+
}
|
520 |
+
});
|
521 |
+
// overwrite options with user supplied
|
522 |
+
qq.extend(this._options, o);
|
523 |
+
|
524 |
+
this._element = this._options.element;
|
525 |
+
this._element.innerHTML = this._options.template;
|
526 |
+
this._listElement = this._options.listElement || this._find(this._element, 'list');
|
527 |
+
|
528 |
+
this._classes = this._options.classes;
|
529 |
+
|
530 |
+
this._button = this._createUploadButton(this._find(this._element, 'button'));
|
531 |
+
|
532 |
+
this._bindCancelEvent();
|
533 |
+
this._setupDragDrop();
|
534 |
+
};
|
535 |
+
|
536 |
+
// inherit from Basic Uploader
|
537 |
+
qq.extend(qq.FileUploader.prototype, qq.FileUploaderBasic.prototype);
|
538 |
+
|
539 |
+
qq.extend(qq.FileUploader.prototype, {
|
540 |
+
/**
|
541 |
+
* Gets one of the elements listed in this._options.classes
|
542 |
+
**/
|
543 |
+
_find: function(parent, type){
|
544 |
+
var element = qq.getByClass(parent, this._options.classes[type])[0];
|
545 |
+
if (!element){
|
546 |
+
throw new Error('element not found ' + type);
|
547 |
+
}
|
548 |
+
|
549 |
+
return element;
|
550 |
+
},
|
551 |
+
_setupDragDrop: function(){
|
552 |
+
var self = this,
|
553 |
+
dropArea = this._find(this._element, 'drop');
|
554 |
+
|
555 |
+
var dz = new qq.UploadDropZone({
|
556 |
+
element: dropArea,
|
557 |
+
onEnter: function(e){
|
558 |
+
qq.addClass(dropArea, self._classes.dropActive);
|
559 |
+
e.stopPropagation();
|
560 |
+
},
|
561 |
+
onLeave: function(e){
|
562 |
+
e.stopPropagation();
|
563 |
+
},
|
564 |
+
onLeaveNotDescendants: function(e){
|
565 |
+
qq.removeClass(dropArea, self._classes.dropActive);
|
566 |
+
},
|
567 |
+
onDrop: function(e){
|
568 |
+
dropArea.style.display = 'none';
|
569 |
+
qq.removeClass(dropArea, self._classes.dropActive);
|
570 |
+
self._uploadFileList(e.dataTransfer.files);
|
571 |
+
}
|
572 |
+
});
|
573 |
+
|
574 |
+
dropArea.style.display = 'none';
|
575 |
+
|
576 |
+
qq.attach(document, 'dragenter', function(e){
|
577 |
+
if (!dz._isValidFileDrag(e)) return;
|
578 |
+
|
579 |
+
dropArea.style.display = 'block';
|
580 |
+
});
|
581 |
+
qq.attach(document, 'dragleave', function(e){
|
582 |
+
if (!dz._isValidFileDrag(e)) return;
|
583 |
+
|
584 |
+
var relatedTarget = document.elementFromPoint(e.clientX, e.clientY);
|
585 |
+
// only fire when leaving document out
|
586 |
+
if ( ! relatedTarget || relatedTarget.nodeName == "HTML"){
|
587 |
+
dropArea.style.display = 'none';
|
588 |
+
}
|
589 |
+
});
|
590 |
+
},
|
591 |
+
_onSubmit: function(id, fileName){
|
592 |
+
qq.FileUploaderBasic.prototype._onSubmit.apply(this, arguments);
|
593 |
+
this._addToList(id, fileName);
|
594 |
+
},
|
595 |
+
_onProgress: function(id, fileName, loaded, total){
|
596 |
+
qq.FileUploaderBasic.prototype._onProgress.apply(this, arguments);
|
597 |
+
|
598 |
+
var item = this._getItemByFileId(id);
|
599 |
+
var size = this._find(item, 'size');
|
600 |
+
size.style.display = 'inline';
|
601 |
+
|
602 |
+
var text;
|
603 |
+
if (loaded != total){
|
604 |
+
text = Math.round(loaded / total * 100) + '% from ' + this._formatSize(total);
|
605 |
+
} else {
|
606 |
+
text = this._formatSize(total);
|
607 |
+
}
|
608 |
+
|
609 |
+
qq.setText(size, text);
|
610 |
+
},
|
611 |
+
_onComplete: function(id, fileName, result){
|
612 |
+
qq.FileUploaderBasic.prototype._onComplete.apply(this, arguments);
|
613 |
+
|
614 |
+
// mark completed
|
615 |
+
var item = this._getItemByFileId(id);
|
616 |
+
qq.remove(this._find(item, 'cancel'));
|
617 |
+
qq.remove(this._find(item, 'spinner'));
|
618 |
+
|
619 |
+
if (result.success){
|
620 |
+
qq.addClass(item, this._classes.success);
|
621 |
+
} else {
|
622 |
+
qq.addClass(item, this._classes.fail);
|
623 |
+
}
|
624 |
+
},
|
625 |
+
_addToList: function(id, fileName){
|
626 |
+
var item = qq.toElement(this._options.fileTemplate);
|
627 |
+
item.qqFileId = id;
|
628 |
+
|
629 |
+
var fileElement = this._find(item, 'file');
|
630 |
+
qq.setText(fileElement, this._formatFileName(fileName));
|
631 |
+
this._find(item, 'size').style.display = 'none';
|
632 |
+
|
633 |
+
if( this._options.multiple || this._listElement.childNodes.length == 0 )
|
634 |
+
this._listElement.appendChild(item);
|
635 |
+
else
|
636 |
+
this._listElement.replaceChild(item, this._listElement.firstChild);
|
637 |
+
},
|
638 |
+
_getItemByFileId: function(id){
|
639 |
+
var item = this._listElement.firstChild;
|
640 |
+
|
641 |
+
// there can't be txt nodes in dynamically created list
|
642 |
+
// and we can use nextSibling
|
643 |
+
while (item){
|
644 |
+
if (item.qqFileId == id) return item;
|
645 |
+
item = item.nextSibling;
|
646 |
+
}
|
647 |
+
},
|
648 |
+
/**
|
649 |
+
* delegate click event for cancel link
|
650 |
+
**/
|
651 |
+
_bindCancelEvent: function(){
|
652 |
+
var self = this,
|
653 |
+
list = this._listElement;
|
654 |
+
|
655 |
+
qq.attach(list, 'click', function(e){
|
656 |
+
e = e || window.event;
|
657 |
+
var target = e.target || e.srcElement;
|
658 |
+
|
659 |
+
if (qq.hasClass(target, self._classes.cancel)){
|
660 |
+
qq.preventDefault(e);
|
661 |
+
|
662 |
+
var item = target.parentNode;
|
663 |
+
self._handler.cancel(item.qqFileId);
|
664 |
+
qq.remove(item);
|
665 |
+
}
|
666 |
+
});
|
667 |
+
}
|
668 |
+
});
|
669 |
+
|
670 |
+
qq.UploadDropZone = function(o){
|
671 |
+
this._options = {
|
672 |
+
element: null,
|
673 |
+
onEnter: function(e){},
|
674 |
+
onLeave: function(e){},
|
675 |
+
// is not fired when leaving element by hovering descendants
|
676 |
+
onLeaveNotDescendants: function(e){},
|
677 |
+
onDrop: function(e){}
|
678 |
+
};
|
679 |
+
qq.extend(this._options, o);
|
680 |
+
|
681 |
+
this._element = this._options.element;
|
682 |
+
|
683 |
+
this._disableDropOutside();
|
684 |
+
this._attachEvents();
|
685 |
+
};
|
686 |
+
|
687 |
+
qq.UploadDropZone.prototype = {
|
688 |
+
_disableDropOutside: function(e){
|
689 |
+
// run only once for all instances
|
690 |
+
if (!qq.UploadDropZone.dropOutsideDisabled ){
|
691 |
+
|
692 |
+
qq.attach(document, 'dragover', function(e){
|
693 |
+
if (e.dataTransfer){
|
694 |
+
e.dataTransfer.dropEffect = 'none';
|
695 |
+
e.preventDefault();
|
696 |
+
}
|
697 |
+
});
|
698 |
+
|
699 |
+
qq.UploadDropZone.dropOutsideDisabled = true;
|
700 |
+
}
|
701 |
+
},
|
702 |
+
_attachEvents: function(){
|
703 |
+
var self = this;
|
704 |
+
|
705 |
+
qq.attach(self._element, 'dragover', function(e){
|
706 |
+
if (!self._isValidFileDrag(e)) return;
|
707 |
+
|
708 |
+
var effect = e.dataTransfer.effectAllowed;
|
709 |
+
if (effect == 'move' || effect == 'linkMove'){
|
710 |
+
e.dataTransfer.dropEffect = 'move'; // for FF (only move allowed)
|
711 |
+
} else {
|
712 |
+
e.dataTransfer.dropEffect = 'copy'; // for Chrome
|
713 |
+
}
|
714 |
+
|
715 |
+
e.stopPropagation();
|
716 |
+
e.preventDefault();
|
717 |
+
});
|
718 |
+
|
719 |
+
qq.attach(self._element, 'dragenter', function(e){
|
720 |
+
if (!self._isValidFileDrag(e)) return;
|
721 |
+
|
722 |
+
self._options.onEnter(e);
|
723 |
+
});
|
724 |
+
|
725 |
+
qq.attach(self._element, 'dragleave', function(e){
|
726 |
+
if (!self._isValidFileDrag(e)) return;
|
727 |
+
|
728 |
+
self._options.onLeave(e);
|
729 |
+
|
730 |
+
var relatedTarget = document.elementFromPoint(e.clientX, e.clientY);
|
731 |
+
// do not fire when moving a mouse over a descendant
|
732 |
+
if (qq.contains(this, relatedTarget)) return;
|
733 |
+
|
734 |
+
self._options.onLeaveNotDescendants(e);
|
735 |
+
});
|
736 |
+
|
737 |
+
qq.attach(self._element, 'drop', function(e){
|
738 |
+
if (!self._isValidFileDrag(e)) return;
|
739 |
+
|
740 |
+
e.preventDefault();
|
741 |
+
self._options.onDrop(e);
|
742 |
+
});
|
743 |
+
},
|
744 |
+
_isValidFileDrag: function(e){
|
745 |
+
var dt = e.dataTransfer,
|
746 |
+
// do not check dt.types.contains in webkit, because it crashes safari 4
|
747 |
+
isWebkit = navigator.userAgent.indexOf("AppleWebKit") > -1;
|
748 |
+
|
749 |
+
// dt.effectAllowed is none in Safari 5
|
750 |
+
// dt.types.contains check is for firefox
|
751 |
+
return dt && dt.effectAllowed != 'none' &&
|
752 |
+
(dt.files || (!isWebkit && dt.types.contains && dt.types.contains('Files')));
|
753 |
+
|
754 |
+
}
|
755 |
+
};
|
756 |
+
|
757 |
+
qq.UploadButton = function(o){
|
758 |
+
this._options = {
|
759 |
+
element: null,
|
760 |
+
// if set to true adds multiple attribute to file input
|
761 |
+
multiple: false,
|
762 |
+
// name attribute of file input
|
763 |
+
name: 'file',
|
764 |
+
onChange: function(input){},
|
765 |
+
hoverClass: 'qq-upload-button-hover',
|
766 |
+
focusClass: 'qq-upload-button-focus'
|
767 |
+
};
|
768 |
+
|
769 |
+
qq.extend(this._options, o);
|
770 |
+
|
771 |
+
this._element = this._options.element;
|
772 |
+
|
773 |
+
// make button suitable container for input
|
774 |
+
qq.css(this._element, {
|
775 |
+
position: 'relative',
|
776 |
+
overflow: 'hidden',
|
777 |
+
// Make sure browse button is in the right side
|
778 |
+
// in Internet Explorer
|
779 |
+
direction: 'ltr'
|
780 |
+
});
|
781 |
+
|
782 |
+
this._input = this._createInput();
|
783 |
+
};
|
784 |
+
|
785 |
+
qq.UploadButton.prototype = {
|
786 |
+
/* returns file input element */
|
787 |
+
getInput: function(){
|
788 |
+
return this._input;
|
789 |
+
},
|
790 |
+
/* cleans/recreates the file input */
|
791 |
+
reset: function(){
|
792 |
+
if (this._input.parentNode){
|
793 |
+
qq.remove(this._input);
|
794 |
+
}
|
795 |
+
|
796 |
+
qq.removeClass(this._element, this._options.focusClass);
|
797 |
+
this._input = this._createInput();
|
798 |
+
},
|
799 |
+
_createInput: function(){
|
800 |
+
var input = document.createElement("input");
|
801 |
+
|
802 |
+
if (this._options.multiple){
|
803 |
+
input.setAttribute("multiple", "multiple");
|
804 |
+
}
|
805 |
+
|
806 |
+
input.setAttribute("type", "file");
|
807 |
+
input.setAttribute("name", this._options.name);
|
808 |
+
|
809 |
+
qq.css(input, {
|
810 |
+
position: 'absolute',
|
811 |
+
// in Opera only 'browse' button
|
812 |
+
// is clickable and it is located at
|
813 |
+
// the right side of the input
|
814 |
+
right: 0,
|
815 |
+
top: 0,
|
816 |
+
fontFamily: 'Arial',
|
817 |
+
// 4 persons reported this, the max values that worked for them were 243, 236, 236, 118
|
818 |
+
fontSize: '118px',
|
819 |
+
margin: 0,
|
820 |
+
padding: 0,
|
821 |
+
cursor: 'pointer',
|
822 |
+
opacity: 0
|
823 |
+
});
|
824 |
+
|
825 |
+
this._element.appendChild(input);
|
826 |
+
|
827 |
+
var self = this;
|
828 |
+
qq.attach(input, 'change', function(){
|
829 |
+
self._options.onChange(input);
|
830 |
+
});
|
831 |
+
|
832 |
+
qq.attach(input, 'mouseover', function(){
|
833 |
+
qq.addClass(self._element, self._options.hoverClass);
|
834 |
+
});
|
835 |
+
qq.attach(input, 'mouseout', function(){
|
836 |
+
qq.removeClass(self._element, self._options.hoverClass);
|
837 |
+
});
|
838 |
+
qq.attach(input, 'focus', function(){
|
839 |
+
qq.addClass(self._element, self._options.focusClass);
|
840 |
+
});
|
841 |
+
qq.attach(input, 'blur', function(){
|
842 |
+
qq.removeClass(self._element, self._options.focusClass);
|
843 |
+
});
|
844 |
+
|
845 |
+
// IE and Opera, unfortunately have 2 tab stops on file input
|
846 |
+
// which is unacceptable in our case, disable keyboard access
|
847 |
+
if (window.attachEvent){
|
848 |
+
// it is IE or Opera
|
849 |
+
input.setAttribute('tabIndex', "-1");
|
850 |
+
}
|
851 |
+
|
852 |
+
return input;
|
853 |
+
}
|
854 |
+
};
|
855 |
+
|
856 |
+
/**
|
857 |
+
* Class for uploading files, uploading itself is handled by child classes
|
858 |
+
*/
|
859 |
+
qq.UploadHandlerAbstract = function(o){
|
860 |
+
this._options = {
|
861 |
+
debug: false,
|
862 |
+
action: '/upload.php',
|
863 |
+
// maximum number of concurrent uploads
|
864 |
+
maxConnections: 999,
|
865 |
+
onProgress: function(id, fileName, loaded, total){},
|
866 |
+
onComplete: function(id, fileName, response){},
|
867 |
+
onCancel: function(id, fileName){}
|
868 |
+
};
|
869 |
+
qq.extend(this._options, o);
|
870 |
+
|
871 |
+
this._queue = [];
|
872 |
+
// params for files in queue
|
873 |
+
this._params = [];
|
874 |
+
};
|
875 |
+
qq.UploadHandlerAbstract.prototype = {
|
876 |
+
log: function(str){
|
877 |
+
if (this._options.debug && window.console) console.log('[uploader] ' + str);
|
878 |
+
},
|
879 |
+
/**
|
880 |
+
* Adds file or file input to the queue
|
881 |
+
* @returns id
|
882 |
+
**/
|
883 |
+
add: function(file){},
|
884 |
+
/**
|
885 |
+
* Sends the file identified by id and additional query params to the server
|
886 |
+
*/
|
887 |
+
upload: function(id, params){
|
888 |
+
var len = this._queue.push(id);
|
889 |
+
|
890 |
+
var copy = {};
|
891 |
+
qq.extend(copy, params);
|
892 |
+
this._params[id] = copy;
|
893 |
+
|
894 |
+
// if too many active uploads, wait...
|
895 |
+
if (len <= this._options.maxConnections){
|
896 |
+
this._upload(id, this._params[id]);
|
897 |
+
}
|
898 |
+
},
|
899 |
+
/**
|
900 |
+
* Cancels file upload by id
|
901 |
+
*/
|
902 |
+
cancel: function(id){
|
903 |
+
this._cancel(id);
|
904 |
+
this._dequeue(id);
|
905 |
+
},
|
906 |
+
/**
|
907 |
+
* Cancells all uploads
|
908 |
+
*/
|
909 |
+
cancelAll: function(){
|
910 |
+
for (var i=0; i<this._queue.length; i++){
|
911 |
+
this._cancel(this._queue[i]);
|
912 |
+
}
|
913 |
+
this._queue = [];
|
914 |
+
},
|
915 |
+
/**
|
916 |
+
* Returns name of the file identified by id
|
917 |
+
*/
|
918 |
+
getName: function(id){},
|
919 |
+
/**
|
920 |
+
* Returns size of the file identified by id
|
921 |
+
*/
|
922 |
+
getSize: function(id){},
|
923 |
+
/**
|
924 |
+
* Returns id of files being uploaded or
|
925 |
+
* waiting for their turn
|
926 |
+
*/
|
927 |
+
getQueue: function(){
|
928 |
+
return this._queue;
|
929 |
+
},
|
930 |
+
/**
|
931 |
+
* Actual upload method
|
932 |
+
*/
|
933 |
+
_upload: function(id){},
|
934 |
+
/**
|
935 |
+
* Actual cancel method
|
936 |
+
*/
|
937 |
+
_cancel: function(id){},
|
938 |
+
/**
|
939 |
+
* Removes element from queue, starts upload of next
|
940 |
+
*/
|
941 |
+
_dequeue: function(id){
|
942 |
+
var i = qq.indexOf(this._queue, id);
|
943 |
+
this._queue.splice(i, 1);
|
944 |
+
|
945 |
+
var max = this._options.maxConnections;
|
946 |
+
|
947 |
+
if (this._queue.length >= max && i < max){
|
948 |
+
var nextId = this._queue[max-1];
|
949 |
+
this._upload(nextId, this._params[nextId]);
|
950 |
+
}
|
951 |
+
}
|
952 |
+
};
|
953 |
+
|
954 |
+
/**
|
955 |
+
* Class for uploading files using form and iframe
|
956 |
+
* @inherits qq.UploadHandlerAbstract
|
957 |
+
*/
|
958 |
+
qq.UploadHandlerForm = function(o){
|
959 |
+
qq.UploadHandlerAbstract.apply(this, arguments);
|
960 |
+
|
961 |
+
this._inputs = {};
|
962 |
+
};
|
963 |
+
// @inherits qq.UploadHandlerAbstract
|
964 |
+
qq.extend(qq.UploadHandlerForm.prototype, qq.UploadHandlerAbstract.prototype);
|
965 |
+
|
966 |
+
qq.extend(qq.UploadHandlerForm.prototype, {
|
967 |
+
add: function(fileInput){
|
968 |
+
fileInput.setAttribute('name', 'qqfile');
|
969 |
+
var id = 'qq-upload-handler-iframe' + qq.getUniqueId();
|
970 |
+
|
971 |
+
this._inputs[id] = fileInput;
|
972 |
+
|
973 |
+
// remove file input from DOM
|
974 |
+
if (fileInput.parentNode){
|
975 |
+
qq.remove(fileInput);
|
976 |
+
}
|
977 |
+
|
978 |
+
return id;
|
979 |
+
},
|
980 |
+
getName: function(id){
|
981 |
+
// get input value and remove path to normalize
|
982 |
+
return this._inputs[id].value.replace(/.*(\/|\\)/, "");
|
983 |
+
},
|
984 |
+
_cancel: function(id){
|
985 |
+
this._options.onCancel(id, this.getName(id));
|
986 |
+
|
987 |
+
delete this._inputs[id];
|
988 |
+
|
989 |
+
var iframe = document.getElementById(id);
|
990 |
+
if (iframe){
|
991 |
+
// to cancel request set src to something else
|
992 |
+
// we use src="javascript:false;" because it doesn't
|
993 |
+
// trigger ie6 prompt on https
|
994 |
+
iframe.setAttribute('src', 'javascript:false;');
|
995 |
+
|
996 |
+
qq.remove(iframe);
|
997 |
+
}
|
998 |
+
},
|
999 |
+
_upload: function(id, params){
|
1000 |
+
var input = this._inputs[id];
|
1001 |
+
|
1002 |
+
if (!input){
|
1003 |
+
throw new Error('file with passed id was not added, or already uploaded or cancelled');
|
1004 |
+
}
|
1005 |
+
|
1006 |
+
var fileName = this.getName(id);
|
1007 |
+
|
1008 |
+
var iframe = this._createIframe(id);
|
1009 |
+
var form = this._createForm(iframe, params);
|
1010 |
+
form.appendChild(input);
|
1011 |
+
|
1012 |
+
var self = this;
|
1013 |
+
this._attachLoadEvent(iframe, function(){
|
1014 |
+
self.log('iframe loaded');
|
1015 |
+
|
1016 |
+
var response = self._getIframeContentJSON(iframe);
|
1017 |
+
|
1018 |
+
self._options.onComplete(id, fileName, response);
|
1019 |
+
self._dequeue(id);
|
1020 |
+
|
1021 |
+
delete self._inputs[id];
|
1022 |
+
// timeout added to fix busy state in FF3.6
|
1023 |
+
setTimeout(function(){
|
1024 |
+
qq.remove(iframe);
|
1025 |
+
}, 1);
|
1026 |
+
});
|
1027 |
+
|
1028 |
+
form.submit();
|
1029 |
+
qq.remove(form);
|
1030 |
+
|
1031 |
+
return id;
|
1032 |
+
},
|
1033 |
+
_attachLoadEvent: function(iframe, callback){
|
1034 |
+
qq.attach(iframe, 'load', function(){
|
1035 |
+
// when we remove iframe from dom
|
1036 |
+
// the request stops, but in IE load
|
1037 |
+
// event fires
|
1038 |
+
if (!iframe.parentNode){
|
1039 |
+
return;
|
1040 |
+
}
|
1041 |
+
|
1042 |
+
// fixing Opera 10.53
|
1043 |
+
if (iframe.contentDocument &&
|
1044 |
+
iframe.contentDocument.body &&
|
1045 |
+
iframe.contentDocument.body.innerHTML == "false"){
|
1046 |
+
// In Opera event is fired second time
|
1047 |
+
// when body.innerHTML changed from false
|
1048 |
+
// to server response approx. after 1 sec
|
1049 |
+
// when we upload file with iframe
|
1050 |
+
return;
|
1051 |
+
}
|
1052 |
+
|
1053 |
+
callback();
|
1054 |
+
});
|
1055 |
+
},
|
1056 |
+
/**
|
1057 |
+
* Returns json object received by iframe from server.
|
1058 |
+
*/
|
1059 |
+
_getIframeContentJSON: function(iframe){
|
1060 |
+
// iframe.contentWindow.document - for IE<7
|
1061 |
+
var doc = iframe.contentDocument ? iframe.contentDocument: iframe.contentWindow.document,
|
1062 |
+
response;
|
1063 |
+
|
1064 |
+
this.log("converting iframe's innerHTML to JSON");
|
1065 |
+
this.log("innerHTML = " + doc.body.innerHTML);
|
1066 |
+
|
1067 |
+
try {
|
1068 |
+
response = eval("(" + doc.body.innerHTML + ")");
|
1069 |
+
} catch(err){
|
1070 |
+
response = {};
|
1071 |
+
}
|
1072 |
+
|
1073 |
+
return response;
|
1074 |
+
},
|
1075 |
+
/**
|
1076 |
+
* Creates iframe with unique name
|
1077 |
+
*/
|
1078 |
+
_createIframe: function(id){
|
1079 |
+
// We can't use following code as the name attribute
|
1080 |
+
// won't be properly registered in IE6, and new window
|
1081 |
+
// on form submit will open
|
1082 |
+
// var iframe = document.createElement('iframe');
|
1083 |
+
// iframe.setAttribute('name', id);
|
1084 |
+
|
1085 |
+
var iframe = qq.toElement('<iframe src="javascript:false;" name="' + id + '" />');
|
1086 |
+
// src="javascript:false;" removes ie6 prompt on https
|
1087 |
+
|
1088 |
+
iframe.setAttribute('id', id);
|
1089 |
+
|
1090 |
+
iframe.style.display = 'none';
|
1091 |
+
document.body.appendChild(iframe);
|
1092 |
+
|
1093 |
+
return iframe;
|
1094 |
+
},
|
1095 |
+
/**
|
1096 |
+
* Creates form, that will be submitted to iframe
|
1097 |
+
*/
|
1098 |
+
_createForm: function(iframe, params){
|
1099 |
+
// We can't use the following code in IE6
|
1100 |
+
// var form = document.createElement('form');
|
1101 |
+
// form.setAttribute('method', 'post');
|
1102 |
+
// form.setAttribute('enctype', 'multipart/form-data');
|
1103 |
+
// Because in this case file won't be attached to request
|
1104 |
+
var form = qq.toElement('<form method="post" enctype="multipart/form-data"></form>');
|
1105 |
+
|
1106 |
+
var queryString = qq.obj2url(params, this._options.action);
|
1107 |
+
|
1108 |
+
form.setAttribute('action', queryString);
|
1109 |
+
form.setAttribute('target', iframe.name);
|
1110 |
+
form.style.display = 'none';
|
1111 |
+
document.body.appendChild(form);
|
1112 |
+
|
1113 |
+
return form;
|
1114 |
+
}
|
1115 |
+
});
|
1116 |
+
|
1117 |
+
/**
|
1118 |
+
* Class for uploading files using xhr
|
1119 |
+
* @inherits qq.UploadHandlerAbstract
|
1120 |
+
*/
|
1121 |
+
qq.UploadHandlerXhr = function(o){
|
1122 |
+
qq.UploadHandlerAbstract.apply(this, arguments);
|
1123 |
+
|
1124 |
+
this._files = [];
|
1125 |
+
this._xhrs = [];
|
1126 |
+
|
1127 |
+
// current loaded size in bytes for each file
|
1128 |
+
this._loaded = [];
|
1129 |
+
};
|
1130 |
+
|
1131 |
+
// static method
|
1132 |
+
qq.UploadHandlerXhr.isSupported = function(){
|
1133 |
+
var input = document.createElement('input');
|
1134 |
+
input.type = 'file';
|
1135 |
+
|
1136 |
+
return (
|
1137 |
+
'multiple' in input &&
|
1138 |
+
typeof File != "undefined" &&
|
1139 |
+
typeof (new XMLHttpRequest()).upload != "undefined" );
|
1140 |
+
};
|
1141 |
+
|
1142 |
+
// @inherits qq.UploadHandlerAbstract
|
1143 |
+
qq.extend(qq.UploadHandlerXhr.prototype, qq.UploadHandlerAbstract.prototype)
|
1144 |
+
|
1145 |
+
qq.extend(qq.UploadHandlerXhr.prototype, {
|
1146 |
+
/**
|
1147 |
+
* Adds file to the queue
|
1148 |
+
* Returns id to use with upload, cancel
|
1149 |
+
**/
|
1150 |
+
add: function(file){
|
1151 |
+
if (!(file instanceof File)){
|
1152 |
+
throw new Error('Passed obj in not a File (in qq.UploadHandlerXhr)');
|
1153 |
+
}
|
1154 |
+
|
1155 |
+
return this._files.push(file) - 1;
|
1156 |
+
},
|
1157 |
+
getName: function(id){
|
1158 |
+
var file = this._files[id];
|
1159 |
+
// fix missing name in Safari 4
|
1160 |
+
return file.fileName != null ? file.fileName : file.name;
|
1161 |
+
},
|
1162 |
+
getSize: function(id){
|
1163 |
+
var file = this._files[id];
|
1164 |
+
return file.fileSize != null ? file.fileSize : file.size;
|
1165 |
+
},
|
1166 |
+
/**
|
1167 |
+
* Returns uploaded bytes for file identified by id
|
1168 |
+
*/
|
1169 |
+
getLoaded: function(id){
|
1170 |
+
return this._loaded[id] || 0;
|
1171 |
+
},
|
1172 |
+
/**
|
1173 |
+
* Sends the file identified by id and additional query params to the server
|
1174 |
+
* @param {Object} params name-value string pairs
|
1175 |
+
*/
|
1176 |
+
_upload: function(id, params){
|
1177 |
+
var file = this._files[id],
|
1178 |
+
name = this.getName(id),
|
1179 |
+
size = this.getSize(id);
|
1180 |
+
|
1181 |
+
this._loaded[id] = 0;
|
1182 |
+
|
1183 |
+
var xhr = this._xhrs[id] = new XMLHttpRequest();
|
1184 |
+
var self = this;
|
1185 |
+
|
1186 |
+
xhr.upload.onprogress = function(e){
|
1187 |
+
if (e.lengthComputable){
|
1188 |
+
self._loaded[id] = e.loaded;
|
1189 |
+
self._options.onProgress(id, name, e.loaded, e.total);
|
1190 |
+
}
|
1191 |
+
};
|
1192 |
+
|
1193 |
+
xhr.onreadystatechange = function(){
|
1194 |
+
if (xhr.readyState == 4){
|
1195 |
+
self._onComplete(id, xhr);
|
1196 |
+
}
|
1197 |
+
};
|
1198 |
+
|
1199 |
+
// build query string
|
1200 |
+
params = params || {};
|
1201 |
+
params['qqfile'] = name;
|
1202 |
+
var queryString = qq.obj2url(params, this._options.action);
|
1203 |
+
|
1204 |
+
xhr.open("POST", queryString, true);
|
1205 |
+
xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest");
|
1206 |
+
xhr.setRequestHeader("X-File-Name", encodeURIComponent(name));
|
1207 |
+
xhr.setRequestHeader("Content-Type", "application/octet-stream");
|
1208 |
+
xhr.send(file);
|
1209 |
+
},
|
1210 |
+
_onComplete: function(id, xhr){
|
1211 |
+
// the request was aborted/cancelled
|
1212 |
+
if (!this._files[id]) return;
|
1213 |
+
|
1214 |
+
var name = this.getName(id);
|
1215 |
+
var size = this.getSize(id);
|
1216 |
+
|
1217 |
+
this._options.onProgress(id, name, size, size);
|
1218 |
+
|
1219 |
+
if (xhr.status == 200){
|
1220 |
+
this.log("xhr - server response received");
|
1221 |
+
this.log("responseText = " + xhr.responseText);
|
1222 |
+
|
1223 |
+
var response;
|
1224 |
+
|
1225 |
+
try {
|
1226 |
+
response = eval("(" + xhr.responseText + ")");
|
1227 |
+
} catch(err){
|
1228 |
+
response = {};
|
1229 |
+
}
|
1230 |
+
|
1231 |
+
this._options.onComplete(id, name, response);
|
1232 |
+
|
1233 |
+
} else {
|
1234 |
+
this._options.onComplete(id, name, {});
|
1235 |
+
}
|
1236 |
+
|
1237 |
+
this._files[id] = null;
|
1238 |
+
this._xhrs[id] = null;
|
1239 |
+
this._dequeue(id);
|
1240 |
+
},
|
1241 |
+
_cancel: function(id){
|
1242 |
+
this._options.onCancel(id, this.getName(id));
|
1243 |
+
|
1244 |
+
this._files[id] = null;
|
1245 |
+
|
1246 |
+
if (this._xhrs[id]){
|
1247 |
+
this._xhrs[id].abort();
|
1248 |
+
this._xhrs[id] = null;
|
1249 |
+
}
|
1250 |
+
}
|
1251 |
+
});
|
js/lookbook/jquery-ui-1.8.17.js
ADDED
@@ -0,0 +1,11827 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*!
|
2 |
+
* jQuery UI 1.8.17
|
3 |
+
*
|
4 |
+
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
|
5 |
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
6 |
+
* http://jquery.org/license
|
7 |
+
*
|
8 |
+
* http://docs.jquery.com/UI
|
9 |
+
*/
|
10 |
+
(function( $, undefined ) {
|
11 |
+
|
12 |
+
// prevent duplicate loading
|
13 |
+
// this is only a problem because we proxy existing functions
|
14 |
+
// and we don't want to double proxy them
|
15 |
+
$.ui = $.ui || {};
|
16 |
+
if ( $.ui.version ) {
|
17 |
+
return;
|
18 |
+
}
|
19 |
+
|
20 |
+
$.extend( $.ui, {
|
21 |
+
version: "1.8.17",
|
22 |
+
|
23 |
+
keyCode: {
|
24 |
+
ALT: 18,
|
25 |
+
BACKSPACE: 8,
|
26 |
+
CAPS_LOCK: 20,
|
27 |
+
COMMA: 188,
|
28 |
+
COMMAND: 91,
|
29 |
+
COMMAND_LEFT: 91, // COMMAND
|
30 |
+
COMMAND_RIGHT: 93,
|
31 |
+
CONTROL: 17,
|
32 |
+
DELETE: 46,
|
33 |
+
DOWN: 40,
|
34 |
+
END: 35,
|
35 |
+
ENTER: 13,
|
36 |
+
ESCAPE: 27,
|
37 |
+
HOME: 36,
|
38 |
+
INSERT: 45,
|
39 |
+
LEFT: 37,
|
40 |
+
MENU: 93, // COMMAND_RIGHT
|
41 |
+
NUMPAD_ADD: 107,
|
42 |
+
NUMPAD_DECIMAL: 110,
|
43 |
+
NUMPAD_DIVIDE: 111,
|
44 |
+
NUMPAD_ENTER: 108,
|
45 |
+
NUMPAD_MULTIPLY: 106,
|
46 |
+
NUMPAD_SUBTRACT: 109,
|
47 |
+
PAGE_DOWN: 34,
|
48 |
+
PAGE_UP: 33,
|
49 |
+
PERIOD: 190,
|
50 |
+
RIGHT: 39,
|
51 |
+
SHIFT: 16,
|
52 |
+
SPACE: 32,
|
53 |
+
TAB: 9,
|
54 |
+
UP: 38,
|
55 |
+
WINDOWS: 91 // COMMAND
|
56 |
+
}
|
57 |
+
});
|
58 |
+
|
59 |
+
// plugins
|
60 |
+
$.fn.extend({
|
61 |
+
propAttr: $.fn.prop || $.fn.attr,
|
62 |
+
|
63 |
+
_focus: $.fn.focus,
|
64 |
+
focus: function( delay, fn ) {
|
65 |
+
return typeof delay === "number" ?
|
66 |
+
this.each(function() {
|
67 |
+
var elem = this;
|
68 |
+
setTimeout(function() {
|
69 |
+
$( elem ).focus();
|
70 |
+
if ( fn ) {
|
71 |
+
fn.call( elem );
|
72 |
+
}
|
73 |
+
}, delay );
|
74 |
+
}) :
|
75 |
+
this._focus.apply( this, arguments );
|
76 |
+
},
|
77 |
+
|
78 |
+
scrollParent: function() {
|
79 |
+
var scrollParent;
|
80 |
+
if (($.browser.msie && (/(static|relative)/).test(this.css('position'))) || (/absolute/).test(this.css('position'))) {
|
81 |
+
scrollParent = this.parents().filter(function() {
|
82 |
+
return (/(relative|absolute|fixed)/).test($.curCSS(this,'position',1)) && (/(auto|scroll)/).test($.curCSS(this,'overflow',1)+$.curCSS(this,'overflow-y',1)+$.curCSS(this,'overflow-x',1));
|
83 |
+
}).eq(0);
|
84 |
+
} else {
|
85 |
+
scrollParent = this.parents().filter(function() {
|
86 |
+
return (/(auto|scroll)/).test($.curCSS(this,'overflow',1)+$.curCSS(this,'overflow-y',1)+$.curCSS(this,'overflow-x',1));
|
87 |
+
}).eq(0);
|
88 |
+
}
|
89 |
+
|
90 |
+
return (/fixed/).test(this.css('position')) || !scrollParent.length ? $(document) : scrollParent;
|
91 |
+
},
|
92 |
+
|
93 |
+
zIndex: function( zIndex ) {
|
94 |
+
if ( zIndex !== undefined ) {
|
95 |
+
return this.css( "zIndex", zIndex );
|
96 |
+
}
|
97 |
+
|
98 |
+
if ( this.length ) {
|
99 |
+
var elem = $( this[ 0 ] ), position, value;
|
100 |
+
while ( elem.length && elem[ 0 ] !== document ) {
|
101 |
+
// Ignore z-index if position is set to a value where z-index is ignored by the browser
|
102 |
+
// This makes behavior of this function consistent across browsers
|
103 |
+
// WebKit always returns auto if the element is positioned
|
104 |
+
position = elem.css( "position" );
|
105 |
+
if ( position === "absolute" || position === "relative" || position === "fixed" ) {
|
106 |
+
// IE returns 0 when zIndex is not specified
|
107 |
+
// other browsers return a string
|
108 |
+
// we ignore the case of nested elements with an explicit value of 0
|
109 |
+
// <div style="z-index: -10;"><div style="z-index: 0;"></div></div>
|
110 |
+
value = parseInt( elem.css( "zIndex" ), 10 );
|
111 |
+
if ( !isNaN( value ) && value !== 0 ) {
|
112 |
+
return value;
|
113 |
+
}
|
114 |
+
}
|
115 |
+
elem = elem.parent();
|
116 |
+
}
|
117 |
+
}
|
118 |
+
|
119 |
+
return 0;
|
120 |
+
},
|
121 |
+
|
122 |
+
disableSelection: function() {
|
123 |
+
return this.bind( ( $.support.selectstart ? "selectstart" : "mousedown" ) +
|
124 |
+
".ui-disableSelection", function( event ) {
|
125 |
+
event.preventDefault();
|
126 |
+
});
|
127 |
+
},
|
128 |
+
|
129 |
+
enableSelection: function() {
|
130 |
+
return this.unbind( ".ui-disableSelection" );
|
131 |
+
}
|
132 |
+
});
|
133 |
+
|
134 |
+
$.each( [ "Width", "Height" ], function( i, name ) {
|
135 |
+
var side = name === "Width" ? [ "Left", "Right" ] : [ "Top", "Bottom" ],
|
136 |
+
type = name.toLowerCase(),
|
137 |
+
orig = {
|
138 |
+
innerWidth: $.fn.innerWidth,
|
139 |
+
innerHeight: $.fn.innerHeight,
|
140 |
+
outerWidth: $.fn.outerWidth,
|
141 |
+
outerHeight: $.fn.outerHeight
|
142 |
+
};
|
143 |
+
|
144 |
+
function reduce( elem, size, border, margin ) {
|
145 |
+
$.each( side, function() {
|
146 |
+
size -= parseFloat( $.curCSS( elem, "padding" + this, true) ) || 0;
|
147 |
+
if ( border ) {
|
148 |
+
size -= parseFloat( $.curCSS( elem, "border" + this + "Width", true) ) || 0;
|
149 |
+
}
|
150 |
+
if ( margin ) {
|
151 |
+
size -= parseFloat( $.curCSS( elem, "margin" + this, true) ) || 0;
|
152 |
+
}
|
153 |
+
});
|
154 |
+
return size;
|
155 |
+
}
|
156 |
+
|
157 |
+
$.fn[ "inner" + name ] = function( size ) {
|
158 |
+
if ( size === undefined ) {
|
159 |
+
return orig[ "inner" + name ].call( this );
|
160 |
+
}
|
161 |
+
|
162 |
+
return this.each(function() {
|
163 |
+
$( this ).css( type, reduce( this, size ) + "px" );
|
164 |
+
});
|
165 |
+
};
|
166 |
+
|
167 |
+
$.fn[ "outer" + name] = function( size, margin ) {
|
168 |
+
if ( typeof size !== "number" ) {
|
169 |
+
return orig[ "outer" + name ].call( this, size );
|
170 |
+
}
|
171 |
+
|
172 |
+
return this.each(function() {
|
173 |
+
$( this).css( type, reduce( this, size, true, margin ) + "px" );
|
174 |
+
});
|
175 |
+
};
|
176 |
+
});
|
177 |
+
|
178 |
+
// selectors
|
179 |
+
function focusable( element, isTabIndexNotNaN ) {
|
180 |
+
var nodeName = element.nodeName.toLowerCase();
|
181 |
+
if ( "area" === nodeName ) {
|
182 |
+
var map = element.parentNode,
|
183 |
+
mapName = map.name,
|
184 |
+
img;
|
185 |
+
if ( !element.href || !mapName || map.nodeName.toLowerCase() !== "map" ) {
|
186 |
+
return false;
|
187 |
+
}
|
188 |
+
img = $( "img[usemap=#" + mapName + "]" )[0];
|
189 |
+
return !!img && visible( img );
|
190 |
+
}
|
191 |
+
return ( /input|select|textarea|button|object/.test( nodeName )
|
192 |
+
? !element.disabled
|
193 |
+
: "a" == nodeName
|
194 |
+
? element.href || isTabIndexNotNaN
|
195 |
+
: isTabIndexNotNaN)
|
196 |
+
// the element and all of its ancestors must be visible
|
197 |
+
&& visible( element );
|
198 |
+
}
|
199 |
+
|
200 |
+
function visible( element ) {
|
201 |
+
return !$( element ).parents().andSelf().filter(function() {
|
202 |
+
return $.curCSS( this, "visibility" ) === "hidden" ||
|
203 |
+
$.expr.filters.hidden( this );
|
204 |
+
}).length;
|
205 |
+
}
|
206 |
+
|
207 |
+
$.extend( $.expr[ ":" ], {
|
208 |
+
data: function( elem, i, match ) {
|
209 |
+
return !!$.data( elem, match[ 3 ] );
|
210 |
+
},
|
211 |
+
|
212 |
+
focusable: function( element ) {
|
213 |
+
return focusable( element, !isNaN( $.attr( element, "tabindex" ) ) );
|
214 |
+
},
|
215 |
+
|
216 |
+
tabbable: function( element ) {
|
217 |
+
var tabIndex = $.attr( element, "tabindex" ),
|
218 |
+
isTabIndexNaN = isNaN( tabIndex );
|
219 |
+
return ( isTabIndexNaN || tabIndex >= 0 ) && focusable( element, !isTabIndexNaN );
|
220 |
+
}
|
221 |
+
});
|
222 |
+
|
223 |
+
// support
|
224 |
+
$(function() {
|
225 |
+
var body = document.body,
|
226 |
+
div = body.appendChild( div = document.createElement( "div" ) );
|
227 |
+
|
228 |
+
$.extend( div.style, {
|
229 |
+
minHeight: "100px",
|
230 |
+
height: "auto",
|
231 |
+
padding: 0,
|
232 |
+
borderWidth: 0
|
233 |
+
});
|
234 |
+
|
235 |
+
$.support.minHeight = div.offsetHeight === 100;
|
236 |
+
$.support.selectstart = "onselectstart" in div;
|
237 |
+
|
238 |
+
// set display to none to avoid a layout bug in IE
|
239 |
+
// http://dev.jquery.com/ticket/4014
|
240 |
+
body.removeChild( div ).style.display = "none";
|
241 |
+
});
|
242 |
+
|
243 |
+
|
244 |
+
|
245 |
+
|
246 |
+
|
247 |
+
// deprecated
|
248 |
+
$.extend( $.ui, {
|
249 |
+
// $.ui.plugin is deprecated. Use the proxy pattern instead.
|
250 |
+
plugin: {
|
251 |
+
add: function( module, option, set ) {
|
252 |
+
var proto = $.ui[ module ].prototype;
|
253 |
+
for ( var i in set ) {
|
254 |
+
proto.plugins[ i ] = proto.plugins[ i ] || [];
|
255 |
+
proto.plugins[ i ].push( [ option, set[ i ] ] );
|
256 |
+
}
|
257 |
+
},
|
258 |
+
call: function( instance, name, args ) {
|
259 |
+
var set = instance.plugins[ name ];
|
260 |
+
if ( !set || !instance.element[ 0 ].parentNode ) {
|
261 |
+
return;
|
262 |
+
}
|
263 |
+
|
264 |
+
for ( var i = 0; i < set.length; i++ ) {
|
265 |
+
if ( instance.options[ set[ i ][ 0 ] ] ) {
|
266 |
+
set[ i ][ 1 ].apply( instance.element, args );
|
267 |
+
}
|
268 |
+
}
|
269 |
+
}
|
270 |
+
},
|
271 |
+
|
272 |
+
// will be deprecated when we switch to jQuery 1.4 - use jQuery.contains()
|
273 |
+
contains: function( a, b ) {
|
274 |
+
return document.compareDocumentPosition ?
|
275 |
+
a.compareDocumentPosition( b ) & 16 :
|
276 |
+
a !== b && a.contains( b );
|
277 |
+
},
|
278 |
+
|
279 |
+
// only used by resizable
|
280 |
+
hasScroll: function( el, a ) {
|
281 |
+
|
282 |
+
//If overflow is hidden, the element might have extra content, but the user wants to hide it
|
283 |
+
if ( $( el ).css( "overflow" ) === "hidden") {
|
284 |
+
return false;
|
285 |
+
}
|
286 |
+
|
287 |
+
var scroll = ( a && a === "left" ) ? "scrollLeft" : "scrollTop",
|
288 |
+
has = false;
|
289 |
+
|
290 |
+
if ( el[ scroll ] > 0 ) {
|
291 |
+
return true;
|
292 |
+
}
|
293 |
+
|
294 |
+
// TODO: determine which cases actually cause this to happen
|
295 |
+
// if the element doesn't have the scroll set, see if it's possible to
|
296 |
+
// set the scroll
|
297 |
+
el[ scroll ] = 1;
|
298 |
+
has = ( el[ scroll ] > 0 );
|
299 |
+
el[ scroll ] = 0;
|
300 |
+
return has;
|
301 |
+
},
|
302 |
+
|
303 |
+
// these are odd functions, fix the API or move into individual plugins
|
304 |
+
isOverAxis: function( x, reference, size ) {
|
305 |
+
//Determines when x coordinate is over "b" element axis
|
306 |
+
return ( x > reference ) && ( x < ( reference + size ) );
|
307 |
+
},
|
308 |
+
isOver: function( y, x, top, left, height, width ) {
|
309 |
+
//Determines when x, y coordinates is over "b" element
|
310 |
+
return $.ui.isOverAxis( y, top, height ) && $.ui.isOverAxis( x, left, width );
|
311 |
+
}
|
312 |
+
});
|
313 |
+
|
314 |
+
})( jQuery );
|
315 |
+
/*!
|
316 |
+
* jQuery UI Widget 1.8.17
|
317 |
+
*
|
318 |
+
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
|
319 |
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
320 |
+
* http://jquery.org/license
|
321 |
+
*
|
322 |
+
* http://docs.jquery.com/UI/Widget
|
323 |
+
*/
|
324 |
+
(function( $, undefined ) {
|
325 |
+
|
326 |
+
// jQuery 1.4+
|
327 |
+
if ( $.cleanData ) {
|
328 |
+
var _cleanData = $.cleanData;
|
329 |
+
$.cleanData = function( elems ) {
|
330 |
+
for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) {
|
331 |
+
try {
|
332 |
+
$( elem ).triggerHandler( "remove" );
|
333 |
+
// http://bugs.jquery.com/ticket/8235
|
334 |
+
} catch( e ) {}
|
335 |
+
}
|
336 |
+
_cleanData( elems );
|
337 |
+
};
|
338 |
+
} else {
|
339 |
+
var _remove = $.fn.remove;
|
340 |
+
$.fn.remove = function( selector, keepData ) {
|
341 |
+
return this.each(function() {
|
342 |
+
if ( !keepData ) {
|
343 |
+
if ( !selector || $.filter( selector, [ this ] ).length ) {
|
344 |
+
$( "*", this ).add( [ this ] ).each(function() {
|
345 |
+
try {
|
346 |
+
$( this ).triggerHandler( "remove" );
|
347 |
+
// http://bugs.jquery.com/ticket/8235
|
348 |
+
} catch( e ) {}
|
349 |
+
});
|
350 |
+
}
|
351 |
+
}
|
352 |
+
return _remove.call( $(this), selector, keepData );
|
353 |
+
});
|
354 |
+
};
|
355 |
+
}
|
356 |
+
|
357 |
+
$.widget = function( name, base, prototype ) {
|
358 |
+
var namespace = name.split( "." )[ 0 ],
|
359 |
+
fullName;
|
360 |
+
name = name.split( "." )[ 1 ];
|
361 |
+
fullName = namespace + "-" + name;
|
362 |
+
|
363 |
+
if ( !prototype ) {
|
364 |
+
prototype = base;
|
365 |
+
base = $.Widget;
|
366 |
+
}
|
367 |
+
|
368 |
+
// create selector for plugin
|
369 |
+
$.expr[ ":" ][ fullName ] = function( elem ) {
|
370 |
+
return !!$.data( elem, name );
|
371 |
+
};
|
372 |
+
|
373 |
+
$[ namespace ] = $[ namespace ] || {};
|
374 |
+
$[ namespace ][ name ] = function( options, element ) {
|
375 |
+
// allow instantiation without initializing for simple inheritance
|
376 |
+
if ( arguments.length ) {
|
377 |
+
this._createWidget( options, element );
|
378 |
+
}
|
379 |
+
};
|
380 |
+
|
381 |
+
var basePrototype = new base();
|
382 |
+
// we need to make the options hash a property directly on the new instance
|
383 |
+
// otherwise we'll modify the options hash on the prototype that we're
|
384 |
+
// inheriting from
|
385 |
+
// $.each( basePrototype, function( key, val ) {
|
386 |
+
// if ( $.isPlainObject(val) ) {
|
387 |
+
// basePrototype[ key ] = $.extend( {}, val );
|
388 |
+
// }
|
389 |
+
// });
|
390 |
+
basePrototype.options = $.extend( true, {}, basePrototype.options );
|
391 |
+
$[ namespace ][ name ].prototype = $.extend( true, basePrototype, {
|
392 |
+
namespace: namespace,
|
393 |
+
widgetName: name,
|
394 |
+
widgetEventPrefix: $[ namespace ][ name ].prototype.widgetEventPrefix || name,
|
395 |
+
widgetBaseClass: fullName
|
396 |
+
}, prototype );
|
397 |
+
|
398 |
+
$.widget.bridge( name, $[ namespace ][ name ] );
|
399 |
+
};
|
400 |
+
|
401 |
+
$.widget.bridge = function( name, object ) {
|
402 |
+
$.fn[ name ] = function( options ) {
|
403 |
+
var isMethodCall = typeof options === "string",
|
404 |
+
args = Array.prototype.slice.call( arguments, 1 ),
|
405 |
+
returnValue = this;
|
406 |
+
|
407 |
+
// allow multiple hashes to be passed on init
|
408 |
+
options = !isMethodCall && args.length ?
|
409 |
+
$.extend.apply( null, [ true, options ].concat(args) ) :
|
410 |
+
options;
|
411 |
+
|
412 |
+
// prevent calls to internal methods
|
413 |
+
if ( isMethodCall && options.charAt( 0 ) === "_" ) {
|
414 |
+
return returnValue;
|
415 |
+
}
|
416 |
+
|
417 |
+
if ( isMethodCall ) {
|
418 |
+
this.each(function() {
|
419 |
+
var instance = $.data( this, name ),
|
420 |
+
methodValue = instance && $.isFunction( instance[options] ) ?
|
421 |
+
instance[ options ].apply( instance, args ) :
|
422 |
+
instance;
|
423 |
+
// TODO: add this back in 1.9 and use $.error() (see #5972)
|
424 |
+
// if ( !instance ) {
|
425 |
+
// throw "cannot call methods on " + name + " prior to initialization; " +
|
426 |
+
// "attempted to call method '" + options + "'";
|
427 |
+
// }
|
428 |
+
// if ( !$.isFunction( instance[options] ) ) {
|
429 |
+
// throw "no such method '" + options + "' for " + name + " widget instance";
|
430 |
+
// }
|
431 |
+
// var methodValue = instance[ options ].apply( instance, args );
|
432 |
+
if ( methodValue !== instance && methodValue !== undefined ) {
|
433 |
+
returnValue = methodValue;
|
434 |
+
return false;
|
435 |
+
}
|
436 |
+
});
|
437 |
+
} else {
|
438 |
+
this.each(function() {
|
439 |
+
var instance = $.data( this, name );
|
440 |
+
if ( instance ) {
|
441 |
+
instance.option( options || {} )._init();
|
442 |
+
} else {
|
443 |
+
$.data( this, name, new object( options, this ) );
|
444 |
+
}
|
445 |
+
});
|
446 |
+
}
|
447 |
+
|
448 |
+
return returnValue;
|
449 |
+
};
|
450 |
+
};
|
451 |
+
|
452 |
+
$.Widget = function( options, element ) {
|
453 |
+
// allow instantiation without initializing for simple inheritance
|
454 |
+
if ( arguments.length ) {
|
455 |
+
this._createWidget( options, element );
|
456 |
+
}
|
457 |
+
};
|
458 |
+
|
459 |
+
$.Widget.prototype = {
|
460 |
+
widgetName: "widget",
|
461 |
+
widgetEventPrefix: "",
|
462 |
+
options: {
|
463 |
+
disabled: false
|
464 |
+
},
|
465 |
+
_createWidget: function( options, element ) {
|
466 |
+
// $.widget.bridge stores the plugin instance, but we do it anyway
|
467 |
+
// so that it's stored even before the _create function runs
|
468 |
+
$.data( element, this.widgetName, this );
|
469 |
+
this.element = $( element );
|
470 |
+
this.options = $.extend( true, {},
|
471 |
+
this.options,
|
472 |
+
this._getCreateOptions(),
|
473 |
+
options );
|
474 |
+
|
475 |
+
var self = this;
|
476 |
+
this.element.bind( "remove." + this.widgetName, function() {
|
477 |
+
self.destroy();
|
478 |
+
});
|
479 |
+
|
480 |
+
this._create();
|
481 |
+
this._trigger( "create" );
|
482 |
+
this._init();
|
483 |
+
},
|
484 |
+
_getCreateOptions: function() {
|
485 |
+
return $.metadata && $.metadata.get( this.element[0] )[ this.widgetName ];
|
486 |
+
},
|
487 |
+
_create: function() {},
|
488 |
+
_init: function() {},
|
489 |
+
|
490 |
+
destroy: function() {
|
491 |
+
this.element
|
492 |
+
.unbind( "." + this.widgetName )
|
493 |
+
.removeData( this.widgetName );
|
494 |
+
this.widget()
|
495 |
+
.unbind( "." + this.widgetName )
|
496 |
+
.removeAttr( "aria-disabled" )
|
497 |
+
.removeClass(
|
498 |
+
this.widgetBaseClass + "-disabled " +
|
499 |
+
"ui-state-disabled" );
|
500 |
+
},
|
501 |
+
|
502 |
+
widget: function() {
|
503 |
+
return this.element;
|
504 |
+
},
|
505 |
+
|
506 |
+
option: function( key, value ) {
|
507 |
+
var options = key;
|
508 |
+
|
509 |
+
if ( arguments.length === 0 ) {
|
510 |
+
// don't return a reference to the internal hash
|
511 |
+
return $.extend( {}, this.options );
|
512 |
+
}
|
513 |
+
|
514 |
+
if (typeof key === "string" ) {
|
515 |
+
if ( value === undefined ) {
|
516 |
+
return this.options[ key ];
|
517 |
+
}
|
518 |
+
options = {};
|
519 |
+
options[ key ] = value;
|
520 |
+
}
|
521 |
+
|
522 |
+
this._setOptions( options );
|
523 |
+
|
524 |
+
return this;
|
525 |
+
},
|
526 |
+
_setOptions: function( options ) {
|
527 |
+
var self = this;
|
528 |
+
$.each( options, function( key, value ) {
|
529 |
+
self._setOption( key, value );
|
530 |
+
});
|
531 |
+
|
532 |
+
return this;
|
533 |
+
},
|
534 |
+
_setOption: function( key, value ) {
|
535 |
+
this.options[ key ] = value;
|
536 |
+
|
537 |
+
if ( key === "disabled" ) {
|
538 |
+
this.widget()
|
539 |
+
[ value ? "addClass" : "removeClass"](
|
540 |
+
this.widgetBaseClass + "-disabled" + " " +
|
541 |
+
"ui-state-disabled" )
|
542 |
+
.attr( "aria-disabled", value );
|
543 |
+
}
|
544 |
+
|
545 |
+
return this;
|
546 |
+
},
|
547 |
+
|
548 |
+
enable: function() {
|
549 |
+
return this._setOption( "disabled", false );
|
550 |
+
},
|
551 |
+
disable: function() {
|
552 |
+
return this._setOption( "disabled", true );
|
553 |
+
},
|
554 |
+
|
555 |
+
_trigger: function( type, event, data ) {
|
556 |
+
var prop, orig,
|
557 |
+
callback = this.options[ type ];
|
558 |
+
|
559 |
+
data = data || {};
|
560 |
+
event = $.Event( event );
|
561 |
+
event.type = ( type === this.widgetEventPrefix ?
|
562 |
+
type :
|
563 |
+
this.widgetEventPrefix + type ).toLowerCase();
|
564 |
+
// the original event may come from any element
|
565 |
+
// so we need to reset the target on the new event
|
566 |
+
event.target = this.element[ 0 ];
|
567 |
+
|
568 |
+
// copy original event properties over to the new event
|
569 |
+
orig = event.originalEvent;
|
570 |
+
if ( orig ) {
|
571 |
+
for ( prop in orig ) {
|
572 |
+
if ( !( prop in event ) ) {
|
573 |
+
event[ prop ] = orig[ prop ];
|
574 |
+
}
|
575 |
+
}
|
576 |
+
}
|
577 |
+
|
578 |
+
this.element.trigger( event, data );
|
579 |
+
|
580 |
+
return !( $.isFunction(callback) &&
|
581 |
+
callback.call( this.element[0], event, data ) === false ||
|
582 |
+
event.isDefaultPrevented() );
|
583 |
+
}
|
584 |
+
};
|
585 |
+
|
586 |
+
})( jQuery );
|
587 |
+
/*!
|
588 |
+
* jQuery UI Mouse 1.8.17
|
589 |
+
*
|
590 |
+
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
|
591 |
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
592 |
+
* http://jquery.org/license
|
593 |
+
*
|
594 |
+
* http://docs.jquery.com/UI/Mouse
|
595 |
+
*
|
596 |
+
* Depends:
|
597 |
+
* jquery.ui.widget.js
|
598 |
+
*/
|
599 |
+
(function( $, undefined ) {
|
600 |
+
|
601 |
+
var mouseHandled = false;
|
602 |
+
$( document ).mouseup( function( e ) {
|
603 |
+
mouseHandled = false;
|
604 |
+
});
|
605 |
+
|
606 |
+
$.widget("ui.mouse", {
|
607 |
+
options: {
|
608 |
+
cancel: ':input,option',
|
609 |
+
distance: 1,
|
610 |
+
delay: 0
|
611 |
+
},
|
612 |
+
_mouseInit: function() {
|
613 |
+
var self = this;
|
614 |
+
|
615 |
+
this.element
|
616 |
+
.bind('mousedown.'+this.widgetName, function(event) {
|
617 |
+
return self._mouseDown(event);
|
618 |
+
})
|
619 |
+
.bind('click.'+this.widgetName, function(event) {
|
620 |
+
if (true === $.data(event.target, self.widgetName + '.preventClickEvent')) {
|
621 |
+
$.removeData(event.target, self.widgetName + '.preventClickEvent');
|
622 |
+
event.stopImmediatePropagation();
|
623 |
+
return false;
|
624 |
+
}
|
625 |
+
});
|
626 |
+
|
627 |
+
this.started = false;
|
628 |
+
},
|
629 |
+
|
630 |
+
// TODO: make sure destroying one instance of mouse doesn't mess with
|
631 |
+
// other instances of mouse
|
632 |
+
_mouseDestroy: function() {
|
633 |
+
this.element.unbind('.'+this.widgetName);
|
634 |
+
},
|
635 |
+
|
636 |
+
_mouseDown: function(event) {
|
637 |
+
// don't let more than one widget handle mouseStart
|
638 |
+
if( mouseHandled ) { return };
|
639 |
+
|
640 |
+
// we may have missed mouseup (out of window)
|
641 |
+
(this._mouseStarted && this._mouseUp(event));
|
642 |
+
|
643 |
+
this._mouseDownEvent = event;
|
644 |
+
|
645 |
+
var self = this,
|
646 |
+
btnIsLeft = (event.which == 1),
|
647 |
+
// event.target.nodeName works around a bug in IE 8 with
|
648 |
+
// disabled inputs (#7620)
|
649 |
+
elIsCancel = (typeof this.options.cancel == "string" && event.target.nodeName ? $(event.target).closest(this.options.cancel).length : false);
|
650 |
+
if (!btnIsLeft || elIsCancel || !this._mouseCapture(event)) {
|
651 |
+
return true;
|
652 |
+
}
|
653 |
+
|
654 |
+
this.mouseDelayMet = !this.options.delay;
|
655 |
+
if (!this.mouseDelayMet) {
|
656 |
+
this._mouseDelayTimer = setTimeout(function() {
|
657 |
+
self.mouseDelayMet = true;
|
658 |
+
}, this.options.delay);
|
659 |
+
}
|
660 |
+
|
661 |
+
if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) {
|
662 |
+
this._mouseStarted = (this._mouseStart(event) !== false);
|
663 |
+
if (!this._mouseStarted) {
|
664 |
+
event.preventDefault();
|
665 |
+
return true;
|
666 |
+
}
|
667 |
+
}
|
668 |
+
|
669 |
+
// Click event may never have fired (Gecko & Opera)
|
670 |
+
if (true === $.data(event.target, this.widgetName + '.preventClickEvent')) {
|
671 |
+
$.removeData(event.target, this.widgetName + '.preventClickEvent');
|
672 |
+
}
|
673 |
+
|
674 |
+
// these delegates are required to keep context
|
675 |
+
this._mouseMoveDelegate = function(event) {
|
676 |
+
return self._mouseMove(event);
|
677 |
+
};
|
678 |
+
this._mouseUpDelegate = function(event) {
|
679 |
+
return self._mouseUp(event);
|
680 |
+
};
|
681 |
+
$(document)
|
682 |
+
.bind('mousemove.'+this.widgetName, this._mouseMoveDelegate)
|
683 |
+
.bind('mouseup.'+this.widgetName, this._mouseUpDelegate);
|
684 |
+
|
685 |
+
event.preventDefault();
|
686 |
+
|
687 |
+
mouseHandled = true;
|
688 |
+
return true;
|
689 |
+
},
|
690 |
+
|
691 |
+
_mouseMove: function(event) {
|
692 |
+
// IE mouseup check - mouseup happened when mouse was out of window
|
693 |
+
if ($.browser.msie && !(document.documentMode >= 9) && !event.button) {
|
694 |
+
return this._mouseUp(event);
|
695 |
+
}
|
696 |
+
|
697 |
+
if (this._mouseStarted) {
|
698 |
+
this._mouseDrag(event);
|
699 |
+
return event.preventDefault();
|
700 |
+
}
|
701 |
+
|
702 |
+
if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) {
|
703 |
+
this._mouseStarted =
|
704 |
+
(this._mouseStart(this._mouseDownEvent, event) !== false);
|
705 |
+
(this._mouseStarted ? this._mouseDrag(event) : this._mouseUp(event));
|
706 |
+
}
|
707 |
+
|
708 |
+
return !this._mouseStarted;
|
709 |
+
},
|
710 |
+
|
711 |
+
_mouseUp: function(event) {
|
712 |
+
$(document)
|
713 |
+
.unbind('mousemove.'+this.widgetName, this._mouseMoveDelegate)
|
714 |
+
.unbind('mouseup.'+this.widgetName, this._mouseUpDelegate);
|
715 |
+
|
716 |
+
if (this._mouseStarted) {
|
717 |
+
this._mouseStarted = false;
|
718 |
+
|
719 |
+
if (event.target == this._mouseDownEvent.target) {
|
720 |
+
$.data(event.target, this.widgetName + '.preventClickEvent', true);
|
721 |
+
}
|
722 |
+
|
723 |
+
this._mouseStop(event);
|
724 |
+
}
|
725 |
+
|
726 |
+
return false;
|
727 |
+
},
|
728 |
+
|
729 |
+
_mouseDistanceMet: function(event) {
|
730 |
+
return (Math.max(
|
731 |
+
Math.abs(this._mouseDownEvent.pageX - event.pageX),
|
732 |
+
Math.abs(this._mouseDownEvent.pageY - event.pageY)
|
733 |
+
) >= this.options.distance
|
734 |
+
);
|
735 |
+
},
|
736 |
+
|
737 |
+
_mouseDelayMet: function(event) {
|
738 |
+
return this.mouseDelayMet;
|
739 |
+
},
|
740 |
+
|
741 |
+
// These are placeholder methods, to be overriden by extending plugin
|
742 |
+
_mouseStart: function(event) {},
|
743 |
+
_mouseDrag: function(event) {},
|
744 |
+
_mouseStop: function(event) {},
|
745 |
+
_mouseCapture: function(event) { return true; }
|
746 |
+
});
|
747 |
+
|
748 |
+
})(jQuery);
|
749 |
+
/*
|
750 |
+
* jQuery UI Position 1.8.17
|
751 |
+
*
|
752 |
+
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
|
753 |
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
754 |
+
* http://jquery.org/license
|
755 |
+
*
|
756 |
+
* http://docs.jquery.com/UI/Position
|
757 |
+
*/
|
758 |
+
(function( $, undefined ) {
|
759 |
+
|
760 |
+
$.ui = $.ui || {};
|
761 |
+
|
762 |
+
var horizontalPositions = /left|center|right/,
|
763 |
+
verticalPositions = /top|center|bottom/,
|
764 |
+
center = "center",
|
765 |
+
support = {},
|
766 |
+
_position = $.fn.position,
|
767 |
+
_offset = $.fn.offset;
|
768 |
+
|
769 |
+
$.fn.position = function( options ) {
|
770 |
+
if ( !options || !options.of ) {
|
771 |
+
return _position.apply( this, arguments );
|
772 |
+
}
|
773 |
+
|
774 |
+
// make a copy, we don't want to modify arguments
|
775 |
+
options = $.extend( {}, options );
|
776 |
+
|
777 |
+
var target = $( options.of ),
|
778 |
+
targetElem = target[0],
|
779 |
+
collision = ( options.collision || "flip" ).split( " " ),
|
780 |
+
offset = options.offset ? options.offset.split( " " ) : [ 0, 0 ],
|
781 |
+
targetWidth,
|
782 |
+
targetHeight,
|
783 |
+
basePosition;
|
784 |
+
|
785 |
+
if ( targetElem.nodeType === 9 ) {
|
786 |
+
targetWidth = target.width();
|
787 |
+
targetHeight = target.height();
|
788 |
+
basePosition = { top: 0, left: 0 };
|
789 |
+
// TODO: use $.isWindow() in 1.9
|
790 |
+
} else if ( targetElem.setTimeout ) {
|
791 |
+
targetWidth = target.width();
|
792 |
+
targetHeight = target.height();
|
793 |
+
basePosition = { top: target.scrollTop(), left: target.scrollLeft() };
|
794 |
+
} else if ( targetElem.preventDefault ) {
|
795 |
+
// force left top to allow flipping
|
796 |
+
options.at = "left top";
|
797 |
+
targetWidth = targetHeight = 0;
|
798 |
+
basePosition = { top: options.of.pageY, left: options.of.pageX };
|
799 |
+
} else {
|
800 |
+
targetWidth = target.outerWidth();
|
801 |
+
targetHeight = target.outerHeight();
|
802 |
+
basePosition = target.offset();
|
803 |
+
}
|
804 |
+
|
805 |
+
// force my and at to have valid horizontal and veritcal positions
|
806 |
+
// if a value is missing or invalid, it will be converted to center
|
807 |
+
$.each( [ "my", "at" ], function() {
|
808 |
+
var pos = ( options[this] || "" ).split( " " );
|
809 |
+
if ( pos.length === 1) {
|
810 |
+
pos = horizontalPositions.test( pos[0] ) ?
|
811 |
+
pos.concat( [center] ) :
|
812 |
+
verticalPositions.test( pos[0] ) ?
|
813 |
+
[ center ].concat( pos ) :
|
814 |
+
[ center, center ];
|
815 |
+
}
|
816 |
+
pos[ 0 ] = horizontalPositions.test( pos[0] ) ? pos[ 0 ] : center;
|
817 |
+
pos[ 1 ] = verticalPositions.test( pos[1] ) ? pos[ 1 ] : center;
|
818 |
+
options[ this ] = pos;
|
819 |
+
});
|
820 |
+
|
821 |
+
// normalize collision option
|
822 |
+
if ( collision.length === 1 ) {
|
823 |
+
collision[ 1 ] = collision[ 0 ];
|
824 |
+
}
|
825 |
+
|
826 |
+
// normalize offset option
|
827 |
+
offset[ 0 ] = parseInt( offset[0], 10 ) || 0;
|
828 |
+
if ( offset.length === 1 ) {
|
829 |
+
offset[ 1 ] = offset[ 0 ];
|
830 |
+
}
|
831 |
+
offset[ 1 ] = parseInt( offset[1], 10 ) || 0;
|
832 |
+
|
833 |
+
if ( options.at[0] === "right" ) {
|
834 |
+
basePosition.left += targetWidth;
|
835 |
+
} else if ( options.at[0] === center ) {
|
836 |
+
basePosition.left += targetWidth / 2;
|
837 |
+
}
|
838 |
+
|
839 |
+
if ( options.at[1] === "bottom" ) {
|
840 |
+
basePosition.top += targetHeight;
|
841 |
+
} else if ( options.at[1] === center ) {
|
842 |
+
basePosition.top += targetHeight / 2;
|
843 |
+
}
|
844 |
+
|
845 |
+
basePosition.left += offset[ 0 ];
|
846 |
+
basePosition.top += offset[ 1 ];
|
847 |
+
|
848 |
+
return this.each(function() {
|
849 |
+
var elem = $( this ),
|
850 |
+
elemWidth = elem.outerWidth(),
|
851 |
+
elemHeight = elem.outerHeight(),
|
852 |
+
marginLeft = parseInt( $.curCSS( this, "marginLeft", true ) ) || 0,
|
853 |
+
marginTop = parseInt( $.curCSS( this, "marginTop", true ) ) || 0,
|
854 |
+
collisionWidth = elemWidth + marginLeft +
|
855 |
+
( parseInt( $.curCSS( this, "marginRight", true ) ) || 0 ),
|
856 |
+
collisionHeight = elemHeight + marginTop +
|
857 |
+
( parseInt( $.curCSS( this, "marginBottom", true ) ) || 0 ),
|
858 |
+
position = $.extend( {}, basePosition ),
|
859 |
+
collisionPosition;
|
860 |
+
|
861 |
+
if ( options.my[0] === "right" ) {
|
862 |
+
position.left -= elemWidth;
|
863 |
+
} else if ( options.my[0] === center ) {
|
864 |
+
position.left -= elemWidth / 2;
|
865 |
+
}
|
866 |
+
|
867 |
+
if ( options.my[1] === "bottom" ) {
|
868 |
+
position.top -= elemHeight;
|
869 |
+
} else if ( options.my[1] === center ) {
|
870 |
+
position.top -= elemHeight / 2;
|
871 |
+
}
|
872 |
+
|
873 |
+
// prevent fractions if jQuery version doesn't support them (see #5280)
|
874 |
+
if ( !support.fractions ) {
|
875 |
+
position.left = Math.round( position.left );
|
876 |
+
position.top = Math.round( position.top );
|
877 |
+
}
|
878 |
+
|
879 |
+
collisionPosition = {
|
880 |
+
left: position.left - marginLeft,
|
881 |
+
top: position.top - marginTop
|
882 |
+
};
|
883 |
+
|
884 |
+
$.each( [ "left", "top" ], function( i, dir ) {
|
885 |
+
if ( $.ui.position[ collision[i] ] ) {
|
886 |
+
$.ui.position[ collision[i] ][ dir ]( position, {
|
887 |
+
targetWidth: targetWidth,
|
888 |
+
targetHeight: targetHeight,
|
889 |
+
elemWidth: elemWidth,
|
890 |
+
elemHeight: elemHeight,
|
891 |
+
collisionPosition: collisionPosition,
|
892 |
+
collisionWidth: collisionWidth,
|
893 |
+
collisionHeight: collisionHeight,
|
894 |
+
offset: offset,
|
895 |
+
my: options.my,
|
896 |
+
at: options.at
|
897 |
+
});
|
898 |
+
}
|
899 |
+
});
|
900 |
+
|
901 |
+
if ( $.fn.bgiframe ) {
|
902 |
+
elem.bgiframe();
|
903 |
+
}
|
904 |
+
elem.offset( $.extend( position, { using: options.using } ) );
|
905 |
+
});
|
906 |
+
};
|
907 |
+
|
908 |
+
$.ui.position = {
|
909 |
+
fit: {
|
910 |
+
left: function( position, data ) {
|
911 |
+
var win = $( window ),
|
912 |
+
over = data.collisionPosition.left + data.collisionWidth - win.width() - win.scrollLeft();
|
913 |
+
position.left = over > 0 ? position.left - over : Math.max( position.left - data.collisionPosition.left, position.left );
|
914 |
+
},
|
915 |
+
top: function( position, data ) {
|
916 |
+
var win = $( window ),
|
917 |
+
over = data.collisionPosition.top + data.collisionHeight - win.height() - win.scrollTop();
|
918 |
+
position.top = over > 0 ? position.top - over : Math.max( position.top - data.collisionPosition.top, position.top );
|
919 |
+
}
|
920 |
+
},
|
921 |
+
|
922 |
+
flip: {
|
923 |
+
left: function( position, data ) {
|
924 |
+
if ( data.at[0] === center ) {
|
925 |
+
return;
|
926 |
+
}
|
927 |
+
var win = $( window ),
|
928 |
+
over = data.collisionPosition.left + data.collisionWidth - win.width() - win.scrollLeft(),
|
929 |
+
myOffset = data.my[ 0 ] === "left" ?
|
930 |
+
-data.elemWidth :
|
931 |
+
data.my[ 0 ] === "right" ?
|
932 |
+
data.elemWidth :
|
933 |
+
0,
|
934 |
+
atOffset = data.at[ 0 ] === "left" ?
|
935 |
+
data.targetWidth :
|
936 |
+
-data.targetWidth,
|
937 |
+
offset = -2 * data.offset[ 0 ];
|
938 |
+
position.left += data.collisionPosition.left < 0 ?
|
939 |
+
myOffset + atOffset + offset :
|
940 |
+
over > 0 ?
|
941 |
+
myOffset + atOffset + offset :
|
942 |
+
0;
|
943 |
+
},
|
944 |
+
top: function( position, data ) {
|
945 |
+
if ( data.at[1] === center ) {
|
946 |
+
return;
|
947 |
+
}
|
948 |
+
var win = $( window ),
|
949 |
+
over = data.collisionPosition.top + data.collisionHeight - win.height() - win.scrollTop(),
|
950 |
+
myOffset = data.my[ 1 ] === "top" ?
|
951 |
+
-data.elemHeight :
|
952 |
+
data.my[ 1 ] === "bottom" ?
|
953 |
+
data.elemHeight :
|
954 |
+
0,
|
955 |
+
atOffset = data.at[ 1 ] === "top" ?
|
956 |
+
data.targetHeight :
|
957 |
+
-data.targetHeight,
|
958 |
+
offset = -2 * data.offset[ 1 ];
|
959 |
+
position.top += data.collisionPosition.top < 0 ?
|
960 |
+
myOffset + atOffset + offset :
|
961 |
+
over > 0 ?
|
962 |
+
myOffset + atOffset + offset :
|
963 |
+
0;
|
964 |
+
}
|
965 |
+
}
|
966 |
+
};
|
967 |
+
|
968 |
+
// offset setter from jQuery 1.4
|
969 |
+
if ( !$.offset.setOffset ) {
|
970 |
+
$.offset.setOffset = function( elem, options ) {
|
971 |
+
// set position first, in-case top/left are set even on static elem
|
972 |
+
if ( /static/.test( $.curCSS( elem, "position" ) ) ) {
|
973 |
+
elem.style.position = "relative";
|
974 |
+
}
|
975 |
+
var curElem = $( elem ),
|
976 |
+
curOffset = curElem.offset(),
|
977 |
+
curTop = parseInt( $.curCSS( elem, "top", true ), 10 ) || 0,
|
978 |
+
curLeft = parseInt( $.curCSS( elem, "left", true ), 10) || 0,
|
979 |
+
props = {
|
980 |
+
top: (options.top - curOffset.top) + curTop,
|
981 |
+
left: (options.left - curOffset.left) + curLeft
|
982 |
+
};
|
983 |
+
|
984 |
+
if ( 'using' in options ) {
|
985 |
+
options.using.call( elem, props );
|
986 |
+
} else {
|
987 |
+
curElem.css( props );
|
988 |
+
}
|
989 |
+
};
|
990 |
+
|
991 |
+
$.fn.offset = function( options ) {
|
992 |
+
var elem = this[ 0 ];
|
993 |
+
if ( !elem || !elem.ownerDocument ) { return null; }
|
994 |
+
if ( options ) {
|
995 |
+
return this.each(function() {
|
996 |
+
$.offset.setOffset( this, options );
|
997 |
+
});
|
998 |
+
}
|
999 |
+
return _offset.call( this );
|
1000 |
+
};
|
1001 |
+
}
|
1002 |
+
|
1003 |
+
// fraction support test (older versions of jQuery don't support fractions)
|
1004 |
+
(function () {
|
1005 |
+
var body = document.getElementsByTagName( "body" )[ 0 ],
|
1006 |
+
div = document.createElement( "div" ),
|
1007 |
+
testElement, testElementParent, testElementStyle, offset, offsetTotal;
|
1008 |
+
|
1009 |
+
//Create a "fake body" for testing based on method used in jQuery.support
|
1010 |
+
testElement = document.createElement( body ? "div" : "body" );
|
1011 |
+
testElementStyle = {
|
1012 |
+
visibility: "hidden",
|
1013 |
+
width: 0,
|
1014 |
+
height: 0,
|
1015 |
+
border: 0,
|
1016 |
+
margin: 0,
|
1017 |
+
background: "none"
|
1018 |
+
};
|
1019 |
+
if ( body ) {
|
1020 |
+
jQuery.extend( testElementStyle, {
|
1021 |
+
position: "absolute",
|
1022 |
+
left: "-1000px",
|
1023 |
+
top: "-1000px"
|
1024 |
+
});
|
1025 |
+
}
|
1026 |
+
for ( var i in testElementStyle ) {
|
1027 |
+
testElement.style[ i ] = testElementStyle[ i ];
|
1028 |
+
}
|
1029 |
+
testElement.appendChild( div );
|
1030 |
+
testElementParent = body || document.documentElement;
|
1031 |
+
testElementParent.insertBefore( testElement, testElementParent.firstChild );
|
1032 |
+
|
1033 |
+
div.style.cssText = "position: absolute; left: 10.7432222px; top: 10.432325px; height: 30px; width: 201px;";
|
1034 |
+
|
1035 |
+
offset = $( div ).offset( function( _, offset ) {
|
1036 |
+
return offset;
|
1037 |
+
}).offset();
|
1038 |
+
|
1039 |
+
testElement.innerHTML = "";
|
1040 |
+
testElementParent.removeChild( testElement );
|
1041 |
+
|
1042 |
+
offsetTotal = offset.top + offset.left + ( body ? 2000 : 0 );
|
1043 |
+
support.fractions = offsetTotal > 21 && offsetTotal < 22;
|
1044 |
+
})();
|
1045 |
+
|
1046 |
+
}( jQuery ));
|
1047 |
+
/*
|
1048 |
+
* jQuery UI Draggable 1.8.17
|
1049 |
+
*
|
1050 |
+
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
|
1051 |
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
1052 |
+
* http://jquery.org/license
|
1053 |
+
*
|
1054 |
+
* http://docs.jquery.com/UI/Draggables
|
1055 |
+
*
|
1056 |
+
* Depends:
|
1057 |
+
* jquery.ui.core.js
|
1058 |
+
* jquery.ui.mouse.js
|
1059 |
+
* jquery.ui.widget.js
|
1060 |
+
*/
|
1061 |
+
(function( $, undefined ) {
|
1062 |
+
|
1063 |
+
$.widget("ui.draggable", $.ui.mouse, {
|
1064 |
+
widgetEventPrefix: "drag",
|
1065 |
+
options: {
|
1066 |
+
addClasses: true,
|
1067 |
+
appendTo: "parent",
|
1068 |
+
axis: false,
|
1069 |
+
connectToSortable: false,
|
1070 |
+
containment: false,
|
1071 |
+
cursor: "auto",
|
1072 |
+
cursorAt: false,
|
1073 |
+
grid: false,
|
1074 |
+
handle: false,
|
1075 |
+
helper: "original",
|
1076 |
+
iframeFix: false,
|
1077 |
+
opacity: false,
|
1078 |
+
refreshPositions: false,
|
1079 |
+
revert: false,
|
1080 |
+
revertDuration: 500,
|
1081 |
+
scope: "default",
|
1082 |
+
scroll: true,
|
1083 |
+
scrollSensitivity: 20,
|
1084 |
+
scrollSpeed: 20,
|
1085 |
+
snap: false,
|
1086 |
+
snapMode: "both",
|
1087 |
+
snapTolerance: 20,
|
1088 |
+
stack: false,
|
1089 |
+
zIndex: false
|
1090 |
+
},
|
1091 |
+
_create: function() {
|
1092 |
+
|
1093 |
+
if (this.options.helper == 'original' && !(/^(?:r|a|f)/).test(this.element.css("position")))
|
1094 |
+
this.element[0].style.position = 'relative';
|
1095 |
+
|
1096 |
+
(this.options.addClasses && this.element.addClass("ui-draggable"));
|
1097 |
+
(this.options.disabled && this.element.addClass("ui-draggable-disabled"));
|
1098 |
+
|
1099 |
+
this._mouseInit();
|
1100 |
+
|
1101 |
+
},
|
1102 |
+
|
1103 |
+
destroy: function() {
|
1104 |
+
if(!this.element.data('draggable')) return;
|
1105 |
+
this.element
|
1106 |
+
.removeData("draggable")
|
1107 |
+
.unbind(".draggable")
|
1108 |
+
.removeClass("ui-draggable"
|
1109 |
+
+ " ui-draggable-dragging"
|
1110 |
+
+ " ui-draggable-disabled");
|
1111 |
+
this._mouseDestroy();
|
1112 |
+
|
1113 |
+
return this;
|
1114 |
+
},
|
1115 |
+
|
1116 |
+
_mouseCapture: function(event) {
|
1117 |
+
|
1118 |
+
var o = this.options;
|
1119 |
+
|
1120 |
+
// among others, prevent a drag on a resizable-handle
|
1121 |
+
if (this.helper || o.disabled || $(event.target).is('.ui-resizable-handle'))
|
1122 |
+
return false;
|
1123 |
+
|
1124 |
+
//Quit if we're not on a valid handle
|
1125 |
+
this.handle = this._getHandle(event);
|
1126 |
+
if (!this.handle)
|
1127 |
+
return false;
|
1128 |
+
|
1129 |
+
if ( o.iframeFix ) {
|
1130 |
+
$(o.iframeFix === true ? "iframe" : o.iframeFix).each(function() {
|
1131 |
+
$('<div class="ui-draggable-iframeFix" style="background: #fff;"></div>')
|
1132 |
+
.css({
|
1133 |
+
width: this.offsetWidth+"px", height: this.offsetHeight+"px",
|
1134 |
+
position: "absolute", opacity: "0.001", zIndex: 1000
|
1135 |
+
})
|
1136 |
+
.css($(this).offset())
|
1137 |
+
.appendTo("body");
|
1138 |
+
});
|
1139 |
+
}
|
1140 |
+
|
1141 |
+
return true;
|
1142 |
+
|
1143 |
+
},
|
1144 |
+
|
1145 |
+
_mouseStart: function(event) {
|
1146 |
+
|
1147 |
+
var o = this.options;
|
1148 |
+
|
1149 |
+
//Create and append the visible helper
|
1150 |
+
this.helper = this._createHelper(event);
|
1151 |
+
|
1152 |
+
//Cache the helper size
|
1153 |
+
this._cacheHelperProportions();
|
1154 |
+
|
1155 |
+
//If ddmanager is used for droppables, set the global draggable
|
1156 |
+
if($.ui.ddmanager)
|
1157 |
+
$.ui.ddmanager.current = this;
|
1158 |
+
|
1159 |
+
/*
|
1160 |
+
* - Position generation -
|
1161 |
+
* This block generates everything position related - it's the core of draggables.
|
1162 |
+
*/
|
1163 |
+
|
1164 |
+
//Cache the margins of the original element
|
1165 |
+
this._cacheMargins();
|
1166 |
+
|
1167 |
+
//Store the helper's css position
|
1168 |
+
this.cssPosition = this.helper.css("position");
|
1169 |
+
this.scrollParent = this.helper.scrollParent();
|
1170 |
+
|
1171 |
+
//The element's absolute position on the page minus margins
|
1172 |
+
this.offset = this.positionAbs = this.element.offset();
|
1173 |
+
this.offset = {
|
1174 |
+
top: this.offset.top - this.margins.top,
|
1175 |
+
left: this.offset.left - this.margins.left
|
1176 |
+
};
|
1177 |
+
|
1178 |
+
$.extend(this.offset, {
|
1179 |
+
click: { //Where the click happened, relative to the element
|
1180 |
+
left: event.pageX - this.offset.left,
|
1181 |
+
top: event.pageY - this.offset.top
|
1182 |
+
},
|
1183 |
+
parent: this._getParentOffset(),
|
1184 |
+
relative: this._getRelativeOffset() //This is a relative to absolute position minus the actual position calculation - only used for relative positioned helper
|
1185 |
+
});
|
1186 |
+
|
1187 |
+
//Generate the original position
|
1188 |
+
this.originalPosition = this.position = this._generatePosition(event);
|
1189 |
+
this.originalPageX = event.pageX;
|
1190 |
+
this.originalPageY = event.pageY;
|
1191 |
+
|
1192 |
+
//Adjust the mouse offset relative to the helper if 'cursorAt' is supplied
|
1193 |
+
(o.cursorAt && this._adjustOffsetFromHelper(o.cursorAt));
|
1194 |
+
|
1195 |
+
//Set a containment if given in the options
|
1196 |
+
if(o.containment)
|
1197 |
+
this._setContainment();
|
1198 |
+
|
1199 |
+
//Trigger event + callbacks
|
1200 |
+
if(this._trigger("start", event) === false) {
|
1201 |
+
this._clear();
|
1202 |
+
return false;
|
1203 |
+
}
|
1204 |
+
|
1205 |
+
//Recache the helper size
|
1206 |
+
this._cacheHelperProportions();
|
1207 |
+
|
1208 |
+
//Prepare the droppable offsets
|
1209 |
+
if ($.ui.ddmanager && !o.dropBehaviour)
|
1210 |
+
$.ui.ddmanager.prepareOffsets(this, event);
|
1211 |
+
|
1212 |
+
this.helper.addClass("ui-draggable-dragging");
|
1213 |
+
this._mouseDrag(event, true); //Execute the drag once - this causes the helper not to be visible before getting its correct position
|
1214 |
+
|
1215 |
+
//If the ddmanager is used for droppables, inform the manager that dragging has started (see #5003)
|
1216 |
+
if ( $.ui.ddmanager ) $.ui.ddmanager.dragStart(this, event);
|
1217 |
+
|
1218 |
+
return true;
|
1219 |
+
},
|
1220 |
+
|
1221 |
+
_mouseDrag: function(event, noPropagation) {
|
1222 |
+
|
1223 |
+
//Compute the helpers position
|
1224 |
+
this.position = this._generatePosition(event);
|
1225 |
+
this.positionAbs = this._convertPositionTo("absolute");
|
1226 |
+
|
1227 |
+
//Call plugins and callbacks and use the resulting position if something is returned
|
1228 |
+
if (!noPropagation) {
|
1229 |
+
var ui = this._uiHash();
|
1230 |
+
if(this._trigger('drag', event, ui) === false) {
|
1231 |
+
this._mouseUp({});
|
1232 |
+
return false;
|
1233 |
+
}
|
1234 |
+
this.position = ui.position;
|
1235 |
+
}
|
1236 |
+
|
1237 |
+
if(!this.options.axis || this.options.axis != "y") this.helper[0].style.left = this.position.left+'px';
|
1238 |
+
if(!this.options.axis || this.options.axis != "x") this.helper[0].style.top = this.position.top+'px';
|
1239 |
+
if($.ui.ddmanager) $.ui.ddmanager.drag(this, event);
|
1240 |
+
|
1241 |
+
return false;
|
1242 |
+
},
|
1243 |
+
|
1244 |
+
_mouseStop: function(event) {
|
1245 |
+
|
1246 |
+
//If we are using droppables, inform the manager about the drop
|
1247 |
+
var dropped = false;
|
1248 |
+
if ($.ui.ddmanager && !this.options.dropBehaviour)
|
1249 |
+
dropped = $.ui.ddmanager.drop(this, event);
|
1250 |
+
|
1251 |
+
//if a drop comes from outside (a sortable)
|
1252 |
+
if(this.dropped) {
|
1253 |
+
dropped = this.dropped;
|
1254 |
+
this.dropped = false;
|
1255 |
+
}
|
1256 |
+
|
1257 |
+
//if the original element is removed, don't bother to continue if helper is set to "original"
|
1258 |
+
if((!this.element[0] || !this.element[0].parentNode) && this.options.helper == "original")
|
1259 |
+
return false;
|
1260 |
+
|
1261 |
+
if((this.options.revert == "invalid" && !dropped) || (this.options.revert == "valid" && dropped) || this.options.revert === true || ($.isFunction(this.options.revert) && this.options.revert.call(this.element, dropped))) {
|
1262 |
+
var self = this;
|
1263 |
+
$(this.helper).animate(this.originalPosition, parseInt(this.options.revertDuration, 10), function() {
|
1264 |
+
if(self._trigger("stop", event) !== false) {
|
1265 |
+
self._clear();
|
1266 |
+
}
|
1267 |
+
});
|
1268 |
+
} else {
|
1269 |
+
if(this._trigger("stop", event) !== false) {
|
1270 |
+
this._clear();
|
1271 |
+
}
|
1272 |
+
}
|
1273 |
+
|
1274 |
+
return false;
|
1275 |
+
},
|
1276 |
+
|
1277 |
+
_mouseUp: function(event) {
|
1278 |
+
if (this.options.iframeFix === true) {
|
1279 |
+
$("div.ui-draggable-iframeFix").each(function() {
|
1280 |
+
this.parentNode.removeChild(this);
|
1281 |
+
}); //Remove frame helpers
|
1282 |
+
}
|
1283 |
+
|
1284 |
+
//If the ddmanager is used for droppables, inform the manager that dragging has stopped (see #5003)
|
1285 |
+
if( $.ui.ddmanager ) $.ui.ddmanager.dragStop(this, event);
|
1286 |
+
|
1287 |
+
return $.ui.mouse.prototype._mouseUp.call(this, event);
|
1288 |
+
},
|
1289 |
+
|
1290 |
+
cancel: function() {
|
1291 |
+
|
1292 |
+
if(this.helper.is(".ui-draggable-dragging")) {
|
1293 |
+
this._mouseUp({});
|
1294 |
+
} else {
|
1295 |
+
this._clear();
|
1296 |
+
}
|
1297 |
+
|
1298 |
+
return this;
|
1299 |
+
|
1300 |
+
},
|
1301 |
+
|
1302 |
+
_getHandle: function(event) {
|
1303 |
+
|
1304 |
+
var handle = !this.options.handle || !$(this.options.handle, this.element).length ? true : false;
|
1305 |
+
$(this.options.handle, this.element)
|
1306 |
+
.find("*")
|
1307 |
+
.andSelf()
|
1308 |
+
.each(function() {
|
1309 |
+
if(this == event.target) handle = true;
|
1310 |
+
});
|
1311 |
+
|
1312 |
+
return handle;
|
1313 |
+
|
1314 |
+
},
|
1315 |
+
|
1316 |
+
_createHelper: function(event) {
|
1317 |
+
|
1318 |
+
var o = this.options;
|
1319 |
+
var helper = $.isFunction(o.helper) ? $(o.helper.apply(this.element[0], [event])) : (o.helper == 'clone' ? this.element.clone().removeAttr('id') : this.element);
|
1320 |
+
|
1321 |
+
if(!helper.parents('body').length)
|
1322 |
+
helper.appendTo((o.appendTo == 'parent' ? this.element[0].parentNode : o.appendTo));
|
1323 |
+
|
1324 |
+
if(helper[0] != this.element[0] && !(/(fixed|absolute)/).test(helper.css("position")))
|
1325 |
+
helper.css("position", "absolute");
|
1326 |
+
|
1327 |
+
return helper;
|
1328 |
+
|
1329 |
+
},
|
1330 |
+
|
1331 |
+
_adjustOffsetFromHelper: function(obj) {
|
1332 |
+
if (typeof obj == 'string') {
|
1333 |
+
obj = obj.split(' ');
|
1334 |
+
}
|
1335 |
+
if ($.isArray(obj)) {
|
1336 |
+
obj = {left: +obj[0], top: +obj[1] || 0};
|
1337 |
+
}
|
1338 |
+
if ('left' in obj) {
|
1339 |
+
this.offset.click.left = obj.left + this.margins.left;
|
1340 |
+
}
|
1341 |
+
if ('right' in obj) {
|
1342 |
+
this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left;
|
1343 |
+
}
|
1344 |
+
if ('top' in obj) {
|
1345 |
+
this.offset.click.top = obj.top + this.margins.top;
|
1346 |
+
}
|
1347 |
+
if ('bottom' in obj) {
|
1348 |
+
this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top;
|
1349 |
+
}
|
1350 |
+
},
|
1351 |
+
|
1352 |
+
_getParentOffset: function() {
|
1353 |
+
|
1354 |
+
//Get the offsetParent and cache its position
|
1355 |
+
this.offsetParent = this.helper.offsetParent();
|
1356 |
+
var po = this.offsetParent.offset();
|
1357 |
+
|
1358 |
+
// This is a special case where we need to modify a offset calculated on start, since the following happened:
|
1359 |
+
// 1. The position of the helper is absolute, so it's position is calculated based on the next positioned parent
|
1360 |
+
// 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't the document, which means that
|
1361 |
+
// the scroll is included in the initial calculation of the offset of the parent, and never recalculated upon drag
|
1362 |
+
if(this.cssPosition == 'absolute' && this.scrollParent[0] != document && $.ui.contains(this.scrollParent[0], this.offsetParent[0])) {
|
1363 |
+
po.left += this.scrollParent.scrollLeft();
|
1364 |
+
po.top += this.scrollParent.scrollTop();
|
1365 |
+
}
|
1366 |
+
|
1367 |
+
if((this.offsetParent[0] == document.body) //This needs to be actually done for all browsers, since pageX/pageY includes this information
|
1368 |
+
|| (this.offsetParent[0].tagName && this.offsetParent[0].tagName.toLowerCase() == 'html' && $.browser.msie)) //Ugly IE fix
|
1369 |
+
po = { top: 0, left: 0 };
|
1370 |
+
|
1371 |
+
return {
|
1372 |
+
top: po.top + (parseInt(this.offsetParent.css("borderTopWidth"),10) || 0),
|
1373 |
+
left: po.left + (parseInt(this.offsetParent.css("borderLeftWidth"),10) || 0)
|
1374 |
+
};
|
1375 |
+
|
1376 |
+
},
|
1377 |
+
|
1378 |
+
_getRelativeOffset: function() {
|
1379 |
+
|
1380 |
+
if(this.cssPosition == "relative") {
|
1381 |
+
var p = this.element.position();
|
1382 |
+
return {
|
1383 |
+
top: p.top - (parseInt(this.helper.css("top"),10) || 0) + this.scrollParent.scrollTop(),
|
1384 |
+
left: p.left - (parseInt(this.helper.css("left"),10) || 0) + this.scrollParent.scrollLeft()
|
1385 |
+
};
|
1386 |
+
} else {
|
1387 |
+
return { top: 0, left: 0 };
|
1388 |
+
}
|
1389 |
+
|
1390 |
+
},
|
1391 |
+
|
1392 |
+
_cacheMargins: function() {
|
1393 |
+
this.margins = {
|
1394 |
+
left: (parseInt(this.element.css("marginLeft"),10) || 0),
|
1395 |
+
top: (parseInt(this.element.css("marginTop"),10) || 0),
|
1396 |
+
right: (parseInt(this.element.css("marginRight"),10) || 0),
|
1397 |
+
bottom: (parseInt(this.element.css("marginBottom"),10) || 0)
|
1398 |
+
};
|
1399 |
+
},
|
1400 |
+
|
1401 |
+
_cacheHelperProportions: function() {
|
1402 |
+
this.helperProportions = {
|
1403 |
+
width: this.helper.outerWidth(),
|
1404 |
+
height: this.helper.outerHeight()
|
1405 |
+
};
|
1406 |
+
},
|
1407 |
+
|
1408 |
+
_setContainment: function() {
|
1409 |
+
|
1410 |
+
var o = this.options;
|
1411 |
+
if(o.containment == 'parent') o.containment = this.helper[0].parentNode;
|
1412 |
+
if(o.containment == 'document' || o.containment == 'window') this.containment = [
|
1413 |
+
o.containment == 'document' ? 0 : $(window).scrollLeft() - this.offset.relative.left - this.offset.parent.left,
|
1414 |
+
o.containment == 'document' ? 0 : $(window).scrollTop() - this.offset.relative.top - this.offset.parent.top,
|
1415 |
+
(o.containment == 'document' ? 0 : $(window).scrollLeft()) + $(o.containment == 'document' ? document : window).width() - this.helperProportions.width - this.margins.left,
|
1416 |
+
(o.containment == 'document' ? 0 : $(window).scrollTop()) + ($(o.containment == 'document' ? document : window).height() || document.body.parentNode.scrollHeight) - this.helperProportions.height - this.margins.top
|
1417 |
+
];
|
1418 |
+
|
1419 |
+
if(!(/^(document|window|parent)$/).test(o.containment) && o.containment.constructor != Array) {
|
1420 |
+
var c = $(o.containment);
|
1421 |
+
var ce = c[0]; if(!ce) return;
|
1422 |
+
var co = c.offset();
|
1423 |
+
var over = ($(ce).css("overflow") != 'hidden');
|
1424 |
+
|
1425 |
+
this.containment = [
|
1426 |
+
(parseInt($(ce).css("borderLeftWidth"),10) || 0) + (parseInt($(ce).css("paddingLeft"),10) || 0),
|
1427 |
+
(parseInt($(ce).css("borderTopWidth"),10) || 0) + (parseInt($(ce).css("paddingTop"),10) || 0),
|
1428 |
+
(over ? Math.max(ce.scrollWidth,ce.offsetWidth) : ce.offsetWidth) - (parseInt($(ce).css("borderLeftWidth"),10) || 0) - (parseInt($(ce).css("paddingRight"),10) || 0) - this.helperProportions.width - this.margins.left - this.margins.right,
|
1429 |
+
(over ? Math.max(ce.scrollHeight,ce.offsetHeight) : ce.offsetHeight) - (parseInt($(ce).css("borderTopWidth"),10) || 0) - (parseInt($(ce).css("paddingBottom"),10) || 0) - this.helperProportions.height - this.margins.top - this.margins.bottom
|
1430 |
+
];
|
1431 |
+
this.relative_container = c;
|
1432 |
+
|
1433 |
+
} else if(o.containment.constructor == Array) {
|
1434 |
+
this.containment = o.containment;
|
1435 |
+
}
|
1436 |
+
|
1437 |
+
},
|
1438 |
+
|
1439 |
+
_convertPositionTo: function(d, pos) {
|
1440 |
+
|
1441 |
+
if(!pos) pos = this.position;
|
1442 |
+
var mod = d == "absolute" ? 1 : -1;
|
1443 |
+
var o = this.options, scroll = this.cssPosition == 'absolute' && !(this.scrollParent[0] != document && $.ui.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent, scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName);
|
1444 |
+
|
1445 |
+
return {
|
1446 |
+
top: (
|
1447 |
+
pos.top // The absolute mouse position
|
1448 |
+
+ this.offset.relative.top * mod // Only for relative positioned nodes: Relative offset from element to offset parent
|
1449 |
+
+ this.offset.parent.top * mod // The offsetParent's offset without borders (offset + border)
|
1450 |
+
- ($.browser.safari && $.browser.version < 526 && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ) * mod)
|
1451 |
+
),
|
1452 |
+
left: (
|
1453 |
+
pos.left // The absolute mouse position
|
1454 |
+
+ this.offset.relative.left * mod // Only for relative positioned nodes: Relative offset from element to offset parent
|
1455 |
+
+ this.offset.parent.left * mod // The offsetParent's offset without borders (offset + border)
|
1456 |
+
- ($.browser.safari && $.browser.version < 526 && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ) * mod)
|
1457 |
+
)
|
1458 |
+
};
|
1459 |
+
|
1460 |
+
},
|
1461 |
+
|
1462 |
+
_generatePosition: function(event) {
|
1463 |
+
|
1464 |
+
var o = this.options, scroll = this.cssPosition == 'absolute' && !(this.scrollParent[0] != document && $.ui.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent, scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName);
|
1465 |
+
var pageX = event.pageX;
|
1466 |
+
var pageY = event.pageY;
|
1467 |
+
|
1468 |
+
/*
|
1469 |
+
* - Position constraining -
|
1470 |
+
* Constrain the position to a mix of grid, containment.
|
1471 |
+
*/
|
1472 |
+
|
1473 |
+
if(this.originalPosition) { //If we are not dragging yet, we won't check for options
|
1474 |
+
var containment;
|
1475 |
+
if(this.containment) {
|
1476 |
+
if (this.relative_container){
|
1477 |
+
var co = this.relative_container.offset();
|
1478 |
+
containment = [ this.containment[0] + co.left,
|
1479 |
+
this.containment[1] + co.top,
|
1480 |
+
this.containment[2] + co.left,
|
1481 |
+
this.containment[3] + co.top ];
|
1482 |
+
}
|
1483 |
+
else {
|
1484 |
+
containment = this.containment;
|
1485 |
+
}
|
1486 |
+
|
1487 |
+
if(event.pageX - this.offset.click.left < containment[0]) pageX = containment[0] + this.offset.click.left;
|
1488 |
+
if(event.pageY - this.offset.click.top < containment[1]) pageY = containment[1] + this.offset.click.top;
|
1489 |
+
if(event.pageX - this.offset.click.left > containment[2]) pageX = containment[2] + this.offset.click.left;
|
1490 |
+
if(event.pageY - this.offset.click.top > containment[3]) pageY = containment[3] + this.offset.click.top;
|
1491 |
+
}
|
1492 |
+
|
1493 |
+
if(o.grid) {
|
1494 |
+
//Check for grid elements set to 0 to prevent divide by 0 error causing invalid argument errors in IE (see ticket #6950)
|
1495 |
+
var top = o.grid[1] ? this.originalPageY + Math.round((pageY - this.originalPageY) / o.grid[1]) * o.grid[1] : this.originalPageY;
|
1496 |
+
pageY = containment ? (!(top - this.offset.click.top < containment[1] || top - this.offset.click.top > containment[3]) ? top : (!(top - this.offset.click.top < containment[1]) ? top - o.grid[1] : top + o.grid[1])) : top;
|
1497 |
+
|
1498 |
+
var left = o.grid[0] ? this.originalPageX + Math.round((pageX - this.originalPageX) / o.grid[0]) * o.grid[0] : this.originalPageX;
|
1499 |
+
pageX = containment ? (!(left - this.offset.click.left < containment[0] || left - this.offset.click.left > containment[2]) ? left : (!(left - this.offset.click.left < containment[0]) ? left - o.grid[0] : left + o.grid[0])) : left;
|
1500 |
+
}
|
1501 |
+
|
1502 |
+
}
|
1503 |
+
|
1504 |
+
return {
|
1505 |
+
top: (
|
1506 |
+
pageY // The absolute mouse position
|
1507 |
+
- this.offset.click.top // Click offset (relative to the element)
|
1508 |
+
- this.offset.relative.top // Only for relative positioned nodes: Relative offset from element to offset parent
|
1509 |
+
- this.offset.parent.top // The offsetParent's offset without borders (offset + border)
|
1510 |
+
+ ($.browser.safari && $.browser.version < 526 && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ))
|
1511 |
+
),
|
1512 |
+
left: (
|
1513 |
+
pageX // The absolute mouse position
|
1514 |
+
- this.offset.click.left // Click offset (relative to the element)
|
1515 |
+
- this.offset.relative.left // Only for relative positioned nodes: Relative offset from element to offset parent
|
1516 |
+
- this.offset.parent.left // The offsetParent's offset without borders (offset + border)
|
1517 |
+
+ ($.browser.safari && $.browser.version < 526 && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ))
|
1518 |
+
)
|
1519 |
+
};
|
1520 |
+
|
1521 |
+
},
|
1522 |
+
|
1523 |
+
_clear: function() {
|
1524 |
+
this.helper.removeClass("ui-draggable-dragging");
|
1525 |
+
if(this.helper[0] != this.element[0] && !this.cancelHelperRemoval) this.helper.remove();
|
1526 |
+
//if($.ui.ddmanager) $.ui.ddmanager.current = null;
|
1527 |
+
this.helper = null;
|
1528 |
+
this.cancelHelperRemoval = false;
|
1529 |
+
},
|
1530 |
+
|
1531 |
+
// From now on bulk stuff - mainly helpers
|
1532 |
+
|
1533 |
+
_trigger: function(type, event, ui) {
|
1534 |
+
ui = ui || this._uiHash();
|
1535 |
+
$.ui.plugin.call(this, type, [event, ui]);
|
1536 |
+
if(type == "drag") this.positionAbs = this._convertPositionTo("absolute"); //The absolute position has to be recalculated after plugins
|
1537 |
+
return $.Widget.prototype._trigger.call(this, type, event, ui);
|
1538 |
+
},
|
1539 |
+
|
1540 |
+
plugins: {},
|
1541 |
+
|
1542 |
+
_uiHash: function(event) {
|
1543 |
+
return {
|
1544 |
+
helper: this.helper,
|
1545 |
+
position: this.position,
|
1546 |
+
originalPosition: this.originalPosition,
|
1547 |
+
offset: this.positionAbs
|
1548 |
+
};
|
1549 |
+
}
|
1550 |
+
|
1551 |
+
});
|
1552 |
+
|
1553 |
+
$.extend($.ui.draggable, {
|
1554 |
+
version: "1.8.17"
|
1555 |
+
});
|
1556 |
+
|
1557 |
+
$.ui.plugin.add("draggable", "connectToSortable", {
|
1558 |
+
start: function(event, ui) {
|
1559 |
+
|
1560 |
+
var inst = $(this).data("draggable"), o = inst.options,
|
1561 |
+
uiSortable = $.extend({}, ui, { item: inst.element });
|
1562 |
+
inst.sortables = [];
|
1563 |
+
$(o.connectToSortable).each(function() {
|
1564 |
+
var sortable = $.data(this, 'sortable');
|
1565 |
+
if (sortable && !sortable.options.disabled) {
|
1566 |
+
inst.sortables.push({
|
1567 |
+
instance: sortable,
|
1568 |
+
shouldRevert: sortable.options.revert
|
1569 |
+
});
|
1570 |
+
sortable.refreshPositions(); // Call the sortable's refreshPositions at drag start to refresh the containerCache since the sortable container cache is used in drag and needs to be up to date (this will ensure it's initialised as well as being kept in step with any changes that might have happened on the page).
|
1571 |
+
sortable._trigger("activate", event, uiSortable);
|
1572 |
+
}
|
1573 |
+
});
|
1574 |
+
|
1575 |
+
},
|
1576 |
+
stop: function(event, ui) {
|
1577 |
+
|
1578 |
+
//If we are still over the sortable, we fake the stop event of the sortable, but also remove helper
|
1579 |
+
var inst = $(this).data("draggable"),
|
1580 |
+
uiSortable = $.extend({}, ui, { item: inst.element });
|
1581 |
+
|
1582 |
+
$.each(inst.sortables, function() {
|
1583 |
+
if(this.instance.isOver) {
|
1584 |
+
|
1585 |
+
this.instance.isOver = 0;
|
1586 |
+
|
1587 |
+
inst.cancelHelperRemoval = true; //Don't remove the helper in the draggable instance
|
1588 |
+
this.instance.cancelHelperRemoval = false; //Remove it in the sortable instance (so sortable plugins like revert still work)
|
1589 |
+
|
1590 |
+
//The sortable revert is supported, and we have to set a temporary dropped variable on the draggable to support revert: 'valid/invalid'
|
1591 |
+
if(this.shouldRevert) this.instance.options.revert = true;
|
1592 |
+
|
1593 |
+
//Trigger the stop of the sortable
|
1594 |
+
this.instance._mouseStop(event);
|
1595 |
+
|
1596 |
+
this.instance.options.helper = this.instance.options._helper;
|
1597 |
+
|
1598 |
+
//If the helper has been the original item, restore properties in the sortable
|
1599 |
+
if(inst.options.helper == 'original')
|
1600 |
+
this.instance.currentItem.css({ top: 'auto', left: 'auto' });
|
1601 |
+
|
1602 |
+
} else {
|
1603 |
+
this.instance.cancelHelperRemoval = false; //Remove the helper in the sortable instance
|
1604 |
+
this.instance._trigger("deactivate", event, uiSortable);
|
1605 |
+
}
|
1606 |
+
|
1607 |
+
});
|
1608 |
+
|
1609 |
+
},
|
1610 |
+
drag: function(event, ui) {
|
1611 |
+
|
1612 |
+
var inst = $(this).data("draggable"), self = this;
|
1613 |
+
|
1614 |
+
var checkPos = function(o) {
|
1615 |
+
var dyClick = this.offset.click.top, dxClick = this.offset.click.left;
|
1616 |
+
var helperTop = this.positionAbs.top, helperLeft = this.positionAbs.left;
|
1617 |
+
var itemHeight = o.height, itemWidth = o.width;
|
1618 |
+
var itemTop = o.top, itemLeft = o.left;
|
1619 |
+
|
1620 |
+
return $.ui.isOver(helperTop + dyClick, helperLeft + dxClick, itemTop, itemLeft, itemHeight, itemWidth);
|
1621 |
+
};
|
1622 |
+
|
1623 |
+
$.each(inst.sortables, function(i) {
|
1624 |
+
|
1625 |
+
//Copy over some variables to allow calling the sortable's native _intersectsWith
|
1626 |
+
this.instance.positionAbs = inst.positionAbs;
|
1627 |
+
this.instance.helperProportions = inst.helperProportions;
|
1628 |
+
this.instance.offset.click = inst.offset.click;
|
1629 |
+
|
1630 |
+
if(this.instance._intersectsWith(this.instance.containerCache)) {
|
1631 |
+
|
1632 |
+
//If it intersects, we use a little isOver variable and set it once, so our move-in stuff gets fired only once
|
1633 |
+
if(!this.instance.isOver) {
|
1634 |
+
|
1635 |
+
this.instance.isOver = 1;
|
1636 |
+
//Now we fake the start of dragging for the sortable instance,
|
1637 |
+
//by cloning the list group item, appending it to the sortable and using it as inst.currentItem
|
1638 |
+
//We can then fire the start event of the sortable with our passed browser event, and our own helper (so it doesn't create a new one)
|
1639 |
+
this.instance.currentItem = $(self).clone().removeAttr('id').appendTo(this.instance.element).data("sortable-item", true);
|
1640 |
+
this.instance.options._helper = this.instance.options.helper; //Store helper option to later restore it
|
1641 |
+
this.instance.options.helper = function() { return ui.helper[0]; };
|
1642 |
+
|
1643 |
+
event.target = this.instance.currentItem[0];
|
1644 |
+
this.instance._mouseCapture(event, true);
|
1645 |
+
this.instance._mouseStart(event, true, true);
|
1646 |
+
|
1647 |
+
//Because the browser event is way off the new appended portlet, we modify a couple of variables to reflect the changes
|
1648 |
+
this.instance.offset.click.top = inst.offset.click.top;
|
1649 |
+
this.instance.offset.click.left = inst.offset.click.left;
|
1650 |
+
this.instance.offset.parent.left -= inst.offset.parent.left - this.instance.offset.parent.left;
|
1651 |
+
this.instance.offset.parent.top -= inst.offset.parent.top - this.instance.offset.parent.top;
|
1652 |
+
|
1653 |
+
inst._trigger("toSortable", event);
|
1654 |
+
inst.dropped = this.instance.element; //draggable revert needs that
|
1655 |
+
//hack so receive/update callbacks work (mostly)
|
1656 |
+
inst.currentItem = inst.element;
|
1657 |
+
this.instance.fromOutside = inst;
|
1658 |
+
|
1659 |
+
}
|
1660 |
+
|
1661 |
+
//Provided we did all the previous steps, we can fire the drag event of the sortable on every draggable drag, when it intersects with the sortable
|
1662 |
+
if(this.instance.currentItem) this.instance._mouseDrag(event);
|
1663 |
+
|
1664 |
+
} else {
|
1665 |
+
|
1666 |
+
//If it doesn't intersect with the sortable, and it intersected before,
|
1667 |
+
//we fake the drag stop of the sortable, but make sure it doesn't remove the helper by using cancelHelperRemoval
|
1668 |
+
if(this.instance.isOver) {
|
1669 |
+
|
1670 |
+
this.instance.isOver = 0;
|
1671 |
+
this.instance.cancelHelperRemoval = true;
|
1672 |
+
|
1673 |
+
//Prevent reverting on this forced stop
|
1674 |
+
this.instance.options.revert = false;
|
1675 |
+
|
1676 |
+
// The out event needs to be triggered independently
|
1677 |
+
this.instance._trigger('out', event, this.instance._uiHash(this.instance));
|
1678 |
+
|
1679 |
+
this.instance._mouseStop(event, true);
|
1680 |
+
this.instance.options.helper = this.instance.options._helper;
|
1681 |
+
|
1682 |
+
//Now we remove our currentItem, the list group clone again, and the placeholder, and animate the helper back to it's original size
|
1683 |
+
this.instance.currentItem.remove();
|
1684 |
+
if(this.instance.placeholder) this.instance.placeholder.remove();
|
1685 |
+
|
1686 |
+
inst._trigger("fromSortable", event);
|
1687 |
+
inst.dropped = false; //draggable revert needs that
|
1688 |
+
}
|
1689 |
+
|
1690 |
+
};
|
1691 |
+
|
1692 |
+
});
|
1693 |
+
|
1694 |
+
}
|
1695 |
+
});
|
1696 |
+
|
1697 |
+
$.ui.plugin.add("draggable", "cursor", {
|
1698 |
+
start: function(event, ui) {
|
1699 |
+
var t = $('body'), o = $(this).data('draggable').options;
|
1700 |
+
if (t.css("cursor")) o._cursor = t.css("cursor");
|
1701 |
+
t.css("cursor", o.cursor);
|
1702 |
+
},
|
1703 |
+
stop: function(event, ui) {
|
1704 |
+
var o = $(this).data('draggable').options;
|
1705 |
+
if (o._cursor) $('body').css("cursor", o._cursor);
|
1706 |
+
}
|
1707 |
+
});
|
1708 |
+
|
1709 |
+
$.ui.plugin.add("draggable", "opacity", {
|
1710 |
+
start: function(event, ui) {
|
1711 |
+
var t = $(ui.helper), o = $(this).data('draggable').options;
|
1712 |
+
if(t.css("opacity")) o._opacity = t.css("opacity");
|
1713 |
+
t.css('opacity', o.opacity);
|
1714 |
+
},
|
1715 |
+
stop: function(event, ui) {
|
1716 |
+
var o = $(this).data('draggable').options;
|
1717 |
+
if(o._opacity) $(ui.helper).css('opacity', o._opacity);
|
1718 |
+
}
|
1719 |
+
});
|
1720 |
+
|
1721 |
+
$.ui.plugin.add("draggable", "scroll", {
|
1722 |
+
start: function(event, ui) {
|
1723 |
+
var i = $(this).data("draggable");
|
1724 |
+
if(i.scrollParent[0] != document && i.scrollParent[0].tagName != 'HTML') i.overflowOffset = i.scrollParent.offset();
|
1725 |
+
},
|
1726 |
+
drag: function(event, ui) {
|
1727 |
+
|
1728 |
+
var i = $(this).data("draggable"), o = i.options, scrolled = false;
|
1729 |
+
|
1730 |
+
if(i.scrollParent[0] != document && i.scrollParent[0].tagName != 'HTML') {
|
1731 |
+
|
1732 |
+
if(!o.axis || o.axis != 'x') {
|
1733 |
+
if((i.overflowOffset.top + i.scrollParent[0].offsetHeight) - event.pageY < o.scrollSensitivity)
|
1734 |
+
i.scrollParent[0].scrollTop = scrolled = i.scrollParent[0].scrollTop + o.scrollSpeed;
|
1735 |
+
else if(event.pageY - i.overflowOffset.top < o.scrollSensitivity)
|
1736 |
+
i.scrollParent[0].scrollTop = scrolled = i.scrollParent[0].scrollTop - o.scrollSpeed;
|
1737 |
+
}
|
1738 |
+
|
1739 |
+
if(!o.axis || o.axis != 'y') {
|
1740 |
+
if((i.overflowOffset.left + i.scrollParent[0].offsetWidth) - event.pageX < o.scrollSensitivity)
|
1741 |
+
i.scrollParent[0].scrollLeft = scrolled = i.scrollParent[0].scrollLeft + o.scrollSpeed;
|
1742 |
+
else if(event.pageX - i.overflowOffset.left < o.scrollSensitivity)
|
1743 |
+
i.scrollParent[0].scrollLeft = scrolled = i.scrollParent[0].scrollLeft - o.scrollSpeed;
|
1744 |
+
}
|
1745 |
+
|
1746 |
+
} else {
|
1747 |
+
|
1748 |
+
if(!o.axis || o.axis != 'x') {
|
1749 |
+
if(event.pageY - $(document).scrollTop() < o.scrollSensitivity)
|
1750 |
+
scrolled = $(document).scrollTop($(document).scrollTop() - o.scrollSpeed);
|
1751 |
+
else if($(window).height() - (event.pageY - $(document).scrollTop()) < o.scrollSensitivity)
|
1752 |
+
scrolled = $(document).scrollTop($(document).scrollTop() + o.scrollSpeed);
|
1753 |
+
}
|
1754 |
+
|
1755 |
+
if(!o.axis || o.axis != 'y') {
|
1756 |
+
if(event.pageX - $(document).scrollLeft() < o.scrollSensitivity)
|
1757 |
+
scrolled = $(document).scrollLeft($(document).scrollLeft() - o.scrollSpeed);
|
1758 |
+
else if($(window).width() - (event.pageX - $(document).scrollLeft()) < o.scrollSensitivity)
|
1759 |
+
scrolled = $(document).scrollLeft($(document).scrollLeft() + o.scrollSpeed);
|
1760 |
+
}
|
1761 |
+
|
1762 |
+
}
|
1763 |
+
|
1764 |
+
if(scrolled !== false && $.ui.ddmanager && !o.dropBehaviour)
|
1765 |
+
$.ui.ddmanager.prepareOffsets(i, event);
|
1766 |
+
|
1767 |
+
}
|
1768 |
+
});
|
1769 |
+
|
1770 |
+
$.ui.plugin.add("draggable", "snap", {
|
1771 |
+
start: function(event, ui) {
|
1772 |
+
|
1773 |
+
var i = $(this).data("draggable"), o = i.options;
|
1774 |
+
i.snapElements = [];
|
1775 |
+
|
1776 |
+
$(o.snap.constructor != String ? ( o.snap.items || ':data(draggable)' ) : o.snap).each(function() {
|
1777 |
+
var $t = $(this); var $o = $t.offset();
|
1778 |
+
if(this != i.element[0]) i.snapElements.push({
|
1779 |
+
item: this,
|
1780 |
+
width: $t.outerWidth(), height: $t.outerHeight(),
|
1781 |
+
top: $o.top, left: $o.left
|
1782 |
+
});
|
1783 |
+
});
|
1784 |
+
|
1785 |
+
},
|
1786 |
+
drag: function(event, ui) {
|
1787 |
+
|
1788 |
+
var inst = $(this).data("draggable"), o = inst.options;
|
1789 |
+
var d = o.snapTolerance;
|
1790 |
+
|
1791 |
+
var x1 = ui.offset.left, x2 = x1 + inst.helperProportions.width,
|
1792 |
+
y1 = ui.offset.top, y2 = y1 + inst.helperProportions.height;
|
1793 |
+
|
1794 |
+
for (var i = inst.snapElements.length - 1; i >= 0; i--){
|
1795 |
+
|
1796 |
+
var l = inst.snapElements[i].left, r = l + inst.snapElements[i].width,
|
1797 |
+
t = inst.snapElements[i].top, b = t + inst.snapElements[i].height;
|
1798 |
+
|
1799 |
+
//Yes, I know, this is insane ;)
|
1800 |
+
if(!((l-d < x1 && x1 < r+d && t-d < y1 && y1 < b+d) || (l-d < x1 && x1 < r+d && t-d < y2 && y2 < b+d) || (l-d < x2 && x2 < r+d && t-d < y1 && y1 < b+d) || (l-d < x2 && x2 < r+d && t-d < y2 && y2 < b+d))) {
|
1801 |
+
if(inst.snapElements[i].snapping) (inst.options.snap.release && inst.options.snap.release.call(inst.element, event, $.extend(inst._uiHash(), { snapItem: inst.snapElements[i].item })));
|
1802 |
+
inst.snapElements[i].snapping = false;
|
1803 |
+
continue;
|
1804 |
+
}
|
1805 |
+
|
1806 |
+
if(o.snapMode != 'inner') {
|
1807 |
+
var ts = Math.abs(t - y2) <= d;
|
1808 |
+
var bs = Math.abs(b - y1) <= d;
|
1809 |
+
var ls = Math.abs(l - x2) <= d;
|
1810 |
+
var rs = Math.abs(r - x1) <= d;
|
1811 |
+
if(ts) ui.position.top = inst._convertPositionTo("relative", { top: t - inst.helperProportions.height, left: 0 }).top - inst.margins.top;
|
1812 |
+
if(bs) ui.position.top = inst._convertPositionTo("relative", { top: b, left: 0 }).top - inst.margins.top;
|
1813 |
+
if(ls) ui.position.left = inst._convertPositionTo("relative", { top: 0, left: l - inst.helperProportions.width }).left - inst.margins.left;
|
1814 |
+
if(rs) ui.position.left = inst._convertPositionTo("relative", { top: 0, left: r }).left - inst.margins.left;
|
1815 |
+
}
|
1816 |
+
|
1817 |
+
var first = (ts || bs || ls || rs);
|
1818 |
+
|
1819 |
+
if(o.snapMode != 'outer') {
|
1820 |
+
var ts = Math.abs(t - y1) <= d;
|
1821 |
+
var bs = Math.abs(b - y2) <= d;
|
1822 |
+
var ls = Math.abs(l - x1) <= d;
|
1823 |
+
var rs = Math.abs(r - x2) <= d;
|
1824 |
+
if(ts) ui.position.top = inst._convertPositionTo("relative", { top: t, left: 0 }).top - inst.margins.top;
|
1825 |
+
if(bs) ui.position.top = inst._convertPositionTo("relative", { top: b - inst.helperProportions.height, left: 0 }).top - inst.margins.top;
|
1826 |
+
if(ls) ui.position.left = inst._convertPositionTo("relative", { top: 0, left: l }).left - inst.margins.left;
|
1827 |
+
if(rs) ui.position.left = inst._convertPositionTo("relative", { top: 0, left: r - inst.helperProportions.width }).left - inst.margins.left;
|
1828 |
+
}
|
1829 |
+
|
1830 |
+
if(!inst.snapElements[i].snapping && (ts || bs || ls || rs || first))
|
1831 |
+
(inst.options.snap.snap && inst.options.snap.snap.call(inst.element, event, $.extend(inst._uiHash(), { snapItem: inst.snapElements[i].item })));
|
1832 |
+
inst.snapElements[i].snapping = (ts || bs || ls || rs || first);
|
1833 |
+
|
1834 |
+
};
|
1835 |
+
|
1836 |
+
}
|
1837 |
+
});
|
1838 |
+
|
1839 |
+
$.ui.plugin.add("draggable", "stack", {
|
1840 |
+
start: function(event, ui) {
|
1841 |
+
|
1842 |
+
var o = $(this).data("draggable").options;
|
1843 |
+
|
1844 |
+
var group = $.makeArray($(o.stack)).sort(function(a,b) {
|
1845 |
+
return (parseInt($(a).css("zIndex"),10) || 0) - (parseInt($(b).css("zIndex"),10) || 0);
|
1846 |
+
});
|
1847 |
+
if (!group.length) { return; }
|
1848 |
+
|
1849 |
+
var min = parseInt(group[0].style.zIndex) || 0;
|
1850 |
+
$(group).each(function(i) {
|
1851 |
+
this.style.zIndex = min + i;
|
1852 |
+
});
|
1853 |
+
|
1854 |
+
this[0].style.zIndex = min + group.length;
|
1855 |
+
|
1856 |
+
}
|
1857 |
+
});
|
1858 |
+
|
1859 |
+
$.ui.plugin.add("draggable", "zIndex", {
|
1860 |
+
start: function(event, ui) {
|
1861 |
+
var t = $(ui.helper), o = $(this).data("draggable").options;
|
1862 |
+
if(t.css("zIndex")) o._zIndex = t.css("zIndex");
|
1863 |
+
t.css('zIndex', o.zIndex);
|
1864 |
+
},
|
1865 |
+
stop: function(event, ui) {
|
1866 |
+
var o = $(this).data("draggable").options;
|
1867 |
+
if(o._zIndex) $(ui.helper).css('zIndex', o._zIndex);
|
1868 |
+
}
|
1869 |
+
});
|
1870 |
+
|
1871 |
+
})(jQuery);
|
1872 |
+
/*
|
1873 |
+
* jQuery UI Droppable 1.8.17
|
1874 |
+
*
|
1875 |
+
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
|
1876 |
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
1877 |
+
* http://jquery.org/license
|
1878 |
+
*
|
1879 |
+
* http://docs.jquery.com/UI/Droppables
|
1880 |
+
*
|
1881 |
+
* Depends:
|
1882 |
+
* jquery.ui.core.js
|
1883 |
+
* jquery.ui.widget.js
|
1884 |
+
* jquery.ui.mouse.js
|
1885 |
+
* jquery.ui.draggable.js
|
1886 |
+
*/
|
1887 |
+
(function( $, undefined ) {
|
1888 |
+
|
1889 |
+
$.widget("ui.droppable", {
|
1890 |
+
widgetEventPrefix: "drop",
|
1891 |
+
options: {
|
1892 |
+
accept: '*',
|
1893 |
+
activeClass: false,
|
1894 |
+
addClasses: true,
|
1895 |
+
greedy: false,
|
1896 |
+
hoverClass: false,
|
1897 |
+
scope: 'default',
|
1898 |
+
tolerance: 'intersect'
|
1899 |
+
},
|
1900 |
+
_create: function() {
|
1901 |
+
|
1902 |
+
var o = this.options, accept = o.accept;
|
1903 |
+
this.isover = 0; this.isout = 1;
|
1904 |
+
|
1905 |
+
this.accept = $.isFunction(accept) ? accept : function(d) {
|
1906 |
+
return d.is(accept);
|
1907 |
+
};
|
1908 |
+
|
1909 |
+
//Store the droppable's proportions
|
1910 |
+
this.proportions = { width: this.element[0].offsetWidth, height: this.element[0].offsetHeight };
|
1911 |
+
|
1912 |
+
// Add the reference and positions to the manager
|
1913 |
+
$.ui.ddmanager.droppables[o.scope] = $.ui.ddmanager.droppables[o.scope] || [];
|
1914 |
+
$.ui.ddmanager.droppables[o.scope].push(this);
|
1915 |
+
|
1916 |
+
(o.addClasses && this.element.addClass("ui-droppable"));
|
1917 |
+
|
1918 |
+
},
|
1919 |
+
|
1920 |
+
destroy: function() {
|
1921 |
+
var drop = $.ui.ddmanager.droppables[this.options.scope];
|
1922 |
+
for ( var i = 0; i < drop.length; i++ )
|
1923 |
+
if ( drop[i] == this )
|
1924 |
+
drop.splice(i, 1);
|
1925 |
+
|
1926 |
+
this.element
|
1927 |
+
.removeClass("ui-droppable ui-droppable-disabled")
|
1928 |
+
.removeData("droppable")
|
1929 |
+
.unbind(".droppable");
|
1930 |
+
|
1931 |
+
return this;
|
1932 |
+
},
|
1933 |
+
|
1934 |
+
_setOption: function(key, value) {
|
1935 |
+
|
1936 |
+
if(key == 'accept') {
|
1937 |
+
this.accept = $.isFunction(value) ? value : function(d) {
|
1938 |
+
return d.is(value);
|
1939 |
+
};
|
1940 |
+
}
|
1941 |
+
$.Widget.prototype._setOption.apply(this, arguments);
|
1942 |
+
},
|
1943 |
+
|
1944 |
+
_activate: function(event) {
|
1945 |
+
var draggable = $.ui.ddmanager.current;
|
1946 |
+
if(this.options.activeClass) this.element.addClass(this.options.activeClass);
|
1947 |
+
(draggable && this._trigger('activate', event, this.ui(draggable)));
|
1948 |
+
},
|
1949 |
+
|
1950 |
+
_deactivate: function(event) {
|
1951 |
+
var draggable = $.ui.ddmanager.current;
|
1952 |
+
if(this.options.activeClass) this.element.removeClass(this.options.activeClass);
|
1953 |
+
(draggable && this._trigger('deactivate', event, this.ui(draggable)));
|
1954 |
+
},
|
1955 |
+
|
1956 |
+
_over: function(event) {
|
1957 |
+
|
1958 |
+
var draggable = $.ui.ddmanager.current;
|
1959 |
+
if (!draggable || (draggable.currentItem || draggable.element)[0] == this.element[0]) return; // Bail if draggable and droppable are same element
|
1960 |
+
|
1961 |
+
if (this.accept.call(this.element[0],(draggable.currentItem || draggable.element))) {
|
1962 |
+
if(this.options.hoverClass) this.element.addClass(this.options.hoverClass);
|
1963 |
+
this._trigger('over', event, this.ui(draggable));
|
1964 |
+
}
|
1965 |
+
|
1966 |
+
},
|
1967 |
+
|
1968 |
+
_out: function(event) {
|
1969 |
+
|
1970 |
+
var draggable = $.ui.ddmanager.current;
|
1971 |
+
if (!draggable || (draggable.currentItem || draggable.element)[0] == this.element[0]) return; // Bail if draggable and droppable are same element
|
1972 |
+
|
1973 |
+
if (this.accept.call(this.element[0],(draggable.currentItem || draggable.element))) {
|
1974 |
+
if(this.options.hoverClass) this.element.removeClass(this.options.hoverClass);
|
1975 |
+
this._trigger('out', event, this.ui(draggable));
|
1976 |
+
}
|
1977 |
+
|
1978 |
+
},
|
1979 |
+
|
1980 |
+
_drop: function(event,custom) {
|
1981 |
+
|
1982 |
+
var draggable = custom || $.ui.ddmanager.current;
|
1983 |
+
if (!draggable || (draggable.currentItem || draggable.element)[0] == this.element[0]) return false; // Bail if draggable and droppable are same element
|
1984 |
+
|
1985 |
+
var childrenIntersection = false;
|
1986 |
+
this.element.find(":data(droppable)").not(".ui-draggable-dragging").each(function() {
|
1987 |
+
var inst = $.data(this, 'droppable');
|
1988 |
+
if(
|
1989 |
+
inst.options.greedy
|
1990 |
+
&& !inst.options.disabled
|
1991 |
+
&& inst.options.scope == draggable.options.scope
|
1992 |
+
&& inst.accept.call(inst.element[0], (draggable.currentItem || draggable.element))
|
1993 |
+
&& $.ui.intersect(draggable, $.extend(inst, { offset: inst.element.offset() }), inst.options.tolerance)
|
1994 |
+
) { childrenIntersection = true; return false; }
|
1995 |
+
});
|
1996 |
+
if(childrenIntersection) return false;
|
1997 |
+
|
1998 |
+
if(this.accept.call(this.element[0],(draggable.currentItem || draggable.element))) {
|
1999 |
+
if(this.options.activeClass) this.element.removeClass(this.options.activeClass);
|
2000 |
+
if(this.options.hoverClass) this.element.removeClass(this.options.hoverClass);
|
2001 |
+
this._trigger('drop', event, this.ui(draggable));
|
2002 |
+
return this.element;
|
2003 |
+
}
|
2004 |
+
|
2005 |
+
return false;
|
2006 |
+
|
2007 |
+
},
|
2008 |
+
|
2009 |
+
ui: function(c) {
|
2010 |
+
return {
|
2011 |
+
draggable: (c.currentItem || c.element),
|
2012 |
+
helper: c.helper,
|
2013 |
+
position: c.position,
|
2014 |
+
offset: c.positionAbs
|
2015 |
+
};
|
2016 |
+
}
|
2017 |
+
|
2018 |
+
});
|
2019 |
+
|
2020 |
+
$.extend($.ui.droppable, {
|
2021 |
+
version: "1.8.17"
|
2022 |
+
});
|
2023 |
+
|
2024 |
+
$.ui.intersect = function(draggable, droppable, toleranceMode) {
|
2025 |
+
|
2026 |
+
if (!droppable.offset) return false;
|
2027 |
+
|
2028 |
+
var x1 = (draggable.positionAbs || draggable.position.absolute).left, x2 = x1 + draggable.helperProportions.width,
|
2029 |
+
y1 = (draggable.positionAbs || draggable.position.absolute).top, y2 = y1 + draggable.helperProportions.height;
|
2030 |
+
var l = droppable.offset.left, r = l + droppable.proportions.width,
|
2031 |
+
t = droppable.offset.top, b = t + droppable.proportions.height;
|
2032 |
+
|
2033 |
+
switch (toleranceMode) {
|
2034 |
+
case 'fit':
|
2035 |
+
return (l <= x1 && x2 <= r
|
2036 |
+
&& t <= y1 && y2 <= b);
|
2037 |
+
break;
|
2038 |
+
case 'intersect':
|
2039 |
+
return (l < x1 + (draggable.helperProportions.width / 2) // Right Half
|
2040 |
+
&& x2 - (draggable.helperProportions.width / 2) < r // Left Half
|
2041 |
+
&& t < y1 + (draggable.helperProportions.height / 2) // Bottom Half
|
2042 |
+
&& y2 - (draggable.helperProportions.height / 2) < b ); // Top Half
|
2043 |
+
break;
|
2044 |
+
case 'pointer':
|
2045 |
+
var draggableLeft = ((draggable.positionAbs || draggable.position.absolute).left + (draggable.clickOffset || draggable.offset.click).left),
|
2046 |
+
draggableTop = ((draggable.positionAbs || draggable.position.absolute).top + (draggable.clickOffset || draggable.offset.click).top),
|
2047 |
+
isOver = $.ui.isOver(draggableTop, draggableLeft, t, l, droppable.proportions.height, droppable.proportions.width);
|
2048 |
+
return isOver;
|
2049 |
+
break;
|
2050 |
+
case 'touch':
|
2051 |
+
return (
|
2052 |
+
(y1 >= t && y1 <= b) || // Top edge touching
|
2053 |
+
(y2 >= t && y2 <= b) || // Bottom edge touching
|
2054 |
+
(y1 < t && y2 > b) // Surrounded vertically
|
2055 |
+
) && (
|
2056 |
+
(x1 >= l && x1 <= r) || // Left edge touching
|
2057 |
+
(x2 >= l && x2 <= r) || // Right edge touching
|
2058 |
+
(x1 < l && x2 > r) // Surrounded horizontally
|
2059 |
+
);
|
2060 |
+
break;
|
2061 |
+
default:
|
2062 |
+
return false;
|
2063 |
+
break;
|
2064 |
+
}
|
2065 |
+
|
2066 |
+
};
|
2067 |
+
|
2068 |
+
/*
|
2069 |
+
This manager tracks offsets of draggables and droppables
|
2070 |
+
*/
|
2071 |
+
$.ui.ddmanager = {
|
2072 |
+
current: null,
|
2073 |
+
droppables: { 'default': [] },
|
2074 |
+
prepareOffsets: function(t, event) {
|
2075 |
+
|
2076 |
+
var m = $.ui.ddmanager.droppables[t.options.scope] || [];
|
2077 |
+
var type = event ? event.type : null; // workaround for #2317
|
2078 |
+
var list = (t.currentItem || t.element).find(":data(droppable)").andSelf();
|
2079 |
+
|
2080 |
+
droppablesLoop: for (var i = 0; i < m.length; i++) {
|
2081 |
+
|
2082 |
+
if(m[i].options.disabled || (t && !m[i].accept.call(m[i].element[0],(t.currentItem || t.element)))) continue; //No disabled and non-accepted
|
2083 |
+
for (var j=0; j < list.length; j++) { if(list[j] == m[i].element[0]) { m[i].proportions.height = 0; continue droppablesLoop; } }; //Filter out elements in the current dragged item
|
2084 |
+
m[i].visible = m[i].element.css("display") != "none"; if(!m[i].visible) continue; //If the element is not visible, continue
|
2085 |
+
|
2086 |
+
if(type == "mousedown") m[i]._activate.call(m[i], event); //Activate the droppable if used directly from draggables
|
2087 |
+
|
2088 |
+
m[i].offset = m[i].element.offset();
|
2089 |
+
m[i].proportions = { width: m[i].element[0].offsetWidth, height: m[i].element[0].offsetHeight };
|
2090 |
+
|
2091 |
+
}
|
2092 |
+
|
2093 |
+
},
|
2094 |
+
drop: function(draggable, event) {
|
2095 |
+
|
2096 |
+
var dropped = false;
|
2097 |
+
$.each($.ui.ddmanager.droppables[draggable.options.scope] || [], function() {
|
2098 |
+
|
2099 |
+
if(!this.options) return;
|
2100 |
+
if (!this.options.disabled && this.visible && $.ui.intersect(draggable, this, this.options.tolerance))
|
2101 |
+
dropped = this._drop.call(this, event) || dropped;
|
2102 |
+
|
2103 |
+
if (!this.options.disabled && this.visible && this.accept.call(this.element[0],(draggable.currentItem || draggable.element))) {
|
2104 |
+
this.isout = 1; this.isover = 0;
|
2105 |
+
this._deactivate.call(this, event);
|
2106 |
+
}
|
2107 |
+
|
2108 |
+
});
|
2109 |
+
return dropped;
|
2110 |
+
|
2111 |
+
},
|
2112 |
+
dragStart: function( draggable, event ) {
|
2113 |
+
//Listen for scrolling so that if the dragging causes scrolling the position of the droppables can be recalculated (see #5003)
|
2114 |
+
draggable.element.parents( ":not(body,html)" ).bind( "scroll.droppable", function() {
|
2115 |
+
if( !draggable.options.refreshPositions ) $.ui.ddmanager.prepareOffsets( draggable, event );
|
2116 |
+
});
|
2117 |
+
},
|
2118 |
+
drag: function(draggable, event) {
|
2119 |
+
|
2120 |
+
//If you have a highly dynamic page, you might try this option. It renders positions every time you move the mouse.
|
2121 |
+
if(draggable.options.refreshPositions) $.ui.ddmanager.prepareOffsets(draggable, event);
|
2122 |
+
|
2123 |
+
//Run through all droppables and check their positions based on specific tolerance options
|
2124 |
+
$.each($.ui.ddmanager.droppables[draggable.options.scope] || [], function() {
|
2125 |
+
|
2126 |
+
if(this.options.disabled || this.greedyChild || !this.visible) return;
|
2127 |
+
var intersects = $.ui.intersect(draggable, this, this.options.tolerance);
|
2128 |
+
|
2129 |
+
var c = !intersects && this.isover == 1 ? 'isout' : (intersects && this.isover == 0 ? 'isover' : null);
|
2130 |
+
if(!c) return;
|
2131 |
+
|
2132 |
+
var parentInstance;
|
2133 |
+
if (this.options.greedy) {
|
2134 |
+
var parent = this.element.parents(':data(droppable):eq(0)');
|
2135 |
+
if (parent.length) {
|
2136 |
+
parentInstance = $.data(parent[0], 'droppable');
|
2137 |
+
parentInstance.greedyChild = (c == 'isover' ? 1 : 0);
|
2138 |
+
}
|
2139 |
+
}
|
2140 |
+
|
2141 |
+
// we just moved into a greedy child
|
2142 |
+
if (parentInstance && c == 'isover') {
|
2143 |
+
parentInstance['isover'] = 0;
|
2144 |
+
parentInstance['isout'] = 1;
|
2145 |
+
parentInstance._out.call(parentInstance, event);
|
2146 |
+
}
|
2147 |
+
|
2148 |
+
this[c] = 1; this[c == 'isout' ? 'isover' : 'isout'] = 0;
|
2149 |
+
this[c == "isover" ? "_over" : "_out"].call(this, event);
|
2150 |
+
|
2151 |
+
// we just moved out of a greedy child
|
2152 |
+
if (parentInstance && c == 'isout') {
|
2153 |
+
parentInstance['isout'] = 0;
|
2154 |
+
parentInstance['isover'] = 1;
|
2155 |
+
parentInstance._over.call(parentInstance, event);
|
2156 |
+
}
|
2157 |
+
});
|
2158 |
+
|
2159 |
+
},
|
2160 |
+
dragStop: function( draggable, event ) {
|
2161 |
+
draggable.element.parents( ":not(body,html)" ).unbind( "scroll.droppable" );
|
2162 |
+
//Call prepareOffsets one final time since IE does not fire return scroll events when overflow was caused by drag (see #5003)
|
2163 |
+
if( !draggable.options.refreshPositions ) $.ui.ddmanager.prepareOffsets( draggable, event );
|
2164 |
+
}
|
2165 |
+
};
|
2166 |
+
|
2167 |
+
})(jQuery);
|
2168 |
+
/*
|
2169 |
+
* jQuery UI Resizable 1.8.17
|
2170 |
+
*
|
2171 |
+
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
|
2172 |
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
2173 |
+
* http://jquery.org/license
|
2174 |
+
*
|
2175 |
+
* http://docs.jquery.com/UI/Resizables
|
2176 |
+
*
|
2177 |
+
* Depends:
|
2178 |
+
* jquery.ui.core.js
|
2179 |
+
* jquery.ui.mouse.js
|
2180 |
+
* jquery.ui.widget.js
|
2181 |
+
*/
|
2182 |
+
(function( $, undefined ) {
|
2183 |
+
|
2184 |
+
$.widget("ui.resizable", $.ui.mouse, {
|
2185 |
+
widgetEventPrefix: "resize",
|
2186 |
+
options: {
|
2187 |
+
alsoResize: false,
|
2188 |
+
animate: false,
|
2189 |
+
animateDuration: "slow",
|
2190 |
+
animateEasing: "swing",
|
2191 |
+
aspectRatio: false,
|
2192 |
+
autoHide: false,
|
2193 |
+
containment: false,
|
2194 |
+
ghost: false,
|
2195 |
+
grid: false,
|
2196 |
+
handles: "e,s,se",
|
2197 |
+
helper: false,
|
2198 |
+
maxHeight: null,
|
2199 |
+
maxWidth: null,
|
2200 |
+
minHeight: 10,
|
2201 |
+
minWidth: 10,
|
2202 |
+
zIndex: 1000
|
2203 |
+
},
|
2204 |
+
_create: function() {
|
2205 |
+
|
2206 |
+
var self = this, o = this.options;
|
2207 |
+
this.element.addClass("ui-resizable");
|
2208 |
+
|
2209 |
+
$.extend(this, {
|
2210 |
+
_aspectRatio: !!(o.aspectRatio),
|
2211 |
+
aspectRatio: o.aspectRatio,
|
2212 |
+
originalElement: this.element,
|
2213 |
+
_proportionallyResizeElements: [],
|
2214 |
+
_helper: o.helper || o.ghost || o.animate ? o.helper || 'ui-resizable-helper' : null
|
2215 |
+
});
|
2216 |
+
|
2217 |
+
//Wrap the element if it cannot hold child nodes
|
2218 |
+
if(this.element[0].nodeName.match(/canvas|textarea|input|select|button|img/i)) {
|
2219 |
+
|
2220 |
+
//Opera fix for relative positioning
|
2221 |
+
if (/relative/.test(this.element.css('position')) && $.browser.opera)
|
2222 |
+
this.element.css({ position: 'relative', top: 'auto', left: 'auto' });
|
2223 |
+
|
2224 |
+
//Create a wrapper element and set the wrapper to the new current internal element
|
2225 |
+
this.element.wrap(
|
2226 |
+
$('<div class="ui-wrapper" style="overflow: hidden;"></div>').css({
|
2227 |
+
position: this.element.css('position'),
|
2228 |
+
width: this.element.outerWidth(),
|
2229 |
+
height: this.element.outerHeight(),
|
2230 |
+
top: this.element.css('top'),
|
2231 |
+
left: this.element.css('left')
|
2232 |
+
})
|
2233 |
+
);
|
2234 |
+
|
2235 |
+
//Overwrite the original this.element
|
2236 |
+
this.element = this.element.parent().data(
|
2237 |
+
"resizable", this.element.data('resizable')
|
2238 |
+
);
|
2239 |
+
|
2240 |
+
this.elementIsWrapper = true;
|
2241 |
+
|
2242 |
+
//Move margins to the wrapper
|
2243 |
+
this.element.css({ marginLeft: this.originalElement.css("marginLeft"), marginTop: this.originalElement.css("marginTop"), marginRight: this.originalElement.css("marginRight"), marginBottom: this.originalElement.css("marginBottom") });
|
2244 |
+
this.originalElement.css({ marginLeft: 0, marginTop: 0, marginRight: 0, marginBottom: 0});
|
2245 |
+
|
2246 |
+
//Prevent Safari textarea resize
|
2247 |
+
this.originalResizeStyle = this.originalElement.css('resize');
|
2248 |
+
this.originalElement.css('resize', 'none');
|
2249 |
+
|
2250 |
+
//Push the actual element to our proportionallyResize internal array
|
2251 |
+
this._proportionallyResizeElements.push(this.originalElement.css({ position: 'static', zoom: 1, display: 'block' }));
|
2252 |
+
|
2253 |
+
// avoid IE jump (hard set the margin)
|
2254 |
+
this.originalElement.css({ margin: this.originalElement.css('margin') });
|
2255 |
+
|
2256 |
+
// fix handlers offset
|
2257 |
+
this._proportionallyResize();
|
2258 |
+
|
2259 |
+
}
|
2260 |
+
|
2261 |
+
this.handles = o.handles || (!$('.ui-resizable-handle', this.element).length ? "e,s,se" : { n: '.ui-resizable-n', e: '.ui-resizable-e', s: '.ui-resizable-s', w: '.ui-resizable-w', se: '.ui-resizable-se', sw: '.ui-resizable-sw', ne: '.ui-resizable-ne', nw: '.ui-resizable-nw' });
|
2262 |
+
if(this.handles.constructor == String) {
|
2263 |
+
|
2264 |
+
if(this.handles == 'all') this.handles = 'n,e,s,w,se,sw,ne,nw';
|
2265 |
+
var n = this.handles.split(","); this.handles = {};
|
2266 |
+
|
2267 |
+
for(var i = 0; i < n.length; i++) {
|
2268 |
+
|
2269 |
+
var handle = $.trim(n[i]), hname = 'ui-resizable-'+handle;
|
2270 |
+
var axis = $('<div class="ui-resizable-handle ' + hname + '"></div>');
|
2271 |
+
|
2272 |
+
// increase zIndex of sw, se, ne, nw axis
|
2273 |
+
//TODO : this modifies original option
|
2274 |
+
if(/sw|se|ne|nw/.test(handle)) axis.css({ zIndex: ++o.zIndex });
|
2275 |
+
|
2276 |
+
//TODO : What's going on here?
|
2277 |
+
if ('se' == handle) {
|
2278 |
+
axis.addClass('ui-icon ui-icon-gripsmall-diagonal-se');
|
2279 |
+
};
|
2280 |
+
|
2281 |
+
//Insert into internal handles object and append to element
|
2282 |
+
this.handles[handle] = '.ui-resizable-'+handle;
|
2283 |
+
this.element.append(axis);
|
2284 |
+
}
|
2285 |
+
|
2286 |
+
}
|
2287 |
+
|
2288 |
+
this._renderAxis = function(target) {
|
2289 |
+
|
2290 |
+
target = target || this.element;
|
2291 |
+
|
2292 |
+
for(var i in this.handles) {
|
2293 |
+
|
2294 |
+
if(this.handles[i].constructor == String)
|
2295 |
+
this.handles[i] = $(this.handles[i], this.element).show();
|
2296 |
+
|
2297 |
+
//Apply pad to wrapper element, needed to fix axis position (textarea, inputs, scrolls)
|
2298 |
+
if (this.elementIsWrapper && this.originalElement[0].nodeName.match(/textarea|input|select|button/i)) {
|
2299 |
+
|
2300 |
+
var axis = $(this.handles[i], this.element), padWrapper = 0;
|
2301 |
+
|
2302 |
+
//Checking the correct pad and border
|
2303 |
+
padWrapper = /sw|ne|nw|se|n|s/.test(i) ? axis.outerHeight() : axis.outerWidth();
|
2304 |
+
|
2305 |
+
//The padding type i have to apply...
|
2306 |
+
var padPos = [ 'padding',
|
2307 |
+
/ne|nw|n/.test(i) ? 'Top' :
|
2308 |
+
/se|sw|s/.test(i) ? 'Bottom' :
|
2309 |
+
/^e$/.test(i) ? 'Right' : 'Left' ].join("");
|
2310 |
+
|
2311 |
+
target.css(padPos, padWrapper);
|
2312 |
+
|
2313 |
+
this._proportionallyResize();
|
2314 |
+
|
2315 |
+
}
|
2316 |
+
|
2317 |
+
//TODO: What's that good for? There's not anything to be executed left
|
2318 |
+
if(!$(this.handles[i]).length)
|
2319 |
+
continue;
|
2320 |
+
|
2321 |
+
}
|
2322 |
+
};
|
2323 |
+
|
2324 |
+
//TODO: make renderAxis a prototype function
|
2325 |
+
this._renderAxis(this.element);
|
2326 |
+
|
2327 |
+
this._handles = $('.ui-resizable-handle', this.element)
|
2328 |
+
.disableSelection();
|
2329 |
+
|
2330 |
+
//Matching axis name
|
2331 |
+
this._handles.mouseover(function() {
|
2332 |
+
if (!self.resizing) {
|
2333 |
+
if (this.className)
|
2334 |
+
var axis = this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i);
|
2335 |
+
//Axis, default = se
|
2336 |
+
self.axis = axis && axis[1] ? axis[1] : 'se';
|
2337 |
+
}
|
2338 |
+
});
|
2339 |
+
|
2340 |
+
//If we want to auto hide the elements
|
2341 |
+
if (o.autoHide) {
|
2342 |
+
this._handles.hide();
|
2343 |
+
$(this.element)
|
2344 |
+
.addClass("ui-resizable-autohide")
|
2345 |
+
.hover(function() {
|
2346 |
+
if (o.disabled) return;
|
2347 |
+
$(this).removeClass("ui-resizable-autohide");
|
2348 |
+
self._handles.show();
|
2349 |
+
},
|
2350 |
+
function(){
|
2351 |
+
if (o.disabled) return;
|
2352 |
+
if (!self.resizing) {
|
2353 |
+
$(this).addClass("ui-resizable-autohide");
|
2354 |
+
self._handles.hide();
|
2355 |
+
}
|
2356 |
+
});
|
2357 |
+
}
|
2358 |
+
|
2359 |
+
//Initialize the mouse interaction
|
2360 |
+
this._mouseInit();
|
2361 |
+
|
2362 |
+
},
|
2363 |
+
|
2364 |
+
destroy: function() {
|
2365 |
+
|
2366 |
+
this._mouseDestroy();
|
2367 |
+
|
2368 |
+
var _destroy = function(exp) {
|
2369 |
+
$(exp).removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing")
|
2370 |
+
.removeData("resizable").unbind(".resizable").find('.ui-resizable-handle').remove();
|
2371 |
+
};
|
2372 |
+
|
2373 |
+
//TODO: Unwrap at same DOM position
|
2374 |
+
if (this.elementIsWrapper) {
|
2375 |
+
_destroy(this.element);
|
2376 |
+
var wrapper = this.element;
|
2377 |
+
wrapper.after(
|
2378 |
+
this.originalElement.css({
|
2379 |
+
position: wrapper.css('position'),
|
2380 |
+
width: wrapper.outerWidth(),
|
2381 |
+
height: wrapper.outerHeight(),
|
2382 |
+
top: wrapper.css('top'),
|
2383 |
+
left: wrapper.css('left')
|
2384 |
+
})
|
2385 |
+
).remove();
|
2386 |
+
}
|
2387 |
+
|
2388 |
+
this.originalElement.css('resize', this.originalResizeStyle);
|
2389 |
+
_destroy(this.originalElement);
|
2390 |
+
|
2391 |
+
return this;
|
2392 |
+
},
|
2393 |
+
|
2394 |
+
_mouseCapture: function(event) {
|
2395 |
+
var handle = false;
|
2396 |
+
for (var i in this.handles) {
|
2397 |
+
if ($(this.handles[i])[0] == event.target) {
|
2398 |
+
handle = true;
|
2399 |
+
}
|
2400 |
+
}
|
2401 |
+
|
2402 |
+
return !this.options.disabled && handle;
|
2403 |
+
},
|
2404 |
+
|
2405 |
+
_mouseStart: function(event) {
|
2406 |
+
|
2407 |
+
var o = this.options, iniPos = this.element.position(), el = this.element;
|
2408 |
+
|
2409 |
+
this.resizing = true;
|
2410 |
+
this.documentScroll = { top: $(document).scrollTop(), left: $(document).scrollLeft() };
|
2411 |
+
|
2412 |
+
// bugfix for http://dev.jquery.com/ticket/1749
|
2413 |
+
if (el.is('.ui-draggable') || (/absolute/).test(el.css('position'))) {
|
2414 |
+
el.css({ position: 'absolute', top: iniPos.top, left: iniPos.left });
|
2415 |
+
}
|
2416 |
+
|
2417 |
+
//Opera fixing relative position
|
2418 |
+
if ($.browser.opera && (/relative/).test(el.css('position')))
|
2419 |
+
el.css({ position: 'relative', top: 'auto', left: 'auto' });
|
2420 |
+
|
2421 |
+
this._renderProxy();
|
2422 |
+
|
2423 |
+
var curleft = num(this.helper.css('left')), curtop = num(this.helper.css('top'));
|
2424 |
+
|
2425 |
+
if (o.containment) {
|
2426 |
+
curleft += $(o.containment).scrollLeft() || 0;
|
2427 |
+
curtop += $(o.containment).scrollTop() || 0;
|
2428 |
+
}
|
2429 |
+
|
2430 |
+
//Store needed variables
|
2431 |
+
this.offset = this.helper.offset();
|
2432 |
+
this.position = { left: curleft, top: curtop };
|
2433 |
+
this.size = this._helper ? { width: el.outerWidth(), height: el.outerHeight() } : { width: el.width(), height: el.height() };
|
2434 |
+
this.originalSize = this._helper ? { width: el.outerWidth(), height: el.outerHeight() } : { width: el.width(), height: el.height() };
|
2435 |
+
this.originalPosition = { left: curleft, top: curtop };
|
2436 |
+
this.sizeDiff = { width: el.outerWidth() - el.width(), height: el.outerHeight() - el.height() };
|
2437 |
+
this.originalMousePosition = { left: event.pageX, top: event.pageY };
|
2438 |
+
|
2439 |
+
//Aspect Ratio
|
2440 |
+
this.aspectRatio = (typeof o.aspectRatio == 'number') ? o.aspectRatio : ((this.originalSize.width / this.originalSize.height) || 1);
|
2441 |
+
|
2442 |
+
var cursor = $('.ui-resizable-' + this.axis).css('cursor');
|
2443 |
+
$('body').css('cursor', cursor == 'auto' ? this.axis + '-resize' : cursor);
|
2444 |
+
|
2445 |
+
el.addClass("ui-resizable-resizing");
|
2446 |
+
this._propagate("start", event);
|
2447 |
+
return true;
|
2448 |
+
},
|
2449 |
+
|
2450 |
+
_mouseDrag: function(event) {
|
2451 |
+
|
2452 |
+
//Increase performance, avoid regex
|
2453 |
+
var el = this.helper, o = this.options, props = {},
|
2454 |
+
self = this, smp = this.originalMousePosition, a = this.axis;
|
2455 |
+
|
2456 |
+
var dx = (event.pageX-smp.left)||0, dy = (event.pageY-smp.top)||0;
|
2457 |
+
var trigger = this._change[a];
|
2458 |
+
if (!trigger) return false;
|
2459 |
+
|
2460 |
+
// Calculate the attrs that will be change
|
2461 |
+
var data = trigger.apply(this, [event, dx, dy]), ie6 = $.browser.msie && $.browser.version < 7, csdif = this.sizeDiff;
|
2462 |
+
|
2463 |
+
// Put this in the mouseDrag handler since the user can start pressing shift while resizing
|
2464 |
+
this._updateVirtualBoundaries(event.shiftKey);
|
2465 |
+
if (this._aspectRatio || event.shiftKey)
|
2466 |
+
data = this._updateRatio(data, event);
|
2467 |
+
|
2468 |
+
data = this._respectSize(data, event);
|
2469 |
+
|
2470 |
+
// plugins callbacks need to be called first
|
2471 |
+
this._propagate("resize", event);
|
2472 |
+
|
2473 |
+
el.css({
|
2474 |
+
top: this.position.top + "px", left: this.position.left + "px",
|
2475 |
+
width: this.size.width + "px", height: this.size.height + "px"
|
2476 |
+
});
|
2477 |
+
|
2478 |
+
if (!this._helper && this._proportionallyResizeElements.length)
|
2479 |
+
this._proportionallyResize();
|
2480 |
+
|
2481 |
+
this._updateCache(data);
|
2482 |
+
|
2483 |
+
// calling the user callback at the end
|
2484 |
+
this._trigger('resize', event, this.ui());
|
2485 |
+
|
2486 |
+
return false;
|
2487 |
+
},
|
2488 |
+
|
2489 |
+
_mouseStop: function(event) {
|
2490 |
+
|
2491 |
+
this.resizing = false;
|
2492 |
+
var o = this.options, self = this;
|
2493 |
+
|
2494 |
+
if(this._helper) {
|
2495 |
+
var pr = this._proportionallyResizeElements, ista = pr.length && (/textarea/i).test(pr[0].nodeName),
|
2496 |
+
soffseth = ista && $.ui.hasScroll(pr[0], 'left') /* TODO - jump height */ ? 0 : self.sizeDiff.height,
|
2497 |
+
soffsetw = ista ? 0 : self.sizeDiff.width;
|
2498 |
+
|
2499 |
+
var s = { width: (self.helper.width() - soffsetw), height: (self.helper.height() - soffseth) },
|
2500 |
+
left = (parseInt(self.element.css('left'), 10) + (self.position.left - self.originalPosition.left)) || null,
|
2501 |
+
top = (parseInt(self.element.css('top'), 10) + (self.position.top - self.originalPosition.top)) || null;
|
2502 |
+
|
2503 |
+
if (!o.animate)
|
2504 |
+
this.element.css($.extend(s, { top: top, left: left }));
|
2505 |
+
|
2506 |
+
self.helper.height(self.size.height);
|
2507 |
+
self.helper.width(self.size.width);
|
2508 |
+
|
2509 |
+
if (this._helper && !o.animate) this._proportionallyResize();
|
2510 |
+
}
|
2511 |
+
|
2512 |
+
$('body').css('cursor', 'auto');
|
2513 |
+
|
2514 |
+
this.element.removeClass("ui-resizable-resizing");
|
2515 |
+
|
2516 |
+
this._propagate("stop", event);
|
2517 |
+
|
2518 |
+
if (this._helper) this.helper.remove();
|
2519 |
+
return false;
|
2520 |
+
|
2521 |
+
},
|
2522 |
+
|
2523 |
+
_updateVirtualBoundaries: function(forceAspectRatio) {
|
2524 |
+
var o = this.options, pMinWidth, pMaxWidth, pMinHeight, pMaxHeight, b;
|
2525 |
+
|
2526 |
+
b = {
|
2527 |
+
minWidth: isNumber(o.minWidth) ? o.minWidth : 0,
|
2528 |
+
maxWidth: isNumber(o.maxWidth) ? o.maxWidth : Infinity,
|
2529 |
+
minHeight: isNumber(o.minHeight) ? o.minHeight : 0,
|
2530 |
+
maxHeight: isNumber(o.maxHeight) ? o.maxHeight : Infinity
|
2531 |
+
};
|
2532 |
+
|
2533 |
+
if(this._aspectRatio || forceAspectRatio) {
|
2534 |
+
// We want to create an enclosing box whose aspect ration is the requested one
|
2535 |
+
// First, compute the "projected" size for each dimension based on the aspect ratio and other dimension
|
2536 |
+
pMinWidth = b.minHeight * this.aspectRatio;
|
2537 |
+
pMinHeight = b.minWidth / this.aspectRatio;
|
2538 |
+
pMaxWidth = b.maxHeight * this.aspectRatio;
|
2539 |
+
pMaxHeight = b.maxWidth / this.aspectRatio;
|
2540 |
+
|
2541 |
+
if(pMinWidth > b.minWidth) b.minWidth = pMinWidth;
|
2542 |
+
if(pMinHeight > b.minHeight) b.minHeight = pMinHeight;
|
2543 |
+
if(pMaxWidth < b.maxWidth) b.maxWidth = pMaxWidth;
|
2544 |
+
if(pMaxHeight < b.maxHeight) b.maxHeight = pMaxHeight;
|
2545 |
+
}
|
2546 |
+
this._vBoundaries = b;
|
2547 |
+
},
|
2548 |
+
|
2549 |
+
_updateCache: function(data) {
|
2550 |
+
var o = this.options;
|
2551 |
+
this.offset = this.helper.offset();
|
2552 |
+
if (isNumber(data.left)) this.position.left = data.left;
|
2553 |
+
if (isNumber(data.top)) this.position.top = data.top;
|
2554 |
+
if (isNumber(data.height)) this.size.height = data.height;
|
2555 |
+
if (isNumber(data.width)) this.size.width = data.width;
|
2556 |
+
},
|
2557 |
+
|
2558 |
+
_updateRatio: function(data, event) {
|
2559 |
+
|
2560 |
+
var o = this.options, cpos = this.position, csize = this.size, a = this.axis;
|
2561 |
+
|
2562 |
+
if (isNumber(data.height)) data.width = (data.height * this.aspectRatio);
|
2563 |
+
else if (isNumber(data.width)) data.height = (data.width / this.aspectRatio);
|
2564 |
+
|
2565 |
+
if (a == 'sw') {
|
2566 |
+
data.left = cpos.left + (csize.width - data.width);
|
2567 |
+
data.top = null;
|
2568 |
+
}
|
2569 |
+
if (a == 'nw') {
|
2570 |
+
data.top = cpos.top + (csize.height - data.height);
|
2571 |
+
data.left = cpos.left + (csize.width - data.width);
|
2572 |
+
}
|
2573 |
+
|
2574 |
+
return data;
|
2575 |
+
},
|
2576 |
+
|
2577 |
+
_respectSize: function(data, event) {
|
2578 |
+
|
2579 |
+
var el = this.helper, o = this._vBoundaries, pRatio = this._aspectRatio || event.shiftKey, a = this.axis,
|
2580 |
+
ismaxw = isNumber(data.width) && o.maxWidth && (o.maxWidth < data.width), ismaxh = isNumber(data.height) && o.maxHeight && (o.maxHeight < data.height),
|
2581 |
+
isminw = isNumber(data.width) && o.minWidth && (o.minWidth > data.width), isminh = isNumber(data.height) && o.minHeight && (o.minHeight > data.height);
|
2582 |
+
|
2583 |
+
if (isminw) data.width = o.minWidth;
|
2584 |
+
if (isminh) data.height = o.minHeight;
|
2585 |
+
if (ismaxw) data.width = o.maxWidth;
|
2586 |
+
if (ismaxh) data.height = o.maxHeight;
|
2587 |
+
|
2588 |
+
var dw = this.originalPosition.left + this.originalSize.width, dh = this.position.top + this.size.height;
|
2589 |
+
var cw = /sw|nw|w/.test(a), ch = /nw|ne|n/.test(a);
|
2590 |
+
|
2591 |
+
if (isminw && cw) data.left = dw - o.minWidth;
|
2592 |
+
if (ismaxw && cw) data.left = dw - o.maxWidth;
|
2593 |
+
if (isminh && ch) data.top = dh - o.minHeight;
|
2594 |
+
if (ismaxh && ch) data.top = dh - o.maxHeight;
|
2595 |
+
|
2596 |
+
// fixing jump error on top/left - bug #2330
|
2597 |
+
var isNotwh = !data.width && !data.height;
|
2598 |
+
if (isNotwh && !data.left && data.top) data.top = null;
|
2599 |
+
else if (isNotwh && !data.top && data.left) data.left = null;
|
2600 |
+
|
2601 |
+
return data;
|
2602 |
+
},
|
2603 |
+
|
2604 |
+
_proportionallyResize: function() {
|
2605 |
+
|
2606 |
+
var o = this.options;
|
2607 |
+
if (!this._proportionallyResizeElements.length) return;
|
2608 |
+
var element = this.helper || this.element;
|
2609 |
+
|
2610 |
+
for (var i=0; i < this._proportionallyResizeElements.length; i++) {
|
2611 |
+
|
2612 |
+
var prel = this._proportionallyResizeElements[i];
|
2613 |
+
|
2614 |
+
if (!this.borderDif) {
|
2615 |
+
var b = [prel.css('borderTopWidth'), prel.css('borderRightWidth'), prel.css('borderBottomWidth'), prel.css('borderLeftWidth')],
|
2616 |
+
p = [prel.css('paddingTop'), prel.css('paddingRight'), prel.css('paddingBottom'), prel.css('paddingLeft')];
|
2617 |
+
|
2618 |
+
this.borderDif = $.map(b, function(v, i) {
|
2619 |
+
var border = parseInt(v,10)||0, padding = parseInt(p[i],10)||0;
|
2620 |
+
return border + padding;
|
2621 |
+
});
|
2622 |
+
}
|
2623 |
+
|
2624 |
+
if ($.browser.msie && !(!($(element).is(':hidden') || $(element).parents(':hidden').length)))
|
2625 |
+
continue;
|
2626 |
+
|
2627 |
+
prel.css({
|
2628 |
+
height: (element.height() - this.borderDif[0] - this.borderDif[2]) || 0,
|
2629 |
+
width: (element.width() - this.borderDif[1] - this.borderDif[3]) || 0
|
2630 |
+
});
|
2631 |
+
|
2632 |
+
};
|
2633 |
+
|
2634 |
+
},
|
2635 |
+
|
2636 |
+
_renderProxy: function() {
|
2637 |
+
|
2638 |
+
var el = this.element, o = this.options;
|
2639 |
+
this.elementOffset = el.offset();
|
2640 |
+
|
2641 |
+
if(this._helper) {
|
2642 |
+
|
2643 |
+
this.helper = this.helper || $('<div style="overflow:hidden;"></div>');
|
2644 |
+
|
2645 |
+
// fix ie6 offset TODO: This seems broken
|
2646 |
+
var ie6 = $.browser.msie && $.browser.version < 7, ie6offset = (ie6 ? 1 : 0),
|
2647 |
+
pxyoffset = ( ie6 ? 2 : -1 );
|
2648 |
+
|
2649 |
+
this.helper.addClass(this._helper).css({
|
2650 |
+
width: this.element.outerWidth() + pxyoffset,
|
2651 |
+
height: this.element.outerHeight() + pxyoffset,
|
2652 |
+
position: 'absolute',
|
2653 |
+
left: this.elementOffset.left - ie6offset +'px',
|
2654 |
+
top: this.elementOffset.top - ie6offset +'px',
|
2655 |
+
zIndex: ++o.zIndex //TODO: Don't modify option
|
2656 |
+
});
|
2657 |
+
|
2658 |
+
this.helper
|
2659 |
+
.appendTo("body")
|
2660 |
+
.disableSelection();
|
2661 |
+
|
2662 |
+
} else {
|
2663 |
+
this.helper = this.element;
|
2664 |
+
}
|
2665 |
+
|
2666 |
+
},
|
2667 |
+
|
2668 |
+
_change: {
|
2669 |
+
e: function(event, dx, dy) {
|
2670 |
+
return { width: this.originalSize.width + dx };
|
2671 |
+
},
|
2672 |
+
w: function(event, dx, dy) {
|
2673 |
+
var o = this.options, cs = this.originalSize, sp = this.originalPosition;
|
2674 |
+
return { left: sp.left + dx, width: cs.width - dx };
|
2675 |
+
},
|
2676 |
+
n: function(event, dx, dy) {
|
2677 |
+
var o = this.options, cs = this.originalSize, sp = this.originalPosition;
|
2678 |
+
return { top: sp.top + dy, height: cs.height - dy };
|
2679 |
+
},
|
2680 |
+
s: function(event, dx, dy) {
|
2681 |
+
return { height: this.originalSize.height + dy };
|
2682 |
+
},
|
2683 |
+
se: function(event, dx, dy) {
|
2684 |
+
return $.extend(this._change.s.apply(this, arguments), this._change.e.apply(this, [event, dx, dy]));
|
2685 |
+
},
|
2686 |
+
sw: function(event, dx, dy) {
|
2687 |
+
return $.extend(this._change.s.apply(this, arguments), this._change.w.apply(this, [event, dx, dy]));
|
2688 |
+
},
|
2689 |
+
ne: function(event, dx, dy) {
|
2690 |
+
return $.extend(this._change.n.apply(this, arguments), this._change.e.apply(this, [event, dx, dy]));
|
2691 |
+
},
|
2692 |
+
nw: function(event, dx, dy) {
|
2693 |
+
return $.extend(this._change.n.apply(this, arguments), this._change.w.apply(this, [event, dx, dy]));
|
2694 |
+
}
|
2695 |
+
},
|
2696 |
+
|
2697 |
+
_propagate: function(n, event) {
|
2698 |
+
$.ui.plugin.call(this, n, [event, this.ui()]);
|
2699 |
+
(n != "resize" && this._trigger(n, event, this.ui()));
|
2700 |
+
},
|
2701 |
+
|
2702 |
+
plugins: {},
|
2703 |
+
|
2704 |
+
ui: function() {
|
2705 |
+
return {
|
2706 |
+
originalElement: this.originalElement,
|
2707 |
+
element: this.element,
|
2708 |
+
helper: this.helper,
|
2709 |
+
position: this.position,
|
2710 |
+
size: this.size,
|
2711 |
+
originalSize: this.originalSize,
|
2712 |
+
originalPosition: this.originalPosition
|
2713 |
+
};
|
2714 |
+
}
|
2715 |
+
|
2716 |
+
});
|
2717 |
+
|
2718 |
+
$.extend($.ui.resizable, {
|
2719 |
+
version: "1.8.17"
|
2720 |
+
});
|
2721 |
+
|
2722 |
+
/*
|
2723 |
+
* Resizable Extensions
|
2724 |
+
*/
|
2725 |
+
|
2726 |
+
$.ui.plugin.add("resizable", "alsoResize", {
|
2727 |
+
|
2728 |
+
start: function (event, ui) {
|
2729 |
+
var self = $(this).data("resizable"), o = self.options;
|
2730 |
+
|
2731 |
+
var _store = function (exp) {
|
2732 |
+
$(exp).each(function() {
|
2733 |
+
var el = $(this);
|
2734 |
+
el.data("resizable-alsoresize", {
|
2735 |
+
width: parseInt(el.width(), 10), height: parseInt(el.height(), 10),
|
2736 |
+
left: parseInt(el.css('left'), 10), top: parseInt(el.css('top'), 10),
|
2737 |
+
position: el.css('position') // to reset Opera on stop()
|
2738 |
+
});
|
2739 |
+
});
|
2740 |
+
};
|
2741 |
+
|
2742 |
+
if (typeof(o.alsoResize) == 'object' && !o.alsoResize.parentNode) {
|
2743 |
+
if (o.alsoResize.length) { o.alsoResize = o.alsoResize[0]; _store(o.alsoResize); }
|
2744 |
+
else { $.each(o.alsoResize, function (exp) { _store(exp); }); }
|
2745 |
+
}else{
|
2746 |
+
_store(o.alsoResize);
|
2747 |
+
}
|
2748 |
+
},
|
2749 |
+
|
2750 |
+
resize: function (event, ui) {
|
2751 |
+
var self = $(this).data("resizable"), o = self.options, os = self.originalSize, op = self.originalPosition;
|
2752 |
+
|
2753 |
+
var delta = {
|
2754 |
+
height: (self.size.height - os.height) || 0, width: (self.size.width - os.width) || 0,
|
2755 |
+
top: (self.position.top - op.top) || 0, left: (self.position.left - op.left) || 0
|
2756 |
+
},
|
2757 |
+
|
2758 |
+
_alsoResize = function (exp, c) {
|
2759 |
+
$(exp).each(function() {
|
2760 |
+
var el = $(this), start = $(this).data("resizable-alsoresize"), style = {},
|
2761 |
+
css = c && c.length ? c : el.parents(ui.originalElement[0]).length ? ['width', 'height'] : ['width', 'height', 'top', 'left'];
|
2762 |
+
|
2763 |
+
$.each(css, function (i, prop) {
|
2764 |
+
var sum = (start[prop]||0) + (delta[prop]||0);
|
2765 |
+
if (sum && sum >= 0)
|
2766 |
+
style[prop] = sum || null;
|
2767 |
+
});
|
2768 |
+
|
2769 |
+
// Opera fixing relative position
|
2770 |
+
if ($.browser.opera && /relative/.test(el.css('position'))) {
|
2771 |
+
self._revertToRelativePosition = true;
|
2772 |
+
el.css({ position: 'absolute', top: 'auto', left: 'auto' });
|
2773 |
+
}
|
2774 |
+
|
2775 |
+
el.css(style);
|
2776 |
+
});
|
2777 |
+
};
|
2778 |
+
|
2779 |
+
if (typeof(o.alsoResize) == 'object' && !o.alsoResize.nodeType) {
|
2780 |
+
$.each(o.alsoResize, function (exp, c) { _alsoResize(exp, c); });
|
2781 |
+
}else{
|
2782 |
+
_alsoResize(o.alsoResize);
|
2783 |
+
}
|
2784 |
+
},
|
2785 |
+
|
2786 |
+
stop: function (event, ui) {
|
2787 |
+
var self = $(this).data("resizable"), o = self.options;
|
2788 |
+
|
2789 |
+
var _reset = function (exp) {
|
2790 |
+
$(exp).each(function() {
|
2791 |
+
var el = $(this);
|
2792 |
+
// reset position for Opera - no need to verify it was changed
|
2793 |
+
el.css({ position: el.data("resizable-alsoresize").position });
|
2794 |
+
});
|
2795 |
+
};
|
2796 |
+
|
2797 |
+
if (self._revertToRelativePosition) {
|
2798 |
+
self._revertToRelativePosition = false;
|
2799 |
+
if (typeof(o.alsoResize) == 'object' && !o.alsoResize.nodeType) {
|
2800 |
+
$.each(o.alsoResize, function (exp) { _reset(exp); });
|
2801 |
+
}else{
|
2802 |
+
_reset(o.alsoResize);
|
2803 |
+
}
|
2804 |
+
}
|
2805 |
+
|
2806 |
+
$(this).removeData("resizable-alsoresize");
|
2807 |
+
}
|
2808 |
+
});
|
2809 |
+
|
2810 |
+
$.ui.plugin.add("resizable", "animate", {
|
2811 |
+
|
2812 |
+
stop: function(event, ui) {
|
2813 |
+
var self = $(this).data("resizable"), o = self.options;
|
2814 |
+
|
2815 |
+
var pr = self._proportionallyResizeElements, ista = pr.length && (/textarea/i).test(pr[0].nodeName),
|
2816 |
+
soffseth = ista && $.ui.hasScroll(pr[0], 'left') /* TODO - jump height */ ? 0 : self.sizeDiff.height,
|
2817 |
+
soffsetw = ista ? 0 : self.sizeDiff.width;
|
2818 |
+
|
2819 |
+
var style = { width: (self.size.width - soffsetw), height: (self.size.height - soffseth) },
|
2820 |
+
left = (parseInt(self.element.css('left'), 10) + (self.position.left - self.originalPosition.left)) || null,
|
2821 |
+
top = (parseInt(self.element.css('top'), 10) + (self.position.top - self.originalPosition.top)) || null;
|
2822 |
+
|
2823 |
+
self.element.animate(
|
2824 |
+
$.extend(style, top && left ? { top: top, left: left } : {}), {
|
2825 |
+
duration: o.animateDuration,
|
2826 |
+
easing: o.animateEasing,
|
2827 |
+
step: function() {
|
2828 |
+
|
2829 |
+
var data = {
|
2830 |
+
width: parseInt(self.element.css('width'), 10),
|
2831 |
+
height: parseInt(self.element.css('height'), 10),
|
2832 |
+
top: parseInt(self.element.css('top'), 10),
|
2833 |
+
left: parseInt(self.element.css('left'), 10)
|
2834 |
+
};
|
2835 |
+
|
2836 |
+
if (pr && pr.length) $(pr[0]).css({ width: data.width, height: data.height });
|
2837 |
+
|
2838 |
+
// propagating resize, and updating values for each animation step
|
2839 |
+
self._updateCache(data);
|
2840 |
+
self._propagate("resize", event);
|
2841 |
+
|
2842 |
+
}
|
2843 |
+
}
|
2844 |
+
);
|
2845 |
+
}
|
2846 |
+
|
2847 |
+
});
|
2848 |
+
|
2849 |
+
$.ui.plugin.add("resizable", "containment", {
|
2850 |
+
|
2851 |
+
start: function(event, ui) {
|
2852 |
+
var self = $(this).data("resizable"), o = self.options, el = self.element;
|
2853 |
+
var oc = o.containment, ce = (oc instanceof $) ? oc.get(0) : (/parent/.test(oc)) ? el.parent().get(0) : oc;
|
2854 |
+
if (!ce) return;
|
2855 |
+
|
2856 |
+
self.containerElement = $(ce);
|
2857 |
+
|
2858 |
+
if (/document/.test(oc) || oc == document) {
|
2859 |
+
self.containerOffset = { left: 0, top: 0 };
|
2860 |
+
self.containerPosition = { left: 0, top: 0 };
|
2861 |
+
|
2862 |
+
self.parentData = {
|
2863 |
+
element: $(document), left: 0, top: 0,
|
2864 |
+
width: $(document).width(), height: $(document).height() || document.body.parentNode.scrollHeight
|
2865 |
+
};
|
2866 |
+
}
|
2867 |
+
|
2868 |
+
// i'm a node, so compute top, left, right, bottom
|
2869 |
+
else {
|
2870 |
+
var element = $(ce), p = [];
|
2871 |
+
$([ "Top", "Right", "Left", "Bottom" ]).each(function(i, name) { p[i] = num(element.css("padding" + name)); });
|
2872 |
+
|
2873 |
+
self.containerOffset = element.offset();
|
2874 |
+
self.containerPosition = element.position();
|
2875 |
+
self.containerSize = { height: (element.innerHeight() - p[3]), width: (element.innerWidth() - p[1]) };
|
2876 |
+
|
2877 |
+
var co = self.containerOffset, ch = self.containerSize.height, cw = self.containerSize.width,
|
2878 |
+
width = ($.ui.hasScroll(ce, "left") ? ce.scrollWidth : cw ), height = ($.ui.hasScroll(ce) ? ce.scrollHeight : ch);
|
2879 |
+
|
2880 |
+
self.parentData = {
|
2881 |
+
element: ce, left: co.left, top: co.top, width: width, height: height
|
2882 |
+
};
|
2883 |
+
}
|
2884 |
+
},
|
2885 |
+
|
2886 |
+
resize: function(event, ui) {
|
2887 |
+
var self = $(this).data("resizable"), o = self.options,
|
2888 |
+
ps = self.containerSize, co = self.containerOffset, cs = self.size, cp = self.position,
|
2889 |
+
pRatio = self._aspectRatio || event.shiftKey, cop = { top:0, left:0 }, ce = self.containerElement;
|
2890 |
+
|
2891 |
+
if (ce[0] != document && (/static/).test(ce.css('position'))) cop = co;
|
2892 |
+
|
2893 |
+
if (cp.left < (self._helper ? co.left : 0)) {
|
2894 |
+
self.size.width = self.size.width + (self._helper ? (self.position.left - co.left) : (self.position.left - cop.left));
|
2895 |
+
if (pRatio) self.size.height = self.size.width / o.aspectRatio;
|
2896 |
+
self.position.left = o.helper ? co.left : 0;
|
2897 |
+
}
|
2898 |
+
|
2899 |
+
if (cp.top < (self._helper ? co.top : 0)) {
|
2900 |
+
self.size.height = self.size.height + (self._helper ? (self.position.top - co.top) : self.position.top);
|
2901 |
+
if (pRatio) self.size.width = self.size.height * o.aspectRatio;
|
2902 |
+
self.position.top = self._helper ? co.top : 0;
|
2903 |
+
}
|
2904 |
+
|
2905 |
+
self.offset.left = self.parentData.left+self.position.left;
|
2906 |
+
self.offset.top = self.parentData.top+self.position.top;
|
2907 |
+
|
2908 |
+
var woset = Math.abs( (self._helper ? self.offset.left - cop.left : (self.offset.left - cop.left)) + self.sizeDiff.width ),
|
2909 |
+
hoset = Math.abs( (self._helper ? self.offset.top - cop.top : (self.offset.top - co.top)) + self.sizeDiff.height );
|
2910 |
+
|
2911 |
+
var isParent = self.containerElement.get(0) == self.element.parent().get(0),
|
2912 |
+
isOffsetRelative = /relative|absolute/.test(self.containerElement.css('position'));
|
2913 |
+
|
2914 |
+
if(isParent && isOffsetRelative) woset -= self.parentData.left;
|
2915 |
+
|
2916 |
+
if (woset + self.size.width >= self.parentData.width) {
|
2917 |
+
self.size.width = self.parentData.width - woset;
|
2918 |
+
if (pRatio) self.size.height = self.size.width / self.aspectRatio;
|
2919 |
+
}
|
2920 |
+
|
2921 |
+
if (hoset + self.size.height >= self.parentData.height) {
|
2922 |
+
self.size.height = self.parentData.height - hoset;
|
2923 |
+
if (pRatio) self.size.width = self.size.height * self.aspectRatio;
|
2924 |
+
}
|
2925 |
+
},
|
2926 |
+
|
2927 |
+
stop: function(event, ui){
|
2928 |
+
var self = $(this).data("resizable"), o = self.options, cp = self.position,
|
2929 |
+
co = self.containerOffset, cop = self.containerPosition, ce = self.containerElement;
|
2930 |
+
|
2931 |
+
var helper = $(self.helper), ho = helper.offset(), w = helper.outerWidth() - self.sizeDiff.width, h = helper.outerHeight() - self.sizeDiff.height;
|
2932 |
+
|
2933 |
+
if (self._helper && !o.animate && (/relative/).test(ce.css('position')))
|
2934 |
+
$(this).css({ left: ho.left - cop.left - co.left, width: w, height: h });
|
2935 |
+
|
2936 |
+
if (self._helper && !o.animate && (/static/).test(ce.css('position')))
|
2937 |
+
$(this).css({ left: ho.left - cop.left - co.left, width: w, height: h });
|
2938 |
+
|
2939 |
+
}
|
2940 |
+
});
|
2941 |
+
|
2942 |
+
$.ui.plugin.add("resizable", "ghost", {
|
2943 |
+
|
2944 |
+
start: function(event, ui) {
|
2945 |
+
|
2946 |
+
var self = $(this).data("resizable"), o = self.options, cs = self.size;
|
2947 |
+
|
2948 |
+
self.ghost = self.originalElement.clone();
|
2949 |
+
self.ghost
|
2950 |
+
.css({ opacity: .25, display: 'block', position: 'relative', height: cs.height, width: cs.width, margin: 0, left: 0, top: 0 })
|
2951 |
+
.addClass('ui-resizable-ghost')
|
2952 |
+
.addClass(typeof o.ghost == 'string' ? o.ghost : '');
|
2953 |
+
|
2954 |
+
self.ghost.appendTo(self.helper);
|
2955 |
+
|
2956 |
+
},
|
2957 |
+
|
2958 |
+
resize: function(event, ui){
|
2959 |
+
var self = $(this).data("resizable"), o = self.options;
|
2960 |
+
if (self.ghost) self.ghost.css({ position: 'relative', height: self.size.height, width: self.size.width });
|
2961 |
+
},
|
2962 |
+
|
2963 |
+
stop: function(event, ui){
|
2964 |
+
var self = $(this).data("resizable"), o = self.options;
|
2965 |
+
if (self.ghost && self.helper) self.helper.get(0).removeChild(self.ghost.get(0));
|
2966 |
+
}
|
2967 |
+
|
2968 |
+
});
|
2969 |
+
|
2970 |
+
$.ui.plugin.add("resizable", "grid", {
|
2971 |
+
|
2972 |
+
resize: function(event, ui) {
|
2973 |
+
var self = $(this).data("resizable"), o = self.options, cs = self.size, os = self.originalSize, op = self.originalPosition, a = self.axis, ratio = o._aspectRatio || event.shiftKey;
|
2974 |
+
o.grid = typeof o.grid == "number" ? [o.grid, o.grid] : o.grid;
|
2975 |
+
var ox = Math.round((cs.width - os.width) / (o.grid[0]||1)) * (o.grid[0]||1), oy = Math.round((cs.height - os.height) / (o.grid[1]||1)) * (o.grid[1]||1);
|
2976 |
+
|
2977 |
+
if (/^(se|s|e)$/.test(a)) {
|
2978 |
+
self.size.width = os.width + ox;
|
2979 |
+
self.size.height = os.height + oy;
|
2980 |
+
}
|
2981 |
+
else if (/^(ne)$/.test(a)) {
|
2982 |
+
self.size.width = os.width + ox;
|
2983 |
+
self.size.height = os.height + oy;
|
2984 |
+
self.position.top = op.top - oy;
|
2985 |
+
}
|
2986 |
+
else if (/^(sw)$/.test(a)) {
|
2987 |
+
self.size.width = os.width + ox;
|
2988 |
+
self.size.height = os.height + oy;
|
2989 |
+
self.position.left = op.left - ox;
|
2990 |
+
}
|
2991 |
+
else {
|
2992 |
+
self.size.width = os.width + ox;
|
2993 |
+
self.size.height = os.height + oy;
|
2994 |
+
self.position.top = op.top - oy;
|
2995 |
+
self.position.left = op.left - ox;
|
2996 |
+
}
|
2997 |
+
}
|
2998 |
+
|
2999 |
+
});
|
3000 |
+
|
3001 |
+
var num = function(v) {
|
3002 |
+
return parseInt(v, 10) || 0;
|
3003 |
+
};
|
3004 |
+
|
3005 |
+
var isNumber = function(value) {
|
3006 |
+
return !isNaN(parseInt(value, 10));
|
3007 |
+
};
|
3008 |
+
|
3009 |
+
})(jQuery);
|
3010 |
+
/*
|
3011 |
+
* jQuery UI Selectable 1.8.17
|
3012 |
+
*
|
3013 |
+
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
|
3014 |
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
3015 |
+
* http://jquery.org/license
|
3016 |
+
*
|
3017 |
+
* http://docs.jquery.com/UI/Selectables
|
3018 |
+
*
|
3019 |
+
* Depends:
|
3020 |
+
* jquery.ui.core.js
|
3021 |
+
* jquery.ui.mouse.js
|
3022 |
+
* jquery.ui.widget.js
|
3023 |
+
*/
|
3024 |
+
(function( $, undefined ) {
|
3025 |
+
|
3026 |
+
$.widget("ui.selectable", $.ui.mouse, {
|
3027 |
+
options: {
|
3028 |
+
appendTo: 'body',
|
3029 |
+
autoRefresh: true,
|
3030 |
+
distance: 0,
|
3031 |
+
filter: '*',
|
3032 |
+
tolerance: 'touch'
|
3033 |
+
},
|
3034 |
+
_create: function() {
|
3035 |
+
var self = this;
|
3036 |
+
|
3037 |
+
this.element.addClass("ui-selectable");
|
3038 |
+
|
3039 |
+
this.dragged = false;
|
3040 |
+
|
3041 |
+
// cache selectee children based on filter
|
3042 |
+
var selectees;
|
3043 |
+
this.refresh = function() {
|
3044 |
+
selectees = $(self.options.filter, self.element[0]);
|
3045 |
+
selectees.addClass("ui-selectee");
|
3046 |
+
selectees.each(function() {
|
3047 |
+
var $this = $(this);
|
3048 |
+
var pos = $this.offset();
|
3049 |
+
$.data(this, "selectable-item", {
|
3050 |
+
element: this,
|
3051 |
+
$element: $this,
|
3052 |
+
left: pos.left,
|
3053 |
+
top: pos.top,
|
3054 |
+
right: pos.left + $this.outerWidth(),
|
3055 |
+
bottom: pos.top + $this.outerHeight(),
|
3056 |
+
startselected: false,
|
3057 |
+
selected: $this.hasClass('ui-selected'),
|
3058 |
+
selecting: $this.hasClass('ui-selecting'),
|
3059 |
+
unselecting: $this.hasClass('ui-unselecting')
|
3060 |
+
});
|
3061 |
+
});
|
3062 |
+
};
|
3063 |
+
this.refresh();
|
3064 |
+
|
3065 |
+
this.selectees = selectees.addClass("ui-selectee");
|
3066 |
+
|
3067 |
+
this._mouseInit();
|
3068 |
+
|
3069 |
+
this.helper = $("<div class='ui-selectable-helper'></div>");
|
3070 |
+
},
|
3071 |
+
|
3072 |
+
destroy: function() {
|
3073 |
+
this.selectees
|
3074 |
+
.removeClass("ui-selectee")
|
3075 |
+
.removeData("selectable-item");
|
3076 |
+
this.element
|
3077 |
+
.removeClass("ui-selectable ui-selectable-disabled")
|
3078 |
+
.removeData("selectable")
|
3079 |
+
.unbind(".selectable");
|
3080 |
+
this._mouseDestroy();
|
3081 |
+
|
3082 |
+
return this;
|
3083 |
+
},
|
3084 |
+
|
3085 |
+
_mouseStart: function(event) {
|
3086 |
+
var self = this;
|
3087 |
+
|
3088 |
+
this.opos = [event.pageX, event.pageY];
|
3089 |
+
|
3090 |
+
if (this.options.disabled)
|
3091 |
+
return;
|
3092 |
+
|
3093 |
+
var options = this.options;
|
3094 |
+
|
3095 |
+
this.selectees = $(options.filter, this.element[0]);
|
3096 |
+
|
3097 |
+
this._trigger("start", event);
|
3098 |
+
|
3099 |
+
$(options.appendTo).append(this.helper);
|
3100 |
+
// position helper (lasso)
|
3101 |
+
this.helper.css({
|
3102 |
+
"left": event.clientX,
|
3103 |
+
"top": event.clientY,
|
3104 |
+
"width": 0,
|
3105 |
+
"height": 0
|
3106 |
+
});
|
3107 |
+
|
3108 |
+
if (options.autoRefresh) {
|
3109 |
+
this.refresh();
|
3110 |
+
}
|
3111 |
+
|
3112 |
+
this.selectees.filter('.ui-selected').each(function() {
|
3113 |
+
var selectee = $.data(this, "selectable-item");
|
3114 |
+
selectee.startselected = true;
|
3115 |
+
if (!event.metaKey && !event.ctrlKey) {
|
3116 |
+
selectee.$element.removeClass('ui-selected');
|
3117 |
+
selectee.selected = false;
|
3118 |
+
selectee.$element.addClass('ui-unselecting');
|
3119 |
+
selectee.unselecting = true;
|
3120 |
+
// selectable UNSELECTING callback
|
3121 |
+
self._trigger("unselecting", event, {
|
3122 |
+
unselecting: selectee.element
|
3123 |
+
});
|
3124 |
+
}
|
3125 |
+
});
|
3126 |
+
|
3127 |
+
$(event.target).parents().andSelf().each(function() {
|
3128 |
+
var selectee = $.data(this, "selectable-item");
|
3129 |
+
if (selectee) {
|
3130 |
+
var doSelect = (!event.metaKey && !event.ctrlKey) || !selectee.$element.hasClass('ui-selected');
|
3131 |
+
selectee.$element
|
3132 |
+
.removeClass(doSelect ? "ui-unselecting" : "ui-selected")
|
3133 |
+
.addClass(doSelect ? "ui-selecting" : "ui-unselecting");
|
3134 |
+
selectee.unselecting = !doSelect;
|
3135 |
+
selectee.selecting = doSelect;
|
3136 |
+
selectee.selected = doSelect;
|
3137 |
+
// selectable (UN)SELECTING callback
|
3138 |
+
if (doSelect) {
|
3139 |
+
self._trigger("selecting", event, {
|
3140 |
+
selecting: selectee.element
|
3141 |
+
});
|
3142 |
+
} else {
|
3143 |
+
self._trigger("unselecting", event, {
|
3144 |
+
unselecting: selectee.element
|
3145 |
+
});
|
3146 |
+
}
|
3147 |
+
return false;
|
3148 |
+
}
|
3149 |
+
});
|
3150 |
+
|
3151 |
+
},
|
3152 |
+
|
3153 |
+
_mouseDrag: function(event) {
|
3154 |
+
var self = this;
|
3155 |
+
this.dragged = true;
|
3156 |
+
|
3157 |
+
if (this.options.disabled)
|
3158 |
+
return;
|
3159 |
+
|
3160 |
+
var options = this.options;
|
3161 |
+
|
3162 |
+
var x1 = this.opos[0], y1 = this.opos[1], x2 = event.pageX, y2 = event.pageY;
|
3163 |
+
if (x1 > x2) { var tmp = x2; x2 = x1; x1 = tmp; }
|
3164 |
+
if (y1 > y2) { var tmp = y2; y2 = y1; y1 = tmp; }
|
3165 |
+
this.helper.css({left: x1, top: y1, width: x2-x1, height: y2-y1});
|
3166 |
+
|
3167 |
+
this.selectees.each(function() {
|
3168 |
+
var selectee = $.data(this, "selectable-item");
|
3169 |
+
//prevent helper from being selected if appendTo: selectable
|
3170 |
+
if (!selectee || selectee.element == self.element[0])
|
3171 |
+
return;
|
3172 |
+
var hit = false;
|
3173 |
+
if (options.tolerance == 'touch') {
|
3174 |
+
hit = ( !(selectee.left > x2 || selectee.right < x1 || selectee.top > y2 || selectee.bottom < y1) );
|
3175 |
+
} else if (options.tolerance == 'fit') {
|
3176 |
+
hit = (selectee.left > x1 && selectee.right < x2 && selectee.top > y1 && selectee.bottom < y2);
|
3177 |
+
}
|
3178 |
+
|
3179 |
+
if (hit) {
|
3180 |
+
// SELECT
|
3181 |
+
if (selectee.selected) {
|
3182 |
+
selectee.$element.removeClass('ui-selected');
|
3183 |
+
selectee.selected = false;
|
3184 |
+
}
|
3185 |
+
if (selectee.unselecting) {
|
3186 |
+
selectee.$element.removeClass('ui-unselecting');
|
3187 |
+
selectee.unselecting = false;
|
3188 |
+
}
|
3189 |
+
if (!selectee.selecting) {
|
3190 |
+
selectee.$element.addClass('ui-selecting');
|
3191 |
+
selectee.selecting = true;
|
3192 |
+
// selectable SELECTING callback
|
3193 |
+
self._trigger("selecting", event, {
|
3194 |
+
selecting: selectee.element
|
3195 |
+
});
|
3196 |
+
}
|
3197 |
+
} else {
|
3198 |
+
// UNSELECT
|
3199 |
+
if (selectee.selecting) {
|
3200 |
+
if ((event.metaKey || event.ctrlKey) && selectee.startselected) {
|
3201 |
+
selectee.$element.removeClass('ui-selecting');
|
3202 |
+
selectee.selecting = false;
|
3203 |
+
selectee.$element.addClass('ui-selected');
|
3204 |
+
selectee.selected = true;
|
3205 |
+
} else {
|
3206 |
+
selectee.$element.removeClass('ui-selecting');
|
3207 |
+
selectee.selecting = false;
|
3208 |
+
if (selectee.startselected) {
|
3209 |
+
selectee.$element.addClass('ui-unselecting');
|
3210 |
+
selectee.unselecting = true;
|
3211 |
+
}
|
3212 |
+
// selectable UNSELECTING callback
|
3213 |
+
self._trigger("unselecting", event, {
|
3214 |
+
unselecting: selectee.element
|
3215 |
+
});
|
3216 |
+
}
|
3217 |
+
}
|
3218 |
+
if (selectee.selected) {
|
3219 |
+
if (!event.metaKey && !event.ctrlKey && !selectee.startselected) {
|
3220 |
+
selectee.$element.removeClass('ui-selected');
|
3221 |
+
selectee.selected = false;
|
3222 |
+
|
3223 |
+
selectee.$element.addClass('ui-unselecting');
|
3224 |
+
selectee.unselecting = true;
|
3225 |
+
// selectable UNSELECTING callback
|
3226 |
+
self._trigger("unselecting", event, {
|
3227 |
+
unselecting: selectee.element
|
3228 |
+
});
|
3229 |
+
}
|
3230 |
+
}
|
3231 |
+
}
|
3232 |
+
});
|
3233 |
+
|
3234 |
+
return false;
|
3235 |
+
},
|
3236 |
+
|
3237 |
+
_mouseStop: function(event) {
|
3238 |
+
var self = this;
|
3239 |
+
|
3240 |
+
this.dragged = false;
|
3241 |
+
|
3242 |
+
var options = this.options;
|
3243 |
+
|
3244 |
+
$('.ui-unselecting', this.element[0]).each(function() {
|
3245 |
+
var selectee = $.data(this, "selectable-item");
|
3246 |
+
selectee.$element.removeClass('ui-unselecting');
|
3247 |
+
selectee.unselecting = false;
|
3248 |
+
selectee.startselected = false;
|
3249 |
+
self._trigger("unselected", event, {
|
3250 |
+
unselected: selectee.element
|
3251 |
+
});
|
3252 |
+
});
|
3253 |
+
$('.ui-selecting', this.element[0]).each(function() {
|
3254 |
+
var selectee = $.data(this, "selectable-item");
|
3255 |
+
selectee.$element.removeClass('ui-selecting').addClass('ui-selected');
|
3256 |
+
selectee.selecting = false;
|
3257 |
+
selectee.selected = true;
|
3258 |
+
selectee.startselected = true;
|
3259 |
+
self._trigger("selected", event, {
|
3260 |
+
selected: selectee.element
|
3261 |
+
});
|
3262 |
+
});
|
3263 |
+
this._trigger("stop", event);
|
3264 |
+
|
3265 |
+
this.helper.remove();
|
3266 |
+
|
3267 |
+
return false;
|
3268 |
+
}
|
3269 |
+
|
3270 |
+
});
|
3271 |
+
|
3272 |
+
$.extend($.ui.selectable, {
|
3273 |
+
version: "1.8.17"
|
3274 |
+
});
|
3275 |
+
|
3276 |
+
})(jQuery);
|
3277 |
+
/*
|
3278 |
+
* jQuery UI Sortable 1.8.17
|
3279 |
+
*
|
3280 |
+
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
|
3281 |
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
3282 |
+
* http://jquery.org/license
|
3283 |
+
*
|
3284 |
+
* http://docs.jquery.com/UI/Sortables
|
3285 |
+
*
|
3286 |
+
* Depends:
|
3287 |
+
* jquery.ui.core.js
|
3288 |
+
* jquery.ui.mouse.js
|
3289 |
+
* jquery.ui.widget.js
|
3290 |
+
*/
|
3291 |
+
(function( $, undefined ) {
|
3292 |
+
|
3293 |
+
$.widget("ui.sortable", $.ui.mouse, {
|
3294 |
+
widgetEventPrefix: "sort",
|
3295 |
+
options: {
|
3296 |
+
appendTo: "parent",
|
3297 |
+
axis: false,
|
3298 |
+
connectWith: false,
|
3299 |
+
containment: false,
|
3300 |
+
cursor: 'auto',
|
3301 |
+
cursorAt: false,
|
3302 |
+
dropOnEmpty: true,
|
3303 |
+
forcePlaceholderSize: false,
|
3304 |
+
forceHelperSize: false,
|
3305 |
+
grid: false,
|
3306 |
+
handle: false,
|
3307 |
+
helper: "original",
|
3308 |
+
items: '> *',
|
3309 |
+
opacity: false,
|
3310 |
+
placeholder: false,
|
3311 |
+
revert: false,
|
3312 |
+
scroll: true,
|
3313 |
+
scrollSensitivity: 20,
|
3314 |
+
scrollSpeed: 20,
|
3315 |
+
scope: "default",
|
3316 |
+
tolerance: "intersect",
|
3317 |
+
zIndex: 1000
|
3318 |
+
},
|
3319 |
+
_create: function() {
|
3320 |
+
|
3321 |
+
var o = this.options;
|
3322 |
+
this.containerCache = {};
|
3323 |
+
this.element.addClass("ui-sortable");
|
3324 |
+
|
3325 |
+
//Get the items
|
3326 |
+
this.refresh();
|
3327 |
+
|
3328 |
+
//Let's determine if the items are being displayed horizontally
|
3329 |
+
this.floating = this.items.length ? o.axis === 'x' || (/left|right/).test(this.items[0].item.css('float')) || (/inline|table-cell/).test(this.items[0].item.css('display')) : false;
|
3330 |
+
|
3331 |
+
//Let's determine the parent's offset
|
3332 |
+
this.offset = this.element.offset();
|
3333 |
+
|
3334 |
+
//Initialize mouse events for interaction
|
3335 |
+
this._mouseInit();
|
3336 |
+
|
3337 |
+
},
|
3338 |
+
|
3339 |
+
destroy: function() {
|
3340 |
+
this.element
|
3341 |
+
.removeClass("ui-sortable ui-sortable-disabled");
|
3342 |
+
this._mouseDestroy();
|
3343 |
+
|
3344 |
+
for ( var i = this.items.length - 1; i >= 0; i-- )
|
3345 |
+
this.items[i].item.removeData(this.widgetName + "-item");
|
3346 |
+
|
3347 |
+
return this;
|
3348 |
+
},
|
3349 |
+
|
3350 |
+
_setOption: function(key, value){
|
3351 |
+
if ( key === "disabled" ) {
|
3352 |
+
this.options[ key ] = value;
|
3353 |
+
|
3354 |
+
this.widget()
|
3355 |
+
[ value ? "addClass" : "removeClass"]( "ui-sortable-disabled" );
|
3356 |
+
} else {
|
3357 |
+
// Don't call widget base _setOption for disable as it adds ui-state-disabled class
|
3358 |
+
$.Widget.prototype._setOption.apply(this, arguments);
|
3359 |
+
}
|
3360 |
+
},
|
3361 |
+
|
3362 |
+
_mouseCapture: function(event, overrideHandle) {
|
3363 |
+
var that = this;
|
3364 |
+
|
3365 |
+
if (this.reverting) {
|
3366 |
+
return false;
|
3367 |
+
}
|
3368 |
+
|
3369 |
+
if(this.options.disabled || this.options.type == 'static') return false;
|
3370 |
+
|
3371 |
+
//We have to refresh the items data once first
|
3372 |
+
this._refreshItems(event);
|
3373 |
+
|
3374 |
+
//Find out if the clicked node (or one of its parents) is a actual item in this.items
|
3375 |
+
var currentItem = null, self = this, nodes = $(event.target).parents().each(function() {
|
3376 |
+
if($.data(this, that.widgetName + '-item') == self) {
|
3377 |
+
currentItem = $(this);
|
3378 |
+
return false;
|
3379 |
+
}
|
3380 |
+
});
|
3381 |
+
if($.data(event.target, that.widgetName + '-item') == self) currentItem = $(event.target);
|
3382 |
+
|
3383 |
+
if(!currentItem) return false;
|
3384 |
+
if(this.options.handle && !overrideHandle) {
|
3385 |
+
var validHandle = false;
|
3386 |
+
|
3387 |
+
$(this.options.handle, currentItem).find("*").andSelf().each(function() { if(this == event.target) validHandle = true; });
|
3388 |
+
if(!validHandle) return false;
|
3389 |
+
}
|
3390 |
+
|
3391 |
+
this.currentItem = currentItem;
|
3392 |
+
this._removeCurrentsFromItems();
|
3393 |
+
return true;
|
3394 |
+
|
3395 |
+
},
|
3396 |
+
|
3397 |
+
_mouseStart: function(event, overrideHandle, noActivation) {
|
3398 |
+
|
3399 |
+
var o = this.options, self = this;
|
3400 |
+
this.currentContainer = this;
|
3401 |
+
|
3402 |
+
//We only need to call refreshPositions, because the refreshItems call has been moved to mouseCapture
|
3403 |
+
this.refreshPositions();
|
3404 |
+
|
3405 |
+
//Create and append the visible helper
|
3406 |
+
this.helper = this._createHelper(event);
|
3407 |
+
|
3408 |
+
//Cache the helper size
|
3409 |
+
this._cacheHelperProportions();
|
3410 |
+
|
3411 |
+
/*
|
3412 |
+
* - Position generation -
|
3413 |
+
* This block generates everything position related - it's the core of draggables.
|
3414 |
+
*/
|
3415 |
+
|
3416 |
+
//Cache the margins of the original element
|
3417 |
+
this._cacheMargins();
|
3418 |
+
|
3419 |
+
//Get the next scrolling parent
|
3420 |
+
this.scrollParent = this.helper.scrollParent();
|
3421 |
+
|
3422 |
+
//The element's absolute position on the page minus margins
|
3423 |
+
this.offset = this.currentItem.offset();
|
3424 |
+
this.offset = {
|
3425 |
+
top: this.offset.top - this.margins.top,
|
3426 |
+
left: this.offset.left - this.margins.left
|
3427 |
+
};
|
3428 |
+
|
3429 |
+
// Only after we got the offset, we can change the helper's position to absolute
|
3430 |
+
// TODO: Still need to figure out a way to make relative sorting possible
|
3431 |
+
this.helper.css("position", "absolute");
|
3432 |
+
this.cssPosition = this.helper.css("position");
|
3433 |
+
|
3434 |
+
$.extend(this.offset, {
|
3435 |
+
click: { //Where the click happened, relative to the element
|
3436 |
+
left: event.pageX - this.offset.left,
|
3437 |
+
top: event.pageY - this.offset.top
|
3438 |
+
},
|
3439 |
+
parent: this._getParentOffset(),
|
3440 |
+
relative: this._getRelativeOffset() //This is a relative to absolute position minus the actual position calculation - only used for relative positioned helper
|
3441 |
+
});
|
3442 |
+
|
3443 |
+
//Generate the original position
|
3444 |
+
this.originalPosition = this._generatePosition(event);
|
3445 |
+
this.originalPageX = event.pageX;
|
3446 |
+
this.originalPageY = event.pageY;
|
3447 |
+
|
3448 |
+
//Adjust the mouse offset relative to the helper if 'cursorAt' is supplied
|
3449 |
+
(o.cursorAt && this._adjustOffsetFromHelper(o.cursorAt));
|
3450 |
+
|
3451 |
+
//Cache the former DOM position
|
3452 |
+
this.domPosition = { prev: this.currentItem.prev()[0], parent: this.currentItem.parent()[0] };
|
3453 |
+
|
3454 |
+
//If the helper is not the original, hide the original so it's not playing any role during the drag, won't cause anything bad this way
|
3455 |
+
if(this.helper[0] != this.currentItem[0]) {
|
3456 |
+
this.currentItem.hide();
|
3457 |
+
}
|
3458 |
+
|
3459 |
+
//Create the placeholder
|
3460 |
+
this._createPlaceholder();
|
3461 |
+
|
3462 |
+
//Set a containment if given in the options
|
3463 |
+
if(o.containment)
|
3464 |
+
this._setContainment();
|
3465 |
+
|
3466 |
+
if(o.cursor) { // cursor option
|
3467 |
+
if ($('body').css("cursor")) this._storedCursor = $('body').css("cursor");
|
3468 |
+
$('body').css("cursor", o.cursor);
|
3469 |
+
}
|
3470 |
+
|
3471 |
+
if(o.opacity) { // opacity option
|
3472 |
+
if (this.helper.css("opacity")) this._storedOpacity = this.helper.css("opacity");
|
3473 |
+
this.helper.css("opacity", o.opacity);
|
3474 |
+
}
|
3475 |
+
|
3476 |
+
if(o.zIndex) { // zIndex option
|
3477 |
+
if (this.helper.css("zIndex")) this._storedZIndex = this.helper.css("zIndex");
|
3478 |
+
this.helper.css("zIndex", o.zIndex);
|
3479 |
+
}
|
3480 |
+
|
3481 |
+
//Prepare scrolling
|
3482 |
+
if(this.scrollParent[0] != document && this.scrollParent[0].tagName != 'HTML')
|
3483 |
+
this.overflowOffset = this.scrollParent.offset();
|
3484 |
+
|
3485 |
+
//Call callbacks
|
3486 |
+
this._trigger("start", event, this._uiHash());
|
3487 |
+
|
3488 |
+
//Recache the helper size
|
3489 |
+
if(!this._preserveHelperProportions)
|
3490 |
+
this._cacheHelperProportions();
|
3491 |
+
|
3492 |
+
|
3493 |
+
//Post 'activate' events to possible containers
|
3494 |
+
if(!noActivation) {
|
3495 |
+
for (var i = this.containers.length - 1; i >= 0; i--) { this.containers[i]._trigger("activate", event, self._uiHash(this)); }
|
3496 |
+
}
|
3497 |
+
|
3498 |
+
//Prepare possible droppables
|
3499 |
+
if($.ui.ddmanager)
|
3500 |
+
$.ui.ddmanager.current = this;
|
3501 |
+
|
3502 |
+
if ($.ui.ddmanager && !o.dropBehaviour)
|
3503 |
+
$.ui.ddmanager.prepareOffsets(this, event);
|
3504 |
+
|
3505 |
+
this.dragging = true;
|
3506 |
+
|
3507 |
+
this.helper.addClass("ui-sortable-helper");
|
3508 |
+
this._mouseDrag(event); //Execute the drag once - this causes the helper not to be visible before getting its correct position
|
3509 |
+
return true;
|
3510 |
+
|
3511 |
+
},
|
3512 |
+
|
3513 |
+
_mouseDrag: function(event) {
|
3514 |
+
|
3515 |
+
//Compute the helpers position
|
3516 |
+
this.position = this._generatePosition(event);
|
3517 |
+
this.positionAbs = this._convertPositionTo("absolute");
|
3518 |
+
|
3519 |
+
if (!this.lastPositionAbs) {
|
3520 |
+
this.lastPositionAbs = this.positionAbs;
|
3521 |
+
}
|
3522 |
+
|
3523 |
+
//Do scrolling
|
3524 |
+
if(this.options.scroll) {
|
3525 |
+
var o = this.options, scrolled = false;
|
3526 |
+
if(this.scrollParent[0] != document && this.scrollParent[0].tagName != 'HTML') {
|
3527 |
+
|
3528 |
+
if((this.overflowOffset.top + this.scrollParent[0].offsetHeight) - event.pageY < o.scrollSensitivity)
|
3529 |
+
this.scrollParent[0].scrollTop = scrolled = this.scrollParent[0].scrollTop + o.scrollSpeed;
|
3530 |
+
else if(event.pageY - this.overflowOffset.top < o.scrollSensitivity)
|
3531 |
+
this.scrollParent[0].scrollTop = scrolled = this.scrollParent[0].scrollTop - o.scrollSpeed;
|
3532 |
+
|
3533 |
+
if((this.overflowOffset.left + this.scrollParent[0].offsetWidth) - event.pageX < o.scrollSensitivity)
|
3534 |
+
this.scrollParent[0].scrollLeft = scrolled = this.scrollParent[0].scrollLeft + o.scrollSpeed;
|
3535 |
+
else if(event.pageX - this.overflowOffset.left < o.scrollSensitivity)
|
3536 |
+
this.scrollParent[0].scrollLeft = scrolled = this.scrollParent[0].scrollLeft - o.scrollSpeed;
|
3537 |
+
|
3538 |
+
} else {
|
3539 |
+
|
3540 |
+
if(event.pageY - $(document).scrollTop() < o.scrollSensitivity)
|
3541 |
+
scrolled = $(document).scrollTop($(document).scrollTop() - o.scrollSpeed);
|
3542 |
+
else if($(window).height() - (event.pageY - $(document).scrollTop()) < o.scrollSensitivity)
|
3543 |
+
scrolled = $(document).scrollTop($(document).scrollTop() + o.scrollSpeed);
|
3544 |
+
|
3545 |
+
if(event.pageX - $(document).scrollLeft() < o.scrollSensitivity)
|
3546 |
+
scrolled = $(document).scrollLeft($(document).scrollLeft() - o.scrollSpeed);
|
3547 |
+
else if($(window).width() - (event.pageX - $(document).scrollLeft()) < o.scrollSensitivity)
|
3548 |
+
scrolled = $(document).scrollLeft($(document).scrollLeft() + o.scrollSpeed);
|
3549 |
+
|
3550 |
+
}
|
3551 |
+
|
3552 |
+
if(scrolled !== false && $.ui.ddmanager && !o.dropBehaviour)
|
3553 |
+
$.ui.ddmanager.prepareOffsets(this, event);
|
3554 |
+
}
|
3555 |
+
|
3556 |
+
//Regenerate the absolute position used for position checks
|
3557 |
+
this.positionAbs = this._convertPositionTo("absolute");
|
3558 |
+
|
3559 |
+
//Set the helper position
|
3560 |
+
if(!this.options.axis || this.options.axis != "y") this.helper[0].style.left = this.position.left+'px';
|
3561 |
+
if(!this.options.axis || this.options.axis != "x") this.helper[0].style.top = this.position.top+'px';
|
3562 |
+
|
3563 |
+
//Rearrange
|
3564 |
+
for (var i = this.items.length - 1; i >= 0; i--) {
|
3565 |
+
|
3566 |
+
//Cache variables and intersection, continue if no intersection
|
3567 |
+
var item = this.items[i], itemElement = item.item[0], intersection = this._intersectsWithPointer(item);
|
3568 |
+
if (!intersection) continue;
|
3569 |
+
|
3570 |
+
if(itemElement != this.currentItem[0] //cannot intersect with itself
|
3571 |
+
&& this.placeholder[intersection == 1 ? "next" : "prev"]()[0] != itemElement //no useless actions that have been done before
|
3572 |
+
&& !$.ui.contains(this.placeholder[0], itemElement) //no action if the item moved is the parent of the item checked
|
3573 |
+
&& (this.options.type == 'semi-dynamic' ? !$.ui.contains(this.element[0], itemElement) : true)
|
3574 |
+
//&& itemElement.parentNode == this.placeholder[0].parentNode // only rearrange items within the same container
|
3575 |
+
) {
|
3576 |
+
|
3577 |
+
this.direction = intersection == 1 ? "down" : "up";
|
3578 |
+
|
3579 |
+
if (this.options.tolerance == "pointer" || this._intersectsWithSides(item)) {
|
3580 |
+
this._rearrange(event, item);
|
3581 |
+
} else {
|
3582 |
+
break;
|
3583 |
+
}
|
3584 |
+
|
3585 |
+
this._trigger("change", event, this._uiHash());
|
3586 |
+
break;
|
3587 |
+
}
|
3588 |
+
}
|
3589 |
+
|
3590 |
+
//Post events to containers
|
3591 |
+
this._contactContainers(event);
|
3592 |
+
|
3593 |
+
//Interconnect with droppables
|
3594 |
+
if($.ui.ddmanager) $.ui.ddmanager.drag(this, event);
|
3595 |
+
|
3596 |
+
//Call callbacks
|
3597 |
+
this._trigger('sort', event, this._uiHash());
|
3598 |
+
|
3599 |
+
this.lastPositionAbs = this.positionAbs;
|
3600 |
+
return false;
|
3601 |
+
|
3602 |
+
},
|
3603 |
+
|
3604 |
+
_mouseStop: function(event, noPropagation) {
|
3605 |
+
|
3606 |
+
if(!event) return;
|
3607 |
+
|
3608 |
+
//If we are using droppables, inform the manager about the drop
|
3609 |
+
if ($.ui.ddmanager && !this.options.dropBehaviour)
|
3610 |
+
$.ui.ddmanager.drop(this, event);
|
3611 |
+
|
3612 |
+
if(this.options.revert) {
|
3613 |
+
var self = this;
|
3614 |
+
var cur = self.placeholder.offset();
|
3615 |
+
|
3616 |
+
self.reverting = true;
|
3617 |
+
|
3618 |
+
$(this.helper).animate({
|
3619 |
+
left: cur.left - this.offset.parent.left - self.margins.left + (this.offsetParent[0] == document.body ? 0 : this.offsetParent[0].scrollLeft),
|
3620 |
+
top: cur.top - this.offset.parent.top - self.margins.top + (this.offsetParent[0] == document.body ? 0 : this.offsetParent[0].scrollTop)
|
3621 |
+
}, parseInt(this.options.revert, 10) || 500, function() {
|
3622 |
+
self._clear(event);
|
3623 |
+
});
|
3624 |
+
} else {
|
3625 |
+
this._clear(event, noPropagation);
|
3626 |
+
}
|
3627 |
+
|
3628 |
+
return false;
|
3629 |
+
|
3630 |
+
},
|
3631 |
+
|
3632 |
+
cancel: function() {
|
3633 |
+
|
3634 |
+
var self = this;
|
3635 |
+
|
3636 |
+
if(this.dragging) {
|
3637 |
+
|
3638 |
+
this._mouseUp({ target: null });
|
3639 |
+
|
3640 |
+
if(this.options.helper == "original")
|
3641 |
+
this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper");
|
3642 |
+
else
|
3643 |
+
this.currentItem.show();
|
3644 |
+
|
3645 |
+
//Post deactivating events to containers
|
3646 |
+
for (var i = this.containers.length - 1; i >= 0; i--){
|
3647 |
+
this.containers[i]._trigger("deactivate", null, self._uiHash(this));
|
3648 |
+
if(this.containers[i].containerCache.over) {
|
3649 |
+
this.containers[i]._trigger("out", null, self._uiHash(this));
|
3650 |
+
this.containers[i].containerCache.over = 0;
|
3651 |
+
}
|
3652 |
+
}
|
3653 |
+
|
3654 |
+
}
|
3655 |
+
|
3656 |
+
if (this.placeholder) {
|
3657 |
+
//$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately, it unbinds ALL events from the original node!
|
3658 |
+
if(this.placeholder[0].parentNode) this.placeholder[0].parentNode.removeChild(this.placeholder[0]);
|
3659 |
+
if(this.options.helper != "original" && this.helper && this.helper[0].parentNode) this.helper.remove();
|
3660 |
+
|
3661 |
+
$.extend(this, {
|
3662 |
+
helper: null,
|
3663 |
+
dragging: false,
|
3664 |
+
reverting: false,
|
3665 |
+
_noFinalSort: null
|
3666 |
+
});
|
3667 |
+
|
3668 |
+
if(this.domPosition.prev) {
|
3669 |
+
$(this.domPosition.prev).after(this.currentItem);
|
3670 |
+
} else {
|
3671 |
+
$(this.domPosition.parent).prepend(this.currentItem);
|
3672 |
+
}
|
3673 |
+
}
|
3674 |
+
|
3675 |
+
return this;
|
3676 |
+
|
3677 |
+
},
|
3678 |
+
|
3679 |
+
serialize: function(o) {
|
3680 |
+
|
3681 |
+
var items = this._getItemsAsjQuery(o && o.connected);
|
3682 |
+
var str = []; o = o || {};
|
3683 |
+
|
3684 |
+
$(items).each(function() {
|
3685 |
+
var res = ($(o.item || this).attr(o.attribute || 'id') || '').match(o.expression || (/(.+)[-=_](.+)/));
|
3686 |
+
if(res) str.push((o.key || res[1]+'[]')+'='+(o.key && o.expression ? res[1] : res[2]));
|
3687 |
+
});
|
3688 |
+
|
3689 |
+
if(!str.length && o.key) {
|
3690 |
+
str.push(o.key + '=');
|
3691 |
+
}
|
3692 |
+
|
3693 |
+
return str.join('&');
|
3694 |
+
|
3695 |
+
},
|
3696 |
+
|
3697 |
+
toArray: function(o) {
|
3698 |
+
|
3699 |
+
var items = this._getItemsAsjQuery(o && o.connected);
|
3700 |
+
var ret = []; o = o || {};
|
3701 |
+
|
3702 |
+
items.each(function() { ret.push($(o.item || this).attr(o.attribute || 'id') || ''); });
|
3703 |
+
return ret;
|
3704 |
+
|
3705 |
+
},
|
3706 |
+
|
3707 |
+
/* Be careful with the following core functions */
|
3708 |
+
_intersectsWith: function(item) {
|
3709 |
+
|
3710 |
+
var x1 = this.positionAbs.left,
|
3711 |
+
x2 = x1 + this.helperProportions.width,
|
3712 |
+
y1 = this.positionAbs.top,
|
3713 |
+
y2 = y1 + this.helperProportions.height;
|
3714 |
+
|
3715 |
+
var l = item.left,
|
3716 |
+
r = l + item.width,
|
3717 |
+
t = item.top,
|
3718 |
+
b = t + item.height;
|
3719 |
+
|
3720 |
+
var dyClick = this.offset.click.top,
|
3721 |
+
dxClick = this.offset.click.left;
|
3722 |
+
|
3723 |
+
var isOverElement = (y1 + dyClick) > t && (y1 + dyClick) < b && (x1 + dxClick) > l && (x1 + dxClick) < r;
|
3724 |
+
|
3725 |
+
if( this.options.tolerance == "pointer"
|
3726 |
+
|| this.options.forcePointerForContainers
|
3727 |
+
|| (this.options.tolerance != "pointer" && this.helperProportions[this.floating ? 'width' : 'height'] > item[this.floating ? 'width' : 'height'])
|
3728 |
+
) {
|
3729 |
+
return isOverElement;
|
3730 |
+
} else {
|
3731 |
+
|
3732 |
+
return (l < x1 + (this.helperProportions.width / 2) // Right Half
|
3733 |
+
&& x2 - (this.helperProportions.width / 2) < r // Left Half
|
3734 |
+
&& t < y1 + (this.helperProportions.height / 2) // Bottom Half
|
3735 |
+
&& y2 - (this.helperProportions.height / 2) < b ); // Top Half
|
3736 |
+
|
3737 |
+
}
|
3738 |
+
},
|
3739 |
+
|
3740 |
+
_intersectsWithPointer: function(item) {
|
3741 |
+
|
3742 |
+
var isOverElementHeight = $.ui.isOverAxis(this.positionAbs.top + this.offset.click.top, item.top, item.height),
|
3743 |
+
isOverElementWidth = $.ui.isOverAxis(this.positionAbs.left + this.offset.click.left, item.left, item.width),
|
3744 |
+
isOverElement = isOverElementHeight && isOverElementWidth,
|
3745 |
+
verticalDirection = this._getDragVerticalDirection(),
|
3746 |
+
horizontalDirection = this._getDragHorizontalDirection();
|
3747 |
+
|
3748 |
+
if (!isOverElement)
|
3749 |
+
return false;
|
3750 |
+
|
3751 |
+
return this.floating ?
|
3752 |
+
( ((horizontalDirection && horizontalDirection == "right") || verticalDirection == "down") ? 2 : 1 )
|
3753 |
+
: ( verticalDirection && (verticalDirection == "down" ? 2 : 1) );
|
3754 |
+
|
3755 |
+
},
|
3756 |
+
|
3757 |
+
_intersectsWithSides: function(item) {
|
3758 |
+
|
3759 |
+
var isOverBottomHalf = $.ui.isOverAxis(this.positionAbs.top + this.offset.click.top, item.top + (item.height/2), item.height),
|
3760 |
+
isOverRightHalf = $.ui.isOverAxis(this.positionAbs.left + this.offset.click.left, item.left + (item.width/2), item.width),
|
3761 |
+
verticalDirection = this._getDragVerticalDirection(),
|
3762 |
+
horizontalDirection = this._getDragHorizontalDirection();
|
3763 |
+
|
3764 |
+
if (this.floating && horizontalDirection) {
|
3765 |
+
return ((horizontalDirection == "right" && isOverRightHalf) || (horizontalDirection == "left" && !isOverRightHalf));
|
3766 |
+
} else {
|
3767 |
+
return verticalDirection && ((verticalDirection == "down" && isOverBottomHalf) || (verticalDirection == "up" && !isOverBottomHalf));
|
3768 |
+
}
|
3769 |
+
|
3770 |
+
},
|
3771 |
+
|
3772 |
+
_getDragVerticalDirection: function() {
|
3773 |
+
var delta = this.positionAbs.top - this.lastPositionAbs.top;
|
3774 |
+
return delta != 0 && (delta > 0 ? "down" : "up");
|
3775 |
+
},
|
3776 |
+
|
3777 |
+
_getDragHorizontalDirection: function() {
|
3778 |
+
var delta = this.positionAbs.left - this.lastPositionAbs.left;
|
3779 |
+
return delta != 0 && (delta > 0 ? "right" : "left");
|
3780 |
+
},
|
3781 |
+
|
3782 |
+
refresh: function(event) {
|
3783 |
+
this._refreshItems(event);
|
3784 |
+
this.refreshPositions();
|
3785 |
+
return this;
|
3786 |
+
},
|
3787 |
+
|
3788 |
+
_connectWith: function() {
|
3789 |
+
var options = this.options;
|
3790 |
+
return options.connectWith.constructor == String
|
3791 |
+
? [options.connectWith]
|
3792 |
+
: options.connectWith;
|
3793 |
+
},
|
3794 |
+
|
3795 |
+
_getItemsAsjQuery: function(connected) {
|
3796 |
+
|
3797 |
+
var self = this;
|
3798 |
+
var items = [];
|
3799 |
+
var queries = [];
|
3800 |
+
var connectWith = this._connectWith();
|
3801 |
+
|
3802 |
+
if(connectWith && connected) {
|
3803 |
+
for (var i = connectWith.length - 1; i >= 0; i--){
|
3804 |
+
var cur = $(connectWith[i]);
|
3805 |
+
for (var j = cur.length - 1; j >= 0; j--){
|
3806 |
+
var inst = $.data(cur[j], this.widgetName);
|
3807 |
+
if(inst && inst != this && !inst.options.disabled) {
|
3808 |
+
queries.push([$.isFunction(inst.options.items) ? inst.options.items.call(inst.element) : $(inst.options.items, inst.element).not(".ui-sortable-helper").not('.ui-sortable-placeholder'), inst]);
|
3809 |
+
}
|
3810 |
+
};
|
3811 |
+
};
|
3812 |
+
}
|
3813 |
+
|
3814 |
+
queries.push([$.isFunction(this.options.items) ? this.options.items.call(this.element, null, { options: this.options, item: this.currentItem }) : $(this.options.items, this.element).not(".ui-sortable-helper").not('.ui-sortable-placeholder'), this]);
|
3815 |
+
|
3816 |
+
for (var i = queries.length - 1; i >= 0; i--){
|
3817 |
+
queries[i][0].each(function() {
|
3818 |
+
items.push(this);
|
3819 |
+
});
|
3820 |
+
};
|
3821 |
+
|
3822 |
+
return $(items);
|
3823 |
+
|
3824 |
+
},
|
3825 |
+
|
3826 |
+
_removeCurrentsFromItems: function() {
|
3827 |
+
|
3828 |
+
var list = this.currentItem.find(":data(" + this.widgetName + "-item)");
|
3829 |
+
|
3830 |
+
for (var i=0; i < this.items.length; i++) {
|
3831 |
+
|
3832 |
+
for (var j=0; j < list.length; j++) {
|
3833 |
+
if(list[j] == this.items[i].item[0])
|
3834 |
+
this.items.splice(i,1);
|
3835 |
+
};
|
3836 |
+
|
3837 |
+
};
|
3838 |
+
|
3839 |
+
},
|
3840 |
+
|
3841 |
+
_refreshItems: function(event) {
|
3842 |
+
|
3843 |
+
this.items = [];
|
3844 |
+
this.containers = [this];
|
3845 |
+
var items = this.items;
|
3846 |
+
var self = this;
|
3847 |
+
var queries = [[$.isFunction(this.options.items) ? this.options.items.call(this.element[0], event, { item: this.currentItem }) : $(this.options.items, this.element), this]];
|
3848 |
+
var connectWith = this._connectWith();
|
3849 |
+
|
3850 |
+
if(connectWith) {
|
3851 |
+
for (var i = connectWith.length - 1; i >= 0; i--){
|
3852 |
+
var cur = $(connectWith[i]);
|
3853 |
+
for (var j = cur.length - 1; j >= 0; j--){
|
3854 |
+
var inst = $.data(cur[j], this.widgetName);
|
3855 |
+
if(inst && inst != this && !inst.options.disabled) {
|
3856 |
+
queries.push([$.isFunction(inst.options.items) ? inst.options.items.call(inst.element[0], event, { item: this.currentItem }) : $(inst.options.items, inst.element), inst]);
|
3857 |
+
this.containers.push(inst);
|
3858 |
+
}
|
3859 |
+
};
|
3860 |
+
};
|
3861 |
+
}
|
3862 |
+
|
3863 |
+
for (var i = queries.length - 1; i >= 0; i--) {
|
3864 |
+
var targetData = queries[i][1];
|
3865 |
+
var _queries = queries[i][0];
|
3866 |
+
|
3867 |
+
for (var j=0, queriesLength = _queries.length; j < queriesLength; j++) {
|
3868 |
+
var item = $(_queries[j]);
|
3869 |
+
|
3870 |
+
item.data(this.widgetName + '-item', targetData); // Data for target checking (mouse manager)
|
3871 |
+
|
3872 |
+
items.push({
|
3873 |
+
item: item,
|
3874 |
+
instance: targetData,
|
3875 |
+
width: 0, height: 0,
|
3876 |
+
left: 0, top: 0
|
3877 |
+
});
|
3878 |
+
};
|
3879 |
+
};
|
3880 |
+
|
3881 |
+
},
|
3882 |
+
|
3883 |
+
refreshPositions: function(fast) {
|
3884 |
+
|
3885 |
+
//This has to be redone because due to the item being moved out/into the offsetParent, the offsetParent's position will change
|
3886 |
+
if(this.offsetParent && this.helper) {
|
3887 |
+
this.offset.parent = this._getParentOffset();
|
3888 |
+
}
|
3889 |
+
|
3890 |
+
for (var i = this.items.length - 1; i >= 0; i--){
|
3891 |
+
var item = this.items[i];
|
3892 |
+
|
3893 |
+
//We ignore calculating positions of all connected containers when we're not over them
|
3894 |
+
if(item.instance != this.currentContainer && this.currentContainer && item.item[0] != this.currentItem[0])
|
3895 |
+
continue;
|
3896 |
+
|
3897 |
+
var t = this.options.toleranceElement ? $(this.options.toleranceElement, item.item) : item.item;
|
3898 |
+
|
3899 |
+
if (!fast) {
|
3900 |
+
item.width = t.outerWidth();
|
3901 |
+
item.height = t.outerHeight();
|
3902 |
+
}
|
3903 |
+
|
3904 |
+
var p = t.offset();
|
3905 |
+
item.left = p.left;
|
3906 |
+
item.top = p.top;
|
3907 |
+
};
|
3908 |
+
|
3909 |
+
if(this.options.custom && this.options.custom.refreshContainers) {
|
3910 |
+
this.options.custom.refreshContainers.call(this);
|
3911 |
+
} else {
|
3912 |
+
for (var i = this.containers.length - 1; i >= 0; i--){
|
3913 |
+
var p = this.containers[i].element.offset();
|
3914 |
+
this.containers[i].containerCache.left = p.left;
|
3915 |
+
this.containers[i].containerCache.top = p.top;
|
3916 |
+
this.containers[i].containerCache.width = this.containers[i].element.outerWidth();
|
3917 |
+
this.containers[i].containerCache.height = this.containers[i].element.outerHeight();
|
3918 |
+
};
|
3919 |
+
}
|
3920 |
+
|
3921 |
+
return this;
|
3922 |
+
},
|
3923 |
+
|
3924 |
+
_createPlaceholder: function(that) {
|
3925 |
+
|
3926 |
+
var self = that || this, o = self.options;
|
3927 |
+
|
3928 |
+
if(!o.placeholder || o.placeholder.constructor == String) {
|
3929 |
+
var className = o.placeholder;
|
3930 |
+
o.placeholder = {
|
3931 |
+
element: function() {
|
3932 |
+
|
3933 |
+
var el = $(document.createElement(self.currentItem[0].nodeName))
|
3934 |
+
.addClass(className || self.currentItem[0].className+" ui-sortable-placeholder")
|
3935 |
+
.removeClass("ui-sortable-helper")[0];
|
3936 |
+
|
3937 |
+
if(!className)
|
3938 |
+
el.style.visibility = "hidden";
|
3939 |
+
|
3940 |
+
return el;
|
3941 |
+
},
|
3942 |
+
update: function(container, p) {
|
3943 |
+
|
3944 |
+
// 1. If a className is set as 'placeholder option, we don't force sizes - the class is responsible for that
|
3945 |
+
// 2. The option 'forcePlaceholderSize can be enabled to force it even if a class name is specified
|
3946 |
+
if(className && !o.forcePlaceholderSize) return;
|
3947 |
+
|
3948 |
+
//If the element doesn't have a actual height by itself (without styles coming from a stylesheet), it receives the inline height from the dragged item
|
3949 |
+
if(!p.height()) { p.height(self.currentItem.innerHeight() - parseInt(self.currentItem.css('paddingTop')||0, 10) - parseInt(self.currentItem.css('paddingBottom')||0, 10)); };
|
3950 |
+
if(!p.width()) { p.width(self.currentItem.innerWidth() - parseInt(self.currentItem.css('paddingLeft')||0, 10) - parseInt(self.currentItem.css('paddingRight')||0, 10)); };
|
3951 |
+
}
|
3952 |
+
};
|
3953 |
+
}
|
3954 |
+
|
3955 |
+
//Create the placeholder
|
3956 |
+
self.placeholder = $(o.placeholder.element.call(self.element, self.currentItem));
|
3957 |
+
|
3958 |
+
//Append it after the actual current item
|
3959 |
+
self.currentItem.after(self.placeholder);
|
3960 |
+
|
3961 |
+
//Update the size of the placeholder (TODO: Logic to fuzzy, see line 316/317)
|
3962 |
+
o.placeholder.update(self, self.placeholder);
|
3963 |
+
|
3964 |
+
},
|
3965 |
+
|
3966 |
+
_contactContainers: function(event) {
|
3967 |
+
|
3968 |
+
// get innermost container that intersects with item
|
3969 |
+
var innermostContainer = null, innermostIndex = null;
|
3970 |
+
|
3971 |
+
|
3972 |
+
for (var i = this.containers.length - 1; i >= 0; i--){
|
3973 |
+
|
3974 |
+
// never consider a container that's located within the item itself
|
3975 |
+
if($.ui.contains(this.currentItem[0], this.containers[i].element[0]))
|
3976 |
+
continue;
|
3977 |
+
|
3978 |
+
if(this._intersectsWith(this.containers[i].containerCache)) {
|
3979 |
+
|
3980 |
+
// if we've already found a container and it's more "inner" than this, then continue
|
3981 |
+
if(innermostContainer && $.ui.contains(this.containers[i].element[0], innermostContainer.element[0]))
|
3982 |
+
continue;
|
3983 |
+
|
3984 |
+
innermostContainer = this.containers[i];
|
3985 |
+
innermostIndex = i;
|
3986 |
+
|
3987 |
+
} else {
|
3988 |
+
// container doesn't intersect. trigger "out" event if necessary
|
3989 |
+
if(this.containers[i].containerCache.over) {
|
3990 |
+
this.containers[i]._trigger("out", event, this._uiHash(this));
|
3991 |
+
this.containers[i].containerCache.over = 0;
|
3992 |
+
}
|
3993 |
+
}
|
3994 |
+
|
3995 |
+
}
|
3996 |
+
|
3997 |
+
// if no intersecting containers found, return
|
3998 |
+
if(!innermostContainer) return;
|
3999 |
+
|
4000 |
+
// move the item into the container if it's not there already
|
4001 |
+
if(this.containers.length === 1) {
|
4002 |
+
this.containers[innermostIndex]._trigger("over", event, this._uiHash(this));
|
4003 |
+
this.containers[innermostIndex].containerCache.over = 1;
|
4004 |
+
} else if(this.currentContainer != this.containers[innermostIndex]) {
|
4005 |
+
|
4006 |
+
//When entering a new container, we will find the item with the least distance and append our item near it
|
4007 |
+
var dist = 10000; var itemWithLeastDistance = null; var base = this.positionAbs[this.containers[innermostIndex].floating ? 'left' : 'top'];
|
4008 |
+
for (var j = this.items.length - 1; j >= 0; j--) {
|
4009 |
+
if(!$.ui.contains(this.containers[innermostIndex].element[0], this.items[j].item[0])) continue;
|
4010 |
+
var cur = this.items[j][this.containers[innermostIndex].floating ? 'left' : 'top'];
|
4011 |
+
if(Math.abs(cur - base) < dist) {
|
4012 |
+
dist = Math.abs(cur - base); itemWithLeastDistance = this.items[j];
|
4013 |
+
}
|
4014 |
+
}
|
4015 |
+
|
4016 |
+
if(!itemWithLeastDistance && !this.options.dropOnEmpty) //Check if dropOnEmpty is enabled
|
4017 |
+
return;
|
4018 |
+
|
4019 |
+
this.currentContainer = this.containers[innermostIndex];
|
4020 |
+
itemWithLeastDistance ? this._rearrange(event, itemWithLeastDistance, null, true) : this._rearrange(event, null, this.containers[innermostIndex].element, true);
|
4021 |
+
this._trigger("change", event, this._uiHash());
|
4022 |
+
this.containers[innermostIndex]._trigger("change", event, this._uiHash(this));
|
4023 |
+
|
4024 |
+
//Update the placeholder
|
4025 |
+
this.options.placeholder.update(this.currentContainer, this.placeholder);
|
4026 |
+
|
4027 |
+
this.containers[innermostIndex]._trigger("over", event, this._uiHash(this));
|
4028 |
+
this.containers[innermostIndex].containerCache.over = 1;
|
4029 |
+
}
|
4030 |
+
|
4031 |
+
|
4032 |
+
},
|
4033 |
+
|
4034 |
+
_createHelper: function(event) {
|
4035 |
+
|
4036 |
+
var o = this.options;
|
4037 |
+
var helper = $.isFunction(o.helper) ? $(o.helper.apply(this.element[0], [event, this.currentItem])) : (o.helper == 'clone' ? this.currentItem.clone() : this.currentItem);
|
4038 |
+
|
4039 |
+
if(!helper.parents('body').length) //Add the helper to the DOM if that didn't happen already
|
4040 |
+
$(o.appendTo != 'parent' ? o.appendTo : this.currentItem[0].parentNode)[0].appendChild(helper[0]);
|
4041 |
+
|
4042 |
+
if(helper[0] == this.currentItem[0])
|
4043 |
+
this._storedCSS = { width: this.currentItem[0].style.width, height: this.currentItem[0].style.height, position: this.currentItem.css("position"), top: this.currentItem.css("top"), left: this.currentItem.css("left") };
|
4044 |
+
|
4045 |
+
if(helper[0].style.width == '' || o.forceHelperSize) helper.width(this.currentItem.width());
|
4046 |
+
if(helper[0].style.height == '' || o.forceHelperSize) helper.height(this.currentItem.height());
|
4047 |
+
|
4048 |
+
return helper;
|
4049 |
+
|
4050 |
+
},
|
4051 |
+
|
4052 |
+
_adjustOffsetFromHelper: function(obj) {
|
4053 |
+
if (typeof obj == 'string') {
|
4054 |
+
obj = obj.split(' ');
|
4055 |
+
}
|
4056 |
+
if ($.isArray(obj)) {
|
4057 |
+
obj = {left: +obj[0], top: +obj[1] || 0};
|
4058 |
+
}
|
4059 |
+
if ('left' in obj) {
|
4060 |
+
this.offset.click.left = obj.left + this.margins.left;
|
4061 |
+
}
|
4062 |
+
if ('right' in obj) {
|
4063 |
+
this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left;
|
4064 |
+
}
|
4065 |
+
if ('top' in obj) {
|
4066 |
+
this.offset.click.top = obj.top + this.margins.top;
|
4067 |
+
}
|
4068 |
+
if ('bottom' in obj) {
|
4069 |
+
this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top;
|
4070 |
+
}
|
4071 |
+
},
|
4072 |
+
|
4073 |
+
_getParentOffset: function() {
|
4074 |
+
|
4075 |
+
|
4076 |
+
//Get the offsetParent and cache its position
|
4077 |
+
this.offsetParent = this.helper.offsetParent();
|
4078 |
+
var po = this.offsetParent.offset();
|
4079 |
+
|
4080 |
+
// This is a special case where we need to modify a offset calculated on start, since the following happened:
|
4081 |
+
// 1. The position of the helper is absolute, so it's position is calculated based on the next positioned parent
|
4082 |
+
// 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't the document, which means that
|
4083 |
+
// the scroll is included in the initial calculation of the offset of the parent, and never recalculated upon drag
|
4084 |
+
if(this.cssPosition == 'absolute' && this.scrollParent[0] != document && $.ui.contains(this.scrollParent[0], this.offsetParent[0])) {
|
4085 |
+
po.left += this.scrollParent.scrollLeft();
|
4086 |
+
po.top += this.scrollParent.scrollTop();
|
4087 |
+
}
|
4088 |
+
|
4089 |
+
if((this.offsetParent[0] == document.body) //This needs to be actually done for all browsers, since pageX/pageY includes this information
|
4090 |
+
|| (this.offsetParent[0].tagName && this.offsetParent[0].tagName.toLowerCase() == 'html' && $.browser.msie)) //Ugly IE fix
|
4091 |
+
po = { top: 0, left: 0 };
|
4092 |
+
|
4093 |
+
return {
|
4094 |
+
top: po.top + (parseInt(this.offsetParent.css("borderTopWidth"),10) || 0),
|
4095 |
+
left: po.left + (parseInt(this.offsetParent.css("borderLeftWidth"),10) || 0)
|
4096 |
+
};
|
4097 |
+
|
4098 |
+
},
|
4099 |
+
|
4100 |
+
_getRelativeOffset: function() {
|
4101 |
+
|
4102 |
+
if(this.cssPosition == "relative") {
|
4103 |
+
var p = this.currentItem.position();
|
4104 |
+
return {
|
4105 |
+
top: p.top - (parseInt(this.helper.css("top"),10) || 0) + this.scrollParent.scrollTop(),
|
4106 |
+
left: p.left - (parseInt(this.helper.css("left"),10) || 0) + this.scrollParent.scrollLeft()
|
4107 |
+
};
|
4108 |
+
} else {
|
4109 |
+
return { top: 0, left: 0 };
|
4110 |
+
}
|
4111 |
+
|
4112 |
+
},
|
4113 |
+
|
4114 |
+
_cacheMargins: function() {
|
4115 |
+
this.margins = {
|
4116 |
+
left: (parseInt(this.currentItem.css("marginLeft"),10) || 0),
|
4117 |
+
top: (parseInt(this.currentItem.css("marginTop"),10) || 0)
|
4118 |
+
};
|
4119 |
+
},
|
4120 |
+
|
4121 |
+
_cacheHelperProportions: function() {
|
4122 |
+
this.helperProportions = {
|
4123 |
+
width: this.helper.outerWidth(),
|
4124 |
+
height: this.helper.outerHeight()
|
4125 |
+
};
|
4126 |
+
},
|
4127 |
+
|
4128 |
+
_setContainment: function() {
|
4129 |
+
|
4130 |
+
var o = this.options;
|
4131 |
+
if(o.containment == 'parent') o.containment = this.helper[0].parentNode;
|
4132 |
+
if(o.containment == 'document' || o.containment == 'window') this.containment = [
|
4133 |
+
0 - this.offset.relative.left - this.offset.parent.left,
|
4134 |
+
0 - this.offset.relative.top - this.offset.parent.top,
|
4135 |
+
$(o.containment == 'document' ? document : window).width() - this.helperProportions.width - this.margins.left,
|
4136 |
+
($(o.containment == 'document' ? document : window).height() || document.body.parentNode.scrollHeight) - this.helperProportions.height - this.margins.top
|
4137 |
+
];
|
4138 |
+
|
4139 |
+
if(!(/^(document|window|parent)$/).test(o.containment)) {
|
4140 |
+
var ce = $(o.containment)[0];
|
4141 |
+
var co = $(o.containment).offset();
|
4142 |
+
var over = ($(ce).css("overflow") != 'hidden');
|
4143 |
+
|
4144 |
+
this.containment = [
|
4145 |
+
co.left + (parseInt($(ce).css("borderLeftWidth"),10) || 0) + (parseInt($(ce).css("paddingLeft"),10) || 0) - this.margins.left,
|
4146 |
+
co.top + (parseInt($(ce).css("borderTopWidth"),10) || 0) + (parseInt($(ce).css("paddingTop"),10) || 0) - this.margins.top,
|
4147 |
+
co.left+(over ? Math.max(ce.scrollWidth,ce.offsetWidth) : ce.offsetWidth) - (parseInt($(ce).css("borderLeftWidth"),10) || 0) - (parseInt($(ce).css("paddingRight"),10) || 0) - this.helperProportions.width - this.margins.left,
|
4148 |
+
co.top+(over ? Math.max(ce.scrollHeight,ce.offsetHeight) : ce.offsetHeight) - (parseInt($(ce).css("borderTopWidth"),10) || 0) - (parseInt($(ce).css("paddingBottom"),10) || 0) - this.helperProportions.height - this.margins.top
|
4149 |
+
];
|
4150 |
+
}
|
4151 |
+
|
4152 |
+
},
|
4153 |
+
|
4154 |
+
_convertPositionTo: function(d, pos) {
|
4155 |
+
|
4156 |
+
if(!pos) pos = this.position;
|
4157 |
+
var mod = d == "absolute" ? 1 : -1;
|
4158 |
+
var o = this.options, scroll = this.cssPosition == 'absolute' && !(this.scrollParent[0] != document && $.ui.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent, scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName);
|
4159 |
+
|
4160 |
+
return {
|
4161 |
+
top: (
|
4162 |
+
pos.top // The absolute mouse position
|
4163 |
+
+ this.offset.relative.top * mod // Only for relative positioned nodes: Relative offset from element to offset parent
|
4164 |
+
+ this.offset.parent.top * mod // The offsetParent's offset without borders (offset + border)
|
4165 |
+
- ($.browser.safari && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ) * mod)
|
4166 |
+
),
|
4167 |
+
left: (
|
4168 |
+
pos.left // The absolute mouse position
|
4169 |
+
+ this.offset.relative.left * mod // Only for relative positioned nodes: Relative offset from element to offset parent
|
4170 |
+
+ this.offset.parent.left * mod // The offsetParent's offset without borders (offset + border)
|
4171 |
+
- ($.browser.safari && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ) * mod)
|
4172 |
+
)
|
4173 |
+
};
|
4174 |
+
|
4175 |
+
},
|
4176 |
+
|
4177 |
+
_generatePosition: function(event) {
|
4178 |
+
|
4179 |
+
var o = this.options, scroll = this.cssPosition == 'absolute' && !(this.scrollParent[0] != document && $.ui.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent, scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName);
|
4180 |
+
|
4181 |
+
// This is another very weird special case that only happens for relative elements:
|
4182 |
+
// 1. If the css position is relative
|
4183 |
+
// 2. and the scroll parent is the document or similar to the offset parent
|
4184 |
+
// we have to refresh the relative offset during the scroll so there are no jumps
|
4185 |
+
if(this.cssPosition == 'relative' && !(this.scrollParent[0] != document && this.scrollParent[0] != this.offsetParent[0])) {
|
4186 |
+
this.offset.relative = this._getRelativeOffset();
|
4187 |
+
}
|
4188 |
+
|
4189 |
+
var pageX = event.pageX;
|
4190 |
+
var pageY = event.pageY;
|
4191 |
+
|
4192 |
+
/*
|
4193 |
+
* - Position constraining -
|
4194 |
+
* Constrain the position to a mix of grid, containment.
|
4195 |
+
*/
|
4196 |
+
|
4197 |
+
if(this.originalPosition) { //If we are not dragging yet, we won't check for options
|
4198 |
+
|
4199 |
+
if(this.containment) {
|
4200 |
+
if(event.pageX - this.offset.click.left < this.containment[0]) pageX = this.containment[0] + this.offset.click.left;
|
4201 |
+
if(event.pageY - this.offset.click.top < this.containment[1]) pageY = this.containment[1] + this.offset.click.top;
|
4202 |
+
if(event.pageX - this.offset.click.left > this.containment[2]) pageX = this.containment[2] + this.offset.click.left;
|
4203 |
+
if(event.pageY - this.offset.click.top > this.containment[3]) pageY = this.containment[3] + this.offset.click.top;
|
4204 |
+
}
|
4205 |
+
|
4206 |
+
if(o.grid) {
|
4207 |
+
var top = this.originalPageY + Math.round((pageY - this.originalPageY) / o.grid[1]) * o.grid[1];
|
4208 |
+
pageY = this.containment ? (!(top - this.offset.click.top < this.containment[1] || top - this.offset.click.top > this.containment[3]) ? top : (!(top - this.offset.click.top < this.containment[1]) ? top - o.grid[1] : top + o.grid[1])) : top;
|
4209 |
+
|
4210 |
+
var left = this.originalPageX + Math.round((pageX - this.originalPageX) / o.grid[0]) * o.grid[0];
|
4211 |
+
pageX = this.containment ? (!(left - this.offset.click.left < this.containment[0] || left - this.offset.click.left > this.containment[2]) ? left : (!(left - this.offset.click.left < this.containment[0]) ? left - o.grid[0] : left + o.grid[0])) : left;
|
4212 |
+
}
|
4213 |
+
|
4214 |
+
}
|
4215 |
+
|
4216 |
+
return {
|
4217 |
+
top: (
|
4218 |
+
pageY // The absolute mouse position
|
4219 |
+
- this.offset.click.top // Click offset (relative to the element)
|
4220 |
+
- this.offset.relative.top // Only for relative positioned nodes: Relative offset from element to offset parent
|
4221 |
+
- this.offset.parent.top // The offsetParent's offset without borders (offset + border)
|
4222 |
+
+ ($.browser.safari && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ))
|
4223 |
+
),
|
4224 |
+
left: (
|
4225 |
+
pageX // The absolute mouse position
|
4226 |
+
- this.offset.click.left // Click offset (relative to the element)
|
4227 |
+
- this.offset.relative.left // Only for relative positioned nodes: Relative offset from element to offset parent
|
4228 |
+
- this.offset.parent.left // The offsetParent's offset without borders (offset + border)
|
4229 |
+
+ ($.browser.safari && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ))
|
4230 |
+
)
|
4231 |
+
};
|
4232 |
+
|
4233 |
+
},
|
4234 |
+
|
4235 |
+
_rearrange: function(event, i, a, hardRefresh) {
|
4236 |
+
|
4237 |
+
a ? a[0].appendChild(this.placeholder[0]) : i.item[0].parentNode.insertBefore(this.placeholder[0], (this.direction == 'down' ? i.item[0] : i.item[0].nextSibling));
|
4238 |
+
|
4239 |
+
//Various things done here to improve the performance:
|
4240 |
+
// 1. we create a setTimeout, that calls refreshPositions
|
4241 |
+
// 2. on the instance, we have a counter variable, that get's higher after every append
|
4242 |
+
// 3. on the local scope, we copy the counter variable, and check in the timeout, if it's still the same
|
4243 |
+
// 4. this lets only the last addition to the timeout stack through
|
4244 |
+
this.counter = this.counter ? ++this.counter : 1;
|
4245 |
+
var self = this, counter = this.counter;
|
4246 |
+
|
4247 |
+
window.setTimeout(function() {
|
4248 |
+
if(counter == self.counter) self.refreshPositions(!hardRefresh); //Precompute after each DOM insertion, NOT on mousemove
|
4249 |
+
},0);
|
4250 |
+
|
4251 |
+
},
|
4252 |
+
|
4253 |
+
_clear: function(event, noPropagation) {
|
4254 |
+
|
4255 |
+
this.reverting = false;
|
4256 |
+
// We delay all events that have to be triggered to after the point where the placeholder has been removed and
|
4257 |
+
// everything else normalized again
|
4258 |
+
var delayedTriggers = [], self = this;
|
4259 |
+
|
4260 |
+
// We first have to update the dom position of the actual currentItem
|
4261 |
+
// Note: don't do it if the current item is already removed (by a user), or it gets reappended (see #4088)
|
4262 |
+
if(!this._noFinalSort && this.currentItem.parent().length) this.placeholder.before(this.currentItem);
|
4263 |
+
this._noFinalSort = null;
|
4264 |
+
|
4265 |
+
if(this.helper[0] == this.currentItem[0]) {
|
4266 |
+
for(var i in this._storedCSS) {
|
4267 |
+
if(this._storedCSS[i] == 'auto' || this._storedCSS[i] == 'static') this._storedCSS[i] = '';
|
4268 |
+
}
|
4269 |
+
this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper");
|
4270 |
+
} else {
|
4271 |
+
this.currentItem.show();
|
4272 |
+
}
|
4273 |
+
|
4274 |
+
if(this.fromOutside && !noPropagation) delayedTriggers.push(function(event) { this._trigger("receive", event, this._uiHash(this.fromOutside)); });
|
4275 |
+
if((this.fromOutside || this.domPosition.prev != this.currentItem.prev().not(".ui-sortable-helper")[0] || this.domPosition.parent != this.currentItem.parent()[0]) && !noPropagation) delayedTriggers.push(function(event) { this._trigger("update", event, this._uiHash()); }); //Trigger update callback if the DOM position has changed
|
4276 |
+
if(!$.ui.contains(this.element[0], this.currentItem[0])) { //Node was moved out of the current element
|
4277 |
+
if(!noPropagation) delayedTriggers.push(function(event) { this._trigger("remove", event, this._uiHash()); });
|
4278 |
+
for (var i = this.containers.length - 1; i >= 0; i--){
|
4279 |
+
if($.ui.contains(this.containers[i].element[0], this.currentItem[0]) && !noPropagation) {
|
4280 |
+
delayedTriggers.push((function(c) { return function(event) { c._trigger("receive", event, this._uiHash(this)); }; }).call(this, this.containers[i]));
|
4281 |
+
delayedTriggers.push((function(c) { return function(event) { c._trigger("update", event, this._uiHash(this)); }; }).call(this, this.containers[i]));
|
4282 |
+
}
|
4283 |
+
};
|
4284 |
+
};
|
4285 |
+
|
4286 |
+
//Post events to containers
|
4287 |
+
for (var i = this.containers.length - 1; i >= 0; i--){
|
4288 |
+
if(!noPropagation) delayedTriggers.push((function(c) { return function(event) { c._trigger("deactivate", event, this._uiHash(this)); }; }).call(this, this.containers[i]));
|
4289 |
+
if(this.containers[i].containerCache.over) {
|
4290 |
+
delayedTriggers.push((function(c) { return function(event) { c._trigger("out", event, this._uiHash(this)); }; }).call(this, this.containers[i]));
|
4291 |
+
this.containers[i].containerCache.over = 0;
|
4292 |
+
}
|
4293 |
+
}
|
4294 |
+
|
4295 |
+
//Do what was originally in plugins
|
4296 |
+
if(this._storedCursor) $('body').css("cursor", this._storedCursor); //Reset cursor
|
4297 |
+
if(this._storedOpacity) this.helper.css("opacity", this._storedOpacity); //Reset opacity
|
4298 |
+
if(this._storedZIndex) this.helper.css("zIndex", this._storedZIndex == 'auto' ? '' : this._storedZIndex); //Reset z-index
|
4299 |
+
|
4300 |
+
this.dragging = false;
|
4301 |
+
if(this.cancelHelperRemoval) {
|
4302 |
+
if(!noPropagation) {
|
4303 |
+
this._trigger("beforeStop", event, this._uiHash());
|
4304 |
+
for (var i=0; i < delayedTriggers.length; i++) { delayedTriggers[i].call(this, event); }; //Trigger all delayed events
|
4305 |
+
this._trigger("stop", event, this._uiHash());
|
4306 |
+
}
|
4307 |
+
return false;
|
4308 |
+
}
|
4309 |
+
|
4310 |
+
if(!noPropagation) this._trigger("beforeStop", event, this._uiHash());
|
4311 |
+
|
4312 |
+
//$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately, it unbinds ALL events from the original node!
|
4313 |
+
this.placeholder[0].parentNode.removeChild(this.placeholder[0]);
|
4314 |
+
|
4315 |
+
if(this.helper[0] != this.currentItem[0]) this.helper.remove(); this.helper = null;
|
4316 |
+
|
4317 |
+
if(!noPropagation) {
|
4318 |
+
for (var i=0; i < delayedTriggers.length; i++) { delayedTriggers[i].call(this, event); }; //Trigger all delayed events
|
4319 |
+
this._trigger("stop", event, this._uiHash());
|
4320 |
+
}
|
4321 |
+
|
4322 |
+
this.fromOutside = false;
|
4323 |
+
return true;
|
4324 |
+
|
4325 |
+
},
|
4326 |
+
|
4327 |
+
_trigger: function() {
|
4328 |
+
if ($.Widget.prototype._trigger.apply(this, arguments) === false) {
|
4329 |
+
this.cancel();
|
4330 |
+
}
|
4331 |
+
},
|
4332 |
+
|
4333 |
+
_uiHash: function(inst) {
|
4334 |
+
var self = inst || this;
|
4335 |
+
return {
|
4336 |
+
helper: self.helper,
|
4337 |
+
placeholder: self.placeholder || $([]),
|
4338 |
+
position: self.position,
|
4339 |
+
originalPosition: self.originalPosition,
|
4340 |
+
offset: self.positionAbs,
|
4341 |
+
item: self.currentItem,
|
4342 |
+
sender: inst ? inst.element : null
|
4343 |
+
};
|
4344 |
+
}
|
4345 |
+
|
4346 |
+
});
|
4347 |
+
|
4348 |
+
$.extend($.ui.sortable, {
|
4349 |
+
version: "1.8.17"
|
4350 |
+
});
|
4351 |
+
|
4352 |
+
})(jQuery);
|
4353 |
+
/*
|
4354 |
+
* jQuery UI Accordion 1.8.17
|
4355 |
+
*
|
4356 |
+
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
|
4357 |
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
4358 |
+
* http://jquery.org/license
|
4359 |
+
*
|
4360 |
+
* http://docs.jquery.com/UI/Accordion
|
4361 |
+
*
|
4362 |
+
* Depends:
|
4363 |
+
* jquery.ui.core.js
|
4364 |
+
* jquery.ui.widget.js
|
4365 |
+
*/
|
4366 |
+
(function( $, undefined ) {
|
4367 |
+
|
4368 |
+
$.widget( "ui.accordion", {
|
4369 |
+
options: {
|
4370 |
+
active: 0,
|
4371 |
+
animated: "slide",
|
4372 |
+
autoHeight: true,
|
4373 |
+
clearStyle: false,
|
4374 |
+
collapsible: false,
|
4375 |
+
event: "click",
|
4376 |
+
fillSpace: false,
|
4377 |
+
header: "> li > :first-child,> :not(li):even",
|
4378 |
+
icons: {
|
4379 |
+
header: "ui-icon-triangle-1-e",
|
4380 |
+
headerSelected: "ui-icon-triangle-1-s"
|
4381 |
+
},
|
4382 |
+
navigation: false,
|
4383 |
+
navigationFilter: function() {
|
4384 |
+
return this.href.toLowerCase() === location.href.toLowerCase();
|
4385 |
+
}
|
4386 |
+
},
|
4387 |
+
|
4388 |
+
_create: function() {
|
4389 |
+
var self = this,
|
4390 |
+
options = self.options;
|
4391 |
+
|
4392 |
+
self.running = 0;
|
4393 |
+
|
4394 |
+
self.element
|
4395 |
+
.addClass( "ui-accordion ui-widget ui-helper-reset" )
|
4396 |
+
// in lack of child-selectors in CSS
|
4397 |
+
// we need to mark top-LIs in a UL-accordion for some IE-fix
|
4398 |
+
.children( "li" )
|
4399 |
+
.addClass( "ui-accordion-li-fix" );
|
4400 |
+
|
4401 |
+
self.headers = self.element.find( options.header )
|
4402 |
+
.addClass( "ui-accordion-header ui-helper-reset ui-state-default ui-corner-all" )
|
4403 |
+
.bind( "mouseenter.accordion", function() {
|
4404 |
+
if ( options.disabled ) {
|
4405 |
+
return;
|
4406 |
+
}
|
4407 |
+
$( this ).addClass( "ui-state-hover" );
|
4408 |
+
})
|
4409 |
+
.bind( "mouseleave.accordion", function() {
|
4410 |
+
if ( options.disabled ) {
|
4411 |
+
return;
|
4412 |
+
}
|
4413 |
+
$( this ).removeClass( "ui-state-hover" );
|
4414 |
+
})
|
4415 |
+
.bind( "focus.accordion", function() {
|
4416 |
+
if ( options.disabled ) {
|
4417 |
+
return;
|
4418 |
+
}
|
4419 |
+
$( this ).addClass( "ui-state-focus" );
|
4420 |
+
})
|
4421 |
+
.bind( "blur.accordion", function() {
|
4422 |
+
if ( options.disabled ) {
|
4423 |
+
return;
|
4424 |
+
}
|
4425 |
+
$( this ).removeClass( "ui-state-focus" );
|
4426 |
+
});
|
4427 |
+
|
4428 |
+
self.headers.next()
|
4429 |
+
.addClass( "ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom" );
|
4430 |
+
|
4431 |
+
if ( options.navigation ) {
|
4432 |
+
var current = self.element.find( "a" ).filter( options.navigationFilter ).eq( 0 );
|
4433 |
+
if ( current.length ) {
|
4434 |
+
var header = current.closest( ".ui-accordion-header" );
|
4435 |
+
if ( header.length ) {
|
4436 |
+
// anchor within header
|
4437 |
+
self.active = header;
|
4438 |
+
} else {
|
4439 |
+
// anchor within content
|
4440 |
+
self.active = current.closest( ".ui-accordion-content" ).prev();
|
4441 |
+
}
|
4442 |
+
}
|
4443 |
+
}
|
4444 |
+
|
4445 |
+
self.active = self._findActive( self.active || options.active )
|
4446 |
+
.addClass( "ui-state-default ui-state-active" )
|
4447 |
+
.toggleClass( "ui-corner-all" )
|
4448 |
+
.toggleClass( "ui-corner-top" );
|
4449 |
+
self.active.next().addClass( "ui-accordion-content-active" );
|
4450 |
+
|
4451 |
+
self._createIcons();
|
4452 |
+
self.resize();
|
4453 |
+
|
4454 |
+
// ARIA
|
4455 |
+
self.element.attr( "role", "tablist" );
|
4456 |
+
|
4457 |
+
self.headers
|
4458 |
+
.attr( "role", "tab" )
|
4459 |
+
.bind( "keydown.accordion", function( event ) {
|
4460 |
+
return self._keydown( event );
|
4461 |
+
})
|
4462 |
+
.next()
|
4463 |
+
.attr( "role", "tabpanel" );
|
4464 |
+
|
4465 |
+
self.headers
|
4466 |
+
.not( self.active || "" )
|
4467 |
+
.attr({
|
4468 |
+
"aria-expanded": "false",
|
4469 |
+
"aria-selected": "false",
|
4470 |
+
tabIndex: -1
|
4471 |
+
})
|
4472 |
+
.next()
|
4473 |
+
.hide();
|
4474 |
+
|
4475 |
+
// make sure at least one header is in the tab order
|
4476 |
+
if ( !self.active.length ) {
|
4477 |
+
self.headers.eq( 0 ).attr( "tabIndex", 0 );
|
4478 |
+
} else {
|
4479 |
+
self.active
|
4480 |
+
.attr({
|
4481 |
+
"aria-expanded": "true",
|
4482 |
+
"aria-selected": "true",
|
4483 |
+
tabIndex: 0
|
4484 |
+
});
|
4485 |
+
}
|
4486 |
+
|
4487 |
+
// only need links in tab order for Safari
|
4488 |
+
if ( !$.browser.safari ) {
|
4489 |
+
self.headers.find( "a" ).attr( "tabIndex", -1 );
|
4490 |
+
}
|
4491 |
+
|
4492 |
+
if ( options.event ) {
|
4493 |
+
self.headers.bind( options.event.split(" ").join(".accordion ") + ".accordion", function(event) {
|
4494 |
+
self._clickHandler.call( self, event, this );
|
4495 |
+
event.preventDefault();
|
4496 |
+
});
|
4497 |
+
}
|
4498 |
+
},
|
4499 |
+
|
4500 |
+
_createIcons: function() {
|
4501 |
+
var options = this.options;
|
4502 |
+
if ( options.icons ) {
|
4503 |
+
$( "<span></span>" )
|
4504 |
+
.addClass( "ui-icon " + options.icons.header )
|
4505 |
+
.prependTo( this.headers );
|
4506 |
+
this.active.children( ".ui-icon" )
|
4507 |
+
.toggleClass(options.icons.header)
|
4508 |
+
.toggleClass(options.icons.headerSelected);
|
4509 |
+
this.element.addClass( "ui-accordion-icons" );
|
4510 |
+
}
|
4511 |
+
},
|
4512 |
+
|
4513 |
+
_destroyIcons: function() {
|
4514 |
+
this.headers.children( ".ui-icon" ).remove();
|
4515 |
+
this.element.removeClass( "ui-accordion-icons" );
|
4516 |
+
},
|
4517 |
+
|
4518 |
+
destroy: function() {
|
4519 |
+
var options = this.options;
|
4520 |
+
|
4521 |
+
this.element
|
4522 |
+
.removeClass( "ui-accordion ui-widget ui-helper-reset" )
|
4523 |
+
.removeAttr( "role" );
|
4524 |
+
|
4525 |
+
this.headers
|
4526 |
+
.unbind( ".accordion" )
|
4527 |
+
.removeClass( "ui-accordion-header ui-accordion-disabled ui-helper-reset ui-state-default ui-corner-all ui-state-active ui-state-disabled ui-corner-top" )
|
4528 |
+
.removeAttr( "role" )
|
4529 |
+
.removeAttr( "aria-expanded" )
|
4530 |
+
.removeAttr( "aria-selected" )
|
4531 |
+
.removeAttr( "tabIndex" );
|
4532 |
+
|
4533 |
+
this.headers.find( "a" ).removeAttr( "tabIndex" );
|
4534 |
+
this._destroyIcons();
|
4535 |
+
var contents = this.headers.next()
|
4536 |
+
.css( "display", "" )
|
4537 |
+
.removeAttr( "role" )
|
4538 |
+
.removeClass( "ui-helper-reset ui-widget-content ui-corner-bottom ui-accordion-content ui-accordion-content-active ui-accordion-disabled ui-state-disabled" );
|
4539 |
+
if ( options.autoHeight || options.fillHeight ) {
|
4540 |
+
contents.css( "height", "" );
|
4541 |
+
}
|
4542 |
+
|
4543 |
+
return $.Widget.prototype.destroy.call( this );
|
4544 |
+
},
|
4545 |
+
|
4546 |
+
_setOption: function( key, value ) {
|
4547 |
+
$.Widget.prototype._setOption.apply( this, arguments );
|
4548 |
+
|
4549 |
+
if ( key == "active" ) {
|
4550 |
+
this.activate( value );
|
4551 |
+
}
|
4552 |
+
if ( key == "icons" ) {
|
4553 |
+
this._destroyIcons();
|
4554 |
+
if ( value ) {
|
4555 |
+
this._createIcons();
|
4556 |
+
}
|
4557 |
+
}
|
4558 |
+
// #5332 - opacity doesn't cascade to positioned elements in IE
|
4559 |
+
// so we need to add the disabled class to the headers and panels
|
4560 |
+
if ( key == "disabled" ) {
|
4561 |
+
this.headers.add(this.headers.next())
|
4562 |
+
[ value ? "addClass" : "removeClass" ](
|
4563 |
+
"ui-accordion-disabled ui-state-disabled" );
|
4564 |
+
}
|
4565 |
+
},
|
4566 |
+
|
4567 |
+
_keydown: function( event ) {
|
4568 |
+
if ( this.options.disabled || event.altKey || event.ctrlKey ) {
|
4569 |
+
return;
|
4570 |
+
}
|
4571 |
+
|
4572 |
+
var keyCode = $.ui.keyCode,
|
4573 |
+
length = this.headers.length,
|
4574 |
+
currentIndex = this.headers.index( event.target ),
|
4575 |
+
toFocus = false;
|
4576 |
+
|
4577 |
+
switch ( event.keyCode ) {
|
4578 |
+
case keyCode.RIGHT:
|
4579 |
+
case keyCode.DOWN:
|
4580 |
+
toFocus = this.headers[ ( currentIndex + 1 ) % length ];
|
4581 |
+
break;
|
4582 |
+
case keyCode.LEFT:
|
4583 |
+
case keyCode.UP:
|
4584 |
+
toFocus = this.headers[ ( currentIndex - 1 + length ) % length ];
|
4585 |
+
break;
|
4586 |
+
case keyCode.SPACE:
|
4587 |
+
case keyCode.ENTER:
|
4588 |
+
this._clickHandler( { target: event.target }, event.target );
|
4589 |
+
event.preventDefault();
|
4590 |
+
}
|
4591 |
+
|
4592 |
+
if ( toFocus ) {
|
4593 |
+
$( event.target ).attr( "tabIndex", -1 );
|
4594 |
+
$( toFocus ).attr( "tabIndex", 0 );
|
4595 |
+
toFocus.focus();
|
4596 |
+
return false;
|
4597 |
+
}
|
4598 |
+
|
4599 |
+
return true;
|
4600 |
+
},
|
4601 |
+
|
4602 |
+
resize: function() {
|
4603 |
+
var options = this.options,
|
4604 |
+
maxHeight;
|
4605 |
+
|
4606 |
+
if ( options.fillSpace ) {
|
4607 |
+
if ( $.browser.msie ) {
|
4608 |
+
var defOverflow = this.element.parent().css( "overflow" );
|
4609 |
+
this.element.parent().css( "overflow", "hidden");
|
4610 |
+
}
|
4611 |
+
maxHeight = this.element.parent().height();
|
4612 |
+
if ($.browser.msie) {
|
4613 |
+
this.element.parent().css( "overflow", defOverflow );
|
4614 |
+
}
|
4615 |
+
|
4616 |
+
this.headers.each(function() {
|
4617 |
+
maxHeight -= $( this ).outerHeight( true );
|
4618 |
+
});
|
4619 |
+
|
4620 |
+
this.headers.next()
|
4621 |
+
.each(function() {
|
4622 |
+
$( this ).height( Math.max( 0, maxHeight -
|
4623 |
+
$( this ).innerHeight() + $( this ).height() ) );
|
4624 |
+
})
|
4625 |
+
.css( "overflow", "auto" );
|
4626 |
+
} else if ( options.autoHeight ) {
|
4627 |
+
maxHeight = 0;
|
4628 |
+
this.headers.next()
|
4629 |
+
.each(function() {
|
4630 |
+
maxHeight = Math.max( maxHeight, $( this ).height( "" ).height() );
|
4631 |
+
})
|
4632 |
+
.height( maxHeight );
|
4633 |
+
}
|
4634 |
+
|
4635 |
+
return this;
|
4636 |
+
},
|
4637 |
+
|
4638 |
+
activate: function( index ) {
|
4639 |
+
// TODO this gets called on init, changing the option without an explicit call for that
|
4640 |
+
this.options.active = index;
|
4641 |
+
// call clickHandler with custom event
|
4642 |
+
var active = this._findActive( index )[ 0 ];
|
4643 |
+
this._clickHandler( { target: active }, active );
|
4644 |
+
|
4645 |
+
return this;
|
4646 |
+
},
|
4647 |
+
|
4648 |
+
_findActive: function( selector ) {
|
4649 |
+
return selector
|
4650 |
+
? typeof selector === "number"
|
4651 |
+
? this.headers.filter( ":eq(" + selector + ")" )
|
4652 |
+
: this.headers.not( this.headers.not( selector ) )
|
4653 |
+
: selector === false
|
4654 |
+
? $( [] )
|
4655 |
+
: this.headers.filter( ":eq(0)" );
|
4656 |
+
},
|
4657 |
+
|
4658 |
+
// TODO isn't event.target enough? why the separate target argument?
|
4659 |
+
_clickHandler: function( event, target ) {
|
4660 |
+
var options = this.options;
|
4661 |
+
if ( options.disabled ) {
|
4662 |
+
return;
|
4663 |
+
}
|
4664 |
+
|
4665 |
+
// called only when using activate(false) to close all parts programmatically
|
4666 |
+
if ( !event.target ) {
|
4667 |
+
if ( !options.collapsible ) {
|
4668 |
+
return;
|
4669 |
+
}
|
4670 |
+
this.active
|
4671 |
+
.removeClass( "ui-state-active ui-corner-top" )
|
4672 |
+
.addClass( "ui-state-default ui-corner-all" )
|
4673 |
+
.children( ".ui-icon" )
|
4674 |
+
.removeClass( options.icons.headerSelected )
|
4675 |
+
.addClass( options.icons.header );
|
4676 |
+
this.active.next().addClass( "ui-accordion-content-active" );
|
4677 |
+
var toHide = this.active.next(),
|
4678 |
+
data = {
|
4679 |
+
options: options,
|
4680 |
+
newHeader: $( [] ),
|
4681 |
+
oldHeader: options.active,
|
4682 |
+
newContent: $( [] ),
|
4683 |
+
oldContent: toHide
|
4684 |
+
},
|
4685 |
+
toShow = ( this.active = $( [] ) );
|
4686 |
+
this._toggle( toShow, toHide, data );
|
4687 |
+
return;
|
4688 |
+
}
|
4689 |
+
|
4690 |
+
// get the click target
|
4691 |
+
var clicked = $( event.currentTarget || target ),
|
4692 |
+
clickedIsActive = clicked[0] === this.active[0];
|
4693 |
+
|
4694 |
+
// TODO the option is changed, is that correct?
|
4695 |
+
// TODO if it is correct, shouldn't that happen after determining that the click is valid?
|
4696 |
+
options.active = options.collapsible && clickedIsActive ?
|
4697 |
+
false :
|
4698 |
+
this.headers.index( clicked );
|
4699 |
+
|
4700 |
+
// if animations are still active, or the active header is the target, ignore click
|
4701 |
+
if ( this.running || ( !options.collapsible && clickedIsActive ) ) {
|
4702 |
+
return;
|
4703 |
+
}
|
4704 |
+
|
4705 |
+
// find elements to show and hide
|
4706 |
+
var active = this.active,
|
4707 |
+
toShow = clicked.next(),
|
4708 |
+
toHide = this.active.next(),
|
4709 |
+
data = {
|
4710 |
+
options: options,
|
4711 |
+
newHeader: clickedIsActive && options.collapsible ? $([]) : clicked,
|
4712 |
+
oldHeader: this.active,
|
4713 |
+
newContent: clickedIsActive && options.collapsible ? $([]) : toShow,
|
4714 |
+
oldContent: toHide
|
4715 |
+
},
|
4716 |
+
down = this.headers.index( this.active[0] ) > this.headers.index( clicked[0] );
|
4717 |
+
|
4718 |
+
// when the call to ._toggle() comes after the class changes
|
4719 |
+
// it causes a very odd bug in IE 8 (see #6720)
|
4720 |
+
this.active = clickedIsActive ? $([]) : clicked;
|
4721 |
+
this._toggle( toShow, toHide, data, clickedIsActive, down );
|
4722 |
+
|
4723 |
+
// switch classes
|
4724 |
+
active
|
4725 |
+
.removeClass( "ui-state-active ui-corner-top" )
|
4726 |
+
.addClass( "ui-state-default ui-corner-all" )
|
4727 |
+
.children( ".ui-icon" )
|
4728 |
+
.removeClass( options.icons.headerSelected )
|
4729 |
+
.addClass( options.icons.header );
|
4730 |
+
if ( !clickedIsActive ) {
|
4731 |
+
clicked
|
4732 |
+
.removeClass( "ui-state-default ui-corner-all" )
|
4733 |
+
.addClass( "ui-state-active ui-corner-top" )
|
4734 |
+
.children( ".ui-icon" )
|
4735 |
+
.removeClass( options.icons.header )
|
4736 |
+
.addClass( options.icons.headerSelected );
|
4737 |
+
clicked
|
4738 |
+
.next()
|
4739 |
+
.addClass( "ui-accordion-content-active" );
|
4740 |
+
}
|
4741 |
+
|
4742 |
+
return;
|
4743 |
+
},
|
4744 |
+
|
4745 |
+
_toggle: function( toShow, toHide, data, clickedIsActive, down ) {
|
4746 |
+
var self = this,
|
4747 |
+
options = self.options;
|
4748 |
+
|
4749 |
+
self.toShow = toShow;
|
4750 |
+
self.toHide = toHide;
|
4751 |
+
self.data = data;
|
4752 |
+
|
4753 |
+
var complete = function() {
|
4754 |
+
if ( !self ) {
|
4755 |
+
return;
|
4756 |
+
}
|
4757 |
+
return self._completed.apply( self, arguments );
|
4758 |
+
};
|
4759 |
+
|
4760 |
+
// trigger changestart event
|
4761 |
+
self._trigger( "changestart", null, self.data );
|
4762 |
+
|
4763 |
+
// count elements to animate
|
4764 |
+
self.running = toHide.size() === 0 ? toShow.size() : toHide.size();
|
4765 |
+
|
4766 |
+
if ( options.animated ) {
|
4767 |
+
var animOptions = {};
|
4768 |
+
|
4769 |
+
if ( options.collapsible && clickedIsActive ) {
|
4770 |
+
animOptions = {
|
4771 |
+
toShow: $( [] ),
|
4772 |
+
toHide: toHide,
|
4773 |
+
complete: complete,
|
4774 |
+
down: down,
|
4775 |
+
autoHeight: options.autoHeight || options.fillSpace
|
4776 |
+
};
|
4777 |
+
} else {
|
4778 |
+
animOptions = {
|
4779 |
+
toShow: toShow,
|
4780 |
+
toHide: toHide,
|
4781 |
+
complete: complete,
|
4782 |
+
down: down,
|
4783 |
+
autoHeight: options.autoHeight || options.fillSpace
|
4784 |
+
};
|
4785 |
+
}
|
4786 |
+
|
4787 |
+
if ( !options.proxied ) {
|
4788 |
+
options.proxied = options.animated;
|
4789 |
+
}
|
4790 |
+
|
4791 |
+
if ( !options.proxiedDuration ) {
|
4792 |
+
options.proxiedDuration = options.duration;
|
4793 |
+
}
|
4794 |
+
|
4795 |
+
options.animated = $.isFunction( options.proxied ) ?
|
4796 |
+
options.proxied( animOptions ) :
|
4797 |
+
options.proxied;
|
4798 |
+
|
4799 |
+
options.duration = $.isFunction( options.proxiedDuration ) ?
|
4800 |
+
options.proxiedDuration( animOptions ) :
|
4801 |
+
options.proxiedDuration;
|
4802 |
+
|
4803 |
+
var animations = $.ui.accordion.animations,
|
4804 |
+
duration = options.duration,
|
4805 |
+
easing = options.animated;
|
4806 |
+
|
4807 |
+
if ( easing && !animations[ easing ] && !$.easing[ easing ] ) {
|
4808 |
+
easing = "slide";
|
4809 |
+
}
|
4810 |
+
if ( !animations[ easing ] ) {
|
4811 |
+
animations[ easing ] = function( options ) {
|
4812 |
+
this.slide( options, {
|
4813 |
+
easing: easing,
|
4814 |
+
duration: duration || 700
|
4815 |
+
});
|
4816 |
+
};
|
4817 |
+
}
|
4818 |
+
|
4819 |
+
animations[ easing ]( animOptions );
|
4820 |
+
} else {
|
4821 |
+
if ( options.collapsible && clickedIsActive ) {
|
4822 |
+
toShow.toggle();
|
4823 |
+
} else {
|
4824 |
+
toHide.hide();
|
4825 |
+
toShow.show();
|
4826 |
+
}
|
4827 |
+
|
4828 |
+
complete( true );
|
4829 |
+
}
|
4830 |
+
|
4831 |
+
// TODO assert that the blur and focus triggers are really necessary, remove otherwise
|
4832 |
+
toHide.prev()
|
4833 |
+
.attr({
|
4834 |
+
"aria-expanded": "false",
|
4835 |
+
"aria-selected": "false",
|
4836 |
+
tabIndex: -1
|
4837 |
+
})
|
4838 |
+
.blur();
|
4839 |
+
toShow.prev()
|
4840 |
+
.attr({
|
4841 |
+
"aria-expanded": "true",
|
4842 |
+
"aria-selected": "true",
|
4843 |
+
tabIndex: 0
|
4844 |
+
})
|
4845 |
+
.focus();
|
4846 |
+
},
|
4847 |
+
|
4848 |
+
_completed: function( cancel ) {
|
4849 |
+
this.running = cancel ? 0 : --this.running;
|
4850 |
+
if ( this.running ) {
|
4851 |
+
return;
|
4852 |
+
}
|
4853 |
+
|
4854 |
+
if ( this.options.clearStyle ) {
|
4855 |
+
this.toShow.add( this.toHide ).css({
|
4856 |
+
height: "",
|
4857 |
+
overflow: ""
|
4858 |
+
});
|
4859 |
+
}
|
4860 |
+
|
4861 |
+
// other classes are removed before the animation; this one needs to stay until completed
|
4862 |
+
this.toHide.removeClass( "ui-accordion-content-active" );
|
4863 |
+
// Work around for rendering bug in IE (#5421)
|
4864 |
+
if ( this.toHide.length ) {
|
4865 |
+
this.toHide.parent()[0].className = this.toHide.parent()[0].className;
|
4866 |
+
}
|
4867 |
+
|
4868 |
+
this._trigger( "change", null, this.data );
|
4869 |
+
}
|
4870 |
+
});
|
4871 |
+
|
4872 |
+
$.extend( $.ui.accordion, {
|
4873 |
+
version: "1.8.17",
|
4874 |
+
animations: {
|
4875 |
+
slide: function( options, additions ) {
|
4876 |
+
options = $.extend({
|
4877 |
+
easing: "swing",
|
4878 |
+
duration: 300
|
4879 |
+
}, options, additions );
|
4880 |
+
if ( !options.toHide.size() ) {
|
4881 |
+
options.toShow.animate({
|
4882 |
+
height: "show",
|
4883 |
+
paddingTop: "show",
|
4884 |
+
paddingBottom: "show"
|
4885 |
+
}, options );
|
4886 |
+
return;
|
4887 |
+
}
|
4888 |
+
if ( !options.toShow.size() ) {
|
4889 |
+
options.toHide.animate({
|
4890 |
+
height: "hide",
|
4891 |
+
paddingTop: "hide",
|
4892 |
+
paddingBottom: "hide"
|
4893 |
+
}, options );
|
4894 |
+
return;
|
4895 |
+
}
|
4896 |
+
var overflow = options.toShow.css( "overflow" ),
|
4897 |
+
percentDone = 0,
|
4898 |
+
showProps = {},
|
4899 |
+
hideProps = {},
|
4900 |
+
fxAttrs = [ "height", "paddingTop", "paddingBottom" ],
|
4901 |
+
originalWidth;
|
4902 |
+
// fix width before calculating height of hidden element
|
4903 |
+
var s = options.toShow;
|
4904 |
+
originalWidth = s[0].style.width;
|
4905 |
+
s.width( s.parent().width()
|
4906 |
+
- parseFloat( s.css( "paddingLeft" ) )
|
4907 |
+
- parseFloat( s.css( "paddingRight" ) )
|
4908 |
+
- ( parseFloat( s.css( "borderLeftWidth" ) ) || 0 )
|
4909 |
+
- ( parseFloat( s.css( "borderRightWidth" ) ) || 0 ) );
|
4910 |
+
|
4911 |
+
$.each( fxAttrs, function( i, prop ) {
|
4912 |
+
hideProps[ prop ] = "hide";
|
4913 |
+
|
4914 |
+
var parts = ( "" + $.css( options.toShow[0], prop ) ).match( /^([\d+-.]+)(.*)$/ );
|
4915 |
+
showProps[ prop ] = {
|
4916 |
+
value: parts[ 1 ],
|
4917 |
+
unit: parts[ 2 ] || "px"
|
4918 |
+
};
|
4919 |
+
});
|
4920 |
+
options.toShow.css({ height: 0, overflow: "hidden" }).show();
|
4921 |
+
options.toHide
|
4922 |
+
.filter( ":hidden" )
|
4923 |
+
.each( options.complete )
|
4924 |
+
.end()
|
4925 |
+
.filter( ":visible" )
|
4926 |
+
.animate( hideProps, {
|
4927 |
+
step: function( now, settings ) {
|
4928 |
+
// only calculate the percent when animating height
|
4929 |
+
// IE gets very inconsistent results when animating elements
|
4930 |
+
// with small values, which is common for padding
|
4931 |
+
if ( settings.prop == "height" ) {
|
4932 |
+
percentDone = ( settings.end - settings.start === 0 ) ? 0 :
|
4933 |
+
( settings.now - settings.start ) / ( settings.end - settings.start );
|
4934 |
+
}
|
4935 |
+
|
4936 |
+
options.toShow[ 0 ].style[ settings.prop ] =
|
4937 |
+
( percentDone * showProps[ settings.prop ].value )
|
4938 |
+
+ showProps[ settings.prop ].unit;
|
4939 |
+
},
|
4940 |
+
duration: options.duration,
|
4941 |
+
easing: options.easing,
|
4942 |
+
complete: function() {
|
4943 |
+
if ( !options.autoHeight ) {
|
4944 |
+
options.toShow.css( "height", "" );
|
4945 |
+
}
|
4946 |
+
options.toShow.css({
|
4947 |
+
width: originalWidth,
|
4948 |
+
overflow: overflow
|
4949 |
+
});
|
4950 |
+
options.complete();
|
4951 |
+
}
|
4952 |
+
});
|
4953 |
+
},
|
4954 |
+
bounceslide: function( options ) {
|
4955 |
+
this.slide( options, {
|
4956 |
+
easing: options.down ? "easeOutBounce" : "swing",
|
4957 |
+
duration: options.down ? 1000 : 200
|
4958 |
+
});
|
4959 |
+
}
|
4960 |
+
}
|
4961 |
+
});
|
4962 |
+
|
4963 |
+
})( jQuery );
|
4964 |
+
/*
|
4965 |
+
* jQuery UI Autocomplete 1.8.17
|
4966 |
+
*
|
4967 |
+
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
|
4968 |
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
4969 |
+
* http://jquery.org/license
|
4970 |
+
*
|
4971 |
+
* http://docs.jquery.com/UI/Autocomplete
|
4972 |
+
*
|
4973 |
+
* Depends:
|
4974 |
+
* jquery.ui.core.js
|
4975 |
+
* jquery.ui.widget.js
|
4976 |
+
* jquery.ui.position.js
|
4977 |
+
*/
|
4978 |
+
(function( $, undefined ) {
|
4979 |
+
|
4980 |
+
// used to prevent race conditions with remote data sources
|
4981 |
+
var requestIndex = 0;
|
4982 |
+
|
4983 |
+
$.widget( "ui.autocomplete", {
|
4984 |
+
options: {
|
4985 |
+
appendTo: "body",
|
4986 |
+
autoFocus: false,
|
4987 |
+
delay: 300,
|
4988 |
+
minLength: 1,
|
4989 |
+
position: {
|
4990 |
+
my: "left top",
|
4991 |
+
at: "left bottom",
|
4992 |
+
collision: "none"
|
4993 |
+
},
|
4994 |
+
source: null
|
4995 |
+
},
|
4996 |
+
|
4997 |
+
pending: 0,
|
4998 |
+
|
4999 |
+
_create: function() {
|
5000 |
+
var self = this,
|
5001 |
+
doc = this.element[ 0 ].ownerDocument,
|
5002 |
+
suppressKeyPress;
|
5003 |
+
|
5004 |
+
this.element
|
5005 |
+
.addClass( "ui-autocomplete-input" )
|
5006 |
+
.attr( "autocomplete", "off" )
|
5007 |
+
// TODO verify these actually work as intended
|
5008 |
+
.attr({
|
5009 |
+
role: "textbox",
|
5010 |
+
"aria-autocomplete": "list",
|
5011 |
+
"aria-haspopup": "true"
|
5012 |
+
})
|
5013 |
+
.bind( "keydown.autocomplete", function( event ) {
|
5014 |
+
if ( self.options.disabled || self.element.propAttr( "readOnly" ) ) {
|
5015 |
+
return;
|
5016 |
+
}
|
5017 |
+
|
5018 |
+
suppressKeyPress = false;
|
5019 |
+
var keyCode = $.ui.keyCode;
|
5020 |
+
switch( event.keyCode ) {
|
5021 |
+
case keyCode.PAGE_UP:
|
5022 |
+
self._move( "previousPage", event );
|
5023 |
+
break;
|
5024 |
+
case keyCode.PAGE_DOWN:
|
5025 |
+
self._move( "nextPage", event );
|
5026 |
+
break;
|
5027 |
+
case keyCode.UP:
|
5028 |
+
self._move( "previous", event );
|
5029 |
+
// prevent moving cursor to beginning of text field in some browsers
|
5030 |
+
event.preventDefault();
|
5031 |
+
break;
|
5032 |
+
case keyCode.DOWN:
|
5033 |
+
self._move( "next", event );
|
5034 |
+
// prevent moving cursor to end of text field in some browsers
|
5035 |
+
event.preventDefault();
|
5036 |
+
break;
|
5037 |
+
case keyCode.ENTER:
|
5038 |
+
case keyCode.NUMPAD_ENTER:
|
5039 |
+
// when menu is open and has focus
|
5040 |
+
if ( self.menu.active ) {
|
5041 |
+
// #6055 - Opera still allows the keypress to occur
|
5042 |
+
// which causes forms to submit
|
5043 |
+
suppressKeyPress = true;
|
5044 |
+
event.preventDefault();
|
5045 |
+
}
|
5046 |
+
//passthrough - ENTER and TAB both select the current element
|
5047 |
+
case keyCode.TAB:
|
5048 |
+
if ( !self.menu.active ) {
|
5049 |
+
return;
|
5050 |
+
}
|
5051 |
+
self.menu.select( event );
|
5052 |
+
break;
|
5053 |
+
case keyCode.ESCAPE:
|
5054 |
+
self.element.val( self.term );
|
5055 |
+
self.close( event );
|
5056 |
+
break;
|
5057 |
+
default:
|
5058 |
+
// keypress is triggered before the input value is changed
|
5059 |
+
clearTimeout( self.searching );
|
5060 |
+
self.searching = setTimeout(function() {
|
5061 |
+
// only search if the value has changed
|
5062 |
+
if ( self.term != self.element.val() ) {
|
5063 |
+
self.selectedItem = null;
|
5064 |
+
self.search( null, event );
|
5065 |
+
}
|
5066 |
+
}, self.options.delay );
|
5067 |
+
break;
|
5068 |
+
}
|
5069 |
+
})
|
5070 |
+
.bind( "keypress.autocomplete", function( event ) {
|
5071 |
+
if ( suppressKeyPress ) {
|
5072 |
+
suppressKeyPress = false;
|
5073 |
+
event.preventDefault();
|
5074 |
+
}
|
5075 |
+
})
|
5076 |
+
.bind( "focus.autocomplete", function() {
|
5077 |
+
if ( self.options.disabled ) {
|
5078 |
+
return;
|
5079 |
+
}
|
5080 |
+
|
5081 |
+
self.selectedItem = null;
|
5082 |
+
self.previous = self.element.val();
|
5083 |
+
})
|
5084 |
+
.bind( "blur.autocomplete", function( event ) {
|
5085 |
+
if ( self.options.disabled ) {
|
5086 |
+
return;
|
5087 |
+
}
|
5088 |
+
|
5089 |
+
clearTimeout( self.searching );
|
5090 |
+
// clicks on the menu (or a button to trigger a search) will cause a blur event
|
5091 |
+
self.closing = setTimeout(function() {
|
5092 |
+
self.close( event );
|
5093 |
+
self._change( event );
|
5094 |
+
}, 150 );
|
5095 |
+
});
|
5096 |
+
this._initSource();
|
5097 |
+
this.response = function() {
|
5098 |
+
return self._response.apply( self, arguments );
|
5099 |
+
};
|
5100 |
+
this.menu = $( "<ul></ul>" )
|
5101 |
+
.addClass( "ui-autocomplete" )
|
5102 |
+
.appendTo( $( this.options.appendTo || "body", doc )[0] )
|
5103 |
+
// prevent the close-on-blur in case of a "slow" click on the menu (long mousedown)
|
5104 |
+
.mousedown(function( event ) {
|
5105 |
+
// clicking on the scrollbar causes focus to shift to the body
|
5106 |
+
// but we can't detect a mouseup or a click immediately afterward
|
5107 |
+
// so we have to track the next mousedown and close the menu if
|
5108 |
+
// the user clicks somewhere outside of the autocomplete
|
5109 |
+
var menuElement = self.menu.element[ 0 ];
|
5110 |
+
if ( !$( event.target ).closest( ".ui-menu-item" ).length ) {
|
5111 |
+
setTimeout(function() {
|
5112 |
+
$( document ).one( 'mousedown', function( event ) {
|
5113 |
+
if ( event.target !== self.element[ 0 ] &&
|
5114 |
+
event.target !== menuElement &&
|
5115 |
+
!$.ui.contains( menuElement, event.target ) ) {
|
5116 |
+
self.close();
|
5117 |
+
}
|
5118 |
+
});
|
5119 |
+
}, 1 );
|
5120 |
+
}
|
5121 |
+
|
5122 |
+
// use another timeout to make sure the blur-event-handler on the input was already triggered
|
5123 |
+
setTimeout(function() {
|
5124 |
+
clearTimeout( self.closing );
|
5125 |
+
}, 13);
|
5126 |
+
})
|
5127 |
+
.menu({
|
5128 |
+
focus: function( event, ui ) {
|
5129 |
+
var item = ui.item.data( "item.autocomplete" );
|
5130 |
+
if ( false !== self._trigger( "focus", event, { item: item } ) ) {
|
5131 |
+
// use value to match what will end up in the input, if it was a key event
|
5132 |
+
if ( /^key/.test(event.originalEvent.type) ) {
|
5133 |
+
self.element.val( item.value );
|
5134 |
+
}
|
5135 |
+
}
|
5136 |
+
},
|
5137 |
+
selected: function( event, ui ) {
|
5138 |
+
var item = ui.item.data( "item.autocomplete" ),
|
5139 |
+
previous = self.previous;
|
5140 |
+
|
5141 |
+
// only trigger when focus was lost (click on menu)
|
5142 |
+
if ( self.element[0] !== doc.activeElement ) {
|
5143 |
+
self.element.focus();
|
5144 |
+
self.previous = previous;
|
5145 |
+
// #6109 - IE triggers two focus events and the second
|
5146 |
+
// is asynchronous, so we need to reset the previous
|
5147 |
+
// term synchronously and asynchronously :-(
|
5148 |
+
setTimeout(function() {
|
5149 |
+
self.previous = previous;
|
5150 |
+
self.selectedItem = item;
|
5151 |
+
}, 1);
|
5152 |
+
}
|
5153 |
+
|
5154 |
+
if ( false !== self._trigger( "select", event, { item: item } ) ) {
|
5155 |
+
self.element.val( item.value );
|
5156 |
+
}
|
5157 |
+
// reset the term after the select event
|
5158 |
+
// this allows custom select handling to work properly
|
5159 |
+
self.term = self.element.val();
|
5160 |
+
|
5161 |
+
self.close( event );
|
5162 |
+
self.selectedItem = item;
|
5163 |
+
},
|
5164 |
+
blur: function( event, ui ) {
|
5165 |
+
// don't set the value of the text field if it's already correct
|
5166 |
+
// this prevents moving the cursor unnecessarily
|
5167 |
+
if ( self.menu.element.is(":visible") &&
|
5168 |
+
( self.element.val() !== self.term ) ) {
|
5169 |
+
self.element.val( self.term );
|
5170 |
+
}
|
5171 |
+
}
|
5172 |
+
})
|
5173 |
+
.zIndex( this.element.zIndex() + 1 )
|
5174 |
+
// workaround for jQuery bug #5781 http://dev.jquery.com/ticket/5781
|
5175 |
+
.css({ top: 0, left: 0 })
|
5176 |
+
.hide()
|
5177 |
+
.data( "menu" );
|
5178 |
+
if ( $.fn.bgiframe ) {
|
5179 |
+
this.menu.element.bgiframe();
|
5180 |
+
}
|
5181 |
+
// turning off autocomplete prevents the browser from remembering the
|
5182 |
+
// value when navigating through history, so we re-enable autocomplete
|
5183 |
+
// if the page is unloaded before the widget is destroyed. #7790
|
5184 |
+
self.beforeunloadHandler = function() {
|
5185 |
+
self.element.removeAttr( "autocomplete" );
|
5186 |
+
};
|
5187 |
+
$( window ).bind( "beforeunload", self.beforeunloadHandler );
|
5188 |
+
},
|
5189 |
+
|
5190 |
+
destroy: function() {
|
5191 |
+
this.element
|
5192 |
+
.removeClass( "ui-autocomplete-input" )
|
5193 |
+
.removeAttr( "autocomplete" )
|
5194 |
+
.removeAttr( "role" )
|
5195 |
+
.removeAttr( "aria-autocomplete" )
|
5196 |
+
.removeAttr( "aria-haspopup" );
|
5197 |
+
this.menu.element.remove();
|
5198 |
+
$( window ).unbind( "beforeunload", this.beforeunloadHandler );
|
5199 |
+
$.Widget.prototype.destroy.call( this );
|
5200 |
+
},
|
5201 |
+
|
5202 |
+
_setOption: function( key, value ) {
|
5203 |
+
$.Widget.prototype._setOption.apply( this, arguments );
|
5204 |
+
if ( key === "source" ) {
|
5205 |
+
this._initSource();
|
5206 |
+
}
|
5207 |
+
if ( key === "appendTo" ) {
|
5208 |
+
this.menu.element.appendTo( $( value || "body", this.element[0].ownerDocument )[0] )
|
5209 |
+
}
|
5210 |
+
if ( key === "disabled" && value && this.xhr ) {
|
5211 |
+
this.xhr.abort();
|
5212 |
+
}
|
5213 |
+
},
|
5214 |
+
|
5215 |
+
_initSource: function() {
|
5216 |
+
var self = this,
|
5217 |
+
array,
|
5218 |
+
url;
|
5219 |
+
if ( $.isArray(this.options.source) ) {
|
5220 |
+
array = this.options.source;
|
5221 |
+
this.source = function( request, response ) {
|
5222 |
+
response( $.ui.autocomplete.filter(array, request.term) );
|
5223 |
+
};
|
5224 |
+
} else if ( typeof this.options.source === "string" ) {
|
5225 |
+
url = this.options.source;
|
5226 |
+
this.source = function( request, response ) {
|
5227 |
+
if ( self.xhr ) {
|
5228 |
+
self.xhr.abort();
|
5229 |
+
}
|
5230 |
+
self.xhr = $.ajax({
|
5231 |
+
url: url,
|
5232 |
+
data: request,
|
5233 |
+
dataType: "json",
|
5234 |
+
autocompleteRequest: ++requestIndex,
|
5235 |
+
success: function( data, status ) {
|
5236 |
+
if ( this.autocompleteRequest === requestIndex ) {
|
5237 |
+
response( data );
|
5238 |
+
}
|
5239 |
+
},
|
5240 |
+
error: function() {
|
5241 |
+
if ( this.autocompleteRequest === requestIndex ) {
|
5242 |
+
response( [] );
|
5243 |
+
}
|
5244 |
+
}
|
5245 |
+
});
|
5246 |
+
};
|
5247 |
+
} else {
|
5248 |
+
this.source = this.options.source;
|
5249 |
+
}
|
5250 |
+
},
|
5251 |
+
|
5252 |
+
search: function( value, event ) {
|
5253 |
+
value = value != null ? value : this.element.val();
|
5254 |
+
|
5255 |
+
// always save the actual value, not the one passed as an argument
|
5256 |
+
this.term = this.element.val();
|
5257 |
+
|
5258 |
+
if ( value.length < this.options.minLength ) {
|
5259 |
+
return this.close( event );
|
5260 |
+
}
|
5261 |
+
|
5262 |
+
clearTimeout( this.closing );
|
5263 |
+
if ( this._trigger( "search", event ) === false ) {
|
5264 |
+
return;
|
5265 |
+
}
|
5266 |
+
|
5267 |
+
return this._search( value );
|
5268 |
+
},
|
5269 |
+
|
5270 |
+
_search: function( value ) {
|
5271 |
+
this.pending++;
|
5272 |
+
this.element.addClass( "ui-autocomplete-loading" );
|
5273 |
+
|
5274 |
+
this.source( { term: value }, this.response );
|
5275 |
+
},
|
5276 |
+
|
5277 |
+
_response: function( content ) {
|
5278 |
+
if ( !this.options.disabled && content && content.length ) {
|
5279 |
+
content = this._normalize( content );
|
5280 |
+
this._suggest( content );
|
5281 |
+
this._trigger( "open" );
|
5282 |
+
} else {
|
5283 |
+
this.close();
|
5284 |
+
}
|
5285 |
+
this.pending--;
|
5286 |
+
if ( !this.pending ) {
|
5287 |
+
this.element.removeClass( "ui-autocomplete-loading" );
|
5288 |
+
}
|
5289 |
+
},
|
5290 |
+
|
5291 |
+
close: function( event ) {
|
5292 |
+
clearTimeout( this.closing );
|
5293 |
+
if ( this.menu.element.is(":visible") ) {
|
5294 |
+
this.menu.element.hide();
|
5295 |
+
this.menu.deactivate();
|
5296 |
+
this._trigger( "close", event );
|
5297 |
+
}
|
5298 |
+
},
|
5299 |
+
|
5300 |
+
_change: function( event ) {
|
5301 |
+
if ( this.previous !== this.element.val() ) {
|
5302 |
+
this._trigger( "change", event, { item: this.selectedItem } );
|
5303 |
+
}
|
5304 |
+
},
|
5305 |
+
|
5306 |
+
_normalize: function( items ) {
|
5307 |
+
// assume all items have the right format when the first item is complete
|
5308 |
+
if ( items.length && items[0].label && items[0].value ) {
|
5309 |
+
return items;
|
5310 |
+
}
|
5311 |
+
return $.map( items, function(item) {
|
5312 |
+
if ( typeof item === "string" ) {
|
5313 |
+
return {
|
5314 |
+
label: item,
|
5315 |
+
value: item
|
5316 |
+
};
|
5317 |
+
}
|
5318 |
+
return $.extend({
|
5319 |
+
label: item.label || item.value,
|
5320 |
+
value: item.value || item.label
|
5321 |
+
}, item );
|
5322 |
+
});
|
5323 |
+
},
|
5324 |
+
|
5325 |
+
_suggest: function( items ) {
|
5326 |
+
var ul = this.menu.element
|
5327 |
+
.empty()
|
5328 |
+
.zIndex( this.element.zIndex() + 1 );
|
5329 |
+
this._renderMenu( ul, items );
|
5330 |
+
// TODO refresh should check if the active item is still in the dom, removing the need for a manual deactivate
|
5331 |
+
this.menu.deactivate();
|
5332 |
+
this.menu.refresh();
|
5333 |
+
|
5334 |
+
// size and position menu
|
5335 |
+
ul.show();
|
5336 |
+
this._resizeMenu();
|
5337 |
+
ul.position( $.extend({
|
5338 |
+
of: this.element
|
5339 |
+
}, this.options.position ));
|
5340 |
+
|
5341 |
+
if ( this.options.autoFocus ) {
|
5342 |
+
this.menu.next( new $.Event("mouseover") );
|
5343 |
+
}
|
5344 |
+
},
|
5345 |
+
|
5346 |
+
_resizeMenu: function() {
|
5347 |
+
var ul = this.menu.element;
|
5348 |
+
ul.outerWidth( Math.max(
|
5349 |
+
// Firefox wraps long text (possibly a rounding bug)
|
5350 |
+
// so we add 1px to avoid the wrapping (#7513)
|
5351 |
+
ul.width( "" ).outerWidth() + 1,
|
5352 |
+
this.element.outerWidth()
|
5353 |
+
) );
|
5354 |
+
},
|
5355 |
+
|
5356 |
+
_renderMenu: function( ul, items ) {
|
5357 |
+
var self = this;
|
5358 |
+
$.each( items, function( index, item ) {
|
5359 |
+
self._renderItem( ul, item );
|
5360 |
+
});
|
5361 |
+
},
|
5362 |
+
|
5363 |
+
_renderItem: function( ul, item) {
|
5364 |
+
return $( "<li></li>" )
|
5365 |
+
.data( "item.autocomplete", item )
|
5366 |
+
.append( $( "<a></a>" ).text( item.label ) )
|
5367 |
+
.appendTo( ul );
|
5368 |
+
},
|
5369 |
+
|
5370 |
+
_move: function( direction, event ) {
|
5371 |
+
if ( !this.menu.element.is(":visible") ) {
|
5372 |
+
this.search( null, event );
|
5373 |
+
return;
|
5374 |
+
}
|
5375 |
+
if ( this.menu.first() && /^previous/.test(direction) ||
|
5376 |
+
this.menu.last() && /^next/.test(direction) ) {
|
5377 |
+
this.element.val( this.term );
|
5378 |
+
this.menu.deactivate();
|
5379 |
+
return;
|
5380 |
+
}
|
5381 |
+
this.menu[ direction ]( event );
|
5382 |
+
},
|
5383 |
+
|
5384 |
+
widget: function() {
|
5385 |
+
return this.menu.element;
|
5386 |
+
}
|
5387 |
+
});
|
5388 |
+
|
5389 |
+
$.extend( $.ui.autocomplete, {
|
5390 |
+
escapeRegex: function( value ) {
|
5391 |
+
return value.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
|
5392 |
+
},
|
5393 |
+
filter: function(array, term) {
|
5394 |
+
var matcher = new RegExp( $.ui.autocomplete.escapeRegex(term), "i" );
|
5395 |
+
return $.grep( array, function(value) {
|
5396 |
+
return matcher.test( value.label || value.value || value );
|
5397 |
+
});
|
5398 |
+
}
|
5399 |
+
});
|
5400 |
+
|
5401 |
+
}( jQuery ));
|
5402 |
+
|
5403 |
+
/*
|
5404 |
+
* jQuery UI Menu (not officially released)
|
5405 |
+
*
|
5406 |
+
* This widget isn't yet finished and the API is subject to change. We plan to finish
|
5407 |
+
* it for the next release. You're welcome to give it a try anyway and give us feedback,
|
5408 |
+
* as long as you're okay with migrating your code later on. We can help with that, too.
|
5409 |
+
*
|
5410 |
+
* Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
|
5411 |
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
5412 |
+
* http://jquery.org/license
|
5413 |
+
*
|
5414 |
+
* http://docs.jquery.com/UI/Menu
|
5415 |
+
*
|
5416 |
+
* Depends:
|
5417 |
+
* jquery.ui.core.js
|
5418 |
+
* jquery.ui.widget.js
|
5419 |
+
*/
|
5420 |
+
(function($) {
|
5421 |
+
|
5422 |
+
$.widget("ui.menu", {
|
5423 |
+
_create: function() {
|
5424 |
+
var self = this;
|
5425 |
+
this.element
|
5426 |
+
.addClass("ui-menu ui-widget ui-widget-content ui-corner-all")
|
5427 |
+
.attr({
|
5428 |
+
role: "listbox",
|
5429 |
+
"aria-activedescendant": "ui-active-menuitem"
|
5430 |
+
})
|
5431 |
+
.click(function( event ) {
|
5432 |
+
if ( !$( event.target ).closest( ".ui-menu-item a" ).length ) {
|
5433 |
+
return;
|
5434 |
+
}
|
5435 |
+
// temporary
|
5436 |
+
event.preventDefault();
|
5437 |
+
self.select( event );
|
5438 |
+
});
|
5439 |
+
this.refresh();
|
5440 |
+
},
|
5441 |
+
|
5442 |
+
refresh: function() {
|
5443 |
+
var self = this;
|
5444 |
+
|
5445 |
+
// don't refresh list items that are already adapted
|
5446 |
+
var items = this.element.children("li:not(.ui-menu-item):has(a)")
|
5447 |
+
.addClass("ui-menu-item")
|
5448 |
+
.attr("role", "menuitem");
|
5449 |
+
|
5450 |
+
items.children("a")
|
5451 |
+
.addClass("ui-corner-all")
|
5452 |
+
.attr("tabindex", -1)
|
5453 |
+
// mouseenter doesn't work with event delegation
|
5454 |
+
.mouseenter(function( event ) {
|
5455 |
+
self.activate( event, $(this).parent() );
|
5456 |
+
})
|
5457 |
+
.mouseleave(function() {
|
5458 |
+
self.deactivate();
|
5459 |
+
});
|
5460 |
+
},
|
5461 |
+
|
5462 |
+
activate: function( event, item ) {
|
5463 |
+
this.deactivate();
|
5464 |
+
if (this.hasScroll()) {
|
5465 |
+
var offset = item.offset().top - this.element.offset().top,
|
5466 |
+
scroll = this.element.scrollTop(),
|
5467 |
+
elementHeight = this.element.height();
|
5468 |
+
if (offset < 0) {
|
5469 |
+
this.element.scrollTop( scroll + offset);
|
5470 |
+
} else if (offset >= elementHeight) {
|
5471 |
+
this.element.scrollTop( scroll + offset - elementHeight + item.height());
|
5472 |
+
}
|
5473 |
+
}
|
5474 |
+
this.active = item.eq(0)
|
5475 |
+
.children("a")
|
5476 |
+
.addClass("ui-state-hover")
|
5477 |
+
.attr("id", "ui-active-menuitem")
|
5478 |
+
.end();
|
5479 |
+
this._trigger("focus", event, { item: item });
|
5480 |
+
},
|
5481 |
+
|
5482 |
+
deactivate: function() {
|
5483 |
+
if (!this.active) { return; }
|
5484 |
+
|
5485 |
+
this.active.children("a")
|
5486 |
+
.removeClass("ui-state-hover")
|
5487 |
+
.removeAttr("id");
|
5488 |
+
this._trigger("blur");
|
5489 |
+
this.active = null;
|
5490 |
+
},
|
5491 |
+
|
5492 |
+
next: function(event) {
|
5493 |
+
this.move("next", ".ui-menu-item:first", event);
|
5494 |
+
},
|
5495 |
+
|
5496 |
+
previous: function(event) {
|
5497 |
+
this.move("prev", ".ui-menu-item:last", event);
|
5498 |
+
},
|
5499 |
+
|
5500 |
+
first: function() {
|
5501 |
+
return this.active && !this.active.prevAll(".ui-menu-item").length;
|
5502 |
+
},
|
5503 |
+
|
5504 |
+
last: function() {
|
5505 |
+
return this.active && !this.active.nextAll(".ui-menu-item").length;
|
5506 |
+
},
|
5507 |
+
|
5508 |
+
move: function(direction, edge, event) {
|
5509 |
+
if (!this.active) {
|
5510 |
+
this.activate(event, this.element.children(edge));
|
5511 |
+
return;
|
5512 |
+
}
|
5513 |
+
var next = this.active[direction + "All"](".ui-menu-item").eq(0);
|
5514 |
+
if (next.length) {
|
5515 |
+
this.activate(event, next);
|
5516 |
+
} else {
|
5517 |
+
this.activate(event, this.element.children(edge));
|
5518 |
+
}
|
5519 |
+
},
|
5520 |
+
|
5521 |
+
// TODO merge with previousPage
|
5522 |
+
nextPage: function(event) {
|
5523 |
+
if (this.hasScroll()) {
|
5524 |
+
// TODO merge with no-scroll-else
|
5525 |
+
if (!this.active || this.last()) {
|
5526 |
+
this.activate(event, this.element.children(".ui-menu-item:first"));
|
5527 |
+
return;
|
5528 |
+
}
|
5529 |
+
var base = this.active.offset().top,
|
5530 |
+
height = this.element.height(),
|
5531 |
+
result = this.element.children(".ui-menu-item").filter(function() {
|
5532 |
+
var close = $(this).offset().top - base - height + $(this).height();
|
5533 |
+
// TODO improve approximation
|
5534 |
+
return close < 10 && close > -10;
|
5535 |
+
});
|
5536 |
+
|
5537 |
+
// TODO try to catch this earlier when scrollTop indicates the last page anyway
|
5538 |
+
if (!result.length) {
|
5539 |
+
result = this.element.children(".ui-menu-item:last");
|
5540 |
+
}
|
5541 |
+
this.activate(event, result);
|
5542 |
+
} else {
|
5543 |
+
this.activate(event, this.element.children(".ui-menu-item")
|
5544 |
+
.filter(!this.active || this.last() ? ":first" : ":last"));
|
5545 |
+
}
|
5546 |
+
},
|
5547 |
+
|
5548 |
+
// TODO merge with nextPage
|
5549 |
+
previousPage: function(event) {
|
5550 |
+
if (this.hasScroll()) {
|
5551 |
+
// TODO merge with no-scroll-else
|
5552 |
+
if (!this.active || this.first()) {
|
5553 |
+
this.activate(event, this.element.children(".ui-menu-item:last"));
|
5554 |
+
return;
|
5555 |
+
}
|
5556 |
+
|
5557 |
+
var base = this.active.offset().top,
|
5558 |
+
height = this.element.height();
|
5559 |
+
result = this.element.children(".ui-menu-item").filter(function() {
|
5560 |
+
var close = $(this).offset().top - base + height - $(this).height();
|
5561 |
+
// TODO improve approximation
|
5562 |
+
return close < 10 && close > -10;
|
5563 |
+
});
|
5564 |
+
|
5565 |
+
// TODO try to catch this earlier when scrollTop indicates the last page anyway
|
5566 |
+
if (!result.length) {
|
5567 |
+
result = this.element.children(".ui-menu-item:first");
|
5568 |
+
}
|
5569 |
+
this.activate(event, result);
|
5570 |
+
} else {
|
5571 |
+
this.activate(event, this.element.children(".ui-menu-item")
|
5572 |
+
.filter(!this.active || this.first() ? ":last" : ":first"));
|
5573 |
+
}
|
5574 |
+
},
|
5575 |
+
|
5576 |
+
hasScroll: function() {
|
5577 |
+
return this.element.height() < this.element[ $.fn.prop ? "prop" : "attr" ]("scrollHeight");
|
5578 |
+
},
|
5579 |
+
|
5580 |
+
select: function( event ) {
|
5581 |
+
this._trigger("selected", event, { item: this.active });
|
5582 |
+
}
|
5583 |
+
});
|
5584 |
+
|
5585 |
+
}(jQuery));
|
5586 |
+
/*
|
5587 |
+
* jQuery UI Button 1.8.17
|
5588 |
+
*
|
5589 |
+
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
|
5590 |
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
5591 |
+
* http://jquery.org/license
|
5592 |
+
*
|
5593 |
+
* http://docs.jquery.com/UI/Button
|
5594 |
+
*
|
5595 |
+
* Depends:
|
5596 |
+
* jquery.ui.core.js
|
5597 |
+
* jquery.ui.widget.js
|
5598 |
+
*/
|
5599 |
+
(function( $, undefined ) {
|
5600 |
+
|
5601 |
+
var lastActive, startXPos, startYPos, clickDragged,
|
5602 |
+
baseClasses = "ui-button ui-widget ui-state-default ui-corner-all",
|
5603 |
+
stateClasses = "ui-state-hover ui-state-active ",
|
5604 |
+
typeClasses = "ui-button-icons-only ui-button-icon-only ui-button-text-icons ui-button-text-icon-primary ui-button-text-icon-secondary ui-button-text-only",
|
5605 |
+
formResetHandler = function() {
|
5606 |
+
var buttons = $( this ).find( ":ui-button" );
|
5607 |
+
setTimeout(function() {
|
5608 |
+
buttons.button( "refresh" );
|
5609 |
+
}, 1 );
|
5610 |
+
},
|
5611 |
+
radioGroup = function( radio ) {
|
5612 |
+
var name = radio.name,
|
5613 |
+
form = radio.form,
|
5614 |
+
radios = $( [] );
|
5615 |
+
if ( name ) {
|
5616 |
+
if ( form ) {
|
5617 |
+
radios = $( form ).find( "[name='" + name + "']" );
|
5618 |
+
} else {
|
5619 |
+
radios = $( "[name='" + name + "']", radio.ownerDocument )
|
5620 |
+
.filter(function() {
|
5621 |
+
return !this.form;
|
5622 |
+
});
|
5623 |
+
}
|
5624 |
+
}
|
5625 |
+
return radios;
|
5626 |
+
};
|
5627 |
+
|
5628 |
+
$.widget( "ui.button", {
|
5629 |
+
options: {
|
5630 |
+
disabled: null,
|
5631 |
+
text: true,
|
5632 |
+
label: null,
|
5633 |
+
icons: {
|
5634 |
+
primary: null,
|
5635 |
+
secondary: null
|
5636 |
+
}
|
5637 |
+
},
|
5638 |
+
_create: function() {
|
5639 |
+
this.element.closest( "form" )
|
5640 |
+
.unbind( "reset.button" )
|
5641 |
+
.bind( "reset.button", formResetHandler );
|
5642 |
+
|
5643 |
+
if ( typeof this.options.disabled !== "boolean" ) {
|
5644 |
+
this.options.disabled = this.element.propAttr( "disabled" );
|
5645 |
+
}
|
5646 |
+
|
5647 |
+
this._determineButtonType();
|
5648 |
+
this.hasTitle = !!this.buttonElement.attr( "title" );
|
5649 |
+
|
5650 |
+
var self = this,
|
5651 |
+
options = this.options,
|
5652 |
+
toggleButton = this.type === "checkbox" || this.type === "radio",
|
5653 |
+
hoverClass = "ui-state-hover" + ( !toggleButton ? " ui-state-active" : "" ),
|
5654 |
+
focusClass = "ui-state-focus";
|
5655 |
+
|
5656 |
+
if ( options.label === null ) {
|
5657 |
+
options.label = this.buttonElement.html();
|
5658 |
+
}
|
5659 |
+
|
5660 |
+
if ( this.element.is( ":disabled" ) ) {
|
5661 |
+
options.disabled = true;
|
5662 |
+
}
|
5663 |
+
|
5664 |
+
this.buttonElement
|
5665 |
+
.addClass( baseClasses )
|
5666 |
+
.attr( "role", "button" )
|
5667 |
+
.bind( "mouseenter.button", function() {
|
5668 |
+
if ( options.disabled ) {
|
5669 |
+
return;
|
5670 |
+
}
|
5671 |
+
$( this ).addClass( "ui-state-hover" );
|
5672 |
+
if ( this === lastActive ) {
|
5673 |
+
$( this ).addClass( "ui-state-active" );
|
5674 |
+
}
|
5675 |
+
})
|
5676 |
+
.bind( "mouseleave.button", function() {
|
5677 |
+
if ( options.disabled ) {
|
5678 |
+
return;
|
5679 |
+
}
|
5680 |
+
$( this ).removeClass( hoverClass );
|
5681 |
+
})
|
5682 |
+
.bind( "click.button", function( event ) {
|
5683 |
+
if ( options.disabled ) {
|
5684 |
+
event.preventDefault();
|
5685 |
+
event.stopImmediatePropagation();
|
5686 |
+
}
|
5687 |
+
});
|
5688 |
+
|
5689 |
+
this.element
|
5690 |
+
.bind( "focus.button", function() {
|
5691 |
+
// no need to check disabled, focus won't be triggered anyway
|
5692 |
+
self.buttonElement.addClass( focusClass );
|
5693 |
+
})
|
5694 |
+
.bind( "blur.button", function() {
|
5695 |
+
self.buttonElement.removeClass( focusClass );
|
5696 |
+
});
|
5697 |
+
|
5698 |
+
if ( toggleButton ) {
|
5699 |
+
this.element.bind( "change.button", function() {
|
5700 |
+
if ( clickDragged ) {
|
5701 |
+
return;
|
5702 |
+
}
|
5703 |
+
self.refresh();
|
5704 |
+
});
|
5705 |
+
// if mouse moves between mousedown and mouseup (drag) set clickDragged flag
|
5706 |
+
// prevents issue where button state changes but checkbox/radio checked state
|
5707 |
+
// does not in Firefox (see ticket #6970)
|
5708 |
+
this.buttonElement
|
5709 |
+
.bind( "mousedown.button", function( event ) {
|
5710 |
+
if ( options.disabled ) {
|
5711 |
+
return;
|
5712 |
+
}
|
5713 |
+
clickDragged = false;
|
5714 |
+
startXPos = event.pageX;
|
5715 |
+
startYPos = event.pageY;
|
5716 |
+
})
|
5717 |
+
.bind( "mouseup.button", function( event ) {
|
5718 |
+
if ( options.disabled ) {
|
5719 |
+
return;
|
5720 |
+
}
|
5721 |
+
if ( startXPos !== event.pageX || startYPos !== event.pageY ) {
|
5722 |
+
clickDragged = true;
|
5723 |
+
}
|
5724 |
+
});
|
5725 |
+
}
|
5726 |
+
|
5727 |
+
if ( this.type === "checkbox" ) {
|
5728 |
+
this.buttonElement.bind( "click.button", function() {
|
5729 |
+
if ( options.disabled || clickDragged ) {
|
5730 |
+
return false;
|
5731 |
+
}
|
5732 |
+
$( this ).toggleClass( "ui-state-active" );
|
5733 |
+
self.buttonElement.attr( "aria-pressed", self.element[0].checked );
|
5734 |
+
});
|
5735 |
+
} else if ( this.type === "radio" ) {
|
5736 |
+
this.buttonElement.bind( "click.button", function() {
|
5737 |
+
if ( options.disabled || clickDragged ) {
|
5738 |
+
return false;
|
5739 |
+
}
|
5740 |
+
$( this ).addClass( "ui-state-active" );
|
5741 |
+
self.buttonElement.attr( "aria-pressed", "true" );
|
5742 |
+
|
5743 |
+
var radio = self.element[ 0 ];
|
5744 |
+
radioGroup( radio )
|
5745 |
+
.not( radio )
|
5746 |
+
.map(function() {
|
5747 |
+
return $( this ).button( "widget" )[ 0 ];
|
5748 |
+
})
|
5749 |
+
.removeClass( "ui-state-active" )
|
5750 |
+
.attr( "aria-pressed", "false" );
|
5751 |
+
});
|
5752 |
+
} else {
|
5753 |
+
this.buttonElement
|
5754 |
+
.bind( "mousedown.button", function() {
|
5755 |
+
if ( options.disabled ) {
|
5756 |
+
return false;
|
5757 |
+
}
|
5758 |
+
$( this ).addClass( "ui-state-active" );
|
5759 |
+
lastActive = this;
|
5760 |
+
$( document ).one( "mouseup", function() {
|
5761 |
+
lastActive = null;
|
5762 |
+
});
|
5763 |
+
})
|
5764 |
+
.bind( "mouseup.button", function() {
|
5765 |
+
if ( options.disabled ) {
|
5766 |
+
return false;
|
5767 |
+
}
|
5768 |
+
$( this ).removeClass( "ui-state-active" );
|
5769 |
+
})
|
5770 |
+
.bind( "keydown.button", function(event) {
|
5771 |
+
if ( options.disabled ) {
|
5772 |
+
return false;
|
5773 |
+
}
|
5774 |
+
if ( event.keyCode == $.ui.keyCode.SPACE || event.keyCode == $.ui.keyCode.ENTER ) {
|
5775 |
+
$( this ).addClass( "ui-state-active" );
|
5776 |
+
}
|
5777 |
+
})
|
5778 |
+
.bind( "keyup.button", function() {
|
5779 |
+
$( this ).removeClass( "ui-state-active" );
|
5780 |
+
});
|
5781 |
+
|
5782 |
+
if ( this.buttonElement.is("a") ) {
|
5783 |
+
this.buttonElement.keyup(function(event) {
|
5784 |
+
if ( event.keyCode === $.ui.keyCode.SPACE ) {
|
5785 |
+
// TODO pass through original event correctly (just as 2nd argument doesn't work)
|
5786 |
+
$( this ).click();
|
5787 |
+
}
|
5788 |
+
});
|
5789 |
+
}
|
5790 |
+
}
|
5791 |
+
|
5792 |
+
// TODO: pull out $.Widget's handling for the disabled option into
|
5793 |
+
// $.Widget.prototype._setOptionDisabled so it's easy to proxy and can
|
5794 |
+
// be overridden by individual plugins
|
5795 |
+
this._setOption( "disabled", options.disabled );
|
5796 |
+
this._resetButton();
|
5797 |
+
},
|
5798 |
+
|
5799 |
+
_determineButtonType: function() {
|
5800 |
+
|
5801 |
+
if ( this.element.is(":checkbox") ) {
|
5802 |
+
this.type = "checkbox";
|
5803 |
+
} else if ( this.element.is(":radio") ) {
|
5804 |
+
this.type = "radio";
|
5805 |
+
} else if ( this.element.is("input") ) {
|
5806 |
+
this.type = "input";
|
5807 |
+
} else {
|
5808 |
+
this.type = "button";
|
5809 |
+
}
|
5810 |
+
|
5811 |
+
if ( this.type === "checkbox" || this.type === "radio" ) {
|
5812 |
+
// we don't search against the document in case the element
|
5813 |
+
// is disconnected from the DOM
|
5814 |
+
var ancestor = this.element.parents().filter(":last"),
|
5815 |
+
labelSelector = "label[for='" + this.element.attr("id") + "']";
|
5816 |
+
this.buttonElement = ancestor.find( labelSelector );
|
5817 |
+
if ( !this.buttonElement.length ) {
|
5818 |
+
ancestor = ancestor.length ? ancestor.siblings() : this.element.siblings();
|
5819 |
+
this.buttonElement = ancestor.filter( labelSelector );
|
5820 |
+
if ( !this.buttonElement.length ) {
|
5821 |
+
this.buttonElement = ancestor.find( labelSelector );
|
5822 |
+
}
|
5823 |
+
}
|
5824 |
+
this.element.addClass( "ui-helper-hidden-accessible" );
|
5825 |
+
|
5826 |
+
var checked = this.element.is( ":checked" );
|
5827 |
+
if ( checked ) {
|
5828 |
+
this.buttonElement.addClass( "ui-state-active" );
|
5829 |
+
}
|
5830 |
+
this.buttonElement.attr( "aria-pressed", checked );
|
5831 |
+
} else {
|
5832 |
+
this.buttonElement = this.element;
|
5833 |
+
}
|
5834 |
+
},
|
5835 |
+
|
5836 |
+
widget: function() {
|
5837 |
+
return this.buttonElement;
|
5838 |
+
},
|
5839 |
+
|
5840 |
+
destroy: function() {
|
5841 |
+
this.element
|
5842 |
+
.removeClass( "ui-helper-hidden-accessible" );
|
5843 |
+
this.buttonElement
|
5844 |
+
.removeClass( baseClasses + " " + stateClasses + " " + typeClasses )
|
5845 |
+
.removeAttr( "role" )
|
5846 |
+
.removeAttr( "aria-pressed" )
|
5847 |
+
.html( this.buttonElement.find(".ui-button-text").html() );
|
5848 |
+
|
5849 |
+
if ( !this.hasTitle ) {
|
5850 |
+
this.buttonElement.removeAttr( "title" );
|
5851 |
+
}
|
5852 |
+
|
5853 |
+
$.Widget.prototype.destroy.call( this );
|
5854 |
+
},
|
5855 |
+
|
5856 |
+
_setOption: function( key, value ) {
|
5857 |
+
$.Widget.prototype._setOption.apply( this, arguments );
|
5858 |
+
if ( key === "disabled" ) {
|
5859 |
+
if ( value ) {
|
5860 |
+
this.element.propAttr( "disabled", true );
|
5861 |
+
} else {
|
5862 |
+
this.element.propAttr( "disabled", false );
|
5863 |
+
}
|
5864 |
+
return;
|
5865 |
+
}
|
5866 |
+
this._resetButton();
|
5867 |
+
},
|
5868 |
+
|
5869 |
+
refresh: function() {
|
5870 |
+
var isDisabled = this.element.is( ":disabled" );
|
5871 |
+
if ( isDisabled !== this.options.disabled ) {
|
5872 |
+
this._setOption( "disabled", isDisabled );
|
5873 |
+
}
|
5874 |
+
if ( this.type === "radio" ) {
|
5875 |
+
radioGroup( this.element[0] ).each(function() {
|
5876 |
+
if ( $( this ).is( ":checked" ) ) {
|
5877 |
+
$( this ).button( "widget" )
|
5878 |
+
.addClass( "ui-state-active" )
|
5879 |
+
.attr( "aria-pressed", "true" );
|
5880 |
+
} else {
|
5881 |
+
$( this ).button( "widget" )
|
5882 |
+
.removeClass( "ui-state-active" )
|
5883 |
+
.attr( "aria-pressed", "false" );
|
5884 |
+
}
|
5885 |
+
});
|
5886 |
+
} else if ( this.type === "checkbox" ) {
|
5887 |
+
if ( this.element.is( ":checked" ) ) {
|
5888 |
+
this.buttonElement
|
5889 |
+
.addClass( "ui-state-active" )
|
5890 |
+
.attr( "aria-pressed", "true" );
|
5891 |
+
} else {
|
5892 |
+
this.buttonElement
|
5893 |
+
.removeClass( "ui-state-active" )
|
5894 |
+
.attr( "aria-pressed", "false" );
|
5895 |
+
}
|
5896 |
+
}
|
5897 |
+
},
|
5898 |
+
|
5899 |
+
_resetButton: function() {
|
5900 |
+
if ( this.type === "input" ) {
|
5901 |
+
if ( this.options.label ) {
|
5902 |
+
this.element.val( this.options.label );
|
5903 |
+
}
|
5904 |
+
return;
|
5905 |
+
}
|
5906 |
+
var buttonElement = this.buttonElement.removeClass( typeClasses ),
|
5907 |
+
buttonText = $( "<span></span>", this.element[0].ownerDocument )
|
5908 |
+
.addClass( "ui-button-text" )
|
5909 |
+
.html( this.options.label )
|
5910 |
+
.appendTo( buttonElement.empty() )
|
5911 |
+
.text(),
|
5912 |
+
icons = this.options.icons,
|
5913 |
+
multipleIcons = icons.primary && icons.secondary,
|
5914 |
+
buttonClasses = [];
|
5915 |
+
|
5916 |
+
if ( icons.primary || icons.secondary ) {
|
5917 |
+
if ( this.options.text ) {
|
5918 |
+
buttonClasses.push( "ui-button-text-icon" + ( multipleIcons ? "s" : ( icons.primary ? "-primary" : "-secondary" ) ) );
|
5919 |
+
}
|
5920 |
+
|
5921 |
+
if ( icons.primary ) {
|
5922 |
+
buttonElement.prepend( "<span class='ui-button-icon-primary ui-icon " + icons.primary + "'></span>" );
|
5923 |
+
}
|
5924 |
+
|
5925 |
+
if ( icons.secondary ) {
|
5926 |
+
buttonElement.append( "<span class='ui-button-icon-secondary ui-icon " + icons.secondary + "'></span>" );
|
5927 |
+
}
|
5928 |
+
|
5929 |
+
if ( !this.options.text ) {
|
5930 |
+
buttonClasses.push( multipleIcons ? "ui-button-icons-only" : "ui-button-icon-only" );
|
5931 |
+
|
5932 |
+
if ( !this.hasTitle ) {
|
5933 |
+
buttonElement.attr( "title", buttonText );
|
5934 |
+
}
|
5935 |
+
}
|
5936 |
+
} else {
|
5937 |
+
buttonClasses.push( "ui-button-text-only" );
|
5938 |
+
}
|
5939 |
+
buttonElement.addClass( buttonClasses.join( " " ) );
|
5940 |
+
}
|
5941 |
+
});
|
5942 |
+
|
5943 |
+
$.widget( "ui.buttonset", {
|
5944 |
+
options: {
|
5945 |
+
items: ":button, :submit, :reset, :checkbox, :radio, a, :data(button)"
|
5946 |
+
},
|
5947 |
+
|
5948 |
+
_create: function() {
|
5949 |
+
this.element.addClass( "ui-buttonset" );
|
5950 |
+
},
|
5951 |
+
|
5952 |
+
_init: function() {
|
5953 |
+
this.refresh();
|
5954 |
+
},
|
5955 |
+
|
5956 |
+
_setOption: function( key, value ) {
|
5957 |
+
if ( key === "disabled" ) {
|
5958 |
+
this.buttons.button( "option", key, value );
|
5959 |
+
}
|
5960 |
+
|
5961 |
+
$.Widget.prototype._setOption.apply( this, arguments );
|
5962 |
+
},
|
5963 |
+
|
5964 |
+
refresh: function() {
|
5965 |
+
var rtl = this.element.css( "direction" ) === "rtl";
|
5966 |
+
|
5967 |
+
this.buttons = this.element.find( this.options.items )
|
5968 |
+
.filter( ":ui-button" )
|
5969 |
+
.button( "refresh" )
|
5970 |
+
.end()
|
5971 |
+
.not( ":ui-button" )
|
5972 |
+
.button()
|
5973 |
+
.end()
|
5974 |
+
.map(function() {
|
5975 |
+
return $( this ).button( "widget" )[ 0 ];
|
5976 |
+
})
|
5977 |
+
.removeClass( "ui-corner-all ui-corner-left ui-corner-right" )
|
5978 |
+
.filter( ":first" )
|
5979 |
+
.addClass( rtl ? "ui-corner-right" : "ui-corner-left" )
|
5980 |
+
.end()
|
5981 |
+
.filter( ":last" )
|
5982 |
+
.addClass( rtl ? "ui-corner-left" : "ui-corner-right" )
|
5983 |
+
.end()
|
5984 |
+
.end();
|
5985 |
+
},
|
5986 |
+
|
5987 |
+
destroy: function() {
|
5988 |
+
this.element.removeClass( "ui-buttonset" );
|
5989 |
+
this.buttons
|
5990 |
+
.map(function() {
|
5991 |
+
return $( this ).button( "widget" )[ 0 ];
|
5992 |
+
})
|
5993 |
+
.removeClass( "ui-corner-left ui-corner-right" )
|
5994 |
+
.end()
|
5995 |
+
.button( "destroy" );
|
5996 |
+
|
5997 |
+
$.Widget.prototype.destroy.call( this );
|
5998 |
+
}
|
5999 |
+
});
|
6000 |
+
|
6001 |
+
}( jQuery ) );
|
6002 |
+
/*
|
6003 |
+
* jQuery UI Dialog 1.8.17
|
6004 |
+
*
|
6005 |
+
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
|
6006 |
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
6007 |
+
* http://jquery.org/license
|
6008 |
+
*
|
6009 |
+
* http://docs.jquery.com/UI/Dialog
|
6010 |
+
*
|
6011 |
+
* Depends:
|
6012 |
+
* jquery.ui.core.js
|
6013 |
+
* jquery.ui.widget.js
|
6014 |
+
* jquery.ui.button.js
|
6015 |
+
* jquery.ui.draggable.js
|
6016 |
+
* jquery.ui.mouse.js
|
6017 |
+
* jquery.ui.position.js
|
6018 |
+
* jquery.ui.resizable.js
|
6019 |
+
*/
|
6020 |
+
(function( $, undefined ) {
|
6021 |
+
|
6022 |
+
var uiDialogClasses =
|
6023 |
+
'ui-dialog ' +
|
6024 |
+
'ui-widget ' +
|
6025 |
+
'ui-widget-content ' +
|
6026 |
+
'ui-corner-all ',
|
6027 |
+
sizeRelatedOptions = {
|
6028 |
+
buttons: true,
|
6029 |
+
height: true,
|
6030 |
+
maxHeight: true,
|
6031 |
+
maxWidth: true,
|
6032 |
+
minHeight: true,
|
6033 |
+
minWidth: true,
|
6034 |
+
width: true
|
6035 |
+
},
|
6036 |
+
resizableRelatedOptions = {
|
6037 |
+
maxHeight: true,
|
6038 |
+
maxWidth: true,
|
6039 |
+
minHeight: true,
|
6040 |
+
minWidth: true
|
6041 |
+
},
|
6042 |
+
// support for jQuery 1.3.2 - handle common attrFn methods for dialog
|
6043 |
+
attrFn = $.attrFn || {
|
6044 |
+
val: true,
|
6045 |
+
css: true,
|
6046 |
+
html: true,
|
6047 |
+
text: true,
|
6048 |
+
data: true,
|
6049 |
+
width: true,
|
6050 |
+
height: true,
|
6051 |
+
offset: true,
|
6052 |
+
click: true
|
6053 |
+
};
|
6054 |
+
|
6055 |
+
$.widget("ui.dialog", {
|
6056 |
+
options: {
|
6057 |
+
autoOpen: true,
|
6058 |
+
buttons: {},
|
6059 |
+
closeOnEscape: true,
|
6060 |
+
closeText: 'close',
|
6061 |
+
dialogClass: '',
|
6062 |
+
draggable: true,
|
6063 |
+
hide: null,
|
6064 |
+
height: 'auto',
|
6065 |
+
maxHeight: false,
|
6066 |
+
maxWidth: false,
|
6067 |
+
minHeight: 150,
|
6068 |
+
minWidth: 150,
|
6069 |
+
modal: false,
|
6070 |
+
position: {
|
6071 |
+
my: 'center',
|
6072 |
+
at: 'center',
|
6073 |
+
collision: 'fit',
|
6074 |
+
// ensure that the titlebar is never outside the document
|
6075 |
+
using: function(pos) {
|
6076 |
+
var topOffset = $(this).css(pos).offset().top;
|
6077 |
+
if (topOffset < 0) {
|
6078 |
+
$(this).css('top', pos.top - topOffset);
|
6079 |
+
}
|
6080 |
+
}
|
6081 |
+
},
|
6082 |
+
resizable: true,
|
6083 |
+
show: null,
|
6084 |
+
stack: true,
|
6085 |
+
title: '',
|
6086 |
+
width: 300,
|
6087 |
+
zIndex: 1000
|
6088 |
+
},
|
6089 |
+
|
6090 |
+
_create: function() {
|
6091 |
+
this.originalTitle = this.element.attr('title');
|
6092 |
+
// #5742 - .attr() might return a DOMElement
|
6093 |
+
if ( typeof this.originalTitle !== "string" ) {
|
6094 |
+
this.originalTitle = "";
|
6095 |
+
}
|
6096 |
+
|
6097 |
+
this.options.title = this.options.title || this.originalTitle;
|
6098 |
+
var self = this,
|
6099 |
+
options = self.options,
|
6100 |
+
|
6101 |
+
title = options.title || ' ',
|
6102 |
+
titleId = $.ui.dialog.getTitleId(self.element),
|
6103 |
+
|
6104 |
+
uiDialog = (self.uiDialog = $('<div></div>'))
|
6105 |
+
.appendTo(document.body)
|
6106 |
+
.hide()
|
6107 |
+
.addClass(uiDialogClasses + options.dialogClass)
|
6108 |
+
.css({
|
6109 |
+
zIndex: options.zIndex
|
6110 |
+
})
|
6111 |
+
// setting tabIndex makes the div focusable
|
6112 |
+
// setting outline to 0 prevents a border on focus in Mozilla
|
6113 |
+
.attr('tabIndex', -1).css('outline', 0).keydown(function(event) {
|
6114 |
+
if (options.closeOnEscape && !event.isDefaultPrevented() && event.keyCode &&
|
6115 |
+
event.keyCode === $.ui.keyCode.ESCAPE) {
|
6116 |
+
|
6117 |
+
self.close(event);
|
6118 |
+
event.preventDefault();
|
6119 |
+
}
|
6120 |
+
})
|
6121 |
+
.attr({
|
6122 |
+
role: 'dialog',
|
6123 |
+
'aria-labelledby': titleId
|
6124 |
+
})
|
6125 |
+
.mousedown(function(event) {
|
6126 |
+
self.moveToTop(false, event);
|
6127 |
+
}),
|
6128 |
+
|
6129 |
+
uiDialogContent = self.element
|
6130 |
+
.show()
|
6131 |
+
.removeAttr('title')
|
6132 |
+
.addClass(
|
6133 |
+
'ui-dialog-content ' +
|
6134 |
+
'ui-widget-content')
|
6135 |
+
.appendTo(uiDialog),
|
6136 |
+
|
6137 |
+
uiDialogTitlebar = (self.uiDialogTitlebar = $('<div></div>'))
|
6138 |
+
.addClass(
|
6139 |
+
'ui-dialog-titlebar ' +
|
6140 |
+
'ui-widget-header ' +
|
6141 |
+
'ui-corner-all ' +
|
6142 |
+
'ui-helper-clearfix'
|
6143 |
+
)
|
6144 |
+
.prependTo(uiDialog),
|
6145 |
+
|
6146 |
+
uiDialogTitlebarClose = $('<a href="#"></a>')
|
6147 |
+
.addClass(
|
6148 |
+
'ui-dialog-titlebar-close ' +
|
6149 |
+
'ui-corner-all'
|
6150 |
+
)
|
6151 |
+
.attr('role', 'button')
|
6152 |
+
.hover(
|
6153 |
+
function() {
|
6154 |
+
uiDialogTitlebarClose.addClass('ui-state-hover');
|
6155 |
+
},
|
6156 |
+
function() {
|
6157 |
+
uiDialogTitlebarClose.removeClass('ui-state-hover');
|
6158 |
+
}
|
6159 |
+
)
|
6160 |
+
.focus(function() {
|
6161 |
+
uiDialogTitlebarClose.addClass('ui-state-focus');
|
6162 |
+
})
|
6163 |
+
.blur(function() {
|
6164 |
+
uiDialogTitlebarClose.removeClass('ui-state-focus');
|
6165 |
+
})
|
6166 |
+
.click(function(event) {
|
6167 |
+
self.close(event);
|
6168 |
+
return false;
|
6169 |
+
})
|
6170 |
+
.appendTo(uiDialogTitlebar),
|
6171 |
+
|
6172 |
+
uiDialogTitlebarCloseText = (self.uiDialogTitlebarCloseText = $('<span></span>'))
|
6173 |
+
.addClass(
|
6174 |
+
'ui-icon ' +
|
6175 |
+
'ui-icon-closethick'
|
6176 |
+
)
|
6177 |
+
.text(options.closeText)
|
6178 |
+
.appendTo(uiDialogTitlebarClose),
|
6179 |
+
|
6180 |
+
uiDialogTitle = $('<span></span>')
|
6181 |
+
.addClass('ui-dialog-title')
|
6182 |
+
.attr('id', titleId)
|
6183 |
+
.html(title)
|
6184 |
+
.prependTo(uiDialogTitlebar);
|
6185 |
+
|
6186 |
+
//handling of deprecated beforeclose (vs beforeClose) option
|
6187 |
+
//Ticket #4669 http://dev.jqueryui.com/ticket/4669
|
6188 |
+
//TODO: remove in 1.9pre
|
6189 |
+
if ($.isFunction(options.beforeclose) && !$.isFunction(options.beforeClose)) {
|
6190 |
+
options.beforeClose = options.beforeclose;
|
6191 |
+
}
|
6192 |
+
|
6193 |
+
uiDialogTitlebar.find("*").add(uiDialogTitlebar).disableSelection();
|
6194 |
+
|
6195 |
+
if (options.draggable && $.fn.draggable) {
|
6196 |
+
self._makeDraggable();
|
6197 |
+
}
|
6198 |
+
if (options.resizable && $.fn.resizable) {
|
6199 |
+
self._makeResizable();
|
6200 |
+
}
|
6201 |
+
|
6202 |
+
self._createButtons(options.buttons);
|
6203 |
+
self._isOpen = false;
|
6204 |
+
|
6205 |
+
if ($.fn.bgiframe) {
|
6206 |
+
uiDialog.bgiframe();
|
6207 |
+
}
|
6208 |
+
},
|
6209 |
+
|
6210 |
+
_init: function() {
|
6211 |
+
if ( this.options.autoOpen ) {
|
6212 |
+
this.open();
|
6213 |
+
}
|
6214 |
+
},
|
6215 |
+
|
6216 |
+
destroy: function() {
|
6217 |
+
var self = this;
|
6218 |
+
|
6219 |
+
if (self.overlay) {
|
6220 |
+
self.overlay.destroy();
|
6221 |
+
}
|
6222 |
+
self.uiDialog.hide();
|
6223 |
+
self.element
|
6224 |
+
.unbind('.dialog')
|
6225 |
+
.removeData('dialog')
|
6226 |
+
.removeClass('ui-dialog-content ui-widget-content')
|
6227 |
+
.hide().appendTo('body');
|
6228 |
+
self.uiDialog.remove();
|
6229 |
+
|
6230 |
+
if (self.originalTitle) {
|
6231 |
+
self.element.attr('title', self.originalTitle);
|
6232 |
+
}
|
6233 |
+
|
6234 |
+
return self;
|
6235 |
+
},
|
6236 |
+
|
6237 |
+
widget: function() {
|
6238 |
+
return this.uiDialog;
|
6239 |
+
},
|
6240 |
+
|
6241 |
+
close: function(event) {
|
6242 |
+
var self = this,
|
6243 |
+
maxZ, thisZ;
|
6244 |
+
|
6245 |
+
if (false === self._trigger('beforeClose', event)) {
|
6246 |
+
return;
|
6247 |
+
}
|
6248 |
+
|
6249 |
+
if (self.overlay) {
|
6250 |
+
self.overlay.destroy();
|
6251 |
+
}
|
6252 |
+
self.uiDialog.unbind('keypress.ui-dialog');
|
6253 |
+
|
6254 |
+
self._isOpen = false;
|
6255 |
+
|
6256 |
+
if (self.options.hide) {
|
6257 |
+
self.uiDialog.hide(self.options.hide, function() {
|
6258 |
+
self._trigger('close', event);
|
6259 |
+
});
|
6260 |
+
} else {
|
6261 |
+
self.uiDialog.hide();
|
6262 |
+
self._trigger('close', event);
|
6263 |
+
}
|
6264 |
+
|
6265 |
+
$.ui.dialog.overlay.resize();
|
6266 |
+
|
6267 |
+
// adjust the maxZ to allow other modal dialogs to continue to work (see #4309)
|
6268 |
+
if (self.options.modal) {
|
6269 |
+
maxZ = 0;
|
6270 |
+
$('.ui-dialog').each(function() {
|
6271 |
+
if (this !== self.uiDialog[0]) {
|
6272 |
+
thisZ = $(this).css('z-index');
|
6273 |
+
if(!isNaN(thisZ)) {
|
6274 |
+
maxZ = Math.max(maxZ, thisZ);
|
6275 |
+
}
|
6276 |
+
}
|
6277 |
+
});
|
6278 |
+
$.ui.dialog.maxZ = maxZ;
|
6279 |
+
}
|
6280 |
+
|
6281 |
+
return self;
|
6282 |
+
},
|
6283 |
+
|
6284 |
+
isOpen: function() {
|
6285 |
+
return this._isOpen;
|
6286 |
+
},
|
6287 |
+
|
6288 |
+
// the force parameter allows us to move modal dialogs to their correct
|
6289 |
+
// position on open
|
6290 |
+
moveToTop: function(force, event) {
|
6291 |
+
var self = this,
|
6292 |
+
options = self.options,
|
6293 |
+
saveScroll;
|
6294 |
+
|
6295 |
+
if ((options.modal && !force) ||
|
6296 |
+
(!options.stack && !options.modal)) {
|
6297 |
+
return self._trigger('focus', event);
|
6298 |
+
}
|
6299 |
+
|
6300 |
+
if (options.zIndex > $.ui.dialog.maxZ) {
|
6301 |
+
$.ui.dialog.maxZ = options.zIndex;
|
6302 |
+
}
|
6303 |
+
if (self.overlay) {
|
6304 |
+
$.ui.dialog.maxZ += 1;
|
6305 |
+
self.overlay.$el.css('z-index', $.ui.dialog.overlay.maxZ = $.ui.dialog.maxZ);
|
6306 |
+
}
|
6307 |
+
|
6308 |
+
//Save and then restore scroll since Opera 9.5+ resets when parent z-Index is changed.
|
6309 |
+
// http://ui.jquery.com/bugs/ticket/3193
|
6310 |
+
saveScroll = { scrollTop: self.element.scrollTop(), scrollLeft: self.element.scrollLeft() };
|
6311 |
+
$.ui.dialog.maxZ += 1;
|
6312 |
+
self.uiDialog.css('z-index', $.ui.dialog.maxZ);
|
6313 |
+
self.element.attr(saveScroll);
|
6314 |
+
self._trigger('focus', event);
|
6315 |
+
|
6316 |
+
return self;
|
6317 |
+
},
|
6318 |
+
|
6319 |
+
open: function() {
|
6320 |
+
if (this._isOpen) { return; }
|
6321 |
+
|
6322 |
+
var self = this,
|
6323 |
+
options = self.options,
|
6324 |
+
uiDialog = self.uiDialog;
|
6325 |
+
|
6326 |
+
self.overlay = options.modal ? new $.ui.dialog.overlay(self) : null;
|
6327 |
+
self._size();
|
6328 |
+
self._position(options.position);
|
6329 |
+
uiDialog.show(options.show);
|
6330 |
+
self.moveToTop(true);
|
6331 |
+
|
6332 |
+
// prevent tabbing out of modal dialogs
|
6333 |
+
if ( options.modal ) {
|
6334 |
+
uiDialog.bind( "keydown.ui-dialog", function( event ) {
|
6335 |
+
if ( event.keyCode !== $.ui.keyCode.TAB ) {
|
6336 |
+
return;
|
6337 |
+
}
|
6338 |
+
|
6339 |
+
var tabbables = $(':tabbable', this),
|
6340 |
+
first = tabbables.filter(':first'),
|
6341 |
+
last = tabbables.filter(':last');
|
6342 |
+
|
6343 |
+
if (event.target === last[0] && !event.shiftKey) {
|
6344 |
+
first.focus(1);
|
6345 |
+
return false;
|
6346 |
+
} else if (event.target === first[0] && event.shiftKey) {
|
6347 |
+
last.focus(1);
|
6348 |
+
return false;
|
6349 |
+
}
|
6350 |
+
});
|
6351 |
+
}
|
6352 |
+
|
6353 |
+
// set focus to the first tabbable element in the content area or the first button
|
6354 |
+
// if there are no tabbable elements, set focus on the dialog itself
|
6355 |
+
$(self.element.find(':tabbable').get().concat(
|
6356 |
+
uiDialog.find('.ui-dialog-buttonpane :tabbable').get().concat(
|
6357 |
+
uiDialog.get()))).eq(0).focus();
|
6358 |
+
|
6359 |
+
self._isOpen = true;
|
6360 |
+
self._trigger('open');
|
6361 |
+
|
6362 |
+
return self;
|
6363 |
+
},
|
6364 |
+
|
6365 |
+
_createButtons: function(buttons) {
|
6366 |
+
var self = this,
|
6367 |
+
hasButtons = false,
|
6368 |
+
uiDialogButtonPane = $('<div></div>')
|
6369 |
+
.addClass(
|
6370 |
+
'ui-dialog-buttonpane ' +
|
6371 |
+
'ui-widget-content ' +
|
6372 |
+
'ui-helper-clearfix'
|
6373 |
+
),
|
6374 |
+
uiButtonSet = $( "<div></div>" )
|
6375 |
+
.addClass( "ui-dialog-buttonset" )
|
6376 |
+
.appendTo( uiDialogButtonPane );
|
6377 |
+
|
6378 |
+
// if we already have a button pane, remove it
|
6379 |
+
self.uiDialog.find('.ui-dialog-buttonpane').remove();
|
6380 |
+
|
6381 |
+
if (typeof buttons === 'object' && buttons !== null) {
|
6382 |
+
$.each(buttons, function() {
|
6383 |
+
return !(hasButtons = true);
|
6384 |
+
});
|
6385 |
+
}
|
6386 |
+
if (hasButtons) {
|
6387 |
+
$.each(buttons, function(name, props) {
|
6388 |
+
props = $.isFunction( props ) ?
|
6389 |
+
{ click: props, text: name } :
|
6390 |
+
props;
|
6391 |
+
var button = $('<button type="button"></button>')
|
6392 |
+
.click(function() {
|
6393 |
+
props.click.apply(self.element[0], arguments);
|
6394 |
+
})
|
6395 |
+
.appendTo(uiButtonSet);
|
6396 |
+
// can't use .attr( props, true ) with jQuery 1.3.2.
|
6397 |
+
$.each( props, function( key, value ) {
|
6398 |
+
if ( key === "click" ) {
|
6399 |
+
return;
|
6400 |
+
}
|
6401 |
+
if ( key in attrFn ) {
|
6402 |
+
button[ key ]( value );
|
6403 |
+
} else {
|
6404 |
+
button.attr( key, value );
|
6405 |
+
}
|
6406 |
+
});
|
6407 |
+
if ($.fn.button) {
|
6408 |
+
button.button();
|
6409 |
+
}
|
6410 |
+
});
|
6411 |
+
uiDialogButtonPane.appendTo(self.uiDialog);
|
6412 |
+
}
|
6413 |
+
},
|
6414 |
+
|
6415 |
+
_makeDraggable: function() {
|
6416 |
+
var self = this,
|
6417 |
+
options = self.options,
|
6418 |
+
doc = $(document),
|
6419 |
+
heightBeforeDrag;
|
6420 |
+
|
6421 |
+
function filteredUi(ui) {
|
6422 |
+
return {
|
6423 |
+
position: ui.position,
|
6424 |
+
offset: ui.offset
|
6425 |
+
};
|
6426 |
+
}
|
6427 |
+
|
6428 |
+
self.uiDialog.draggable({
|
6429 |
+
cancel: '.ui-dialog-content, .ui-dialog-titlebar-close',
|
6430 |
+
handle: '.ui-dialog-titlebar',
|
6431 |
+
containment: 'document',
|
6432 |
+
start: function(event, ui) {
|
6433 |
+
heightBeforeDrag = options.height === "auto" ? "auto" : $(this).height();
|
6434 |
+
$(this).height($(this).height()).addClass("ui-dialog-dragging");
|
6435 |
+
self._trigger('dragStart', event, filteredUi(ui));
|
6436 |
+
},
|
6437 |
+
drag: function(event, ui) {
|
6438 |
+
self._trigger('drag', event, filteredUi(ui));
|
6439 |
+
},
|
6440 |
+
stop: function(event, ui) {
|
6441 |
+
options.position = [ui.position.left - doc.scrollLeft(),
|
6442 |
+
ui.position.top - doc.scrollTop()];
|
6443 |
+
$(this).removeClass("ui-dialog-dragging").height(heightBeforeDrag);
|
6444 |
+
self._trigger('dragStop', event, filteredUi(ui));
|
6445 |
+
$.ui.dialog.overlay.resize();
|
6446 |
+
}
|
6447 |
+
});
|
6448 |
+
},
|
6449 |
+
|
6450 |
+
_makeResizable: function(handles) {
|
6451 |
+
handles = (handles === undefined ? this.options.resizable : handles);
|
6452 |
+
var self = this,
|
6453 |
+
options = self.options,
|
6454 |
+
// .ui-resizable has position: relative defined in the stylesheet
|
6455 |
+
// but dialogs have to use absolute or fixed positioning
|
6456 |
+
position = self.uiDialog.css('position'),
|
6457 |
+
resizeHandles = (typeof handles === 'string' ?
|
6458 |
+
handles :
|
6459 |
+
'n,e,s,w,se,sw,ne,nw'
|
6460 |
+
);
|
6461 |
+
|
6462 |
+
function filteredUi(ui) {
|
6463 |
+
return {
|
6464 |
+
originalPosition: ui.originalPosition,
|
6465 |
+
originalSize: ui.originalSize,
|
6466 |
+
position: ui.position,
|
6467 |
+
size: ui.size
|
6468 |
+
};
|
6469 |
+
}
|
6470 |
+
|
6471 |
+
self.uiDialog.resizable({
|
6472 |
+
cancel: '.ui-dialog-content',
|
6473 |
+
containment: 'document',
|
6474 |
+
alsoResize: self.element,
|
6475 |
+
maxWidth: options.maxWidth,
|
6476 |
+
maxHeight: options.maxHeight,
|
6477 |
+
minWidth: options.minWidth,
|
6478 |
+
minHeight: self._minHeight(),
|
6479 |
+
handles: resizeHandles,
|
6480 |
+
start: function(event, ui) {
|
6481 |
+
$(this).addClass("ui-dialog-resizing");
|
6482 |
+
self._trigger('resizeStart', event, filteredUi(ui));
|
6483 |
+
},
|
6484 |
+
resize: function(event, ui) {
|
6485 |
+
self._trigger('resize', event, filteredUi(ui));
|
6486 |
+
},
|
6487 |
+
stop: function(event, ui) {
|
6488 |
+
$(this).removeClass("ui-dialog-resizing");
|
6489 |
+
options.height = $(this).height();
|
6490 |
+
options.width = $(this).width();
|
6491 |
+
self._trigger('resizeStop', event, filteredUi(ui));
|
6492 |
+
$.ui.dialog.overlay.resize();
|
6493 |
+
}
|
6494 |
+
})
|
6495 |
+
.css('position', position)
|
6496 |
+
.find('.ui-resizable-se').addClass('ui-icon ui-icon-grip-diagonal-se');
|
6497 |
+
},
|
6498 |
+
|
6499 |
+
_minHeight: function() {
|
6500 |
+
var options = this.options;
|
6501 |
+
|
6502 |
+
if (options.height === 'auto') {
|
6503 |
+
return options.minHeight;
|
6504 |
+
} else {
|
6505 |
+
return Math.min(options.minHeight, options.height);
|
6506 |
+
}
|
6507 |
+
},
|
6508 |
+
|
6509 |
+
_position: function(position) {
|
6510 |
+
var myAt = [],
|
6511 |
+
offset = [0, 0],
|
6512 |
+
isVisible;
|
6513 |
+
|
6514 |
+
if (position) {
|
6515 |
+
// deep extending converts arrays to objects in jQuery <= 1.3.2 :-(
|
6516 |
+
// if (typeof position == 'string' || $.isArray(position)) {
|
6517 |
+
// myAt = $.isArray(position) ? position : position.split(' ');
|
6518 |
+
|
6519 |
+
if (typeof position === 'string' || (typeof position === 'object' && '0' in position)) {
|
6520 |
+
myAt = position.split ? position.split(' ') : [position[0], position[1]];
|
6521 |
+
if (myAt.length === 1) {
|
6522 |
+
myAt[1] = myAt[0];
|
6523 |
+
}
|
6524 |
+
|
6525 |
+
$.each(['left', 'top'], function(i, offsetPosition) {
|
6526 |
+
if (+myAt[i] === myAt[i]) {
|
6527 |
+
offset[i] = myAt[i];
|
6528 |
+
myAt[i] = offsetPosition;
|
6529 |
+
}
|
6530 |
+
});
|
6531 |
+
|
6532 |
+
position = {
|
6533 |
+
my: myAt.join(" "),
|
6534 |
+
at: myAt.join(" "),
|
6535 |
+
offset: offset.join(" ")
|
6536 |
+
};
|
6537 |
+
}
|
6538 |
+
|
6539 |
+
position = $.extend({}, $.ui.dialog.prototype.options.position, position);
|
6540 |
+
} else {
|
6541 |
+
position = $.ui.dialog.prototype.options.position;
|
6542 |
+
}
|
6543 |
+
|
6544 |
+
// need to show the dialog to get the actual offset in the position plugin
|
6545 |
+
isVisible = this.uiDialog.is(':visible');
|
6546 |
+
if (!isVisible) {
|
6547 |
+
this.uiDialog.show();
|
6548 |
+
}
|
6549 |
+
this.uiDialog
|
6550 |
+
// workaround for jQuery bug #5781 http://dev.jquery.com/ticket/5781
|
6551 |
+
.css({ top: 0, left: 0 })
|
6552 |
+
.position($.extend({ of: window }, position));
|
6553 |
+
if (!isVisible) {
|
6554 |
+
this.uiDialog.hide();
|
6555 |
+
}
|
6556 |
+
},
|
6557 |
+
|
6558 |
+
_setOptions: function( options ) {
|
6559 |
+
var self = this,
|
6560 |
+
resizableOptions = {},
|
6561 |
+
resize = false;
|
6562 |
+
|
6563 |
+
$.each( options, function( key, value ) {
|
6564 |
+
self._setOption( key, value );
|
6565 |
+
|
6566 |
+
if ( key in sizeRelatedOptions ) {
|
6567 |
+
resize = true;
|
6568 |
+
}
|
6569 |
+
if ( key in resizableRelatedOptions ) {
|
6570 |
+
resizableOptions[ key ] = value;
|
6571 |
+
}
|
6572 |
+
});
|
6573 |
+
|
6574 |
+
if ( resize ) {
|
6575 |
+
this._size();
|
6576 |
+
}
|
6577 |
+
if ( this.uiDialog.is( ":data(resizable)" ) ) {
|
6578 |
+
this.uiDialog.resizable( "option", resizableOptions );
|
6579 |
+
}
|
6580 |
+
},
|
6581 |
+
|
6582 |
+
_setOption: function(key, value){
|
6583 |
+
var self = this,
|
6584 |
+
uiDialog = self.uiDialog;
|
6585 |
+
|
6586 |
+
switch (key) {
|
6587 |
+
//handling of deprecated beforeclose (vs beforeClose) option
|
6588 |
+
//Ticket #4669 http://dev.jqueryui.com/ticket/4669
|
6589 |
+
//TODO: remove in 1.9pre
|
6590 |
+
case "beforeclose":
|
6591 |
+
key = "beforeClose";
|
6592 |
+
break;
|
6593 |
+
case "buttons":
|
6594 |
+
self._createButtons(value);
|
6595 |
+
break;
|
6596 |
+
case "closeText":
|
6597 |
+
// ensure that we always pass a string
|
6598 |
+
self.uiDialogTitlebarCloseText.text("" + value);
|
6599 |
+
break;
|
6600 |
+
case "dialogClass":
|
6601 |
+
uiDialog
|
6602 |
+
.removeClass(self.options.dialogClass)
|
6603 |
+
.addClass(uiDialogClasses + value);
|
6604 |
+
break;
|
6605 |
+
case "disabled":
|
6606 |
+
if (value) {
|
6607 |
+
uiDialog.addClass('ui-dialog-disabled');
|
6608 |
+
} else {
|
6609 |
+
uiDialog.removeClass('ui-dialog-disabled');
|
6610 |
+
}
|
6611 |
+
break;
|
6612 |
+
case "draggable":
|
6613 |
+
var isDraggable = uiDialog.is( ":data(draggable)" );
|
6614 |
+
if ( isDraggable && !value ) {
|
6615 |
+
uiDialog.draggable( "destroy" );
|
6616 |
+
}
|
6617 |
+
|
6618 |
+
if ( !isDraggable && value ) {
|
6619 |
+
self._makeDraggable();
|
6620 |
+
}
|
6621 |
+
break;
|
6622 |
+
case "position":
|
6623 |
+
self._position(value);
|
6624 |
+
break;
|
6625 |
+
case "resizable":
|
6626 |
+
// currently resizable, becoming non-resizable
|
6627 |
+
var isResizable = uiDialog.is( ":data(resizable)" );
|
6628 |
+
if (isResizable && !value) {
|
6629 |
+
uiDialog.resizable('destroy');
|
6630 |
+
}
|
6631 |
+
|
6632 |
+
// currently resizable, changing handles
|
6633 |
+
if (isResizable && typeof value === 'string') {
|
6634 |
+
uiDialog.resizable('option', 'handles', value);
|
6635 |
+
}
|
6636 |
+
|
6637 |
+
// currently non-resizable, becoming resizable
|
6638 |
+
if (!isResizable && value !== false) {
|
6639 |
+
self._makeResizable(value);
|
6640 |
+
}
|
6641 |
+
break;
|
6642 |
+
case "title":
|
6643 |
+
// convert whatever was passed in o a string, for html() to not throw up
|
6644 |
+
$(".ui-dialog-title", self.uiDialogTitlebar).html("" + (value || ' '));
|
6645 |
+
break;
|
6646 |
+
}
|
6647 |
+
|
6648 |
+
$.Widget.prototype._setOption.apply(self, arguments);
|
6649 |
+
},
|
6650 |
+
|
6651 |
+
_size: function() {
|
6652 |
+
/* If the user has resized the dialog, the .ui-dialog and .ui-dialog-content
|
6653 |
+
* divs will both have width and height set, so we need to reset them
|
6654 |
+
*/
|
6655 |
+
var options = this.options,
|
6656 |
+
nonContentHeight,
|
6657 |
+
minContentHeight,
|
6658 |
+
isVisible = this.uiDialog.is( ":visible" );
|
6659 |
+
|
6660 |
+
// reset content sizing
|
6661 |
+
this.element.show().css({
|
6662 |
+
width: 'auto',
|
6663 |
+
minHeight: 0,
|
6664 |
+
height: 0
|
6665 |
+
});
|
6666 |
+
|
6667 |
+
if (options.minWidth > options.width) {
|
6668 |
+
options.width = options.minWidth;
|
6669 |
+
}
|
6670 |
+
|
6671 |
+
// reset wrapper sizing
|
6672 |
+
// determine the height of all the non-content elements
|
6673 |
+
nonContentHeight = this.uiDialog.css({
|
6674 |
+
height: 'auto',
|
6675 |
+
width: options.width
|
6676 |
+
})
|
6677 |
+
.height();
|
6678 |
+
minContentHeight = Math.max( 0, options.minHeight - nonContentHeight );
|
6679 |
+
|
6680 |
+
if ( options.height === "auto" ) {
|
6681 |
+
// only needed for IE6 support
|
6682 |
+
if ( $.support.minHeight ) {
|
6683 |
+
this.element.css({
|
6684 |
+
minHeight: minContentHeight,
|
6685 |
+
height: "auto"
|
6686 |
+
});
|
6687 |
+
} else {
|
6688 |
+
this.uiDialog.show();
|
6689 |
+
var autoHeight = this.element.css( "height", "auto" ).height();
|
6690 |
+
if ( !isVisible ) {
|
6691 |
+
this.uiDialog.hide();
|
6692 |
+
}
|
6693 |
+
this.element.height( Math.max( autoHeight, minContentHeight ) );
|
6694 |
+
}
|
6695 |
+
} else {
|
6696 |
+
this.element.height( Math.max( options.height - nonContentHeight, 0 ) );
|
6697 |
+
}
|
6698 |
+
|
6699 |
+
if (this.uiDialog.is(':data(resizable)')) {
|
6700 |
+
this.uiDialog.resizable('option', 'minHeight', this._minHeight());
|
6701 |
+
}
|
6702 |
+
}
|
6703 |
+
});
|
6704 |
+
|
6705 |
+
$.extend($.ui.dialog, {
|
6706 |
+
version: "1.8.17",
|
6707 |
+
|
6708 |
+
uuid: 0,
|
6709 |
+
maxZ: 0,
|
6710 |
+
|
6711 |
+
getTitleId: function($el) {
|
6712 |
+
var id = $el.attr('id');
|
6713 |
+
if (!id) {
|
6714 |
+
this.uuid += 1;
|
6715 |
+
id = this.uuid;
|
6716 |
+
}
|
6717 |
+
return 'ui-dialog-title-' + id;
|
6718 |
+
},
|
6719 |
+
|
6720 |
+
overlay: function(dialog) {
|
6721 |
+
this.$el = $.ui.dialog.overlay.create(dialog);
|
6722 |
+
}
|
6723 |
+
});
|
6724 |
+
|
6725 |
+
$.extend($.ui.dialog.overlay, {
|
6726 |
+
instances: [],
|
6727 |
+
// reuse old instances due to IE memory leak with alpha transparency (see #5185)
|
6728 |
+
oldInstances: [],
|
6729 |
+
maxZ: 0,
|
6730 |
+
events: $.map('focus,mousedown,mouseup,keydown,keypress,click'.split(','),
|
6731 |
+
function(event) { return event + '.dialog-overlay'; }).join(' '),
|
6732 |
+
create: function(dialog) {
|
6733 |
+
if (this.instances.length === 0) {
|
6734 |
+
// prevent use of anchors and inputs
|
6735 |
+
// we use a setTimeout in case the overlay is created from an
|
6736 |
+
// event that we're going to be cancelling (see #2804)
|
6737 |
+
setTimeout(function() {
|
6738 |
+
// handle $(el).dialog().dialog('close') (see #4065)
|
6739 |
+
if ($.ui.dialog.overlay.instances.length) {
|
6740 |
+
$(document).bind($.ui.dialog.overlay.events, function(event) {
|
6741 |
+
// stop events if the z-index of the target is < the z-index of the overlay
|
6742 |
+
// we cannot return true when we don't want to cancel the event (#3523)
|
6743 |
+
if ($(event.target).zIndex() < $.ui.dialog.overlay.maxZ) {
|
6744 |
+
return false;
|
6745 |
+
}
|
6746 |
+
});
|
6747 |
+
}
|
6748 |
+
}, 1);
|
6749 |
+
|
6750 |
+
// allow closing by pressing the escape key
|
6751 |
+
$(document).bind('keydown.dialog-overlay', function(event) {
|
6752 |
+
if (dialog.options.closeOnEscape && !event.isDefaultPrevented() && event.keyCode &&
|
6753 |
+
event.keyCode === $.ui.keyCode.ESCAPE) {
|
6754 |
+
|
6755 |
+
dialog.close(event);
|
6756 |
+
event.preventDefault();
|
6757 |
+
}
|
6758 |
+
});
|
6759 |
+
|
6760 |
+
// handle window resize
|
6761 |
+
$(window).bind('resize.dialog-overlay', $.ui.dialog.overlay.resize);
|
6762 |
+
}
|
6763 |
+
|
6764 |
+
var $el = (this.oldInstances.pop() || $('<div></div>').addClass('ui-widget-overlay'))
|
6765 |
+
.appendTo(document.body)
|
6766 |
+
.css({
|
6767 |
+
width: this.width(),
|
6768 |
+
height: this.height()
|
6769 |
+
});
|
6770 |
+
|
6771 |
+
if ($.fn.bgiframe) {
|
6772 |
+
$el.bgiframe();
|
6773 |
+
}
|
6774 |
+
|
6775 |
+
this.instances.push($el);
|
6776 |
+
return $el;
|
6777 |
+
},
|
6778 |
+
|
6779 |
+
destroy: function($el) {
|
6780 |
+
var indexOf = $.inArray($el, this.instances);
|
6781 |
+
if (indexOf != -1){
|
6782 |
+
this.oldInstances.push(this.instances.splice(indexOf, 1)[0]);
|
6783 |
+
}
|
6784 |
+
|
6785 |
+
if (this.instances.length === 0) {
|
6786 |
+
$([document, window]).unbind('.dialog-overlay');
|
6787 |
+
}
|
6788 |
+
|
6789 |
+
$el.remove();
|
6790 |
+
|
6791 |
+
// adjust the maxZ to allow other modal dialogs to continue to work (see #4309)
|
6792 |
+
var maxZ = 0;
|
6793 |
+
$.each(this.instances, function() {
|
6794 |
+
maxZ = Math.max(maxZ, this.css('z-index'));
|
6795 |
+
});
|
6796 |
+
this.maxZ = maxZ;
|
6797 |
+
},
|
6798 |
+
|
6799 |
+
height: function() {
|
6800 |
+
var scrollHeight,
|
6801 |
+
offsetHeight;
|
6802 |
+
// handle IE 6
|
6803 |
+
if ($.browser.msie && $.browser.version < 7) {
|
6804 |
+
scrollHeight = Math.max(
|
6805 |
+
document.documentElement.scrollHeight,
|
6806 |
+
document.body.scrollHeight
|
6807 |
+
);
|
6808 |
+
offsetHeight = Math.max(
|
6809 |
+
document.documentElement.offsetHeight,
|
6810 |
+
document.body.offsetHeight
|
6811 |
+
);
|
6812 |
+
|
6813 |
+
if (scrollHeight < offsetHeight) {
|
6814 |
+
return $(window).height() + 'px';
|
6815 |
+
} else {
|
6816 |
+
return scrollHeight + 'px';
|
6817 |
+
}
|
6818 |
+
// handle "good" browsers
|
6819 |
+
} else {
|
6820 |
+
return $(document).height() + 'px';
|
6821 |
+
}
|
6822 |
+
},
|
6823 |
+
|
6824 |
+
width: function() {
|
6825 |
+
var scrollWidth,
|
6826 |
+
offsetWidth;
|
6827 |
+
// handle IE
|
6828 |
+
if ( $.browser.msie ) {
|
6829 |
+
scrollWidth = Math.max(
|
6830 |
+
document.documentElement.scrollWidth,
|
6831 |
+
document.body.scrollWidth
|
6832 |
+
);
|
6833 |
+
offsetWidth = Math.max(
|
6834 |
+
document.documentElement.offsetWidth,
|
6835 |
+
document.body.offsetWidth
|
6836 |
+
);
|
6837 |
+
|
6838 |
+
if (scrollWidth < offsetWidth) {
|
6839 |
+
return $(window).width() + 'px';
|
6840 |
+
} else {
|
6841 |
+
return scrollWidth + 'px';
|
6842 |
+
}
|
6843 |
+
// handle "good" browsers
|
6844 |
+
} else {
|
6845 |
+
return $(document).width() + 'px';
|
6846 |
+
}
|
6847 |
+
},
|
6848 |
+
|
6849 |
+
resize: function() {
|
6850 |
+
/* If the dialog is draggable and the user drags it past the
|
6851 |
+
* right edge of the window, the document becomes wider so we
|
6852 |
+
* need to stretch the overlay. If the user then drags the
|
6853 |
+
* dialog back to the left, the document will become narrower,
|
6854 |
+
* so we need to shrink the overlay to the appropriate size.
|
6855 |
+
* This is handled by shrinking the overlay before setting it
|
6856 |
+
* to the full document size.
|
6857 |
+
*/
|
6858 |
+
var $overlays = $([]);
|
6859 |
+
$.each($.ui.dialog.overlay.instances, function() {
|
6860 |
+
$overlays = $overlays.add(this);
|
6861 |
+
});
|
6862 |
+
|
6863 |
+
$overlays.css({
|
6864 |
+
width: 0,
|
6865 |
+
height: 0
|
6866 |
+
}).css({
|
6867 |
+
width: $.ui.dialog.overlay.width(),
|
6868 |
+
height: $.ui.dialog.overlay.height()
|
6869 |
+
});
|
6870 |
+
}
|
6871 |
+
});
|
6872 |
+
|
6873 |
+
$.extend($.ui.dialog.overlay.prototype, {
|
6874 |
+
destroy: function() {
|
6875 |
+
$.ui.dialog.overlay.destroy(this.$el);
|
6876 |
+
}
|
6877 |
+
});
|
6878 |
+
|
6879 |
+
}(jQuery));
|
6880 |
+
/*
|
6881 |
+
* jQuery UI Slider 1.8.17
|
6882 |
+
*
|
6883 |
+
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
|
6884 |
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
6885 |
+
* http://jquery.org/license
|
6886 |
+
*
|
6887 |
+
* http://docs.jquery.com/UI/Slider
|
6888 |
+
*
|
6889 |
+
* Depends:
|
6890 |
+
* jquery.ui.core.js
|
6891 |
+
* jquery.ui.mouse.js
|
6892 |
+
* jquery.ui.widget.js
|
6893 |
+
*/
|
6894 |
+
(function( $, undefined ) {
|
6895 |
+
|
6896 |
+
// number of pages in a slider
|
6897 |
+
// (how many times can you page up/down to go through the whole range)
|
6898 |
+
var numPages = 5;
|
6899 |
+
|
6900 |
+
$.widget( "ui.slider", $.ui.mouse, {
|
6901 |
+
|
6902 |
+
widgetEventPrefix: "slide",
|
6903 |
+
|
6904 |
+
options: {
|
6905 |
+
animate: false,
|
6906 |
+
distance: 0,
|
6907 |
+
max: 100,
|
6908 |
+
min: 0,
|
6909 |
+
orientation: "horizontal",
|
6910 |
+
range: false,
|
6911 |
+
step: 1,
|
6912 |
+
value: 0,
|
6913 |
+
values: null
|
6914 |
+
},
|
6915 |
+
|
6916 |
+
_create: function() {
|
6917 |
+
var self = this,
|
6918 |
+
o = this.options,
|
6919 |
+
existingHandles = this.element.find( ".ui-slider-handle" ).addClass( "ui-state-default ui-corner-all" ),
|
6920 |
+
handle = "<a class='ui-slider-handle ui-state-default ui-corner-all' href='#'></a>",
|
6921 |
+
handleCount = ( o.values && o.values.length ) || 1,
|
6922 |
+
handles = [];
|
6923 |
+
|
6924 |
+
this._keySliding = false;
|
6925 |
+
this._mouseSliding = false;
|
6926 |
+
this._animateOff = true;
|
6927 |
+
this._handleIndex = null;
|
6928 |
+
this._detectOrientation();
|
6929 |
+
this._mouseInit();
|
6930 |
+
|
6931 |
+
this.element
|
6932 |
+
.addClass( "ui-slider" +
|
6933 |
+
" ui-slider-" + this.orientation +
|
6934 |
+
" ui-widget" +
|
6935 |
+
" ui-widget-content" +
|
6936 |
+
" ui-corner-all" +
|
6937 |
+
( o.disabled ? " ui-slider-disabled ui-disabled" : "" ) );
|
6938 |
+
|
6939 |
+
this.range = $([]);
|
6940 |
+
|
6941 |
+
if ( o.range ) {
|
6942 |
+
if ( o.range === true ) {
|
6943 |
+
if ( !o.values ) {
|
6944 |
+
o.values = [ this._valueMin(), this._valueMin() ];
|
6945 |
+
}
|
6946 |
+
if ( o.values.length && o.values.length !== 2 ) {
|
6947 |
+
o.values = [ o.values[0], o.values[0] ];
|
6948 |
+
}
|
6949 |
+
}
|
6950 |
+
|
6951 |
+
this.range = $( "<div></div>" )
|
6952 |
+
.appendTo( this.element )
|
6953 |
+
.addClass( "ui-slider-range" +
|
6954 |
+
// note: this isn't the most fittingly semantic framework class for this element,
|
6955 |
+
// but worked best visually with a variety of themes
|
6956 |
+
" ui-widget-header" +
|
6957 |
+
( ( o.range === "min" || o.range === "max" ) ? " ui-slider-range-" + o.range : "" ) );
|
6958 |
+
}
|
6959 |
+
|
6960 |
+
for ( var i = existingHandles.length; i < handleCount; i += 1 ) {
|
6961 |
+
handles.push( handle );
|
6962 |
+
}
|
6963 |
+
|
6964 |
+
this.handles = existingHandles.add( $( handles.join( "" ) ).appendTo( self.element ) );
|
6965 |
+
|
6966 |
+
this.handle = this.handles.eq( 0 );
|
6967 |
+
|
6968 |
+
this.handles.add( this.range ).filter( "a" )
|
6969 |
+
.click(function( event ) {
|
6970 |
+
event.preventDefault();
|
6971 |
+
})
|
6972 |
+
.hover(function() {
|
6973 |
+
if ( !o.disabled ) {
|
6974 |
+
$( this ).addClass( "ui-state-hover" );
|
6975 |
+
}
|
6976 |
+
}, function() {
|
6977 |
+
$( this ).removeClass( "ui-state-hover" );
|
6978 |
+
})
|
6979 |
+
.focus(function() {
|
6980 |
+
if ( !o.disabled ) {
|
6981 |
+
$( ".ui-slider .ui-state-focus" ).removeClass( "ui-state-focus" );
|
6982 |
+
$( this ).addClass( "ui-state-focus" );
|
6983 |
+
} else {
|
6984 |
+
$( this ).blur();
|
6985 |
+
}
|
6986 |
+
})
|
6987 |
+
.blur(function() {
|
6988 |
+
$( this ).removeClass( "ui-state-focus" );
|
6989 |
+
});
|
6990 |
+
|
6991 |
+
this.handles.each(function( i ) {
|
6992 |
+
$( this ).data( "index.ui-slider-handle", i );
|
6993 |
+
});
|
6994 |
+
|
6995 |
+
this.handles
|
6996 |
+
.keydown(function( event ) {
|
6997 |
+
var ret = true,
|
6998 |
+
index = $( this ).data( "index.ui-slider-handle" ),
|
6999 |
+
allowed,
|
7000 |
+
curVal,
|
7001 |
+
newVal,
|
7002 |
+
step;
|
7003 |
+
|
7004 |
+
if ( self.options.disabled ) {
|
7005 |
+
return;
|
7006 |
+
}
|
7007 |
+
|
7008 |
+
switch ( event.keyCode ) {
|
7009 |
+
case $.ui.keyCode.HOME:
|
7010 |
+
case $.ui.keyCode.END:
|
7011 |
+
case $.ui.keyCode.PAGE_UP:
|
7012 |
+
case $.ui.keyCode.PAGE_DOWN:
|
7013 |
+
case $.ui.keyCode.UP:
|
7014 |
+
case $.ui.keyCode.RIGHT:
|
7015 |
+
case $.ui.keyCode.DOWN:
|
7016 |
+
case $.ui.keyCode.LEFT:
|
7017 |
+
ret = false;
|
7018 |
+
if ( !self._keySliding ) {
|
7019 |
+
self._keySliding = true;
|
7020 |
+
$( this ).addClass( "ui-state-active" );
|
7021 |
+
allowed = self._start( event, index );
|
7022 |
+
if ( allowed === false ) {
|
7023 |
+
return;
|
7024 |
+
}
|
7025 |
+
}
|
7026 |
+
break;
|
7027 |
+
}
|
7028 |
+
|
7029 |
+
step = self.options.step;
|
7030 |
+
if ( self.options.values && self.options.values.length ) {
|
7031 |
+
curVal = newVal = self.values( index );
|
7032 |
+
} else {
|
7033 |
+
curVal = newVal = self.value();
|
7034 |
+
}
|
7035 |
+
|
7036 |
+
switch ( event.keyCode ) {
|
7037 |
+
case $.ui.keyCode.HOME:
|
7038 |
+
newVal = self._valueMin();
|
7039 |
+
break;
|
7040 |
+
case $.ui.keyCode.END:
|
7041 |
+
newVal = self._valueMax();
|
7042 |
+
break;
|
7043 |
+
case $.ui.keyCode.PAGE_UP:
|
7044 |
+
newVal = self._trimAlignValue( curVal + ( (self._valueMax() - self._valueMin()) / numPages ) );
|
7045 |
+
break;
|
7046 |
+
case $.ui.keyCode.PAGE_DOWN:
|
7047 |
+
newVal = self._trimAlignValue( curVal - ( (self._valueMax() - self._valueMin()) / numPages ) );
|
7048 |
+
break;
|
7049 |
+
case $.ui.keyCode.UP:
|
7050 |
+
case $.ui.keyCode.RIGHT:
|
7051 |
+
if ( curVal === self._valueMax() ) {
|
7052 |
+
return;
|
7053 |
+
}
|
7054 |
+
newVal = self._trimAlignValue( curVal + step );
|
7055 |
+
break;
|
7056 |
+
case $.ui.keyCode.DOWN:
|
7057 |
+
case $.ui.keyCode.LEFT:
|
7058 |
+
if ( curVal === self._valueMin() ) {
|
7059 |
+
return;
|
7060 |
+
}
|
7061 |
+
newVal = self._trimAlignValue( curVal - step );
|
7062 |
+
break;
|
7063 |
+
}
|
7064 |
+
|
7065 |
+
self._slide( event, index, newVal );
|
7066 |
+
|
7067 |
+
return ret;
|
7068 |
+
|
7069 |
+
})
|
7070 |
+
.keyup(function( event ) {
|
7071 |
+
var index = $( this ).data( "index.ui-slider-handle" );
|
7072 |
+
|
7073 |
+
if ( self._keySliding ) {
|
7074 |
+
self._keySliding = false;
|
7075 |
+
self._stop( event, index );
|
7076 |
+
self._change( event, index );
|
7077 |
+
$( this ).removeClass( "ui-state-active" );
|
7078 |
+
}
|
7079 |
+
|
7080 |
+
});
|
7081 |
+
|
7082 |
+
this._refreshValue();
|
7083 |
+
|
7084 |
+
this._animateOff = false;
|
7085 |
+
},
|
7086 |
+
|
7087 |
+
destroy: function() {
|
7088 |
+
this.handles.remove();
|
7089 |
+
this.range.remove();
|
7090 |
+
|
7091 |
+
this.element
|
7092 |
+
.removeClass( "ui-slider" +
|
7093 |
+
" ui-slider-horizontal" +
|
7094 |
+
" ui-slider-vertical" +
|
7095 |
+
" ui-slider-disabled" +
|
7096 |
+
" ui-widget" +
|
7097 |
+
" ui-widget-content" +
|
7098 |
+
" ui-corner-all" )
|
7099 |
+
.removeData( "slider" )
|
7100 |
+
.unbind( ".slider" );
|
7101 |
+
|
7102 |
+
this._mouseDestroy();
|
7103 |
+
|
7104 |
+
return this;
|
7105 |
+
},
|
7106 |
+
|
7107 |
+
_mouseCapture: function( event ) {
|
7108 |
+
var o = this.options,
|
7109 |
+
position,
|
7110 |
+
normValue,
|
7111 |
+
distance,
|
7112 |
+
closestHandle,
|
7113 |
+
self,
|
7114 |
+
index,
|
7115 |
+
allowed,
|
7116 |
+
offset,
|
7117 |
+
mouseOverHandle;
|
7118 |
+
|
7119 |
+
if ( o.disabled ) {
|
7120 |
+
return false;
|
7121 |
+
}
|
7122 |
+
|
7123 |
+
this.elementSize = {
|
7124 |
+
width: this.element.outerWidth(),
|
7125 |
+
height: this.element.outerHeight()
|
7126 |
+
};
|
7127 |
+
this.elementOffset = this.element.offset();
|
7128 |
+
|
7129 |
+
position = { x: event.pageX, y: event.pageY };
|
7130 |
+
normValue = this._normValueFromMouse( position );
|
7131 |
+
distance = this._valueMax() - this._valueMin() + 1;
|
7132 |
+
self = this;
|
7133 |
+
this.handles.each(function( i ) {
|
7134 |
+
var thisDistance = Math.abs( normValue - self.values(i) );
|
7135 |
+
if ( distance > thisDistance ) {
|
7136 |
+
distance = thisDistance;
|
7137 |
+
closestHandle = $( this );
|
7138 |
+
index = i;
|
7139 |
+
}
|
7140 |
+
});
|
7141 |
+
|
7142 |
+
// workaround for bug #3736 (if both handles of a range are at 0,
|
7143 |
+
// the first is always used as the one with least distance,
|
7144 |
+
// and moving it is obviously prevented by preventing negative ranges)
|
7145 |
+
if( o.range === true && this.values(1) === o.min ) {
|
7146 |
+
index += 1;
|
7147 |
+
closestHandle = $( this.handles[index] );
|
7148 |
+
}
|
7149 |
+
|
7150 |
+
allowed = this._start( event, index );
|
7151 |
+
if ( allowed === false ) {
|
7152 |
+
return false;
|
7153 |
+
}
|
7154 |
+
this._mouseSliding = true;
|
7155 |
+
|
7156 |
+
self._handleIndex = index;
|
7157 |
+
|
7158 |
+
closestHandle
|
7159 |
+
.addClass( "ui-state-active" )
|
7160 |
+
.focus();
|
7161 |
+
|
7162 |
+
offset = closestHandle.offset();
|
7163 |
+
mouseOverHandle = !$( event.target ).parents().andSelf().is( ".ui-slider-handle" );
|
7164 |
+
this._clickOffset = mouseOverHandle ? { left: 0, top: 0 } : {
|
7165 |
+
left: event.pageX - offset.left - ( closestHandle.width() / 2 ),
|
7166 |
+
top: event.pageY - offset.top -
|
7167 |
+
( closestHandle.height() / 2 ) -
|
7168 |
+
( parseInt( closestHandle.css("borderTopWidth"), 10 ) || 0 ) -
|
7169 |
+
( parseInt( closestHandle.css("borderBottomWidth"), 10 ) || 0) +
|
7170 |
+
( parseInt( closestHandle.css("marginTop"), 10 ) || 0)
|
7171 |
+
};
|
7172 |
+
|
7173 |
+
if ( !this.handles.hasClass( "ui-state-hover" ) ) {
|
7174 |
+
this._slide( event, index, normValue );
|
7175 |
+
}
|
7176 |
+
this._animateOff = true;
|
7177 |
+
return true;
|
7178 |
+
},
|
7179 |
+
|
7180 |
+
_mouseStart: function( event ) {
|
7181 |
+
return true;
|
7182 |
+
},
|
7183 |
+
|
7184 |
+
_mouseDrag: function( event ) {
|
7185 |
+
var position = { x: event.pageX, y: event.pageY },
|
7186 |
+
normValue = this._normValueFromMouse( position );
|
7187 |
+
|
7188 |
+
this._slide( event, this._handleIndex, normValue );
|
7189 |
+
|
7190 |
+
return false;
|
7191 |
+
},
|
7192 |
+
|
7193 |
+
_mouseStop: function( event ) {
|
7194 |
+
this.handles.removeClass( "ui-state-active" );
|
7195 |
+
this._mouseSliding = false;
|
7196 |
+
|
7197 |
+
this._stop( event, this._handleIndex );
|
7198 |
+
this._change( event, this._handleIndex );
|
7199 |
+
|
7200 |
+
this._handleIndex = null;
|
7201 |
+
this._clickOffset = null;
|
7202 |
+
this._animateOff = false;
|
7203 |
+
|
7204 |
+
return false;
|
7205 |
+
},
|
7206 |
+
|
7207 |
+
_detectOrientation: function() {
|
7208 |
+
this.orientation = ( this.options.orientation === "vertical" ) ? "vertical" : "horizontal";
|
7209 |
+
},
|
7210 |
+
|
7211 |
+
_normValueFromMouse: function( position ) {
|
7212 |
+
var pixelTotal,
|
7213 |
+
pixelMouse,
|
7214 |
+
percentMouse,
|
7215 |
+
valueTotal,
|
7216 |
+
valueMouse;
|
7217 |
+
|
7218 |
+
if ( this.orientation === "horizontal" ) {
|
7219 |
+
pixelTotal = this.elementSize.width;
|
7220 |
+
pixelMouse = position.x - this.elementOffset.left - ( this._clickOffset ? this._clickOffset.left : 0 );
|
7221 |
+
} else {
|
7222 |
+
pixelTotal = this.elementSize.height;
|
7223 |
+
pixelMouse = position.y - this.elementOffset.top - ( this._clickOffset ? this._clickOffset.top : 0 );
|
7224 |
+
}
|
7225 |
+
|
7226 |
+
percentMouse = ( pixelMouse / pixelTotal );
|
7227 |
+
if ( percentMouse > 1 ) {
|
7228 |
+
percentMouse = 1;
|
7229 |
+
}
|
7230 |
+
if ( percentMouse < 0 ) {
|
7231 |
+
percentMouse = 0;
|
7232 |
+
}
|
7233 |
+
if ( this.orientation === "vertical" ) {
|
7234 |
+
percentMouse = 1 - percentMouse;
|
7235 |
+
}
|
7236 |
+
|
7237 |
+
valueTotal = this._valueMax() - this._valueMin();
|
7238 |
+
valueMouse = this._valueMin() + percentMouse * valueTotal;
|
7239 |
+
|
7240 |
+
return this._trimAlignValue( valueMouse );
|
7241 |
+
},
|
7242 |
+
|
7243 |
+
_start: function( event, index ) {
|
7244 |
+
var uiHash = {
|
7245 |
+
handle: this.handles[ index ],
|
7246 |
+
value: this.value()
|
7247 |
+
};
|
7248 |
+
if ( this.options.values && this.options.values.length ) {
|
7249 |
+
uiHash.value = this.values( index );
|
7250 |
+
uiHash.values = this.values();
|
7251 |
+
}
|
7252 |
+
return this._trigger( "start", event, uiHash );
|
7253 |
+
},
|
7254 |
+
|
7255 |
+
_slide: function( event, index, newVal ) {
|
7256 |
+
var otherVal,
|
7257 |
+
newValues,
|
7258 |
+
allowed;
|
7259 |
+
|
7260 |
+
if ( this.options.values && this.options.values.length ) {
|
7261 |
+
otherVal = this.values( index ? 0 : 1 );
|
7262 |
+
|
7263 |
+
if ( ( this.options.values.length === 2 && this.options.range === true ) &&
|
7264 |
+
( ( index === 0 && newVal > otherVal) || ( index === 1 && newVal < otherVal ) )
|
7265 |
+
) {
|
7266 |
+
newVal = otherVal;
|
7267 |
+
}
|
7268 |
+
|
7269 |
+
if ( newVal !== this.values( index ) ) {
|
7270 |
+
newValues = this.values();
|
7271 |
+
newValues[ index ] = newVal;
|
7272 |
+
// A slide can be canceled by returning false from the slide callback
|
7273 |
+
allowed = this._trigger( "slide", event, {
|
7274 |
+
handle: this.handles[ index ],
|
7275 |
+
value: newVal,
|
7276 |
+
values: newValues
|
7277 |
+
} );
|
7278 |
+
otherVal = this.values( index ? 0 : 1 );
|
7279 |
+
if ( allowed !== false ) {
|
7280 |
+
this.values( index, newVal, true );
|
7281 |
+
}
|
7282 |
+
}
|
7283 |
+
} else {
|
7284 |
+
if ( newVal !== this.value() ) {
|
7285 |
+
// A slide can be canceled by returning false from the slide callback
|
7286 |
+
allowed = this._trigger( "slide", event, {
|
7287 |
+
handle: this.handles[ index ],
|
7288 |
+
value: newVal
|
7289 |
+
} );
|
7290 |
+
if ( allowed !== false ) {
|
7291 |
+
this.value( newVal );
|
7292 |
+
}
|
7293 |
+
}
|
7294 |
+
}
|
7295 |
+
},
|
7296 |
+
|
7297 |
+
_stop: function( event, index ) {
|
7298 |
+
var uiHash = {
|
7299 |
+
handle: this.handles[ index ],
|
7300 |
+
value: this.value()
|
7301 |
+
};
|
7302 |
+
if ( this.options.values && this.options.values.length ) {
|
7303 |
+
uiHash.value = this.values( index );
|
7304 |
+
uiHash.values = this.values();
|
7305 |
+
}
|
7306 |
+
|
7307 |
+
this._trigger( "stop", event, uiHash );
|
7308 |
+
},
|
7309 |
+
|
7310 |
+
_change: function( event, index ) {
|
7311 |
+
if ( !this._keySliding && !this._mouseSliding ) {
|
7312 |
+
var uiHash = {
|
7313 |
+
handle: this.handles[ index ],
|
7314 |
+
value: this.value()
|
7315 |
+
};
|
7316 |
+
if ( this.options.values && this.options.values.length ) {
|
7317 |
+
uiHash.value = this.values( index );
|
7318 |
+
uiHash.values = this.values();
|
7319 |
+
}
|
7320 |
+
|
7321 |
+
this._trigger( "change", event, uiHash );
|
7322 |
+
}
|
7323 |
+
},
|
7324 |
+
|
7325 |
+
value: function( newValue ) {
|
7326 |
+
if ( arguments.length ) {
|
7327 |
+
this.options.value = this._trimAlignValue( newValue );
|
7328 |
+
this._refreshValue();
|
7329 |
+
this._change( null, 0 );
|
7330 |
+
return;
|
7331 |
+
}
|
7332 |
+
|
7333 |
+
return this._value();
|
7334 |
+
},
|
7335 |
+
|
7336 |
+
values: function( index, newValue ) {
|
7337 |
+
var vals,
|
7338 |
+
newValues,
|
7339 |
+
i;
|
7340 |
+
|
7341 |
+
if ( arguments.length > 1 ) {
|
7342 |
+
this.options.values[ index ] = this._trimAlignValue( newValue );
|
7343 |
+
this._refreshValue();
|
7344 |
+
this._change( null, index );
|
7345 |
+
return;
|
7346 |
+
}
|
7347 |
+
|
7348 |
+
if ( arguments.length ) {
|
7349 |
+
if ( $.isArray( arguments[ 0 ] ) ) {
|
7350 |
+
vals = this.options.values;
|
7351 |
+
newValues = arguments[ 0 ];
|
7352 |
+
for ( i = 0; i < vals.length; i += 1 ) {
|
7353 |
+
vals[ i ] = this._trimAlignValue( newValues[ i ] );
|
7354 |
+
this._change( null, i );
|
7355 |
+
}
|
7356 |
+
this._refreshValue();
|
7357 |
+
} else {
|
7358 |
+
if ( this.options.values && this.options.values.length ) {
|
7359 |
+
return this._values( index );
|
7360 |
+
} else {
|
7361 |
+
return this.value();
|
7362 |
+
}
|
7363 |
+
}
|
7364 |
+
} else {
|
7365 |
+
return this._values();
|
7366 |
+
}
|
7367 |
+
},
|
7368 |
+
|
7369 |
+
_setOption: function( key, value ) {
|
7370 |
+
var i,
|
7371 |
+
valsLength = 0;
|
7372 |
+
|
7373 |
+
if ( $.isArray( this.options.values ) ) {
|
7374 |
+
valsLength = this.options.values.length;
|
7375 |
+
}
|
7376 |
+
|
7377 |
+
$.Widget.prototype._setOption.apply( this, arguments );
|
7378 |
+
|
7379 |
+
switch ( key ) {
|
7380 |
+
case "disabled":
|
7381 |
+
if ( value ) {
|
7382 |
+
this.handles.filter( ".ui-state-focus" ).blur();
|
7383 |
+
this.handles.removeClass( "ui-state-hover" );
|
7384 |
+
this.handles.propAttr( "disabled", true );
|
7385 |
+
this.element.addClass( "ui-disabled" );
|
7386 |
+
} else {
|
7387 |
+
this.handles.propAttr( "disabled", false );
|
7388 |
+
this.element.removeClass( "ui-disabled" );
|
7389 |
+
}
|
7390 |
+
break;
|
7391 |
+
case "orientation":
|
7392 |
+
this._detectOrientation();
|
7393 |
+
this.element
|
7394 |
+
.removeClass( "ui-slider-horizontal ui-slider-vertical" )
|
7395 |
+
.addClass( "ui-slider-" + this.orientation );
|
7396 |
+
this._refreshValue();
|
7397 |
+
break;
|
7398 |
+
case "value":
|
7399 |
+
this._animateOff = true;
|
7400 |
+
this._refreshValue();
|
7401 |
+
this._change( null, 0 );
|
7402 |
+
this._animateOff = false;
|
7403 |
+
break;
|
7404 |
+
case "values":
|
7405 |
+
this._animateOff = true;
|
7406 |
+
this._refreshValue();
|
7407 |
+
for ( i = 0; i < valsLength; i += 1 ) {
|
7408 |
+
this._change( null, i );
|
7409 |
+
}
|
7410 |
+
this._animateOff = false;
|
7411 |
+
break;
|
7412 |
+
}
|
7413 |
+
},
|
7414 |
+
|
7415 |
+
//internal value getter
|
7416 |
+
// _value() returns value trimmed by min and max, aligned by step
|
7417 |
+
_value: function() {
|
7418 |
+
var val = this.options.value;
|
7419 |
+
val = this._trimAlignValue( val );
|
7420 |
+
|
7421 |
+
return val;
|
7422 |
+
},
|
7423 |
+
|
7424 |
+
//internal values getter
|
7425 |
+
// _values() returns array of values trimmed by min and max, aligned by step
|
7426 |
+
// _values( index ) returns single value trimmed by min and max, aligned by step
|
7427 |
+
_values: function( index ) {
|
7428 |
+
var val,
|
7429 |
+
vals,
|
7430 |
+
i;
|
7431 |
+
|
7432 |
+
if ( arguments.length ) {
|
7433 |
+
val = this.options.values[ index ];
|
7434 |
+
val = this._trimAlignValue( val );
|
7435 |
+
|
7436 |
+
return val;
|
7437 |
+
} else {
|
7438 |
+
// .slice() creates a copy of the array
|
7439 |
+
// this copy gets trimmed by min and max and then returned
|
7440 |
+
vals = this.options.values.slice();
|
7441 |
+
for ( i = 0; i < vals.length; i+= 1) {
|
7442 |
+
vals[ i ] = this._trimAlignValue( vals[ i ] );
|
7443 |
+
}
|
7444 |
+
|
7445 |
+
return vals;
|
7446 |
+
}
|
7447 |
+
},
|
7448 |
+
|
7449 |
+
// returns the step-aligned value that val is closest to, between (inclusive) min and max
|
7450 |
+
_trimAlignValue: function( val ) {
|
7451 |
+
if ( val <= this._valueMin() ) {
|
7452 |
+
return this._valueMin();
|
7453 |
+
}
|
7454 |
+
if ( val >= this._valueMax() ) {
|
7455 |
+
return this._valueMax();
|
7456 |
+
}
|
7457 |
+
var step = ( this.options.step > 0 ) ? this.options.step : 1,
|
7458 |
+
valModStep = (val - this._valueMin()) % step,
|
7459 |
+
alignValue = val - valModStep;
|
7460 |
+
|
7461 |
+
if ( Math.abs(valModStep) * 2 >= step ) {
|
7462 |
+
alignValue += ( valModStep > 0 ) ? step : ( -step );
|
7463 |
+
}
|
7464 |
+
|
7465 |
+
// Since JavaScript has problems with large floats, round
|
7466 |
+
// the final value to 5 digits after the decimal point (see #4124)
|
7467 |
+
return parseFloat( alignValue.toFixed(5) );
|
7468 |
+
},
|
7469 |
+
|
7470 |
+
_valueMin: function() {
|
7471 |
+
return this.options.min;
|
7472 |
+
},
|
7473 |
+
|
7474 |
+
_valueMax: function() {
|
7475 |
+
return this.options.max;
|
7476 |
+
},
|
7477 |
+
|
7478 |
+
_refreshValue: function() {
|
7479 |
+
var oRange = this.options.range,
|
7480 |
+
o = this.options,
|
7481 |
+
self = this,
|
7482 |
+
animate = ( !this._animateOff ) ? o.animate : false,
|
7483 |
+
valPercent,
|
7484 |
+
_set = {},
|
7485 |
+
lastValPercent,
|
7486 |
+
value,
|
7487 |
+
valueMin,
|
7488 |
+
valueMax;
|
7489 |
+
|
7490 |
+
if ( this.options.values && this.options.values.length ) {
|
7491 |
+
this.handles.each(function( i, j ) {
|
7492 |
+
valPercent = ( self.values(i) - self._valueMin() ) / ( self._valueMax() - self._valueMin() ) * 100;
|
7493 |
+
_set[ self.orientation === "horizontal" ? "left" : "bottom" ] = valPercent + "%";
|
7494 |
+
$( this ).stop( 1, 1 )[ animate ? "animate" : "css" ]( _set, o.animate );
|
7495 |
+
if ( self.options.range === true ) {
|
7496 |
+
if ( self.orientation === "horizontal" ) {
|
7497 |
+
if ( i === 0 ) {
|
7498 |
+
self.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { left: valPercent + "%" }, o.animate );
|
7499 |
+
}
|
7500 |
+
if ( i === 1 ) {
|
7501 |
+
self.range[ animate ? "animate" : "css" ]( { width: ( valPercent - lastValPercent ) + "%" }, { queue: false, duration: o.animate } );
|
7502 |
+
}
|
7503 |
+
} else {
|
7504 |
+
if ( i === 0 ) {
|
7505 |
+
self.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { bottom: ( valPercent ) + "%" }, o.animate );
|
7506 |
+
}
|
7507 |
+
if ( i === 1 ) {
|
7508 |
+
self.range[ animate ? "animate" : "css" ]( { height: ( valPercent - lastValPercent ) + "%" }, { queue: false, duration: o.animate } );
|
7509 |
+
}
|
7510 |
+
}
|
7511 |
+
}
|
7512 |
+
lastValPercent = valPercent;
|
7513 |
+
});
|
7514 |
+
} else {
|
7515 |
+
value = this.value();
|
7516 |
+
valueMin = this._valueMin();
|
7517 |
+
valueMax = this._valueMax();
|
7518 |
+
valPercent = ( valueMax !== valueMin ) ?
|
7519 |
+
( value - valueMin ) / ( valueMax - valueMin ) * 100 :
|
7520 |
+
0;
|
7521 |
+
_set[ self.orientation === "horizontal" ? "left" : "bottom" ] = valPercent + "%";
|
7522 |
+
this.handle.stop( 1, 1 )[ animate ? "animate" : "css" ]( _set, o.animate );
|
7523 |
+
|
7524 |
+
if ( oRange === "min" && this.orientation === "horizontal" ) {
|
7525 |
+
this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { width: valPercent + "%" }, o.animate );
|
7526 |
+
}
|
7527 |
+
if ( oRange === "max" && this.orientation === "horizontal" ) {
|
7528 |
+
this.range[ animate ? "animate" : "css" ]( { width: ( 100 - valPercent ) + "%" }, { queue: false, duration: o.animate } );
|
7529 |
+
}
|
7530 |
+
if ( oRange === "min" && this.orientation === "vertical" ) {
|
7531 |
+
this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { height: valPercent + "%" }, o.animate );
|
7532 |
+
}
|
7533 |
+
if ( oRange === "max" && this.orientation === "vertical" ) {
|
7534 |
+
this.range[ animate ? "animate" : "css" ]( { height: ( 100 - valPercent ) + "%" }, { queue: false, duration: o.animate } );
|
7535 |
+
}
|
7536 |
+
}
|
7537 |
+
}
|
7538 |
+
|
7539 |
+
});
|
7540 |
+
|
7541 |
+
$.extend( $.ui.slider, {
|
7542 |
+
version: "1.8.17"
|
7543 |
+
});
|
7544 |
+
|
7545 |
+
}(jQuery));
|
7546 |
+
/*
|
7547 |
+
* jQuery UI Tabs 1.8.17
|
7548 |
+
*
|
7549 |
+
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
|
7550 |
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
7551 |
+
* http://jquery.org/license
|
7552 |
+
*
|
7553 |
+
* http://docs.jquery.com/UI/Tabs
|
7554 |
+
*
|
7555 |
+
* Depends:
|
7556 |
+
* jquery.ui.core.js
|
7557 |
+
* jquery.ui.widget.js
|
7558 |
+
*/
|
7559 |
+
(function( $, undefined ) {
|
7560 |
+
|
7561 |
+
var tabId = 0,
|
7562 |
+
listId = 0;
|
7563 |
+
|
7564 |
+
function getNextTabId() {
|
7565 |
+
return ++tabId;
|
7566 |
+
}
|
7567 |
+
|
7568 |
+
function getNextListId() {
|
7569 |
+
return ++listId;
|
7570 |
+
}
|
7571 |
+
|
7572 |
+
$.widget( "ui.tabs", {
|
7573 |
+
options: {
|
7574 |
+
add: null,
|
7575 |
+
ajaxOptions: null,
|
7576 |
+
cache: false,
|
7577 |
+
cookie: null, // e.g. { expires: 7, path: '/', domain: 'jquery.com', secure: true }
|
7578 |
+
collapsible: false,
|
7579 |
+
disable: null,
|
7580 |
+
disabled: [],
|
7581 |
+
enable: null,
|
7582 |
+
event: "click",
|
7583 |
+
fx: null, // e.g. { height: 'toggle', opacity: 'toggle', duration: 200 }
|
7584 |
+
idPrefix: "ui-tabs-",
|
7585 |
+
load: null,
|
7586 |
+
panelTemplate: "<div></div>",
|
7587 |
+
remove: null,
|
7588 |
+
select: null,
|
7589 |
+
show: null,
|
7590 |
+
spinner: "<em>Loading…</em>",
|
7591 |
+
tabTemplate: "<li><a href='#{href}'><span>#{label}</span></a></li>"
|
7592 |
+
},
|
7593 |
+
|
7594 |
+
_create: function() {
|
7595 |
+
this._tabify( true );
|
7596 |
+
},
|
7597 |
+
|
7598 |
+
_setOption: function( key, value ) {
|
7599 |
+
if ( key == "selected" ) {
|
7600 |
+
if (this.options.collapsible && value == this.options.selected ) {
|
7601 |
+
return;
|
7602 |
+
}
|
7603 |
+
this.select( value );
|
7604 |
+
} else {
|
7605 |
+
this.options[ key ] = value;
|
7606 |
+
this._tabify();
|
7607 |
+
}
|
7608 |
+
},
|
7609 |
+
|
7610 |
+
_tabId: function( a ) {
|
7611 |
+
return a.title && a.title.replace( /\s/g, "_" ).replace( /[^\w\u00c0-\uFFFF-]/g, "" ) ||
|
7612 |
+
this.options.idPrefix + getNextTabId();
|
7613 |
+
},
|
7614 |
+
|
7615 |
+
_sanitizeSelector: function( hash ) {
|
7616 |
+
// we need this because an id may contain a ":"
|
7617 |
+
return hash.replace( /:/g, "\\:" );
|
7618 |
+
},
|
7619 |
+
|
7620 |
+
_cookie: function() {
|
7621 |
+
var cookie = this.cookie ||
|
7622 |
+
( this.cookie = this.options.cookie.name || "ui-tabs-" + getNextListId() );
|
7623 |
+
return $.cookie.apply( null, [ cookie ].concat( $.makeArray( arguments ) ) );
|
7624 |
+
},
|
7625 |
+
|
7626 |
+
_ui: function( tab, panel ) {
|
7627 |
+
return {
|
7628 |
+
tab: tab,
|
7629 |
+
panel: panel,
|
7630 |
+
index: this.anchors.index( tab )
|
7631 |
+
};
|
7632 |
+
},
|
7633 |
+
|
7634 |
+
_cleanup: function() {
|
7635 |
+
// restore all former loading tabs labels
|
7636 |
+
this.lis.filter( ".ui-state-processing" )
|
7637 |
+
.removeClass( "ui-state-processing" )
|
7638 |
+
.find( "span:data(label.tabs)" )
|
7639 |
+
.each(function() {
|
7640 |
+
var el = $( this );
|
7641 |
+
el.html( el.data( "label.tabs" ) ).removeData( "label.tabs" );
|
7642 |
+
});
|
7643 |
+
},
|
7644 |
+
|
7645 |
+
_tabify: function( init ) {
|
7646 |
+
var self = this,
|
7647 |
+
o = this.options,
|
7648 |
+
fragmentId = /^#.+/; // Safari 2 reports '#' for an empty hash
|
7649 |
+
|
7650 |
+
this.list = this.element.find( "ol,ul" ).eq( 0 );
|
7651 |
+
this.lis = $( " > li:has(a[href])", this.list );
|
7652 |
+
this.anchors = this.lis.map(function() {
|
7653 |
+
return $( "a", this )[ 0 ];
|
7654 |
+
});
|
7655 |
+
this.panels = $( [] );
|
7656 |
+
|
7657 |
+
this.anchors.each(function( i, a ) {
|
7658 |
+
var href = $( a ).attr( "href" );
|
7659 |
+
// For dynamically created HTML that contains a hash as href IE < 8 expands
|
7660 |
+
// such href to the full page url with hash and then misinterprets tab as ajax.
|
7661 |
+
// Same consideration applies for an added tab with a fragment identifier
|
7662 |
+
// since a[href=#fragment-identifier] does unexpectedly not match.
|
7663 |
+
// Thus normalize href attribute...
|
7664 |
+
var hrefBase = href.split( "#" )[ 0 ],
|
7665 |
+
baseEl;
|
7666 |
+
if ( hrefBase && ( hrefBase === location.toString().split( "#" )[ 0 ] ||
|
7667 |
+
( baseEl = $( "base" )[ 0 ]) && hrefBase === baseEl.href ) ) {
|
7668 |
+
href = a.hash;
|
7669 |
+
a.href = href;
|
7670 |
+
}
|
7671 |
+
|
7672 |
+
// inline tab
|
7673 |
+
if ( fragmentId.test( href ) ) {
|
7674 |
+
self.panels = self.panels.add( self.element.find( self._sanitizeSelector( href ) ) );
|
7675 |
+
// remote tab
|
7676 |
+
// prevent loading the page itself if href is just "#"
|
7677 |
+
} else if ( href && href !== "#" ) {
|
7678 |
+
// required for restore on destroy
|
7679 |
+
$.data( a, "href.tabs", href );
|
7680 |
+
|
7681 |
+
// TODO until #3808 is fixed strip fragment identifier from url
|
7682 |
+
// (IE fails to load from such url)
|
7683 |
+
$.data( a, "load.tabs", href.replace( /#.*$/, "" ) );
|
7684 |
+
|
7685 |
+
var id = self._tabId( a );
|
7686 |
+
a.href = "#" + id;
|
7687 |
+
var $panel = self.element.find( "#" + id );
|
7688 |
+
if ( !$panel.length ) {
|
7689 |
+
$panel = $( o.panelTemplate )
|
7690 |
+
.attr( "id", id )
|
7691 |
+
.addClass( "ui-tabs-panel ui-widget-content ui-corner-bottom" )
|
7692 |
+
.insertAfter( self.panels[ i - 1 ] || self.list );
|
7693 |
+
$panel.data( "destroy.tabs", true );
|
7694 |
+
}
|
7695 |
+
self.panels = self.panels.add( $panel );
|
7696 |
+
// invalid tab href
|
7697 |
+
} else {
|
7698 |
+
o.disabled.push( i );
|
7699 |
+
}
|
7700 |
+
});
|
7701 |
+
|
7702 |
+
// initialization from scratch
|
7703 |
+
if ( init ) {
|
7704 |
+
// attach necessary classes for styling
|
7705 |
+
this.element.addClass( "ui-tabs ui-widget ui-widget-content ui-corner-all" );
|
7706 |
+
this.list.addClass( "ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all" );
|
7707 |
+
this.lis.addClass( "ui-state-default ui-corner-top" );
|
7708 |
+
this.panels.addClass( "ui-tabs-panel ui-widget-content ui-corner-bottom" );
|
7709 |
+
|
7710 |
+
// Selected tab
|
7711 |
+
// use "selected" option or try to retrieve:
|
7712 |
+
// 1. from fragment identifier in url
|
7713 |
+
// 2. from cookie
|
7714 |
+
// 3. from selected class attribute on <li>
|
7715 |
+
if ( o.selected === undefined ) {
|
7716 |
+
if ( location.hash ) {
|
7717 |
+
this.anchors.each(function( i, a ) {
|
7718 |
+
if ( a.hash == location.hash ) {
|
7719 |
+
o.selected = i;
|
7720 |
+
return false;
|
7721 |
+
}
|
7722 |
+
});
|
7723 |
+
}
|
7724 |
+
if ( typeof o.selected !== "number" && o.cookie ) {
|
7725 |
+
o.selected = parseInt( self._cookie(), 10 );
|
7726 |
+
}
|
7727 |
+
if ( typeof o.selected !== "number" && this.lis.filter( ".ui-tabs-selected" ).length ) {
|
7728 |
+
o.selected = this.lis.index( this.lis.filter( ".ui-tabs-selected" ) );
|
7729 |
+
}
|
7730 |
+
o.selected = o.selected || ( this.lis.length ? 0 : -1 );
|
7731 |
+
} else if ( o.selected === null ) { // usage of null is deprecated, TODO remove in next release
|
7732 |
+
o.selected = -1;
|
7733 |
+
}
|
7734 |
+
|
7735 |
+
// sanity check - default to first tab...
|
7736 |
+
o.selected = ( ( o.selected >= 0 && this.anchors[ o.selected ] ) || o.selected < 0 )
|
7737 |
+
? o.selected
|
7738 |
+
: 0;
|
7739 |
+
|
7740 |
+
// Take disabling tabs via class attribute from HTML
|
7741 |
+
// into account and update option properly.
|
7742 |
+
// A selected tab cannot become disabled.
|
7743 |
+
o.disabled = $.unique( o.disabled.concat(
|
7744 |
+
$.map( this.lis.filter( ".ui-state-disabled" ), function( n, i ) {
|
7745 |
+
return self.lis.index( n );
|
7746 |
+
})
|
7747 |
+
) ).sort();
|
7748 |
+
|
7749 |
+
if ( $.inArray( o.selected, o.disabled ) != -1 ) {
|
7750 |
+
o.disabled.splice( $.inArray( o.selected, o.disabled ), 1 );
|
7751 |
+
}
|
7752 |
+
|
7753 |
+
// highlight selected tab
|
7754 |
+
this.panels.addClass( "ui-tabs-hide" );
|
7755 |
+
this.lis.removeClass( "ui-tabs-selected ui-state-active" );
|
7756 |
+
// check for length avoids error when initializing empty list
|
7757 |
+
if ( o.selected >= 0 && this.anchors.length ) {
|
7758 |
+
self.element.find( self._sanitizeSelector( self.anchors[ o.selected ].hash ) ).removeClass( "ui-tabs-hide" );
|
7759 |
+
this.lis.eq( o.selected ).addClass( "ui-tabs-selected ui-state-active" );
|
7760 |
+
|
7761 |
+
// seems to be expected behavior that the show callback is fired
|
7762 |
+
self.element.queue( "tabs", function() {
|
7763 |
+
self._trigger( "show", null,
|
7764 |
+
self._ui( self.anchors[ o.selected ], self.element.find( self._sanitizeSelector( self.anchors[ o.selected ].hash ) )[ 0 ] ) );
|
7765 |
+
});
|
7766 |
+
|
7767 |
+
this.load( o.selected );
|
7768 |
+
}
|
7769 |
+
|
7770 |
+
// clean up to avoid memory leaks in certain versions of IE 6
|
7771 |
+
// TODO: namespace this event
|
7772 |
+
$( window ).bind( "unload", function() {
|
7773 |
+
self.lis.add( self.anchors ).unbind( ".tabs" );
|
7774 |
+
self.lis = self.anchors = self.panels = null;
|
7775 |
+
});
|
7776 |
+
// update selected after add/remove
|
7777 |
+
} else {
|
7778 |
+
o.selected = this.lis.index( this.lis.filter( ".ui-tabs-selected" ) );
|
7779 |
+
}
|
7780 |
+
|
7781 |
+
// update collapsible
|
7782 |
+
// TODO: use .toggleClass()
|
7783 |
+
this.element[ o.collapsible ? "addClass" : "removeClass" ]( "ui-tabs-collapsible" );
|
7784 |
+
|
7785 |
+
// set or update cookie after init and add/remove respectively
|
7786 |
+
if ( o.cookie ) {
|
7787 |
+
this._cookie( o.selected, o.cookie );
|
7788 |
+
}
|
7789 |
+
|
7790 |
+
// disable tabs
|
7791 |
+
for ( var i = 0, li; ( li = this.lis[ i ] ); i++ ) {
|
7792 |
+
$( li )[ $.inArray( i, o.disabled ) != -1 &&
|
7793 |
+
// TODO: use .toggleClass()
|
7794 |
+
!$( li ).hasClass( "ui-tabs-selected" ) ? "addClass" : "removeClass" ]( "ui-state-disabled" );
|
7795 |
+
}
|
7796 |
+
|
7797 |
+
// reset cache if switching from cached to not cached
|
7798 |
+
if ( o.cache === false ) {
|
7799 |
+
this.anchors.removeData( "cache.tabs" );
|
7800 |
+
}
|
7801 |
+
|
7802 |
+
// remove all handlers before, tabify may run on existing tabs after add or option change
|
7803 |
+
this.lis.add( this.anchors ).unbind( ".tabs" );
|
7804 |
+
|
7805 |
+
if ( o.event !== "mouseover" ) {
|
7806 |
+
var addState = function( state, el ) {
|
7807 |
+
if ( el.is( ":not(.ui-state-disabled)" ) ) {
|
7808 |
+
el.addClass( "ui-state-" + state );
|
7809 |
+
}
|
7810 |
+
};
|
7811 |
+
var removeState = function( state, el ) {
|
7812 |
+
el.removeClass( "ui-state-" + state );
|
7813 |
+
};
|
7814 |
+
this.lis.bind( "mouseover.tabs" , function() {
|
7815 |
+
addState( "hover", $( this ) );
|
7816 |
+
});
|
7817 |
+
this.lis.bind( "mouseout.tabs", function() {
|
7818 |
+
removeState( "hover", $( this ) );
|
7819 |
+
});
|
7820 |
+
this.anchors.bind( "focus.tabs", function() {
|
7821 |
+
addState( "focus", $( this ).closest( "li" ) );
|
7822 |
+
});
|
7823 |
+
this.anchors.bind( "blur.tabs", function() {
|
7824 |
+
removeState( "focus", $( this ).closest( "li" ) );
|
7825 |
+
});
|
7826 |
+
}
|
7827 |
+
|
7828 |
+
// set up animations
|
7829 |
+
var hideFx, showFx;
|
7830 |
+
if ( o.fx ) {
|
7831 |
+
if ( $.isArray( o.fx ) ) {
|
7832 |
+
hideFx = o.fx[ 0 ];
|
7833 |
+
showFx = o.fx[ 1 ];
|
7834 |
+
} else {
|
7835 |
+
hideFx = showFx = o.fx;
|
7836 |
+
}
|
7837 |
+
}
|
7838 |
+
|
7839 |
+
// Reset certain styles left over from animation
|
7840 |
+
// and prevent IE's ClearType bug...
|
7841 |
+
function resetStyle( $el, fx ) {
|
7842 |
+
$el.css( "display", "" );
|
7843 |
+
if ( !$.support.opacity && fx.opacity ) {
|
7844 |
+
$el[ 0 ].style.removeAttribute( "filter" );
|
7845 |
+
}
|
7846 |
+
}
|
7847 |
+
|
7848 |
+
// Show a tab...
|
7849 |
+
var showTab = showFx
|
7850 |
+
? function( clicked, $show ) {
|
7851 |
+
$( clicked ).closest( "li" ).addClass( "ui-tabs-selected ui-state-active" );
|
7852 |
+
$show.hide().removeClass( "ui-tabs-hide" ) // avoid flicker that way
|
7853 |
+
.animate( showFx, showFx.duration || "normal", function() {
|
7854 |
+
resetStyle( $show, showFx );
|
7855 |
+
self._trigger( "show", null, self._ui( clicked, $show[ 0 ] ) );
|
7856 |
+
});
|
7857 |
+
}
|
7858 |
+
: function( clicked, $show ) {
|
7859 |
+
$( clicked ).closest( "li" ).addClass( "ui-tabs-selected ui-state-active" );
|
7860 |
+
$show.removeClass( "ui-tabs-hide" );
|
7861 |
+
self._trigger( "show", null, self._ui( clicked, $show[ 0 ] ) );
|
7862 |
+
};
|
7863 |
+
|
7864 |
+
// Hide a tab, $show is optional...
|
7865 |
+
var hideTab = hideFx
|
7866 |
+
? function( clicked, $hide ) {
|
7867 |
+
$hide.animate( hideFx, hideFx.duration || "normal", function() {
|
7868 |
+
self.lis.removeClass( "ui-tabs-selected ui-state-active" );
|
7869 |
+
$hide.addClass( "ui-tabs-hide" );
|
7870 |
+
resetStyle( $hide, hideFx );
|
7871 |
+
self.element.dequeue( "tabs" );
|
7872 |
+
});
|
7873 |
+
}
|
7874 |
+
: function( clicked, $hide, $show ) {
|
7875 |
+
self.lis.removeClass( "ui-tabs-selected ui-state-active" );
|
7876 |
+
$hide.addClass( "ui-tabs-hide" );
|
7877 |
+
self.element.dequeue( "tabs" );
|
7878 |
+
};
|
7879 |
+
|
7880 |
+
// attach tab event handler, unbind to avoid duplicates from former tabifying...
|
7881 |
+
this.anchors.bind( o.event + ".tabs", function() {
|
7882 |
+
var el = this,
|
7883 |
+
$li = $(el).closest( "li" ),
|
7884 |
+
$hide = self.panels.filter( ":not(.ui-tabs-hide)" ),
|
7885 |
+
$show = self.element.find( self._sanitizeSelector( el.hash ) );
|
7886 |
+
|
7887 |
+
// If tab is already selected and not collapsible or tab disabled or
|
7888 |
+
// or is already loading or click callback returns false stop here.
|
7889 |
+
// Check if click handler returns false last so that it is not executed
|
7890 |
+
// for a disabled or loading tab!
|
7891 |
+
if ( ( $li.hasClass( "ui-tabs-selected" ) && !o.collapsible) ||
|
7892 |
+
$li.hasClass( "ui-state-disabled" ) ||
|
7893 |
+
$li.hasClass( "ui-state-processing" ) ||
|
7894 |
+
self.panels.filter( ":animated" ).length ||
|
7895 |
+
self._trigger( "select", null, self._ui( this, $show[ 0 ] ) ) === false ) {
|
7896 |
+
this.blur();
|
7897 |
+
return false;
|
7898 |
+
}
|
7899 |
+
|
7900 |
+
o.selected = self.anchors.index( this );
|
7901 |
+
|
7902 |
+
self.abort();
|
7903 |
+
|
7904 |
+
// if tab may be closed
|
7905 |
+
if ( o.collapsible ) {
|
7906 |
+
if ( $li.hasClass( "ui-tabs-selected" ) ) {
|
7907 |
+
o.selected = -1;
|
7908 |
+
|
7909 |
+
if ( o.cookie ) {
|
7910 |
+
self._cookie( o.selected, o.cookie );
|
7911 |
+
}
|
7912 |
+
|
7913 |
+
self.element.queue( "tabs", function() {
|
7914 |
+
hideTab( el, $hide );
|
7915 |
+
}).dequeue( "tabs" );
|
7916 |
+
|
7917 |
+
this.blur();
|
7918 |
+
return false;
|
7919 |
+
} else if ( !$hide.length ) {
|
7920 |
+
if ( o.cookie ) {
|
7921 |
+
self._cookie( o.selected, o.cookie );
|
7922 |
+
}
|
7923 |
+
|
7924 |
+
self.element.queue( "tabs", function() {
|
7925 |
+
showTab( el, $show );
|
7926 |
+
});
|
7927 |
+
|
7928 |
+
// TODO make passing in node possible, see also http://dev.jqueryui.com/ticket/3171
|
7929 |
+
self.load( self.anchors.index( this ) );
|
7930 |
+
|
7931 |
+
this.blur();
|
7932 |
+
return false;
|
7933 |
+
}
|
7934 |
+
}
|
7935 |
+
|
7936 |
+
if ( o.cookie ) {
|
7937 |
+
self._cookie( o.selected, o.cookie );
|
7938 |
+
}
|
7939 |
+
|
7940 |
+
// show new tab
|
7941 |
+
if ( $show.length ) {
|
7942 |
+
if ( $hide.length ) {
|
7943 |
+
self.element.queue( "tabs", function() {
|
7944 |
+
hideTab( el, $hide );
|
7945 |
+
});
|
7946 |
+
}
|
7947 |
+
self.element.queue( "tabs", function() {
|
7948 |
+
showTab( el, $show );
|
7949 |
+
});
|
7950 |
+
|
7951 |
+
self.load( self.anchors.index( this ) );
|
7952 |
+
} else {
|
7953 |
+
throw "jQuery UI Tabs: Mismatching fragment identifier.";
|
7954 |
+
}
|
7955 |
+
|
7956 |
+
// Prevent IE from keeping other link focussed when using the back button
|
7957 |
+
// and remove dotted border from clicked link. This is controlled via CSS
|
7958 |
+
// in modern browsers; blur() removes focus from address bar in Firefox
|
7959 |
+
// which can become a usability and annoying problem with tabs('rotate').
|
7960 |
+
if ( $.browser.msie ) {
|
7961 |
+
this.blur();
|
7962 |
+
}
|
7963 |
+
});
|
7964 |
+
|
7965 |
+
// disable click in any case
|
7966 |
+
this.anchors.bind( "click.tabs", function(){
|
7967 |
+
return false;
|
7968 |
+
});
|
7969 |
+
},
|
7970 |
+
|
7971 |
+
_getIndex: function( index ) {
|
7972 |
+
// meta-function to give users option to provide a href string instead of a numerical index.
|
7973 |
+
// also sanitizes numerical indexes to valid values.
|
7974 |
+
if ( typeof index == "string" ) {
|
7975 |
+
index = this.anchors.index( this.anchors.filter( "[href$=" + index + "]" ) );
|
7976 |
+
}
|
7977 |
+
|
7978 |
+
return index;
|
7979 |
+
},
|
7980 |
+
|
7981 |
+
destroy: function() {
|
7982 |
+
var o = this.options;
|
7983 |
+
|
7984 |
+
this.abort();
|
7985 |
+
|
7986 |
+
this.element
|
7987 |
+
.unbind( ".tabs" )
|
7988 |
+
.removeClass( "ui-tabs ui-widget ui-widget-content ui-corner-all ui-tabs-collapsible" )
|
7989 |
+
.removeData( "tabs" );
|
7990 |
+
|
7991 |
+
this.list.removeClass( "ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all" );
|
7992 |
+
|
7993 |
+
this.anchors.each(function() {
|
7994 |
+
var href = $.data( this, "href.tabs" );
|
7995 |
+
if ( href ) {
|
7996 |
+
this.href = href;
|
7997 |
+
}
|
7998 |
+
var $this = $( this ).unbind( ".tabs" );
|
7999 |
+
$.each( [ "href", "load", "cache" ], function( i, prefix ) {
|
8000 |
+
$this.removeData( prefix + ".tabs" );
|
8001 |
+
});
|
8002 |
+
});
|
8003 |
+
|
8004 |
+
this.lis.unbind( ".tabs" ).add( this.panels ).each(function() {
|
8005 |
+
if ( $.data( this, "destroy.tabs" ) ) {
|
8006 |
+
$( this ).remove();
|
8007 |
+
} else {
|
8008 |
+
$( this ).removeClass([
|
8009 |
+
"ui-state-default",
|
8010 |
+
"ui-corner-top",
|
8011 |
+
"ui-tabs-selected",
|
8012 |
+
"ui-state-active",
|
8013 |
+
"ui-state-hover",
|
8014 |
+
"ui-state-focus",
|
8015 |
+
"ui-state-disabled",
|
8016 |
+
"ui-tabs-panel",
|
8017 |
+
"ui-widget-content",
|
8018 |
+
"ui-corner-bottom",
|
8019 |
+
"ui-tabs-hide"
|
8020 |
+
].join( " " ) );
|
8021 |
+
}
|
8022 |
+
});
|
8023 |
+
|
8024 |
+
if ( o.cookie ) {
|
8025 |
+
this._cookie( null, o.cookie );
|
8026 |
+
}
|
8027 |
+
|
8028 |
+
return this;
|
8029 |
+
},
|
8030 |
+
|
8031 |
+
add: function( url, label, index ) {
|
8032 |
+
if ( index === undefined ) {
|
8033 |
+
index = this.anchors.length;
|
8034 |
+
}
|
8035 |
+
|
8036 |
+
var self = this,
|
8037 |
+
o = this.options,
|
8038 |
+
$li = $( o.tabTemplate.replace( /#\{href\}/g, url ).replace( /#\{label\}/g, label ) ),
|
8039 |
+
id = !url.indexOf( "#" ) ? url.replace( "#", "" ) : this._tabId( $( "a", $li )[ 0 ] );
|
8040 |
+
|
8041 |
+
$li.addClass( "ui-state-default ui-corner-top" ).data( "destroy.tabs", true );
|
8042 |
+
|
8043 |
+
// try to find an existing element before creating a new one
|
8044 |
+
var $panel = self.element.find( "#" + id );
|
8045 |
+
if ( !$panel.length ) {
|
8046 |
+
$panel = $( o.panelTemplate )
|
8047 |
+
.attr( "id", id )
|
8048 |
+
.data( "destroy.tabs", true );
|
8049 |
+
}
|
8050 |
+
$panel.addClass( "ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide" );
|
8051 |
+
|
8052 |
+
if ( index >= this.lis.length ) {
|
8053 |
+
$li.appendTo( this.list );
|
8054 |
+
$panel.appendTo( this.list[ 0 ].parentNode );
|
8055 |
+
} else {
|
8056 |
+
$li.insertBefore( this.lis[ index ] );
|
8057 |
+
$panel.insertBefore( this.panels[ index ] );
|
8058 |
+
}
|
8059 |
+
|
8060 |
+
o.disabled = $.map( o.disabled, function( n, i ) {
|
8061 |
+
return n >= index ? ++n : n;
|
8062 |
+
});
|
8063 |
+
|
8064 |
+
this._tabify();
|
8065 |
+
|
8066 |
+
if ( this.anchors.length == 1 ) {
|
8067 |
+
o.selected = 0;
|
8068 |
+
$li.addClass( "ui-tabs-selected ui-state-active" );
|
8069 |
+
$panel.removeClass( "ui-tabs-hide" );
|
8070 |
+
this.element.queue( "tabs", function() {
|
8071 |
+
self._trigger( "show", null, self._ui( self.anchors[ 0 ], self.panels[ 0 ] ) );
|
8072 |
+
});
|
8073 |
+
|
8074 |
+
this.load( 0 );
|
8075 |
+
}
|
8076 |
+
|
8077 |
+
this._trigger( "add", null, this._ui( this.anchors[ index ], this.panels[ index ] ) );
|
8078 |
+
return this;
|
8079 |
+
},
|
8080 |
+
|
8081 |
+
remove: function( index ) {
|
8082 |
+
index = this._getIndex( index );
|
8083 |
+
var o = this.options,
|
8084 |
+
$li = this.lis.eq( index ).remove(),
|
8085 |
+
$panel = this.panels.eq( index ).remove();
|
8086 |
+
|
8087 |
+
// If selected tab was removed focus tab to the right or
|
8088 |
+
// in case the last tab was removed the tab to the left.
|
8089 |
+
if ( $li.hasClass( "ui-tabs-selected" ) && this.anchors.length > 1) {
|
8090 |
+
this.select( index + ( index + 1 < this.anchors.length ? 1 : -1 ) );
|
8091 |
+
}
|
8092 |
+
|
8093 |
+
o.disabled = $.map(
|
8094 |
+
$.grep( o.disabled, function(n, i) {
|
8095 |
+
return n != index;
|
8096 |
+
}),
|
8097 |
+
function( n, i ) {
|
8098 |
+
return n >= index ? --n : n;
|
8099 |
+
});
|
8100 |
+
|
8101 |
+
this._tabify();
|
8102 |
+
|
8103 |
+
this._trigger( "remove", null, this._ui( $li.find( "a" )[ 0 ], $panel[ 0 ] ) );
|
8104 |
+
return this;
|
8105 |
+
},
|
8106 |
+
|
8107 |
+
enable: function( index ) {
|
8108 |
+
index = this._getIndex( index );
|
8109 |
+
var o = this.options;
|
8110 |
+
if ( $.inArray( index, o.disabled ) == -1 ) {
|
8111 |
+
return;
|
8112 |
+
}
|
8113 |
+
|
8114 |
+
this.lis.eq( index ).removeClass( "ui-state-disabled" );
|
8115 |
+
o.disabled = $.grep( o.disabled, function( n, i ) {
|
8116 |
+
return n != index;
|
8117 |
+
});
|
8118 |
+
|
8119 |
+
this._trigger( "enable", null, this._ui( this.anchors[ index ], this.panels[ index ] ) );
|
8120 |
+
return this;
|
8121 |
+
},
|
8122 |
+
|
8123 |
+
disable: function( index ) {
|
8124 |
+
index = this._getIndex( index );
|
8125 |
+
var self = this, o = this.options;
|
8126 |
+
// cannot disable already selected tab
|
8127 |
+
if ( index != o.selected ) {
|
8128 |
+
this.lis.eq( index ).addClass( "ui-state-disabled" );
|
8129 |
+
|
8130 |
+
o.disabled.push( index );
|
8131 |
+
o.disabled.sort();
|
8132 |
+
|
8133 |
+
this._trigger( "disable", null, this._ui( this.anchors[ index ], this.panels[ index ] ) );
|
8134 |
+
}
|
8135 |
+
|
8136 |
+
return this;
|
8137 |
+
},
|
8138 |
+
|
8139 |
+
select: function( index ) {
|
8140 |
+
index = this._getIndex( index );
|
8141 |
+
if ( index == -1 ) {
|
8142 |
+
if ( this.options.collapsible && this.options.selected != -1 ) {
|
8143 |
+
index = this.options.selected;
|
8144 |
+
} else {
|
8145 |
+
return this;
|
8146 |
+
}
|
8147 |
+
}
|
8148 |
+
this.anchors.eq( index ).trigger( this.options.event + ".tabs" );
|
8149 |
+
return this;
|
8150 |
+
},
|
8151 |
+
|
8152 |
+
load: function( index ) {
|
8153 |
+
index = this._getIndex( index );
|
8154 |
+
var self = this,
|
8155 |
+
o = this.options,
|
8156 |
+
a = this.anchors.eq( index )[ 0 ],
|
8157 |
+
url = $.data( a, "load.tabs" );
|
8158 |
+
|
8159 |
+
this.abort();
|
8160 |
+
|
8161 |
+
// not remote or from cache
|
8162 |
+
if ( !url || this.element.queue( "tabs" ).length !== 0 && $.data( a, "cache.tabs" ) ) {
|
8163 |
+
this.element.dequeue( "tabs" );
|
8164 |
+
return;
|
8165 |
+
}
|
8166 |
+
|
8167 |
+
// load remote from here on
|
8168 |
+
this.lis.eq( index ).addClass( "ui-state-processing" );
|
8169 |
+
|
8170 |
+
if ( o.spinner ) {
|
8171 |
+
var span = $( "span", a );
|
8172 |
+
span.data( "label.tabs", span.html() ).html( o.spinner );
|
8173 |
+
}
|
8174 |
+
|
8175 |
+
this.xhr = $.ajax( $.extend( {}, o.ajaxOptions, {
|
8176 |
+
url: url,
|
8177 |
+
success: function( r, s ) {
|
8178 |
+
self.element.find( self._sanitizeSelector( a.hash ) ).html( r );
|
8179 |
+
|
8180 |
+
// take care of tab labels
|
8181 |
+
self._cleanup();
|
8182 |
+
|
8183 |
+
if ( o.cache ) {
|
8184 |
+
$.data( a, "cache.tabs", true );
|
8185 |
+
}
|
8186 |
+
|
8187 |
+
self._trigger( "load", null, self._ui( self.anchors[ index ], self.panels[ index ] ) );
|
8188 |
+
try {
|
8189 |
+
o.ajaxOptions.success( r, s );
|
8190 |
+
}
|
8191 |
+
catch ( e ) {}
|
8192 |
+
},
|
8193 |
+
error: function( xhr, s, e ) {
|
8194 |
+
// take care of tab labels
|
8195 |
+
self._cleanup();
|
8196 |
+
|
8197 |
+
self._trigger( "load", null, self._ui( self.anchors[ index ], self.panels[ index ] ) );
|
8198 |
+
try {
|
8199 |
+
// Passing index avoid a race condition when this method is
|
8200 |
+
// called after the user has selected another tab.
|
8201 |
+
// Pass the anchor that initiated this request allows
|
8202 |
+
// loadError to manipulate the tab content panel via $(a.hash)
|
8203 |
+
o.ajaxOptions.error( xhr, s, index, a );
|
8204 |
+
}
|
8205 |
+
catch ( e ) {}
|
8206 |
+
}
|
8207 |
+
} ) );
|
8208 |
+
|
8209 |
+
// last, so that load event is fired before show...
|
8210 |
+
self.element.dequeue( "tabs" );
|
8211 |
+
|
8212 |
+
return this;
|
8213 |
+
},
|
8214 |
+
|
8215 |
+
abort: function() {
|
8216 |
+
// stop possibly running animations
|
8217 |
+
this.element.queue( [] );
|
8218 |
+
this.panels.stop( false, true );
|
8219 |
+
|
8220 |
+
// "tabs" queue must not contain more than two elements,
|
8221 |
+
// which are the callbacks for the latest clicked tab...
|
8222 |
+
this.element.queue( "tabs", this.element.queue( "tabs" ).splice( -2, 2 ) );
|
8223 |
+
|
8224 |
+
// terminate pending requests from other tabs
|
8225 |
+
if ( this.xhr ) {
|
8226 |
+
this.xhr.abort();
|
8227 |
+
delete this.xhr;
|
8228 |
+
}
|
8229 |
+
|
8230 |
+
// take care of tab labels
|
8231 |
+
this._cleanup();
|
8232 |
+
return this;
|
8233 |
+
},
|
8234 |
+
|
8235 |
+
url: function( index, url ) {
|
8236 |
+
this.anchors.eq( index ).removeData( "cache.tabs" ).data( "load.tabs", url );
|
8237 |
+
return this;
|
8238 |
+
},
|
8239 |
+
|
8240 |
+
length: function() {
|
8241 |
+
return this.anchors.length;
|
8242 |
+
}
|
8243 |
+
});
|
8244 |
+
|
8245 |
+
$.extend( $.ui.tabs, {
|
8246 |
+
version: "1.8.17"
|
8247 |
+
});
|
8248 |
+
|
8249 |
+
/*
|
8250 |
+
* Tabs Extensions
|
8251 |
+
*/
|
8252 |
+
|
8253 |
+
/*
|
8254 |
+
* Rotate
|
8255 |
+
*/
|
8256 |
+
$.extend( $.ui.tabs.prototype, {
|
8257 |
+
rotation: null,
|
8258 |
+
rotate: function( ms, continuing ) {
|
8259 |
+
var self = this,
|
8260 |
+
o = this.options;
|
8261 |
+
|
8262 |
+
var rotate = self._rotate || ( self._rotate = function( e ) {
|
8263 |
+
clearTimeout( self.rotation );
|
8264 |
+
self.rotation = setTimeout(function() {
|
8265 |
+
var t = o.selected;
|
8266 |
+
self.select( ++t < self.anchors.length ? t : 0 );
|
8267 |
+
}, ms );
|
8268 |
+
|
8269 |
+
if ( e ) {
|
8270 |
+
e.stopPropagation();
|
8271 |
+
}
|
8272 |
+
});
|
8273 |
+
|
8274 |
+
var stop = self._unrotate || ( self._unrotate = !continuing
|
8275 |
+
? function(e) {
|
8276 |
+
if (e.clientX) { // in case of a true click
|
8277 |
+
self.rotate(null);
|
8278 |
+
}
|
8279 |
+
}
|
8280 |
+
: function( e ) {
|
8281 |
+
t = o.selected;
|
8282 |
+
rotate();
|
8283 |
+
});
|
8284 |
+
|
8285 |
+
// start rotation
|
8286 |
+
if ( ms ) {
|
8287 |
+
this.element.bind( "tabsshow", rotate );
|
8288 |
+
this.anchors.bind( o.event + ".tabs", stop );
|
8289 |
+
rotate();
|
8290 |
+
// stop rotation
|
8291 |
+
} else {
|
8292 |
+
clearTimeout( self.rotation );
|
8293 |
+
this.element.unbind( "tabsshow", rotate );
|
8294 |
+
this.anchors.unbind( o.event + ".tabs", stop );
|
8295 |
+
delete this._rotate;
|
8296 |
+
delete this._unrotate;
|
8297 |
+
}
|
8298 |
+
|
8299 |
+
return this;
|
8300 |
+
}
|
8301 |
+
});
|
8302 |
+
|
8303 |
+
})( jQuery );
|
8304 |
+
/*
|
8305 |
+
* jQuery UI Datepicker 1.8.17
|
8306 |
+
*
|
8307 |
+
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
|
8308 |
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
8309 |
+
* http://jquery.org/license
|
8310 |
+
*
|
8311 |
+
* http://docs.jquery.com/UI/Datepicker
|
8312 |
+
*
|
8313 |
+
* Depends:
|
8314 |
+
* jquery.ui.core.js
|
8315 |
+
*/
|
8316 |
+
(function( $, undefined ) {
|
8317 |
+
|
8318 |
+
$.extend($.ui, { datepicker: { version: "1.8.17" } });
|
8319 |
+
|
8320 |
+
var PROP_NAME = 'datepicker';
|
8321 |
+
var dpuuid = new Date().getTime();
|
8322 |
+
var instActive;
|
8323 |
+
|
8324 |
+
/* Date picker manager.
|
8325 |
+
Use the singleton instance of this class, $.datepicker, to interact with the date picker.
|
8326 |
+
Settings for (groups of) date pickers are maintained in an instance object,
|
8327 |
+
allowing multiple different settings on the same page. */
|
8328 |
+
|
8329 |
+
function Datepicker() {
|
8330 |
+
this.debug = false; // Change this to true to start debugging
|
8331 |
+
this._curInst = null; // The current instance in use
|
8332 |
+
this._keyEvent = false; // If the last event was a key event
|
8333 |
+
this._disabledInputs = []; // List of date picker inputs that have been disabled
|
8334 |
+
this._datepickerShowing = false; // True if the popup picker is showing , false if not
|
8335 |
+
this._inDialog = false; // True if showing within a "dialog", false if not
|
8336 |
+
this._mainDivId = 'ui-datepicker-div'; // The ID of the main datepicker division
|
8337 |
+
this._inlineClass = 'ui-datepicker-inline'; // The name of the inline marker class
|
8338 |
+
this._appendClass = 'ui-datepicker-append'; // The name of the append marker class
|
8339 |
+
this._triggerClass = 'ui-datepicker-trigger'; // The name of the trigger marker class
|
8340 |
+
this._dialogClass = 'ui-datepicker-dialog'; // The name of the dialog marker class
|
8341 |
+
this._disableClass = 'ui-datepicker-disabled'; // The name of the disabled covering marker class
|
8342 |
+
this._unselectableClass = 'ui-datepicker-unselectable'; // The name of the unselectable cell marker class
|
8343 |
+
this._currentClass = 'ui-datepicker-current-day'; // The name of the current day marker class
|
8344 |
+
this._dayOverClass = 'ui-datepicker-days-cell-over'; // The name of the day hover marker class
|
8345 |
+
this.regional = []; // Available regional settings, indexed by language code
|
8346 |
+
this.regional[''] = { // Default regional settings
|
8347 |
+
closeText: 'Done', // Display text for close link
|
8348 |
+
prevText: 'Prev', // Display text for previous month link
|
8349 |
+
nextText: 'Next', // Display text for next month link
|
8350 |
+
currentText: 'Today', // Display text for current month link
|
8351 |
+
monthNames: ['January','February','March','April','May','June',
|
8352 |
+
'July','August','September','October','November','December'], // Names of months for drop-down and formatting
|
8353 |
+
monthNamesShort: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'], // For formatting
|
8354 |
+
dayNames: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'], // For formatting
|
8355 |
+
dayNamesShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'], // For formatting
|
8356 |
+
dayNamesMin: ['Su','Mo','Tu','We','Th','Fr','Sa'], // Column headings for days starting at Sunday
|
8357 |
+
weekHeader: 'Wk', // Column header for week of the year
|
8358 |
+
dateFormat: 'mm/dd/yy', // See format options on parseDate
|
8359 |
+
firstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ...
|
8360 |
+
isRTL: false, // True if right-to-left language, false if left-to-right
|
8361 |
+
showMonthAfterYear: false, // True if the year select precedes month, false for month then year
|
8362 |
+
yearSuffix: '' // Additional text to append to the year in the month headers
|
8363 |
+
};
|
8364 |
+
this._defaults = { // Global defaults for all the date picker instances
|
8365 |
+
showOn: 'focus', // 'focus' for popup on focus,
|
8366 |
+
// 'button' for trigger button, or 'both' for either
|
8367 |
+
showAnim: 'fadeIn', // Name of jQuery animation for popup
|
8368 |
+
showOptions: {}, // Options for enhanced animations
|
8369 |
+
defaultDate: null, // Used when field is blank: actual date,
|
8370 |
+
// +/-number for offset from today, null for today
|
8371 |
+
appendText: '', // Display text following the input box, e.g. showing the format
|
8372 |
+
buttonText: '...', // Text for trigger button
|
8373 |
+
buttonImage: '', // URL for trigger button image
|
8374 |
+
buttonImageOnly: false, // True if the image appears alone, false if it appears on a button
|
8375 |
+
hideIfNoPrevNext: false, // True to hide next/previous month links
|
8376 |
+
// if not applicable, false to just disable them
|
8377 |
+
navigationAsDateFormat: false, // True if date formatting applied to prev/today/next links
|
8378 |
+
gotoCurrent: false, // True if today link goes back to current selection instead
|
8379 |
+
changeMonth: false, // True if month can be selected directly, false if only prev/next
|
8380 |
+
changeYear: false, // True if year can be selected directly, false if only prev/next
|
8381 |
+
yearRange: 'c-10:c+10', // Range of years to display in drop-down,
|
8382 |
+
// either relative to today's year (-nn:+nn), relative to currently displayed year
|
8383 |
+
// (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n)
|
8384 |
+
showOtherMonths: false, // True to show dates in other months, false to leave blank
|
8385 |
+
selectOtherMonths: false, // True to allow selection of dates in other months, false for unselectable
|
8386 |
+
showWeek: false, // True to show week of the year, false to not show it
|
8387 |
+
calculateWeek: this.iso8601Week, // How to calculate the week of the year,
|
8388 |
+
// takes a Date and returns the number of the week for it
|
8389 |
+
shortYearCutoff: '+10', // Short year values < this are in the current century,
|
8390 |
+
// > this are in the previous century,
|
8391 |
+
// string value starting with '+' for current year + value
|
8392 |
+
minDate: null, // The earliest selectable date, or null for no limit
|
8393 |
+
maxDate: null, // The latest selectable date, or null for no limit
|
8394 |
+
duration: 'fast', // Duration of display/closure
|
8395 |
+
beforeShowDay: null, // Function that takes a date and returns an array with
|
8396 |
+
// [0] = true if selectable, false if not, [1] = custom CSS class name(s) or '',
|
8397 |
+
// [2] = cell title (optional), e.g. $.datepicker.noWeekends
|
8398 |
+
beforeShow: null, // Function that takes an input field and
|
8399 |
+
// returns a set of custom settings for the date picker
|
8400 |
+
onSelect: null, // Define a callback function when a date is selected
|
8401 |
+
onChangeMonthYear: null, // Define a callback function when the month or year is changed
|
8402 |
+
onClose: null, // Define a callback function when the datepicker is closed
|
8403 |
+
numberOfMonths: 1, // Number of months to show at a time
|
8404 |
+
showCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0)
|
8405 |
+
stepMonths: 1, // Number of months to step back/forward
|
8406 |
+
stepBigMonths: 12, // Number of months to step back/forward for the big links
|
8407 |
+
altField: '', // Selector for an alternate field to store selected dates into
|
8408 |
+
altFormat: '', // The date format to use for the alternate field
|
8409 |
+
constrainInput: true, // The input is constrained by the current date format
|
8410 |
+
showButtonPanel: false, // True to show button panel, false to not show it
|
8411 |
+
autoSize: false, // True to size the input for the date format, false to leave as is
|
8412 |
+
disabled: false // The initial disabled state
|
8413 |
+
};
|
8414 |
+
$.extend(this._defaults, this.regional['']);
|
8415 |
+
this.dpDiv = bindHover($('<div id="' + this._mainDivId + '" class="ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all"></div>'));
|
8416 |
+
}
|
8417 |
+
|
8418 |
+
$.extend(Datepicker.prototype, {
|
8419 |
+
/* Class name added to elements to indicate already configured with a date picker. */
|
8420 |
+
markerClassName: 'hasDatepicker',
|
8421 |
+
|
8422 |
+
//Keep track of the maximum number of rows displayed (see #7043)
|
8423 |
+
maxRows: 4,
|
8424 |
+
|
8425 |
+
/* Debug logging (if enabled). */
|
8426 |
+
log: function () {
|
8427 |
+
if (this.debug)
|
8428 |
+
console.log.apply('', arguments);
|
8429 |
+
},
|
8430 |
+
|
8431 |
+
// TODO rename to "widget" when switching to widget factory
|
8432 |
+
_widgetDatepicker: function() {
|
8433 |
+
return this.dpDiv;
|
8434 |
+
},
|
8435 |
+
|
8436 |
+
/* Override the default settings for all instances of the date picker.
|
8437 |
+
@param settings object - the new settings to use as defaults (anonymous object)
|
8438 |
+
@return the manager object */
|
8439 |
+
setDefaults: function(settings) {
|
8440 |
+
extendRemove(this._defaults, settings || {});
|
8441 |
+
return this;
|
8442 |
+
},
|
8443 |
+
|
8444 |
+
/* Attach the date picker to a jQuery selection.
|
8445 |
+
@param target element - the target input field or division or span
|
8446 |
+
@param settings object - the new settings to use for this date picker instance (anonymous) */
|
8447 |
+
_attachDatepicker: function(target, settings) {
|
8448 |
+
// check for settings on the control itself - in namespace 'date:'
|
8449 |
+
var inlineSettings = null;
|
8450 |
+
for (var attrName in this._defaults) {
|
8451 |
+
var attrValue = target.getAttribute('date:' + attrName);
|
8452 |
+
if (attrValue) {
|
8453 |
+
inlineSettings = inlineSettings || {};
|
8454 |
+
try {
|
8455 |
+
inlineSettings[attrName] = eval(attrValue);
|
8456 |
+
} catch (err) {
|
8457 |
+
inlineSettings[attrName] = attrValue;
|
8458 |
+
}
|
8459 |
+
}
|
8460 |
+
}
|
8461 |
+
var nodeName = target.nodeName.toLowerCase();
|
8462 |
+
var inline = (nodeName == 'div' || nodeName == 'span');
|
8463 |
+
if (!target.id) {
|
8464 |
+
this.uuid += 1;
|
8465 |
+
target.id = 'dp' + this.uuid;
|
8466 |
+
}
|
8467 |
+
var inst = this._newInst($(target), inline);
|
8468 |
+
inst.settings = $.extend({}, settings || {}, inlineSettings || {});
|
8469 |
+
if (nodeName == 'input') {
|
8470 |
+
this._connectDatepicker(target, inst);
|
8471 |
+
} else if (inline) {
|
8472 |
+
this._inlineDatepicker(target, inst);
|
8473 |
+
}
|
8474 |
+
},
|
8475 |
+
|
8476 |
+
/* Create a new instance object. */
|
8477 |
+
_newInst: function(target, inline) {
|
8478 |
+
var id = target[0].id.replace(/([^A-Za-z0-9_-])/g, '\\\\$1'); // escape jQuery meta chars
|
8479 |
+
return {id: id, input: target, // associated target
|
8480 |
+
selectedDay: 0, selectedMonth: 0, selectedYear: 0, // current selection
|
8481 |
+
drawMonth: 0, drawYear: 0, // month being drawn
|
8482 |
+
inline: inline, // is datepicker inline or not
|
8483 |
+
dpDiv: (!inline ? this.dpDiv : // presentation div
|
8484 |
+
bindHover($('<div class="' + this._inlineClass + ' ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all"></div>')))};
|
8485 |
+
},
|
8486 |
+
|
8487 |
+
/* Attach the date picker to an input field. */
|
8488 |
+
_connectDatepicker: function(target, inst) {
|
8489 |
+
var input = $(target);
|
8490 |
+
inst.append = $([]);
|
8491 |
+
inst.trigger = $([]);
|
8492 |
+
if (input.hasClass(this.markerClassName))
|
8493 |
+
return;
|
8494 |
+
this._attachments(input, inst);
|
8495 |
+
input.addClass(this.markerClassName).keydown(this._doKeyDown).
|
8496 |
+
keypress(this._doKeyPress).keyup(this._doKeyUp).
|
8497 |
+
bind("setData.datepicker", function(event, key, value) {
|
8498 |
+
inst.settings[key] = value;
|
8499 |
+
}).bind("getData.datepicker", function(event, key) {
|
8500 |
+
return this._get(inst, key);
|
8501 |
+
});
|
8502 |
+
this._autoSize(inst);
|
8503 |
+
$.data(target, PROP_NAME, inst);
|
8504 |
+
//If disabled option is true, disable the datepicker once it has been attached to the input (see ticket #5665)
|
8505 |
+
if( inst.settings.disabled ) {
|
8506 |
+
this._disableDatepicker( target );
|
8507 |
+
}
|
8508 |
+
},
|
8509 |
+
|
8510 |
+
/* Make attachments based on settings. */
|
8511 |
+
_attachments: function(input, inst) {
|
8512 |
+
var appendText = this._get(inst, 'appendText');
|
8513 |
+
var isRTL = this._get(inst, 'isRTL');
|
8514 |
+
if (inst.append)
|
8515 |
+
inst.append.remove();
|
8516 |
+
if (appendText) {
|
8517 |
+
inst.append = $('<span class="' + this._appendClass + '">' + appendText + '</span>');
|
8518 |
+
input[isRTL ? 'before' : 'after'](inst.append);
|
8519 |
+
}
|
8520 |
+
input.unbind('focus', this._showDatepicker);
|
8521 |
+
if (inst.trigger)
|
8522 |
+
inst.trigger.remove();
|
8523 |
+
var showOn = this._get(inst, 'showOn');
|
8524 |
+
if (showOn == 'focus' || showOn == 'both') // pop-up date picker when in the marked field
|
8525 |
+
input.focus(this._showDatepicker);
|
8526 |
+
if (showOn == 'button' || showOn == 'both') { // pop-up date picker when button clicked
|
8527 |
+
var buttonText = this._get(inst, 'buttonText');
|
8528 |
+
var buttonImage = this._get(inst, 'buttonImage');
|
8529 |
+
inst.trigger = $(this._get(inst, 'buttonImageOnly') ?
|
8530 |
+
$('<img/>').addClass(this._triggerClass).
|
8531 |
+
attr({ src: buttonImage, alt: buttonText, title: buttonText }) :
|
8532 |
+
$('<button type="button"></button>').addClass(this._triggerClass).
|
8533 |
+
html(buttonImage == '' ? buttonText : $('<img/>').attr(
|
8534 |
+
{ src:buttonImage, alt:buttonText, title:buttonText })));
|
8535 |
+
input[isRTL ? 'before' : 'after'](inst.trigger);
|
8536 |
+
inst.trigger.click(function() {
|
8537 |
+
if ($.datepicker._datepickerShowing && $.datepicker._lastInput == input[0])
|
8538 |
+
$.datepicker._hideDatepicker();
|
8539 |
+
else
|
8540 |
+
$.datepicker._showDatepicker(input[0]);
|
8541 |
+
return false;
|
8542 |
+
});
|
8543 |
+
}
|
8544 |
+
},
|
8545 |
+
|
8546 |
+
/* Apply the maximum length for the date format. */
|
8547 |
+
_autoSize: function(inst) {
|
8548 |
+
if (this._get(inst, 'autoSize') && !inst.inline) {
|
8549 |
+
var date = new Date(2009, 12 - 1, 20); // Ensure double digits
|
8550 |
+
var dateFormat = this._get(inst, 'dateFormat');
|
8551 |
+
if (dateFormat.match(/[DM]/)) {
|
8552 |
+
var findMax = function(names) {
|
8553 |
+
var max = 0;
|
8554 |
+
var maxI = 0;
|
8555 |
+
for (var i = 0; i < names.length; i++) {
|
8556 |
+
if (names[i].length > max) {
|
8557 |
+
max = names[i].length;
|
8558 |
+
maxI = i;
|
8559 |
+
}
|
8560 |
+
}
|
8561 |
+
return maxI;
|
8562 |
+
};
|
8563 |
+
date.setMonth(findMax(this._get(inst, (dateFormat.match(/MM/) ?
|
8564 |
+
'monthNames' : 'monthNamesShort'))));
|
8565 |
+
date.setDate(findMax(this._get(inst, (dateFormat.match(/DD/) ?
|
8566 |
+
'dayNames' : 'dayNamesShort'))) + 20 - date.getDay());
|
8567 |
+
}
|
8568 |
+
inst.input.attr('size', this._formatDate(inst, date).length);
|
8569 |
+
}
|
8570 |
+
},
|
8571 |
+
|
8572 |
+
/* Attach an inline date picker to a div. */
|
8573 |
+
_inlineDatepicker: function(target, inst) {
|
8574 |
+
var divSpan = $(target);
|
8575 |
+
if (divSpan.hasClass(this.markerClassName))
|
8576 |
+
return;
|
8577 |
+
divSpan.addClass(this.markerClassName).append(inst.dpDiv).
|
8578 |
+
bind("setData.datepicker", function(event, key, value){
|
8579 |
+
inst.settings[key] = value;
|
8580 |
+
}).bind("getData.datepicker", function(event, key){
|
8581 |
+
return this._get(inst, key);
|
8582 |
+
});
|
8583 |
+
$.data(target, PROP_NAME, inst);
|
8584 |
+
this._setDate(inst, this._getDefaultDate(inst), true);
|
8585 |
+
this._updateDatepicker(inst);
|
8586 |
+
this._updateAlternate(inst);
|
8587 |
+
//If disabled option is true, disable the datepicker before showing it (see ticket #5665)
|
8588 |
+
if( inst.settings.disabled ) {
|
8589 |
+
this._disableDatepicker( target );
|
8590 |
+
}
|
8591 |
+
// Set display:block in place of inst.dpDiv.show() which won't work on disconnected elements
|
8592 |
+
// http://bugs.jqueryui.com/ticket/7552 - A Datepicker created on a detached div has zero height
|
8593 |
+
inst.dpDiv.css( "display", "block" );
|
8594 |
+
},
|
8595 |
+
|
8596 |
+
/* Pop-up the date picker in a "dialog" box.
|
8597 |
+
@param input element - ignored
|
8598 |
+
@param date string or Date - the initial date to display
|
8599 |
+
@param onSelect function - the function to call when a date is selected
|
8600 |
+
@param settings object - update the dialog date picker instance's settings (anonymous object)
|
8601 |
+
@param pos int[2] - coordinates for the dialog's position within the screen or
|
8602 |
+
event - with x/y coordinates or
|
8603 |
+
leave empty for default (screen centre)
|
8604 |
+
@return the manager object */
|
8605 |
+
_dialogDatepicker: function(input, date, onSelect, settings, pos) {
|
8606 |
+
var inst = this._dialogInst; // internal instance
|
8607 |
+
if (!inst) {
|
8608 |
+
this.uuid += 1;
|
8609 |
+
var id = 'dp' + this.uuid;
|
8610 |
+
this._dialogInput = $('<input type="text" id="' + id +
|
8611 |
+
'" style="position: absolute; top: -100px; width: 0px; z-index: -10;"/>');
|
8612 |
+
this._dialogInput.keydown(this._doKeyDown);
|
8613 |
+
$('body').append(this._dialogInput);
|
8614 |
+
inst = this._dialogInst = this._newInst(this._dialogInput, false);
|
8615 |
+
inst.settings = {};
|
8616 |
+
$.data(this._dialogInput[0], PROP_NAME, inst);
|
8617 |
+
}
|
8618 |
+
extendRemove(inst.settings, settings || {});
|
8619 |
+
date = (date && date.constructor == Date ? this._formatDate(inst, date) : date);
|
8620 |
+
this._dialogInput.val(date);
|
8621 |
+
|
8622 |
+
this._pos = (pos ? (pos.length ? pos : [pos.pageX, pos.pageY]) : null);
|
8623 |
+
if (!this._pos) {
|
8624 |
+
var browserWidth = document.documentElement.clientWidth;
|
8625 |
+
var browserHeight = document.documentElement.clientHeight;
|
8626 |
+
var scrollX = document.documentElement.scrollLeft || document.body.scrollLeft;
|
8627 |
+
var scrollY = document.documentElement.scrollTop || document.body.scrollTop;
|
8628 |
+
this._pos = // should use actual width/height below
|
8629 |
+
[(browserWidth / 2) - 100 + scrollX, (browserHeight / 2) - 150 + scrollY];
|
8630 |
+
}
|
8631 |
+
|
8632 |
+
// move input on screen for focus, but hidden behind dialog
|
8633 |
+
this._dialogInput.css('left', (this._pos[0] + 20) + 'px').css('top', this._pos[1] + 'px');
|
8634 |
+
inst.settings.onSelect = onSelect;
|
8635 |
+
this._inDialog = true;
|
8636 |
+
this.dpDiv.addClass(this._dialogClass);
|
8637 |
+
this._showDatepicker(this._dialogInput[0]);
|
8638 |
+
if ($.blockUI)
|
8639 |
+
$.blockUI(this.dpDiv);
|
8640 |
+
$.data(this._dialogInput[0], PROP_NAME, inst);
|
8641 |
+
return this;
|
8642 |
+
},
|
8643 |
+
|
8644 |
+
/* Detach a datepicker from its control.
|
8645 |
+
@param target element - the target input field or division or span */
|
8646 |
+
_destroyDatepicker: function(target) {
|
8647 |
+
var $target = $(target);
|
8648 |
+
var inst = $.data(target, PROP_NAME);
|
8649 |
+
if (!$target.hasClass(this.markerClassName)) {
|
8650 |
+
return;
|
8651 |
+
}
|
8652 |
+
var nodeName = target.nodeName.toLowerCase();
|
8653 |
+
$.removeData(target, PROP_NAME);
|
8654 |
+
if (nodeName == 'input') {
|
8655 |
+
inst.append.remove();
|
8656 |
+
inst.trigger.remove();
|
8657 |
+
$target.removeClass(this.markerClassName).
|
8658 |
+
unbind('focus', this._showDatepicker).
|
8659 |
+
unbind('keydown', this._doKeyDown).
|
8660 |
+
unbind('keypress', this._doKeyPress).
|
8661 |
+
unbind('keyup', this._doKeyUp);
|
8662 |
+
} else if (nodeName == 'div' || nodeName == 'span')
|
8663 |
+
$target.removeClass(this.markerClassName).empty();
|
8664 |
+
},
|
8665 |
+
|
8666 |
+
/* Enable the date picker to a jQuery selection.
|
8667 |
+
@param target element - the target input field or division or span */
|
8668 |
+
_enableDatepicker: function(target) {
|
8669 |
+
var $target = $(target);
|
8670 |
+
var inst = $.data(target, PROP_NAME);
|
8671 |
+
if (!$target.hasClass(this.markerClassName)) {
|
8672 |
+
return;
|
8673 |
+
}
|
8674 |
+
var nodeName = target.nodeName.toLowerCase();
|
8675 |
+
if (nodeName == 'input') {
|
8676 |
+
target.disabled = false;
|
8677 |
+
inst.trigger.filter('button').
|
8678 |
+
each(function() { this.disabled = false; }).end().
|
8679 |
+
filter('img').css({opacity: '1.0', cursor: ''});
|
8680 |
+
}
|
8681 |
+
else if (nodeName == 'div' || nodeName == 'span') {
|
8682 |
+
var inline = $target.children('.' + this._inlineClass);
|
8683 |
+
inline.children().removeClass('ui-state-disabled');
|
8684 |
+
inline.find("select.ui-datepicker-month, select.ui-datepicker-year").
|
8685 |
+
removeAttr("disabled");
|
8686 |
+
}
|
8687 |
+
this._disabledInputs = $.map(this._disabledInputs,
|
8688 |
+
function(value) { return (value == target ? null : value); }); // delete entry
|
8689 |
+
},
|
8690 |
+
|
8691 |
+
/* Disable the date picker to a jQuery selection.
|
8692 |
+
@param target element - the target input field or division or span */
|
8693 |
+
_disableDatepicker: function(target) {
|
8694 |
+
var $target = $(target);
|
8695 |
+
var inst = $.data(target, PROP_NAME);
|
8696 |
+
if (!$target.hasClass(this.markerClassName)) {
|
8697 |
+
return;
|
8698 |
+
}
|
8699 |
+
var nodeName = target.nodeName.toLowerCase();
|
8700 |
+
if (nodeName == 'input') {
|
8701 |
+
target.disabled = true;
|
8702 |
+
inst.trigger.filter('button').
|
8703 |
+
each(function() { this.disabled = true; }).end().
|
8704 |
+
filter('img').css({opacity: '0.5', cursor: 'default'});
|
8705 |
+
}
|
8706 |
+
else if (nodeName == 'div' || nodeName == 'span') {
|
8707 |
+
var inline = $target.children('.' + this._inlineClass);
|
8708 |
+
inline.children().addClass('ui-state-disabled');
|
8709 |
+
inline.find("select.ui-datepicker-month, select.ui-datepicker-year").
|
8710 |
+
attr("disabled", "disabled");
|
8711 |
+
}
|
8712 |
+
this._disabledInputs = $.map(this._disabledInputs,
|
8713 |
+
function(value) { return (value == target ? null : value); }); // delete entry
|
8714 |
+
this._disabledInputs[this._disabledInputs.length] = target;
|
8715 |
+
},
|
8716 |
+
|
8717 |
+
/* Is the first field in a jQuery collection disabled as a datepicker?
|
8718 |
+
@param target element - the target input field or division or span
|
8719 |
+
@return boolean - true if disabled, false if enabled */
|
8720 |
+
_isDisabledDatepicker: function(target) {
|
8721 |
+
if (!target) {
|
8722 |
+
return false;
|
8723 |
+
}
|
8724 |
+
for (var i = 0; i < this._disabledInputs.length; i++) {
|
8725 |
+
if (this._disabledInputs[i] == target)
|
8726 |
+
return true;
|
8727 |
+
}
|
8728 |
+
return false;
|
8729 |
+
},
|
8730 |
+
|
8731 |
+
/* Retrieve the instance data for the target control.
|
8732 |
+
@param target element - the target input field or division or span
|
8733 |
+
@return object - the associated instance data
|
8734 |
+
@throws error if a jQuery problem getting data */
|
8735 |
+
_getInst: function(target) {
|
8736 |
+
try {
|
8737 |
+
return $.data(target, PROP_NAME);
|
8738 |
+
}
|
8739 |
+
catch (err) {
|
8740 |
+
throw 'Missing instance data for this datepicker';
|
8741 |
+
}
|
8742 |
+
},
|
8743 |
+
|
8744 |
+
/* Update or retrieve the settings for a date picker attached to an input field or division.
|
8745 |
+
@param target element - the target input field or division or span
|
8746 |
+
@param name object - the new settings to update or
|
8747 |
+
string - the name of the setting to change or retrieve,
|
8748 |
+
when retrieving also 'all' for all instance settings or
|
8749 |
+
'defaults' for all global defaults
|
8750 |
+
@param value any - the new value for the setting
|
8751 |
+
(omit if above is an object or to retrieve a value) */
|
8752 |
+
_optionDatepicker: function(target, name, value) {
|
8753 |
+
var inst = this._getInst(target);
|
8754 |
+
if (arguments.length == 2 && typeof name == 'string') {
|
8755 |
+
return (name == 'defaults' ? $.extend({}, $.datepicker._defaults) :
|
8756 |
+
(inst ? (name == 'all' ? $.extend({}, inst.settings) :
|
8757 |
+
this._get(inst, name)) : null));
|
8758 |
+
}
|
8759 |
+
var settings = name || {};
|
8760 |
+
if (typeof name == 'string') {
|
8761 |
+
settings = {};
|
8762 |
+
settings[name] = value;
|
8763 |
+
}
|
8764 |
+
if (inst) {
|
8765 |
+
if (this._curInst == inst) {
|
8766 |
+
this._hideDatepicker();
|
8767 |
+
}
|
8768 |
+
var date = this._getDateDatepicker(target, true);
|
8769 |
+
var minDate = this._getMinMaxDate(inst, 'min');
|
8770 |
+
var maxDate = this._getMinMaxDate(inst, 'max');
|
8771 |
+
extendRemove(inst.settings, settings);
|
8772 |
+
// reformat the old minDate/maxDate values if dateFormat changes and a new minDate/maxDate isn't provided
|
8773 |
+
if (minDate !== null && settings['dateFormat'] !== undefined && settings['minDate'] === undefined)
|
8774 |
+
inst.settings.minDate = this._formatDate(inst, minDate);
|
8775 |
+
if (maxDate !== null && settings['dateFormat'] !== undefined && settings['maxDate'] === undefined)
|
8776 |
+
inst.settings.maxDate = this._formatDate(inst, maxDate);
|
8777 |
+
this._attachments($(target), inst);
|
8778 |
+
this._autoSize(inst);
|
8779 |
+
this._setDate(inst, date);
|
8780 |
+
this._updateAlternate(inst);
|
8781 |
+
this._updateDatepicker(inst);
|
8782 |
+
}
|
8783 |
+
},
|
8784 |
+
|
8785 |
+
// change method deprecated
|
8786 |
+
_changeDatepicker: function(target, name, value) {
|
8787 |
+
this._optionDatepicker(target, name, value);
|
8788 |
+
},
|
8789 |
+
|
8790 |
+
/* Redraw the date picker attached to an input field or division.
|
8791 |
+
@param target element - the target input field or division or span */
|
8792 |
+
_refreshDatepicker: function(target) {
|
8793 |
+
var inst = this._getInst(target);
|
8794 |
+
if (inst) {
|
8795 |
+
this._updateDatepicker(inst);
|
8796 |
+
}
|
8797 |
+
},
|
8798 |
+
|
8799 |
+
/* Set the dates for a jQuery selection.
|
8800 |
+
@param target element - the target input field or division or span
|
8801 |
+
@param date Date - the new date */
|
8802 |
+
_setDateDatepicker: function(target, date) {
|
8803 |
+
var inst = this._getInst(target);
|
8804 |
+
if (inst) {
|
8805 |
+
this._setDate(inst, date);
|
8806 |
+
this._updateDatepicker(inst);
|
8807 |
+
this._updateAlternate(inst);
|
8808 |
+
}
|
8809 |
+
},
|
8810 |
+
|
8811 |
+
/* Get the date(s) for the first entry in a jQuery selection.
|
8812 |
+
@param target element - the target input field or division or span
|
8813 |
+
@param noDefault boolean - true if no default date is to be used
|
8814 |
+
@return Date - the current date */
|
8815 |
+
_getDateDatepicker: function(target, noDefault) {
|
8816 |
+
var inst = this._getInst(target);
|
8817 |
+
if (inst && !inst.inline)
|
8818 |
+
this._setDateFromField(inst, noDefault);
|
8819 |
+
return (inst ? this._getDate(inst) : null);
|
8820 |
+
},
|
8821 |
+
|
8822 |
+
/* Handle keystrokes. */
|
8823 |
+
_doKeyDown: function(event) {
|
8824 |
+
var inst = $.datepicker._getInst(event.target);
|
8825 |
+
var handled = true;
|
8826 |
+
var isRTL = inst.dpDiv.is('.ui-datepicker-rtl');
|
8827 |
+
inst._keyEvent = true;
|
8828 |
+
if ($.datepicker._datepickerShowing)
|
8829 |
+
switch (event.keyCode) {
|
8830 |
+
case 9: $.datepicker._hideDatepicker();
|
8831 |
+
handled = false;
|
8832 |
+
break; // hide on tab out
|
8833 |
+
case 13: var sel = $('td.' + $.datepicker._dayOverClass + ':not(.' +
|
8834 |
+
$.datepicker._currentClass + ')', inst.dpDiv);
|
8835 |
+
if (sel[0])
|
8836 |
+
$.datepicker._selectDay(event.target, inst.selectedMonth, inst.selectedYear, sel[0]);
|
8837 |
+
var onSelect = $.datepicker._get(inst, 'onSelect');
|
8838 |
+
if (onSelect) {
|
8839 |
+
var dateStr = $.datepicker._formatDate(inst);
|
8840 |
+
|
8841 |
+
// trigger custom callback
|
8842 |
+
onSelect.apply((inst.input ? inst.input[0] : null), [dateStr, inst]);
|
8843 |
+
}
|
8844 |
+
else
|
8845 |
+
$.datepicker._hideDatepicker();
|
8846 |
+
return false; // don't submit the form
|
8847 |
+
break; // select the value on enter
|
8848 |
+
case 27: $.datepicker._hideDatepicker();
|
8849 |
+
break; // hide on escape
|
8850 |
+
case 33: $.datepicker._adjustDate(event.target, (event.ctrlKey ?
|
8851 |
+
-$.datepicker._get(inst, 'stepBigMonths') :
|
8852 |
+
-$.datepicker._get(inst, 'stepMonths')), 'M');
|
8853 |
+
break; // previous month/year on page up/+ ctrl
|
8854 |
+
case 34: $.datepicker._adjustDate(event.target, (event.ctrlKey ?
|
8855 |
+
+$.datepicker._get(inst, 'stepBigMonths') :
|
8856 |
+
+$.datepicker._get(inst, 'stepMonths')), 'M');
|
8857 |
+
break; // next month/year on page down/+ ctrl
|
8858 |
+
case 35: if (event.ctrlKey || event.metaKey) $.datepicker._clearDate(event.target);
|
8859 |
+
handled = event.ctrlKey || event.metaKey;
|
8860 |
+
break; // clear on ctrl or command +end
|
8861 |
+
case 36: if (event.ctrlKey || event.metaKey) $.datepicker._gotoToday(event.target);
|
8862 |
+
handled = event.ctrlKey || event.metaKey;
|
8863 |
+
break; // current on ctrl or command +home
|
8864 |
+
case 37: if (event.ctrlKey || event.metaKey) $.datepicker._adjustDate(event.target, (isRTL ? +1 : -1), 'D');
|
8865 |
+
handled = event.ctrlKey || event.metaKey;
|
8866 |
+
// -1 day on ctrl or command +left
|
8867 |
+
if (event.originalEvent.altKey) $.datepicker._adjustDate(event.target, (event.ctrlKey ?
|
8868 |
+
-$.datepicker._get(inst, 'stepBigMonths') :
|
8869 |
+
-$.datepicker._get(inst, 'stepMonths')), 'M');
|
8870 |
+
// next month/year on alt +left on Mac
|
8871 |
+
break;
|
8872 |
+
case 38: if (event.ctrlKey || event.metaKey) $.datepicker._adjustDate(event.target, -7, 'D');
|
8873 |
+
handled = event.ctrlKey || event.metaKey;
|
8874 |
+
break; // -1 week on ctrl or command +up
|
8875 |
+
case 39: if (event.ctrlKey || event.metaKey) $.datepicker._adjustDate(event.target, (isRTL ? -1 : +1), 'D');
|
8876 |
+
handled = event.ctrlKey || event.metaKey;
|
8877 |
+
// +1 day on ctrl or command +right
|
8878 |
+
if (event.originalEvent.altKey) $.datepicker._adjustDate(event.target, (event.ctrlKey ?
|
8879 |
+
+$.datepicker._get(inst, 'stepBigMonths') :
|
8880 |
+
+$.datepicker._get(inst, 'stepMonths')), 'M');
|
8881 |
+
// next month/year on alt +right
|
8882 |
+
break;
|
8883 |
+
case 40: if (event.ctrlKey || event.metaKey) $.datepicker._adjustDate(event.target, +7, 'D');
|
8884 |
+
handled = event.ctrlKey || event.metaKey;
|
8885 |
+
break; // +1 week on ctrl or command +down
|
8886 |
+
default: handled = false;
|
8887 |
+
}
|
8888 |
+
else if (event.keyCode == 36 && event.ctrlKey) // display the date picker on ctrl+home
|
8889 |
+
$.datepicker._showDatepicker(this);
|
8890 |
+
else {
|
8891 |
+
handled = false;
|
8892 |
+
}
|
8893 |
+
if (handled) {
|
8894 |
+
event.preventDefault();
|
8895 |
+
event.stopPropagation();
|
8896 |
+
}
|
8897 |
+
},
|
8898 |
+
|
8899 |
+
/* Filter entered characters - based on date format. */
|
8900 |
+
_doKeyPress: function(event) {
|
8901 |
+
var inst = $.datepicker._getInst(event.target);
|
8902 |
+
if ($.datepicker._get(inst, 'constrainInput')) {
|
8903 |
+
var chars = $.datepicker._possibleChars($.datepicker._get(inst, 'dateFormat'));
|
8904 |
+
var chr = String.fromCharCode(event.charCode == undefined ? event.keyCode : event.charCode);
|
8905 |
+
return event.ctrlKey || event.metaKey || (chr < ' ' || !chars || chars.indexOf(chr) > -1);
|
8906 |
+
}
|
8907 |
+
},
|
8908 |
+
|
8909 |
+
/* Synchronise manual entry and field/alternate field. */
|
8910 |
+
_doKeyUp: function(event) {
|
8911 |
+
var inst = $.datepicker._getInst(event.target);
|
8912 |
+
if (inst.input.val() != inst.lastVal) {
|
8913 |
+
try {
|
8914 |
+
var date = $.datepicker.parseDate($.datepicker._get(inst, 'dateFormat'),
|
8915 |
+
(inst.input ? inst.input.val() : null),
|
8916 |
+
$.datepicker._getFormatConfig(inst));
|
8917 |
+
if (date) { // only if valid
|
8918 |
+
$.datepicker._setDateFromField(inst);
|
8919 |
+
$.datepicker._updateAlternate(inst);
|
8920 |
+
$.datepicker._updateDatepicker(inst);
|
8921 |
+
}
|
8922 |
+
}
|
8923 |
+
catch (event) {
|
8924 |
+
$.datepicker.log(event);
|
8925 |
+
}
|
8926 |
+
}
|
8927 |
+
return true;
|
8928 |
+
},
|
8929 |
+
|
8930 |
+
/* Pop-up the date picker for a given input field.
|
8931 |
+
If false returned from beforeShow event handler do not show.
|
8932 |
+
@param input element - the input field attached to the date picker or
|
8933 |
+
event - if triggered by focus */
|
8934 |
+
_showDatepicker: function(input) {
|
8935 |
+
input = input.target || input;
|
8936 |
+
if (input.nodeName.toLowerCase() != 'input') // find from button/image trigger
|
8937 |
+
input = $('input', input.parentNode)[0];
|
8938 |
+
if ($.datepicker._isDisabledDatepicker(input) || $.datepicker._lastInput == input) // already here
|
8939 |
+
return;
|
8940 |
+
var inst = $.datepicker._getInst(input);
|
8941 |
+
if ($.datepicker._curInst && $.datepicker._curInst != inst) {
|
8942 |
+
$.datepicker._curInst.dpDiv.stop(true, true);
|
8943 |
+
if ( inst && $.datepicker._datepickerShowing ) {
|
8944 |
+
$.datepicker._hideDatepicker( $.datepicker._curInst.input[0] );
|
8945 |
+
}
|
8946 |
+
}
|
8947 |
+
var beforeShow = $.datepicker._get(inst, 'beforeShow');
|
8948 |
+
var beforeShowSettings = beforeShow ? beforeShow.apply(input, [input, inst]) : {};
|
8949 |
+
if(beforeShowSettings === false){
|
8950 |
+
//false
|
8951 |
+
return;
|
8952 |
+
}
|
8953 |
+
extendRemove(inst.settings, beforeShowSettings);
|
8954 |
+
inst.lastVal = null;
|
8955 |
+
$.datepicker._lastInput = input;
|
8956 |
+
$.datepicker._setDateFromField(inst);
|
8957 |
+
if ($.datepicker._inDialog) // hide cursor
|
8958 |
+
input.value = '';
|
8959 |
+
if (!$.datepicker._pos) { // position below input
|
8960 |
+
$.datepicker._pos = $.datepicker._findPos(input);
|
8961 |
+
$.datepicker._pos[1] += input.offsetHeight; // add the height
|
8962 |
+
}
|
8963 |
+
var isFixed = false;
|
8964 |
+
$(input).parents().each(function() {
|
8965 |
+
isFixed |= $(this).css('position') == 'fixed';
|
8966 |
+
return !isFixed;
|
8967 |
+
});
|
8968 |
+
if (isFixed && $.browser.opera) { // correction for Opera when fixed and scrolled
|
8969 |
+
$.datepicker._pos[0] -= document.documentElement.scrollLeft;
|
8970 |
+
$.datepicker._pos[1] -= document.documentElement.scrollTop;
|
8971 |
+
}
|
8972 |
+
var offset = {left: $.datepicker._pos[0], top: $.datepicker._pos[1]};
|
8973 |
+
$.datepicker._pos = null;
|
8974 |
+
//to avoid flashes on Firefox
|
8975 |
+
inst.dpDiv.empty();
|
8976 |
+
// determine sizing offscreen
|
8977 |
+
inst.dpDiv.css({position: 'absolute', display: 'block', top: '-1000px'});
|
8978 |
+
$.datepicker._updateDatepicker(inst);
|
8979 |
+
// fix width for dynamic number of date pickers
|
8980 |
+
// and adjust position before showing
|
8981 |
+
offset = $.datepicker._checkOffset(inst, offset, isFixed);
|
8982 |
+
inst.dpDiv.css({position: ($.datepicker._inDialog && $.blockUI ?
|
8983 |
+
'static' : (isFixed ? 'fixed' : 'absolute')), display: 'none',
|
8984 |
+
left: offset.left + 'px', top: offset.top + 'px'});
|
8985 |
+
if (!inst.inline) {
|
8986 |
+
var showAnim = $.datepicker._get(inst, 'showAnim');
|
8987 |
+
var duration = $.datepicker._get(inst, 'duration');
|
8988 |
+
var postProcess = function() {
|
8989 |
+
var cover = inst.dpDiv.find('iframe.ui-datepicker-cover'); // IE6- only
|
8990 |
+
if( !! cover.length ){
|
8991 |
+
var borders = $.datepicker._getBorders(inst.dpDiv);
|
8992 |
+
cover.css({left: -borders[0], top: -borders[1],
|
8993 |
+
width: inst.dpDiv.outerWidth(), height: inst.dpDiv.outerHeight()});
|
8994 |
+
}
|
8995 |
+
};
|
8996 |
+
inst.dpDiv.zIndex($(input).zIndex()+1);
|
8997 |
+
$.datepicker._datepickerShowing = true;
|
8998 |
+
if ($.effects && $.effects[showAnim])
|
8999 |
+
inst.dpDiv.show(showAnim, $.datepicker._get(inst, 'showOptions'), duration, postProcess);
|
9000 |
+
else
|
9001 |
+
inst.dpDiv[showAnim || 'show']((showAnim ? duration : null), postProcess);
|
9002 |
+
if (!showAnim || !duration)
|
9003 |
+
postProcess();
|
9004 |
+
if (inst.input.is(':visible') && !inst.input.is(':disabled'))
|
9005 |
+
inst.input.focus();
|
9006 |
+
$.datepicker._curInst = inst;
|
9007 |
+
}
|
9008 |
+
},
|
9009 |
+
|
9010 |
+
/* Generate the date picker content. */
|
9011 |
+
_updateDatepicker: function(inst) {
|
9012 |
+
var self = this;
|
9013 |
+
self.maxRows = 4; //Reset the max number of rows being displayed (see #7043)
|
9014 |
+
var borders = $.datepicker._getBorders(inst.dpDiv);
|
9015 |
+
instActive = inst; // for delegate hover events
|
9016 |
+
inst.dpDiv.empty().append(this._generateHTML(inst));
|
9017 |
+
var cover = inst.dpDiv.find('iframe.ui-datepicker-cover'); // IE6- only
|
9018 |
+
if( !!cover.length ){ //avoid call to outerXXXX() when not in IE6
|
9019 |
+
cover.css({left: -borders[0], top: -borders[1], width: inst.dpDiv.outerWidth(), height: inst.dpDiv.outerHeight()})
|
9020 |
+
}
|
9021 |
+
inst.dpDiv.find('.' + this._dayOverClass + ' a').mouseover();
|
9022 |
+
var numMonths = this._getNumberOfMonths(inst);
|
9023 |
+
var cols = numMonths[1];
|
9024 |
+
var width = 17;
|
9025 |
+
inst.dpDiv.removeClass('ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4').width('');
|
9026 |
+
if (cols > 1)
|
9027 |
+
inst.dpDiv.addClass('ui-datepicker-multi-' + cols).css('width', (width * cols) + 'em');
|
9028 |
+
inst.dpDiv[(numMonths[0] != 1 || numMonths[1] != 1 ? 'add' : 'remove') +
|
9029 |
+
'Class']('ui-datepicker-multi');
|
9030 |
+
inst.dpDiv[(this._get(inst, 'isRTL') ? 'add' : 'remove') +
|
9031 |
+
'Class']('ui-datepicker-rtl');
|
9032 |
+
if (inst == $.datepicker._curInst && $.datepicker._datepickerShowing && inst.input &&
|
9033 |
+
// #6694 - don't focus the input if it's already focused
|
9034 |
+
// this breaks the change event in IE
|
9035 |
+
inst.input.is(':visible') && !inst.input.is(':disabled') && inst.input[0] != document.activeElement)
|
9036 |
+
inst.input.focus();
|
9037 |
+
// deffered render of the years select (to avoid flashes on Firefox)
|
9038 |
+
if( inst.yearshtml ){
|
9039 |
+
var origyearshtml = inst.yearshtml;
|
9040 |
+
setTimeout(function(){
|
9041 |
+
//assure that inst.yearshtml didn't change.
|
9042 |
+
if( origyearshtml === inst.yearshtml && inst.yearshtml ){
|
9043 |
+
inst.dpDiv.find('select.ui-datepicker-year:first').replaceWith(inst.yearshtml);
|
9044 |
+
}
|
9045 |
+
origyearshtml = inst.yearshtml = null;
|
9046 |
+
}, 0);
|
9047 |
+
}
|
9048 |
+
},
|
9049 |
+
|
9050 |
+
/* Retrieve the size of left and top borders for an element.
|
9051 |
+
@param elem (jQuery object) the element of interest
|
9052 |
+
@return (number[2]) the left and top borders */
|
9053 |
+
_getBorders: function(elem) {
|
9054 |
+
var convert = function(value) {
|
9055 |
+
return {thin: 1, medium: 2, thick: 3}[value] || value;
|
9056 |
+
};
|
9057 |
+
return [parseFloat(convert(elem.css('border-left-width'))),
|
9058 |
+
parseFloat(convert(elem.css('border-top-width')))];
|
9059 |
+
},
|
9060 |
+
|
9061 |
+
/* Check positioning to remain on screen. */
|
9062 |
+
_checkOffset: function(inst, offset, isFixed) {
|
9063 |
+
var dpWidth = inst.dpDiv.outerWidth();
|
9064 |
+
var dpHeight = inst.dpDiv.outerHeight();
|
9065 |
+
var inputWidth = inst.input ? inst.input.outerWidth() : 0;
|
9066 |
+
var inputHeight = inst.input ? inst.input.outerHeight() : 0;
|
9067 |
+
var viewWidth = document.documentElement.clientWidth + $(document).scrollLeft();
|
9068 |
+
var viewHeight = document.documentElement.clientHeight + $(document).scrollTop();
|
9069 |
+
|
9070 |
+
offset.left -= (this._get(inst, 'isRTL') ? (dpWidth - inputWidth) : 0);
|
9071 |
+
offset.left -= (isFixed && offset.left == inst.input.offset().left) ? $(document).scrollLeft() : 0;
|
9072 |
+
offset.top -= (isFixed && offset.top == (inst.input.offset().top + inputHeight)) ? $(document).scrollTop() : 0;
|
9073 |
+
|
9074 |
+
// now check if datepicker is showing outside window viewport - move to a better place if so.
|
9075 |
+
offset.left -= Math.min(offset.left, (offset.left + dpWidth > viewWidth && viewWidth > dpWidth) ?
|
9076 |
+
Math.abs(offset.left + dpWidth - viewWidth) : 0);
|
9077 |
+
offset.top -= Math.min(offset.top, (offset.top + dpHeight > viewHeight && viewHeight > dpHeight) ?
|
9078 |
+
Math.abs(dpHeight + inputHeight) : 0);
|
9079 |
+
|
9080 |
+
return offset;
|
9081 |
+
},
|
9082 |
+
|
9083 |
+
/* Find an object's position on the screen. */
|
9084 |
+
_findPos: function(obj) {
|
9085 |
+
var inst = this._getInst(obj);
|
9086 |
+
var isRTL = this._get(inst, 'isRTL');
|
9087 |
+
while (obj && (obj.type == 'hidden' || obj.nodeType != 1 || $.expr.filters.hidden(obj))) {
|
9088 |
+
obj = obj[isRTL ? 'previousSibling' : 'nextSibling'];
|
9089 |
+
}
|
9090 |
+
var position = $(obj).offset();
|
9091 |
+
return [position.left, position.top];
|
9092 |
+
},
|
9093 |
+
|
9094 |
+
/* Hide the date picker from view.
|
9095 |
+
@param input element - the input field attached to the date picker */
|
9096 |
+
_hideDatepicker: function(input) {
|
9097 |
+
var inst = this._curInst;
|
9098 |
+
if (!inst || (input && inst != $.data(input, PROP_NAME)))
|
9099 |
+
return;
|
9100 |
+
if (this._datepickerShowing) {
|
9101 |
+
var showAnim = this._get(inst, 'showAnim');
|
9102 |
+
var duration = this._get(inst, 'duration');
|
9103 |
+
var self = this;
|
9104 |
+
var postProcess = function() {
|
9105 |
+
$.datepicker._tidyDialog(inst);
|
9106 |
+
self._curInst = null;
|
9107 |
+
};
|
9108 |
+
if ($.effects && $.effects[showAnim])
|
9109 |
+
inst.dpDiv.hide(showAnim, $.datepicker._get(inst, 'showOptions'), duration, postProcess);
|
9110 |
+
else
|
9111 |
+
inst.dpDiv[(showAnim == 'slideDown' ? 'slideUp' :
|
9112 |
+
(showAnim == 'fadeIn' ? 'fadeOut' : 'hide'))]((showAnim ? duration : null), postProcess);
|
9113 |
+
if (!showAnim)
|
9114 |
+
postProcess();
|
9115 |
+
this._datepickerShowing = false;
|
9116 |
+
var onClose = this._get(inst, 'onClose');
|
9117 |
+
if (onClose)
|
9118 |
+
onClose.apply((inst.input ? inst.input[0] : null),
|
9119 |
+
[(inst.input ? inst.input.val() : ''), inst]);
|
9120 |
+
this._lastInput = null;
|
9121 |
+
if (this._inDialog) {
|
9122 |
+
this._dialogInput.css({ position: 'absolute', left: '0', top: '-100px' });
|
9123 |
+
if ($.blockUI) {
|
9124 |
+
$.unblockUI();
|
9125 |
+
$('body').append(this.dpDiv);
|
9126 |
+
}
|
9127 |
+
}
|
9128 |
+
this._inDialog = false;
|
9129 |
+
}
|
9130 |
+
},
|
9131 |
+
|
9132 |
+
/* Tidy up after a dialog display. */
|
9133 |
+
_tidyDialog: function(inst) {
|
9134 |
+
inst.dpDiv.removeClass(this._dialogClass).unbind('.ui-datepicker-calendar');
|
9135 |
+
},
|
9136 |
+
|
9137 |
+
/* Close date picker if clicked elsewhere. */
|
9138 |
+
_checkExternalClick: function(event) {
|
9139 |
+
if (!$.datepicker._curInst)
|
9140 |
+
return;
|
9141 |
+
|
9142 |
+
var $target = $(event.target),
|
9143 |
+
inst = $.datepicker._getInst($target[0]);
|
9144 |
+
|
9145 |
+
if ( ( ( $target[0].id != $.datepicker._mainDivId &&
|
9146 |
+
$target.parents('#' + $.datepicker._mainDivId).length == 0 &&
|
9147 |
+
!$target.hasClass($.datepicker.markerClassName) &&
|
9148 |
+
!$target.hasClass($.datepicker._triggerClass) &&
|
9149 |
+
$.datepicker._datepickerShowing && !($.datepicker._inDialog && $.blockUI) ) ) ||
|
9150 |
+
( $target.hasClass($.datepicker.markerClassName) && $.datepicker._curInst != inst ) )
|
9151 |
+
$.datepicker._hideDatepicker();
|
9152 |
+
},
|
9153 |
+
|
9154 |
+
/* Adjust one of the date sub-fields. */
|
9155 |
+
_adjustDate: function(id, offset, period) {
|
9156 |
+
var target = $(id);
|
9157 |
+
var inst = this._getInst(target[0]);
|
9158 |
+
if (this._isDisabledDatepicker(target[0])) {
|
9159 |
+
return;
|
9160 |
+
}
|
9161 |
+
this._adjustInstDate(inst, offset +
|
9162 |
+
(period == 'M' ? this._get(inst, 'showCurrentAtPos') : 0), // undo positioning
|
9163 |
+
period);
|
9164 |
+
this._updateDatepicker(inst);
|
9165 |
+
},
|
9166 |
+
|
9167 |
+
/* Action for current link. */
|
9168 |
+
_gotoToday: function(id) {
|
9169 |
+
var target = $(id);
|
9170 |
+
var inst = this._getInst(target[0]);
|
9171 |
+
if (this._get(inst, 'gotoCurrent') && inst.currentDay) {
|
9172 |
+
inst.selectedDay = inst.currentDay;
|
9173 |
+
inst.drawMonth = inst.selectedMonth = inst.currentMonth;
|
9174 |
+
inst.drawYear = inst.selectedYear = inst.currentYear;
|
9175 |
+
}
|
9176 |
+
else {
|
9177 |
+
var date = new Date();
|
9178 |
+
inst.selectedDay = date.getDate();
|
9179 |
+
inst.drawMonth = inst.selectedMonth = date.getMonth();
|
9180 |
+
inst.drawYear = inst.selectedYear = date.getFullYear();
|
9181 |
+
}
|
9182 |
+
this._notifyChange(inst);
|
9183 |
+
this._adjustDate(target);
|
9184 |
+
},
|
9185 |
+
|
9186 |
+
/* Action for selecting a new month/year. */
|
9187 |
+
_selectMonthYear: function(id, select, period) {
|
9188 |
+
var target = $(id);
|
9189 |
+
var inst = this._getInst(target[0]);
|
9190 |
+
inst['selected' + (period == 'M' ? 'Month' : 'Year')] =
|
9191 |
+
inst['draw' + (period == 'M' ? 'Month' : 'Year')] =
|
9192 |
+
parseInt(select.options[select.selectedIndex].value,10);
|
9193 |
+
this._notifyChange(inst);
|
9194 |
+
this._adjustDate(target);
|
9195 |
+
},
|
9196 |
+
|
9197 |
+
/* Action for selecting a day. */
|
9198 |
+
_selectDay: function(id, month, year, td) {
|
9199 |
+
var target = $(id);
|
9200 |
+
if ($(td).hasClass(this._unselectableClass) || this._isDisabledDatepicker(target[0])) {
|
9201 |
+
return;
|
9202 |
+
}
|
9203 |
+
var inst = this._getInst(target[0]);
|
9204 |
+
inst.selectedDay = inst.currentDay = $('a', td).html();
|
9205 |
+
inst.selectedMonth = inst.currentMonth = month;
|
9206 |
+
inst.selectedYear = inst.currentYear = year;
|
9207 |
+
this._selectDate(id, this._formatDate(inst,
|
9208 |
+
inst.currentDay, inst.currentMonth, inst.currentYear));
|
9209 |
+
},
|
9210 |
+
|
9211 |
+
/* Erase the input field and hide the date picker. */
|
9212 |
+
_clearDate: function(id) {
|
9213 |
+
var target = $(id);
|
9214 |
+
var inst = this._getInst(target[0]);
|
9215 |
+
this._selectDate(target, '');
|
9216 |
+
},
|
9217 |
+
|
9218 |
+
/* Update the input field with the selected date. */
|
9219 |
+
_selectDate: function(id, dateStr) {
|
9220 |
+
var target = $(id);
|
9221 |
+
var inst = this._getInst(target[0]);
|
9222 |
+
dateStr = (dateStr != null ? dateStr : this._formatDate(inst));
|
9223 |
+
if (inst.input)
|
9224 |
+
inst.input.val(dateStr);
|
9225 |
+
this._updateAlternate(inst);
|
9226 |
+
var onSelect = this._get(inst, 'onSelect');
|
9227 |
+
if (onSelect)
|
9228 |
+
onSelect.apply((inst.input ? inst.input[0] : null), [dateStr, inst]); // trigger custom callback
|
9229 |
+
else if (inst.input)
|
9230 |
+
inst.input.trigger('change'); // fire the change event
|
9231 |
+
if (inst.inline)
|
9232 |
+
this._updateDatepicker(inst);
|
9233 |
+
else {
|
9234 |
+
this._hideDatepicker();
|
9235 |
+
this._lastInput = inst.input[0];
|
9236 |
+
if (typeof(inst.input[0]) != 'object')
|
9237 |
+
inst.input.focus(); // restore focus
|
9238 |
+
this._lastInput = null;
|
9239 |
+
}
|
9240 |
+
},
|
9241 |
+
|
9242 |
+
/* Update any alternate field to synchronise with the main field. */
|
9243 |
+
_updateAlternate: function(inst) {
|
9244 |
+
var altField = this._get(inst, 'altField');
|
9245 |
+
if (altField) { // update alternate field too
|
9246 |
+
var altFormat = this._get(inst, 'altFormat') || this._get(inst, 'dateFormat');
|
9247 |
+
var date = this._getDate(inst);
|
9248 |
+
var dateStr = this.formatDate(altFormat, date, this._getFormatConfig(inst));
|
9249 |
+
$(altField).each(function() { $(this).val(dateStr); });
|
9250 |
+
}
|
9251 |
+
},
|
9252 |
+
|
9253 |
+
/* Set as beforeShowDay function to prevent selection of weekends.
|
9254 |
+
@param date Date - the date to customise
|
9255 |
+
@return [boolean, string] - is this date selectable?, what is its CSS class? */
|
9256 |
+
noWeekends: function(date) {
|
9257 |
+
var day = date.getDay();
|
9258 |
+
return [(day > 0 && day < 6), ''];
|
9259 |
+
},
|
9260 |
+
|
9261 |
+
/* Set as calculateWeek to determine the week of the year based on the ISO 8601 definition.
|
9262 |
+
@param date Date - the date to get the week for
|
9263 |
+
@return number - the number of the week within the year that contains this date */
|
9264 |
+
iso8601Week: function(date) {
|
9265 |
+
var checkDate = new Date(date.getTime());
|
9266 |
+
// Find Thursday of this week starting on Monday
|
9267 |
+
checkDate.setDate(checkDate.getDate() + 4 - (checkDate.getDay() || 7));
|
9268 |
+
var time = checkDate.getTime();
|
9269 |
+
checkDate.setMonth(0); // Compare with Jan 1
|
9270 |
+
checkDate.setDate(1);
|
9271 |
+
return Math.floor(Math.round((time - checkDate) / 86400000) / 7) + 1;
|
9272 |
+
},
|
9273 |
+
|
9274 |
+
/* Parse a string value into a date object.
|
9275 |
+
See formatDate below for the possible formats.
|
9276 |
+
|
9277 |
+
@param format string - the expected format of the date
|
9278 |
+
@param value string - the date in the above format
|
9279 |
+
@param settings Object - attributes include:
|
9280 |
+
shortYearCutoff number - the cutoff year for determining the century (optional)
|
9281 |
+
dayNamesShort string[7] - abbreviated names of the days from Sunday (optional)
|
9282 |
+
dayNames string[7] - names of the days from Sunday (optional)
|
9283 |
+
monthNamesShort string[12] - abbreviated names of the months (optional)
|
9284 |
+
monthNames string[12] - names of the months (optional)
|
9285 |
+
@return Date - the extracted date value or null if value is blank */
|
9286 |
+
parseDate: function (format, value, settings) {
|
9287 |
+
if (format == null || value == null)
|
9288 |
+
throw 'Invalid arguments';
|
9289 |
+
value = (typeof value == 'object' ? value.toString() : value + '');
|
9290 |
+
if (value == '')
|
9291 |
+
return null;
|
9292 |
+
var shortYearCutoff = (settings ? settings.shortYearCutoff : null) || this._defaults.shortYearCutoff;
|
9293 |
+
shortYearCutoff = (typeof shortYearCutoff != 'string' ? shortYearCutoff :
|
9294 |
+
new Date().getFullYear() % 100 + parseInt(shortYearCutoff, 10));
|
9295 |
+
var dayNamesShort = (settings ? settings.dayNamesShort : null) || this._defaults.dayNamesShort;
|
9296 |
+
var dayNames = (settings ? settings.dayNames : null) || this._defaults.dayNames;
|
9297 |
+
var monthNamesShort = (settings ? settings.monthNamesShort : null) || this._defaults.monthNamesShort;
|
9298 |
+
var monthNames = (settings ? settings.monthNames : null) || this._defaults.monthNames;
|
9299 |
+
var year = -1;
|
9300 |
+
var month = -1;
|
9301 |
+
var day = -1;
|
9302 |
+
var doy = -1;
|
9303 |
+
var literal = false;
|
9304 |
+
// Check whether a format character is doubled
|
9305 |
+
var lookAhead = function(match) {
|
9306 |
+
var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) == match);
|
9307 |
+
if (matches)
|
9308 |
+
iFormat++;
|
9309 |
+
return matches;
|
9310 |
+
};
|
9311 |
+
// Extract a number from the string value
|
9312 |
+
var getNumber = function(match) {
|
9313 |
+
var isDoubled = lookAhead(match);
|
9314 |
+
var size = (match == '@' ? 14 : (match == '!' ? 20 :
|
9315 |
+
(match == 'y' && isDoubled ? 4 : (match == 'o' ? 3 : 2))));
|
9316 |
+
var digits = new RegExp('^\\d{1,' + size + '}');
|
9317 |
+
var num = value.substring(iValue).match(digits);
|
9318 |
+
if (!num)
|
9319 |
+
throw 'Missing number at position ' + iValue;
|
9320 |
+
iValue += num[0].length;
|
9321 |
+
return parseInt(num[0], 10);
|
9322 |
+
};
|
9323 |
+
// Extract a name from the string value and convert to an index
|
9324 |
+
var getName = function(match, shortNames, longNames) {
|
9325 |
+
var names = $.map(lookAhead(match) ? longNames : shortNames, function (v, k) {
|
9326 |
+
return [ [k, v] ];
|
9327 |
+
}).sort(function (a, b) {
|
9328 |
+
return -(a[1].length - b[1].length);
|
9329 |
+
});
|
9330 |
+
var index = -1;
|
9331 |
+
$.each(names, function (i, pair) {
|
9332 |
+
var name = pair[1];
|
9333 |
+
if (value.substr(iValue, name.length).toLowerCase() == name.toLowerCase()) {
|
9334 |
+
index = pair[0];
|
9335 |
+
iValue += name.length;
|
9336 |
+
return false;
|
9337 |
+
}
|
9338 |
+
});
|
9339 |
+
if (index != -1)
|
9340 |
+
return index + 1;
|
9341 |
+
else
|
9342 |
+
throw 'Unknown name at position ' + iValue;
|
9343 |
+
};
|
9344 |
+
// Confirm that a literal character matches the string value
|
9345 |
+
var checkLiteral = function() {
|
9346 |
+
if (value.charAt(iValue) != format.charAt(iFormat))
|
9347 |
+
throw 'Unexpected literal at position ' + iValue;
|
9348 |
+
iValue++;
|
9349 |
+
};
|
9350 |
+
var iValue = 0;
|
9351 |
+
for (var iFormat = 0; iFormat < format.length; iFormat++) {
|
9352 |
+
if (literal)
|
9353 |
+
if (format.charAt(iFormat) == "'" && !lookAhead("'"))
|
9354 |
+
literal = false;
|
9355 |
+
else
|
9356 |
+
checkLiteral();
|
9357 |
+
else
|
9358 |
+
switch (format.charAt(iFormat)) {
|
9359 |
+
case 'd':
|
9360 |
+
day = getNumber('d');
|
9361 |
+
break;
|
9362 |
+
case 'D':
|
9363 |
+
getName('D', dayNamesShort, dayNames);
|
9364 |
+
break;
|
9365 |
+
case 'o':
|
9366 |
+
doy = getNumber('o');
|
9367 |
+
break;
|
9368 |
+
case 'm':
|
9369 |
+
month = getNumber('m');
|
9370 |
+
break;
|
9371 |
+
case 'M':
|
9372 |
+
month = getName('M', monthNamesShort, monthNames);
|
9373 |
+
break;
|
9374 |
+
case 'y':
|
9375 |
+
year = getNumber('y');
|
9376 |
+
break;
|
9377 |
+
case '@':
|
9378 |
+
var date = new Date(getNumber('@'));
|
9379 |
+
year = date.getFullYear();
|
9380 |
+
month = date.getMonth() + 1;
|
9381 |
+
day = date.getDate();
|
9382 |
+
break;
|
9383 |
+
case '!':
|
9384 |
+
var date = new Date((getNumber('!') - this._ticksTo1970) / 10000);
|
9385 |
+
year = date.getFullYear();
|
9386 |
+
month = date.getMonth() + 1;
|
9387 |
+
day = date.getDate();
|
9388 |
+
break;
|
9389 |
+
case "'":
|
9390 |
+
if (lookAhead("'"))
|
9391 |
+
checkLiteral();
|
9392 |
+
else
|
9393 |
+
literal = true;
|
9394 |
+
break;
|
9395 |
+
default:
|
9396 |
+
checkLiteral();
|
9397 |
+
}
|
9398 |
+
}
|
9399 |
+
if (iValue < value.length){
|
9400 |
+
throw "Extra/unparsed characters found in date: " + value.substring(iValue);
|
9401 |
+
}
|
9402 |
+
if (year == -1)
|
9403 |
+
year = new Date().getFullYear();
|
9404 |
+
else if (year < 100)
|
9405 |
+
year += new Date().getFullYear() - new Date().getFullYear() % 100 +
|
9406 |
+
(year <= shortYearCutoff ? 0 : -100);
|
9407 |
+
if (doy > -1) {
|
9408 |
+
month = 1;
|
9409 |
+
day = doy;
|
9410 |
+
do {
|
9411 |
+
var dim = this._getDaysInMonth(year, month - 1);
|
9412 |
+
if (day <= dim)
|
9413 |
+
break;
|
9414 |
+
month++;
|
9415 |
+
day -= dim;
|
9416 |
+
} while (true);
|
9417 |
+
}
|
9418 |
+
var date = this._daylightSavingAdjust(new Date(year, month - 1, day));
|
9419 |
+
if (date.getFullYear() != year || date.getMonth() + 1 != month || date.getDate() != day)
|
9420 |
+
throw 'Invalid date'; // E.g. 31/02/00
|
9421 |
+
return date;
|
9422 |
+
},
|
9423 |
+
|
9424 |
+
/* Standard date formats. */
|
9425 |
+
ATOM: 'yy-mm-dd', // RFC 3339 (ISO 8601)
|
9426 |
+
COOKIE: 'D, dd M yy',
|
9427 |
+
ISO_8601: 'yy-mm-dd',
|
9428 |
+
RFC_822: 'D, d M y',
|
9429 |
+
RFC_850: 'DD, dd-M-y',
|
9430 |
+
RFC_1036: 'D, d M y',
|
9431 |
+
RFC_1123: 'D, d M yy',
|
9432 |
+
RFC_2822: 'D, d M yy',
|
9433 |
+
RSS: 'D, d M y', // RFC 822
|
9434 |
+
TICKS: '!',
|
9435 |
+
TIMESTAMP: '@',
|
9436 |
+
W3C: 'yy-mm-dd', // ISO 8601
|
9437 |
+
|
9438 |
+
_ticksTo1970: (((1970 - 1) * 365 + Math.floor(1970 / 4) - Math.floor(1970 / 100) +
|
9439 |
+
Math.floor(1970 / 400)) * 24 * 60 * 60 * 10000000),
|
9440 |
+
|
9441 |
+
/* Format a date object into a string value.
|
9442 |
+
The format can be combinations of the following:
|
9443 |
+
d - day of month (no leading zero)
|
9444 |
+
dd - day of month (two digit)
|
9445 |
+
o - day of year (no leading zeros)
|
9446 |
+
oo - day of year (three digit)
|
9447 |
+
D - day name short
|
9448 |
+
DD - day name long
|
9449 |
+
m - month of year (no leading zero)
|
9450 |
+
mm - month of year (two digit)
|
9451 |
+
M - month name short
|
9452 |
+
MM - month name long
|
9453 |
+
y - year (two digit)
|
9454 |
+
yy - year (four digit)
|
9455 |
+
@ - Unix timestamp (ms since 01/01/1970)
|
9456 |
+
! - Windows ticks (100ns since 01/01/0001)
|
9457 |
+
'...' - literal text
|
9458 |
+
'' - single quote
|
9459 |
+
|
9460 |
+
@param format string - the desired format of the date
|
9461 |
+
@param date Date - the date value to format
|
9462 |
+
@param settings Object - attributes include:
|
9463 |
+
dayNamesShort string[7] - abbreviated names of the days from Sunday (optional)
|
9464 |
+
dayNames string[7] - names of the days from Sunday (optional)
|
9465 |
+
monthNamesShort string[12] - abbreviated names of the months (optional)
|
9466 |
+
monthNames string[12] - names of the months (optional)
|
9467 |
+
@return string - the date in the above format */
|
9468 |
+
formatDate: function (format, date, settings) {
|
9469 |
+
if (!date)
|
9470 |
+
return '';
|
9471 |
+
var dayNamesShort = (settings ? settings.dayNamesShort : null) || this._defaults.dayNamesShort;
|
9472 |
+
var dayNames = (settings ? settings.dayNames : null) || this._defaults.dayNames;
|
9473 |
+
var monthNamesShort = (settings ? settings.monthNamesShort : null) || this._defaults.monthNamesShort;
|
9474 |
+
var monthNames = (settings ? settings.monthNames : null) || this._defaults.monthNames;
|
9475 |
+
// Check whether a format character is doubled
|
9476 |
+
var lookAhead = function(match) {
|
9477 |
+
var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) == match);
|
9478 |
+
if (matches)
|
9479 |
+
iFormat++;
|
9480 |
+
return matches;
|
9481 |
+
};
|
9482 |
+
// Format a number, with leading zero if necessary
|
9483 |
+
var formatNumber = function(match, value, len) {
|
9484 |
+
var num = '' + value;
|
9485 |
+
if (lookAhead(match))
|
9486 |
+
while (num.length < len)
|
9487 |
+
num = '0' + num;
|
9488 |
+
return num;
|
9489 |
+
};
|
9490 |
+
// Format a name, short or long as requested
|
9491 |
+
var formatName = function(match, value, shortNames, longNames) {
|
9492 |
+
return (lookAhead(match) ? longNames[value] : shortNames[value]);
|
9493 |
+
};
|
9494 |
+
var output = '';
|
9495 |
+
var literal = false;
|
9496 |
+
if (date)
|
9497 |
+
for (var iFormat = 0; iFormat < format.length; iFormat++) {
|
9498 |
+
if (literal)
|
9499 |
+
if (format.charAt(iFormat) == "'" && !lookAhead("'"))
|
9500 |
+
literal = false;
|
9501 |
+
else
|
9502 |
+
output += format.charAt(iFormat);
|
9503 |
+
else
|
9504 |
+
switch (format.charAt(iFormat)) {
|
9505 |
+
case 'd':
|
9506 |
+
output += formatNumber('d', date.getDate(), 2);
|
9507 |
+
break;
|
9508 |
+
case 'D':
|
9509 |
+
output += formatName('D', date.getDay(), dayNamesShort, dayNames);
|
9510 |
+
break;
|
9511 |
+
case 'o':
|
9512 |
+
output += formatNumber('o',
|
9513 |
+
Math.round((new Date(date.getFullYear(), date.getMonth(), date.getDate()).getTime() - new Date(date.getFullYear(), 0, 0).getTime()) / 86400000), 3);
|
9514 |
+
break;
|
9515 |
+
case 'm':
|
9516 |
+
output += formatNumber('m', date.getMonth() + 1, 2);
|
9517 |
+
break;
|
9518 |
+
case 'M':
|
9519 |
+
output += formatName('M', date.getMonth(), monthNamesShort, monthNames);
|
9520 |
+
break;
|
9521 |
+
case 'y':
|
9522 |
+
output += (lookAhead('y') ? date.getFullYear() :
|
9523 |
+
(date.getYear() % 100 < 10 ? '0' : '') + date.getYear() % 100);
|
9524 |
+
break;
|
9525 |
+
case '@':
|
9526 |
+
output += date.getTime();
|
9527 |
+
break;
|
9528 |
+
case '!':
|
9529 |
+
output += date.getTime() * 10000 + this._ticksTo1970;
|
9530 |
+
break;
|
9531 |
+
case "'":
|
9532 |
+
if (lookAhead("'"))
|
9533 |
+
output += "'";
|
9534 |
+
else
|
9535 |
+
literal = true;
|
9536 |
+
break;
|
9537 |
+
default:
|
9538 |
+
output += format.charAt(iFormat);
|
9539 |
+
}
|
9540 |
+
}
|
9541 |
+
return output;
|
9542 |
+
},
|
9543 |
+
|
9544 |
+
/* Extract all possible characters from the date format. */
|
9545 |
+
_possibleChars: function (format) {
|
9546 |
+
var chars = '';
|
9547 |
+
var literal = false;
|
9548 |
+
// Check whether a format character is doubled
|
9549 |
+
var lookAhead = function(match) {
|
9550 |
+
var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) == match);
|
9551 |
+
if (matches)
|
9552 |
+
iFormat++;
|
9553 |
+
return matches;
|
9554 |
+
};
|
9555 |
+
for (var iFormat = 0; iFormat < format.length; iFormat++)
|
9556 |
+
if (literal)
|
9557 |
+
if (format.charAt(iFormat) == "'" && !lookAhead("'"))
|
9558 |
+
literal = false;
|
9559 |
+
else
|
9560 |
+
chars += format.charAt(iFormat);
|
9561 |
+
else
|
9562 |
+
switch (format.charAt(iFormat)) {
|
9563 |
+
case 'd': case 'm': case 'y': case '@':
|
9564 |
+
chars += '0123456789';
|
9565 |
+
break;
|
9566 |
+
case 'D': case 'M':
|
9567 |
+
return null; // Accept anything
|
9568 |
+
case "'":
|
9569 |
+
if (lookAhead("'"))
|
9570 |
+
chars += "'";
|
9571 |
+
else
|
9572 |
+
literal = true;
|
9573 |
+
break;
|
9574 |
+
default:
|
9575 |
+
chars += format.charAt(iFormat);
|
9576 |
+
}
|
9577 |
+
return chars;
|
9578 |
+
},
|
9579 |
+
|
9580 |
+
/* Get a setting value, defaulting if necessary. */
|
9581 |
+
_get: function(inst, name) {
|
9582 |
+
return inst.settings[name] !== undefined ?
|
9583 |
+
inst.settings[name] : this._defaults[name];
|
9584 |
+
},
|
9585 |
+
|
9586 |
+
/* Parse existing date and initialise date picker. */
|
9587 |
+
_setDateFromField: function(inst, noDefault) {
|
9588 |
+
if (inst.input.val() == inst.lastVal) {
|
9589 |
+
return;
|
9590 |
+
}
|
9591 |
+
var dateFormat = this._get(inst, 'dateFormat');
|
9592 |
+
var dates = inst.lastVal = inst.input ? inst.input.val() : null;
|
9593 |
+
var date, defaultDate;
|
9594 |
+
date = defaultDate = this._getDefaultDate(inst);
|
9595 |
+
var settings = this._getFormatConfig(inst);
|
9596 |
+
try {
|
9597 |
+
date = this.parseDate(dateFormat, dates, settings) || defaultDate;
|
9598 |
+
} catch (event) {
|
9599 |
+
this.log(event);
|
9600 |
+
dates = (noDefault ? '' : dates);
|
9601 |
+
}
|
9602 |
+
inst.selectedDay = date.getDate();
|
9603 |
+
inst.drawMonth = inst.selectedMonth = date.getMonth();
|
9604 |
+
inst.drawYear = inst.selectedYear = date.getFullYear();
|
9605 |
+
inst.currentDay = (dates ? date.getDate() : 0);
|
9606 |
+
inst.currentMonth = (dates ? date.getMonth() : 0);
|
9607 |
+
inst.currentYear = (dates ? date.getFullYear() : 0);
|
9608 |
+
this._adjustInstDate(inst);
|
9609 |
+
},
|
9610 |
+
|
9611 |
+
/* Retrieve the default date shown on opening. */
|
9612 |
+
_getDefaultDate: function(inst) {
|
9613 |
+
return this._restrictMinMax(inst,
|
9614 |
+
this._determineDate(inst, this._get(inst, 'defaultDate'), new Date()));
|
9615 |
+
},
|
9616 |
+
|
9617 |
+
/* A date may be specified as an exact value or a relative one. */
|
9618 |
+
_determineDate: function(inst, date, defaultDate) {
|
9619 |
+
var offsetNumeric = function(offset) {
|
9620 |
+
var date = new Date();
|
9621 |
+
date.setDate(date.getDate() + offset);
|
9622 |
+
return date;
|
9623 |
+
};
|
9624 |
+
var offsetString = function(offset) {
|
9625 |
+
try {
|
9626 |
+
return $.datepicker.parseDate($.datepicker._get(inst, 'dateFormat'),
|
9627 |
+
offset, $.datepicker._getFormatConfig(inst));
|
9628 |
+
}
|
9629 |
+
catch (e) {
|
9630 |
+
// Ignore
|
9631 |
+
}
|
9632 |
+
var date = (offset.toLowerCase().match(/^c/) ?
|
9633 |
+
$.datepicker._getDate(inst) : null) || new Date();
|
9634 |
+
var year = date.getFullYear();
|
9635 |
+
var month = date.getMonth();
|
9636 |
+
var day = date.getDate();
|
9637 |
+
var pattern = /([+-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g;
|
9638 |
+
var matches = pattern.exec(offset);
|
9639 |
+
while (matches) {
|
9640 |
+
switch (matches[2] || 'd') {
|
9641 |
+
case 'd' : case 'D' :
|
9642 |
+
day += parseInt(matches[1],10); break;
|
9643 |
+
case 'w' : case 'W' :
|
9644 |
+
day += parseInt(matches[1],10) * 7; break;
|
9645 |
+
case 'm' : case 'M' :
|
9646 |
+
month += parseInt(matches[1],10);
|
9647 |
+
day = Math.min(day, $.datepicker._getDaysInMonth(year, month));
|
9648 |
+
break;
|
9649 |
+
case 'y': case 'Y' :
|
9650 |
+
year += parseInt(matches[1],10);
|
9651 |
+
day = Math.min(day, $.datepicker._getDaysInMonth(year, month));
|
9652 |
+
break;
|
9653 |
+
}
|
9654 |
+
matches = pattern.exec(offset);
|
9655 |
+
}
|
9656 |
+
return new Date(year, month, day);
|
9657 |
+
};
|
9658 |
+
var newDate = (date == null || date === '' ? defaultDate : (typeof date == 'string' ? offsetString(date) :
|
9659 |
+
(typeof date == 'number' ? (isNaN(date) ? defaultDate : offsetNumeric(date)) : new Date(date.getTime()))));
|
9660 |
+
newDate = (newDate && newDate.toString() == 'Invalid Date' ? defaultDate : newDate);
|
9661 |
+
if (newDate) {
|
9662 |
+
newDate.setHours(0);
|
9663 |
+
newDate.setMinutes(0);
|
9664 |
+
newDate.setSeconds(0);
|
9665 |
+
newDate.setMilliseconds(0);
|
9666 |
+
}
|
9667 |
+
return this._daylightSavingAdjust(newDate);
|
9668 |
+
},
|
9669 |
+
|
9670 |
+
/* Handle switch to/from daylight saving.
|
9671 |
+
Hours may be non-zero on daylight saving cut-over:
|
9672 |
+
> 12 when midnight changeover, but then cannot generate
|
9673 |
+
midnight datetime, so jump to 1AM, otherwise reset.
|
9674 |
+
@param date (Date) the date to check
|
9675 |
+
@return (Date) the corrected date */
|
9676 |
+
_daylightSavingAdjust: function(date) {
|
9677 |
+
if (!date) return null;
|
9678 |
+
date.setHours(date.getHours() > 12 ? date.getHours() + 2 : 0);
|
9679 |
+
return date;
|
9680 |
+
},
|
9681 |
+
|
9682 |
+
/* Set the date(s) directly. */
|
9683 |
+
_setDate: function(inst, date, noChange) {
|
9684 |
+
var clear = !date;
|
9685 |
+
var origMonth = inst.selectedMonth;
|
9686 |
+
var origYear = inst.selectedYear;
|
9687 |
+
var newDate = this._restrictMinMax(inst, this._determineDate(inst, date, new Date()));
|
9688 |
+
inst.selectedDay = inst.currentDay = newDate.getDate();
|
9689 |
+
inst.drawMonth = inst.selectedMonth = inst.currentMonth = newDate.getMonth();
|
9690 |
+
inst.drawYear = inst.selectedYear = inst.currentYear = newDate.getFullYear();
|
9691 |
+
if ((origMonth != inst.selectedMonth || origYear != inst.selectedYear) && !noChange)
|
9692 |
+
this._notifyChange(inst);
|
9693 |
+
this._adjustInstDate(inst);
|
9694 |
+
if (inst.input) {
|
9695 |
+
inst.input.val(clear ? '' : this._formatDate(inst));
|
9696 |
+
}
|
9697 |
+
},
|
9698 |
+
|
9699 |
+
/* Retrieve the date(s) directly. */
|
9700 |
+
_getDate: function(inst) {
|
9701 |
+
var startDate = (!inst.currentYear || (inst.input && inst.input.val() == '') ? null :
|
9702 |
+
this._daylightSavingAdjust(new Date(
|
9703 |
+
inst.currentYear, inst.currentMonth, inst.currentDay)));
|
9704 |
+
return startDate;
|
9705 |
+
},
|
9706 |
+
|
9707 |
+
/* Generate the HTML for the current state of the date picker. */
|
9708 |
+
_generateHTML: function(inst) {
|
9709 |
+
var today = new Date();
|
9710 |
+
today = this._daylightSavingAdjust(
|
9711 |
+
new Date(today.getFullYear(), today.getMonth(), today.getDate())); // clear time
|
9712 |
+
var isRTL = this._get(inst, 'isRTL');
|
9713 |
+
var showButtonPanel = this._get(inst, 'showButtonPanel');
|
9714 |
+
var hideIfNoPrevNext = this._get(inst, 'hideIfNoPrevNext');
|
9715 |
+
var navigationAsDateFormat = this._get(inst, 'navigationAsDateFormat');
|
9716 |
+
var numMonths = this._getNumberOfMonths(inst);
|
9717 |
+
var showCurrentAtPos = this._get(inst, 'showCurrentAtPos');
|
9718 |
+
var stepMonths = this._get(inst, 'stepMonths');
|
9719 |
+
var isMultiMonth = (numMonths[0] != 1 || numMonths[1] != 1);
|
9720 |
+
var currentDate = this._daylightSavingAdjust((!inst.currentDay ? new Date(9999, 9, 9) :
|
9721 |
+
new Date(inst.currentYear, inst.currentMonth, inst.currentDay)));
|
9722 |
+
var minDate = this._getMinMaxDate(inst, 'min');
|
9723 |
+
var maxDate = this._getMinMaxDate(inst, 'max');
|
9724 |
+
var drawMonth = inst.drawMonth - showCurrentAtPos;
|
9725 |
+
var drawYear = inst.drawYear;
|
9726 |
+
if (drawMonth < 0) {
|
9727 |
+
drawMonth += 12;
|
9728 |
+
drawYear--;
|
9729 |
+
}
|
9730 |
+
if (maxDate) {
|
9731 |
+
var maxDraw = this._daylightSavingAdjust(new Date(maxDate.getFullYear(),
|
9732 |
+
maxDate.getMonth() - (numMonths[0] * numMonths[1]) + 1, maxDate.getDate()));
|
9733 |
+
maxDraw = (minDate && maxDraw < minDate ? minDate : maxDraw);
|
9734 |
+
while (this._daylightSavingAdjust(new Date(drawYear, drawMonth, 1)) > maxDraw) {
|
9735 |
+
drawMonth--;
|
9736 |
+
if (drawMonth < 0) {
|
9737 |
+
drawMonth = 11;
|
9738 |
+
drawYear--;
|
9739 |
+
}
|
9740 |
+
}
|
9741 |
+
}
|
9742 |
+
inst.drawMonth = drawMonth;
|
9743 |
+
inst.drawYear = drawYear;
|
9744 |
+
var prevText = this._get(inst, 'prevText');
|
9745 |
+
prevText = (!navigationAsDateFormat ? prevText : this.formatDate(prevText,
|
9746 |
+
this._daylightSavingAdjust(new Date(drawYear, drawMonth - stepMonths, 1)),
|
9747 |
+
this._getFormatConfig(inst)));
|
9748 |
+
var prev = (this._canAdjustMonth(inst, -1, drawYear, drawMonth) ?
|
9749 |
+
'<a class="ui-datepicker-prev ui-corner-all" onclick="DP_jQuery_' + dpuuid +
|
9750 |
+
'.datepicker._adjustDate(\'#' + inst.id + '\', -' + stepMonths + ', \'M\');"' +
|
9751 |
+
' title="' + prevText + '"><span class="ui-icon ui-icon-circle-triangle-' + ( isRTL ? 'e' : 'w') + '">' + prevText + '</span></a>' :
|
9752 |
+
(hideIfNoPrevNext ? '' : '<a class="ui-datepicker-prev ui-corner-all ui-state-disabled" title="'+ prevText +'"><span class="ui-icon ui-icon-circle-triangle-' + ( isRTL ? 'e' : 'w') + '">' + prevText + '</span></a>'));
|
9753 |
+
var nextText = this._get(inst, 'nextText');
|
9754 |
+
nextText = (!navigationAsDateFormat ? nextText : this.formatDate(nextText,
|
9755 |
+
this._daylightSavingAdjust(new Date(drawYear, drawMonth + stepMonths, 1)),
|
9756 |
+
this._getFormatConfig(inst)));
|
9757 |
+
var next = (this._canAdjustMonth(inst, +1, drawYear, drawMonth) ?
|
9758 |
+
'<a class="ui-datepicker-next ui-corner-all" onclick="DP_jQuery_' + dpuuid +
|
9759 |
+
'.datepicker._adjustDate(\'#' + inst.id + '\', +' + stepMonths + ', \'M\');"' +
|
9760 |
+
' title="' + nextText + '"><span class="ui-icon ui-icon-circle-triangle-' + ( isRTL ? 'w' : 'e') + '">' + nextText + '</span></a>' :
|
9761 |
+
(hideIfNoPrevNext ? '' : '<a class="ui-datepicker-next ui-corner-all ui-state-disabled" title="'+ nextText + '"><span class="ui-icon ui-icon-circle-triangle-' + ( isRTL ? 'w' : 'e') + '">' + nextText + '</span></a>'));
|
9762 |
+
var currentText = this._get(inst, 'currentText');
|
9763 |
+
var gotoDate = (this._get(inst, 'gotoCurrent') && inst.currentDay ? currentDate : today);
|
9764 |
+
currentText = (!navigationAsDateFormat ? currentText :
|
9765 |
+
this.formatDate(currentText, gotoDate, this._getFormatConfig(inst)));
|
9766 |
+
var controls = (!inst.inline ? '<button type="button" class="ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all" onclick="DP_jQuery_' + dpuuid +
|
9767 |
+
'.datepicker._hideDatepicker();">' + this._get(inst, 'closeText') + '</button>' : '');
|
9768 |
+
var buttonPanel = (showButtonPanel) ? '<div class="ui-datepicker-buttonpane ui-widget-content">' + (isRTL ? controls : '') +
|
9769 |
+
(this._isInRange(inst, gotoDate) ? '<button type="button" class="ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all" onclick="DP_jQuery_' + dpuuid +
|
9770 |
+
'.datepicker._gotoToday(\'#' + inst.id + '\');"' +
|
9771 |
+
'>' + currentText + '</button>' : '') + (isRTL ? '' : controls) + '</div>' : '';
|
9772 |
+
var firstDay = parseInt(this._get(inst, 'firstDay'),10);
|
9773 |
+
firstDay = (isNaN(firstDay) ? 0 : firstDay);
|
9774 |
+
var showWeek = this._get(inst, 'showWeek');
|
9775 |
+
var dayNames = this._get(inst, 'dayNames');
|
9776 |
+
var dayNamesShort = this._get(inst, 'dayNamesShort');
|
9777 |
+
var dayNamesMin = this._get(inst, 'dayNamesMin');
|
9778 |
+
var monthNames = this._get(inst, 'monthNames');
|
9779 |
+
var monthNamesShort = this._get(inst, 'monthNamesShort');
|
9780 |
+
var beforeShowDay = this._get(inst, 'beforeShowDay');
|
9781 |
+
var showOtherMonths = this._get(inst, 'showOtherMonths');
|
9782 |
+
var selectOtherMonths = this._get(inst, 'selectOtherMonths');
|
9783 |
+
var calculateWeek = this._get(inst, 'calculateWeek') || this.iso8601Week;
|
9784 |
+
var defaultDate = this._getDefaultDate(inst);
|
9785 |
+
var html = '';
|
9786 |
+
for (var row = 0; row < numMonths[0]; row++) {
|
9787 |
+
var group = '';
|
9788 |
+
this.maxRows = 4;
|
9789 |
+
for (var col = 0; col < numMonths[1]; col++) {
|
9790 |
+
var selectedDate = this._daylightSavingAdjust(new Date(drawYear, drawMonth, inst.selectedDay));
|
9791 |
+
var cornerClass = ' ui-corner-all';
|
9792 |
+
var calender = '';
|
9793 |
+
if (isMultiMonth) {
|
9794 |
+
calender += '<div class="ui-datepicker-group';
|
9795 |
+
if (numMonths[1] > 1)
|
9796 |
+
switch (col) {
|
9797 |
+
case 0: calender += ' ui-datepicker-group-first';
|
9798 |
+
cornerClass = ' ui-corner-' + (isRTL ? 'right' : 'left'); break;
|
9799 |
+
case numMonths[1]-1: calender += ' ui-datepicker-group-last';
|
9800 |
+
cornerClass = ' ui-corner-' + (isRTL ? 'left' : 'right'); break;
|
9801 |
+
default: calender += ' ui-datepicker-group-middle'; cornerClass = ''; break;
|
9802 |
+
}
|
9803 |
+
calender += '">';
|
9804 |
+
}
|
9805 |
+
calender += '<div class="ui-datepicker-header ui-widget-header ui-helper-clearfix' + cornerClass + '">' +
|
9806 |
+
(/all|left/.test(cornerClass) && row == 0 ? (isRTL ? next : prev) : '') +
|
9807 |
+
(/all|right/.test(cornerClass) && row == 0 ? (isRTL ? prev : next) : '') +
|
9808 |
+
this._generateMonthYearHeader(inst, drawMonth, drawYear, minDate, maxDate,
|
9809 |
+
row > 0 || col > 0, monthNames, monthNamesShort) + // draw month headers
|
9810 |
+
'</div><table class="ui-datepicker-calendar"><thead>' +
|
9811 |
+
'<tr>';
|
9812 |
+
var thead = (showWeek ? '<th class="ui-datepicker-week-col">' + this._get(inst, 'weekHeader') + '</th>' : '');
|
9813 |
+
for (var dow = 0; dow < 7; dow++) { // days of the week
|
9814 |
+
var day = (dow + firstDay) % 7;
|
9815 |
+
thead += '<th' + ((dow + firstDay + 6) % 7 >= 5 ? ' class="ui-datepicker-week-end"' : '') + '>' +
|
9816 |
+
'<span title="' + dayNames[day] + '">' + dayNamesMin[day] + '</span></th>';
|
9817 |
+
}
|
9818 |
+
calender += thead + '</tr></thead><tbody>';
|
9819 |
+
var daysInMonth = this._getDaysInMonth(drawYear, drawMonth);
|
9820 |
+
if (drawYear == inst.selectedYear && drawMonth == inst.selectedMonth)
|
9821 |
+
inst.selectedDay = Math.min(inst.selectedDay, daysInMonth);
|
9822 |
+
var leadDays = (this._getFirstDayOfMonth(drawYear, drawMonth) - firstDay + 7) % 7;
|
9823 |
+
var curRows = Math.ceil((leadDays + daysInMonth) / 7); // calculate the number of rows to generate
|
9824 |
+
var numRows = (isMultiMonth ? this.maxRows > curRows ? this.maxRows : curRows : curRows); //If multiple months, use the higher number of rows (see #7043)
|
9825 |
+
this.maxRows = numRows;
|
9826 |
+
var printDate = this._daylightSavingAdjust(new Date(drawYear, drawMonth, 1 - leadDays));
|
9827 |
+
for (var dRow = 0; dRow < numRows; dRow++) { // create date picker rows
|
9828 |
+
calender += '<tr>';
|
9829 |
+
var tbody = (!showWeek ? '' : '<td class="ui-datepicker-week-col">' +
|
9830 |
+
this._get(inst, 'calculateWeek')(printDate) + '</td>');
|
9831 |
+
for (var dow = 0; dow < 7; dow++) { // create date picker days
|
9832 |
+
var daySettings = (beforeShowDay ?
|
9833 |
+
beforeShowDay.apply((inst.input ? inst.input[0] : null), [printDate]) : [true, '']);
|
9834 |
+
var otherMonth = (printDate.getMonth() != drawMonth);
|
9835 |
+
var unselectable = (otherMonth && !selectOtherMonths) || !daySettings[0] ||
|
9836 |
+
(minDate && printDate < minDate) || (maxDate && printDate > maxDate);
|
9837 |
+
tbody += '<td class="' +
|
9838 |
+
((dow + firstDay + 6) % 7 >= 5 ? ' ui-datepicker-week-end' : '') + // highlight weekends
|
9839 |
+
(otherMonth ? ' ui-datepicker-other-month' : '') + // highlight days from other months
|
9840 |
+
((printDate.getTime() == selectedDate.getTime() && drawMonth == inst.selectedMonth && inst._keyEvent) || // user pressed key
|
9841 |
+
(defaultDate.getTime() == printDate.getTime() && defaultDate.getTime() == selectedDate.getTime()) ?
|
9842 |
+
// or defaultDate is current printedDate and defaultDate is selectedDate
|
9843 |
+
' ' + this._dayOverClass : '') + // highlight selected day
|
9844 |
+
(unselectable ? ' ' + this._unselectableClass + ' ui-state-disabled': '') + // highlight unselectable days
|
9845 |
+
(otherMonth && !showOtherMonths ? '' : ' ' + daySettings[1] + // highlight custom dates
|
9846 |
+
(printDate.getTime() == currentDate.getTime() ? ' ' + this._currentClass : '') + // highlight selected day
|
9847 |
+
(printDate.getTime() == today.getTime() ? ' ui-datepicker-today' : '')) + '"' + // highlight today (if different)
|
9848 |
+
((!otherMonth || showOtherMonths) && daySettings[2] ? ' title="' + daySettings[2] + '"' : '') + // cell title
|
9849 |
+
(unselectable ? '' : ' onclick="DP_jQuery_' + dpuuid + '.datepicker._selectDay(\'#' +
|
9850 |
+
inst.id + '\',' + printDate.getMonth() + ',' + printDate.getFullYear() + ', this);return false;"') + '>' + // actions
|
9851 |
+
(otherMonth && !showOtherMonths ? ' ' : // display for other months
|
9852 |
+
(unselectable ? '<span class="ui-state-default">' + printDate.getDate() + '</span>' : '<a class="ui-state-default' +
|
9853 |
+
(printDate.getTime() == today.getTime() ? ' ui-state-highlight' : '') +
|
9854 |
+
(printDate.getTime() == currentDate.getTime() ? ' ui-state-active' : '') + // highlight selected day
|
9855 |
+
(otherMonth ? ' ui-priority-secondary' : '') + // distinguish dates from other months
|
9856 |
+
'" href="#">' + printDate.getDate() + '</a>')) + '</td>'; // display selectable date
|
9857 |
+
printDate.setDate(printDate.getDate() + 1);
|
9858 |
+
printDate = this._daylightSavingAdjust(printDate);
|
9859 |
+
}
|
9860 |
+
calender += tbody + '</tr>';
|
9861 |
+
}
|
9862 |
+
drawMonth++;
|
9863 |
+
if (drawMonth > 11) {
|
9864 |
+
drawMonth = 0;
|
9865 |
+
drawYear++;
|
9866 |
+
}
|
9867 |
+
calender += '</tbody></table>' + (isMultiMonth ? '</div>' +
|
9868 |
+
((numMonths[0] > 0 && col == numMonths[1]-1) ? '<div class="ui-datepicker-row-break"></div>' : '') : '');
|
9869 |
+
group += calender;
|
9870 |
+
}
|
9871 |
+
html += group;
|
9872 |
+
}
|
9873 |
+
html += buttonPanel + ($.browser.msie && parseInt($.browser.version,10) < 7 && !inst.inline ?
|
9874 |
+
'<iframe src="javascript:false;" class="ui-datepicker-cover" frameborder="0"></iframe>' : '');
|
9875 |
+
inst._keyEvent = false;
|
9876 |
+
return html;
|
9877 |
+
},
|
9878 |
+
|
9879 |
+
/* Generate the month and year header. */
|
9880 |
+
_generateMonthYearHeader: function(inst, drawMonth, drawYear, minDate, maxDate,
|
9881 |
+
secondary, monthNames, monthNamesShort) {
|
9882 |
+
var changeMonth = this._get(inst, 'changeMonth');
|
9883 |
+
var changeYear = this._get(inst, 'changeYear');
|
9884 |
+
var showMonthAfterYear = this._get(inst, 'showMonthAfterYear');
|
9885 |
+
var html = '<div class="ui-datepicker-title">';
|
9886 |
+
var monthHtml = '';
|
9887 |
+
// month selection
|
9888 |
+
if (secondary || !changeMonth)
|
9889 |
+
monthHtml += '<span class="ui-datepicker-month">' + monthNames[drawMonth] + '</span>';
|
9890 |
+
else {
|
9891 |
+
var inMinYear = (minDate && minDate.getFullYear() == drawYear);
|
9892 |
+
var inMaxYear = (maxDate && maxDate.getFullYear() == drawYear);
|
9893 |
+
monthHtml += '<select class="ui-datepicker-month" ' +
|
9894 |
+
'onchange="DP_jQuery_' + dpuuid + '.datepicker._selectMonthYear(\'#' + inst.id + '\', this, \'M\');" ' +
|
9895 |
+
'>';
|
9896 |
+
for (var month = 0; month < 12; month++) {
|
9897 |
+
if ((!inMinYear || month >= minDate.getMonth()) &&
|
9898 |
+
(!inMaxYear || month <= maxDate.getMonth()))
|
9899 |
+
monthHtml += '<option value="' + month + '"' +
|
9900 |
+
(month == drawMonth ? ' selected="selected"' : '') +
|
9901 |
+
'>' + monthNamesShort[month] + '</option>';
|
9902 |
+
}
|
9903 |
+
monthHtml += '</select>';
|
9904 |
+
}
|
9905 |
+
if (!showMonthAfterYear)
|
9906 |
+
html += monthHtml + (secondary || !(changeMonth && changeYear) ? ' ' : '');
|
9907 |
+
// year selection
|
9908 |
+
if ( !inst.yearshtml ) {
|
9909 |
+
inst.yearshtml = '';
|
9910 |
+
if (secondary || !changeYear)
|
9911 |
+
html += '<span class="ui-datepicker-year">' + drawYear + '</span>';
|
9912 |
+
else {
|
9913 |
+
// determine range of years to display
|
9914 |
+
var years = this._get(inst, 'yearRange').split(':');
|
9915 |
+
var thisYear = new Date().getFullYear();
|
9916 |
+
var determineYear = function(value) {
|
9917 |
+
var year = (value.match(/c[+-].*/) ? drawYear + parseInt(value.substring(1), 10) :
|
9918 |
+
(value.match(/[+-].*/) ? thisYear + parseInt(value, 10) :
|
9919 |
+
parseInt(value, 10)));
|
9920 |
+
return (isNaN(year) ? thisYear : year);
|
9921 |
+
};
|
9922 |
+
var year = determineYear(years[0]);
|
9923 |
+
var endYear = Math.max(year, determineYear(years[1] || ''));
|
9924 |
+
year = (minDate ? Math.max(year, minDate.getFullYear()) : year);
|
9925 |
+
endYear = (maxDate ? Math.min(endYear, maxDate.getFullYear()) : endYear);
|
9926 |
+
inst.yearshtml += '<select class="ui-datepicker-year" ' +
|
9927 |
+
'onchange="DP_jQuery_' + dpuuid + '.datepicker._selectMonthYear(\'#' + inst.id + '\', this, \'Y\');" ' +
|
9928 |
+
'>';
|
9929 |
+
for (; year <= endYear; year++) {
|
9930 |
+
inst.yearshtml += '<option value="' + year + '"' +
|
9931 |
+
(year == drawYear ? ' selected="selected"' : '') +
|
9932 |
+
'>' + year + '</option>';
|
9933 |
+
}
|
9934 |
+
inst.yearshtml += '</select>';
|
9935 |
+
|
9936 |
+
html += inst.yearshtml;
|
9937 |
+
inst.yearshtml = null;
|
9938 |
+
}
|
9939 |
+
}
|
9940 |
+
html += this._get(inst, 'yearSuffix');
|
9941 |
+
if (showMonthAfterYear)
|
9942 |
+
html += (secondary || !(changeMonth && changeYear) ? ' ' : '') + monthHtml;
|
9943 |
+
html += '</div>'; // Close datepicker_header
|
9944 |
+
return html;
|
9945 |
+
},
|
9946 |
+
|
9947 |
+
/* Adjust one of the date sub-fields. */
|
9948 |
+
_adjustInstDate: function(inst, offset, period) {
|
9949 |
+
var year = inst.drawYear + (period == 'Y' ? offset : 0);
|
9950 |
+
var month = inst.drawMonth + (period == 'M' ? offset : 0);
|
9951 |
+
var day = Math.min(inst.selectedDay, this._getDaysInMonth(year, month)) +
|
9952 |
+
(period == 'D' ? offset : 0);
|
9953 |
+
var date = this._restrictMinMax(inst,
|
9954 |
+
this._daylightSavingAdjust(new Date(year, month, day)));
|
9955 |
+
inst.selectedDay = date.getDate();
|
9956 |
+
inst.drawMonth = inst.selectedMonth = date.getMonth();
|
9957 |
+
inst.drawYear = inst.selectedYear = date.getFullYear();
|
9958 |
+
if (period == 'M' || period == 'Y')
|
9959 |
+
this._notifyChange(inst);
|
9960 |
+
},
|
9961 |
+
|
9962 |
+
/* Ensure a date is within any min/max bounds. */
|
9963 |
+
_restrictMinMax: function(inst, date) {
|
9964 |
+
var minDate = this._getMinMaxDate(inst, 'min');
|
9965 |
+
var maxDate = this._getMinMaxDate(inst, 'max');
|
9966 |
+
var newDate = (minDate && date < minDate ? minDate : date);
|
9967 |
+
newDate = (maxDate && newDate > maxDate ? maxDate : newDate);
|
9968 |
+
return newDate;
|
9969 |
+
},
|
9970 |
+
|
9971 |
+
/* Notify change of month/year. */
|
9972 |
+
_notifyChange: function(inst) {
|
9973 |
+
var onChange = this._get(inst, 'onChangeMonthYear');
|
9974 |
+
if (onChange)
|
9975 |
+
onChange.apply((inst.input ? inst.input[0] : null),
|
9976 |
+
[inst.selectedYear, inst.selectedMonth + 1, inst]);
|
9977 |
+
},
|
9978 |
+
|
9979 |
+
/* Determine the number of months to show. */
|
9980 |
+
_getNumberOfMonths: function(inst) {
|
9981 |
+
var numMonths = this._get(inst, 'numberOfMonths');
|
9982 |
+
return (numMonths == null ? [1, 1] : (typeof numMonths == 'number' ? [1, numMonths] : numMonths));
|
9983 |
+
},
|
9984 |
+
|
9985 |
+
/* Determine the current maximum date - ensure no time components are set. */
|
9986 |
+
_getMinMaxDate: function(inst, minMax) {
|
9987 |
+
return this._determineDate(inst, this._get(inst, minMax + 'Date'), null);
|
9988 |
+
},
|
9989 |
+
|
9990 |
+
/* Find the number of days in a given month. */
|
9991 |
+
_getDaysInMonth: function(year, month) {
|
9992 |
+
return 32 - this._daylightSavingAdjust(new Date(year, month, 32)).getDate();
|
9993 |
+
},
|
9994 |
+
|
9995 |
+
/* Find the day of the week of the first of a month. */
|
9996 |
+
_getFirstDayOfMonth: function(year, month) {
|
9997 |
+
return new Date(year, month, 1).getDay();
|
9998 |
+
},
|
9999 |
+
|
10000 |
+
/* Determines if we should allow a "next/prev" month display change. */
|
10001 |
+
_canAdjustMonth: function(inst, offset, curYear, curMonth) {
|
10002 |
+
var numMonths = this._getNumberOfMonths(inst);
|
10003 |
+
var date = this._daylightSavingAdjust(new Date(curYear,
|
10004 |
+
curMonth + (offset < 0 ? offset : numMonths[0] * numMonths[1]), 1));
|
10005 |
+
if (offset < 0)
|
10006 |
+
date.setDate(this._getDaysInMonth(date.getFullYear(), date.getMonth()));
|
10007 |
+
return this._isInRange(inst, date);
|
10008 |
+
},
|
10009 |
+
|
10010 |
+
/* Is the given date in the accepted range? */
|
10011 |
+
_isInRange: function(inst, date) {
|
10012 |
+
var minDate = this._getMinMaxDate(inst, 'min');
|
10013 |
+
var maxDate = this._getMinMaxDate(inst, 'max');
|
10014 |
+
return ((!minDate || date.getTime() >= minDate.getTime()) &&
|
10015 |
+
(!maxDate || date.getTime() <= maxDate.getTime()));
|
10016 |
+
},
|
10017 |
+
|
10018 |
+
/* Provide the configuration settings for formatting/parsing. */
|
10019 |
+
_getFormatConfig: function(inst) {
|
10020 |
+
var shortYearCutoff = this._get(inst, 'shortYearCutoff');
|
10021 |
+
shortYearCutoff = (typeof shortYearCutoff != 'string' ? shortYearCutoff :
|
10022 |
+
new Date().getFullYear() % 100 + parseInt(shortYearCutoff, 10));
|
10023 |
+
return {shortYearCutoff: shortYearCutoff,
|
10024 |
+
dayNamesShort: this._get(inst, 'dayNamesShort'), dayNames: this._get(inst, 'dayNames'),
|
10025 |
+
monthNamesShort: this._get(inst, 'monthNamesShort'), monthNames: this._get(inst, 'monthNames')};
|
10026 |
+
},
|
10027 |
+
|
10028 |
+
/* Format the given date for display. */
|
10029 |
+
_formatDate: function(inst, day, month, year) {
|
10030 |
+
if (!day) {
|
10031 |
+
inst.currentDay = inst.selectedDay;
|
10032 |
+
inst.currentMonth = inst.selectedMonth;
|
10033 |
+
inst.currentYear = inst.selectedYear;
|
10034 |
+
}
|
10035 |
+
var date = (day ? (typeof day == 'object' ? day :
|
10036 |
+
this._daylightSavingAdjust(new Date(year, month, day))) :
|
10037 |
+
this._daylightSavingAdjust(new Date(inst.currentYear, inst.currentMonth, inst.currentDay)));
|
10038 |
+
return this.formatDate(this._get(inst, 'dateFormat'), date, this._getFormatConfig(inst));
|
10039 |
+
}
|
10040 |
+
});
|
10041 |
+
|
10042 |
+
/*
|
10043 |
+
* Bind hover events for datepicker elements.
|
10044 |
+
* Done via delegate so the binding only occurs once in the lifetime of the parent div.
|
10045 |
+
* Global instActive, set by _updateDatepicker allows the handlers to find their way back to the active picker.
|
10046 |
+
*/
|
10047 |
+
function bindHover(dpDiv) {
|
10048 |
+
var selector = 'button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a';
|
10049 |
+
return dpDiv.bind('mouseout', function(event) {
|
10050 |
+
var elem = $( event.target ).closest( selector );
|
10051 |
+
if ( !elem.length ) {
|
10052 |
+
return;
|
10053 |
+
}
|
10054 |
+
elem.removeClass( "ui-state-hover ui-datepicker-prev-hover ui-datepicker-next-hover" );
|
10055 |
+
})
|
10056 |
+
.bind('mouseover', function(event) {
|
10057 |
+
var elem = $( event.target ).closest( selector );
|
10058 |
+
if ($.datepicker._isDisabledDatepicker( instActive.inline ? dpDiv.parent()[0] : instActive.input[0]) ||
|
10059 |
+
!elem.length ) {
|
10060 |
+
return;
|
10061 |
+
}
|
10062 |
+
elem.parents('.ui-datepicker-calendar').find('a').removeClass('ui-state-hover');
|
10063 |
+
elem.addClass('ui-state-hover');
|
10064 |
+
if (elem.hasClass('ui-datepicker-prev')) elem.addClass('ui-datepicker-prev-hover');
|
10065 |
+
if (elem.hasClass('ui-datepicker-next')) elem.addClass('ui-datepicker-next-hover');
|
10066 |
+
});
|
10067 |
+
}
|
10068 |
+
|
10069 |
+
/* jQuery extend now ignores nulls! */
|
10070 |
+
function extendRemove(target, props) {
|
10071 |
+
$.extend(target, props);
|
10072 |
+
for (var name in props)
|
10073 |
+
if (props[name] == null || props[name] == undefined)
|
10074 |
+
target[name] = props[name];
|
10075 |
+
return target;
|
10076 |
+
};
|
10077 |
+
|
10078 |
+
/* Determine whether an object is an array. */
|
10079 |
+
function isArray(a) {
|
10080 |
+
return (a && (($.browser.safari && typeof a == 'object' && a.length) ||
|
10081 |
+
(a.constructor && a.constructor.toString().match(/\Array\(\)/))));
|
10082 |
+
};
|
10083 |
+
|
10084 |
+
/* Invoke the datepicker functionality.
|
10085 |
+
@param options string - a command, optionally followed by additional parameters or
|
10086 |
+
Object - settings for attaching new datepicker functionality
|
10087 |
+
@return jQuery object */
|
10088 |
+
$.fn.datepicker = function(options){
|
10089 |
+
|
10090 |
+
/* Verify an empty collection wasn't passed - Fixes #6976 */
|
10091 |
+
if ( !this.length ) {
|
10092 |
+
return this;
|
10093 |
+
}
|
10094 |
+
|
10095 |
+
/* Initialise the date picker. */
|
10096 |
+
if (!$.datepicker.initialized) {
|
10097 |
+
$(document).mousedown($.datepicker._checkExternalClick).
|
10098 |
+
find('body').append($.datepicker.dpDiv);
|
10099 |
+
$.datepicker.initialized = true;
|
10100 |
+
}
|
10101 |
+
|
10102 |
+
var otherArgs = Array.prototype.slice.call(arguments, 1);
|
10103 |
+
if (typeof options == 'string' && (options == 'isDisabled' || options == 'getDate' || options == 'widget'))
|
10104 |
+
return $.datepicker['_' + options + 'Datepicker'].
|
10105 |
+
apply($.datepicker, [this[0]].concat(otherArgs));
|
10106 |
+
if (options == 'option' && arguments.length == 2 && typeof arguments[1] == 'string')
|
10107 |
+
return $.datepicker['_' + options + 'Datepicker'].
|
10108 |
+
apply($.datepicker, [this[0]].concat(otherArgs));
|
10109 |
+
return this.each(function() {
|
10110 |
+
typeof options == 'string' ?
|
10111 |
+
$.datepicker['_' + options + 'Datepicker'].
|
10112 |
+
apply($.datepicker, [this].concat(otherArgs)) :
|
10113 |
+
$.datepicker._attachDatepicker(this, options);
|
10114 |
+
});
|
10115 |
+
};
|
10116 |
+
|
10117 |
+
$.datepicker = new Datepicker(); // singleton instance
|
10118 |
+
$.datepicker.initialized = false;
|
10119 |
+
$.datepicker.uuid = new Date().getTime();
|
10120 |
+
$.datepicker.version = "1.8.17";
|
10121 |
+
|
10122 |
+
// Workaround for #4055
|
10123 |
+
// Add another global to avoid noConflict issues with inline event handlers
|
10124 |
+
window['DP_jQuery_' + dpuuid] = $;
|
10125 |
+
|
10126 |
+
})(jQuery);
|
10127 |
+
/*
|
10128 |
+
* jQuery UI Progressbar 1.8.17
|
10129 |
+
*
|
10130 |
+
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
|
10131 |
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
10132 |
+
* http://jquery.org/license
|
10133 |
+
*
|
10134 |
+
* http://docs.jquery.com/UI/Progressbar
|
10135 |
+
*
|
10136 |
+
* Depends:
|
10137 |
+
* jquery.ui.core.js
|
10138 |
+
* jquery.ui.widget.js
|
10139 |
+
*/
|
10140 |
+
(function( $, undefined ) {
|
10141 |
+
|
10142 |
+
$.widget( "ui.progressbar", {
|
10143 |
+
options: {
|
10144 |
+
value: 0,
|
10145 |
+
max: 100
|
10146 |
+
},
|
10147 |
+
|
10148 |
+
min: 0,
|
10149 |
+
|
10150 |
+
_create: function() {
|
10151 |
+
this.element
|
10152 |
+
.addClass( "ui-progressbar ui-widget ui-widget-content ui-corner-all" )
|
10153 |
+
.attr({
|
10154 |
+
role: "progressbar",
|
10155 |
+
"aria-valuemin": this.min,
|
10156 |
+
"aria-valuemax": this.options.max,
|
10157 |
+
"aria-valuenow": this._value()
|
10158 |
+
});
|
10159 |
+
|
10160 |
+
this.valueDiv = $( "<div class='ui-progressbar-value ui-widget-header ui-corner-left'></div>" )
|
10161 |
+
.appendTo( this.element );
|
10162 |
+
|
10163 |
+
this.oldValue = this._value();
|
10164 |
+
this._refreshValue();
|
10165 |
+
},
|
10166 |
+
|
10167 |
+
destroy: function() {
|
10168 |
+
this.element
|
10169 |
+
.removeClass( "ui-progressbar ui-widget ui-widget-content ui-corner-all" )
|
10170 |
+
.removeAttr( "role" )
|
10171 |
+
.removeAttr( "aria-valuemin" )
|
10172 |
+
.removeAttr( "aria-valuemax" )
|
10173 |
+
.removeAttr( "aria-valuenow" );
|
10174 |
+
|
10175 |
+
this.valueDiv.remove();
|
10176 |
+
|
10177 |
+
$.Widget.prototype.destroy.apply( this, arguments );
|
10178 |
+
},
|
10179 |
+
|
10180 |
+
value: function( newValue ) {
|
10181 |
+
if ( newValue === undefined ) {
|
10182 |
+
return this._value();
|
10183 |
+
}
|
10184 |
+
|
10185 |
+
this._setOption( "value", newValue );
|
10186 |
+
return this;
|
10187 |
+
},
|
10188 |
+
|
10189 |
+
_setOption: function( key, value ) {
|
10190 |
+
if ( key === "value" ) {
|
10191 |
+
this.options.value = value;
|
10192 |
+
this._refreshValue();
|
10193 |
+
if ( this._value() === this.options.max ) {
|
10194 |
+
this._trigger( "complete" );
|
10195 |
+
}
|
10196 |
+
}
|
10197 |
+
|
10198 |
+
$.Widget.prototype._setOption.apply( this, arguments );
|
10199 |
+
},
|
10200 |
+
|
10201 |
+
_value: function() {
|
10202 |
+
var val = this.options.value;
|
10203 |
+
// normalize invalid value
|
10204 |
+
if ( typeof val !== "number" ) {
|
10205 |
+
val = 0;
|
10206 |
+
}
|
10207 |
+
return Math.min( this.options.max, Math.max( this.min, val ) );
|
10208 |
+
},
|
10209 |
+
|
10210 |
+
_percentage: function() {
|
10211 |
+
return 100 * this._value() / this.options.max;
|
10212 |
+
},
|
10213 |
+
|
10214 |
+
_refreshValue: function() {
|
10215 |
+
var value = this.value();
|
10216 |
+
var percentage = this._percentage();
|
10217 |
+
|
10218 |
+
if ( this.oldValue !== value ) {
|
10219 |
+
this.oldValue = value;
|
10220 |
+
this._trigger( "change" );
|
10221 |
+
}
|
10222 |
+
|
10223 |
+
this.valueDiv
|
10224 |
+
.toggle( value > this.min )
|
10225 |
+
.toggleClass( "ui-corner-right", value === this.options.max )
|
10226 |
+
.width( percentage.toFixed(0) + "%" );
|
10227 |
+
this.element.attr( "aria-valuenow", value );
|
10228 |
+
}
|
10229 |
+
});
|
10230 |
+
|
10231 |
+
$.extend( $.ui.progressbar, {
|
10232 |
+
version: "1.8.17"
|
10233 |
+
});
|
10234 |
+
|
10235 |
+
})( jQuery );
|
10236 |
+
/*
|
10237 |
+
* jQuery UI Effects 1.8.17
|
10238 |
+
*
|
10239 |
+
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
|
10240 |
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
10241 |
+
* http://jquery.org/license
|
10242 |
+
*
|
10243 |
+
* http://docs.jquery.com/UI/Effects/
|
10244 |
+
*/
|
10245 |
+
;jQuery.effects || (function($, undefined) {
|
10246 |
+
|
10247 |
+
$.effects = {};
|
10248 |
+
|
10249 |
+
|
10250 |
+
|
10251 |
+
/******************************************************************************/
|
10252 |
+
/****************************** COLOR ANIMATIONS ******************************/
|
10253 |
+
/******************************************************************************/
|
10254 |
+
|
10255 |
+
// override the animation for color styles
|
10256 |
+
$.each(['backgroundColor', 'borderBottomColor', 'borderLeftColor',
|
10257 |
+
'borderRightColor', 'borderTopColor', 'borderColor', 'color', 'outlineColor'],
|
10258 |
+
function(i, attr) {
|
10259 |
+
$.fx.step[attr] = function(fx) {
|
10260 |
+
if (!fx.colorInit) {
|
10261 |
+
fx.start = getColor(fx.elem, attr);
|
10262 |
+
fx.end = getRGB(fx.end);
|
10263 |
+
fx.colorInit = true;
|
10264 |
+
}
|
10265 |
+
|
10266 |
+
fx.elem.style[attr] = 'rgb(' +
|
10267 |
+
Math.max(Math.min(parseInt((fx.pos * (fx.end[0] - fx.start[0])) + fx.start[0], 10), 255), 0) + ',' +
|
10268 |
+
Math.max(Math.min(parseInt((fx.pos * (fx.end[1] - fx.start[1])) + fx.start[1], 10), 255), 0) + ',' +
|
10269 |
+
Math.max(Math.min(parseInt((fx.pos * (fx.end[2] - fx.start[2])) + fx.start[2], 10), 255), 0) + ')';
|
10270 |
+
};
|
10271 |
+
});
|
10272 |
+
|
10273 |
+
// Color Conversion functions from highlightFade
|
10274 |
+
// By Blair Mitchelmore
|
10275 |
+
// http://jquery.offput.ca/highlightFade/
|
10276 |
+
|
10277 |
+
// Parse strings looking for color tuples [255,255,255]
|
10278 |
+
function getRGB(color) {
|
10279 |
+
var result;
|
10280 |
+
|
10281 |
+
// Check if we're already dealing with an array of colors
|
10282 |
+
if ( color && color.constructor == Array && color.length == 3 )
|
10283 |
+
return color;
|
10284 |
+
|
10285 |
+
// Look for rgb(num,num,num)
|
10286 |
+
if (result = /rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(color))
|
10287 |
+
return [parseInt(result[1],10), parseInt(result[2],10), parseInt(result[3],10)];
|
10288 |
+
|
10289 |
+
// Look for rgb(num%,num%,num%)
|
10290 |
+
if (result = /rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(color))
|
10291 |
+
return [parseFloat(result[1])*2.55, parseFloat(result[2])*2.55, parseFloat(result[3])*2.55];
|
10292 |
+
|
10293 |
+
// Look for #a0b1c2
|
10294 |
+
if (result = /#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(color))
|
10295 |
+
return [parseInt(result[1],16), parseInt(result[2],16), parseInt(result[3],16)];
|
10296 |
+
|
10297 |
+
// Look for #fff
|
10298 |
+
if (result = /#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(color))
|
10299 |
+
return [parseInt(result[1]+result[1],16), parseInt(result[2]+result[2],16), parseInt(result[3]+result[3],16)];
|
10300 |
+
|
10301 |
+
// Look for rgba(0, 0, 0, 0) == transparent in Safari 3
|
10302 |
+
if (result = /rgba\(0, 0, 0, 0\)/.exec(color))
|
10303 |
+
return colors['transparent'];
|
10304 |
+
|
10305 |
+
// Otherwise, we're most likely dealing with a named color
|
10306 |
+
return colors[$.trim(color).toLowerCase()];
|
10307 |
+
}
|
10308 |
+
|
10309 |
+
function getColor(elem, attr) {
|
10310 |
+
var color;
|
10311 |
+
|
10312 |
+
do {
|
10313 |
+
color = $.curCSS(elem, attr);
|
10314 |
+
|
10315 |
+
// Keep going until we find an element that has color, or we hit the body
|
10316 |
+
if ( color != '' && color != 'transparent' || $.nodeName(elem, "body") )
|
10317 |
+
break;
|
10318 |
+
|
10319 |
+
attr = "backgroundColor";
|
10320 |
+
} while ( elem = elem.parentNode );
|
10321 |
+
|
10322 |
+
return getRGB(color);
|
10323 |
+
};
|
10324 |
+
|
10325 |
+
// Some named colors to work with
|
10326 |
+
// From Interface by Stefan Petre
|
10327 |
+
// http://interface.eyecon.ro/
|
10328 |
+
|
10329 |
+
var colors = {
|
10330 |
+
aqua:[0,255,255],
|
10331 |
+
azure:[240,255,255],
|
10332 |
+
beige:[245,245,220],
|
10333 |
+
black:[0,0,0],
|
10334 |
+
blue:[0,0,255],
|
10335 |
+
brown:[165,42,42],
|
10336 |
+
cyan:[0,255,255],
|
10337 |
+
darkblue:[0,0,139],
|
10338 |
+
darkcyan:[0,139,139],
|
10339 |
+
darkgrey:[169,169,169],
|
10340 |
+
darkgreen:[0,100,0],
|
10341 |
+
darkkhaki:[189,183,107],
|
10342 |
+
darkmagenta:[139,0,139],
|
10343 |
+
darkolivegreen:[85,107,47],
|
10344 |
+
darkorange:[255,140,0],
|
10345 |
+
darkorchid:[153,50,204],
|
10346 |
+
darkred:[139,0,0],
|
10347 |
+
darksalmon:[233,150,122],
|
10348 |
+
darkviolet:[148,0,211],
|
10349 |
+
fuchsia:[255,0,255],
|
10350 |
+
gold:[255,215,0],
|
10351 |
+
green:[0,128,0],
|
10352 |
+
indigo:[75,0,130],
|
10353 |
+
khaki:[240,230,140],
|
10354 |
+
lightblue:[173,216,230],
|
10355 |
+
lightcyan:[224,255,255],
|
10356 |
+
lightgreen:[144,238,144],
|
10357 |
+
lightgrey:[211,211,211],
|
10358 |
+
lightpink:[255,182,193],
|
10359 |
+
lightyellow:[255,255,224],
|
10360 |
+
lime:[0,255,0],
|
10361 |
+
magenta:[255,0,255],
|
10362 |
+
maroon:[128,0,0],
|
10363 |
+
navy:[0,0,128],
|
10364 |
+
olive:[128,128,0],
|
10365 |
+
orange:[255,165,0],
|
10366 |
+
pink:[255,192,203],
|
10367 |
+
purple:[128,0,128],
|
10368 |
+
violet:[128,0,128],
|
10369 |
+
red:[255,0,0],
|
10370 |
+
silver:[192,192,192],
|
10371 |
+
white:[255,255,255],
|
10372 |
+
yellow:[255,255,0],
|
10373 |
+
transparent: [255,255,255]
|
10374 |
+
};
|
10375 |
+
|
10376 |
+
|
10377 |
+
|
10378 |
+
/******************************************************************************/
|
10379 |
+
/****************************** CLASS ANIMATIONS ******************************/
|
10380 |
+
/******************************************************************************/
|
10381 |
+
|
10382 |
+
var classAnimationActions = ['add', 'remove', 'toggle'],
|
10383 |
+
shorthandStyles = {
|
10384 |
+
border: 1,
|
10385 |
+
borderBottom: 1,
|
10386 |
+
borderColor: 1,
|
10387 |
+
borderLeft: 1,
|
10388 |
+
borderRight: 1,
|
10389 |
+
borderTop: 1,
|
10390 |
+
borderWidth: 1,
|
10391 |
+
margin: 1,
|
10392 |
+
padding: 1
|
10393 |
+
};
|
10394 |
+
|
10395 |
+
function getElementStyles() {
|
10396 |
+
var style = document.defaultView
|
10397 |
+
? document.defaultView.getComputedStyle(this, null)
|
10398 |
+
: this.currentStyle,
|
10399 |
+
newStyle = {},
|
10400 |
+
key,
|
10401 |
+
camelCase;
|
10402 |
+
|
10403 |
+
// webkit enumerates style porperties
|
10404 |
+
if (style && style.length && style[0] && style[style[0]]) {
|
10405 |
+
var len = style.length;
|
10406 |
+
while (len--) {
|
10407 |
+
key = style[len];
|
10408 |
+
if (typeof style[key] == 'string') {
|
10409 |
+
camelCase = key.replace(/\-(\w)/g, function(all, letter){
|
10410 |
+
return letter.toUpperCase();
|
10411 |
+
});
|
10412 |
+
newStyle[camelCase] = style[key];
|
10413 |
+
}
|
10414 |
+
}
|
10415 |
+
} else {
|
10416 |
+
for (key in style) {
|
10417 |
+
if (typeof style[key] === 'string') {
|
10418 |
+
newStyle[key] = style[key];
|
10419 |
+
}
|
10420 |
+
}
|
10421 |
+
}
|
10422 |
+
|
10423 |
+
return newStyle;
|
10424 |
+
}
|
10425 |
+
|
10426 |
+
function filterStyles(styles) {
|
10427 |
+
var name, value;
|
10428 |
+
for (name in styles) {
|
10429 |
+
value = styles[name];
|
10430 |
+
if (
|
10431 |
+
// ignore null and undefined values
|
10432 |
+
value == null ||
|
10433 |
+
// ignore functions (when does this occur?)
|
10434 |
+
$.isFunction(value) ||
|
10435 |
+
// shorthand styles that need to be expanded
|
10436 |
+
name in shorthandStyles ||
|
10437 |
+
// ignore scrollbars (break in IE)
|
10438 |
+
(/scrollbar/).test(name) ||
|
10439 |
+
|
10440 |
+
// only colors or values that can be converted to numbers
|
10441 |
+
(!(/color/i).test(name) && isNaN(parseFloat(value)))
|
10442 |
+
) {
|
10443 |
+
delete styles[name];
|
10444 |
+
}
|
10445 |
+
}
|
10446 |
+
|
10447 |
+
return styles;
|
10448 |
+
}
|
10449 |
+
|
10450 |
+
function styleDifference(oldStyle, newStyle) {
|
10451 |
+
var diff = { _: 0 }, // http://dev.jquery.com/ticket/5459
|
10452 |
+
name;
|
10453 |
+
|
10454 |
+
for (name in newStyle) {
|
10455 |
+
if (oldStyle[name] != newStyle[name]) {
|
10456 |
+
diff[name] = newStyle[name];
|
10457 |
+
}
|
10458 |
+
}
|
10459 |
+
|
10460 |
+
return diff;
|
10461 |
+
}
|
10462 |
+
|
10463 |
+
$.effects.animateClass = function(value, duration, easing, callback) {
|
10464 |
+
if ($.isFunction(easing)) {
|
10465 |
+
callback = easing;
|
10466 |
+
easing = null;
|
10467 |
+
}
|
10468 |
+
|
10469 |
+
return this.queue(function() {
|
10470 |
+
var that = $(this),
|
10471 |
+
originalStyleAttr = that.attr('style') || ' ',
|
10472 |
+
originalStyle = filterStyles(getElementStyles.call(this)),
|
10473 |
+
newStyle,
|
10474 |
+
className = that.attr('class');
|
10475 |
+
|
10476 |
+
$.each(classAnimationActions, function(i, action) {
|
10477 |
+
if (value[action]) {
|
10478 |
+
that[action + 'Class'](value[action]);
|
10479 |
+
}
|
10480 |
+
});
|
10481 |
+
newStyle = filterStyles(getElementStyles.call(this));
|
10482 |
+
that.attr('class', className);
|
10483 |
+
|
10484 |
+
that.animate(styleDifference(originalStyle, newStyle), {
|
10485 |
+
queue: false,
|
10486 |
+
duration: duration,
|
10487 |
+
easing: easing,
|
10488 |
+
complete: function() {
|
10489 |
+
$.each(classAnimationActions, function(i, action) {
|
10490 |
+
if (value[action]) { that[action + 'Class'](value[action]); }
|
10491 |
+
});
|
10492 |
+
// work around bug in IE by clearing the cssText before setting it
|
10493 |
+
if (typeof that.attr('style') == 'object') {
|
10494 |
+
that.attr('style').cssText = '';
|
10495 |
+
that.attr('style').cssText = originalStyleAttr;
|
10496 |
+
} else {
|
10497 |
+
that.attr('style', originalStyleAttr);
|
10498 |
+
}
|
10499 |
+
if (callback) { callback.apply(this, arguments); }
|
10500 |
+
$.dequeue( this );
|
10501 |
+
}
|
10502 |
+
});
|
10503 |
+
});
|
10504 |
+
};
|
10505 |
+
|
10506 |
+
$.fn.extend({
|
10507 |
+
_addClass: $.fn.addClass,
|
10508 |
+
addClass: function(classNames, speed, easing, callback) {
|
10509 |
+
return speed ? $.effects.animateClass.apply(this, [{ add: classNames },speed,easing,callback]) : this._addClass(classNames);
|
10510 |
+
},
|
10511 |
+
|
10512 |
+
_removeClass: $.fn.removeClass,
|
10513 |
+
removeClass: function(classNames,speed,easing,callback) {
|
10514 |
+
return speed ? $.effects.animateClass.apply(this, [{ remove: classNames },speed,easing,callback]) : this._removeClass(classNames);
|
10515 |
+
},
|
10516 |
+
|
10517 |
+
_toggleClass: $.fn.toggleClass,
|
10518 |
+
toggleClass: function(classNames, force, speed, easing, callback) {
|
10519 |
+
if ( typeof force == "boolean" || force === undefined ) {
|
10520 |
+
if ( !speed ) {
|
10521 |
+
// without speed parameter;
|
10522 |
+
return this._toggleClass(classNames, force);
|
10523 |
+
} else {
|
10524 |
+
return $.effects.animateClass.apply(this, [(force?{add:classNames}:{remove:classNames}),speed,easing,callback]);
|
10525 |
+
}
|
10526 |
+
} else {
|
10527 |
+
// without switch parameter;
|
10528 |
+
return $.effects.animateClass.apply(this, [{ toggle: classNames },force,speed,easing]);
|
10529 |
+
}
|
10530 |
+
},
|
10531 |
+
|
10532 |
+
switchClass: function(remove,add,speed,easing,callback) {
|
10533 |
+
return $.effects.animateClass.apply(this, [{ add: add, remove: remove },speed,easing,callback]);
|
10534 |
+
}
|
10535 |
+
});
|
10536 |
+
|
10537 |
+
|
10538 |
+
|
10539 |
+
/******************************************************************************/
|
10540 |
+
/*********************************** EFFECTS **********************************/
|
10541 |
+
/******************************************************************************/
|
10542 |
+
|
10543 |
+
$.extend($.effects, {
|
10544 |
+
version: "1.8.17",
|
10545 |
+
|
10546 |
+
// Saves a set of properties in a data storage
|
10547 |
+
save: function(element, set) {
|
10548 |
+
for(var i=0; i < set.length; i++) {
|
10549 |
+
if(set[i] !== null) element.data("ec.storage."+set[i], element[0].style[set[i]]);
|
10550 |
+
}
|
10551 |
+
},
|
10552 |
+
|
10553 |
+
// Restores a set of previously saved properties from a data storage
|
10554 |
+
restore: function(element, set) {
|
10555 |
+
for(var i=0; i < set.length; i++) {
|
10556 |
+
if(set[i] !== null) element.css(set[i], element.data("ec.storage."+set[i]));
|
10557 |
+
}
|
10558 |
+
},
|
10559 |
+
|
10560 |
+
setMode: function(el, mode) {
|
10561 |
+
if (mode == 'toggle') mode = el.is(':hidden') ? 'show' : 'hide'; // Set for toggle
|
10562 |
+
return mode;
|
10563 |
+
},
|
10564 |
+
|
10565 |
+
getBaseline: function(origin, original) { // Translates a [top,left] array into a baseline value
|
10566 |
+
// this should be a little more flexible in the future to handle a string & hash
|
10567 |
+
var y, x;
|
10568 |
+
switch (origin[0]) {
|
10569 |
+
case 'top': y = 0; break;
|
10570 |
+
case 'middle': y = 0.5; break;
|
10571 |
+
case 'bottom': y = 1; break;
|
10572 |
+
default: y = origin[0] / original.height;
|
10573 |
+
};
|
10574 |
+
switch (origin[1]) {
|
10575 |
+
case 'left': x = 0; break;
|
10576 |
+
case 'center': x = 0.5; break;
|
10577 |
+
case 'right': x = 1; break;
|
10578 |
+
default: x = origin[1] / original.width;
|
10579 |
+
};
|
10580 |
+
return {x: x, y: y};
|
10581 |
+
},
|
10582 |
+
|
10583 |
+
// Wraps the element around a wrapper that copies position properties
|
10584 |
+
createWrapper: function(element) {
|
10585 |
+
|
10586 |
+
// if the element is already wrapped, return it
|
10587 |
+
if (element.parent().is('.ui-effects-wrapper')) {
|
10588 |
+
return element.parent();
|
10589 |
+
}
|
10590 |
+
|
10591 |
+
// wrap the element
|
10592 |
+
var props = {
|
10593 |
+
width: element.outerWidth(true),
|
10594 |
+
height: element.outerHeight(true),
|
10595 |
+
'float': element.css('float')
|
10596 |
+
},
|
10597 |
+
wrapper = $('<div></div>')
|
10598 |
+
.addClass('ui-effects-wrapper')
|
10599 |
+
.css({
|
10600 |
+
fontSize: '100%',
|
10601 |
+
background: 'transparent',
|
10602 |
+
border: 'none',
|
10603 |
+
margin: 0,
|
10604 |
+
padding: 0
|
10605 |
+
}),
|
10606 |
+
active = document.activeElement;
|
10607 |
+
|
10608 |
+
element.wrap(wrapper);
|
10609 |
+
|
10610 |
+
// Fixes #7595 - Elements lose focus when wrapped.
|
10611 |
+
if ( element[ 0 ] === active || $.contains( element[ 0 ], active ) ) {
|
10612 |
+
$( active ).focus();
|
10613 |
+
}
|
10614 |
+
|
10615 |
+
wrapper = element.parent(); //Hotfix for jQuery 1.4 since some change in wrap() seems to actually loose the reference to the wrapped element
|
10616 |
+
|
10617 |
+
// transfer positioning properties to the wrapper
|
10618 |
+
if (element.css('position') == 'static') {
|
10619 |
+
wrapper.css({ position: 'relative' });
|
10620 |
+
element.css({ position: 'relative' });
|
10621 |
+
} else {
|
10622 |
+
$.extend(props, {
|
10623 |
+
position: element.css('position'),
|
10624 |
+
zIndex: element.css('z-index')
|
10625 |
+
});
|
10626 |
+
$.each(['top', 'left', 'bottom', 'right'], function(i, pos) {
|
10627 |
+
props[pos] = element.css(pos);
|
10628 |
+
if (isNaN(parseInt(props[pos], 10))) {
|
10629 |
+
props[pos] = 'auto';
|
10630 |
+
}
|
10631 |
+
});
|
10632 |
+
element.css({position: 'relative', top: 0, left: 0, right: 'auto', bottom: 'auto' });
|
10633 |
+
}
|
10634 |
+
|
10635 |
+
return wrapper.css(props).show();
|
10636 |
+
},
|
10637 |
+
|
10638 |
+
removeWrapper: function(element) {
|
10639 |
+
var parent,
|
10640 |
+
active = document.activeElement;
|
10641 |
+
|
10642 |
+
if (element.parent().is('.ui-effects-wrapper')) {
|
10643 |
+
parent = element.parent().replaceWith(element);
|
10644 |
+
// Fixes #7595 - Elements lose focus when wrapped.
|
10645 |
+
if ( element[ 0 ] === active || $.contains( element[ 0 ], active ) ) {
|
10646 |
+
$( active ).focus();
|
10647 |
+
}
|
10648 |
+
return parent;
|
10649 |
+
}
|
10650 |
+
|
10651 |
+
return element;
|
10652 |
+
},
|
10653 |
+
|
10654 |
+
setTransition: function(element, list, factor, value) {
|
10655 |
+
value = value || {};
|
10656 |
+
$.each(list, function(i, x){
|
10657 |
+
unit = element.cssUnit(x);
|
10658 |
+
if (unit[0] > 0) value[x] = unit[0] * factor + unit[1];
|
10659 |
+
});
|
10660 |
+
return value;
|
10661 |
+
}
|
10662 |
+
});
|
10663 |
+
|
10664 |
+
|
10665 |
+
function _normalizeArguments(effect, options, speed, callback) {
|
10666 |
+
// shift params for method overloading
|
10667 |
+
if (typeof effect == 'object') {
|
10668 |
+
callback = options;
|
10669 |
+
speed = null;
|
10670 |
+
options = effect;
|
10671 |
+
effect = options.effect;
|
10672 |
+
}
|
10673 |
+
if ($.isFunction(options)) {
|
10674 |
+
callback = options;
|
10675 |
+
speed = null;
|
10676 |
+
options = {};
|
10677 |
+
}
|
10678 |
+
if (typeof options == 'number' || $.fx.speeds[options]) {
|
10679 |
+
callback = speed;
|
10680 |
+
speed = options;
|
10681 |
+
options = {};
|
10682 |
+
}
|
10683 |
+
if ($.isFunction(speed)) {
|
10684 |
+
callback = speed;
|
10685 |
+
speed = null;
|
10686 |
+
}
|
10687 |
+
|
10688 |
+
options = options || {};
|
10689 |
+
|
10690 |
+
speed = speed || options.duration;
|
10691 |
+
speed = $.fx.off ? 0 : typeof speed == 'number'
|
10692 |
+
? speed : speed in $.fx.speeds ? $.fx.speeds[speed] : $.fx.speeds._default;
|
10693 |
+
|
10694 |
+
callback = callback || options.complete;
|
10695 |
+
|
10696 |
+
return [effect, options, speed, callback];
|
10697 |
+
}
|
10698 |
+
|
10699 |
+
function standardSpeed( speed ) {
|
10700 |
+
// valid standard speeds
|
10701 |
+
if ( !speed || typeof speed === "number" || $.fx.speeds[ speed ] ) {
|
10702 |
+
return true;
|
10703 |
+
}
|
10704 |
+
|
10705 |
+
// invalid strings - treat as "normal" speed
|
10706 |
+
if ( typeof speed === "string" && !$.effects[ speed ] ) {
|
10707 |
+
return true;
|
10708 |
+
}
|
10709 |
+
|
10710 |
+
return false;
|
10711 |
+
}
|
10712 |
+
|
10713 |
+
$.fn.extend({
|
10714 |
+
effect: function(effect, options, speed, callback) {
|
10715 |
+
var args = _normalizeArguments.apply(this, arguments),
|
10716 |
+
// TODO: make effects take actual parameters instead of a hash
|
10717 |
+
args2 = {
|
10718 |
+
options: args[1],
|
10719 |
+
duration: args[2],
|
10720 |
+
callback: args[3]
|
10721 |
+
},
|
10722 |
+
mode = args2.options.mode,
|
10723 |
+
effectMethod = $.effects[effect];
|
10724 |
+
|
10725 |
+
if ( $.fx.off || !effectMethod ) {
|
10726 |
+
// delegate to the original method (e.g., .show()) if possible
|
10727 |
+
if ( mode ) {
|
10728 |
+
return this[ mode ]( args2.duration, args2.callback );
|
10729 |
+
} else {
|
10730 |
+
return this.each(function() {
|
10731 |
+
if ( args2.callback ) {
|
10732 |
+
args2.callback.call( this );
|
10733 |
+
}
|
10734 |
+
});
|
10735 |
+
}
|
10736 |
+
}
|
10737 |
+
|
10738 |
+
return effectMethod.call(this, args2);
|
10739 |
+
},
|
10740 |
+
|
10741 |
+
_show: $.fn.show,
|
10742 |
+
show: function(speed) {
|
10743 |
+
if ( standardSpeed( speed ) ) {
|
10744 |
+
return this._show.apply(this, arguments);
|
10745 |
+
} else {
|
10746 |
+
var args = _normalizeArguments.apply(this, arguments);
|
10747 |
+
args[1].mode = 'show';
|
10748 |
+
return this.effect.apply(this, args);
|
10749 |
+
}
|
10750 |
+
},
|
10751 |
+
|
10752 |
+
_hide: $.fn.hide,
|
10753 |
+
hide: function(speed) {
|
10754 |
+
if ( standardSpeed( speed ) ) {
|
10755 |
+
return this._hide.apply(this, arguments);
|
10756 |
+
} else {
|
10757 |
+
var args = _normalizeArguments.apply(this, arguments);
|
10758 |
+
args[1].mode = 'hide';
|
10759 |
+
return this.effect.apply(this, args);
|
10760 |
+
}
|
10761 |
+
},
|
10762 |
+
|
10763 |
+
// jQuery core overloads toggle and creates _toggle
|
10764 |
+
__toggle: $.fn.toggle,
|
10765 |
+
toggle: function(speed) {
|
10766 |
+
if ( standardSpeed( speed ) || typeof speed === "boolean" || $.isFunction( speed ) ) {
|
10767 |
+
return this.__toggle.apply(this, arguments);
|
10768 |
+
} else {
|
10769 |
+
var args = _normalizeArguments.apply(this, arguments);
|
10770 |
+
args[1].mode = 'toggle';
|
10771 |
+
return this.effect.apply(this, args);
|
10772 |
+
}
|
10773 |
+
},
|
10774 |
+
|
10775 |
+
// helper functions
|
10776 |
+
cssUnit: function(key) {
|
10777 |
+
var style = this.css(key), val = [];
|
10778 |
+
$.each( ['em','px','%','pt'], function(i, unit){
|
10779 |
+
if(style.indexOf(unit) > 0)
|
10780 |
+
val = [parseFloat(style), unit];
|
10781 |
+
});
|
10782 |
+
return val;
|
10783 |
+
}
|
10784 |
+
});
|
10785 |
+
|
10786 |
+
|
10787 |
+
|
10788 |
+
/******************************************************************************/
|
10789 |
+
/*********************************** EASING ***********************************/
|
10790 |
+
/******************************************************************************/
|
10791 |
+
|
10792 |
+
/*
|
10793 |
+
* jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/
|
10794 |
+
*
|
10795 |
+
* Uses the built in easing capabilities added In jQuery 1.1
|
10796 |
+
* to offer multiple easing options
|
10797 |
+
*
|
10798 |
+
* TERMS OF USE - jQuery Easing
|
10799 |
+
*
|
10800 |
+
* Open source under the BSD License.
|
10801 |
+
*
|
10802 |
+
* Copyright 2008 George McGinley Smith
|
10803 |
+
* All rights reserved.
|
10804 |
+
*
|
10805 |
+
* Redistribution and use in source and binary forms, with or without modification,
|
10806 |
+
* are permitted provided that the following conditions are met:
|
10807 |
+
*
|
10808 |
+
* Redistributions of source code must retain the above copyright notice, this list of
|
10809 |
+
* conditions and the following disclaimer.
|
10810 |
+
* Redistributions in binary form must reproduce the above copyright notice, this list
|
10811 |
+
* of conditions and the following disclaimer in the documentation and/or other materials
|
10812 |
+
* provided with the distribution.
|
10813 |
+
*
|
10814 |
+
* Neither the name of the author nor the names of contributors may be used to endorse
|
10815 |
+
* or promote products derived from this software without specific prior written permission.
|
10816 |
+
*
|
10817 |
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
10818 |
+
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
10819 |
+
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
10820 |
+
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
10821 |
+
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
|
10822 |
+
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
10823 |
+
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
10824 |
+
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
10825 |
+
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
10826 |
+
*
|
10827 |
+
*/
|
10828 |
+
|
10829 |
+
// t: current time, b: begInnIng value, c: change In value, d: duration
|
10830 |
+
$.easing.jswing = $.easing.swing;
|
10831 |
+
|
10832 |
+
$.extend($.easing,
|
10833 |
+
{
|
10834 |
+
def: 'easeOutQuad',
|
10835 |
+
swing: function (x, t, b, c, d) {
|
10836 |
+
//alert($.easing.default);
|
10837 |
+
return $.easing[$.easing.def](x, t, b, c, d);
|
10838 |
+
},
|
10839 |
+
easeInQuad: function (x, t, b, c, d) {
|
10840 |
+
return c*(t/=d)*t + b;
|
10841 |
+
},
|
10842 |
+
easeOutQuad: function (x, t, b, c, d) {
|
10843 |
+
return -c *(t/=d)*(t-2) + b;
|
10844 |
+
},
|
10845 |
+
easeInOutQuad: function (x, t, b, c, d) {
|
10846 |
+
if ((t/=d/2) < 1) return c/2*t*t + b;
|
10847 |
+
return -c/2 * ((--t)*(t-2) - 1) + b;
|
10848 |
+
},
|
10849 |
+
easeInCubic: function (x, t, b, c, d) {
|
10850 |
+
return c*(t/=d)*t*t + b;
|
10851 |
+
},
|
10852 |
+
easeOutCubic: function (x, t, b, c, d) {
|
10853 |
+
return c*((t=t/d-1)*t*t + 1) + b;
|
10854 |
+
},
|
10855 |
+
easeInOutCubic: function (x, t, b, c, d) {
|
10856 |
+
if ((t/=d/2) < 1) return c/2*t*t*t + b;
|
10857 |
+
return c/2*((t-=2)*t*t + 2) + b;
|
10858 |
+
},
|
10859 |
+
easeInQuart: function (x, t, b, c, d) {
|
10860 |
+
return c*(t/=d)*t*t*t + b;
|
10861 |
+
},
|
10862 |
+
easeOutQuart: function (x, t, b, c, d) {
|
10863 |
+
return -c * ((t=t/d-1)*t*t*t - 1) + b;
|
10864 |
+
},
|
10865 |
+
easeInOutQuart: function (x, t, b, c, d) {
|
10866 |
+
if ((t/=d/2) < 1) return c/2*t*t*t*t + b;
|
10867 |
+
return -c/2 * ((t-=2)*t*t*t - 2) + b;
|
10868 |
+
},
|
10869 |
+
easeInQuint: function (x, t, b, c, d) {
|
10870 |
+
return c*(t/=d)*t*t*t*t + b;
|
10871 |
+
},
|
10872 |
+
easeOutQuint: function (x, t, b, c, d) {
|
10873 |
+
return c*((t=t/d-1)*t*t*t*t + 1) + b;
|
10874 |
+
},
|
10875 |
+
easeInOutQuint: function (x, t, b, c, d) {
|
10876 |
+
if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b;
|
10877 |
+
return c/2*((t-=2)*t*t*t*t + 2) + b;
|
10878 |
+
},
|
10879 |
+
easeInSine: function (x, t, b, c, d) {
|
10880 |
+
return -c * Math.cos(t/d * (Math.PI/2)) + c + b;
|
10881 |
+
},
|
10882 |
+
easeOutSine: function (x, t, b, c, d) {
|
10883 |
+
return c * Math.sin(t/d * (Math.PI/2)) + b;
|
10884 |
+
},
|
10885 |
+
easeInOutSine: function (x, t, b, c, d) {
|
10886 |
+
return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b;
|
10887 |
+
},
|
10888 |
+
easeInExpo: function (x, t, b, c, d) {
|
10889 |
+
return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b;
|
10890 |
+
},
|
10891 |
+
easeOutExpo: function (x, t, b, c, d) {
|
10892 |
+
return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b;
|
10893 |
+
},
|
10894 |
+
easeInOutExpo: function (x, t, b, c, d) {
|
10895 |
+
if (t==0) return b;
|
10896 |
+
if (t==d) return b+c;
|
10897 |
+
if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b;
|
10898 |
+
return c/2 * (-Math.pow(2, -10 * --t) + 2) + b;
|
10899 |
+
},
|
10900 |
+
easeInCirc: function (x, t, b, c, d) {
|
10901 |
+
return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b;
|
10902 |
+
},
|
10903 |
+
easeOutCirc: function (x, t, b, c, d) {
|
10904 |
+
return c * Math.sqrt(1 - (t=t/d-1)*t) + b;
|
10905 |
+
},
|
10906 |
+
easeInOutCirc: function (x, t, b, c, d) {
|
10907 |
+
if ((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b;
|
10908 |
+
return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b;
|
10909 |
+
},
|
10910 |
+
easeInElastic: function (x, t, b, c, d) {
|
10911 |
+
var s=1.70158;var p=0;var a=c;
|
10912 |
+
if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3;
|
10913 |
+
if (a < Math.abs(c)) { a=c; var s=p/4; }
|
10914 |
+
else var s = p/(2*Math.PI) * Math.asin (c/a);
|
10915 |
+
return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
|
10916 |
+
},
|
10917 |
+
easeOutElastic: function (x, t, b, c, d) {
|
10918 |
+
var s=1.70158;var p=0;var a=c;
|
10919 |
+
if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3;
|
10920 |
+
if (a < Math.abs(c)) { a=c; var s=p/4; }
|
10921 |
+
else var s = p/(2*Math.PI) * Math.asin (c/a);
|
10922 |
+
return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b;
|
10923 |
+
},
|
10924 |
+
easeInOutElastic: function (x, t, b, c, d) {
|
10925 |
+
var s=1.70158;var p=0;var a=c;
|
10926 |
+
if (t==0) return b; if ((t/=d/2)==2) return b+c; if (!p) p=d*(.3*1.5);
|
10927 |
+
if (a < Math.abs(c)) { a=c; var s=p/4; }
|
10928 |
+
else var s = p/(2*Math.PI) * Math.asin (c/a);
|
10929 |
+
if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
|
10930 |
+
return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b;
|
10931 |
+
},
|
10932 |
+
easeInBack: function (x, t, b, c, d, s) {
|
10933 |
+
if (s == undefined) s = 1.70158;
|
10934 |
+
return c*(t/=d)*t*((s+1)*t - s) + b;
|
10935 |
+
},
|
10936 |
+
easeOutBack: function (x, t, b, c, d, s) {
|
10937 |
+
if (s == undefined) s = 1.70158;
|
10938 |
+
return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b;
|
10939 |
+
},
|
10940 |
+
easeInOutBack: function (x, t, b, c, d, s) {
|
10941 |
+
if (s == undefined) s = 1.70158;
|
10942 |
+
if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b;
|
10943 |
+
return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b;
|
10944 |
+
},
|
10945 |
+
easeInBounce: function (x, t, b, c, d) {
|
10946 |
+
return c - $.easing.easeOutBounce (x, d-t, 0, c, d) + b;
|
10947 |
+
},
|
10948 |
+
easeOutBounce: function (x, t, b, c, d) {
|
10949 |
+
if ((t/=d) < (1/2.75)) {
|
10950 |
+
return c*(7.5625*t*t) + b;
|
10951 |
+
} else if (t < (2/2.75)) {
|
10952 |
+
return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b;
|
10953 |
+
} else if (t < (2.5/2.75)) {
|
10954 |
+
return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b;
|
10955 |
+
} else {
|
10956 |
+
return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b;
|
10957 |
+
}
|
10958 |
+
},
|
10959 |
+
easeInOutBounce: function (x, t, b, c, d) {
|
10960 |
+
if (t < d/2) return $.easing.easeInBounce (x, t*2, 0, c, d) * .5 + b;
|
10961 |
+
return $.easing.easeOutBounce (x, t*2-d, 0, c, d) * .5 + c*.5 + b;
|
10962 |
+
}
|
10963 |
+
});
|
10964 |
+
|
10965 |
+
/*
|
10966 |
+
*
|
10967 |
+
* TERMS OF USE - EASING EQUATIONS
|
10968 |
+
*
|
10969 |
+
* Open source under the BSD License.
|
10970 |
+
*
|
10971 |
+
* Copyright 2001 Robert Penner
|
10972 |
+
* All rights reserved.
|
10973 |
+
*
|
10974 |
+
* Redistribution and use in source and binary forms, with or without modification,
|
10975 |
+
* are permitted provided that the following conditions are met:
|
10976 |
+
*
|
10977 |
+
* Redistributions of source code must retain the above copyright notice, this list of
|
10978 |
+
* conditions and the following disclaimer.
|
10979 |
+
* Redistributions in binary form must reproduce the above copyright notice, this list
|
10980 |
+
* of conditions and the following disclaimer in the documentation and/or other materials
|
10981 |
+
* provided with the distribution.
|
10982 |
+
*
|
10983 |
+
* Neither the name of the author nor the names of contributors may be used to endorse
|
10984 |
+
* or promote products derived from this software without specific prior written permission.
|
10985 |
+
*
|
10986 |
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
10987 |
+
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
10988 |
+
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
10989 |
+
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
10990 |
+
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
|
10991 |
+
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
10992 |
+
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
10993 |
+
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
10994 |
+
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
10995 |
+
*
|
10996 |
+
*/
|
10997 |
+
|
10998 |
+
})(jQuery);
|
10999 |
+
/*
|
11000 |
+
* jQuery UI Effects Blind 1.8.17
|
11001 |
+
*
|
11002 |
+
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
|
11003 |
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
11004 |
+
* http://jquery.org/license
|
11005 |
+
*
|
11006 |
+
* http://docs.jquery.com/UI/Effects/Blind
|
11007 |
+
*
|
11008 |
+
* Depends:
|
11009 |
+
* jquery.effects.core.js
|
11010 |
+
*/
|
11011 |
+
(function( $, undefined ) {
|
11012 |
+
|
11013 |
+
$.effects.blind = function(o) {
|
11014 |
+
|
11015 |
+
return this.queue(function() {
|
11016 |
+
|
11017 |
+
// Create element
|
11018 |
+
var el = $(this), props = ['position','top','bottom','left','right'];
|
11019 |
+
|
11020 |
+
// Set options
|
11021 |
+
var mode = $.effects.setMode(el, o.options.mode || 'hide'); // Set Mode
|
11022 |
+
var direction = o.options.direction || 'vertical'; // Default direction
|
11023 |
+
|
11024 |
+
// Adjust
|
11025 |
+
$.effects.save(el, props); el.show(); // Save & Show
|
11026 |
+
var wrapper = $.effects.createWrapper(el).css({overflow:'hidden'}); // Create Wrapper
|
11027 |
+
var ref = (direction == 'vertical') ? 'height' : 'width';
|
11028 |
+
var distance = (direction == 'vertical') ? wrapper.height() : wrapper.width();
|
11029 |
+
if(mode == 'show') wrapper.css(ref, 0); // Shift
|
11030 |
+
|
11031 |
+
// Animation
|
11032 |
+
var animation = {};
|
11033 |
+
animation[ref] = mode == 'show' ? distance : 0;
|
11034 |
+
|
11035 |
+
// Animate
|
11036 |
+
wrapper.animate(animation, o.duration, o.options.easing, function() {
|
11037 |
+
if(mode == 'hide') el.hide(); // Hide
|
11038 |
+
$.effects.restore(el, props); $.effects.removeWrapper(el); // Restore
|
11039 |
+
if(o.callback) o.callback.apply(el[0], arguments); // Callback
|
11040 |
+
el.dequeue();
|
11041 |
+
});
|
11042 |
+
|
11043 |
+
});
|
11044 |
+
|
11045 |
+
};
|
11046 |
+
|
11047 |
+
})(jQuery);
|
11048 |
+
/*
|
11049 |
+
* jQuery UI Effects Bounce 1.8.17
|
11050 |
+
*
|
11051 |
+
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
|
11052 |
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
11053 |
+
* http://jquery.org/license
|
11054 |
+
*
|
11055 |
+
* http://docs.jquery.com/UI/Effects/Bounce
|
11056 |
+
*
|
11057 |
+
* Depends:
|
11058 |
+
* jquery.effects.core.js
|
11059 |
+
*/
|
11060 |
+
(function( $, undefined ) {
|
11061 |
+
|
11062 |
+
$.effects.bounce = function(o) {
|
11063 |
+
|
11064 |
+
return this.queue(function() {
|
11065 |
+
|
11066 |
+
// Create element
|
11067 |
+
var el = $(this), props = ['position','top','bottom','left','right'];
|
11068 |
+
|
11069 |
+
// Set options
|
11070 |
+
var mode = $.effects.setMode(el, o.options.mode || 'effect'); // Set Mode
|
11071 |
+
var direction = o.options.direction || 'up'; // Default direction
|
11072 |
+
var distance = o.options.distance || 20; // Default distance
|
11073 |
+
var times = o.options.times || 5; // Default # of times
|
11074 |
+
var speed = o.duration || 250; // Default speed per bounce
|
11075 |
+
if (/show|hide/.test(mode)) props.push('opacity'); // Avoid touching opacity to prevent clearType and PNG issues in IE
|
11076 |
+
|
11077 |
+
// Adjust
|
11078 |
+
$.effects.save(el, props); el.show(); // Save & Show
|
11079 |
+
$.effects.createWrapper(el); // Create Wrapper
|
11080 |
+
var ref = (direction == 'up' || direction == 'down') ? 'top' : 'left';
|
11081 |
+
var motion = (direction == 'up' || direction == 'left') ? 'pos' : 'neg';
|
11082 |
+
var distance = o.options.distance || (ref == 'top' ? el.outerHeight({margin:true}) / 3 : el.outerWidth({margin:true}) / 3);
|
11083 |
+
if (mode == 'show') el.css('opacity', 0).css(ref, motion == 'pos' ? -distance : distance); // Shift
|
11084 |
+
if (mode == 'hide') distance = distance / (times * 2);
|
11085 |
+
if (mode != 'hide') times--;
|
11086 |
+
|
11087 |
+
// Animate
|
11088 |
+
if (mode == 'show') { // Show Bounce
|
11089 |
+
var animation = {opacity: 1};
|
11090 |
+
animation[ref] = (motion == 'pos' ? '+=' : '-=') + distance;
|
11091 |
+
el.animate(animation, speed / 2, o.options.easing);
|
11092 |
+
distance = distance / 2;
|
11093 |
+
times--;
|
11094 |
+
};
|
11095 |
+
for (var i = 0; i < times; i++) { // Bounces
|
11096 |
+
var animation1 = {}, animation2 = {};
|
11097 |
+
animation1[ref] = (motion == 'pos' ? '-=' : '+=') + distance;
|
11098 |
+
animation2[ref] = (motion == 'pos' ? '+=' : '-=') + distance;
|
11099 |
+
el.animate(animation1, speed / 2, o.options.easing).animate(animation2, speed / 2, o.options.easing);
|
11100 |
+
distance = (mode == 'hide') ? distance * 2 : distance / 2;
|
11101 |
+
};
|
11102 |
+
if (mode == 'hide') { // Last Bounce
|
11103 |
+
var animation = {opacity: 0};
|
11104 |
+
animation[ref] = (motion == 'pos' ? '-=' : '+=') + distance;
|
11105 |
+
el.animate(animation, speed / 2, o.options.easing, function(){
|
11106 |
+
el.hide(); // Hide
|
11107 |
+
$.effects.restore(el, props); $.effects.removeWrapper(el); // Restore
|
11108 |
+
if(o.callback) o.callback.apply(this, arguments); // Callback
|
11109 |
+
});
|
11110 |
+
} else {
|
11111 |
+
var animation1 = {}, animation2 = {};
|
11112 |
+
animation1[ref] = (motion == 'pos' ? '-=' : '+=') + distance;
|
11113 |
+
animation2[ref] = (motion == 'pos' ? '+=' : '-=') + distance;
|
11114 |
+
el.animate(animation1, speed / 2, o.options.easing).animate(animation2, speed / 2, o.options.easing, function(){
|
11115 |
+
$.effects.restore(el, props); $.effects.removeWrapper(el); // Restore
|
11116 |
+
if(o.callback) o.callback.apply(this, arguments); // Callback
|
11117 |
+
});
|
11118 |
+
};
|
11119 |
+
el.queue('fx', function() { el.dequeue(); });
|
11120 |
+
el.dequeue();
|
11121 |
+
});
|
11122 |
+
|
11123 |
+
};
|
11124 |
+
|
11125 |
+
})(jQuery);
|
11126 |
+
/*
|
11127 |
+
* jQuery UI Effects Clip 1.8.17
|
11128 |
+
*
|
11129 |
+
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
|
11130 |
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
11131 |
+
* http://jquery.org/license
|
11132 |
+
*
|
11133 |
+
* http://docs.jquery.com/UI/Effects/Clip
|
11134 |
+
*
|
11135 |
+
* Depends:
|
11136 |
+
* jquery.effects.core.js
|
11137 |
+
*/
|
11138 |
+
(function( $, undefined ) {
|
11139 |
+
|
11140 |
+
$.effects.clip = function(o) {
|
11141 |
+
|
11142 |
+
return this.queue(function() {
|
11143 |
+
|
11144 |
+
// Create element
|
11145 |
+
var el = $(this), props = ['position','top','bottom','left','right','height','width'];
|
11146 |
+
|
11147 |
+
// Set options
|
11148 |
+
var mode = $.effects.setMode(el, o.options.mode || 'hide'); // Set Mode
|
11149 |
+
var direction = o.options.direction || 'vertical'; // Default direction
|
11150 |
+
|
11151 |
+
// Adjust
|
11152 |
+
$.effects.save(el, props); el.show(); // Save & Show
|
11153 |
+
var wrapper = $.effects.createWrapper(el).css({overflow:'hidden'}); // Create Wrapper
|
11154 |
+
var animate = el[0].tagName == 'IMG' ? wrapper : el;
|
11155 |
+
var ref = {
|
11156 |
+
size: (direction == 'vertical') ? 'height' : 'width',
|
11157 |
+
position: (direction == 'vertical') ? 'top' : 'left'
|
11158 |
+
};
|
11159 |
+
var distance = (direction == 'vertical') ? animate.height() : animate.width();
|
11160 |
+
if(mode == 'show') { animate.css(ref.size, 0); animate.css(ref.position, distance / 2); } // Shift
|
11161 |
+
|
11162 |
+
// Animation
|
11163 |
+
var animation = {};
|
11164 |
+
animation[ref.size] = mode == 'show' ? distance : 0;
|
11165 |
+
animation[ref.position] = mode == 'show' ? 0 : distance / 2;
|
11166 |
+
|
11167 |
+
// Animate
|
11168 |
+
animate.animate(animation, { queue: false, duration: o.duration, easing: o.options.easing, complete: function() {
|
11169 |
+
if(mode == 'hide') el.hide(); // Hide
|
11170 |
+
$.effects.restore(el, props); $.effects.removeWrapper(el); // Restore
|
11171 |
+
if(o.callback) o.callback.apply(el[0], arguments); // Callback
|
11172 |
+
el.dequeue();
|
11173 |
+
}});
|
11174 |
+
|
11175 |
+
});
|
11176 |
+
|
11177 |
+
};
|
11178 |
+
|
11179 |
+
})(jQuery);
|
11180 |
+
/*
|
11181 |
+
* jQuery UI Effects Drop 1.8.17
|
11182 |
+
*
|
11183 |
+
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
|
11184 |
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
11185 |
+
* http://jquery.org/license
|
11186 |
+
*
|
11187 |
+
* http://docs.jquery.com/UI/Effects/Drop
|
11188 |
+
*
|
11189 |
+
* Depends:
|
11190 |
+
* jquery.effects.core.js
|
11191 |
+
*/
|
11192 |
+
(function( $, undefined ) {
|
11193 |
+
|
11194 |
+
$.effects.drop = function(o) {
|
11195 |
+
|
11196 |
+
return this.queue(function() {
|
11197 |
+
|
11198 |
+
// Create element
|
11199 |
+
var el = $(this), props = ['position','top','bottom','left','right','opacity'];
|
11200 |
+
|
11201 |
+
// Set options
|
11202 |
+
var mode = $.effects.setMode(el, o.options.mode || 'hide'); // Set Mode
|
11203 |
+
var direction = o.options.direction || 'left'; // Default Direction
|
11204 |
+
|
11205 |
+
// Adjust
|
11206 |
+
$.effects.save(el, props); el.show(); // Save & Show
|
11207 |
+
$.effects.createWrapper(el); // Create Wrapper
|
11208 |
+
var ref = (direction == 'up' || direction == 'down') ? 'top' : 'left';
|
11209 |
+
var motion = (direction == 'up' || direction == 'left') ? 'pos' : 'neg';
|
11210 |
+
var distance = o.options.distance || (ref == 'top' ? el.outerHeight({margin:true}) / 2 : el.outerWidth({margin:true}) / 2);
|
11211 |
+
if (mode == 'show') el.css('opacity', 0).css(ref, motion == 'pos' ? -distance : distance); // Shift
|
11212 |
+
|
11213 |
+
// Animation
|
11214 |
+
var animation = {opacity: mode == 'show' ? 1 : 0};
|
11215 |
+
animation[ref] = (mode == 'show' ? (motion == 'pos' ? '+=' : '-=') : (motion == 'pos' ? '-=' : '+=')) + distance;
|
11216 |
+
|
11217 |
+
// Animate
|
11218 |
+
el.animate(animation, { queue: false, duration: o.duration, easing: o.options.easing, complete: function() {
|
11219 |
+
if(mode == 'hide') el.hide(); // Hide
|
11220 |
+
$.effects.restore(el, props); $.effects.removeWrapper(el); // Restore
|
11221 |
+
if(o.callback) o.callback.apply(this, arguments); // Callback
|
11222 |
+
el.dequeue();
|
11223 |
+
}});
|
11224 |
+
|
11225 |
+
});
|
11226 |
+
|
11227 |
+
};
|
11228 |
+
|
11229 |
+
})(jQuery);
|
11230 |
+
/*
|
11231 |
+
* jQuery UI Effects Explode 1.8.17
|
11232 |
+
*
|
11233 |
+
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
|
11234 |
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
11235 |
+
* http://jquery.org/license
|
11236 |
+
*
|
11237 |
+
* http://docs.jquery.com/UI/Effects/Explode
|
11238 |
+
*
|
11239 |
+
* Depends:
|
11240 |
+
* jquery.effects.core.js
|
11241 |
+
*/
|
11242 |
+
(function( $, undefined ) {
|
11243 |
+
|
11244 |
+
$.effects.explode = function(o) {
|
11245 |
+
|
11246 |
+
return this.queue(function() {
|
11247 |
+
|
11248 |
+
var rows = o.options.pieces ? Math.round(Math.sqrt(o.options.pieces)) : 3;
|
11249 |
+
var cells = o.options.pieces ? Math.round(Math.sqrt(o.options.pieces)) : 3;
|
11250 |
+
|
11251 |
+
o.options.mode = o.options.mode == 'toggle' ? ($(this).is(':visible') ? 'hide' : 'show') : o.options.mode;
|
11252 |
+
var el = $(this).show().css('visibility', 'hidden');
|
11253 |
+
var offset = el.offset();
|
11254 |
+
|
11255 |
+
//Substract the margins - not fixing the problem yet.
|
11256 |
+
offset.top -= parseInt(el.css("marginTop"),10) || 0;
|
11257 |
+
offset.left -= parseInt(el.css("marginLeft"),10) || 0;
|
11258 |
+
|
11259 |
+
var width = el.outerWidth(true);
|
11260 |
+
var height = el.outerHeight(true);
|
11261 |
+
|
11262 |
+
for(var i=0;i<rows;i++) { // =
|
11263 |
+
for(var j=0;j<cells;j++) { // ||
|
11264 |
+
el
|
11265 |
+
.clone()
|
11266 |
+
.appendTo('body')
|
11267 |
+
.wrap('<div></div>')
|
11268 |
+
.css({
|
11269 |
+
position: 'absolute',
|
11270 |
+
visibility: 'visible',
|
11271 |
+
left: -j*(width/cells),
|
11272 |
+
top: -i*(height/rows)
|
11273 |
+
})
|
11274 |
+
.parent()
|
11275 |
+
.addClass('ui-effects-explode')
|
11276 |
+
.css({
|
11277 |
+
position: 'absolute',
|
11278 |
+
overflow: 'hidden',
|
11279 |
+
width: width/cells,
|
11280 |
+
height: height/rows,
|
11281 |
+
left: offset.left + j*(width/cells) + (o.options.mode == 'show' ? (j-Math.floor(cells/2))*(width/cells) : 0),
|
11282 |
+
top: offset.top + i*(height/rows) + (o.options.mode == 'show' ? (i-Math.floor(rows/2))*(height/rows) : 0),
|
11283 |
+
opacity: o.options.mode == 'show' ? 0 : 1
|
11284 |
+
}).animate({
|
11285 |
+
left: offset.left + j*(width/cells) + (o.options.mode == 'show' ? 0 : (j-Math.floor(cells/2))*(width/cells)),
|
11286 |
+
top: offset.top + i*(height/rows) + (o.options.mode == 'show' ? 0 : (i-Math.floor(rows/2))*(height/rows)),
|
11287 |
+
opacity: o.options.mode == 'show' ? 1 : 0
|
11288 |
+
}, o.duration || 500);
|
11289 |
+
}
|
11290 |
+
}
|
11291 |
+
|
11292 |
+
// Set a timeout, to call the callback approx. when the other animations have finished
|
11293 |
+
setTimeout(function() {
|
11294 |
+
|
11295 |
+
o.options.mode == 'show' ? el.css({ visibility: 'visible' }) : el.css({ visibility: 'visible' }).hide();
|
11296 |
+
if(o.callback) o.callback.apply(el[0]); // Callback
|
11297 |
+
el.dequeue();
|
11298 |
+
|
11299 |
+
$('div.ui-effects-explode').remove();
|
11300 |
+
|
11301 |
+
}, o.duration || 500);
|
11302 |
+
|
11303 |
+
|
11304 |
+
});
|
11305 |
+
|
11306 |
+
};
|
11307 |
+
|
11308 |
+
})(jQuery);
|
11309 |
+
/*
|
11310 |
+
* jQuery UI Effects Fade 1.8.17
|
11311 |
+
*
|
11312 |
+
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
|
11313 |
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
11314 |
+
* http://jquery.org/license
|
11315 |
+
*
|
11316 |
+
* http://docs.jquery.com/UI/Effects/Fade
|
11317 |
+
*
|
11318 |
+
* Depends:
|
11319 |
+
* jquery.effects.core.js
|
11320 |
+
*/
|
11321 |
+
(function( $, undefined ) {
|
11322 |
+
|
11323 |
+
$.effects.fade = function(o) {
|
11324 |
+
return this.queue(function() {
|
11325 |
+
var elem = $(this),
|
11326 |
+
mode = $.effects.setMode(elem, o.options.mode || 'hide');
|
11327 |
+
|
11328 |
+
elem.animate({ opacity: mode }, {
|
11329 |
+
queue: false,
|
11330 |
+
duration: o.duration,
|
11331 |
+
easing: o.options.easing,
|
11332 |
+
complete: function() {
|
11333 |
+
(o.callback && o.callback.apply(this, arguments));
|
11334 |
+
elem.dequeue();
|
11335 |
+
}
|
11336 |
+
});
|
11337 |
+
});
|
11338 |
+
};
|
11339 |
+
|
11340 |
+
})(jQuery);
|
11341 |
+
/*
|
11342 |
+
* jQuery UI Effects Fold 1.8.17
|
11343 |
+
*
|
11344 |
+
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
|
11345 |
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
11346 |
+
* http://jquery.org/license
|
11347 |
+
*
|
11348 |
+
* http://docs.jquery.com/UI/Effects/Fold
|
11349 |
+
*
|
11350 |
+
* Depends:
|
11351 |
+
* jquery.effects.core.js
|
11352 |
+
*/
|
11353 |
+
(function( $, undefined ) {
|
11354 |
+
|
11355 |
+
$.effects.fold = function(o) {
|
11356 |
+
|
11357 |
+
return this.queue(function() {
|
11358 |
+
|
11359 |
+
// Create element
|
11360 |
+
var el = $(this), props = ['position','top','bottom','left','right'];
|
11361 |
+
|
11362 |
+
// Set options
|
11363 |
+
var mode = $.effects.setMode(el, o.options.mode || 'hide'); // Set Mode
|
11364 |
+
var size = o.options.size || 15; // Default fold size
|
11365 |
+
var horizFirst = !(!o.options.horizFirst); // Ensure a boolean value
|
11366 |
+
var duration = o.duration ? o.duration / 2 : $.fx.speeds._default / 2;
|
11367 |
+
|
11368 |
+
// Adjust
|
11369 |
+
$.effects.save(el, props); el.show(); // Save & Show
|
11370 |
+
var wrapper = $.effects.createWrapper(el).css({overflow:'hidden'}); // Create Wrapper
|
11371 |
+
var widthFirst = ((mode == 'show') != horizFirst);
|
11372 |
+
var ref = widthFirst ? ['width', 'height'] : ['height', 'width'];
|
11373 |
+
var distance = widthFirst ? [wrapper.width(), wrapper.height()] : [wrapper.height(), wrapper.width()];
|
11374 |
+
var percent = /([0-9]+)%/.exec(size);
|
11375 |
+
if(percent) size = parseInt(percent[1],10) / 100 * distance[mode == 'hide' ? 0 : 1];
|
11376 |
+
if(mode == 'show') wrapper.css(horizFirst ? {height: 0, width: size} : {height: size, width: 0}); // Shift
|
11377 |
+
|
11378 |
+
// Animation
|
11379 |
+
var animation1 = {}, animation2 = {};
|
11380 |
+
animation1[ref[0]] = mode == 'show' ? distance[0] : size;
|
11381 |
+
animation2[ref[1]] = mode == 'show' ? distance[1] : 0;
|
11382 |
+
|
11383 |
+
// Animate
|
11384 |
+
wrapper.animate(animation1, duration, o.options.easing)
|
11385 |
+
.animate(animation2, duration, o.options.easing, function() {
|
11386 |
+
if(mode == 'hide') el.hide(); // Hide
|
11387 |
+
$.effects.restore(el, props); $.effects.removeWrapper(el); // Restore
|
11388 |
+
if(o.callback) o.callback.apply(el[0], arguments); // Callback
|
11389 |
+
el.dequeue();
|
11390 |
+
});
|
11391 |
+
|
11392 |
+
});
|
11393 |
+
|
11394 |
+
};
|
11395 |
+
|
11396 |
+
})(jQuery);
|
11397 |
+
/*
|
11398 |
+
* jQuery UI Effects Highlight 1.8.17
|
11399 |
+
*
|
11400 |
+
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
|
11401 |
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
11402 |
+
* http://jquery.org/license
|
11403 |
+
*
|
11404 |
+
* http://docs.jquery.com/UI/Effects/Highlight
|
11405 |
+
*
|
11406 |
+
* Depends:
|
11407 |
+
* jquery.effects.core.js
|
11408 |
+
*/
|
11409 |
+
(function( $, undefined ) {
|
11410 |
+
|
11411 |
+
$.effects.highlight = function(o) {
|
11412 |
+
return this.queue(function() {
|
11413 |
+
var elem = $(this),
|
11414 |
+
props = ['backgroundImage', 'backgroundColor', 'opacity'],
|
11415 |
+
mode = $.effects.setMode(elem, o.options.mode || 'show'),
|
11416 |
+
animation = {
|
11417 |
+
backgroundColor: elem.css('backgroundColor')
|
11418 |
+
};
|
11419 |
+
|
11420 |
+
if (mode == 'hide') {
|
11421 |
+
animation.opacity = 0;
|
11422 |
+
}
|
11423 |
+
|
11424 |
+
$.effects.save(elem, props);
|
11425 |
+
elem
|
11426 |
+
.show()
|
11427 |
+
.css({
|
11428 |
+
backgroundImage: 'none',
|
11429 |
+
backgroundColor: o.options.color || '#ffff99'
|
11430 |
+
})
|
11431 |
+
.animate(animation, {
|
11432 |
+
queue: false,
|
11433 |
+
duration: o.duration,
|
11434 |
+
easing: o.options.easing,
|
11435 |
+
complete: function() {
|
11436 |
+
(mode == 'hide' && elem.hide());
|
11437 |
+
$.effects.restore(elem, props);
|
11438 |
+
(mode == 'show' && !$.support.opacity && this.style.removeAttribute('filter'));
|
11439 |
+
(o.callback && o.callback.apply(this, arguments));
|
11440 |
+
elem.dequeue();
|
11441 |
+
}
|
11442 |
+
});
|
11443 |
+
});
|
11444 |
+
};
|
11445 |
+
|
11446 |
+
})(jQuery);
|
11447 |
+
/*
|
11448 |
+
* jQuery UI Effects Pulsate 1.8.17
|
11449 |
+
*
|
11450 |
+
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
|
11451 |
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
11452 |
+
* http://jquery.org/license
|
11453 |
+
*
|
11454 |
+
* http://docs.jquery.com/UI/Effects/Pulsate
|
11455 |
+
*
|
11456 |
+
* Depends:
|
11457 |
+
* jquery.effects.core.js
|
11458 |
+
*/
|
11459 |
+
(function( $, undefined ) {
|
11460 |
+
|
11461 |
+
$.effects.pulsate = function(o) {
|
11462 |
+
return this.queue(function() {
|
11463 |
+
var elem = $(this),
|
11464 |
+
mode = $.effects.setMode(elem, o.options.mode || 'show');
|
11465 |
+
times = ((o.options.times || 5) * 2) - 1;
|
11466 |
+
duration = o.duration ? o.duration / 2 : $.fx.speeds._default / 2,
|
11467 |
+
isVisible = elem.is(':visible'),
|
11468 |
+
animateTo = 0;
|
11469 |
+
|
11470 |
+
if (!isVisible) {
|
11471 |
+
elem.css('opacity', 0).show();
|
11472 |
+
animateTo = 1;
|
11473 |
+
}
|
11474 |
+
|
11475 |
+
if ((mode == 'hide' && isVisible) || (mode == 'show' && !isVisible)) {
|
11476 |
+
times--;
|
11477 |
+
}
|
11478 |
+
|
11479 |
+
for (var i = 0; i < times; i++) {
|
11480 |
+
elem.animate({ opacity: animateTo }, duration, o.options.easing);
|
11481 |
+
animateTo = (animateTo + 1) % 2;
|
11482 |
+
}
|
11483 |
+
|
11484 |
+
elem.animate({ opacity: animateTo }, duration, o.options.easing, function() {
|
11485 |
+
if (animateTo == 0) {
|
11486 |
+
elem.hide();
|
11487 |
+
}
|
11488 |
+
(o.callback && o.callback.apply(this, arguments));
|
11489 |
+
});
|
11490 |
+
|
11491 |
+
elem
|
11492 |
+
.queue('fx', function() { elem.dequeue(); })
|
11493 |
+
.dequeue();
|
11494 |
+
});
|
11495 |
+
};
|
11496 |
+
|
11497 |
+
})(jQuery);
|
11498 |
+
/*
|
11499 |
+
* jQuery UI Effects Scale 1.8.17
|
11500 |
+
*
|
11501 |
+
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
|
11502 |
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
11503 |
+
* http://jquery.org/license
|
11504 |
+
*
|
11505 |
+
* http://docs.jquery.com/UI/Effects/Scale
|
11506 |
+
*
|
11507 |
+
* Depends:
|
11508 |
+
* jquery.effects.core.js
|
11509 |
+
*/
|
11510 |
+
(function( $, undefined ) {
|
11511 |
+
|
11512 |
+
$.effects.puff = function(o) {
|
11513 |
+
return this.queue(function() {
|
11514 |
+
var elem = $(this),
|
11515 |
+
mode = $.effects.setMode(elem, o.options.mode || 'hide'),
|
11516 |
+
percent = parseInt(o.options.percent, 10) || 150,
|
11517 |
+
factor = percent / 100,
|
11518 |
+
original = { height: elem.height(), width: elem.width() };
|
11519 |
+
|
11520 |
+
$.extend(o.options, {
|
11521 |
+
fade: true,
|
11522 |
+
mode: mode,
|
11523 |
+
percent: mode == 'hide' ? percent : 100,
|
11524 |
+
from: mode == 'hide'
|
11525 |
+
? original
|
11526 |
+
: {
|
11527 |
+
height: original.height * factor,
|
11528 |
+
width: original.width * factor
|
11529 |
+
}
|
11530 |
+
});
|
11531 |
+
|
11532 |
+
elem.effect('scale', o.options, o.duration, o.callback);
|
11533 |
+
elem.dequeue();
|
11534 |
+
});
|
11535 |
+
};
|
11536 |
+
|
11537 |
+
$.effects.scale = function(o) {
|
11538 |
+
|
11539 |
+
return this.queue(function() {
|
11540 |
+
|
11541 |
+
// Create element
|
11542 |
+
var el = $(this);
|
11543 |
+
|
11544 |
+
// Set options
|
11545 |
+
var options = $.extend(true, {}, o.options);
|
11546 |
+
var mode = $.effects.setMode(el, o.options.mode || 'effect'); // Set Mode
|
11547 |
+
var percent = parseInt(o.options.percent,10) || (parseInt(o.options.percent,10) == 0 ? 0 : (mode == 'hide' ? 0 : 100)); // Set default scaling percent
|
11548 |
+
var direction = o.options.direction || 'both'; // Set default axis
|
11549 |
+
var origin = o.options.origin; // The origin of the scaling
|
11550 |
+
if (mode != 'effect') { // Set default origin and restore for show/hide
|
11551 |
+
options.origin = origin || ['middle','center'];
|
11552 |
+
options.restore = true;
|
11553 |
+
}
|
11554 |
+
var original = {height: el.height(), width: el.width()}; // Save original
|
11555 |
+
el.from = o.options.from || (mode == 'show' ? {height: 0, width: 0} : original); // Default from state
|
11556 |
+
|
11557 |
+
// Adjust
|
11558 |
+
var factor = { // Set scaling factor
|
11559 |
+
y: direction != 'horizontal' ? (percent / 100) : 1,
|
11560 |
+
x: direction != 'vertical' ? (percent / 100) : 1
|
11561 |
+
};
|
11562 |
+
el.to = {height: original.height * factor.y, width: original.width * factor.x}; // Set to state
|
11563 |
+
|
11564 |
+
if (o.options.fade) { // Fade option to support puff
|
11565 |
+
if (mode == 'show') {el.from.opacity = 0; el.to.opacity = 1;};
|
11566 |
+
if (mode == 'hide') {el.from.opacity = 1; el.to.opacity = 0;};
|
11567 |
+
};
|
11568 |
+
|
11569 |
+
// Animation
|
11570 |
+
options.from = el.from; options.to = el.to; options.mode = mode;
|
11571 |
+
|
11572 |
+
// Animate
|
11573 |
+
el.effect('size', options, o.duration, o.callback);
|
11574 |
+
el.dequeue();
|
11575 |
+
});
|
11576 |
+
|
11577 |
+
};
|
11578 |
+
|
11579 |
+
$.effects.size = function(o) {
|
11580 |
+
|
11581 |
+
return this.queue(function() {
|
11582 |
+
|
11583 |
+
// Create element
|
11584 |
+
var el = $(this), props = ['position','top','bottom','left','right','width','height','overflow','opacity'];
|
11585 |
+
var props1 = ['position','top','bottom','left','right','overflow','opacity']; // Always restore
|
11586 |
+
var props2 = ['width','height','overflow']; // Copy for children
|
11587 |
+
var cProps = ['fontSize'];
|
11588 |
+
var vProps = ['borderTopWidth', 'borderBottomWidth', 'paddingTop', 'paddingBottom'];
|
11589 |
+
var hProps = ['borderLeftWidth', 'borderRightWidth', 'paddingLeft', 'paddingRight'];
|
11590 |
+
|
11591 |
+
// Set options
|
11592 |
+
var mode = $.effects.setMode(el, o.options.mode || 'effect'); // Set Mode
|
11593 |
+
var restore = o.options.restore || false; // Default restore
|
11594 |
+
var scale = o.options.scale || 'both'; // Default scale mode
|
11595 |
+
var origin = o.options.origin; // The origin of the sizing
|
11596 |
+
var original = {height: el.height(), width: el.width()}; // Save original
|
11597 |
+
el.from = o.options.from || original; // Default from state
|
11598 |
+
el.to = o.options.to || original; // Default to state
|
11599 |
+
// Adjust
|
11600 |
+
if (origin) { // Calculate baseline shifts
|
11601 |
+
var baseline = $.effects.getBaseline(origin, original);
|
11602 |
+
el.from.top = (original.height - el.from.height) * baseline.y;
|
11603 |
+
el.from.left = (original.width - el.from.width) * baseline.x;
|
11604 |
+
el.to.top = (original.height - el.to.height) * baseline.y;
|
11605 |
+
el.to.left = (original.width - el.to.width) * baseline.x;
|
11606 |
+
};
|
11607 |
+
var factor = { // Set scaling factor
|
11608 |
+
from: {y: el.from.height / original.height, x: el.from.width / original.width},
|
11609 |
+
to: {y: el.to.height / original.height, x: el.to.width / original.width}
|
11610 |
+
};
|
11611 |
+
if (scale == 'box' || scale == 'both') { // Scale the css box
|
11612 |
+
if (factor.from.y != factor.to.y) { // Vertical props scaling
|
11613 |
+
props = props.concat(vProps);
|
11614 |
+
el.from = $.effects.setTransition(el, vProps, factor.from.y, el.from);
|
11615 |
+
el.to = $.effects.setTransition(el, vProps, factor.to.y, el.to);
|
11616 |
+
};
|
11617 |
+
if (factor.from.x != factor.to.x) { // Horizontal props scaling
|
11618 |
+
props = props.concat(hProps);
|
11619 |
+
el.from = $.effects.setTransition(el, hProps, factor.from.x, el.from);
|
11620 |
+
el.to = $.effects.setTransition(el, hProps, factor.to.x, el.to);
|
11621 |
+
};
|
11622 |
+
};
|
11623 |
+
if (scale == 'content' || scale == 'both') { // Scale the content
|
11624 |
+
if (factor.from.y != factor.to.y) { // Vertical props scaling
|
11625 |
+
props = props.concat(cProps);
|
11626 |
+
el.from = $.effects.setTransition(el, cProps, factor.from.y, el.from);
|
11627 |
+
el.to = $.effects.setTransition(el, cProps, factor.to.y, el.to);
|
11628 |
+
};
|
11629 |
+
};
|
11630 |
+
$.effects.save(el, restore ? props : props1); el.show(); // Save & Show
|
11631 |
+
$.effects.createWrapper(el); // Create Wrapper
|
11632 |
+
el.css('overflow','hidden').css(el.from); // Shift
|
11633 |
+
|
11634 |
+
// Animate
|
11635 |
+
if (scale == 'content' || scale == 'both') { // Scale the children
|
11636 |
+
vProps = vProps.concat(['marginTop','marginBottom']).concat(cProps); // Add margins/font-size
|
11637 |
+
hProps = hProps.concat(['marginLeft','marginRight']); // Add margins
|
11638 |
+
props2 = props.concat(vProps).concat(hProps); // Concat
|
11639 |
+
el.find("*[width]").each(function(){
|
11640 |
+
child = $(this);
|
11641 |
+
if (restore) $.effects.save(child, props2);
|
11642 |
+
var c_original = {height: child.height(), width: child.width()}; // Save original
|
11643 |
+
child.from = {height: c_original.height * factor.from.y, width: c_original.width * factor.from.x};
|
11644 |
+
child.to = {height: c_original.height * factor.to.y, width: c_original.width * factor.to.x};
|
11645 |
+
if (factor.from.y != factor.to.y) { // Vertical props scaling
|
11646 |
+
child.from = $.effects.setTransition(child, vProps, factor.from.y, child.from);
|
11647 |
+
child.to = $.effects.setTransition(child, vProps, factor.to.y, child.to);
|
11648 |
+
};
|
11649 |
+
if (factor.from.x != factor.to.x) { // Horizontal props scaling
|
11650 |
+
child.from = $.effects.setTransition(child, hProps, factor.from.x, child.from);
|
11651 |
+
child.to = $.effects.setTransition(child, hProps, factor.to.x, child.to);
|
11652 |
+
};
|
11653 |
+
child.css(child.from); // Shift children
|
11654 |
+
child.animate(child.to, o.duration, o.options.easing, function(){
|
11655 |
+
if (restore) $.effects.restore(child, props2); // Restore children
|
11656 |
+
}); // Animate children
|
11657 |
+
});
|
11658 |
+
};
|
11659 |
+
|
11660 |
+
// Animate
|
11661 |
+
el.animate(el.to, { queue: false, duration: o.duration, easing: o.options.easing, complete: function() {
|
11662 |
+
if (el.to.opacity === 0) {
|
11663 |
+
el.css('opacity', el.from.opacity);
|
11664 |
+
}
|
11665 |
+
if(mode == 'hide') el.hide(); // Hide
|
11666 |
+
$.effects.restore(el, restore ? props : props1); $.effects.removeWrapper(el); // Restore
|
11667 |
+
if(o.callback) o.callback.apply(this, arguments); // Callback
|
11668 |
+
el.dequeue();
|
11669 |
+
}});
|
11670 |
+
|
11671 |
+
});
|
11672 |
+
|
11673 |
+
};
|
11674 |
+
|
11675 |
+
})(jQuery);
|
11676 |
+
/*
|
11677 |
+
* jQuery UI Effects Shake 1.8.17
|
11678 |
+
*
|
11679 |
+
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
|
11680 |
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
11681 |
+
* http://jquery.org/license
|
11682 |
+
*
|
11683 |
+
* http://docs.jquery.com/UI/Effects/Shake
|
11684 |
+
*
|
11685 |
+
* Depends:
|
11686 |
+
* jquery.effects.core.js
|
11687 |
+
*/
|
11688 |
+
(function( $, undefined ) {
|
11689 |
+
|
11690 |
+
$.effects.shake = function(o) {
|
11691 |
+
|
11692 |
+
return this.queue(function() {
|
11693 |
+
|
11694 |
+
// Create element
|
11695 |
+
var el = $(this), props = ['position','top','bottom','left','right'];
|
11696 |
+
|
11697 |
+
// Set options
|
11698 |
+
var mode = $.effects.setMode(el, o.options.mode || 'effect'); // Set Mode
|
11699 |
+
var direction = o.options.direction || 'left'; // Default direction
|
11700 |
+
var distance = o.options.distance || 20; // Default distance
|
11701 |
+
var times = o.options.times || 3; // Default # of times
|
11702 |
+
var speed = o.duration || o.options.duration || 140; // Default speed per shake
|
11703 |
+
|
11704 |
+
// Adjust
|
11705 |
+
$.effects.save(el, props); el.show(); // Save & Show
|
11706 |
+
$.effects.createWrapper(el); // Create Wrapper
|
11707 |
+
var ref = (direction == 'up' || direction == 'down') ? 'top' : 'left';
|
11708 |
+
var motion = (direction == 'up' || direction == 'left') ? 'pos' : 'neg';
|
11709 |
+
|
11710 |
+
// Animation
|
11711 |
+
var animation = {}, animation1 = {}, animation2 = {};
|
11712 |
+
animation[ref] = (motion == 'pos' ? '-=' : '+=') + distance;
|
11713 |
+
animation1[ref] = (motion == 'pos' ? '+=' : '-=') + distance * 2;
|
11714 |
+
animation2[ref] = (motion == 'pos' ? '-=' : '+=') + distance * 2;
|
11715 |
+
|
11716 |
+
// Animate
|
11717 |
+
el.animate(animation, speed, o.options.easing);
|
11718 |
+
for (var i = 1; i < times; i++) { // Shakes
|
11719 |
+
el.animate(animation1, speed, o.options.easing).animate(animation2, speed, o.options.easing);
|
11720 |
+
};
|
11721 |
+
el.animate(animation1, speed, o.options.easing).
|
11722 |
+
animate(animation, speed / 2, o.options.easing, function(){ // Last shake
|
11723 |
+
$.effects.restore(el, props); $.effects.removeWrapper(el); // Restore
|
11724 |
+
if(o.callback) o.callback.apply(this, arguments); // Callback
|
11725 |
+
});
|
11726 |
+
el.queue('fx', function() { el.dequeue(); });
|
11727 |
+
el.dequeue();
|
11728 |
+
});
|
11729 |
+
|
11730 |
+
};
|
11731 |
+
|
11732 |
+
})(jQuery);
|
11733 |
+
/*
|
11734 |
+
* jQuery UI Effects Slide 1.8.17
|
11735 |
+
*
|
11736 |
+
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
|
11737 |
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
11738 |
+
* http://jquery.org/license
|
11739 |
+
*
|
11740 |
+
* http://docs.jquery.com/UI/Effects/Slide
|
11741 |
+
*
|
11742 |
+
* Depends:
|
11743 |
+
* jquery.effects.core.js
|
11744 |
+
*/
|
11745 |
+
(function( $, undefined ) {
|
11746 |
+
|
11747 |
+
$.effects.slide = function(o) {
|
11748 |
+
|
11749 |
+
return this.queue(function() {
|
11750 |
+
|
11751 |
+
// Create element
|
11752 |
+
var el = $(this), props = ['position','top','bottom','left','right'];
|
11753 |
+
|
11754 |
+
// Set options
|
11755 |
+
var mode = $.effects.setMode(el, o.options.mode || 'show'); // Set Mode
|
11756 |
+
var direction = o.options.direction || 'left'; // Default Direction
|
11757 |
+
|
11758 |
+
// Adjust
|
11759 |
+
$.effects.save(el, props); el.show(); // Save & Show
|
11760 |
+
$.effects.createWrapper(el).css({overflow:'hidden'}); // Create Wrapper
|
11761 |
+
var ref = (direction == 'up' || direction == 'down') ? 'top' : 'left';
|
11762 |
+
var motion = (direction == 'up' || direction == 'left') ? 'pos' : 'neg';
|
11763 |
+
var distance = o.options.distance || (ref == 'top' ? el.outerHeight({margin:true}) : el.outerWidth({margin:true}));
|
11764 |
+
if (mode == 'show') el.css(ref, motion == 'pos' ? (isNaN(distance) ? "-" + distance : -distance) : distance); // Shift
|
11765 |
+
|
11766 |
+
// Animation
|
11767 |
+
var animation = {};
|
11768 |
+
animation[ref] = (mode == 'show' ? (motion == 'pos' ? '+=' : '-=') : (motion == 'pos' ? '-=' : '+=')) + distance;
|
11769 |
+
|
11770 |
+
// Animate
|
11771 |
+
el.animate(animation, { queue: false, duration: o.duration, easing: o.options.easing, complete: function() {
|
11772 |
+
if(mode == 'hide') el.hide(); // Hide
|
11773 |
+
$.effects.restore(el, props); $.effects.removeWrapper(el); // Restore
|
11774 |
+
if(o.callback) o.callback.apply(this, arguments); // Callback
|
11775 |
+
el.dequeue();
|
11776 |
+
}});
|
11777 |
+
|
11778 |
+
});
|
11779 |
+
|
11780 |
+
};
|
11781 |
+
|
11782 |
+
})(jQuery);
|
11783 |
+
/*
|
11784 |
+
* jQuery UI Effects Transfer 1.8.17
|
11785 |
+
*
|
11786 |
+
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
|
11787 |
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
11788 |
+
* http://jquery.org/license
|
11789 |
+
*
|
11790 |
+
* http://docs.jquery.com/UI/Effects/Transfer
|
11791 |
+
*
|
11792 |
+
* Depends:
|
11793 |
+
* jquery.effects.core.js
|
11794 |
+
*/
|
11795 |
+
(function( $, undefined ) {
|
11796 |
+
|
11797 |
+
$.effects.transfer = function(o) {
|
11798 |
+
return this.queue(function() {
|
11799 |
+
var elem = $(this),
|
11800 |
+
target = $(o.options.to),
|
11801 |
+
endPosition = target.offset(),
|
11802 |
+
animation = {
|
11803 |
+
top: endPosition.top,
|
11804 |
+
left: endPosition.left,
|
11805 |
+
height: target.innerHeight(),
|
11806 |
+
width: target.innerWidth()
|
11807 |
+
},
|
11808 |
+
startPosition = elem.offset(),
|
11809 |
+
transfer = $('<div class="ui-effects-transfer"></div>')
|
11810 |
+
.appendTo(document.body)
|
11811 |
+
.addClass(o.options.className)
|
11812 |
+
.css({
|
11813 |
+
top: startPosition.top,
|
11814 |
+
left: startPosition.left,
|
11815 |
+
height: elem.innerHeight(),
|
11816 |
+
width: elem.innerWidth(),
|
11817 |
+
position: 'absolute'
|
11818 |
+
})
|
11819 |
+
.animate(animation, o.duration, o.options.easing, function() {
|
11820 |
+
transfer.remove();
|
11821 |
+
(o.callback && o.callback.apply(elem[0], arguments));
|
11822 |
+
elem.dequeue();
|
11823 |
+
});
|
11824 |
+
});
|
11825 |
+
};
|
11826 |
+
|
11827 |
+
})(jQuery);
|
js/lookbook/jquery.annotate.js
ADDED
@@ -0,0 +1,536 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/// <reference path="jquery-1.2.6-vsdoc.js" />
|
2 |
+
(function($) {
|
3 |
+
|
4 |
+
$.fn.annotateImage = function(options) {
|
5 |
+
/// <summary>
|
6 |
+
/// Creates annotations on the given image.
|
7 |
+
/// Images are loaded from the "getUrl" propety passed into the options.
|
8 |
+
/// </summary>
|
9 |
+
var opts = $.extend({}, $.fn.annotateImage.defaults, options);
|
10 |
+
var image = this;
|
11 |
+
|
12 |
+
this.image = this;
|
13 |
+
this.mode = 'view';
|
14 |
+
|
15 |
+
// Assign defaults
|
16 |
+
this.input_field_id = opts.input_field_id;
|
17 |
+
this.getUrl = opts.getUrl;
|
18 |
+
this.saveUrl = opts.saveUrl;
|
19 |
+
this.deleteUrl = opts.deleteUrl;
|
20 |
+
this.editable = opts.editable;
|
21 |
+
this.useAjax = opts.useAjax;
|
22 |
+
this.notes = opts.notes;
|
23 |
+
|
24 |
+
// Add the canvas
|
25 |
+
this.canvas = $('<div class="image-annotate-canvas"><div class="image-annotate-view"></div><div class="image-annotate-edit"><div class="image-annotate-edit-area"></div></div></div>');
|
26 |
+
this.canvas.children('.image-annotate-edit').hide();
|
27 |
+
this.canvas.children('.image-annotate-view').hide();
|
28 |
+
this.image.after(this.canvas);
|
29 |
+
|
30 |
+
// Give the canvas and the container their size and background
|
31 |
+
this.canvas.height(this.height());
|
32 |
+
this.canvas.width(this.width());
|
33 |
+
this.canvas.css('background-image', 'url("' + this.attr('src') + '")');
|
34 |
+
this.canvas.children('.image-annotate-view, .image-annotate-edit').height(this.height());
|
35 |
+
this.canvas.children('.image-annotate-view, .image-annotate-edit').width(this.width());
|
36 |
+
|
37 |
+
// Add the behavior: hide/show the notes when hovering the picture
|
38 |
+
this.canvas.hover(function() {
|
39 |
+
if ($(this).children('.image-annotate-edit').css('display') == 'none') {
|
40 |
+
$(this).children('.image-annotate-view').show();
|
41 |
+
}
|
42 |
+
}, function() {
|
43 |
+
$(this).children('.image-annotate-view').hide();
|
44 |
+
});
|
45 |
+
|
46 |
+
this.canvas.children('.image-annotate-view').hover(function() {
|
47 |
+
$(this).show();
|
48 |
+
}, function() {
|
49 |
+
$(this).hide();
|
50 |
+
});
|
51 |
+
|
52 |
+
// load the notes
|
53 |
+
if (this.useAjax) {
|
54 |
+
$.fn.annotateImage.ajaxLoad(this);
|
55 |
+
} else {
|
56 |
+
$.fn.annotateImage.load(this);
|
57 |
+
}
|
58 |
+
|
59 |
+
// Add the "Add a note" button
|
60 |
+
if (this.editable) {
|
61 |
+
this.button = $('<button class="image-annotate-add" id="image-annotate-add" onclick="javascript: return false;"><span>Add Hotspot</span></button>');
|
62 |
+
this.button.click(function() {
|
63 |
+
if (image.notes.length==3) {
|
64 |
+
alert('Only up to 3 hotspots could be added in Free Lookbook extension.');
|
65 |
+
return false;
|
66 |
+
}
|
67 |
+
$.fn.annotateImage.add(image);
|
68 |
+
});
|
69 |
+
this.canvas.after(this.button);
|
70 |
+
}
|
71 |
+
|
72 |
+
// Hide the original
|
73 |
+
this.hide();
|
74 |
+
|
75 |
+
return this;
|
76 |
+
};
|
77 |
+
|
78 |
+
/**
|
79 |
+
* Plugin Defaults
|
80 |
+
**/
|
81 |
+
$.fn.annotateImage.defaults = {
|
82 |
+
getUrl: 'your-get.rails',
|
83 |
+
saveUrl: 'your-save.rails',
|
84 |
+
deleteUrl: 'your-delete.rails',
|
85 |
+
editable: true,
|
86 |
+
useAjax: true,
|
87 |
+
notes: new Array()
|
88 |
+
};
|
89 |
+
|
90 |
+
$.fn.annotateImage.clear = function(image) {
|
91 |
+
/// <summary>
|
92 |
+
/// Clears all existing annotations from the image.
|
93 |
+
/// </summary>
|
94 |
+
for (var i = 0; i < image.notes.length; i++) {
|
95 |
+
image.notes[image.notes[i]].destroy();
|
96 |
+
}
|
97 |
+
image.notes = new Array();
|
98 |
+
};
|
99 |
+
|
100 |
+
$.fn.annotateImage.ajaxLoad = function(image) {
|
101 |
+
/// <summary>
|
102 |
+
/// Loads the annotations from the "getUrl" property passed in on the
|
103 |
+
/// options object.
|
104 |
+
/// </summary>
|
105 |
+
$.getJSON(image.getUrl + '?ticks=' + $.fn.annotateImage.getTicks(), function(data) {
|
106 |
+
image.notes = data;
|
107 |
+
$.fn.annotateImage.load(image);
|
108 |
+
});
|
109 |
+
};
|
110 |
+
|
111 |
+
$.fn.annotateImage.load = function(image) {
|
112 |
+
/// <summary>
|
113 |
+
/// Loads the annotations from the notes property passed in on the
|
114 |
+
/// options object.
|
115 |
+
/// </summary>
|
116 |
+
for (var i = 0; i < image.notes.length; i++) {
|
117 |
+
image.notes[image.notes[i]] = new $.fn.annotateView(image, image.notes[i]);
|
118 |
+
}
|
119 |
+
};
|
120 |
+
|
121 |
+
$.fn.annotateImage.getTicks = function() {
|
122 |
+
/// <summary>
|
123 |
+
/// Gets a count og the ticks for the current date.
|
124 |
+
/// This is used to ensure that URLs are always unique and not cached by the browser.
|
125 |
+
/// </summary>
|
126 |
+
var now = new Date();
|
127 |
+
return now.getTime();
|
128 |
+
};
|
129 |
+
|
130 |
+
$.fn.annotateImage.add = function(image) {
|
131 |
+
/// <summary>
|
132 |
+
/// Adds a note to the image.
|
133 |
+
/// </summary>
|
134 |
+
if (image.mode == 'view') {
|
135 |
+
image.mode = 'edit';
|
136 |
+
|
137 |
+
// Create/prepare the editable note elements
|
138 |
+
var editable = new $.fn.annotateEdit(image);
|
139 |
+
|
140 |
+
$.fn.annotateImage.createSaveButton(editable, image);
|
141 |
+
$.fn.annotateImage.createCancelButton(editable, image);
|
142 |
+
$("#image-annotate-edit-ok").css('float', 'right').css('margin-right', '25px');
|
143 |
+
$(".image-annotate-edit-close").css('margin-left', '25px');
|
144 |
+
}
|
145 |
+
|
146 |
+
};
|
147 |
+
|
148 |
+
$.fn.annotateImage.createSaveButton = function(editable, image, note) {
|
149 |
+
/// <summary>
|
150 |
+
/// Creates a Save button on the editable note.
|
151 |
+
/// </summary>
|
152 |
+
var ok = $('<button class="image-annotate-edit-ok" id="image-annotate-edit-ok" onclick="javascript: return false;"><span>OK</span></button>');
|
153 |
+
|
154 |
+
ok.click(function() {
|
155 |
+
var form = $('#image-annotate-edit-form form');
|
156 |
+
var text = $('#image-annotate-text').val();
|
157 |
+
|
158 |
+
$.fn.annotateImage.appendPosition(form, editable)
|
159 |
+
image.mode = 'view';
|
160 |
+
|
161 |
+
// Save via AJAX
|
162 |
+
if (image.useAjax) {
|
163 |
+
$.ajax({
|
164 |
+
url: image.saveUrl,
|
165 |
+
data: form.serialize(),
|
166 |
+
error: function(e) { alert("An error occured saving that note.") },
|
167 |
+
success: function(data) {
|
168 |
+
if (data.annotation_id != undefined) {
|
169 |
+
editable.note.id = data.annotation_id;
|
170 |
+
}
|
171 |
+
},
|
172 |
+
dataType: "json"
|
173 |
+
});
|
174 |
+
}
|
175 |
+
|
176 |
+
var test_area = Object();
|
177 |
+
test_area.id = editable.note.id;
|
178 |
+
test_area.height = editable.area.height();
|
179 |
+
test_area.width = editable.area.width();
|
180 |
+
test_area.left = editable.area.position().left;
|
181 |
+
test_area.top = editable.area.position().top;
|
182 |
+
|
183 |
+
if (!CheckPosition(test_area,image.notes)) {
|
184 |
+
alert('Areas should not overlap in Free Lookbook extension.');
|
185 |
+
return false;
|
186 |
+
}
|
187 |
+
|
188 |
+
if ($.trim(text)=='') {
|
189 |
+
alert('Please, enter product SKU');
|
190 |
+
return false;
|
191 |
+
}
|
192 |
+
|
193 |
+
var response = checkSKU();
|
194 |
+
if (response!=1) {
|
195 |
+
alert('The product with SKU="'+text+'" ' + response);
|
196 |
+
return false;
|
197 |
+
}
|
198 |
+
// Add to canvas
|
199 |
+
if (note) {
|
200 |
+
note.resetPosition(editable, text);
|
201 |
+
} else {
|
202 |
+
editable.note.editable = true;
|
203 |
+
note = new $.fn.annotateView(image, editable.note);
|
204 |
+
note.resetPosition(editable, text);
|
205 |
+
image.notes.push(editable.note);
|
206 |
+
}
|
207 |
+
|
208 |
+
$('#'+image.input_field_id).val(JSON.stringify(image.notes));
|
209 |
+
editable.destroy();
|
210 |
+
});
|
211 |
+
editable.form.append(ok);
|
212 |
+
};
|
213 |
+
|
214 |
+
$.fn.annotateImage.createCancelButton = function(editable, image) {
|
215 |
+
/// <summary>
|
216 |
+
/// Creates a Cancel button on the editable note.
|
217 |
+
/// </summary>
|
218 |
+
var cancel = $('<button class="image-annotate-edit-close" onclick="javascript: return false;"><span>Cancel</span></button>');
|
219 |
+
cancel.click(function() {
|
220 |
+
editable.destroy();
|
221 |
+
image.mode = 'view';
|
222 |
+
});
|
223 |
+
editable.form.append(cancel);
|
224 |
+
};
|
225 |
+
|
226 |
+
$.fn.annotateImage.saveAsHtml = function(image, target) {
|
227 |
+
var element = $(target);
|
228 |
+
var html = "";
|
229 |
+
for (var i = 0; i < image.notes.length; i++) {
|
230 |
+
html += $.fn.annotateImage.createHiddenField("text_" + i, image.notes[i].text);
|
231 |
+
html += $.fn.annotateImage.createHiddenField("top_" + i, image.notes[i].top);
|
232 |
+
html += $.fn.annotateImage.createHiddenField("left_" + i, image.notes[i].left);
|
233 |
+
html += $.fn.annotateImage.createHiddenField("height_" + i, image.notes[i].height);
|
234 |
+
html += $.fn.annotateImage.createHiddenField("width_" + i, image.notes[i].width);
|
235 |
+
}
|
236 |
+
element.html(html);
|
237 |
+
};
|
238 |
+
|
239 |
+
$.fn.annotateImage.createHiddenField = function(name, value) {
|
240 |
+
return '<input type="hidden" name="' + name + '" value="' + value + '" /><br />';
|
241 |
+
};
|
242 |
+
|
243 |
+
$.fn.annotateEdit = function(image, note) {
|
244 |
+
/// <summary>
|
245 |
+
/// Defines an editable annotation area.
|
246 |
+
/// </summary>
|
247 |
+
this.image = image;
|
248 |
+
|
249 |
+
if (note) {
|
250 |
+
this.note = note;
|
251 |
+
} else {
|
252 |
+
var newNote = new Object();
|
253 |
+
newNote.id = ""+new Date().getTime();
|
254 |
+
newNote.top = 30;
|
255 |
+
newNote.left = 30;
|
256 |
+
newNote.width = 30;
|
257 |
+
newNote.height = 30;
|
258 |
+
newNote.text = "";
|
259 |
+
this.note = newNote;
|
260 |
+
}
|
261 |
+
|
262 |
+
// Set area
|
263 |
+
var area = image.canvas.children('.image-annotate-edit').children('.image-annotate-edit-area');
|
264 |
+
this.area = area;
|
265 |
+
this.area.css('height', this.note.height + 'px');
|
266 |
+
this.area.css('width', this.note.width + 'px');
|
267 |
+
this.area.css('left', this.note.left + 'px');
|
268 |
+
this.area.css('top', this.note.top + 'px');
|
269 |
+
|
270 |
+
// Show the edition canvas and hide the view canvas
|
271 |
+
image.canvas.children('.image-annotate-view').hide();
|
272 |
+
image.canvas.children('.image-annotate-edit').show();
|
273 |
+
|
274 |
+
// Add the note (which we'll load with the form afterwards)
|
275 |
+
var form = $('<div id="image-annotate-edit-form"><form id="annotate-edit-form"><label for="image-annotate-text">Product SKU: </label> <input id="image-annotate-text" value="'+this.note.text+'" name="text" type="text"/></form></div>');
|
276 |
+
this.form = form;
|
277 |
+
|
278 |
+
$('body').append(this.form);
|
279 |
+
this.form.css('left', this.area.offset().left + 'px');
|
280 |
+
this.form.css('top', (parseInt(this.area.offset().top) + parseInt(this.area.height()) + 7) + 'px');
|
281 |
+
|
282 |
+
// Set the area as a draggable/resizable element contained in the image canvas.
|
283 |
+
// Would be better to use the containment option for resizable but buggy
|
284 |
+
area.resizable({
|
285 |
+
handles: 'all',
|
286 |
+
|
287 |
+
stop: function(e, ui) {
|
288 |
+
form.css('left', area.offset().left + 'px');
|
289 |
+
form.css('top', (parseInt(area.offset().top) + parseInt(area.height()) + 2) + 'px');
|
290 |
+
}
|
291 |
+
})
|
292 |
+
.draggable({
|
293 |
+
containment: image.canvas,
|
294 |
+
drag: function(e, ui) {
|
295 |
+
form.css('left', area.offset().left + 'px');
|
296 |
+
form.css('top', (parseInt(area.offset().top) + parseInt(area.height()) + 2) + 'px');
|
297 |
+
},
|
298 |
+
stop: function(e, ui) {
|
299 |
+
form.css('left', area.offset().left + 'px');
|
300 |
+
form.css('top', (parseInt(area.offset().top) + parseInt(area.height()) + 2) + 'px');
|
301 |
+
}
|
302 |
+
});
|
303 |
+
|
304 |
+
return this;
|
305 |
+
};
|
306 |
+
|
307 |
+
$.fn.annotateEdit.prototype.destroy = function() {
|
308 |
+
/// <summary>
|
309 |
+
/// Destroys an editable annotation area.
|
310 |
+
/// </summary>
|
311 |
+
this.image.canvas.children('.image-annotate-edit').hide();
|
312 |
+
this.area.resizable('destroy');
|
313 |
+
this.area.draggable('destroy');
|
314 |
+
this.area.css('height', '');
|
315 |
+
this.area.css('width', '');
|
316 |
+
this.area.css('left', '');
|
317 |
+
this.area.css('top', '');
|
318 |
+
this.form.remove();
|
319 |
+
ShowHideHotspotsMsg();
|
320 |
+
}
|
321 |
+
|
322 |
+
$.fn.annotateView = function(image, note) {
|
323 |
+
/// <summary>
|
324 |
+
/// Defines a annotation area.
|
325 |
+
/// </summary>
|
326 |
+
this.image = image;
|
327 |
+
|
328 |
+
this.note = note;
|
329 |
+
|
330 |
+
this.editable = (note.editable && image.editable);
|
331 |
+
|
332 |
+
// Add the area
|
333 |
+
this.area = $('<div class="image-annotate-area' + (this.editable ? ' image-annotate-area-editable' : '') + '"><div></div></div>');
|
334 |
+
image.canvas.children('.image-annotate-view').prepend(this.area);
|
335 |
+
|
336 |
+
// Add the note
|
337 |
+
this.form = $('<div class="image-annotate-note">' + note.text + '</div>');
|
338 |
+
this.form.hide();
|
339 |
+
image.canvas.children('.image-annotate-view').append(this.form);
|
340 |
+
this.form.children('span.actions').hide();
|
341 |
+
|
342 |
+
// Set the position and size of the note
|
343 |
+
this.setPosition();
|
344 |
+
|
345 |
+
// Add the behavior: hide/display the note when hovering the area
|
346 |
+
var annotation = this;
|
347 |
+
this.area.hover(function() {
|
348 |
+
annotation.show();
|
349 |
+
}, function() {
|
350 |
+
annotation.hide();
|
351 |
+
});
|
352 |
+
|
353 |
+
// Edit a note feature
|
354 |
+
if (this.editable) {
|
355 |
+
var form = this;
|
356 |
+
this.area.click(function() {
|
357 |
+
form.edit();
|
358 |
+
});
|
359 |
+
}
|
360 |
+
};
|
361 |
+
|
362 |
+
$.fn.annotateView.prototype.setPosition = function() {
|
363 |
+
/// <summary>
|
364 |
+
/// Sets the position of an annotation.
|
365 |
+
/// </summary>
|
366 |
+
this.area.children('div').height((parseInt(this.note.height) - 2) + 'px');
|
367 |
+
this.area.children('div').width((parseInt(this.note.width) - 2) + 'px');
|
368 |
+
this.area.css('left', (this.note.left) + 'px');
|
369 |
+
this.area.css('top', (this.note.top) + 'px');
|
370 |
+
this.form.css('left', (this.note.left) + 'px');
|
371 |
+
this.form.css('top', (parseInt(this.note.top) + parseInt(this.note.height) + 7) + 'px');
|
372 |
+
};
|
373 |
+
|
374 |
+
$.fn.annotateView.prototype.show = function() {
|
375 |
+
/// <summary>
|
376 |
+
/// Highlights the annotation
|
377 |
+
/// </summary>
|
378 |
+
this.form.fadeIn(250);
|
379 |
+
if (!this.editable) {
|
380 |
+
this.area.addClass('image-annotate-area-hover');
|
381 |
+
} else {
|
382 |
+
this.area.addClass('image-annotate-area-editable-hover');
|
383 |
+
}
|
384 |
+
};
|
385 |
+
|
386 |
+
$.fn.annotateView.prototype.hide = function() {
|
387 |
+
/// <summary>
|
388 |
+
/// Removes the highlight from the annotation.
|
389 |
+
/// </summary>
|
390 |
+
this.form.fadeOut(250);
|
391 |
+
this.area.removeClass('image-annotate-area-hover');
|
392 |
+
this.area.removeClass('image-annotate-area-editable-hover');
|
393 |
+
};
|
394 |
+
|
395 |
+
$.fn.annotateView.prototype.destroy = function() {
|
396 |
+
/// <summary>
|
397 |
+
/// Destroys the annotation.
|
398 |
+
/// </summary>
|
399 |
+
this.area.remove();
|
400 |
+
this.form.remove();
|
401 |
+
}
|
402 |
+
|
403 |
+
$.fn.annotateView.prototype.edit = function() {
|
404 |
+
/// <summary>
|
405 |
+
/// Edits the annotation.
|
406 |
+
/// </summary>
|
407 |
+
if (this.image.mode == 'view') {
|
408 |
+
this.image.mode = 'edit';
|
409 |
+
var annotation = this;
|
410 |
+
|
411 |
+
// Create/prepare the editable note elements
|
412 |
+
var editable = new $.fn.annotateEdit(this.image, this.note);
|
413 |
+
|
414 |
+
$.fn.annotateImage.createSaveButton(editable, this.image, annotation);
|
415 |
+
|
416 |
+
// Add the delete button
|
417 |
+
var del = $('<button class="image-annotate-edit-delete" onclick="javascript: return false;"><span>Delete</span></button>');
|
418 |
+
del.click(function() {
|
419 |
+
var form = $('#image-annotate-edit-form form');
|
420 |
+
|
421 |
+
$.fn.annotateImage.appendPosition(form, editable)
|
422 |
+
|
423 |
+
if (annotation.image.useAjax) {
|
424 |
+
$.ajax({
|
425 |
+
url: annotation.image.deleteUrl,
|
426 |
+
data: form.serialize(),
|
427 |
+
error: function(e) { alert("An error occured deleting that note.") }
|
428 |
+
});
|
429 |
+
}
|
430 |
+
|
431 |
+
for (var i = 0; i < annotation.image.notes.length; i++) {
|
432 |
+
if (annotation.image.notes[i]==editable.note)
|
433 |
+
{
|
434 |
+
annotation.image.notes.splice(i,1);
|
435 |
+
}
|
436 |
+
}
|
437 |
+
|
438 |
+
$('#'+annotation.image.input_field_id).val(JSON.stringify(annotation.image.notes));
|
439 |
+
|
440 |
+
annotation.image.mode = 'view';
|
441 |
+
editable.destroy();
|
442 |
+
annotation.destroy();
|
443 |
+
|
444 |
+
});
|
445 |
+
editable.form.append(del);
|
446 |
+
|
447 |
+
$.fn.annotateImage.createCancelButton(editable, this.image);
|
448 |
+
}
|
449 |
+
};
|
450 |
+
|
451 |
+
$.fn.annotateImage.appendPosition = function(form, editable) {
|
452 |
+
/// <summary>
|
453 |
+
/// Appends the annotations coordinates to the given form that is posted to the server.
|
454 |
+
/// </summary>
|
455 |
+
var areaFields = $('<input type="hidden" value="' + editable.area.height() + '" name="height"/>' +
|
456 |
+
'<input type="hidden" value="' + editable.area.width() + '" name="width"/>' +
|
457 |
+
'<input type="hidden" value="' + editable.area.position().top + '" name="top"/>' +
|
458 |
+
'<input type="hidden" value="' + editable.area.position().left + '" name="left"/>' +
|
459 |
+
'<input type="hidden" value="' + editable.note.id + '" name="id"/>');
|
460 |
+
form.append(areaFields);
|
461 |
+
}
|
462 |
+
|
463 |
+
$.fn.annotateView.prototype.resetPosition = function(editable, text) {
|
464 |
+
/// <summary>
|
465 |
+
/// Sets the position of an annotation.
|
466 |
+
/// </summary>
|
467 |
+
this.form.html(text);
|
468 |
+
this.form.hide();
|
469 |
+
|
470 |
+
// Resize
|
471 |
+
this.area.children('div').height(editable.area.height() + 'px');
|
472 |
+
this.area.children('div').width((editable.area.width() - 2) + 'px');
|
473 |
+
this.area.css('left', (editable.area.position().left) + 'px');
|
474 |
+
this.area.css('top', (editable.area.position().top) + 'px');
|
475 |
+
this.form.css('left', (editable.area.position().left) + 'px');
|
476 |
+
this.form.css('top', (parseInt(editable.area.position().top) + parseInt(editable.area.height()) + 7) + 'px');
|
477 |
+
|
478 |
+
// Save new position to note
|
479 |
+
this.note.top = editable.area.position().top;
|
480 |
+
this.note.left = editable.area.position().left;
|
481 |
+
this.note.height = editable.area.height();
|
482 |
+
this.note.width = editable.area.width();
|
483 |
+
this.note.text = text;
|
484 |
+
this.note.id = editable.note.id;
|
485 |
+
this.editable = true;
|
486 |
+
};
|
487 |
+
|
488 |
+
intersects = function(X1, Y1, H1, L1, X2, Y2, H2, L2) {
|
489 |
+
X1 = parseInt(X1);
|
490 |
+
Y1 = parseInt(Y1);
|
491 |
+
H1 = parseInt(H1);
|
492 |
+
L1 = parseInt(L1);
|
493 |
+
X2 = parseInt(X2);
|
494 |
+
Y2 = parseInt(Y2);
|
495 |
+
H2 = parseInt(H2);
|
496 |
+
L2 = parseInt(L2);
|
497 |
+
a = X1 + L1 < X2;
|
498 |
+
b = X1 > X2 + L2;
|
499 |
+
c = Y1 + H1 < Y2;
|
500 |
+
d = Y1 > Y2 + H2;
|
501 |
+
if ((a || b || c || d)) {
|
502 |
+
return false;
|
503 |
+
}
|
504 |
+
else
|
505 |
+
{
|
506 |
+
return true;
|
507 |
+
}
|
508 |
+
};
|
509 |
+
|
510 |
+
ShowHideHotspotsMsg = function() {
|
511 |
+
view_is_visible = $(".image-annotate-canvas").find(".image-annotate-view").is(":visible");
|
512 |
+
edit_is_visible = $(".image-annotate-canvas").find(".image-annotate-edit").is(":visible");
|
513 |
+
if (view_is_visible || edit_is_visible) {
|
514 |
+
$(".hotspots-msg").hide();
|
515 |
+
}
|
516 |
+
else
|
517 |
+
{
|
518 |
+
$(".hotspots-msg").show();
|
519 |
+
}
|
520 |
+
}
|
521 |
+
|
522 |
+
CheckPosition = function(note, notes) {
|
523 |
+
i=0;
|
524 |
+
res = true;
|
525 |
+
notes.each(function() {
|
526 |
+
if (note.id!=notes[i].id) {
|
527 |
+
if (intersects(note.left, note.top, note.height, note.width, notes[i].left, notes[i].top, notes[i].height, notes[i].width)){
|
528 |
+
res = false;
|
529 |
+
}
|
530 |
+
}
|
531 |
+
i++;
|
532 |
+
});
|
533 |
+
return res;
|
534 |
+
};
|
535 |
+
|
536 |
+
})(jQuery);
|
js/lookbook/json2.min.js
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
var JSON;if(!JSON){JSON={}}(function(){'use strict';function f(n){return n<10?'0'+n:n}if(typeof Date.prototype.toJSON!=='function'){Date.prototype.toJSON=function(key){return isFinite(this.valueOf())?this.getUTCFullYear()+'-'+f(this.getUTCMonth()+1)+'-'+f(this.getUTCDate())+'T'+f(this.getUTCHours())+':'+f(this.getUTCMinutes())+':'+f(this.getUTCSeconds())+'Z':null};String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(key){return this.valueOf()}}var cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,escapable=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,gap,indent,meta={'\b':'\\b','\t':'\\t','\n':'\\n','\f':'\\f','\r':'\\r','"':'\\"','\\':'\\\\'},rep;function quote(string){escapable.lastIndex=0;return escapable.test(string)?'"'+string.replace(escapable,function(a){var c=meta[a];return typeof c==='string'?c:'\\u'+('0000'+a.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+string+'"'}function str(key,holder){var i,k,v,length,mind=gap,partial,value=holder[key];if(value&&typeof value==='object'&&typeof value.toJSON==='function'){value=value.toJSON(key)}if(typeof rep==='function'){value=rep.call(holder,key,value)}switch(typeof value){case'string':return quote(value);case'number':return isFinite(value)?String(value):'null';case'boolean':case'null':return String(value);case'object':if(!value){return'null'}gap+=indent;partial=[];if(Object.prototype.toString.apply(value)==='[object Array]'){length=value.length;for(i=0;i<length;i+=1){partial[i]=str(i,value)||'null'}v=partial.length===0?'[]':gap?'[\n'+gap+partial.join(',\n'+gap)+'\n'+mind+']':'['+partial.join(',')+']';gap=mind;return v}if(rep&&typeof rep==='object'){length=rep.length;for(i=0;i<length;i+=1){if(typeof rep[i]==='string'){k=rep[i];v=str(k,value);if(v){partial.push(quote(k)+(gap?': ':':')+v)}}}}else{for(k in value){if(Object.prototype.hasOwnProperty.call(value,k)){v=str(k,value);if(v){partial.push(quote(k)+(gap?': ':':')+v)}}}}v=partial.length===0?'{}':gap?'{\n'+gap+partial.join(',\n'+gap)+'\n'+mind+'}':'{'+partial.join(',')+'}';gap=mind;return v}}if(typeof JSON.stringify!=='function'){JSON.stringify=function(value,replacer,space){var i;gap='';indent='';if(typeof space==='number'){for(i=0;i<space;i+=1){indent+=' '}}else if(typeof space==='string'){indent=space}rep=replacer;if(replacer&&typeof replacer!=='function'&&(typeof replacer!=='object'||typeof replacer.length!=='number')){throw new Error('JSON.stringify')}return str('',{'':value})}}if(typeof JSON.parse!=='function'){JSON.parse=function(text,reviver){var j;function walk(holder,key){var k,v,value=holder[key];if(value&&typeof value==='object'){for(k in value){if(Object.prototype.hasOwnProperty.call(value,k)){v=walk(value,k);if(v!==undefined){value[k]=v}else{delete value[k]}}}}return reviver.call(holder,key,value)}text=String(text);cx.lastIndex=0;if(cx.test(text)){text=text.replace(cx,function(a){return'\\u'+('0000'+a.charCodeAt(0).toString(16)).slice(-4)})}if(/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,'@').replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,']').replace(/(?:^|:|,)(?:\s*\[)+/g,''))){j=eval('('+text+')');return typeof reviver==='function'?walk({'':j},''):j}throw new SyntaxError('JSON.parse')}}}());
|
js/lookbook/slides.min.jquery.js
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*
|
2 |
+
* Slides, A Slideshow Plugin for jQuery
|
3 |
+
* Intructions: http://slidesjs.com
|
4 |
+
* By: Nathan Searles, http://nathansearles.com
|
5 |
+
* Version: 1.1.9
|
6 |
+
* Updated: September 5th, 2011
|
7 |
+
*
|
8 |
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
9 |
+
* you may not use this file except in compliance with the License.
|
10 |
+
* You may obtain a copy of the License at
|
11 |
+
*
|
12 |
+
* http://www.apache.org/licenses/LICENSE-2.0
|
13 |
+
*
|
14 |
+
* Unless required by applicable law or agreed to in writing, software
|
15 |
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
16 |
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
17 |
+
* See the License for the specific language governing permissions and
|
18 |
+
* limitations under the License.
|
19 |
+
*/
|
20 |
+
(function(a){a.fn.slides=function(b){return b=a.extend({},a.fn.slides.option,b),this.each(function(){function w(g,h,i){if(!p&&o){p=!0,b.animationStart(n+1);switch(g){case"next":l=n,k=n+1,k=e===k?0:k,r=f*2,g=-f*2,n=k;break;case"prev":l=n,k=n-1,k=k===-1?e-1:k,r=0,g=0,n=k;break;case"pagination":k=parseInt(i,10),l=a("."+b.paginationClass+" li."+b.currentClass+" a",c).attr("href").match("[^#/]+$"),k>l?(r=f*2,g=-f*2):(r=0,g=0),n=k}h==="fade"?b.crossfade?d.children(":eq("+k+")",c).css({zIndex:10}).fadeIn(b.fadeSpeed,b.fadeEasing,function(){b.autoHeight?d.animate({height:d.children(":eq("+k+")",c).outerHeight()},b.autoHeightSpeed,function(){d.children(":eq("+l+")",c).css({display:"none",zIndex:0}),d.children(":eq("+k+")",c).css({zIndex:0}),b.animationComplete(k+1),p=!1}):(d.children(":eq("+l+")",c).css({display:"none",zIndex:0}),d.children(":eq("+k+")",c).css({zIndex:0}),b.animationComplete(k+1),p=!1)}):d.children(":eq("+l+")",c).fadeOut(b.fadeSpeed,b.fadeEasing,function(){b.autoHeight?d.animate({height:d.children(":eq("+k+")",c).outerHeight()},b.autoHeightSpeed,function(){d.children(":eq("+k+")",c).fadeIn(b.fadeSpeed,b.fadeEasing)}):d.children(":eq("+k+")",c).fadeIn(b.fadeSpeed,b.fadeEasing,function(){a.browser.msie&&a(this).get(0).style.removeAttribute("filter")}),b.animationComplete(k+1),p=!1}):(d.children(":eq("+k+")").css({left:r,display:"block"}),b.autoHeight?d.animate({left:g,height:d.children(":eq("+k+")").outerHeight()},b.slideSpeed,b.slideEasing,function(){d.css({left:-f}),d.children(":eq("+k+")").css({left:f,zIndex:5}),d.children(":eq("+l+")").css({left:f,display:"none",zIndex:0}),b.animationComplete(k+1),p=!1}):d.animate({left:g},b.slideSpeed,b.slideEasing,function(){d.css({left:-f}),d.children(":eq("+k+")").css({left:f,zIndex:5}),d.children(":eq("+l+")").css({left:f,display:"none",zIndex:0}),b.animationComplete(k+1),p=!1})),b.pagination&&(a("."+b.paginationClass+" li."+b.currentClass,c).removeClass(b.currentClass),a("."+b.paginationClass+" li:eq("+k+")",c).addClass(b.currentClass))}}function x(){clearInterval(c.data("interval"))}function y(){b.pause?(clearTimeout(c.data("pause")),clearInterval(c.data("interval")),u=setTimeout(function(){clearTimeout(c.data("pause")),v=setInterval(function(){w("next",i)},b.play),c.data("interval",v)},b.pause),c.data("pause",u)):x()}a("."+b.container,a(this)).children().wrapAll('<div class="slides_control"/>');var c=a(this),d=a(".slides_control",c),e=d.children().size(),f=d.children().outerWidth(),g=d.children().outerHeight(),h=b.start-1,i=b.effect.indexOf(",")<0?b.effect:b.effect.replace(" ","").split(",")[0],j=b.effect.indexOf(",")<0?i:b.effect.replace(" ","").split(",")[1],k=0,l=0,m=0,n=0,o,p,q,r,s,t,u,v;if(e<2)return a("."+b.container,a(this)).fadeIn(b.fadeSpeed,b.fadeEasing,function(){o=!0,b.slidesLoaded()}),a("."+b.next+", ."+b.prev).fadeOut(0),!1;if(e<2)return;h<0&&(h=0),h>e&&(h=e-1),b.start&&(n=h),b.randomize&&d.randomize(),a("."+b.container,c).css({overflow:"hidden",position:"relative"}),d.children().css({position:"absolute",top:0,left:d.children().outerWidth(),zIndex:0,display:"none"}),d.css({position:"relative",width:f*3,height:g,left:-f}),a("."+b.container,c).css({display:"block"}),b.autoHeight&&(d.children().css({height:"auto"}),d.animate({height:d.children(":eq("+h+")").outerHeight()},b.autoHeightSpeed));if(b.preload&&d.find("img:eq("+h+")").length){a("."+b.container,c).css({background:"url("+b.preloadImage+") no-repeat 50% 50%"});var z=d.find("img:eq("+h+")").attr("src")+"?"+(new Date).getTime();a("img",c).parent().attr("class")!="slides_control"?t=d.children(":eq(0)")[0].tagName.toLowerCase():t=d.find("img:eq("+h+")"),d.find("img:eq("+h+")").attr("src",z).load(function(){d.find(t+":eq("+h+")").fadeIn(b.fadeSpeed,b.fadeEasing,function(){a(this).css({zIndex:5}),a("."+b.container,c).css({background:""}),o=!0,b.slidesLoaded()})})}else d.children(":eq("+h+")").fadeIn(b.fadeSpeed,b.fadeEasing,function(){o=!0,b.slidesLoaded()});b.bigTarget&&(d.children().css({cursor:"pointer"}),d.children().click(function(){return w("next",i),!1})),b.hoverPause&&b.play&&(d.bind("mouseover",function(){x()}),d.bind("mouseleave",function(){y()})),b.generateNextPrev&&(a("."+b.container,c).after('<a href="#" class="'+b.prev+'">Prev</a>'),a("."+b.prev,c).after('<a href="#" class="'+b.next+'">Next</a>')),a("."+b.next,c).click(function(a){a.preventDefault(),b.play&&y(),w("next",i)}),a("."+b.prev,c).click(function(a){a.preventDefault(),b.play&&y(),w("prev",i)}),b.generatePagination?(b.prependPagination?c.prepend("<ul class="+b.paginationClass+"></ul>"):c.append("<ul class="+b.paginationClass+"></ul>"),d.children().each(function(){a("."+b.paginationClass,c).append('<li><a href="#'+m+'">'+(m+1)+"</a></li>"),m++})):a("."+b.paginationClass+" li a",c).each(function(){a(this).attr("href","#"+m),m++}),a("."+b.paginationClass+" li:eq("+h+")",c).addClass(b.currentClass),a("."+b.paginationClass+" li a",c).click(function(){return b.play&&y(),q=a(this).attr("href").match("[^#/]+$"),n!=q&&w("pagination",j,q),!1}),a("a.link",c).click(function(){return b.play&&y(),q=a(this).attr("href").match("[^#/]+$")-1,n!=q&&w("pagination",j,q),!1}),b.play&&(v=setInterval(function(){w("next",i)},b.play),c.data("interval",v))})},a.fn.slides.option={preload:!1,preloadImage:"/img/loading.gif",container:"slides_container",generateNextPrev:!1,next:"next",prev:"prev",pagination:!0,generatePagination:!0,prependPagination:!1,paginationClass:"pagination",currentClass:"current",fadeSpeed:350,fadeEasing:"",slideSpeed:350,slideEasing:"",start:1,effect:"slide",crossfade:!1,randomize:!1,play:0,pause:0,hoverPause:!1,autoHeight:!1,autoHeightSpeed:350,bigTarget:!1,animationStart:function(){},animationComplete:function(){},slidesLoaded:function(){}},a.fn.randomize=function(b){function c(){return Math.round(Math.random())-.5}return a(this).each(function(){var d=a(this),e=d.children(),f=e.length;if(f>1){e.hide();var g=[];for(i=0;i<f;i++)g[g.length]=i;g=g.sort(c),a.each(g,function(a,c){var f=e.eq(c),g=f.clone(!0);g.show().appendTo(d),b!==undefined&&b(f,g),f.remove()})}})}})(jQuery)
|
media/lookbook/icons/default/hotspot-icon.png
ADDED
Binary file
|
package.xml
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>Altima_lookbook_free</name>
|
4 |
+
<version>0.1.0</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license uri="http://opensource.org/licenses/osl-3.0.php">Open Software License (OSL 3.0)</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>Create interactive gallery - photos of your goods in environment with hotspots linked to product pages</summary>
|
10 |
+
<description>Altima Lookbook Free lets you create interactive gallery and show the best of your products to customers.</description>
|
11 |
+
<notes>Altima Lookbook Free extension provides online merchants with an ability to show their product in nice and compelling way, close to the way it is shown in print catalogues, but with interactive link to product pages. For example you can show your dresses and accessories on sexy models and furniture in well designed living room. Each element of lookbook image can be tagged as a hotspot and linked to specific product page of your Magento online store.</notes>
|
12 |
+
<authors><author><name>Alexander</name><user>auto-converted</user><email>alex@altima.net.au</email></author></authors>
|
13 |
+
<date>2012-05-06</date>
|
14 |
+
<time>13:45:40</time>
|
15 |
+
<contents><target name="mage"><dir name="app"><dir name="etc"><dir name="modules"><file name="Altima_Lookbook.xml" hash="a34f1cc1dbe2a184664d3877116f2977"/></dir></dir><dir name="code"><dir name="local"><dir name="Altima"><dir name="Lookbook"><dir name="Block"><dir name="Adminhtml"><dir name="Lookbook"><dir name="Edit"><dir name="Form"><dir name="Element"><file name="Hotspots.php" hash="f52fd981377f510e457acd43faa5e0d0"/><file name="Lookbookimage.php" hash="93e7d862424440c4c72682a0613e30dc"/></dir></dir><dir name="Tab"><file name="Form.php" hash="3bc18cf0c96a34c2c3db598e622fdbc7"/></dir><file name="Form.php" hash="c4f32e1a2013d2bd436a90b0c3c77a5f"/><file name="Tabs.php" hash="24d5820584ce75878c9a950f94756ffc"/></dir><file name="Edit.php" hash="f0a347f0e76490d68d67a47875fdd89b"/><file name="Grid.php" hash="31a2de1234c16aa8b3734945cfec19b9"/></dir><dir name="Template"><dir name="Grid"><dir name="Renderer"><file name="Image.php" hash="b5cf2e36bc23d0f25a8a1453062949f3"/></dir></dir></dir><file name="Lookbook.php" hash="d96830c83f91ee3a78492cc1edd6bff5"/></dir><file name="Lookbook.php" hash="dfe1c58667f1f8bbd1a0860d1ed12429"/></dir><dir name="Helper"><file name="Data.php" hash="a6cc48fc2f68b8a5b4c618afbd222c30"/></dir><dir name="Model"><dir name="Layout"><dir name="Generate"><file name="Observer.php" hash="e5bf7bf51cfcf47b737969564f091f4a"/></dir></dir><dir name="Mysql4"><dir name="Lookbook"><file name="Collection.php" hash="41afe8655609410962e6b2068fc974d4"/></dir><file name="Lookbook.php" hash="2026fe0e3150b5a46c85df031bcc9c88"/></dir><file name="Fileuploader.php" hash="f987f0b2170a16ab9a1fa2f2f99ce2a6"/><file name="Lookbook.php" hash="3eb927a4ecd93ac299588ad7129c5ff4"/><file name="Status.php" hash="8ec99dd61315524a21dbaeb5672530a2"/><file name="Uploadedfileform.php" hash="88fa3bbf7e11ca6628011b2ce16e43a3"/><file name="Uploadedfilexhr.php" hash="e459a403415cc4a70b74fd30db1359d9"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="LookbookController.php" hash="99d7e3001389c2592abbe20138fa0335"/></dir><file name="IndexController.php" hash="3db667312e80e4ada1c5dff6297399d4"/></dir><dir name="etc"><file name="config.xml" hash="96fa35026241a62dacb36eff885d0324"/><file name="system.xml" hash="bbe0f04f4538c66cb74362e254a4f63a"/></dir><dir name="sql"><dir name="lookbook_setup"><file name="mysql4-install-0.1.0.php" hash="4db9cbe98f529f6c02686550cbdf1520"/></dir></dir></dir></dir></dir></dir><dir name="design"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="lookbook.xml" hash="0f68d91f719e660ada78d941343e4e49"/></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="lookbook.xml" hash="32663855234d63ec344a64ad4a50f30a"/></dir><dir name="template"><dir name="lookbook"><file name="lookbook.phtml" hash="0206af05aa51d3c2af3a11188038e33c"/></dir></dir></dir></dir></dir></dir></dir><dir name="js"><dir name="jquery"><file name="jquery-1.7.min.js" hash="25721ced154b3a99e818431446d7506d"/><file name="jquery.noconflict.js" hash="a9fdc7984aee946b2e9792844362c77c"/></dir><dir name="lookbook"><file name="fileuploader.js" hash="64cb3de32e4a6cc1710dd08bb0da582a"/><file name="jquery-ui-1.8.17.js" hash="3eff185cff022b9b33a12306b5718cd4"/><file name="jquery.annotate.js" hash="f9534530d6156b4b8471cfe5c259a594"/><file name="json2.min.js" hash="041eedd4d7676d33b6ccd2056734e4b3"/><file name="slides.min.jquery.js" hash="e80e9e252b5f66e4f71c2c609d8b34fd"/></dir></dir><dir name="media"><dir name="lookbook"><dir name="icons"><dir name="default"><file name="hotspot-icon.png" hash="fa27397b9eb8b54df13e62a5a1b6c8b8"/></dir></dir></dir></dir><dir name="skin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="lookbook"><dir name="css"><file name="annotation.css" hash="a47fa611c7abbe1913145b120b09a260"/><file name="fileuploader.css" hash="8678f7cde252ff89caead1d92511da5f"/></dir><dir name="images"><file name="btn_bg.gif" hash="37c51a4d48a92da9648dcd3ca011039f"/><file name="btn_gray_bg.gif" hash="8be512788b8044fe31aa8d00cc16ba7b"/><file name="btn_over_bg.gif" hash="f91641168454c03d1fa72731ec97a2b3"/><file name="cancel_btn_icon.png" hash="343e0534818e33d4e3886aa4694602d7"/><file name="cross.png" hash="42492684e24356a4081134894eabeb9e"/><file name="delete_btn_icon.png" hash="04485bbcca5d645427061365185b4a76"/><file name="icon_btn_add.png" hash="3a99c7c227e5e6feb656e1649a8264ab"/><file name="link_external.png" hash="7cc8feaca790904979edda0ba930d6cd"/><file name="loading.gif" hash="2da0807814ad64841cd597c4e8a653d1"/><file name="ok_btn_icon.png" hash="bf2b8c5bb1c784e8d907f5d6345f0e5e"/><file name="upload_btn_icon.png" hash="1ede630273613ffe452dede682e5e028"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="lookbook"><dir name="css"><file name="hotspots.css" hash="696151a84a98e6fb9004fa04e1782273"/></dir><dir name="images"><file name="adv-bg.png" hash="06af9432757479345a304c8d8b8b3939"/><file name="arrow-next.png" hash="15d6fe778c4df2494a7af4e098aad4ff"/><file name="arrow-prev.png" hash="bc273e26e577babc8044b0a8a86358d0"/><file name="background.png" hash="96519dab3e5a2a09075632cca4a98141"/><file name="caption-bg.png" hash="b09e2b8f7382607b51b0392ba46f5963"/><file name="info-bg.png" hash="6b2e3b329380a9bf3c298e3a6c34a7fa"/><file name="loading.gif" hash="58c35cf5e9fcbe3914c839c6665794bd"/><file name="pagination.png" hash="c1e5cc6dfe80b935b657576c8b93f5f5"/></dir></dir></dir></dir></dir></dir></target></contents>
|
16 |
+
<compatible/>
|
17 |
+
<dependencies><required><package><name>Mage_Core_Modules</name><channel>community</channel><min>1.4.1.1</min><max>1.7.0.0</max></package></required></dependencies>
|
18 |
+
</package>
|
skin/adminhtml/default/default/lookbook/css/annotation.css
ADDED
@@ -0,0 +1,288 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
button.image-annotate-add {
|
2 |
+
background: url("../images/btn_gray_bg.gif") repeat-x scroll 0 100% #FFFFFF;
|
3 |
+
border-color: #CCCCCC #AAAAAA #AAAAAA #CCCCCC;
|
4 |
+
color: #555555;
|
5 |
+
border-style: solid;
|
6 |
+
border-width: 1px;
|
7 |
+
cursor: pointer;
|
8 |
+
font: bold 12px arial,helvetica,sans-serif;
|
9 |
+
text-align: center !important;
|
10 |
+
white-space: nowrap;
|
11 |
+
float:right;
|
12 |
+
margin-top: 5px;
|
13 |
+
padding-top:1px;
|
14 |
+
padding-left:4px;
|
15 |
+
}
|
16 |
+
|
17 |
+
.image-annotate-add span {
|
18 |
+
padding: 5px 0px 5px 35px;
|
19 |
+
background-repeat: no-repeat;
|
20 |
+
line-height: 1.6em;
|
21 |
+
background-image: url("../images/icon_btn_add.png");
|
22 |
+
}
|
23 |
+
|
24 |
+
.image-annotate-canvas {
|
25 |
+
border: solid 1px #ccc;
|
26 |
+
background-position: left top;
|
27 |
+
background-repeat: no-repeat;
|
28 |
+
display: block;
|
29 |
+
margin: 0;
|
30 |
+
position: relative;
|
31 |
+
}
|
32 |
+
.image-annotate-view {
|
33 |
+
display: none;
|
34 |
+
position: relative;
|
35 |
+
}
|
36 |
+
.image-annotate-area {
|
37 |
+
border: 1px solid #000000;
|
38 |
+
position: absolute;
|
39 |
+
}
|
40 |
+
.image-annotate-area div {
|
41 |
+
border: 1px solid #FFFFFF;
|
42 |
+
display: block;
|
43 |
+
}
|
44 |
+
.image-annotate-area-hover div {
|
45 |
+
border-color: yellow !important;
|
46 |
+
}
|
47 |
+
.image-annotate-area-editable {
|
48 |
+
cursor: pointer;
|
49 |
+
}
|
50 |
+
.image-annotate-area-editable-hover div {
|
51 |
+
border-color: #00AD00 !important;
|
52 |
+
}
|
53 |
+
.image-annotate-note {
|
54 |
+
background: #E7FFE7 none repeat scroll 0 0;
|
55 |
+
border: solid 1px #397F39;
|
56 |
+
color: #000;
|
57 |
+
display: none;
|
58 |
+
font-family: Verdana, Sans-Serif;
|
59 |
+
font-size: 12px;
|
60 |
+
max-width: 200px;
|
61 |
+
padding: 3px 7px;
|
62 |
+
position: absolute;
|
63 |
+
}
|
64 |
+
.image-annotate-note .actions {
|
65 |
+
display: block;
|
66 |
+
font-size: 80%;
|
67 |
+
}
|
68 |
+
.image-annotate-edit {
|
69 |
+
display: none;
|
70 |
+
}
|
71 |
+
#image-annotate-edit-form {
|
72 |
+
background: #FFFEE3 none repeat scroll 0 0;
|
73 |
+
border: 1px solid #000000;
|
74 |
+
padding: 15px 7px;
|
75 |
+
position: absolute;
|
76 |
+
width: 265px;
|
77 |
+
text-align: center;
|
78 |
+
}
|
79 |
+
#image-annotate-edit-form form {
|
80 |
+
clear: right;
|
81 |
+
margin: 0 !important;
|
82 |
+
padding: 5px 0 5px 0;
|
83 |
+
z-index: 999;
|
84 |
+
}
|
85 |
+
#image-annotate-edit-form .box {
|
86 |
+
margin: 0;
|
87 |
+
}
|
88 |
+
#image-annotate-edit-form input.form-text, #image-annotate-edit-form #edit-comment-wrapper textarea {
|
89 |
+
width: 90%;
|
90 |
+
}
|
91 |
+
#image-annotate-edit-form textarea {
|
92 |
+
height: 50px;
|
93 |
+
font-family: Verdana, Sans-Serif;
|
94 |
+
font-size: 12px;
|
95 |
+
width: 248px;
|
96 |
+
}
|
97 |
+
#image-annotate-edit-form fieldset {
|
98 |
+
background: transparent none repeat scroll 0 0;
|
99 |
+
}
|
100 |
+
#image-annotate-edit-form .form-item {
|
101 |
+
margin: 0 0 5px;
|
102 |
+
}
|
103 |
+
#image-annotate-edit-form .form-button, #image-annotate-edit-form .form-submit {
|
104 |
+
margin: 0;
|
105 |
+
}
|
106 |
+
/*
|
107 |
+
#image-annotate-edit-form a {
|
108 |
+
background-color: #fff;
|
109 |
+
background-repeat: no-repeat;
|
110 |
+
background-position: 3px 3px;
|
111 |
+
border: solid 1px #ccc;
|
112 |
+
color: #333;
|
113 |
+
cursor: pointer;
|
114 |
+
display: block;
|
115 |
+
float: left;
|
116 |
+
font-family: Verdana, Sans-Serif;
|
117 |
+
font-size: 12px;
|
118 |
+
height: 18px;
|
119 |
+
line-height: 18px;
|
120 |
+
padding: 2px 6px 2px 24px;
|
121 |
+
margin: 6px 0px 6px 6px;
|
122 |
+
}
|
123 |
+
|
124 |
+
#image-annotate-edit-form a:hover {
|
125 |
+
background-color: #eee;
|
126 |
+
}*/
|
127 |
+
|
128 |
+
.image-annotate-edit-area {
|
129 |
+
border: 1px solid #000;
|
130 |
+
cursor: move;
|
131 |
+
display: block;
|
132 |
+
height: 60px;
|
133 |
+
left: 10px;
|
134 |
+
margin: 0;
|
135 |
+
padding: 0;
|
136 |
+
position: absolute;
|
137 |
+
top: 10px;
|
138 |
+
width: 60px;
|
139 |
+
}
|
140 |
+
.image-annotate-edit-area .ui-resizable-handle {
|
141 |
+
opacity: 0.8;
|
142 |
+
}
|
143 |
+
|
144 |
+
.image-annotate-edit-area:before {
|
145 |
+
position:absolute;
|
146 |
+
display:block;
|
147 |
+
content:'';
|
148 |
+
border:1px solid #FFF;
|
149 |
+
height:100%;
|
150 |
+
width:100%;
|
151 |
+
box-sizing: border-box;
|
152 |
+
-moz-box-sizing: border-box;
|
153 |
+
-webkit-box-sizing: border-box;
|
154 |
+
}
|
155 |
+
#image-annotate-edit-form button {
|
156 |
+
background: url("../images/btn_gray_bg.gif") repeat-x scroll 0 100% #FFFFFF;
|
157 |
+
border-color: #CCCCCC #AAAAAA #AAAAAA #CCCCCC;
|
158 |
+
color: #555555;
|
159 |
+
float:left;
|
160 |
+
border-style: solid;
|
161 |
+
border-width: 1px;
|
162 |
+
cursor: pointer;
|
163 |
+
font: bold 12px arial,helvetica,sans-serif;
|
164 |
+
text-align: center !important;
|
165 |
+
white-space: nowrap;
|
166 |
+
margin-top: 10px;
|
167 |
+
margin-left:10px;
|
168 |
+
margin-right:0px;
|
169 |
+
padding-top:1px;
|
170 |
+
padding-left:4px;
|
171 |
+
}
|
172 |
+
|
173 |
+
#image-annotate-edit-form button span {
|
174 |
+
padding: 0px 0px 5px 20px;
|
175 |
+
background-repeat: no-repeat;
|
176 |
+
line-height: 1.35em;
|
177 |
+
}
|
178 |
+
|
179 |
+
.image-annotate-edit-ok span {
|
180 |
+
background: url("../images/ok_btn_icon.png") no-repeat;
|
181 |
+
}
|
182 |
+
#image-annotate-edit-form button.image-annotate-edit-delete span{
|
183 |
+
padding: 1px 0px 5px 20px;
|
184 |
+
background: url(../images/delete_btn_icon.png) no-repeat;
|
185 |
+
}
|
186 |
+
.image-annotate-edit-close span {
|
187 |
+
background: url(../images/cancel_btn_icon.png) no-repeat;
|
188 |
+
}
|
189 |
+
.ui-resizable {
|
190 |
+
position: relative;
|
191 |
+
}
|
192 |
+
.ui-resizable-handle {
|
193 |
+
position: absolute;
|
194 |
+
font-size: 0.1px;
|
195 |
+
z-index: 99999;
|
196 |
+
display: block;
|
197 |
+
}
|
198 |
+
.ui-resizable-disabled .ui-resizable-handle, .ui-resizable- autohide .ui-resizable-handle {
|
199 |
+
display: block;
|
200 |
+
}
|
201 |
+
.ui-resizable-n {
|
202 |
+
cursor: n-resize;
|
203 |
+
height: 7px;
|
204 |
+
width: 100%;
|
205 |
+
top: -5px;
|
206 |
+
left: 0px;
|
207 |
+
}
|
208 |
+
.ui-resizable-s {
|
209 |
+
cursor: s-resize;
|
210 |
+
height: 7px;
|
211 |
+
width: 100%;
|
212 |
+
bottom: -5px;
|
213 |
+
left: 0px;
|
214 |
+
}
|
215 |
+
.ui-resizable-e {
|
216 |
+
cursor: e-resize;
|
217 |
+
width: 7px;
|
218 |
+
right: -5px;
|
219 |
+
top: 0px;
|
220 |
+
height: 100%;
|
221 |
+
}
|
222 |
+
.ui-resizable-w {
|
223 |
+
cursor: w-resize;
|
224 |
+
width: 7px;
|
225 |
+
left: -5px;
|
226 |
+
top: 0px;
|
227 |
+
height: 100%;
|
228 |
+
}
|
229 |
+
.ui-resizable-se {
|
230 |
+
cursor: se-resize;
|
231 |
+
width: 12px;
|
232 |
+
height: 12px;
|
233 |
+
right: 1px;
|
234 |
+
bottom: 1px;
|
235 |
+
}
|
236 |
+
.ui-resizable-sw {
|
237 |
+
cursor: sw-resize;
|
238 |
+
width: 9px;
|
239 |
+
height: 9px;
|
240 |
+
left: -5px;
|
241 |
+
bottom: -5px;
|
242 |
+
}
|
243 |
+
.ui-resizable-nw {
|
244 |
+
cursor: nw-resize;
|
245 |
+
width: 9px;
|
246 |
+
height: 9px;
|
247 |
+
left: -5px;
|
248 |
+
top: -5px;
|
249 |
+
}
|
250 |
+
.ui-resizable-ne {
|
251 |
+
cursor: ne-resize;
|
252 |
+
width: 9px;
|
253 |
+
height: 9px;
|
254 |
+
right: -5px;
|
255 |
+
top: -5px;
|
256 |
+
}
|
257 |
+
|
258 |
+
.hotspots-msg {
|
259 |
+
display:block;
|
260 |
+
position:absolute;
|
261 |
+
width:100%;
|
262 |
+
font-weight: bold;
|
263 |
+
text-align:center;
|
264 |
+
font-size:14px;
|
265 |
+
color: #FFFFFF;
|
266 |
+
text-shadow: #000000 2px 2px 6px;
|
267 |
+
}
|
268 |
+
|
269 |
+
.products-link{
|
270 |
+
display:block;
|
271 |
+
width:100%;
|
272 |
+
font-weight: bold;
|
273 |
+
text-align:center;
|
274 |
+
font-size:14px;
|
275 |
+
color: #FFFFFF;
|
276 |
+
padding-top: 10px;
|
277 |
+
padding-bottom: 30px;
|
278 |
+
}
|
279 |
+
|
280 |
+
.products-link a {
|
281 |
+
float:right;
|
282 |
+
padding-right: 16px;
|
283 |
+
background-image: url("../images/link_external.png");
|
284 |
+
background-repeat: no-repeat;
|
285 |
+
background-position: right center;
|
286 |
+
font-weight: normal;
|
287 |
+
color:#EA7601;
|
288 |
+
}
|
skin/adminhtml/default/default/lookbook/css/fileuploader.css
ADDED
@@ -0,0 +1,75 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
.qq-uploader { position:relative; display:block; float:left;}
|
2 |
+
|
3 |
+
.qq-upload-button {
|
4 |
+
background: url("../images/btn_bg.gif") repeat-x scroll 0 100% #FFAC47;
|
5 |
+
border-color: #ED6502 #A04300 #A04300 #ED6502;
|
6 |
+
border-style: solid;
|
7 |
+
border-width: 1px;
|
8 |
+
float:left;
|
9 |
+
color: #FFFFFF;
|
10 |
+
cursor: pointer;
|
11 |
+
font: bold 12px arial,helvetica,sans-serif;
|
12 |
+
padding: 4px 7px 3px 7px;
|
13 |
+
text-align: center !important;
|
14 |
+
white-space: nowrap;
|
15 |
+
}
|
16 |
+
|
17 |
+
.qq-upload-button span {
|
18 |
+
padding-left: 20px;
|
19 |
+
background-image: url("../images/upload_btn_icon.png");
|
20 |
+
background-repeat: no-repeat;
|
21 |
+
}
|
22 |
+
|
23 |
+
.qq-upload-button:hover {
|
24 |
+
background:#f77c16 url(../images/btn_over_bg.gif) repeat-x 0 0;
|
25 |
+
}
|
26 |
+
|
27 |
+
.qq-upload-button input {
|
28 |
+
cursor: pointer !important;
|
29 |
+
width:auto !important;
|
30 |
+
}
|
31 |
+
|
32 |
+
.qq-upload-drop-area {
|
33 |
+
position:absolute; top:0; left:0; width:100%; height:100%; min-height: 70px; z-index:2;
|
34 |
+
background:#FF9797; text-align:center;
|
35 |
+
}
|
36 |
+
.qq-upload-drop-area span {
|
37 |
+
display:block; position:absolute; top: 50%; width:100%; margin-top:-8px; font-size:16px;
|
38 |
+
}
|
39 |
+
.qq-upload-drop-area-active {background:#FF7171;}
|
40 |
+
|
41 |
+
.qq-upload-list {margin:6px; padding:0; list-style:none; float:left;}
|
42 |
+
.qq-upload-list li {font-size:12px;}
|
43 |
+
.qq-upload-file, .qq-upload-spinner, .qq-upload-remove, .qq-upload-size, .qq-upload-cancel, .qq-upload-failed-text {
|
44 |
+
margin-right: 7px;
|
45 |
+
}
|
46 |
+
|
47 |
+
.qq-upload-spinner {display:inline-block; background: url("../images/loading.gif"); width:15px; height:15px; vertical-align:text-bottom;}
|
48 |
+
.qq-upload-remove {display:none; background: url("../images/cancel.png"); width:17px; height:17px; vertical-align:text-bottom;}
|
49 |
+
.qq-upload-size,
|
50 |
+
.qq-upload-cancel {font-size:11px;}
|
51 |
+
|
52 |
+
.qq-upload-failed-text {display:none;}
|
53 |
+
.qq-upload-fail .qq-upload-failed-text {display:inline;}
|
54 |
+
|
55 |
+
|
56 |
+
#LookbookImageBlock {
|
57 |
+
position:relative;
|
58 |
+
}
|
59 |
+
#maket_image {
|
60 |
+
margin-top:5px !important;
|
61 |
+
margin-bottom:5px !important;
|
62 |
+
position:relative;
|
63 |
+
float:left;
|
64 |
+
}
|
65 |
+
|
66 |
+
#lookbook_form {
|
67 |
+
padding:30px 50px;
|
68 |
+
}
|
69 |
+
#lookbook_form .form-list td.label {
|
70 |
+
width: 100px;
|
71 |
+
}
|
72 |
+
|
73 |
+
#lookbook_form .form-list td.label label {
|
74 |
+
width: 75px;
|
75 |
+
}
|
skin/adminhtml/default/default/lookbook/images/btn_bg.gif
ADDED
Binary file
|
skin/adminhtml/default/default/lookbook/images/btn_gray_bg.gif
ADDED
Binary file
|
skin/adminhtml/default/default/lookbook/images/btn_over_bg.gif
ADDED
Binary file
|
skin/adminhtml/default/default/lookbook/images/cancel_btn_icon.png
ADDED
Binary file
|
skin/adminhtml/default/default/lookbook/images/cross.png
ADDED
Binary file
|
skin/adminhtml/default/default/lookbook/images/delete_btn_icon.png
ADDED
Binary file
|
skin/adminhtml/default/default/lookbook/images/icon_btn_add.png
ADDED
Binary file
|
skin/adminhtml/default/default/lookbook/images/link_external.png
ADDED
Binary file
|
skin/adminhtml/default/default/lookbook/images/loading.gif
ADDED
Binary file
|
skin/adminhtml/default/default/lookbook/images/ok_btn_icon.png
ADDED
Binary file
|
skin/adminhtml/default/default/lookbook/images/upload_btn_icon.png
ADDED
Binary file
|
skin/frontend/base/default/lookbook/css/hotspots.css
ADDED
@@ -0,0 +1,141 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#lookbook {
|
2 |
+
position:relative;
|
3 |
+
}
|
4 |
+
|
5 |
+
#adv_link {
|
6 |
+
position:absolute;
|
7 |
+
background : url(../images/adv-bg.png) no-repeat 0 0;
|
8 |
+
width:188px;
|
9 |
+
height: 76px;
|
10 |
+
right: 0px;
|
11 |
+
top: 0px;
|
12 |
+
display:block;
|
13 |
+
color: #e6d3cc;
|
14 |
+
font-size: 12px;
|
15 |
+
font-family: Arial;
|
16 |
+
text-align: right;
|
17 |
+
}
|
18 |
+
|
19 |
+
#adv_link div{
|
20 |
+
margin-top: 8px;
|
21 |
+
margin-right: 12px;
|
22 |
+
position: absolute;
|
23 |
+
z-index: 105;
|
24 |
+
top: 0px;
|
25 |
+
right: 0px;
|
26 |
+
}
|
27 |
+
|
28 |
+
#adv_link a{
|
29 |
+
color: #e6d3cc;
|
30 |
+
font-size: 12px;
|
31 |
+
font-family: Arial;
|
32 |
+
}
|
33 |
+
|
34 |
+
#slides {
|
35 |
+
position:absolute;
|
36 |
+
top:15px;
|
37 |
+
left:15px;
|
38 |
+
}
|
39 |
+
|
40 |
+
.slides_container {
|
41 |
+
overflow:hidden;
|
42 |
+
position:relative;
|
43 |
+
display:none;
|
44 |
+
z-index:7;
|
45 |
+
}
|
46 |
+
.slides_container div.slide {
|
47 |
+
display:block;
|
48 |
+
}
|
49 |
+
#slides .next,#slides .prev {
|
50 |
+
position:absolute;
|
51 |
+
width:24px;
|
52 |
+
height:43px;
|
53 |
+
display:block;
|
54 |
+
z-index:1;
|
55 |
+
}
|
56 |
+
.pagination {
|
57 |
+
margin:16px auto 0 !important;
|
58 |
+
}
|
59 |
+
|
60 |
+
.pagination li {
|
61 |
+
float:left;
|
62 |
+
margin:0 1px;
|
63 |
+
list-style:none;
|
64 |
+
}
|
65 |
+
|
66 |
+
.pagination li a {
|
67 |
+
display:block;
|
68 |
+
width:12px;
|
69 |
+
height:0;
|
70 |
+
padding-top:12px;
|
71 |
+
background-image:url(../images/pagination.png);
|
72 |
+
background-position:0 0;
|
73 |
+
float:left;
|
74 |
+
overflow:hidden;
|
75 |
+
}
|
76 |
+
|
77 |
+
.pagination li.current a {
|
78 |
+
background-position:0 -12px;
|
79 |
+
}
|
80 |
+
|
81 |
+
.caption {
|
82 |
+
position:absolute;
|
83 |
+
bottom:-35px;
|
84 |
+
left:0;
|
85 |
+
height:30px;
|
86 |
+
padding:5px 20px 0 20px;
|
87 |
+
/*background:#000; background:rgba(0,0,0,.5);*/
|
88 |
+
background : url(../images/caption-bg.png) repeat-x 0 0;
|
89 |
+
font-size:1.3em;
|
90 |
+
line-height:1.33;
|
91 |
+
color:#fff;
|
92 |
+
border-top:1px solid #000;
|
93 |
+
text-shadow:none;
|
94 |
+
}
|
95 |
+
|
96 |
+
.hotspot {
|
97 |
+
position:absolute;
|
98 |
+
}
|
99 |
+
|
100 |
+
.hotspot:hover .product-info {
|
101 |
+
display:block;
|
102 |
+
}
|
103 |
+
|
104 |
+
.hotspot:hover .hotspot-icon {
|
105 |
+
z-index:101;
|
106 |
+
}
|
107 |
+
|
108 |
+
.product-info {
|
109 |
+
background: url(../images/info-bg.png) repeat 0 0 transparent;
|
110 |
+
border-top: 2px solid #FFFFFF;
|
111 |
+
color: #686767;
|
112 |
+
overflow:hidden;
|
113 |
+
font: normal 12px Tahoma,Arial;
|
114 |
+
min-width: 100px;
|
115 |
+
max-width: 200px;
|
116 |
+
padding: 12px;
|
117 |
+
position: absolute;
|
118 |
+
display:none;
|
119 |
+
z-index:100;
|
120 |
+
|
121 |
+
-webkit-border-radius: 4px;
|
122 |
+
-moz-border-radius: 4px;
|
123 |
+
border-radius: 4px;
|
124 |
+
-webkit-box-shadow: #666 2px 2px 3px;
|
125 |
+
-moz-box-shadow: #666 2px 2px 3px;
|
126 |
+
box-shadow: #666 2px 2px 3px;
|
127 |
+
}
|
128 |
+
|
129 |
+
.product-info a {
|
130 |
+
color: #686767;
|
131 |
+
font: normal 12px Tahoma,Arial;
|
132 |
+
}
|
133 |
+
|
134 |
+
.product-info .price {
|
135 |
+
font: bold 12px Tahoma,Arial;
|
136 |
+
color: #7dad01;
|
137 |
+
padding-top: 8px;
|
138 |
+
}
|
139 |
+
.hotspot-icon {
|
140 |
+
position: absolute;
|
141 |
+
}
|
skin/frontend/base/default/lookbook/images/adv-bg.png
ADDED
Binary file
|
skin/frontend/base/default/lookbook/images/arrow-next.png
ADDED
Binary file
|
skin/frontend/base/default/lookbook/images/arrow-prev.png
ADDED
Binary file
|
skin/frontend/base/default/lookbook/images/background.png
ADDED
Binary file
|
skin/frontend/base/default/lookbook/images/caption-bg.png
ADDED
Binary file
|
skin/frontend/base/default/lookbook/images/info-bg.png
ADDED
Binary file
|
skin/frontend/base/default/lookbook/images/loading.gif
ADDED
Binary file
|
skin/frontend/base/default/lookbook/images/pagination.png
ADDED
Binary file
|