Version Notes
First version of the extension. Free Auguria_Core extension required.
Download this release
Release Info
Developer | Auguria |
Extension | auguriaInteractiveImage |
Version | 0.0.1 |
Comparing to | |
See all releases |
Version 0.0.1
- app/code/community/Auguria/InteractiveImage/Block/Adminhtml/Catalog/Product/Helper/Form/Image/Interactive.php +82 -0
- app/code/community/Auguria/InteractiveImage/Block/Adminhtml/Catalog/Product/Helper/Form/Image/Interactive/Panel/Area/Default.php +11 -0
- app/code/community/Auguria/InteractiveImage/Block/Adminhtml/Catalog/Product/Helper/Form/Image/Interactive/Panel/Areas.php +98 -0
- app/code/community/Auguria/InteractiveImage/Block/Adminhtml/Catalog/Product/Helper/Form/Image/Interactive/Popin.php +50 -0
- app/code/community/Auguria/InteractiveImage/Block/Catalog/Product/Image.php +186 -0
- app/code/community/Auguria/InteractiveImage/Helper/Config.php +24 -0
- app/code/community/Auguria/InteractiveImage/Helper/Data.php +33 -0
- app/code/community/Auguria/InteractiveImage/Model/Catalog/Product/Attribute/Backend/Image.php +94 -0
- app/code/community/Auguria/InteractiveImage/controllers/Adminhtml/Auguria/InteractiveImage/ImageController.php +111 -0
- app/code/community/Auguria/InteractiveImage/controllers/Checkout/Cart/AjaxController.php +164 -0
- app/code/community/Auguria/InteractiveImage/controllers/Checkout/CartController.php +164 -0
- app/code/community/Auguria/InteractiveImage/etc/adminhtml.xml +30 -0
- app/code/community/Auguria/InteractiveImage/etc/config.xml +111 -0
- app/code/community/Auguria/InteractiveImage/etc/jstranslator.xml +14 -0
- app/code/community/Auguria/InteractiveImage/etc/system.xml +45 -0
- app/code/community/Auguria/InteractiveImage/sql/auguria_interactiveimage_setup/install-0.0.1.php +37 -0
- app/design/adminhtml/default/default/layout/auguria/interactive_image.xml +35 -0
- app/design/adminhtml/default/default/template/auguria/interactiveimage/catalog/product/helper/form/image/interactive/panel/area/default.phtml +46 -0
- app/design/adminhtml/default/default/template/auguria/interactiveimage/catalog/product/helper/form/image/interactive/panel/areas.phtml +25 -0
- app/design/adminhtml/default/default/template/auguria/interactiveimage/catalog/product/helper/form/image/interactive/popin.phtml +35 -0
- app/design/frontend/base/default/layout/auguria/interactive_image.xml +26 -0
- app/design/frontend/base/default/template/auguria/interactiveimage/catalog/product/image.phtml +126 -0
- app/etc/modules/Auguria_InteractiveImage.xml +20 -0
- app/locale/en_US/Auguria_InteractiveImage.csv +0 -0
- app/locale/fr_FR/Auguria_InteractiveImage.csv +14 -0
- js/auguria/interactiveimage/cart.js +11 -0
- js/auguria/interactiveimage/image.js +357 -0
- js/auguria/interactiveimage/jquery-1.10.2.min.js +7 -0
- js/auguria/interactiveimage/jquery.maphilight.min.js +1 -0
- js/auguria/interactiveimage/kinetic-v4.5.4.min.js +4 -0
- package.xml +28 -0
- skin/adminhtml/default/default/auguria/interactiveimage/image.css +25 -0
- skin/frontend/base/default/css/auguria/interactiveimage/image.css +20 -0
app/code/community/Auguria/InteractiveImage/Block/Adminhtml/Catalog/Product/Helper/Form/Image/Interactive.php
ADDED
@@ -0,0 +1,82 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category Auguria
|
4 |
+
* @package Auguria_InteractiveImage
|
5 |
+
* @author Auguria
|
6 |
+
* @license http://opensource.org/licenses/gpl-3.0.html GNU General Public License version 3 (GPLv3)
|
7 |
+
*/
|
8 |
+
|
9 |
+
class Auguria_InteractiveImage_Block_Adminhtml_Catalog_Product_Helper_Form_Image_Interactive extends Mage_Adminhtml_Block_Catalog_Product_Helper_Form_Image
|
10 |
+
{
|
11 |
+
/**
|
12 |
+
* Override getValue method
|
13 |
+
*
|
14 |
+
* @return string : path of the image
|
15 |
+
*/
|
16 |
+
public function getValue()
|
17 |
+
{
|
18 |
+
$array = $this->getJsonValue();
|
19 |
+
|
20 |
+
return $array['image_path'];
|
21 |
+
}
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Get json value
|
25 |
+
*
|
26 |
+
* @param bool $asArray
|
27 |
+
* @return mixed|array|string
|
28 |
+
*/
|
29 |
+
public function getJsonValue($asArray = true)
|
30 |
+
{
|
31 |
+
$string = $this->getData('value');
|
32 |
+
|
33 |
+
if($asArray){
|
34 |
+
return Mage::helper('core')->jsonDecode($string);
|
35 |
+
}
|
36 |
+
|
37 |
+
return $string;
|
38 |
+
}
|
39 |
+
|
40 |
+
/**
|
41 |
+
* Get areas value
|
42 |
+
*
|
43 |
+
* @param bool $asArray
|
44 |
+
* @return mixed|array|string
|
45 |
+
*/
|
46 |
+
public function getAreas($asArray = true)
|
47 |
+
{
|
48 |
+
$attributeValue = $this->getJsonValue();
|
49 |
+
$areas = is_array($attributeValue) && array_key_exists('areas', $attributeValue) ? $attributeValue['areas'] : array();
|
50 |
+
|
51 |
+
if($asArray){
|
52 |
+
return $areas;
|
53 |
+
}else{
|
54 |
+
return Mage::helper('core')->jsonEncode($areas);
|
55 |
+
}
|
56 |
+
}
|
57 |
+
|
58 |
+
/**
|
59 |
+
* Return element html code
|
60 |
+
*
|
61 |
+
* @return string
|
62 |
+
*/
|
63 |
+
public function getElementHtml()
|
64 |
+
{
|
65 |
+
$html = parent::getElementHtml();
|
66 |
+
|
67 |
+
$areas = $this->getAreas(false); // json encoded
|
68 |
+
$imageUrl = $this->_getUrl();
|
69 |
+
|
70 |
+
$params = $this->getJsonValue(false); // json encoded
|
71 |
+
$parameters = $params ? $params : '\'\'';
|
72 |
+
|
73 |
+
$html .= '
|
74 |
+
<div class="clear"></div>
|
75 |
+
<input type="hidden" id="' . $this->getName() . '_areas" name="product['. $this->getName() . '][areas]" value="' . $areas . '"/>
|
76 |
+
<script type="text/javascript">var interactiveImage = new InteractiveImage(\'' . $imageUrl . '\', ' . $parameters . ');</script>
|
77 |
+
<button type="button" onclick="interactiveImage.display();return false;">' . Mage::helper('auguria_interactiveimage')->__('Define areas') . '</button>
|
78 |
+
';
|
79 |
+
|
80 |
+
return $html;
|
81 |
+
}
|
82 |
+
}
|
app/code/community/Auguria/InteractiveImage/Block/Adminhtml/Catalog/Product/Helper/Form/Image/Interactive/Panel/Area/Default.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category Auguria
|
4 |
+
* @package Auguria_InteractiveImage
|
5 |
+
* @author Auguria
|
6 |
+
* @license http://opensource.org/licenses/gpl-3.0.html GNU General Public License version 3 (GPLv3)
|
7 |
+
*/
|
8 |
+
|
9 |
+
class Auguria_InteractiveImage_Block_Adminhtml_Catalog_Product_Helper_Form_Image_Interactive_Panel_Area_Default extends Mage_Core_Block_Template
|
10 |
+
{
|
11 |
+
}
|
app/code/community/Auguria/InteractiveImage/Block/Adminhtml/Catalog/Product/Helper/Form/Image/Interactive/Panel/Areas.php
ADDED
@@ -0,0 +1,98 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category Auguria
|
4 |
+
* @package Auguria_InteractiveImage
|
5 |
+
* @author Auguria
|
6 |
+
* @license http://opensource.org/licenses/gpl-3.0.html GNU General Public License version 3 (GPLv3)
|
7 |
+
*/
|
8 |
+
|
9 |
+
class Auguria_InteractiveImage_Block_Adminhtml_Catalog_Product_Helper_Form_Image_Interactive_Panel_Areas extends Mage_Core_Block_Template
|
10 |
+
{
|
11 |
+
protected $_areas;
|
12 |
+
|
13 |
+
protected $_areaRenders = array();
|
14 |
+
|
15 |
+
public function __construct()
|
16 |
+
{
|
17 |
+
parent::__construct();
|
18 |
+
$this->addAreaRenderer(
|
19 |
+
'default',
|
20 |
+
'auguria_interactiveimage/adminhtml_catalog_product_helper_form_image_interactive_panel_area_default',
|
21 |
+
'auguria/interactiveimage/catalog/product/helper/form/image/interactive/panel/area/default.phtml'
|
22 |
+
);
|
23 |
+
}
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Retrieve area
|
27 |
+
*
|
28 |
+
* @return array
|
29 |
+
*/
|
30 |
+
public function getAreas()
|
31 |
+
{
|
32 |
+
return $this->_areas;
|
33 |
+
}
|
34 |
+
|
35 |
+
/**
|
36 |
+
* Set area
|
37 |
+
*
|
38 |
+
* @param array $area
|
39 |
+
* @return Auguria_InteractiveImage_Block_Adminhtml_Catalog_Product_Helper_Form_Image_Interactive_Panel_Areas
|
40 |
+
*/
|
41 |
+
public function setAreas(array $areas = null)
|
42 |
+
{
|
43 |
+
$this->_areas = $areas;
|
44 |
+
return $this;
|
45 |
+
}
|
46 |
+
|
47 |
+
/**
|
48 |
+
* Add area renderer to renderers array
|
49 |
+
*
|
50 |
+
* @param string $type
|
51 |
+
* @param string $block
|
52 |
+
* @param string $template
|
53 |
+
* @return Auguria_InteractiveImage_Block_Adminhtml_Catalog_Product_Helper_Form_Image_Interactive_Panel_Areas
|
54 |
+
*/
|
55 |
+
public function addAreaRenderer($type, $block, $template)
|
56 |
+
{
|
57 |
+
$this->_areaRenders[$type] = array(
|
58 |
+
'block' => $block,
|
59 |
+
'template' => $template,
|
60 |
+
'renderer' => null
|
61 |
+
);
|
62 |
+
return $this;
|
63 |
+
}
|
64 |
+
|
65 |
+
/**
|
66 |
+
* Get area render by given type
|
67 |
+
*
|
68 |
+
* @param string $type
|
69 |
+
* @return array
|
70 |
+
*/
|
71 |
+
public function getAreaRender($type)
|
72 |
+
{
|
73 |
+
if (isset($this->_areaRenders[$type])) {
|
74 |
+
return $this->_areaRenders[$type];
|
75 |
+
}
|
76 |
+
|
77 |
+
return $this->_areaRenders['default'];
|
78 |
+
}
|
79 |
+
|
80 |
+
/**
|
81 |
+
* Get option html block
|
82 |
+
*
|
83 |
+
* @param array $area
|
84 |
+
*/
|
85 |
+
public function getAreaHtml(array $area)
|
86 |
+
{
|
87 |
+
$renderer = $this->_areaRenders[$area['render']];
|
88 |
+
|
89 |
+
if (is_null($renderer['renderer'])) {
|
90 |
+
$renderer['renderer'] = $this->getLayout()->createBlock($renderer['block'])
|
91 |
+
->setTemplate($renderer['template']);
|
92 |
+
}
|
93 |
+
|
94 |
+
return $renderer['renderer']
|
95 |
+
->setInteractiveArea($area) // "area" reserved name
|
96 |
+
->toHtml();
|
97 |
+
}
|
98 |
+
}
|
app/code/community/Auguria/InteractiveImage/Block/Adminhtml/Catalog/Product/Helper/Form/Image/Interactive/Popin.php
ADDED
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category Auguria
|
4 |
+
* @package Auguria_InteractiveImage
|
5 |
+
* @author Auguria
|
6 |
+
* @license http://opensource.org/licenses/gpl-3.0.html GNU General Public License version 3 (GPLv3)
|
7 |
+
*/
|
8 |
+
|
9 |
+
class Auguria_InteractiveImage_Block_Adminhtml_Catalog_Product_Helper_Form_Image_Interactive_Popin extends Mage_Core_Block_Template
|
10 |
+
{
|
11 |
+
/**
|
12 |
+
* Get edition interface parameters
|
13 |
+
*
|
14 |
+
* @var null|array
|
15 |
+
*/
|
16 |
+
protected $_params = null;
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Initialise parameters
|
20 |
+
*
|
21 |
+
* @param array $params
|
22 |
+
* @return Auguria_InteractiveImage_Block_Adminhtml_Catalog_Product_Helper_Form_Image_Interactive_Popin
|
23 |
+
*/
|
24 |
+
public function setParams(array $params)
|
25 |
+
{
|
26 |
+
$this->_params = $params;
|
27 |
+
return $this;
|
28 |
+
}
|
29 |
+
|
30 |
+
/**
|
31 |
+
* Get parameters
|
32 |
+
*
|
33 |
+
* @return null|array
|
34 |
+
*/
|
35 |
+
public function getParams()
|
36 |
+
{
|
37 |
+
return $this->_params;
|
38 |
+
}
|
39 |
+
|
40 |
+
/**
|
41 |
+
* Get image properties
|
42 |
+
*
|
43 |
+
* @return array
|
44 |
+
*/
|
45 |
+
public function getImage()
|
46 |
+
{
|
47 |
+
return array('url' => $this->_params['image_url'], 'size' => getimagesize($this->_params['image_url']));
|
48 |
+
}
|
49 |
+
|
50 |
+
}
|
app/code/community/Auguria/InteractiveImage/Block/Catalog/Product/Image.php
ADDED
@@ -0,0 +1,186 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category Auguria
|
4 |
+
* @package Auguria_InteractiveImage
|
5 |
+
* @author Auguria
|
6 |
+
* @license http://opensource.org/licenses/gpl-3.0.html GNU General Public License version 3 (GPLv3)
|
7 |
+
*/
|
8 |
+
|
9 |
+
class Auguria_InteractiveImage_Block_Catalog_Product_Image extends Mage_Core_Block_Template
|
10 |
+
{
|
11 |
+
protected $_imageUrl;
|
12 |
+
protected $_imageSize;
|
13 |
+
protected $_areas;
|
14 |
+
protected $_products;
|
15 |
+
protected $_productsBySku;
|
16 |
+
protected $_positions;
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Get image url
|
20 |
+
*
|
21 |
+
* @return string
|
22 |
+
*/
|
23 |
+
public function getInteractiveImage()
|
24 |
+
{
|
25 |
+
if(!$this->_imageUrl){
|
26 |
+
$values = Mage::helper('core')->jsonDecode($this->getProduct()->getData('auguria_interactiveimage_image'));
|
27 |
+
// image
|
28 |
+
if(!empty($values['image_path'])){
|
29 |
+
$this->_imageUrl = Mage::getSingleton('catalog/product_media_config')->getBaseMediaUrl() . '/' . $values['image_path'];
|
30 |
+
|
31 |
+
$sizes = getimagesize($this->_imageUrl);
|
32 |
+
$this->_imageSize = array('width' => $sizes[0], 'height' => $sizes[1]);
|
33 |
+
}
|
34 |
+
|
35 |
+
// areas
|
36 |
+
if(!empty($values['areas'])){
|
37 |
+
$this->_areas = Mage::helper('core')->jsonDecode($values['areas']);
|
38 |
+
}
|
39 |
+
}
|
40 |
+
|
41 |
+
return $this->_imageUrl;
|
42 |
+
}
|
43 |
+
|
44 |
+
/**
|
45 |
+
* Get image size
|
46 |
+
*
|
47 |
+
* @return null|array
|
48 |
+
*/
|
49 |
+
public function getInteractiveImageSize()
|
50 |
+
{
|
51 |
+
return $this->_imageSize;
|
52 |
+
}
|
53 |
+
|
54 |
+
/**
|
55 |
+
* Get areas
|
56 |
+
*
|
57 |
+
* @return array
|
58 |
+
*/
|
59 |
+
public function getAreas()
|
60 |
+
{
|
61 |
+
return $this->_areas;
|
62 |
+
}
|
63 |
+
|
64 |
+
/**
|
65 |
+
* Retrieve current product model
|
66 |
+
*
|
67 |
+
* @return Mage_Catalog_Model_Product
|
68 |
+
*/
|
69 |
+
public function getProduct()
|
70 |
+
{
|
71 |
+
return Mage::registry('product');
|
72 |
+
}
|
73 |
+
|
74 |
+
/**
|
75 |
+
* Get area coords
|
76 |
+
*
|
77 |
+
* @param array $area
|
78 |
+
* @return array
|
79 |
+
*/
|
80 |
+
public function getCoords($area)
|
81 |
+
{
|
82 |
+
$coords = array();
|
83 |
+
|
84 |
+
if($area['type'] == 'rect'){
|
85 |
+
$x2 = $area['size']['x'] + $area['size']['width'];
|
86 |
+
$y2 = $area['size']['y'] + $area['size']['height'];
|
87 |
+
$coords['area'] = $area['size']['x'] . ',' . $area['size']['y'] . ',' . $x2 . ',' . $y2;
|
88 |
+
$coords['tooltip'] = array('top' => -($this->_imageSize['height'] - $area['size']['y']), 'left' => $x2 + 10);
|
89 |
+
}
|
90 |
+
|
91 |
+
return $coords;
|
92 |
+
}
|
93 |
+
|
94 |
+
/**
|
95 |
+
* Get product associated with areas
|
96 |
+
*
|
97 |
+
* @return Mage_Catalog_Model_Resource_Product_Collection
|
98 |
+
*/
|
99 |
+
public function getProducts()
|
100 |
+
{
|
101 |
+
if(!$this->_products){
|
102 |
+
$ids = array();
|
103 |
+
|
104 |
+
$product = Mage::getSingleton('catalog/product');
|
105 |
+
if($this->_areas){
|
106 |
+
foreach ($this->_areas as $_area){
|
107 |
+
$ids[] = $product->getIdBySku($_area['sku']);
|
108 |
+
$this->_positions[$_area['sku']] = $_area['position'];
|
109 |
+
}
|
110 |
+
}
|
111 |
+
|
112 |
+
$this->_products = Mage::getResourceModel('catalog/product_collection')
|
113 |
+
->addAttributeToSelect(array('name', 'sku'))
|
114 |
+
->addFieldToFilter('entity_id', array('in' => $ids))
|
115 |
+
->addFinalPrice()
|
116 |
+
->addStoreFilter(Mage::app()->getStore());
|
117 |
+
|
118 |
+
// get easily product by without reload them
|
119 |
+
foreach ($this->_products as $_product){
|
120 |
+
$this->_productsBySku[$_product->getSku()] = $_product;
|
121 |
+
}
|
122 |
+
}
|
123 |
+
|
124 |
+
return $this->_products;
|
125 |
+
}
|
126 |
+
|
127 |
+
/**
|
128 |
+
* Get product by sku
|
129 |
+
*
|
130 |
+
* @param string $sku
|
131 |
+
* @return Mage_Catalog_Model_Product
|
132 |
+
*/
|
133 |
+
public function getProductBySku($sku)
|
134 |
+
{
|
135 |
+
return is_array($this->_productsBySku) && array_key_exists($sku, $this->_productsBySku) ? $this->_productsBySku[$sku] : null;
|
136 |
+
}
|
137 |
+
|
138 |
+
/**
|
139 |
+
* Get product position by sku
|
140 |
+
*
|
141 |
+
* @param string $sku
|
142 |
+
*/
|
143 |
+
public function getPositionBySku($sku)
|
144 |
+
{
|
145 |
+
return $this->_positions[$sku];
|
146 |
+
}
|
147 |
+
|
148 |
+
/**
|
149 |
+
* Retrieve url for direct adding product to cart
|
150 |
+
*
|
151 |
+
* @param string $sku
|
152 |
+
* @param array $additional
|
153 |
+
* @return string
|
154 |
+
*/
|
155 |
+
public function getAddToCartUrl($sku, $additional = array())
|
156 |
+
{
|
157 |
+
if ($this->getRequest()->getParam('wishlist_next')){
|
158 |
+
$additional['wishlist_next'] = 1;
|
159 |
+
}
|
160 |
+
|
161 |
+
$addUrlKey = Mage_Core_Controller_Front_Action::PARAM_NAME_URL_ENCODED;
|
162 |
+
$addUrlValue = Mage::getUrl('*/*/*', array('_use_rewrite' => true, '_current' => true));
|
163 |
+
$additional[$addUrlKey] = Mage::helper('core')->urlEncode($addUrlValue);
|
164 |
+
|
165 |
+
// no product load
|
166 |
+
$product = Mage::getModel('catalog/product');
|
167 |
+
$id = Mage::getModel('catalog/product')->getIdBySku($sku);
|
168 |
+
$product->setId($id);
|
169 |
+
|
170 |
+
return $this->helper('checkout/cart')->getAddUrl($product, $additional);
|
171 |
+
}
|
172 |
+
|
173 |
+
/**
|
174 |
+
* Retrieve url for direct adding product to cart
|
175 |
+
*
|
176 |
+
* @return string
|
177 |
+
*/
|
178 |
+
public function getMassAddToCartUrl()
|
179 |
+
{
|
180 |
+
$addUrlKey = Mage_Core_Controller_Front_Action::PARAM_NAME_URL_ENCODED;
|
181 |
+
$addUrlValue = Mage::getUrl('*/*/*', array('_use_rewrite' => true, '_current' => true));
|
182 |
+
$additional[$addUrlKey] = Mage::helper('core')->urlEncode($addUrlValue);
|
183 |
+
|
184 |
+
return Mage::getUrl('image/checkout_cart/add', $additional);
|
185 |
+
}
|
186 |
+
}
|
app/code/community/Auguria/InteractiveImage/Helper/Config.php
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category Auguria
|
4 |
+
* @package Auguria_InteractiveImage
|
5 |
+
* @author Auguria
|
6 |
+
* @license http://opensource.org/licenses/gpl-3.0.html GNU General Public License version 3 (GPLv3)
|
7 |
+
*/
|
8 |
+
|
9 |
+
class Auguria_InteractiveImage_Helper_Config extends Mage_Core_Helper_Abstract {
|
10 |
+
|
11 |
+
/* PATH TO CONFIGURATION */
|
12 |
+
const XML_PATH_INTERACTIVE_IMAGE_USE_AJAX = 'auguria_interactiveimage/general/use_ajax';
|
13 |
+
|
14 |
+
/**
|
15 |
+
* Check if ajax must be used
|
16 |
+
*
|
17 |
+
* @return bool
|
18 |
+
*/
|
19 |
+
public function useAjax()
|
20 |
+
{
|
21 |
+
return Mage::helper('core')->isModuleEnabled('Auguria_CartAjax') && Mage::getStoreConfigFlag(self::XML_PATH_INTERACTIVE_IMAGE_USE_AJAX);
|
22 |
+
}
|
23 |
+
|
24 |
+
}
|
app/code/community/Auguria/InteractiveImage/Helper/Data.php
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category Auguria
|
4 |
+
* @package Auguria_InteractiveImage
|
5 |
+
* @author Auguria
|
6 |
+
* @license http://opensource.org/licenses/gpl-3.0.html GNU General Public License version 3 (GPLv3)
|
7 |
+
*/
|
8 |
+
|
9 |
+
class Auguria_InteractiveImage_Helper_Data extends Mage_Core_Helper_Abstract {
|
10 |
+
|
11 |
+
/**
|
12 |
+
* Get the full image path by attribute path saved
|
13 |
+
*
|
14 |
+
* @param string $attributeImagePath
|
15 |
+
* @return string
|
16 |
+
*/
|
17 |
+
public function getFullImagePath($attributeImagePath)
|
18 |
+
{
|
19 |
+
return Mage::getBaseDir('media') . DS . 'catalog' . DS . 'product' . DS . $attributeImagePath;
|
20 |
+
}
|
21 |
+
|
22 |
+
/**
|
23 |
+
* Get the full image url by attribute path saved
|
24 |
+
*
|
25 |
+
* @param string $attributeImagePath
|
26 |
+
* @return string
|
27 |
+
*/
|
28 |
+
public function getFullImageUrl($attributeImagePath)
|
29 |
+
{
|
30 |
+
return Mage::getBaseUrl('media') . 'catalog/product/' . $attributeImagePath;
|
31 |
+
}
|
32 |
+
|
33 |
+
}
|
app/code/community/Auguria/InteractiveImage/Model/Catalog/Product/Attribute/Backend/Image.php
ADDED
@@ -0,0 +1,94 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category Auguria
|
4 |
+
* @package Auguria_Core
|
5 |
+
* @author Auguria
|
6 |
+
* @license http://opensource.org/licenses/gpl-3.0.html GNU General Public License version 3 (GPLv3)
|
7 |
+
*/
|
8 |
+
|
9 |
+
class Auguria_InteractiveImage_Model_Catalog_Product_Attribute_Backend_Image extends Auguria_Core_Model_Attribute_Backend_Image_Abstract
|
10 |
+
{
|
11 |
+
/**
|
12 |
+
* Default format/value for the attribute
|
13 |
+
*
|
14 |
+
* @var array
|
15 |
+
*/
|
16 |
+
protected $_defaultValue = array('image_path' => '', 'areas' => array());
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Save uploaded file
|
20 |
+
*
|
21 |
+
* @param Varien_Object $object
|
22 |
+
*/
|
23 |
+
public function afterSave($object)
|
24 |
+
{
|
25 |
+
$value = $object->getData($this->getAttribute()->getName());
|
26 |
+
|
27 |
+
if (is_array($value)) {
|
28 |
+
if(!empty($value['delete'])){ // delete : save default value
|
29 |
+
$object->setData($this->getAttribute()->getName(), Mage::helper('core')->jsonEncode($this->_defaultValue));
|
30 |
+
$this->getAttribute()->getEntity()
|
31 |
+
->saveAttribute($object, $this->getAttribute()->getName());
|
32 |
+
return;
|
33 |
+
}
|
34 |
+
|
35 |
+
try {
|
36 |
+
// upload image
|
37 |
+
if(!isset($value['value']) || !file_exists($this->_getPathWithoutPrefix() . $value['value'])){
|
38 |
+
$uploader = new Mage_Core_Model_File_Uploader($this->getAttribute()->getName());
|
39 |
+
$uploader->setAllowedExtensions(array('jpg','jpeg','gif','png'));
|
40 |
+
$uploader->setAllowRenameFiles(true);
|
41 |
+
$result = $uploader->save($this->_getPath());
|
42 |
+
|
43 |
+
$value['image_path'] = $this->_getPrefix() . $result['file']; // update image path
|
44 |
+
}else{
|
45 |
+
$value['image_path'] = $value['value'];
|
46 |
+
}
|
47 |
+
|
48 |
+
$object->setData($this->getAttribute()->getName(), Mage::helper('core')->jsonEncode($value));
|
49 |
+
$this->getAttribute()->getEntity()->saveAttribute($object, $this->getAttribute()->getName()); // save attribute
|
50 |
+
} catch (Exception $e) {
|
51 |
+
if ($e->getCode() != Mage_Core_Model_File_Uploader::TMP_NAME_EMPTY) {
|
52 |
+
Mage::logException($e);
|
53 |
+
}
|
54 |
+
|
55 |
+
return;
|
56 |
+
}
|
57 |
+
}else{ // save default value
|
58 |
+
$object->setData($this->getAttribute()->getName(), Mage::helper('core')->jsonEncode($this->_defaultValue));
|
59 |
+
$this->getAttribute()->getEntity()
|
60 |
+
->saveAttribute($object, $this->getAttribute()->getName());
|
61 |
+
return;
|
62 |
+
}
|
63 |
+
}
|
64 |
+
|
65 |
+
/**
|
66 |
+
* Get path to save file
|
67 |
+
*
|
68 |
+
* @return string
|
69 |
+
*/
|
70 |
+
protected function _getPath()
|
71 |
+
{
|
72 |
+
return Mage::getBaseDir('media') . DS . 'catalog' . DS . 'product' . DS . 'auguria' . DS . 'interactiveimage' . DS;
|
73 |
+
}
|
74 |
+
|
75 |
+
/**
|
76 |
+
* Get prefix when save path file in attribute value
|
77 |
+
*
|
78 |
+
* @return string
|
79 |
+
*/
|
80 |
+
protected function _getPrefix()
|
81 |
+
{
|
82 |
+
return 'auguria' . DS . 'interactiveimage' . DS;
|
83 |
+
}
|
84 |
+
|
85 |
+
/**
|
86 |
+
* Get path without prefix
|
87 |
+
*
|
88 |
+
* @return string
|
89 |
+
*/
|
90 |
+
protected function _getPathWithoutPrefix()
|
91 |
+
{
|
92 |
+
return Mage::getBaseDir('media') . DS . 'catalog' . DS . 'product' . DS;
|
93 |
+
}
|
94 |
+
}
|
app/code/community/Auguria/InteractiveImage/controllers/Adminhtml/Auguria/InteractiveImage/ImageController.php
ADDED
@@ -0,0 +1,111 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category Auguria
|
4 |
+
* @package Auguria_InteractiveImage
|
5 |
+
* @author Auguria
|
6 |
+
* @license http://opensource.org/licenses/gpl-3.0.html GNU General Public License version 3 (GPLv3)
|
7 |
+
*/
|
8 |
+
class Auguria_InteractiveImage_Adminhtml_Auguria_InteractiveImage_ImageController extends Mage_Adminhtml_Controller_Action
|
9 |
+
{
|
10 |
+
/**
|
11 |
+
* Additional initialization
|
12 |
+
*
|
13 |
+
*/
|
14 |
+
protected function _construct()
|
15 |
+
{
|
16 |
+
$this->setUsedModuleName('Auguria_InteractiveImage');
|
17 |
+
}
|
18 |
+
|
19 |
+
/**
|
20 |
+
* Display popin and canvas with image background and image dimensions
|
21 |
+
*/
|
22 |
+
public function displayAction()
|
23 |
+
{
|
24 |
+
$response = array('error' => false, 'messages' => array(), 'content' => '');
|
25 |
+
$params = Mage::helper('core')->jsonDecode($this->getRequest()->getParam('interactive_image', ''));
|
26 |
+
|
27 |
+
$fullImagePath = Mage::helper('auguria_interactiveimage')->getFullImagePath($params['image_path']);
|
28 |
+
$fullImageUrl = Mage::helper('auguria_interactiveimage')->getFullImageUrl($params['image_path']);
|
29 |
+
|
30 |
+
try {
|
31 |
+
if(file_exists($fullImagePath)){
|
32 |
+
$this->loadLayout(); // init layout messages
|
33 |
+
|
34 |
+
if(!is_array($params['areas'])){
|
35 |
+
$params['areas'] = Mage::helper('core')->jsonDecode($params['areas']);
|
36 |
+
}
|
37 |
+
|
38 |
+
$params['image_url'] = $fullImageUrl; // add full image path to params
|
39 |
+
$response['content'] = $this->getLayout()->getBlock('interactive.image.popin')->setParams($params)->toHtml();
|
40 |
+
}else{
|
41 |
+
Mage::throwException($this->__('Image not found.'));
|
42 |
+
}
|
43 |
+
} catch (Exception $e) {
|
44 |
+
$response['error'] = true;
|
45 |
+
$this->_getSession()->addException($e, $this->__('Error while loading edition interface.'));
|
46 |
+
}
|
47 |
+
|
48 |
+
if($response['error']){
|
49 |
+
// if success messages called in template
|
50 |
+
$response['messages'][Mage_Core_Model_Message::ERROR] = $this->_getSession()->getMessages(true)->getItemsByType(Mage_Core_Model_Message::ERROR); // clear messages
|
51 |
+
}
|
52 |
+
|
53 |
+
$this->getResponse()->setBody(Mage::helper('core')->jsonEncode($response));
|
54 |
+
}
|
55 |
+
|
56 |
+
/**
|
57 |
+
* Get Panel Tab html
|
58 |
+
*/
|
59 |
+
public function createPanelTabAction()
|
60 |
+
{
|
61 |
+
$response = array('error' => false, 'messages' => array(), 'content' => '');
|
62 |
+
$area = Mage::helper('core')->jsonDecode($this->getRequest()->getParam('area', ''));
|
63 |
+
|
64 |
+
try {
|
65 |
+
if($area){
|
66 |
+
$this->loadLayout(); // init layout messages
|
67 |
+
|
68 |
+
$response['content'] = $this->getLayout()->getBlock('interactive.image.panel.areas')->getAreaHtml($area);
|
69 |
+
}else{
|
70 |
+
Mage::throwException($this->__('Area does not exixsts.'));
|
71 |
+
}
|
72 |
+
} catch (Exception $e) {
|
73 |
+
$response['error'] = true;
|
74 |
+
$this->_getSession()->addException($e, $this->__('Error while adding area.'));
|
75 |
+
}
|
76 |
+
|
77 |
+
if($response['error']){
|
78 |
+
// if success messages called in template
|
79 |
+
$response['messages'][Mage_Core_Model_Message::ERROR] = $this->_getSession()->getMessages(true)->getItemsByType(Mage_Core_Model_Message::ERROR); // clear messages
|
80 |
+
}
|
81 |
+
|
82 |
+
$this->getResponse()->setBody(Mage::helper('core')->jsonEncode($response));
|
83 |
+
}
|
84 |
+
|
85 |
+
/**
|
86 |
+
* Save form values
|
87 |
+
*/
|
88 |
+
public function saveAction()
|
89 |
+
{
|
90 |
+
$response = array('error' => false, 'messages' => array(), 'content' => '');
|
91 |
+
$areas = $this->getRequest()->getParam('areas', null);
|
92 |
+
|
93 |
+
try {
|
94 |
+
if($areas){
|
95 |
+
$response['content'] = Mage::helper('core')->jsonEncode($areas);
|
96 |
+
}else{
|
97 |
+
Mage::throwException($this->__('Areas does not exixsts.'));
|
98 |
+
}
|
99 |
+
} catch (Exception $e) {
|
100 |
+
$response['error'] = true;
|
101 |
+
$this->_getSession()->addException($e, $this->__('Error while saving areas.'));
|
102 |
+
}
|
103 |
+
|
104 |
+
if($response['error']){
|
105 |
+
// if success messages called in template
|
106 |
+
$response['messages'][Mage_Core_Model_Message::ERROR] = $this->_getSession()->getMessages(true)->getItemsByType(Mage_Core_Model_Message::ERROR); // clear messages
|
107 |
+
}
|
108 |
+
|
109 |
+
$this->getResponse()->setBody(Mage::helper('core')->jsonEncode($response));
|
110 |
+
}
|
111 |
+
}
|
app/code/community/Auguria/InteractiveImage/controllers/Checkout/Cart/AjaxController.php
ADDED
@@ -0,0 +1,164 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category Auguria
|
4 |
+
* @package Auguria_InteractiveImage
|
5 |
+
* @author Auguria
|
6 |
+
* @license http://opensource.org/licenses/gpl-3.0.html GNU General Public License version 3 (GPLv3)
|
7 |
+
*/
|
8 |
+
|
9 |
+
class Auguria_InteractiveImage_Checkout_Cart_AjaxController extends Mage_Core_Controller_Front_Action
|
10 |
+
{
|
11 |
+
/**
|
12 |
+
* Retrieve shopping cart model object
|
13 |
+
*
|
14 |
+
* @return Mage_Checkout_Model_Cart
|
15 |
+
*/
|
16 |
+
protected function _getCart()
|
17 |
+
{
|
18 |
+
return Mage::getSingleton('checkout/cart');
|
19 |
+
}
|
20 |
+
|
21 |
+
/**
|
22 |
+
* Get checkout session model instance
|
23 |
+
*
|
24 |
+
* @return Mage_Checkout_Model_Session
|
25 |
+
*/
|
26 |
+
protected function _getSession()
|
27 |
+
{
|
28 |
+
return Mage::getSingleton('checkout/session');
|
29 |
+
}
|
30 |
+
|
31 |
+
/**
|
32 |
+
* Set back redirect url to response
|
33 |
+
*
|
34 |
+
* @return Mage_Checkout_CartController
|
35 |
+
*/
|
36 |
+
protected function _goBack()
|
37 |
+
{
|
38 |
+
$returnUrl = $this->getRequest()->getParam('return_url');
|
39 |
+
if ($returnUrl) {
|
40 |
+
|
41 |
+
if (!$this->_isUrlInternal($returnUrl)) {
|
42 |
+
throw new Mage_Exception('External urls redirect to "' . $returnUrl . '" denied!');
|
43 |
+
}
|
44 |
+
|
45 |
+
$this->_getSession()->getMessages(true);
|
46 |
+
$this->getResponse()->setRedirect($returnUrl);
|
47 |
+
} elseif (!Mage::getStoreConfig('checkout/cart/redirect_to_cart')
|
48 |
+
&& !$this->getRequest()->getParam('in_cart')
|
49 |
+
&& $backUrl = $this->_getRefererUrl()
|
50 |
+
) {
|
51 |
+
$this->getResponse()->setRedirect($backUrl);
|
52 |
+
} else {
|
53 |
+
if (($this->getRequest()->getActionName() == 'add') && !$this->getRequest()->getParam('in_cart')) {
|
54 |
+
$this->_getSession()->setContinueShoppingUrl($this->_getRefererUrl());
|
55 |
+
}
|
56 |
+
$this->_redirect('checkout/cart');
|
57 |
+
}
|
58 |
+
return $this;
|
59 |
+
}
|
60 |
+
|
61 |
+
/**
|
62 |
+
* Initialize product instance from request data
|
63 |
+
*
|
64 |
+
* @param int $productId
|
65 |
+
* @return Mage_Catalog_Model_Product || false
|
66 |
+
*/
|
67 |
+
protected function _initProduct($productId)
|
68 |
+
{
|
69 |
+
if ($productId) {
|
70 |
+
$product = Mage::getModel('catalog/product')
|
71 |
+
->setStoreId(Mage::app()->getStore()->getId())
|
72 |
+
->load($productId);
|
73 |
+
if ($product->getId()) {
|
74 |
+
return $product;
|
75 |
+
}
|
76 |
+
}
|
77 |
+
return false;
|
78 |
+
}
|
79 |
+
|
80 |
+
/**
|
81 |
+
* Add product to shopping cart action
|
82 |
+
*/
|
83 |
+
public function addAction()
|
84 |
+
{
|
85 |
+
$cart = $this->_getCart();
|
86 |
+
$params = $this->getRequest()->getParams();
|
87 |
+
|
88 |
+
try {
|
89 |
+
|
90 |
+
foreach($params['products'] as $_child){
|
91 |
+
|
92 |
+
// get required params to add in cart
|
93 |
+
$_child['uenc'] = $params['uenc'];
|
94 |
+
|
95 |
+
if (isset($_child['qty'])) {
|
96 |
+
$filter = new Zend_Filter_LocalizedToNormalized(
|
97 |
+
array('locale' => Mage::app()->getLocale()->getLocaleCode())
|
98 |
+
);
|
99 |
+
$_child['qty'] = $filter->filter($_child['qty']);
|
100 |
+
}
|
101 |
+
|
102 |
+
if(!array_key_exists('qty', $_child) || $_child['qty'] == 0){
|
103 |
+
continue; // check qty
|
104 |
+
}
|
105 |
+
|
106 |
+
$product = $this->_initProduct($_child['product']);
|
107 |
+
|
108 |
+
/**
|
109 |
+
* Check product availability
|
110 |
+
*/
|
111 |
+
if (!$product) {
|
112 |
+
$this->_goBack();
|
113 |
+
return;
|
114 |
+
}
|
115 |
+
|
116 |
+
$related = $this->getRequest()->getParam('related_product');
|
117 |
+
|
118 |
+
$cart->addProduct($product, $_child);
|
119 |
+
if (!empty($related)) {
|
120 |
+
$cart->addProductsByIds(explode(',', $related));
|
121 |
+
}
|
122 |
+
}
|
123 |
+
|
124 |
+
$cart->save();
|
125 |
+
|
126 |
+
$this->_getSession()->setCartWasUpdated(true);
|
127 |
+
|
128 |
+
/**
|
129 |
+
* @todo remove wishlist observer processAddToCart
|
130 |
+
*/
|
131 |
+
Mage::dispatchEvent('checkout_cart_add_product_complete',
|
132 |
+
array('product' => $product, 'request' => $this->getRequest(), 'response' => $this->getResponse())
|
133 |
+
);
|
134 |
+
|
135 |
+
if (!$this->_getSession()->getNoCartRedirect(true)) {
|
136 |
+
if (!$cart->getQuote()->getHasError()){
|
137 |
+
$message = $this->__('%s was added to your shopping cart.', Mage::helper('core')->escapeHtml($product->getName()));
|
138 |
+
$this->_getSession()->addSuccess($message);
|
139 |
+
}
|
140 |
+
$this->_goBack();
|
141 |
+
}
|
142 |
+
} catch (Mage_Core_Exception $e) {
|
143 |
+
if ($this->_getSession()->getUseNotice(true)) {
|
144 |
+
$this->_getSession()->addNotice(Mage::helper('core')->escapeHtml($e->getMessage()));
|
145 |
+
} else {
|
146 |
+
$messages = array_unique(explode("\n", $e->getMessage()));
|
147 |
+
foreach ($messages as $message) {
|
148 |
+
$this->_getSession()->addError(Mage::helper('core')->escapeHtml($message));
|
149 |
+
}
|
150 |
+
}
|
151 |
+
|
152 |
+
$url = $this->_getSession()->getRedirectUrl(true);
|
153 |
+
if ($url) {
|
154 |
+
$this->getResponse()->setRedirect($url);
|
155 |
+
} else {
|
156 |
+
$this->_redirectReferer(Mage::helper('checkout/cart')->getCartUrl());
|
157 |
+
}
|
158 |
+
} catch (Exception $e) {
|
159 |
+
$this->_getSession()->addException($e, $this->__('Cannot add the item to shopping cart.'));
|
160 |
+
Mage::logException($e);
|
161 |
+
$this->_goBack();
|
162 |
+
}
|
163 |
+
}
|
164 |
+
}
|
app/code/community/Auguria/InteractiveImage/controllers/Checkout/CartController.php
ADDED
@@ -0,0 +1,164 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category Auguria
|
4 |
+
* @package Auguria_InteractiveImage
|
5 |
+
* @author Auguria
|
6 |
+
* @license http://opensource.org/licenses/gpl-3.0.html GNU General Public License version 3 (GPLv3)
|
7 |
+
*/
|
8 |
+
|
9 |
+
class Auguria_InteractiveImage_Checkout_CartController extends Mage_Core_Controller_Front_Action
|
10 |
+
{
|
11 |
+
/**
|
12 |
+
* Retrieve shopping cart model object
|
13 |
+
*
|
14 |
+
* @return Mage_Checkout_Model_Cart
|
15 |
+
*/
|
16 |
+
protected function _getCart()
|
17 |
+
{
|
18 |
+
return Mage::getSingleton('checkout/cart');
|
19 |
+
}
|
20 |
+
|
21 |
+
/**
|
22 |
+
* Get checkout session model instance
|
23 |
+
*
|
24 |
+
* @return Mage_Checkout_Model_Session
|
25 |
+
*/
|
26 |
+
protected function _getSession()
|
27 |
+
{
|
28 |
+
return Mage::getSingleton('checkout/session');
|
29 |
+
}
|
30 |
+
|
31 |
+
/**
|
32 |
+
* Set back redirect url to response
|
33 |
+
*
|
34 |
+
* @return Mage_Checkout_CartController
|
35 |
+
*/
|
36 |
+
protected function _goBack()
|
37 |
+
{
|
38 |
+
$returnUrl = $this->getRequest()->getParam('return_url');
|
39 |
+
if ($returnUrl) {
|
40 |
+
|
41 |
+
if (!$this->_isUrlInternal($returnUrl)) {
|
42 |
+
throw new Mage_Exception('External urls redirect to "' . $returnUrl . '" denied!');
|
43 |
+
}
|
44 |
+
|
45 |
+
$this->_getSession()->getMessages(true);
|
46 |
+
$this->getResponse()->setRedirect($returnUrl);
|
47 |
+
} elseif (!Mage::getStoreConfig('checkout/cart/redirect_to_cart')
|
48 |
+
&& !$this->getRequest()->getParam('in_cart')
|
49 |
+
&& $backUrl = $this->_getRefererUrl()
|
50 |
+
) {
|
51 |
+
$this->getResponse()->setRedirect($backUrl);
|
52 |
+
} else {
|
53 |
+
if (($this->getRequest()->getActionName() == 'add') && !$this->getRequest()->getParam('in_cart')) {
|
54 |
+
$this->_getSession()->setContinueShoppingUrl($this->_getRefererUrl());
|
55 |
+
}
|
56 |
+
$this->_redirect('checkout/cart');
|
57 |
+
}
|
58 |
+
return $this;
|
59 |
+
}
|
60 |
+
|
61 |
+
/**
|
62 |
+
* Initialize product instance from request data
|
63 |
+
*
|
64 |
+
* @param int $productId
|
65 |
+
* @return Mage_Catalog_Model_Product || false
|
66 |
+
*/
|
67 |
+
protected function _initProduct($productId)
|
68 |
+
{
|
69 |
+
if ($productId) {
|
70 |
+
$product = Mage::getModel('catalog/product')
|
71 |
+
->setStoreId(Mage::app()->getStore()->getId())
|
72 |
+
->load($productId);
|
73 |
+
if ($product->getId()) {
|
74 |
+
return $product;
|
75 |
+
}
|
76 |
+
}
|
77 |
+
return false;
|
78 |
+
}
|
79 |
+
|
80 |
+
/**
|
81 |
+
* Add product to shopping cart action
|
82 |
+
*/
|
83 |
+
public function addAction()
|
84 |
+
{
|
85 |
+
$cart = $this->_getCart();
|
86 |
+
$params = $this->getRequest()->getParams();
|
87 |
+
|
88 |
+
try {
|
89 |
+
|
90 |
+
foreach($params['products'] as $_child){
|
91 |
+
|
92 |
+
// get required params to add in cart
|
93 |
+
$_child['uenc'] = $params['uenc'];
|
94 |
+
|
95 |
+
if (isset($_child['qty'])) {
|
96 |
+
$filter = new Zend_Filter_LocalizedToNormalized(
|
97 |
+
array('locale' => Mage::app()->getLocale()->getLocaleCode())
|
98 |
+
);
|
99 |
+
$_child['qty'] = $filter->filter($_child['qty']);
|
100 |
+
}
|
101 |
+
|
102 |
+
if(!array_key_exists('qty', $_child) || $_child['qty'] == 0){
|
103 |
+
continue; // check qty
|
104 |
+
}
|
105 |
+
|
106 |
+
$product = $this->_initProduct($_child['product']);
|
107 |
+
|
108 |
+
/**
|
109 |
+
* Check product availability
|
110 |
+
*/
|
111 |
+
if (!$product) {
|
112 |
+
$this->_goBack();
|
113 |
+
return;
|
114 |
+
}
|
115 |
+
|
116 |
+
$related = $this->getRequest()->getParam('related_product');
|
117 |
+
|
118 |
+
$cart->addProduct($product, $_child);
|
119 |
+
if (!empty($related)) {
|
120 |
+
$cart->addProductsByIds(explode(',', $related));
|
121 |
+
}
|
122 |
+
}
|
123 |
+
|
124 |
+
$cart->save();
|
125 |
+
|
126 |
+
$this->_getSession()->setCartWasUpdated(true);
|
127 |
+
|
128 |
+
/**
|
129 |
+
* @todo remove wishlist observer processAddToCart
|
130 |
+
*/
|
131 |
+
Mage::dispatchEvent('checkout_cart_add_product_complete',
|
132 |
+
array('product' => $product, 'request' => $this->getRequest(), 'response' => $this->getResponse())
|
133 |
+
);
|
134 |
+
|
135 |
+
if (!$this->_getSession()->getNoCartRedirect(true)) {
|
136 |
+
if (!$cart->getQuote()->getHasError()){
|
137 |
+
$message = $this->__('%s was added to your shopping cart.', Mage::helper('core')->escapeHtml($product->getName()));
|
138 |
+
$this->_getSession()->addSuccess($message);
|
139 |
+
}
|
140 |
+
$this->_goBack();
|
141 |
+
}
|
142 |
+
} catch (Mage_Core_Exception $e) {
|
143 |
+
if ($this->_getSession()->getUseNotice(true)) {
|
144 |
+
$this->_getSession()->addNotice(Mage::helper('core')->escapeHtml($e->getMessage()));
|
145 |
+
} else {
|
146 |
+
$messages = array_unique(explode("\n", $e->getMessage()));
|
147 |
+
foreach ($messages as $message) {
|
148 |
+
$this->_getSession()->addError(Mage::helper('core')->escapeHtml($message));
|
149 |
+
}
|
150 |
+
}
|
151 |
+
|
152 |
+
$url = $this->_getSession()->getRedirectUrl(true);
|
153 |
+
if ($url) {
|
154 |
+
$this->getResponse()->setRedirect($url);
|
155 |
+
} else {
|
156 |
+
$this->_redirectReferer(Mage::helper('checkout/cart')->getCartUrl());
|
157 |
+
}
|
158 |
+
} catch (Exception $e) {
|
159 |
+
$this->_getSession()->addException($e, $this->__('Cannot add the item to shopping cart.'));
|
160 |
+
Mage::logException($e);
|
161 |
+
$this->_goBack();
|
162 |
+
}
|
163 |
+
}
|
164 |
+
}
|
app/code/community/Auguria/InteractiveImage/etc/adminhtml.xml
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* @category Auguria
|
5 |
+
* @package Auguria_InteractiveImage
|
6 |
+
* @author Auguria
|
7 |
+
* @license http://opensource.org/licenses/gpl-3.0.html GNU General Public License version 3 (GPLv3)
|
8 |
+
*/
|
9 |
+
-->
|
10 |
+
<config>
|
11 |
+
<acl>
|
12 |
+
<resources>
|
13 |
+
<admin>
|
14 |
+
<children>
|
15 |
+
<system>
|
16 |
+
<children>
|
17 |
+
<config>
|
18 |
+
<children>
|
19 |
+
<auguria_interactiveimage translate="title" module="auguria_interactiveimage">
|
20 |
+
<title>Auguria interactive image</title>
|
21 |
+
</auguria_interactiveimage>
|
22 |
+
</children>
|
23 |
+
</config>
|
24 |
+
</children>
|
25 |
+
</system>
|
26 |
+
</children>
|
27 |
+
</admin>
|
28 |
+
</resources>
|
29 |
+
</acl>
|
30 |
+
</config>
|
app/code/community/Auguria/InteractiveImage/etc/config.xml
ADDED
@@ -0,0 +1,111 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* @category Auguria
|
5 |
+
* @package Auguria_InteractiveImage
|
6 |
+
* @author Auguria
|
7 |
+
* @license http://opensource.org/licenses/gpl-3.0.html GNU General Public License version 3 (GPLv3)
|
8 |
+
*/
|
9 |
+
-->
|
10 |
+
<config>
|
11 |
+
|
12 |
+
<modules>
|
13 |
+
<Auguria_InteractiveImage>
|
14 |
+
<version>0.0.1</version>
|
15 |
+
</Auguria_InteractiveImage>
|
16 |
+
</modules>
|
17 |
+
|
18 |
+
<global>
|
19 |
+
<resources>
|
20 |
+
<auguria_interactiveimage_setup>
|
21 |
+
<setup>
|
22 |
+
<module>Auguria_InteractiveImage</module>
|
23 |
+
<class>Mage_Catalog_Model_Resource_Setup</class>
|
24 |
+
</setup>
|
25 |
+
</auguria_interactiveimage_setup>
|
26 |
+
</resources>
|
27 |
+
<blocks>
|
28 |
+
<auguria_interactiveimage>
|
29 |
+
<class>Auguria_InteractiveImage_Block</class>
|
30 |
+
</auguria_interactiveimage>
|
31 |
+
</blocks>
|
32 |
+
<helpers>
|
33 |
+
<auguria_interactiveimage>
|
34 |
+
<class>Auguria_InteractiveImage_Helper</class>
|
35 |
+
</auguria_interactiveimage>
|
36 |
+
</helpers>
|
37 |
+
<models>
|
38 |
+
<auguria_interactiveimage>
|
39 |
+
<class>Auguria_InteractiveImage_Model</class>
|
40 |
+
</auguria_interactiveimage>
|
41 |
+
</models>
|
42 |
+
</global>
|
43 |
+
|
44 |
+
<frontend>
|
45 |
+
<routers>
|
46 |
+
<auguria_interactiveimage>
|
47 |
+
<use>standard</use>
|
48 |
+
<args>
|
49 |
+
<module>Auguria_InteractiveImage</module>
|
50 |
+
<frontName>image</frontName>
|
51 |
+
</args>
|
52 |
+
</auguria_interactiveimage>
|
53 |
+
</routers>
|
54 |
+
<layout>
|
55 |
+
<updates>
|
56 |
+
<auguria_interactiveimage>
|
57 |
+
<file>auguria/interactive_image.xml</file>
|
58 |
+
</auguria_interactiveimage>
|
59 |
+
</updates>
|
60 |
+
</layout>
|
61 |
+
<translate>
|
62 |
+
<modules>
|
63 |
+
<Auguria_InteractiveImage>
|
64 |
+
<files>
|
65 |
+
<default>Auguria_InteractiveImage.csv</default>
|
66 |
+
</files>
|
67 |
+
</Auguria_InteractiveImage>
|
68 |
+
</modules>
|
69 |
+
</translate>
|
70 |
+
</frontend>
|
71 |
+
|
72 |
+
<admin>
|
73 |
+
<routers>
|
74 |
+
<adminhtml>
|
75 |
+
<args>
|
76 |
+
<modules>
|
77 |
+
<auguria_interactiveimage before="Mage_Adminhtml">Auguria_InteractiveImage_Adminhtml</auguria_interactiveimage>
|
78 |
+
</modules>
|
79 |
+
</args>
|
80 |
+
</adminhtml>
|
81 |
+
</routers>
|
82 |
+
</admin>
|
83 |
+
|
84 |
+
<adminhtml>
|
85 |
+
<layout>
|
86 |
+
<updates>
|
87 |
+
<auguria_interactiveimage>
|
88 |
+
<file>auguria/interactive_image.xml</file>
|
89 |
+
</auguria_interactiveimage>
|
90 |
+
</updates>
|
91 |
+
</layout>
|
92 |
+
<translate>
|
93 |
+
<modules>
|
94 |
+
<Auguria_InteractiveImage>
|
95 |
+
<files>
|
96 |
+
<default>Auguria_InteractiveImage.csv</default>
|
97 |
+
</files>
|
98 |
+
</Auguria_InteractiveImage>
|
99 |
+
</modules>
|
100 |
+
</translate>
|
101 |
+
</adminhtml>
|
102 |
+
|
103 |
+
<default>
|
104 |
+
<auguria_interactiveimage>
|
105 |
+
<general>
|
106 |
+
<use_ajax>0</use_ajax>
|
107 |
+
</general>
|
108 |
+
</auguria_interactiveimage>
|
109 |
+
</default>
|
110 |
+
|
111 |
+
</config>
|
app/code/community/Auguria/InteractiveImage/etc/jstranslator.xml
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* @category Auguria
|
5 |
+
* @package Auguria_InteractiveImage
|
6 |
+
* @author Auguria
|
7 |
+
* @license http://opensource.org/licenses/gpl-3.0.html GNU General Public License version 3 (GPLv3)
|
8 |
+
*/
|
9 |
+
-->
|
10 |
+
<jstranslator>
|
11 |
+
<alert-display-image-url-undefined translate="message" module="auguria_interactiveimage">
|
12 |
+
<message>Complete</message>
|
13 |
+
</alert-display-image-url-undefined>
|
14 |
+
</jstranslator>
|
app/code/community/Auguria/InteractiveImage/etc/system.xml
ADDED
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<!--
|
2 |
+
/**
|
3 |
+
* @category Auguria
|
4 |
+
* @package Auguria_InteractiveImage
|
5 |
+
* @author Auguria
|
6 |
+
* @license http://opensource.org/licenses/gpl-3.0.html GNU General Public License version 3 (GPLv3)
|
7 |
+
*/
|
8 |
+
-->
|
9 |
+
<config>
|
10 |
+
<sections>
|
11 |
+
<auguria_interactiveimage translate="label" module="auguria_interactiveimage">
|
12 |
+
<label>Interactive image</label>
|
13 |
+
<tab>auguria</tab>
|
14 |
+
<header_css>auguria-header</header_css>
|
15 |
+
<frontend_type>text</frontend_type>
|
16 |
+
<sort_order>300</sort_order>
|
17 |
+
<show_in_default>1</show_in_default>
|
18 |
+
<show_in_website>1</show_in_website>
|
19 |
+
<show_in_store>0</show_in_store>
|
20 |
+
<groups>
|
21 |
+
<general translate="label">
|
22 |
+
<label>General</label>
|
23 |
+
<frontend_type>text</frontend_type>
|
24 |
+
<sort_order>1</sort_order>
|
25 |
+
<show_in_default>1</show_in_default>
|
26 |
+
<show_in_website>1</show_in_website>
|
27 |
+
<show_in_store>0</show_in_store>
|
28 |
+
<fields>
|
29 |
+
<use_ajax translate="label comment">
|
30 |
+
<label>Use ajax for adding product to cart</label>
|
31 |
+
<comment>Module Auguria_CartAjax must be enabled</comment>
|
32 |
+
<frontend_type>select</frontend_type>
|
33 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
34 |
+
<sort_order>1</sort_order>
|
35 |
+
<show_in_default>1</show_in_default>
|
36 |
+
<show_in_website>1</show_in_website>
|
37 |
+
<show_in_store>0</show_in_store>
|
38 |
+
<if_module_enabled>Auguria_CartAjax</if_module_enabled>
|
39 |
+
</use_ajax>
|
40 |
+
</fields>
|
41 |
+
</general>
|
42 |
+
</groups>
|
43 |
+
</auguria_interactiveimage>
|
44 |
+
</sections>
|
45 |
+
</config>
|
app/code/community/Auguria/InteractiveImage/sql/auguria_interactiveimage_setup/install-0.0.1.php
ADDED
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category Auguria
|
4 |
+
* @package Auguria_InteractiveImage
|
5 |
+
* @author Auguria
|
6 |
+
* @license http://opensource.org/licenses/gpl-3.0.html GNU General Public License version 3 (GPLv3)
|
7 |
+
*/
|
8 |
+
|
9 |
+
/* @var $this Mage_Catalog_Model_Resource_Setup */
|
10 |
+
|
11 |
+
// Create new attribute group ( render attribute element correctly )
|
12 |
+
$entityTypeId = $this->getEntityTypeId('catalog_product');
|
13 |
+
|
14 |
+
// add group for each existing attribute set
|
15 |
+
$attributeSets = $this->_conn->fetchAll('select * from '.$this->getTable('eav/attribute_set').' where entity_type_id=?', $entityTypeId);
|
16 |
+
foreach ($attributeSets as $attributeSet) {
|
17 |
+
$setId = $attributeSet['attribute_set_id'];
|
18 |
+
$this->addAttributeGroup($entityTypeId, $setId, 'Interactive image');
|
19 |
+
}
|
20 |
+
|
21 |
+
// auguria_matrix_active : define if the matrix can be displayed on the product view page
|
22 |
+
$this->addAttribute(Mage_Catalog_Model_Product::ENTITY, 'auguria_interactiveimage_image', array(
|
23 |
+
'group' => 'Interactive image',
|
24 |
+
'type' => 'text',
|
25 |
+
'backend' => 'auguria_interactiveimage/catalog_product_attribute_backend_image',
|
26 |
+
'frontend' => '',
|
27 |
+
'label' => 'Interactive image',
|
28 |
+
'input' => 'image',
|
29 |
+
'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
|
30 |
+
'visible' => true,
|
31 |
+
'required' => false,
|
32 |
+
'user_defined' => false,
|
33 |
+
'default' => '',
|
34 |
+
'input_renderer' => 'auguria_interactiveimage/adminhtml_catalog_product_helper_form_image_interactive',
|
35 |
+
'visible_on_front' => false,
|
36 |
+
'used_in_product_listing' => true
|
37 |
+
));
|
app/design/adminhtml/default/default/layout/auguria/interactive_image.xml
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* @category Auguria
|
5 |
+
* @package Auguria_InteractiveImage
|
6 |
+
* @author Auguria
|
7 |
+
* @license http://opensource.org/licenses/gpl-3.0.html GNU General Public License version 3 (GPLv3)
|
8 |
+
*/
|
9 |
+
-->
|
10 |
+
|
11 |
+
<layout>
|
12 |
+
|
13 |
+
<adminhtml_catalog_product_edit>
|
14 |
+
<reference name="head">
|
15 |
+
<action method="addJs"><link>auguria/interactiveimage/kinetic-v4.5.4.min.js</link></action>
|
16 |
+
<action method="addJs"><link>auguria/interactiveimage/image.js</link></action>
|
17 |
+
<action method="addCss"><link>auguria/interactiveimage/image.css</link></action>
|
18 |
+
</reference>
|
19 |
+
</adminhtml_catalog_product_edit>
|
20 |
+
|
21 |
+
<adminhtml_auguria_interactiveimage_image_display>
|
22 |
+
<reference name="content">
|
23 |
+
<block type="auguria_interactiveimage/adminhtml_catalog_product_helper_form_image_interactive_popin" name="interactive.image.popin" template="auguria/interactiveimage/catalog/product/helper/form/image/interactive/popin.phtml">
|
24 |
+
<block type="auguria_interactiveimage/adminhtml_catalog_product_helper_form_image_interactive_panel_areas" name="interactive.image.panel.areas" template="auguria/interactiveimage/catalog/product/helper/form/image/interactive/panel/areas.phtml">
|
25 |
+
</block>
|
26 |
+
</block>
|
27 |
+
</reference>
|
28 |
+
</adminhtml_auguria_interactiveimage_image_display>
|
29 |
+
|
30 |
+
<adminhtml_auguria_interactiveimage_image_createpaneltab>
|
31 |
+
<block type="auguria_interactiveimage/adminhtml_catalog_product_helper_form_image_interactive_panel_areas" name="interactive.image.panel.areas" template="auguria/interactiveimage/catalog/product/helper/form/image/interactive/panel/areas.phtml">
|
32 |
+
</block>
|
33 |
+
</adminhtml_auguria_interactiveimage_image_createpaneltab>
|
34 |
+
|
35 |
+
</layout>
|
app/design/adminhtml/default/default/template/auguria/interactiveimage/catalog/product/helper/form/image/interactive/panel/area/default.phtml
ADDED
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category Auguria
|
4 |
+
* @package Auguria_InteractiveImage
|
5 |
+
* @author Auguria
|
6 |
+
* @license http://opensource.org/licenses/gpl-3.0.html GNU General Public License version 3 (GPLv3)
|
7 |
+
*/
|
8 |
+
|
9 |
+
/* @var $this Auguria_InteractiveImage_Block_Adminhtml_Catalog_Product_Helper_Form_Image_Interactive_Panel_Area_Default */
|
10 |
+
?>
|
11 |
+
<?php
|
12 |
+
$area = $this->getInteractiveArea();
|
13 |
+
?>
|
14 |
+
|
15 |
+
<fieldset id="fieldset-<?php echo $area['id']?>" class="area">
|
16 |
+
<input type="hidden" name="areas[<?php echo $area['id']?>][id]" value="<?php echo $area['id']?>">
|
17 |
+
<input type="hidden" name="areas[<?php echo $area['id']?>][size][x]" value="<?php echo $area['size']['x']?>">
|
18 |
+
<input type="hidden" name="areas[<?php echo $area['id']?>][size][y]" value="<?php echo $area['size']['y']?>">
|
19 |
+
<input type="hidden" name="areas[<?php echo $area['id']?>][size][width]" value="<?php echo $area['size']['width']?>">
|
20 |
+
<input type="hidden" name="areas[<?php echo $area['id']?>][size][height]" value="<?php echo $area['size']['height']?>">
|
21 |
+
<input type="hidden" name="areas[<?php echo $area['id']?>][type]" value="<?php echo $area['type']?>">
|
22 |
+
<input type="hidden" name="areas[<?php echo $area['id']?>][color]" value="<?php echo $area['color']?>">
|
23 |
+
<input type="hidden" name="areas[<?php echo $area['id']?>][render]" value="<?php echo $area['render']?>">
|
24 |
+
<label>
|
25 |
+
<?php echo $this->__('Position')?>
|
26 |
+
<input type="text" name="areas[<?php echo $area['id']?>][position]" value="<?php echo isset($area['position']) ? $area['position'] : '' ?>">
|
27 |
+
</label>
|
28 |
+
<label>
|
29 |
+
<?php echo $this->__('Product Sku')?>
|
30 |
+
<input type="text" name="areas[<?php echo $area['id']?>][sku]" value="<?php echo isset($area['sku']) ? $area['sku'] : '' ?>">
|
31 |
+
</label>
|
32 |
+
<label>
|
33 |
+
<?php $value = isset($area['hilight_area']) ? $area['hilight_area'] : '0' ?>
|
34 |
+
|
35 |
+
<?php echo $this->__('Hilight area on frontend')?>
|
36 |
+
<select name="areas[<?php echo $area['id']?>][hilight_area]">
|
37 |
+
<option value="0" <?php echo $value == '0' ? 'selected="selected"' : ''?>><?php echo $this->__('No')?></option>
|
38 |
+
<option value="1" <?php echo $value == '1' ? 'selected="selected"' : ''?>><?php echo $this->__('Yes')?></option>
|
39 |
+
</select>
|
40 |
+
</label>
|
41 |
+
|
42 |
+
<div class="clear"></div>
|
43 |
+
<button type="button" class="button button-delete" onclick="interactiveImage.deleteArea('<?php echo $area['id']?>');"><?php echo $this->__('Delete')?></button>
|
44 |
+
</fieldset>
|
45 |
+
|
46 |
+
<hr>
|
app/design/adminhtml/default/default/template/auguria/interactiveimage/catalog/product/helper/form/image/interactive/panel/areas.phtml
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category Auguria
|
4 |
+
* @package Auguria_InteractiveImage
|
5 |
+
* @author Auguria
|
6 |
+
* @license http://opensource.org/licenses/gpl-3.0.html GNU General Public License version 3 (GPLv3)
|
7 |
+
*/
|
8 |
+
|
9 |
+
/* @var $this Auguria_InteractiveImage_Block_Adminhtml_Catalog_Product_Helper_Form_Image_Interactive_Panel_Areas */
|
10 |
+
?>
|
11 |
+
<?php
|
12 |
+
$areas = $this->getAreas();
|
13 |
+
?>
|
14 |
+
|
15 |
+
<div class="buttons">
|
16 |
+
<button class="button btn-clear" type="button" onclick="interactiveImage.clear();">
|
17 |
+
<span><span><?php echo $this->__('Clear')?></span></span>
|
18 |
+
</button>
|
19 |
+
</div>
|
20 |
+
|
21 |
+
<?php if(count($areas) > 0):?>
|
22 |
+
<?php foreach($areas as $_area):?>
|
23 |
+
<?php echo $this->getAreaHtml($_area)?>
|
24 |
+
<?php endforeach;?>
|
25 |
+
<?php endif;?>
|
app/design/adminhtml/default/default/template/auguria/interactiveimage/catalog/product/helper/form/image/interactive/popin.phtml
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category Auguria
|
4 |
+
* @package Auguria_InteractiveImage
|
5 |
+
* @author Auguria
|
6 |
+
* @license http://opensource.org/licenses/gpl-3.0.html GNU General Public License version 3 (GPLv3)
|
7 |
+
*/
|
8 |
+
|
9 |
+
/* @var $this Auguria_InteractiveImage_Block_Adminhtml_Catalog_Product_Helper_Form_Image_Interactive_Popin */
|
10 |
+
?>
|
11 |
+
<?php
|
12 |
+
$image = $this->getImage();
|
13 |
+
$params = $this->getParams();
|
14 |
+
?>
|
15 |
+
<div class="popin interactive-image">
|
16 |
+
<?php echo $this->getMessagesBlock()->setMessages(Mage::getSingleton('adminhtml/session')->getMessages(true))->getGroupedHtml(); ?>
|
17 |
+
|
18 |
+
<div id="interactive-image-canvas" style="width:<?php echo $image['size'][0]?>px;height:<?php echo $image['size'][1]?>px;background-image: url('<?php echo $image['url']?>');" ></div>
|
19 |
+
<div id="interactive-image-panel" style="width:300px;">
|
20 |
+
<form id="interactive-image-form">
|
21 |
+
<?php if(isset($params['areas'])):?>
|
22 |
+
<?php echo $this->getChild('interactive.image.panel.areas')->setAreas($params['areas'])->tohtml()?>
|
23 |
+
<?php endif;?>
|
24 |
+
</form>
|
25 |
+
</div>
|
26 |
+
|
27 |
+
<div class="buttons">
|
28 |
+
<button class="button btn-close" type="button" onclick="interactiveImage.close();">
|
29 |
+
<span><span><?php echo $this->__('Close')?></span></span>
|
30 |
+
</button>
|
31 |
+
<button class="button btn-save" type="button" onclick="interactiveImage.save();">
|
32 |
+
<span><span><?php echo $this->__('Save')?></span></span>
|
33 |
+
</button>
|
34 |
+
</div>
|
35 |
+
</div>
|
app/design/frontend/base/default/layout/auguria/interactive_image.xml
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* @category Auguria
|
5 |
+
* @package Auguria_InteractiveImage
|
6 |
+
* @author Auguria
|
7 |
+
* @license http://opensource.org/licenses/gpl-3.0.html GNU General Public License version 3 (GPLv3)
|
8 |
+
*/
|
9 |
+
-->
|
10 |
+
<layout version="0.1.0">
|
11 |
+
|
12 |
+
<catalog_product_view>
|
13 |
+
<reference name="head">
|
14 |
+
<action method="addJs"><link>auguria/interactiveimage/jquery-1.10.2.min.js</link></action>
|
15 |
+
<action method="addJs"><link>auguria/interactiveimage/jquery.maphilight.min.js</link></action>
|
16 |
+
<action method="addJs"><link>auguria/interactiveimage/cart.js</link></action>
|
17 |
+
<action method="addCss"><link>css/auguria/interactiveimage/image.css</link></action>
|
18 |
+
</reference>
|
19 |
+
<reference name="product.info.additional">
|
20 |
+
<block type="auguria_interactiveimage/catalog_product_image" name="auguria.interactiveimage.catalog.product.image">
|
21 |
+
<action method="setTemplate"><template>auguria/interactiveimage/catalog/product/image.phtml</template></action>
|
22 |
+
</block>
|
23 |
+
</reference>
|
24 |
+
</catalog_product_view>
|
25 |
+
|
26 |
+
</layout>
|
app/design/frontend/base/default/template/auguria/interactiveimage/catalog/product/image.phtml
ADDED
@@ -0,0 +1,126 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category Auguria
|
4 |
+
* @package Auguria_InteractiveImage
|
5 |
+
* @author Auguria
|
6 |
+
* @license http://opensource.org/licenses/gpl-3.0.html GNU General Public License version 3 (GPLv3)
|
7 |
+
*/
|
8 |
+
|
9 |
+
/* @var $this Auguria_InteractiveImage_Block_Catalog_Product_Image */
|
10 |
+
?>
|
11 |
+
<?php
|
12 |
+
$imageUrl = $this->getInteractiveImage();
|
13 |
+
$useAjax = Mage::helper('auguria_interactiveimage/config')->useAjax();
|
14 |
+
?>
|
15 |
+
|
16 |
+
<?php if($imageUrl):?>
|
17 |
+
|
18 |
+
<?php
|
19 |
+
$areas = $this->getAreas();
|
20 |
+
$products = $this->getProducts();
|
21 |
+
?>
|
22 |
+
<div class="box box-collateral">
|
23 |
+
<h2>
|
24 |
+
<?php echo $this->__('Interactive image') ?>
|
25 |
+
</h2>
|
26 |
+
<div class="std">
|
27 |
+
<div class="interactive-container">
|
28 |
+
<img id="interactiveimage" src="<?php echo $imageUrl ?>" alt=""
|
29 |
+
usemap="#interactiveimage" />
|
30 |
+
|
31 |
+
<?php if(count($areas)):?>
|
32 |
+
<map name="interactiveimage" id="map-interactiveimage">
|
33 |
+
<?php foreach($areas as $_area):?>
|
34 |
+
<?php
|
35 |
+
$_coords = $this->getCoords($_area);
|
36 |
+
$_product = $this->getProductBySku($_area['sku']);
|
37 |
+
?>
|
38 |
+
|
39 |
+
<?php if($_product): ?>
|
40 |
+
<area id="area-position-<?php echo $_area['id']?>"
|
41 |
+
shape="<?php echo $_area['type']?>"
|
42 |
+
coords="<?php echo $_coords['area']?>"
|
43 |
+
href="<?php echo $this->getAddToCartUrl($_area['sku'])?>"
|
44 |
+
alt="<?php echo $_area['sku']?>"
|
45 |
+
<?php echo $useAjax ? 'onclick="cartajax.submitInline(this, ' . Mage::helper('auguria_cartajax')->getAjaxParams($_area['sku']) . ');return false;"' : '' ?>
|
46 |
+
data-maphilight='<?php echo isset($_area['hilight_area']) && $_area['hilight_area'] ? '{"alwaysOn":true, "neverOn":false}' : '' ?>'>
|
47 |
+
|
48 |
+
<div id="tooltip-area-position-<?php echo $_area['id']?>" class="tooltip" style="display:none;top:<?php echo $_coords['tooltip']['top']?>px;left:<?php echo $_coords['tooltip']['left']?>px;">
|
49 |
+
<div class="sku">
|
50 |
+
<?php echo $_product->getSku()?>
|
51 |
+
</div>
|
52 |
+
<div class="name">
|
53 |
+
<?php echo $_product->getName()?>
|
54 |
+
</div>
|
55 |
+
<div class="price">
|
56 |
+
<?php echo $_product->getFormatedPrice()?>
|
57 |
+
</div>
|
58 |
+
</div>
|
59 |
+
<?php endif; ?>
|
60 |
+
<?php endforeach;?>
|
61 |
+
</map>
|
62 |
+
|
63 |
+
<form action="<?php echo $this->getMassAddToCartUrl() ?>"
|
64 |
+
method="post" id="image_addtocart_form">
|
65 |
+
|
66 |
+
<table id="interactiveimage-product-list"
|
67 |
+
class="interactiveimage-product-list data-table">
|
68 |
+
<caption></caption>
|
69 |
+
<thead>
|
70 |
+
<tr>
|
71 |
+
<th><?php echo $this->__('Position')?></th>
|
72 |
+
<th><?php echo $this->__('Reference')?></th>
|
73 |
+
<th><?php echo $this->__('Designation')?></th>
|
74 |
+
<th><?php echo $this->__('Unit price')?></th>
|
75 |
+
<th><?php echo $this->__('Qty')?></th>
|
76 |
+
</tr>
|
77 |
+
</thead>
|
78 |
+
<tfoot>
|
79 |
+
</tfoot>
|
80 |
+
<tbody id="interactiveimage-product-list-body">
|
81 |
+
<?php foreach($products as $_product):?>
|
82 |
+
<?php /* @var $_product Mage_Catalog_Model_Product */ ?>
|
83 |
+
<tr>
|
84 |
+
<td><?php echo $this->getPositionBySku($_product->getSku())?></td>
|
85 |
+
<td><?php echo $_product->getSku()?></td>
|
86 |
+
<td><?php echo $_product->getName()?></td>
|
87 |
+
<td><?php echo $_product->getFormatedPrice()?></td>
|
88 |
+
<td><input type="hidden"
|
89 |
+
name="products[<?php echo $_product->getId()?>][product]"
|
90 |
+
value="<?php echo $_product->getId()?>" /> <input type="text"
|
91 |
+
name="products[<?php echo $_product->getId()?>][qty]" value="0" />
|
92 |
+
</td>
|
93 |
+
</tr>
|
94 |
+
<?php endforeach;?>
|
95 |
+
</tbody>
|
96 |
+
</table>
|
97 |
+
|
98 |
+
<div class="no-display">
|
99 |
+
<input type="hidden" name="related_product"
|
100 |
+
id="related-products-field" value="" />
|
101 |
+
</div>
|
102 |
+
|
103 |
+
<button class="button btn-cart"
|
104 |
+
title="<?php echo $this->__('Add to Cart')?>" type="submit"
|
105 |
+
<?php echo $useAjax ? 'onclick="productAddToCartForm.submit(this);return false;"' : '' ?>>
|
106 |
+
<span><span><?php echo $this->__('Add to Cart')?> </span> </span>
|
107 |
+
</button>
|
108 |
+
|
109 |
+
</form>
|
110 |
+
|
111 |
+
<script type="text/javascript">
|
112 |
+
jQuery('#interactiveimage').maphilight({neverOn:true,fillColor:'00D2FF',strokeColor:'000000'});
|
113 |
+
jQuery(document).ready(function() {
|
114 |
+
jQuery('area').mouseover(function() {
|
115 |
+
jQuery('#tooltip-' + this.id).toggle();
|
116 |
+
});
|
117 |
+
jQuery('area').mouseout(function() {
|
118 |
+
jQuery('#tooltip-' + this.id).toggle();
|
119 |
+
});
|
120 |
+
});
|
121 |
+
</script>
|
122 |
+
<?php endif;?>
|
123 |
+
</div>
|
124 |
+
</div>
|
125 |
+
</div>
|
126 |
+
<?php endif;?>
|
app/etc/modules/Auguria_InteractiveImage.xml
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* @category Auguria
|
5 |
+
* @package Auguria_InteractiveImage
|
6 |
+
* @author Auguria
|
7 |
+
* @license http://opensource.org/licenses/gpl-3.0.html GNU General Public License version 3 (GPLv3)
|
8 |
+
*/
|
9 |
+
-->
|
10 |
+
<config>
|
11 |
+
<modules>
|
12 |
+
<Auguria_InteractiveImage>
|
13 |
+
<active>true</active>
|
14 |
+
<codePool>community</codePool>
|
15 |
+
<depends>
|
16 |
+
<Auguria_Core />
|
17 |
+
</depends>
|
18 |
+
</Auguria_InteractiveImage>
|
19 |
+
</modules>
|
20 |
+
</config>
|
app/locale/en_US/Auguria_InteractiveImage.csv
ADDED
File without changes
|
app/locale/fr_FR/Auguria_InteractiveImage.csv
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
"Interactive image","Image interactive"
|
2 |
+
"Use ajax for adding product to cart","Utiliser l'ajax (popin) pour l'ajout au panier"
|
3 |
+
"Module Auguria_CartAjax must be enabled","Le module Auguria_CartAjax doit être activé"
|
4 |
+
"Define areas","Définir les zones"
|
5 |
+
"Clear","Tout supprimer"
|
6 |
+
"Position","Position"
|
7 |
+
"Product Sku","Sku du produit"
|
8 |
+
"Hilight area on frontend","Afficher le contour de la zone en front"
|
9 |
+
"Delete","Supprimer"
|
10 |
+
"Close","Fermer"
|
11 |
+
"Save","Sauvegarder"
|
12 |
+
"Products","Produits"
|
13 |
+
"Designation","Désignation"
|
14 |
+
"Qty","Qté"
|
js/auguria/interactiveimage/cart.js
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
InteractiveImage = Class.create();
|
2 |
+
InteractiveImage.prototype = {
|
3 |
+
|
4 |
+
initialize: function(){
|
5 |
+
|
6 |
+
},
|
7 |
+
|
8 |
+
addToCart: function(sku){
|
9 |
+
|
10 |
+
}
|
11 |
+
}
|
js/auguria/interactiveimage/image.js
ADDED
@@ -0,0 +1,357 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
InteractiveImage = Class.create();
|
2 |
+
InteractiveImage.prototype = {
|
3 |
+
|
4 |
+
initialize: function(imgUrl, config){
|
5 |
+
|
6 |
+
if(config == undefined){
|
7 |
+
alert(Translator.translate('Image path is not defined. Upload the image (choose image path and save product) then define areas (and save again).'));
|
8 |
+
return false;
|
9 |
+
}
|
10 |
+
|
11 |
+
// by config
|
12 |
+
this.imgUrl = imgUrl;
|
13 |
+
this.imagePath = config.image_path;
|
14 |
+
|
15 |
+
var areas = {};
|
16 |
+
if(config.areas){var areas = JSON.parse(config.areas);}
|
17 |
+
this.originAreas = areas;
|
18 |
+
this.areas = areas;
|
19 |
+
|
20 |
+
// base
|
21 |
+
this.popin = null;
|
22 |
+
this.types = {rect: 'rect'}
|
23 |
+
this.formId = 'interactive-image-form';
|
24 |
+
|
25 |
+
// canvas
|
26 |
+
this.canvasId = 'interactive-image-canvas';
|
27 |
+
this.canvasWidth = null;
|
28 |
+
this.canvasHeight = null;
|
29 |
+
|
30 |
+
this.stage = null;
|
31 |
+
this.currentArea = null;
|
32 |
+
|
33 |
+
// control panel
|
34 |
+
this.panelId = 'interactive-image-panel';
|
35 |
+
this.panel = $(this.panelId);
|
36 |
+
},
|
37 |
+
|
38 |
+
// display popin for edition (areas definitions)
|
39 |
+
display: function(){
|
40 |
+
if(this.imagePath == undefined){
|
41 |
+
alert(Translator.translate('Image path is not defined. Upload the image (choose image path and save product) then define areas (and save again).'));
|
42 |
+
return false;
|
43 |
+
}
|
44 |
+
|
45 |
+
var _self = this;
|
46 |
+
|
47 |
+
// informations used for edition interface
|
48 |
+
var params = {
|
49 |
+
'image_path': this.imagePath,
|
50 |
+
'areas': this.areas
|
51 |
+
}
|
52 |
+
|
53 |
+
this.initImage(); // get canvas/image dimensions
|
54 |
+
|
55 |
+
new Ajax.Request('/admin/auguria_interactiveImage_image/display', {
|
56 |
+
parameters: {
|
57 |
+
'interactive_image': Object.toJSON(params),
|
58 |
+
},
|
59 |
+
onSuccess: function(transport) {
|
60 |
+
var response = transport.responseText.evalJSON(true);
|
61 |
+
|
62 |
+
if(response.error){
|
63 |
+
alert('error');
|
64 |
+
}else{
|
65 |
+
if(response.content){
|
66 |
+
_self.popin = Dialog.info(response.content, {
|
67 |
+
closable: true,
|
68 |
+
resizable: true,
|
69 |
+
draggable: true,
|
70 |
+
className: 'magento',
|
71 |
+
windowClassName: 'popup-window',
|
72 |
+
width: 'auto',
|
73 |
+
height: 'auto',
|
74 |
+
top: 0, // fix top position with largest images (draggable popin)
|
75 |
+
zIndex: 1000,
|
76 |
+
recenterAuto: false,
|
77 |
+
hideEffect: Element.hide,
|
78 |
+
showEffect: Element.show,
|
79 |
+
id: 'interactive-image-popin',
|
80 |
+
destroyOnClose: true
|
81 |
+
});
|
82 |
+
}
|
83 |
+
|
84 |
+
_self.initCanvas();
|
85 |
+
_self.initAreas();
|
86 |
+
}
|
87 |
+
}
|
88 |
+
});
|
89 |
+
},
|
90 |
+
|
91 |
+
// init image/canvas dimensions
|
92 |
+
initImage: function(){
|
93 |
+
var img = new Image();
|
94 |
+
img.src = this.imgUrl;
|
95 |
+
this.canvasWidth = img.width;
|
96 |
+
this.canvasHeight = img.height;
|
97 |
+
},
|
98 |
+
|
99 |
+
// clear areas
|
100 |
+
clear: function(){
|
101 |
+
this.stage.clear(); // layers
|
102 |
+
// DOM
|
103 |
+
$$('#' + this.formId + ' fieldset').each(function(elem){
|
104 |
+
elem.remove();
|
105 |
+
});
|
106 |
+
this.areas = this.originAreas;
|
107 |
+
},
|
108 |
+
|
109 |
+
// close generated popin
|
110 |
+
close: function(){
|
111 |
+
if(this.popin != null){
|
112 |
+
// this.areas = this.originAreas;
|
113 |
+
this.popin.close();
|
114 |
+
}
|
115 |
+
|
116 |
+
return false;
|
117 |
+
},
|
118 |
+
|
119 |
+
// save areas
|
120 |
+
save: function(){
|
121 |
+
var _self = this;
|
122 |
+
|
123 |
+
new Ajax.Request('/admin/auguria_interactiveImage_image/save', {
|
124 |
+
parameters: $(this.formId).serialize(true),
|
125 |
+
onSuccess: function(transport) {
|
126 |
+
var response = transport.responseText.evalJSON(true);
|
127 |
+
|
128 |
+
if(response.error){
|
129 |
+
alert('error');
|
130 |
+
}else{
|
131 |
+
$('auguria_interactiveimage_image_areas').setValue(response.content);
|
132 |
+
_self.areas = JSON.parse(response.content);
|
133 |
+
alert('saved');
|
134 |
+
}
|
135 |
+
}
|
136 |
+
});
|
137 |
+
},
|
138 |
+
|
139 |
+
// init canvas
|
140 |
+
initCanvas: function(){
|
141 |
+
_self = this;
|
142 |
+
|
143 |
+
this.stage = new Kinetic.Stage({
|
144 |
+
container: this.canvasId,
|
145 |
+
width: this.canvasWidth,
|
146 |
+
height: this.canvasHeight
|
147 |
+
});
|
148 |
+
|
149 |
+
document.getElementById(this.canvasId).addEventListener('mousedown', function(){_self.mouseDown(_self)});
|
150 |
+
},
|
151 |
+
|
152 |
+
mouseDown: function(_self){
|
153 |
+
var mousePos = _self.stage.getMousePosition();
|
154 |
+
|
155 |
+
if(document.body.style.cursor != 'pointer'){
|
156 |
+
_self.draw = true;
|
157 |
+
_self.initCurrentArea({type: _self.types.rect, x:mousePos.x, y:mousePos.y});
|
158 |
+
|
159 |
+
var mouseMove = _self.mouseMove(_self);
|
160 |
+
document.getElementById(this.canvasId).addEventListener('mousemove', mouseMove, false);
|
161 |
+
|
162 |
+
var mouseUp = _self.mouseUp(_self);
|
163 |
+
document.getElementById(this.canvasId).addEventListener('mouseup', mouseUp, false);
|
164 |
+
}
|
165 |
+
},
|
166 |
+
|
167 |
+
mouseUp: function(_self){
|
168 |
+
var handler = function(event){
|
169 |
+
_self.createArea(_self.currentArea);
|
170 |
+
_self.createPanelTab(_self.currentArea);
|
171 |
+
|
172 |
+
// var mouseMove = _self.mouseMove(_self);
|
173 |
+
// document.getElementById(_self.canvasId).removeEventListener('mousemove', mouseMove, false);
|
174 |
+
|
175 |
+
document.getElementById(_self.canvasId).removeEventListener('mouseup', arguments.callee, false);
|
176 |
+
|
177 |
+
_self.draw = false;
|
178 |
+
}
|
179 |
+
|
180 |
+
return handler;
|
181 |
+
},
|
182 |
+
|
183 |
+
mouseMove: function(_self){
|
184 |
+
var handler = function(event){
|
185 |
+
if(!_self.draw){
|
186 |
+
document.getElementById(_self.canvasId).removeEventListener('mousemove', arguments.callee, false);
|
187 |
+
}
|
188 |
+
|
189 |
+
var mousePos = _self.stage.getMousePosition();
|
190 |
+
|
191 |
+
// rect
|
192 |
+
if(_self.currentArea.type == _self.types.rect){
|
193 |
+
_self.currentArea.size.width = mousePos.x - _self.currentArea.size.x;
|
194 |
+
_self.currentArea.size.height = mousePos.y - _self.currentArea.size.y;
|
195 |
+
}
|
196 |
+
}
|
197 |
+
|
198 |
+
return handler;
|
199 |
+
},
|
200 |
+
|
201 |
+
// init existing areas
|
202 |
+
initAreas: function(){
|
203 |
+
var _self = this;
|
204 |
+
|
205 |
+
for (var i in _self.areas) {
|
206 |
+
if (_self.areas.hasOwnProperty(i)) {
|
207 |
+
_self.createArea(_self.areas[i]);
|
208 |
+
}
|
209 |
+
}
|
210 |
+
|
211 |
+
$('auguria_interactiveimage_image_areas').setValue(Object.toJSON(_self.areas));
|
212 |
+
},
|
213 |
+
|
214 |
+
initCurrentArea: function(params){
|
215 |
+
if(params.type == this.types.rect){
|
216 |
+
|
217 |
+
var areaKeys = Object.keys(this.areas);
|
218 |
+
if(areaKeys.length > 0){
|
219 |
+
var id = areaKeys[areaKeys.length - 1];
|
220 |
+
id = parseInt(id) + 1;
|
221 |
+
}else{
|
222 |
+
var id = 0;
|
223 |
+
}
|
224 |
+
|
225 |
+
this.currentArea = {
|
226 |
+
type: params.type,
|
227 |
+
color:'#00D2FF',
|
228 |
+
size: {
|
229 |
+
x: params.x,
|
230 |
+
y: params.y,
|
231 |
+
width: 0,
|
232 |
+
height: 0
|
233 |
+
},
|
234 |
+
render: 'default',
|
235 |
+
id: id,
|
236 |
+
}
|
237 |
+
}
|
238 |
+
},
|
239 |
+
|
240 |
+
// create defined area
|
241 |
+
createArea: function(area){
|
242 |
+
_self = this;
|
243 |
+
var layer = new Kinetic.Layer();
|
244 |
+
|
245 |
+
if(area.type == this.types.rect){
|
246 |
+
var box = new Kinetic.Rect({
|
247 |
+
x: parseFloat(area.size.x),
|
248 |
+
y: parseFloat(area.size.y),
|
249 |
+
width: parseFloat(area.size.width),
|
250 |
+
height: parseFloat(area.size.height),
|
251 |
+
fill: area.color,
|
252 |
+
stroke: 'black',
|
253 |
+
strokeWidth: 1,
|
254 |
+
opacity: 0.6,
|
255 |
+
draggable: true,
|
256 |
+
dragBoundFunc: function(pos) {
|
257 |
+
// x
|
258 |
+
var newX = pos.x < 0 ? 0 : pos.x;
|
259 |
+
var newX = newX > _self.canvasWidth - area.size.width ? _self.canvasWidth - area.size.width : newX;
|
260 |
+
// y
|
261 |
+
var newY = pos.y < 0 ? 0 : pos.y;
|
262 |
+
var newY = newY > _self.canvasHeight - area.size.height ? _self.canvasHeight - area.size.height : newY;
|
263 |
+
|
264 |
+
return {
|
265 |
+
x: newX,
|
266 |
+
y: newY
|
267 |
+
};
|
268 |
+
}
|
269 |
+
});
|
270 |
+
}
|
271 |
+
|
272 |
+
if(!this.areas.hasOwnProperty(area.id)){
|
273 |
+
this.areas[area.id] = area;
|
274 |
+
}
|
275 |
+
|
276 |
+
this.areas[area.id].layer = layer;
|
277 |
+
this.appendEvents(box, area);
|
278 |
+
|
279 |
+
layer.add(box);
|
280 |
+
this.stage.add(layer);
|
281 |
+
},
|
282 |
+
|
283 |
+
// delete existing area
|
284 |
+
deleteArea: function(areaId){
|
285 |
+
this.areas[areaId].layer.destroy(); // remove layer
|
286 |
+
delete this.areas[areaId];
|
287 |
+
|
288 |
+
$('fieldset-' + areaId).remove(); // remove from DOM
|
289 |
+
},
|
290 |
+
|
291 |
+
// define events
|
292 |
+
appendEvents: function(box, area){
|
293 |
+
_self = this;
|
294 |
+
|
295 |
+
// add cursor styling
|
296 |
+
box.on('mouseover', function() {
|
297 |
+
_self.draw = false;
|
298 |
+
document.body.style.cursor = 'pointer';
|
299 |
+
});
|
300 |
+
box.on('mouseout', function() {
|
301 |
+
document.body.style.cursor = 'default';
|
302 |
+
});
|
303 |
+
box.on('click', function() {
|
304 |
+
_self.draw = false;
|
305 |
+
_self.focusArea(area, box);
|
306 |
+
});
|
307 |
+
box.on('dragend', function() {
|
308 |
+
_self.draw = false;
|
309 |
+
_self.dragArea(area, box);
|
310 |
+
});
|
311 |
+
},
|
312 |
+
|
313 |
+
focusArea: function(area, box = null){
|
314 |
+
// clean active filedsets
|
315 |
+
$$('#' + this.formId + ' fieldset').each(function(elem){
|
316 |
+
elem.removeClassName('active');
|
317 |
+
});
|
318 |
+
|
319 |
+
if(box){
|
320 |
+
box.stroke = 'red';
|
321 |
+
}
|
322 |
+
$('fieldset-' + area.id).addClassName('active');
|
323 |
+
},
|
324 |
+
|
325 |
+
dragArea: function(area, box = null){
|
326 |
+
if(box){
|
327 |
+
$$('#' + this.formId + ' [name="areas[' + area.id + '][size][x]"]').first().value = parseInt(box.attrs.x);
|
328 |
+
$$('#' + this.formId + ' [name="areas[' + area.id + '][size][y]"]').first().value = parseInt(box.attrs.y);
|
329 |
+
|
330 |
+
area.size.x = parseInt(box.attrs.x);
|
331 |
+
area.size.y = parseInt(box.attrs.y);
|
332 |
+
}
|
333 |
+
},
|
334 |
+
|
335 |
+
createPanelTab: function(area){
|
336 |
+
_self = this;
|
337 |
+
|
338 |
+
new Ajax.Request('/admin/auguria_interactiveImage_image/createPanelTab', {
|
339 |
+
parameters: {
|
340 |
+
'area': Object.toJSON(area),
|
341 |
+
},
|
342 |
+
onSuccess: function(transport) {
|
343 |
+
var response = transport.responseText.evalJSON(true);
|
344 |
+
|
345 |
+
if(response.error){
|
346 |
+
alert('error');
|
347 |
+
}else{
|
348 |
+
if(response.content){
|
349 |
+
$('interactive-image-form').insert(response.content);
|
350 |
+
_self.focusArea(area);
|
351 |
+
}
|
352 |
+
}
|
353 |
+
}
|
354 |
+
});
|
355 |
+
}
|
356 |
+
|
357 |
+
}
|
js/auguria/interactiveimage/jquery-1.10.2.min.js
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*! jQuery v1.10.2 | (c) 2005, 2013 jQuery Foundation, Inc. | jquery.org/license
|
2 |
+
//@ sourceMappingURL=jquery-1.10.2.min.map
|
3 |
+
*/
|
4 |
+
(function(e,t){var n,r,i=typeof t,o=e.location,a=e.document,s=a.documentElement,l=e.jQuery,u=e.$,c={},p=[],f="1.10.2",d=p.concat,h=p.push,g=p.slice,m=p.indexOf,y=c.toString,v=c.hasOwnProperty,b=f.trim,x=function(e,t){return new x.fn.init(e,t,r)},w=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,T=/\S+/g,C=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,N=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,k=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,E=/^[\],:{}\s]*$/,S=/(?:^|:|,)(?:\s*\[)+/g,A=/\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,j=/"[^"\\\r\n]*"|true|false|null|-?(?:\d+\.|)\d+(?:[eE][+-]?\d+|)/g,D=/^-ms-/,L=/-([\da-z])/gi,H=function(e,t){return t.toUpperCase()},q=function(e){(a.addEventListener||"load"===e.type||"complete"===a.readyState)&&(_(),x.ready())},_=function(){a.addEventListener?(a.removeEventListener("DOMContentLoaded",q,!1),e.removeEventListener("load",q,!1)):(a.detachEvent("onreadystatechange",q),e.detachEvent("onload",q))};x.fn=x.prototype={jquery:f,constructor:x,init:function(e,n,r){var i,o;if(!e)return this;if("string"==typeof e){if(i="<"===e.charAt(0)&&">"===e.charAt(e.length-1)&&e.length>=3?[null,e,null]:N.exec(e),!i||!i[1]&&n)return!n||n.jquery?(n||r).find(e):this.constructor(n).find(e);if(i[1]){if(n=n instanceof x?n[0]:n,x.merge(this,x.parseHTML(i[1],n&&n.nodeType?n.ownerDocument||n:a,!0)),k.test(i[1])&&x.isPlainObject(n))for(i in n)x.isFunction(this[i])?this[i](n[i]):this.attr(i,n[i]);return this}if(o=a.getElementById(i[2]),o&&o.parentNode){if(o.id!==i[2])return r.find(e);this.length=1,this[0]=o}return this.context=a,this.selector=e,this}return e.nodeType?(this.context=this[0]=e,this.length=1,this):x.isFunction(e)?r.ready(e):(e.selector!==t&&(this.selector=e.selector,this.context=e.context),x.makeArray(e,this))},selector:"",length:0,toArray:function(){return g.call(this)},get:function(e){return null==e?this.toArray():0>e?this[this.length+e]:this[e]},pushStack:function(e){var t=x.merge(this.constructor(),e);return t.prevObject=this,t.context=this.context,t},each:function(e,t){return x.each(this,e,t)},ready:function(e){return x.ready.promise().done(e),this},slice:function(){return this.pushStack(g.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(e){var t=this.length,n=+e+(0>e?t:0);return this.pushStack(n>=0&&t>n?[this[n]]:[])},map:function(e){return this.pushStack(x.map(this,function(t,n){return e.call(t,n,t)}))},end:function(){return this.prevObject||this.constructor(null)},push:h,sort:[].sort,splice:[].splice},x.fn.init.prototype=x.fn,x.extend=x.fn.extend=function(){var e,n,r,i,o,a,s=arguments[0]||{},l=1,u=arguments.length,c=!1;for("boolean"==typeof s&&(c=s,s=arguments[1]||{},l=2),"object"==typeof s||x.isFunction(s)||(s={}),u===l&&(s=this,--l);u>l;l++)if(null!=(o=arguments[l]))for(i in o)e=s[i],r=o[i],s!==r&&(c&&r&&(x.isPlainObject(r)||(n=x.isArray(r)))?(n?(n=!1,a=e&&x.isArray(e)?e:[]):a=e&&x.isPlainObject(e)?e:{},s[i]=x.extend(c,a,r)):r!==t&&(s[i]=r));return s},x.extend({expando:"jQuery"+(f+Math.random()).replace(/\D/g,""),noConflict:function(t){return e.$===x&&(e.$=u),t&&e.jQuery===x&&(e.jQuery=l),x},isReady:!1,readyWait:1,holdReady:function(e){e?x.readyWait++:x.ready(!0)},ready:function(e){if(e===!0?!--x.readyWait:!x.isReady){if(!a.body)return setTimeout(x.ready);x.isReady=!0,e!==!0&&--x.readyWait>0||(n.resolveWith(a,[x]),x.fn.trigger&&x(a).trigger("ready").off("ready"))}},isFunction:function(e){return"function"===x.type(e)},isArray:Array.isArray||function(e){return"array"===x.type(e)},isWindow:function(e){return null!=e&&e==e.window},isNumeric:function(e){return!isNaN(parseFloat(e))&&isFinite(e)},type:function(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?c[y.call(e)]||"object":typeof e},isPlainObject:function(e){var n;if(!e||"object"!==x.type(e)||e.nodeType||x.isWindow(e))return!1;try{if(e.constructor&&!v.call(e,"constructor")&&!v.call(e.constructor.prototype,"isPrototypeOf"))return!1}catch(r){return!1}if(x.support.ownLast)for(n in e)return v.call(e,n);for(n in e);return n===t||v.call(e,n)},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},error:function(e){throw Error(e)},parseHTML:function(e,t,n){if(!e||"string"!=typeof e)return null;"boolean"==typeof t&&(n=t,t=!1),t=t||a;var r=k.exec(e),i=!n&&[];return r?[t.createElement(r[1])]:(r=x.buildFragment([e],t,i),i&&x(i).remove(),x.merge([],r.childNodes))},parseJSON:function(n){return e.JSON&&e.JSON.parse?e.JSON.parse(n):null===n?n:"string"==typeof n&&(n=x.trim(n),n&&E.test(n.replace(A,"@").replace(j,"]").replace(S,"")))?Function("return "+n)():(x.error("Invalid JSON: "+n),t)},parseXML:function(n){var r,i;if(!n||"string"!=typeof n)return null;try{e.DOMParser?(i=new DOMParser,r=i.parseFromString(n,"text/xml")):(r=new ActiveXObject("Microsoft.XMLDOM"),r.async="false",r.loadXML(n))}catch(o){r=t}return r&&r.documentElement&&!r.getElementsByTagName("parsererror").length||x.error("Invalid XML: "+n),r},noop:function(){},globalEval:function(t){t&&x.trim(t)&&(e.execScript||function(t){e.eval.call(e,t)})(t)},camelCase:function(e){return e.replace(D,"ms-").replace(L,H)},nodeName:function(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()},each:function(e,t,n){var r,i=0,o=e.length,a=M(e);if(n){if(a){for(;o>i;i++)if(r=t.apply(e[i],n),r===!1)break}else for(i in e)if(r=t.apply(e[i],n),r===!1)break}else if(a){for(;o>i;i++)if(r=t.call(e[i],i,e[i]),r===!1)break}else for(i in e)if(r=t.call(e[i],i,e[i]),r===!1)break;return e},trim:b&&!b.call("\ufeff\u00a0")?function(e){return null==e?"":b.call(e)}:function(e){return null==e?"":(e+"").replace(C,"")},makeArray:function(e,t){var n=t||[];return null!=e&&(M(Object(e))?x.merge(n,"string"==typeof e?[e]:e):h.call(n,e)),n},inArray:function(e,t,n){var r;if(t){if(m)return m.call(t,e,n);for(r=t.length,n=n?0>n?Math.max(0,r+n):n:0;r>n;n++)if(n in t&&t[n]===e)return n}return-1},merge:function(e,n){var r=n.length,i=e.length,o=0;if("number"==typeof r)for(;r>o;o++)e[i++]=n[o];else while(n[o]!==t)e[i++]=n[o++];return e.length=i,e},grep:function(e,t,n){var r,i=[],o=0,a=e.length;for(n=!!n;a>o;o++)r=!!t(e[o],o),n!==r&&i.push(e[o]);return i},map:function(e,t,n){var r,i=0,o=e.length,a=M(e),s=[];if(a)for(;o>i;i++)r=t(e[i],i,n),null!=r&&(s[s.length]=r);else for(i in e)r=t(e[i],i,n),null!=r&&(s[s.length]=r);return d.apply([],s)},guid:1,proxy:function(e,n){var r,i,o;return"string"==typeof n&&(o=e[n],n=e,e=o),x.isFunction(e)?(r=g.call(arguments,2),i=function(){return e.apply(n||this,r.concat(g.call(arguments)))},i.guid=e.guid=e.guid||x.guid++,i):t},access:function(e,n,r,i,o,a,s){var l=0,u=e.length,c=null==r;if("object"===x.type(r)){o=!0;for(l in r)x.access(e,n,l,r[l],!0,a,s)}else if(i!==t&&(o=!0,x.isFunction(i)||(s=!0),c&&(s?(n.call(e,i),n=null):(c=n,n=function(e,t,n){return c.call(x(e),n)})),n))for(;u>l;l++)n(e[l],r,s?i:i.call(e[l],l,n(e[l],r)));return o?e:c?n.call(e):u?n(e[0],r):a},now:function(){return(new Date).getTime()},swap:function(e,t,n,r){var i,o,a={};for(o in t)a[o]=e.style[o],e.style[o]=t[o];i=n.apply(e,r||[]);for(o in t)e.style[o]=a[o];return i}}),x.ready.promise=function(t){if(!n)if(n=x.Deferred(),"complete"===a.readyState)setTimeout(x.ready);else if(a.addEventListener)a.addEventListener("DOMContentLoaded",q,!1),e.addEventListener("load",q,!1);else{a.attachEvent("onreadystatechange",q),e.attachEvent("onload",q);var r=!1;try{r=null==e.frameElement&&a.documentElement}catch(i){}r&&r.doScroll&&function o(){if(!x.isReady){try{r.doScroll("left")}catch(e){return setTimeout(o,50)}_(),x.ready()}}()}return n.promise(t)},x.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(e,t){c["[object "+t+"]"]=t.toLowerCase()});function M(e){var t=e.length,n=x.type(e);return x.isWindow(e)?!1:1===e.nodeType&&t?!0:"array"===n||"function"!==n&&(0===t||"number"==typeof t&&t>0&&t-1 in e)}r=x(a),function(e,t){var n,r,i,o,a,s,l,u,c,p,f,d,h,g,m,y,v,b="sizzle"+-new Date,w=e.document,T=0,C=0,N=st(),k=st(),E=st(),S=!1,A=function(e,t){return e===t?(S=!0,0):0},j=typeof t,D=1<<31,L={}.hasOwnProperty,H=[],q=H.pop,_=H.push,M=H.push,O=H.slice,F=H.indexOf||function(e){var t=0,n=this.length;for(;n>t;t++)if(this[t]===e)return t;return-1},B="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",P="[\\x20\\t\\r\\n\\f]",R="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",W=R.replace("w","w#"),$="\\["+P+"*("+R+")"+P+"*(?:([*^$|!~]?=)"+P+"*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|("+W+")|)|)"+P+"*\\]",I=":("+R+")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|"+$.replace(3,8)+")*)|.*)\\)|)",z=RegExp("^"+P+"+|((?:^|[^\\\\])(?:\\\\.)*)"+P+"+$","g"),X=RegExp("^"+P+"*,"+P+"*"),U=RegExp("^"+P+"*([>+~]|"+P+")"+P+"*"),V=RegExp(P+"*[+~]"),Y=RegExp("="+P+"*([^\\]'\"]*)"+P+"*\\]","g"),J=RegExp(I),G=RegExp("^"+W+"$"),Q={ID:RegExp("^#("+R+")"),CLASS:RegExp("^\\.("+R+")"),TAG:RegExp("^("+R.replace("w","w*")+")"),ATTR:RegExp("^"+$),PSEUDO:RegExp("^"+I),CHILD:RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+P+"*(even|odd|(([+-]|)(\\d*)n|)"+P+"*(?:([+-]|)"+P+"*(\\d+)|))"+P+"*\\)|)","i"),bool:RegExp("^(?:"+B+")$","i"),needsContext:RegExp("^"+P+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+P+"*((?:-\\d)?\\d*)"+P+"*\\)|)(?=[^-]|$)","i")},K=/^[^{]+\{\s*\[native \w/,Z=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,et=/^(?:input|select|textarea|button)$/i,tt=/^h\d$/i,nt=/'|\\/g,rt=RegExp("\\\\([\\da-f]{1,6}"+P+"?|("+P+")|.)","ig"),it=function(e,t,n){var r="0x"+t-65536;return r!==r||n?t:0>r?String.fromCharCode(r+65536):String.fromCharCode(55296|r>>10,56320|1023&r)};try{M.apply(H=O.call(w.childNodes),w.childNodes),H[w.childNodes.length].nodeType}catch(ot){M={apply:H.length?function(e,t){_.apply(e,O.call(t))}:function(e,t){var n=e.length,r=0;while(e[n++]=t[r++]);e.length=n-1}}}function at(e,t,n,i){var o,a,s,l,u,c,d,m,y,x;if((t?t.ownerDocument||t:w)!==f&&p(t),t=t||f,n=n||[],!e||"string"!=typeof e)return n;if(1!==(l=t.nodeType)&&9!==l)return[];if(h&&!i){if(o=Z.exec(e))if(s=o[1]){if(9===l){if(a=t.getElementById(s),!a||!a.parentNode)return n;if(a.id===s)return n.push(a),n}else if(t.ownerDocument&&(a=t.ownerDocument.getElementById(s))&&v(t,a)&&a.id===s)return n.push(a),n}else{if(o[2])return M.apply(n,t.getElementsByTagName(e)),n;if((s=o[3])&&r.getElementsByClassName&&t.getElementsByClassName)return M.apply(n,t.getElementsByClassName(s)),n}if(r.qsa&&(!g||!g.test(e))){if(m=d=b,y=t,x=9===l&&e,1===l&&"object"!==t.nodeName.toLowerCase()){c=mt(e),(d=t.getAttribute("id"))?m=d.replace(nt,"\\$&"):t.setAttribute("id",m),m="[id='"+m+"'] ",u=c.length;while(u--)c[u]=m+yt(c[u]);y=V.test(e)&&t.parentNode||t,x=c.join(",")}if(x)try{return M.apply(n,y.querySelectorAll(x)),n}catch(T){}finally{d||t.removeAttribute("id")}}}return kt(e.replace(z,"$1"),t,n,i)}function st(){var e=[];function t(n,r){return e.push(n+=" ")>o.cacheLength&&delete t[e.shift()],t[n]=r}return t}function lt(e){return e[b]=!0,e}function ut(e){var t=f.createElement("div");try{return!!e(t)}catch(n){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function ct(e,t){var n=e.split("|"),r=e.length;while(r--)o.attrHandle[n[r]]=t}function pt(e,t){var n=t&&e,r=n&&1===e.nodeType&&1===t.nodeType&&(~t.sourceIndex||D)-(~e.sourceIndex||D);if(r)return r;if(n)while(n=n.nextSibling)if(n===t)return-1;return e?1:-1}function ft(e){return function(t){var n=t.nodeName.toLowerCase();return"input"===n&&t.type===e}}function dt(e){return function(t){var n=t.nodeName.toLowerCase();return("input"===n||"button"===n)&&t.type===e}}function ht(e){return lt(function(t){return t=+t,lt(function(n,r){var i,o=e([],n.length,t),a=o.length;while(a--)n[i=o[a]]&&(n[i]=!(r[i]=n[i]))})})}s=at.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return t?"HTML"!==t.nodeName:!1},r=at.support={},p=at.setDocument=function(e){var n=e?e.ownerDocument||e:w,i=n.defaultView;return n!==f&&9===n.nodeType&&n.documentElement?(f=n,d=n.documentElement,h=!s(n),i&&i.attachEvent&&i!==i.top&&i.attachEvent("onbeforeunload",function(){p()}),r.attributes=ut(function(e){return e.className="i",!e.getAttribute("className")}),r.getElementsByTagName=ut(function(e){return e.appendChild(n.createComment("")),!e.getElementsByTagName("*").length}),r.getElementsByClassName=ut(function(e){return e.innerHTML="<div class='a'></div><div class='a i'></div>",e.firstChild.className="i",2===e.getElementsByClassName("i").length}),r.getById=ut(function(e){return d.appendChild(e).id=b,!n.getElementsByName||!n.getElementsByName(b).length}),r.getById?(o.find.ID=function(e,t){if(typeof t.getElementById!==j&&h){var n=t.getElementById(e);return n&&n.parentNode?[n]:[]}},o.filter.ID=function(e){var t=e.replace(rt,it);return function(e){return e.getAttribute("id")===t}}):(delete o.find.ID,o.filter.ID=function(e){var t=e.replace(rt,it);return function(e){var n=typeof e.getAttributeNode!==j&&e.getAttributeNode("id");return n&&n.value===t}}),o.find.TAG=r.getElementsByTagName?function(e,n){return typeof n.getElementsByTagName!==j?n.getElementsByTagName(e):t}:function(e,t){var n,r=[],i=0,o=t.getElementsByTagName(e);if("*"===e){while(n=o[i++])1===n.nodeType&&r.push(n);return r}return o},o.find.CLASS=r.getElementsByClassName&&function(e,n){return typeof n.getElementsByClassName!==j&&h?n.getElementsByClassName(e):t},m=[],g=[],(r.qsa=K.test(n.querySelectorAll))&&(ut(function(e){e.innerHTML="<select><option selected=''></option></select>",e.querySelectorAll("[selected]").length||g.push("\\["+P+"*(?:value|"+B+")"),e.querySelectorAll(":checked").length||g.push(":checked")}),ut(function(e){var t=n.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("t",""),e.querySelectorAll("[t^='']").length&&g.push("[*^$]="+P+"*(?:''|\"\")"),e.querySelectorAll(":enabled").length||g.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),g.push(",.*:")})),(r.matchesSelector=K.test(y=d.webkitMatchesSelector||d.mozMatchesSelector||d.oMatchesSelector||d.msMatchesSelector))&&ut(function(e){r.disconnectedMatch=y.call(e,"div"),y.call(e,"[s!='']:x"),m.push("!=",I)}),g=g.length&&RegExp(g.join("|")),m=m.length&&RegExp(m.join("|")),v=K.test(d.contains)||d.compareDocumentPosition?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)while(t=t.parentNode)if(t===e)return!0;return!1},A=d.compareDocumentPosition?function(e,t){if(e===t)return S=!0,0;var i=t.compareDocumentPosition&&e.compareDocumentPosition&&e.compareDocumentPosition(t);return i?1&i||!r.sortDetached&&t.compareDocumentPosition(e)===i?e===n||v(w,e)?-1:t===n||v(w,t)?1:c?F.call(c,e)-F.call(c,t):0:4&i?-1:1:e.compareDocumentPosition?-1:1}:function(e,t){var r,i=0,o=e.parentNode,a=t.parentNode,s=[e],l=[t];if(e===t)return S=!0,0;if(!o||!a)return e===n?-1:t===n?1:o?-1:a?1:c?F.call(c,e)-F.call(c,t):0;if(o===a)return pt(e,t);r=e;while(r=r.parentNode)s.unshift(r);r=t;while(r=r.parentNode)l.unshift(r);while(s[i]===l[i])i++;return i?pt(s[i],l[i]):s[i]===w?-1:l[i]===w?1:0},n):f},at.matches=function(e,t){return at(e,null,null,t)},at.matchesSelector=function(e,t){if((e.ownerDocument||e)!==f&&p(e),t=t.replace(Y,"='$1']"),!(!r.matchesSelector||!h||m&&m.test(t)||g&&g.test(t)))try{var n=y.call(e,t);if(n||r.disconnectedMatch||e.document&&11!==e.document.nodeType)return n}catch(i){}return at(t,f,null,[e]).length>0},at.contains=function(e,t){return(e.ownerDocument||e)!==f&&p(e),v(e,t)},at.attr=function(e,n){(e.ownerDocument||e)!==f&&p(e);var i=o.attrHandle[n.toLowerCase()],a=i&&L.call(o.attrHandle,n.toLowerCase())?i(e,n,!h):t;return a===t?r.attributes||!h?e.getAttribute(n):(a=e.getAttributeNode(n))&&a.specified?a.value:null:a},at.error=function(e){throw Error("Syntax error, unrecognized expression: "+e)},at.uniqueSort=function(e){var t,n=[],i=0,o=0;if(S=!r.detectDuplicates,c=!r.sortStable&&e.slice(0),e.sort(A),S){while(t=e[o++])t===e[o]&&(i=n.push(o));while(i--)e.splice(n[i],1)}return e},a=at.getText=function(e){var t,n="",r=0,i=e.nodeType;if(i){if(1===i||9===i||11===i){if("string"==typeof e.textContent)return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=a(e)}else if(3===i||4===i)return e.nodeValue}else for(;t=e[r];r++)n+=a(t);return n},o=at.selectors={cacheLength:50,createPseudo:lt,match:Q,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(rt,it),e[3]=(e[4]||e[5]||"").replace(rt,it),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||at.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&at.error(e[0]),e},PSEUDO:function(e){var n,r=!e[5]&&e[2];return Q.CHILD.test(e[0])?null:(e[3]&&e[4]!==t?e[2]=e[4]:r&&J.test(r)&&(n=mt(r,!0))&&(n=r.indexOf(")",r.length-n)-r.length)&&(e[0]=e[0].slice(0,n),e[2]=r.slice(0,n)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(rt,it).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=N[e+" "];return t||(t=RegExp("(^|"+P+")"+e+"("+P+"|$)"))&&N(e,function(e){return t.test("string"==typeof e.className&&e.className||typeof e.getAttribute!==j&&e.getAttribute("class")||"")})},ATTR:function(e,t,n){return function(r){var i=at.attr(r,e);return null==i?"!="===t:t?(i+="","="===t?i===n:"!="===t?i!==n:"^="===t?n&&0===i.indexOf(n):"*="===t?n&&i.indexOf(n)>-1:"$="===t?n&&i.slice(-n.length)===n:"~="===t?(" "+i+" ").indexOf(n)>-1:"|="===t?i===n||i.slice(0,n.length+1)===n+"-":!1):!0}},CHILD:function(e,t,n,r,i){var o="nth"!==e.slice(0,3),a="last"!==e.slice(-4),s="of-type"===t;return 1===r&&0===i?function(e){return!!e.parentNode}:function(t,n,l){var u,c,p,f,d,h,g=o!==a?"nextSibling":"previousSibling",m=t.parentNode,y=s&&t.nodeName.toLowerCase(),v=!l&&!s;if(m){if(o){while(g){p=t;while(p=p[g])if(s?p.nodeName.toLowerCase()===y:1===p.nodeType)return!1;h=g="only"===e&&!h&&"nextSibling"}return!0}if(h=[a?m.firstChild:m.lastChild],a&&v){c=m[b]||(m[b]={}),u=c[e]||[],d=u[0]===T&&u[1],f=u[0]===T&&u[2],p=d&&m.childNodes[d];while(p=++d&&p&&p[g]||(f=d=0)||h.pop())if(1===p.nodeType&&++f&&p===t){c[e]=[T,d,f];break}}else if(v&&(u=(t[b]||(t[b]={}))[e])&&u[0]===T)f=u[1];else while(p=++d&&p&&p[g]||(f=d=0)||h.pop())if((s?p.nodeName.toLowerCase()===y:1===p.nodeType)&&++f&&(v&&((p[b]||(p[b]={}))[e]=[T,f]),p===t))break;return f-=i,f===r||0===f%r&&f/r>=0}}},PSEUDO:function(e,t){var n,r=o.pseudos[e]||o.setFilters[e.toLowerCase()]||at.error("unsupported pseudo: "+e);return r[b]?r(t):r.length>1?(n=[e,e,"",t],o.setFilters.hasOwnProperty(e.toLowerCase())?lt(function(e,n){var i,o=r(e,t),a=o.length;while(a--)i=F.call(e,o[a]),e[i]=!(n[i]=o[a])}):function(e){return r(e,0,n)}):r}},pseudos:{not:lt(function(e){var t=[],n=[],r=l(e.replace(z,"$1"));return r[b]?lt(function(e,t,n,i){var o,a=r(e,null,i,[]),s=e.length;while(s--)(o=a[s])&&(e[s]=!(t[s]=o))}):function(e,i,o){return t[0]=e,r(t,null,o,n),!n.pop()}}),has:lt(function(e){return function(t){return at(e,t).length>0}}),contains:lt(function(e){return function(t){return(t.textContent||t.innerText||a(t)).indexOf(e)>-1}}),lang:lt(function(e){return G.test(e||"")||at.error("unsupported lang: "+e),e=e.replace(rt,it).toLowerCase(),function(t){var n;do if(n=h?t.lang:t.getAttribute("xml:lang")||t.getAttribute("lang"))return n=n.toLowerCase(),n===e||0===n.indexOf(e+"-");while((t=t.parentNode)&&1===t.nodeType);return!1}}),target:function(t){var n=e.location&&e.location.hash;return n&&n.slice(1)===t.id},root:function(e){return e===d},focus:function(e){return e===f.activeElement&&(!f.hasFocus||f.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},enabled:function(e){return e.disabled===!1},disabled:function(e){return e.disabled===!0},checked:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&!!e.checked||"option"===t&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,e.selected===!0},empty:function(e){for(e=e.firstChild;e;e=e.nextSibling)if(e.nodeName>"@"||3===e.nodeType||4===e.nodeType)return!1;return!0},parent:function(e){return!o.pseudos.empty(e)},header:function(e){return tt.test(e.nodeName)},input:function(e){return et.test(e.nodeName)},button:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&"button"===e.type||"button"===t},text:function(e){var t;return"input"===e.nodeName.toLowerCase()&&"text"===e.type&&(null==(t=e.getAttribute("type"))||t.toLowerCase()===e.type)},first:ht(function(){return[0]}),last:ht(function(e,t){return[t-1]}),eq:ht(function(e,t,n){return[0>n?n+t:n]}),even:ht(function(e,t){var n=0;for(;t>n;n+=2)e.push(n);return e}),odd:ht(function(e,t){var n=1;for(;t>n;n+=2)e.push(n);return e}),lt:ht(function(e,t,n){var r=0>n?n+t:n;for(;--r>=0;)e.push(r);return e}),gt:ht(function(e,t,n){var r=0>n?n+t:n;for(;t>++r;)e.push(r);return e})}},o.pseudos.nth=o.pseudos.eq;for(n in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})o.pseudos[n]=ft(n);for(n in{submit:!0,reset:!0})o.pseudos[n]=dt(n);function gt(){}gt.prototype=o.filters=o.pseudos,o.setFilters=new gt;function mt(e,t){var n,r,i,a,s,l,u,c=k[e+" "];if(c)return t?0:c.slice(0);s=e,l=[],u=o.preFilter;while(s){(!n||(r=X.exec(s)))&&(r&&(s=s.slice(r[0].length)||s),l.push(i=[])),n=!1,(r=U.exec(s))&&(n=r.shift(),i.push({value:n,type:r[0].replace(z," ")}),s=s.slice(n.length));for(a in o.filter)!(r=Q[a].exec(s))||u[a]&&!(r=u[a](r))||(n=r.shift(),i.push({value:n,type:a,matches:r}),s=s.slice(n.length));if(!n)break}return t?s.length:s?at.error(e):k(e,l).slice(0)}function yt(e){var t=0,n=e.length,r="";for(;n>t;t++)r+=e[t].value;return r}function vt(e,t,n){var r=t.dir,o=n&&"parentNode"===r,a=C++;return t.first?function(t,n,i){while(t=t[r])if(1===t.nodeType||o)return e(t,n,i)}:function(t,n,s){var l,u,c,p=T+" "+a;if(s){while(t=t[r])if((1===t.nodeType||o)&&e(t,n,s))return!0}else while(t=t[r])if(1===t.nodeType||o)if(c=t[b]||(t[b]={}),(u=c[r])&&u[0]===p){if((l=u[1])===!0||l===i)return l===!0}else if(u=c[r]=[p],u[1]=e(t,n,s)||i,u[1]===!0)return!0}}function bt(e){return e.length>1?function(t,n,r){var i=e.length;while(i--)if(!e[i](t,n,r))return!1;return!0}:e[0]}function xt(e,t,n,r,i){var o,a=[],s=0,l=e.length,u=null!=t;for(;l>s;s++)(o=e[s])&&(!n||n(o,r,i))&&(a.push(o),u&&t.push(s));return a}function wt(e,t,n,r,i,o){return r&&!r[b]&&(r=wt(r)),i&&!i[b]&&(i=wt(i,o)),lt(function(o,a,s,l){var u,c,p,f=[],d=[],h=a.length,g=o||Nt(t||"*",s.nodeType?[s]:s,[]),m=!e||!o&&t?g:xt(g,f,e,s,l),y=n?i||(o?e:h||r)?[]:a:m;if(n&&n(m,y,s,l),r){u=xt(y,d),r(u,[],s,l),c=u.length;while(c--)(p=u[c])&&(y[d[c]]=!(m[d[c]]=p))}if(o){if(i||e){if(i){u=[],c=y.length;while(c--)(p=y[c])&&u.push(m[c]=p);i(null,y=[],u,l)}c=y.length;while(c--)(p=y[c])&&(u=i?F.call(o,p):f[c])>-1&&(o[u]=!(a[u]=p))}}else y=xt(y===a?y.splice(h,y.length):y),i?i(null,a,y,l):M.apply(a,y)})}function Tt(e){var t,n,r,i=e.length,a=o.relative[e[0].type],s=a||o.relative[" "],l=a?1:0,c=vt(function(e){return e===t},s,!0),p=vt(function(e){return F.call(t,e)>-1},s,!0),f=[function(e,n,r){return!a&&(r||n!==u)||((t=n).nodeType?c(e,n,r):p(e,n,r))}];for(;i>l;l++)if(n=o.relative[e[l].type])f=[vt(bt(f),n)];else{if(n=o.filter[e[l].type].apply(null,e[l].matches),n[b]){for(r=++l;i>r;r++)if(o.relative[e[r].type])break;return wt(l>1&&bt(f),l>1&&yt(e.slice(0,l-1).concat({value:" "===e[l-2].type?"*":""})).replace(z,"$1"),n,r>l&&Tt(e.slice(l,r)),i>r&&Tt(e=e.slice(r)),i>r&&yt(e))}f.push(n)}return bt(f)}function Ct(e,t){var n=0,r=t.length>0,a=e.length>0,s=function(s,l,c,p,d){var h,g,m,y=[],v=0,b="0",x=s&&[],w=null!=d,C=u,N=s||a&&o.find.TAG("*",d&&l.parentNode||l),k=T+=null==C?1:Math.random()||.1;for(w&&(u=l!==f&&l,i=n);null!=(h=N[b]);b++){if(a&&h){g=0;while(m=e[g++])if(m(h,l,c)){p.push(h);break}w&&(T=k,i=++n)}r&&((h=!m&&h)&&v--,s&&x.push(h))}if(v+=b,r&&b!==v){g=0;while(m=t[g++])m(x,y,l,c);if(s){if(v>0)while(b--)x[b]||y[b]||(y[b]=q.call(p));y=xt(y)}M.apply(p,y),w&&!s&&y.length>0&&v+t.length>1&&at.uniqueSort(p)}return w&&(T=k,u=C),x};return r?lt(s):s}l=at.compile=function(e,t){var n,r=[],i=[],o=E[e+" "];if(!o){t||(t=mt(e)),n=t.length;while(n--)o=Tt(t[n]),o[b]?r.push(o):i.push(o);o=E(e,Ct(i,r))}return o};function Nt(e,t,n){var r=0,i=t.length;for(;i>r;r++)at(e,t[r],n);return n}function kt(e,t,n,i){var a,s,u,c,p,f=mt(e);if(!i&&1===f.length){if(s=f[0]=f[0].slice(0),s.length>2&&"ID"===(u=s[0]).type&&r.getById&&9===t.nodeType&&h&&o.relative[s[1].type]){if(t=(o.find.ID(u.matches[0].replace(rt,it),t)||[])[0],!t)return n;e=e.slice(s.shift().value.length)}a=Q.needsContext.test(e)?0:s.length;while(a--){if(u=s[a],o.relative[c=u.type])break;if((p=o.find[c])&&(i=p(u.matches[0].replace(rt,it),V.test(s[0].type)&&t.parentNode||t))){if(s.splice(a,1),e=i.length&&yt(s),!e)return M.apply(n,i),n;break}}}return l(e,f)(i,t,!h,n,V.test(e)),n}r.sortStable=b.split("").sort(A).join("")===b,r.detectDuplicates=S,p(),r.sortDetached=ut(function(e){return 1&e.compareDocumentPosition(f.createElement("div"))}),ut(function(e){return e.innerHTML="<a href='#'></a>","#"===e.firstChild.getAttribute("href")})||ct("type|href|height|width",function(e,n,r){return r?t:e.getAttribute(n,"type"===n.toLowerCase()?1:2)}),r.attributes&&ut(function(e){return e.innerHTML="<input/>",e.firstChild.setAttribute("value",""),""===e.firstChild.getAttribute("value")})||ct("value",function(e,n,r){return r||"input"!==e.nodeName.toLowerCase()?t:e.defaultValue}),ut(function(e){return null==e.getAttribute("disabled")})||ct(B,function(e,n,r){var i;return r?t:(i=e.getAttributeNode(n))&&i.specified?i.value:e[n]===!0?n.toLowerCase():null}),x.find=at,x.expr=at.selectors,x.expr[":"]=x.expr.pseudos,x.unique=at.uniqueSort,x.text=at.getText,x.isXMLDoc=at.isXML,x.contains=at.contains}(e);var O={};function F(e){var t=O[e]={};return x.each(e.match(T)||[],function(e,n){t[n]=!0}),t}x.Callbacks=function(e){e="string"==typeof e?O[e]||F(e):x.extend({},e);var n,r,i,o,a,s,l=[],u=!e.once&&[],c=function(t){for(r=e.memory&&t,i=!0,a=s||0,s=0,o=l.length,n=!0;l&&o>a;a++)if(l[a].apply(t[0],t[1])===!1&&e.stopOnFalse){r=!1;break}n=!1,l&&(u?u.length&&c(u.shift()):r?l=[]:p.disable())},p={add:function(){if(l){var t=l.length;(function i(t){x.each(t,function(t,n){var r=x.type(n);"function"===r?e.unique&&p.has(n)||l.push(n):n&&n.length&&"string"!==r&&i(n)})})(arguments),n?o=l.length:r&&(s=t,c(r))}return this},remove:function(){return l&&x.each(arguments,function(e,t){var r;while((r=x.inArray(t,l,r))>-1)l.splice(r,1),n&&(o>=r&&o--,a>=r&&a--)}),this},has:function(e){return e?x.inArray(e,l)>-1:!(!l||!l.length)},empty:function(){return l=[],o=0,this},disable:function(){return l=u=r=t,this},disabled:function(){return!l},lock:function(){return u=t,r||p.disable(),this},locked:function(){return!u},fireWith:function(e,t){return!l||i&&!u||(t=t||[],t=[e,t.slice?t.slice():t],n?u.push(t):c(t)),this},fire:function(){return p.fireWith(this,arguments),this},fired:function(){return!!i}};return p},x.extend({Deferred:function(e){var t=[["resolve","done",x.Callbacks("once memory"),"resolved"],["reject","fail",x.Callbacks("once memory"),"rejected"],["notify","progress",x.Callbacks("memory")]],n="pending",r={state:function(){return n},always:function(){return i.done(arguments).fail(arguments),this},then:function(){var e=arguments;return x.Deferred(function(n){x.each(t,function(t,o){var a=o[0],s=x.isFunction(e[t])&&e[t];i[o[1]](function(){var e=s&&s.apply(this,arguments);e&&x.isFunction(e.promise)?e.promise().done(n.resolve).fail(n.reject).progress(n.notify):n[a+"With"](this===r?n.promise():this,s?[e]:arguments)})}),e=null}).promise()},promise:function(e){return null!=e?x.extend(e,r):r}},i={};return r.pipe=r.then,x.each(t,function(e,o){var a=o[2],s=o[3];r[o[1]]=a.add,s&&a.add(function(){n=s},t[1^e][2].disable,t[2][2].lock),i[o[0]]=function(){return i[o[0]+"With"](this===i?r:this,arguments),this},i[o[0]+"With"]=a.fireWith}),r.promise(i),e&&e.call(i,i),i},when:function(e){var t=0,n=g.call(arguments),r=n.length,i=1!==r||e&&x.isFunction(e.promise)?r:0,o=1===i?e:x.Deferred(),a=function(e,t,n){return function(r){t[e]=this,n[e]=arguments.length>1?g.call(arguments):r,n===s?o.notifyWith(t,n):--i||o.resolveWith(t,n)}},s,l,u;if(r>1)for(s=Array(r),l=Array(r),u=Array(r);r>t;t++)n[t]&&x.isFunction(n[t].promise)?n[t].promise().done(a(t,u,n)).fail(o.reject).progress(a(t,l,s)):--i;return i||o.resolveWith(u,n),o.promise()}}),x.support=function(t){var n,r,o,s,l,u,c,p,f,d=a.createElement("div");if(d.setAttribute("className","t"),d.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",n=d.getElementsByTagName("*")||[],r=d.getElementsByTagName("a")[0],!r||!r.style||!n.length)return t;s=a.createElement("select"),u=s.appendChild(a.createElement("option")),o=d.getElementsByTagName("input")[0],r.style.cssText="top:1px;float:left;opacity:.5",t.getSetAttribute="t"!==d.className,t.leadingWhitespace=3===d.firstChild.nodeType,t.tbody=!d.getElementsByTagName("tbody").length,t.htmlSerialize=!!d.getElementsByTagName("link").length,t.style=/top/.test(r.getAttribute("style")),t.hrefNormalized="/a"===r.getAttribute("href"),t.opacity=/^0.5/.test(r.style.opacity),t.cssFloat=!!r.style.cssFloat,t.checkOn=!!o.value,t.optSelected=u.selected,t.enctype=!!a.createElement("form").enctype,t.html5Clone="<:nav></:nav>"!==a.createElement("nav").cloneNode(!0).outerHTML,t.inlineBlockNeedsLayout=!1,t.shrinkWrapBlocks=!1,t.pixelPosition=!1,t.deleteExpando=!0,t.noCloneEvent=!0,t.reliableMarginRight=!0,t.boxSizingReliable=!0,o.checked=!0,t.noCloneChecked=o.cloneNode(!0).checked,s.disabled=!0,t.optDisabled=!u.disabled;try{delete d.test}catch(h){t.deleteExpando=!1}o=a.createElement("input"),o.setAttribute("value",""),t.input=""===o.getAttribute("value"),o.value="t",o.setAttribute("type","radio"),t.radioValue="t"===o.value,o.setAttribute("checked","t"),o.setAttribute("name","t"),l=a.createDocumentFragment(),l.appendChild(o),t.appendChecked=o.checked,t.checkClone=l.cloneNode(!0).cloneNode(!0).lastChild.checked,d.attachEvent&&(d.attachEvent("onclick",function(){t.noCloneEvent=!1}),d.cloneNode(!0).click());for(f in{submit:!0,change:!0,focusin:!0})d.setAttribute(c="on"+f,"t"),t[f+"Bubbles"]=c in e||d.attributes[c].expando===!1;d.style.backgroundClip="content-box",d.cloneNode(!0).style.backgroundClip="",t.clearCloneStyle="content-box"===d.style.backgroundClip;for(f in x(t))break;return t.ownLast="0"!==f,x(function(){var n,r,o,s="padding:0;margin:0;border:0;display:block;box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;",l=a.getElementsByTagName("body")[0];l&&(n=a.createElement("div"),n.style.cssText="border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px",l.appendChild(n).appendChild(d),d.innerHTML="<table><tr><td></td><td>t</td></tr></table>",o=d.getElementsByTagName("td"),o[0].style.cssText="padding:0;margin:0;border:0;display:none",p=0===o[0].offsetHeight,o[0].style.display="",o[1].style.display="none",t.reliableHiddenOffsets=p&&0===o[0].offsetHeight,d.innerHTML="",d.style.cssText="box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;",x.swap(l,null!=l.style.zoom?{zoom:1}:{},function(){t.boxSizing=4===d.offsetWidth}),e.getComputedStyle&&(t.pixelPosition="1%"!==(e.getComputedStyle(d,null)||{}).top,t.boxSizingReliable="4px"===(e.getComputedStyle(d,null)||{width:"4px"}).width,r=d.appendChild(a.createElement("div")),r.style.cssText=d.style.cssText=s,r.style.marginRight=r.style.width="0",d.style.width="1px",t.reliableMarginRight=!parseFloat((e.getComputedStyle(r,null)||{}).marginRight)),typeof d.style.zoom!==i&&(d.innerHTML="",d.style.cssText=s+"width:1px;padding:1px;display:inline;zoom:1",t.inlineBlockNeedsLayout=3===d.offsetWidth,d.style.display="block",d.innerHTML="<div></div>",d.firstChild.style.width="5px",t.shrinkWrapBlocks=3!==d.offsetWidth,t.inlineBlockNeedsLayout&&(l.style.zoom=1)),l.removeChild(n),n=d=o=r=null)}),n=s=l=u=r=o=null,t
|
5 |
+
}({});var B=/(?:\{[\s\S]*\}|\[[\s\S]*\])$/,P=/([A-Z])/g;function R(e,n,r,i){if(x.acceptData(e)){var o,a,s=x.expando,l=e.nodeType,u=l?x.cache:e,c=l?e[s]:e[s]&&s;if(c&&u[c]&&(i||u[c].data)||r!==t||"string"!=typeof n)return c||(c=l?e[s]=p.pop()||x.guid++:s),u[c]||(u[c]=l?{}:{toJSON:x.noop}),("object"==typeof n||"function"==typeof n)&&(i?u[c]=x.extend(u[c],n):u[c].data=x.extend(u[c].data,n)),a=u[c],i||(a.data||(a.data={}),a=a.data),r!==t&&(a[x.camelCase(n)]=r),"string"==typeof n?(o=a[n],null==o&&(o=a[x.camelCase(n)])):o=a,o}}function W(e,t,n){if(x.acceptData(e)){var r,i,o=e.nodeType,a=o?x.cache:e,s=o?e[x.expando]:x.expando;if(a[s]){if(t&&(r=n?a[s]:a[s].data)){x.isArray(t)?t=t.concat(x.map(t,x.camelCase)):t in r?t=[t]:(t=x.camelCase(t),t=t in r?[t]:t.split(" ")),i=t.length;while(i--)delete r[t[i]];if(n?!I(r):!x.isEmptyObject(r))return}(n||(delete a[s].data,I(a[s])))&&(o?x.cleanData([e],!0):x.support.deleteExpando||a!=a.window?delete a[s]:a[s]=null)}}}x.extend({cache:{},noData:{applet:!0,embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"},hasData:function(e){return e=e.nodeType?x.cache[e[x.expando]]:e[x.expando],!!e&&!I(e)},data:function(e,t,n){return R(e,t,n)},removeData:function(e,t){return W(e,t)},_data:function(e,t,n){return R(e,t,n,!0)},_removeData:function(e,t){return W(e,t,!0)},acceptData:function(e){if(e.nodeType&&1!==e.nodeType&&9!==e.nodeType)return!1;var t=e.nodeName&&x.noData[e.nodeName.toLowerCase()];return!t||t!==!0&&e.getAttribute("classid")===t}}),x.fn.extend({data:function(e,n){var r,i,o=null,a=0,s=this[0];if(e===t){if(this.length&&(o=x.data(s),1===s.nodeType&&!x._data(s,"parsedAttrs"))){for(r=s.attributes;r.length>a;a++)i=r[a].name,0===i.indexOf("data-")&&(i=x.camelCase(i.slice(5)),$(s,i,o[i]));x._data(s,"parsedAttrs",!0)}return o}return"object"==typeof e?this.each(function(){x.data(this,e)}):arguments.length>1?this.each(function(){x.data(this,e,n)}):s?$(s,e,x.data(s,e)):null},removeData:function(e){return this.each(function(){x.removeData(this,e)})}});function $(e,n,r){if(r===t&&1===e.nodeType){var i="data-"+n.replace(P,"-$1").toLowerCase();if(r=e.getAttribute(i),"string"==typeof r){try{r="true"===r?!0:"false"===r?!1:"null"===r?null:+r+""===r?+r:B.test(r)?x.parseJSON(r):r}catch(o){}x.data(e,n,r)}else r=t}return r}function I(e){var t;for(t in e)if(("data"!==t||!x.isEmptyObject(e[t]))&&"toJSON"!==t)return!1;return!0}x.extend({queue:function(e,n,r){var i;return e?(n=(n||"fx")+"queue",i=x._data(e,n),r&&(!i||x.isArray(r)?i=x._data(e,n,x.makeArray(r)):i.push(r)),i||[]):t},dequeue:function(e,t){t=t||"fx";var n=x.queue(e,t),r=n.length,i=n.shift(),o=x._queueHooks(e,t),a=function(){x.dequeue(e,t)};"inprogress"===i&&(i=n.shift(),r--),i&&("fx"===t&&n.unshift("inprogress"),delete o.stop,i.call(e,a,o)),!r&&o&&o.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return x._data(e,n)||x._data(e,n,{empty:x.Callbacks("once memory").add(function(){x._removeData(e,t+"queue"),x._removeData(e,n)})})}}),x.fn.extend({queue:function(e,n){var r=2;return"string"!=typeof e&&(n=e,e="fx",r--),r>arguments.length?x.queue(this[0],e):n===t?this:this.each(function(){var t=x.queue(this,e,n);x._queueHooks(this,e),"fx"===e&&"inprogress"!==t[0]&&x.dequeue(this,e)})},dequeue:function(e){return this.each(function(){x.dequeue(this,e)})},delay:function(e,t){return e=x.fx?x.fx.speeds[e]||e:e,t=t||"fx",this.queue(t,function(t,n){var r=setTimeout(t,e);n.stop=function(){clearTimeout(r)}})},clearQueue:function(e){return this.queue(e||"fx",[])},promise:function(e,n){var r,i=1,o=x.Deferred(),a=this,s=this.length,l=function(){--i||o.resolveWith(a,[a])};"string"!=typeof e&&(n=e,e=t),e=e||"fx";while(s--)r=x._data(a[s],e+"queueHooks"),r&&r.empty&&(i++,r.empty.add(l));return l(),o.promise(n)}});var z,X,U=/[\t\r\n\f]/g,V=/\r/g,Y=/^(?:input|select|textarea|button|object)$/i,J=/^(?:a|area)$/i,G=/^(?:checked|selected)$/i,Q=x.support.getSetAttribute,K=x.support.input;x.fn.extend({attr:function(e,t){return x.access(this,x.attr,e,t,arguments.length>1)},removeAttr:function(e){return this.each(function(){x.removeAttr(this,e)})},prop:function(e,t){return x.access(this,x.prop,e,t,arguments.length>1)},removeProp:function(e){return e=x.propFix[e]||e,this.each(function(){try{this[e]=t,delete this[e]}catch(n){}})},addClass:function(e){var t,n,r,i,o,a=0,s=this.length,l="string"==typeof e&&e;if(x.isFunction(e))return this.each(function(t){x(this).addClass(e.call(this,t,this.className))});if(l)for(t=(e||"").match(T)||[];s>a;a++)if(n=this[a],r=1===n.nodeType&&(n.className?(" "+n.className+" ").replace(U," "):" ")){o=0;while(i=t[o++])0>r.indexOf(" "+i+" ")&&(r+=i+" ");n.className=x.trim(r)}return this},removeClass:function(e){var t,n,r,i,o,a=0,s=this.length,l=0===arguments.length||"string"==typeof e&&e;if(x.isFunction(e))return this.each(function(t){x(this).removeClass(e.call(this,t,this.className))});if(l)for(t=(e||"").match(T)||[];s>a;a++)if(n=this[a],r=1===n.nodeType&&(n.className?(" "+n.className+" ").replace(U," "):"")){o=0;while(i=t[o++])while(r.indexOf(" "+i+" ")>=0)r=r.replace(" "+i+" "," ");n.className=e?x.trim(r):""}return this},toggleClass:function(e,t){var n=typeof e;return"boolean"==typeof t&&"string"===n?t?this.addClass(e):this.removeClass(e):x.isFunction(e)?this.each(function(n){x(this).toggleClass(e.call(this,n,this.className,t),t)}):this.each(function(){if("string"===n){var t,r=0,o=x(this),a=e.match(T)||[];while(t=a[r++])o.hasClass(t)?o.removeClass(t):o.addClass(t)}else(n===i||"boolean"===n)&&(this.className&&x._data(this,"__className__",this.className),this.className=this.className||e===!1?"":x._data(this,"__className__")||"")})},hasClass:function(e){var t=" "+e+" ",n=0,r=this.length;for(;r>n;n++)if(1===this[n].nodeType&&(" "+this[n].className+" ").replace(U," ").indexOf(t)>=0)return!0;return!1},val:function(e){var n,r,i,o=this[0];{if(arguments.length)return i=x.isFunction(e),this.each(function(n){var o;1===this.nodeType&&(o=i?e.call(this,n,x(this).val()):e,null==o?o="":"number"==typeof o?o+="":x.isArray(o)&&(o=x.map(o,function(e){return null==e?"":e+""})),r=x.valHooks[this.type]||x.valHooks[this.nodeName.toLowerCase()],r&&"set"in r&&r.set(this,o,"value")!==t||(this.value=o))});if(o)return r=x.valHooks[o.type]||x.valHooks[o.nodeName.toLowerCase()],r&&"get"in r&&(n=r.get(o,"value"))!==t?n:(n=o.value,"string"==typeof n?n.replace(V,""):null==n?"":n)}}}),x.extend({valHooks:{option:{get:function(e){var t=x.find.attr(e,"value");return null!=t?t:e.text}},select:{get:function(e){var t,n,r=e.options,i=e.selectedIndex,o="select-one"===e.type||0>i,a=o?null:[],s=o?i+1:r.length,l=0>i?s:o?i:0;for(;s>l;l++)if(n=r[l],!(!n.selected&&l!==i||(x.support.optDisabled?n.disabled:null!==n.getAttribute("disabled"))||n.parentNode.disabled&&x.nodeName(n.parentNode,"optgroup"))){if(t=x(n).val(),o)return t;a.push(t)}return a},set:function(e,t){var n,r,i=e.options,o=x.makeArray(t),a=i.length;while(a--)r=i[a],(r.selected=x.inArray(x(r).val(),o)>=0)&&(n=!0);return n||(e.selectedIndex=-1),o}}},attr:function(e,n,r){var o,a,s=e.nodeType;if(e&&3!==s&&8!==s&&2!==s)return typeof e.getAttribute===i?x.prop(e,n,r):(1===s&&x.isXMLDoc(e)||(n=n.toLowerCase(),o=x.attrHooks[n]||(x.expr.match.bool.test(n)?X:z)),r===t?o&&"get"in o&&null!==(a=o.get(e,n))?a:(a=x.find.attr(e,n),null==a?t:a):null!==r?o&&"set"in o&&(a=o.set(e,r,n))!==t?a:(e.setAttribute(n,r+""),r):(x.removeAttr(e,n),t))},removeAttr:function(e,t){var n,r,i=0,o=t&&t.match(T);if(o&&1===e.nodeType)while(n=o[i++])r=x.propFix[n]||n,x.expr.match.bool.test(n)?K&&Q||!G.test(n)?e[r]=!1:e[x.camelCase("default-"+n)]=e[r]=!1:x.attr(e,n,""),e.removeAttribute(Q?n:r)},attrHooks:{type:{set:function(e,t){if(!x.support.radioValue&&"radio"===t&&x.nodeName(e,"input")){var n=e.value;return e.setAttribute("type",t),n&&(e.value=n),t}}}},propFix:{"for":"htmlFor","class":"className"},prop:function(e,n,r){var i,o,a,s=e.nodeType;if(e&&3!==s&&8!==s&&2!==s)return a=1!==s||!x.isXMLDoc(e),a&&(n=x.propFix[n]||n,o=x.propHooks[n]),r!==t?o&&"set"in o&&(i=o.set(e,r,n))!==t?i:e[n]=r:o&&"get"in o&&null!==(i=o.get(e,n))?i:e[n]},propHooks:{tabIndex:{get:function(e){var t=x.find.attr(e,"tabindex");return t?parseInt(t,10):Y.test(e.nodeName)||J.test(e.nodeName)&&e.href?0:-1}}}}),X={set:function(e,t,n){return t===!1?x.removeAttr(e,n):K&&Q||!G.test(n)?e.setAttribute(!Q&&x.propFix[n]||n,n):e[x.camelCase("default-"+n)]=e[n]=!0,n}},x.each(x.expr.match.bool.source.match(/\w+/g),function(e,n){var r=x.expr.attrHandle[n]||x.find.attr;x.expr.attrHandle[n]=K&&Q||!G.test(n)?function(e,n,i){var o=x.expr.attrHandle[n],a=i?t:(x.expr.attrHandle[n]=t)!=r(e,n,i)?n.toLowerCase():null;return x.expr.attrHandle[n]=o,a}:function(e,n,r){return r?t:e[x.camelCase("default-"+n)]?n.toLowerCase():null}}),K&&Q||(x.attrHooks.value={set:function(e,n,r){return x.nodeName(e,"input")?(e.defaultValue=n,t):z&&z.set(e,n,r)}}),Q||(z={set:function(e,n,r){var i=e.getAttributeNode(r);return i||e.setAttributeNode(i=e.ownerDocument.createAttribute(r)),i.value=n+="","value"===r||n===e.getAttribute(r)?n:t}},x.expr.attrHandle.id=x.expr.attrHandle.name=x.expr.attrHandle.coords=function(e,n,r){var i;return r?t:(i=e.getAttributeNode(n))&&""!==i.value?i.value:null},x.valHooks.button={get:function(e,n){var r=e.getAttributeNode(n);return r&&r.specified?r.value:t},set:z.set},x.attrHooks.contenteditable={set:function(e,t,n){z.set(e,""===t?!1:t,n)}},x.each(["width","height"],function(e,n){x.attrHooks[n]={set:function(e,r){return""===r?(e.setAttribute(n,"auto"),r):t}}})),x.support.hrefNormalized||x.each(["href","src"],function(e,t){x.propHooks[t]={get:function(e){return e.getAttribute(t,4)}}}),x.support.style||(x.attrHooks.style={get:function(e){return e.style.cssText||t},set:function(e,t){return e.style.cssText=t+""}}),x.support.optSelected||(x.propHooks.selected={get:function(e){var t=e.parentNode;return t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex),null}}),x.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){x.propFix[this.toLowerCase()]=this}),x.support.enctype||(x.propFix.enctype="encoding"),x.each(["radio","checkbox"],function(){x.valHooks[this]={set:function(e,n){return x.isArray(n)?e.checked=x.inArray(x(e).val(),n)>=0:t}},x.support.checkOn||(x.valHooks[this].get=function(e){return null===e.getAttribute("value")?"on":e.value})});var Z=/^(?:input|select|textarea)$/i,et=/^key/,tt=/^(?:mouse|contextmenu)|click/,nt=/^(?:focusinfocus|focusoutblur)$/,rt=/^([^.]*)(?:\.(.+)|)$/;function it(){return!0}function ot(){return!1}function at(){try{return a.activeElement}catch(e){}}x.event={global:{},add:function(e,n,r,o,a){var s,l,u,c,p,f,d,h,g,m,y,v=x._data(e);if(v){r.handler&&(c=r,r=c.handler,a=c.selector),r.guid||(r.guid=x.guid++),(l=v.events)||(l=v.events={}),(f=v.handle)||(f=v.handle=function(e){return typeof x===i||e&&x.event.triggered===e.type?t:x.event.dispatch.apply(f.elem,arguments)},f.elem=e),n=(n||"").match(T)||[""],u=n.length;while(u--)s=rt.exec(n[u])||[],g=y=s[1],m=(s[2]||"").split(".").sort(),g&&(p=x.event.special[g]||{},g=(a?p.delegateType:p.bindType)||g,p=x.event.special[g]||{},d=x.extend({type:g,origType:y,data:o,handler:r,guid:r.guid,selector:a,needsContext:a&&x.expr.match.needsContext.test(a),namespace:m.join(".")},c),(h=l[g])||(h=l[g]=[],h.delegateCount=0,p.setup&&p.setup.call(e,o,m,f)!==!1||(e.addEventListener?e.addEventListener(g,f,!1):e.attachEvent&&e.attachEvent("on"+g,f))),p.add&&(p.add.call(e,d),d.handler.guid||(d.handler.guid=r.guid)),a?h.splice(h.delegateCount++,0,d):h.push(d),x.event.global[g]=!0);e=null}},remove:function(e,t,n,r,i){var o,a,s,l,u,c,p,f,d,h,g,m=x.hasData(e)&&x._data(e);if(m&&(c=m.events)){t=(t||"").match(T)||[""],u=t.length;while(u--)if(s=rt.exec(t[u])||[],d=g=s[1],h=(s[2]||"").split(".").sort(),d){p=x.event.special[d]||{},d=(r?p.delegateType:p.bindType)||d,f=c[d]||[],s=s[2]&&RegExp("(^|\\.)"+h.join("\\.(?:.*\\.|)")+"(\\.|$)"),l=o=f.length;while(o--)a=f[o],!i&&g!==a.origType||n&&n.guid!==a.guid||s&&!s.test(a.namespace)||r&&r!==a.selector&&("**"!==r||!a.selector)||(f.splice(o,1),a.selector&&f.delegateCount--,p.remove&&p.remove.call(e,a));l&&!f.length&&(p.teardown&&p.teardown.call(e,h,m.handle)!==!1||x.removeEvent(e,d,m.handle),delete c[d])}else for(d in c)x.event.remove(e,d+t[u],n,r,!0);x.isEmptyObject(c)&&(delete m.handle,x._removeData(e,"events"))}},trigger:function(n,r,i,o){var s,l,u,c,p,f,d,h=[i||a],g=v.call(n,"type")?n.type:n,m=v.call(n,"namespace")?n.namespace.split("."):[];if(u=f=i=i||a,3!==i.nodeType&&8!==i.nodeType&&!nt.test(g+x.event.triggered)&&(g.indexOf(".")>=0&&(m=g.split("."),g=m.shift(),m.sort()),l=0>g.indexOf(":")&&"on"+g,n=n[x.expando]?n:new x.Event(g,"object"==typeof n&&n),n.isTrigger=o?2:3,n.namespace=m.join("."),n.namespace_re=n.namespace?RegExp("(^|\\.)"+m.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,n.result=t,n.target||(n.target=i),r=null==r?[n]:x.makeArray(r,[n]),p=x.event.special[g]||{},o||!p.trigger||p.trigger.apply(i,r)!==!1)){if(!o&&!p.noBubble&&!x.isWindow(i)){for(c=p.delegateType||g,nt.test(c+g)||(u=u.parentNode);u;u=u.parentNode)h.push(u),f=u;f===(i.ownerDocument||a)&&h.push(f.defaultView||f.parentWindow||e)}d=0;while((u=h[d++])&&!n.isPropagationStopped())n.type=d>1?c:p.bindType||g,s=(x._data(u,"events")||{})[n.type]&&x._data(u,"handle"),s&&s.apply(u,r),s=l&&u[l],s&&x.acceptData(u)&&s.apply&&s.apply(u,r)===!1&&n.preventDefault();if(n.type=g,!o&&!n.isDefaultPrevented()&&(!p._default||p._default.apply(h.pop(),r)===!1)&&x.acceptData(i)&&l&&i[g]&&!x.isWindow(i)){f=i[l],f&&(i[l]=null),x.event.triggered=g;try{i[g]()}catch(y){}x.event.triggered=t,f&&(i[l]=f)}return n.result}},dispatch:function(e){e=x.event.fix(e);var n,r,i,o,a,s=[],l=g.call(arguments),u=(x._data(this,"events")||{})[e.type]||[],c=x.event.special[e.type]||{};if(l[0]=e,e.delegateTarget=this,!c.preDispatch||c.preDispatch.call(this,e)!==!1){s=x.event.handlers.call(this,e,u),n=0;while((o=s[n++])&&!e.isPropagationStopped()){e.currentTarget=o.elem,a=0;while((i=o.handlers[a++])&&!e.isImmediatePropagationStopped())(!e.namespace_re||e.namespace_re.test(i.namespace))&&(e.handleObj=i,e.data=i.data,r=((x.event.special[i.origType]||{}).handle||i.handler).apply(o.elem,l),r!==t&&(e.result=r)===!1&&(e.preventDefault(),e.stopPropagation()))}return c.postDispatch&&c.postDispatch.call(this,e),e.result}},handlers:function(e,n){var r,i,o,a,s=[],l=n.delegateCount,u=e.target;if(l&&u.nodeType&&(!e.button||"click"!==e.type))for(;u!=this;u=u.parentNode||this)if(1===u.nodeType&&(u.disabled!==!0||"click"!==e.type)){for(o=[],a=0;l>a;a++)i=n[a],r=i.selector+" ",o[r]===t&&(o[r]=i.needsContext?x(r,this).index(u)>=0:x.find(r,this,null,[u]).length),o[r]&&o.push(i);o.length&&s.push({elem:u,handlers:o})}return n.length>l&&s.push({elem:this,handlers:n.slice(l)}),s},fix:function(e){if(e[x.expando])return e;var t,n,r,i=e.type,o=e,s=this.fixHooks[i];s||(this.fixHooks[i]=s=tt.test(i)?this.mouseHooks:et.test(i)?this.keyHooks:{}),r=s.props?this.props.concat(s.props):this.props,e=new x.Event(o),t=r.length;while(t--)n=r[t],e[n]=o[n];return e.target||(e.target=o.srcElement||a),3===e.target.nodeType&&(e.target=e.target.parentNode),e.metaKey=!!e.metaKey,s.filter?s.filter(e,o):e},props:"altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(e,t){return null==e.which&&(e.which=null!=t.charCode?t.charCode:t.keyCode),e}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(e,n){var r,i,o,s=n.button,l=n.fromElement;return null==e.pageX&&null!=n.clientX&&(i=e.target.ownerDocument||a,o=i.documentElement,r=i.body,e.pageX=n.clientX+(o&&o.scrollLeft||r&&r.scrollLeft||0)-(o&&o.clientLeft||r&&r.clientLeft||0),e.pageY=n.clientY+(o&&o.scrollTop||r&&r.scrollTop||0)-(o&&o.clientTop||r&&r.clientTop||0)),!e.relatedTarget&&l&&(e.relatedTarget=l===e.target?n.toElement:l),e.which||s===t||(e.which=1&s?1:2&s?3:4&s?2:0),e}},special:{load:{noBubble:!0},focus:{trigger:function(){if(this!==at()&&this.focus)try{return this.focus(),!1}catch(e){}},delegateType:"focusin"},blur:{trigger:function(){return this===at()&&this.blur?(this.blur(),!1):t},delegateType:"focusout"},click:{trigger:function(){return x.nodeName(this,"input")&&"checkbox"===this.type&&this.click?(this.click(),!1):t},_default:function(e){return x.nodeName(e.target,"a")}},beforeunload:{postDispatch:function(e){e.result!==t&&(e.originalEvent.returnValue=e.result)}}},simulate:function(e,t,n,r){var i=x.extend(new x.Event,n,{type:e,isSimulated:!0,originalEvent:{}});r?x.event.trigger(i,null,t):x.event.dispatch.call(t,i),i.isDefaultPrevented()&&n.preventDefault()}},x.removeEvent=a.removeEventListener?function(e,t,n){e.removeEventListener&&e.removeEventListener(t,n,!1)}:function(e,t,n){var r="on"+t;e.detachEvent&&(typeof e[r]===i&&(e[r]=null),e.detachEvent(r,n))},x.Event=function(e,n){return this instanceof x.Event?(e&&e.type?(this.originalEvent=e,this.type=e.type,this.isDefaultPrevented=e.defaultPrevented||e.returnValue===!1||e.getPreventDefault&&e.getPreventDefault()?it:ot):this.type=e,n&&x.extend(this,n),this.timeStamp=e&&e.timeStamp||x.now(),this[x.expando]=!0,t):new x.Event(e,n)},x.Event.prototype={isDefaultPrevented:ot,isPropagationStopped:ot,isImmediatePropagationStopped:ot,preventDefault:function(){var e=this.originalEvent;this.isDefaultPrevented=it,e&&(e.preventDefault?e.preventDefault():e.returnValue=!1)},stopPropagation:function(){var e=this.originalEvent;this.isPropagationStopped=it,e&&(e.stopPropagation&&e.stopPropagation(),e.cancelBubble=!0)},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=it,this.stopPropagation()}},x.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(e,t){x.event.special[e]={delegateType:t,bindType:t,handle:function(e){var n,r=this,i=e.relatedTarget,o=e.handleObj;return(!i||i!==r&&!x.contains(r,i))&&(e.type=o.origType,n=o.handler.apply(this,arguments),e.type=t),n}}}),x.support.submitBubbles||(x.event.special.submit={setup:function(){return x.nodeName(this,"form")?!1:(x.event.add(this,"click._submit keypress._submit",function(e){var n=e.target,r=x.nodeName(n,"input")||x.nodeName(n,"button")?n.form:t;r&&!x._data(r,"submitBubbles")&&(x.event.add(r,"submit._submit",function(e){e._submit_bubble=!0}),x._data(r,"submitBubbles",!0))}),t)},postDispatch:function(e){e._submit_bubble&&(delete e._submit_bubble,this.parentNode&&!e.isTrigger&&x.event.simulate("submit",this.parentNode,e,!0))},teardown:function(){return x.nodeName(this,"form")?!1:(x.event.remove(this,"._submit"),t)}}),x.support.changeBubbles||(x.event.special.change={setup:function(){return Z.test(this.nodeName)?(("checkbox"===this.type||"radio"===this.type)&&(x.event.add(this,"propertychange._change",function(e){"checked"===e.originalEvent.propertyName&&(this._just_changed=!0)}),x.event.add(this,"click._change",function(e){this._just_changed&&!e.isTrigger&&(this._just_changed=!1),x.event.simulate("change",this,e,!0)})),!1):(x.event.add(this,"beforeactivate._change",function(e){var t=e.target;Z.test(t.nodeName)&&!x._data(t,"changeBubbles")&&(x.event.add(t,"change._change",function(e){!this.parentNode||e.isSimulated||e.isTrigger||x.event.simulate("change",this.parentNode,e,!0)}),x._data(t,"changeBubbles",!0))}),t)},handle:function(e){var n=e.target;return this!==n||e.isSimulated||e.isTrigger||"radio"!==n.type&&"checkbox"!==n.type?e.handleObj.handler.apply(this,arguments):t},teardown:function(){return x.event.remove(this,"._change"),!Z.test(this.nodeName)}}),x.support.focusinBubbles||x.each({focus:"focusin",blur:"focusout"},function(e,t){var n=0,r=function(e){x.event.simulate(t,e.target,x.event.fix(e),!0)};x.event.special[t]={setup:function(){0===n++&&a.addEventListener(e,r,!0)},teardown:function(){0===--n&&a.removeEventListener(e,r,!0)}}}),x.fn.extend({on:function(e,n,r,i,o){var a,s;if("object"==typeof e){"string"!=typeof n&&(r=r||n,n=t);for(a in e)this.on(a,n,r,e[a],o);return this}if(null==r&&null==i?(i=n,r=n=t):null==i&&("string"==typeof n?(i=r,r=t):(i=r,r=n,n=t)),i===!1)i=ot;else if(!i)return this;return 1===o&&(s=i,i=function(e){return x().off(e),s.apply(this,arguments)},i.guid=s.guid||(s.guid=x.guid++)),this.each(function(){x.event.add(this,e,i,r,n)})},one:function(e,t,n,r){return this.on(e,t,n,r,1)},off:function(e,n,r){var i,o;if(e&&e.preventDefault&&e.handleObj)return i=e.handleObj,x(e.delegateTarget).off(i.namespace?i.origType+"."+i.namespace:i.origType,i.selector,i.handler),this;if("object"==typeof e){for(o in e)this.off(o,n,e[o]);return this}return(n===!1||"function"==typeof n)&&(r=n,n=t),r===!1&&(r=ot),this.each(function(){x.event.remove(this,e,r,n)})},trigger:function(e,t){return this.each(function(){x.event.trigger(e,t,this)})},triggerHandler:function(e,n){var r=this[0];return r?x.event.trigger(e,n,r,!0):t}});var st=/^.[^:#\[\.,]*$/,lt=/^(?:parents|prev(?:Until|All))/,ut=x.expr.match.needsContext,ct={children:!0,contents:!0,next:!0,prev:!0};x.fn.extend({find:function(e){var t,n=[],r=this,i=r.length;if("string"!=typeof e)return this.pushStack(x(e).filter(function(){for(t=0;i>t;t++)if(x.contains(r[t],this))return!0}));for(t=0;i>t;t++)x.find(e,r[t],n);return n=this.pushStack(i>1?x.unique(n):n),n.selector=this.selector?this.selector+" "+e:e,n},has:function(e){var t,n=x(e,this),r=n.length;return this.filter(function(){for(t=0;r>t;t++)if(x.contains(this,n[t]))return!0})},not:function(e){return this.pushStack(ft(this,e||[],!0))},filter:function(e){return this.pushStack(ft(this,e||[],!1))},is:function(e){return!!ft(this,"string"==typeof e&&ut.test(e)?x(e):e||[],!1).length},closest:function(e,t){var n,r=0,i=this.length,o=[],a=ut.test(e)||"string"!=typeof e?x(e,t||this.context):0;for(;i>r;r++)for(n=this[r];n&&n!==t;n=n.parentNode)if(11>n.nodeType&&(a?a.index(n)>-1:1===n.nodeType&&x.find.matchesSelector(n,e))){n=o.push(n);break}return this.pushStack(o.length>1?x.unique(o):o)},index:function(e){return e?"string"==typeof e?x.inArray(this[0],x(e)):x.inArray(e.jquery?e[0]:e,this):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(e,t){var n="string"==typeof e?x(e,t):x.makeArray(e&&e.nodeType?[e]:e),r=x.merge(this.get(),n);return this.pushStack(x.unique(r))},addBack:function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}});function pt(e,t){do e=e[t];while(e&&1!==e.nodeType);return e}x.each({parent:function(e){var t=e.parentNode;return t&&11!==t.nodeType?t:null},parents:function(e){return x.dir(e,"parentNode")},parentsUntil:function(e,t,n){return x.dir(e,"parentNode",n)},next:function(e){return pt(e,"nextSibling")},prev:function(e){return pt(e,"previousSibling")},nextAll:function(e){return x.dir(e,"nextSibling")},prevAll:function(e){return x.dir(e,"previousSibling")},nextUntil:function(e,t,n){return x.dir(e,"nextSibling",n)},prevUntil:function(e,t,n){return x.dir(e,"previousSibling",n)},siblings:function(e){return x.sibling((e.parentNode||{}).firstChild,e)},children:function(e){return x.sibling(e.firstChild)},contents:function(e){return x.nodeName(e,"iframe")?e.contentDocument||e.contentWindow.document:x.merge([],e.childNodes)}},function(e,t){x.fn[e]=function(n,r){var i=x.map(this,t,n);return"Until"!==e.slice(-5)&&(r=n),r&&"string"==typeof r&&(i=x.filter(r,i)),this.length>1&&(ct[e]||(i=x.unique(i)),lt.test(e)&&(i=i.reverse())),this.pushStack(i)}}),x.extend({filter:function(e,t,n){var r=t[0];return n&&(e=":not("+e+")"),1===t.length&&1===r.nodeType?x.find.matchesSelector(r,e)?[r]:[]:x.find.matches(e,x.grep(t,function(e){return 1===e.nodeType}))},dir:function(e,n,r){var i=[],o=e[n];while(o&&9!==o.nodeType&&(r===t||1!==o.nodeType||!x(o).is(r)))1===o.nodeType&&i.push(o),o=o[n];return i},sibling:function(e,t){var n=[];for(;e;e=e.nextSibling)1===e.nodeType&&e!==t&&n.push(e);return n}});function ft(e,t,n){if(x.isFunction(t))return x.grep(e,function(e,r){return!!t.call(e,r,e)!==n});if(t.nodeType)return x.grep(e,function(e){return e===t!==n});if("string"==typeof t){if(st.test(t))return x.filter(t,e,n);t=x.filter(t,e)}return x.grep(e,function(e){return x.inArray(e,t)>=0!==n})}function dt(e){var t=ht.split("|"),n=e.createDocumentFragment();if(n.createElement)while(t.length)n.createElement(t.pop());return n}var ht="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",gt=/ jQuery\d+="(?:null|\d+)"/g,mt=RegExp("<(?:"+ht+")[\\s/>]","i"),yt=/^\s+/,vt=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,bt=/<([\w:]+)/,xt=/<tbody/i,wt=/<|&#?\w+;/,Tt=/<(?:script|style|link)/i,Ct=/^(?:checkbox|radio)$/i,Nt=/checked\s*(?:[^=]|=\s*.checked.)/i,kt=/^$|\/(?:java|ecma)script/i,Et=/^true\/(.*)/,St=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,At={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],area:[1,"<map>","</map>"],param:[1,"<object>","</object>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:x.support.htmlSerialize?[0,"",""]:[1,"X<div>","</div>"]},jt=dt(a),Dt=jt.appendChild(a.createElement("div"));At.optgroup=At.option,At.tbody=At.tfoot=At.colgroup=At.caption=At.thead,At.th=At.td,x.fn.extend({text:function(e){return x.access(this,function(e){return e===t?x.text(this):this.empty().append((this[0]&&this[0].ownerDocument||a).createTextNode(e))},null,e,arguments.length)},append:function(){return this.domManip(arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=Lt(this,e);t.appendChild(e)}})},prepend:function(){return this.domManip(arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=Lt(this,e);t.insertBefore(e,t.firstChild)}})},before:function(){return this.domManip(arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this)})},after:function(){return this.domManip(arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this.nextSibling)})},remove:function(e,t){var n,r=e?x.filter(e,this):this,i=0;for(;null!=(n=r[i]);i++)t||1!==n.nodeType||x.cleanData(Ft(n)),n.parentNode&&(t&&x.contains(n.ownerDocument,n)&&_t(Ft(n,"script")),n.parentNode.removeChild(n));return this},empty:function(){var e,t=0;for(;null!=(e=this[t]);t++){1===e.nodeType&&x.cleanData(Ft(e,!1));while(e.firstChild)e.removeChild(e.firstChild);e.options&&x.nodeName(e,"select")&&(e.options.length=0)}return this},clone:function(e,t){return e=null==e?!1:e,t=null==t?e:t,this.map(function(){return x.clone(this,e,t)})},html:function(e){return x.access(this,function(e){var n=this[0]||{},r=0,i=this.length;if(e===t)return 1===n.nodeType?n.innerHTML.replace(gt,""):t;if(!("string"!=typeof e||Tt.test(e)||!x.support.htmlSerialize&&mt.test(e)||!x.support.leadingWhitespace&&yt.test(e)||At[(bt.exec(e)||["",""])[1].toLowerCase()])){e=e.replace(vt,"<$1></$2>");try{for(;i>r;r++)n=this[r]||{},1===n.nodeType&&(x.cleanData(Ft(n,!1)),n.innerHTML=e);n=0}catch(o){}}n&&this.empty().append(e)},null,e,arguments.length)},replaceWith:function(){var e=x.map(this,function(e){return[e.nextSibling,e.parentNode]}),t=0;return this.domManip(arguments,function(n){var r=e[t++],i=e[t++];i&&(r&&r.parentNode!==i&&(r=this.nextSibling),x(this).remove(),i.insertBefore(n,r))},!0),t?this:this.remove()},detach:function(e){return this.remove(e,!0)},domManip:function(e,t,n){e=d.apply([],e);var r,i,o,a,s,l,u=0,c=this.length,p=this,f=c-1,h=e[0],g=x.isFunction(h);if(g||!(1>=c||"string"!=typeof h||x.support.checkClone)&&Nt.test(h))return this.each(function(r){var i=p.eq(r);g&&(e[0]=h.call(this,r,i.html())),i.domManip(e,t,n)});if(c&&(l=x.buildFragment(e,this[0].ownerDocument,!1,!n&&this),r=l.firstChild,1===l.childNodes.length&&(l=r),r)){for(a=x.map(Ft(l,"script"),Ht),o=a.length;c>u;u++)i=l,u!==f&&(i=x.clone(i,!0,!0),o&&x.merge(a,Ft(i,"script"))),t.call(this[u],i,u);if(o)for(s=a[a.length-1].ownerDocument,x.map(a,qt),u=0;o>u;u++)i=a[u],kt.test(i.type||"")&&!x._data(i,"globalEval")&&x.contains(s,i)&&(i.src?x._evalUrl(i.src):x.globalEval((i.text||i.textContent||i.innerHTML||"").replace(St,"")));l=r=null}return this}});function Lt(e,t){return x.nodeName(e,"table")&&x.nodeName(1===t.nodeType?t:t.firstChild,"tr")?e.getElementsByTagName("tbody")[0]||e.appendChild(e.ownerDocument.createElement("tbody")):e}function Ht(e){return e.type=(null!==x.find.attr(e,"type"))+"/"+e.type,e}function qt(e){var t=Et.exec(e.type);return t?e.type=t[1]:e.removeAttribute("type"),e}function _t(e,t){var n,r=0;for(;null!=(n=e[r]);r++)x._data(n,"globalEval",!t||x._data(t[r],"globalEval"))}function Mt(e,t){if(1===t.nodeType&&x.hasData(e)){var n,r,i,o=x._data(e),a=x._data(t,o),s=o.events;if(s){delete a.handle,a.events={};for(n in s)for(r=0,i=s[n].length;i>r;r++)x.event.add(t,n,s[n][r])}a.data&&(a.data=x.extend({},a.data))}}function Ot(e,t){var n,r,i;if(1===t.nodeType){if(n=t.nodeName.toLowerCase(),!x.support.noCloneEvent&&t[x.expando]){i=x._data(t);for(r in i.events)x.removeEvent(t,r,i.handle);t.removeAttribute(x.expando)}"script"===n&&t.text!==e.text?(Ht(t).text=e.text,qt(t)):"object"===n?(t.parentNode&&(t.outerHTML=e.outerHTML),x.support.html5Clone&&e.innerHTML&&!x.trim(t.innerHTML)&&(t.innerHTML=e.innerHTML)):"input"===n&&Ct.test(e.type)?(t.defaultChecked=t.checked=e.checked,t.value!==e.value&&(t.value=e.value)):"option"===n?t.defaultSelected=t.selected=e.defaultSelected:("input"===n||"textarea"===n)&&(t.defaultValue=e.defaultValue)}}x.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(e,t){x.fn[e]=function(e){var n,r=0,i=[],o=x(e),a=o.length-1;for(;a>=r;r++)n=r===a?this:this.clone(!0),x(o[r])[t](n),h.apply(i,n.get());return this.pushStack(i)}});function Ft(e,n){var r,o,a=0,s=typeof e.getElementsByTagName!==i?e.getElementsByTagName(n||"*"):typeof e.querySelectorAll!==i?e.querySelectorAll(n||"*"):t;if(!s)for(s=[],r=e.childNodes||e;null!=(o=r[a]);a++)!n||x.nodeName(o,n)?s.push(o):x.merge(s,Ft(o,n));return n===t||n&&x.nodeName(e,n)?x.merge([e],s):s}function Bt(e){Ct.test(e.type)&&(e.defaultChecked=e.checked)}x.extend({clone:function(e,t,n){var r,i,o,a,s,l=x.contains(e.ownerDocument,e);if(x.support.html5Clone||x.isXMLDoc(e)||!mt.test("<"+e.nodeName+">")?o=e.cloneNode(!0):(Dt.innerHTML=e.outerHTML,Dt.removeChild(o=Dt.firstChild)),!(x.support.noCloneEvent&&x.support.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||x.isXMLDoc(e)))for(r=Ft(o),s=Ft(e),a=0;null!=(i=s[a]);++a)r[a]&&Ot(i,r[a]);if(t)if(n)for(s=s||Ft(e),r=r||Ft(o),a=0;null!=(i=s[a]);a++)Mt(i,r[a]);else Mt(e,o);return r=Ft(o,"script"),r.length>0&&_t(r,!l&&Ft(e,"script")),r=s=i=null,o},buildFragment:function(e,t,n,r){var i,o,a,s,l,u,c,p=e.length,f=dt(t),d=[],h=0;for(;p>h;h++)if(o=e[h],o||0===o)if("object"===x.type(o))x.merge(d,o.nodeType?[o]:o);else if(wt.test(o)){s=s||f.appendChild(t.createElement("div")),l=(bt.exec(o)||["",""])[1].toLowerCase(),c=At[l]||At._default,s.innerHTML=c[1]+o.replace(vt,"<$1></$2>")+c[2],i=c[0];while(i--)s=s.lastChild;if(!x.support.leadingWhitespace&&yt.test(o)&&d.push(t.createTextNode(yt.exec(o)[0])),!x.support.tbody){o="table"!==l||xt.test(o)?"<table>"!==c[1]||xt.test(o)?0:s:s.firstChild,i=o&&o.childNodes.length;while(i--)x.nodeName(u=o.childNodes[i],"tbody")&&!u.childNodes.length&&o.removeChild(u)}x.merge(d,s.childNodes),s.textContent="";while(s.firstChild)s.removeChild(s.firstChild);s=f.lastChild}else d.push(t.createTextNode(o));s&&f.removeChild(s),x.support.appendChecked||x.grep(Ft(d,"input"),Bt),h=0;while(o=d[h++])if((!r||-1===x.inArray(o,r))&&(a=x.contains(o.ownerDocument,o),s=Ft(f.appendChild(o),"script"),a&&_t(s),n)){i=0;while(o=s[i++])kt.test(o.type||"")&&n.push(o)}return s=null,f},cleanData:function(e,t){var n,r,o,a,s=0,l=x.expando,u=x.cache,c=x.support.deleteExpando,f=x.event.special;for(;null!=(n=e[s]);s++)if((t||x.acceptData(n))&&(o=n[l],a=o&&u[o])){if(a.events)for(r in a.events)f[r]?x.event.remove(n,r):x.removeEvent(n,r,a.handle);
|
6 |
+
u[o]&&(delete u[o],c?delete n[l]:typeof n.removeAttribute!==i?n.removeAttribute(l):n[l]=null,p.push(o))}},_evalUrl:function(e){return x.ajax({url:e,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0})}}),x.fn.extend({wrapAll:function(e){if(x.isFunction(e))return this.each(function(t){x(this).wrapAll(e.call(this,t))});if(this[0]){var t=x(e,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){var e=this;while(e.firstChild&&1===e.firstChild.nodeType)e=e.firstChild;return e}).append(this)}return this},wrapInner:function(e){return x.isFunction(e)?this.each(function(t){x(this).wrapInner(e.call(this,t))}):this.each(function(){var t=x(this),n=t.contents();n.length?n.wrapAll(e):t.append(e)})},wrap:function(e){var t=x.isFunction(e);return this.each(function(n){x(this).wrapAll(t?e.call(this,n):e)})},unwrap:function(){return this.parent().each(function(){x.nodeName(this,"body")||x(this).replaceWith(this.childNodes)}).end()}});var Pt,Rt,Wt,$t=/alpha\([^)]*\)/i,It=/opacity\s*=\s*([^)]*)/,zt=/^(top|right|bottom|left)$/,Xt=/^(none|table(?!-c[ea]).+)/,Ut=/^margin/,Vt=RegExp("^("+w+")(.*)$","i"),Yt=RegExp("^("+w+")(?!px)[a-z%]+$","i"),Jt=RegExp("^([+-])=("+w+")","i"),Gt={BODY:"block"},Qt={position:"absolute",visibility:"hidden",display:"block"},Kt={letterSpacing:0,fontWeight:400},Zt=["Top","Right","Bottom","Left"],en=["Webkit","O","Moz","ms"];function tn(e,t){if(t in e)return t;var n=t.charAt(0).toUpperCase()+t.slice(1),r=t,i=en.length;while(i--)if(t=en[i]+n,t in e)return t;return r}function nn(e,t){return e=t||e,"none"===x.css(e,"display")||!x.contains(e.ownerDocument,e)}function rn(e,t){var n,r,i,o=[],a=0,s=e.length;for(;s>a;a++)r=e[a],r.style&&(o[a]=x._data(r,"olddisplay"),n=r.style.display,t?(o[a]||"none"!==n||(r.style.display=""),""===r.style.display&&nn(r)&&(o[a]=x._data(r,"olddisplay",ln(r.nodeName)))):o[a]||(i=nn(r),(n&&"none"!==n||!i)&&x._data(r,"olddisplay",i?n:x.css(r,"display"))));for(a=0;s>a;a++)r=e[a],r.style&&(t&&"none"!==r.style.display&&""!==r.style.display||(r.style.display=t?o[a]||"":"none"));return e}x.fn.extend({css:function(e,n){return x.access(this,function(e,n,r){var i,o,a={},s=0;if(x.isArray(n)){for(o=Rt(e),i=n.length;i>s;s++)a[n[s]]=x.css(e,n[s],!1,o);return a}return r!==t?x.style(e,n,r):x.css(e,n)},e,n,arguments.length>1)},show:function(){return rn(this,!0)},hide:function(){return rn(this)},toggle:function(e){return"boolean"==typeof e?e?this.show():this.hide():this.each(function(){nn(this)?x(this).show():x(this).hide()})}}),x.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=Wt(e,"opacity");return""===n?"1":n}}}},cssNumber:{columnCount:!0,fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":x.support.cssFloat?"cssFloat":"styleFloat"},style:function(e,n,r,i){if(e&&3!==e.nodeType&&8!==e.nodeType&&e.style){var o,a,s,l=x.camelCase(n),u=e.style;if(n=x.cssProps[l]||(x.cssProps[l]=tn(u,l)),s=x.cssHooks[n]||x.cssHooks[l],r===t)return s&&"get"in s&&(o=s.get(e,!1,i))!==t?o:u[n];if(a=typeof r,"string"===a&&(o=Jt.exec(r))&&(r=(o[1]+1)*o[2]+parseFloat(x.css(e,n)),a="number"),!(null==r||"number"===a&&isNaN(r)||("number"!==a||x.cssNumber[l]||(r+="px"),x.support.clearCloneStyle||""!==r||0!==n.indexOf("background")||(u[n]="inherit"),s&&"set"in s&&(r=s.set(e,r,i))===t)))try{u[n]=r}catch(c){}}},css:function(e,n,r,i){var o,a,s,l=x.camelCase(n);return n=x.cssProps[l]||(x.cssProps[l]=tn(e.style,l)),s=x.cssHooks[n]||x.cssHooks[l],s&&"get"in s&&(a=s.get(e,!0,r)),a===t&&(a=Wt(e,n,i)),"normal"===a&&n in Kt&&(a=Kt[n]),""===r||r?(o=parseFloat(a),r===!0||x.isNumeric(o)?o||0:a):a}}),e.getComputedStyle?(Rt=function(t){return e.getComputedStyle(t,null)},Wt=function(e,n,r){var i,o,a,s=r||Rt(e),l=s?s.getPropertyValue(n)||s[n]:t,u=e.style;return s&&(""!==l||x.contains(e.ownerDocument,e)||(l=x.style(e,n)),Yt.test(l)&&Ut.test(n)&&(i=u.width,o=u.minWidth,a=u.maxWidth,u.minWidth=u.maxWidth=u.width=l,l=s.width,u.width=i,u.minWidth=o,u.maxWidth=a)),l}):a.documentElement.currentStyle&&(Rt=function(e){return e.currentStyle},Wt=function(e,n,r){var i,o,a,s=r||Rt(e),l=s?s[n]:t,u=e.style;return null==l&&u&&u[n]&&(l=u[n]),Yt.test(l)&&!zt.test(n)&&(i=u.left,o=e.runtimeStyle,a=o&&o.left,a&&(o.left=e.currentStyle.left),u.left="fontSize"===n?"1em":l,l=u.pixelLeft+"px",u.left=i,a&&(o.left=a)),""===l?"auto":l});function on(e,t,n){var r=Vt.exec(t);return r?Math.max(0,r[1]-(n||0))+(r[2]||"px"):t}function an(e,t,n,r,i){var o=n===(r?"border":"content")?4:"width"===t?1:0,a=0;for(;4>o;o+=2)"margin"===n&&(a+=x.css(e,n+Zt[o],!0,i)),r?("content"===n&&(a-=x.css(e,"padding"+Zt[o],!0,i)),"margin"!==n&&(a-=x.css(e,"border"+Zt[o]+"Width",!0,i))):(a+=x.css(e,"padding"+Zt[o],!0,i),"padding"!==n&&(a+=x.css(e,"border"+Zt[o]+"Width",!0,i)));return a}function sn(e,t,n){var r=!0,i="width"===t?e.offsetWidth:e.offsetHeight,o=Rt(e),a=x.support.boxSizing&&"border-box"===x.css(e,"boxSizing",!1,o);if(0>=i||null==i){if(i=Wt(e,t,o),(0>i||null==i)&&(i=e.style[t]),Yt.test(i))return i;r=a&&(x.support.boxSizingReliable||i===e.style[t]),i=parseFloat(i)||0}return i+an(e,t,n||(a?"border":"content"),r,o)+"px"}function ln(e){var t=a,n=Gt[e];return n||(n=un(e,t),"none"!==n&&n||(Pt=(Pt||x("<iframe frameborder='0' width='0' height='0'/>").css("cssText","display:block !important")).appendTo(t.documentElement),t=(Pt[0].contentWindow||Pt[0].contentDocument).document,t.write("<!doctype html><html><body>"),t.close(),n=un(e,t),Pt.detach()),Gt[e]=n),n}function un(e,t){var n=x(t.createElement(e)).appendTo(t.body),r=x.css(n[0],"display");return n.remove(),r}x.each(["height","width"],function(e,n){x.cssHooks[n]={get:function(e,r,i){return r?0===e.offsetWidth&&Xt.test(x.css(e,"display"))?x.swap(e,Qt,function(){return sn(e,n,i)}):sn(e,n,i):t},set:function(e,t,r){var i=r&&Rt(e);return on(e,t,r?an(e,n,r,x.support.boxSizing&&"border-box"===x.css(e,"boxSizing",!1,i),i):0)}}}),x.support.opacity||(x.cssHooks.opacity={get:function(e,t){return It.test((t&&e.currentStyle?e.currentStyle.filter:e.style.filter)||"")?.01*parseFloat(RegExp.$1)+"":t?"1":""},set:function(e,t){var n=e.style,r=e.currentStyle,i=x.isNumeric(t)?"alpha(opacity="+100*t+")":"",o=r&&r.filter||n.filter||"";n.zoom=1,(t>=1||""===t)&&""===x.trim(o.replace($t,""))&&n.removeAttribute&&(n.removeAttribute("filter"),""===t||r&&!r.filter)||(n.filter=$t.test(o)?o.replace($t,i):o+" "+i)}}),x(function(){x.support.reliableMarginRight||(x.cssHooks.marginRight={get:function(e,n){return n?x.swap(e,{display:"inline-block"},Wt,[e,"marginRight"]):t}}),!x.support.pixelPosition&&x.fn.position&&x.each(["top","left"],function(e,n){x.cssHooks[n]={get:function(e,r){return r?(r=Wt(e,n),Yt.test(r)?x(e).position()[n]+"px":r):t}}})}),x.expr&&x.expr.filters&&(x.expr.filters.hidden=function(e){return 0>=e.offsetWidth&&0>=e.offsetHeight||!x.support.reliableHiddenOffsets&&"none"===(e.style&&e.style.display||x.css(e,"display"))},x.expr.filters.visible=function(e){return!x.expr.filters.hidden(e)}),x.each({margin:"",padding:"",border:"Width"},function(e,t){x.cssHooks[e+t]={expand:function(n){var r=0,i={},o="string"==typeof n?n.split(" "):[n];for(;4>r;r++)i[e+Zt[r]+t]=o[r]||o[r-2]||o[0];return i}},Ut.test(e)||(x.cssHooks[e+t].set=on)});var cn=/%20/g,pn=/\[\]$/,fn=/\r?\n/g,dn=/^(?:submit|button|image|reset|file)$/i,hn=/^(?:input|select|textarea|keygen)/i;x.fn.extend({serialize:function(){return x.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var e=x.prop(this,"elements");return e?x.makeArray(e):this}).filter(function(){var e=this.type;return this.name&&!x(this).is(":disabled")&&hn.test(this.nodeName)&&!dn.test(e)&&(this.checked||!Ct.test(e))}).map(function(e,t){var n=x(this).val();return null==n?null:x.isArray(n)?x.map(n,function(e){return{name:t.name,value:e.replace(fn,"\r\n")}}):{name:t.name,value:n.replace(fn,"\r\n")}}).get()}}),x.param=function(e,n){var r,i=[],o=function(e,t){t=x.isFunction(t)?t():null==t?"":t,i[i.length]=encodeURIComponent(e)+"="+encodeURIComponent(t)};if(n===t&&(n=x.ajaxSettings&&x.ajaxSettings.traditional),x.isArray(e)||e.jquery&&!x.isPlainObject(e))x.each(e,function(){o(this.name,this.value)});else for(r in e)gn(r,e[r],n,o);return i.join("&").replace(cn,"+")};function gn(e,t,n,r){var i;if(x.isArray(t))x.each(t,function(t,i){n||pn.test(e)?r(e,i):gn(e+"["+("object"==typeof i?t:"")+"]",i,n,r)});else if(n||"object"!==x.type(t))r(e,t);else for(i in t)gn(e+"["+i+"]",t[i],n,r)}x.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(e,t){x.fn[t]=function(e,n){return arguments.length>0?this.on(t,null,e,n):this.trigger(t)}}),x.fn.extend({hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)},bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",n)}});var mn,yn,vn=x.now(),bn=/\?/,xn=/#.*$/,wn=/([?&])_=[^&]*/,Tn=/^(.*?):[ \t]*([^\r\n]*)\r?$/gm,Cn=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Nn=/^(?:GET|HEAD)$/,kn=/^\/\//,En=/^([\w.+-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/,Sn=x.fn.load,An={},jn={},Dn="*/".concat("*");try{yn=o.href}catch(Ln){yn=a.createElement("a"),yn.href="",yn=yn.href}mn=En.exec(yn.toLowerCase())||[];function Hn(e){return function(t,n){"string"!=typeof t&&(n=t,t="*");var r,i=0,o=t.toLowerCase().match(T)||[];if(x.isFunction(n))while(r=o[i++])"+"===r[0]?(r=r.slice(1)||"*",(e[r]=e[r]||[]).unshift(n)):(e[r]=e[r]||[]).push(n)}}function qn(e,n,r,i){var o={},a=e===jn;function s(l){var u;return o[l]=!0,x.each(e[l]||[],function(e,l){var c=l(n,r,i);return"string"!=typeof c||a||o[c]?a?!(u=c):t:(n.dataTypes.unshift(c),s(c),!1)}),u}return s(n.dataTypes[0])||!o["*"]&&s("*")}function _n(e,n){var r,i,o=x.ajaxSettings.flatOptions||{};for(i in n)n[i]!==t&&((o[i]?e:r||(r={}))[i]=n[i]);return r&&x.extend(!0,e,r),e}x.fn.load=function(e,n,r){if("string"!=typeof e&&Sn)return Sn.apply(this,arguments);var i,o,a,s=this,l=e.indexOf(" ");return l>=0&&(i=e.slice(l,e.length),e=e.slice(0,l)),x.isFunction(n)?(r=n,n=t):n&&"object"==typeof n&&(a="POST"),s.length>0&&x.ajax({url:e,type:a,dataType:"html",data:n}).done(function(e){o=arguments,s.html(i?x("<div>").append(x.parseHTML(e)).find(i):e)}).complete(r&&function(e,t){s.each(r,o||[e.responseText,t,e])}),this},x.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){x.fn[t]=function(e){return this.on(t,e)}}),x.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:yn,type:"GET",isLocal:Cn.test(mn[1]),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Dn,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":x.parseJSON,"text xml":x.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(e,t){return t?_n(_n(e,x.ajaxSettings),t):_n(x.ajaxSettings,e)},ajaxPrefilter:Hn(An),ajaxTransport:Hn(jn),ajax:function(e,n){"object"==typeof e&&(n=e,e=t),n=n||{};var r,i,o,a,s,l,u,c,p=x.ajaxSetup({},n),f=p.context||p,d=p.context&&(f.nodeType||f.jquery)?x(f):x.event,h=x.Deferred(),g=x.Callbacks("once memory"),m=p.statusCode||{},y={},v={},b=0,w="canceled",C={readyState:0,getResponseHeader:function(e){var t;if(2===b){if(!c){c={};while(t=Tn.exec(a))c[t[1].toLowerCase()]=t[2]}t=c[e.toLowerCase()]}return null==t?null:t},getAllResponseHeaders:function(){return 2===b?a:null},setRequestHeader:function(e,t){var n=e.toLowerCase();return b||(e=v[n]=v[n]||e,y[e]=t),this},overrideMimeType:function(e){return b||(p.mimeType=e),this},statusCode:function(e){var t;if(e)if(2>b)for(t in e)m[t]=[m[t],e[t]];else C.always(e[C.status]);return this},abort:function(e){var t=e||w;return u&&u.abort(t),k(0,t),this}};if(h.promise(C).complete=g.add,C.success=C.done,C.error=C.fail,p.url=((e||p.url||yn)+"").replace(xn,"").replace(kn,mn[1]+"//"),p.type=n.method||n.type||p.method||p.type,p.dataTypes=x.trim(p.dataType||"*").toLowerCase().match(T)||[""],null==p.crossDomain&&(r=En.exec(p.url.toLowerCase()),p.crossDomain=!(!r||r[1]===mn[1]&&r[2]===mn[2]&&(r[3]||("http:"===r[1]?"80":"443"))===(mn[3]||("http:"===mn[1]?"80":"443")))),p.data&&p.processData&&"string"!=typeof p.data&&(p.data=x.param(p.data,p.traditional)),qn(An,p,n,C),2===b)return C;l=p.global,l&&0===x.active++&&x.event.trigger("ajaxStart"),p.type=p.type.toUpperCase(),p.hasContent=!Nn.test(p.type),o=p.url,p.hasContent||(p.data&&(o=p.url+=(bn.test(o)?"&":"?")+p.data,delete p.data),p.cache===!1&&(p.url=wn.test(o)?o.replace(wn,"$1_="+vn++):o+(bn.test(o)?"&":"?")+"_="+vn++)),p.ifModified&&(x.lastModified[o]&&C.setRequestHeader("If-Modified-Since",x.lastModified[o]),x.etag[o]&&C.setRequestHeader("If-None-Match",x.etag[o])),(p.data&&p.hasContent&&p.contentType!==!1||n.contentType)&&C.setRequestHeader("Content-Type",p.contentType),C.setRequestHeader("Accept",p.dataTypes[0]&&p.accepts[p.dataTypes[0]]?p.accepts[p.dataTypes[0]]+("*"!==p.dataTypes[0]?", "+Dn+"; q=0.01":""):p.accepts["*"]);for(i in p.headers)C.setRequestHeader(i,p.headers[i]);if(p.beforeSend&&(p.beforeSend.call(f,C,p)===!1||2===b))return C.abort();w="abort";for(i in{success:1,error:1,complete:1})C[i](p[i]);if(u=qn(jn,p,n,C)){C.readyState=1,l&&d.trigger("ajaxSend",[C,p]),p.async&&p.timeout>0&&(s=setTimeout(function(){C.abort("timeout")},p.timeout));try{b=1,u.send(y,k)}catch(N){if(!(2>b))throw N;k(-1,N)}}else k(-1,"No Transport");function k(e,n,r,i){var c,y,v,w,T,N=n;2!==b&&(b=2,s&&clearTimeout(s),u=t,a=i||"",C.readyState=e>0?4:0,c=e>=200&&300>e||304===e,r&&(w=Mn(p,C,r)),w=On(p,w,C,c),c?(p.ifModified&&(T=C.getResponseHeader("Last-Modified"),T&&(x.lastModified[o]=T),T=C.getResponseHeader("etag"),T&&(x.etag[o]=T)),204===e||"HEAD"===p.type?N="nocontent":304===e?N="notmodified":(N=w.state,y=w.data,v=w.error,c=!v)):(v=N,(e||!N)&&(N="error",0>e&&(e=0))),C.status=e,C.statusText=(n||N)+"",c?h.resolveWith(f,[y,N,C]):h.rejectWith(f,[C,N,v]),C.statusCode(m),m=t,l&&d.trigger(c?"ajaxSuccess":"ajaxError",[C,p,c?y:v]),g.fireWith(f,[C,N]),l&&(d.trigger("ajaxComplete",[C,p]),--x.active||x.event.trigger("ajaxStop")))}return C},getJSON:function(e,t,n){return x.get(e,t,n,"json")},getScript:function(e,n){return x.get(e,t,n,"script")}}),x.each(["get","post"],function(e,n){x[n]=function(e,r,i,o){return x.isFunction(r)&&(o=o||i,i=r,r=t),x.ajax({url:e,type:n,dataType:o,data:r,success:i})}});function Mn(e,n,r){var i,o,a,s,l=e.contents,u=e.dataTypes;while("*"===u[0])u.shift(),o===t&&(o=e.mimeType||n.getResponseHeader("Content-Type"));if(o)for(s in l)if(l[s]&&l[s].test(o)){u.unshift(s);break}if(u[0]in r)a=u[0];else{for(s in r){if(!u[0]||e.converters[s+" "+u[0]]){a=s;break}i||(i=s)}a=a||i}return a?(a!==u[0]&&u.unshift(a),r[a]):t}function On(e,t,n,r){var i,o,a,s,l,u={},c=e.dataTypes.slice();if(c[1])for(a in e.converters)u[a.toLowerCase()]=e.converters[a];o=c.shift();while(o)if(e.responseFields[o]&&(n[e.responseFields[o]]=t),!l&&r&&e.dataFilter&&(t=e.dataFilter(t,e.dataType)),l=o,o=c.shift())if("*"===o)o=l;else if("*"!==l&&l!==o){if(a=u[l+" "+o]||u["* "+o],!a)for(i in u)if(s=i.split(" "),s[1]===o&&(a=u[l+" "+s[0]]||u["* "+s[0]])){a===!0?a=u[i]:u[i]!==!0&&(o=s[0],c.unshift(s[1]));break}if(a!==!0)if(a&&e["throws"])t=a(t);else try{t=a(t)}catch(p){return{state:"parsererror",error:a?p:"No conversion from "+l+" to "+o}}}return{state:"success",data:t}}x.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/(?:java|ecma)script/},converters:{"text script":function(e){return x.globalEval(e),e}}}),x.ajaxPrefilter("script",function(e){e.cache===t&&(e.cache=!1),e.crossDomain&&(e.type="GET",e.global=!1)}),x.ajaxTransport("script",function(e){if(e.crossDomain){var n,r=a.head||x("head")[0]||a.documentElement;return{send:function(t,i){n=a.createElement("script"),n.async=!0,e.scriptCharset&&(n.charset=e.scriptCharset),n.src=e.url,n.onload=n.onreadystatechange=function(e,t){(t||!n.readyState||/loaded|complete/.test(n.readyState))&&(n.onload=n.onreadystatechange=null,n.parentNode&&n.parentNode.removeChild(n),n=null,t||i(200,"success"))},r.insertBefore(n,r.firstChild)},abort:function(){n&&n.onload(t,!0)}}}});var Fn=[],Bn=/(=)\?(?=&|$)|\?\?/;x.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=Fn.pop()||x.expando+"_"+vn++;return this[e]=!0,e}}),x.ajaxPrefilter("json jsonp",function(n,r,i){var o,a,s,l=n.jsonp!==!1&&(Bn.test(n.url)?"url":"string"==typeof n.data&&!(n.contentType||"").indexOf("application/x-www-form-urlencoded")&&Bn.test(n.data)&&"data");return l||"jsonp"===n.dataTypes[0]?(o=n.jsonpCallback=x.isFunction(n.jsonpCallback)?n.jsonpCallback():n.jsonpCallback,l?n[l]=n[l].replace(Bn,"$1"+o):n.jsonp!==!1&&(n.url+=(bn.test(n.url)?"&":"?")+n.jsonp+"="+o),n.converters["script json"]=function(){return s||x.error(o+" was not called"),s[0]},n.dataTypes[0]="json",a=e[o],e[o]=function(){s=arguments},i.always(function(){e[o]=a,n[o]&&(n.jsonpCallback=r.jsonpCallback,Fn.push(o)),s&&x.isFunction(a)&&a(s[0]),s=a=t}),"script"):t});var Pn,Rn,Wn=0,$n=e.ActiveXObject&&function(){var e;for(e in Pn)Pn[e](t,!0)};function In(){try{return new e.XMLHttpRequest}catch(t){}}function zn(){try{return new e.ActiveXObject("Microsoft.XMLHTTP")}catch(t){}}x.ajaxSettings.xhr=e.ActiveXObject?function(){return!this.isLocal&&In()||zn()}:In,Rn=x.ajaxSettings.xhr(),x.support.cors=!!Rn&&"withCredentials"in Rn,Rn=x.support.ajax=!!Rn,Rn&&x.ajaxTransport(function(n){if(!n.crossDomain||x.support.cors){var r;return{send:function(i,o){var a,s,l=n.xhr();if(n.username?l.open(n.type,n.url,n.async,n.username,n.password):l.open(n.type,n.url,n.async),n.xhrFields)for(s in n.xhrFields)l[s]=n.xhrFields[s];n.mimeType&&l.overrideMimeType&&l.overrideMimeType(n.mimeType),n.crossDomain||i["X-Requested-With"]||(i["X-Requested-With"]="XMLHttpRequest");try{for(s in i)l.setRequestHeader(s,i[s])}catch(u){}l.send(n.hasContent&&n.data||null),r=function(e,i){var s,u,c,p;try{if(r&&(i||4===l.readyState))if(r=t,a&&(l.onreadystatechange=x.noop,$n&&delete Pn[a]),i)4!==l.readyState&&l.abort();else{p={},s=l.status,u=l.getAllResponseHeaders(),"string"==typeof l.responseText&&(p.text=l.responseText);try{c=l.statusText}catch(f){c=""}s||!n.isLocal||n.crossDomain?1223===s&&(s=204):s=p.text?200:404}}catch(d){i||o(-1,d)}p&&o(s,c,p,u)},n.async?4===l.readyState?setTimeout(r):(a=++Wn,$n&&(Pn||(Pn={},x(e).unload($n)),Pn[a]=r),l.onreadystatechange=r):r()},abort:function(){r&&r(t,!0)}}}});var Xn,Un,Vn=/^(?:toggle|show|hide)$/,Yn=RegExp("^(?:([+-])=|)("+w+")([a-z%]*)$","i"),Jn=/queueHooks$/,Gn=[nr],Qn={"*":[function(e,t){var n=this.createTween(e,t),r=n.cur(),i=Yn.exec(t),o=i&&i[3]||(x.cssNumber[e]?"":"px"),a=(x.cssNumber[e]||"px"!==o&&+r)&&Yn.exec(x.css(n.elem,e)),s=1,l=20;if(a&&a[3]!==o){o=o||a[3],i=i||[],a=+r||1;do s=s||".5",a/=s,x.style(n.elem,e,a+o);while(s!==(s=n.cur()/r)&&1!==s&&--l)}return i&&(a=n.start=+a||+r||0,n.unit=o,n.end=i[1]?a+(i[1]+1)*i[2]:+i[2]),n}]};function Kn(){return setTimeout(function(){Xn=t}),Xn=x.now()}function Zn(e,t,n){var r,i=(Qn[t]||[]).concat(Qn["*"]),o=0,a=i.length;for(;a>o;o++)if(r=i[o].call(n,t,e))return r}function er(e,t,n){var r,i,o=0,a=Gn.length,s=x.Deferred().always(function(){delete l.elem}),l=function(){if(i)return!1;var t=Xn||Kn(),n=Math.max(0,u.startTime+u.duration-t),r=n/u.duration||0,o=1-r,a=0,l=u.tweens.length;for(;l>a;a++)u.tweens[a].run(o);return s.notifyWith(e,[u,o,n]),1>o&&l?n:(s.resolveWith(e,[u]),!1)},u=s.promise({elem:e,props:x.extend({},t),opts:x.extend(!0,{specialEasing:{}},n),originalProperties:t,originalOptions:n,startTime:Xn||Kn(),duration:n.duration,tweens:[],createTween:function(t,n){var r=x.Tween(e,u.opts,t,n,u.opts.specialEasing[t]||u.opts.easing);return u.tweens.push(r),r},stop:function(t){var n=0,r=t?u.tweens.length:0;if(i)return this;for(i=!0;r>n;n++)u.tweens[n].run(1);return t?s.resolveWith(e,[u,t]):s.rejectWith(e,[u,t]),this}}),c=u.props;for(tr(c,u.opts.specialEasing);a>o;o++)if(r=Gn[o].call(u,e,c,u.opts))return r;return x.map(c,Zn,u),x.isFunction(u.opts.start)&&u.opts.start.call(e,u),x.fx.timer(x.extend(l,{elem:e,anim:u,queue:u.opts.queue})),u.progress(u.opts.progress).done(u.opts.done,u.opts.complete).fail(u.opts.fail).always(u.opts.always)}function tr(e,t){var n,r,i,o,a;for(n in e)if(r=x.camelCase(n),i=t[r],o=e[n],x.isArray(o)&&(i=o[1],o=e[n]=o[0]),n!==r&&(e[r]=o,delete e[n]),a=x.cssHooks[r],a&&"expand"in a){o=a.expand(o),delete e[r];for(n in o)n in e||(e[n]=o[n],t[n]=i)}else t[r]=i}x.Animation=x.extend(er,{tweener:function(e,t){x.isFunction(e)?(t=e,e=["*"]):e=e.split(" ");var n,r=0,i=e.length;for(;i>r;r++)n=e[r],Qn[n]=Qn[n]||[],Qn[n].unshift(t)},prefilter:function(e,t){t?Gn.unshift(e):Gn.push(e)}});function nr(e,t,n){var r,i,o,a,s,l,u=this,c={},p=e.style,f=e.nodeType&&nn(e),d=x._data(e,"fxshow");n.queue||(s=x._queueHooks(e,"fx"),null==s.unqueued&&(s.unqueued=0,l=s.empty.fire,s.empty.fire=function(){s.unqueued||l()}),s.unqueued++,u.always(function(){u.always(function(){s.unqueued--,x.queue(e,"fx").length||s.empty.fire()})})),1===e.nodeType&&("height"in t||"width"in t)&&(n.overflow=[p.overflow,p.overflowX,p.overflowY],"inline"===x.css(e,"display")&&"none"===x.css(e,"float")&&(x.support.inlineBlockNeedsLayout&&"inline"!==ln(e.nodeName)?p.zoom=1:p.display="inline-block")),n.overflow&&(p.overflow="hidden",x.support.shrinkWrapBlocks||u.always(function(){p.overflow=n.overflow[0],p.overflowX=n.overflow[1],p.overflowY=n.overflow[2]}));for(r in t)if(i=t[r],Vn.exec(i)){if(delete t[r],o=o||"toggle"===i,i===(f?"hide":"show"))continue;c[r]=d&&d[r]||x.style(e,r)}if(!x.isEmptyObject(c)){d?"hidden"in d&&(f=d.hidden):d=x._data(e,"fxshow",{}),o&&(d.hidden=!f),f?x(e).show():u.done(function(){x(e).hide()}),u.done(function(){var t;x._removeData(e,"fxshow");for(t in c)x.style(e,t,c[t])});for(r in c)a=Zn(f?d[r]:0,r,u),r in d||(d[r]=a.start,f&&(a.end=a.start,a.start="width"===r||"height"===r?1:0))}}function rr(e,t,n,r,i){return new rr.prototype.init(e,t,n,r,i)}x.Tween=rr,rr.prototype={constructor:rr,init:function(e,t,n,r,i,o){this.elem=e,this.prop=n,this.easing=i||"swing",this.options=t,this.start=this.now=this.cur(),this.end=r,this.unit=o||(x.cssNumber[n]?"":"px")},cur:function(){var e=rr.propHooks[this.prop];return e&&e.get?e.get(this):rr.propHooks._default.get(this)},run:function(e){var t,n=rr.propHooks[this.prop];return this.pos=t=this.options.duration?x.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):e,this.now=(this.end-this.start)*t+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):rr.propHooks._default.set(this),this}},rr.prototype.init.prototype=rr.prototype,rr.propHooks={_default:{get:function(e){var t;return null==e.elem[e.prop]||e.elem.style&&null!=e.elem.style[e.prop]?(t=x.css(e.elem,e.prop,""),t&&"auto"!==t?t:0):e.elem[e.prop]},set:function(e){x.fx.step[e.prop]?x.fx.step[e.prop](e):e.elem.style&&(null!=e.elem.style[x.cssProps[e.prop]]||x.cssHooks[e.prop])?x.style(e.elem,e.prop,e.now+e.unit):e.elem[e.prop]=e.now}}},rr.propHooks.scrollTop=rr.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},x.each(["toggle","show","hide"],function(e,t){var n=x.fn[t];x.fn[t]=function(e,r,i){return null==e||"boolean"==typeof e?n.apply(this,arguments):this.animate(ir(t,!0),e,r,i)}}),x.fn.extend({fadeTo:function(e,t,n,r){return this.filter(nn).css("opacity",0).show().end().animate({opacity:t},e,n,r)},animate:function(e,t,n,r){var i=x.isEmptyObject(e),o=x.speed(t,n,r),a=function(){var t=er(this,x.extend({},e),o);(i||x._data(this,"finish"))&&t.stop(!0)};return a.finish=a,i||o.queue===!1?this.each(a):this.queue(o.queue,a)},stop:function(e,n,r){var i=function(e){var t=e.stop;delete e.stop,t(r)};return"string"!=typeof e&&(r=n,n=e,e=t),n&&e!==!1&&this.queue(e||"fx",[]),this.each(function(){var t=!0,n=null!=e&&e+"queueHooks",o=x.timers,a=x._data(this);if(n)a[n]&&a[n].stop&&i(a[n]);else for(n in a)a[n]&&a[n].stop&&Jn.test(n)&&i(a[n]);for(n=o.length;n--;)o[n].elem!==this||null!=e&&o[n].queue!==e||(o[n].anim.stop(r),t=!1,o.splice(n,1));(t||!r)&&x.dequeue(this,e)})},finish:function(e){return e!==!1&&(e=e||"fx"),this.each(function(){var t,n=x._data(this),r=n[e+"queue"],i=n[e+"queueHooks"],o=x.timers,a=r?r.length:0;for(n.finish=!0,x.queue(this,e,[]),i&&i.stop&&i.stop.call(this,!0),t=o.length;t--;)o[t].elem===this&&o[t].queue===e&&(o[t].anim.stop(!0),o.splice(t,1));for(t=0;a>t;t++)r[t]&&r[t].finish&&r[t].finish.call(this);delete n.finish})}});function ir(e,t){var n,r={height:e},i=0;for(t=t?1:0;4>i;i+=2-t)n=Zt[i],r["margin"+n]=r["padding"+n]=e;return t&&(r.opacity=r.width=e),r}x.each({slideDown:ir("show"),slideUp:ir("hide"),slideToggle:ir("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(e,t){x.fn[e]=function(e,n,r){return this.animate(t,e,n,r)}}),x.speed=function(e,t,n){var r=e&&"object"==typeof e?x.extend({},e):{complete:n||!n&&t||x.isFunction(e)&&e,duration:e,easing:n&&t||t&&!x.isFunction(t)&&t};return r.duration=x.fx.off?0:"number"==typeof r.duration?r.duration:r.duration in x.fx.speeds?x.fx.speeds[r.duration]:x.fx.speeds._default,(null==r.queue||r.queue===!0)&&(r.queue="fx"),r.old=r.complete,r.complete=function(){x.isFunction(r.old)&&r.old.call(this),r.queue&&x.dequeue(this,r.queue)},r},x.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2}},x.timers=[],x.fx=rr.prototype.init,x.fx.tick=function(){var e,n=x.timers,r=0;for(Xn=x.now();n.length>r;r++)e=n[r],e()||n[r]!==e||n.splice(r--,1);n.length||x.fx.stop(),Xn=t},x.fx.timer=function(e){e()&&x.timers.push(e)&&x.fx.start()},x.fx.interval=13,x.fx.start=function(){Un||(Un=setInterval(x.fx.tick,x.fx.interval))},x.fx.stop=function(){clearInterval(Un),Un=null},x.fx.speeds={slow:600,fast:200,_default:400},x.fx.step={},x.expr&&x.expr.filters&&(x.expr.filters.animated=function(e){return x.grep(x.timers,function(t){return e===t.elem}).length}),x.fn.offset=function(e){if(arguments.length)return e===t?this:this.each(function(t){x.offset.setOffset(this,e,t)});var n,r,o={top:0,left:0},a=this[0],s=a&&a.ownerDocument;if(s)return n=s.documentElement,x.contains(n,a)?(typeof a.getBoundingClientRect!==i&&(o=a.getBoundingClientRect()),r=or(s),{top:o.top+(r.pageYOffset||n.scrollTop)-(n.clientTop||0),left:o.left+(r.pageXOffset||n.scrollLeft)-(n.clientLeft||0)}):o},x.offset={setOffset:function(e,t,n){var r=x.css(e,"position");"static"===r&&(e.style.position="relative");var i=x(e),o=i.offset(),a=x.css(e,"top"),s=x.css(e,"left"),l=("absolute"===r||"fixed"===r)&&x.inArray("auto",[a,s])>-1,u={},c={},p,f;l?(c=i.position(),p=c.top,f=c.left):(p=parseFloat(a)||0,f=parseFloat(s)||0),x.isFunction(t)&&(t=t.call(e,n,o)),null!=t.top&&(u.top=t.top-o.top+p),null!=t.left&&(u.left=t.left-o.left+f),"using"in t?t.using.call(e,u):i.css(u)}},x.fn.extend({position:function(){if(this[0]){var e,t,n={top:0,left:0},r=this[0];return"fixed"===x.css(r,"position")?t=r.getBoundingClientRect():(e=this.offsetParent(),t=this.offset(),x.nodeName(e[0],"html")||(n=e.offset()),n.top+=x.css(e[0],"borderTopWidth",!0),n.left+=x.css(e[0],"borderLeftWidth",!0)),{top:t.top-n.top-x.css(r,"marginTop",!0),left:t.left-n.left-x.css(r,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var e=this.offsetParent||s;while(e&&!x.nodeName(e,"html")&&"static"===x.css(e,"position"))e=e.offsetParent;return e||s})}}),x.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(e,n){var r=/Y/.test(n);x.fn[e]=function(i){return x.access(this,function(e,i,o){var a=or(e);return o===t?a?n in a?a[n]:a.document.documentElement[i]:e[i]:(a?a.scrollTo(r?x(a).scrollLeft():o,r?o:x(a).scrollTop()):e[i]=o,t)},e,i,arguments.length,null)}});function or(e){return x.isWindow(e)?e:9===e.nodeType?e.defaultView||e.parentWindow:!1}x.each({Height:"height",Width:"width"},function(e,n){x.each({padding:"inner"+e,content:n,"":"outer"+e},function(r,i){x.fn[i]=function(i,o){var a=arguments.length&&(r||"boolean"!=typeof i),s=r||(i===!0||o===!0?"margin":"border");return x.access(this,function(n,r,i){var o;return x.isWindow(n)?n.document.documentElement["client"+e]:9===n.nodeType?(o=n.documentElement,Math.max(n.body["scroll"+e],o["scroll"+e],n.body["offset"+e],o["offset"+e],o["client"+e])):i===t?x.css(n,r,s):x.style(n,r,i,s)},n,a?i:t,a,null)}})}),x.fn.size=function(){return this.length},x.fn.andSelf=x.fn.addBack,"object"==typeof module&&module&&"object"==typeof module.exports?module.exports=x:(e.jQuery=e.$=x,"function"==typeof define&&define.amd&&define("jquery",[],function(){return x}))})(window);
|
7 |
+
jQuery.noConflict()
|
js/auguria/interactiveimage/jquery.maphilight.min.js
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
(function(G){var B,J,C,K,N,M,I,E,H,A,L;J=!!document.createElement("canvas").getContext;B=(function(){var P=document.createElement("div");P.innerHTML='<v:shape id="vml_flag1" adj="1" />';var O=P.firstChild;O.style.behavior="url(#default#VML)";return O?typeof O.adj=="object":true})();if(!(J||B)){G.fn.maphilight=function(){return this};return }if(J){E=function(O){return Math.max(0,Math.min(parseInt(O,16),255))};H=function(O,P){return"rgba("+E(O.substr(0,2))+","+E(O.substr(2,2))+","+E(O.substr(4,2))+","+P+")"};C=function(O){var P=G('<canvas style="width:'+O.width+"px;height:"+O.height+'px;"></canvas>').get(0);P.getContext("2d").clearRect(0,0,P.width,P.height);return P};var F=function(Q,O,R,P,S){P=P||0;S=S||0;Q.beginPath();if(O=="rect"){Q.rect(R[0]+P,R[1]+S,R[2]-R[0],R[3]-R[1])}else{if(O=="poly"){Q.moveTo(R[0]+P,R[1]+S);for(i=2;i<R.length;i+=2){Q.lineTo(R[i]+P,R[i+1]+S)}}else{if(O=="circ"){Q.arc(R[0]+P,R[1]+S,R[2],0,Math.PI*2,false)}}}Q.closePath()};K=function(Q,T,U,X,O){var S,P=Q.getContext("2d");if(X.shadow){P.save();if(X.shadowPosition=="inside"){F(P,T,U);P.clip()}var R=Q.width*100;var W=Q.height*100;F(P,T,U,R,W);P.shadowOffsetX=X.shadowX-R;P.shadowOffsetY=X.shadowY-W;P.shadowBlur=X.shadowRadius;P.shadowColor=H(X.shadowColor,X.shadowOpacity);var V=X.shadowFrom;if(!V){if(X.shadowPosition=="outside"){V="fill"}else{V="stroke"}}if(V=="stroke"){P.strokeStyle="rgba(0,0,0,1)";P.stroke()}else{if(V=="fill"){P.fillStyle="rgba(0,0,0,1)";P.fill()}}P.restore();if(X.shadowPosition=="outside"){P.save();F(P,T,U);P.globalCompositeOperation="destination-out";P.fillStyle="rgba(0,0,0,1);";P.fill();P.restore()}}P.save();F(P,T,U);if(X.fill){P.fillStyle=H(X.fillColor,X.fillOpacity);P.fill()}if(X.stroke){P.strokeStyle=H(X.strokeColor,X.strokeOpacity);P.lineWidth=X.strokeWidth;P.stroke()}P.restore();if(X.fade){G(Q).css("opacity",0).animate({opacity:1},100)}};N=function(O){O.getContext("2d").clearRect(0,0,O.width,O.height)}}else{C=function(O){return G('<var style="zoom:1;overflow:hidden;display:block;width:'+O.width+"px;height:"+O.height+'px;"></var>').get(0)};K=function(P,T,U,X,O){var V,W,R,S;for(var Q in U){U[Q]=parseInt(U[Q],10)}V='<v:fill color="#'+X.fillColor+'" opacity="'+(X.fill?X.fillOpacity:0)+'" />';W=(X.stroke?'strokeweight="'+X.strokeWidth+'" stroked="t" strokecolor="#'+X.strokeColor+'"':'stroked="f"');R='<v:stroke opacity="'+X.strokeOpacity+'"/>';if(T=="rect"){S=G('<v:rect name="'+O+'" filled="t" '+W+' style="zoom:1;margin:0;padding:0;display:block;position:absolute;left:'+U[0]+"px;top:"+U[1]+"px;width:"+(U[2]-U[0])+"px;height:"+(U[3]-U[1])+'px;"></v:rect>')}else{if(T=="poly"){S=G('<v:shape name="'+O+'" filled="t" '+W+' coordorigin="0,0" coordsize="'+P.width+","+P.height+'" path="m '+U[0]+","+U[1]+" l "+U.join(",")+' x e" style="zoom:1;margin:0;padding:0;display:block;position:absolute;top:0px;left:0px;width:'+P.width+"px;height:"+P.height+'px;"></v:shape>')}else{if(T=="circ"){S=G('<v:oval name="'+O+'" filled="t" '+W+' style="zoom:1;margin:0;padding:0;display:block;position:absolute;left:'+(U[0]-U[2])+"px;top:"+(U[1]-U[2])+"px;width:"+(U[2]*2)+"px;height:"+(U[2]*2)+'px;"></v:oval>')}}}S.get(0).innerHTML=V+R;G(P).append(S)};N=function(P){var O=G("<div>"+P.innerHTML+"</div>");O.children("[name=highlighted]").remove();P.innerHTML=O.html()}}M=function(P){var O,Q=P.getAttribute("coords").split(",");for(O=0;O<Q.length;O++){Q[O]=parseFloat(Q[O])}return[P.getAttribute("shape").toLowerCase().substr(0,4),Q]};L=function(Q,P){var O=G(Q);return G.extend({},P,G.metadata?O.metadata():false,O.data("maphilight"))};A=function(O){if(!O.complete){return false}if(typeof O.naturalWidth!="undefined"&&O.naturalWidth===0){return false}return true};I={position:"absolute",left:0,top:0,padding:0,border:0};var D=false;G.fn.maphilight=function(O){O=G.extend({},G.fn.maphilight.defaults,O);if(!J&&!D){G(window).ready(function(){document.namespaces.add("v","urn:schemas-microsoft-com:vml");var Q=document.createStyleSheet();var P=["shape","rect","oval","circ","fill","stroke","imagedata","group","textbox"];G.each(P,function(){Q.addRule("v\\:"+this,"behavior: url(#default#VML); antialias:true")})});D=true}return this.each(function(){var U,R,Y,Q,T,V,X,S,W;U=G(this);if(!A(this)){return window.setTimeout(function(){U.maphilight(O)},200)}Y=G.extend({},O,G.metadata?U.metadata():false,U.data("maphilight"));W=U.get(0).getAttribute("usemap");if(!W){return }Q=G('map[name="'+W.substr(1)+'"]');if(!(U.is('img,input[type="image"]')&&W&&Q.size()>0)){return }if(U.hasClass("maphilighted")){var P=U.parent();U.insertBefore(P);P.remove();G(Q).unbind(".maphilight").find("area[coords]").unbind(".maphilight")}R=G("<div></div>").css({display:"block",background:'url("'+this.src+'")',position:"relative",padding:0,width:this.width,height:this.height});if(Y.wrapClass){if(Y.wrapClass===true){R.addClass(G(this).attr("class"))}else{R.addClass(Y.wrapClass)}}U.before(R).css("opacity",0).css(I).remove();if(B){U.css("filter","Alpha(opacity=0)")}R.append(U);T=C(this);G(T).css(I);T.height=this.height;T.width=this.width;X=function(c){var a,b;b=L(this,Y);if(!b.neverOn&&!b.alwaysOn){a=M(this);K(T,a[0],a[1],b,"highlighted");if(b.groupBy){var Z;if(/^[a-zA-Z][\-a-zA-Z]+$/.test(b.groupBy)){Z=Q.find("area["+b.groupBy+'="'+G(this).attr(b.groupBy)+'"]')}else{Z=Q.find(b.groupBy)}var d=this;Z.each(function(){if(this!=d){var f=L(this,Y);if(!f.neverOn&&!f.alwaysOn){var e=M(this);K(T,e[0],e[1],f,"highlighted")}}})}if(!J){G(T).append("<v:rect></v:rect>")}}};G(Q).bind("alwaysOn.maphilight",function(){if(V){N(V)}if(!J){G(T).empty()}G(Q).find("area[coords]").each(function(){var Z,a;a=L(this,Y);if(a.alwaysOn){if(!V&&J){V=C(U[0]);G(V).css(I);V.width=U[0].width;V.height=U[0].height;U.before(V)}a.fade=a.alwaysOnFade;Z=M(this);if(J){K(V,Z[0],Z[1],a,"")}else{K(T,Z[0],Z[1],a,"")}}})});G(Q).trigger("alwaysOn.maphilight").find("area[coords]").bind("mouseover.maphilight",X).bind("mouseout.maphilight",function(Z){N(T)});U.before(T);U.addClass("maphilighted")})};G.fn.maphilight.defaults={fill:true,fillColor:"000000",fillOpacity:0.2,stroke:true,strokeColor:"ff0000",strokeOpacity:1,strokeWidth:1,fade:true,alwaysOn:false,neverOn:false,groupBy:false,wrapClass:true,shadow:false,shadowX:0,shadowY:0,shadowRadius:6,shadowColor:"000000",shadowOpacity:0.8,shadowPosition:"outside",shadowFrom:false}})(jQuery);
|
js/auguria/interactiveimage/kinetic-v4.5.4.min.js
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
/*! KineticJS v4.5.4 2013-06-09 http://www.kineticjs.com by Eric Rowell @ericdrowell - MIT License https://github.com/ericdrowell/KineticJS/wiki/License*/
|
2 |
+
var Kinetic={};!function(){Kinetic.version="4.5.4",Kinetic.Filters={},Kinetic.Node=function(a){this._nodeInit(a)},Kinetic.Shape=function(a){this._initShape(a)},Kinetic.Container=function(a){this._containerInit(a)},Kinetic.Stage=function(a){this._initStage(a)},Kinetic.Layer=function(a){this._initLayer(a)},Kinetic.Group=function(a){this._initGroup(a)},Kinetic.Global={stages:[],idCounter:0,ids:{},names:{},shapes:{},isDragging:function(){var a=Kinetic.DD;return a?a.isDragging:!1},isDragReady:function(){var a=Kinetic.DD;return a?!!a.node:!1},_addId:function(a,b){void 0!==b&&(this.ids[b]=a)},_removeId:function(a){void 0!==a&&delete this.ids[a]},_addName:function(a,b){void 0!==b&&(void 0===this.names[b]&&(this.names[b]=[]),this.names[b].push(a))},_removeName:function(a,b){if(void 0!==a){var c=this.names[a];if(void 0!==c){for(var d=0;d<c.length;d++){var e=c[d];e._id===b&&c.splice(d,1)}0===c.length&&delete this.names[a]}}}}}(),function(a,b){"object"==typeof exports?module.exports=b():"function"==typeof define&&define.amd?define(b):a.returnExports=b()}(this,function(){return Kinetic}),function(){Kinetic.Collection=function(){var a=[].slice.call(arguments),b=a.length,c=0;for(this.length=b;b>c;c++)this[c]=a[c];return this},Kinetic.Collection.prototype=[],Kinetic.Collection.prototype.each=function(a){for(var b=0;b<this.length;b++)a(this[b],b)},Kinetic.Collection.prototype.toArray=function(){for(var a=[],b=0;b<this.length;b++)a.push(this[b]);return a},Kinetic.Collection.mapMethods=function(a){var b,c=a.length;for(b=0;c>b;b++)!function(b){var c=a[b];Kinetic.Collection.prototype[c]=function(){var a,b=this.length;for(args=[].slice.call(arguments),a=0;b>a;a++)this[a][c].apply(this[a],args)}}(b)}}(),function(){Kinetic.Transform=function(){this.m=[1,0,0,1,0,0]},Kinetic.Transform.prototype={translate:function(a,b){this.m[4]+=this.m[0]*a+this.m[2]*b,this.m[5]+=this.m[1]*a+this.m[3]*b},scale:function(a,b){this.m[0]*=a,this.m[1]*=a,this.m[2]*=b,this.m[3]*=b},rotate:function(a){var b=Math.cos(a),c=Math.sin(a),d=this.m[0]*b+this.m[2]*c,e=this.m[1]*b+this.m[3]*c,f=this.m[0]*-c+this.m[2]*b,g=this.m[1]*-c+this.m[3]*b;this.m[0]=d,this.m[1]=e,this.m[2]=f,this.m[3]=g},getTranslation:function(){return{x:this.m[4],y:this.m[5]}},skew:function(a,b){var c=this.m[0]+this.m[2]*b,d=this.m[1]+this.m[3]*b,e=this.m[2]+this.m[0]*a,f=this.m[3]+this.m[1]*a;this.m[0]=c,this.m[1]=d,this.m[2]=e,this.m[3]=f},multiply:function(a){var b=this.m[0]*a.m[0]+this.m[2]*a.m[1],c=this.m[1]*a.m[0]+this.m[3]*a.m[1],d=this.m[0]*a.m[2]+this.m[2]*a.m[3],e=this.m[1]*a.m[2]+this.m[3]*a.m[3],f=this.m[0]*a.m[4]+this.m[2]*a.m[5]+this.m[4],g=this.m[1]*a.m[4]+this.m[3]*a.m[5]+this.m[5];this.m[0]=b,this.m[1]=c,this.m[2]=d,this.m[3]=e,this.m[4]=f,this.m[5]=g},invert:function(){var a=1/(this.m[0]*this.m[3]-this.m[1]*this.m[2]),b=this.m[3]*a,c=-this.m[1]*a,d=-this.m[2]*a,e=this.m[0]*a,f=a*(this.m[2]*this.m[5]-this.m[3]*this.m[4]),g=a*(this.m[1]*this.m[4]-this.m[0]*this.m[5]);this.m[0]=b,this.m[1]=c,this.m[2]=d,this.m[3]=e,this.m[4]=f,this.m[5]=g},getMatrix:function(){return this.m}}}(),function(){var a="canvas",b="2d",c="[object Array]",d="[object Number]",e="[object String]",f=Math.PI/180,g=180/Math.PI,h="#",i="",j="0",k="Kinetic warning: ",l="rgb(",m={aqua:[0,255,255],lime:[0,255,0],silver:[192,192,192],black:[0,0,0],maroon:[128,0,0],teal:[0,128,128],blue:[0,0,255],navy:[0,0,128],white:[255,255,255],fuchsia:[255,0,255],olive:[128,128,0],yellow:[255,255,0],orange:[255,165,0],gray:[128,128,128],purple:[128,0,128],green:[0,128,0],red:[255,0,0],pink:[255,192,203],cyan:[0,255,255],transparent:[255,255,255,0]},n=/rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)/;Kinetic.Util={_isElement:function(a){return!(!a||1!=a.nodeType)},_isFunction:function(a){return!!(a&&a.constructor&&a.call&&a.apply)},_isObject:function(a){return!!a&&a.constructor==Object},_isArray:function(a){return Object.prototype.toString.call(a)==c},_isNumber:function(a){return Object.prototype.toString.call(a)==d},_isString:function(a){return Object.prototype.toString.call(a)==e},_hasMethods:function(a){var b,c=[];for(b in a)this._isFunction(a[b])&&c.push(b);return c.length>0},_isInDocument:function(a){for(;a=a.parentNode;)if(a==document)return!0;return!1},_getXY:function(a){if(this._isNumber(a))return{x:a,y:a};if(this._isArray(a)){if(1===a.length){var b=a[0];if(this._isNumber(b))return{x:b,y:b};if(this._isArray(b))return{x:b[0],y:b[1]};if(this._isObject(b))return b}else if(a.length>=2)return{x:a[0],y:a[1]}}else if(this._isObject(a))return a;return null},_getSize:function(a){if(this._isNumber(a))return{width:a,height:a};if(this._isArray(a))if(1===a.length){var b=a[0];if(this._isNumber(b))return{width:b,height:b};if(this._isArray(b)){if(b.length>=4)return{width:b[2],height:b[3]};if(b.length>=2)return{width:b[0],height:b[1]}}else if(this._isObject(b))return b}else{if(a.length>=4)return{width:a[2],height:a[3]};if(a.length>=2)return{width:a[0],height:a[1]}}else if(this._isObject(a))return a;return null},_getPoints:function(a){var b,c,d=[];if(void 0===a)return[];if(c=a.length,this._isArray(a[0])){for(b=0;c>b;b++)d.push({x:a[b][0],y:a[b][1]});return d}if(this._isObject(a[0]))return a;for(b=0;c>b;b+=2)d.push({x:a[b],y:a[b+1]});return d},_getImage:function(c,d){var e,f,g,h;c?this._isElement(c)?d(c):this._isString(c)?(e=new Image,e.onload=function(){d(e)},e.src=c):c.data?(f=document.createElement(a),f.width=c.width,f.height=c.height,g=f.getContext(b),g.putImageData(c,0,0),h=f.toDataURL(),e=new Image,e.onload=function(){d(e)},e.src=h):d(null):d(null)},_rgbToHex:function(a,b,c){return((1<<24)+(a<<16)+(b<<8)+c).toString(16).slice(1)},_hexToRgb:function(a){a=a.replace(h,i);var b=parseInt(a,16);return{r:255&b>>16,g:255&b>>8,b:255&b}},getRandomColor:function(){for(var a=(16777215*Math.random()<<0).toString(16);a.length<6;)a=j+a;return h+a},getRGB:function(a){var b;return a in m?(b=m[a],{r:b[0],g:b[1],b:b[2]}):a[0]===h?this._hexToRgb(a.substring(1)):a.substr(0,4)===l?(b=n.exec(a.replace(/ /g,"")),{r:parseInt(b[1],10),g:parseInt(b[2],10),b:parseInt(b[3],10)}):{r:0,g:0,b:0}},_merge:function(a,b){var c=this._clone(b);for(var d in a)c[d]=this._isObject(a[d])?this._merge(a[d],c[d]):a[d];return c},_clone:function(a){var b={};for(var c in a)b[c]=this._isObject(a[c])?this._clone(a[c]):a[c];return b},_degToRad:function(a){return a*f},_radToDeg:function(a){return a*g},_capitalize:function(a){return a.charAt(0).toUpperCase()+a.slice(1)},warn:function(a){window.console&&console.warn&&console.warn(k+a)},extend:function(a,b){for(var c in b.prototype)c in a.prototype||(a.prototype[c]=b.prototype[c])},addMethods:function(a,b){var c;for(c in b)a.prototype[c]=b[c]},_getControlPoints:function(a,b,c,d){var e=a.x,f=a.y,g=b.x,h=b.y,i=c.x,j=c.y,k=Math.sqrt(Math.pow(g-e,2)+Math.pow(h-f,2)),l=Math.sqrt(Math.pow(i-g,2)+Math.pow(j-h,2)),m=d*k/(k+l),n=d*l/(k+l),o=g-m*(i-e),p=h-m*(j-f),q=g+n*(i-e),r=h+n*(j-f);return[{x:o,y:p},{x:q,y:r}]},_expandPoints:function(a,b){var c,d,e=a.length,f=[];for(c=1;e-1>c;c++)d=Kinetic.Util._getControlPoints(a[c-1],a[c],a[c+1],b),f.push(d[0]),f.push(a[c]),f.push(d[1]);return f}}}(),function(){var a=document.createElement("canvas"),b=a.getContext("2d"),c=window.devicePixelRatio||1,d=b.webkitBackingStorePixelRatio||b.mozBackingStorePixelRatio||b.msBackingStorePixelRatio||b.oBackingStorePixelRatio||b.backingStorePixelRatio||1,e=c/d;Kinetic.Canvas=function(a){this.init(a)},Kinetic.Canvas.prototype={init:function(a){a=a||{};var b=a.width||0,c=a.height||0,d=a.pixelRatio||e,f=a.contextType||"2d";this.pixelRatio=d,this.element=document.createElement("canvas"),this.element.style.padding=0,this.element.style.margin=0,this.element.style.border=0,this.element.style.background="transparent",this.context=this.element.getContext(f),this.setSize(b,c)},getElement:function(){return this.element},getContext:function(){return this.context},setWidth:function(a){this.width=this.element.width=a*this.pixelRatio,this.element.style.width=a+"px"},setHeight:function(a){this.height=this.element.height=a*this.pixelRatio,this.element.style.height=a+"px"},getWidth:function(){return this.width},getHeight:function(){return this.height},setSize:function(a,b){this.setWidth(a),this.setHeight(b)},clear:function(){var a=this.getContext();this.getElement(),a.clearRect(0,0,this.getWidth(),this.getHeight())},toDataURL:function(a,b){try{return this.element.toDataURL(a,b)}catch(c){try{return this.element.toDataURL()}catch(d){return Kinetic.Util.warn("Unable to get data URL. "+d.message),""}}},fill:function(a){a.getFillEnabled()&&this._fill(a)},stroke:function(a){a.getStrokeEnabled()&&this._stroke(a)},fillStroke:function(a){var b=a.getFillEnabled();b&&this._fill(a),a.getStrokeEnabled()&&this._stroke(a,a.hasShadow()&&a.hasFill()&&b)},applyShadow:function(a,b){var c=this.context;c.save(),this._applyShadow(a),b(),c.restore(),b()},_applyLineCap:function(a){var b=a.getLineCap();b&&(this.context.lineCap=b)},_applyOpacity:function(a){var b=a.getAbsoluteOpacity();1!==b&&(this.context.globalAlpha=b)},_applyLineJoin:function(a){var b=a.getLineJoin();b&&(this.context.lineJoin=b)},_applyAncestorTransforms:function(a){var b,c,d=this.context;a._eachAncestorReverse(function(a){b=a.getTransform(!0),c=b.getMatrix(),d.transform(c[0],c[1],c[2],c[3],c[4],c[5])},!0)},_clip:function(a){var b=this.getContext();b.save(),this._applyAncestorTransforms(a),b.beginPath(),a.getClipFunc()(this),b.clip(),b.setTransform(1,0,0,1,0,0)}},Kinetic.SceneCanvas=function(a){Kinetic.Canvas.call(this,a)},Kinetic.SceneCanvas.prototype={setWidth:function(a){var b=this.pixelRatio;Kinetic.Canvas.prototype.setWidth.call(this,a),this.context.scale(b,b)},setHeight:function(a){var b=this.pixelRatio;Kinetic.Canvas.prototype.setHeight.call(this,a),this.context.scale(b,b)},_fillColor:function(a){var b=this.context,c=a.getFill();b.fillStyle=c,a._fillFunc(b)},_fillPattern:function(a){var b=this.context,c=a.getFillPatternImage(),d=a.getFillPatternX(),e=a.getFillPatternY(),f=a.getFillPatternScale(),g=a.getFillPatternRotation(),h=a.getFillPatternOffset(),i=a.getFillPatternRepeat();(d||e)&&b.translate(d||0,e||0),g&&b.rotate(g),f&&b.scale(f.x,f.y),h&&b.translate(-1*h.x,-1*h.y),b.fillStyle=b.createPattern(c,i||"repeat"),b.fill()},_fillLinearGradient:function(a){var b=this.context,c=a.getFillLinearGradientStartPoint(),d=a.getFillLinearGradientEndPoint(),e=a.getFillLinearGradientColorStops(),f=b.createLinearGradient(c.x,c.y,d.x,d.y);if(e){for(var g=0;g<e.length;g+=2)f.addColorStop(e[g],e[g+1]);b.fillStyle=f,b.fill()}},_fillRadialGradient:function(a){for(var b=this.context,c=a.getFillRadialGradientStartPoint(),d=a.getFillRadialGradientEndPoint(),e=a.getFillRadialGradientStartRadius(),f=a.getFillRadialGradientEndRadius(),g=a.getFillRadialGradientColorStops(),h=b.createRadialGradient(c.x,c.y,e,d.x,d.y,f),i=0;i<g.length;i+=2)h.addColorStop(g[i],g[i+1]);b.fillStyle=h,b.fill()},_fill:function(a,b){var c=this.context,d=a.getFill(),e=a.getFillPatternImage(),f=a.getFillLinearGradientColorStops(),g=a.getFillRadialGradientColorStops(),h=a.getFillPriority();c.save(),!b&&a.hasShadow()&&this._applyShadow(a),d&&"color"===h?this._fillColor(a):e&&"pattern"===h?this._fillPattern(a):f&&"linear-gradient"===h?this._fillLinearGradient(a):g&&"radial-gradient"===h?this._fillRadialGradient(a):d?this._fillColor(a):e?this._fillPattern(a):f?this._fillLinearGradient(a):g&&this._fillRadialGradient(a),c.restore(),!b&&a.hasShadow()&&this._fill(a,!0)},_stroke:function(a,b){var c=this.context,d=a.getStroke(),e=a.getStrokeWidth(),f=a.getDashArray();(d||e)&&(c.save(),a.getStrokeScaleEnabled()||c.setTransform(1,0,0,1,0,0),this._applyLineCap(a),f&&a.getDashArrayEnabled()&&(c.setLineDash?c.setLineDash(f):"mozDash"in c?c.mozDash=f:"webkitLineDash"in c&&(c.webkitLineDash=f)),!b&&a.hasShadow()&&this._applyShadow(a),c.lineWidth=e||2,c.strokeStyle=d||"black",a._strokeFunc(c),c.restore(),!b&&a.hasShadow()&&this._stroke(a,!0))},_applyShadow:function(a){var b=this.context;if(a.hasShadow()&&a.getShadowEnabled()){var c=a.getAbsoluteOpacity(),d=a.getShadowColor()||"black",e=a.getShadowBlur()||5,f=a.getShadowOffset()||{x:0,y:0};a.getShadowOpacity()&&(b.globalAlpha=a.getShadowOpacity()*c),b.shadowColor=d,b.shadowBlur=e,b.shadowOffsetX=f.x,b.shadowOffsetY=f.y}}},Kinetic.Util.extend(Kinetic.SceneCanvas,Kinetic.Canvas),Kinetic.HitCanvas=function(a){Kinetic.Canvas.call(this,a)},Kinetic.HitCanvas.prototype={_fill:function(a){var b=this.context;b.save(),b.fillStyle=a.colorKey,a._fillFuncHit(b),b.restore()},_stroke:function(a){var b=this.context,c=a.getStroke(),d=a.getStrokeWidth();(c||d)&&(this._applyLineCap(a),b.save(),b.lineWidth=d||2,b.strokeStyle=a.colorKey,a._strokeFuncHit(b),b.restore())}},Kinetic.Util.extend(Kinetic.HitCanvas,Kinetic.Canvas)}(),function(){var a=" ",b="",c=".",d="get",e="set",f="Shape",g="Stage",h="X",i="Y",j="kinetic",k="before",l="Change",m="id",n="name",o="mouseenter",p="mouseleave",q="Deg",r="beforeDraw",s="draw",t="RGB",u="r",v="g",w="b",x="R",y="G",z="B",A="#",B="children";Kinetic.Util.addMethods(Kinetic.Node,{_nodeInit:function(a){this._id=Kinetic.Global.idCounter++,this.eventListeners={},this.setAttrs(a)},on:function(d,e){var f,g,h,i,j,k,l=d.split(a),m=l.length;for(f=0;m>f;f++)g=l[f],h=g,i=h.split(c),j=i[0],k=i.length>1?i[1]:b,this.eventListeners[j]||(this.eventListeners[j]=[]),this.eventListeners[j].push({name:k,handler:e});return this},off:function(b){var d,e,f,g,h,i,j=b.split(a),k=j.length;for(d=0;k>d;d++)if(e=j[d],g=e,h=g.split(c),i=h[0],h.length>1)if(i)this.eventListeners[i]&&this._off(i,h[1]);else for(f in this.eventListeners)this._off(f,h[1]);else delete this.eventListeners[i];return this},remove:function(){var a=this.getParent();return a&&a.children&&(a.children.splice(this.index,1),a._setChildrenIndices(),delete this.parent),this},destroy:function(){var a=Kinetic.Global;a._removeId(this.getId()),a._removeName(this.getName(),this._id),this.remove()},getAttr:function(a){var b=d+Kinetic.Util._capitalize(a);return Kinetic.Util._isFunction(this[b])?this[b]():this.attrs[a]},setAttr:function(){var a=Array.prototype.slice.call(arguments),b=a[0],c=e+Kinetic.Util._capitalize(b),d=this[c];return a.shift(),Kinetic.Util._isFunction(d)?d.apply(this,a):this.attrs[b]=a[0],this},getAttrs:function(){return this.attrs||{}},createAttrs:function(){return void 0===this.attrs&&(this.attrs={}),this},setAttrs:function(a){var b,c;if(a)for(b in a)b===B||(c=e+Kinetic.Util._capitalize(b),Kinetic.Util._isFunction(this[c])?this[c](a[b]):this._setAttr(b,a[b]));return this},getVisible:function(){var a=this.attrs.visible,b=this.getParent();return void 0===a&&(a=!0),a&&b&&!b.getVisible()?!1:a},getListening:function(){var a=this.attrs.listening,b=this.getParent();return void 0===a&&(a=!0),a&&b&&!b.getListening()?!1:a},show:function(){return this.setVisible(!0),this},hide:function(){return this.setVisible(!1),this},getZIndex:function(){return this.index||0},getAbsoluteZIndex:function(){function a(g){for(b=[],c=g.length,d=0;c>d;d++)e=g[d],j++,e.nodeType!==f&&(b=b.concat(e.getChildren().toArray())),e._id===i._id&&(d=c);b.length>0&&b[0].getLevel()<=h&&a(b)}var b,c,d,e,h=this.getLevel(),i=(this.getStage(),this),j=0;return i.nodeType!==g&&a(i.getStage().getChildren()),j},getLevel:function(){for(var a=0,b=this.parent;b;)a++,b=b.parent;return a},setPosition:function(){var a=Kinetic.Util._getXY([].slice.call(arguments));return this.setX(a.x),this.setY(a.y),this},getPosition:function(){return{x:this.getX(),y:this.getY()}},getAbsolutePosition:function(){var a=this.getAbsoluteTransform(),b=this.getOffset();return a.translate(b.x,b.y),a.getTranslation()},setAbsolutePosition:function(){var a,b=Kinetic.Util._getXY([].slice.call(arguments)),c=this._clearTransform();return this.attrs.x=c.x,this.attrs.y=c.y,delete c.x,delete c.y,a=this.getAbsoluteTransform(),a.invert(),a.translate(b.x,b.y),b={x:this.attrs.x+a.getTranslation().x,y:this.attrs.y+a.getTranslation().y},this.setPosition(b.x,b.y),this._setTransform(c),this},move:function(){var a=Kinetic.Util._getXY([].slice.call(arguments)),b=this.getX(),c=this.getY();return void 0!==a.x&&(b+=a.x),void 0!==a.y&&(c+=a.y),this.setPosition(b,c),this},_eachAncestorReverse:function(a,b){var c,d,e=[],f=this.getParent();for(b&&e.unshift(this);f;)e.unshift(f),f=f.parent;for(c=e.length,d=0;c>d;d++)a(e[d])},rotate:function(a){return this.setRotation(this.getRotation()+a),this},rotateDeg:function(a){return this.setRotation(this.getRotation()+Kinetic.Util._degToRad(a)),this},moveToTop:function(){var a=this.index;return this.parent.children.splice(a,1),this.parent.children.push(this),this.parent._setChildrenIndices(),!0},moveUp:function(){var a=this.index,b=this.parent.getChildren().length;return b-1>a?(this.parent.children.splice(a,1),this.parent.children.splice(a+1,0,this),this.parent._setChildrenIndices(),!0):!1},moveDown:function(){var a=this.index;return a>0?(this.parent.children.splice(a,1),this.parent.children.splice(a-1,0,this),this.parent._setChildrenIndices(),!0):!1},moveToBottom:function(){var a=this.index;return a>0?(this.parent.children.splice(a,1),this.parent.children.unshift(this),this.parent._setChildrenIndices(),!0):!1},setZIndex:function(a){var b=this.index;return this.parent.children.splice(b,1),this.parent.children.splice(a,0,this),this.parent._setChildrenIndices(),this},getAbsoluteOpacity:function(){var a=this.getOpacity();return this.getParent()&&(a*=this.getParent().getAbsoluteOpacity()),a},moveTo:function(a){return Kinetic.Node.prototype.remove.call(this),a.add(this),this},toObject:function(){var a,b,c=Kinetic.Util,d={},e=this.getAttrs();d.attrs={};for(a in e)b=e[a],c._isFunction(b)||c._isElement(b)||c._isObject(b)&&c._hasMethods(b)||(d.attrs[a]=b);return d.className=this.getClassName(),d},toJSON:function(){return JSON.stringify(this.toObject())},getParent:function(){return this.parent},getLayer:function(){return this.getParent().getLayer()},getStage:function(){return this.getParent()?this.getParent().getStage():void 0},fire:function(a,b,c){return c?this._fireAndBubble(a,b||{}):this._fire(a,b||{}),this},getAbsoluteTransform:function(){var a,b=new Kinetic.Transform;return this._eachAncestorReverse(function(c){a=c.getTransform(),b.multiply(a)},!0),b},_getAndCacheTransform:function(){var a=new Kinetic.Transform,b=this.getX(),c=this.getY(),d=this.getRotation(),e=this.getScaleX(),f=this.getScaleY(),g=this.getSkewX(),h=this.getSkewY(),i=this.getOffsetX(),j=this.getOffsetY();return(0!==b||0!==c)&&a.translate(b,c),0!==d&&a.rotate(d),(0!==g||0!==h)&&a.skew(g,h),(1!==e||1!==f)&&a.scale(e,f),(0!==i||0!==j)&&a.translate(-1*i,-1*j),this.cachedTransform=a,a},getTransform:function(a){var b=this.cachedTransform;return a&&b?b:this._getAndCacheTransform()},clone:function(a){var b,c,d,e,f,g=this.getClassName(),h=new Kinetic[g](this.attrs);for(b in this.eventListeners)for(c=this.eventListeners[b],d=c.length,e=0;d>e;e++)f=c[e],f.name.indexOf(j)<0&&(h.eventListeners[b]||(h.eventListeners[b]=[]),h.eventListeners[b].push(f));return h.setAttrs(a),h},toDataURL:function(a){a=a||{};var b=a.mimeType||null,c=a.quality||null,d=this.getStage(),e=a.x||0,f=a.y||0,g=new Kinetic.SceneCanvas({width:a.width||d.getWidth(),height:a.height||d.getHeight(),pixelRatio:1}),h=g.getContext();return h.save(),(e||f)&&h.translate(-1*e,-1*f),this.drawScene(g),h.restore(),g.toDataURL(b,c)},toImage:function(a){Kinetic.Util._getImage(this.toDataURL(a),function(b){a.callback(b)})},setSize:function(){var a=Kinetic.Util._getSize(Array.prototype.slice.call(arguments));return this.setWidth(a.width),this.setHeight(a.height),this},getSize:function(){return{width:this.getWidth(),height:this.getHeight()}},getWidth:function(){return this.attrs.width||0},getHeight:function(){return this.attrs.height||0},getClassName:function(){return this.className||this.nodeType},getType:function(){return this.nodeType},_get:function(a){return this.nodeType===a?[this]:[]},_off:function(a,b){var c,d=this.eventListeners[a];for(c=0;c<d.length;c++)if(d[c].name===b){if(d.splice(c,1),0===d.length){delete this.eventListeners[a];break}c--}},_clearTransform:function(){var a={x:this.getX(),y:this.getY(),rotation:this.getRotation(),scaleX:this.getScaleX(),scaleY:this.getScaleY(),offsetX:this.getOffsetX(),offsetY:this.getOffsetY(),skewX:this.getSkewX(),skewY:this.getSkewY()};return this.attrs.x=0,this.attrs.y=0,this.attrs.rotation=0,this.attrs.scaleX=1,this.attrs.scaleY=1,this.attrs.offsetX=0,this.attrs.offsetY=0,this.attrs.skewX=0,this.attrs.skewY=0,a},_setTransform:function(a){var b;for(b in a)this.attrs[b]=a[b];this.cachedTransform=null},_fireBeforeChangeEvent:function(a,b,c){this._fire(k+Kinetic.Util._capitalize(a)+l,{oldVal:b,newVal:c})},_fireChangeEvent:function(a,b,c){this._fire(a+l,{oldVal:b,newVal:c})},setId:function(a){var b=this.getId(),c=(this.getStage(),Kinetic.Global);return c._removeId(b),c._addId(this,a),this._setAttr(m,a),this},setName:function(a){var b=this.getName(),c=(this.getStage(),Kinetic.Global);return c._removeName(b,this._id),c._addName(this,a),this._setAttr(n,a),this},_setAttr:function(a,b){var c;void 0!==b&&(c=this.attrs[a],this._fireBeforeChangeEvent(a,c,b),this.attrs[a]=b,this._fireChangeEvent(a,c,b))},_fireAndBubble:function(a,b,c){b&&this.nodeType===f&&(b.targetNode=this),this.getStage(),this.eventListeners;var d=!0;a===o&&c&&this._id===c._id?d=!1:a===p&&c&&this._id===c._id&&(d=!1),d&&(this._fire(a,b),b&&!b.cancelBubble&&this.parent&&(c&&c.parent?this._fireAndBubble.call(this.parent,a,b,c.parent):this._fireAndBubble.call(this.parent,a,b)))},_fire:function(a,b){var c,d,e=this.eventListeners[a];if(e)for(c=e.length,d=0;c>d;d++)e[d].handler.call(this,b)},draw:function(){var a={node:this};return this._fire(r,a),this.drawScene(),this.drawHit(),this._fire(s,a),this},shouldDrawHit:function(){return this.isVisible()&&this.isListening()&&!Kinetic.Global.isDragging()},isDraggable:function(){return!1}}),Kinetic.Node.setPoints=function(a){var b=Kinetic.Util._getPoints(a);this._setAttr("points",b)},Kinetic.Node.addGetterSetter=function(a,b,c,d){this.addGetter(a,b,c),this.addSetter(a,b,d)},Kinetic.Node.addPointGetterSetter=function(a,b,c,d){this.addPointGetter(a,b),this.addPointSetter(a,b),this.addGetter(a,b+h,c),this.addGetter(a,b+i,c),this.addSetter(a,b+h,d),this.addSetter(a,b+i,d)},Kinetic.Node.addPointsGetterSetter=function(a,b){this.addPointsGetter(a,b),this.addPointsSetter(a,b)},Kinetic.Node.addRotationGetterSetter=function(a,b,c,d){this.addRotationGetter(a,b,c),this.addRotationSetter(a,b,d)},Kinetic.Node.addColorGetterSetter=function(a,b){this.addGetter(a,b),this.addSetter(a,b),this.addColorRGBGetter(a,b),this.addColorComponentGetter(a,b,u),this.addColorComponentGetter(a,b,v),this.addColorComponentGetter(a,b,w),this.addColorRGBSetter(a,b),this.addColorComponentSetter(a,b,u),this.addColorComponentSetter(a,b,v),this.addColorComponentSetter(a,b,w)},Kinetic.Node.addColorRGBGetter=function(a,b){var c=d+Kinetic.Util._capitalize(b)+t;a.prototype[c]=function(){return Kinetic.Util.getRGB(this.attrs[b])}},Kinetic.Node.addColorComponentGetter=function(a,b,c){var e=d+Kinetic.Util._capitalize(b),f=e+Kinetic.Util._capitalize(c);a.prototype[f]=function(){return this[e+t]()[c]}},Kinetic.Node.addPointsGetter=function(a,b){var c=d+Kinetic.Util._capitalize(b);a.prototype[c]=function(){var a=this.attrs[b];return void 0===a?[]:a}},Kinetic.Node.addGetter=function(a,b,c){var e=d+Kinetic.Util._capitalize(b);a.prototype[e]=function(){var a=this.attrs[b];return void 0===a?c:a}},Kinetic.Node.addPointGetter=function(a,b){var c=d+Kinetic.Util._capitalize(b);a.prototype[c]=function(){var a=this;return{x:a[c+h](),y:a[c+i]()}}},Kinetic.Node.addRotationGetter=function(a,b,c){var e=d+Kinetic.Util._capitalize(b);a.prototype[e]=function(){var a=this.attrs[b];return void 0===a&&(a=c),a},a.prototype[e+q]=function(){var a=this.attrs[b];return void 0===a&&(a=c),Kinetic.Util._radToDeg(a)}},Kinetic.Node.addColorRGBSetter=function(a,b){var c=e+Kinetic.Util._capitalize(b)+t;a.prototype[c]=function(a){var c=a&&void 0!==a.r?0|a.r:this.getAttr(b+x),d=a&&void 0!==a.g?0|a.g:this.getAttr(b+y),e=a&&void 0!==a.b?0|a.b:this.getAttr(b+z);this._setAttr(b,A+Kinetic.Util._rgbToHex(c,d,e))}},Kinetic.Node.addColorComponentSetter=function(a,b,c){var d=e+Kinetic.Util._capitalize(b),f=d+Kinetic.Util._capitalize(c);a.prototype[f]=function(a){var b={};b[c]=a,this[d+t](b)}},Kinetic.Node.addPointsSetter=function(a,b){var c=e+Kinetic.Util._capitalize(b);a.prototype[c]=Kinetic.Node.setPoints},Kinetic.Node.addSetter=function(a,b,c){var d=e+Kinetic.Util._capitalize(b);a.prototype[d]=function(a){this._setAttr(b,a),c&&(this.cachedTransform=null)}},Kinetic.Node.addPointSetter=function(a,b){var c=e+Kinetic.Util._capitalize(b);a.prototype[c]=function(){var a=Kinetic.Util._getXY([].slice.call(arguments)),d=this.attrs[b],e=0,f=0;a&&(e=a.x,f=a.y,this._fireBeforeChangeEvent(b,d,a),void 0!==e&&this[c+h](e),void 0!==f&&this[c+i](f),this._fireChangeEvent(b,d,a))}},Kinetic.Node.addRotationSetter=function(a,b,c){var d=e+Kinetic.Util._capitalize(b);a.prototype[d]=function(a){this._setAttr(b,a),c&&(this.cachedTransform=null)},a.prototype[d+q]=function(a){this._setAttr(b,Kinetic.Util._degToRad(a)),c&&(this.cachedTransform=null)}},Kinetic.Node.create=function(a,b){return this._createNode(JSON.parse(a),b)},Kinetic.Node._createNode=function(a,b){var c,d,e,f=Kinetic.Node.prototype.getClassName.call(a),g=a.children;if(b&&(a.attrs.container=b),c=new Kinetic[f](a.attrs),g)for(d=g.length,e=0;d>e;e++)c.add(this._createNode(g[e]));return c},Kinetic.Node.addGetterSetter(Kinetic.Node,"x",0,!0),Kinetic.Node.addGetterSetter(Kinetic.Node,"y",0,!0),Kinetic.Node.addGetterSetter(Kinetic.Node,"opacity",1),Kinetic.Node.addGetter(Kinetic.Node,"name"),Kinetic.Node.addGetter(Kinetic.Node,"id"),Kinetic.Node.addRotationGetterSetter(Kinetic.Node,"rotation",0,!0),Kinetic.Node.addPointGetterSetter(Kinetic.Node,"scale",1,!0),Kinetic.Node.addPointGetterSetter(Kinetic.Node,"skew",0,!0),Kinetic.Node.addPointGetterSetter(Kinetic.Node,"offset",0,!0),Kinetic.Node.addSetter(Kinetic.Node,"width"),Kinetic.Node.addSetter(Kinetic.Node,"height"),Kinetic.Node.addSetter(Kinetic.Node,"listening"),Kinetic.Node.addSetter(Kinetic.Node,"visible"),Kinetic.Node.prototype.isListening=Kinetic.Node.prototype.getListening,Kinetic.Node.prototype.isVisible=Kinetic.Node.prototype.getVisible,Kinetic.Collection.mapMethods(["on","off","remove","destroy","show","hide","move","rotate","moveToTop","moveUp","moveDown","moveToBottom","moveTo","fire","draw"])}(),function(){function a(a){window.setTimeout(a,1e3/60)}Kinetic.Animation=function(a,b){this.func=a,this.setLayers(b),this.id=Kinetic.Animation.animIdCounter++,this.frame={time:0,timeDiff:0,lastTime:(new Date).getTime()}},Kinetic.Animation.prototype={setLayers:function(a){var b=[];b=a?a.length>0?a:[a]:[],this.layers=b},getLayers:function(){return this.layers},addLayer:function(a){var b,c,d=this.layers;if(d){for(b=d.length,c=0;b>c;c++)if(d[c]._id===a._id)return!1}else this.layers=[];return this.layers.push(a),!0},isRunning:function(){for(var a=Kinetic.Animation,b=a.animations,c=0;c<b.length;c++)if(b[c].id===this.id)return!0;return!1},start:function(){this.stop(),this.frame.timeDiff=0,this.frame.lastTime=(new Date).getTime(),Kinetic.Animation._addAnimation(this)},stop:function(){Kinetic.Animation._removeAnimation(this)},_updateFrameObject:function(a){this.frame.timeDiff=a-this.frame.lastTime,this.frame.lastTime=a,this.frame.time+=this.frame.timeDiff,this.frame.frameRate=1e3/this.frame.timeDiff}},Kinetic.Animation.animations=[],Kinetic.Animation.animIdCounter=0,Kinetic.Animation.animRunning=!1,Kinetic.Animation._addAnimation=function(a){this.animations.push(a),this._handleAnimation()},Kinetic.Animation._removeAnimation=function(a){for(var b=a.id,c=this.animations,d=c.length,e=0;d>e;e++)if(c[e].id===b){this.animations.splice(e,1);break}},Kinetic.Animation._runFrames=function(){var a,b,c,d,e,f,g,h,i={},j=this.animations;for(d=0;d<j.length;d++){for(a=j[d],b=a.layers,c=a.func,a._updateFrameObject((new Date).getTime()),f=b.length,e=0;f>e;e++)g=b[e],void 0!==g._id&&(i[g._id]=g);c&&c.call(a,a.frame)}for(h in i)i[h].draw()},Kinetic.Animation._animationLoop=function(){var a=this;this.animations.length>0?(this._runFrames(),Kinetic.Animation.requestAnimFrame(function(){a._animationLoop()})):this.animRunning=!1},Kinetic.Animation._handleAnimation=function(){var a=this;this.animRunning||(this.animRunning=!0,a._animationLoop())},RAF=function(){return window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||a}(),Kinetic.Animation.requestAnimFrame=function(b){var c=Kinetic.DD&&Kinetic.DD.isDragging?a:RAF;c(b)};var b=Kinetic.Node.prototype.moveTo;Kinetic.Node.prototype.moveTo=function(a){b.call(this,a)},Kinetic.Layer.batchAnim=new Kinetic.Animation(function(){0===this.getLayers().length&&this.stop(),this.setLayers([])}),Kinetic.Layer.prototype.batchDraw=function(){var a=Kinetic.Layer.batchAnim;a.addLayer(this),a.isRunning()||a.start()}}(),function(){var a={node:1,duration:1,easing:1,onFinish:1,yoyo:1},b=1,c=2,d=3,e=0;Kinetic.Tween=function(b){var c,d=this,g=b.node,h=g._id,i=b.duration||1,j=b.easing||Kinetic.Easings.Linear,k=!!b.yoyo;this.node=g,this._id=e++,this.onFinish=b.onFinish,this.anim=new Kinetic.Animation(function(){d.tween.onEnterFrame()},g.getLayer()||g.getLayers()),this.tween=new f(c,function(a){d._tweenFunc(a)},j,0,1,1e3*i,k),this._addListeners(),Kinetic.Tween.attrs[h]||(Kinetic.Tween.attrs[h]={}),Kinetic.Tween.attrs[h][this._id]||(Kinetic.Tween.attrs[h][this._id]={}),Kinetic.Tween.tweens[h]||(Kinetic.Tween.tweens[h]={});for(c in b)void 0===a[c]&&this._addAttr(c,b[c]);this.reset()},Kinetic.Tween.attrs={},Kinetic.Tween.tweens={},Kinetic.Tween.prototype={_addAttr:function(a,b){var c,d,e,f,g,h,i,j=this.node,k=j._id;if(e=Kinetic.Tween.tweens[k][a],e&&delete Kinetic.Tween.attrs[k][e][a],c=j.getAttr(a),Kinetic.Util._isArray(b))for(b=Kinetic.Util._getPoints(b),d=[],g=b.length,f=0;g>f;f++)h=c[f],i=b[f],d.push({x:i.x-h.x,y:i.y-h.y});else d=b-c;Kinetic.Tween.attrs[k][this._id][a]={start:c,diff:d},Kinetic.Tween.tweens[k][a]=this._id},_tweenFunc:function(a){var b,c,d,e,f,g,h,i,j,k=this.node,l=Kinetic.Tween.attrs[k._id][this._id];for(b in l){if(c=l[b],d=c.start,e=c.diff,Kinetic.Util._isArray(d))for(f=[],h=d.length,g=0;h>g;g++)i=d[g],j=e[g],f.push({x:i.x+j.x*a,y:i.y+j.y*a});else f=d+e*a;k.setAttr(b,f)}},_addListeners:function(){var a=this;this.tween.onPlay=function(){a.anim.start()},this.tween.onReverse=function(){a.anim.start()},this.tween.onPause=function(){a.anim.stop()},this.tween.onFinish=function(){a.onFinish&&a.onFinish()}},play:function(){return this.tween.play(),this},reverse:function(){return this.tween.reverse(),this},reset:function(){var a=this.node;return this.tween.reset(),(a.getLayer()||a.getLayers()).draw(),this},seek:function(a){var b=this.node;return this.tween.seek(1e3*a),(b.getLayer()||b.getLayers()).draw(),this},pause:function(){return this.tween.pause(),this},finish:function(){var a=this.node;return this.tween.finish(),(a.getLayer()||a.getLayers()).draw(),this},destroy:function(){var a,b=this.node._id,c=this._id,d=Kinetic.Tween.tweens[b];this.pause();for(a in d)delete Kinetic.Tween.tweens[b][a];delete Kinetic.Tween.attrs[b][c]}};var f=function(a,b,c,d,e,f,g){this.prop=a,this.propFunc=b,this.begin=d,this._pos=d,this.duration=f,this._change=0,this.prevPos=0,this.yoyo=g,this._time=0,this._position=0,this._startTime=0,this._finish=0,this.func=c,this._change=e-this.begin,this.pause()};f.prototype={fire:function(a){var b=this[a];b&&b()},setTime:function(a){a>this.duration?this.yoyo?(this._time=this.duration,this.reverse()):this.finish():0>a?this.yoyo?(this._time=0,this.play()):this.reset():(this._time=a,this.update())},getTime:function(){return this._time},setPosition:function(a){this.prevPos=this._pos,this.propFunc(a),this._pos=a},getPosition:function(a){return void 0===a&&(a=this._time),this.func(a,this.begin,this._change,this.duration)},play:function(){this.state=c,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire("onPlay")
|
3 |
+
},reverse:function(){this.state=d,this._time=this.duration-this._time,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire("onReverse")},seek:function(a){this.pause(),this._time=a,this.update(),this.fire("onSeek")},reset:function(){this.pause(),this._time=0,this.update(),this.fire("onReset")},finish:function(){this.pause(),this._time=this.duration,this.update(),this.fire("onFinish")},update:function(){this.setPosition(this.getPosition(this._time))},onEnterFrame:function(){var a=this.getTimer()-this._startTime;this.state===c?this.setTime(a):this.state===d&&this.setTime(this.duration-a)},pause:function(){this.state=b,this.fire("onPause")},getTimer:function(){return(new Date).getTime()}},Kinetic.Easings={BackEaseIn:function(a,b,c,d){var e=1.70158;return c*(a/=d)*a*((e+1)*a-e)+b},BackEaseOut:function(a,b,c,d){var e=1.70158;return c*((a=a/d-1)*a*((e+1)*a+e)+1)+b},BackEaseInOut:function(a,b,c,d){var e=1.70158;return(a/=d/2)<1?c/2*a*a*(((e*=1.525)+1)*a-e)+b:c/2*((a-=2)*a*(((e*=1.525)+1)*a+e)+2)+b},ElasticEaseIn:function(a,b,c,d,e,f){var g=0;return 0===a?b:1==(a/=d)?b+c:(f||(f=.3*d),!e||e<Math.abs(c)?(e=c,g=f/4):g=f/(2*Math.PI)*Math.asin(c/e),-(e*Math.pow(2,10*(a-=1))*Math.sin((a*d-g)*2*Math.PI/f))+b)},ElasticEaseOut:function(a,b,c,d,e,f){var g=0;return 0===a?b:1==(a/=d)?b+c:(f||(f=.3*d),!e||e<Math.abs(c)?(e=c,g=f/4):g=f/(2*Math.PI)*Math.asin(c/e),e*Math.pow(2,-10*a)*Math.sin((a*d-g)*2*Math.PI/f)+c+b)},ElasticEaseInOut:function(a,b,c,d,e,f){var g=0;return 0===a?b:2==(a/=d/2)?b+c:(f||(f=d*.3*1.5),!e||e<Math.abs(c)?(e=c,g=f/4):g=f/(2*Math.PI)*Math.asin(c/e),1>a?-.5*e*Math.pow(2,10*(a-=1))*Math.sin((a*d-g)*2*Math.PI/f)+b:.5*e*Math.pow(2,-10*(a-=1))*Math.sin((a*d-g)*2*Math.PI/f)+c+b)},BounceEaseOut:function(a,b,c,d){return(a/=d)<1/2.75?c*7.5625*a*a+b:2/2.75>a?c*(7.5625*(a-=1.5/2.75)*a+.75)+b:2.5/2.75>a?c*(7.5625*(a-=2.25/2.75)*a+.9375)+b:c*(7.5625*(a-=2.625/2.75)*a+.984375)+b},BounceEaseIn:function(a,b,c,d){return c-Kinetic.Easings.BounceEaseOut(d-a,0,c,d)+b},BounceEaseInOut:function(a,b,c,d){return d/2>a?.5*Kinetic.Easings.BounceEaseIn(2*a,0,c,d)+b:.5*Kinetic.Easings.BounceEaseOut(2*a-d,0,c,d)+.5*c+b},EaseIn:function(a,b,c,d){return c*(a/=d)*a+b},EaseOut:function(a,b,c,d){return-c*(a/=d)*(a-2)+b},EaseInOut:function(a,b,c,d){return(a/=d/2)<1?c/2*a*a+b:-c/2*(--a*(a-2)-1)+b},StrongEaseIn:function(a,b,c,d){return c*(a/=d)*a*a*a*a+b},StrongEaseOut:function(a,b,c,d){return c*((a=a/d-1)*a*a*a*a+1)+b},StrongEaseInOut:function(a,b,c,d){return(a/=d/2)<1?c/2*a*a*a*a*a+b:c/2*((a-=2)*a*a*a*a+2)+b},Linear:function(a,b,c,d){return c*a/d+b}}}(),function(){Kinetic.DD={anim:new Kinetic.Animation,isDragging:!1,offset:{x:0,y:0},node:null,_drag:function(a){var b=Kinetic.DD,c=b.node;if(c){var d=c.getStage().getPointerPosition(),e=c.getDragBoundFunc(),f={x:d.x-b.offset.x,y:d.y-b.offset.y};void 0!==e&&(f=e.call(c,f,a)),c.setAbsolutePosition(f),b.isDragging||(b.isDragging=!0,c.fire("dragstart",a,!0)),c.fire("dragmove",a,!0)}},_endDragBefore:function(a){var b,c,d=Kinetic.DD,e=d.node;e&&(b=e.nodeType,c=e.getLayer(),d.anim.stop(),d.isDragging&&(d.isDragging=!1,a&&(a.dragEndNode=e)),delete d.node,(c||e).draw())},_endDragAfter:function(a){a=a||{};var b=a.dragEndNode;a&&b&&b.fire("dragend",a,!0)}},Kinetic.Node.prototype.startDrag=function(){var a=Kinetic.DD,b=this.getStage(),c=this.getLayer(),d=b.getPointerPosition(),e=(this.getTransform().getTranslation(),this.getAbsolutePosition());d&&(a.node&&a.node.stopDrag(),a.node=this,a.offset.x=d.x-e.x,a.offset.y=d.y-e.y,a.anim.setLayers(c||this.getLayers()),a.anim.start())},Kinetic.Node.prototype.stopDrag=function(){var a=Kinetic.DD,b={};a._endDragBefore(b),a._endDragAfter(b)},Kinetic.Node.prototype.setDraggable=function(a){this._setAttr("draggable",a),this._dragChange()};var a=Kinetic.Node.prototype.destroy;Kinetic.Node.prototype.destroy=function(){var b=Kinetic.DD;b.node&&b.node._id===this._id&&this.stopDrag(),a.call(this)},Kinetic.Node.prototype.isDragging=function(){var a=Kinetic.DD;return a.node&&a.node._id===this._id&&a.isDragging},Kinetic.Node.prototype._listenDrag=function(){this._dragCleanup();var a=this;this.on("mousedown.kinetic touchstart.kinetic",function(b){Kinetic.DD.node||a.startDrag(b)})},Kinetic.Node.prototype._dragChange=function(){if(this.attrs.draggable)this._listenDrag();else{this._dragCleanup();var a=this.getStage(),b=Kinetic.DD;a&&b.node&&b.node._id===this._id&&b.node.stopDrag()}},Kinetic.Node.prototype._dragCleanup=function(){this.off("mousedown.kinetic"),this.off("touchstart.kinetic")},Kinetic.Node.addGetterSetter(Kinetic.Node,"dragBoundFunc"),Kinetic.Node.addGetter(Kinetic.Node,"draggable",!1),Kinetic.Node.prototype.isDraggable=Kinetic.Node.prototype.getDraggable;var b=document.getElementsByTagName("html")[0];b.addEventListener("mouseup",Kinetic.DD._endDragBefore,!0),b.addEventListener("touchend",Kinetic.DD._endDragBefore,!0),b.addEventListener("mouseup",Kinetic.DD._endDragAfter,!1),b.addEventListener("touchend",Kinetic.DD._endDragAfter,!1)}(),function(){Kinetic.Util.addMethods(Kinetic.Container,{_containerInit:function(a){this.children=new Kinetic.Collection,Kinetic.Node.call(this,a)},getChildren:function(){return this.children},hasChildren:function(){return this.getChildren().length>0},removeChildren:function(){for(var a,b=this.children;b.length>0;){var a=b[0];a.hasChildren()&&a.removeChildren(),a.remove()}return this},destroyChildren:function(){for(var a=this.children;a.length>0;)a[0].destroy();return this},add:function(a){var b=(Kinetic.Global,this.children);return a.index=b.length,a.parent=this,b.push(a),this._fire("add",{child:a}),this},destroy:function(){this.hasChildren()&&this.destroyChildren(),Kinetic.Node.prototype.destroy.call(this)},get:function(a){var b=new Kinetic.Collection;if("#"===a.charAt(0)){var c=this._getNodeById(a.slice(1));c&&b.push(c)}else if("."===a.charAt(0)){var d=this._getNodesByName(a.slice(1));Kinetic.Collection.apply(b,d)}else{for(var e=[],f=this.getChildren(),g=f.length,h=0;g>h;h++)e=e.concat(f[h]._get(a));Kinetic.Collection.apply(b,e)}return b},_getNodeById:function(a){var b=(this.getStage(),Kinetic.Global),c=b.ids[a];return void 0!==c&&this.isAncestorOf(c)?c:null},_getNodesByName:function(a){var b=Kinetic.Global,c=b.names[a]||[];return this._getDescendants(c)},_get:function(a){for(var b=Kinetic.Node.prototype._get.call(this,a),c=this.getChildren(),d=c.length,e=0;d>e;e++)b=b.concat(c[e]._get(a));return b},toObject:function(){var a=Kinetic.Node.prototype.toObject.call(this);a.children=[];for(var b=this.getChildren(),c=b.length,d=0;c>d;d++){var e=b[d];a.children.push(e.toObject())}return a},_getDescendants:function(a){for(var b=[],c=a.length,d=0;c>d;d++){var e=a[d];this.isAncestorOf(e)&&b.push(e)}return b},isAncestorOf:function(a){for(var b=a.getParent();b;){if(b._id===this._id)return!0;b=b.getParent()}return!1},clone:function(a){var b=Kinetic.Node.prototype.clone.call(this,a);return this.getChildren().each(function(a){b.add(a.clone())}),b},getAllIntersections:function(){for(var a=Kinetic.Util._getXY(Array.prototype.slice.call(arguments)),b=[],c=this.get("Shape"),d=c.length,e=0;d>e;e++){var f=c[e];f.isVisible()&&f.intersects(a)&&b.push(f)}return b},_setChildrenIndices:function(){for(var a=this.children,b=a.length,c=0;b>c;c++)a[c].index=c},drawScene:function(a){var b,c,d,e=this.getLayer(),f=!!this.getClipFunc();if(!a&&e&&(a=e.getCanvas()),this.isVisible()){for(f&&a._clip(this),b=this.children,d=b.length,c=0;d>c;c++)b[c].drawScene(a);f&&a.getContext().restore()}return this},drawHit:function(){var a,b=!!this.getClipFunc()&&"Stage"!==this.nodeType,c=0,d=0,e=[];if(this.shouldDrawHit()){for(b&&(a=this.getLayer().hitCanvas,a._clip(this)),e=this.children,d=e.length,c=0;d>c;c++)e[c].drawHit();b&&a.getContext().restore()}return this}}),Kinetic.Util.extend(Kinetic.Container,Kinetic.Node),Kinetic.Node.addGetterSetter(Kinetic.Container,"clipFunc")}(),function(){function a(a){a.fill()}function b(a){a.stroke()}function c(a){a.fill()}function d(a){a.stroke()}Kinetic.Util.addMethods(Kinetic.Shape,{_initShape:function(e){this.nodeType="Shape",this._fillFunc=a,this._strokeFunc=b,this._fillFuncHit=c,this._strokeFuncHit=d;for(var f,g=Kinetic.Global.shapes;;)if(f=Kinetic.Util.getRandomColor(),f&&!(f in g))break;this.colorKey=f,g[f]=this,this.createAttrs(),Kinetic.Node.call(this,e)},hasChildren:function(){return!1},getChildren:function(){return[]},getContext:function(){return this.getLayer().getContext()},getCanvas:function(){return this.getLayer().getCanvas()},hasShadow:function(){return!!(this.getShadowColor()||this.getShadowBlur()||this.getShadowOffsetX()||this.getShadowOffsetY())},hasFill:function(){return!!(this.getFill()||this.getFillPatternImage()||this.getFillLinearGradientColorStops()||this.getFillRadialGradientColorStops())},_get:function(a){return this.className===a||this.nodeType===a?[this]:[]},intersects:function(){var a=Kinetic.Util._getXY(Array.prototype.slice.call(arguments)),b=this.getStage(),c=b.hitCanvas;c.clear(),this.drawScene(c);var d=c.context.getImageData(0|a.x,0|a.y,1,1).data;return d[3]>0},enableFill:function(){return this._setAttr("fillEnabled",!0),this},disableFill:function(){return this._setAttr("fillEnabled",!1),this},enableStroke:function(){return this._setAttr("strokeEnabled",!0),this},disableStroke:function(){return this._setAttr("strokeEnabled",!1),this},enableStrokeScale:function(){return this._setAttr("strokeScaleEnabled",!0),this},disableStrokeScale:function(){return this._setAttr("strokeScaleEnabled",!1),this},enableShadow:function(){return this._setAttr("shadowEnabled",!0),this},disableShadow:function(){return this._setAttr("shadowEnabled",!1),this},enableDashArray:function(){return this._setAttr("dashArrayEnabled",!0),this},disableDashArray:function(){return this._setAttr("dashArrayEnabled",!1),this},destroy:function(){return Kinetic.Node.prototype.destroy.call(this),delete Kinetic.Global.shapes[this.colorKey],this},drawScene:function(a){a=a||this.getLayer().getCanvas();var b=this.getDrawFunc(),c=a.getContext();return b&&this.isVisible()&&(c.save(),a._applyOpacity(this),a._applyLineJoin(this),a._applyAncestorTransforms(this),b.call(this,a),c.restore()),this},drawHit:function(){var a=this.getAttrs(),b=a.drawHitFunc||a.drawFunc,c=this.getLayer().hitCanvas,d=c.getContext();return b&&this.shouldDrawHit()&&(d.save(),c._applyLineJoin(this),c._applyAncestorTransforms(this),b.call(this,c),d.restore()),this},_setDrawFuncs:function(){!this.attrs.drawFunc&&this.drawFunc&&this.setDrawFunc(this.drawFunc),!this.attrs.drawHitFunc&&this.drawHitFunc&&this.setDrawHitFunc(this.drawHitFunc)}}),Kinetic.Util.extend(Kinetic.Shape,Kinetic.Node),Kinetic.Node.addColorGetterSetter(Kinetic.Shape,"stroke"),Kinetic.Node.addGetterSetter(Kinetic.Shape,"lineJoin"),Kinetic.Node.addGetterSetter(Kinetic.Shape,"lineCap"),Kinetic.Node.addGetterSetter(Kinetic.Shape,"strokeWidth"),Kinetic.Node.addGetterSetter(Kinetic.Shape,"drawFunc"),Kinetic.Node.addGetterSetter(Kinetic.Shape,"drawHitFunc"),Kinetic.Node.addGetterSetter(Kinetic.Shape,"dashArray"),Kinetic.Node.addColorGetterSetter(Kinetic.Shape,"shadowColor"),Kinetic.Node.addGetterSetter(Kinetic.Shape,"shadowBlur"),Kinetic.Node.addGetterSetter(Kinetic.Shape,"shadowOpacity"),Kinetic.Node.addGetterSetter(Kinetic.Shape,"fillPatternImage"),Kinetic.Node.addColorGetterSetter(Kinetic.Shape,"fill"),Kinetic.Node.addGetterSetter(Kinetic.Shape,"fillPatternX"),Kinetic.Node.addGetterSetter(Kinetic.Shape,"fillPatternY"),Kinetic.Node.addGetterSetter(Kinetic.Shape,"fillLinearGradientColorStops"),Kinetic.Node.addGetterSetter(Kinetic.Shape,"fillRadialGradientStartRadius"),Kinetic.Node.addGetterSetter(Kinetic.Shape,"fillRadialGradientEndRadius"),Kinetic.Node.addGetterSetter(Kinetic.Shape,"fillRadialGradientColorStops"),Kinetic.Node.addGetterSetter(Kinetic.Shape,"fillPatternRepeat"),Kinetic.Node.addGetterSetter(Kinetic.Shape,"fillEnabled",!0),Kinetic.Node.addGetterSetter(Kinetic.Shape,"strokeEnabled",!0),Kinetic.Node.addGetterSetter(Kinetic.Shape,"shadowEnabled",!0),Kinetic.Node.addGetterSetter(Kinetic.Shape,"dashArrayEnabled",!0),Kinetic.Node.addGetterSetter(Kinetic.Shape,"fillPriority","color"),Kinetic.Node.addGetterSetter(Kinetic.Shape,"strokeScaleEnabled",!0),Kinetic.Node.addPointGetterSetter(Kinetic.Shape,"fillPatternOffset",0),Kinetic.Node.addPointGetterSetter(Kinetic.Shape,"fillPatternScale",1),Kinetic.Node.addPointGetterSetter(Kinetic.Shape,"fillLinearGradientStartPoint",0),Kinetic.Node.addPointGetterSetter(Kinetic.Shape,"fillLinearGradientEndPoint",0),Kinetic.Node.addPointGetterSetter(Kinetic.Shape,"fillRadialGradientStartPoint",0),Kinetic.Node.addPointGetterSetter(Kinetic.Shape,"fillRadialGradientEndPoint",0),Kinetic.Node.addPointGetterSetter(Kinetic.Shape,"shadowOffset",0),Kinetic.Node.addRotationGetterSetter(Kinetic.Shape,"fillPatternRotation",0)}(),function(){function a(a,b){a.content.addEventListener(b,function(c){c.preventDefault(),a[x+b](c)},!1)}var b="Stage",c="string",d="px",e="mouseout",f="mouseleave",g="mouseover",h="mouseenter",i="mousemove",j="mousedown",k="mouseup",l="click",m="dblclick",n="touchstart",o="touchend",p="tap",q="dbltap",r="touchmove",s="div",t="relative",u="inline-block",v="kineticjs-content",w=" ",x="_",y="container",z="",A=[j,i,k,e,n,r,o],B=A.length;Kinetic.Util.addMethods(Kinetic.Stage,{_initStage:function(a){this.createAttrs(),Kinetic.Container.call(this,a),this.nodeType=b,this.dblClickWindow=400,this._id=Kinetic.Global.idCounter++,this._buildDOM(),this._bindContentEvents(),Kinetic.Global.stages.push(this)},setContainer:function(a){return typeof a===c&&(a=document.getElementById(a)),this._setAttr(y,a),this},draw:function(){var a,b,c=this.getChildren(),d=c.length;for(a=0;d>a;a++)b=c[a],b.getClearBeforeDraw()&&(b.getCanvas().clear(),b.getHitCanvas().clear());return Kinetic.Node.prototype.draw.call(this),this},setHeight:function(a){return Kinetic.Node.prototype.setHeight.call(this,a),this._resizeDOM(),this},setWidth:function(a){return Kinetic.Node.prototype.setWidth.call(this,a),this._resizeDOM(),this},clear:function(){var a,b=this.children,c=b.length;for(a=0;c>a;a++)b[a].clear();return this},destroy:function(){var a=this.content;Kinetic.Container.prototype.destroy.call(this),a&&Kinetic.Util._isInDocument(a)&&this.getContainer().removeChild(a)},getMousePosition:function(){return this.mousePos},getTouchPosition:function(){return this.touchPos},getPointerPosition:function(){return this.getTouchPosition()||this.getMousePosition()},getStage:function(){return this},getContent:function(){return this.content},toDataURL:function(a){function b(e){var f=i[e],j=f.toDataURL(),k=new Image;k.onload=function(){h.drawImage(k,0,0),e<i.length-1?b(e+1):a.callback(g.toDataURL(c,d))},k.src=j}a=a||{};var c=a.mimeType||null,d=a.quality||null,e=a.x||0,f=a.y||0,g=new Kinetic.SceneCanvas({width:a.width||this.getWidth(),height:a.height||this.getHeight(),pixelRatio:1}),h=g.getContext(),i=this.children;(e||f)&&h.translate(-1*e,-1*f),b(0)},toImage:function(a){var b=a.callback;a.callback=function(a){Kinetic.Util._getImage(a,function(a){b(a)})},this.toDataURL(a)},getIntersection:function(){var a,b,c=Kinetic.Util._getXY(Array.prototype.slice.call(arguments)),d=this.getChildren(),e=d.length,f=e-1;for(a=f;a>=0;a--)if(b=d[a].getIntersection(c))return b;return null},_resizeDOM:function(){if(this.content){var a,b=this.getWidth(),c=this.getHeight(),e=this.getChildren(),f=e.length;for(this.content.style.width=b+d,this.content.style.height=c+d,this.bufferCanvas.setSize(b,c,1),this.hitCanvas.setSize(b,c),a=0;f>a;a++)layer=e[a],layer.getCanvas().setSize(b,c),layer.hitCanvas.setSize(b,c),layer.draw()}},add:function(a){return Kinetic.Container.prototype.add.call(this,a),a.canvas.setSize(this.attrs.width,this.attrs.height),a.hitCanvas.setSize(this.attrs.width,this.attrs.height),a.draw(),this.content.appendChild(a.canvas.element),this},getParent:function(){return null},getLayer:function(){return null},getLayers:function(){return this.getChildren()},_setPointerPosition:function(a){a||(a=window.event),this._setMousePosition(a),this._setTouchPosition(a)},_bindContentEvents:function(){var b;for(b=0;B>b;b++)a(this,A[b])},_mouseout:function(a){this._setPointerPosition(a);var b=Kinetic.Global,c=this.targetShape;c&&!b.isDragging()&&(c._fireAndBubble(e,a),c._fireAndBubble(f,a),this.targetShape=null),this.mousePos=void 0},_mousemove:function(a){this._setPointerPosition(a);var b,c=Kinetic.Global,d=Kinetic.DD,j=this.getIntersection(this.getPointerPosition());j?(b=j.shape,b&&(c.isDragging()||255!==j.pixel[3]||this.targetShape&&this.targetShape._id===b._id?b._fireAndBubble(i,a):(this.targetShape&&(this.targetShape._fireAndBubble(e,a,b),this.targetShape._fireAndBubble(f,a,b)),b._fireAndBubble(g,a,this.targetShape),b._fireAndBubble(h,a,this.targetShape),this.targetShape=b))):this.targetShape&&!c.isDragging()&&(this.targetShape._fireAndBubble(e,a),this.targetShape._fireAndBubble(f,a),this.targetShape=null),d&&d._drag(a)},_mousedown:function(a){this._setPointerPosition(a);var b,c=Kinetic.Global,d=this.getIntersection(this.getPointerPosition());d&&d.shape&&(b=d.shape,this.clickStart=!0,this.clickStartShape=b,b._fireAndBubble(j,a)),this.isDraggable()&&!c.isDragReady()&&this.startDrag(a)},_mouseup:function(a){this._setPointerPosition(a);var b,c=this,d=Kinetic.Global,e=this.getIntersection(this.getPointerPosition());e&&e.shape&&(b=e.shape,b._fireAndBubble(k,a),this.clickStart&&(d.isDragging()||b._id!==this.clickStartShape._id||(b._fireAndBubble(l,a),this.inDoubleClickWindow&&b._fireAndBubble(m,a),this.inDoubleClickWindow=!0,setTimeout(function(){c.inDoubleClickWindow=!1},this.dblClickWindow)))),this.clickStart=!1},_touchstart:function(a){this._setPointerPosition(a);var b,c=Kinetic.Global,d=this.getIntersection(this.getPointerPosition());d&&d.shape&&(b=d.shape,this.tapStart=!0,this.tapStartShape=b,b._fireAndBubble(n,a)),this.isDraggable()&&!c.isDragReady()&&this.startDrag(a)},_touchend:function(a){this._setPointerPosition(a);var b,c=this,d=Kinetic.Global,e=this.getIntersection(this.getPointerPosition());e&&e.shape&&(b=e.shape,b._fireAndBubble(o,a),this.tapStart&&(d.isDragging()||b._id!==this.tapStartShape._id||(b._fireAndBubble(p,a),this.inDoubleClickWindow&&b._fireAndBubble(q,a),this.inDoubleClickWindow=!0,setTimeout(function(){c.inDoubleClickWindow=!1},this.dblClickWindow)))),this.tapStart=!1},_touchmove:function(a){this._setPointerPosition(a);var b,c=Kinetic.DD,d=this.getIntersection(this.getPointerPosition());d&&d.shape&&(b=d.shape,b._fireAndBubble(r,a)),c&&c._drag(a)},_setMousePosition:function(a){var b=a.clientX-this._getContentPosition().left,c=a.clientY-this._getContentPosition().top;this.mousePos={x:b,y:c}},_setTouchPosition:function(a){var b,c,d;void 0!==a.touches&&1===a.touches.length&&(b=a.touches[0],c=b.clientX-this._getContentPosition().left,d=b.clientY-this._getContentPosition().top,this.touchPos={x:c,y:d})},_getContentPosition:function(){var a=this.content.getBoundingClientRect();return{top:a.top,left:a.left}},_buildDOM:function(){var a=this.getContainer();a.innerHTML=z,this.content=document.createElement(s),this.content.style.position=t,this.content.style.display=u,this.content.className=v,a.appendChild(this.content),this.bufferCanvas=new Kinetic.SceneCanvas,this.hitCanvas=new Kinetic.HitCanvas,this._resizeDOM()},_onContent:function(a,b){var c,d,e=a.split(w),f=e.length;for(c=0;f>c;c++)d=e[c],this.content.addEventListener(d,b,!1)}}),Kinetic.Util.extend(Kinetic.Stage,Kinetic.Container),Kinetic.Node.addGetter(Kinetic.Stage,"container")}(),function(){var a="#";Kinetic.Util.addMethods(Kinetic.Layer,{_initLayer:function(a){this.nodeType="Layer",this.createAttrs(),this.canvas=new Kinetic.SceneCanvas,this.canvas.getElement().style.position="absolute",this.hitCanvas=new Kinetic.HitCanvas,Kinetic.Container.call(this,a)},getIntersection:function(){var b,c,d,e=Kinetic.Util._getXY(Array.prototype.slice.call(arguments));if(this.isVisible()&&this.isListening()){if(b=this.hitCanvas.context.getImageData(0|e.x,0|e.y,1,1).data,255===b[3])return c=Kinetic.Util._rgbToHex(b[0],b[1],b[2]),d=Kinetic.Global.shapes[a+c],{shape:d,pixel:b};if(b[0]>0||b[1]>0||b[2]>0||b[3]>0)return{pixel:b}}return null},drawScene:function(a){return a=a||this.getCanvas(),this.getClearBeforeDraw()&&a.clear(),Kinetic.Container.prototype.drawScene.call(this,a),this},drawHit:function(){var a=this.getLayer();return a&&a.getClearBeforeDraw()&&a.getHitCanvas().clear(),Kinetic.Container.prototype.drawHit.call(this),this},getCanvas:function(){return this.canvas},getHitCanvas:function(){return this.hitCanvas},getContext:function(){return this.getCanvas().getContext()},clear:function(){return this.getCanvas().clear(),this},setVisible:function(a){return Kinetic.Node.prototype.setVisible.call(this,a),a?(this.getCanvas().element.style.display="block",this.hitCanvas.element.style.display="block"):(this.getCanvas().element.style.display="none",this.hitCanvas.element.style.display="none"),this},setZIndex:function(a){Kinetic.Node.prototype.setZIndex.call(this,a);var b=this.getStage();return b&&(b.content.removeChild(this.getCanvas().element),a<b.getChildren().length-1?b.content.insertBefore(this.getCanvas().element,b.getChildren()[a+1].getCanvas().element):b.content.appendChild(this.getCanvas().element)),this},moveToTop:function(){Kinetic.Node.prototype.moveToTop.call(this);var a=this.getStage();a&&(a.content.removeChild(this.getCanvas().element),a.content.appendChild(this.getCanvas().element))},moveUp:function(){if(Kinetic.Node.prototype.moveUp.call(this)){var a=this.getStage();a&&(a.content.removeChild(this.getCanvas().element),this.index<a.getChildren().length-1?a.content.insertBefore(this.getCanvas().element,a.getChildren()[this.index+1].getCanvas().element):a.content.appendChild(this.getCanvas().element))}},moveDown:function(){if(Kinetic.Node.prototype.moveDown.call(this)){var a=this.getStage();if(a){var b=a.getChildren();a.content.removeChild(this.getCanvas().element),a.content.insertBefore(this.getCanvas().element,b[this.index+1].getCanvas().element)}}},moveToBottom:function(){if(Kinetic.Node.prototype.moveToBottom.call(this)){var a=this.getStage();if(a){var b=a.getChildren();a.content.removeChild(this.getCanvas().element),a.content.insertBefore(this.getCanvas().element,b[1].getCanvas().element)}}},getLayer:function(){return this},remove:function(){var a=this.getStage(),b=this.getCanvas(),c=b.element;return Kinetic.Node.prototype.remove.call(this),a&&b&&Kinetic.Util._isInDocument(c)&&a.content.removeChild(c),this}}),Kinetic.Util.extend(Kinetic.Layer,Kinetic.Container),Kinetic.Node.addGetterSetter(Kinetic.Layer,"clearBeforeDraw",!0)}(),function(){Kinetic.Util.addMethods(Kinetic.Group,{_initGroup:function(a){this.nodeType="Group",this.createAttrs(),Kinetic.Container.call(this,a)}}),Kinetic.Util.extend(Kinetic.Group,Kinetic.Container)}(),function(){Kinetic.Rect=function(a){this._initRect(a)},Kinetic.Rect.prototype={_initRect:function(a){this.createAttrs(),Kinetic.Shape.call(this,a),this.className="Rect",this._setDrawFuncs()},drawFunc:function(a){var b=a.getContext(),c=this.getCornerRadius(),d=this.getWidth(),e=this.getHeight();b.beginPath(),c?(b.moveTo(c,0),b.lineTo(d-c,0),b.arc(d-c,c,c,3*Math.PI/2,0,!1),b.lineTo(d,e-c),b.arc(d-c,e-c,c,0,Math.PI/2,!1),b.lineTo(c,e),b.arc(c,e-c,c,Math.PI/2,Math.PI,!1),b.lineTo(0,c),b.arc(c,c,c,Math.PI,3*Math.PI/2,!1)):b.rect(0,0,d,e),b.closePath(),a.fillStroke(this)}},Kinetic.Util.extend(Kinetic.Rect,Kinetic.Shape),Kinetic.Node.addGetterSetter(Kinetic.Rect,"cornerRadius",0)}(),function(){var a=2*Math.PI-1e-4,b="Circle";Kinetic.Circle=function(a){this._initCircle(a)},Kinetic.Circle.prototype={_initCircle:function(a){this.createAttrs(),Kinetic.Shape.call(this,a),this.className=b,this._setDrawFuncs()},drawFunc:function(b){var c=b.getContext();c.beginPath(),c.arc(0,0,this.getRadius(),0,a,!1),c.closePath(),b.fillStroke(this)},getWidth:function(){return 2*this.getRadius()},getHeight:function(){return 2*this.getRadius()},setWidth:function(a){Kinetic.Node.prototype.setWidth.call(this,a),this.setRadius(a/2)},setHeight:function(a){Kinetic.Node.prototype.setHeight.call(this,a),this.setRadius(a/2)}},Kinetic.Util.extend(Kinetic.Circle,Kinetic.Shape),Kinetic.Node.addGetterSetter(Kinetic.Circle,"radius",0)}(),function(){var a=2*Math.PI-1e-4,b="Ellipse";Kinetic.Ellipse=function(a){this._initEllipse(a)},Kinetic.Ellipse.prototype={_initEllipse:function(a){this.createAttrs(),Kinetic.Shape.call(this,a),this.className=b,this._setDrawFuncs()},drawFunc:function(b){var c=b.getContext(),d=this.getRadius();c.beginPath(),c.save(),d.x!==d.y&&c.scale(1,d.y/d.x),c.arc(0,0,d.x,0,a,!1),c.restore(),c.closePath(),b.fillStroke(this)},getWidth:function(){return 2*this.getRadius().x},getHeight:function(){return 2*this.getRadius().y},setWidth:function(a){Kinetic.Node.prototype.setWidth.call(this,a),this.setRadius({x:a/2})},setHeight:function(a){Kinetic.Node.prototype.setHeight.call(this,a),this.setRadius({y:a/2})}},Kinetic.Util.extend(Kinetic.Ellipse,Kinetic.Shape),Kinetic.Node.addPointGetterSetter(Kinetic.Ellipse,"radius",0)}(),function(){Kinetic.Wedge=function(a){this._initWedge(a)},Kinetic.Wedge.prototype={_initWedge:function(a){this.createAttrs(),Kinetic.Shape.call(this,a),this.className="Wedge",this._setDrawFuncs()},drawFunc:function(a){var b=a.getContext();b.beginPath(),b.arc(0,0,this.getRadius(),0,this.getAngle(),this.getClockwise()),b.lineTo(0,0),b.closePath(),a.fillStroke(this)}},Kinetic.Util.extend(Kinetic.Wedge,Kinetic.Shape),Kinetic.Node.addGetterSetter(Kinetic.Wedge,"radius",0),Kinetic.Node.addRotationGetterSetter(Kinetic.Wedge,"angle",0),Kinetic.Node.addGetterSetter(Kinetic.Wedge,"clockwise",!1)}(),function(){var a="Image",b="crop",c="set";Kinetic.Image=function(a){this._initImage(a)},Kinetic.Image.prototype={_initImage:function(b){Kinetic.Shape.call(this,b),this.className=a,this._setDrawFuncs()},drawFunc:function(a){var b,c,d,e,f,g,h=this.getWidth(),i=this.getHeight(),j=this,k=a.getContext(),l=this.getCrop();this.getFilter()&&this._applyFilter&&(this.applyFilter(),this._applyFilter=!1),g=this.filterCanvas?this.filterCanvas.getElement():this.getImage(),k.beginPath(),k.rect(0,0,h,i),k.closePath(),a.fillStroke(this),g&&(l?(c=l.x||0,d=l.y||0,e=l.width||0,f=l.height||0,b=[g,c,d,e,f,0,0,h,i]):b=[g,0,0,h,i],this.hasShadow()?a.applyShadow(this,function(){j._drawImage(k,b)}):this._drawImage(k,b))},drawHitFunc:function(a){var b=this.getWidth(),c=this.getHeight(),d=this.imageHitRegion,e=a.getContext();d?(e.drawImage(d,0,0,b,c),e.beginPath(),e.rect(0,0,b,c),e.closePath(),a.stroke(this)):(e.beginPath(),e.rect(0,0,b,c),e.closePath(),a.fillStroke(this))},applyFilter:function(){var a,b,c,d=this.getImage(),e=this.getWidth(),f=this.getHeight(),g=this.getFilter();a=this.filterCanvas?this.filterCanvas:this.filterCanvas=new Kinetic.SceneCanvas({width:e,height:f}),b=a.getContext();try{this._drawImage(b,[d,0,0,e,f]),c=b.getImageData(0,0,a.getWidth(),a.getHeight()),g.call(this,c),b.putImageData(c,0,0)}catch(h){this.clearFilter(),Kinetic.Util.warn("Unable to apply filter. "+h.message)}},clearFilter:function(){this.filterCanvas=null,this._applyFilter=!1},setCrop:function(){var a=[].slice.call(arguments),c=Kinetic.Util._getXY(a),d=Kinetic.Util._getSize(a),e=Kinetic.Util._merge(c,d);this._setAttr(b,Kinetic.Util._merge(e,this.getCrop()))},createImageHitRegion:function(a){var b,c,d,e,f,g=this,h=this.getWidth(),i=this.getHeight(),j=new Kinetic.Canvas({width:h,height:i}),k=j.getContext(),l=this.getImage();k.drawImage(l,0,0);try{for(b=k.getImageData(0,0,h,i),c=b.data,d=Kinetic.Util._hexToRgb(this.colorKey),e=0,f=c.length;f>e;e+=4)c[e+3]>0&&(c[e]=d.r,c[e+1]=d.g,c[e+2]=d.b);Kinetic.Util._getImage(b,function(b){g.imageHitRegion=b,a&&a()})}catch(m){Kinetic.Util.warn("Unable to create image hit region. "+m.message)}},clearImageHitRegion:function(){delete this.imageHitRegion},getWidth:function(){var a=this.getImage();return this.attrs.width||(a?a.width:0)},getHeight:function(){var a=this.getImage();return this.attrs.height||(a?a.height:0)},_drawImage:function(a,b){5===b.length?a.drawImage(b[0],b[1],b[2],b[3],b[4]):9===b.length&&a.drawImage(b[0],b[1],b[2],b[3],b[4],b[5],b[6],b[7],b[8])}},Kinetic.Util.extend(Kinetic.Image,Kinetic.Shape),Kinetic.Node.addFilterGetterSetter=function(a,b,c){this.addGetter(a,b,c),this.addFilterSetter(a,b)},Kinetic.Node.addFilterSetter=function(a,b){var d=c+Kinetic.Util._capitalize(b);a.prototype[d]=function(a){this._setAttr(b,a),this._applyFilter=!0}},Kinetic.Node.addGetterSetter(Kinetic.Image,"image"),Kinetic.Node.addGetter(Kinetic.Image,"crop"),Kinetic.Node.addFilterGetterSetter(Kinetic.Image,"filter")}(),function(){Kinetic.Polygon=function(a){this._initPolygon(a)},Kinetic.Polygon.prototype={_initPolygon:function(a){this.createAttrs(),Kinetic.Shape.call(this,a),this.className="Polygon",this._setDrawFuncs()},drawFunc:function(a){var b=a.getContext(),c=this.getPoints(),d=c.length;b.beginPath(),b.moveTo(c[0].x,c[0].y);for(var e=1;d>e;e++)b.lineTo(c[e].x,c[e].y);b.closePath(),a.fillStroke(this)}},Kinetic.Util.extend(Kinetic.Polygon,Kinetic.Shape),Kinetic.Node.addPointsGetterSetter(Kinetic.Polygon,"points")}(),function(){function a(a){a.fillText(this.partialText,0,0)}function b(a){a.strokeText(this.partialText,0,0)}var c="auto",d="Calibri",e="canvas",f="center",g="Change.kinetic",h="2d",i="-",j="",k="left",l="text",m="Text",n="middle",o="normal",p="px ",q=" ",r="right",s="word",t="char",u="none",v=["fontFamily","fontSize","fontStyle","padding","align","lineHeight","text","width","height","wrap"],w=v.length,x=document.createElement(e).getContext(h);Kinetic.Text=function(a){this._initText(a)},Kinetic.Text.prototype={_initText:function(d){var e=this;this.createAttrs(),this.attrs.width=c,this.attrs.height=c,Kinetic.Shape.call(this,d),this._fillFunc=a,this._strokeFunc=b,this.className=m,this._setDrawFuncs();for(var f=0;w>f;f++)this.on(v[f]+g,e._setTextData);this._setTextData()},drawFunc:function(a){var b=a.getContext(),c=this.getPadding(),d=(this.getFontStyle(),this.getFontSize(),this.getFontFamily(),this.getTextHeight()),e=this.getLineHeight()*d,g=this.textArr,h=g.length,i=this.getWidth();b.font=this._getContextFont(),b.textBaseline=n,b.textAlign=k,b.save(),b.translate(c,0),b.translate(0,c+d/2);for(var j=0;h>j;j++){var l=g[j],m=l.text,o=l.width;b.save(),this.getAlign()===r?b.translate(i-o-2*c,0):this.getAlign()===f&&b.translate((i-o-2*c)/2,0),this.partialText=m,a.fillStroke(this),b.restore(),b.translate(0,e)}b.restore()},drawHitFunc:function(a){var b=a.getContext(),c=this.getWidth(),d=this.getHeight();b.beginPath(),b.rect(0,0,c,d),b.closePath(),a.fillStroke(this)},setText:function(a){var b=Kinetic.Util._isString(a)?a:a.toString();this._setAttr(l,b)},getWidth:function(){return this.attrs.width===c?this.getTextWidth()+2*this.getPadding():this.attrs.width},getHeight:function(){return this.attrs.height===c?this.getTextHeight()*this.textArr.length*this.getLineHeight()+2*this.getPadding():this.attrs.height},getTextWidth:function(){return this.textWidth},getTextHeight:function(){return this.textHeight},_getTextSize:function(a){var b,c=x,d=this.getFontSize();return c.save(),c.font=this._getContextFont(),b=c.measureText(a),c.restore(),{width:b.width,height:parseInt(d,10)}},_getContextFont:function(){return this.getFontStyle()+q+this.getFontSize()+p+this.getFontFamily()},_addTextLine:function(a,b){return this.textArr.push({text:a,width:b})},_getTextWidth:function(a){return x.measureText(a).width},_setTextData:function(){var a=this.getText().split("\n"),b=+this.getFontSize(),d=0,e=this.getLineHeight()*b,f=this.attrs.width,g=this.attrs.height,h=f!==c,j=g!==c,k=this.getPadding(),l=f-2*k,m=g-2*k,n=0,o=this.getWrap(),r=o!==u,s=o!==t&&r;this.textArr=[],x.save(),x.font=this.getFontStyle()+q+b+p+this.getFontFamily();for(var v=0,w=a.length;w>v;++v){var y=a[v],z=this._getTextWidth(y);if(h&&z>l)for(;y.length>0;){for(var A=0,B=y.length,C="",D=0;B>A;){var E=A+B>>>1,F=y.slice(0,E+1),G=this._getTextWidth(F);l>=G?(A=E+1,C=F,D=G):B=E}if(!C)break;if(s){var H=Math.max(C.lastIndexOf(q),C.lastIndexOf(i))+1;H>0&&(A=H,C=C.slice(0,A),D=this._getTextWidth(C))
|
4 |
+
}if(this._addTextLine(C,D),n+=e,!r||j&&n+e>m)break;if(y=y.slice(A),y.length>0&&(z=this._getTextWidth(y),l>=z)){this._addTextLine(y,z),n+=e;break}}else this._addTextLine(y,z),n+=e,d=Math.max(d,z);if(j&&n+e>m)break}x.restore(),this.textHeight=b,this.textWidth=d}},Kinetic.Util.extend(Kinetic.Text,Kinetic.Shape),Kinetic.Node.addGetterSetter(Kinetic.Text,"fontFamily",d),Kinetic.Node.addGetterSetter(Kinetic.Text,"fontSize",12),Kinetic.Node.addGetterSetter(Kinetic.Text,"fontStyle",o),Kinetic.Node.addGetterSetter(Kinetic.Text,"padding",0),Kinetic.Node.addGetterSetter(Kinetic.Text,"align",k),Kinetic.Node.addGetterSetter(Kinetic.Text,"lineHeight",1),Kinetic.Node.addGetterSetter(Kinetic.Text,"wrap",s),Kinetic.Node.addGetter(Kinetic.Text,l,j),Kinetic.Node.addSetter(Kinetic.Text,"width"),Kinetic.Node.addSetter(Kinetic.Text,"height")}(),function(){Kinetic.Line=function(a){this._initLine(a)},Kinetic.Line.prototype={_initLine:function(a){this.createAttrs(),Kinetic.Shape.call(this,a),this.className="Line",this._setDrawFuncs()},drawFunc:function(a){var b,c,d=this.getPoints(),e=d.length,f=a.getContext();for(f.beginPath(),f.moveTo(d[0].x,d[0].y),b=1;e>b;b++)c=d[b],f.lineTo(c.x,c.y);a.stroke(this)}},Kinetic.Util.extend(Kinetic.Line,Kinetic.Shape),Kinetic.Node.addPointsGetterSetter(Kinetic.Line,"points")}(),function(){Kinetic.Spline=function(a){this._initSpline(a)},Kinetic.Spline.prototype={_initSpline:function(a){this.createAttrs(),Kinetic.Shape.call(this,a),this.className="Spline",this._setDrawFuncs()},drawFunc:function(a){var b,c,d,e,f=this.getPoints(),g=f.length,h=a.getContext(),i=this.getTension();if(h.beginPath(),h.moveTo(f[0].x,f[0].y),0!==i&&g>2){for(b=this.allPoints,c=b.length,d=2,h.quadraticCurveTo(b[0].x,b[0].y,b[1].x,b[1].y);c-1>d;)h.bezierCurveTo(b[d].x,b[d++].y,b[d].x,b[d++].y,b[d].x,b[d++].y);h.quadraticCurveTo(b[c-1].x,b[c-1].y,f[g-1].x,f[g-1].y)}else for(d=1;g>d;d++)e=f[d],h.lineTo(e.x,e.y);a.stroke(this)},setTension:function(a){this._setAttr("tension",a),this._setAllPoints()},setPoints:function(a){Kinetic.Node.setPoints.call(this,a),this._setAllPoints()},_setAllPoints:function(){this.allPoints=Kinetic.Util._expandPoints(this.getPoints(),this.getTension())}},Kinetic.Util.extend(Kinetic.Spline,Kinetic.Shape),Kinetic.Node.addGetter(Kinetic.Spline,"tension",1),Kinetic.Node.addPointsGetter(Kinetic.Spline,"points")}(),function(){Kinetic.Blob=function(a){this._initBlob(a)},Kinetic.Blob.prototype={_initBlob:function(a){this.createAttrs(),Kinetic.Shape.call(this,a),this.className="Blob",this._setDrawFuncs()},drawFunc:function(a){var b,c,d,e,f=this.getPoints(),g=f.length,h=a.getContext(),i=this.getTension();if(h.beginPath(),h.moveTo(f[0].x,f[0].y),0!==i&&g>2)for(b=this.allPoints,c=b.length,d=0;c-1>d;)h.bezierCurveTo(b[d].x,b[d++].y,b[d].x,b[d++].y,b[d].x,b[d++].y);else for(d=1;g>d;d++)e=f[d],h.lineTo(e.x,e.y);h.closePath(),a.fillStroke(this)},setTension:function(a){this._setAttr("tension",a),this._setAllPoints()},setPoints:function(a){Kinetic.Node.setPoints.call(this,a),this._setAllPoints()},_setAllPoints:function(){var a=this.getPoints(),b=a.length,c=this.getTension(),d=Kinetic.Util,e=d._getControlPoints(a[b-1],a[0],a[1],c),f=d._getControlPoints(a[b-2],a[b-1],a[0],c);this.allPoints=Kinetic.Util._expandPoints(this.getPoints(),this.getTension()),this.allPoints.unshift(e[1]),this.allPoints.push(f[0]),this.allPoints.push(a[b-1]),this.allPoints.push(f[1]),this.allPoints.push(e[0]),this.allPoints.push(a[0])}},Kinetic.Util.extend(Kinetic.Blob,Kinetic.Shape),Kinetic.Node.addGetter(Kinetic.Blob,"tension",1),Kinetic.Node.addPointsGetter(Kinetic.Blob,"points")}(),function(){Kinetic.Sprite=function(a){this._initSprite(a)},Kinetic.Sprite.prototype={_initSprite:function(a){this.createAttrs(),Kinetic.Shape.call(this,a),this.className="Sprite",this._setDrawFuncs(),this.anim=new Kinetic.Animation;var b=this;this.on("animationChange",function(){b.setIndex(0)})},drawFunc:function(a){var b=this.getAnimation(),c=this.getIndex(),d=this.getAnimations()[b][c],e=a.getContext(),f=this.getImage();f&&e.drawImage(f,d.x,d.y,d.width,d.height,0,0,d.width,d.height)},drawHitFunc:function(a){var b=this.getAnimation(),c=this.getIndex(),d=this.getAnimations()[b][c],e=a.getContext();e.beginPath(),e.rect(0,0,d.width,d.height),e.closePath(),a.fill(this)},start:function(){var a=this,b=this.getLayer();this.anim.setLayers(b),this.interval=setInterval(function(){var b=a.getIndex();a._updateIndex(),a.afterFrameFunc&&b===a.afterFrameIndex&&(a.afterFrameFunc(),delete a.afterFrameFunc,delete a.afterFrameIndex)},1e3/this.getFrameRate()),this.anim.start()},stop:function(){this.anim.stop(),clearInterval(this.interval)},afterFrame:function(a,b){this.afterFrameIndex=a,this.afterFrameFunc=b},_updateIndex:function(){var a=this.getIndex(),b=this.getAnimation(),c=this.getAnimations(),d=c[b],e=d.length;e-1>a?this.setIndex(a+1):this.setIndex(0)}},Kinetic.Util.extend(Kinetic.Sprite,Kinetic.Shape),Kinetic.Node.addGetterSetter(Kinetic.Sprite,"animation"),Kinetic.Node.addGetterSetter(Kinetic.Sprite,"animations"),Kinetic.Node.addGetterSetter(Kinetic.Sprite,"image"),Kinetic.Node.addGetterSetter(Kinetic.Sprite,"index",0),Kinetic.Node.addGetterSetter(Kinetic.Sprite,"frameRate",17)}(),function(){Kinetic.Path=function(a){this._initPath(a)},Kinetic.Path.prototype={_initPath:function(a){this.dataArray=[];var b=this;Kinetic.Shape.call(this,a),this.className="Path",this._setDrawFuncs(),this.dataArray=Kinetic.Path.parsePathData(this.getData()),this.on("dataChange",function(){b.dataArray=Kinetic.Path.parsePathData(this.getData())})},drawFunc:function(a){var b=this.dataArray,c=a.getContext();c.beginPath();for(var d=0;d<b.length;d++){var e=b[d].command,f=b[d].points;switch(e){case"L":c.lineTo(f[0],f[1]);break;case"M":c.moveTo(f[0],f[1]);break;case"C":c.bezierCurveTo(f[0],f[1],f[2],f[3],f[4],f[5]);break;case"Q":c.quadraticCurveTo(f[0],f[1],f[2],f[3]);break;case"A":var g=f[0],h=f[1],i=f[2],j=f[3],k=f[4],l=f[5],m=f[6],n=f[7],o=i>j?i:j,p=i>j?1:i/j,q=i>j?j/i:1;c.translate(g,h),c.rotate(m),c.scale(p,q),c.arc(0,0,o,k,k+l,1-n),c.scale(1/p,1/q),c.rotate(-m),c.translate(-g,-h);break;case"z":c.closePath()}}a.fillStroke(this)}},Kinetic.Util.extend(Kinetic.Path,Kinetic.Shape),Kinetic.Path.getLineLength=function(a,b,c,d){return Math.sqrt((c-a)*(c-a)+(d-b)*(d-b))},Kinetic.Path.getPointOnLine=function(a,b,c,d,e,f,g){void 0===f&&(f=b),void 0===g&&(g=c);var h=(e-c)/(d-b+1e-8),i=Math.sqrt(a*a/(1+h*h));b>d&&(i*=-1);var j,k=h*i;if((g-c)/(f-b+1e-8)===h)j={x:f+i,y:g+k};else{var l,m,n=this.getLineLength(b,c,d,e);if(1e-8>n)return void 0;var o=(f-b)*(d-b)+(g-c)*(e-c);o/=n*n,l=b+o*(d-b),m=c+o*(e-c);var p=this.getLineLength(f,g,l,m),q=Math.sqrt(a*a-p*p);i=Math.sqrt(q*q/(1+h*h)),b>d&&(i*=-1),k=h*i,j={x:l+i,y:m+k}}return j},Kinetic.Path.getPointOnCubicBezier=function(a,b,c,d,e,f,g,h,i){function j(a){return a*a*a}function k(a){return 3*a*a*(1-a)}function l(a){return 3*a*(1-a)*(1-a)}function m(a){return(1-a)*(1-a)*(1-a)}var n=h*j(a)+f*k(a)+d*l(a)+b*m(a),o=i*j(a)+g*k(a)+e*l(a)+c*m(a);return{x:n,y:o}},Kinetic.Path.getPointOnQuadraticBezier=function(a,b,c,d,e,f,g){function h(a){return a*a}function i(a){return 2*a*(1-a)}function j(a){return(1-a)*(1-a)}var k=f*h(a)+d*i(a)+b*j(a),l=g*h(a)+e*i(a)+c*j(a);return{x:k,y:l}},Kinetic.Path.getPointOnEllipticalArc=function(a,b,c,d,e,f){var g=Math.cos(f),h=Math.sin(f),i={x:c*Math.cos(e),y:d*Math.sin(e)};return{x:a+(i.x*g-i.y*h),y:b+(i.x*h+i.y*g)}},Kinetic.Path.parsePathData=function(a){if(!a)return[];var b=a,c=["m","M","l","L","v","V","h","H","z","Z","c","C","q","Q","t","T","s","S","a","A"];b=b.replace(new RegExp(" ","g"),",");for(var d=0;d<c.length;d++)b=b.replace(new RegExp(c[d],"g"),"|"+c[d]);for(var e=b.split("|"),f=[],g=0,h=0,d=1;d<e.length;d++){var i=e[d],j=i.charAt(0);i=i.slice(1),i=i.replace(new RegExp(",-","g"),"-"),i=i.replace(new RegExp("-","g"),",-"),i=i.replace(new RegExp("e,-","g"),"e-");var k=i.split(",");k.length>0&&""===k[0]&&k.shift();for(var l=0;l<k.length;l++)k[l]=parseFloat(k[l]);for(;k.length>0&&!isNaN(k[0]);){var m=null,n=[],o=g,p=h;switch(j){case"l":g+=k.shift(),h+=k.shift(),m="L",n.push(g,h);break;case"L":g=k.shift(),h=k.shift(),n.push(g,h);break;case"m":g+=k.shift(),h+=k.shift(),m="M",n.push(g,h),j="l";break;case"M":g=k.shift(),h=k.shift(),m="M",n.push(g,h),j="L";break;case"h":g+=k.shift(),m="L",n.push(g,h);break;case"H":g=k.shift(),m="L",n.push(g,h);break;case"v":h+=k.shift(),m="L",n.push(g,h);break;case"V":h=k.shift(),m="L",n.push(g,h);break;case"C":n.push(k.shift(),k.shift(),k.shift(),k.shift()),g=k.shift(),h=k.shift(),n.push(g,h);break;case"c":n.push(g+k.shift(),h+k.shift(),g+k.shift(),h+k.shift()),g+=k.shift(),h+=k.shift(),m="C",n.push(g,h);break;case"S":var q=g,r=h,s=f[f.length-1];"C"===s.command&&(q=g+(g-s.points[2]),r=h+(h-s.points[3])),n.push(q,r,k.shift(),k.shift()),g=k.shift(),h=k.shift(),m="C",n.push(g,h);break;case"s":var q=g,r=h,s=f[f.length-1];"C"===s.command&&(q=g+(g-s.points[2]),r=h+(h-s.points[3])),n.push(q,r,g+k.shift(),h+k.shift()),g+=k.shift(),h+=k.shift(),m="C",n.push(g,h);break;case"Q":n.push(k.shift(),k.shift()),g=k.shift(),h=k.shift(),n.push(g,h);break;case"q":n.push(g+k.shift(),h+k.shift()),g+=k.shift(),h+=k.shift(),m="Q",n.push(g,h);break;case"T":var q=g,r=h,s=f[f.length-1];"Q"===s.command&&(q=g+(g-s.points[0]),r=h+(h-s.points[1])),g=k.shift(),h=k.shift(),m="Q",n.push(q,r,g,h);break;case"t":var q=g,r=h,s=f[f.length-1];"Q"===s.command&&(q=g+(g-s.points[0]),r=h+(h-s.points[1])),g+=k.shift(),h+=k.shift(),m="Q",n.push(q,r,g,h);break;case"A":var t=k.shift(),u=k.shift(),v=k.shift(),w=k.shift(),x=k.shift(),y=g,z=h;g=k.shift(),h=k.shift(),m="A",n=this.convertEndpointToCenterParameterization(y,z,g,h,w,x,t,u,v);break;case"a":var t=k.shift(),u=k.shift(),v=k.shift(),w=k.shift(),x=k.shift(),y=g,z=h;g+=k.shift(),h+=k.shift(),m="A",n=this.convertEndpointToCenterParameterization(y,z,g,h,w,x,t,u,v)}f.push({command:m||j,points:n,start:{x:o,y:p},pathLength:this.calcLength(o,p,m||j,n)})}("z"===j||"Z"===j)&&f.push({command:"z",points:[],start:void 0,pathLength:0})}return f},Kinetic.Path.calcLength=function(a,b,c,d){var e,f,g,h=Kinetic.Path;switch(c){case"L":return h.getLineLength(a,b,d[0],d[1]);case"C":for(e=0,f=h.getPointOnCubicBezier(0,a,b,d[0],d[1],d[2],d[3],d[4],d[5]),t=.01;1>=t;t+=.01)g=h.getPointOnCubicBezier(t,a,b,d[0],d[1],d[2],d[3],d[4],d[5]),e+=h.getLineLength(f.x,f.y,g.x,g.y),f=g;return e;case"Q":for(e=0,f=h.getPointOnQuadraticBezier(0,a,b,d[0],d[1],d[2],d[3]),t=.01;1>=t;t+=.01)g=h.getPointOnQuadraticBezier(t,a,b,d[0],d[1],d[2],d[3]),e+=h.getLineLength(f.x,f.y,g.x,g.y),f=g;return e;case"A":e=0;var i=d[4],j=d[5],k=d[4]+j,l=Math.PI/180;if(Math.abs(i-k)<l&&(l=Math.abs(i-k)),f=h.getPointOnEllipticalArc(d[0],d[1],d[2],d[3],i,0),0>j)for(t=i-l;t>k;t-=l)g=h.getPointOnEllipticalArc(d[0],d[1],d[2],d[3],t,0),e+=h.getLineLength(f.x,f.y,g.x,g.y),f=g;else for(t=i+l;k>t;t+=l)g=h.getPointOnEllipticalArc(d[0],d[1],d[2],d[3],t,0),e+=h.getLineLength(f.x,f.y,g.x,g.y),f=g;return g=h.getPointOnEllipticalArc(d[0],d[1],d[2],d[3],k,0),e+=h.getLineLength(f.x,f.y,g.x,g.y)}return 0},Kinetic.Path.convertEndpointToCenterParameterization=function(a,b,c,d,e,f,g,h,i){var j=i*(Math.PI/180),k=Math.cos(j)*(a-c)/2+Math.sin(j)*(b-d)/2,l=-1*Math.sin(j)*(a-c)/2+Math.cos(j)*(b-d)/2,m=k*k/(g*g)+l*l/(h*h);m>1&&(g*=Math.sqrt(m),h*=Math.sqrt(m));var n=Math.sqrt((g*g*h*h-g*g*l*l-h*h*k*k)/(g*g*l*l+h*h*k*k));e==f&&(n*=-1),isNaN(n)&&(n=0);var o=n*g*l/h,p=n*-h*k/g,q=(a+c)/2+Math.cos(j)*o-Math.sin(j)*p,r=(b+d)/2+Math.sin(j)*o+Math.cos(j)*p,s=function(a){return Math.sqrt(a[0]*a[0]+a[1]*a[1])},t=function(a,b){return(a[0]*b[0]+a[1]*b[1])/(s(a)*s(b))},u=function(a,b){return(a[0]*b[1]<a[1]*b[0]?-1:1)*Math.acos(t(a,b))},v=u([1,0],[(k-o)/g,(l-p)/h]),w=[(k-o)/g,(l-p)/h],x=[(-1*k-o)/g,(-1*l-p)/h],y=u(w,x);return t(w,x)<=-1&&(y=Math.PI),t(w,x)>=1&&(y=0),0===f&&y>0&&(y-=2*Math.PI),1==f&&0>y&&(y+=2*Math.PI),[q,r,g,h,v,y,j,f]},Kinetic.Node.addGetterSetter(Kinetic.Path,"data")}(),function(){function a(a){a.fillText(this.partialText,0,0)}function b(a){a.strokeText(this.partialText,0,0)}var c="",d="Calibri",e="normal";Kinetic.TextPath=function(a){this._initTextPath(a)},Kinetic.TextPath.prototype={_initTextPath:function(c){var d=this;this.createAttrs(),this.dummyCanvas=document.createElement("canvas"),this.dataArray=[],Kinetic.Shape.call(this,c),this._fillFunc=a,this._strokeFunc=b,this.className="TextPath",this._setDrawFuncs(),this.dataArray=Kinetic.Path.parsePathData(this.attrs.data),this.on("dataChange",function(){d.dataArray=Kinetic.Path.parsePathData(this.attrs.data)});for(var e=["text","textStroke","textStrokeWidth"],f=0;f<e.length;f++){var g=e[f];this.on(g+"Change",d._setTextData)}d._setTextData()},drawFunc:function(a){var b=(this.charArr,a.getContext());b.font=this._getContextFont(),b.textBaseline="middle",b.textAlign="left",b.save();for(var c=this.glyphInfo,d=0;d<c.length;d++){b.save();var e=c[d].p0;c[d].p1,parseFloat(this.attrs.fontSize),b.translate(e.x,e.y),b.rotate(c[d].rotation),this.partialText=c[d].text,a.fillStroke(this),b.restore()}b.restore()},getTextWidth:function(){return this.textWidth},getTextHeight:function(){return this.textHeight},setText:function(a){Kinetic.Text.prototype.setText.call(this,a)},_getTextSize:function(a){var b=this.dummyCanvas,c=b.getContext("2d");c.save(),c.font=this._getContextFont();var d=c.measureText(a);return c.restore(),{width:d.width,height:parseInt(this.attrs.fontSize,10)}},_setTextData:function(){var a=this,b=this._getTextSize(this.attrs.text);this.textWidth=b.width,this.textHeight=b.height,this.glyphInfo=[];for(var c,d,e,f=this.attrs.text.split(""),g=-1,h=0,i=function(){h=0;for(var b=a.dataArray,d=g+1;d<b.length;d++){if(b[d].pathLength>0)return g=d,b[d];"M"==b[d].command&&(c={x:b[d].points[0],y:b[d].points[1]})}return{}},j=function(b){var f=a._getTextSize(b).width,g=0,j=0;for(d=void 0;Math.abs(f-g)/f>.01&&25>j;){j++;for(var k=g;void 0===e;)e=i(),e&&k+e.pathLength<f&&(k+=e.pathLength,e=void 0);if(e==={}||void 0===c)return void 0;var l=!1;switch(e.command){case"L":Kinetic.Path.getLineLength(c.x,c.y,e.points[0],e.points[1])>f?d=Kinetic.Path.getPointOnLine(f,c.x,c.y,e.points[0],e.points[1],c.x,c.y):e=void 0;break;case"A":var m=e.points[4],n=e.points[5],o=e.points[4]+n;0===h?h=m+1e-8:f>g?h+=Math.PI/180*n/Math.abs(n):h-=Math.PI/360*n/Math.abs(n),Math.abs(h)>Math.abs(o)&&(h=o,l=!0),d=Kinetic.Path.getPointOnEllipticalArc(e.points[0],e.points[1],e.points[2],e.points[3],h,e.points[6]);break;case"C":0===h?h=f>e.pathLength?1e-8:f/e.pathLength:f>g?h+=(f-g)/e.pathLength:h-=(g-f)/e.pathLength,h>1&&(h=1,l=!0),d=Kinetic.Path.getPointOnCubicBezier(h,e.start.x,e.start.y,e.points[0],e.points[1],e.points[2],e.points[3],e.points[4],e.points[5]);break;case"Q":0===h?h=f/e.pathLength:f>g?h+=(f-g)/e.pathLength:h-=(g-f)/e.pathLength,h>1&&(h=1,l=!0),d=Kinetic.Path.getPointOnQuadraticBezier(h,e.start.x,e.start.y,e.points[0],e.points[1],e.points[2],e.points[3])}void 0!==d&&(g=Kinetic.Path.getLineLength(c.x,c.y,d.x,d.y)),l&&(l=!1,e=void 0)}},k=0;k<f.length&&(j(f[k]),void 0!==c&&void 0!==d);k++){var l=Kinetic.Path.getLineLength(c.x,c.y,d.x,d.y),m=0,n=Kinetic.Path.getPointOnLine(m+l/2,c.x,c.y,d.x,d.y),o=Math.atan2(d.y-c.y,d.x-c.x);this.glyphInfo.push({transposeX:n.x,transposeY:n.y,text:f[k],rotation:o,p0:c,p1:d}),c=d}}},Kinetic.TextPath.prototype._getContextFont=Kinetic.Text.prototype._getContextFont,Kinetic.Util.extend(Kinetic.TextPath,Kinetic.Shape),Kinetic.Node.addGetterSetter(Kinetic.TextPath,"fontFamily",d),Kinetic.Node.addGetterSetter(Kinetic.TextPath,"fontSize",12),Kinetic.Node.addGetterSetter(Kinetic.TextPath,"fontStyle",e),Kinetic.Node.addGetter(Kinetic.TextPath,"text",c)}(),function(){Kinetic.RegularPolygon=function(a){this._initRegularPolygon(a)},Kinetic.RegularPolygon.prototype={_initRegularPolygon:function(a){this.createAttrs(),Kinetic.Shape.call(this,a),this.className="RegularPolygon",this._setDrawFuncs()},drawFunc:function(a){var b,c,d,e=a.getContext(),f=this.attrs.sides,g=this.attrs.radius;for(e.beginPath(),e.moveTo(0,0-g),b=1;f>b;b++)c=g*Math.sin(2*b*Math.PI/f),d=-1*g*Math.cos(2*b*Math.PI/f),e.lineTo(c,d);e.closePath(),a.fillStroke(this)}},Kinetic.Util.extend(Kinetic.RegularPolygon,Kinetic.Shape),Kinetic.Node.addGetterSetter(Kinetic.RegularPolygon,"radius",0),Kinetic.Node.addGetterSetter(Kinetic.RegularPolygon,"sides",0)}(),function(){Kinetic.Star=function(a){this._initStar(a)},Kinetic.Star.prototype={_initStar:function(a){this.createAttrs(),Kinetic.Shape.call(this,a),this.className="Star",this._setDrawFuncs()},drawFunc:function(a){var b=a.getContext(),c=this.attrs.innerRadius,d=this.attrs.outerRadius,e=this.attrs.numPoints;b.beginPath(),b.moveTo(0,0-this.attrs.outerRadius);for(var f=1;2*e>f;f++){var g=0===f%2?d:c,h=g*Math.sin(f*Math.PI/e),i=-1*g*Math.cos(f*Math.PI/e);b.lineTo(h,i)}b.closePath(),a.fillStroke(this)}},Kinetic.Util.extend(Kinetic.Star,Kinetic.Shape),Kinetic.Node.addGetterSetter(Kinetic.Star,"numPoints",0),Kinetic.Node.addGetterSetter(Kinetic.Star,"innerRadius",0),Kinetic.Node.addGetterSetter(Kinetic.Star,"outerRadius",0)}(),function(){var a=["fontFamily","fontSize","fontStyle","padding","lineHeight","text"],b="Change.kinetic",c="none",d="up",e="right",f="down",g="left",h="Label",i=a.length;Kinetic.Label=function(a){this._initLabel(a)},Kinetic.Label.prototype={_initLabel:function(a){var b=this;this.createAttrs(),this.className=h,Kinetic.Group.call(this,a),this.on("add",function(a){b._addListeners(a.child),b._sync()})},getText:function(){return this.get("Text")[0]},getTag:function(){return this.get("Tag")[0]},_addListeners:function(c){var d,e=this;for(d=0;i>d;d++)c.on(a[d]+b,function(){e._sync()})},getWidth:function(){return this.getText().getWidth()},getHeight:function(){return this.getText().getHeight()},_sync:function(){var a,b,c,h,i,j,k=this.getText(),l=this.getTag();if(k&&l){switch(a=k.getWidth(),b=k.getHeight(),c=l.getPointerDirection(),h=l.getPointerWidth(),pointerHeight=l.getPointerHeight(),i=0,j=0,c){case d:i=a/2,j=-1*pointerHeight;break;case e:i=a+h,j=b/2;break;case f:i=a/2,j=b+pointerHeight;break;case g:i=-1*h,j=b/2}l.setAttrs({x:-1*i,y:-1*j,width:a,height:b}),k.setAttrs({x:-1*i,y:-1*j})}}},Kinetic.Util.extend(Kinetic.Label,Kinetic.Group),Kinetic.Tag=function(a){this._initTag(a)},Kinetic.Tag.prototype={_initTag:function(a){this.createAttrs(),Kinetic.Shape.call(this,a),this.className="Tag",this._setDrawFuncs()},drawFunc:function(a){var b=a.getContext(),c=this.getWidth(),h=this.getHeight(),i=this.getPointerDirection(),j=this.getPointerWidth(),k=this.getPointerHeight();this.getCornerRadius(),b.beginPath(),b.moveTo(0,0),i===d&&(b.lineTo((c-j)/2,0),b.lineTo(c/2,-1*k),b.lineTo((c+j)/2,0)),b.lineTo(c,0),i===e&&(b.lineTo(c,(h-k)/2),b.lineTo(c+j,h/2),b.lineTo(c,(h+k)/2)),b.lineTo(c,h),i===f&&(b.lineTo((c+j)/2,h),b.lineTo(c/2,h+k),b.lineTo((c-j)/2,h)),b.lineTo(0,h),i===g&&(b.lineTo(0,(h+k)/2),b.lineTo(-1*j,h/2),b.lineTo(0,(h-k)/2)),b.closePath(),a.fillStroke(this)}},Kinetic.Util.extend(Kinetic.Tag,Kinetic.Shape),Kinetic.Node.addGetterSetter(Kinetic.Tag,"pointerDirection",c),Kinetic.Node.addGetterSetter(Kinetic.Tag,"pointerWidth",0),Kinetic.Node.addGetterSetter(Kinetic.Tag,"pointerHeight",0),Kinetic.Node.addGetterSetter(Kinetic.Tag,"cornerRadius",0)}(),function(){Kinetic.Filters.Grayscale=function(a){for(var b=a.data,c=0;c<b.length;c+=4){var d=.34*b[c]+.5*b[c+1]+.16*b[c+2];b[c]=d,b[c+1]=d,b[c+2]=d}}}(),function(){Kinetic.Filters.Brighten=function(a){for(var b=this.getFilterBrightness(),c=a.data,d=0;d<c.length;d+=4)c[d]+=b,c[d+1]+=b,c[d+2]+=b},Kinetic.Node.addFilterGetterSetter(Kinetic.Image,"filterBrightness",0)}(),function(){Kinetic.Filters.Invert=function(a){for(var b=a.data,c=0;c<b.length;c+=4)b[c]=255-b[c],b[c+1]=255-b[c+1],b[c+2]=255-b[c+2]}}(),function(){function a(){this.r=0,this.g=0,this.b=0,this.a=0,this.next=null}function b(b,e){var f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D=b.data,E=b.width,F=b.height,G=e+e+1,H=E-1,I=F-1,J=e+1,K=J*(J+1)/2,L=new a,M=L,N=null,O=null,P=c[e],Q=d[e];for(h=1;G>h;h++)if(M=M.next=new a,h==J)var R=M;for(M.next=L,l=k=0,g=0;F>g;g++){for(u=v=w=x=m=n=o=p=0,q=J*(y=D[k]),r=J*(z=D[k+1]),s=J*(A=D[k+2]),t=J*(B=D[k+3]),m+=K*y,n+=K*z,o+=K*A,p+=K*B,M=L,h=0;J>h;h++)M.r=y,M.g=z,M.b=A,M.a=B,M=M.next;for(h=1;J>h;h++)i=k+((h>H?H:h)<<2),m+=(M.r=y=D[i])*(C=J-h),n+=(M.g=z=D[i+1])*C,o+=(M.b=A=D[i+2])*C,p+=(M.a=B=D[i+3])*C,u+=y,v+=z,w+=A,x+=B,M=M.next;for(N=L,O=R,f=0;E>f;f++)D[k+3]=B=p*P>>Q,0!=B?(B=255/B,D[k]=(m*P>>Q)*B,D[k+1]=(n*P>>Q)*B,D[k+2]=(o*P>>Q)*B):D[k]=D[k+1]=D[k+2]=0,m-=q,n-=r,o-=s,p-=t,q-=N.r,r-=N.g,s-=N.b,t-=N.a,i=l+((i=f+e+1)<H?i:H)<<2,u+=N.r=D[i],v+=N.g=D[i+1],w+=N.b=D[i+2],x+=N.a=D[i+3],m+=u,n+=v,o+=w,p+=x,N=N.next,q+=y=O.r,r+=z=O.g,s+=A=O.b,t+=B=O.a,u-=y,v-=z,w-=A,x-=B,O=O.next,k+=4;l+=E}for(f=0;E>f;f++){for(v=w=x=u=n=o=p=m=0,k=f<<2,q=J*(y=D[k]),r=J*(z=D[k+1]),s=J*(A=D[k+2]),t=J*(B=D[k+3]),m+=K*y,n+=K*z,o+=K*A,p+=K*B,M=L,h=0;J>h;h++)M.r=y,M.g=z,M.b=A,M.a=B,M=M.next;for(j=E,h=1;e>=h;h++)k=j+f<<2,m+=(M.r=y=D[k])*(C=J-h),n+=(M.g=z=D[k+1])*C,o+=(M.b=A=D[k+2])*C,p+=(M.a=B=D[k+3])*C,u+=y,v+=z,w+=A,x+=B,M=M.next,I>h&&(j+=E);for(k=f,N=L,O=R,g=0;F>g;g++)i=k<<2,D[i+3]=B=p*P>>Q,B>0?(B=255/B,D[i]=(m*P>>Q)*B,D[i+1]=(n*P>>Q)*B,D[i+2]=(o*P>>Q)*B):D[i]=D[i+1]=D[i+2]=0,m-=q,n-=r,o-=s,p-=t,q-=N.r,r-=N.g,s-=N.b,t-=N.a,i=f+((i=g+J)<I?i:I)*E<<2,m+=u+=N.r=D[i],n+=v+=N.g=D[i+1],o+=w+=N.b=D[i+2],p+=x+=N.a=D[i+3],N=N.next,q+=y=O.r,r+=z=O.g,s+=A=O.b,t+=B=O.a,u-=y,v-=z,w-=A,x-=B,O=O.next,k+=E}}var c=[512,512,456,512,328,456,335,512,405,328,271,456,388,335,292,512,454,405,364,328,298,271,496,456,420,388,360,335,312,292,273,512,482,454,428,405,383,364,345,328,312,298,284,271,259,496,475,456,437,420,404,388,374,360,347,335,323,312,302,292,282,273,265,512,497,482,468,454,441,428,417,405,394,383,373,364,354,345,337,328,320,312,305,298,291,284,278,271,265,259,507,496,485,475,465,456,446,437,428,420,412,404,396,388,381,374,367,360,354,347,341,335,329,323,318,312,307,302,297,292,287,282,278,273,269,265,261,512,505,497,489,482,475,468,461,454,447,441,435,428,422,417,411,405,399,394,389,383,378,373,368,364,359,354,350,345,341,337,332,328,324,320,316,312,309,305,301,298,294,291,287,284,281,278,274,271,268,265,262,259,257,507,501,496,491,485,480,475,470,465,460,456,451,446,442,437,433,428,424,420,416,412,408,404,400,396,392,388,385,381,377,374,370,367,363,360,357,354,350,347,344,341,338,335,332,329,326,323,320,318,315,312,310,307,304,302,299,297,294,292,289,287,285,282,280,278,275,273,271,269,267,265,263,261,259],d=[9,11,12,13,13,14,14,15,15,15,15,16,16,16,16,17,17,17,17,17,17,17,18,18,18,18,18,18,18,18,18,19,19,19,19,19,19,19,19,19,19,19,19,19,19,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24];Kinetic.Filters.Blur=function(a){var c=0|this.getFilterRadius();c>0&&b(a,c)},Kinetic.Node.addFilterGetterSetter(Kinetic.Image,"filterRadius",0)}(),function(){function a(a,b,c){var d=4*(c*a.width+b),e=[];return e.push(a.data[d++],a.data[d++],a.data[d++],a.data[d++]),e}function b(a,b){return Math.sqrt(Math.pow(a[0]-b[0],2)+Math.pow(a[1]-b[1],2)+Math.pow(a[2]-b[2],2))}function c(a){for(var b=[0,0,0],c=0;c<a.length;c++)b[0]+=a[c][0],b[1]+=a[c][1],b[2]+=a[c][2];return b[0]/=a.length,b[1]/=a.length,b[2]/=a.length,b}function d(d,e){var f=a(d,0,0),g=a(d,d.width-1,0),h=a(d,0,d.height-1),i=a(d,d.width-1,d.height-1),j=e||10;if(b(f,g)<j&&b(g,i)<j&&b(i,h)<j&&b(h,f)<j){for(var k=c([g,f,i,h]),l=[],m=0;m<d.width*d.height;m++){var n=b(k,[d.data[4*m],d.data[4*m+1],d.data[4*m+2]]);l[m]=j>n?0:255}return l}}function e(a,b){for(var c=0;c<a.width*a.height;c++)a.data[4*c+3]=b[c]}function f(a,b,c){for(var d=[1,1,1,1,0,1,1,1,1],e=Math.round(Math.sqrt(d.length)),f=Math.floor(e/2),g=[],h=0;c>h;h++)for(var i=0;b>i;i++){for(var j=h*b+i,k=0,l=0;e>l;l++)for(var m=0;e>m;m++){var n=h+l-f,o=i+m-f;if(n>=0&&c>n&&o>=0&&b>o){var p=n*b+o,q=d[l*e+m];k+=a[p]*q}}g[j]=2040===k?255:0}return g}function g(a,b,c){for(var d=[1,1,1,1,1,1,1,1,1],e=Math.round(Math.sqrt(d.length)),f=Math.floor(e/2),g=[],h=0;c>h;h++)for(var i=0;b>i;i++){for(var j=h*b+i,k=0,l=0;e>l;l++)for(var m=0;e>m;m++){var n=h+l-f,o=i+m-f;if(n>=0&&c>n&&o>=0&&b>o){var p=n*b+o,q=d[l*e+m];k+=a[p]*q}}g[j]=k>=1020?255:0}return g}function h(a,b,c){for(var d=[1/9,1/9,1/9,1/9,1/9,1/9,1/9,1/9,1/9],e=Math.round(Math.sqrt(d.length)),f=Math.floor(e/2),g=[],h=0;c>h;h++)for(var i=0;b>i;i++){for(var j=h*b+i,k=0,l=0;e>l;l++)for(var m=0;e>m;m++){var n=h+l-f,o=i+m-f;if(n>=0&&c>n&&o>=0&&b>o){var p=n*b+o,q=d[l*e+m];k+=a[p]*q}}g[j]=k}return g}Kinetic.Filters.Mask=function(a){var b=this.getFilterThreshold(),c=d(a,b);return c&&(c=f(c,a.width,a.height),c=g(c,a.width,a.height),c=h(c,a.width,a.height),e(a,c)),a},Kinetic.Node.addFilterGetterSetter(Kinetic.Image,"filterThreshold",0)}();
|
package.xml
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>auguriaInteractiveImage</name>
|
4 |
+
<version>0.0.1</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license uri="http://opensource.org/licenses/gpl-license.php">GNU General Public License</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>This extension allow you to display an image on a product page. Areas will be defined et linked to another products.</summary>
|
10 |
+
<description>Handled by the extension
|
11 |
+

|
12 |
+
Possibility to define an image by product.
|
13 |
+
The areas are manageable by product.
|
14 |
+
Listing of the linked products associated to the areas.
|
15 |
+
Mass add for the listed products.
|
16 |
+
Tooltip hovering the areas.
|
17 |
+
Only list the "in stock" products.
|
18 |
+

|
19 |
+
Free Auguria_Core extension required.
|
20 |
+
</description>
|
21 |
+
<notes>First version of the extension. Free Auguria_Core extension required.</notes>
|
22 |
+
<authors><author><name>Auguria</name><user>auguria</user><email>magento@auguria.net</email></author></authors>
|
23 |
+
<date>2014-05-12</date>
|
24 |
+
<time>08:57:05</time>
|
25 |
+
<contents><target name="magecommunity"><dir name="Auguria"><dir name="InteractiveImage"><dir name="Block"><dir name="Adminhtml"><dir name="Catalog"><dir name="Product"><dir name="Helper"><dir name="Form"><dir name="Image"><dir name="Interactive"><dir name="Panel"><dir name="Area"><file name="Default.php" hash="27c20fcc58c34a619c76c7d9f3020238"/></dir><file name="Areas.php" hash="79d25988e2c8898ef472aa0abfe29728"/></dir><file name="Popin.php" hash="f311bc5eb2b7a1de5b85cd4cf90922dc"/></dir><file name="Interactive.php" hash="b00f872fae58bbe8eaaa17d1a479f495"/></dir></dir></dir></dir></dir></dir><dir name="Catalog"><dir name="Product"><file name="Image.php" hash="0ae00def32a8ff335dbc8ab21d0b6abb"/></dir></dir></dir><dir name="Helper"><file name="Config.php" hash="1b681b6bc6026d85612e71e92e7e231b"/><file name="Data.php" hash="f77d687f8f8394f380b0c49011aed92f"/></dir><dir name="Model"><dir name="Catalog"><dir name="Product"><dir name="Attribute"><dir name="Backend"><file name="Image.php" hash="d4626a456cf2bf891b6907ab29d16224"/></dir></dir></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><dir name="Auguria"><dir name="InteractiveImage"><file name="ImageController.php" hash="e2785e9df66cd2f18cd27b7a4591ee99"/></dir></dir></dir><dir name="Checkout"><dir name="Cart"><file name="AjaxController.php" hash="08e9986648018b25072b09855166b555"/></dir><file name="CartController.php" hash="03f0f24305a19f07001fe71853f58d81"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="5ec267e2e63459b3ec9eb7784ea9e4da"/><file name="config.xml" hash="3bdfc9be83229c8b7ff363b3fdd37016"/><file name="jstranslator.xml" hash="f85990cfdb8aac7ea10529c4b2dab0e6"/><file name="system.xml" hash="854e957398da36fd688cea794ab48fe8"/></dir><dir name="sql"><dir name="auguria_interactiveimage_setup"><file name="install-0.0.1.php" hash="42e8345c1826f45cb90a5a43d5ab3780"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="auguria"><dir name="interactiveimage"><dir name="catalog"><dir name="product"><dir name="helper"><dir name="form"><dir name="image"><dir name="interactive"><dir name="panel"><dir name="area"><file name="default.phtml" hash="747a1cb7a7e43dfb59abd38ee14afdd5"/></dir><file name="areas.phtml" hash="0ab8dccd7bbd5b4532f1d6eb46083459"/></dir><file name="popin.phtml" hash="fbdb832cdb9a769aaabe9e694a819dfc"/></dir></dir></dir></dir></dir></dir></dir></dir></dir><dir name="layout"><dir name="auguria"><file name="interactive_image.xml" hash="ef596e624796cc469f3660276d9a4233"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="auguria"><dir name="interactiveimage"><dir name="catalog"><dir name="product"><file name="image.phtml" hash="b248488043e9347baa20ee71504ce462"/></dir></dir></dir></dir></dir><dir name="layout"><dir name="auguria"><file name="interactive_image.xml" hash="6a51a87a692676a91bad0236a1965520"/></dir></dir></dir></dir></dir></target><target name="mage"><dir name="js"><dir name="auguria"><dir name="interactiveimage"><file name="cart.js" hash="724efb87a4b8fe5e5850921bc928e72d"/><file name="image.js" hash="5c64f22d0a98a0c77156378efd042da7"/><file name="jquery-1.10.2.min.js" hash="055b1c0c38f106959bdd3cee7e6b0136"/><file name="jquery.maphilight.min.js" hash="060990df8870589e0e629349f8fb3a4c"/><file name="kinetic-v4.5.4.min.js" hash="5d114c84e5926c19c8b1cee80ea79ce5"/></dir></dir></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="auguria"><dir name="interactiveimage"><file name="image.css" hash="47b0fbfecac78ae0b5a524cf85a5c515"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="css"><dir name="auguria"><dir name="interactiveimage"><file name="image.css" hash="4081440dcd4fa462f4d18b9ef76266ea"/></dir></dir></dir></dir></dir></dir></target><target name="magelocale"><dir name="en_US"><file name="Auguria_InteractiveImage.csv" hash="d41d8cd98f00b204e9800998ecf8427e"/></dir><dir name="fr_FR"><file name="Auguria_InteractiveImage.csv" hash="ca76a1aa121f73673b8fc16a6fcd7bc2"/></dir></target><target name="mageetc"><dir name="modules"><file name="Auguria_InteractiveImage.xml" hash="bd010178de76af694025d33e666e55b2"/></dir></target></contents>
|
26 |
+
<compatible/>
|
27 |
+
<dependencies><required><php><min>5.3.0</min><max>6.0.0</max></php></required></dependencies>
|
28 |
+
</package>
|
skin/adminhtml/default/default/auguria/interactiveimage/image.css
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<!--
|
2 |
+
/**
|
3 |
+
* @category Auguria
|
4 |
+
* @package Auguria_InteractiveImage
|
5 |
+
* @author Auguria
|
6 |
+
* @license http://opensource.org/licenses/gpl-3.0.html GNU General Public License version 3 (GPLv3)
|
7 |
+
*/
|
8 |
+
-->
|
9 |
+
#interactive-image-canvas, #interactive-image-panel {
|
10 |
+
float:left;
|
11 |
+
}
|
12 |
+
#interactive-image-panel {
|
13 |
+
border: 1px solid;
|
14 |
+
margin-left: 5px;
|
15 |
+
}
|
16 |
+
#interactive-image-panel fieldset {
|
17 |
+
margin: 10px 0;
|
18 |
+
}
|
19 |
+
fieldset.area label {
|
20 |
+
float: left;
|
21 |
+
margin: 2px 0;
|
22 |
+
}
|
23 |
+
fieldset.area.active {
|
24 |
+
background-color: #FFAC47;
|
25 |
+
}
|
skin/frontend/base/default/css/auguria/interactiveimage/image.css
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
.interactive-container {
|
2 |
+
overflow: auto;
|
3 |
+
}
|
4 |
+
.interactive-container .btn-cart {
|
5 |
+
float: right;
|
6 |
+
margin: 10px 0;
|
7 |
+
}
|
8 |
+
.interactive-container map {
|
9 |
+
position: relative;
|
10 |
+
}
|
11 |
+
.interactive-container .tooltip {
|
12 |
+
position: absolute;
|
13 |
+
background-color: #fff;
|
14 |
+
padding: 5px;
|
15 |
+
border: 1px solid #C4C6C8;
|
16 |
+
min-width: 50px;
|
17 |
+
}
|
18 |
+
.interactiveimage-product-list {
|
19 |
+
margin-top: 10px;
|
20 |
+
}
|